summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2014-12-04 10:42:11 +0200
committerFrancisco Jerez <[email protected]>2015-05-04 17:44:16 +0300
commitf64edfdc44d955adfe3e99154559e7935a2efd45 (patch)
treec6c2a06e79df69ba2d618845fbd14f69755cd8af /src/glsl/ast_to_hir.cpp
parentb5854ee72b25078616f04b49004011036fef5a87 (diff)
glsl: Forbid opaque variables as operands of the ternary operator.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 18b82e3bec9..da063d5606b 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1558,6 +1558,18 @@ ast_expression::do_hir(exec_list *instructions,
error_emitted = true;
}
+ /* From section 4.1.7 of the GLSL 4.50 spec (Opaque Types):
+ *
+ * "Except for array indexing, structure member selection, and
+ * parentheses, opaque variables are not allowed to be operands in
+ * expressions; such use results in a compile-time error."
+ */
+ if (type->contains_opaque()) {
+ _mesa_glsl_error(&loc, state, "opaque variables cannot be operands "
+ "of the ?: operator");
+ error_emitted = true;
+ }
+
ir_constant *cond_val = op[0]->constant_expression_value();
if (then_instructions.is_empty()