diff options
author | nobled <[email protected]> | 2011-05-01 15:46:45 +0000 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-03-10 21:42:05 +0100 |
commit | ed087ee49808a692ce8a0389fcf6c9da27f99d8e (patch) | |
tree | ca730c3c4808b1db991652e43db7676bb24f438f /src/mesa | |
parent | 3917503b9a48275f389ec1e563fdb53415b87171 (diff) |
mesa: add infrastructure for GL_ARB_debug_output
Marek v2: don't add the extension to extensions.c yet
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/config.h | 6 | ||||
-rw-r--r-- | src/mesa/main/context.c | 1 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 5 | ||||
-rw-r--r-- | src/mesa/main/errors.c | 13 | ||||
-rw-r--r-- | src/mesa/main/errors.h | 3 | ||||
-rw-r--r-- | src/mesa/main/get.c | 7 | ||||
-rw-r--r-- | src/mesa/main/getstring.c | 6 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 29 |
8 files changed, 69 insertions, 1 deletions
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 8bf741f99ac..1d5a0622dda 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -261,6 +261,12 @@ #define MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024 /*@}*/ +/** For GL_ARB_debug_output */ +/*@{*/ +#define MAX_DEBUG_LOGGED_MESSAGES 10 +#define MAX_DEBUG_MESSAGE_LENGTH 4096 +/*@}*/ + /* * Color channel component order diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8d48904f82f..6332e07b126 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -759,6 +759,7 @@ init_attrib_groups(struct gl_context *ctx) _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); _mesa_init_display_list( ctx ); + _mesa_init_errors( ctx ); _mesa_init_eval( ctx ); _mesa_init_fbobjects( ctx ); _mesa_init_feedback( ctx ); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 515dda95243..2f0216b0184 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -348,6 +348,9 @@ _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_SYNCHRONOUS_ARB: + ctx->Debug.SyncOutput = state; + break; case GL_DITHER: if (ctx->Color.DitherFlag == state) return; @@ -1114,6 +1117,8 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Light.ColorMaterialEnabled; case GL_CULL_FACE: return ctx->Polygon.CullFlag; + case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB: + return ctx->Debug.SyncOutput; case GL_DEPTH_TEST: return ctx->Depth.Test; case GL_DITHER: diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index a571cdfe809..906aafcc9e7 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -36,7 +36,18 @@ #include "version.h" -#define MAXSTRING 4000 /* for _mesa_vsnprintf() */ +#define MAXSTRING MAX_DEBUG_MESSAGE_LENGTH + +void +_mesa_init_errors(struct gl_context *ctx) +{ + ctx->Debug.Callback = NULL; + ctx->Debug.SyncOutput = GL_FALSE; + ctx->Debug.Log[0].length = 0; + ctx->Debug.NumMessages = 0; + ctx->Debug.NextMsg = 0; + ctx->Debug.NextMsgLength = 0; +} /**********************************************************************/ /** \name Diagnostics */ diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h index 78dd57ae2dc..e467f5d44f2 100644 --- a/src/mesa/main/errors.h +++ b/src/mesa/main/errors.h @@ -47,6 +47,9 @@ extern "C" { struct gl_context; extern void +_mesa_init_errors( struct gl_context *ctx ); + +extern void _mesa_warning( struct gl_context *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 5ad601242f4..9a5ca53345b 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1297,6 +1297,13 @@ static const struct value_desc values[] = { /* GL_ARB_robustness */ { GL_RESET_NOTIFICATION_STRATEGY_ARB, CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA }, + + /* GL_ARB_debug_output */ + { GL_DEBUG_LOGGED_MESSAGES_ARB, CONTEXT_INT(Debug.NumMessages), NO_EXTRA }, + { GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB, CONTEXT_INT(Debug.NextMsgLength), NO_EXTRA }, + { GL_MAX_DEBUG_LOGGED_MESSAGES_ARB, CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA }, + { GL_MAX_DEBUG_MESSAGE_LENGTH_ARB, CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA }, + #endif /* FEATURE_GL */ }; diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index dbf6c3f5e42..90e0280552e 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -224,6 +224,12 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr; break; #endif + case GL_DEBUG_CALLBACK_FUNCTION_ARB: + *params = (GLvoid *) ctx->Debug.Callback; + break; + case GL_DEBUG_CALLBACK_USER_PARAM_ARB: + *params = ctx->Debug.CallbackData; + break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); return; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 480b1cf28e2..03ec30356e9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3186,6 +3186,32 @@ struct gl_dlist_state } Current; }; +/** + * An error, warning, or other piece of debug information for an application + * to consume via GL_ARB_debug_output. + */ +struct gl_debug_msg +{ + GLenum source; + GLenum type; + GLuint id; + GLenum severity; + GLsizei length; + GLcharARB *message; +}; + +/* GL_ARB_debug_output */ +struct gl_debug_state +{ + GLDEBUGPROCARB Callback; + GLvoid *CallbackData; + GLboolean SyncOutput; + struct gl_debug_msg Log[MAX_DEBUG_LOGGED_MESSAGES]; + GLint NumMessages; + GLint NextMsg; + GLint NextMsgLength; /* redundant, but copied here from Log[NextMsg].length + for the sake of the offsetof() code in get.c */ +}; /** * Enum for the OpenGL APIs we know about and may support. @@ -3351,6 +3377,9 @@ struct gl_context const char *ErrorDebugFmtString; GLuint ErrorDebugCount; + /* GL_ARB_debug_output */ + struct gl_debug_state Debug; + GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ |