[Mesa-dev] NaN behavior in GLSL (was Re: [PATCH] glsl: always do sqrt(abs()) and inversesqrt(abs()))

Matteo Bruni matteo.mystral at gmail.com
Thu Jan 12 22:09:30 UTC 2017


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.)


More information about the mesa-dev mailing list