From: Thomas Helland <thomashellan...@gmail.com> v1 -> v2: Correct indentation
Signed-off-by: Thomas Helland <thomashelland90 at gmail.com> Reviewed-by: Eric Anholt <eric at anholt.net> --- src/glsl/opt_algebraic.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index c179d53..67326c5 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -591,6 +591,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } else if (ir->operands[0]->equals(ir->operands[1])) { /* (a || a) == a */ return ir->operands[0]; + } else if ( (op_expr[0] && op_expr[0]->operation == ir_unop_logic_not && + ir->operands[1]->equals(op_expr[0]->operands[0])) || + /* !A || A == 1 */ + (op_expr[1] && op_expr[1]->operation == ir_unop_logic_not && + ir->operands[0]->equals(op_expr[1]->operands[0])) ) { + /* A || !A == 1 */ + ir_constant_data data; + + for (unsigned i = 0; i < 16; i++) + data.b[i] = true; + + return new(mem_ctx) ir_constant(ir->type, &data); } break; -- 2.0.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev