[d3d9, regressions] Alt-tab issues in fullscreen at non native resolutions
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
- GPU: RTX 4080
- Driver: 550.40.63
- Wine version: Proton Bleeding Edge
Extra note as d8vk was merged since I made this.
This problem affects a bunch of d3d8 games the same and is probably a bigger issue there in practice since a lot of games from that era won't support 1080p and above. I personally consider this issue the biggest showstopper in regards to enabling d3d8 support by default in Proton as I would consider it a regression versus currently used wined3d.
Just to give my feedback here: I don't see this happening in Wine Staging, so I'm not sure if some combination of Proton fixes or fshack are playing a part in triggering it. Agreed that it's something that should be addressed, but not entirely sure if dxvk is at fault in the equation.
Found that Might & Magic: Heroes VI (d3d9Ex) have the same behavior and seem semi related as it also regressed with https://github.com/doitsujin/dxvk/commit/83f6400a07035aba10538bd21336dcf89fc22393. The difference is that the issue occurs even at native resolution and d3d9.deviceLossOnFocusLoss = True does not help.