From b8bf9f1510de24bbbc61c27e23a825d83a2f80e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sat, 22 Aug 2026 18:03:08 +0200 Subject: [PATCH] Fix back buffer not resizing on fullscreen toggle Window::OnResized() (called for every SDL window-resize event, including entering/leaving browser fullscreen) updated the window's own tracked pixel size but never propagated it to the window's back buffer render target, whose stale size kept driving glViewport() - so toggling fullscreen resized the canvas but rendering stayed pinned to the old, smaller viewport. Mirrors the resize handling the BGFX backend already does explicitly elsewhere in RenderDevice.cpp. Co-Authored-By: Claude Sonnet 5 --- ...005-window-onresized-backbuffer-sync.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/vpinball/0005-window-onresized-backbuffer-sync.patch diff --git a/patches/vpinball/0005-window-onresized-backbuffer-sync.patch b/patches/vpinball/0005-window-onresized-backbuffer-sync.patch new file mode 100644 index 0000000..b8940aa --- /dev/null +++ b/patches/vpinball/0005-window-onresized-backbuffer-sync.patch @@ -0,0 +1,20 @@ +diff --git a/src/renderer/Window.cpp b/src/renderer/Window.cpp +index ad608f8..3dff060 100644 +--- a/src/renderer/Window.cpp ++++ b/src/renderer/Window.cpp +@@ -381,6 +381,15 @@ void Window::OnResized() + return; + SDL_GetWindowSize(m_nwnd, &m_width, &m_height); + SDL_GetWindowSizeInPixels(m_nwnd, &m_pixelWidth, &m_pixelHeight); ++ // vpinball-wasm: keep the (GL) default back buffer's tracked size in sync ++ // with the window's actual pixel size, mirroring what the BGFX backend ++ // already does explicitly every frame (RenderDevice.cpp's swapchain ++ // resize handling). Without this, glViewport(0, 0, m_width, m_height) in ++ // RenderTarget::Activate() keeps using the pre-resize size forever, so ++ // e.g. entering browser fullscreen (which resizes the canvas well after ++ // the back buffer was created) only renders into the old, smaller area. ++ if (m_backBuffer) ++ m_backBuffer->SetSize(m_pixelWidth, m_pixelHeight); + } + + VPX::Window::VideoMode Window::SDLtoVPXVideoMode(const SDL_DisplayMode* mode)