From 2bd139e18c941e7ea0870ba43314a5c10fd5bb12 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Feb 2015 17:43:07 -0800 Subject: [PATCH] i965/fs: Un-hardcode DEBUG_WM, "FS", and "fragment". MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These code paths can (or will) be used for other shader stages. Signed-off-by: Kenneth Graunke Reviewed-by: Jason Ekstrand Reviewed-by: Ian Romanick Reviewed-by: Kristian Høgsberg Reviewed-by: Anuj Phogat --- src/mesa/drivers/dri/i965/brw_fs.cpp | 4 ++-- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c46e1d73fd4..a562b8a3b1c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -810,11 +810,11 @@ fs_visitor::vfail(const char *format, va_list va) failed = true; msg = ralloc_vasprintf(mem_ctx, format, va); - msg = ralloc_asprintf(mem_ctx, "FS compile failed: %s\n", msg); + msg = ralloc_asprintf(mem_ctx, "%s compile failed: %s\n", stage_abbrev, msg); this->fail_msg = msg; - if (INTEL_DEBUG & DEBUG_WM) { + if (debug_enabled) { fprintf(stderr, "%s", msg); } } diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 21238296d50..90eecae7120 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -124,8 +124,8 @@ fs_visitor::emit_nir_code() nir_copy_prop(nir); nir_validate_shader(nir); - if (INTEL_DEBUG & DEBUG_WM) { - fprintf(stderr, "NIR (SSA form) for fragment shader:\n"); + if (unlikely(debug_enabled)) { + fprintf(stderr, "NIR (SSA form) for %s shader:\n", stage_name); nir_print_shader(nir, stderr); } @@ -135,7 +135,8 @@ fs_visitor::emit_nir_code() MESA_DEBUG_SOURCE_SHADER_COMPILER, MESA_DEBUG_TYPE_OTHER, MESA_DEBUG_SEVERITY_NOTIFICATION, - "FS NIR shader: %d inst\n", + "%s NIR shader: %d inst\n", + stage_abbrev, count_nir_instrs(nir)); } @@ -178,8 +179,8 @@ fs_visitor::emit_nir_code() nir_emit_impl(overload->impl); } - if (INTEL_DEBUG & DEBUG_WM) { - fprintf(stderr, "NIR (final form) for fragment shader:\n"); + if (unlikely(debug_enabled)) { + fprintf(stderr, "NIR (final form) for %s shader:\n", stage_name); nir_print_shader(nir, stderr); } -- 2.30.2