Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d3d9] Front/Backbuffer flipping leads to flickering in games that don't respect DISCARD SwapEffect #1368

Closed
w-flo opened this issue Jan 24, 2020 · 2 comments

Comments

@w-flo
Copy link
Contributor

w-flo commented Jan 24, 2020

Thanks for dxvk, it's great :-) It looks like my FPS in a benchmark situation in ZUSI 3 are now better than on Windows (20 vs. 18, wined3d gets 14), but I need to double check.

The recent introduction of a front buffer in the swap chain causes some issues though. After looking into it, I believe the game actually doesn't redraw all pixels for every frame even though it uses the DISCARD SwapEffect. It apparently still expects the "current" backbuffer to be unchanged after Present(), even though that is not guaranteed on any system unless the COPY SwapEffect is used. Apparently it still works under most circumstances when setting the presentation params to windowed. (Exclusive fullscreen mode is available in the game settings, but heavily discouraged.)

Or maybe I'm reading the apitrace wrong / missing something and it actually DOES redraw everything, and dxvk just fails to do that successfully.

This results in strange flickering effects when using dxvk, but not wined3d and most Windows setups in windowed mode. Thankfully, someone posted a vid when he had the issue on Windows: https://www.youtube.com/watch?v=bm7Lk2O0Ink That issue eventually solved itself without changing anything in the game, probably an automatic Windows or driver update.

I could understand if this is a WONTFIX if the bug is in ZUSI, but since most Windows drivers seem to handle this pretty gracefully, maybe it would be possible to fix it in DXVK. I'm not really sure how that would work though. If it comes at a performance cost, then it shouldn't be a default behavior to imitate COPY SwapEffect behavior even when the application requests DISCARD.

I have verified that simply commenting out the "Rotate swap chain buffers" loop fixes the flickering. Also, released versions including v1.5.1 obviously don't flicker so you could call this a regression.

Software information

ZUSI 3 - Aerosoft Edition https://store.steampowered.com/app/1040730/ZUSI_3__Aerosoft_Edition/
Pretty much default settings, but in the wine prefix / proton "dist" directory I use dsound.dll from wine-staging, a hacked iphlpapi.dll, winetricks gdiplus and some winetricks dotnet versions and fonts to fix various game issues.

System information

  • GPU: HD 7870 (GCN 1.0)
  • Driver: amdgpu from XanMod kernel + radv from Ubuntu 19.10 mesa (19.2.1)
  • Wine version: Proton 4.11-12, but with modified wine prefix (see last section)
  • DXVK version: git 6776765 with added FlushImplicit(FALSE) in FlushBuffer() to make MANAGED vertex/index buffers load correctly in ZUSI (sync/driver bug?), that's why my version info in the log is different

Apitrace file(s)

https://drive.google.com/file/d/1aJEv2aArCWT-1cStf5h1p3j7bmJOvqwz/view?usp=sharing . Flickering starts at frame ~370 when using dxvk.

Log files

@doitsujin
Copy link
Owner

If this is a game bug then we could add a workaround, although I'd like to understand the problem first and for that we'd need an apitrace. It's not exactly clear how to contact you, and in general we'd like apitrace links to be posted right away since having to send messages back and forth and wait for several hours or days is quite frankly just wasting everyone's time.

@w-flo
Copy link
Contributor Author

w-flo commented Jan 24, 2020

Alright, sorry about that. The trace is at https://drive.google.com/file/d/1aJEv2aArCWT-1cStf5h1p3j7bmJOvqwz/view?usp=sharing . Flickering starts at frame ~370 when using dxvk.

Note that I will remove the file once the issue is fixed or gets stuck since I'm not sure about the legal consequences of sharing the file.

w-flo added a commit to w-flo/dxvk that referenced this issue Feb 11, 2020
Fixes flickering when parts of the screen are not redrawn in a frame.

Closes: doitsujin#1368
misyltoad pushed a commit that referenced this issue Mar 18, 2020
Fixes flickering when parts of the screen are not redrawn in a frame.

Closes #1368
Merges #1437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants