diff options
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r-- | src/mesa/main/shaderapi.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index f9106140770..571b35be58b 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -161,8 +161,7 @@ _mesa_free_shader_state(struct gl_context *ctx) _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram[i], NULL); } - _mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram, - NULL); + _mesa_reference_program(ctx, &ctx->Shader._CurrentFragmentProgram, NULL); _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL); /* Extended for ARB_separate_shader_objects */ @@ -1230,10 +1229,13 @@ use_shader_program(struct gl_context *ctx, gl_shader_stage stage, /* Empty for now. */ break; case MESA_SHADER_FRAGMENT: - if (*target == ctx->_Shader->_CurrentFragmentProgram) { - _mesa_reference_shader_program(ctx, - &ctx->_Shader->_CurrentFragmentProgram, - NULL); + if (*target != NULL && + ((*target)->_LinkedShaders[MESA_SHADER_FRAGMENT] && + (*target)->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program == + ctx->_Shader->_CurrentFragmentProgram)) { + _mesa_reference_program(ctx, + &ctx->_Shader->_CurrentFragmentProgram, + NULL); } break; } |