Mesa (master): radeonsi: don't compute average vertex count in si_draw_vbo

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 18 01:33:14 UTC 2021


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Dec 26 22:06:42 2020 -0500

radeonsi: don't compute average vertex count in si_draw_vbo

It's probably not needed and we also have draw merging on gfx10,
so we should be able to use total_driver_count in theory.
(I may be wrong, but I don't know if having avg_direct_count really
improves anything)

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

---

 src/gallium/drivers/radeonsi/si_state_draw.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index 41dc50f68b6..26598a1ddf4 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -1648,7 +1648,6 @@ static void si_draw_vbo(struct pipe_context *ctx,
    bool dispatch_prim_discard_cs = false;
    bool prim_discard_cs_instancing = false;
    unsigned original_index_size = index_size;
-   unsigned avg_direct_count = 0;
    unsigned min_direct_count = 0;
    unsigned total_direct_count = 0;
 
@@ -1678,12 +1677,11 @@ static void si_draw_vbo(struct pipe_context *ctx,
          total_direct_count += count;
          min_direct_count = MIN2(min_direct_count, count);
       }
-      avg_direct_count = (total_direct_count / num_draws) * instance_count;
    }
 
    /* Determine if we can use the primitive discard compute shader. */
    if (ALLOW_PRIM_DISCARD_CS &&
-       (avg_direct_count > sctx->prim_discard_vertex_count_threshold
+       (total_direct_count > sctx->prim_discard_vertex_count_threshold
            ? (sctx->compute_num_verts_rejected += total_direct_count, true)
            : /* Add, then return true. */
            (sctx->compute_num_verts_ineligible += total_direct_count,
@@ -1769,9 +1767,9 @@ static void si_draw_vbo(struct pipe_context *ctx,
       struct si_shader_selector *hw_vs;
       if (NGG && !dispatch_prim_discard_cs && rast_prim == PIPE_PRIM_TRIANGLES &&
           (hw_vs = si_get_vs(sctx)->cso) &&
-          (avg_direct_count > hw_vs->ngg_cull_vert_threshold ||
+          (total_direct_count > hw_vs->ngg_cull_vert_threshold ||
            (!index_size &&
-            avg_direct_count > hw_vs->ngg_cull_nonindexed_fast_launch_vert_threshold &&
+            total_direct_count > hw_vs->ngg_cull_nonindexed_fast_launch_vert_threshold &&
             prim & ((1 << PIPE_PRIM_TRIANGLES) |
                     (1 << PIPE_PRIM_TRIANGLE_STRIP))))) {
          uint8_t ngg_culling = 0;



More information about the mesa-commit mailing list