[Mesa-dev] [PATCH 06/11] nir/lower_vars_to_ssa: Use the nir_pass framework internally

Jason Ekstrand jason at jlekstrand.net
Wed Oct 28 14:32:06 PDT 2015


---
 src/glsl/nir/nir_lower_vars_to_ssa.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c b/src/glsl/nir/nir_lower_vars_to_ssa.c
index 5971507..b9215d0 100644
--- a/src/glsl/nir/nir_lower_vars_to_ssa.c
+++ b/src/glsl/nir/nir_lower_vars_to_ssa.c
@@ -856,7 +856,7 @@ insert_phi_nodes(struct lower_variables_state *state)
  *     with SSA definitions and SSA uses.
  */
 static bool
-nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
+nir_lower_vars_to_ssa_impl(nir_function_impl *impl, void *unused)
 {
    struct lower_variables_state state;
 
@@ -935,19 +935,19 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
    insert_phi_nodes(&state);
    rename_variables_block(nir_start_block(impl), &state);
 
-   nir_metadata_preserve(impl, nir_metadata_block_index |
-                               nir_metadata_dominance);
-
    ralloc_free(state.dead_ctx);
 
    return progress;
 }
 
+static const nir_pass nir_lower_vars_to_ssa_pass = {
+   NULL, /* shader_pass_func */
+   nir_lower_vars_to_ssa_impl,
+   nir_metadata_block_index | nir_metadata_dominance,
+};
+
 void
 nir_lower_vars_to_ssa(nir_shader *shader)
 {
-   nir_foreach_overload(shader, overload) {
-      if (overload->impl)
-         nir_lower_vars_to_ssa_impl(overload->impl);
-   }
+   nir_shader_run_pass(shader, &nir_lower_vars_to_ssa_pass);
 }
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list