From a58bc3eaf4f042659a44867c089e70922d2005e7 Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Sat, 4 Jan 2025 10:25:08 -0800 Subject: [PATCH] [GPU] Fix crash in nvidia user-mode win32 driver when game window is minimized during swapchain resize (#11848) --- src/gpu/vulkan/SDL_gpu_vulkan.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index de135f4ee6a32..98217ca4370f4 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -4463,6 +4463,7 @@ static Uint32 VULKAN_INTERNAL_CreateSwapchain( &windowData->surface)) { return false; } + SDL_assert(windowData->surface); if (!VULKAN_INTERNAL_QuerySwapchainSupport( renderer, @@ -9471,6 +9472,9 @@ static bool VULKAN_SupportsSwapchainComposition( } surface = windowData->surface; + if (!surface) { + SET_STRING_ERROR_AND_RETURN("Window has no Vulkan surface", false); + } if (VULKAN_INTERNAL_QuerySwapchainSupport( renderer, @@ -9516,6 +9520,9 @@ static bool VULKAN_SupportsPresentMode( } surface = windowData->surface; + if (!surface) { + SET_STRING_ERROR_AND_RETURN("Window has no Vulkan surface", false); + } if (VULKAN_INTERNAL_QuerySwapchainSupport( renderer,