[Mesa-dev] [PATCH 3/9] nir: Report progress from lower_vec_to_movs().

Kenneth Graunke kenneth at whitecape.org
Fri Sep 18 08:37:09 PDT 2015


Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/nir/nir.h                   |  2 +-
 src/glsl/nir/nir_lower_vec_to_movs.c | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 31c0c27..0950289 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1826,7 +1826,7 @@ void nir_lower_vars_to_ssa(nir_shader *shader);
 void nir_remove_dead_variables(nir_shader *shader);
 
 void nir_move_vec_src_uses_to_dest(nir_shader *shader);
-void nir_lower_vec_to_movs(nir_shader *shader);
+bool nir_lower_vec_to_movs(nir_shader *shader);
 void nir_lower_alu_to_scalar(nir_shader *shader);
 void nir_lower_load_const_to_scalar(nir_shader *shader);
 
diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c b/src/glsl/nir/nir_lower_vec_to_movs.c
index f5d30be..b7ee4e8 100644
--- a/src/glsl/nir/nir_lower_vec_to_movs.c
+++ b/src/glsl/nir/nir_lower_vec_to_movs.c
@@ -34,6 +34,7 @@
 
 struct vec_to_movs_state {
    nir_function_impl *impl;
+   bool progress;
 };
 
 static bool
@@ -251,24 +252,31 @@ lower_vec_to_movs_block(nir_block *block, void *void_state)
 
       nir_instr_remove(&vec->instr);
       ralloc_free(vec);
+      state->progress = true;
    }
 
    return true;
 }
 
-static void
+static bool
 nir_lower_vec_to_movs_impl(nir_function_impl *impl)
 {
-   struct vec_to_movs_state state = { impl };
+   struct vec_to_movs_state state = { impl, false };
 
    nir_foreach_block(impl, lower_vec_to_movs_block, &state);
+
+   return state.progress;
 }
 
-void
+bool
 nir_lower_vec_to_movs(nir_shader *shader)
 {
+   bool progress = false;
+
    nir_foreach_overload(shader, overload) {
       if (overload->impl)
-         nir_lower_vec_to_movs_impl(overload->impl);
+         progress = nir_lower_vec_to_movs_impl(overload->impl) || progress;
    }
+
+   return progress;
 }
-- 
2.5.1



More information about the mesa-dev mailing list