summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2015-02-23 22:56:47 -0800
committerKenneth Graunke <[email protected]>2015-02-24 15:24:52 -0800
commit926d8b05107f4f5fecad41ad30833a306a566303 (patch)
treef84e3cc93e1e54d53d29091283229cde888584e4
parent6f5604601cefb3c656e16a7b65102740861bee90 (diff)
glsl: Make ir_validate check the type of ir_discard::condition.
Copy and pasted from the ir_if::condition handling, plus a NULL check. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/glsl/ir_validate.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 66788948064..7a7688cb23b 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -61,6 +61,7 @@ public:
virtual ir_visitor_status visit(ir_variable *v);
virtual ir_visitor_status visit(ir_dereference_variable *ir);
+ virtual ir_visitor_status visit_enter(ir_discard *ir);
virtual ir_visitor_status visit_enter(ir_if *ir);
virtual ir_visitor_status visit_enter(ir_function *ir);
@@ -133,6 +134,20 @@ ir_validate::visit_enter(class ir_dereference_array *ir)
}
ir_visitor_status
+ir_validate::visit_enter(ir_discard *ir)
+{
+ if (ir->condition && ir->condition->type != glsl_type::bool_type) {
+ printf("ir_discard condition %s type instead of bool.\n",
+ ir->condition->type->name);
+ ir->print();
+ printf("\n");
+ abort();
+ }
+
+ return visit_continue;
+}
+
+ir_visitor_status
ir_validate::visit_enter(ir_if *ir)
{
if (ir->condition->type != glsl_type::bool_type) {