[Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))
Axel Davy
axel.davy at ens.fr
Thu Jan 12 22:41:26 UTC 2017
On 12/01/2017 23:09, Matteo Bruni wrote:
> 2017-01-12 22:54 GMT+01:00 Axel Davy <axel.davy at ens.fr>:
>> Preventing NaN from being generated is not sufficient to fix the 0*inf = 0
>> issue.
>>
>> For example radeonsi does convert all NaN to zeros via a hardware setting.
>>
>> But 0*inf = 0 behaviour should be also in mad, and with the NaN to zero
>> conversion, you get 0 * inf + 24 = 0 instead of 24.
> Do you refer to the d3d9 MAD or the hardware instruction? If the
> former, just generating MUL and ADD separately should do the trick. In
> the latter case, I guess that means the "NaN switch" should also
> affect code generation (although I think that should be already
> covered by the "precise" qualifier.)
>
all radeon card released so far have special instructions for both mul
and mad to have 0*inf = 0.
I guess you'd need some gl extension to use them if available.
Axel
More information about the mesa-dev
mailing list