Mesa (master): mesa: Implement GL_DEBUG_OUTPUT
Brian Paul
brianp at kemper.freedesktop.org
Wed Sep 4 13:57:02 UTC 2013
Module: Mesa
Branch: master
Commit: b5c4795f386976830370f56d1fa5a1c4099d88e2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5c4795f386976830370f56d1fa5a1c4099d88e2
Author: Timothy Arceri <t_arceri at yahoo.com.au>
Date: Mon Aug 26 19:02:11 2013 +1000
mesa: Implement GL_DEBUG_OUTPUT
Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/mesa/drivers/dri/i965/brw_context.c | 2 ++
src/mesa/main/enable.c | 9 +++++++++
src/mesa/main/errors.c | 3 +++
src/mesa/main/mtypes.h | 1 +
src/mesa/state_tracker/st_manager.c | 6 +++++-
5 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 2321076..d0b2fc1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -468,8 +468,10 @@ brwCreateContext(int api,
if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
+ ctx->Debug.DebugOutput = GL_FALSE;
if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) {
ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
+ ctx->Debug.DebugOutput = GL_TRUE;
/* Turn on some extra GL_ARB_debug_output generation. */
brw->perf_debug = true;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 21e5931..5e2fd80 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -364,6 +364,11 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
FLUSH_VERTICES(ctx, _NEW_DEPTH);
ctx->Depth.Test = state;
break;
+ case GL_DEBUG_OUTPUT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
+ ctx->Debug.DebugOutput = state;
+ break;
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
@@ -1201,6 +1206,10 @@ _mesa_IsEnabled( GLenum cap )
return ctx->Light.ColorMaterialEnabled;
case GL_CULL_FACE:
return ctx->Polygon.CullFlag;
+ case GL_DEBUG_OUTPUT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
+ return ctx->Debug.DebugOutput;
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index afe1aff..52fbade 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -194,6 +194,9 @@ should_log(struct gl_context *ctx,
&ctx->Debug.Namespaces[gstack][source][type];
uintptr_t state;
+ if (!ctx->Debug.DebugOutput)
+ return GL_FALSE;
+
/* In addition to not being able to store zero as a value, HashTable also
can't use zero as a key. */
if (id)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1747866..5e68a77 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3392,6 +3392,7 @@ struct gl_debug_state
GLDEBUGPROC Callback;
const void *CallbackData;
GLboolean SyncOutput;
+ GLboolean DebugOutput;
GLboolean Defaults[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SEVERITY_COUNT][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
struct gl_debug_namespace Namespaces[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT];
struct gl_debug_msg Log[MAX_DEBUG_LOGGED_MESSAGES];
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 9c2b4d2..098e6c0 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -626,8 +626,12 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
return NULL;
}
- if (attribs->flags & ST_CONTEXT_FLAG_DEBUG)
+ st->ctx->Debug.DebugOutput = GL_FALSE;
+ if (attribs->flags & ST_CONTEXT_FLAG_DEBUG){
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
+ st->ctx->Debug.DebugOutput = GL_TRUE;
+ }
+
if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
More information about the mesa-commit
mailing list