From f351613660acef68d67ba75a2bdae71c9898e0cb Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 29 Mar 2014 16:53:53 +0100 Subject: [PATCH] separate_shader_object: bug 76721 Currently the shader context (_Shader) is only saved when SSO extension is enabled. _Shader could potentially be corrupted if the extension is not enabled. Even if SSO is not supported, _Shader exists so it must be saved. --- src/mesa/drivers/common/meta.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index acf927b..e1ba9d0 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -536,13 +536,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, GL_FALSE); } - if (ctx->Extensions.ARB_separate_shader_objects) { - /* Warning it must be done before _mesa_UseProgram call */ - _mesa_reference_pipeline_object(ctx, &save->_Shader, ctx->_Shader); - _mesa_reference_pipeline_object(ctx, &save->Pipeline, - ctx->Pipeline.Current); - _mesa_BindProgramPipeline(0); - } + /* Warning it must be done before _mesa_UseProgram call */ + _mesa_reference_pipeline_object(ctx, &save->_Shader, ctx->_Shader); + _mesa_reference_pipeline_object(ctx, &save->Pipeline, + ctx->Pipeline.Current); + _mesa_BindProgramPipeline(0); for (i = 0; i < MESA_SHADER_STAGES; i++) { _mesa_reference_shader_program(ctx, &save->Shader[i], @@ -890,12 +888,10 @@ _mesa_meta_end(struct gl_context *ctx) } /* Warning it must be done before _mesa_use_shader_program call */ - if (ctx->Extensions.ARB_separate_shader_objects) { - _mesa_reference_pipeline_object(ctx, &ctx->_Shader, save->_Shader); - _mesa_reference_pipeline_object(ctx, &ctx->Pipeline.Current, - save->Pipeline); - _mesa_reference_pipeline_object(ctx, &save->Pipeline, NULL); - } + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, save->_Shader); + _mesa_reference_pipeline_object(ctx, &ctx->Pipeline.Current, + save->Pipeline); + _mesa_reference_pipeline_object(ctx, &save->Pipeline, NULL); if (ctx->Extensions.ARB_vertex_shader) { _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, -- 1.9.1