[Mesa-dev] [PATCH 11/16] glsl: Add ir_binop_pow to get_range
Bruno Jimenez
brunojimen at gmail.com
Mon Nov 17 06:48:26 PST 2014
On Mon, 2014-11-17 at 02:51 +0100, Thomas Helland wrote:
> 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))
^^^^^^
Hi,
I think that you meant 'less' here.
If not, sorry for the noise.
- Bruno
> + 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;
> }
More information about the mesa-dev
mailing list