glsl: remove unused system vars

System vars are added to the resource list as inputs so remove any
dead ones before building the list.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
This commit is contained in:
Timothy Arceri
2023-05-04 12:13:44 +10:00
committed by Marge Bot
parent cbff8f8c5c
commit a8c485efee

View File

@@ -202,7 +202,7 @@ gl_nir_link_opts(nir_shader *producer, nir_shader *consumer)
}
static bool
can_remove_uniform(nir_variable *var, UNUSED void *data)
can_remove_var(nir_variable *var, UNUSED void *data)
{
/* Section 2.11.6 (Uniform Variables) of the OpenGL ES 3.0.3 spec
* says:
@@ -1092,7 +1092,7 @@ gl_nir_link_spirv(const struct gl_constants *consts,
struct gl_linked_shader *shader = prog->_LinkedShaders[i];
if (shader) {
const nir_remove_dead_variables_options opts = {
.can_remove_var = can_remove_uniform,
.can_remove_var = can_remove_var,
};
nir_remove_dead_variables(shader->Program->nir,
nir_var_uniform | nir_var_image,
@@ -1295,11 +1295,12 @@ gl_nir_link_glsl(const struct gl_constants *consts,
}
const nir_remove_dead_variables_options opts = {
.can_remove_var = can_remove_uniform,
.can_remove_var = can_remove_var,
};
nir_remove_dead_variables(shader->Program->nir,
nir_var_uniform | nir_var_image |
nir_var_mem_ubo | nir_var_mem_ssbo,
nir_var_mem_ubo | nir_var_mem_ssbo |
nir_var_system_value,
&opts);
}
}