From: Eric Anholt Date: Thu, 22 Jul 2010 23:24:49 +0000 (-0700) Subject: glsl2: Validate that ir_if conditions are actually bool. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=432b787b29202301dbfc139c3289521b0bfc3dec;p=mesa.git glsl2: Validate that ir_if conditions are actually bool. --- 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)