Browse Source

variety of updates to better conform to real GLX

tags/mesa_3_3
Brian Paul 25 years ago
parent
commit
4c07bd5709
3 changed files with 59 additions and 64 deletions
  1. 21
    16
      src/mesa/drivers/x11/fakeglx.c
  2. 25
    25
      src/mesa/drivers/x11/glxapi.c
  3. 13
    23
      src/mesa/drivers/x11/glxapi.h

+ 21
- 16
src/mesa/drivers/x11/fakeglx.c View File

@@ -1,4 +1,4 @@
/* $Id: fakeglx.c,v 1.33 2000/04/19 01:44:01 brianp Exp $ */
/* $Id: fakeglx.c,v 1.34 2000/06/08 22:50:28 brianp Exp $ */

/*
* Mesa 3-D graphics library
@@ -1138,7 +1138,7 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
}
if (!drawBuffer) {
/* drawable must be a new window! */
drawBuffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, draw, ctx );
drawBuffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, draw, (XMesaContext) ctx );
if (!drawBuffer) {
/* Out of memory, or context/drawable depth mismatch */
return False;
@@ -1155,7 +1155,7 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
}
if (!readBuffer) {
/* drawable must be a new window! */
readBuffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, read, ctx );
readBuffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, read, (XMesaContext) ctx );
if (!readBuffer) {
/* Out of memory, or context/drawable depth mismatch */
return False;
@@ -1223,7 +1223,6 @@ Fake_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo, Pixmap pixmap )


#ifdef GLX_MESA_pixmap_colormap

static GLXPixmap
Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
Pixmap pixmap, Colormap cmap )
@@ -1246,7 +1245,6 @@ Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
}
return b->frontbuffer;
}

#endif


@@ -1263,6 +1261,7 @@ Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
}



static void
Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
unsigned long mask )
@@ -1332,6 +1331,8 @@ Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
}



#ifdef GLX_MESA_copy_sub_buffer
static void
Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height )
@@ -1344,6 +1345,7 @@ Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
fprintf(stderr, "Mesa Warning: glXCopySubBufferMESA: invalid drawable\n");
}
}
#endif



@@ -1775,6 +1777,7 @@ Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,



#ifdef GLX_MESA_release_buffers
/*
* Release the depth, stencil, accum buffers attached to a GLXDrawable
* (a window or pixmap) prior to destroying the GLXDrawable.
@@ -1789,16 +1792,18 @@ Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
}
return False;
}
#endif


/*
* GLX_MESA_set_3dfx_mode
*/

#ifdef GLX_MESA_set_3dfx_mode
static GLboolean
Fake_glXSet3DfxModeMESA( GLint mode )
{
return XMesaSetFXmode( mode );
}
#endif



/*
@@ -1858,17 +1863,17 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void)
glx.WaitGL = Fake_glXWaitGL;
glx.WaitX = Fake_glXWaitX;

#ifdef _GLXAPI_VERSION_1_1
#ifdef GLX_VERSION_1_1
glx.GetClientString = Fake_glXGetClientString;
glx.QueryExtensionsString = Fake_glXQueryExtensionsString;
glx.QueryServerString = Fake_glXQueryServerString;
#endif

#ifdef _GLXAPI_VERSION_1_2
#ifdef GLX_VERSION_1_2
/*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/
#endif

#ifdef _GLXAPI_VERSION_1_3
#ifdef GLX_VERSION_1_3
glx.ChooseFBConfig = Fake_glXChooseFBConfig;
glx.CreateNewContext = Fake_glXCreateNewContext;
glx.CreatePbuffer = Fake_glXCreatePbuffer;
@@ -1888,24 +1893,24 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void)
glx.SelectEvent = Fake_glXSelectEvent;
#endif

#ifdef _GLXAPI_SGI_video_sync
#ifdef GLX_SGI_video_sync
glx.GetVideoSyncSGI = Fake_glXGetVideoSyncSGI;
glx.WaitVideoSyncSGI = Fake_glXWaitVideoSyncSGI;
#endif

#ifdef _GLXAPI_MESA_copy_sub_buffer
#ifdef GLX_MESA_copy_sub_buffer
glx.CopySubBufferMESA = Fake_glXCopySubBufferMESA;
#endif

#ifdef _GLXAPI_MESA_release_buffers
#ifdef GLX_MESA_release_buffers
glx.ReleaseBuffersMESA = Fake_glXReleaseBuffersMESA;
#endif

#ifdef _GLXAPI_MESA_pixmap_colormap
#ifdef GLX_MESA_pixmap_colormap
glx.CreateGLXPixmapMESA = Fake_glXCreateGLXPixmapMESA;
#endif

#ifdef _GLXAPI_MESA_set_3dfx_mode
#ifdef GLX_MESA_set_3dfx_mode
glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA;
#endif


+ 25
- 25
src/mesa/drivers/x11/glxapi.c View File

@@ -1,4 +1,4 @@
/* $Id: glxapi.c,v 1.16 2000/04/10 21:13:19 brianp Exp $ */
/* $Id: glxapi.c,v 1.17 2000/06/08 22:50:28 brianp Exp $ */

/*
* Mesa 3-D graphics library
@@ -316,7 +316,7 @@ void glXWaitX(void)



#ifdef _GLXAPI_VERSION_1_1
#ifdef GLX_VERSION_1_1

const char *glXGetClientString(Display *dpy, int name)
{
@@ -348,7 +348,7 @@ const char *glXQueryServerString(Display *dpy, int screen, int name)



#ifdef _GLXAPI_VERSION_1_2
#ifdef GLX_VERSION_1_2
Display *glXGetCurrentDisplay(void)
{
return CurrentDisplay;
@@ -357,7 +357,7 @@ Display *glXGetCurrentDisplay(void)



#ifdef _GLXAPI_VERSION_1_3
#ifdef GLX_VERSION_1_3

GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
{
@@ -516,10 +516,10 @@ void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
(t->SelectEvent)(dpy, drawable, mask);
}

#endif /* _GLXAPI_VERSION_1_3 */
#endif /* GLX_VERSION_1_3 */


#ifdef _GLXAPI_EXT_import_context
#ifdef GLX_EXT_import_context

void glXFreeContextEXT(Display *dpy, GLXContext context)
{
@@ -565,7 +565,7 @@ int glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int *
#endif


#ifdef _GLXAPI_SGI_video_sync
#ifdef GLX_SGI_video_sync

int glXGetVideoSyncSGI(unsigned int *count)
{
@@ -587,7 +587,7 @@ int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
#endif


#ifdef _GLXAPI_MESA_copy_sub_buffer
#ifdef GLX_MESA_copy_sub_buffer

void glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height)
{
@@ -600,7 +600,7 @@ void glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int
#endif


#ifdef _GLXAPI_MESA_release_buffers
#ifdef GLX_MESA_release_buffers

Bool glXReleaseBuffersMESA(Display *dpy, Window w)
{
@@ -613,7 +613,7 @@ Bool glXReleaseBuffersMESA(Display *dpy, Window w)
#endif


#ifdef _GLXAPI_MESA_pixmap_colormap
#ifdef GLX_MESA_pixmap_colormap

GLXPixmap glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap)
{
@@ -626,7 +626,7 @@ GLXPixmap glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixm
#endif


#ifdef _GLXAPI_MESA_set_3dfx_mode
#ifdef GLX_MESA_set_3dfx_mode

GLboolean glXSet3DfxModeMESA(GLint mode)
{
@@ -659,22 +659,22 @@ const char **
_glxapi_get_extensions(void)
{
static const char *extensions[] = {
#ifdef _GLXAPI_EXT_import_context
#ifdef GLX_EXT_import_context
"GLX_EXT_import_context",
#endif
#ifdef _GLXAPI_SGI_video_sync
#ifdef GLX_SGI_video_sync
"GLX_SGI_video_sync",
#endif
#ifdef _GLXAPI_MESA_copy_sub_buffer
#ifdef GLX_MESA_copy_sub_buffer
"GLX_MESA_copy_sub_buffer",
#endif
#ifdef _GLXAPI_MESA_release_buffers
#ifdef GLX_MESA_release_buffers
"GLX_MESA_release_buffers",
#endif
#ifdef _GLXAPI_MESA_pixmap_colormap
#ifdef GLX_MESA_pixmap_colormap
"GLX_MESA_pixmap_colormap",
#endif
#ifdef _GLXAPI_MESA_set_3dfx_mode
#ifdef GLX_MESA_set_3dfx_mode
"GLX_MESA_set_3dfx_mode",
#endif
NULL
@@ -740,17 +740,17 @@ static struct name_address_pair GLX_functions[] = {
{ "glXWaitGL", (GLvoid *) glXWaitGL },
{ "glXWaitX", (GLvoid *) glXWaitX },

#ifdef _GLXAPI_VERSION_1_1
#ifdef GLX_VERSION_1_1
{ "glXGetClientString", (GLvoid *) glXGetClientString },
{ "glXQueryExtensionsString", (GLvoid *) glXQueryExtensionsString },
{ "glXQueryServerString", (GLvoid *) glXQueryServerString },
#endif

#ifdef _GLXAPI_VERSION_1_2
#ifdef GLX_VERSION_1_2
{ "glXGetCurrentDisplay", (GLvoid *) glXGetCurrentDisplay },
#endif

#ifdef _GLXAPI_VERSION_1_3
#ifdef GLX_VERSION_1_3
{ "glXChooseFBConfig", (GLvoid *) glXChooseFBConfig },
{ "glXCreateNewContext", (GLvoid *) glXCreateNewContext },
{ "glXCreatePbuffer", (GLvoid *) glXCreatePbuffer },
@@ -769,24 +769,24 @@ static struct name_address_pair GLX_functions[] = {
{ "glXSelectEvent", (GLvoid *) glXSelectEvent },
#endif

#ifdef _GLXAPI_SGI_video_sync
#ifdef GLX_SGI_video_sync
{ "glXGetVideoSyncSGI", (GLvoid *) glXGetVideoSyncSGI },
{ "glXWaitVideoSyncSGI", (GLvoid *) glXWaitVideoSyncSGI },
#endif

#ifdef _GLXAPI_MESA_copy_sub_buffer
#ifdef GLX_MESA_copy_sub_buffer
{ "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA },
#endif

#ifdef _GLXAPI_MESA_release_buffers
#ifdef GLX_MESA_release_buffers
{ "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA },
#endif

#ifdef _GLXAPI_MESA_pixmap_colormap
#ifdef GLX_MESA_pixmap_colormap
{ "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA },
#endif

#ifdef _GLXAPI_MESA_set_3dfx_mode
#ifdef GLX_MESA_set_3dfx_mode
{ "glXSet3DfxModeMESA", (GLvoid *) glXSet3DfxModeMESA },
#endif


+ 13
- 23
src/mesa/drivers/x11/glxapi.h View File

@@ -1,10 +1,10 @@
/* $Id: glxapi.h,v 1.5 2000/04/10 21:13:19 brianp Exp $ */
/* $Id: glxapi.h,v 1.6 2000/06/08 22:50:28 brianp Exp $ */

/*
* Mesa 3-D graphics library
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -29,21 +29,11 @@
#define _glxapi_h_


#define GLX_GLXEXT_LEGACY
#define GL_GLEXT_PROTOTYPES
#include "GL/glx.h"


#define _GLXAPI_VERSION_1_1 1
#define _GLXAPI_VERSION_1_2 1
#define _GLXAPI_VERSION_1_3 1

#define _GLXAPI_EXT_import_context 1
#define _GLXAPI_SGI_video_sync 1
#define _GLXAPI_MESA_copy_sub_buffer 1
#define _GLXAPI_MESA_release_buffers 1
#define _GLXAPI_MESA_pixmap_colormap 1
#define _GLXAPI_MESA_set_3dfx_mode 1


/*
* Almost all the GLX API functions get routed through this dispatch table.
* The exceptions are the glXGetCurrentXXX() functions.
@@ -73,17 +63,17 @@ struct _glxapi_table {
void (*WaitGL)(void);
void (*WaitX)(void);

#ifdef _GLXAPI_VERSION_1_1
#ifdef GLX_VERSION_1_1
const char *(*GetClientString)(Display *dpy, int name);
const char *(*QueryExtensionsString)(Display *dpy, int screen);
const char *(*QueryServerString)(Display *dpy, int screen, int name);
#endif

#ifdef _GLXAPI_VERSION_1_2
#ifdef GLX_VERSION_1_2
/*Display *(*GetCurrentDisplay)(void);*/
#endif

#ifdef _GLXAPI_VERSION_1_3
#ifdef GLX_VERSION_1_3
GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
@@ -103,7 +93,7 @@ struct _glxapi_table {
void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
#endif

#ifdef _GLXAPI_EXT_import_context
#ifdef GLX_EXT_import_context
void (*FreeContextEXT)(Display *dpy, GLXContext context);
GLXContextID (*GetContextIDEXT)(const GLXContext context);
Display *(*GetCurrentDisplayEXT)(void);
@@ -111,7 +101,7 @@ struct _glxapi_table {
int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
#endif

#ifdef _GLXAPI_SGI_video_sync
#ifdef GLX_SGI_video_sync
int (*GetVideoSyncSGI)(unsigned int *count);
int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
#endif
@@ -120,19 +110,19 @@ struct _glxapi_table {
* XXX thesa Mesa-specific functions might not belong here
*/

#ifdef _GLXAPI_MESA_copy_sub_buffer
#ifdef GLX_MESA_copy_sub_buffer
void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
#endif

#ifdef _GLXAPI_MESA_release_buffers
#ifdef GLX_MESA_release_buffers
Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
#endif

#ifdef _GLXAPI_MESA_pixmap_colormap
#ifdef GLX_MESA_pixmap_colormap
GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
#endif

#ifdef _GLXAPI_MESA_set_3dfx_mode
#ifdef GLX_MESA_set_3dfx_mode
GLboolean (*Set3DfxModeMESA)(GLint mode);
#endif


Loading…
Cancel
Save