From 2df5387e385bd332c24ad7376c8363db21897610 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Mon, 16 Aug 2021 12:04:47 +0200 Subject: [PATCH] tu: Consider depth/stencil for implicit dependencies Noticed by inspection. Part-of: --- src/freedreno/vulkan/tu_pass.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/freedreno/vulkan/tu_pass.c b/src/freedreno/vulkan/tu_pass.c index f29d805..feef006 100644 --- a/src/freedreno/vulkan/tu_pass.c +++ b/src/freedreno/vulkan/tu_pass.c @@ -235,6 +235,15 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, att_used[a] = true; } + if (subpass->pDepthStencilAttachment && + subpass->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { + uint32_t a = subpass->pDepthStencilAttachment->attachment; + if (att[a].initialLayout != subpass->pDepthStencilAttachment->layout && + !att_used[a] && !has_external_src[i]) + src_implicit_dep = true; + att_used[a] = true; + } + if (subpass->pResolveAttachments) { for (unsigned j = 0; j < subpass->colorAttachmentCount; j++) { uint32_t a = subpass->pResolveAttachments[j].attachment; @@ -247,6 +256,18 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, } } + const VkSubpassDescriptionDepthStencilResolve *ds_resolve = + vk_find_struct_const(subpass->pNext, SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR); + + if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment && + ds_resolve->pDepthStencilResolveAttachment->attachment != VK_ATTACHMENT_UNUSED) { + uint32_t a = ds_resolve->pDepthStencilResolveAttachment->attachment; + if (att[a].initialLayout != subpass->pDepthStencilAttachment->layout && + !att_used[a] && !has_external_src[i]) + src_implicit_dep = true; + att_used[a] = true; + } + if (src_implicit_dep) { tu_render_pass_add_subpass_dep(pass, &(VkSubpassDependency2KHR) { .srcSubpass = VK_SUBPASS_EXTERNAL, @@ -290,6 +311,15 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, att_used[a] = true; } + if (subpass->pDepthStencilAttachment && + subpass->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { + uint32_t a = subpass->pDepthStencilAttachment->attachment; + if (att[a].finalLayout != subpass->pDepthStencilAttachment->layout && + !att_used[a] && !has_external_dst[i]) + dst_implicit_dep = true; + att_used[a] = true; + } + if (subpass->pResolveAttachments) { for (unsigned j = 0; j < subpass->colorAttachmentCount; j++) { uint32_t a = subpass->pResolveAttachments[j].attachment; @@ -302,6 +332,18 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, } } + const VkSubpassDescriptionDepthStencilResolve *ds_resolve = + vk_find_struct_const(subpass->pNext, SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR); + + if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment && + ds_resolve->pDepthStencilResolveAttachment->attachment != VK_ATTACHMENT_UNUSED) { + uint32_t a = ds_resolve->pDepthStencilResolveAttachment->attachment; + if (att[a].finalLayout != subpass->pDepthStencilAttachment->layout && + !att_used[a] && !has_external_dst[i]) + dst_implicit_dep = true; + att_used[a] = true; + } + if (dst_implicit_dep) { tu_render_pass_add_subpass_dep(pass, &(VkSubpassDependency2KHR) { .srcSubpass = i, -- 2.7.4