From 351eaffdc5cb1706d036fcfc80f209d8b2f1dfcd Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Fri, 17 Apr 2026 23:38:45 +0800 Subject: [PATCH] pvr: fix handling of invalid attachment info in pvr_init_fs_outputs_mrt The attachments field of the render pass state could be MESA_VK_RP_ATTACHMENT_INFO_INVALID, which indicates no attachment information is valid. If such situation really happens when initializing the fragment state of a pipeline, this means neither a render pass nor a VkPipelineRenderingCreateInfo structure is available -- in this case, the specificiation for that structure says colorAttachmentCount is considered as 0, so the loop iterating color attachments should just not happen. Skip iterating color attachments if the render pass has a attachments field with value MESA_VK_RP_ATTACHMENT_INFO. This fixes some regression on the Vulkan CTS testcase dEQP-VK.pipeline.monolithic.misc.no_rendering introduced by !40870, in which MESA_VK_RP_ATTACHMENT_INFO instead of 0 is set as the value of the attachments field of the render pass state, if neither a render pass nor the VkPipelineRenderingCreateInfo structure is available. Fixes: 1950b6c1a7ce ("vulkan: mark RP attachments as invalid when no rendering create info") Signed-off-by: Icenowy Zheng Acked-by: Frank Binns Part-of: --- src/imagination/vulkan/pvr_arch_pipeline.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/imagination/vulkan/pvr_arch_pipeline.c b/src/imagination/vulkan/pvr_arch_pipeline.c index 602a1046707..8cbc5ef3821 100644 --- a/src/imagination/vulkan/pvr_arch_pipeline.c +++ b/src/imagination/vulkan/pvr_arch_pipeline.c @@ -2016,6 +2016,9 @@ static void pvr_init_fs_outputs_mrt(pco_data *data, unsigned u; pco_fs_data *fs = &data->fs; + if (!vk_render_pass_state_has_attachment_info(rp)) + goto early_exit; + for (u = 0; u < PVR_MAX_COLOR_ATTACHMENTS; u++) { if (!(rp->attachments & MESA_VK_RP_ATTACHMENT_COLOR_BIT(u))) continue; @@ -2036,6 +2039,7 @@ static void pvr_init_fs_outputs_mrt(pco_data *data, } } +early_exit: fs->z_replicate = ~0u; }