[Mesa-dev] [PATCH v3 09/29] glsl/ir: Add builtin function support for doubles

Ilia Mirkin imirkin at alum.mit.edu
Sun Feb 8 13:40:03 PST 2015


On Sun, Feb 8, 2015 at 2:26 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Sun, Feb 8, 2015 at 1:00 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> @@ -886,6 +953,25 @@ ir_constant::get_float_component(unsigned i) const
>>     case GLSL_TYPE_INT:   return (float) this->value.i[i];
>>     case GLSL_TYPE_FLOAT: return this->value.f[i];
>>     case GLSL_TYPE_BOOL:  return this->value.b[i] ? 1.0f : 0.0f;
>> +   case GLSL_TYPE_DOUBLE: return (float) this->value.d[i];
>> +   default:              assert(!"Should not get here."); break;
>> +   }
>> +
>> +   /* Must return something to make the compiler happy.  This is clearly an
>> +    * error case.
>> +    */
>> +   return 0.0;
>
> Use unreachable() here.

diff made a funky (but understandable) decision here. That code was
actually already there. However the exact same thing is added to the
(new) get_double_component function. I think it's more important to
have symmetry there so that it can all be cleaned up later rather than
someone wondering "why are these nearly identical functions
different".

  -ilia


More information about the mesa-dev mailing list