[Mesa-dev] [PATCH 15/22] glsl: Add ir_triop_lrp to get_range

Matt Turner mattst88 at gmail.com
Sat Jan 3 12:55:19 PST 2015


On Sat, Jan 3, 2015 at 11:18 AM, Thomas Helland
<thomashelland90 at gmail.com> wrote:
> ---
>  src/glsl/opt_minmax.cpp | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
> index 8d63d96..f066b45 100644
> --- a/src/glsl/opt_minmax.cpp
> +++ b/src/glsl/opt_minmax.cpp
> @@ -457,6 +457,22 @@ get_range(ir_rvalue *rval)
>           // Get the range of the addition of op0*op1 and op2
>           return resolv_add_range(r0, r1);
>
> +      case ir_triop_lrp:
> +         r0 = get_range(expr->operands[2]);
> +
> +         // Get the range of (1-a)
> +         r1 = resolv_add_range(get_range(new(mem_ctx) ir_constant(1.0f)),
> +               get_range(neg(expr->operands[2])->as_rvalue()));
> +
> +         // Get the range of (1-a)*y
> +         r1 = resolv_mul_range(r1, get_range(expr->operands[2]));
> +
> +         // Get the range of a*x
> +         r0 = resolv_mul_range(r0, get_range(expr->operands[0]));

I think we've reversed the roles of x and y? It should be x * (1-a) +
y * a, I think.


More information about the mesa-dev mailing list