aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 2b4c45f5f55..081f85edf53 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -232,6 +232,16 @@ st_nir_opts(nir_shader *nir, bool scalar)
progress = false;
NIR_PASS_V(nir, nir_lower_vars_to_ssa);
+
+ /* Linking deals with unused inputs/outputs, but here we can remove
+ * things local to the shader in the hopes that we can cleanup other
+ * things. This pass will also remove variables with only stores, so we
+ * might be able to make progress after it.
+ */
+ NIR_PASS(progress, nir, nir_remove_dead_variables,
+ (nir_variable_mode)(nir_var_function_temp |
+ nir_var_shader_temp |
+ nir_var_mem_shared));
NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
NIR_PASS(progress, nir, nir_opt_dead_write_vars);