Module: Mesa
Branch: main
Commit: c42e7aa46cde839d7ecba1737505f40a076efb83
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c42e7aa46cde839d7ecba1737505f40a076efb83

Author: Connor Abbott <[email protected]>
Date:   Fri Jun 24 15:05:34 2022 +0200

tu: Move TU_DONT_CARE_AS_LOAD into attachment_set_ops()

So that we can share it with dynamic rendering.

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

---

 src/freedreno/vulkan/tu_pass.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/freedreno/vulkan/tu_pass.c b/src/freedreno/vulkan/tu_pass.c
index fe3c32c78ff..43f497295dc 100644
--- a/src/freedreno/vulkan/tu_pass.c
+++ b/src/freedreno/vulkan/tu_pass.c
@@ -613,12 +613,20 @@ tu_render_pass_gmem_config(struct tu_render_pass *pass,
 }
 
 static void
-attachment_set_ops(struct tu_render_pass_attachment *att,
+attachment_set_ops(struct tu_device *device,
+                   struct tu_render_pass_attachment *att,
                    VkAttachmentLoadOp load_op,
                    VkAttachmentLoadOp stencil_load_op,
                    VkAttachmentStoreOp store_op,
                    VkAttachmentStoreOp stencil_store_op)
 {
+   if (device->instance->debug_flags & TU_DEBUG_DONT_CARE_AS_LOAD) {
+      if (load_op == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
+         load_op = VK_ATTACHMENT_LOAD_OP_LOAD;
+      if (stencil_load_op == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
+         stencil_load_op = VK_ATTACHMENT_LOAD_OP_LOAD;
+   }
+
    /* load/store ops */
    att->clear_mask =
       (load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) ? VK_IMAGE_ASPECT_COLOR_BIT : 0;
@@ -725,16 +733,7 @@ tu_CreateRenderPass2(VkDevice _device,
       VkAttachmentLoadOp loadOp = pCreateInfo->pAttachments[i].loadOp;
       VkAttachmentLoadOp stencilLoadOp = 
pCreateInfo->pAttachments[i].stencilLoadOp;
 
-      if (device->instance->debug_flags & TU_DEBUG_DONT_CARE_AS_LOAD) {
-         if (loadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
-            loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
-         if (stencilLoadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
-            stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
-      }
-
-      attachment_set_ops(att,
-                         loadOp,
-                         stencilLoadOp,
+      attachment_set_ops(device, att, loadOp, stencilLoadOp,
                          pCreateInfo->pAttachments[i].storeOp,
                          pCreateInfo->pAttachments[i].stencilStoreOp);
    }

Reply via email to