Closed ianromanick closed 2 years ago
Cases where isinf(dot(x, x))
are also potentially problematic.
We discussed this in today's OpenGL/ES meeting and we're not inclined to add any special language, or require implementations to add special handling, for these cases and will allow implementations to return inf, nan or whatever. The advice to applications is - don't do that.
The GLSL 4.60 specification and the SPIR-V Extended Instructions for GLSL specification both say
However, what is the expected result when
x
is the zero vector? When all the components ofx
are subnormal values?At least one implementation implements
normalize
in the obvious way:return x / length(x);
. In the exceptional cases mentioned above, this will result in NaN. See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4678 and https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10481.I think that's clearly unacceptable, but what should the result be? The zero vector? A "random" unit vector?