From 589aea50c295df7b144c6b557490f2c767065d5c Mon Sep 17 00:00:00 2001 From: Jordan Saunders Date: Fri, 29 Aug 2025 21:39:03 -0700 Subject: [PATCH] Fix two uninitialized variables Found when running in valgrind looking at another issue. - RenderPass' depth_stencil_target Tripped in SDL_BindGPUFragmentSamplers when not binding a DS target - VulkanCommandBuffer's swapchainRequested Tripped in VULKAN_Submit for the end transition barrier when creating an image. The field is only reset when reused, not on first use (cherry picked from commit 265236d952dea4f50cf2e1340311848d6892b137) --- src/gpu/SDL_gpu.c | 2 ++ src/gpu/vulkan/SDL_gpu_vulkan.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c index aea7ed5c97..d21d863bb8 100644 --- a/src/gpu/SDL_gpu.c +++ b/src/gpu/SDL_gpu.c @@ -1785,6 +1785,8 @@ SDL_GPURenderPass *SDL_BeginGPURenderPass( commandBufferHeader->render_pass.num_color_targets = num_color_targets; if (depth_stencil_target_info != NULL) { commandBufferHeader->render_pass.depth_stencil_target = depth_stencil_target_info->texture; + } else { + commandBufferHeader->render_pass.depth_stencil_target = NULL; } } diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 1d989e7be1..d1896531ed 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -9408,6 +9408,8 @@ static bool VULKAN_INTERNAL_AllocateCommandBuffer( commandBuffer->usedUniformBuffers = SDL_malloc( commandBuffer->usedUniformBufferCapacity * sizeof(VulkanUniformBuffer *)); + commandBuffer->swapchainRequested = false; + // Pool it! vulkanCommandPool->inactiveCommandBuffers[vulkanCommandPool->inactiveCommandBufferCount] = commandBuffer;