From 9c322386bf7f132c076d9662650cae1d9e09c1d0 Mon Sep 17 00:00:00 2001 From: David Gow Date: Thu, 10 Oct 2024 21:47:27 +0800 Subject: [PATCH] gpu: vulkan: Fix an uninitialised structure in SDL_BlitGPUTexture() The SDL_GPUColorTargetInfo structure needs to be zeroed, as otherwise we can end up trying to create a resolve_texture which doesn't exist, causing a rather difficult-to-debug segfault when calling SDL_BlitGPUTexture() with a load op of SDL_GPU_LOADOP_CLEAR. --- src/gpu/vulkan/SDL_gpu_vulkan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 8ff9aad1e..db40d6788 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -8949,6 +8949,7 @@ static void VULKAN_Blit( // Using BeginRenderPass to clear because vkCmdClearColorImage requires barriers anyway if (info->load_op == SDL_GPU_LOADOP_CLEAR) { SDL_GPUColorTargetInfo targetInfo; + SDL_zero(targetInfo); targetInfo.texture = info->destination.texture; targetInfo.mip_level = info->destination.mip_level; targetInfo.layer_or_depth_plane = info->destination.layer_or_depth_plane;