summaryrefslogtreecommitdiff
path: root/src/mesa/glapi/glapi.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-09-05 20:17:37 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-09-05 20:17:37 +0000
commit3a71d05e538c24b23fbe356295e2096f8bb692d1 (patch)
treeb8e33a99e3d7f8f4253d8ebd349db2a27075f2c3 /src/mesa/glapi/glapi.c
parentdca39e89119b8c2c35831ee745b2ff7da3bf11ba (diff)
added tracing facility from Loki
Diffstat (limited to 'src/mesa/glapi/glapi.c')
-rw-r--r--src/mesa/glapi/glapi.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index 9c40ce8e4d..8d31afb01d 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -1,8 +1,8 @@
-/* $Id: glapi.c,v 1.42 2000/05/24 17:53:30 brianp Exp $ */
+/* $Id: glapi.c,v 1.43 2000/09/05 20:17:37 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -49,6 +49,9 @@
#include "glapitable.h"
#include "glthread.h"
+#if defined(TRACE)
+#include "types.h"
+#endif
/* This is used when thread safety is disabled */
struct _glapi_table *_glapi_Dispatch = (struct _glapi_table *) __glapi_noop_table;
@@ -167,6 +170,10 @@ _glapi_get_context(void)
void
_glapi_set_dispatch(struct _glapi_table *dispatch)
{
+#if defined(TRACE)
+ GLcontext * ctx;
+#endif
+
if (!dispatch) {
/* use the no-op functions */
dispatch = (struct _glapi_table *) __glapi_noop_table;
@@ -178,14 +185,36 @@ _glapi_set_dispatch(struct _glapi_table *dispatch)
#endif
#if defined(THREADS)
+#if defined(TRACE)
+ ctx = (GLcontext *)_glthread_GetTSD(&ContextTSD);
+ if (ctx->TraceCtx->traceEnabled == GL_TRUE) {
+ _glthread_SetTSD(&DispatchTSD, (void*) ctx->TraceDispatch);
+ if (ThreadSafe)
+ _glapi_Dispatch = NULL;
+ else
+ _glapi_Dispatch = ctx->TraceDispatch;
+ } else {
+ _glthread_SetTSD(&DispatchTSD, (void*) dispatch);
+ if (ThreadSafe)
+ _glapi_Dispatch = NULL;
+ else
+ _glapi_Dispatch = dispatch;
+ }
+#else
_glthread_SetTSD(&DispatchTSD, (void*) dispatch);
if (ThreadSafe)
_glapi_Dispatch = NULL;
else
_glapi_Dispatch = dispatch;
+#endif /*TRACE*/
+#else /*THREADS*/
+#if defined(TRACE)
+ ctx = (GLcontext *)_glthread_GetTSD(&ContextTSD);
+ _glapi_Dispatch = ctx->TraceDispatch;
#else
_glapi_Dispatch = dispatch;
-#endif
+#endif /*TRACE*/
+#endif /*THREADS*/
}
@@ -210,6 +239,32 @@ _glapi_get_dispatch(void)
}
+#if defined(TRACE)
+struct _glapi_table *
+_glapi_get_true_dispatch(void)
+{
+ GLcontext* ctx;
+
+#if defined(THREADS)
+ if (ThreadSafe) {
+ ctx = (GLcontext *) _glthread_GetTSD(&ContextTSD);
+ assert(ctx);
+ assert(ctx->CurrentDispatch);
+ return ctx->CurrentDispatch;
+ }
+ else {
+ assert(_glapi_Context);
+ assert(((GLcontext *)_glapi_Context)->CurrentDispatch);
+ return ((GLcontext *)_glapi_Context)->CurrentDispatch;
+ }
+#else
+ assert(_glapi_Context);
+ assert(((GLcontext *)_glapi_Context)->CurrentDispatch);
+ return ((GLcontext *)_glapi_Context)->CurrentDispatch;
+#endif
+}
+#endif /* TRACE */
+
/*
* Return size of dispatch table struct as number of functions (or