mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
glsl: optimize (0 cmp x + y) into (-x cmp y).
The optimization done by commit34ec1a24ddid not take it into account. Fixes: dEQP-GLES3.functional.shaders.random.all_features.fragment.20 Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org> (cherry picked from commitb43bbfa90a)
This commit is contained in:
parent
8c25b0f2d1
commit
b2e243f70c
1 changed files with 12 additions and 3 deletions
|
|
@ -578,9 +578,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
|
|||
if (!is_vec_zero(zero))
|
||||
continue;
|
||||
|
||||
return new(mem_ctx) ir_expression(ir->operation,
|
||||
add->operands[0],
|
||||
neg(add->operands[1]));
|
||||
/* Depending of the zero position we want to optimize
|
||||
* (0 cmp x+y) into (-x cmp y) or (x+y cmp 0) into (x cmp -y)
|
||||
*/
|
||||
if (add_pos == 1) {
|
||||
return new(mem_ctx) ir_expression(ir->operation,
|
||||
neg(add->operands[0]),
|
||||
add->operands[1]);
|
||||
} else {
|
||||
return new(mem_ctx) ir_expression(ir->operation,
|
||||
add->operands[0],
|
||||
neg(add->operands[1]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue