[Mesa-dev] [RFC 07/11] glsl: Add "built-in" functions to do mul(fp64, fp64)

tournier.elie tournier.elie at gmail.com
Fri Mar 3 18:51:18 UTC 2017


On 3 March 2017 at 17:46, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> On Friday, 2017-03-03 16:23:03 +0000, Elie Tournier wrote:
>> Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
>> ---
>>  src/compiler/glsl/builtin_float64.h     | 2558 +++++++++++++++++++++++++++++++
>>  src/compiler/glsl/builtin_functions.cpp |    4 +
>>  src/compiler/glsl/builtin_functions.h   |    3 +
>>  src/compiler/glsl/float64.glsl          |  172 +++
>>  4 files changed, 2737 insertions(+)
>>
>> diff --git a/src/compiler/glsl/builtin_float64.h b/src/compiler/glsl/builtin_float64.h
>> index bf0953e5d6..0a363bd27a 100644
>> --- a/src/compiler/glsl/builtin_float64.h
>> +++ b/src/compiler/glsl/builtin_float64.h
> [snip]
>> +
>> +            /* THEN INSTRUCTIONS */
>> +            body.instructions = &f0EF9->then_instructions;
>> +
>> +            ir_constant_data r0EFD_data;
>> +            memset(&r0EFD_data, 0, sizeof(ir_constant_data));
>> +r0EFD_data.u[0] = 4294967295;
>> +r0EFD_data.u[1] = 4294967295;
>
> Looks like some debug/testing left-overs?

No. It's the IR representation of "return uvec2(0xFFFFFFFFu, 0xFFFFFFFFu);"
Multiply 0 by Inf (or Inf by 0) is an invalid operation.
So when we have this kind of operation,  we return a NaN.

IEEE 754:
" 7.2 Invalid operation

For operations producing results in floating-point format, the default
result of an operation that signals the
invalid operation exception shall be a quiet NaN that should provide
some diagnostic information. "


>
> [snip]
>> +
>> +               /* THEN INSTRUCTIONS */
>> +               body.instructions = &f0F22->then_instructions;
>> +
>> +               ir_constant_data r0F26_data;
>> +               memset(&r0F26_data, 0, sizeof(ir_constant_data));
>> +r0F26_data.u[0] = 4294967295;
>> +r0F26_data.u[1] = 4294967295;
>
> Ditto


More information about the mesa-dev mailing list