radv: determine the last subpass id for every attachments
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 29 Jan 2019 21:18:53 +0000 (22:18 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 4 Feb 2019 12:17:59 +0000 (13:17 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_pass.c
src/amd/vulkan/radv_private.h

index 1102ef689b2ac5a9a61c68f6026b83882589622e..ac9f93812161f74ec83dec0ff0748ef543cdd785 100644 (file)
@@ -42,6 +42,18 @@ radv_render_pass_compile(struct radv_render_pass *pass)
                if (subpass->depth_stencil_attachment &&
                    subpass->depth_stencil_attachment->attachment == VK_ATTACHMENT_UNUSED)
                        subpass->depth_stencil_attachment = NULL;
+
+               for (uint32_t j = 0; j < subpass->attachment_count; j++) {
+                       struct radv_subpass_attachment *subpass_att =
+                               &subpass->attachments[j];
+                       if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
+                               continue;
+
+                       struct radv_render_pass_attachment *pass_att =
+                               &pass->attachments[subpass_att->attachment];
+
+                       pass_att->last_subpass_idx = i;
+               }
        }
 }
 
index 4863841a0ac2878cb9a1b90703bd65ff76aff669..3d1782b559d2cfdbd928bd3264394e228e1c5e48 100644 (file)
@@ -1841,6 +1841,9 @@ struct radv_render_pass_attachment {
        VkAttachmentLoadOp                           stencil_load_op;
        VkImageLayout                                initial_layout;
        VkImageLayout                                final_layout;
+
+       /* The subpass id in which the attachment will be used last. */
+       uint32_t                                     last_subpass_idx;
 };
 
 struct radv_render_pass {