SDL_SetWindowFullscreen causes system freeze
Summary
When entering or exiting fullscreen on Windows, my application detects the change in window/display state and subsequently recreates the Vulkan swapchain. During this transition, the system may completely freeze.
After testing multiple configurations, the issue appears to occur specifically when using SDL3's borderless fullscreen mode through SDL_SetWindowFullscreen().
Reproduction
Switching in/out of fullscreen mode using Vulkan.
Expected behavior
The application switches from borderless fullscreen back to windowed mode and continues running normally.
Actual behavior
The entire system freezes when exiting fullscreen.
I have been able to reproduce the issue on multiple physical PCs and laptops. I have not been able to reproduce it in virtual machines using GPU virtualization.
The application uses bgfx for rendering, but I have not been able to trace the issue back to bgfx itself.
Workaround
The issue can be avoided by explicitly forcing one of the available display modes returned by SDL_GetFullscreenDisplayModes() instead of relying on SDL3's borderless fullscreen behavior.
Please note that some DisplayModes also have the same issue.
My current guess is that the Vulkan swapchain recreation triggers a deadlock somewhere in the GPU driver or graphics stack, ultimately causing the system to freeze.
Source: libsdl-org/SDL