Removed all RCS / CVS tags (Id, Header, Date, etc.) from everything.
[mesa.git] / src / mesa / drivers / x11 / glxapi.c
index 93e5808ddbcdaada34c7faa8c0d9b1065c8d633a..4680994310ef2d97b6719b86e5569b80d8f6de39 100644 (file)
@@ -1,10 +1,9 @@
-/* $Id: glxapi.c,v 1.16 2000/04/10 21:13:19 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.3
+ * Version:  5.1
  * 
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2002  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"),
 
 /*
  * 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.
+ * See the glxapi.h file for more details.
  */
 
 
 #include <assert.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include "glapi.h"
 #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 {
@@ -67,20 +52,17 @@ struct display_dispatch {
 static struct display_dispatch *DispatchList = NULL;
 
 
+/* Display -> Dispatch caching */
+static Display *prevDisplay = NULL;
+static struct _glxapi_table *prevTable = NULL;
+
+
 static struct _glxapi_table *
 get_dispatch(Display *dpy)
 {
-   static Display *prevDisplay = NULL;
-   static struct _glxapi_table *prevTable = NULL;
-
    if (!dpy)
       return NULL;
 
-   /* try cached display */
-   if (dpy == prevDisplay) {
-      return prevTable;
-   }
-
    /* search list of display/dispatch pairs for this display */
    {
       const struct display_dispatch *d = DispatchList;
@@ -94,32 +76,35 @@ 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_BUILT_IN_XMESA
+      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_BUILT_IN_XMESA
+         if (getenv("LIBGL_DEBUG")) {
+            fprintf(stderr,
+                    "libGL: server %s lacks the GLX extension.",
+                    dpy->display_name);
+            fprintf(stderr, " Using Mesa Xlib renderer.\n");
+         }
+#endif
          t = _mesa_GetGLXDispatchTable();
          assert(t);  /* this has to work */
       }
-#endif
 
       if (t) {
          struct display_dispatch *d;
@@ -146,23 +131,37 @@ get_dispatch(Display *dpy)
 }
 
 
+#define GET_DISPATCH(DPY, TABLE)       \
+   if (DPY == prevDisplay) {           \
+      TABLE = prevTable;               \
+   }                                   \
+   else if (!DPY) {                    \
+      TABLE = NULL;                    \
+   }                                   \
+   else {                              \
+      TABLE = get_dispatch(DPY);       \
+   }
+
+   
+
 
 /* Set by glXMakeCurrent() and glXMakeContextCurrent() only */
-static Display *CurrentDisplay = NULL;
+#ifndef GLX_BUILT_IN_XMESA
 static GLXContext CurrentContext = 0;
-static GLXDrawable CurrentDrawable = 0;
-static GLXDrawable CurrentReadDrawable = 0;
-
+#define __glXGetCurrentContext() CurrentContext;
+#endif
 
 
 /*
  * GLX API entrypoints
  */
 
+/*** GLX_VERSION_1_0 ***/
 
 XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *list)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return NULL;
    return (t->ChooseVisual)(dpy, screen, list);
@@ -171,7 +170,8 @@ XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *list)
 
 void glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->CopyContext)(dpy, src, dst, mask);
@@ -180,7 +180,8 @@ void glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long
 
 GLXContext glXCreateContext(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->CreateContext)(dpy, visinfo, shareList, direct);
@@ -189,7 +190,8 @@ GLXContext glXCreateContext(Display *dpy, XVisualInfo *visinfo, GLXContext share
 
 GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->CreateGLXPixmap)(dpy, visinfo, pixmap);
@@ -198,7 +200,8 @@ GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap)
 
 void glXDestroyContext(Display *dpy, GLXContext ctx)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->DestroyContext)(dpy, ctx);
@@ -207,7 +210,8 @@ void glXDestroyContext(Display *dpy, GLXContext ctx)
 
 void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->DestroyGLXPixmap)(dpy, pixmap);
@@ -216,28 +220,41 @@ void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap)
 
 int glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return GLX_NO_EXTENSION;
    return (t->GetConfig)(dpy, visinfo, attrib, value);
 }
 
 
+#ifdef GLX_BUILT_IN_XMESA
+/* Use real libGL's glXGetCurrentContext() function */
+#else
+/* stand-alone Mesa */
 GLXContext glXGetCurrentContext(void)
 {
    return CurrentContext;
 }
+#endif
 
 
+#ifdef GLX_BUILT_IN_XMESA
+/* Use real libGL's glXGetCurrentContext() function */
+#else
+/* stand-alone Mesa */
 GLXDrawable glXGetCurrentDrawable(void)
 {
-   return CurrentDrawable;
+   __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
+   return gc ? gc->currentDrawable : 0;
 }
+#endif
 
 
 Bool glXIsDirect(Display *dpy, GLXContext ctx)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return False;
    return (t->IsDirect)(dpy, ctx);
@@ -247,23 +264,25 @@ Bool glXIsDirect(Display *dpy, GLXContext ctx)
 Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
 {
    Bool b;
-   struct _glxapi_table *t = get_dispatch(dpy);
-   if (!t)
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t) {
       return False;
+   }
    b = (*t->MakeCurrent)(dpy, drawable, ctx);
+#ifndef  GLX_BUILT_IN_XMESA
    if (b) {
-      CurrentDisplay = dpy;
       CurrentContext = ctx;
-      CurrentDrawable = drawable;
-      CurrentReadDrawable = drawable;
    }
+#endif
    return b;
 }
 
 
 Bool glXQueryExtension(Display *dpy, int *errorb, int *event)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return False;
    return (t->QueryExtension)(dpy, errorb, event);
@@ -272,7 +291,8 @@ Bool glXQueryExtension(Display *dpy, int *errorb, int *event)
 
 Bool glXQueryVersion(Display *dpy, int *maj, int *min)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return False;
    return (t->QueryVersion)(dpy, maj, min);
@@ -281,7 +301,8 @@ Bool glXQueryVersion(Display *dpy, int *maj, int *min)
 
 void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->SwapBuffers)(dpy, drawable);
@@ -290,7 +311,9 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
 
 void glXUseXFont(Font font, int first, int count, int listBase)
 {
-   struct _glxapi_table *t = get_dispatch(CurrentDisplay);
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->UseXFont)(font, first, count, listBase);
@@ -299,7 +322,9 @@ void glXUseXFont(Font font, int first, int count, int listBase)
 
 void glXWaitGL(void)
 {
-   struct _glxapi_table *t = get_dispatch(CurrentDisplay);
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->WaitGL)();
@@ -308,7 +333,9 @@ void glXWaitGL(void)
 
 void glXWaitX(void)
 {
-   struct _glxapi_table *t = get_dispatch(CurrentDisplay);
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->WaitX)();
@@ -316,11 +343,12 @@ void glXWaitX(void)
 
 
 
-#ifdef _GLXAPI_VERSION_1_1
+/*** GLX_VERSION_1_1 ***/
 
 const char *glXGetClientString(Display *dpy, int name)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return NULL;
    return (t->GetClientString)(dpy, name);
@@ -329,7 +357,8 @@ const char *glXGetClientString(Display *dpy, int name)
 
 const char *glXQueryExtensionsString(Display *dpy, int screen)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return NULL;
    return (t->QueryExtensionsString)(dpy, screen);
@@ -338,30 +367,34 @@ const char *glXQueryExtensionsString(Display *dpy, int screen)
 
 const char *glXQueryServerString(Display *dpy, int screen, int name)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return NULL;
    return (t->QueryServerString)(dpy, screen, name);
 }
 
-#endif
-
 
+/*** GLX_VERSION_1_2 ***/
 
-#ifdef _GLXAPI_VERSION_1_2
+#if !defined(GLX_BUILT_IN_XMESA)
 Display *glXGetCurrentDisplay(void)
 {
-   return CurrentDisplay;
+   /* Same code as in libGL's glxext.c */
+   __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
+   if (NULL == gc) return NULL;
+   return gc->currentDpy;
 }
 #endif
 
 
 
-#ifdef _GLXAPI_VERSION_1_3
+/*** GLX_VERSION_1_3 ***/
 
 GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->ChooseFBConfig)(dpy, screen, attribList, nitems);
@@ -370,7 +403,8 @@ GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList,
 
 GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->CreateNewContext)(dpy, config, renderType, shareList, direct);
@@ -379,7 +413,8 @@ GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType,
 
 GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->CreatePbuffer)(dpy, config, attribList);
@@ -388,7 +423,8 @@ GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribL
 
 GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->CreatePixmap)(dpy, config, pixmap, attribList);
@@ -397,7 +433,8 @@ GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const
 
 GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->CreateWindow)(dpy, config, win, attribList);
@@ -406,7 +443,8 @@ GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const in
 
 void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->DestroyPbuffer)(dpy, pbuf);
@@ -415,7 +453,8 @@ void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
 
 void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->DestroyPixmap)(dpy, pixmap);
@@ -424,22 +463,29 @@ void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
 
 void glXDestroyWindow(Display *dpy, GLXWindow window)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->DestroyWindow)(dpy, window);
 }
 
 
+#ifdef GLX_BUILT_IN_XMESA
+/* Use the glXGetCurrentReadDrawable() function from libGL */
+#else
 GLXDrawable glXGetCurrentReadDrawable(void)
 {
-   return CurrentReadDrawable;
+   __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
+   return gc ? gc->currentReadable : 0;
 }
+#endif
 
 
 int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return GLX_NO_EXTENSION;
    return (t->GetFBConfigAttrib)(dpy, config, attribute, value);
@@ -448,7 +494,8 @@ int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *v
 
 GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->GetFBConfigs)(dpy, screen, nelements);
@@ -456,7 +503,8 @@ GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements)
 
 void glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->GetSelectedEvent)(dpy, drawable, mask);
@@ -465,7 +513,8 @@ void glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask
 
 XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return NULL;
    return (t->GetVisualFromFBConfig)(dpy, config);
@@ -474,24 +523,25 @@ XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
 
 Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
    Bool b;
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return False;
    b = (t->MakeContextCurrent)(dpy, draw, read, ctx);
+#ifndef GLX_BUILT_IN_XMESA
    if (b) {
-      CurrentDisplay = dpy;
       CurrentContext = ctx;
-      CurrentDrawable = draw;
-      CurrentReadDrawable = read;
    }
+#endif
    return b;
 }
 
 
 int glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    assert(t);
    if (!t)
       return 0; /* XXX correct? */
@@ -501,7 +551,8 @@ int glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
 
 void glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->QueryDrawable)(dpy, draw, attribute, value);
@@ -510,45 +561,133 @@ void glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned in
 
 void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->SelectEvent)(dpy, drawable, mask);
 }
 
-#endif /* _GLXAPI_VERSION_1_3 */
 
 
-#ifdef _GLXAPI_EXT_import_context
+/*** GLX_SGI_swap_control ***/
 
-void glXFreeContextEXT(Display *dpy, GLXContext context)
+int glXSwapIntervalSGI(int interval)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
    if (!t)
-      return;
-   (t->FreeContextEXT)(dpy, context);
+      return 0;
+   return (t->SwapIntervalSGI)(interval);
 }
 
 
-GLXContextID glXGetContextIDEXT(const GLXContext context)
+
+/*** GLX_SGI_video_sync ***/
+
+int glXGetVideoSyncSGI(unsigned int *count)
+{
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->GetVideoSyncSGI)(count);
+}
+
+int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
 {
-   /* XXX is this function right? */
-   struct _glxapi_table *t = get_dispatch(CurrentDisplay);
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
-   return (t->GetContextIDEXT)(context);
+   return (t->WaitVideoSyncSGI)(divisor, remainder, count);
 }
 
 
-Display *glXGetCurrentDisplayEXT(void)
+
+/*** GLX_SGI_make_current_read ***/
+
+Bool glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->MakeCurrentReadSGI)(dpy, draw, read, ctx);
+}
+
+#ifdef GLX_BUILT_IN_XMESA
+/* Use glXGetCurrentReadDrawableSGI() from libGL */
+#else
+/* stand-alone Mesa */
+GLXDrawable glXGetCurrentReadDrawableSGI(void)
+{
+   return glXGetCurrentReadDrawable();
+}
+#endif
+
+
+#if defined(_VL_H)
+
+GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->CreateGLXVideoSourceSGIX)(dpy, screen, server, path, nodeClass, drainNode);
+}
+
+void glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->DestroyGLXVideoSourceSGIX)(dpy, src);
+}
+
+#endif
+
+
+/*** GLX_EXT_import_context ***/
+
+void glXFreeContextEXT(Display *dpy, GLXContext context)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return;
+   (t->FreeContextEXT)(dpy, context);
+}
+
+#ifdef GLX_BUILT_IN_XMESA
+/* Use real libGL's glXGetContextIDEXT() function */
+#else
+/* stand-alone Mesa */
+GLXContextID glXGetContextIDEXT(const GLXContext context)
 {
-   return CurrentDisplay;
+   return ((__GLXcontext *) context)->xid;
 }
+#endif
 
+#ifdef GLX_BUILT_IN_XMESA
+/* Use real libGL's glXGetCurrentDisplayEXT() function */
+#else
+/* stand-alone Mesa */
+Display *glXGetCurrentDisplayEXT(void)
+{
+   return glXGetCurrentDisplay();
+}
+#endif
 
 GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->ImportContextEXT)(dpy, contextID);
@@ -556,87 +695,374 @@ GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID)
 
 int glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int *value)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;  /* XXX ok? */
    return (t->QueryContextInfoEXT)(dpy, context, attribute, value);
 }
 
-#endif
 
 
-#ifdef _GLXAPI_SGI_video_sync
+/*** GLX_SGIX_fbconfig ***/
 
-int glXGetVideoSyncSGI(unsigned int *count)
+int glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value)
 {
-   struct _glxapi_table *t = get_dispatch(CurrentDisplay);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
-   return (t->GetVideoSyncSGI)(count);
+   return (t->GetFBConfigAttribSGIX)(dpy, config, attribute, value);
 }
 
+GLXFBConfigSGIX *glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->ChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
+}
 
-int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
+GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
 {
-   struct _glxapi_table *t = get_dispatch(CurrentDisplay);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
-   return (t->WaitVideoSyncSGI)(divisor, remainder, count);
+   return (t->CreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap);
+}
+
+GLXContext glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->CreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct);
+}
+
+XVisualInfo * glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->GetVisualFromFBConfigSGIX)(dpy, config);
+}
+
+GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->GetFBConfigFromVisualSGIX)(dpy, vis);
+}
+
+
+
+/*** GLX_SGIX_pbuffer ***/
+
+GLXPbufferSGIX glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->CreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
+}
+
+void glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return;
+   (t->DestroyGLXPbufferSGIX)(dpy, pbuf);
+}
+
+int 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);
+}
+
+void glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return;
+   (t->SelectEventSGIX)(dpy, drawable, mask);
+}
+
+void glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return;
+   (t->GetSelectedEventSGIX)(dpy, drawable, mask);
+}
+
+
+
+/*** GLX_SGI_cushion ***/
+
+void glXCushionSGI(Display *dpy, Window win, float cushion)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return;
+   (t->CushionSGI)(dpy, win, cushion);
+}
+
+
+
+/*** GLX_SGIX_video_resize ***/
+
+int glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->BindChannelToWindowSGIX)(dpy, screen, channel, window);
+}
+
+int glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->ChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
+}
+
+int glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->QueryChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
+}
+
+int glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->QueryChannelDeltasSGIX)(dpy, screen, channel, dx, dy, dw, dh);
+}
+
+int glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return 0;
+   return (t->ChannelRectSyncSGIX)(dpy, screen, channel, synctype);
+}
+
+
+
+#if defined(_DM_BUFFER_H_)
+
+Bool glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return False;
+   return (t->AssociateDMPbufferSGIX)(dpy, pbuffer, params, dmbuffer);
 }
 
 #endif
 
 
-#ifdef _GLXAPI_MESA_copy_sub_buffer
+/*** GLX_SGIX_swap_group ***/
+
+void 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 glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return;
+   (*t->BindSwapBarrierSGIX)(dpy, drawable, barrier);
+}
+
+Bool 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 glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent)
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return False;
+   return (*t->GetTransparentIndexSUN)(dpy, overlay, underlay, pTransparent);
+}
+
+
+
+/*** GLX_MESA_copy_sub_buffer ***/
 
 void glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return;
    (t->CopySubBufferMESA)(dpy, drawable, x, y, width, height);
 }
 
-#endif
 
 
-#ifdef _GLXAPI_MESA_release_buffers
+/*** GLX_MESA_release_buffers ***/
 
 Bool glXReleaseBuffersMESA(Display *dpy, Window w)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return False;
    return (t->ReleaseBuffersMESA)(dpy, w);
 }
 
-#endif
 
 
-#ifdef _GLXAPI_MESA_pixmap_colormap
+/*** GLX_MESA_pixmap_colormap ***/
 
 GLXPixmap glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap)
 {
-   struct _glxapi_table *t = get_dispatch(dpy);
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
    if (!t)
       return 0;
    return (t->CreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap);
 }
 
-#endif
 
 
-#ifdef _GLXAPI_MESA_set_3dfx_mode
+/*** GLX_MESA_set_3dfx_mode ***/
 
-GLboolean glXSet3DfxModeMESA(GLint mode)
+Bool glXSet3DfxModeMESA(int mode)
 {
-   struct _glxapi_table *t = get_dispatch(CurrentDisplay);
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
    if (!t)
       return False;
    return (t->Set3DfxModeMESA)(mode);
 }
 
-#endif
+
+
+/*** GLX_NV_vertex_array_range ***/
+
+void *
+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);
+}
+
+
+void 
+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
+glXGetAGPOffsetMESA( const GLvoid *pointer )
+{
+   struct _glxapi_table *t;
+   Display *dpy = glXGetCurrentDisplay();
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return ~0;
+   return (t->GetAGPOffsetMESA)(pointer);
+}
+
+
+/*** GLX_ARB_render_Texture ***/
+
+Bool
+glXBindTexImageARB( Display *dpy, GLXPbuffer pbuffer, int buffer )
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return False;
+   return (t->BindTexImageARB)(dpy, pbuffer, buffer);
+}
+
+
+Bool
+glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer )
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return False;
+   return (t->ReleaseTexImageARB)(dpy, pbuffer, buffer);
+}
+
+
+Bool
+glXDrawableAttribARB( Display *dpy, GLXDrawable draw, const int *attribList )
+{
+   struct _glxapi_table *t;
+   GET_DISPATCH(dpy, t);
+   if (!t)
+      return False;
+   return (t->DrawableAttribARB)(dpy, draw, attribList);
+}
 
 
 
@@ -659,23 +1085,32 @@ 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
+#ifdef GLX_SGIX_fbconfig
+      "GLX_SGIX_fbconfig",
+#endif
+#ifdef GLX_SGIX_pbuffer
+      "GLX_SGIX_pbuffer",
+#endif
+#ifdef GLX_ARB_render_texture
+      "GLX_ARB_render_texture",
 #endif
       NULL
    };
@@ -715,13 +1150,13 @@ _glxapi_set_no_op_table(struct _glxapi_table *t)
 }
 
 
-
 struct name_address_pair {
    const char *Name;
    GLvoid *Address;
 };
 
 static struct name_address_pair GLX_functions[] = {
+   /*** GLX_VERSION_1_0 ***/
    { "glXChooseVisual", (GLvoid *) glXChooseVisual },
    { "glXCopyContext", (GLvoid *) glXCopyContext },
    { "glXCreateContext", (GLvoid *) glXCreateContext },
@@ -740,17 +1175,15 @@ static struct name_address_pair GLX_functions[] = {
    { "glXWaitGL", (GLvoid *) glXWaitGL },
    { "glXWaitX", (GLvoid *) glXWaitX },
 
-#ifdef _GLXAPI_VERSION_1_1
+   /*** GLX_VERSION_1_1 ***/
    { "glXGetClientString", (GLvoid *) glXGetClientString },
    { "glXQueryExtensionsString", (GLvoid *) glXQueryExtensionsString },
    { "glXQueryServerString", (GLvoid *) glXQueryServerString },
-#endif
 
-#ifdef _GLXAPI_VERSION_1_2
+   /*** GLX_VERSION_1_2 ***/
    { "glXGetCurrentDisplay", (GLvoid *) glXGetCurrentDisplay },
-#endif
 
-#ifdef _GLXAPI_VERSION_1_3
+   /*** GLX_VERSION_1_3 ***/
    { "glXChooseFBConfig", (GLvoid *) glXChooseFBConfig },
    { "glXCreateNewContext", (GLvoid *) glXCreateNewContext },
    { "glXCreatePbuffer", (GLvoid *) glXCreatePbuffer },
@@ -761,37 +1194,108 @@ static struct name_address_pair GLX_functions[] = {
    { "glXDestroyWindow", (GLvoid *) glXDestroyWindow },
    { "glXGetCurrentReadDrawable", (GLvoid *) glXGetCurrentReadDrawable },
    { "glXGetFBConfigAttrib", (GLvoid *) glXGetFBConfigAttrib },
+   { "glXGetFBConfigs", (GLvoid *) glXGetFBConfigs },
    { "glXGetSelectedEvent", (GLvoid *) glXGetSelectedEvent },
    { "glXGetVisualFromFBConfig", (GLvoid *) glXGetVisualFromFBConfig },
    { "glXMakeContextCurrent", (GLvoid *) glXMakeContextCurrent },
    { "glXQueryContext", (GLvoid *) glXQueryContext },
    { "glXQueryDrawable", (GLvoid *) glXQueryDrawable },
    { "glXSelectEvent", (GLvoid *) glXSelectEvent },
-#endif
 
-#ifdef _GLXAPI_SGI_video_sync
+   /*** GLX_VERSION_1_4 ***/
+   { "glXGetProcAddress", (GLvoid *) glXGetProcAddress },
+
+   /*** GLX_SGI_swap_control ***/
+   { "glXSwapIntervalSGI", (GLvoid *) glXSwapIntervalSGI },
+
+   /*** GLX_SGI_video_sync ***/
    { "glXGetVideoSyncSGI", (GLvoid *) glXGetVideoSyncSGI },
    { "glXWaitVideoSyncSGI", (GLvoid *) glXWaitVideoSyncSGI },
-#endif
 
-#ifdef _GLXAPI_MESA_copy_sub_buffer
-   { "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA },
+   /*** GLX_SGI_make_current_read ***/
+   { "glXMakeCurrentReadSGI", (GLvoid *) glXMakeCurrentReadSGI },
+   { "glXGetCurrentReadDrawableSGI", (GLvoid *) glXGetCurrentReadDrawableSGI },
+
+   /*** GLX_SGIX_video_source ***/
+#if defined(_VL_H)
+   { "glXCreateGLXVideoSourceSGIX", (GLvoid *) glXCreateGLXVideoSourceSGIX },
+   { "glXDestroyGLXVideoSourceSGIX", (GLvoid *) glXDestroyGLXVideoSourceSGIX },
 #endif
 
-#ifdef _GLXAPI_MESA_release_buffers
-   { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA },
+   /*** GLX_EXT_import_context ***/
+   { "glXFreeContextEXT", (GLvoid *) glXFreeContextEXT },
+   { "glXGetContextIDEXT", (GLvoid *) glXGetContextIDEXT },
+   { "glXGetCurrentDisplayEXT", (GLvoid *) glXGetCurrentDisplayEXT },
+   { "glXImportContextEXT", (GLvoid *) glXImportContextEXT },
+   { "glXQueryContextInfoEXT", (GLvoid *) glXQueryContextInfoEXT },
+
+   /*** GLX_SGIX_fbconfig ***/
+   { "glXGetFBConfigAttribSGIX", (GLvoid *) glXGetFBConfigAttribSGIX },
+   { "glXChooseFBConfigSGIX", (GLvoid *) glXChooseFBConfigSGIX },
+   { "glXCreateGLXPixmapWithConfigSGIX", (GLvoid *) glXCreateGLXPixmapWithConfigSGIX },
+   { "glXCreateContextWithConfigSGIX", (GLvoid *) glXCreateContextWithConfigSGIX },
+   { "glXGetVisualFromFBConfigSGIX", (GLvoid *) glXGetVisualFromFBConfigSGIX },
+   { "glXGetFBConfigFromVisualSGIX", (GLvoid *) glXGetFBConfigFromVisualSGIX },
+
+   /*** GLX_SGIX_pbuffer ***/
+   { "glXCreateGLXPbufferSGIX", (GLvoid *) glXCreateGLXPbufferSGIX },
+   { "glXDestroyGLXPbufferSGIX", (GLvoid *) glXDestroyGLXPbufferSGIX },
+   { "glXQueryGLXPbufferSGIX", (GLvoid *) glXQueryGLXPbufferSGIX },
+   { "glXSelectEventSGIX", (GLvoid *) glXSelectEventSGIX },
+   { "glXGetSelectedEventSGIX", (GLvoid *) glXGetSelectedEventSGIX },
+
+   /*** GLX_SGI_cushion ***/
+   { "glXCushionSGI", (GLvoid *) glXCushionSGI },
+
+   /*** GLX_SGIX_video_resize ***/
+   { "glXBindChannelToWindowSGIX", (GLvoid *) glXBindChannelToWindowSGIX },
+   { "glXChannelRectSGIX", (GLvoid *) glXChannelRectSGIX },
+   { "glXQueryChannelRectSGIX", (GLvoid *) glXQueryChannelRectSGIX },
+   { "glXQueryChannelDeltasSGIX", (GLvoid *) glXQueryChannelDeltasSGIX },
+   { "glXChannelRectSyncSGIX", (GLvoid *) glXChannelRectSyncSGIX },
+
+   /*** GLX_SGIX_dmbuffer **/
+#if defined(_DM_BUFFER_H_)
+   { "glXAssociateDMPbufferSGIX", (GLvoid *) glXAssociateDMPbufferSGIX },
 #endif
 
-#ifdef _GLXAPI_MESA_pixmap_colormap
+   /*** GLX_SGIX_swap_group ***/
+   { "glXJoinSwapGroupSGIX", (GLvoid *) glXJoinSwapGroupSGIX },
+
+   /*** GLX_SGIX_swap_barrier ***/
+   { "glXBindSwapBarrierSGIX", (GLvoid *) glXBindSwapBarrierSGIX },
+   { "glXQueryMaxSwapBarriersSGIX", (GLvoid *) glXQueryMaxSwapBarriersSGIX },
+
+   /*** GLX_SUN_get_transparent_index ***/
+   { "glXGetTransparentIndexSUN", (GLvoid *) glXGetTransparentIndexSUN },
+
+   /*** GLX_MESA_copy_sub_buffer ***/
+   { "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA },
+
+   /*** GLX_MESA_pixmap_colormap ***/
    { "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA },
-#endif
 
-#ifdef _GLXAPI_MESA_set_3dfx_mode
+   /*** GLX_MESA_release_buffers ***/
+   { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA },
+
+   /*** GLX_MESA_set_3dfx_mode ***/
    { "glXSet3DfxModeMESA", (GLvoid *) glXSet3DfxModeMESA },
-#endif
 
+   /*** GLX_ARB_get_proc_address ***/
    { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB },
 
+   /*** GLX_NV_vertex_array_range ***/
+   { "glXAllocateMemoryNV", (GLvoid *) glXAllocateMemoryNV },
+   { "glXFreeMemoryNV", (GLvoid *) glXFreeMemoryNV },
+
+   /*** GLX_MESA_agp_offset ***/
+   { "glXGetAGPOffsetMESA", (GLvoid *) glXGetAGPOffsetMESA },
+
+   /*** GLX_ARB_render_texture ***/
+   { "glXBindTexImageARB", (GLvoid *) glXBindTexImageARB },
+   { "glXReleaseTexImageARB", (GLvoid *) glXReleaseTexImageARB },
+   { "glXDrawableAttribARB", (GLvoid *) glXDrawableAttribARB },
+
    { NULL, NULL }   /* end of list */
 };
 
@@ -830,3 +1334,10 @@ void (*glXGetProcAddressARB(const GLubyte *procName))()
    f = (gl_function) _glapi_get_proc_address((const char *) procName);
    return f;
 }
+
+
+/* GLX 1.4 */
+void (*glXGetProcAddress(const GLubyte *procName))()
+{
+   return glXGetProcAddressARB(procName);
+}