From 30e3eba20ac6862a61e793a1538cd76e7f690d89 Mon Sep 17 00:00:00 2001
From: Cheney Wang <[EMAIL REDACTED]>
Date: Wed, 30 Jul 2025 17:44:47 -0400
Subject: [PATCH] GPU: Fix wrong Vulkan swapchain size when retrying acquire
(cherry picked from commit d8ac51859e79adae21a2e8b5696bab4780741e56)
---
src/gpu/vulkan/SDL_gpu_vulkan.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c
index f925836cdd4d5..93bc1158d1dc8 100644
--- a/src/gpu/vulkan/SDL_gpu_vulkan.c
+++ b/src/gpu/vulkan/SDL_gpu_vulkan.c
@@ -9951,13 +9951,6 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
}
}
- if (swapchainTextureWidth) {
- *swapchainTextureWidth = windowData->width;
- }
- if (swapchainTextureHeight) {
- *swapchainTextureHeight = windowData->height;
- }
-
if (windowData->inFlightFences[windowData->frameCounter] != NULL) {
if (block) {
// If we are blocking, just wait for the fence!
@@ -10009,6 +10002,14 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
}
}
+ if (swapchainTextureWidth) {
+ *swapchainTextureWidth = windowData->width;
+ }
+
+ if (swapchainTextureHeight) {
+ *swapchainTextureHeight = windowData->height;
+ }
+
swapchainTextureContainer = &windowData->textureContainers[swapchainImageIndex];
// We need a special execution dependency with pWaitDstStageMask or image transition can start before acquire finishes