diff options
author | Eric Anholt <[email protected]> | 2010-07-22 16:24:49 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-07-22 16:24:49 -0700 |
commit | 432b787b29202301dbfc139c3289521b0bfc3dec (patch) | |
tree | 5c6e1dafcd892fb7cbfa48d3eff468e97080f575 /src/glsl/ir_validate.cpp | |
parent | 85e93da18ca2c967ca12870b62ab1aac2f0b880c (diff) |
glsl2: Validate that ir_if conditions are actually bool.
Diffstat (limited to 'src/glsl/ir_validate.cpp')
-rw-r--r-- | src/glsl/ir_validate.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index c05edf2ee3d..bb381a00df3 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -59,6 +59,7 @@ public: virtual ir_visitor_status visit(ir_variable *v); virtual ir_visitor_status visit(ir_dereference_variable *ir); + virtual ir_visitor_status visit(ir_if *ir); virtual ir_visitor_status visit_enter(ir_function *ir); virtual ir_visitor_status visit_leave(ir_function *ir); @@ -93,6 +94,18 @@ ir_validate::visit(ir_dereference_variable *ir) return visit_continue; } +ir_visitor_status +ir_validate::visit(ir_if *ir) +{ + if (ir->condition->type != glsl_type::bool_type) { + printf("ir_if condition %s type instead of bool.\n", + ir->condition->type->name); + ir->print(); + printf("\n"); + abort(); + } +} + ir_visitor_status ir_validate::visit_enter(ir_function *ir) |