http://bugs.winehq.org/show_bug.cgi?id=10580
Summary: S.T.A.L.K.E.R. shadow corruption Product: Wine Version: CVS/GIT Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: ambro@b4ever.net
Some video corruption can be seen in S.T.A.L.K.E.R. - Shadow of Chernobyl. It was introduced by the following commit: edb78187a9277de615d7e9c2039505a8302a2940 wined3d: Hardcode local constants into the shader if possible. Screenshots attached.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #1 from Ambro ambro@b4ever.net 2007-11-27 13:04:03 --- Created an attachment (id=9370) --> (http://bugs.winehq.org/attachment.cgi?id=9370) good screenshot
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #2 from Ambro ambro@b4ever.net 2007-11-27 13:04:35 --- Created an attachment (id=9371) --> (http://bugs.winehq.org/attachment.cgi?id=9371) screenshot with corruption
http://bugs.winehq.org/show_bug.cgi?id=10580
Ambro ambro@b4ever.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |stefandoesinger@gmx.at
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #3 from Stefan Dösinger stefandoesinger@gmx.at 2007-11-27 17:05:03 --- Can you attach a +d3d_shader trace of good and bad wine trees?
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #4 from Ambro ambro@b4ever.net 2007-11-27 17:49:31 --- Created an attachment (id=9384) --> (http://bugs.winehq.org/attachment.cgi?id=9384) good output
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #5 from Ambro ambro@b4ever.net 2007-11-27 17:50:11 --- Created an attachment (id=9385) --> (http://bugs.winehq.org/attachment.cgi?id=9385) bad output
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #6 from Ambro ambro@b4ever.net 2007-11-27 17:50:47 --- Also, this only happens with glsl enabled. Card is Quadro NVS 130M.
http://bugs.winehq.org/show_bug.cgi?id=10580
Ambro ambro@b4ever.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression
--- Comment #7 from Ambro ambro@b4ever.net 2008-03-18 09:50:31 --- This also happens with UseGLSL=disabled since the following commit:
aeb0e43e3eb476789411d236c39192193295c20d wined3d: Hardcode local constants in ARB shaders if possible.
This makes it impossible to work around by disabling GLSL. By the way, this doesn't only happen to me, it's only hard to notice. See the last screenshot on the AppDB, http://appdb.winehq.org/screenshots.php?iAppId=4794&iVersionId=7377 , particulary the weird blockish shadow on the wall on the right.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #8 from Stefan Dösinger stefandoesinger@gmx.at 2008-03-18 10:10:41 --- Is a demo of this game available which can be used to reproduce the bug?
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #9 from Ambro ambro@b4ever.net 2008-03-18 14:18:42 --- I think there is no official demo, but there is a multiplayer (LAN) beta available. I'm downloading it now to see if it works. download: http://files.filefront.com/STALKER+Russian+MPBETAzip/;6954770;/fileinfo.html http://www.worthdownloading.com/download.php?gid=291&id=10554
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #10 from Ambro ambro@b4ever.net 2008-03-19 10:23:54 --- Unfortunately I was unable to get this running under Wine becouse of network/DirectPlay problems. However I can reproduce the bug with this beta under Windows using Wine's d3d dlls. Under Windows, it only seems to start with dlls compiled from current git (0.9.56 hangs the game on start). To allow the game to run, you need to set OffscreenRenderingMode=fbo and select static lightning in the game (to prevent it from crashing). Shadow corruption can then be noticed if you host a game. The corruption was gone after setting UseGLSL=disabled and reverting "Hardcode local constants in ARB shaders if possible.".
http://bugs.winehq.org/show_bug.cgi?id=10580
Ambro ambro@b4ever.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
--- Comment #11 from Ambro ambro@b4ever.net 2008-05-20 12:13:57 --- I've managed to start the server using that MP beta and get into the game. To get it to run do the following: - install the game (better remove bad characters from install path) - extract that rar archive into the game folder to get english menus: http://www.worthdownloading.com/download.php?gid=291&id=10555 - download DirectX runtime (don't use dlls from a windows partition): http://download.microsoft.com/download/6/4/c/64c3d3d6-c5da-47eb-9db4-86e45b9... - run the executable and select a folder to extract to - extract dxnt.cab using cabextract - copy dp* to windows/system32 - cd to <game folder>/bin - export WINEDLLOVERRIDES="dplay,dplayx,dpnaddr,dpnet,dpnhpast,dpnlobby=n" (or winecfg) - for f in dplayx.dll dpnet.dll dpnhpast.dll dpnhupnp.dll dpvacm.dll dpvoice.dll dpvvox.dll; do regsvr32 $f; done - wine XR_3DA.exe -dsound - start a self-hosted game
Tested with wine 1.0_rc1, the bug is still present and can be seen on the walls.
http://bugs.winehq.org/show_bug.cgi?id=10580
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #12 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-25 01:25:12 --- Confirming.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #13 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-25 01:42:55 --- fbo doesn't work at all - whole screen s black with exception of hud elements.
http://bugs.winehq.org/show_bug.cgi?id=10580
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |vitaliy@kievinfo.com
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #14 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-25 01:54:00 --- The "everything black" bug with fbo is bug 12794. Reverting commit in question from that bug allows fbo to work again. However the problem still remains (looks exactly the same as the bad screenshot).
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #15 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-25 13:35:10 --- Indeed reverting/hacking parts of the patch in question to force use of local constants fixes the problem.
I don't see any obvious problems looking at the generated shaders and comparing it's hard-coded constants with local constants.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #16 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-26 00:26:03 --- I think found the problem. The old codepath used to remap constant indexes: tmp_loc = constant_locations[lconst->idx] New code doesn't. Inserting extra debug print statements confirms it: 23 != 11 22 != 11 13 != 11 (11 being the lconst->idx).
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #17 from Stefan Dösinger stefandoesinger@gmx.at 2008-05-26 03:40:21 --- I think the remapping is mapping the GLSL name strings like "VC12" to a numeric uniform slot in the linked shader program to pass to glLoadUniform. Since we're only using the GLSL name in this case(in the shader itself) and never set a Uniform, we do not need this here I think.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #18 from H. Verbeet hverbeet@gmail.com 2008-05-26 03:55:26 --- Could you post the shader in question (d3d) and the generated GLSL?
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #19 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-26 13:20:36 --- Created an attachment (id=13364) --> (http://bugs.winehq.org/attachment.cgi?id=13364) Problem shader
Took a while to find the shader in question. However I'm not seeing any problems with it. Could it be something else, like a driver bug?
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #20 from Stefan Dösinger stefandoesinger@gmx.at 2008-05-26 13:53:53 --- Probably the shader_addline(buffer, "const vec4 LC%d = vec4(%f, %f, %f, %f)") causes a precision loss because the float value is transformed into a string.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #21 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-26 14:24:19 --- (In reply to comment #20)
Probably the shader_addline(buffer, "const vec4 LC%d = vec4(%f, %f, %f, %f)") causes a precision loss because the float value is transformed into a string.
Indeed this fixes the problem: -shader_addline(buffer, "const vec4 LC%u = vec4(%f, %f, %f, %f);\n", lconst->idx, +shader_addline(buffer, "const vec4 LC%u = vec4(%.12f, %.12f, %.12f, %.12f);\n", lconst->idx,
I think all such places needs to be changed to higher precision.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #22 from Stefan Dösinger stefandoesinger@gmx.at 2008-05-26 16:54:38 --- I'd say go ahead and send a patch. Probably make the precision %.16f or something to be safe. There are other potential places where a similar adjustment is needed, maybe the sRGB constant loading.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #23 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-26 17:09:29 --- (In reply to comment #22)
I'd say go ahead and send a patch. Probably make the precision %.16f or something to be safe. There are other potential places where a similar adjustment is needed, maybe the sRGB constant loading.
Already did. Except used .12 precision - float has just 24 bits for mantissa - max 10 decimal digits.
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #24 from H. Verbeet hverbeet@gmail.com 2008-05-27 02:32:05 --- Just to mention an alternative, it would also be possible to load the constants using glUniform4fv() at program creation. GLSL tracks constants per program, so you'd only need to do it once, and it would prevent the float->text->float conversion (if you take the d3d source into account it's even text->float->text->float).
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #25 from Stefan Dösinger stefandoesinger@gmx.at 2008-05-27 03:12:22 --- Then we'd have to make sure we do not overwrite them when loading global constants, which means an additional if() for each global constant loaded. For arb shaders we could do this because it has a different set of program-only shader constants. (Or rather, ARB knows global constants, which GLSL doesn't)
http://bugs.winehq.org/show_bug.cgi?id=10580
--- Comment #26 from Vitaliy Margolen vitaliy@kievinfo.com 2008-05-30 23:29:23 --- Since patches was not accepted this bug still present in wine-1.0-rc3
http://bugs.winehq.org/show_bug.cgi?id=10580
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #27 from Alexandre Julliard julliard@winehq.org 2008-06-05 06:54:19 --- A fix has been committed.
http://bugs.winehq.org/show_bug.cgi?id=10580
Stefan Dösinger stefandoesinger@gmx.at changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |
--- Comment #28 from Stefan Dösinger stefandoesinger@gmx.at 2008-06-05 07:07:58 --- It is partially fixed only. The GLSL code has the fix, ARB still shows the bug.
http://bugs.winehq.org/show_bug.cgi?id=10580
Stefan Dösinger stefandoesinger@gmx.at changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|S.T.A.L.K.E.R. shadow |S.T.A.L.K.E.R. shadow |corruption |corruption with ARB shaders
http://bugs.winehq.org/show_bug.cgi?id=10580
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED
--- Comment #29 from Alexandre Julliard julliard@winehq.org 2008-06-06 08:29:19 --- ARB fix is committed.
http://bugs.winehq.org/show_bug.cgi?id=10580
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #30 from Alexandre Julliard julliard@winehq.org 2008-06-06 10:39:45 --- Closing bugs fixed in 1.0-rc4.
http://bugs.winehq.org/show_bug.cgi?id=10580
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|CVS/GIT |unspecified