From 6346a753c6e77373cffcec6dd0df253efd159dd4 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Fri, 20 Apr 2007 18:25:42 +0300 Subject: xmesa: split FX functions to separate file, part 2. --- src/mesa/drivers/x11/xm_api.c | 21 ++++++++------------- src/mesa/drivers/x11/xm_glide.c | 21 ++++++++++++++++++++- src/mesa/drivers/x11/xm_glide.h | 4 ++++ src/mesa/drivers/x11/xmesaP.h | 1 - 4 files changed, 32 insertions(+), 15 deletions(-) (limited to 'src/mesa/drivers/x11') diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 692eb5f8078..5e2327a2d3b 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1557,12 +1557,11 @@ PUBLIC void XMesaDestroyContext( XMesaContext c ) { GLcontext *mesaCtx = &c->mesa; -#ifdef FX - XMesaBuffer xmbuf = XMESA_BUFFER(mesaCtx->DrawBuffer); - if (xmbuf && xmbuf->FXctx) - fxMesaDestroyContext(xmbuf->FXctx); +#ifdef FX + FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) ); #endif + _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); _tnl_DestroyContext( mesaCtx ); @@ -1767,15 +1766,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, if (!drawBuffer || !readBuffer) return GL_FALSE; /* must specify buffers! */ -#ifdef FX - if (drawBuffer->FXctx) { - fxMesaMakeCurrent(drawBuffer->FXctx); - - c->xm_buffer = drawBuffer; - - return GL_TRUE; - } -#endif if (&(c->mesa) == _mesa_get_current_context() && c->mesa.DrawBuffer == &drawBuffer->mesa_buffer && c->mesa.ReadBuffer == &readBuffer->mesa_buffer @@ -1786,6 +1776,11 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, c->xm_buffer = drawBuffer; +#ifdef FX + if (FXmakeCurrent( drawBuffer )) + return GL_TRUE; +#endif + /* Call this periodically to detect when the user has begun using * GL rendering from multiple threads. */ diff --git a/src/mesa/drivers/x11/xm_glide.c b/src/mesa/drivers/x11/xm_glide.c index 37787a7922b..ae4f4282dbb 100644 --- a/src/mesa/drivers/x11/xm_glide.c +++ b/src/mesa/drivers/x11/xm_glide.c @@ -27,6 +27,8 @@ #include "xmesaP.h" #ifdef FX +#include "../glide/fxdrv.h" + void FXcreateContext(XMesaVisual v, XMesaWindow w, XMesaContext c, XMesaBuffer b) { @@ -109,6 +111,24 @@ FXcreateContext(XMesaVisual v, XMesaWindow w, XMesaContext c, XMesaBuffer b) } +void FXdestroyContext( XMesaBuffer b ) +{ + if (b && b->FXctx) + fxMesaDestroyContext(b->FXctx); +} + + +GLboolean FXmakeCurrent( XMesaBuffer b ) +{ + if (b->FXctx) { + fxMesaMakeCurrent(b->FXctx); + + return GL_TRUE; + } + return GL_FALSE; +} + + /* * Read image from VooDoo frame buffer into X/Mesa's back XImage. */ @@ -118,7 +138,6 @@ static void FXgetImage( XMesaBuffer b ) static unsigned short pixbuf[MAX_WIDTH]; GLuint x, y; GLuint width, height; - XMesaContext xmesa = XMESA_CONTEXT(ctx); #ifdef XFree86Server x = b->frontxrb->pixmap->x; diff --git a/src/mesa/drivers/x11/xm_glide.h b/src/mesa/drivers/x11/xm_glide.h index 7458c57415a..f7d0316524d 100644 --- a/src/mesa/drivers/x11/xm_glide.h +++ b/src/mesa/drivers/x11/xm_glide.h @@ -31,6 +31,10 @@ extern void FXcreateContext( XMesaVisual v, XMesaContext c, XMesaBuffer b ); +extern void FXdestroyContext( XMesaBuffer b ); + +extern GLboolean FXmakeCurrent( XMesaBuffer b ); + extern GLboolean FXswapBuffers( XMesaBuffer b ); #endif /* _XM_GLIDE_H_ */ diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index cae5c0d9bc5..01988867476 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -31,7 +31,6 @@ #include "mtypes.h" #if defined(FX) #include "GL/fxmesa.h" -#include "../glide/fxdrv.h" #include "xm_glide.h" #endif #ifdef XFree86Server -- cgit v1.2.3