[Mesa-dev] [PATCH 1/9] nir: Make nir_lower_globals_vars_to_local report progress.

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


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

diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 83e3153..31c0c27 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1809,7 +1809,7 @@ void nir_split_var_copies(nir_shader *shader);
 void nir_lower_var_copy_instr(nir_intrinsic_instr *copy, void *mem_ctx);
 void nir_lower_var_copies(nir_shader *shader);
 
-void nir_lower_global_vars_to_local(nir_shader *shader);
+bool nir_lower_global_vars_to_local(nir_shader *shader);
 
 void nir_lower_locals_to_regs(nir_shader *shader);
 
diff --git a/src/glsl/nir/nir_lower_global_vars_to_local.c b/src/glsl/nir/nir_lower_global_vars_to_local.c
index 0cd8740..fab2366 100644
--- a/src/glsl/nir/nir_lower_global_vars_to_local.c
+++ b/src/glsl/nir/nir_lower_global_vars_to_local.c
@@ -73,10 +73,11 @@ mark_global_var_uses_block(nir_block *block, void *void_state)
    return true;
 }
 
-void
+bool
 nir_lower_global_vars_to_local(nir_shader *shader)
 {
    struct global_to_local_state state;
+   bool progress = false;
 
    state.var_func_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                                                   _mesa_key_pointer_equal);
@@ -99,8 +100,11 @@ nir_lower_global_vars_to_local(nir_shader *shader)
          exec_node_remove(&var->node);
          var->data.mode = nir_var_local;
          exec_list_push_tail(&impl->locals, &var->node);
+         progress = true;
       }
    }
 
    _mesa_hash_table_destroy(state.var_func_table, NULL);
+
+   return progress;
 }
-- 
2.5.1



More information about the mesa-dev mailing list