[Mesa-dev] [PATCH 2/4] glsl: make array validation more robust

Timothy Arceri t_arceri at yahoo.com.au
Mon Feb 23 22:49:08 PST 2015


---
 src/glsl/linker.cpp | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ff62e32..6f1a009 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -704,14 +704,17 @@ validate_intrastage_arrays(struct gl_shader_program *prog,
          }
          existing->type = var->type;
          return true;
-      } else if (existing->type->length != 0 &&
-                 existing->type->length <= var->data.max_array_access) {
-         linker_error(prog, "%s `%s' declared as type "
-                      "`%s' but outermost dimension has an index"
-                      " of `%i'\n",
-                      mode_string(var),
-                      var->name, existing->type->name,
-                      var->data.max_array_access);
+      } else if (existing->type->length != 0) {
+         if(existing->type->length <= var->data.max_array_access) {
+            linker_error(prog, "%s `%s' declared as type "
+                         "`%s' but outermost dimension has an index"
+                         " of `%i'\n",
+                         mode_string(var),
+                         var->name, existing->type->name,
+                         var->data.max_array_access);
+         }
+         var->type = existing->type;
+         return true;
       }
    }
    return false;
-- 
2.1.0



More information about the mesa-dev mailing list