[Mesa-dev] [PATCH v2 10/10] ir3: Use nir_pass for lower_if_else

Jason Ekstrand jason at jlekstrand.net
Tue Nov 3 13:41:16 PST 2015


Cc: Rob Clark <robclark at freedesktop.org>
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
---
 src/gallium/drivers/freedreno/ir3/ir3_nir.h         |  2 +-
 .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c   | 21 +++++----------------
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.h b/src/gallium/drivers/freedreno/ir3/ir3_nir.h
index 9950782..1fbf055 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);
+NIR_DECL_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..04430f5 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,10 @@ 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_pass = {
+   .impl_pass_func = lower_if_else_impl,
+   .metadata_preserved = nir_metadata_none,
+};
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list