Mesa (main): turnip: Include 3d-based CmdClearAttachments() in binning visibility.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 7 00:23:17 UTC 2022


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

Author: Emma Anholt <emma at anholt.net>
Date:   Wed Jun  1 14:11:47 2022 -0700

turnip: Include 3d-based CmdClearAttachments() in binning visibility.

It means the clear's draw can get skipped when it doesn't intersect with
the tile.

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

---

 src/freedreno/vulkan/tu_clear_blit.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/freedreno/vulkan/tu_clear_blit.c b/src/freedreno/vulkan/tu_clear_blit.c
index 3dd5bcbd4d3..93a5a3fcc3f 100644
--- a/src/freedreno/vulkan/tu_clear_blit.c
+++ b/src/freedreno/vulkan/tu_clear_blit.c
@@ -1124,6 +1124,17 @@ r3d_run(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
    tu_cs_emit(cs, 2); /* vertex count */
 }
 
+static void
+r3d_run_vis(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
+{
+   tu_cs_emit_pkt7(cs, CP_DRAW_INDX_OFFSET, 3);
+   tu_cs_emit(cs, CP_DRAW_INDX_OFFSET_0_PRIM_TYPE(DI_PT_RECTLIST) |
+                  CP_DRAW_INDX_OFFSET_0_SOURCE_SELECT(DI_SRC_SEL_AUTO_INDEX) |
+                  CP_DRAW_INDX_OFFSET_0_VIS_CULL(USE_VISIBILITY));
+   tu_cs_emit(cs, 1); /* instance count */
+   tu_cs_emit(cs, 2); /* vertex count */
+}
+
 static void
 r3d_teardown(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
 {
@@ -2404,7 +2415,7 @@ tu_clear_sysmem_attachments(struct tu_cmd_buffer *cmd,
             rects[i].rect.offset.y + rects[i].rect.extent.height,
             z_clear_val, 1.0f,
          });
-         r3d_run(cmd, cs);
+         r3d_run_vis(cmd, cs);
       }
    }
 
@@ -2609,16 +2620,10 @@ tu_CmdClearAttachments(VkCommandBuffer commandBuffer,
    /* vkCmdClearAttachments is supposed to respect the predicate if active.
     * The easiest way to do this is to always use the 3d path, which always
     * works even with GMEM because it's just a simple draw using the existing
-    * attachment state. However it seems that IGNORE_VISIBILITY draws must be
-    * skipped in the binning pass, since otherwise they produce binning data
-    * which isn't consumed and leads to the wrong binning data being read, so
-    * condition on GMEM | SYSMEM.
+    * attachment state.
     */
    if (cmd->state.predication_active) {
-      tu_cond_exec_start(cs, CP_COND_EXEC_0_RENDER_MODE_GMEM |
-                             CP_COND_EXEC_0_RENDER_MODE_SYSMEM);
       tu_clear_sysmem_attachments(cmd, attachmentCount, pAttachments, rectCount, pRects);
-      tu_cond_exec_end(cs);
       return;
    }
 



More information about the mesa-commit mailing list