From 5854d4583c6e8885185e12a0636f77489a62e24c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 9 Aug 2010 21:22:17 -0700 Subject: glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1)) All the current HW backends transform subtract to adding the negation, so I haven't bothered peepholing it back out in Mesa IR. This allows some subtract of subtract to get removed in ir_algebraic. --- src/mesa/program/ir_to_mesa.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/program/ir_to_mesa.cpp') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 5a272ab88a..a9a6f977c0 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2570,6 +2570,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) do_mat_op_to_vec(shader->ir); do_mod_to_fract(shader->ir); do_div_to_mul_rcp(shader->ir); + do_sub_to_add_neg(shader->ir); /* Optimization passes */ bool progress; -- cgit v1.2.3