Cc: Rob Clark <robcl...@freedesktop.org> --- .../drivers/freedreno/ir3/ir3_compiler_nir.c | 2 +- src/gallium/drivers/freedreno/ir3/ir3_nir.h | 2 +- .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c | 22 ++++++---------------- 3 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 8c9234b..e0be26f 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -195,7 +195,7 @@ static struct nir_shader *to_nir(struct ir3_compile *ctx, progress |= nir_copy_prop(s); progress |= nir_opt_dce(s); progress |= nir_opt_cse(s); - progress |= ir3_nir_lower_if_else(s); + progress |= nir_shader_run_pass(s, &ir3_nir_lower_if_else); progress |= nir_opt_algebraic(s); progress |= nir_opt_constant_folding(s); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.h b/src/gallium/drivers/freedreno/ir3/ir3_nir.h index 9950782..079a5b7 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_nir.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.h @@ -32,6 +32,6 @@ #include "glsl/nir/nir.h" #include "glsl/nir/shader_enums.h" -bool ir3_nir_lower_if_else(nir_shader *shader); +extern const nir_pass ir3_nir_lower_if_else; #endif /* IR3_NIR_H_ */ diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c index 4ec0e2b..69f6554 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c @@ -307,7 +307,7 @@ lower_if_else_block(nir_block *block, void *void_state) } static bool -lower_if_else_impl(nir_function_impl *impl) +lower_if_else_impl(nir_function_impl *impl, void *unused) { struct lower_state state; @@ -317,21 +317,11 @@ lower_if_else_impl(nir_function_impl *impl) nir_foreach_block(impl, lower_if_else_block, &state); - if (state.progress) - nir_metadata_preserve(impl, nir_metadata_none); - return state.progress; } -bool -ir3_nir_lower_if_else(nir_shader *shader) -{ - bool progress = false; - - nir_foreach_overload(shader, overload) { - if (overload->impl) - progress |= lower_if_else_impl(overload->impl); - } - - return progress; -} +const nir_pass ir3_nir_lower_if_else = { + NULL, /* shader_pass_func */ + lower_if_else_impl, + nir_metadata_none, +}; -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev