Mesa (main): glsl/nir/linker: Also remove image variables

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 27 07:23:34 UTC 2021


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Mon Oct 18 10:21:04 2021 -0500

glsl/nir/linker: Also remove image variables

If we don't, then the array shrinker may shrink them to an array of zero
images which can cause GLSL serialization to blow up but only the next
time the GLSL shader is loaded from the disk cache.

Fixes: b8ee37472d3e ("glsl: Use nir_var_mem_image for images")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5520
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13412>

---

 src/compiler/glsl/gl_nir_linker.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c
index 9a93285c6d3..9815145189d 100644
--- a/src/compiler/glsl/gl_nir_linker.c
+++ b/src/compiler/glsl/gl_nir_linker.c
@@ -606,7 +606,8 @@ gl_nir_link_spirv(struct gl_context *ctx, struct gl_shader_program *prog,
          const nir_remove_dead_variables_options opts = {
             .can_remove_var = can_remove_uniform,
          };
-         nir_remove_dead_variables(shader->Program->nir, nir_var_uniform,
+         nir_remove_dead_variables(shader->Program->nir,
+                                   nir_var_uniform | nir_var_image,
                                    &opts);
       }
    }
@@ -670,7 +671,8 @@ gl_nir_link_glsl(struct gl_context *ctx, struct gl_shader_program *prog)
          const nir_remove_dead_variables_options opts = {
             .can_remove_var = can_remove_uniform,
          };
-         nir_remove_dead_variables(shader->Program->nir, nir_var_uniform,
+         nir_remove_dead_variables(shader->Program->nir,
+                                   nir_var_uniform | nir_var_image,
                                    &opts);
       }
    }



More information about the mesa-commit mailing list