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/main/uniform_query.cpp | |
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/main/uniform_query.cpp')
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index f505986fcfc..d5a2d0f58bc 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -1163,27 +1163,22 @@ _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *pipeline) GLbitfield mask; GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; - struct gl_linked_shader *shader; unsigned active_samplers = 0; - const struct gl_shader_program **shProg = - (const struct gl_shader_program **) pipeline->CurrentProgram; + const struct gl_program **prog = + (const struct gl_program **) pipeline->CurrentProgram; memset(TexturesUsed, 0, sizeof(TexturesUsed)); for (unsigned idx = 0; idx < ARRAY_SIZE(pipeline->CurrentProgram); idx++) { - if (!shProg[idx]) + if (!prog[idx]) continue; - shader = shProg[idx]->_LinkedShaders[idx]; - if (!shader || !shader->Program) - continue; - - mask = shader->Program->SamplersUsed; + mask = prog[idx]->SamplersUsed; while (mask) { const int s = u_bit_scan(&mask); - GLuint unit = shader->Program->SamplerUnits[s]; - GLuint tgt = shader->Program->sh.SamplerTargets[s]; + GLuint unit = prog[idx]->SamplerUnits[s]; + GLuint tgt = prog[idx]->sh.SamplerTargets[s]; /* FIXME: Samplers are initialized to 0 and Mesa doesn't do a * great job of eliminating unused uniforms currently so for now @@ -1197,14 +1192,14 @@ _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *pipeline) ralloc_asprintf(pipeline, "Program %d: " "Texture unit %d is accessed with 2 different types", - shProg[idx]->Name, unit); + prog[idx]->Id, unit); return false; } TexturesUsed[unit] |= (1 << tgt); } - active_samplers += shader->Program->info.num_textures; + active_samplers += prog[idx]->info.num_textures; } if (active_samplers > MAX_COMBINED_TEXTURE_IMAGE_UNITS) { |