mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
mesa: add infrastructure for GL_ARB_debug_output
Marek v2: don't add the extension to extensions.c yet
This commit is contained in:
parent
3917503b9a
commit
ed087ee498
8 changed files with 69 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -46,6 +46,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue