summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.c24
-rw-r--r--src/mesa/main/context.h3
-rw-r--r--src/mesa/main/debug.c6
-rw-r--r--src/mesa/main/dlist.c8
-rw-r--r--src/mesa/main/mtypes.h3
5 files changed, 36 insertions, 8 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8e34ec4124f..73d96e8d212 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1367,6 +1367,26 @@ _mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height)
}
}
+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);
+ }
+}
/**
* Bind the given context to the given drawBuffer and readBuffer and
@@ -1411,10 +1431,10 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
ASSERT(_mesa_get_current_context() == newCtx);
if (!newCtx) {
- _glapi_set_dispatch(NULL); /* none current */
+ _mesa_set_dispatch(NULL); /* none current */
}
else {
- _glapi_set_dispatch(newCtx->CurrentDispatch);
+ _mesa_set_dispatch(newCtx->CurrentDispatch);
if (drawBuffer && readBuffer) {
/* TODO: check if newCtx and buffer's visual match??? */
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index c61da62826f..142243f5ee3 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -145,6 +145,9 @@ extern GLboolean
_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer );
+extern void
+_mesa_set_dispatch(void *table);
+
extern GLboolean
_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 526145aeccf..e5c313304d1 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -201,7 +201,8 @@ static void add_debug_flags( const char *debug )
{ "lighting", VERBOSE_LIGHTING },
{ "disassem", VERBOSE_DISASSEM },
{ "draw", VERBOSE_DRAW },
- { "swap", VERBOSE_SWAPBUFFERS }
+ { "swap", VERBOSE_SWAPBUFFERS },
+ { "dispatch", VERBOSE_DISPATCH }
};
GLuint i;
@@ -211,6 +212,9 @@ static void add_debug_flags( const char *debug )
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:
*/
if (strstr(debug, "flush"))
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 6928d21a21e..0c4e3d51a9d 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -8062,7 +8062,7 @@ _mesa_NewList(GLuint name, GLenum mode)
ctx->Driver.NewList(ctx, name, mode);
ctx->CurrentDispatch = ctx->Save;
- _glapi_set_dispatch(ctx->CurrentDispatch);
+ _mesa_set_dispatch(ctx->CurrentDispatch);
}
@@ -8109,7 +8109,7 @@ _mesa_EndList(void)
ctx->CompileFlag = GL_FALSE;
ctx->CurrentDispatch = ctx->Exec;
- _glapi_set_dispatch(ctx->CurrentDispatch);
+ _mesa_set_dispatch(ctx->CurrentDispatch);
}
@@ -8143,7 +8143,7 @@ _mesa_CallList(GLuint list)
/* also restore API function pointers to point to "save" versions */
if (save_compile_flag) {
ctx->CurrentDispatch = ctx->Save;
- _glapi_set_dispatch(ctx->CurrentDispatch);
+ _mesa_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 */
if (save_compile_flag) {
ctx->CurrentDispatch = ctx->Save;
- _glapi_set_dispatch(ctx->CurrentDispatch);
+ _mesa_set_dispatch(ctx->CurrentDispatch);
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3e54656981d..96fd9141902 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3345,7 +3345,8 @@ enum _verbose
VERBOSE_VERTS = 0x0800,
VERBOSE_DISASSEM = 0x1000,
VERBOSE_DRAW = 0x2000,
- VERBOSE_SWAPBUFFERS = 0x4000
+ VERBOSE_SWAPBUFFERS = 0x4000,
+ VERBOSE_DISPATCH = 0x8000
};