From cd724208d3e1e3307f84a794f2c1fc83b69ccf8a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 15 Nov 2016 15:56:04 -0700 Subject: mesa: if MESA_DEBUG=context, create a debug context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A number of drivers report useful debug/perf information accessible through GL_ARB_debug_output and with debug contexts (i.e. setting the GLX_CONTEXT_DEBUG_BIT_ARB flag). But few applications actually use the GL_ARB_debug_output extension. This change lets one set the MESA_DEBUG env var to "context" to force-set a debug context and report debug/perf messages to stderr (or whatever file MESA_LOG_FILE is set to). This is a useful debugging tool. The small change in st_api_create_context() is needed so that st_update_debug_callback() gets called to hook up the driver debug callbacks when ST_CONTEXT_FLAG_DEBUG was not set, but MESA_DEBUG=context. v2: use %.*s format string instead of allocating temporary buffer. Reviewed-by: Nicolai Hähnle --- src/mesa/state_tracker/st_manager.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/state_tracker/st_manager.c') diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 0f71e6311b1..c3d8286b5a7 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -680,7 +680,9 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, } st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT; + } + if (st->ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT) { st_update_debug_callback(st); } -- cgit v1.2.3