From: Ian Romanick <ian.d.roman...@intel.com>

Other parts of the code already caught things like 'float x[4][2]'.
However, nothing caught 'float [4] x[2]'.

Fixes piglit test array-multidimensional-new-syntax.vert.

Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
---
 src/glsl/ast_to_hir.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 70afb67..b08b443 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2476,6 +2476,18 @@ ast_declarator_list::hir(exec_list *instructions,
       }
 
       if (decl->is_array) {
+        /* From page 19 (page 25) of the GLSL 1.20 spec:
+         *
+         *     "Only one-dimensional arrays may be declared."
+         */
+        if (decl_type->is_array()) {
+           _mesa_glsl_error(& loc, state,
+                            "invalid array of `%s' in declaration of `%s'",
+                            decl_type->name,
+                            decl->identifier);
+           continue;
+        }
+
         var_type = process_array_type(&loc, decl_type, decl->array_size,
                                       state);
       } else {
-- 
1.7.6.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to