glsl2: Disallow non-constant array indexing for unsized arrays.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 17 Jul 2010 01:28:44 +0000 (18:28 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 21 Jul 2010 00:13:17 +0000 (17:13 -0700)
Fixes piglit test unsized-array-non-const-index.vert.

src/glsl/ast_to_hir.cpp

index 98090d2b01b0c31b22a799c9c511e26ea2a0dc73..41371e75367831be831c010b2d09743787cf2de3 100644 (file)
@@ -1233,6 +1233,8 @@ ast_expression::hir(exec_list *instructions,
            if ((v != NULL) && (unsigned(idx) > v->max_array_access))
               v->max_array_access = idx;
         }
+      } else if (array->type->array_size() == 0) {
+        _mesa_glsl_error(&loc, state, "unsized array index must be constant");
       }
 
       if (error_emitted)