Mesa (main): zink: prune unused st-injected pointsize exports

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 05:08:01 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Apr  8 09:18:17 2022 -0400

zink: prune unused st-injected pointsize exports

only the last vertex stage needs to keep these, so prune any that aren't
being weirdly passed through

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15853>

---

 src/gallium/drivers/zink/zink_compiler.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index a445bfdcc09..62e2636eddb 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -1176,6 +1176,16 @@ zink_compiler_assign_io(nir_shader *producer, nir_shader *consumer)
    memset(patch_slot_map, -1, sizeof(patch_slot_map));
    bool do_fixup = false;
    nir_shader *nir = producer->info.stage == MESA_SHADER_TESS_CTRL ? producer : consumer;
+   if (consumer->info.stage != MESA_SHADER_FRAGMENT) {
+      /* remove injected pointsize from all but the last vertex stage */
+      nir_variable *var = nir_find_variable_with_location(producer, nir_var_shader_out, VARYING_SLOT_PSIZ);
+      if (var && !var->data.explicit_location) {
+         var->data.mode = nir_var_shader_temp;
+         nir_fixup_deref_modes(producer);
+         NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_temp, NULL);
+         optimize_nir(producer);
+      }
+   }
    if (producer->info.stage == MESA_SHADER_TESS_CTRL) {
       /* never assign from tcs -> tes, always invert */
       nir_foreach_variable_with_modes(var, consumer, nir_var_shader_in)



More information about the mesa-commit mailing list