diff options
author | Timothy Arceri <[email protected]> | 2016-11-11 11:45:55 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-11-19 09:35:58 +1100 |
commit | adb3a83c09c20babfa9f7f5b36bc61bbc36c9cb1 (patch) | |
tree | 02b6c2047b7fb6a8cbf9ec6f160cbf740666b1b3 /src/compiler/glsl | |
parent | c20564ae3ec2b5ac6bee23751d53a92b2dc09067 (diff) |
glsl: tidy up entries temporary
Here we just move initialisation of entries to where it is needed i.e.
outside the loop and after the continue checks.
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/link_uniforms.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 40347ac0777..8e411f7d58f 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -1130,6 +1130,10 @@ link_setup_uniform_remap_tables(struct gl_context *ctx, if (prog->UniformStorage[i].remap_location == UNMAPPED_UNIFORM_LOC) continue; + /* How many new entries for this uniform? */ + const unsigned entries = + MAX2(1, prog->UniformStorage[i].array_elements); + for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) { struct gl_linked_shader *sh = prog->_LinkedShaders[j]; if (!sh) @@ -1138,10 +1142,6 @@ link_setup_uniform_remap_tables(struct gl_context *ctx, if (!prog->UniformStorage[i].opaque[j].active) continue; - /* How many new entries for this uniform? */ - const unsigned entries = - MAX2(1, prog->UniformStorage[i].array_elements); - /* Set remap table entries point to correct gl_uniform_storage. */ for (unsigned k = 0; k < entries; k++) { unsigned element_loc = prog->UniformStorage[i].remap_location + k; @@ -1155,13 +1155,15 @@ link_setup_uniform_remap_tables(struct gl_context *ctx, /* reserve subroutine locations */ for (unsigned i = 0; i < prog->NumUniformStorage; i++) { - if (!prog->UniformStorage[i].type->is_subroutine()) continue; - const unsigned entries = MAX2(1, prog->UniformStorage[i].array_elements); if (prog->UniformStorage[i].remap_location != UNMAPPED_UNIFORM_LOC) continue; + + const unsigned entries = + MAX2(1, prog->UniformStorage[i].array_elements); + for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) { struct gl_linked_shader *sh = prog->_LinkedShaders[j]; if (!sh) |