doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
12.95k stars 832 forks source link

[d3d9, regressions] Alt-tab issues in fullscreen at non native resolutions #4082

Open Blisto91 opened 3 months ago

Blisto91 commented 3 months ago

I've noticed a alt-tab issue that seemingly affects d3d9 games in general with dxvk. This behavior is a regression compared to older versions of dxvk. The issue happens you set the game to fullscreen mode and a non native resolution, that is different than 1080p for me. When you then do a alt-tab the game will be a mostly black screen except a small corner in the top left that will either show the game or a part of a background app.

The 3 games i have tested for this so far are Battlestations Midway, Borderlands 2 and Guild Wars 1. In all these cases setting d3d9.deviceLossOnFocusLoss = True works around the issue, but that might be a undesirable solution in general.

Midway and Borderlands 2

I have bisected the issue to start with commit https://github.com/doitsujin/dxvk/commit/83f6400a07035aba10538bd21336dcf89fc22393 @WinterSnowfall Gave me a little experiment and inserting the code below the linked line makes the issue go away. Not that it is a proper solution.

windowData.swapchain->RecreateSwapChain();

https://github.com/doitsujin/dxvk/blob/e9fc071d9548a6e865f09b9c03f9349ef0aa5c1e/src/d3d9/d3d9_window.cpp#L75

Guild Wars 1

Bisected to instead start with https://github.com/doitsujin/dxvk/commit/b0ed9e30ceeb8ef16d242ea189f53e717ab37201. The code trick above for Midway and Borderlands 2 does not work here for this one. I recently added a app profile to work around this before i knew of this being a general issue, so maybe that isn't a desired fix.

Note that the regressing commit for Midway and Borderlands 2 also have an effect for GW1 in that the mouse cursor will be restricted to the small corner up in the left side while visuals stay the same. This goes away in later dxvk versions (not bisected) before it then regresses visually the same with the commit noted in the GW1 section.

System information