Revert "glapi: Implement optional dispatch logging"
This reverts commitb9abc6139a
and the follow on fixes (7aae704
and6fe1b47
). It's changing the glapi/driver ABI and causes a number of problems for debug/non-debug builds.
This commit is contained in:
parent
1f3c7d968c
commit
042a333028
|
@ -94,7 +94,7 @@ _GLAPI_EXPORT extern __thread void * _glapi_tls_Context
|
||||||
_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch;
|
_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch;
|
||||||
_GLAPI_EXPORT extern const void *_glapi_Context;
|
_GLAPI_EXPORT extern const void *_glapi_Context;
|
||||||
|
|
||||||
# define GET_DISPATCH(t) _glapi_tls_Dispatch
|
# define GET_DISPATCH() _glapi_tls_Dispatch
|
||||||
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
|
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -167,12 +167,6 @@ _glapi_get_proc_name(unsigned int offset);
|
||||||
_GLAPI_EXPORT unsigned long
|
_GLAPI_EXPORT unsigned long
|
||||||
_glthread_GetID(void);
|
_glthread_GetID(void);
|
||||||
|
|
||||||
_GLAPI_EXPORT int
|
|
||||||
_glapi_logging_available(void);
|
|
||||||
|
|
||||||
_GLAPI_EXPORT void
|
|
||||||
_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...),
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These stubs are kept so that the old DRI drivers still load.
|
* These stubs are kept so that the old DRI drivers still load.
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "glapi/glapitable.h"
|
#include "glapi/glapitable.h"
|
||||||
#include "glapi/glapidispatch.h"
|
#include "glapi/glapidispatch.h"
|
||||||
|
|
||||||
|
|
||||||
#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))
|
#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
@ -57,12 +58,27 @@
|
||||||
#define NAME(func) gl##func
|
#define NAME(func) gl##func
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */
|
||||||
|
|
||||||
|
#define F stdout
|
||||||
|
#define DISPATCH(FUNC, ARGS, MESSAGE) \
|
||||||
|
fprintf MESSAGE; \
|
||||||
|
CALL_ ## FUNC(GET_DISPATCH(), ARGS);
|
||||||
|
|
||||||
|
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
|
||||||
|
fprintf MESSAGE; \
|
||||||
|
return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define DISPATCH(FUNC, ARGS, MESSAGE) \
|
#define DISPATCH(FUNC, ARGS, MESSAGE) \
|
||||||
CALL_ ## FUNC(GET_DISPATCH(), ARGS);
|
CALL_ ## FUNC(GET_DISPATCH(), ARGS);
|
||||||
|
|
||||||
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
|
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
|
||||||
return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
|
return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
|
||||||
|
|
||||||
|
#endif /* logging */
|
||||||
|
|
||||||
|
|
||||||
#ifndef GLAPIENTRY
|
#ifndef GLAPIENTRY
|
||||||
#define GLAPIENTRY
|
#define GLAPIENTRY
|
||||||
|
@ -75,67 +91,3 @@
|
||||||
#include "glapi/glapitemp.h"
|
#include "glapi/glapitemp.h"
|
||||||
|
|
||||||
#endif /* USE_X86_ASM */
|
#endif /* USE_X86_ASM */
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
static void *logger_data;
|
|
||||||
static void (*logger_func)(void *data, const char *fmt, ...);
|
|
||||||
static struct _glapi_table *real_dispatch; /* FIXME: This need to be TLS etc */
|
|
||||||
|
|
||||||
#define KEYWORD1 static
|
|
||||||
#define KEYWORD1_ALT static
|
|
||||||
#define KEYWORD2
|
|
||||||
#define NAME(func) log_##func
|
|
||||||
#define F logger_data
|
|
||||||
|
|
||||||
static void
|
|
||||||
log_Unused(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DISPATCH(FUNC, ARGS, MESSAGE) \
|
|
||||||
logger_func MESSAGE; \
|
|
||||||
CALL_ ## FUNC(real_dispatch, ARGS);
|
|
||||||
|
|
||||||
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
|
|
||||||
logger_func MESSAGE; \
|
|
||||||
return CALL_ ## FUNC(real_dispatch, ARGS);
|
|
||||||
|
|
||||||
#define DISPATCH_TABLE_NAME __glapi_logging_table
|
|
||||||
|
|
||||||
#define TABLE_ENTRY(func) (_glapi_proc) log_##func
|
|
||||||
|
|
||||||
#include "glapi/glapitemp.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
_glapi_logging_available(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
real_dispatch = GET_DISPATCH();
|
|
||||||
logger_func = func;
|
|
||||||
logger_data = data;
|
|
||||||
_glapi_set_dispatch(&__glapi_logging_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
int
|
|
||||||
_glapi_logging_available(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -82,18 +82,6 @@ _glthread_GetID(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC int
|
|
||||||
_glapi_logging_available(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PUBLIC void
|
|
||||||
_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
void* p = __driDriverExtensions;
|
void* p = __driDriverExtensions;
|
||||||
|
|
|
@ -1370,38 +1370,7 @@ _mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispatch_logger(void *data, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vfprintf(stderr, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_mesa_set_dispatch(void *table)
|
|
||||||
{
|
|
||||||
if (table && (MESA_VERBOSE & VERBOSE_DISPATCH)) {
|
|
||||||
_glapi_set_dispatch(table);
|
|
||||||
_glapi_enable_logging(dispatch_logger, stderr);
|
|
||||||
} else {
|
|
||||||
_glapi_set_dispatch(table);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void
|
|
||||||
_mesa_set_dispatch(void *table)
|
|
||||||
{
|
|
||||||
_glapi_set_dispatch(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* Bind the given context to the given drawBuffer and readBuffer and
|
* Bind the given context to the given drawBuffer and readBuffer and
|
||||||
* make it the current context for the calling thread.
|
* make it the current context for the calling thread.
|
||||||
|
@ -1445,10 +1414,10 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
||||||
ASSERT(_mesa_get_current_context() == newCtx);
|
ASSERT(_mesa_get_current_context() == newCtx);
|
||||||
|
|
||||||
if (!newCtx) {
|
if (!newCtx) {
|
||||||
_mesa_set_dispatch(NULL); /* none current */
|
_glapi_set_dispatch(NULL); /* none current */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_mesa_set_dispatch(newCtx->CurrentDispatch);
|
_glapi_set_dispatch(newCtx->CurrentDispatch);
|
||||||
|
|
||||||
if (drawBuffer && readBuffer) {
|
if (drawBuffer && readBuffer) {
|
||||||
/* TODO: check if newCtx and buffer's visual match??? */
|
/* TODO: check if newCtx and buffer's visual match??? */
|
||||||
|
|
|
@ -145,9 +145,6 @@ extern GLboolean
|
||||||
_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
|
_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
|
||||||
GLframebuffer *readBuffer );
|
GLframebuffer *readBuffer );
|
||||||
|
|
||||||
extern void
|
|
||||||
_mesa_set_dispatch(void *table);
|
|
||||||
|
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
|
_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
|
||||||
|
|
||||||
|
|
|
@ -201,8 +201,7 @@ static void add_debug_flags( const char *debug )
|
||||||
{ "lighting", VERBOSE_LIGHTING },
|
{ "lighting", VERBOSE_LIGHTING },
|
||||||
{ "disassem", VERBOSE_DISASSEM },
|
{ "disassem", VERBOSE_DISASSEM },
|
||||||
{ "draw", VERBOSE_DRAW },
|
{ "draw", VERBOSE_DRAW },
|
||||||
{ "swap", VERBOSE_SWAPBUFFERS },
|
{ "swap", VERBOSE_SWAPBUFFERS }
|
||||||
{ "dispatch", VERBOSE_DISPATCH }
|
|
||||||
};
|
};
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
|
@ -212,9 +211,6 @@ static void add_debug_flags( const char *debug )
|
||||||
MESA_VERBOSE |= debug_opt[i].flag;
|
MESA_VERBOSE |= debug_opt[i].flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((MESA_VERBOSE & VERBOSE_DISPATCH) && !_glapi_logging_available())
|
|
||||||
_mesa_debug(NULL, "dispatch logging not available in this buidl\n");
|
|
||||||
|
|
||||||
/* Debug flag:
|
/* Debug flag:
|
||||||
*/
|
*/
|
||||||
if (strstr(debug, "flush"))
|
if (strstr(debug, "flush"))
|
||||||
|
|
|
@ -8062,7 +8062,7 @@ _mesa_NewList(GLuint name, GLenum mode)
|
||||||
ctx->Driver.NewList(ctx, name, mode);
|
ctx->Driver.NewList(ctx, name, mode);
|
||||||
|
|
||||||
ctx->CurrentDispatch = ctx->Save;
|
ctx->CurrentDispatch = ctx->Save;
|
||||||
_mesa_set_dispatch(ctx->CurrentDispatch);
|
_glapi_set_dispatch(ctx->CurrentDispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8109,7 +8109,7 @@ _mesa_EndList(void)
|
||||||
ctx->CompileFlag = GL_FALSE;
|
ctx->CompileFlag = GL_FALSE;
|
||||||
|
|
||||||
ctx->CurrentDispatch = ctx->Exec;
|
ctx->CurrentDispatch = ctx->Exec;
|
||||||
_mesa_set_dispatch(ctx->CurrentDispatch);
|
_glapi_set_dispatch(ctx->CurrentDispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8143,7 +8143,7 @@ _mesa_CallList(GLuint list)
|
||||||
/* also restore API function pointers to point to "save" versions */
|
/* also restore API function pointers to point to "save" versions */
|
||||||
if (save_compile_flag) {
|
if (save_compile_flag) {
|
||||||
ctx->CurrentDispatch = ctx->Save;
|
ctx->CurrentDispatch = ctx->Save;
|
||||||
_mesa_set_dispatch(ctx->CurrentDispatch);
|
_glapi_set_dispatch(ctx->CurrentDispatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8195,7 +8195,7 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
|
||||||
/* also restore API function pointers to point to "save" versions */
|
/* also restore API function pointers to point to "save" versions */
|
||||||
if (save_compile_flag) {
|
if (save_compile_flag) {
|
||||||
ctx->CurrentDispatch = ctx->Save;
|
ctx->CurrentDispatch = ctx->Save;
|
||||||
_mesa_set_dispatch(ctx->CurrentDispatch);
|
_glapi_set_dispatch(ctx->CurrentDispatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3346,8 +3346,7 @@ enum _verbose
|
||||||
VERBOSE_VERTS = 0x0800,
|
VERBOSE_VERTS = 0x0800,
|
||||||
VERBOSE_DISASSEM = 0x1000,
|
VERBOSE_DISASSEM = 0x1000,
|
||||||
VERBOSE_DRAW = 0x2000,
|
VERBOSE_DRAW = 0x2000,
|
||||||
VERBOSE_SWAPBUFFERS = 0x4000,
|
VERBOSE_SWAPBUFFERS = 0x4000
|
||||||
VERBOSE_DISPATCH = 0x8000
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue