Module: Mesa
Branch: master
Commit: 8aaca3820cfc98705215e31b751d818154437fe4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8aaca3820cfc98705215e31b751d818154437fe4

Author: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
Date:   Sun Jan  8 23:23:52 2017 +0100

radv: Call NIR passes using NIR_PASS_V.

Port of faa1edeeb7bbe9321c79587e592dce812e8caa78
"anv/pipeline: Call NIR passes using NIR_PASS_V"

Signed-off-by: Bas Nieuwenhuizen <ba...@google.com>
Reviewed-by: Timothy Arceri <timothy.arc...@collabora.com>

---

 src/amd/vulkan/radv_pipeline.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index d818938..d1a3efe 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -209,14 +209,9 @@ radv_shader_compile_to_nir(struct radv_device *device,
                 * inline functions.  That way they get properly initialized at 
the top
                 * of the function and not at the top of its caller.
                 */
-               nir_lower_constant_initializers(nir, nir_var_local);
-               nir_validate_shader(nir);
-
-               nir_lower_returns(nir);
-               nir_validate_shader(nir);
-
-               nir_inline_functions(nir);
-               nir_validate_shader(nir);
+               NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_local);
+               NIR_PASS_V(nir, nir_lower_returns);
+               NIR_PASS_V(nir, nir_inline_functions);
 
                /* Pick off the single entrypoint that we want */
                foreach_list_typed_safe(nir_function, func, node, 
&nir->functions) {
@@ -226,19 +221,14 @@ radv_shader_compile_to_nir(struct radv_device *device,
                assert(exec_list_length(&nir->functions) == 1);
                entry_point->name = ralloc_strdup(entry_point, "main");
 
-               nir_remove_dead_variables(nir, nir_var_shader_in |
-                                              nir_var_shader_out |
-                                              nir_var_system_value);
-               nir_validate_shader(nir);
+               NIR_PASS_V(nir, nir_remove_dead_variables,
+                          nir_var_shader_in | nir_var_shader_out | 
nir_var_system_value);
 
                /* Now that we've deleted all but the main function, we can go 
ahead and
                 * lower the rest of the constant initializers.
                 */
-               nir_lower_constant_initializers(nir, ~0);
-               nir_validate_shader(nir);
-
-               nir_lower_system_values(nir);
-               nir_validate_shader(nir);
+               NIR_PASS_V(nir, nir_lower_constant_initializers, ~0);
+               NIR_PASS_V(nir, nir_lower_system_values);
        }
 
        /* Vulkan uses the separate-shader linking model */

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to