Mesa (main): radeonsi: cleanup some primitive discard CS TODOs regarding instancing, etc.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 21 19:17:04 UTC 2021


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Jun  1 00:18:51 2021 -0400

radeonsi: cleanup some primitive discard CS TODOs regarding instancing, etc.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11102>

---

 src/gallium/drivers/radeonsi/si_compute_prim_discard.c | 6 ++++--
 src/gallium/drivers/radeonsi/si_state_draw.cpp         | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
index 54b58bfadc0..939423ef3f3 100644
--- a/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
+++ b/src/gallium/drivers/radeonsi/si_compute_prim_discard.c
@@ -956,9 +956,11 @@ si_prepare_prim_discard_or_split_draw(struct si_context *sctx, const struct pipe
 
    /* Split draws at the draw call level if the ring is full. This makes
     * better use of the ring space.
+    *
+    * If instancing is enabled and there is not enough ring buffer space, compute-based
+    * primitive discard is disabled.
     */
-   if (ring_full && num_prims > PRIMS_PER_BATCH &&
-       instance_count == 1) { /* TODO: support splitting instanced draws */
+   if (ring_full && num_prims > PRIMS_PER_BATCH && instance_count == 1) {
       unsigned vert_count_per_subdraw = 0;
 
       if (prim == PIPE_PRIM_TRIANGLES)
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index 52d10876d3a..ce72a53c45d 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -1936,7 +1936,7 @@ static void si_draw_vbo(struct pipe_context *ctx,
            (1 << prim) & ((1 << PIPE_PRIM_TRIANGLES) | (1 << PIPE_PRIM_TRIANGLE_STRIP)) &&
               /* Instancing is limited to 16-bit indices, because InstanceID is packed into
                  VertexID. */
-              /* TODO: DrawArraysInstanced doesn't sometimes work, so it's disabled. */
+              /* Instanced index_size == 0 requires that start + count < USHRT_MAX, so just reject it. */
               (instance_count == 1 ||
                (instance_count <= USHRT_MAX && index_size && index_size <= 2) ||
                pd_msg("instance_count too large or index_size == 4 or DrawArraysInstanced"))) &&



More information about the mesa-commit mailing list