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

Author: Marek Olšák <[email protected]>
Date:   Wed Jun 16 19:31:22 2021 -0400

radeonsi: if shader culling culls all vertices, cull the primitive exports too

This was overlooked. It benefits triangle strips the most due to
GS fast launch.

Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11509>

---

 src/gallium/drivers/radeonsi/gfx10_shader_ngg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c 
b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
index 09590878e5e..ca88581215b 100644
--- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
+++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
@@ -1113,9 +1113,15 @@ void gfx10_emit_ngg_culling_epilogue(struct 
ac_shader_abi *abi, unsigned max_out
    }
    ac_build_endif(&ctx->ac, 16009);
 
+   /* If all vertices are culled, set the primitive count to 0, so that all 
waves are culled here. */
+   LLVMValueRef num_primitives = ngg_get_prim_cnt(ctx);
+   num_primitives = LLVMBuildSelect(builder,
+                                    LLVMBuildICmp(builder, LLVMIntEQ, 
new_num_es_threads,
+                                                  ctx->ac.i32_0, ""),
+                                    ctx->ac.i32_0, num_primitives, "");
    /* Kill waves that have inactive threads. */
    kill_wave = LLVMBuildICmp(builder, LLVMIntULE,
-                             ac_build_imax(&ctx->ac, new_num_es_threads, 
ngg_get_prim_cnt(ctx)),
+                             ac_build_imax(&ctx->ac, new_num_es_threads, 
num_primitives),
                              LLVMBuildMul(builder, get_wave_id_in_tg(ctx),
                                           LLVMConstInt(ctx->ac.i32, 
ctx->ac.wave_size, 0), ""),
                              "");

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to