nir: add callback to nir_remove_dead_variables()
[mesa.git] / src / mesa / state_tracker / st_glsl_to_nir.cpp
index d7277f7f5c59a416a275b2c3b3930685a7201016..b99e8339ae0245977f7c1db4badb1031f68015e6 100644 (file)
@@ -260,7 +260,8 @@ st_nir_opts(nir_shader *nir)
       NIR_PASS(progress, nir, nir_remove_dead_variables,
                (nir_variable_mode)(nir_var_function_temp |
                                    nir_var_shader_temp |
-                                   nir_var_mem_shared));
+                                   nir_var_mem_shared),
+               NULL);
 
       NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
       NIR_PASS(progress, nir, nir_opt_dead_write_vars);
@@ -378,7 +379,7 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog,
    if (!_mesa_is_gles(st->ctx) || !nir->info.separate_shader) {
       nir_variable_mode mask =
          (nir_variable_mode) (nir_var_shader_in | nir_var_shader_out);
-      nir_remove_dead_variables(nir, mask);
+      nir_remove_dead_variables(nir, mask, NULL);
    }
 
    if (options->lower_all_io_to_temps ||
@@ -503,7 +504,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
 
    nir_variable_mode mask = (nir_variable_mode)
       (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp );
-   nir_remove_dead_variables(nir, mask);
+   nir_remove_dead_variables(nir, mask, NULL);
 
    if (!st->has_hw_atomics)
       NIR_PASS_V(nir, nir_lower_atomics_to_ssbo);
@@ -561,8 +562,8 @@ st_nir_link_shaders(nir_shader *producer, nir_shader *consumer)
    if (nir_link_opt_varyings(producer, consumer))
       st_nir_opts(consumer);
 
-   NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_out);
-   NIR_PASS_V(consumer, nir_remove_dead_variables, nir_var_shader_in);
+   NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_out, NULL);
+   NIR_PASS_V(consumer, nir_remove_dead_variables, nir_var_shader_in, NULL);
 
    if (nir_remove_unused_varyings(producer, consumer)) {
       NIR_PASS_V(producer, nir_lower_global_vars_to_local);
@@ -575,8 +576,10 @@ st_nir_link_shaders(nir_shader *producer, nir_shader *consumer)
        * nir_compact_varyings() depends on all dead varyings being removed so
        * we need to call nir_remove_dead_variables() again here.
        */
-      NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_out);
-      NIR_PASS_V(consumer, nir_remove_dead_variables, nir_var_shader_in);
+      NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_out,
+                 NULL);
+      NIR_PASS_V(consumer, nir_remove_dead_variables, nir_var_shader_in,
+                 NULL);
    }
 }