Mesa (master): i965/nir: Print NIR on INTEL_DEBUG=fs.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Jan 23 22:55:22 UTC 2015


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Jan 19 23:11:54 2015 -0800

i965/nir: Print NIR on INTEL_DEBUG=fs.

This is useful for debugging and looking for optimization opportunities.

It will need to be expanded when we add support for other scalar stages.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs_nir.cpp |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 40a1673..2d30321 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -93,6 +93,12 @@ fs_visitor::emit_nir_code()
    nir_validate_shader(nir);
    nir_copy_prop(nir);
    nir_validate_shader(nir);
+
+   if (INTEL_DEBUG & DEBUG_WM) {
+      fprintf(stderr, "NIR (SSA form) for fragment shader:\n");
+      nir_print_shader(nir, stderr);
+   }
+
    nir_convert_from_ssa(nir);
    nir_validate_shader(nir);
    nir_lower_vec_to_movs(nir);
@@ -134,6 +140,11 @@ fs_visitor::emit_nir_code()
       nir_emit_impl(overload->impl);
    }
 
+   if (INTEL_DEBUG & DEBUG_WM) {
+      fprintf(stderr, "NIR (final form) for fragment shader:\n");
+      nir_print_shader(nir, stderr);
+   }
+
    ralloc_free(nir);
 }
 




More information about the mesa-commit mailing list