diff options
author | Brian Paul <[email protected]> | 1999-11-19 22:26:52 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 1999-11-19 22:26:52 +0000 |
commit | 0498682406d23226b5bc8973e02c7b3a9e0bdeaa (patch) | |
tree | f3a77213c31f672bfe27f1ac8680dbfb9cb90fce /src/mesa | |
parent | 9fd022a905e08e0d24ae987b5f8f858adfd671d9 (diff) |
updates for Mesa 3.3
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/context.c | 30 | ||||
-rw-r--r-- | src/mesa/main/context.h | 74 |
2 files changed, 49 insertions, 55 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7e913480a47..e5ab6047834 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.20 1999/11/15 22:21:47 brianp Exp $ */ +/* $Id: context.c,v 1.21 1999/11/19 22:26:52 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -93,23 +93,12 @@ #ifdef THREADS -#include "mthreads.h" /* Mesa platform independent threads interface */ - +#include "mthreads.h" static MesaTSD mesa_ctx_tsd; - static void mesa_ctx_thread_init() { MesaInitTSD(&mesa_ctx_tsd); } -GLcontext *gl_get_thread_context( void ) { - return (GLcontext *) MesaGetTSD(&mesa_ctx_tsd); -} - -static void set_thread_context( GLcontext *ctx ) { - MesaSetTSD(&mesa_ctx_tsd, ctx, mesa_ctx_thread_init); -} - - #else /* One Current Context pointer for all threads in the address space */ @@ -1498,19 +1487,20 @@ void gl_make_current( GLcontext *newCtx, GLframebuffer *buffer ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(oldCtx, "gl_make_current"); } -#ifdef THREADS - /* TODO: unbind old buffer from context? */ - set_thread_context( newCtx ); -#else if (oldCtx && oldCtx->Buffer) { /* unbind frame buffer from context */ oldCtx->Buffer = NULL; } + +#ifdef THREADS + /* TODO: unbind old buffer from context? */ + MesaSetTSD(&mesa_ctx_tsd, (void *) newCtx, mesa_ctx_thread_init); +#else _mesa_current_context = newCtx; +#endif if (newCtx) { SET_IMMEDIATE(newCtx, newCtx->input); } -#endif if (newCtx) _glapi_set_dispatch(newCtx->CurrentDispatch); @@ -1529,12 +1519,12 @@ void gl_make_current( GLcontext *newCtx, GLframebuffer *buffer ) /* - * Return current context handle. + * Return current context handle for the calling thread. */ GLcontext *gl_get_current_context( void ) { #ifdef THREADS - return gl_get_thread_context(); + return (GLcontext *) MesaGetTSD(&mesa_ctx_tsd); #else return _mesa_current_context; #endif diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 1da01fbb79b..6d391b89d3d 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -1,4 +1,4 @@ -/* $Id: context.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */ +/* $Id: context.h,v 1.3 1999/11/19 22:26:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -32,39 +32,6 @@ #include "types.h" -#ifdef THREADS - /* - * A seperate GLcontext for each thread - */ - extern GLcontext *gl_get_thread_context( void ); - -#define GET_IMMEDIATE struct immediate *IM = (gl_get_thread_context())->input; -#define SET_IMMEDIATE(ctx, im) \ -do { \ - ctx->input = im; \ -} while (0) - - -#else - /* - * All threads use same pointer to current context. - */ - extern GLcontext *_mesa_current_context; - extern struct immediate *CURRENT_INPUT; - #define GET_CURRENT_CONTEXT(C) GLcontext *C = _mesa_current_context - -#define GET_IMMEDIATE struct immediate *IM = CURRENT_INPUT -#define SET_IMMEDIATE(ctx, im) \ -do { \ - ctx->input = im; \ - CURRENT_INPUT = im; \ -} while (0) - - -#endif - - - /* * There are three Mesa datatypes which are meant to be used by device * drivers: @@ -121,6 +88,10 @@ extern void gl_destroy_context( GLcontext *ctx ); */ extern void gl_context_initialize( GLcontext *ctx ); + +extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); + + /* * Create/destroy a GLframebuffer. A GLframebuffer is like a GLX drawable. * It bundles up the depth buffer, stencil buffer and accum buffers into a @@ -136,7 +107,40 @@ extern void gl_make_current( GLcontext *ctx, GLframebuffer *buffer ); extern GLcontext *gl_get_current_context(void); -extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); + +#ifdef THREADS + /* + * A seperate GLcontext for each thread + */ + + #define GET_CURRENT_CONTEXT(C) GLcontext *C = gl_get_current_context() + +#define GET_IMMEDIATE struct immediate *IM = (gl_get_current_context())->input; +#define SET_IMMEDIATE(ctx, im) \ +do { \ + ctx->input = im; \ +} while (0) + + +#else + /* + * All threads use same pointer to current context. + */ + extern GLcontext *_mesa_current_context; + extern struct immediate *CURRENT_INPUT; + #define GET_CURRENT_CONTEXT(C) GLcontext *C = _mesa_current_context + +#define GET_IMMEDIATE struct immediate *IM = CURRENT_INPUT +#define SET_IMMEDIATE(ctx, im) \ +do { \ + ctx->input = im; \ + CURRENT_INPUT = im; \ +} while (0) + + +#endif + + extern void _mesa_swapbuffers(GLcontext *ctx); |