Borderless fullscreen (Windows): keep the window composed (one row taller)

A window exactly covering the display is promoted by Windows to a direct /
independent flip. OpenGL swaps issued from the render thread then stop
reaching the screen on NVIDIA drivers: the image freezes while the game keeps
running, and it comes back as soon as anything forces composition (taskbar,
another window, a tooltip). The borderless window is now one row taller than
the display (the extra row is off-screen), so it always stays composed.
test_window_fullscreen checks the new size.

Seen with R4 on an RTX 3060 (driver 576.57), Windows 11, render thread on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rkyma8rbyPiccs9n2bkyG6
This commit is contained in:
yacineolivier-maker
2026-10-20 21:58:41 +02:00
parent fe8d937d69
commit 20a9312049
2 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -65,7 +65,13 @@ static inline int psx_window_fullscreen_set(SDL_Window* window,
SDL_SetWindowBordered(window, SDL_FALSE);
SDL_SetWindowResizable(window, SDL_FALSE);
SDL_SetWindowPosition(window, desktop.x, desktop.y);
SDL_SetWindowSize(window, desktop.w, desktop.h);
/* One row taller than the display: a window exactly covering it is
* promoted by Windows to a direct/independent flip, and OpenGL swaps
* from the render thread then stop reaching the screen (NVIDIA: the
* image freezes while the game runs; any overlay -- taskbar, another
* window -- forces composition and the frames reappear). The extra
* row is off-screen; the window stays composed. */
SDL_SetWindowSize(window, desktop.w, desktop.h + 1);
SDL_SyncWindow(window);
#elif defined(PSX_SDL3)
if (!SDL_SetWindowFullscreen(window, true)) return -1;
+2 -1
View File
@@ -35,7 +35,8 @@ int main() {
SDL_Rect bounds{};
SDL_GetDisplayBounds(SDL_GetDisplayForWindow(window), &bounds);
int full_w, full_h; SDL_GetWindowSize(window, &full_w, &full_h);
check(full_w == bounds.w && full_h == bounds.h, "borderless covers the current display");
check(full_w == bounds.w && full_h == bounds.h + 1,
"borderless covers the current display (one row over: stays composed)");
check(!SDL_CursorVisible(), "fullscreen cursor hidden");
SDL_DisplayMode current{};
check(SDL_GetCurrentDisplayMode(original_display, &current) == 0 &&