From 7c891e8ddd41a77ccdc804ce938f2a1ed46e97e8 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 18 Feb 2015 17:31:29 -0800 Subject: [PATCH] i965: Add a function to translate MESA_SHADER_* into DEBUG_* enums. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When compiling, we have a gl_shader_stage (MESA_SHADER_*) enum, and want to know whether debugging is enabled for that stage. This allows us to easily translate it into the corresponding debug flag. 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/intel_debug.c | 13 +++++++++++++ src/mesa/drivers/dri/i965/intel_debug.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c index 013602c4abe..0cb7aef3231 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.c +++ b/src/mesa/drivers/dri/i965/intel_debug.c @@ -72,6 +72,19 @@ static const struct dri_debug_control debug_control[] = { { NULL, 0 } }; +uint64_t +intel_debug_flag_for_shader_stage(gl_shader_stage stage) +{ + int flags[] = { + [MESA_SHADER_VERTEX] = DEBUG_VS, + [MESA_SHADER_GEOMETRY] = DEBUG_GS, + [MESA_SHADER_FRAGMENT] = DEBUG_WM, + [MESA_SHADER_COMPUTE] = 0, /* no debug flag yet */ + }; + STATIC_ASSERT(MESA_SHADER_STAGES == 4); + return flags[stage]; +} + void brw_process_intel_debug_variable(struct brw_context *brw) { diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h index 01b4dcfd3fe..ed879aba8d3 100644 --- a/src/mesa/drivers/dri/i965/intel_debug.h +++ b/src/mesa/drivers/dri/i965/intel_debug.h @@ -110,6 +110,8 @@ extern uint64_t INTEL_DEBUG; } \ } while (0) +extern uint64_t intel_debug_flag_for_shader_stage(gl_shader_stage stage); + struct brw_context; extern void brw_process_intel_debug_variable(struct brw_context *brw); -- 2.30.2