tu: Consider depth/stencil for implicit dependencies
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 16 Aug 2021 10:04:47 +0000 (12:04 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 17 Aug 2021 18:33:17 +0000 (18:33 +0000)
Noticed by inspection.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12386>

src/freedreno/vulkan/tu_pass.c

index f29d805..feef006 100644 (file)
@@ -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,