[Mesa-dev] [PATCH 31/34] glsl: Permit non-ubo input interface arrays to use non-const indexing.

Paul Berry stereotype441 at gmail.com
Sun Jul 28 23:03:57 PDT 2013


>From the GLSL ES 3.00 spec:

    "All indexes used to index a uniform block array must be constant
    integral expressions."

Similar text exists in GLSL specs since 1.50.

When we implemented this, the only type of interface block supported
by Mesa was uniform blocks, so we required all indexes used to index
any interface block to be constant integral expressions.

Now that we are adding interface block support for GLSL 1.50, we need
a more specific check.
---
 src/glsl/ast_array_index.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index 4baeb6f..51f6b10 100644
--- a/src/glsl/ast_array_index.cpp
+++ b/src/glsl/ast_array_index.cpp
@@ -117,7 +117,8 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
    } else if (const_index == NULL && array->type->is_array()) {
       if (array->type->array_size() == 0) {
 	 _mesa_glsl_error(&loc, state, "unsized array index must be constant");
-      } else if (array->type->fields.array->is_interface()) {
+      } else if (array->type->fields.array->is_interface()
+                 && array->variable_referenced()->mode == ir_var_uniform) {
 	 /* 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
-- 
1.8.3.4



More information about the mesa-dev mailing list