X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fx11%2Fglxapi.c;h=2ef675682e4796326b43b83514292e6234ead044;hp=c2ccce6f520801c7f47e33c7d916a03830543e5b;hb=3dd299c3d5b88114894ec30d1fac85fba688201f;hpb=2b66417402bc595be301ab9ed7b9ea2a5f79e180 diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index c2ccce6f520..2ef675682e4 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -17,16 +16,17 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /* - * This is the GLX API dispatcher. Calls to the glX* functions are - * either routed to the real GLX encoders or to Mesa's pseudo-GLX functions. - * See the glxapi.h file for more details. + * This is the GLX API dispatcher. It uses a dispatch table but that's + * not really needed anymore since the table always points to the "fake" + * GLX functions. */ @@ -39,7 +39,6 @@ #include "glxapi.h" -extern struct _glxapi_table *_real_GetGLXDispatchTable(void); extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); @@ -49,6 +48,36 @@ struct display_dispatch { struct display_dispatch *Next; }; + +/** + * When GLX_INDIRECT_RENDERING is defined, some symbols are missing in + * libglapi.a. We need to define them here. + */ +#ifdef GLX_INDIRECT_RENDERING + +#include "glapi/glapitable.h" + +#define KEYWORD1 PUBLIC + +#if defined(USE_MGL_NAMESPACE) +#define NAME(func) mgl##func +#else +#define NAME(func) gl##func +#endif + +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + GET_DISPATCH()->FUNC ARGS + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + return GET_DISPATCH()->FUNC ARGS + +/* skip normal ones */ +#define _GLAPI_SKIP_NORMAL_ENTRY_POINTS +#include "glapi/glapitemp.h" + +#endif /* GLX_INDIRECT_RENDERING */ + + static struct display_dispatch *DispatchList = NULL; @@ -76,15 +105,13 @@ get_dispatch(Display *dpy) } } - /* A new display, determine if we should use real GLX - * or Mesa's pseudo-GLX. - */ + /* Setup the dispatch table */ { struct _glxapi_table *t = _mesa_GetGLXDispatchTable(); if (t) { struct display_dispatch *d; - d = (struct display_dispatch *) malloc(sizeof(struct display_dispatch)); + d = malloc(sizeof(struct display_dispatch)); if (d) { d->Dpy = dpy; d->Table = t; @@ -99,15 +126,11 @@ get_dispatch(Display *dpy) } } - /* If we get here that means we can't use real GLX on this display - * and the Mesa pseudo-GLX software renderer wasn't compiled in. - * Or, we ran out of memory! - */ return NULL; } -/* Don't use the GET_DISPATCH defined in glthread.h */ +/* Don't use the GET_DISPATCH macro */ #undef GET_DISPATCH #define GET_DISPATCH(DPY, TABLE) \ @@ -122,34 +145,6 @@ get_dispatch(Display *dpy) } - - -/** - * GLX API current context. - */ -#if defined(GLX_USE_TLS) -PUBLIC __thread void * CurrentContext - __attribute__((tls_model("initial-exec"))); -#elif defined(THREADS) -static _glthread_TSD ContextTSD; /**< Per-thread context pointer */ -#else -static GLXContext CurrentContext = 0; -#endif - - -static void -SetCurrentContext(GLXContext c) -{ -#if defined(GLX_USE_TLS) - CurrentContext = c; -#elif defined(THREADS) - _glthread_SetTSD(&ContextTSD, c); -#else - CurrentContext = c; -#endif -} - - /* * GLX API entrypoints */ @@ -163,7 +158,7 @@ glXChooseVisual(Display *dpy, int screen, int *list) GET_DISPATCH(dpy, t); if (!t) return NULL; - return (t->ChooseVisual)(dpy, screen, list); + return t->ChooseVisual(dpy, screen, list); } @@ -174,7 +169,7 @@ glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask) GET_DISPATCH(dpy, t); if (!t) return; - (t->CopyContext)(dpy, src, dst, mask); + t->CopyContext(dpy, src, dst, mask); } @@ -185,7 +180,7 @@ glXCreateContext(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateContext)(dpy, visinfo, shareList, direct); + return t->CreateContext(dpy, visinfo, shareList, direct); } @@ -196,7 +191,7 @@ glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateGLXPixmap)(dpy, visinfo, pixmap); + return t->CreateGLXPixmap(dpy, visinfo, pixmap); } @@ -207,9 +202,7 @@ glXDestroyContext(Display *dpy, GLXContext ctx) GET_DISPATCH(dpy, t); if (!t) return; - if (glXGetCurrentContext() == ctx) - SetCurrentContext(NULL); - (t->DestroyContext)(dpy, ctx); + t->DestroyContext(dpy, ctx); } @@ -220,7 +213,7 @@ glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap) GET_DISPATCH(dpy, t); if (!t) return; - (t->DestroyGLXPixmap)(dpy, pixmap); + t->DestroyGLXPixmap(dpy, pixmap); } @@ -231,20 +224,17 @@ glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value) GET_DISPATCH(dpy, t); if (!t) return GLX_NO_EXTENSION; - return (t->GetConfig)(dpy, visinfo, attrib, value); + return t->GetConfig(dpy, visinfo, attrib, value); } +/* declare here to avoid including xmesa.h */ +extern void *XMesaGetCurrentContext(void); + GLXContext PUBLIC glXGetCurrentContext(void) { -#if defined(GLX_USE_TLS) - return CurrentContext; -#elif defined(THREADS) - return (GLXContext) _glthread_GetTSD(&ContextTSD); -#else - return CurrentContext; -#endif + return (GLXContext) XMesaGetCurrentContext(); } @@ -263,7 +253,7 @@ glXIsDirect(Display *dpy, GLXContext ctx) GET_DISPATCH(dpy, t); if (!t) return False; - return (t->IsDirect)(dpy, ctx); + return t->IsDirect(dpy, ctx); } @@ -276,10 +266,7 @@ glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx) if (!t) { return False; } - b = (*t->MakeCurrent)(dpy, drawable, ctx); - if (b) { - SetCurrentContext(ctx); - } + b = t->MakeCurrent(dpy, drawable, ctx); return b; } @@ -291,7 +278,7 @@ glXQueryExtension(Display *dpy, int *errorb, int *event) GET_DISPATCH(dpy, t); if (!t) return False; - return (t->QueryExtension)(dpy, errorb, event); + return t->QueryExtension(dpy, errorb, event); } @@ -302,7 +289,7 @@ glXQueryVersion(Display *dpy, int *maj, int *min) GET_DISPATCH(dpy, t); if (!t) return False; - return (t->QueryVersion)(dpy, maj, min); + return t->QueryVersion(dpy, maj, min); } @@ -313,7 +300,7 @@ glXSwapBuffers(Display *dpy, GLXDrawable drawable) GET_DISPATCH(dpy, t); if (!t) return; - (t->SwapBuffers)(dpy, drawable); + t->SwapBuffers(dpy, drawable); } @@ -325,7 +312,7 @@ glXUseXFont(Font font, int first, int count, int listBase) GET_DISPATCH(dpy, t); if (!t) return; - (t->UseXFont)(font, first, count, listBase); + t->UseXFont(font, first, count, listBase); } @@ -337,7 +324,7 @@ glXWaitGL(void) GET_DISPATCH(dpy, t); if (!t) return; - (t->WaitGL)(); + t->WaitGL(); } @@ -349,7 +336,7 @@ glXWaitX(void) GET_DISPATCH(dpy, t); if (!t) return; - (t->WaitX)(); + t->WaitX(); } @@ -363,7 +350,7 @@ glXGetClientString(Display *dpy, int name) GET_DISPATCH(dpy, t); if (!t) return NULL; - return (t->GetClientString)(dpy, name); + return t->GetClientString(dpy, name); } @@ -374,7 +361,7 @@ glXQueryExtensionsString(Display *dpy, int screen) GET_DISPATCH(dpy, t); if (!t) return NULL; - return (t->QueryExtensionsString)(dpy, screen); + return t->QueryExtensionsString(dpy, screen); } @@ -385,19 +372,19 @@ glXQueryServerString(Display *dpy, int screen, int name) GET_DISPATCH(dpy, t); if (!t) return NULL; - return (t->QueryServerString)(dpy, screen, name); + return t->QueryServerString(dpy, screen, name); } /*** GLX_VERSION_1_2 ***/ +/* declare here to avoid including xmesa.h */ +extern Display *XMesaGetCurrentDisplay(void); + Display PUBLIC * glXGetCurrentDisplay(void) { - /* Same code as in libGL's glxext.c */ - __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext(); - if (NULL == gc) return NULL; - return gc->currentDpy; + return XMesaGetCurrentDisplay(); } @@ -411,7 +398,7 @@ glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->ChooseFBConfig)(dpy, screen, attribList, nitems); + return t->ChooseFBConfig(dpy, screen, attribList, nitems); } @@ -422,7 +409,7 @@ glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateNewContext)(dpy, config, renderType, shareList, direct); + return t->CreateNewContext(dpy, config, renderType, shareList, direct); } @@ -433,7 +420,7 @@ glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreatePbuffer)(dpy, config, attribList); + return t->CreatePbuffer(dpy, config, attribList); } @@ -444,7 +431,7 @@ glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attr GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreatePixmap)(dpy, config, pixmap, attribList); + return t->CreatePixmap(dpy, config, pixmap, attribList); } @@ -455,7 +442,7 @@ glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribL GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateWindow)(dpy, config, win, attribList); + return t->CreateWindow(dpy, config, win, attribList); } @@ -466,7 +453,7 @@ glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf) GET_DISPATCH(dpy, t); if (!t) return; - (t->DestroyPbuffer)(dpy, pbuf); + t->DestroyPbuffer(dpy, pbuf); } @@ -477,7 +464,7 @@ glXDestroyPixmap(Display *dpy, GLXPixmap pixmap) GET_DISPATCH(dpy, t); if (!t) return; - (t->DestroyPixmap)(dpy, pixmap); + t->DestroyPixmap(dpy, pixmap); } @@ -488,7 +475,7 @@ glXDestroyWindow(Display *dpy, GLXWindow window) GET_DISPATCH(dpy, t); if (!t) return; - (t->DestroyWindow)(dpy, window); + t->DestroyWindow(dpy, window); } @@ -507,7 +494,7 @@ glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value GET_DISPATCH(dpy, t); if (!t) return GLX_NO_EXTENSION; - return (t->GetFBConfigAttrib)(dpy, config, attribute, value); + return t->GetFBConfigAttrib(dpy, config, attribute, value); } @@ -518,7 +505,7 @@ glXGetFBConfigs(Display *dpy, int screen, int *nelements) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->GetFBConfigs)(dpy, screen, nelements); + return t->GetFBConfigs(dpy, screen, nelements); } void PUBLIC @@ -528,7 +515,7 @@ glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask) GET_DISPATCH(dpy, t); if (!t) return; - (t->GetSelectedEvent)(dpy, drawable, mask); + t->GetSelectedEvent(dpy, drawable, mask); } @@ -539,7 +526,7 @@ glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config) GET_DISPATCH(dpy, t); if (!t) return NULL; - return (t->GetVisualFromFBConfig)(dpy, config); + return t->GetVisualFromFBConfig(dpy, config); } @@ -551,10 +538,7 @@ glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXConte GET_DISPATCH(dpy, t); if (!t) return False; - b = (t->MakeContextCurrent)(dpy, draw, read, ctx); - if (b) { - SetCurrentContext(ctx); - } + b = t->MakeContextCurrent(dpy, draw, read, ctx); return b; } @@ -567,7 +551,7 @@ glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value) assert(t); if (!t) return 0; /* XXX correct? */ - return (t->QueryContext)(dpy, ctx, attribute, value); + return t->QueryContext(dpy, ctx, attribute, value); } @@ -578,7 +562,7 @@ glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *va GET_DISPATCH(dpy, t); if (!t) return; - (t->QueryDrawable)(dpy, draw, attribute, value); + t->QueryDrawable(dpy, draw, attribute, value); } @@ -589,7 +573,7 @@ glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask) GET_DISPATCH(dpy, t); if (!t) return; - (t->SelectEvent)(dpy, drawable, mask); + t->SelectEvent(dpy, drawable, mask); } @@ -604,7 +588,7 @@ glXSwapIntervalSGI(int interval) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->SwapIntervalSGI)(interval); + return t->SwapIntervalSGI(interval); } @@ -619,7 +603,7 @@ glXGetVideoSyncSGI(unsigned int *count) GET_DISPATCH(dpy, t); if (!t || !glXGetCurrentContext()) return GLX_BAD_CONTEXT; - return (t->GetVideoSyncSGI)(count); + return t->GetVideoSyncSGI(count); } int PUBLIC @@ -630,7 +614,7 @@ glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) GET_DISPATCH(dpy, t); if (!t || !glXGetCurrentContext()) return GLX_BAD_CONTEXT; - return (t->WaitVideoSyncSGI)(divisor, remainder, count); + return t->WaitVideoSyncSGI(divisor, remainder, count); } @@ -644,7 +628,7 @@ glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXConte GET_DISPATCH(dpy, t); if (!t) return False; - return (t->MakeCurrentReadSGI)(dpy, draw, read, ctx); + return t->MakeCurrentReadSGI(dpy, draw, read, ctx); } GLXDrawable PUBLIC @@ -663,7 +647,7 @@ glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath pa GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateGLXVideoSourceSGIX)(dpy, screen, server, path, nodeClass, drainNode); + return t->CreateGLXVideoSourceSGIX(dpy, screen, server, path, nodeClass, drainNode); } void PUBLIC @@ -673,7 +657,7 @@ glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->DestroyGLXVideoSourceSGIX)(dpy, src); + return t->DestroyGLXVideoSourceSGIX(dpy, src); } #endif @@ -688,7 +672,7 @@ glXFreeContextEXT(Display *dpy, GLXContext context) GET_DISPATCH(dpy, t); if (!t) return; - (t->FreeContextEXT)(dpy, context); + t->FreeContextEXT(dpy, context); } GLXContextID PUBLIC @@ -710,7 +694,7 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->ImportContextEXT)(dpy, contextID); + return t->ImportContextEXT(dpy, contextID); } int PUBLIC @@ -720,7 +704,7 @@ glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int *valu GET_DISPATCH(dpy, t); if (!t) return 0; /* XXX ok? */ - return (t->QueryContextInfoEXT)(dpy, context, attribute, value); + return t->QueryContextInfoEXT(dpy, context, attribute, value); } @@ -734,7 +718,7 @@ glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, in GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->GetFBConfigAttribSGIX)(dpy, config, attribute, value); + return t->GetFBConfigAttribSGIX(dpy, config, attribute, value); } GLXFBConfigSGIX PUBLIC * @@ -744,7 +728,7 @@ glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->ChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements); + return t->ChooseFBConfigSGIX(dpy, screen, attrib_list, nelements); } GLXPixmap PUBLIC @@ -754,7 +738,7 @@ glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pi GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap); + return t->CreateGLXPixmapWithConfigSGIX(dpy, config, pixmap); } GLXContext PUBLIC @@ -764,7 +748,7 @@ glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_ GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct); + return t->CreateContextWithConfigSGIX(dpy, config, render_type, share_list, direct); } XVisualInfo PUBLIC * @@ -774,7 +758,7 @@ glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->GetVisualFromFBConfigSGIX)(dpy, config); + return t->GetVisualFromFBConfigSGIX(dpy, config); } GLXFBConfigSGIX PUBLIC @@ -784,7 +768,7 @@ glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->GetFBConfigFromVisualSGIX)(dpy, vis); + return t->GetFBConfigFromVisualSGIX(dpy, vis); } @@ -798,7 +782,7 @@ glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list); + return t->CreateGLXPbufferSGIX(dpy, config, width, height, attrib_list); } void PUBLIC @@ -808,17 +792,17 @@ glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf) GET_DISPATCH(dpy, t); if (!t) return; - (t->DestroyGLXPbufferSGIX)(dpy, pbuf); + t->DestroyGLXPbufferSGIX(dpy, pbuf); } -int PUBLIC +void PUBLIC glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value) { struct _glxapi_table *t; GET_DISPATCH(dpy, t); if (!t) - return 0; - return (t->QueryGLXPbufferSGIX)(dpy, pbuf, attribute, value); + return; + t->QueryGLXPbufferSGIX(dpy, pbuf, attribute, value); } void PUBLIC @@ -828,7 +812,7 @@ glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask) GET_DISPATCH(dpy, t); if (!t) return; - (t->SelectEventSGIX)(dpy, drawable, mask); + t->SelectEventSGIX(dpy, drawable, mask); } void PUBLIC @@ -838,7 +822,7 @@ glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask) GET_DISPATCH(dpy, t); if (!t) return; - (t->GetSelectedEventSGIX)(dpy, drawable, mask); + t->GetSelectedEventSGIX(dpy, drawable, mask); } @@ -852,7 +836,7 @@ glXCushionSGI(Display *dpy, Window win, float cushion) GET_DISPATCH(dpy, t); if (!t) return; - (t->CushionSGI)(dpy, win, cushion); + t->CushionSGI(dpy, win, cushion); } @@ -866,7 +850,7 @@ glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->BindChannelToWindowSGIX)(dpy, screen, channel, window); + return t->BindChannelToWindowSGIX(dpy, screen, channel, window); } int PUBLIC @@ -876,7 +860,7 @@ glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, i GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->ChannelRectSGIX)(dpy, screen, channel, x, y, w, h); + return t->ChannelRectSGIX(dpy, screen, channel, x, y, w, h); } int PUBLIC @@ -886,7 +870,7 @@ glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, i GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->QueryChannelRectSGIX)(dpy, screen, channel, x, y, w, h); + return t->QueryChannelRectSGIX(dpy, screen, channel, x, y, w, h); } int PUBLIC @@ -896,7 +880,7 @@ glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *d GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->QueryChannelDeltasSGIX)(dpy, screen, channel, dx, dy, dw, dh); + return t->QueryChannelDeltasSGIX(dpy, screen, channel, dx, dy, dw, dh); } int PUBLIC @@ -906,7 +890,7 @@ glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype) GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->ChannelRectSyncSGIX)(dpy, screen, channel, synctype); + return t->ChannelRectSyncSGIX(dpy, screen, channel, synctype); } @@ -920,59 +904,22 @@ glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params GET_DISPATCH(dpy, t); if (!t) return False; - return (t->AssociateDMPbufferSGIX)(dpy, pbuffer, params, dmbuffer); + return t->AssociateDMPbufferSGIX(dpy, pbuffer, params, dmbuffer); } #endif -/*** GLX_SGIX_swap_group ***/ - -void PUBLIC -glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member) -{ - struct _glxapi_table *t; - GET_DISPATCH(dpy, t); - if (!t) - return; - (*t->JoinSwapGroupSGIX)(dpy, drawable, member); -} - - -/*** GLX_SGIX_swap_barrier ***/ - -void PUBLIC -glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier) -{ - struct _glxapi_table *t; - GET_DISPATCH(dpy, t); - if (!t) - return; - (*t->BindSwapBarrierSGIX)(dpy, drawable, barrier); -} - -Bool PUBLIC -glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max) -{ - struct _glxapi_table *t; - GET_DISPATCH(dpy, t); - if (!t) - return False; - return (*t->QueryMaxSwapBarriersSGIX)(dpy, screen, max); -} - - - /*** GLX_SUN_get_transparent_index ***/ Status PUBLIC -glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent) +glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, unsigned long *pTransparent) { struct _glxapi_table *t; GET_DISPATCH(dpy, t); if (!t) return False; - return (*t->GetTransparentIndexSUN)(dpy, overlay, underlay, pTransparent); + return t->GetTransparentIndexSUN(dpy, overlay, underlay, pTransparent); } @@ -986,7 +933,7 @@ glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width GET_DISPATCH(dpy, t); if (!t) return; - (t->CopySubBufferMESA)(dpy, drawable, x, y, width, height); + t->CopySubBufferMESA(dpy, drawable, x, y, width, height); } @@ -1000,7 +947,7 @@ glXReleaseBuffersMESA(Display *dpy, Window w) GET_DISPATCH(dpy, t); if (!t) return False; - return (t->ReleaseBuffersMESA)(dpy, w); + return t->ReleaseBuffersMESA(dpy, w); } @@ -1014,99 +961,14 @@ glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colorm GET_DISPATCH(dpy, t); if (!t) return 0; - return (t->CreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap); -} - - - -/*** GLX_MESA_set_3dfx_mode ***/ - -Bool PUBLIC -glXSet3DfxModeMESA(int mode) -{ - struct _glxapi_table *t; - Display *dpy = glXGetCurrentDisplay(); - GET_DISPATCH(dpy, t); - if (!t) - return False; - return (t->Set3DfxModeMESA)(mode); -} - - - -/*** GLX_NV_vertex_array_range ***/ - -void PUBLIC * -glXAllocateMemoryNV( GLsizei size, - GLfloat readFrequency, - GLfloat writeFrequency, - GLfloat priority ) -{ - struct _glxapi_table *t; - Display *dpy = glXGetCurrentDisplay(); - GET_DISPATCH(dpy, t); - if (!t) - return NULL; - return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority); + return t->CreateGLXPixmapMESA(dpy, visinfo, pixmap, cmap); } -void PUBLIC -glXFreeMemoryNV( GLvoid *pointer ) -{ - struct _glxapi_table *t; - Display *dpy = glXGetCurrentDisplay(); - GET_DISPATCH(dpy, t); - if (!t) - return; - (t->FreeMemoryNV)(pointer); -} - - - - -/*** GLX_MESA_agp_offset */ - -GLuint PUBLIC -glXGetAGPOffsetMESA( const GLvoid *pointer ) -{ - struct _glxapi_table *t; - Display *dpy = glXGetCurrentDisplay(); - GET_DISPATCH(dpy, t); - if (!t) - return ~0; - return (t->GetAGPOffsetMESA)(pointer); -} - - -/*** GLX_MESA_allocate_memory */ - -void * -glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, - float readfreq, float writefreq, float priority) -{ - /* dummy */ - return NULL; -} - -void -glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) -{ - /* dummy */ -} - - -GLuint -glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer) -{ - /* dummy */ - return 0; -} - /*** GLX_EXT_texture_from_pixmap */ -void +void PUBLIC glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list) { @@ -1116,7 +978,7 @@ glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, t->BindTexImageEXT(dpy, drawable, buffer, attrib_list); } -void +void PUBLIC glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer) { struct _glxapi_table *t; @@ -1145,33 +1007,15 @@ const char ** _glxapi_get_extensions(void) { static const char *extensions[] = { -#ifdef GLX_EXT_import_context "GLX_EXT_import_context", -#endif -#ifdef GLX_SGI_video_sync "GLX_SGI_video_sync", -#endif -#ifdef GLX_MESA_copy_sub_buffer "GLX_MESA_copy_sub_buffer", -#endif -#ifdef GLX_MESA_release_buffers "GLX_MESA_release_buffers", -#endif -#ifdef GLX_MESA_pixmap_colormap "GLX_MESA_pixmap_colormap", -#endif -#ifdef GLX_MESA_set_3dfx_mode - "GLX_MESA_set_3dfx_mode", -#endif -#ifdef GLX_SGIX_fbconfig "GLX_SGIX_fbconfig", -#endif -#ifdef GLX_SGIX_pbuffer "GLX_SGIX_pbuffer", -#endif -#ifdef GLX_EXT_texture_from_pixmap "GLX_EXT_texture_from_pixmap", -#endif + "GLX_INTEL_swap_event", NULL }; return extensions; @@ -1320,13 +1164,6 @@ static struct name_address_pair GLX_functions[] = { { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr) glXAssociateDMPbufferSGIX }, #endif - /*** GLX_SGIX_swap_group ***/ - { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr) glXJoinSwapGroupSGIX }, - - /*** GLX_SGIX_swap_barrier ***/ - { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr) glXBindSwapBarrierSGIX }, - { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr) glXQueryMaxSwapBarriersSGIX }, - /*** GLX_SUN_get_transparent_index ***/ { "glXGetTransparentIndexSUN", (__GLXextFuncPtr) glXGetTransparentIndexSUN }, @@ -1339,28 +1176,16 @@ static struct name_address_pair GLX_functions[] = { /*** GLX_MESA_release_buffers ***/ { "glXReleaseBuffersMESA", (__GLXextFuncPtr) glXReleaseBuffersMESA }, - /*** GLX_MESA_set_3dfx_mode ***/ - { "glXSet3DfxModeMESA", (__GLXextFuncPtr) glXSet3DfxModeMESA }, - /*** GLX_ARB_get_proc_address ***/ { "glXGetProcAddressARB", (__GLXextFuncPtr) glXGetProcAddressARB }, - /*** GLX_NV_vertex_array_range ***/ - { "glXAllocateMemoryNV", (__GLXextFuncPtr) glXAllocateMemoryNV }, - { "glXFreeMemoryNV", (__GLXextFuncPtr) glXFreeMemoryNV }, - - /*** GLX_MESA_agp_offset ***/ - { "glXGetAGPOffsetMESA", (__GLXextFuncPtr) glXGetAGPOffsetMESA }, - - /*** GLX_MESA_allocate_memory ***/ - { "glXAllocateMemoryMESA", (__GLXextFuncPtr) glXAllocateMemoryMESA }, - { "glXFreeMemoryMESA", (__GLXextFuncPtr) glXFreeMemoryMESA }, - { "glXGetMemoryOffsetMESA", (__GLXextFuncPtr) glXGetMemoryOffsetMESA }, - /*** GLX_EXT_texture_from_pixmap ***/ { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT }, { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT }, + /*** GLX_ARB_create_context ***/ + { "glXCreateContextAttribsARB", (__GLXextFuncPtr) glXCreateContextAttribsARB }, + { NULL, NULL } /* end of list */ }; @@ -1374,7 +1199,12 @@ _glxapi_get_proc_address(const char *funcName) { GLuint i; for (i = 0; GLX_functions[i].Name; i++) { +#ifdef MANGLE + /* skip the "m" prefix on the name */ + if (strcmp(GLX_functions[i].Name, funcName+1) == 0) +#else if (strcmp(GLX_functions[i].Name, funcName) == 0) +#endif return GLX_functions[i].Address; } return NULL; @@ -1386,7 +1216,7 @@ _glxapi_get_proc_address(const char *funcName) * This function does not get dispatched through the dispatch table * since it's really a "meta" function. */ -__GLXextFuncPtr +__GLXextFuncPtr PUBLIC glXGetProcAddressARB(const GLubyte *procName) { __GLXextFuncPtr f; @@ -1402,7 +1232,25 @@ glXGetProcAddressARB(const GLubyte *procName) /* GLX 1.4 */ -void (*glXGetProcAddress(const GLubyte *procName))() +void PUBLIC +(*glXGetProcAddress(const GLubyte *procName))() { return glXGetProcAddressARB(procName); } + + +/** + * Added in GLX_ARB_create_context. + */ +GLXContext PUBLIC +glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, + GLXContext share_context, Bool direct, + const int *attrib_list) +{ + struct _glxapi_table *t; + GET_DISPATCH(dpy, t); + if (!t) + return 0; + return t->CreateContextAttribs(dpy, config, share_context, direct, + attrib_list); +}