From: Thomas Helland <thomashellan...@gmail.com> v1 -> v2: Corrected indentation.
Signed-off-by: Thomas Helland <thomashelland90 at gmail.com> Reviewed-by: Eric Anholt <eric at anholt.net> --- src/glsl/opt_algebraic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ac7514a..c179d53 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -439,6 +439,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) return neg(ir->operands[1]); if (is_vec_zero(op_const[1])) return ir->operands[0]; + /* X - X == 0 */ + if (ir->operands[0]->equals(ir->operands[1])) + return ir_constant::zero(ir, ir->type); break; case ir_binop_mul: -- 2.0.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev