From 732724bf75c2886754cda05d78109f8a550054b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 26 Aug 2026 06:40:45 +0000 Subject: [PATCH] VK, WebGPU: Fixed frame buffer resize on headless reset. (#3931) --- src/renderer_vk.cpp | 13 +++++++++++++ src/renderer_webgpu.cpp | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index 511a445f8..46ed823f5 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -3221,6 +3221,19 @@ VK_IMPORT_DEVICE if (NULL == m_backBuffer.m_nwh) { + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height) + { + m_resolution.width = _resolution.width; + m_resolution.height = _resolution.height; + + for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) + { + m_frameBuffers[ii].preReset(); + m_frameBuffers[ii].postReset(); + } + } + return suspended; } diff --git a/src/renderer_webgpu.cpp b/src/renderer_webgpu.cpp index d1bc54232..762a54845 100644 --- a/src/renderer_webgpu.cpp +++ b/src/renderer_webgpu.cpp @@ -2599,6 +2599,19 @@ WGPU_IMPORT if (!m_backBuffer.isSwapChain() ) { + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height) + { + m_resolution.width = _resolution.width; + m_resolution.height = _resolution.height; + + for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) + { + m_frameBuffers[ii].preReset(); + m_frameBuffers[ii].postReset(); + } + } + return suspended; } @@ -6088,6 +6101,7 @@ m_resolution.formatColor = TextureFormat::BGRA8; const bool direct = (1 == numRows*depth || 0 == rowPitch % 256) && 0 == bufferOffset % offsetAlign + && 0 == bufferOffset % 512 ; const uint32_t numCopies = direct ? 1 : numRows*depth;