[5/8] radv: determine the first subpass id for every attachments

Submitted by Samuel Pitoiset on May 30, 2019, 2:05 p.m.

Details

Message ID 20190530140521.31502-6-samuel.pitoiset@gmail.com
State New
Headers show
Series "radv: add support for sample locations during layout transitions" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset May 30, 2019, 2:05 p.m.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 src/amd/vulkan/radv_pass.c    | 18 ++++++++++++++++++
 src/amd/vulkan/radv_private.h |  3 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/vulkan/radv_pass.c b/src/amd/vulkan/radv_pass.c
index 4d1e38a780e..8fa098eaac8 100644
--- a/src/amd/vulkan/radv_pass.c
+++ b/src/amd/vulkan/radv_pass.c
@@ -62,6 +62,22 @@  radv_render_pass_add_subpass_dep(struct radv_render_pass *pass,
 static void
 radv_render_pass_compile(struct radv_render_pass *pass)
 {
+	for (uint32_t i = 0; i < pass->subpass_count; i++) {
+		struct radv_subpass *subpass = &pass->subpasses[i];
+
+		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->first_subpass_idx = UINT32_MAX;
+		}
+	}
+
 	for (uint32_t i = 0; i < pass->subpass_count; i++) {
 		struct radv_subpass *subpass = &pass->subpasses[i];
 		uint32_t color_sample_count = 1, depth_sample_count = 1;
@@ -84,6 +100,8 @@  radv_render_pass_compile(struct radv_render_pass *pass)
 			struct radv_render_pass_attachment *pass_att =
 				&pass->attachments[subpass_att->attachment];
 
+			if (i < pass_att->first_subpass_idx)
+				pass_att->first_subpass_idx = i;
 			pass_att->last_subpass_idx = i;
 		}
 
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 828edb56540..180f8b976ab 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1920,7 +1920,8 @@  struct radv_render_pass_attachment {
 	VkImageLayout                                initial_layout;
 	VkImageLayout                                final_layout;
 
-	/* The subpass id in which the attachment will be used last. */
+	/* The subpass id in which the attachment will be used first/last. */
+	uint32_t				     first_subpass_idx;
 	uint32_t                                     last_subpass_idx;
 };