Mesa (master): anv: Add TRANSFER_SRC to pass usage not subpass usage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 28 22:52:24 UTC 2020


Module: Mesa
Branch: master
Commit: 5808efdf40d2496e14625322c1f9e8bdbe6f8c36
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5808efdf40d2496e14625322c1f9e8bdbe6f8c36

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Mar 25 00:43:14 2020 -0500

anv: Add TRANSFER_SRC to pass usage not subpass usage

The subpass usage flags are supposed to always be one bit and never
multiple bits.  However, when adding in TRANSFER_SRC usage for resolve
attachments we were adding it to the subpass bits and not the render
pass bits.  This potentially is causing issues where images aren't
getting marked written properly.

Reviewed-by: Rafael Antognolli <rafael.antognolli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4393>

---

 src/intel/vulkan/anv_pass.c        | 18 +++++++++++++++---
 src/intel/vulkan/genX_cmd_buffer.c |  1 +
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
index 69a66478c56..ec32e0ca3bd 100644
--- a/src/intel/vulkan/anv_pass.c
+++ b/src/intel/vulkan/anv_pass.c
@@ -86,7 +86,6 @@ anv_render_pass_compile(struct anv_render_pass *pass)
          struct anv_render_pass_attachment *pass_att =
             &pass->attachments[subpass_att->attachment];
 
-         assert(__builtin_popcount(subpass_att->usage) == 1);
          pass_att->usage |= subpass_att->usage;
          pass_att->last_subpass_idx = i;
 
@@ -116,8 +115,13 @@ anv_render_pass_compile(struct anv_render_pass *pass)
 
             subpass->has_color_resolve = true;
 
+            assert(color_att->attachment < pass->attachment_count);
+            struct anv_render_pass_attachment *color_pass_att =
+               &pass->attachments[color_att->attachment];
+
             assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT);
-            color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+            assert(color_att->usage == VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
+            color_pass_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
          }
       }
 
@@ -127,9 +131,17 @@ anv_render_pass_compile(struct anv_render_pass *pass)
          UNUSED struct anv_subpass_attachment *resolve_att =
             subpass->ds_resolve_attachment;
 
+         assert(ds_att->attachment < pass->attachment_count);
+         struct anv_render_pass_attachment *ds_pass_att =
+            &pass->attachments[ds_att->attachment];
+
          assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT);
-         ds_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+         assert(ds_att->usage == VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
+         ds_pass_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
       }
+
+      for (uint32_t j = 0; j < subpass->attachment_count; j++)
+         assert(__builtin_popcount(subpass->attachments[j].usage) == 1);
    }
 
    /* From the Vulkan 1.0.39 spec:
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 3ac514ee777..28c375cb1b8 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -5238,6 +5238,7 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
          }
       }
 
+      assert(util_bitcount(subpass->attachments[i].usage) == 1);
       if (subpass->attachments[i].usage ==
           VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
          /* We assume that if we're starting a subpass, we're going to do some



More information about the mesa-commit mailing list