summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/link_uniforms.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-02 14:28:12 +1100
committerTimothy Arceri <[email protected]>2016-11-30 14:13:52 +1100
commit2ea021a1ebb768b13c533f6bea56cdfb4a9cc3b3 (patch)
tree7a747ac81ed0493583f97bce84a5398e41b6231e /src/compiler/glsl/link_uniforms.cpp
parent6d3458cbfbb4efb5a2ee33ad17e11f45163b6180 (diff)
glsl: use linked_shaders bitmask to iterate stages for subroutine fields
This should be faster than looping over every stage and null checking, but will also make the code a bit cleaner when we switch to getting more fields from gl_program rather than from gl_linked_shader as we can just copy the pointer and not need to worry about null checking then copying. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/glsl/link_uniforms.cpp')
-rw-r--r--src/compiler/glsl/link_uniforms.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index 66bcbda1336..dd6336e12da 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -1140,10 +1140,10 @@ link_setup_uniform_remap_tables(struct gl_context *ctx,
const unsigned entries =
MAX2(1, prog->data->UniformStorage[i].array_elements);
- for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
+ unsigned mask = prog->data->linked_stages;
+ while (mask) {
+ const int j = u_bit_scan(&mask);
struct gl_linked_shader *sh = prog->_LinkedShaders[j];
- if (!sh)
- continue;
if (!prog->data->UniformStorage[i].opaque[j].active)
continue;
@@ -1172,10 +1172,10 @@ link_setup_uniform_remap_tables(struct gl_context *ctx,
const unsigned entries =
MAX2(1, prog->data->UniformStorage[i].array_elements);
- for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
+ unsigned mask = prog->data->linked_stages;
+ while (mask) {
+ const int j = u_bit_scan(&mask);
struct gl_linked_shader *sh = prog->_LinkedShaders[j];
- if (!sh)
- continue;
if (!prog->data->UniformStorage[i].opaque[j].active)
continue;