mesa/st: migrate debug callback code into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
This commit is contained in:
@@ -63,81 +63,3 @@ st_debug_init(void)
|
||||
{
|
||||
ST_DEBUG = debug_get_option_st_debug();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Installed as pipe_debug_callback when GL_DEBUG_OUTPUT is enabled.
|
||||
*/
|
||||
static void
|
||||
st_debug_message(void *data,
|
||||
unsigned *id,
|
||||
enum pipe_debug_type ptype,
|
||||
const char *fmt,
|
||||
va_list args)
|
||||
{
|
||||
struct gl_context *ctx = data;
|
||||
enum mesa_debug_source source;
|
||||
enum mesa_debug_type type;
|
||||
enum mesa_debug_severity severity;
|
||||
|
||||
switch (ptype) {
|
||||
case PIPE_DEBUG_TYPE_OUT_OF_MEMORY:
|
||||
source = MESA_DEBUG_SOURCE_API;
|
||||
type = MESA_DEBUG_TYPE_ERROR;
|
||||
severity = MESA_DEBUG_SEVERITY_MEDIUM;
|
||||
break;
|
||||
case PIPE_DEBUG_TYPE_ERROR:
|
||||
source = MESA_DEBUG_SOURCE_API;
|
||||
type = MESA_DEBUG_TYPE_ERROR;
|
||||
severity = MESA_DEBUG_SEVERITY_MEDIUM;
|
||||
break;
|
||||
case PIPE_DEBUG_TYPE_SHADER_INFO:
|
||||
source = MESA_DEBUG_SOURCE_SHADER_COMPILER;
|
||||
type = MESA_DEBUG_TYPE_OTHER;
|
||||
severity = MESA_DEBUG_SEVERITY_NOTIFICATION;
|
||||
break;
|
||||
case PIPE_DEBUG_TYPE_PERF_INFO:
|
||||
source = MESA_DEBUG_SOURCE_API;
|
||||
type = MESA_DEBUG_TYPE_PERFORMANCE;
|
||||
severity = MESA_DEBUG_SEVERITY_NOTIFICATION;
|
||||
break;
|
||||
case PIPE_DEBUG_TYPE_INFO:
|
||||
source = MESA_DEBUG_SOURCE_API;
|
||||
type = MESA_DEBUG_TYPE_OTHER;
|
||||
severity = MESA_DEBUG_SEVERITY_NOTIFICATION;
|
||||
break;
|
||||
case PIPE_DEBUG_TYPE_FALLBACK:
|
||||
source = MESA_DEBUG_SOURCE_API;
|
||||
type = MESA_DEBUG_TYPE_PERFORMANCE;
|
||||
severity = MESA_DEBUG_SEVERITY_NOTIFICATION;
|
||||
break;
|
||||
case PIPE_DEBUG_TYPE_CONFORMANCE:
|
||||
source = MESA_DEBUG_SOURCE_API;
|
||||
type = MESA_DEBUG_TYPE_OTHER;
|
||||
severity = MESA_DEBUG_SEVERITY_NOTIFICATION;
|
||||
break;
|
||||
default:
|
||||
unreachable("invalid debug type");
|
||||
}
|
||||
_mesa_gl_vdebugf(ctx, id, source, type, severity, fmt, args);
|
||||
}
|
||||
|
||||
void
|
||||
st_update_debug_callback(struct gl_context *ctx)
|
||||
{
|
||||
struct pipe_context *pipe = ctx->pipe;
|
||||
|
||||
if (!pipe->set_debug_callback)
|
||||
return;
|
||||
|
||||
if (_mesa_get_debug_state_int(ctx, GL_DEBUG_OUTPUT)) {
|
||||
struct pipe_debug_callback cb;
|
||||
memset(&cb, 0, sizeof(cb));
|
||||
cb.async = !_mesa_get_debug_state_int(ctx, GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
cb.debug_message = st_debug_message;
|
||||
cb.data = ctx;
|
||||
pipe->set_debug_callback(pipe, &cb);
|
||||
} else {
|
||||
pipe->set_debug_callback(pipe, NULL);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user