Mesa (main): nir: remove gl_PrimitiveID output from MS when it's not used in FS

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 10:00:36 UTC 2022


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

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Fri Mar 11 11:01:38 2022 +0100

nir: remove gl_PrimitiveID output from MS when it's not used in FS

Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15340>

---

 src/compiler/nir/nir_linking_helpers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c
index 8f31dd4055c..6a574ec29be 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -148,7 +148,8 @@ nir_remove_unused_io_vars(nir_shader *shader,
          used = used_by_other_stage;
 
       if (var->data.location < VARYING_SLOT_VAR0 && var->data.location >= 0)
-         continue;
+         if (shader->info.stage != MESA_SHADER_MESH || var->data.location != VARYING_SLOT_PRIMITIVE_ID)
+            continue;
 
       if (var->data.always_active_io)
          continue;



More information about the mesa-commit mailing list