#include "util/u_memory.h"
#include "api_exec_decl.h"
+#include "pipe/p_context.h"
static GLuint PrevDynamicID = 0;
/**
+ * Installed as pipe_debug_callback when GL_DEBUG_OUTPUT is enabled.
+ */
+static void
+_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
+_mesa_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 = _debug_message;
+ cb.data = ctx;
+ pipe->set_debug_callback(pipe, &cb);
+ } else {
+ pipe->set_debug_callback(pipe, NULL);
+ }
+}
+
+/**
* Lock and return debug state for the context. The debug state will be
* allocated and initialized upon the first call. When NULL is returned, the
* debug state is not locked.
GLuint id,
enum mesa_debug_severity severity);
+void
+_mesa_update_debug_callback(struct gl_context *ctx);
+
#ifdef __cplusplus
}
#endif
switch (cap) {
case GL_DEBUG_OUTPUT:
case GL_DEBUG_OUTPUT_SYNCHRONOUS:
- st_update_debug_callback(ctx);
+ _mesa_update_debug_callback(ctx);
break;
default:
break;
{
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);
- }
-}
void st_debug_init( void );
-void st_update_debug_callback(struct gl_context *ctx);
-
static inline void
ST_DBG( unsigned flag, const char *fmt, ... )
{
}
if (st->ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT) {
- st_update_debug_callback(st->ctx);
+ _mesa_update_debug_callback(st->ctx);
}
if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)