From b0bb4f6226a18e0a6eb40046c7f7b5a841c75eda Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 May 2001 21:51:02 +0000 Subject: [PATCH] more work on XMesa / libGL integration --- src/mesa/drivers/x11/fakeglx.c | 123 +++++++++------------ src/mesa/drivers/x11/glxapi.c | 196 +++++++++++++-------------------- src/mesa/drivers/x11/glxapi.h | 69 +++++------- 3 files changed, 158 insertions(+), 230 deletions(-) diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 71e52039d38..31aa873aa64 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.51 2001/05/24 20:05:32 brianp Exp $ */ +/* $Id: fakeglx.c,v 1.52 2001/05/25 21:51:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1251,6 +1251,9 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw, MakeCurrent_PrevReadable = 0; MakeCurrent_PrevDrawBuffer = 0; MakeCurrent_PrevReadBuffer = 0; +#ifdef GLX_BUILD_IN_XLIB_MESA + /* XXX bind dummy context with __glXSetCurrentContext(ctx); */ +#endif return True; } else { @@ -1294,7 +1297,8 @@ Fake_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo, Pixmap pixmap ) } -#ifdef GLX_MESA_pixmap_colormap +/*** GLX_MESA_pixmap_colormap ***/ + static GLXPixmap Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap ) @@ -1317,7 +1321,6 @@ Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo, } return b->frontbuffer; } -#endif static void @@ -1406,7 +1409,8 @@ Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable ) -#ifdef GLX_MESA_copy_sub_buffer +/*** GLX_MESA_copy_sub_buffer ***/ + static void Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, int x, int y, int width, int height ) @@ -1419,7 +1423,6 @@ Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, fprintf(stderr, "Mesa Warning: glXCopySubBufferMESA: invalid drawable\n"); } } -#endif @@ -1851,7 +1854,7 @@ Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, -#ifdef GLX_SGI_swap_control +/*** GLX_SGI_swap_control ***/ static int Fake_glXSwapIntervalSGI(int interval) @@ -1860,10 +1863,9 @@ Fake_glXSwapIntervalSGI(int interval) return 0; } -#endif -#ifdef GLX_SGI_video_sync +/*** GLX_SGI_video_sync ***/ static int Fake_glXGetVideoSyncSGI(unsigned int *count) @@ -1881,10 +1883,9 @@ Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) return 0; } -#endif -#ifdef GLX_SGI_make_current_read +/*** GLX_SGI_make_current_read ***/ static Bool Fake_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) @@ -1898,15 +1899,15 @@ Fake_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLX /* not used static GLXDrawable -make_glXGetCurrentReadDrawableSGI(void) +Fake_glXGetCurrentReadDrawableSGI(void) { return 0; } */ -#endif -#if defined(_VL_H) && defined(GLX_SGIX_video_source) +/*** GLX_SGIX_video_source ***/ +#if defined(_VL_H) static GLXVideoSourceSGIX Fake_glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode) @@ -1930,7 +1931,7 @@ Fake_glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src) #endif -#ifdef GLX_EXT_import_context +/*** GLX_EXT_import_context ***/ static void Fake_glXFreeContextEXT(Display *dpy, GLXContext context) @@ -1964,10 +1965,9 @@ Fake_glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute, int return 0; } -#endif -#ifdef GLX_SGIX_fbconfig +/*** GLX_SGIX_fbconfig ***/ static int Fake_glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value) @@ -2025,10 +2025,9 @@ Fake_glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis) return 0; } -#endif -#ifdef GLX_SGIX_pbuffer +/*** GLX_SGIX_pbuffer ***/ static GLXPbufferSGIX Fake_glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list) @@ -2074,10 +2073,9 @@ Fake_glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long * (void) mask; } -#endif -#ifdef GLX_SGI_cushion +/*** GLX_SGI_cushion ***/ static void Fake_glXCushionSGI(Display *dpy, Window win, float cushion) @@ -2087,10 +2085,9 @@ Fake_glXCushionSGI(Display *dpy, Window win, float cushion) (void) cushion; } -#endif -#ifdef GLX_SGIX_video_resize +/*** GLX_SGIX_video_resize ***/ static int Fake_glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window) @@ -2151,11 +2148,11 @@ Fake_glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum syncty return 0; } -#endif -#if defined(_DM_BUFFER_H_) && defined(GLX_SGIX_dmbuffer) +/*** GLX_SGIX_dmbuffer **/ +#if defined(_DM_BUFFER_H_) static Bool Fake_glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer) { @@ -2165,11 +2162,10 @@ Fake_glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *p (void) dmbuffer; return False; } - #endif -#ifdef GLX_SGIX_swap_group +/*** GLX_SGIX_swap_group ***/ static void Fake_glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member) @@ -2179,10 +2175,9 @@ Fake_glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member (void) member; } -#endif -#ifdef GLX_SGIX_swap_barrier +/*** GLX_SGIX_swap_barrier ***/ static void Fake_glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier) @@ -2201,10 +2196,9 @@ Fake_glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max) return False; } -#endif -#ifdef GLX_SUN_get_transparent_index +/*** GLX_SUN_get_transparent_index ***/ static Status Fake_glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent) @@ -2216,10 +2210,10 @@ Fake_glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, lo return 0; } -#endif -#ifdef GLX_MESA_release_buffers +/*** GLX_MESA_release_buffers ***/ + /* * Release the depth, stencil, accum buffers attached to a GLXDrawable * (a window or pixmap) prior to destroying the GLXDrawable. @@ -2234,17 +2228,16 @@ Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ) } return False; } -#endif -#ifdef GLX_MESA_set_3dfx_mode +/*** GLX_MESA_set_3dfx_mode ***/ + static Bool Fake_glXSet3DfxModeMESA( int mode ) { return XMesaSetFXmode( mode ); } -#endif @@ -2283,17 +2276,15 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) glx.WaitGL = Fake_glXWaitGL; glx.WaitX = Fake_glXWaitX; -#ifdef GLX_VERSION_1_1 + /*** GLX_VERSION_1_1 ***/ glx.GetClientString = Fake_glXGetClientString; glx.QueryExtensionsString = Fake_glXQueryExtensionsString; glx.QueryServerString = Fake_glXQueryServerString; -#endif -#ifdef GLX_VERSION_1_2 + /*** GLX_VERSION_1_2 ***/ /*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/ -#endif -#ifdef GLX_VERSION_1_3 + /*** GLX_VERSION_1_3 ***/ glx.ChooseFBConfig = Fake_glXChooseFBConfig; glx.CreateNewContext = Fake_glXCreateNewContext; glx.CreatePbuffer = Fake_glXCreatePbuffer; @@ -2311,96 +2302,82 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) glx.QueryContext = Fake_glXQueryContext; glx.QueryDrawable = Fake_glXQueryDrawable; glx.SelectEvent = Fake_glXSelectEvent; -#endif -#ifdef GLX_SGI_swap_control + /*** GLX_SGI_swap_control ***/ glx.SwapIntervalSGI = Fake_glXSwapIntervalSGI; -#endif -#ifdef GLX_SGI_video_sync + /*** GLX_SGI_video_sync ***/ glx.GetVideoSyncSGI = Fake_glXGetVideoSyncSGI; glx.WaitVideoSyncSGI = Fake_glXWaitVideoSyncSGI; -#endif -#ifdef GLX_SGI_make_current_read + /*** GLX_SGI_make_current_read ***/ glx.MakeCurrentReadSGI = Fake_glXMakeCurrentReadSGI; /*glx.GetCurrentReadDrawableSGI = Fake_glXGetCurrentReadDrawableSGI;*/ -#endif -#if defined(_VL_H) && defined(GLX_SGIX_video_source) +/*** GLX_SGIX_video_source ***/ +#if defined(_VL_H) glx.CreateGLXVideoSourceSGIX = Fake_glXCreateGLXVideoSourceSGIX; glx.DestroyGLXVideoSourceSGIX = Fake_glXDestroyGLXVideoSourceSGIX; #endif -#ifdef GLX_EXT_import_context + /*** GLX_EXT_import_context ***/ glx.FreeContextEXT = Fake_glXFreeContextEXT; glx.GetContextIDEXT = Fake_glXGetContextIDEXT; /*glx.GetCurrentDisplayEXT = Fake_glXGetCurrentDisplayEXT;*/ glx.ImportContextEXT = Fake_glXImportContextEXT; glx.QueryContextInfoEXT = Fake_glXQueryContextInfoEXT; -#endif -#ifdef GLX_SGIX_fbconfig + /*** GLX_SGIX_fbconfig ***/ glx.GetFBConfigAttribSGIX = Fake_glXGetFBConfigAttribSGIX; glx.ChooseFBConfigSGIX = Fake_glXChooseFBConfigSGIX; glx.CreateGLXPixmapWithConfigSGIX = Fake_glXCreateGLXPixmapWithConfigSGIX; glx.CreateContextWithConfigSGIX = Fake_glXCreateContextWithConfigSGIX; glx.GetVisualFromFBConfigSGIX = Fake_glXGetVisualFromFBConfigSGIX; glx.GetFBConfigFromVisualSGIX = Fake_glXGetFBConfigFromVisualSGIX; -#endif -#ifdef GLX_SGIX_pbuffer + /*** GLX_SGIX_pbuffer ***/ glx.CreateGLXPbufferSGIX = Fake_glXCreateGLXPbufferSGIX; glx.DestroyGLXPbufferSGIX = Fake_glXDestroyGLXPbufferSGIX; glx.QueryGLXPbufferSGIX = Fake_glXQueryGLXPbufferSGIX; glx.SelectEventSGIX = Fake_glXSelectEventSGIX; glx.GetSelectedEventSGIX = Fake_glXGetSelectedEventSGIX; -#endif -#ifdef GLX_SGI_cushion + /*** GLX_SGI_cushion ***/ glx.CushionSGI = Fake_glXCushionSGI; -#endif -#ifdef GLX_SGIX_video_resize + /*** GLX_SGIX_video_resize ***/ glx.BindChannelToWindowSGIX = Fake_glXBindChannelToWindowSGIX; glx.ChannelRectSGIX = Fake_glXChannelRectSGIX; glx.QueryChannelRectSGIX = Fake_glXQueryChannelRectSGIX; glx.QueryChannelDeltasSGIX = Fake_glXQueryChannelDeltasSGIX; glx.ChannelRectSyncSGIX = Fake_glXChannelRectSyncSGIX; -#endif -#if defined(_DM_BUFFER_H_) && defined(GLX_SGIX_dmbuffer) + /*** GLX_SGIX_dmbuffer **/ +#if defined(_DM_BUFFER_H_) glx.AssociateDMPbufferSGIX = NULL; #endif -#ifdef GLX_SGIX_swap_group + /*** GLX_SGIX_swap_group ***/ glx.JoinSwapGroupSGIX = Fake_glXJoinSwapGroupSGIX; -#endif -#ifdef GLX_SGIX_swap_barrier + /*** GLX_SGIX_swap_barrier ***/ glx.BindSwapBarrierSGIX = Fake_glXBindSwapBarrierSGIX; glx.QueryMaxSwapBarriersSGIX = Fake_glXQueryMaxSwapBarriersSGIX; -#endif -#ifdef GLX_SUN_get_transparent_index + /*** GLX_SUN_get_transparent_index ***/ glx.GetTransparentIndexSUN = Fake_glXGetTransparentIndexSUN; -#endif -#ifdef GLX_MESA_copy_sub_buffer + /*** GLX_MESA_copy_sub_buffer ***/ glx.CopySubBufferMESA = Fake_glXCopySubBufferMESA; -#endif -#ifdef GLX_MESA_release_buffers + /*** GLX_MESA_release_buffers ***/ glx.ReleaseBuffersMESA = Fake_glXReleaseBuffersMESA; -#endif -#ifdef GLX_MESA_pixmap_colormap + /*** GLX_MESA_pixmap_colormap ***/ glx.CreateGLXPixmapMESA = Fake_glXCreateGLXPixmapMESA; -#endif -#ifdef GLX_MESA_set_3dfx_mode + /*** GLX_MESA_set_3dfx_mode ***/ glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA; -#endif return &glx; } diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 4eb78ea4c25..c274d64b9d7 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -1,4 +1,4 @@ -/* $Id: glxapi.c,v 1.23 2001/05/24 20:05:32 brianp Exp $ */ +/* $Id: glxapi.c,v 1.24 2001/05/25 21:51:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -27,8 +27,7 @@ /* * This is the GLX API dispatcher. Calls to the glX* functions are - * either routed to real (SGI / Utah) GLX encoders or to Mesa's - * pseudo-GLX module. + * either routed to the real GLX encoders or to Mesa's pseudo-GLX functions. */ @@ -41,24 +40,8 @@ #include "glxapi.h" -/* - * XXX - this really shouldn't be here. - * Instead, add -DUSE_MESA_GLX to the compiler flags when needed. - */ -#define USE_MESA_GLX 1 - - -/* Rather than include possibly non-existant headers... */ -#ifdef USE_SGI_GLX -extern struct _glxapi_table *_sgi_GetGLXDispatchTable(void); -#endif -#ifdef USE_UTAH_GLX -extern struct _glxapi_table *_utah_GetGLXDispatchTable(void); -#endif -#ifdef USE_MESA_GLX +extern struct _glxapi_table *_real_GetGLXDispatchTable(void); extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); -#endif - struct display_dispatch { @@ -94,32 +77,33 @@ get_dispatch(Display *dpy) } } - /* A new display, determine if we should use real GLX (SGI / Utah) + /* A new display, determine if we should use real GLX * or Mesa's pseudo-GLX. */ { struct _glxapi_table *t = NULL; -#if defined(USE_SGI_GLX) || defined(USE_UTAH_GLX) - if (!getenv("MESA_FORCE_SOFTX")) { +#ifdef GLX_BUILD_IN_XLIB_MESA + if (!getenv("LIBGL_FORCE_XMESA")) { int ignore; if (XQueryExtension( dpy, "GLX", &ignore, &ignore, &ignore )) { /* the X server has the GLX extension */ -#if defined(USE_SGI_GLX) - t = _sgi_GetGLXDispatchTable(); -#elif defined(USE_UTAH_GLX) - t = _utah_GetGLXDispatchTable(); -#endif + t = _real_GetGLXDispatchTable(); } } #endif -#if defined(USE_MESA_GLX) if (!t) { + /* Fallback to Mesa with Xlib driver */ +#ifdef GLX_BUILD_IN_XLIB_MESA + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, + "libGL: server lacks GLX extension. Using Mesa Xlib renderer."); + } +#endif t = _mesa_GetGLXDispatchTable(); assert(t); /* this has to work */ } -#endif if (t) { struct display_dispatch *d; @@ -171,6 +155,7 @@ static GLXContext CurrentContext = 0; * GLX API entrypoints */ +/*** GLX_VERSION_1_0 ***/ XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *list) { @@ -253,11 +238,16 @@ GLXContext glXGetCurrentContext(void) #endif +#ifdef GLX_BUILD_IN_XLIB_MESA +/* Use real libGL's glXGetCurrentContext() function */ +#else +/* stand-alone Mesa */ GLXDrawable glXGetCurrentDrawable(void) { __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext(); return gc ? gc->currentDrawable : 0; } +#endif Bool glXIsDirect(Display *dpy, GLXContext ctx) @@ -351,7 +341,7 @@ void glXWaitX(void) -#ifdef GLX_VERSION_1_1 +/*** GLX_VERSION_1_1 ***/ const char *glXGetClientString(Display *dpy, int name) { @@ -382,11 +372,10 @@ const char *glXQueryServerString(Display *dpy, int screen, int name) return (t->QueryServerString)(dpy, screen, name); } -#endif - +/*** GLX_VERSION_1_2 ***/ -#ifdef GLX_VERSION_1_2 +#if !defined(GLX_BUILD_IN_XLIB_MESA) Display *glXGetCurrentDisplay(void) { /* Same code as in libGL's glxext.c */ @@ -398,7 +387,7 @@ Display *glXGetCurrentDisplay(void) -#ifdef GLX_VERSION_1_3 +/*** GLX_VERSION_1_3 ***/ GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) { @@ -480,11 +469,15 @@ void glXDestroyWindow(Display *dpy, GLXWindow window) } +#ifdef GLX_BUILD_IN_XLIB_MESA +/* Use the glXGetCurrentReadDrawable() function from libGL */ +#else GLXDrawable glXGetCurrentReadDrawable(void) { __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext(); return gc ? gc->currentReadable : 0; } +#endif int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value) @@ -534,7 +527,7 @@ Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLX if (!t) return False; b = (t->MakeContextCurrent)(dpy, draw, read, ctx); -#ifndef GLX_BUILD_IN_XLIB_MESA +#ifndef GLX_BUILD_IN_XLIB_MESA if (b) { CurrentContext = ctx; } @@ -573,10 +566,9 @@ void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask) (t->SelectEvent)(dpy, drawable, mask); } -#endif /* GLX_VERSION_1_3 */ -#ifdef GLX_SGI_swap_control +/*** GLX_SGI_swap_control ***/ int glXSwapIntervalSGI(int interval) { @@ -588,10 +580,9 @@ int glXSwapIntervalSGI(int interval) return (t->SwapIntervalSGI)(interval); } -#endif -#ifdef GLX_SGI_video_sync +/*** GLX_SGI_video_sync ***/ int glXGetVideoSyncSGI(unsigned int *count) { @@ -613,10 +604,9 @@ int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) return (t->WaitVideoSyncSGI)(divisor, remainder, count); } -#endif -#ifdef GLX_SGI_make_current_read +/*** GLX_SGI_make_current_read ***/ Bool glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) { @@ -627,6 +617,10 @@ Bool glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLX return (t->MakeCurrentReadSGI)(dpy, draw, read, ctx); } +#ifdef GLX_BUILD_IN_XLIB_MESA +/* Use glXGetCurrentReadDrawableSGI() from libGL */ +#else +/* stand-alone Mesa */ GLXDrawable glXGetCurrentReadDrawableSGI(void) { return glXGetCurrentReadDrawable(); @@ -634,7 +628,7 @@ GLXDrawable glXGetCurrentReadDrawableSGI(void) #endif -#if defined(_VL_H) && defined(GLX_SGIX_video_source) +#if defined(_VL_H) GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode) { @@ -657,7 +651,7 @@ void glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src) #endif -#ifdef GLX_EXT_import_context +/*** GLX_EXT_import_context ***/ void glXFreeContextEXT(Display *dpy, GLXContext context) { @@ -701,10 +695,9 @@ int glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int * return (t->QueryContextInfoEXT)(dpy, context, attribute, value); } -#endif -#ifdef GLX_SGIX_fbconfig +/*** GLX_SGIX_fbconfig ***/ int glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value) { @@ -760,10 +753,9 @@ GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis) return (t->GetFBConfigFromVisualSGIX)(dpy, vis); } -#endif -#ifdef GLX_SGIX_pbuffer +/*** GLX_SGIX_pbuffer ***/ GLXPbufferSGIX glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list) { @@ -810,10 +802,9 @@ void glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long * (t->GetSelectedEventSGIX)(dpy, drawable, mask); } -#endif -#ifdef GLX_SGI_cushion +/*** GLX_SGI_cushion ***/ void glXCushionSGI(Display *dpy, Window win, float cushion) { @@ -824,10 +815,9 @@ void glXCushionSGI(Display *dpy, Window win, float cushion) (t->CushionSGI)(dpy, win, cushion); } -#endif -#ifdef GLX_SGIX_video_resize +/*** GLX_SGIX_video_resize ***/ int glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window) { @@ -874,10 +864,9 @@ int glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctyp return (t->ChannelRectSyncSGIX)(dpy, screen, channel, synctype); } -#endif -#if defined(_DM_BUFFER_H_) && defined(GLX_SGIX_dmbuffer) +#if defined(_DM_BUFFER_H_) Bool glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer) { @@ -891,7 +880,7 @@ Bool glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *p #endif -#ifdef GLX_SGIX_swap_group +/*** GLX_SGIX_swap_group ***/ void glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member) { @@ -902,10 +891,8 @@ void glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member (*t->JoinSwapGroupSGIX)(dpy, drawable, member); } -#endif - -#ifdef GLX_SGIX_swap_barrier +/*** GLX_SGIX_swap_barrier ***/ void glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier) { @@ -925,10 +912,9 @@ Bool glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max) return (*t->QueryMaxSwapBarriersSGIX)(dpy, screen, max); } -#endif -#ifdef GLX_SUN_get_transparent_index +/*** GLX_SUN_get_transparent_index ***/ Status glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent) { @@ -939,10 +925,9 @@ Status glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, return (*t->GetTransparentIndexSUN)(dpy, overlay, underlay, pTransparent); } -#endif -#ifdef GLX_MESA_copy_sub_buffer +/*** GLX_MESA_copy_sub_buffer ***/ void glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height) { @@ -953,10 +938,9 @@ void glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int (t->CopySubBufferMESA)(dpy, drawable, x, y, width, height); } -#endif -#ifdef GLX_MESA_release_buffers +/*** GLX_MESA_release_buffers ***/ Bool glXReleaseBuffersMESA(Display *dpy, Window w) { @@ -967,10 +951,9 @@ Bool glXReleaseBuffersMESA(Display *dpy, Window w) return (t->ReleaseBuffersMESA)(dpy, w); } -#endif -#ifdef GLX_MESA_pixmap_colormap +/*** GLX_MESA_pixmap_colormap ***/ GLXPixmap glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap) { @@ -981,10 +964,9 @@ GLXPixmap glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixm return (t->CreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap); } -#endif -#ifdef GLX_MESA_set_3dfx_mode +/*** GLX_MESA_set_3dfx_mode ***/ Bool glXSet3DfxModeMESA(int mode) { @@ -996,7 +978,6 @@ Bool glXSet3DfxModeMESA(int mode) return (t->Set3DfxModeMESA)(mode); } -#endif @@ -1146,78 +1127,65 @@ _glxapi_load_library_table(const char *libName, struct _glxapi_table *t) GET_OPT_FUNCTION(QueryContext, "glXQueryContext"); GET_OPT_FUNCTION(QueryDrawable, "glXQueryDrawable"); GET_OPT_FUNCTION(SelectEvent, "glXSelectEvent"); -#ifdef GLX_SGI_swap_control + /*** GLX_SGI_swap_control ***/ GET_OPT_FUNCTION(SwapIntervalSGI, "glXSwapIntervalSGI"); -#endif -#ifdef GLX_SGI_video_sync + /*** GLX_SGI_video_sync ***/ GET_OPT_FUNCTION(GetVideoSyncSGI, "glXGetVideoSyncSGI"); GET_OPT_FUNCTION(WaitVideoSyncSGI, "glXWaitVideoSyncSGI"); -#endif -#ifdef GLX_SGI_make_current_read + /*** GLX_SGI_make_current_read ***/ GET_OPT_FUNCTION(MakeCurrentReadSGI, "glXMakeCurrentReadSGI"); GET_OPT_FUNCTION(GetCurrentReadDrawableSGI, "glXGetCurrentReadDrawableSGI"); -#endif -#if defined(_VL_H) && defined(GLX_SGIX_video_source) + /*** GLX_SGIX_video_source ***/ +#if defined(_VL_H) GET_OPT_FUNCTION(CreateGLXVideoSourceSGIX, "glXCreateGLXVideoSourceSGIX"); GET_OPT_FUNCTION(DestroyGLXVideoSourceSGIX, "glXDestroyGLXVideoSourceSGIX"); #endif -#ifdef GLX_EXT_import_context + /*** GLX_EXT_import_context ***/ GET_OPT_FUNCTION(FreeContextEXT, "glXFreeContextEXT"); GET_OPT_FUNCTION(GetContextIDEXT, "glXGetContextIDEXT"); GET_OPT_FUNCTION(GetCurrentDisplayEXT, "glXGetCurrentDisplayEXT"); GET_OPT_FUNCTION(ImportContextEXT, "glXImportContextEXT"); GET_OPT_FUNCTION(QueryContextInfoEXT, "glXQueryContextInfoEXT"); -#endif -#ifdef GLX_SGIX_fbconfig + /*** GLX_SGIX_fbconfig ***/ GET_OPT_FUNCTION(GetFBConfigAttribSGIX, "glXGetFBConfigAttribSGIX"); GET_OPT_FUNCTION(ChooseFBConfigSGIX, "glXChooseFBConfigSGIX"); GET_OPT_FUNCTION(CreateGLXPixmapWithConfigSGIX, "glXCreateGLXPixmapWithConfigSGIX"); GET_OPT_FUNCTION(CreateContextWithConfigSGIX, "glXCreateContextWithConfigSGIX"); GET_OPT_FUNCTION(GetVisualFromFBConfigSGIX, "glXGetVisualFromFBConfigSGIX"); GET_OPT_FUNCTION(GetFBConfigFromVisualSGIX, "glXGetFBConfigFromVisualSGIX"); -#endif -#ifdef GLX_SGIX_pbuffer + /*** GLX_SGIX_pbuffer ***/ GET_OPT_FUNCTION(CreateGLXPbufferSGIX, "glXCreateGLXPbufferSGIX"); GET_OPT_FUNCTION(DestroyGLXPbufferSGIX, "glXDestroyGLXPbufferSGIX"); GET_OPT_FUNCTION(QueryGLXPbufferSGIX, "glXQueryGLXPbufferSGIX"); GET_OPT_FUNCTION(SelectEventSGIX, "glXSelectEventSGIX"); GET_OPT_FUNCTION(GetSelectedEventSGIX, "glXGetSelectedEventSGIX"); -#endif -#ifdef GLX_SGI_cushion + /*** GLX_SGI_cushion ***/ GET_OPT_FUNCTION(CushionSGI, "glXCushionSGI"); -#endif -#ifdef GLX_SGIX_video_resize + /*** GLX_SGIX_video_resize ***/ GET_OPT_FUNCTION(BindChannelToWindowSGIX, "glXBindChannelToWindowSGIX"); GET_OPT_FUNCTION(ChannelRectSGIX, "glXChannelRectSGIX"); GET_OPT_FUNCTION(QueryChannelRectSGIX, "glXQueryChannelRectSGIX"); GET_OPT_FUNCTION(QueryChannelDeltasSGIX, "glXQueryChannelDeltasSGIX"); GET_OPT_FUNCTION(ChannelRectSyncSGIX, "glXChannelRectSyncSGIX"); -#endif -#if defined (_DM_BUFFER_H_) && defined(GLX_SGIX_dmbuffer) + /*** GLX_SGIX_dmbuffer ***/ +#if defined (_DM_BUFFER_H_) GET_OPT_FUNCTION(AssociateDMPbufferSGIX, "glXAssociateDMPbufferSGIX"); #endif -#ifdef GLX_SGIX_swap_group + /*** GLX_SGIX_swap_group ***/ GET_OPT_FUNCTION(JoinSwapGroupSGIX, "glXJoinSwapGroupSGIX"); -#endif -#ifdef GLX_SGIX_swap_barrier + /*** GLX_SGIX_swap_barrier ***/ GET_OPT_FUNCTION(BindSwapBarrierSGIX, "glXBindSwapBarrierSGIX"); GET_OPT_FUNCTION(QueryMaxSwapBarriersSGIX, "glXQueryMaxSwapBarriersSGIX"); -#endif -#ifdef GLX_SUN_get_transparent_index + /*** GLX_SUN_get_transparent_index ***/ GET_OPT_FUNCTION(GetTransparentIndexSUN, "glXGetTransparentIndexSUN"); -#endif -#ifdef GLX_MESA_copy_sub_buffer + /*** GLX_MESA_copy_sub_buffer ***/ GET_OPT_FUNCTION(CopySubBufferMESA, "glXCopySubBufferMESA"); -#endif -#ifdef GLX_MESA_release_buffers + /*** GLX_MESA_release_buffers ***/ GET_OPT_FUNCTION(ReleaseBuffersMESA, "glXReleaseBuffersMESA"); -#endif -#ifdef GLX_MESA_pixmap_colormap + /*** GLX_MESA_pixmap_colormap ***/ GET_OPT_FUNCTION(CreateGLXPixmapMESA, "glXCreateGLXPixmapMESA"); -#endif -#ifdef GLX_MESA_set_3dfx_mode + /*** GLX_MESA_set_3dfx_mode ***/ GET_OPT_FUNCTION(Set3DfxModeMESA, "glXSet3DfxModeMESA"); -#endif return GL_TRUE; } @@ -1231,6 +1199,7 @@ struct name_address_pair { }; static struct name_address_pair GLX_functions[] = { + /*** GLX_VERSION_1_0 ***/ { "glXChooseVisual", (GLvoid *) glXChooseVisual }, { "glXCopyContext", (GLvoid *) glXCopyContext }, { "glXCreateContext", (GLvoid *) glXCreateContext }, @@ -1249,17 +1218,15 @@ static struct name_address_pair GLX_functions[] = { { "glXWaitGL", (GLvoid *) glXWaitGL }, { "glXWaitX", (GLvoid *) glXWaitX }, -#ifdef GLX_VERSION_1_1 + /*** GLX_VERSION_1_1 ***/ { "glXGetClientString", (GLvoid *) glXGetClientString }, { "glXQueryExtensionsString", (GLvoid *) glXQueryExtensionsString }, { "glXQueryServerString", (GLvoid *) glXQueryServerString }, -#endif -#ifdef GLX_VERSION_1_2 + /*** GLX_VERSION_1_2 ***/ { "glXGetCurrentDisplay", (GLvoid *) glXGetCurrentDisplay }, -#endif -#ifdef GLX_VERSION_1_3 + /*** GLX_VERSION_1_3 ***/ { "glXChooseFBConfig", (GLvoid *) glXChooseFBConfig }, { "glXCreateNewContext", (GLvoid *) glXCreateNewContext }, { "glXCreatePbuffer", (GLvoid *) glXCreatePbuffer }, @@ -1276,29 +1243,24 @@ static struct name_address_pair GLX_functions[] = { { "glXQueryContext", (GLvoid *) glXQueryContext }, { "glXQueryDrawable", (GLvoid *) glXQueryDrawable }, { "glXSelectEvent", (GLvoid *) glXSelectEvent }, -#endif -#ifdef GLX_SGI_video_sync + /*** GLX_SGI_video_sync ***/ { "glXGetVideoSyncSGI", (GLvoid *) glXGetVideoSyncSGI }, { "glXWaitVideoSyncSGI", (GLvoid *) glXWaitVideoSyncSGI }, -#endif -#ifdef GLX_MESA_copy_sub_buffer + /*** GLX_MESA_copy_sub_buffer ***/ { "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA }, -#endif -#ifdef GLX_MESA_release_buffers + /*** GLX_MESA_release_buffers ***/ { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA }, -#endif -#ifdef GLX_MESA_pixmap_colormap + /*** GLX_MESA_pixmap_colormap ***/ { "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA }, -#endif -#ifdef GLX_MESA_set_3dfx_mode + /*** GLX_MESA_set_3dfx_mode ***/ { "glXSet3DfxModeMESA", (GLvoid *) glXSet3DfxModeMESA }, -#endif + /*** GLX_ARB_get_proc_address ***/ { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB }, { NULL, NULL } /* end of list */ diff --git a/src/mesa/drivers/x11/glxapi.h b/src/mesa/drivers/x11/glxapi.h index ea287473a6b..d9b8fb236bf 100644 --- a/src/mesa/drivers/x11/glxapi.h +++ b/src/mesa/drivers/x11/glxapi.h @@ -1,4 +1,4 @@ -/* $Id: glxapi.h,v 1.9 2001/05/24 19:06:21 brianp Exp $ */ +/* $Id: glxapi.h,v 1.10 2001/05/25 21:51:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -61,7 +61,7 @@ typedef struct __GLXcontextRec { * the DRI. Red Hat, however, has used it for their custom libGL. */ struct _glxapi_table { - /* GLX 1.0 functions */ + /*** GLX_VERSION_1_0 ***/ XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list); void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask); GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct); @@ -80,17 +80,15 @@ struct _glxapi_table { void (*WaitGL)(void); void (*WaitX)(void); -#ifdef GLX_VERSION_1_1 + /*** 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 GLX_VERSION_1_2 + /*** GLX_VERSION_1_2 ***/ /*Display *(*GetCurrentDisplay)(void);*/ -#endif -#ifdef GLX_VERSION_1_3 + /*** 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); @@ -108,96 +106,87 @@ struct _glxapi_table { int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value); void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask); -#endif -#ifdef GLX_SGI_swap_control + /*** GLX_SGI_swap_control ***/ int (*SwapIntervalSGI)(int); -#endif -#ifdef GLX_SGI_video_sync + /*** GLX_SGI_video_sync ***/ int (*GetVideoSyncSGI)(unsigned int *count); int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count); -#endif -#ifdef GLX_SGI_make_current_read + /*** GLX_SGI_make_current_read ***/ Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext); /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/ -#endif -#if defined(_VL_H) && defined(GLX_SGIX_video_source) + /*** GLX_SGIX_video_source (needs video library) ***/ +#if defined(_VL_H_) GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode); void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX); +#else + void *CreateGLXVideoSourceSGIX; + void *DestroyGLXVideoSourceSGIX; #endif -#ifdef GLX_EXT_import_context + /*** GLX_EXT_import_context ***/ void (*FreeContextEXT)(Display *dpy, GLXContext context); GLXContextID (*GetContextIDEXT)(const GLXContext context); /*Display *(*GetCurrentDisplayEXT)(void);*/ GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID); int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value); -#endif -#ifdef GLX_SGIX_fbconfig + /*** GLX_SGIX_fbconfig ***/ int (*GetFBConfigAttribSGIX)(Display *, GLXFBConfigSGIX, int, int *); GLXFBConfigSGIX * (*ChooseFBConfigSGIX)(Display *, int, int *, int *); GLXPixmap (*CreateGLXPixmapWithConfigSGIX)(Display *, GLXFBConfigSGIX, Pixmap); GLXContext (*CreateContextWithConfigSGIX)(Display *, GLXFBConfigSGIX, int, GLXContext, Bool); XVisualInfo * (*GetVisualFromFBConfigSGIX)(Display *, GLXFBConfigSGIX); GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX)(Display *, XVisualInfo *); -#endif -#ifdef GLX_SGIX_pbuffer + /*** GLX_SGIX_pbuffer ***/ GLXPbufferSGIX (*CreateGLXPbufferSGIX)(Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); void (*DestroyGLXPbufferSGIX)(Display *, GLXPbufferSGIX); int (*QueryGLXPbufferSGIX)(Display *, GLXPbufferSGIX, int, unsigned int *); void (*SelectEventSGIX)(Display *, GLXDrawable, unsigned long); void (*GetSelectedEventSGIX)(Display *, GLXDrawable, unsigned long *); -#endif -#ifdef GLX_SGI_cushion + /*** GLX_SGI_cushion ***/ void (*CushionSGI)(Display *, Window, float); -#endif -#ifdef GLX_SGIX_video_resize + /*** GLX_SGIX_video_resize ***/ int (*BindChannelToWindowSGIX)(Display *, int, int, Window); int (*ChannelRectSGIX)(Display *, int, int, int, int, int, int); int (*QueryChannelRectSGIX)(Display *, int, int, int *, int *, int *, int *); int (*QueryChannelDeltasSGIX)(Display *, int, int, int *, int *, int *, int *); int (*ChannelRectSyncSGIX)(Display *, int, int, GLenum); -#endif -#if defined (_DM_BUFFER_H_) && defined(GLX_SGIX_dmbuffer) + /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/ +#if defined (_DM_BUFFER_H_) Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer); +#else + void *AssociciateDMPbufferSGIX; #endif -#ifdef GLX_SGIX_swap_group + /*** GLX_SGIX_swap_group ***/ void (*JoinSwapGroupSGIX)(Display *, GLXDrawable, GLXDrawable); -#endif -#ifdef GLX_SGIX_swap_barrier + /*** GLX_SGIX_swap_barrier ***/ void (*BindSwapBarrierSGIX)(Display *, GLXDrawable, int); Bool (*QueryMaxSwapBarriersSGIX)(Display *, int, int *); -#endif -#ifdef GLX_SUN_get_transparent_index + /*** GLX_SUN_get_transparent_index ***/ Status (*GetTransparentIndexSUN)(Display *, Window, Window, long *); -#endif -#ifdef GLX_MESA_copy_sub_buffer + /*** GLX_MESA_copy_sub_buffer ***/ void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); -#endif -#ifdef GLX_MESA_release_buffers + /*** GLX_MESA_release_buffers ***/ Bool (*ReleaseBuffersMESA)(Display *dpy, Window w); -#endif -#ifdef GLX_MESA_pixmap_colormap + /*** GLX_MESA_pixmap_colormap ***/ GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap); -#endif -#ifdef GLX_MESA_set_3dfx_mode + /*** GLX_MESA_set_3dfx_mode ***/ Bool (*Set3DfxModeMESA)(int mode); -#endif }; -- 2.30.2