sdl_window: Call SDL_SyncWindow after setting fullscreen mode (#4131)

SDL_SetWindowFullscreen is asynchronous on Windows. Without
SDL_SyncWindow, the window may not have finished transitioning
to borderless fullscreen before the Vulkan surface and swapchain
are created, causing borderless mode to silently fail at startup.

This is most visible with Immediate (No VSync) present mode where
the swapchain is created quickly, but the fix is correct for all
present modes.

SDL3 docs state: "On asynchronous windowing systems, this acts as a
synchronization barrier for pending window state." and SDL_SyncWindow
is listed as the recommended follow-up to SDL_SetWindowFullscreen.
https://wiki.libsdl.org/SDL3/SDL_SyncWindow

Fixes #3945
This commit is contained in:
Semahegn 2026-03-19 11:02:03 +03:00 committed by GitHub
parent f245cf76a7
commit 64e10e6f98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -323,6 +323,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_
window, Config::getFullscreenMode() == "Fullscreen" ? displayMode : NULL);
}
SDL_SetWindowFullscreen(window, Config::getIsFullscreen());
SDL_SyncWindow(window);
SDL_InitSubSystem(SDL_INIT_GAMEPAD);
controller->SetEngine(std::make_unique<Input::SDLInputEngine>());