xmesa: spilt FX code to separate functions.

This commit is contained in:
George Sapountzis
2007-04-20 17:51:55 +03:00
parent d60009bd6d
commit 6aa5668871
3 changed files with 36 additions and 29 deletions
+14 -4
View File
@@ -1440,11 +1440,14 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
}
if (!drawBuffer) {
/* drawable must be a new window! */
drawBuffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, draw, xmctx);
drawBuffer = XMesaCreateWindowBuffer( xmctx->xm_visual, draw );
if (!drawBuffer) {
/* Out of memory, or context/drawable depth mismatch */
return False;
}
#ifdef FX
FXcreateContext( xmctx->xm_visual, draw, xmctx, drawBuffer );
#endif
}
/* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */
@@ -1457,12 +1460,14 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
}
if (!readBuffer) {
/* drawable must be a new window! */
readBuffer = XMesaCreateWindowBuffer2(glxCtx->xmesaContext->xm_visual,
read, xmctx);
readBuffer = XMesaCreateWindowBuffer( xmctx->xm_visual, read );
if (!readBuffer) {
/* Out of memory, or context/drawable depth mismatch */
return False;
}
#ifdef FX
FXcreateContext( xmctx->xm_visual, read, xmctx, readBuffer );
#endif
}
MakeCurrent_PrevContext = ctx;
@@ -2107,10 +2112,15 @@ Fake_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
if (!xmvis)
return 0;
xmbuf = XMesaCreateWindowBuffer2(xmvis, win, NULL);
xmbuf = XMesaCreateWindowBuffer(xmvis, win);
if (!xmbuf)
return 0;
#ifdef FX
/* XXX this will segfault if actually called */
FXcreateContext(xmvis, win, NULL, xmbuf);
#endif
(void) dpy;
(void) attribList; /* Ignored in GLX 1.3 */
+18 -22
View File
@@ -1578,17 +1578,13 @@ void XMesaDestroyContext( XMesaContext c )
* X window or pixmap.
* \param v the window's XMesaVisual
* \param w the window we're wrapping
* \param c context used to initialize the buffer if 3Dfx mode in use.
* \return new XMesaBuffer or NULL if error
*/
XMesaBuffer
XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c)
PUBLIC XMesaBuffer
XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
{
#ifndef XFree86Server
XWindowAttributes attr;
#endif
#ifdef FX
char *fxEnvVar;
#endif
int client = 0;
XMesaBuffer b;
@@ -1596,7 +1592,6 @@ XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c)
assert(v);
assert(w);
(void) c;
/* Check that window depth matches visual depth */
#ifdef XFree86Server
@@ -1642,8 +1637,14 @@ XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c)
return NULL;
}
return b;
}
#ifdef FX
fxEnvVar = _mesa_getenv("MESA_GLX_FX");
void
FXcreateContext(XMesaVisual v, XMesaWindow w, XMesaContext c, XMesaBuffer b)
{
char *fxEnvVar = _mesa_getenv("MESA_GLX_FX");
if (fxEnvVar) {
if (fxEnvVar[0]!='d') {
int attribs[100];
@@ -1719,18 +1720,9 @@ XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c)
_mesa_warning(NULL, " (check the README.3DFX file for more information).\n\n");
_mesa_warning(NULL, " you can disable this message with a 'export MESA_GLX_FX=disable'.\n");
}
}
#endif
return b;
}
PUBLIC XMesaBuffer
XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
{
return XMesaCreateWindowBuffer2( v, w, NULL );
}
/**
* Create a new XMesaBuffer from an X pixmap.
@@ -2004,9 +1996,9 @@ GLboolean XMesaCopyContext( XMesaContext xm_src, XMesaContext xm_dst, GLuint mas
/*
* Switch 3Dfx support hack between window and full-screen mode.
*/
#ifdef FX
GLboolean XMesaSetFXmode( GLint mode )
{
#ifdef FX
const char *fx = _mesa_getenv("MESA_GLX_FX");
if (fx && fx[0] != 'd') {
GET_CURRENT_CONTEXT(ctx);
@@ -2043,11 +2035,15 @@ GLboolean XMesaSetFXmode( GLint mode )
}
}
/*fprintf(stderr, "fallthrough\n");*/
#else
(void) mode;
#endif
return GL_FALSE;
}
#else
GLboolean XMesaSetFXmode( GLint mode )
{
(void) mode;
return GL_FALSE;
}
#endif
+4 -3
View File
@@ -569,9 +569,10 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx );
/* XXX this is a hack to implement shared display lists with 3Dfx */
extern XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v,
XMesaWindow w,
XMesaContext c );
extern void FXcreateContext( XMesaVisual v,
XMesaWindow w,
XMesaContext c,
XMesaBuffer b );
#define ENABLE_EXT_texure_compression_s3tc 0 /* SW texture compression */