summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2015-08-17 01:27:43 +0300
committerFrancisco Jerez <[email protected]>2015-08-20 12:28:27 +0300
commitee7bf349d865b18ca2827508fb947b7e549c7fc6 (patch)
tree75e33ea0822064ad1b128765eacea9168d03e38d /src/glsl/ast_to_hir.cpp
parent527ae5d4286e76fc2ec3d70f4b6cea3798539372 (diff)
glsl: Implement GLSL ES restriction on images being either readonly or writeonly.
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 4d279f6e946..ff57ec3a97d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2469,6 +2469,24 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
var->data.image_format = GL_NONE;
}
+
+ /* From page 70 of the GLSL ES 3.1 specification:
+ *
+ * "Except for image variables qualified with the format qualifiers
+ * r32f, r32i, and r32ui, image variables must specify either memory
+ * qualifier readonly or the memory qualifier writeonly."
+ */
+ if (state->es_shader &&
+ var->data.image_format != GL_R32F &&
+ var->data.image_format != GL_R32I &&
+ var->data.image_format != GL_R32UI &&
+ !var->data.image_read_only &&
+ !var->data.image_write_only) {
+ _mesa_glsl_error(loc, state, "image variables of format other than "
+ "r32f, r32i or r32ui must be qualified `readonly' or "
+ "`writeonly'");
+ }
+
} else if (qual->flags.q.read_only ||
qual->flags.q.write_only ||
qual->flags.q.coherent ||