[Mesa-dev] [PATCH v2 14/28] glsl: Add support doubles in optimization passes

Ilia Mirkin imirkin at alum.mit.edu
Sat Feb 7 18:38:26 PST 2015


Hmmmmm... yeah. Looks like ir_binop_dot could use some help. I think
I'm just going to guard it with a if (!float) for now. Most of the
code is pretty good about checking it.

On Fri, Feb 6, 2015 at 3:05 AM, Ian Romanick <idr at freedesktop.org> wrote:
> Does opt_algebraic also need updates?
>
> On 02/06/2015 06:56 AM, Ilia Mirkin wrote:
>> From: Dave Airlie <airlied at gmail.com>
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>> ---
>>  src/glsl/opt_constant_propagation.cpp |  3 +++
>>  src/glsl/opt_minmax.cpp               | 13 +++++++++++++
>>  2 files changed, 16 insertions(+)
>>
>> diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp
>> index c334e12..90cc0c8 100644
>> --- a/src/glsl/opt_constant_propagation.cpp
>> +++ b/src/glsl/opt_constant_propagation.cpp
>> @@ -194,6 +194,9 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue)
>>        case GLSL_TYPE_FLOAT:
>>        data.f[i] = found->constant->value.f[rhs_channel];
>>        break;
>> +      case GLSL_TYPE_DOUBLE:
>> +      data.d[i] = found->constant->value.d[rhs_channel];
>> +      break;
>>        case GLSL_TYPE_INT:
>>        data.i[i] = found->constant->value.i[rhs_channel];
>>        break;
>> diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
>> index 32fb2d7..23d0b10 100644
>> --- a/src/glsl/opt_minmax.cpp
>> +++ b/src/glsl/opt_minmax.cpp
>> @@ -133,6 +133,14 @@ compare_components(ir_constant *a, ir_constant *b)
>>           else
>>              foundequal = true;
>>           break;
>> +      case GLSL_TYPE_DOUBLE:
>> +         if (a->value.d[c0] < b->value.d[c1])
>> +            foundless = true;
>> +         else if (a->value.d[c0] > b->value.d[c1])
>> +            foundgreater = true;
>> +         else
>> +            foundequal = true;
>> +         break;
>>        default:
>>           unreachable("not reached");
>>        }
>> @@ -178,6 +186,11 @@ combine_constant(bool ismin, ir_constant *a, ir_constant *b)
>>               (!ismin && b->value.f[i] > c->value.f[i]))
>>              c->value.f[i] = b->value.f[i];
>>           break;
>> +      case GLSL_TYPE_DOUBLE:
>> +         if ((ismin && b->value.d[i] < c->value.d[i]) ||
>> +             (!ismin && b->value.d[i] > c->value.d[i]))
>> +            c->value.d[i] = b->value.d[i];
>> +         break;
>>        default:
>>           assert(!"not reached");
>>        }
>>
>


More information about the mesa-dev mailing list