Mesa (master): radeonsi: remove VS input loads when culling with rasterizer discard

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 18 06:41:16 UTC 2020


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed Oct 21 13:00:41 2020 -0400

radeonsi: remove VS input loads when culling with rasterizer discard

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

---

 src/gallium/drivers/radeonsi/gfx10_shader_ngg.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
index 1cad17195dd..64be935e3f9 100644
--- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
+++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
@@ -763,6 +763,17 @@ void gfx10_emit_ngg_culling_epilogue(struct ac_shader_abi *abi, unsigned max_out
 
       switch (info->output_semantic[i]) {
       case VARYING_SLOT_POS:
+         /* If we are going to cull everything (rasterizer_discard), discard
+          * the position. This is useful for analyzing maximum theoretical
+          * performance without VS input loads.
+          */
+         if (shader->key.opt.ngg_culling & SI_NGG_CULL_FRONT_FACE &&
+             shader->key.opt.ngg_culling & SI_NGG_CULL_BACK_FACE) {
+            for (unsigned j = 0; j < 4; j++)
+               LLVMBuildStore(builder, LLVMGetUndef(ctx->ac.f32), addrs[4 * i + j]);
+            break;
+         }
+
          pos_index = i;
          for (unsigned j = 0; j < 4; j++) {
             position[j] = LLVMBuildLoad(ctx->ac.builder, addrs[4 * i + j], "");



More information about the mesa-commit mailing list