https://bugs.winehq.org/show_bug.cgi?id=57411
Bug ID: 57411 Summary: Heroes of the Storm: screen sporadically flickers black Product: Wine Version: 8.4 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: d3d Assignee: wine-bugs@winehq.org Reporter: matteo.mystral@gmail.com Distribution: ---
You can already notice it in the login screen you get by running the game directly (.../Support64/HeroesSwitcher_x64.exe).
Regression test blames:
46c8a637525d0f1cf67830295fb460c819b800b6 is the first bad commit commit 46c8a637525d0f1cf67830295fb460c819b800b6 Author: Zebediah Figura zfigura@codeweavers.com Date: Fri Jan 20 16:23:42 2023 -0600
winex11: Separately store the internal pixel format set by WGL_WINE_pixel_format_passthrough.
dlls/d3d8/tests/device.c | 6 +++--- dlls/d3d9/tests/device.c | 6 +++--- dlls/ddraw/tests/ddraw1.c | 6 +++--- dlls/ddraw/tests/ddraw2.c | 6 +++--- dlls/ddraw/tests/ddraw4.c | 6 +++--- dlls/ddraw/tests/ddraw7.c | 6 +++--- dlls/winex11.drv/opengl.c | 26 +++++++++++--------------- 7 files changed, 29 insertions(+), 33 deletions(-)
Although effectively it seems to be kind of a bad interaction with my commit 72597b170e814599ef2be4b19dc4b9de0932a30f "wined3d: Don't use separate GL contexts for different swapchains." compounded with wined3d being a bit overeager with switching window for GL contexts.
The game uses D3D11CreateDeviceAndSwapChain() to initialize the device and (AFAICS) always uses the returned swapchain to do all its work. Except, every now and then (about once every ~4 frames?) it clears the implicit swapchain's back buffer.
At the moment, wined3d_context_gl_acquire() never attempts to reuse the current context if it has NULL target (e.g. because the texture that was used for the original activation of the context was released in the meantime, which is always the case when this bug triggers). What effectively happens for such (offscreen) clears is that wined3d activates the GL context on the implicit swapchain, on a different window, and that resets internal_format_set (see wined3d_context_gl_update_window()) which leads to resetting the pixel format on it. Soon afterwards the game will do some operation that requires the "real" swapchain (e.g. Present()) and wined3d will reactivate the context on the explicit swapchain, bouncing back and forth between the two swapchains / windows and resetting pixel format every time.
I guess one way to fix this in general would be to keep per-window values for the current pixel format / internal format set flag in struct wined3d_context_gl, so that we avoid spurious pixel format resets when flipping through multiple windows.
In this case though, it's enough to always allow reusing the current context if we don't need to access any on-screen resource. I'm going to open an MR that does just that in a bit.
https://bugs.winehq.org/show_bug.cgi?id=57411
--- Comment #1 from Matteo Bruni matteo.mystral@gmail.com --- Opened https://gitlab.winehq.org/wine/wine/-/merge_requests/6806 with the patch I just mentioned.
https://bugs.winehq.org/show_bug.cgi?id=57411
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #2 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to Matteo Bruni from comment #1)
Opened https://gitlab.winehq.org/wine/wine/-/merge_requests/6806 with the patch I just mentioned.
Merged as 8923eb51ea56329bfccd572b95b80175352d3b55 (after some needed fixes).
https://bugs.winehq.org/show_bug.cgi?id=57411
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 10.0-rc1.