From 22633805fa4edf5771a4aa951de947e3346f76be Mon Sep 17 00:00:00 2001 From: Daniel Borca Date: Tue, 10 Feb 2004 07:46:07 +0000 Subject: [PATCH] fixed back fxMesaGetCurrentContext to match MakeCurrent --- include/GL/dmesa.h | 7 +++++- include/GL/fxmesa.h | 2 +- src/mesa/drivers/dos/dmesa.c | 39 ++++++++++++++++++++++++-------- src/mesa/drivers/glide/fxapi.c | 5 ++-- src/mesa/drivers/glide/fxddtex.c | 2 +- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/include/GL/dmesa.h b/include/GL/dmesa.h index 8d4c5bd645d..c7207bd8b6e 100644 --- a/include/GL/dmesa.h +++ b/include/GL/dmesa.h @@ -90,7 +90,7 @@ void DMesaDestroyContext (DMesaContext c); /* * Return a handle to the current context. */ -void *DMesaGetCurrentContext (void); +DMesaContext DMesaGetCurrentContext (void); @@ -106,6 +106,11 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, */ void DMesaDestroyBuffer (DMesaBuffer b); +/* + * Return a handle to the current buffer. + */ +DMesaBuffer DMesaGetCurrentBuffer (void); + /* * Swap the front and back buffers for the given Buffer. * No action is taken if the buffer is not double buffered. diff --git a/include/GL/fxmesa.h b/include/GL/fxmesa.h index 5c63a8db658..057e6bd017e 100644 --- a/include/GL/fxmesa.h +++ b/include/GL/fxmesa.h @@ -77,7 +77,7 @@ GLAPI GLint GLAPIENTRY fxMesaSelectCurrentBoard(int n); GLAPI void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext ctx); -GLAPI void * GLAPIENTRY fxMesaGetCurrentContext(void); +GLAPI fxMesaContext GLAPIENTRY fxMesaGetCurrentContext(void); GLAPI void GLAPIENTRY fxMesaSwapBuffers(void); diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c index c7c8fcff849..752f13e909d 100644 --- a/src/mesa/drivers/dos/dmesa.c +++ b/src/mesa/drivers/dos/dmesa.c @@ -807,7 +807,7 @@ static const GLubyte* get_string (GLcontext *ctx, GLenum name) switch (name) { case GL_RENDERER: return (const GLubyte *)"Mesa DJGPP" - "\0port (c) Borca Daniel dec-2003"; + "\0port (c) Borca Daniel feb-2004"; default: return NULL; } @@ -1137,8 +1137,8 @@ void DMesaDestroyBuffer (DMesaBuffer b) DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share) { -#ifndef FX GLcontext *c; +#ifndef FX TNLcontext *tnl; struct dd_function_table functions; @@ -1177,11 +1177,11 @@ DMesaContext DMesaCreateContext (DMesaVisual visual, _swsetup_Wakeup(c); } - return (DMesaContext)c; - #else /* FX */ - return (DMesaContext)visual; + c = (GLcontext *)0xdeadbeef; #endif /* FX */ + + return (DMesaContext)c; } @@ -1292,13 +1292,34 @@ void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue) -void *DMesaGetCurrentContext (void) +DMesaContext DMesaGetCurrentContext (void) { -#ifndef FX GET_CURRENT_CONTEXT(ctx); - return ctx; + +#ifndef FX +#else + if (ctx != NULL) { + ctx = (GLcontext *)0xdeadbeef; + } +#endif + + return (DMesaContext)ctx; +} + + + +DMesaBuffer DMesaGetCurrentBuffer (void) +{ + const DMesaContext dmesa = DMesaGetCurrentContext(); + + if (dmesa == NULL) { + return NULL; + } + +#ifndef FX + return dmesa->buffer; #else - return fxMesaGetCurrentContext(); + return (DMesaBuffer)fxMesaGetCurrentContext(); #endif } diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index 61c69853e6a..8ffa36c9c36 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -147,10 +147,9 @@ GLint GLAPIENTRY fxMesaSelectCurrentBoard (int n) } -void * GLAPIENTRY fxMesaGetCurrentContext (void) +fxMesaContext GLAPIENTRY fxMesaGetCurrentContext (void) { - GET_CURRENT_CONTEXT(ctx); - return ctx; + return fxMesaCurrentCtx; } diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 17ff0826961..baaba8e6e31 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1257,7 +1257,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, } } #endif -#if 1 || FX_COMPRESS_DXT5_AS_DXT3_HACK +#if 0 && FX_COMPRESS_DXT5_AS_DXT3_HACK /* [dBorca] either VSA is stupid at DXT5, * or our compression tool is broken. See * above for caveats. -- 2.30.2