[DesktopVK] Soft fullscreen behaves like exclusive fullscreen on NVIDIA when the device is created with vsync off (the first swapchain's present mode fixes the driver's present path)`
Prerequisites
- I have verified this issue is present in the
developbranch - I have searched open and closed issues to ensure it has not already been reported.
LLM Declaration
- I used an LLM to generate the code or fix in this Issue.
MonoGame Version
3.8.5
Which MonoGame platform are you using?
MonoGame Cross-Platform Desktop Vulkan Application
Operating System
Windows 11
Description
With IsFullScreen = true and HardwareModeSwitch = false, the Native/DesktopVK backend creates the
right SDL FULLSCREEN_DESKTOP window, but on NVIDIA with the default "Vulkan/OpenGL present method:
Auto" the window still behaves like exclusive fullscreen whenever SynchronizeWithVerticalRetrace was
false at device creation: the display re-initialises on every focus loss and every focus gain. The
driver fixes its presentation path at the first swapchain created on the surface. Born immediate-mode,
it takes the display over for every later swapchain on that surface. Born FIFO, it stays composited for
the life of the surface, even after the swapchain is rebuilt immediate-mode and runs uncapped.
- MonoGame 3.8.5:
MonoGame.Framework.Native3.8.5 +MonoGame.Runtime.Windows.Vulkan3.8.5 (mgruntime.dll, SDL 2.32.10 statically linked) - Windows 11 (build 26200), NVIDIA GeForce RTX 4080, driver 595.79 (32.0.15.9579), three monitors
- NVIDIA Control Panel "Vulkan/OpenGL present method" at its default, Auto
Steps to Reproduce
dotnet run, then Alt+Tab away and back. Blue is focused, red is not.
The whole difference between blanking and not is where this one line lives:
_graphics = new GraphicsDeviceManager(this) { SynchronizeWithVerticalRetrace = false }; // blanksversus setting SynchronizeWithVerticalRetrace = false in Initialize, before the ApplyChanges that
enters soft fullscreen, which does not blank. Measured with IsFixedTimeStep = false and the frame rate
printed from Draw:
| first swapchain | later swapchain | focus change | fps while focused |
|---|---|---|---|
| immediate (vsync off in the ctor) | immediate | display blanks both ways | 7,000 to 10,000 |
| FIFO (vsync on in the ctor), switched off in the same apply as fullscreen | immediate | composited, no blank | about 3,000 |
| FIFO, switched off while still windowed, fullscreen afterwards | immediate | composited, no blank | about 3,000 |
The frame-rate gap is the exclusive flip path against DWM composition. Both composited cases run far above the 270 Hz refresh, so the late vsync-off switch is honoured; it just never changes the path.
Minimal Example Repo
https://github.com/nathanmarsh-dev/MonoGame.DesktopVK.SoftFullscreenRepro
Expected Behavior
When Alt + Tab or Windows Key and clicking out of the game, the monitor does not blank out.
Resulting Behavior
the monitor goes black for a moment on every focus loss and every focus gain, identical to
HardwareModeSwitch = true.
Files
Source: MonoGame/MonoGame