http://bugs.winehq.org/show_bug.cgi?id=17437
Stefan Dösinger stefandoesinger@gmx.at changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |stefandoesinger@gmx.at
--- Comment #24 from Stefan Dösinger stefandoesinger@gmx.at 2009-03-03 12:19:22 --- I am working on a patchset that addresses the issue with the Wine-reserved uniforms. Basically I always advertise the full amount of GL supported uniforms to d3d(in case of the gf7600 256).
In the shader, if indirect addressing is not used, I always declare the full 256 uniforms. The driver can optimize unused ones away; That way a game can use c255 even if we need reserved ones, as long as it doesn't use indirect addressing in the shader. If the shader does use all 256 uniforms we're still screwed of course.
With indirect addressing, the driver can't optimize away unused uniforms because it can't know which ones are unused and which are used. So I currently subtract the number of really used INT and BOOL uniforms, and 2 vprivately used vec4's(1 for posFixup, one for immediate values). In the best case, a shader can use c253 together with indirect addressing.
The remaining problem is that not all drivers deal with immediate values as efficiently as the nvidia driver. Especially MacOS sucks here, and I found that I have to reserve 10-20 vec4's due to that. I still need some way to could the number of immvals we're using and package them up manually.
As for working around incorrectly advertised varyings: If we do that, this should be integrated with the card detection. E.g. for each PCI ID we detect in the card detection, we could store info such as this:
1) Number of GLSL uniforms and varyings we expect the driver to advertise 2) Number of ARB constants 3) Number of uniforms and varyings that are really supported 4) Use ARB values, GLSL values or hardcoded values?
One important thing is that every workaround is built on some assumptions. The code should be able to detect when the assumptions aren't true any longer(e.g. driver update fixed the bug), and issue a warning. A workaround + a fixed driver might lead to new bugs.