glsl: Rewrite unrolled link_invalidate_variable_locations calls as a loop
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 12 Feb 2014 00:37:56 +0000 (16:37 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 12 Mar 2014 18:16:50 +0000 (11:16 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/linker.cpp

index f6b26618552dd87c7054c457b00bac0f68b3cc78..3bf27896523c2dca7956a36ea1b5b230e09d28a1 100644 (file)
@@ -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