Signed-off-by: Elie Tournier <[email protected]>
---
src/compiler/glsl/lower_instructions.cpp | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/compiler/glsl/lower_instructions.cpp
b/src/compiler/glsl/lower_instructions.cpp
index 76dde68c23..c6c3a627d3 100644
--- a/src/compiler/glsl/lower_instructions.cpp
+++ b/src/compiler/glsl/lower_instructions.cpp
@@ -177,6 +177,7 @@ private:
void imul_high_to_mul(ir_expression *ir);
void sqrt_to_abs_sqrt(ir_expression *ir);
void min_to_less(ir_expression *ir);
+ void max_to_less(ir_expression *ir);
ir_expression *_carry(operand a, operand b);
};
@@ -1645,6 +1646,20 @@ lower_instructions_visitor::min_to_less(ir_expression
*ir)
this->progress = true;
}
+void
+lower_instructions_visitor::max_to_less(ir_expression *ir)
+{
+ ir_rvalue *x_clone = ir->operands[0]->clone(ir, NULL);
+ ir_rvalue *y_clone = ir->operands[1]->clone(ir, NULL);
+ ir->operation = ir_triop_csel;
+ ir->init_num_operands();
+ ir->operands[0] = less(ir->operands[0], ir->operands[1]);
+ ir->operands[1] = y_clone;
+ ir->operands[2] = x_clone;
+
+ this->progress = true;
+}
+
ir_visitor_status
lower_instructions_visitor::visit_leave(ir_expression *ir)
{
@@ -1794,6 +1809,12 @@ lower_instructions_visitor::visit_leave(ir_expression
*ir)
min_to_less(ir);
break;
+ case ir_binop_max:
+ if (lowering(MIN_MAX_TO_LESS) &&
+ ir->type->is_double() && ir->type->is_scalar())
+ max_to_less(ir);
+ break;
+
default:
return visit_continue;
}
--
2.14.1
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev