From: Kenneth Graunke Date: Thu, 19 Feb 2015 01:43:07 +0000 (-0800) Subject: i965/fs: Un-hardcode DEBUG_WM, "FS", and "fragment". X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2bd139e18c941e7ea0870ba43314a5c10fd5bb12;p=mesa.git i965/fs: Un-hardcode DEBUG_WM, "FS", and "fragment". 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 --- 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); }