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

Author: Marek Olšák <[email protected]>
Date:   Mon Sep  7 06:29:45 2020 -0400

radeonsi: eliminate unused shader outputs for separate NGG geometry shaders

This just works because the same output export code is used for VS too.

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

---

 src/gallium/drivers/radeonsi/si_state_shaders.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 7d88c730bf8..af1e3e277bf 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1791,10 +1791,13 @@ static void si_shader_selector_key_hw_vs(struct 
si_context *sctx, struct si_shad
    uint64_t linked = outputs_written & inputs_read;
 
    key->opt.kill_outputs = ~linked & outputs_written;
-   key->opt.ngg_culling = sctx->ngg_culling;
 
-   if (sctx->ps_shader.cso && sctx->ps_shader.cso->info.uses_primid)
-      key->mono.u.vs_export_prim_id = 1;
+   if (vs->info.stage != MESA_SHADER_GEOMETRY) {
+      key->opt.ngg_culling = sctx->ngg_culling;
+
+      if (sctx->ps_shader.cso && sctx->ps_shader.cso->info.uses_primid)
+         key->mono.u.vs_export_prim_id = 1;
+   }
 
    /* We need PKT3_CONTEXT_REG_RMW, which we currently only use on GFX10+. */
    if (sctx->chip_class >= GFX10 &&
@@ -1877,6 +1880,10 @@ static inline void si_shader_selector_key(struct 
pipe_context *ctx, struct si_sh
 
          key->as_ngg = stages_key.u.ngg;
 
+         /* Only NGG can eliminate GS outputs, because the code is shared with 
VS. */
+         if (stages_key.u.ngg)
+            si_shader_selector_key_hw_vs(sctx, sel, key);
+
          /* Merged ES-GS can have unbalanced wave usage.
           *
           * ES threads are per-vertex, while GS threads are

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

Reply via email to