Mesa (master): glsl/spirv: remove dead uniforms in spirv nir linker

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 3 02:43:24 UTC 2020


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

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Mon May  4 14:33:56 2020 +1000

glsl/spirv: remove dead uniforms in spirv nir linker

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>

---

 src/compiler/glsl/gl_nir_linker.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c
index 7c38f28cd3c..c0cd587d0a1 100644
--- a/src/compiler/glsl/gl_nir_linker.c
+++ b/src/compiler/glsl/gl_nir_linker.c
@@ -601,6 +601,14 @@ bool
 gl_nir_link_spirv(struct gl_context *ctx, struct gl_shader_program *prog,
                   const struct gl_nir_linker_options *options)
 {
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+      struct gl_linked_shader *shader = prog->_LinkedShaders[i];
+      if (shader) {
+         nir_remove_dead_variables(shader->Program->nir, nir_var_uniform,
+                                   &can_remove_uniform);
+      }
+   }
+
    if (!gl_nir_link_uniform_blocks(ctx, prog))
       return false;
 



More information about the mesa-commit mailing list