diff options
author | Gregory Hainaut <[email protected]> | 2013-05-03 19:44:11 +0200 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-03-25 10:25:25 -0700 |
commit | de4f85f52d0002cfd0105e932141cfdb108f1a61 (patch) | |
tree | 2fc83392269401c79e3fd327eda66ecdffb7976b /src | |
parent | c03477050a6f51e601f75cb3c061a3e16a5b7171 (diff) |
meta/sso: Update meta to save and restore SSO state.
save and restore _Shader/Pipeline binding point. Rational we don't want any
conflict when the program will be unattached.
V2: formatting improvement
V3 (idr):
* Build fix. The original patch added calls to _mesa_use_shader_program
with 4 parameters, but the fourth parameter isn't added to that
function until a much later patch. Just drop that parameter for now.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 0abdfb2cada..dbc6ab2a701 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -53,6 +53,7 @@ #include "main/mipmap.h" #include "main/multisample.h" #include "main/objectlabel.h" +#include "main/pipelineobj.h" #include "main/pixel.h" #include "main/pbo.h" #include "main/polygon.h" @@ -535,6 +536,14 @@ _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); + } + for (i = 0; i < MESA_SHADER_STAGES; i++) { _mesa_reference_shader_program(ctx, &save->Shader[i], ctx->_Shader->CurrentProgram[i]); @@ -880,6 +889,14 @@ _mesa_meta_end(struct gl_context *ctx) save->ATIFragmentShaderEnabled); } + /* 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); + } + if (ctx->Extensions.ARB_vertex_shader) { _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, save->Shader[MESA_SHADER_VERTEX]); @@ -899,6 +916,7 @@ _mesa_meta_end(struct gl_context *ctx) for (i = 0; i < MESA_SHADER_STAGES; i++) _mesa_reference_shader_program(ctx, &save->Shader[i], NULL); _mesa_reference_shader_program(ctx, &save->ActiveShader, NULL); + _mesa_reference_pipeline_object(ctx, &save->_Shader, NULL); } if (state & MESA_META_STENCIL_TEST) { diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index e2ccb939e8c..4faae0b4042 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -121,6 +121,8 @@ struct save_state GLboolean ATIFragmentShaderEnabled; struct gl_shader_program *Shader[MESA_SHADER_STAGES]; struct gl_shader_program *ActiveShader; + struct gl_pipeline_object *_Shader; + struct gl_pipeline_object *Pipeline; /** MESA_META_STENCIL_TEST */ struct gl_stencil_attrib Stencil; |