diff options
author | Timothy Arceri <[email protected]> | 2016-10-31 22:39:17 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-01-23 14:48:04 +1100 |
commit | c505d6d852220f4aaaee161465dd2c579647e672 (patch) | |
tree | d77bf00e32a00b310fa09399974f5a51f99be073 /src/mesa/drivers/common | |
parent | 31daeb5bf14334bc0d39f28c9102cd15d834abfc (diff) |
mesa: use gl_program for CurrentProgram rather than gl_shader_program
This makes much more sense and should be more performant in some
critical paths such as SSO validation which is called at draw time.
Previously the CurrentProgram array could have contained multiple
pointers to the same struct which was confusing and we would often
need to fish out the information we were really after from the
gl_program anyway.
Also it was error prone to depend on the _LinkedShader array for
programs in current use because a failed linking attempt will lose
the infomation about the current program in use which is still
valid.
V2: fix validate_io() to compare linked_stages rather than the
consumer and producer to decide if we are looking at inward
facing shader interfaces which don't need validation.
Acked-by: Edward O'Callaghan <[email protected]>
To avoid build regressions the following 2 patches were squashed in to
this commit:
mesa/meta: rewrite _mesa_shader_program_use() and _mesa_program_use()
These are rewritten to do what the function name suggests, that is
_mesa_shader_program_use() sets the use of all stage and
_mesa_program_use() sets the use of a single stage.
Reviewed-by: Lionel Landwerlin <[email protected]>
Acked-by: Edward O'Callaghan <[email protected]>
mesa: update active relinked program
This likely fixes a subroutine bug were
_mesa_shader_program_init_subroutine_defaults() would never have been
called for the relinked program as we previously just set
_NEW_PROGRAM as dirty and never called the _mesa_use* functions when
linking.
Acked-by: Edward O'Callaghan <[email protected]>
Diffstat (limited to 'src/mesa/drivers/common')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 28 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 2 |
2 files changed, 9 insertions, 21 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 0d5661ba062..5b99c6baa52 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -167,7 +167,7 @@ _mesa_meta_use_program(struct gl_context *ctx, _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader); /* Update the program */ - _mesa_use_program(ctx, sh_prog); + _mesa_use_shader_program(ctx, sh_prog); } void @@ -594,8 +594,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) * that we don't have to worry about the current pipeline state. */ for (i = 0; i < MESA_SHADER_STAGES; i++) { - _mesa_reference_shader_program(ctx, &save->Shader[i], - ctx->Shader.CurrentProgram[i]); + _mesa_reference_program(ctx, &save->Program[i], + ctx->Shader.CurrentProgram[i]); } _mesa_reference_shader_program(ctx, &save->ActiveShader, ctx->Shader.ActiveProgram); @@ -931,16 +931,6 @@ _mesa_meta_end(struct gl_context *ctx) } if (state & MESA_META_SHADER) { - static const GLenum targets[] = { - GL_VERTEX_SHADER, - GL_TESS_CONTROL_SHADER, - GL_TESS_EVALUATION_SHADER, - GL_GEOMETRY_SHADER, - GL_FRAGMENT_SHADER, - GL_COMPUTE_SHADER, - }; - STATIC_ASSERT(MESA_SHADER_STAGES == ARRAY_SIZE(targets)); - bool any_shader; if (ctx->Extensions.ARB_vertex_program) { @@ -966,22 +956,20 @@ _mesa_meta_end(struct gl_context *ctx) any_shader = false; for (i = 0; i < MESA_SHADER_STAGES; i++) { - /* It is safe to call _mesa_use_shader_program even if the extension + /* It is safe to call _mesa_use_program even if the extension * necessary for that program state is not supported. In that case, * the saved program object must be NULL and the currently bound - * program object must be NULL. _mesa_use_shader_program is a no-op + * program object must be NULL. _mesa_use_program is a no-op * in that case. */ - _mesa_use_shader_program(ctx, targets[i], - save->Shader[i], - &ctx->Shader); + _mesa_use_program(ctx, i, save->Program[i], &ctx->Shader); /* Do this *before* killing the reference. :) */ - if (save->Shader[i] != NULL) + if (save->Program[i] != NULL) any_shader = true; - _mesa_reference_shader_program(ctx, &save->Shader[i], NULL); + _mesa_reference_program(ctx, &save->Program[i], NULL); } _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 0a913e9fa82..1b5cf42eb87 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -125,7 +125,7 @@ struct save_state GLboolean FragmentProgramEnabled; struct gl_program *FragmentProgram; GLboolean ATIFragmentShaderEnabled; - struct gl_shader_program *Shader[MESA_SHADER_STAGES]; + struct gl_program *Program[MESA_SHADER_STAGES]; struct gl_shader_program *ActiveShader; struct gl_pipeline_object *Pipeline; |