https://bugs.winehq.org/show_bug.cgi?id=50235
Bug ID: 50235 Summary: Broken rendering in Sniper Elite 3 Product: Wine Version: 5.22 Hardware: x86-64 OS: Linux Status: NEW Keywords: regression Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: andrey.goosev@gmail.com CC: matteo.mystral@gmail.com Regression SHA1: 77f0149a6c99fc0289d12a788f630519d7dc49d3 Distribution: ---
Created attachment 68741 --> https://bugs.winehq.org/attachment.cgi?id=68741 example
Mix of blinking textures and lights.
https://bugs.winehq.org/show_bug.cgi?id=50235
--- Comment #1 from Matteo Bruni matteo.mystral@gmail.com --- Created attachment 68778 --> https://bugs.winehq.org/attachment.cgi?id=68778 Hack, game will run out of memory in a matter of seconds though
The bug is affected by https://source.winehq.org/git/wine.git/commit/8b3cc57df0b791ca6c33f383f9358e... in that now reverting the original regression patch doesn't fix the issue anymore.
What I think is happening is, basically, a WAW hazard: the game DISCARD maps constant buffers very often, drawing between maps. The Nvidia driver reuses previously used BO names when creating a new buffer with glGenBuffers(). So we end up with certain BO IDs "matching" multiple buffers / buffer contents over a short period of time. I suspect DISCARD maps (either explicit with GL_MAP_INVALIDATE_BUFFER_BIT or just the first and only map of a new buffer) are optimized in the driver not to wait for draws in progress. The driver then sometimes finds itself with "too new" data inside BO x: data destined for a following draw.
Updating a buffer with glBufferData() is optimized similarly, in that those calls never synchronize the driver command stream and each buffer is "versioned" so to avoid ambiguity at draw time. Before 8b3cc57df0b791ca6c33f383f9358e1613206b84 we were destroying and immediately recreating the BO, which got assigned the same ID and that, I gather, didn't break the driver's internal BO version tracking. I guess that the original regression patch, replacing glBufferData() with glBufferStorage(), broke the game because it effectively "hacked" around the glBufferData() update tracking in the driver (the driver doesn't track glBufferStorage() updates because those aren't a thing - the BO defined by glBufferStorage() is immutable and can't be updated, which is also the reason why we do glDeleteBuffers() + glGenBuffers()). At the same time, now going back to glBufferData() doesn't fix the issue because now additionally there's aliasing at the BO ID level.
This is arguably a driver bug, but our current buffer usage pattern is (temporarily, I assume) really weird so I'm not surprised we're breaking driver optimizations that usually work fine. I think we should do something more sensible with buffer updates (even though we're in code freeze, technically) and fix the regression, or otherwise revert everything up to 77f0149a6c99fc0289d12a788f630519d7dc49d3.
https://bugs.winehq.org/show_bug.cgi?id=50235
--- Comment #2 from Henri Verbeet hverbeet@gmail.com --- Created attachment 68824 --> https://bugs.winehq.org/attachment.cgi?id=68824 patch
Does the attached patch make it any better?
https://bugs.winehq.org/show_bug.cgi?id=50235
--- Comment #3 from Andrey Gusev andrey.goosev@gmail.com --- (In reply to Henri Verbeet from comment #2)
No, unfortunately.
(In reply to Matteo Bruni from comment #1)
I also noticed that 8b3cc57df0b791ca6c33f383f9358e1613206b84 makes performance a bit slow in Hitman: Absolution.
https://bugs.winehq.org/show_bug.cgi?id=50235
Olivier F. R. Dierick o.dierick@piezo-forte.be changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |o.dierick@piezo-forte.be
--- Comment #4 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- Hello,
I noticed a fps drop in The Elder Scrolls Online after updating from wine 5.21 to 6.0-rc3.
The regression test shows that the performance issue is first introduced by commit 77f0149 and after reverting that, secondly by commit 8b3cc57. That led me to this bug.
Reverting 77f0149 fixes the issues until commit 8b3cc57. After that commit, reverting both, with a tweak, makes the application render as fast as before, up to wine 6.0-rc3. The tweak reintroduces the definition of WINED3D_BUFFER_APPLESYNC and 'coherent' to the members of 'struct wined3d_bo_gl', used by later commits, to avoid compilation errors.
I also tested the hack and the patch:
With the hack from comment 1, all the memory was consumed before getting to actual gameplay, the game got stuck loading the saved character, presumably using disk swapping, and I had to kill the process.
The patch from comment 2 didn't have any visible effect on the performance issue.
On Nvidia RTX 2070 with proprietary driver 450.80.02.
Regards.
https://bugs.winehq.org/show_bug.cgi?id=50235
--- Comment #5 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- Created attachment 69043 --> https://bugs.winehq.org/attachment.cgi?id=69043 Patchset to revert the regression commits
This is simply reverting the two commits to a compilable state and restore the previous performance, not a fix by any means.
https://bugs.winehq.org/show_bug.cgi?id=50235
Olivier F. R. Dierick o.dierick@piezo-forte.be changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #69043|0 |1 is obsolete| |
--- Comment #6 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- Created attachment 69926 --> https://bugs.winehq.org/attachment.cgi?id=69926 Simple reverting patchset rebased for 6.7
Hello,
Simple reverting patchset, rebased for wine/wine-staging 6.7.
Still useful for me as a workaround for the performance drop introduced by the two regression commits.
Regards.
https://bugs.winehq.org/show_bug.cgi?id=50235
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |fgouget@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=50235
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #7 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-6.23?
https://bugs.winehq.org/show_bug.cgi?id=50235
--- Comment #8 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- (In reply to joaopa from comment #7)
Does the bug still occur with wine-6.23?
Hello,
I don't know about the broken textures and lights, but the FPS drop is still happening for me in World of Warship (ESO is broken) with wine 7.3.
I could work around the issue with the two reverts but I can no longer revert those commits. It makes the games crashs with GL_INVALID_OPERATION errors. There have been too many changes to Buffer Objects since, and I didn't keep track of them for rebasing the reverts.
Regards.
https://bugs.winehq.org/show_bug.cgi?id=50235
mirh mirh@protonmail.ch changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mirh@protonmail.ch
https://bugs.winehq.org/show_bug.cgi?id=50235
Ker noa blue-t@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |blue-t@web.de
https://bugs.winehq.org/show_bug.cgi?id=50235
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #9 from Zeb Figura z.figura12@gmail.com --- Are things any better with wine 8.0-rc4?
https://bugs.winehq.org/show_bug.cgi?id=50235
--- Comment #10 from Matteo Bruni matteo.mystral@gmail.com --- I haven't retested with pre-regression Wine to make sure but unfortunately it doesn't look like the regression is fixed in current Wine. In particular 69a730090abe81c5829c6504aac373babbe9e8a8 seems to not make a difference, at least in the main menu.
https://bugs.winehq.org/show_bug.cgi?id=50235
--- Comment #11 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- (In reply to Zeb Figura from comment #9)
Are things any better with wine 8.0-rc4?
Hello,
I see no improvement for the frame rate loss in World of Warships with 8.0-rc5.
Regards.
https://bugs.winehq.org/show_bug.cgi?id=50235
Neko-san nekoNexus@protonmail.ch changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nekoNexus@protonmail.ch