http://bugs.winehq.org/show_bug.cgi?id=34266
--- Comment #6 from Henri Verbeet hverbeet@gmail.com 2013-08-17 05:56:42 CDT --- (In reply to comment #4)
Thanks for the insight. (For reference, I'm using an NVIDIA GTX450; I'm not familiar with the ISA, but I assume it has a similar zeroing MUL instruction for use with D3D9.)
Afaik at least older hardware has a context global switch for this, newer hardware may have separate instructions.
It looks like D3D10 and later follow the IEEE rules as well, so I'm not sure how much support we could get for an OpenGL extension just to support legacy shaders. I wonder if we could work around the problem with the mix() function from GLSL 1.30? Something like:
dest = mix(vecN(0), a * b, equal(a, vecN(0)) || equal(b, vecN(0)))
That would be really expensive, the performance impact would pretty much not make it worth it. In terms of hacks, avoiding infinities in instructions like rcp, rsq, etc. tends to work well enough, although the performance hit is still noticeable, but it's not something that can go into Wine either way.
We've brought this up with driver vendors in the past, and at least NVIDIA and Mesa seemed open to the idea. We didn't get a direct response from fglrx. At some point we talked about an EXT_zero_mul_conventions extension with NVIDIA, but that seems to have stalled somewhere inside NVIDIA for reasons that aren't entirely clear to me.