summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Sapountzis <gsap7@yahoo.gr>2007-04-20 17:51:55 +0300
committerGeorge Sapountzis <gsap7@yahoo.gr>2007-04-20 21:08:55 +0300
commit6aa5668871e7f366b33e85fabc72885fc269a7d4 (patch)
tree34126e846c2a950d9bdd877c9a52a48a78d5d586
parentd60009bd6dba15d094b0d0bcb8180b7a2e1c1708 (diff)
xmesa: spilt FX code to separate functions.
-rw-r--r--src/mesa/drivers/x11/fakeglx.c18
-rw-r--r--src/mesa/drivers/x11/xm_api.c36
-rw-r--r--src/mesa/drivers/x11/xmesaP.h7
3 files changed, 34 insertions, 27 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index eecd52aa32..86a4deabc6 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -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 */
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 6439d13fa5..3e65ebd99b 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1578,25 +1578,20 @@ 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;
XMesaColormap cmap;
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,17 +1720,8 @@ 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 );
}
+#endif
/**
@@ -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");*/
+ return GL_FALSE;
+}
#else
+GLboolean XMesaSetFXmode( GLint mode )
+{
(void) mode;
-#endif
return GL_FALSE;
}
+#endif
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 98d03ccf62..170fc678eb 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -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 */