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

Thomas Helland thomashelland90 at gmail.com
Sat Jan 3 13:06:24 PST 2015


2015-01-03 21:55 GMT+01:00 Matt Turner <mattst88 at gmail.com>:
> 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.

Good catch. I think you're correct. At least that matches what it
says in the comment for the lerp-detection code in opt_algebraic.
I'll correct it, do a new shader-db run, and post a V2 with comments.


More information about the mesa-dev mailing list