http://bugs.winehq.org/show_bug.cgi?id=20053
--- Comment #20 from Nephyrin zey Nephyrin@nephyrin.net 2010-01-04 14:25:20 --- (In reply to comment #18)
(In reply to comment #17)
As far as I understand it: Drivers up to 180.60 returned INF on divide by zero in shaders. Newer ones return NaN, which directx does not expect, causing issues. This hack changes the particular offending shader path to check for div by zero and make sure it generates INF. It does not fix the problem in general, just masks it, hence, a hack.
The problem with the hack is mostly that it returns 0.0 instead of +INF. The problem with writing a proper fix is that I don't know a practical/reliable way to generate +INF in GLSL.
For what it's worth, the main difference between NaN and +INF that TF2 cares about is that NaN keeps propagating while e.g. "clamp(+INF, 0.0, 1.0);" returns 1.0.
Perhaps wine should do some tests on the implementation at startup to determine the behavior of undefineds like div 0 and log 0, and assuming at least one +INF generating special is available, store it in a constant? Or is this way too hacky as well? It seems like implementing dx shaders with a defined floating point model on GLSL without one is basically not possible without manually resolving any ambiguous operations.