tu: Move TU_DONT_CARE_AS_LOAD into attachment_set_ops()
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 24 Jun 2022 13:05:34 +0000 (15:05 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 27 Jul 2022 19:40:44 +0000 (19:40 +0000)
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

index fe3c32c..43f4972 100644 (file)
@@ -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);
    }