nir: add callback to nir_remove_dead_variables()

This allows us to do API specific checks before removing variable
without filling nir_remove_dead_variables() with API specific code.

In the following patches we will use this to support the removal
of dead uniforms in GLSL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>
This commit is contained in:
Timothy Arceri
2020-05-28 10:59:28 +10:00
committed by Marge Bot
parent bc79442f3f
commit 04dbf709ed
23 changed files with 78 additions and 51 deletions

View File

@@ -635,8 +635,8 @@ int r600_shader_from_nir(struct r600_context *rctx,
if (optimize)
while(optimize_once(sel->nir));
NIR_PASS_V(sel->nir, nir_remove_dead_variables, nir_var_shader_in);
NIR_PASS_V(sel->nir, nir_remove_dead_variables, nir_var_shader_out);
NIR_PASS_V(sel->nir, nir_remove_dead_variables, nir_var_shader_in, NULL);
NIR_PASS_V(sel->nir, nir_remove_dead_variables, nir_var_shader_out, NULL);
NIR_PASS_V(sel->nir, nir_lower_vars_to_scratch,