protonscr

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

dxvkclosed
doitsujin/dxvk#1368 · opened 2020-01-24 by w-flo · updated 2020-03-18 · 2 comments · github
Ww-flo 2020-01-24 github

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 67767650 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

Ddoitsujin maintainer 2020-01-24 github

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.

Ww-flo 2020-01-24 github

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.

Proton versions

DLLs