From 926d8b05107f4f5fecad41ad30833a306a566303 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 23 Feb 2015 22:56:47 -0800 Subject: [PATCH] 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 Reviewed-by: Ian Romanick Reviewed-by: Connor Abbott Reviewed-by: Matt Turner Reviewed-by: Eric Anholt --- src/glsl/ir_validate.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); @@ -132,6 +133,20 @@ ir_validate::visit_enter(class ir_dereference_array *ir) return visit_continue; } +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) { -- 2.30.2