From ac9de14f032e32f3c488edb58d93f10077a6524e Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 10 Oct 2025 10:34:03 +0200 Subject: [PATCH] Fix: Vulkan: Incorrect color attachments When using a framebuffer without any color attachments there was always a single color attachment acounted for. This oversight was detected when looking into #147299. Pull Request: https://projects.blender.org/blender/blender/pulls/147791 --- source/blender/gpu/vulkan/vk_framebuffer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/vulkan/vk_framebuffer.cc b/source/blender/gpu/vulkan/vk_framebuffer.cc index 3f7a137188d..300ce0bf8b1 100644 --- a/source/blender/gpu/vulkan/vk_framebuffer.cc +++ b/source/blender/gpu/vulkan/vk_framebuffer.cc @@ -578,7 +578,7 @@ void VKFrameBuffer::rendering_ensure_dynamic_rendering(VKContext &context, render_area_update(begin_rendering.node_data.vk_rendering_info.renderArea); color_attachment_formats_.clear(); - uint32_t max_filled_slot_index = 0; + int32_t max_filled_slot_index = -1; for (int color_attachment_index : IndexRange(GPU_FB_COLOR_ATTACHMENT0, GPU_FB_MAX_COLOR_ATTACHMENT)) { @@ -652,7 +652,7 @@ void VKFrameBuffer::rendering_ensure_dynamic_rendering(VKContext &context, VK_FORMAT_UNDEFINED : vk_format); } - color_attachment_size = max_filled_slot_index + 1; + color_attachment_size = uint32_t(max_filled_slot_index + 1); begin_rendering.node_data.vk_rendering_info.colorAttachmentCount = color_attachment_size; begin_rendering.node_data.vk_rendering_info.pColorAttachments = begin_rendering.node_data.color_attachments;