diff --git a/.pick_status.json b/.pick_status.json index de9087cf56c..f97120be608 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -504,7 +504,7 @@ "description": "pvr: Add missing support for preserve attachments", "nominated": true, "nomination_type": 4, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/imagination/vulkan/pvr_arch_hw_pass.c b/src/imagination/vulkan/pvr_arch_hw_pass.c index 809ae974990..8e4eacad6d8 100644 --- a/src/imagination/vulkan/pvr_arch_hw_pass.c +++ b/src/imagination/vulkan/pvr_arch_hw_pass.c @@ -2290,6 +2290,10 @@ static VkResult pvr_schedule_subpass(const struct pvr_device *device, subpass_num, subpass->input_attachments, subpass->input_count); + pvr_dereference_surface_list(ctx, + subpass_num, + subpass->preserve_attachments, + subpass->preserve_count); if (subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) { struct pvr_render_int_attachment *int_depth_attach = &ctx->int_attach[subpass->depth_stencil_attachment]; @@ -2595,6 +2599,11 @@ VkResult pvr_arch_create_renderpass_hwsetup( subpass->input_count, i); + const uint32_t preserve_attachment_uses = + pvr_count_uses_in_attachment_list(subpass->preserve_attachments, + subpass->preserve_count, + i); + uint32_t resolve_output_uses; uint32_t color_output_uses; uint32_t total_output_uses; @@ -2604,13 +2613,13 @@ VkResult pvr_arch_create_renderpass_hwsetup( &color_output_uses, &resolve_output_uses); - total_output_uses = color_output_uses + resolve_output_uses; + total_output_uses = color_output_uses + resolve_output_uses + + input_attachment_uses + preserve_attachment_uses; - if (total_output_uses != 0U || input_attachment_uses != 0U) + if (total_output_uses != 0U) int_attach->last_read = j; - int_attach->remaining_count += - total_output_uses + input_attachment_uses; + int_attach->remaining_count += total_output_uses; if ((uint32_t)subpass->depth_stencil_attachment == i) int_attach->remaining_count++; diff --git a/src/imagination/vulkan/pvr_arch_pass.c b/src/imagination/vulkan/pvr_arch_pass.c index cc4bb76f2db..1179b4cd4ee 100644 --- a/src/imagination/vulkan/pvr_arch_pass.c +++ b/src/imagination/vulkan/pvr_arch_pass.c @@ -763,7 +763,9 @@ PVR_PER_ARCH(CreateRenderPass2)(VkDevice _device, const VkAllocationCallbacks *alloc; size_t subpass_attachment_count; size_t subpass_input_attachment_count; + size_t subpass_preserve_attachment_count; struct pvr_render_attachment *subpass_input_attachments; + struct pvr_render_attachment *subpass_preserve_attachments; uint32_t *subpass_attachments; struct pvr_render_pass *pass; uint32_t *dep_list; @@ -785,12 +787,14 @@ PVR_PER_ARCH(CreateRenderPass2)(VkDevice _device, subpass_attachment_count = 0; subpass_input_attachment_count = 0; + subpass_preserve_attachment_count = 0; for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) { const VkSubpassDescription2 *desc = &pCreateInfo->pSubpasses[i]; subpass_attachment_count += desc->colorAttachmentCount + (desc->pResolveAttachments ? desc->colorAttachmentCount : 0); subpass_input_attachment_count += desc->inputAttachmentCount; + subpass_preserve_attachment_count += desc->preserveAttachmentCount; } vk_multialloc_add(&ma, @@ -801,6 +805,10 @@ PVR_PER_ARCH(CreateRenderPass2)(VkDevice _device, &subpass_input_attachments, __typeof__(*subpass_input_attachments), subpass_input_attachment_count); + vk_multialloc_add(&ma, + &subpass_preserve_attachments, + __typeof__(*subpass_preserve_attachments), + subpass_preserve_attachment_count); vk_multialloc_add(&ma, &dep_list, __typeof__(*dep_list), @@ -989,6 +997,17 @@ PVR_PER_ARCH(CreateRenderPass2)(VkDevice _device, } } + subpass->preserve_count = desc->preserveAttachmentCount; + if (subpass->preserve_count > 0) { + subpass->preserve_attachments = subpass_preserve_attachments; + subpass_preserve_attachments += subpass->preserve_count; + + for (uint32_t j = 0; j < subpass->preserve_count; j++) { + subpass->preserve_attachments[j].attachment_idx = + desc->pPreserveAttachments[j]; + } + } + /* Give the dependencies a slice of the subpass_attachments array. */ subpass->dep_list = dep_list; dep_list += subpass->dep_count; diff --git a/src/imagination/vulkan/pvr_pass.h b/src/imagination/vulkan/pvr_pass.h index eb3971cbc99..9e6751927e4 100644 --- a/src/imagination/vulkan/pvr_pass.h +++ b/src/imagination/vulkan/pvr_pass.h @@ -71,6 +71,9 @@ struct pvr_render_subpass { uint32_t input_count; struct pvr_render_attachment *input_attachments; + uint32_t preserve_count; + struct pvr_render_attachment *preserve_attachments; + uint32_t depth_stencil_attachment; uint32_t depth_stencil_resolve_attachment;