From 5d3cf93aa3420ce4bd6bb22a42b5b4c438854170 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 10 Jan 2024 14:14:17 +1000 Subject: [PATCH] GPUDevice: Fix race on resize in GL/Vulkan --- src/util/opengl_device.cpp | 3 +++ src/util/vulkan_device.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/util/opengl_device.cpp b/src/util/opengl_device.cpp index 354d1ff97..4302da5e3 100644 --- a/src/util/opengl_device.cpp +++ b/src/util/opengl_device.cpp @@ -576,6 +576,9 @@ bool OpenGLDevice::UpdateWindow() void OpenGLDevice::ResizeWindow(s32 new_window_width, s32 new_window_height, float new_window_scale) { + if (m_window_info.IsSurfaceless()) + return; + m_window_info.surface_scale = new_window_scale; if (m_window_info.surface_width == static_cast(new_window_width) && m_window_info.surface_height == static_cast(new_window_height)) diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index df4537302..9d34e8709 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -2213,6 +2213,9 @@ bool VulkanDevice::UpdateWindow() void VulkanDevice::ResizeWindow(s32 new_window_width, s32 new_window_height, float new_window_scale) { + if (!m_swap_chain) + return; + if (m_swap_chain->GetWidth() == static_cast(new_window_width) && m_swap_chain->GetHeight() == static_cast(new_window_height)) {