From 0bbb32ece45d9ef6dd62f5516a8ae1dc779ea3a3 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 18 Oct 2021 10:21:04 -0500 Subject: [PATCH] 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 Part-of: --- 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 9a93285..9815145 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); } } -- 2.7.4