summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_array_index.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2015-08-17 01:21:01 +0300
committerFrancisco Jerez <currojerez@riseup.net>2015-08-20 12:26:54 +0300
commitebf1196d82eeed2f7863984ec33d26538a97b531 (patch)
tree2d6b7a980b9e71e8b7020b9f86b1380069f4c0b9 /src/glsl/ast_array_index.cpp
parent6c161405dc191f3d4083a48dfc033d4401b8055a (diff)
downloadexternal_mesa3d-ebf1196d82eeed2f7863984ec33d26538a97b531.zip
external_mesa3d-ebf1196d82eeed2f7863984ec33d26538a97b531.tar.gz
external_mesa3d-ebf1196d82eeed2f7863984ec33d26538a97b531.tar.bz2
glsl: Forbid non-constant image array indexing in GLSL ES 3.1.
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Diffstat (limited to 'src/glsl/ast_array_index.cpp')
-rw-r--r--src/glsl/ast_array_index.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index 27e84d1..ae399f0 100644
--- a/src/glsl/ast_array_index.cpp
+++ b/src/glsl/ast_array_index.cpp
@@ -290,6 +290,21 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
"1.30 and later");
}
}
+
+ /* From page 27 of the GLSL ES 3.1 specification:
+ *
+ * "When aggregated into arrays within a shader, images can only be
+ * indexed with a constant integral expression."
+ *
+ * On the other hand the desktop GL specification extension allows
+ * non-constant indexing of image arrays, but behavior is left undefined
+ * in cases where the indexing expression is not dynamically uniform.
+ */
+ if (state->es_shader && array->type->without_array()->is_image()) {
+ _mesa_glsl_error(&loc, state,
+ "image arrays indexed with non-constant "
+ "expressions are forbidden in GLSL ES.");
+ }
}
/* After performing all of the error checking, generate the IR for the