http://bugs.winehq.org/show_bug.cgi?id=12923
Summary: GTR2 graphics are seen through or invisible Product: Wine Version: 0.9.61. Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: greg87@online.de
4428cc32de1f99463ebaa990726c8bd7a3eef6c4 is first bad commit commit 4428cc32de1f99463ebaa990726c8bd7a3eef6c4 Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Mon Apr 28 21:13:12 2008 +0000
wined3d: Fix a few small bugs in WineD3D_ChoosePixelFormat.
:040000 040000 6e6e5f451c4a9961328c12a57c3042b6b622067c b5090b2050987a2273e1e20d55c91be1117c1c92 M dlls
Ingame most of the models and textures are missing, this making the game unplayable. Probably also an issue in BMW M3 Challenge.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #1 from Gregor Münch greg87@online.de 2008-05-03 08:21:45 --- Created an attachment (id=12664) --> (http://bugs.winehq.org/attachment.cgi?id=12664) image describing the bug
http://bugs.winehq.org/show_bug.cgi?id=12923
Gregor Münch greg87@online.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |thunderbird2k@gmx.net Keywords| |regression
--- Comment #2 from Gregor Münch greg87@online.de 2008-05-03 08:23:25 --- adding author of the patch...
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #3 from Gregor Münch greg87@online.de 2008-05-03 08:28:54 --- Created an attachment (id=12665) --> (http://bugs.winehq.org/attachment.cgi?id=12665) +wgl
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #4 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-03 09:47:04 --- Create a log of WINEDEBUG=+d3d further what directx version does this game require?
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #5 from Gregor Münch greg87@online.de 2008-05-03 11:12:36 --- The game is a directx9 one. Interesting is, if I select AA (2x or 4x) in games option program before gamestart everything renders correctly. http://sharebase.de/files/gShQSmhT2t.html
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #6 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-03 12:57:45 --- You can just attach the log as an attachment to here. The other download site doesn't work for me.
http://bugs.winehq.org/show_bug.cgi?id=12923
Richie listmail@triad.rr.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |listmail@triad.rr.com
--- Comment #7 from Richie listmail@triad.rr.com 2008-05-09 20:51:04 --- This is for call of duty 4. I was going to log a new bug but done a search on this commit. I hope it is ok to post here. I first noticed corrupt graphics in COD4 at wine-0.9.61 and days later I tried the latest git as of May 8, 8:00pm EST and problem was still there. I then did a full regression from .60 to .61 and came up with the following commit:
$ git bisect good 4428cc32de1f99463ebaa990726c8bd7a3eef6c4 is first bad commit commit 4428cc32de1f99463ebaa990726c8bd7a3eef6c4 Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Mon Apr 28 21:13:12 2008 +0000
wined3d: Fix a few small bugs in WineD3D_ChoosePixelFormat.
:040000 040000 6e6e5f451c4a9961328c12a57c3042b6b622067c b5090b2050987a2273e1e20d55c91be1117c1c92 M dlls
Notes: - both Nvida drivers versions 169.12 and 173.08 beta were tested, however for the duration of the regression testing I remained on 169.12. This not simply confirms nothing changes between versions. - nvidia 8800 GTS 512 - Additionaly, I tested today's wine-1.0-rc1 and confirmed that it still exhibited this issue.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #8 from Richie listmail@triad.rr.com 2008-05-09 20:52:47 --- Created an attachment (id=12860) --> (http://bugs.winehq.org/attachment.cgi?id=12860) demonstration of graphical corruption in COD4
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #9 from Lei Zhang thestig@google.com 2008-05-09 21:04:40 --- same problem as bug 13025?
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #10 from Richie listmail@triad.rr.com 2008-05-10 00:39:01 --- Created an attachment (id=12866) --> (http://bugs.winehq.org/attachment.cgi?id=12866) patch for cached opengl pixel format table code loop
I have COD4 consistently displaying correct graphics on wine 1.0-rc1 now. No other tests done.
Regarding the initial "(cached) opengl pixel format table code loop" within dlls/wined3d/context.c... Without knowing the content/structure of the cfgs data, among other things, my first thoughts was that if it is expected that we use the *first* iPixelFormat found -when our depth requirements aren't met- (as per the code comments) it seems logical that we would need to break at that point.
However, it could simply be that by having added this loop break, the use of a *higher* iPixelFormat value is now being avoided (which for whatever reason could be causing the corruption issue). Perhaps within that there is the underlying issue?
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #11 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-10 02:41:02 --- The way I wrote the code is that we try to find a pixel format which exactly matches our requirements. The pixel format table is sorted by the display drivers and there is no real pattern in it and it is different for each driver. Further down to the end of the list there tend to be 'extended' pixel formats. Those formats have the same basic properties as the ones at the top of the list but different extended features like multisampling and others.
Due to the sorting of the list we store the first format which reaches the end of the loop (because that format matches out basis requirements). We then continue to look for a format for which depth also matches exactly. If that one is found we break else we use the format which first met our requirements.
It would be useful to see what the requirements specified to WineD3D_ChoosePixelFormat are (what parameters are passed to it). Likely depth/stencil isn't requested. If that is the case we need to know why it wasn't requested.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #12 from Richie listmail@triad.rr.com 2008-05-10 11:14:30 --- Ok I understand now that it would only define it, *if its undefined*, which would imply the first match where the depth requirements aren't met. So it seems more likey that I'm now avoiding a particular *depth matching* format by having added that break. -- Roderick, please give specifics on how you want me to execute tests in wine to gather the information that you need. If you want to provide a customised file for this case then I will rebuild against that. Let me know.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #13 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-10 11:25:09 --- Actually I think that bug 12923 is a duplicate of this one. Let me quickly explain the problem.
At some stage CreateContext is called to create an OpenGL context. It uses info passed to it at D3D device creation time to WineD3D_ChoosePixelFormat to choose a pixel format. WineD3D_ChoosePixelFormat works fine.
The issue is I think that the program manually attaches a 'depth stencil surface' using SetDepthStencilSurface. Check if that is called. The call should recreate an OpenGL context using the proper pixel format. Right now SetDepthStencilSurface is not doing this at all. The reason is just a leftover of the old pixel format limitation. When it was around the only format we had always had depth and stencil.
So check if SetDepthStencilSurface is used to manually add a depth/stencil buffer.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #14 from Richie listmail@triad.rr.com 2008-05-12 21:05:34 --- Roderick, I can't get the game to load up completely ( screen goes black and first logo video doesn't start) when trying to run cod4 with WINEDEBUG=+d3d. I hope that someone else who reads this and has the same issue can upload the trace data. I'd really like to see this get fixed!
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #15 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-17 11:55:52 --- Created an attachment (id=13124) --> (http://bugs.winehq.org/attachment.cgi?id=13124) Hacky patch
This is a first attempt to a patch to fix the issue. It is far from clean but give it a try.
http://bugs.winehq.org/show_bug.cgi?id=12923
Roderick Colenbrander thunderbird2k@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tdb@tdb.fi
--- Comment #16 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-17 11:56:45 --- *** Bug 13025 has been marked as a duplicate of this bug. ***
http://bugs.winehq.org/show_bug.cgi?id=12923
haarp liquitsnake@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |liquitsnake@gmx.net
--- Comment #17 from haarp liquitsnake@gmx.net 2008-05-17 12:29:58 --- For Supreme Commander, this patch results in a huge performance hit and severe graphical corruption, even in the intro videos and main menu. Console spits stuff like this out (Offscreenrenderer=fbo):
err:d3d:IWineD3DDeviceImpl_SetDepthStencilSurface depthstencil change: WINED3DFMT_D24S8 err:d3d:IWineD3DDeviceImpl_SetDepthStencilSurface depthstencil change: WINED3DFMT_D24S8 err:d3d_surface:IWineD3DSurfaceImpl_LoadLocation Surface does not have any up to date location fixme:d3d:check_fbo_status FBO status GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT (0x8cd6) fixme:d3d:check_fbo_status Color attachment 0: (0x1c4ebe88) WINED3DFMT_A8R8G8B8 1920x1200 fixme:d3d:check_fbo_status Depth attachment: (0x1c4ebfd0) WINED3DFMT_D24S8 1920x1200 fixme:d3d:IWineD3DDeviceImpl_ClearSurface >>>>>>>>>>>>>>>>> GL_INVALID_FRAMEBUFFER_OPERATION_EXT (0x506) from glClear @ device.c / 5080 fixme:d3d:ActivateContext >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION (0x502) from glDrawBuffer @ context.c / 1040
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #18 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-17 14:54:03 --- Likely a lot of unneeded context recreation is done now. Further I'm not restoring the contents of the backbuffer.
In short SetDepthStencilSurface is something which we can't easily do in opengl. In OpenGL you select a pixel format for your drawable (a window, a pixmap or a pbuffer) and this pixel format describes the RGB colors but it also fixes the depth and stencil buffer. In d3d RGB colors aren't tied to depth stencil, you can just attach a depth buffer after you create your 'drawable'. What we must do in case of opengl is to recreate the window and opengl context. This is very tricky stuff and I'm now doing it quickly using a reset command. (but I'm not restoring the backbuffer yet)
Let me create a version which at least won't do a reset when it isn't needed.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #19 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-17 14:58:35 --- Created an attachment (id=13130) --> (http://bugs.winehq.org/attachment.cgi?id=13130) Attempt 2
This is a quickly updated patch. It only resets the device when no depth stencil format was previously set. (I still need to check for format 'upgrades' though)
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #20 from Richie listmail@triad.rr.com 2008-05-17 15:28:34 --- Created an attachment (id=13131) --> (http://bugs.winehq.org/attachment.cgi?id=13131) hacky_patch test results
With your "Hacky patch", COD4 did not show any graphical corruption or noticable performance problems. My initial tests show that it is working, however this is with Shadows OFF. The game hard locks when turning Shadows ON (during game or after launch from inital options screen). While we can't expect a performance hit when turning Shadows ON, we shouldn't expect a hard lock so I will upload output. -- I will follup up with results on the Attempt 2 patch.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #21 from Richie listmail@triad.rr.com 2008-05-17 15:57:30 --- excerpt from my previous post should have read "While we *could* expect a performance hit when turning Shadows ON, we shouldn't expect a hard lock so I will upload output." -- -- COD4: The Attempt 2 patch worked with both Shadows ON or OFF and I received the typical performance hit that I have in the past when turning Shadows ON. Other settings were (have remained) Specular Map YES, Depth of Field NO, Glow NO, Number of Dynamic lights OFF, Soften Smoke Edges NO -- I didn't do tests for these other options being ON, but near basic settings leads to a working game.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #22 from haarp liquitsnake@gmx.net 2008-05-17 16:46:48 --- Created an attachment (id=13133) --> (http://bugs.winehq.org/attachment.cgi?id=13133) Pic describing problems
Ok, the 2nd patch makes it actually possible to use Supreme Commander. Although it appears it introduces more problems than it solves.
From the pic (left good, right with patch):
Top: Lightning seems to break Middle: Ground textures become "blocky" (ignore the black bar, this was a bug in my graphics software) Bottom: More texture problems.
Also, using this patch makes the game slower than not using it. Additionally, all fonts disappear in the main menu. :/
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #23 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-18 02:51:43 --- What sort of errrors/messages are you seeing in the console? As I mentioned we are recreating everything and that's why this patch is so tricky.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #24 from haarp liquitsnake@gmx.net 2008-05-18 04:36:06 --- fixme:d3d:check_fbo_status FBO status GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT (0x8cd6) fixme:d3d:check_fbo_status Color attachment 0: (0x1c4eb830) WINED3DFMT_A8R8G8B8 1920x1200 fixme:d3d:check_fbo_status Depth attachment: (0x1c4ebfd0) WINED3DFMT_D24S8 1920x1200 fixme:d3d_draw:drawStridedFast >>>>>>>>>>>>>>>>> GL_INVALID_FRAMEBUFFER_OPERATION_EXT (0x506) from glDrawArrays @ drawprim.c / 279 err:d3d_surface:IWineD3DSurfaceImpl_LoadLocation Surface does not have any up to date location
whereas the fixmes get spammed while the last err only pops up "occasionally"
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #25 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-18 11:03:45 --- I'm about to submit a workaround for the problem to wine-patches. The real fix is a lot of work and way to risky during the 1.0 code freeze.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #26 from haarp liquitsnake@gmx.net 2008-05-18 11:10:41 --- Created an attachment (id=13158) --> (http://bugs.winehq.org/attachment.cgi?id=13158) Stalker broken
Hopefully it's not one of the patches in this bug. Because I just noticed another game (Stalker) whose graphics completely screw up when the patch is used ;) again with lightning issues and some other stuff
Also, every game seems to slow down to a crawl...
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #27 from Richie listmail@triad.rr.com 2008-05-18 12:35:20 --- haarp, ooc does Supreme Commander and Stalker work correctly on 0.9.60 ? The core commit listed here at the beginning of the bug occured about midway between .60 and .61. I'm using .60 as an initial reference point as to what to expect verses what the current head +/- any patches here produce.
Roderick, with the WineD3D_ChoosePixelFormat changes that you've recently made and with this new exposed bug, is it actually more benefical to revert those commits and have the pre-existing functionality restored as opposed to now leading to a work around to avoid breaking 1.0 release canidates? I don't know what things were fixed by those WineD3D_ChoosePixelFormat updates, but I'm curious if you've weighed the options in this respect. I respect that bugs need to be fixed as those commits begin to address, but perhaps this is something that could be re-introduced, and with more fixes, and after 1.0? Just a thought.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #28 from haarp liquitsnake@gmx.net 2008-05-18 12:43:17 --- (In reply to comment #27)
haarp, ooc does Supreme Commander and Stalker work correctly on 0.9.60 ? The core commit listed here at the beginning of the bug occured about midway between .60 and .61. I'm using .60 as an initial reference point as to what to expect verses what the current head +/- any patches here produce.
I am using 1.0-rc1 as base to apply Roderick's patches. In any way, this bug got introduced between 0.9.60 and 61. SupCom works fine in 0.9.60, Stalker exhibits bug 12794. Luckily, I had a Stalker savegame that is not affected by this bug with which I tested it. (Interestingly, Stalker's bug 12974 exhibits similiar terminal messages as this bug here, but it was a different commit that broke it)
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #29 from haarp liquitsnake@gmx.net 2008-05-18 12:45:23 --- Oops, meant to say bug 12794 in the second link..
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #30 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-20 06:39:01 --- The workaround is in GIT.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #31 from haarp liquitsnake@gmx.net 2008-05-20 09:29:31 --- By workaround, do you mean reverting the patch that caused the problem or a proper patch? Because as far as I'm concerned, this problem is fixed in SupCom.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #32 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-20 09:45:59 --- As I explained the issue is basically that D3D programs have to decide either when they initialize D3D or add a later stage whether they want to use a depth and stencil buffer. In case of OpenGL you need to request depth and stencil support roughly at the moment you initialize OpenGL. In order to support the 'delayed' depth / stencil usage which D3D allows we need to 'reinitialize' OpenGL and that is tricky (we need to recreate all textures, shaders, ..). This is too risky to do during the 1.0 codefreeze. Stefan and I thought it would be easy but we missed some things.
The workaround just hard codes the use of a depth stencil format at OpenGL initialization time and that way works around the issue.
http://bugs.winehq.org/show_bug.cgi?id=12923
Gregor Münch greg87@online.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #33 from Gregor Münch greg87@online.de 2008-05-20 14:10:02 --- GTR2 works again. Thx.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #34 from Jonathan echidnaman@gmail.com 2008-05-21 06:47:42 --- Robot Wars is also fixed. Thanks.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #35 from haarp liquitsnake@gmx.net 2008-05-21 08:44:17 --- I wouldn't close this bug yet as the proper fix isn't implemented yet.
http://bugs.winehq.org/show_bug.cgi?id=12923
Roderick Colenbrander thunderbird2k@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |REMIND
--- Comment #36 from Roderick Colenbrander thunderbird2k@gmx.net 2008-05-21 09:44:46 --- I'm leaving it at REMIND.
http://bugs.winehq.org/show_bug.cgi?id=12923
--- Comment #37 from Dmitry Timoshkov dmitry@codeweavers.com 2008-05-21 09:47:55 --- REMIND is a bad choice. I'd argue that we shouldn't use this resolution for Wine bugs as all, it's meaningless.
http://bugs.winehq.org/show_bug.cgi?id=12923
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|REMIND |ABANDONED
--- Comment #38 from Dmitry Timoshkov dmitry@codeweavers.com 2008-06-09 01:57:51 --- Changing the resolution to abandoned. If the problem persists please open a separate bug report.
http://bugs.winehq.org/show_bug.cgi?id=12923
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #39 from Dmitry Timoshkov dmitry@codeweavers.com 2008-06-09 01:58:01 --- Closing.
http://bugs.winehq.org/show_bug.cgi?id=12923
Gregor Münch greg87@online.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|ABANDONED |FIXED
--- Comment #40 from Gregor Münch greg87@online.de 2008-06-09 09:14:18 --- The issue was simply fixed. Even if its not the _fully_ correct approach. There are no impacts for the user. Its now just basically like it was before.