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: b8ee37472d ("glsl: Use nir_var_mem_image for images")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5520
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13412>
This commit is contained in:
Jason Ekstrand
2021-10-18 10:21:04 -05:00
parent 0a277fabce
commit 0bbb32ece4

View File

@@ -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);
}
}