Commit fc2611d4 authored by Ivan Gyurdiev's avatar Ivan Gyurdiev Committed by Alexandre Julliard

wined3d: Only link and use GLSL program if at least one GLSL shader is available.

parent ea0a102d
...@@ -282,12 +282,6 @@ void set_glsl_shader_program(IWineD3DDevice *iface) { ...@@ -282,12 +282,6 @@ void set_glsl_shader_program(IWineD3DDevice *iface) {
struct list *ptr = NULL; struct list *ptr = NULL;
GLhandleARB programId = 0; GLhandleARB programId = 0;
if (NULL == vshader && NULL == pshader) {
/* No pixel or vertex shader specified */
This->stateBlock->shaderPrgId = 0;
return;
}
ptr = list_head( &This->glsl_shader_progs ); ptr = list_head( &This->glsl_shader_progs );
while (ptr) { while (ptr) {
/* At least one program exists - see if it matches our ps/vs combination */ /* At least one program exists - see if it matches our ps/vs combination */
......
...@@ -1926,13 +1926,18 @@ inline static void drawPrimitiveDrawStrided( ...@@ -1926,13 +1926,18 @@ inline static void drawPrimitiveDrawStrided(
useDrawStridedSlow = TRUE; useDrawStridedSlow = TRUE;
} }
/* Bind the correct GLSL shader program based on the currently set vertex & pixel shaders. */ /* If GLSL is used for either pixel or vertex shaders, make a GLSL program
if (wined3d_settings.vs_selected_mode == SHADER_GLSL || * Otherwise set 0, which restores fixed function */
if ((wined3d_settings.vs_selected_mode == SHADER_GLSL && useVertexShaderFunction) ||
(wined3d_settings.ps_selected_mode == SHADER_GLSL && usePixelShaderFunction))
set_glsl_shader_program(iface);
else
This->stateBlock->shaderPrgId = 0;
/* If GLSL is used now, or might have been used before, (re)set the program */
if (wined3d_settings.vs_selected_mode == SHADER_GLSL ||
wined3d_settings.ps_selected_mode == SHADER_GLSL) { wined3d_settings.ps_selected_mode == SHADER_GLSL) {
set_glsl_shader_program(iface);
/* Start using this program ID (if it's 0, there is no shader program to use, so
* glUseProgramObjectARB(0) will disable the use of any shaders) */
if (This->stateBlock->shaderPrgId) if (This->stateBlock->shaderPrgId)
TRACE_(d3d_shader)("Using GLSL program %u\n", This->stateBlock->shaderPrgId); TRACE_(d3d_shader)("Using GLSL program %u\n", This->stateBlock->shaderPrgId);
GL_EXTCALL(glUseProgramObjectARB(This->stateBlock->shaderPrgId)); GL_EXTCALL(glUseProgramObjectARB(This->stateBlock->shaderPrgId));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment