glsl: Require that indices into uniform block arrays be constants
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 22 Jan 2013 03:07:34 +0000 (22:07 -0500)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 25 Jan 2013 14:07:34 +0000 (09:07 -0500)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp

index 372ffde1b16b611c352f28eceee74b7186c8cd90..e2d7265a6a290774ab7499d0e7fbd37752dbf806 100644 (file)
@@ -1622,6 +1622,15 @@ ast_expression::hir(exec_list *instructions,
         }
       } else if (array->type->array_size() == 0) {
         _mesa_glsl_error(&loc, state, "unsized array index must be constant");
+      } else if (array->type->is_array()
+                 && array->type->fields.array->is_interface()) {
+         /* Page 46 in section 4.3.7 of the OpenGL ES 3.00 spec says:
+          *
+          *     "All indexes used to index a uniform block array must be
+          *     constant integral expressions."
+          */
+         _mesa_glsl_error(&loc, state,
+                          "uniform block array index must be constant");
       } else {
         if (array->type->is_array()) {
            /* whole_variable_referenced can return NULL if the array is a