From b3f162746d1b1bdd7c8ea093554a4c8a360536f2 Mon Sep 17 00:00:00 2001 From: ipavlin98 Date: Mon, 2 Nov 2026 10:53:06 +0300 Subject: [PATCH 1/2] Clear the swapchain's stale mark before reading the surface so a resize during the build is not lost The mark used to be cleared after the swapchain was built, which dropped a resize that arrived meanwhile. The switch to fullscreen at start lands there on the window thread, and the driver does not report the swapchain as out of date. --- runtime/gfx_present.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/runtime/gfx_present.c b/runtime/gfx_present.c index 9b5afbbf..2cff8e29 100644 --- a/runtime/gfx_present.c +++ b/runtime/gfx_present.c @@ -295,8 +295,7 @@ static void free_capture(void) { g_cap_valid = 0; } -// Returns 1 with a usable swapchain, 0 when the window has no area (minimised). Called with g_pl held. -static int create_swapchain(void) { +static int build_swapchain(void) { flip_locked(); // the acquired image goes out before its swapchain is replaced VkCtx *c = vk_ctx(); VkSurfaceCapabilitiesKHR caps; @@ -364,10 +363,19 @@ static int create_swapchain(void) { } free_capture(); vk_queue_unlock(); - plat_xchg32(&g_dirty, 0); return 1; } +// Returns 1 with a usable swapchain, 0 when the window has no area (minimised). Called with g_pl held. The stale mark +// goes before the surface is read: a resize during the build keeps it. The switch to fullscreen at start lands there +// on the window thread, and the driver does not report the swapchain as out of date. +static int create_swapchain(void) { + plat_xchg32(&g_dirty, 0); + if (build_swapchain()) return 1; + plat_xchg32(&g_dirty, 1); + return 0; +} + static void sync_barrier(VkCommandBuffer cb, VkImage img, VkImageLayout from, VkImageLayout to, VkPipelineStageFlags2 s0, VkAccessFlags2 a0, VkPipelineStageFlags2 s1, VkAccessFlags2 a1) { VkImageMemoryBarrier2 b = {.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2, .srcStageMask = s0, .srcAccessMask = a0, From d531e96d35ac5c83b59b0ca2b79d6b9541376611 Mon Sep 17 00:00:00 2001 From: Wintego <17454585+Wintego@users.noreply.github.com> Date: Thu, 5 Nov 2026 08:30:33 +0300 Subject: [PATCH 2/2] Go fullscreen at start again when the window is raised --- runtime/gfx_window_win.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/gfx_window_win.c b/runtime/gfx_window_win.c index 51dafe04..71806dd9 100644 --- a/runtime/gfx_window_win.c +++ b/runtime/gfx_window_win.c @@ -333,10 +333,12 @@ static void window_main(void *arg) { outer_size(g_hwnd, cw, ch, &ow, &oh); SetWindowPos(g_hwnd, HWND_BOTTOM, 0, 0, ow, oh, SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW); if (!background) { + // Pending before the raise: the activation it gets is the first WM_ACTIVATEAPP, which takes the fullscreen + // setting; set after it, fullscreen waited for the next activation and the game started in a window + g_fs_pending = cfg_fullscreen(); raise_window(g_hwnd); // a frontend's player may have no way to reach a window left behind FLASHWINFO fw = {.cbSize = sizeof fw, .hwnd = g_hwnd, .dwFlags = FLASHW_TRAY | FLASHW_TIMERNOFG}; FlashWindowEx(&fw); - g_fs_pending = cfg_fullscreen(); } note_applied(); refresh_rate_update(g_hwnd, 1);