[Mesa-dev] [PATCH 01/12] glsl: Rewrite unrolled link_invalidate_variable_locations calls as a loop

Ian Romanick idr at freedesktop.org
Wed Mar 5 02:27:38 PST 2014


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/linker.cpp | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index f6b2661..3bf2789 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2303,17 +2303,10 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    }
 
    /* Mark all generic shader inputs and outputs as unpaired. */
-   if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) {
-      link_invalidate_variable_locations(
-            prog->_LinkedShaders[MESA_SHADER_VERTEX]->ir);
-   }
-   if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) {
-      link_invalidate_variable_locations(
-            prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->ir);
-   }
-   if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) {
-      link_invalidate_variable_locations(
-            prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir);
+   for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+      if (prog->_LinkedShaders[i] != NULL) {
+         link_invalidate_variable_locations(prog->_LinkedShaders[i]->ir);
+      }
    }
 
    /* FINISHME: The value of the max_attribute_index parameter is
-- 
1.8.1.4



More information about the mesa-dev mailing list