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
This commit is contained in:
Jeroen Bakker
2025-10-10 10:34:03 +02:00
parent 61033de969
commit ac9de14f03

View File

@@ -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;