https://bugs.winehq.org/show_bug.cgi?id=37705
Paul Gofman gofmanp@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gofmanp@gmail.com
--- Comment #24 from Paul Gofman gofmanp@gmail.com --- Created attachment 63529 --> https://bugs.winehq.org/attachment.cgi?id=63529 wined3d: Do not treat _SAMP_SRGB_TEXTURE state as a boolean value.
I tested the game from Ubisoft website (started by UPlay; basic package, some campaigns look missing). The game worked right away with d3dcompiler_47 native override only. I could reproduce the problem by starting "Dungeon Campaign" ("The Other Elves"). The screen gets dark during the intro animation, and after that the map is dark on load. If I save the game, restart and load, or reset device somehow (e. g. by changing resolution), the map is displayed nicely.
The problem is that at the start of intro animation the game sets some big nonzero value (0x7e41882a) for D3DSAMP_SRGBTEXTURE (sampler 0). It does it somewhere close to the end of frame rendering, and goes rendering next frame with this value set. It sometimes switches D3DSAMP_SRGBTEXTURE to 0 for a short while, but sets it back to the same value after, and most of the textures are accessed with SRGB correction under Wine since that. Sampler state setting looks exactly the same under Windows. The same sequence recorded and displayed by apitrace displays without dark textures under Windows, and with those under Wine. Ultimately disabling D3DSAMP_SRGBTEXTURE state handling makes it display like on Windows.
Weird enough, Windows seem to not turn SRGB correction mode on when this value (0x7e41882a) is used. I am attaching the patch which includes the test (which succeeds for me on a Windows machine) showing that setting 2, 100 or that value from the game trace does not make native d3d9 to perform SRGB correction. It does that if the value of 1 is set.
The patch attached fixes the issue for me (tested on the campaign start referenced above). The match introduces a comparioson of D3DSAMP_SRGBTEXTURE value with 1 instead of treating it as a boolean value.