We can use the intersection function to reduce the range even further if the operand has bounds between 0.0 and 1.0.
v2: Rewrite as suggested by Ian. Put in alphabetic order. --- src/glsl/opt_minmax.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp index ffdf203..8fee0aa 100644 --- a/src/glsl/opt_minmax.cpp +++ b/src/glsl/opt_minmax.cpp @@ -308,6 +308,11 @@ get_range(ir_rvalue *rval) low = new(mem_ctx) ir_constant(0.0f); return minmax_range(low, high); + case ir_unop_saturate: + r0 = minmax_range(new(mem_ctx) ir_constant(0.0f), + new(mem_ctx) ir_constant(1.0f)); + return range_intersection(get_range(expr->operands[0]), r0); + case ir_unop_sin: case ir_unop_sin_reduced: case ir_unop_cos: -- 2.2.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev