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

Ilia Mirkin imirkin at alum.mit.edu
Thu Jan 12 22:46:37 UTC 2017


On Thu, Jan 12, 2017 at 4:03 PM, Matteo Bruni <matteo.mystral at gmail.com> wrote:
> So, what would be really nice to have is a GLSL extension for some
> kind of switch to select the requested behavior WRT NaN. For example a
> three-way option with "don't generate NaN in arithmetic operations",
> "do generate NaN" and "don't care". It could also be a GL state if
> that's easier to implement with the existing hardware, since an
> individual application isn't supposed to require different behavior
> from one shader to the next.
>
> Is anyone interested in / favorable to something like this? It would
> solve the issue with defining NaN behavior in GLSL while making things
> a bit more compatible with "other API a lot of games are ported from
> which happens to be supported by all the desktop GPUs".

Not that I'm biased, but on the NVIDIA Tesla series (G80-GT21x), this
enable is handled via a global flag, not in the shader binary, so this
is all-or-nothing for a whole pipeline. On GF100+, I believe there is
also an enable via a global flag, but there are also a FMUL.FMZ (and
FFMA.FMZ) flag, which I *think* has the same effect. So for GF100+ hw,
this could be done at the instruction level.

Cheers,

  -ilia


More information about the mesa-dev mailing list