The spec states that pow is undefined for x < 0. Just set the range to correspond to a constant 0 if this is the case. --- src/glsl/opt_minmax.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp index 9852dd9..ad8c88a 100644 --- a/src/glsl/opt_minmax.cpp +++ b/src/glsl/opt_minmax.cpp @@ -335,6 +335,17 @@ get_range(ir_rvalue *rval) high = add(r0.high, r1.high)->constant_expression_value(); return minmax_range(low, high); + case ir_binop_pow: + r0 = get_range(expr->operands[0]); + if (is_greater_than_or_equal_zero(r0.low)) + low = new(mem_ctx) ir_constant(0.0f); + // Result is undefined so we can set the range to bikeshed. + if (is_less_than_zero(r0.high)) { + low = new(mem_ctx) ir_constant(0.0f); + high = new(mem_ctx) ir_constant(0.0f); + } + return minmax_range(low, high); + default: break; } -- 2.0.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev