Mesa (master): glsl: Forbid opaque variables as operands of the ternary operator.
Francisco Jerez
currojerez at kemper.freedesktop.org
Mon May 4 15:40:22 UTC 2015
Module: Mesa
Branch: master
Commit: f64edfdc44d955adfe3e99154559e7935a2efd45
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f64edfdc44d955adfe3e99154559e7935a2efd45
Author: Francisco Jerez <currojerez at riseup.net>
Date: Thu Dec 4 10:42:11 2014 +0200
glsl: Forbid opaque variables as operands of the ternary operator.
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/glsl/ast_to_hir.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 18b82e3..da063d5 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()
More information about the mesa-commit
mailing list