summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>1999-11-28 20:08:02 +0000
committerBrian Paul <[email protected]>1999-11-28 20:08:02 +0000
commit426cb9f58f194a1e30e0908e8fc971bdcae06960 (patch)
treefaa99f006510ef0fd971de26fd5cfb868d7e9b44 /src/mesa/drivers/x11
parente17ba7120fee25e57e7e19fc55d4dbb7b5634f1f (diff)
changes for new GLX dispatcher
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/fakeglx.c428
1 files changed, 340 insertions, 88 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 538793f9b46..84d95f68463 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1,4 +1,4 @@
-/* $Id: fakeglx.c,v 1.17 1999/11/25 17:37:49 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.18 1999/11/28 20:08:02 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -25,9 +25,6 @@
*/
-
-
-
/*
* A pseudo-GLX implementation to allow OpenGL/GLX programs to work with Mesa.
* The Fake_glX*() functions implemented here are called from glxapi.c
@@ -46,10 +43,10 @@
#include "glxheader.h"
+#include "glxapi.h"
#include "GL/xmesa.h"
#include "context.h"
#include "config.h"
-#include "fakeglx.h"
#include "macros.h"
#include "types.h"
#include "xmesaP.h"
@@ -851,7 +848,8 @@ static XVisualInfo *choose_x_overlay_visual( Display *dpy, int scr,
-XVisualInfo *Fake_glXChooseVisual( Display *dpy, int screen, int *list )
+static XVisualInfo *
+Fake_glXChooseVisual( Display *dpy, int screen, int *list )
{
int *parselist;
XVisualInfo *vis;
@@ -1028,8 +1026,9 @@ XVisualInfo *Fake_glXChooseVisual( Display *dpy, int screen, int *list )
-GLXContext Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
- GLXContext share_list, Bool direct )
+static GLXContext
+Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
+ GLXContext share_list, Bool direct )
{
XMesaVisual glxvis;
XMesaContext xmctx;
@@ -1062,57 +1061,10 @@ static GLXDrawable MakeCurrent_PrevReadable = 0;
static XMesaBuffer MakeCurrent_PrevDrawBuffer = 0;
static XMesaBuffer MakeCurrent_PrevReadBuffer = 0;
-Bool Fake_glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx )
-{
-#if 1
- return Fake_glXMakeContextCurrent( dpy, drawable, drawable, ctx );
-#endif
-#if 0
- if (ctx && drawable) {
- XMesaBuffer buffer;
- XMesaContext xmctx = (XMesaContext) ctx;
-
- if (drawable==MakeCurrent_PrevDrawable && ctx==MakeCurrent_PrevContext) {
- buffer = MakeCurrent_PrevDrawBuffer;
- }
- else {
- buffer = XMesaFindBuffer( dpy, drawable );
- }
- if (!buffer) {
- /* drawable must be a new window! */
- buffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, drawable, ctx );
- if (!buffer) {
- /* Out of memory, or context/drawable depth mismatch */
- return False;
- }
- }
- MakeCurrent_PrevContext = ctx;
- MakeCurrent_PrevDrawable = drawable;
- MakeCurrent_PrevDrawBuffer = buffer;
-
- /* Now make current! */
- return (Bool) XMesaMakeCurrent( (XMesaContext) ctx, buffer );
- }
- else if (!ctx && !drawable) {
- /* release current context w/out assigning new one. */
- XMesaMakeCurrent( NULL, NULL );
- MakeCurrent_PrevContext = 0;
- MakeCurrent_PrevDrawable = 0;
- MakeCurrent_PrevDrawBuffer = 0;
- return True;
- }
- else {
- /* ctx XOR drawable is NULL, this is an error */
- return False;
- }
-#endif
-}
-
-
-
/* GLX 1.3 and later */
-Bool Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
- GLXDrawable read, GLXContext ctx )
+static Bool
+Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
+ GLXDrawable read, GLXContext ctx )
{
if (ctx && draw && read) {
XMesaBuffer drawBuffer, readBuffer;
@@ -1180,8 +1132,19 @@ Bool Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
}
+
+static Bool
+Fake_glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx )
+{
+ return Fake_glXMakeContextCurrent( dpy, drawable, drawable, ctx );
+}
+
+
+
/* GLX 1.3 and later */
-GLXDrawable Fake_glXGetCurrentReadDrawable( void )
+#if 0
+static GLXDrawable
+Fake_glXGetCurrentReadDrawable( void )
{
XMesaBuffer b = XMesaGetCurrentReadBuffer();
if (b) {
@@ -1191,11 +1154,11 @@ GLXDrawable Fake_glXGetCurrentReadDrawable( void )
return 0;
}
}
+#endif
-
-GLXPixmap Fake_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo,
- Pixmap pixmap )
+static GLXPixmap
+Fake_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo, Pixmap pixmap )
{
XMesaVisual v;
XMesaBuffer b;
@@ -1219,8 +1182,9 @@ GLXPixmap Fake_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo,
#ifdef GLX_MESA_pixmap_colormap
-GLXPixmap Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
- Pixmap pixmap, Colormap cmap )
+static GLXPixmap
+Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
+ Pixmap pixmap, Colormap cmap )
{
XMesaVisual v;
XMesaBuffer b;
@@ -1244,7 +1208,8 @@ GLXPixmap Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
#endif
-void Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
+static void
+Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
{
XMesaBuffer b = XMesaFindBuffer(dpy, pixmap);
if (b) {
@@ -1256,8 +1221,9 @@ void Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
}
-void Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
- GLuint mask )
+static void
+Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
+ GLuint mask )
{
XMesaContext xm_src = (XMesaContext) src;
XMesaContext xm_dst = (XMesaContext) dst;
@@ -1267,7 +1233,8 @@ void Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
-Bool Fake_glXQueryExtension( Display *dpy, int *errorb, int *event )
+static Bool
+Fake_glXQueryExtension( Display *dpy, int *errorb, int *event )
{
/* Mesa's GLX isn't really an X extension but we try to act like one. */
(void) dpy;
@@ -1284,7 +1251,8 @@ void _kw_ungrab_all( Display *dpy )
}
-void Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
+static void
+Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
{
(void) dpy;
MakeCurrent_PrevContext = 0;
@@ -1298,7 +1266,8 @@ void Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
-Bool Fake_glXIsDirect( Display *dpy, GLXContext ctx )
+static Bool
+Fake_glXIsDirect( Display *dpy, GLXContext ctx )
{
(void) dpy;
return ((XMesaContext) ctx)->direct;
@@ -1306,7 +1275,8 @@ Bool Fake_glXIsDirect( Display *dpy, GLXContext ctx )
-void Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
+static void
+Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
{
XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
@@ -1319,8 +1289,9 @@ void Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
}
-void Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
- int x, int y, int width, int height )
+static void
+Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
+ int x, int y, int width, int height )
{
XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
if (buffer) {
@@ -1333,7 +1304,8 @@ void Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
-Bool Fake_glXQueryVersion( Display *dpy, int *maj, int *min )
+static Bool
+Fake_glXQueryVersion( Display *dpy, int *maj, int *min )
{
(void) dpy;
/* Return GLX version, not Mesa version */
@@ -1348,8 +1320,9 @@ Bool Fake_glXQueryVersion( Display *dpy, int *maj, int *min )
/*
* Query the GLX attributes of the given XVisualInfo.
*/
-int Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
- int attrib, int *value )
+static int
+Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
+ int attrib, int *value )
{
XMesaVisual glxvis;
@@ -1491,14 +1464,18 @@ int Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
-GLXContext Fake_glXGetCurrentContext( void )
+#if 0
+static GLXContext
+Fake_glXGetCurrentContext( void )
{
return (GLXContext) XMesaGetCurrentContext();
}
+#endif
-
-GLXDrawable Fake_glXGetCurrentDrawable( void )
+#if 0
+static GLXDrawable
+Fake_glXGetCurrentDrawable( void )
{
XMesaBuffer b = XMesaGetCurrentBuffer();
if (b) {
@@ -1508,9 +1485,11 @@ GLXDrawable Fake_glXGetCurrentDrawable( void )
return 0;
}
}
+#endif
-void Fake_glXWaitGL( void )
+static void
+Fake_glXWaitGL( void )
{
XMesaContext xmesa = XMesaGetCurrentContext();
XMesaFlush( xmesa );
@@ -1518,7 +1497,8 @@ void Fake_glXWaitGL( void )
-void Fake_glXWaitX( void )
+static void
+Fake_glXWaitX( void )
{
XMesaContext xmesa = XMesaGetCurrentContext();
XMesaFlush( xmesa );
@@ -1542,7 +1522,8 @@ static const char *get_extensions( void )
/* GLX 1.1 and later */
-const char *Fake_glXQueryExtensionsString( Display *dpy, int screen )
+static const char *
+Fake_glXQueryExtensionsString( Display *dpy, int screen )
{
(void) dpy;
(void) screen;
@@ -1552,7 +1533,8 @@ const char *Fake_glXQueryExtensionsString( Display *dpy, int screen )
/* GLX 1.1 and later */
-const char *Fake_glXQueryServerString( Display *dpy, int screen, int name )
+static const char *
+Fake_glXQueryServerString( Display *dpy, int screen, int name )
{
static char version[1000];
sprintf(version, "%d.%d %s", SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION,
@@ -1576,7 +1558,8 @@ const char *Fake_glXQueryServerString( Display *dpy, int screen, int name )
/* GLX 1.1 and later */
-const char *Fake_glXGetClientString( Display *dpy, int name )
+static const char *
+Fake_glXGetClientString( Display *dpy, int name )
{
static char version[1000];
sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION, CLIENT_MINOR_VERSION,
@@ -1599,7 +1582,9 @@ const char *Fake_glXGetClientString( Display *dpy, int name )
/* GLX 1.2 and later */
-Display *Fake_glXGetCurrentDisplay( void )
+#if 0
+static Display *
+Fake_glXGetCurrentDisplay( void )
{
XMesaContext xmesa = XMesaGetCurrentContext();
if (xmesa && xmesa->xm_visual)
@@ -1607,6 +1592,159 @@ Display *Fake_glXGetCurrentDisplay( void )
else
return NULL;
}
+#endif
+
+
+/*
+ * GLX 1.3 and later
+ */
+
+static GLXFBConfig
+Fake_glXChooseFBConfig( Display *dpy, int screen,
+ const int *attribList, int *nitems )
+{
+ (void) dpy;
+ (void) screen;
+ (void) attribList;
+ (void) nitems;
+ return 0;
+}
+
+
+static int
+Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
+ int attribute, int *value )
+{
+ (void) dpy;
+ (void) config;
+ (void) attribute;
+ (void) value;
+ return 0;
+}
+
+
+static XVisualInfo *
+Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
+{
+ (void) dpy;
+ (void) config;
+ return 0;
+}
+
+
+static GLXWindow
+Fake_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
+ const int *attribList )
+{
+ (void) dpy;
+ (void) config;
+ (void) win;
+ (void) attribList;
+ return 0;
+}
+
+
+static void
+Fake_glXDestroyWindow( Display *dpy, GLXWindow window )
+{
+ (void) dpy;
+ (void) window;
+ return;
+}
+
+
+static GLXPixmap
+Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
+ const int *attribList )
+{
+ (void) dpy;
+ (void) config;
+ (void) pixmap;
+ (void) attribList;
+ return 0;
+}
+
+
+static void
+Fake_glXDestroyPixmap( Display *dpy, GLXPixmap pixmap )
+{
+ (void) dpy;
+ (void) pixmap;
+ return;
+}
+
+
+static GLXPbuffer
+Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config,
+ const int *attribList )
+{
+ (void) dpy;
+ (void) config;
+ (void) attribList;
+ return 0;
+}
+
+
+static void
+Fake_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf )
+{
+ (void) dpy;
+ (void) pbuf;
+}
+
+
+static void
+Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
+ unsigned int *value )
+{
+ (void) dpy;
+ (void) draw;
+ (void) attribute;
+ (void) value;
+}
+
+
+static GLXContext
+Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config,
+ int renderType, GLXContext shareList, Bool direct )
+{
+ (void) dpy;
+ (void) config;
+ (void) renderType;
+ (void) shareList;
+ (void) direct;
+ return 0;
+}
+
+
+static int
+Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value )
+{
+ (void) dpy;
+ (void) ctx;
+ (void) attribute;
+ (void) value;
+ return 0;
+}
+
+
+static void
+Fake_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask )
+{
+ (void) dpy;
+ (void) drawable;
+ (void) mask;
+}
+
+
+static void
+Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
+ unsigned long *mask )
+{
+ (void) dpy;
+ (void) drawable;
+ (void) mask;
+}
@@ -1614,7 +1752,8 @@ Display *Fake_glXGetCurrentDisplay( void )
* Release the depth, stencil, accum buffers attached to a GLXDrawable
* (a window or pixmap) prior to destroying the GLXDrawable.
*/
-Bool Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
+static Bool
+Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
{
XMesaBuffer b = XMesaFindBuffer(dpy, d);
if (b) {
@@ -1628,15 +1767,38 @@ Bool Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
/*
* GLX_MESA_set_3dfx_mode
*/
-GLboolean Fake_glXSet3DfxModeMESA( GLint mode )
+static GLboolean
+Fake_glXSet3DfxModeMESA( GLint mode )
{
return XMesaSetFXmode( mode );
}
+/*
+ * GLX_SGI_video_sync
+ */
+
+#ifdef GLX_SGI_video_sync
+
+static int
+Fake_glXGetVideoSyncSGI(unsigned int *count)
+{
+ return 0;
+}
+
+
+static int
+Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
+{
+ return 0;
+}
+
+#endif
+
+
#if 0
-/*GLfunction Fake_glXGetProcAddress( const GLubyte *procName )*/
+/*GLfunction glXGetProcAddress( const GLubyte *procName )*/
void (*Fake_glXGetProcAddress( const GLubyte *procName ))()
{
typedef void (*GLfunction)();
@@ -1669,3 +1831,93 @@ void (*Fake_glXGetProcAddress( const GLubyte *procName ))()
return NULL;
}
#endif
+
+
+extern void Fake_glXUseXFont( Font font, int first, int count, int listbase );
+
+
+struct _glxapi_table *_mesa_GetGLXDispatchTable(void)
+{
+ static struct _glxapi_table glx;
+
+ /* be sure our dispatch table size <= libGL's table */
+ {
+ int size = sizeof(struct _glxapi_table) / sizeof(void *);
+ (void) size;
+ assert(_glxapi_get_dispatch_table_size() >= size);
+ }
+
+ /* initialize the whole table to no-ops */
+ _glxapi_set_no_op_table(&glx);
+
+ /* now initialize the table with the functions I implement */
+ glx.ChooseVisual = Fake_glXChooseVisual;
+ glx.CopyContext = Fake_glXCopyContext;
+ glx.CreateContext = Fake_glXCreateContext;
+ glx.CreateGLXPixmap = Fake_glXCreateGLXPixmap;
+ glx.DestroyContext = Fake_glXDestroyContext;
+ glx.DestroyGLXPixmap = Fake_glXDestroyGLXPixmap;
+ glx.GetConfig = Fake_glXGetConfig;
+ /*glx.GetCurrentContext = Fake_glXGetCurrentContext;*/
+ /*glx.GetCurrentDrawable = Fake_glXGetCurrentDrawable;*/
+ glx.IsDirect = Fake_glXIsDirect;
+ glx.MakeCurrent = Fake_glXMakeCurrent;
+ glx.QueryExtension = Fake_glXQueryExtension;
+ glx.QueryVersion = Fake_glXQueryVersion;
+ glx.SwapBuffers = Fake_glXSwapBuffers;
+ glx.UseXFont = Fake_glXUseXFont;
+ glx.WaitGL = Fake_glXWaitGL;
+ glx.WaitX = Fake_glXWaitX;
+
+#ifdef _GLXAPI_VERSION_1_1
+ glx.GetClientString = Fake_glXGetClientString;
+ glx.QueryExtensionsString = Fake_glXQueryExtensionsString;
+ glx.QueryServerString = Fake_glXQueryServerString;
+#endif
+
+#ifdef _GLXAPI_VERSION_1_2
+ /*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/
+#endif
+
+#ifdef _GLXAPI_VERSION_1_3
+ glx.ChooseFBConfig = Fake_glXChooseFBConfig;
+ glx.CreateNewContext = Fake_glXCreateNewContext;
+ glx.CreatePbuffer = Fake_glXCreatePbuffer;
+ glx.CreatePixmap = Fake_glXCreatePixmap;
+ glx.CreateWindow = Fake_glXCreateWindow;
+ glx.DestroyPbuffer = Fake_glXDestroyPbuffer;
+ glx.DestroyPixmap = Fake_glXDestroyPixmap;
+ glx.DestroyWindow = Fake_glXDestroyWindow;
+ /*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/
+ glx.GetFBConfigAttrib = Fake_glXGetFBConfigAttrib;
+ glx.GetSelectedEvent = Fake_glXGetSelectedEvent;
+ glx.GetVisualFromFBConfig = Fake_glXGetVisualFromFBConfig;
+ glx.MakeContextCurrent = Fake_glXMakeContextCurrent;
+ glx.QueryContext = Fake_glXQueryContext;
+ glx.QueryDrawable = Fake_glXQueryDrawable;
+ glx.SelectEvent = Fake_glXSelectEvent;
+#endif
+
+#ifdef _GLXAPI_SGI_video_sync
+ glx.GetVideoSyncSGI = Fake_glXGetVideoSyncSGI;
+ glx.WaitVideoSyncSGI = Fake_glXWaitVideoSyncSGI;
+#endif
+
+#ifdef _GLXAPI_MESA_copy_sub_buffer
+ glx.CopySubBufferMESA = Fake_glXCopySubBufferMESA;
+#endif
+
+#ifdef _GLXAPI_MESA_release_buffers
+ glx.ReleaseBuffersMESA = Fake_glXReleaseBuffersMESA;
+#endif
+
+#ifdef _GLXAPI_MESA_pixmap_colormap
+ glx.CreateGLXPixmapMESA = Fake_glXCreateGLXPixmapMESA;
+#endif
+
+#ifdef _GLXAPI_MESA_set_3dfx_mode
+ glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA;
+#endif
+
+ return &glx;
+}