From f4d6043aa415e9a502168eb07fff9dcd51fa49cf Mon Sep 17 00:00:00 2001 From: Wilson Jallet Date: Tue, 19 Aug 2025 21:10:55 +0200 Subject: [PATCH] GPU: Fix Vulkan indexing error for resolve attachment refs (#13768) (cherry picked from commit 03b14f5211bcf4c6e7ef150a4ceb387f276d0c19) --- src/gpu/vulkan/SDL_gpu_vulkan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 7af5f56bf5..1d989e7be1 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -6089,7 +6089,6 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass( colorAttachmentReferences[colorAttachmentReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; attachmentDescriptionCount += 1; - colorAttachmentReferenceCount += 1; if (colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE || colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) { VulkanTextureContainer *resolveContainer = (VulkanTextureContainer *)colorTargetInfos[i].resolve_texture; @@ -6104,12 +6103,16 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass( attachmentDescriptions[attachmentDescriptionCount].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; attachmentDescriptions[attachmentDescriptionCount].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - resolveReferences[resolveReferenceCount].attachment = attachmentDescriptionCount; - resolveReferences[resolveReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + resolveReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount; + resolveReferences[colorAttachmentReferenceCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; attachmentDescriptionCount += 1; resolveReferenceCount += 1; + } else { + resolveReferences[colorAttachmentReferenceCount].attachment = VK_ATTACHMENT_UNUSED; } + + colorAttachmentReferenceCount += 1; } subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;