[Xquartz-changes] xserver: Branch 'server-1.11-apple' - 23 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Jun 3 08:59:12 PDT 2011


Rebased ref, commits from common ancestor:
commit d81f24172f9ac904e22624330975e9dc79f6980d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 12 19:48:52 2010 -0800

    fb: Revert fb changes that broke XQuartz
    
    http://bugs.freedesktop.org/show_bug.cgi?id=26124
    
    Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
    Revert "fb: Adjust transform or composite coordinates for pixman operations"
    
    http://bugs.freedesktop.org/26124
    
    This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
    This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/fb/fb.h b/fb/fb.h
index eaa21ad..e65a1c0 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2049,11 +2049,8 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
 		   FbBits	xor);
 
 extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr	pict,
-		 Bool		has_clip,
-		 int		*xoff,
-		 int		*yoff);
-
+image_from_pict (PicturePtr pict,
+		 Bool       has_clip);
 extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
 
 #endif /* _FB_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index d1fd0cb..d2986c8 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -50,24 +50,19 @@ fbComposite (CARD8      op,
 	     CARD16     height)
 {
     pixman_image_t *src, *mask, *dest;
-    int src_xoff, src_yoff;
-    int msk_xoff, msk_yoff;
-    int dst_xoff, dst_yoff;
     
     miCompositeSourceValidate (pSrc);
     if (pMask)
 	miCompositeSourceValidate (pMask);
     
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
-    dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, TRUE);
+    mask = image_from_pict (pMask, TRUE);
+    dest = image_from_pict (pDst, TRUE);
 
     if (src && dest && !(pMask && !mask))
     {
 	pixman_image_composite (op, src, mask, dest,
-				xSrc + src_xoff, ySrc + src_yoff,
-				xMask + msk_xoff, yMask + msk_yoff,
-				xDst + dst_xoff, yDst + dst_yoff,
+				xSrc, ySrc, xMask, yMask, xDst, yDst,
 				width, height);
     }
 
@@ -146,22 +141,22 @@ create_conical_gradient_image (PictGradient *gradient)
 
 static pixman_image_t *
 create_bits_picture (PicturePtr pict,
-		     Bool       has_clip,
-		     int	*xoff,
-		     int	*yoff)
+		     Bool       has_clip)
 {
-    PixmapPtr pixmap;
     FbBits *bits;
     FbStride stride;
-    int bpp;
+    int bpp, xoff, yoff;
     pixman_image_t *image;
     
-    fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
-    fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+    bits = (FbBits*)((CARD8*)bits +
+		     (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+		     (pict->pDrawable->x + xoff) * (bpp / 8));
 
     image = pixman_image_create_bits (
 	(pixman_format_code_t)pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
     
     
@@ -187,55 +182,33 @@ create_bits_picture (PicturePtr pict,
 	if (pict->clientClipType != CT_NONE)
 	    pixman_image_set_has_client_clip (image, TRUE);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+	pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
 
 	pixman_image_set_clip_region (image, pict->pCompositeClip);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+	pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
     }
     
     /* Indexed table */
     if (pict->pFormat->index.devPrivate)
 	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
 
-    /* Add in drawable origin to position within the image */
-    *xoff += pict->pDrawable->x;
-    *yoff += pict->pDrawable->y;
-
     return image;
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+image_from_pict_internal (PicturePtr pict, Bool has_clip, Bool is_alpha_map);
 
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool is_alpha_map)
 {
     pixman_repeat_t repeat;
     pixman_filter_t filter;
     
     if (pict->transform)
     {
-	/* For source images, adjust the transform to account
-	 * for the drawable offset within the pixman image,
-	 * then set the offset to 0 as it will be used
-	 * to compute positions within the transformed image.
-	 */
-	if (!has_clip) {
-	    struct pixman_transform	adjusted;
-
-	    adjusted = *pict->transform;
-	    pixman_transform_translate(&adjusted,
-				       NULL,
-				       pixman_int_to_fixed(*xoff),
-				       pixman_int_to_fixed(*yoff));
-	    pixman_image_set_transform (image, &adjusted);
-	    *xoff = 0;
-	    *yoff = 0;
-	} else
-	    pixman_image_set_transform (image, pict->transform);
+	pixman_image_set_transform (
+	    image, (pixman_transform_t *)pict->transform);
     }
     
     switch (pict->repeatType)
@@ -265,8 +238,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
      */
     if (pict->alphaMap && !is_alpha_map)
     {
-	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
+	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, TRUE, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -299,7 +271,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal (PicturePtr pict,
+		 Bool has_clip, Bool is_alpha_map)
 {
     pixman_image_t *image = NULL;
 
@@ -308,7 +281,7 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 
     if (pict->pDrawable)
     {
-	image = create_bits_picture (pict, has_clip, xoff, yoff);
+	image = create_bits_picture (pict, has_clip);
     }
     else if (pict->pSourcePict)
     {
@@ -329,19 +302,18 @@ image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 	    else if (sp->type == SourcePictTypeConical)
 		image = create_conical_gradient_image (gradient);
 	}
-	*xoff = *yoff = 0;
     }
     
     if (image)
-	set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
+	set_image_properties (image, pict, is_alpha_map);
     
     return image;
 }
 
 pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
 {
-    return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+    return image_from_pict_internal (pict, has_clip, FALSE);
 }
 
 void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 0b5a638..fbe2647 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -39,12 +39,11 @@ fbAddTraps (PicturePtr	pPicture,
 	    xTrap	*traps)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
-    pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
+    pixman_add_traps (image, x_off, y_off,
 		      ntrap, (pixman_trap_t *)traps);
 
     free_pixman_pict (pPicture, image);
@@ -57,14 +56,13 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    y_off)
 {
     pixman_image_t *image;
-    int	dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
 
     pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
-				x_off + dst_xoff,
-				y_off + dst_yoff);
+				x_off,
+				y_off);
 
     free_pixman_pict (pPicture, image);
 }
@@ -77,13 +75,12 @@ fbAddTriangles (PicturePtr  pPicture,
 		xTriangle *tris)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
     pixman_add_triangles (image,
-			  dst_xoff + x_off, dst_yoff + y_off,
+			  x_off, y_off,
 			  ntri, (pixman_triangle_t *)tris);
 
     free_pixman_pict (pPicture, image);
@@ -110,13 +107,11 @@ fbShapes (CompositeShapesFunc	composite,
 	  const uint8_t *	shapes)
 {
     pixman_image_t *src, *dst;
-    int src_xoff, src_yoff;
-    int dst_xoff, dst_yoff;
 
     miCompositeSourceValidate (pSrc);
 
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, FALSE);
+    dst = image_from_pict (pDst, TRUE);
 
     if (src && dst)
     {
@@ -136,10 +131,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    for (i = 0; i < nshapes; ++i)
 	    {
 		composite (op, src, dst, format,
-			   xSrc + src_xoff,
-			   ySrc + src_yoff,
-			   dst_xoff,
-			   dst_yoff,
+			   xSrc,
+			   ySrc,
+			   0,
+			   0,
 			   1, shapes + i * shape_size);
 	    }
 	}
@@ -162,10 +157,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    }
 	    
 	    composite (op, src, dst, format,
-		       xSrc + src_xoff,
-		       ySrc + src_yoff,
-		       dst_xoff,
-		       dst_yoff,
+		       xSrc,
+		       ySrc,
+		       0,
+		       0,
 		       nshapes, shapes);
 	}
 
commit c807c85982dbf32e137918cc470e782a22d32492
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 30 13:08:25 2010 -0700

    Workaround the GC clipping problem in miPaintWindow and add some debugging output.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 94258b8..4f25c23 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
 void RootlessStartDrawing(WindowPtr pWin);
 void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
 Bool IsFramedWindow(WindowPtr pWin);
+#include "../fb/fb.h"
 #endif 
 
 void
@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     Bool	solid = TRUE;
     DrawablePtr	drawable = &pWin->drawable;
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+    ErrorF("      Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+	                               prgn->extents.x2 - prgn->extents.x1,
+	                               prgn->extents.y2 - prgn->extents.y1);
+    ErrorF("      Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+	                                       pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+	                                       pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+					       pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+    ErrorF("     Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+				       pWin->drawable.width, pWin->drawable.height);
+#endif
+
 #ifdef ROOTLESS
     if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
 	return;
-
-    if(IsFramedWindow(pWin)) {
-        RootlessStartDrawing(pWin);
-        RootlessDamageRegion(pWin, prgn);
-    
-        if(pWin->backgroundState == ParentRelative) {
-            if((what == PW_BACKGROUND) || 
-               (what == PW_BORDER && !pWin->borderIsPixel))
-                RootlessSetPixmapOfAncestors(pWin);
-        }
-    }
 #endif
     
     if (what == PW_BACKGROUND)
     {
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+
+	    if(pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	while (pWin->backgroundState == ParentRelative)
 	    pWin = pWin->parent;
 
@@ -587,6 +601,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     {
 	PixmapPtr   pixmap;
 
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+	    
+	    if(!pWin->borderIsPixel &&
+		pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	tile_x_off = drawable->x;
 	tile_y_off = drawable->y;
 	
@@ -595,6 +621,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	    return;
 	pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
 	drawable = &pixmap->drawable;
+
+#ifdef XQUARTZ_CLIP_DEBUG
+	ErrorF("     Draw: %d %d %d %d\n",
+	       drawable->x, drawable->y, drawable->width, drawable->height);    
+#endif
+	
 #ifdef COMPOSITE
 	draw_x_off = pixmap->screen_x;
 	draw_y_off = pixmap->screen_y;
@@ -657,6 +689,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     ChangeGC (NullClient, pGC, gcmask, gcval);
     ValidateGC (drawable, pGC);
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+    
+#ifdef XQUARTZ
+    /* Looks like our clipping isn't set right for some reason:
+     * http://xquartz.macosforge.org/trac/ticket/290
+     */
+    if(what == PW_BORDER) {
+
+#if 0
+	if(solid) {
+#if 1
+	    fbFillRegionSolid(&pWin->drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       pWin->drawable.bitsPerPixel));
+#else
+	    fbFillRegionSolid(drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       drawable->bitsPerPixel));
+#endif
+	    return;
+	}
+#endif
+    
+	pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+	pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+	
+	if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+	    pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+	if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+	    pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+    }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);    
+#endif
+
     numRects = RegionNumRects(prgn);
     pbox = RegionRects(prgn);
     for (i= numRects; --i >= 0; pbox++, prect++)
commit e5ce09b4dfc81c4780c4ca828026182ba9b0eb77
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Oct 30 14:55:06 2010 -0700

    configure.ac: Add -fno-strict-aliasing to CFLAGS
    
    This should address https://bugs.freedesktop.org/show_bug.cgi?id=31238
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 22566c9..f3f298e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,12 @@ XORG_PROG_RAWCPP
 # easier overrides at build time.
 XSERVER_CFLAGS='$(CWARNFLAGS)'
 
+dnl Explicitly add -fno-strict-aliasing since this option should disappear
+dnl from util-macros CWARNFLAGS
+if  test "x$GCC" = xyes ; then
+    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
+fi
+
 dnl Check for dtrace program (needed to build Xserver dtrace probes)
 dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
 dnl ISDN trace program named dtrace
commit 262573d91f0e96dda222d21b74edf3cbf7c32dbb
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Jun 3 02:50:40 2011 -0400

    XQuartz: AIGLX: Remove unnecessary includes in indirect.c
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 40f1e93..ca25e73 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -35,48 +35,34 @@
 #include <dix-config.h>
 #endif
 
-#include "dri.h"
-
 #include <AvailabilityMacros.h>
 
 #include <dlfcn.h>
 
-#define GL_GLEXT_WUNDEF_SUPPORT
-
 #include <OpenGL/OpenGL.h>
-#include <OpenGL/CGLContext.h>
+#include <OpenGL/gl.h>     /* Just to prevent glxserver.h from loading mesa's and colliding with OpenGL.h */
 
+#include <X11/Xproto.h>
 #include <GL/glxproto.h>
-#include <windowstr.h>
-#include <resource.h>
-#include <GL/glxint.h>
-#include <GL/glxtokens.h>
-#include <scrnintstr.h>
+
 #include <glxserver.h>
-#include <glxscreens.h>
-#include <glxdrawable.h>
-#include <glxcontext.h>
-#include <glxext.h>
 #include <glxutil.h>
-#include <GL/internal/glcore.h>
-#include "x-hash.h"
-#include "x-list.h"
-
-//#include "capabilities.h"
-#include "visualConfigs.h"
 
 typedef unsigned long long GLuint64EXT;
 typedef long long GLint64EXT;
 #include <dispatch.h>
-#include <Xplugin.h>
 #include <glapi.h>
-#include <glapitable.h>
 
-__GLXprovider * GlxGetDRISWrastProvider (void);
+#include "x-hash.h"
+
+#include "visualConfigs.h"
+#include "dri.h"
 
 #include "darwin.h"
 #define GLAQUA_DEBUG_MSG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "GLXAqua", msg, ##args)
 
+__GLXprovider * GlxGetDRISWrastProvider (void);
+
 static void setup_dispatch_table(void);
 GLuint __glFloorLog2(GLuint val);
 void warn_func(void * p1, char *format, ...);
commit d73c1286f9e6153f50e339bdb2e6a6493e05871e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Jun 2 20:04:04 2011 -0700

    XQuartz: AIGLX: Setup dispatch table based on runtime capabilities rather than buildtime
    
    This will allow XQuartz built on older systems to pickup capabilities on
    newer systems and prevent runtime failures when building on newer systems and
    running on older ones.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index c41840b..40f1e93 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -2,7 +2,7 @@
  * GLX implementation that uses Apple's OpenGL.framework
  * (Indirect rendering path -- it's also used for some direct mode code too)
  *
- * Copyright (c) 2007, 2008, 2009 Apple Inc.
+ * Copyright (c) 2007-2011 Apple Inc.
  * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved.
  * Copyright (c) 2002 Greg Parker. All Rights Reserved.
  *
@@ -39,94 +39,13 @@
 
 #include <AvailabilityMacros.h>
 
+#include <dlfcn.h>
+
 #define GL_GLEXT_WUNDEF_SUPPORT
 
 #include <OpenGL/OpenGL.h>
-#include <OpenGL/gl.h>
-#include <OpenGL/glext.h>
 #include <OpenGL/CGLContext.h>
 
-/* These next few GL_EXT pre-processing blocks are to explicitly define 
- * these symbols to 0 if they are not set by OpenGL.framework.  This
- * prevents the X11 glext.h from setting them to 1.
- */
-
-#ifndef GL_EXT_fragment_shader
-#define GL_EXT_fragment_shader 0
-#endif
-
-#ifndef GL_EXT_blend_equation_separate
-#define GL_EXT_blend_equation_separate 0
-#endif
-
-#ifndef GL_EXT_blend_func_separate
-#define GL_EXT_blend_func_separate 0
-#endif
-
-#ifndef GL_EXT_depth_bounds_test
-#define GL_EXT_depth_bounds_test 0
-#endif
-
-#ifndef GL_EXT_compiled_vertex_array
-#define GL_EXT_compiled_vertex_array 0
-#endif
-
-#ifndef GL_EXT_cull_vertex
-#define GL_EXT_cull_vertex 0
-#endif
-
-#ifndef GL_EXT_fog_coord
-#define GL_EXT_fog_coord 0
-#endif
-
-#ifndef GL_EXT_framebuffer_blit
-#define GL_EXT_framebuffer_blit 0
-#endif
-
-#ifndef GL_EXT_framebuffer_object
-#define GL_EXT_framebuffer_object 0
-#endif
-
-#ifndef GL_EXT_gpu_program_parameters
-#define GL_EXT_gpu_program_parameters 0
-#endif
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 0
-#endif
-
-#ifndef GL_EXT_point_parameters
-#define GL_EXT_point_parameters 0
-#endif
-
-#ifndef GL_EXT_polygon_offset
-#define GL_EXT_polygon_offset 0
-#endif
-
-#ifndef GL_EXT_secondary_color
-#define GL_EXT_secondary_color 0
-#endif
-
-#ifndef GL_EXT_stencil_two_side
-#define GL_EXT_stencil_two_side 0
-#endif
-
-#ifndef GL_EXT_timer_query
-#define GL_EXT_timer_query 0
-#endif
-
-#ifndef GL_EXT_vertex_array
-#define GL_EXT_vertex_array 0
-#endif
-
-/* Tiger PPC doesn't have the associated symbols, but glext.h says it does.  Liars!
- * http://trac.macports.org/ticket/20638
- */
-#if defined(__ppc__) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050
-#undef GL_EXT_gpu_program_parameters
-#define GL_EXT_gpu_program_parameters 0
-#endif
-
 #include <GL/glxproto.h>
 #include <windowstr.h>
 #include <resource.h>
@@ -673,345 +592,345 @@ static void setup_dispatch_table(void) {
     assert(disp);
 
     /* to update:
-     * for f in $(grep 'define SET_' ../../../glx/dispatch.h  | cut -f2 -d' ' | cut -f1 -d\( | sort -u); do grep -q $f indirect.c || echo $f ; done | grep -v by_offset | sed 's:SET_\(.*\)$:SET_\1(disp, gl\1)\;:' | pbcopy
+     * for f in $(grep 'define SET_' ../../../glx/dispatch.h  | cut -f2 -d' ' | cut -f1 -d\( | sort -u); do grep -q $f indirect.c && echo $f ; done | grep -v by_offset | sed 's:SET_\(.*\)$:SET_\1(disp, dlsym(RTLD_DEFAULT, "gl\1"))\;:'
      */
 
-    SET_Accum(disp, glAccum);
-    SET_AlphaFunc(disp, glAlphaFunc);
-    SET_AreTexturesResident(disp, glAreTexturesResident);
-    SET_ArrayElement(disp, glArrayElement);
-    SET_Begin(disp, glBegin);
-    SET_BindTexture(disp, glBindTexture);
-    SET_Bitmap(disp, glBitmap);
-    SET_BlendColor(disp, glBlendColor);
-    SET_BlendEquation(disp, glBlendEquation);
-    SET_BlendFunc(disp, glBlendFunc);
-    SET_CallList(disp, glCallList);
-    SET_CallLists(disp, glCallLists);
-    SET_Clear(disp, glClear);
-    SET_ClearAccum(disp, glClearAccum);
-    SET_ClearColor(disp, glClearColor);
-    SET_ClearDepth(disp, glClearDepth);
-    SET_ClearIndex(disp, glClearIndex);
-    SET_ClearStencil(disp, glClearStencil);
-    SET_ClipPlane(disp, glClipPlane);
-    SET_Color3b(disp, glColor3b);
-    SET_Color3bv(disp, glColor3bv);
-    SET_Color3d(disp, glColor3d);
-    SET_Color3dv(disp, glColor3dv);
-    SET_Color3f(disp, glColor3f);
-    SET_Color3fv(disp, glColor3fv);
-    SET_Color3i(disp, glColor3i);
-    SET_Color3iv(disp, glColor3iv);
-    SET_Color3s(disp, glColor3s);
-    SET_Color3sv(disp, glColor3sv);
-    SET_Color3ub(disp, glColor3ub);
-    SET_Color3ubv(disp, glColor3ubv);
-    SET_Color3ui(disp, glColor3ui);
-    SET_Color3uiv(disp, glColor3uiv);
-    SET_Color3us(disp, glColor3us);
-    SET_Color3usv(disp, glColor3usv);
-    SET_Color4b(disp, glColor4b);
-    SET_Color4bv(disp, glColor4bv);
-    SET_Color4d(disp, glColor4d);
-    SET_Color4dv(disp, glColor4dv);
-    SET_Color4f(disp, glColor4f);
-    SET_Color4fv(disp, glColor4fv);
-    SET_Color4i(disp, glColor4i);
-    SET_Color4iv(disp, glColor4iv);
-    SET_Color4s(disp, glColor4s);
-    SET_Color4sv(disp, glColor4sv);
-    SET_Color4ub(disp, glColor4ub);
-    SET_Color4ubv(disp, glColor4ubv);
-    SET_Color4ui(disp, glColor4ui);
-    SET_Color4uiv(disp, glColor4uiv);
-    SET_Color4us(disp, glColor4us);
-    SET_Color4usv(disp, glColor4usv);
-    SET_ColorMask(disp, glColorMask);
-    SET_ColorMaterial(disp, glColorMaterial);
-    SET_ColorPointer(disp, glColorPointer);
-    SET_ColorSubTable(disp, glColorSubTable);
-    SET_ColorTable(disp, glColorTable);
-    SET_ColorTableParameterfv(disp, glColorTableParameterfv);
-    SET_ColorTableParameteriv(disp, glColorTableParameteriv);
-    SET_ConvolutionFilter1D(disp, glConvolutionFilter1D);
-    SET_ConvolutionFilter2D(disp, glConvolutionFilter2D);
-    SET_ConvolutionParameterf(disp, glConvolutionParameterf);
-    SET_ConvolutionParameterfv(disp, glConvolutionParameterfv);
-    SET_ConvolutionParameteri(disp, glConvolutionParameteri);
-    SET_ConvolutionParameteriv(disp, glConvolutionParameteriv);
-    SET_CopyColorSubTable(disp, glCopyColorSubTable);
-    SET_CopyColorTable(disp, glCopyColorTable);
-    SET_CopyConvolutionFilter1D(disp, glCopyConvolutionFilter1D);
-    SET_CopyConvolutionFilter2D(disp, glCopyConvolutionFilter2D);
-    SET_CopyPixels(disp, glCopyPixels);
-    SET_CopyTexImage1D(disp, glCopyTexImage1D);
-    SET_CopyTexImage2D(disp, glCopyTexImage2D);
-    SET_CopyTexSubImage1D(disp, glCopyTexSubImage1D);
-    SET_CopyTexSubImage2D(disp, glCopyTexSubImage2D);
-    SET_CopyTexSubImage3D(disp, glCopyTexSubImage3D);
-    SET_CullFace(disp, glCullFace);
-    SET_DeleteLists(disp, glDeleteLists);
-    SET_DeleteTextures(disp, glDeleteTextures);
-    SET_DepthFunc(disp, glDepthFunc);
-    SET_DepthMask(disp, glDepthMask);
-    SET_DepthRange(disp, glDepthRange);
-    SET_Disable(disp, glDisable);
-    SET_DisableClientState(disp, glDisableClientState);
-    SET_DrawArrays(disp, glDrawArrays);
-    SET_DrawBuffer(disp, glDrawBuffer);
-    SET_DrawElements(disp, glDrawElements);
-    SET_DrawPixels(disp, glDrawPixels);
-    SET_DrawRangeElements(disp, glDrawRangeElements);
-    SET_EdgeFlag(disp, glEdgeFlag);
-    SET_EdgeFlagPointer(disp, glEdgeFlagPointer);
-    SET_EdgeFlagv(disp, glEdgeFlagv);
-    SET_Enable(disp, glEnable);
-    SET_EnableClientState(disp, glEnableClientState);
-    SET_End(disp, glEnd);
-    SET_EndList(disp, glEndList);
-    SET_EvalCoord1d(disp, glEvalCoord1d);
-    SET_EvalCoord1dv(disp, glEvalCoord1dv);
-    SET_EvalCoord1f(disp, glEvalCoord1f);
-    SET_EvalCoord1fv(disp, glEvalCoord1fv);
-    SET_EvalCoord2d(disp, glEvalCoord2d);
-    SET_EvalCoord2dv(disp, glEvalCoord2dv);
-    SET_EvalCoord2f(disp, glEvalCoord2f);
-    SET_EvalCoord2fv(disp, glEvalCoord2fv);
-    SET_EvalMesh1(disp, glEvalMesh1);
-    SET_EvalMesh2(disp, glEvalMesh2);
-    SET_EvalPoint1(disp, glEvalPoint1);
-    SET_EvalPoint2(disp, glEvalPoint2);
-    SET_FeedbackBuffer(disp, glFeedbackBuffer);
-    SET_Finish(disp, glFinish);
-    SET_Flush(disp, glFlush);
-    SET_Fogf(disp, glFogf);
-    SET_Fogfv(disp, glFogfv);
-    SET_Fogi(disp, glFogi);
-    SET_Fogiv(disp, glFogiv);
-    SET_FrontFace(disp, glFrontFace);
-    SET_Frustum(disp, glFrustum);
-    SET_GenLists(disp, glGenLists);
-    SET_GenTextures(disp, glGenTextures);
-    SET_GetBooleanv(disp, glGetBooleanv);
-    SET_GetClipPlane(disp, glGetClipPlane);
-    SET_GetColorTable(disp, glGetColorTable);
-    SET_GetColorTableParameterfv(disp, glGetColorTableParameterfv);
-    SET_GetColorTableParameteriv(disp, glGetColorTableParameteriv);
-    SET_GetConvolutionFilter(disp, glGetConvolutionFilter);
-    SET_GetConvolutionParameterfv(disp, glGetConvolutionParameterfv);
-    SET_GetConvolutionParameteriv(disp, glGetConvolutionParameteriv);
-    SET_GetDoublev(disp, glGetDoublev);
-    SET_GetError(disp, glGetError);
-    SET_GetFloatv(disp, glGetFloatv);
-    SET_GetHistogram(disp, glGetHistogram);
-    SET_GetHistogramParameterfv(disp, glGetHistogramParameterfv);
-    SET_GetHistogramParameteriv(disp, glGetHistogramParameteriv);
-    SET_GetIntegerv(disp, glGetIntegerv);
-    SET_GetLightfv(disp, glGetLightfv);
-    SET_GetLightiv(disp, glGetLightiv);
-    SET_GetMapdv(disp, glGetMapdv);
-    SET_GetMapfv(disp, glGetMapfv);
-    SET_GetMapiv(disp, glGetMapiv);
-    SET_GetMaterialfv(disp, glGetMaterialfv);
-    SET_GetMaterialiv(disp, glGetMaterialiv);
-    SET_GetMinmax(disp, glGetMinmax);
-    SET_GetMinmaxParameterfv(disp, glGetMinmaxParameterfv);
-    SET_GetMinmaxParameteriv(disp, glGetMinmaxParameteriv);
-    SET_GetPixelMapfv(disp, glGetPixelMapfv);
-    SET_GetPixelMapuiv(disp, glGetPixelMapuiv);
-    SET_GetPixelMapusv(disp, glGetPixelMapusv);
-    SET_GetPointerv(disp, glGetPointerv);
-    SET_GetPolygonStipple(disp, glGetPolygonStipple);
-    SET_GetSeparableFilter(disp, glGetSeparableFilter);
-    SET_GetString(disp, glGetString);
-    SET_GetTexEnvfv(disp, glGetTexEnvfv);
-    SET_GetTexEnviv(disp, glGetTexEnviv);
-    SET_GetTexGendv(disp, glGetTexGendv);
-    SET_GetTexGenfv(disp, glGetTexGenfv);
-    SET_GetTexGeniv(disp, glGetTexGeniv);
-    SET_GetTexImage(disp, glGetTexImage);
-    SET_GetTexLevelParameterfv(disp, glGetTexLevelParameterfv);
-    SET_GetTexLevelParameteriv(disp, glGetTexLevelParameteriv);
-    SET_GetTexParameterfv(disp, glGetTexParameterfv);
-    SET_GetTexParameteriv(disp, glGetTexParameteriv);
-    SET_Hint(disp, glHint);
-    SET_Histogram(disp, glHistogram);
-    SET_IndexMask(disp, glIndexMask);
-    SET_IndexPointer(disp, glIndexPointer);
-    SET_Indexd(disp, glIndexd);
-    SET_Indexdv(disp, glIndexdv);
-    SET_Indexf(disp, glIndexf);
-    SET_Indexfv(disp, glIndexfv);
-    SET_Indexi(disp, glIndexi);
-    SET_Indexiv(disp, glIndexiv);
-    SET_Indexs(disp, glIndexs);
-    SET_Indexsv(disp, glIndexsv);
-    SET_Indexub(disp, glIndexub);
-    SET_Indexubv(disp, glIndexubv);
-    SET_InitNames(disp, glInitNames);
-    SET_InterleavedArrays(disp, glInterleavedArrays);
-    SET_IsEnabled(disp, glIsEnabled);
-    SET_IsList(disp, glIsList);
-    SET_IsTexture(disp, glIsTexture);
-    SET_LightModelf(disp, glLightModelf);
-    SET_LightModelfv(disp, glLightModelfv);
-    SET_LightModeli(disp, glLightModeli);
-    SET_LightModeliv(disp, glLightModeliv);
-    SET_Lightf(disp, glLightf);
-    SET_Lightfv(disp, glLightfv);
-    SET_Lighti(disp, glLighti);
-    SET_Lightiv(disp, glLightiv);
-    SET_LineStipple(disp, glLineStipple);
-    SET_LineWidth(disp, glLineWidth);
-    SET_ListBase(disp, glListBase);
-    SET_LoadIdentity(disp, glLoadIdentity);
-    SET_LoadMatrixd(disp, glLoadMatrixd);
-    SET_LoadMatrixf(disp, glLoadMatrixf);
-    SET_LoadName(disp, glLoadName);
-    SET_LogicOp(disp, glLogicOp);
-    SET_Map1d(disp, glMap1d);
-    SET_Map1f(disp, glMap1f);
-    SET_Map2d(disp, glMap2d);
-    SET_Map2f(disp, glMap2f);
-    SET_MapGrid1d(disp, glMapGrid1d);
-    SET_MapGrid1f(disp, glMapGrid1f);
-    SET_MapGrid2d(disp, glMapGrid2d);
-    SET_MapGrid2f(disp, glMapGrid2f);
-    SET_Materialf(disp, glMaterialf);
-    SET_Materialfv(disp, glMaterialfv);
-    SET_Materiali(disp, glMateriali);
-    SET_Materialiv(disp, glMaterialiv);
-    SET_MatrixMode(disp, glMatrixMode);
-    SET_Minmax(disp, glMinmax);
-    SET_MultMatrixd(disp, glMultMatrixd);
-    SET_MultMatrixf(disp, glMultMatrixf);
-    SET_NewList(disp, glNewList);
-    SET_Normal3b(disp, glNormal3b);
-    SET_Normal3bv(disp, glNormal3bv);
-    SET_Normal3d(disp, glNormal3d);
-    SET_Normal3dv(disp, glNormal3dv);
-    SET_Normal3f(disp, glNormal3f);
-    SET_Normal3fv(disp, glNormal3fv);
-    SET_Normal3i(disp, glNormal3i);
-    SET_Normal3iv(disp, glNormal3iv);
-    SET_Normal3s(disp, glNormal3s);
-    SET_Normal3sv(disp, glNormal3sv);
-    SET_NormalPointer(disp, glNormalPointer);
-    SET_Ortho(disp, glOrtho);
-    SET_PassThrough(disp, glPassThrough);
-    SET_PixelMapfv(disp, glPixelMapfv);
-    SET_PixelMapuiv(disp, glPixelMapuiv);
-    SET_PixelMapusv(disp, glPixelMapusv);
-    SET_PixelStoref(disp, glPixelStoref);
-    SET_PixelStorei(disp, glPixelStorei);
-    SET_PixelTransferf(disp, glPixelTransferf);
-    SET_PixelTransferi(disp, glPixelTransferi);
-    SET_PixelZoom(disp, glPixelZoom);
-    SET_PointSize(disp, glPointSize);
-    SET_PolygonMode(disp, glPolygonMode);
-    SET_PolygonOffset(disp, glPolygonOffset);
-    SET_PolygonStipple(disp, glPolygonStipple);
-    SET_PopAttrib(disp, glPopAttrib);
-    SET_PopClientAttrib(disp, glPopClientAttrib);
-    SET_PopMatrix(disp, glPopMatrix);
-    SET_PopName(disp, glPopName);
-    SET_PrioritizeTextures(disp, glPrioritizeTextures);
-    SET_PushAttrib(disp, glPushAttrib);
-    SET_PushClientAttrib(disp, glPushClientAttrib);
-    SET_PushMatrix(disp, glPushMatrix);
-    SET_PushName(disp, glPushName);
-    SET_RasterPos2d(disp, glRasterPos2d);
-    SET_RasterPos2dv(disp, glRasterPos2dv);
-    SET_RasterPos2f(disp, glRasterPos2f);
-    SET_RasterPos2fv(disp, glRasterPos2fv);
-    SET_RasterPos2i(disp, glRasterPos2i);
-    SET_RasterPos2iv(disp, glRasterPos2iv);
-    SET_RasterPos2s(disp, glRasterPos2s);
-    SET_RasterPos2sv(disp, glRasterPos2sv);
-    SET_RasterPos3d(disp, glRasterPos3d);
-    SET_RasterPos3dv(disp, glRasterPos3dv);
-    SET_RasterPos3f(disp, glRasterPos3f);
-    SET_RasterPos3fv(disp, glRasterPos3fv);
-    SET_RasterPos3i(disp, glRasterPos3i);
-    SET_RasterPos3iv(disp, glRasterPos3iv);
-    SET_RasterPos3s(disp, glRasterPos3s);
-    SET_RasterPos3sv(disp, glRasterPos3sv);
-    SET_RasterPos4d(disp, glRasterPos4d);
-    SET_RasterPos4dv(disp, glRasterPos4dv);
-    SET_RasterPos4f(disp, glRasterPos4f);
-    SET_RasterPos4fv(disp, glRasterPos4fv);
-    SET_RasterPos4i(disp, glRasterPos4i);
-    SET_RasterPos4iv(disp, glRasterPos4iv);
-    SET_RasterPos4s(disp, glRasterPos4s);
-    SET_RasterPos4sv(disp, glRasterPos4sv);
-    SET_ReadBuffer(disp, glReadBuffer);
-    SET_ReadPixels(disp, glReadPixels);
-    SET_Rectd(disp, glRectd);
-    SET_Rectdv(disp, glRectdv);
-    SET_Rectf(disp, glRectf);
-    SET_Rectfv(disp, glRectfv);
-    SET_Recti(disp, glRecti);
-    SET_Rectiv(disp, glRectiv);
-    SET_Rects(disp, glRects);
-    SET_Rectsv(disp, glRectsv);
-    SET_RenderMode(disp, glRenderMode);
-    SET_ResetHistogram(disp, glResetHistogram);
-    SET_ResetMinmax(disp, glResetMinmax);
-    SET_Rotated(disp, glRotated);
-    SET_Rotatef(disp, glRotatef);
-    SET_Scaled(disp, glScaled);
-    SET_Scalef(disp, glScalef);
-    SET_Scissor(disp, glScissor);
-    SET_SelectBuffer(disp, glSelectBuffer);
-    SET_SeparableFilter2D(disp, glSeparableFilter2D);
-    SET_ShadeModel(disp, glShadeModel);
-    SET_StencilFunc(disp, glStencilFunc);
-    SET_StencilMask(disp, glStencilMask);
-    SET_StencilOp(disp, glStencilOp);
-    SET_TexCoord1d(disp, glTexCoord1d);
-    SET_TexCoord1dv(disp, glTexCoord1dv);
-    SET_TexCoord1f(disp, glTexCoord1f);
-    SET_TexCoord1fv(disp, glTexCoord1fv);
-    SET_TexCoord1i(disp, glTexCoord1i);
-    SET_TexCoord1iv(disp, glTexCoord1iv);
-    SET_TexCoord1s(disp, glTexCoord1s);
-    SET_TexCoord1sv(disp, glTexCoord1sv);
-    SET_TexCoord2d(disp, glTexCoord2d);
-    SET_TexCoord2dv(disp, glTexCoord2dv);
-    SET_TexCoord2f(disp, glTexCoord2f);
-    SET_TexCoord2fv(disp, glTexCoord2fv);
-    SET_TexCoord2i(disp, glTexCoord2i);
-    SET_TexCoord2iv(disp, glTexCoord2iv);
-    SET_TexCoord2s(disp, glTexCoord2s);
-    SET_TexCoord2sv(disp, glTexCoord2sv);
-    SET_TexCoord3d(disp, glTexCoord3d);
-    SET_TexCoord3dv(disp, glTexCoord3dv);
-    SET_TexCoord3f(disp, glTexCoord3f);
-    SET_TexCoord3fv(disp, glTexCoord3fv);
-    SET_TexCoord3i(disp, glTexCoord3i);
-    SET_TexCoord3iv(disp, glTexCoord3iv);
-    SET_TexCoord3s(disp, glTexCoord3s);
-    SET_TexCoord3sv(disp, glTexCoord3sv);
-    SET_TexCoord4d(disp, glTexCoord4d);
-    SET_TexCoord4dv(disp, glTexCoord4dv);
-    SET_TexCoord4f(disp, glTexCoord4f);
-    SET_TexCoord4fv(disp, glTexCoord4fv);
-    SET_TexCoord4i(disp, glTexCoord4i);
-    SET_TexCoord4iv(disp, glTexCoord4iv);
-    SET_TexCoord4s(disp, glTexCoord4s);
-    SET_TexCoord4sv(disp, glTexCoord4sv);
-    SET_TexCoordPointer(disp, glTexCoordPointer);
-    SET_TexEnvf(disp, glTexEnvf);
-    SET_TexEnvfv(disp, glTexEnvfv);
-    SET_TexEnvi(disp, glTexEnvi);
-    SET_TexEnviv(disp, glTexEnviv);
-    SET_TexGend(disp, glTexGend);
-    SET_TexGendv(disp, glTexGendv);
-    SET_TexGenf(disp, glTexGenf);
-    SET_TexGenfv(disp, glTexGenfv);
-    SET_TexGeni(disp, glTexGeni);
-    SET_TexGeniv(disp, glTexGeniv);
+    SET_Accum(disp, dlsym(RTLD_DEFAULT, "glAccum"));
+    SET_AlphaFunc(disp, dlsym(RTLD_DEFAULT, "glAlphaFunc"));
+    SET_AreTexturesResident(disp, dlsym(RTLD_DEFAULT, "glAreTexturesResident"));
+    SET_ArrayElement(disp, dlsym(RTLD_DEFAULT, "glArrayElement"));
+    SET_Begin(disp, dlsym(RTLD_DEFAULT, "glBegin"));
+    SET_BindTexture(disp, dlsym(RTLD_DEFAULT, "glBindTexture"));
+    SET_Bitmap(disp, dlsym(RTLD_DEFAULT, "glBitmap"));
+    SET_BlendColor(disp, dlsym(RTLD_DEFAULT, "glBlendColor"));
+    SET_BlendEquation(disp, dlsym(RTLD_DEFAULT, "glBlendEquation"));
+    SET_BlendFunc(disp, dlsym(RTLD_DEFAULT, "glBlendFunc"));
+    SET_CallList(disp, dlsym(RTLD_DEFAULT, "glCallList"));
+    SET_CallLists(disp, dlsym(RTLD_DEFAULT, "glCallLists"));
+    SET_Clear(disp, dlsym(RTLD_DEFAULT, "glClear"));
+    SET_ClearAccum(disp, dlsym(RTLD_DEFAULT, "glClearAccum"));
+    SET_ClearColor(disp, dlsym(RTLD_DEFAULT, "glClearColor"));
+    SET_ClearDepth(disp, dlsym(RTLD_DEFAULT, "glClearDepth"));
+    SET_ClearIndex(disp, dlsym(RTLD_DEFAULT, "glClearIndex"));
+    SET_ClearStencil(disp, dlsym(RTLD_DEFAULT, "glClearStencil"));
+    SET_ClipPlane(disp, dlsym(RTLD_DEFAULT, "glClipPlane"));
+    SET_Color3b(disp, dlsym(RTLD_DEFAULT, "glColor3b"));
+    SET_Color3bv(disp, dlsym(RTLD_DEFAULT, "glColor3bv"));
+    SET_Color3d(disp, dlsym(RTLD_DEFAULT, "glColor3d"));
+    SET_Color3dv(disp, dlsym(RTLD_DEFAULT, "glColor3dv"));
+    SET_Color3f(disp, dlsym(RTLD_DEFAULT, "glColor3f"));
+    SET_Color3fv(disp, dlsym(RTLD_DEFAULT, "glColor3fv"));
+    SET_Color3i(disp, dlsym(RTLD_DEFAULT, "glColor3i"));
+    SET_Color3iv(disp, dlsym(RTLD_DEFAULT, "glColor3iv"));
+    SET_Color3s(disp, dlsym(RTLD_DEFAULT, "glColor3s"));
+    SET_Color3sv(disp, dlsym(RTLD_DEFAULT, "glColor3sv"));
+    SET_Color3ub(disp, dlsym(RTLD_DEFAULT, "glColor3ub"));
+    SET_Color3ubv(disp, dlsym(RTLD_DEFAULT, "glColor3ubv"));
+    SET_Color3ui(disp, dlsym(RTLD_DEFAULT, "glColor3ui"));
+    SET_Color3uiv(disp, dlsym(RTLD_DEFAULT, "glColor3uiv"));
+    SET_Color3us(disp, dlsym(RTLD_DEFAULT, "glColor3us"));
+    SET_Color3usv(disp, dlsym(RTLD_DEFAULT, "glColor3usv"));
+    SET_Color4b(disp, dlsym(RTLD_DEFAULT, "glColor4b"));
+    SET_Color4bv(disp, dlsym(RTLD_DEFAULT, "glColor4bv"));
+    SET_Color4d(disp, dlsym(RTLD_DEFAULT, "glColor4d"));
+    SET_Color4dv(disp, dlsym(RTLD_DEFAULT, "glColor4dv"));
+    SET_Color4f(disp, dlsym(RTLD_DEFAULT, "glColor4f"));
+    SET_Color4fv(disp, dlsym(RTLD_DEFAULT, "glColor4fv"));
+    SET_Color4i(disp, dlsym(RTLD_DEFAULT, "glColor4i"));
+    SET_Color4iv(disp, dlsym(RTLD_DEFAULT, "glColor4iv"));
+    SET_Color4s(disp, dlsym(RTLD_DEFAULT, "glColor4s"));
+    SET_Color4sv(disp, dlsym(RTLD_DEFAULT, "glColor4sv"));
+    SET_Color4ub(disp, dlsym(RTLD_DEFAULT, "glColor4ub"));
+    SET_Color4ubv(disp, dlsym(RTLD_DEFAULT, "glColor4ubv"));
+    SET_Color4ui(disp, dlsym(RTLD_DEFAULT, "glColor4ui"));
+    SET_Color4uiv(disp, dlsym(RTLD_DEFAULT, "glColor4uiv"));
+    SET_Color4us(disp, dlsym(RTLD_DEFAULT, "glColor4us"));
+    SET_Color4usv(disp, dlsym(RTLD_DEFAULT, "glColor4usv"));
+    SET_ColorMask(disp, dlsym(RTLD_DEFAULT, "glColorMask"));
+    SET_ColorMaterial(disp, dlsym(RTLD_DEFAULT, "glColorMaterial"));
+    SET_ColorPointer(disp, dlsym(RTLD_DEFAULT, "glColorPointer"));
+    SET_ColorSubTable(disp, dlsym(RTLD_DEFAULT, "glColorSubTable"));
+    SET_ColorTable(disp, dlsym(RTLD_DEFAULT, "glColorTable"));
+    SET_ColorTableParameterfv(disp, dlsym(RTLD_DEFAULT, "glColorTableParameterfv"));
+    SET_ColorTableParameteriv(disp, dlsym(RTLD_DEFAULT, "glColorTableParameteriv"));
+    SET_ConvolutionFilter1D(disp, dlsym(RTLD_DEFAULT, "glConvolutionFilter1D"));
+    SET_ConvolutionFilter2D(disp, dlsym(RTLD_DEFAULT, "glConvolutionFilter2D"));
+    SET_ConvolutionParameterf(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameterf"));
+    SET_ConvolutionParameterfv(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameterfv"));
+    SET_ConvolutionParameteri(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameteri"));
+    SET_ConvolutionParameteriv(disp, dlsym(RTLD_DEFAULT, "glConvolutionParameteriv"));
+    SET_CopyColorSubTable(disp, dlsym(RTLD_DEFAULT, "glCopyColorSubTable"));
+    SET_CopyColorTable(disp, dlsym(RTLD_DEFAULT, "glCopyColorTable"));
+    SET_CopyConvolutionFilter1D(disp, dlsym(RTLD_DEFAULT, "glCopyConvolutionFilter1D"));
+    SET_CopyConvolutionFilter2D(disp, dlsym(RTLD_DEFAULT, "glCopyConvolutionFilter2D"));
+    SET_CopyPixels(disp, dlsym(RTLD_DEFAULT, "glCopyPixels"));
+    SET_CopyTexImage1D(disp, dlsym(RTLD_DEFAULT, "glCopyTexImage1D"));
+    SET_CopyTexImage2D(disp, dlsym(RTLD_DEFAULT, "glCopyTexImage2D"));
+    SET_CopyTexSubImage1D(disp, dlsym(RTLD_DEFAULT, "glCopyTexSubImage1D"));
+    SET_CopyTexSubImage2D(disp, dlsym(RTLD_DEFAULT, "glCopyTexSubImage2D"));
+    SET_CopyTexSubImage3D(disp, dlsym(RTLD_DEFAULT, "glCopyTexSubImage3D"));
+    SET_CullFace(disp, dlsym(RTLD_DEFAULT, "glCullFace"));
+    SET_DeleteLists(disp, dlsym(RTLD_DEFAULT, "glDeleteLists"));
+    SET_DeleteTextures(disp, dlsym(RTLD_DEFAULT, "glDeleteTextures"));
+    SET_DepthFunc(disp, dlsym(RTLD_DEFAULT, "glDepthFunc"));
+    SET_DepthMask(disp, dlsym(RTLD_DEFAULT, "glDepthMask"));
+    SET_DepthRange(disp, dlsym(RTLD_DEFAULT, "glDepthRange"));
+    SET_Disable(disp, dlsym(RTLD_DEFAULT, "glDisable"));
+    SET_DisableClientState(disp, dlsym(RTLD_DEFAULT, "glDisableClientState"));
+    SET_DrawArrays(disp, dlsym(RTLD_DEFAULT, "glDrawArrays"));
+    SET_DrawBuffer(disp, dlsym(RTLD_DEFAULT, "glDrawBuffer"));
+    SET_DrawElements(disp, dlsym(RTLD_DEFAULT, "glDrawElements"));
+    SET_DrawPixels(disp, dlsym(RTLD_DEFAULT, "glDrawPixels"));
+    SET_DrawRangeElements(disp, dlsym(RTLD_DEFAULT, "glDrawRangeElements"));
+    SET_EdgeFlag(disp, dlsym(RTLD_DEFAULT, "glEdgeFlag"));
+    SET_EdgeFlagPointer(disp, dlsym(RTLD_DEFAULT, "glEdgeFlagPointer"));
+    SET_EdgeFlagv(disp, dlsym(RTLD_DEFAULT, "glEdgeFlagv"));
+    SET_Enable(disp, dlsym(RTLD_DEFAULT, "glEnable"));
+    SET_EnableClientState(disp, dlsym(RTLD_DEFAULT, "glEnableClientState"));
+    SET_End(disp, dlsym(RTLD_DEFAULT, "glEnd"));
+    SET_EndList(disp, dlsym(RTLD_DEFAULT, "glEndList"));
+    SET_EvalCoord1d(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1d"));
+    SET_EvalCoord1dv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1dv"));
+    SET_EvalCoord1f(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1f"));
+    SET_EvalCoord1fv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord1fv"));
+    SET_EvalCoord2d(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2d"));
+    SET_EvalCoord2dv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2dv"));
+    SET_EvalCoord2f(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2f"));
+    SET_EvalCoord2fv(disp, dlsym(RTLD_DEFAULT, "glEvalCoord2fv"));
+    SET_EvalMesh1(disp, dlsym(RTLD_DEFAULT, "glEvalMesh1"));
+    SET_EvalMesh2(disp, dlsym(RTLD_DEFAULT, "glEvalMesh2"));
+    SET_EvalPoint1(disp, dlsym(RTLD_DEFAULT, "glEvalPoint1"));
+    SET_EvalPoint2(disp, dlsym(RTLD_DEFAULT, "glEvalPoint2"));
+    SET_FeedbackBuffer(disp, dlsym(RTLD_DEFAULT, "glFeedbackBuffer"));
+    SET_Finish(disp, dlsym(RTLD_DEFAULT, "glFinish"));
+    SET_Flush(disp, dlsym(RTLD_DEFAULT, "glFlush"));
+    SET_Fogf(disp, dlsym(RTLD_DEFAULT, "glFogf"));
+    SET_Fogfv(disp, dlsym(RTLD_DEFAULT, "glFogfv"));
+    SET_Fogi(disp, dlsym(RTLD_DEFAULT, "glFogi"));
+    SET_Fogiv(disp, dlsym(RTLD_DEFAULT, "glFogiv"));
+    SET_FrontFace(disp, dlsym(RTLD_DEFAULT, "glFrontFace"));
+    SET_Frustum(disp, dlsym(RTLD_DEFAULT, "glFrustum"));
+    SET_GenLists(disp, dlsym(RTLD_DEFAULT, "glGenLists"));
+    SET_GenTextures(disp, dlsym(RTLD_DEFAULT, "glGenTextures"));
+    SET_GetBooleanv(disp, dlsym(RTLD_DEFAULT, "glGetBooleanv"));
+    SET_GetClipPlane(disp, dlsym(RTLD_DEFAULT, "glGetClipPlane"));
+    SET_GetColorTable(disp, dlsym(RTLD_DEFAULT, "glGetColorTable"));
+    SET_GetColorTableParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetColorTableParameterfv"));
+    SET_GetColorTableParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetColorTableParameteriv"));
+    SET_GetConvolutionFilter(disp, dlsym(RTLD_DEFAULT, "glGetConvolutionFilter"));
+    SET_GetConvolutionParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetConvolutionParameterfv"));
+    SET_GetConvolutionParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetConvolutionParameteriv"));
+    SET_GetDoublev(disp, dlsym(RTLD_DEFAULT, "glGetDoublev"));
+    SET_GetError(disp, dlsym(RTLD_DEFAULT, "glGetError"));
+    SET_GetFloatv(disp, dlsym(RTLD_DEFAULT, "glGetFloatv"));
+    SET_GetHistogram(disp, dlsym(RTLD_DEFAULT, "glGetHistogram"));
+    SET_GetHistogramParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetHistogramParameterfv"));
+    SET_GetHistogramParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetHistogramParameteriv"));
+    SET_GetIntegerv(disp, dlsym(RTLD_DEFAULT, "glGetIntegerv"));
+    SET_GetLightfv(disp, dlsym(RTLD_DEFAULT, "glGetLightfv"));
+    SET_GetLightiv(disp, dlsym(RTLD_DEFAULT, "glGetLightiv"));
+    SET_GetMapdv(disp, dlsym(RTLD_DEFAULT, "glGetMapdv"));
+    SET_GetMapfv(disp, dlsym(RTLD_DEFAULT, "glGetMapfv"));
+    SET_GetMapiv(disp, dlsym(RTLD_DEFAULT, "glGetMapiv"));
+    SET_GetMaterialfv(disp, dlsym(RTLD_DEFAULT, "glGetMaterialfv"));
+    SET_GetMaterialiv(disp, dlsym(RTLD_DEFAULT, "glGetMaterialiv"));
+    SET_GetMinmax(disp, dlsym(RTLD_DEFAULT, "glGetMinmax"));
+    SET_GetMinmaxParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetMinmaxParameterfv"));
+    SET_GetMinmaxParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetMinmaxParameteriv"));
+    SET_GetPixelMapfv(disp, dlsym(RTLD_DEFAULT, "glGetPixelMapfv"));
+    SET_GetPixelMapuiv(disp, dlsym(RTLD_DEFAULT, "glGetPixelMapuiv"));
+    SET_GetPixelMapusv(disp, dlsym(RTLD_DEFAULT, "glGetPixelMapusv"));
+    SET_GetPointerv(disp, dlsym(RTLD_DEFAULT, "glGetPointerv"));
+    SET_GetPolygonStipple(disp, dlsym(RTLD_DEFAULT, "glGetPolygonStipple"));
+    SET_GetSeparableFilter(disp, dlsym(RTLD_DEFAULT, "glGetSeparableFilter"));
+    SET_GetString(disp, dlsym(RTLD_DEFAULT, "glGetString"));
+    SET_GetTexEnvfv(disp, dlsym(RTLD_DEFAULT, "glGetTexEnvfv"));
+    SET_GetTexEnviv(disp, dlsym(RTLD_DEFAULT, "glGetTexEnviv"));
+    SET_GetTexGendv(disp, dlsym(RTLD_DEFAULT, "glGetTexGendv"));
+    SET_GetTexGenfv(disp, dlsym(RTLD_DEFAULT, "glGetTexGenfv"));
+    SET_GetTexGeniv(disp, dlsym(RTLD_DEFAULT, "glGetTexGeniv"));
+    SET_GetTexImage(disp, dlsym(RTLD_DEFAULT, "glGetTexImage"));
+    SET_GetTexLevelParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetTexLevelParameterfv"));
+    SET_GetTexLevelParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetTexLevelParameteriv"));
+    SET_GetTexParameterfv(disp, dlsym(RTLD_DEFAULT, "glGetTexParameterfv"));
+    SET_GetTexParameteriv(disp, dlsym(RTLD_DEFAULT, "glGetTexParameteriv"));
+    SET_Hint(disp, dlsym(RTLD_DEFAULT, "glHint"));
+    SET_Histogram(disp, dlsym(RTLD_DEFAULT, "glHistogram"));
+    SET_IndexMask(disp, dlsym(RTLD_DEFAULT, "glIndexMask"));
+    SET_IndexPointer(disp, dlsym(RTLD_DEFAULT, "glIndexPointer"));
+    SET_Indexd(disp, dlsym(RTLD_DEFAULT, "glIndexd"));
+    SET_Indexdv(disp, dlsym(RTLD_DEFAULT, "glIndexdv"));
+    SET_Indexf(disp, dlsym(RTLD_DEFAULT, "glIndexf"));
+    SET_Indexfv(disp, dlsym(RTLD_DEFAULT, "glIndexfv"));
+    SET_Indexi(disp, dlsym(RTLD_DEFAULT, "glIndexi"));
+    SET_Indexiv(disp, dlsym(RTLD_DEFAULT, "glIndexiv"));
+    SET_Indexs(disp, dlsym(RTLD_DEFAULT, "glIndexs"));
+    SET_Indexsv(disp, dlsym(RTLD_DEFAULT, "glIndexsv"));
+    SET_Indexub(disp, dlsym(RTLD_DEFAULT, "glIndexub"));
+    SET_Indexubv(disp, dlsym(RTLD_DEFAULT, "glIndexubv"));
+    SET_InitNames(disp, dlsym(RTLD_DEFAULT, "glInitNames"));
+    SET_InterleavedArrays(disp, dlsym(RTLD_DEFAULT, "glInterleavedArrays"));
+    SET_IsEnabled(disp, dlsym(RTLD_DEFAULT, "glIsEnabled"));
+    SET_IsList(disp, dlsym(RTLD_DEFAULT, "glIsList"));
+    SET_IsTexture(disp, dlsym(RTLD_DEFAULT, "glIsTexture"));
+    SET_LightModelf(disp, dlsym(RTLD_DEFAULT, "glLightModelf"));
+    SET_LightModelfv(disp, dlsym(RTLD_DEFAULT, "glLightModelfv"));
+    SET_LightModeli(disp, dlsym(RTLD_DEFAULT, "glLightModeli"));
+    SET_LightModeliv(disp, dlsym(RTLD_DEFAULT, "glLightModeliv"));
+    SET_Lightf(disp, dlsym(RTLD_DEFAULT, "glLightf"));
+    SET_Lightfv(disp, dlsym(RTLD_DEFAULT, "glLightfv"));
+    SET_Lighti(disp, dlsym(RTLD_DEFAULT, "glLighti"));
+    SET_Lightiv(disp, dlsym(RTLD_DEFAULT, "glLightiv"));
+    SET_LineStipple(disp, dlsym(RTLD_DEFAULT, "glLineStipple"));
+    SET_LineWidth(disp, dlsym(RTLD_DEFAULT, "glLineWidth"));
+    SET_ListBase(disp, dlsym(RTLD_DEFAULT, "glListBase"));
+    SET_LoadIdentity(disp, dlsym(RTLD_DEFAULT, "glLoadIdentity"));
+    SET_LoadMatrixd(disp, dlsym(RTLD_DEFAULT, "glLoadMatrixd"));
+    SET_LoadMatrixf(disp, dlsym(RTLD_DEFAULT, "glLoadMatrixf"));
+    SET_LoadName(disp, dlsym(RTLD_DEFAULT, "glLoadName"));
+    SET_LogicOp(disp, dlsym(RTLD_DEFAULT, "glLogicOp"));
+    SET_Map1d(disp, dlsym(RTLD_DEFAULT, "glMap1d"));
+    SET_Map1f(disp, dlsym(RTLD_DEFAULT, "glMap1f"));
+    SET_Map2d(disp, dlsym(RTLD_DEFAULT, "glMap2d"));
+    SET_Map2f(disp, dlsym(RTLD_DEFAULT, "glMap2f"));
+    SET_MapGrid1d(disp, dlsym(RTLD_DEFAULT, "glMapGrid1d"));
+    SET_MapGrid1f(disp, dlsym(RTLD_DEFAULT, "glMapGrid1f"));
+    SET_MapGrid2d(disp, dlsym(RTLD_DEFAULT, "glMapGrid2d"));
+    SET_MapGrid2f(disp, dlsym(RTLD_DEFAULT, "glMapGrid2f"));
+    SET_Materialf(disp, dlsym(RTLD_DEFAULT, "glMaterialf"));
+    SET_Materialfv(disp, dlsym(RTLD_DEFAULT, "glMaterialfv"));
+    SET_Materiali(disp, dlsym(RTLD_DEFAULT, "glMateriali"));
+    SET_Materialiv(disp, dlsym(RTLD_DEFAULT, "glMaterialiv"));
+    SET_MatrixMode(disp, dlsym(RTLD_DEFAULT, "glMatrixMode"));
+    SET_Minmax(disp, dlsym(RTLD_DEFAULT, "glMinmax"));
+    SET_MultMatrixd(disp, dlsym(RTLD_DEFAULT, "glMultMatrixd"));
+    SET_MultMatrixf(disp, dlsym(RTLD_DEFAULT, "glMultMatrixf"));
+    SET_NewList(disp, dlsym(RTLD_DEFAULT, "glNewList"));
+    SET_Normal3b(disp, dlsym(RTLD_DEFAULT, "glNormal3b"));
+    SET_Normal3bv(disp, dlsym(RTLD_DEFAULT, "glNormal3bv"));
+    SET_Normal3d(disp, dlsym(RTLD_DEFAULT, "glNormal3d"));
+    SET_Normal3dv(disp, dlsym(RTLD_DEFAULT, "glNormal3dv"));
+    SET_Normal3f(disp, dlsym(RTLD_DEFAULT, "glNormal3f"));
+    SET_Normal3fv(disp, dlsym(RTLD_DEFAULT, "glNormal3fv"));
+    SET_Normal3i(disp, dlsym(RTLD_DEFAULT, "glNormal3i"));
+    SET_Normal3iv(disp, dlsym(RTLD_DEFAULT, "glNormal3iv"));
+    SET_Normal3s(disp, dlsym(RTLD_DEFAULT, "glNormal3s"));
+    SET_Normal3sv(disp, dlsym(RTLD_DEFAULT, "glNormal3sv"));
+    SET_NormalPointer(disp, dlsym(RTLD_DEFAULT, "glNormalPointer"));
+    SET_Ortho(disp, dlsym(RTLD_DEFAULT, "glOrtho"));
+    SET_PassThrough(disp, dlsym(RTLD_DEFAULT, "glPassThrough"));
+    SET_PixelMapfv(disp, dlsym(RTLD_DEFAULT, "glPixelMapfv"));
+    SET_PixelMapuiv(disp, dlsym(RTLD_DEFAULT, "glPixelMapuiv"));
+    SET_PixelMapusv(disp, dlsym(RTLD_DEFAULT, "glPixelMapusv"));
+    SET_PixelStoref(disp, dlsym(RTLD_DEFAULT, "glPixelStoref"));
+    SET_PixelStorei(disp, dlsym(RTLD_DEFAULT, "glPixelStorei"));
+    SET_PixelTransferf(disp, dlsym(RTLD_DEFAULT, "glPixelTransferf"));
+    SET_PixelTransferi(disp, dlsym(RTLD_DEFAULT, "glPixelTransferi"));
+    SET_PixelZoom(disp, dlsym(RTLD_DEFAULT, "glPixelZoom"));
+    SET_PointSize(disp, dlsym(RTLD_DEFAULT, "glPointSize"));
+    SET_PolygonMode(disp, dlsym(RTLD_DEFAULT, "glPolygonMode"));
+    SET_PolygonOffset(disp, dlsym(RTLD_DEFAULT, "glPolygonOffset"));
+    SET_PolygonStipple(disp, dlsym(RTLD_DEFAULT, "glPolygonStipple"));
+    SET_PopAttrib(disp, dlsym(RTLD_DEFAULT, "glPopAttrib"));
+    SET_PopClientAttrib(disp, dlsym(RTLD_DEFAULT, "glPopClientAttrib"));
+    SET_PopMatrix(disp, dlsym(RTLD_DEFAULT, "glPopMatrix"));
+    SET_PopName(disp, dlsym(RTLD_DEFAULT, "glPopName"));
+    SET_PrioritizeTextures(disp, dlsym(RTLD_DEFAULT, "glPrioritizeTextures"));
+    SET_PushAttrib(disp, dlsym(RTLD_DEFAULT, "glPushAttrib"));
+    SET_PushClientAttrib(disp, dlsym(RTLD_DEFAULT, "glPushClientAttrib"));
+    SET_PushMatrix(disp, dlsym(RTLD_DEFAULT, "glPushMatrix"));
+    SET_PushName(disp, dlsym(RTLD_DEFAULT, "glPushName"));
+    SET_RasterPos2d(disp, dlsym(RTLD_DEFAULT, "glRasterPos2d"));
+    SET_RasterPos2dv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2dv"));
+    SET_RasterPos2f(disp, dlsym(RTLD_DEFAULT, "glRasterPos2f"));
+    SET_RasterPos2fv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2fv"));
+    SET_RasterPos2i(disp, dlsym(RTLD_DEFAULT, "glRasterPos2i"));
+    SET_RasterPos2iv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2iv"));
+    SET_RasterPos2s(disp, dlsym(RTLD_DEFAULT, "glRasterPos2s"));
+    SET_RasterPos2sv(disp, dlsym(RTLD_DEFAULT, "glRasterPos2sv"));
+    SET_RasterPos3d(disp, dlsym(RTLD_DEFAULT, "glRasterPos3d"));
+    SET_RasterPos3dv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3dv"));
+    SET_RasterPos3f(disp, dlsym(RTLD_DEFAULT, "glRasterPos3f"));
+    SET_RasterPos3fv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3fv"));
+    SET_RasterPos3i(disp, dlsym(RTLD_DEFAULT, "glRasterPos3i"));
+    SET_RasterPos3iv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3iv"));
+    SET_RasterPos3s(disp, dlsym(RTLD_DEFAULT, "glRasterPos3s"));
+    SET_RasterPos3sv(disp, dlsym(RTLD_DEFAULT, "glRasterPos3sv"));
+    SET_RasterPos4d(disp, dlsym(RTLD_DEFAULT, "glRasterPos4d"));
+    SET_RasterPos4dv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4dv"));
+    SET_RasterPos4f(disp, dlsym(RTLD_DEFAULT, "glRasterPos4f"));
+    SET_RasterPos4fv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4fv"));
+    SET_RasterPos4i(disp, dlsym(RTLD_DEFAULT, "glRasterPos4i"));
+    SET_RasterPos4iv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4iv"));
+    SET_RasterPos4s(disp, dlsym(RTLD_DEFAULT, "glRasterPos4s"));
+    SET_RasterPos4sv(disp, dlsym(RTLD_DEFAULT, "glRasterPos4sv"));
+    SET_ReadBuffer(disp, dlsym(RTLD_DEFAULT, "glReadBuffer"));
+    SET_ReadPixels(disp, dlsym(RTLD_DEFAULT, "glReadPixels"));
+    SET_Rectd(disp, dlsym(RTLD_DEFAULT, "glRectd"));
+    SET_Rectdv(disp, dlsym(RTLD_DEFAULT, "glRectdv"));
+    SET_Rectf(disp, dlsym(RTLD_DEFAULT, "glRectf"));
+    SET_Rectfv(disp, dlsym(RTLD_DEFAULT, "glRectfv"));
+    SET_Recti(disp, dlsym(RTLD_DEFAULT, "glRecti"));
+    SET_Rectiv(disp, dlsym(RTLD_DEFAULT, "glRectiv"));
+    SET_Rects(disp, dlsym(RTLD_DEFAULT, "glRects"));
+    SET_Rectsv(disp, dlsym(RTLD_DEFAULT, "glRectsv"));
+    SET_RenderMode(disp, dlsym(RTLD_DEFAULT, "glRenderMode"));
+    SET_ResetHistogram(disp, dlsym(RTLD_DEFAULT, "glResetHistogram"));
+    SET_ResetMinmax(disp, dlsym(RTLD_DEFAULT, "glResetMinmax"));
+    SET_Rotated(disp, dlsym(RTLD_DEFAULT, "glRotated"));
+    SET_Rotatef(disp, dlsym(RTLD_DEFAULT, "glRotatef"));
+    SET_Scaled(disp, dlsym(RTLD_DEFAULT, "glScaled"));
+    SET_Scalef(disp, dlsym(RTLD_DEFAULT, "glScalef"));
+    SET_Scissor(disp, dlsym(RTLD_DEFAULT, "glScissor"));
+    SET_SelectBuffer(disp, dlsym(RTLD_DEFAULT, "glSelectBuffer"));
+    SET_SeparableFilter2D(disp, dlsym(RTLD_DEFAULT, "glSeparableFilter2D"));
+    SET_ShadeModel(disp, dlsym(RTLD_DEFAULT, "glShadeModel"));
+    SET_StencilFunc(disp, dlsym(RTLD_DEFAULT, "glStencilFunc"));
+    SET_StencilMask(disp, dlsym(RTLD_DEFAULT, "glStencilMask"));
+    SET_StencilOp(disp, dlsym(RTLD_DEFAULT, "glStencilOp"));
+    SET_TexCoord1d(disp, dlsym(RTLD_DEFAULT, "glTexCoord1d"));
+    SET_TexCoord1dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1dv"));
+    SET_TexCoord1f(disp, dlsym(RTLD_DEFAULT, "glTexCoord1f"));
+    SET_TexCoord1fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1fv"));
+    SET_TexCoord1i(disp, dlsym(RTLD_DEFAULT, "glTexCoord1i"));
+    SET_TexCoord1iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1iv"));
+    SET_TexCoord1s(disp, dlsym(RTLD_DEFAULT, "glTexCoord1s"));
+    SET_TexCoord1sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord1sv"));
+    SET_TexCoord2d(disp, dlsym(RTLD_DEFAULT, "glTexCoord2d"));
+    SET_TexCoord2dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2dv"));
+    SET_TexCoord2f(disp, dlsym(RTLD_DEFAULT, "glTexCoord2f"));
+    SET_TexCoord2fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2fv"));
+    SET_TexCoord2i(disp, dlsym(RTLD_DEFAULT, "glTexCoord2i"));
+    SET_TexCoord2iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2iv"));
+    SET_TexCoord2s(disp, dlsym(RTLD_DEFAULT, "glTexCoord2s"));
+    SET_TexCoord2sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord2sv"));
+    SET_TexCoord3d(disp, dlsym(RTLD_DEFAULT, "glTexCoord3d"));
+    SET_TexCoord3dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3dv"));
+    SET_TexCoord3f(disp, dlsym(RTLD_DEFAULT, "glTexCoord3f"));
+    SET_TexCoord3fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3fv"));
+    SET_TexCoord3i(disp, dlsym(RTLD_DEFAULT, "glTexCoord3i"));
+    SET_TexCoord3iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3iv"));
+    SET_TexCoord3s(disp, dlsym(RTLD_DEFAULT, "glTexCoord3s"));
+    SET_TexCoord3sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord3sv"));
+    SET_TexCoord4d(disp, dlsym(RTLD_DEFAULT, "glTexCoord4d"));
+    SET_TexCoord4dv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4dv"));
+    SET_TexCoord4f(disp, dlsym(RTLD_DEFAULT, "glTexCoord4f"));
+    SET_TexCoord4fv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4fv"));
+    SET_TexCoord4i(disp, dlsym(RTLD_DEFAULT, "glTexCoord4i"));
+    SET_TexCoord4iv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4iv"));
+    SET_TexCoord4s(disp, dlsym(RTLD_DEFAULT, "glTexCoord4s"));
+    SET_TexCoord4sv(disp, dlsym(RTLD_DEFAULT, "glTexCoord4sv"));
+    SET_TexCoordPointer(disp, dlsym(RTLD_DEFAULT, "glTexCoordPointer"));
+    SET_TexEnvf(disp, dlsym(RTLD_DEFAULT, "glTexEnvf"));
+    SET_TexEnvfv(disp, dlsym(RTLD_DEFAULT, "glTexEnvfv"));
+    SET_TexEnvi(disp, dlsym(RTLD_DEFAULT, "glTexEnvi"));
+    SET_TexEnviv(disp, dlsym(RTLD_DEFAULT, "glTexEnviv"));
+    SET_TexGend(disp, dlsym(RTLD_DEFAULT, "glTexGend"));
+    SET_TexGendv(disp, dlsym(RTLD_DEFAULT, "glTexGendv"));
+    SET_TexGenf(disp, dlsym(RTLD_DEFAULT, "glTexGenf"));
+    SET_TexGenfv(disp, dlsym(RTLD_DEFAULT, "glTexGenfv"));
+    SET_TexGeni(disp, dlsym(RTLD_DEFAULT, "glTexGeni"));
+    SET_TexGeniv(disp, dlsym(RTLD_DEFAULT, "glTexGeniv"));
     
     /* Pointer Incompatability:
      * internalformat is a GLenum according to /System/Library/Frameworks/OpenGL.framework/Headers/gl.h
@@ -1027,385 +946,363 @@ static void setup_dispatch_table(void) {
      * <rdar://problem/6953344> gl.h contains incorrect prototypes for glTexImage[123]D
      */
     
-    SET_TexImage1D(disp, (void *)glTexImage1D);
-    SET_TexImage2D(disp, (void *)glTexImage2D);
-    SET_TexImage3D(disp, (void *)glTexImage3D);
-    SET_TexParameterf(disp, glTexParameterf);
-    SET_TexParameterfv(disp, glTexParameterfv);
-    SET_TexParameteri(disp, glTexParameteri);
-    SET_TexParameteriv(disp, glTexParameteriv);
-    SET_TexSubImage1D(disp, glTexSubImage1D);
-    SET_TexSubImage2D(disp, glTexSubImage2D);
-    SET_TexSubImage3D(disp, glTexSubImage3D);
-    SET_Translated(disp, glTranslated);
-    SET_Translatef(disp, glTranslatef);
-    SET_Vertex2d(disp, glVertex2d);
-    SET_Vertex2dv(disp, glVertex2dv);
-    SET_Vertex2f(disp, glVertex2f);
-    SET_Vertex2fv(disp, glVertex2fv);
-    SET_Vertex2i(disp, glVertex2i);
-    SET_Vertex2iv(disp, glVertex2iv);
-    SET_Vertex2s(disp, glVertex2s);
-    SET_Vertex2sv(disp, glVertex2sv);
-    SET_Vertex3d(disp, glVertex3d);
-    SET_Vertex3dv(disp, glVertex3dv);
-    SET_Vertex3f(disp, glVertex3f);
-    SET_Vertex3fv(disp, glVertex3fv);
-    SET_Vertex3i(disp, glVertex3i);
-    SET_Vertex3iv(disp, glVertex3iv);
-    SET_Vertex3s(disp, glVertex3s);
-    SET_Vertex3sv(disp, glVertex3sv);
-    SET_Vertex4d(disp, glVertex4d);
-    SET_Vertex4dv(disp, glVertex4dv);
-    SET_Vertex4f(disp, glVertex4f);
-    SET_Vertex4fv(disp, glVertex4fv);
-    SET_Vertex4i(disp, glVertex4i);
-    SET_Vertex4iv(disp, glVertex4iv);
-    SET_Vertex4s(disp, glVertex4s);
-    SET_Vertex4sv(disp, glVertex4sv);
-    SET_VertexPointer(disp, glVertexPointer);
-    SET_Viewport(disp, glViewport);
-
-#if GL_VERSION_2_0
-    SET_AttachShader(disp, glAttachShader);
-    SET_DeleteShader(disp, glDeleteShader);
-    SET_DetachShader(disp, glDetachShader);
-    SET_GetAttachedShaders(disp, glGetAttachedShaders);
-    SET_GetProgramInfoLog(disp, glGetProgramInfoLog);
-    SET_GetShaderInfoLog(disp, glGetShaderInfoLog);
-    SET_GetShaderiv(disp, glGetShaderiv);
-    SET_IsShader(disp, glIsShader);
-    SET_StencilFuncSeparate(disp, glStencilFuncSeparate);
-    SET_StencilMaskSeparate(disp, glStencilMaskSeparate);
-    SET_StencilOpSeparate(disp, glStencilOpSeparate);
-#endif
-
-#if GL_VERSION_2_1
-    SET_UniformMatrix2x3fv(disp, glUniformMatrix2x3fv);
-    SET_UniformMatrix2x4fv(disp, glUniformMatrix2x4fv);
-    SET_UniformMatrix3x2fv(disp, glUniformMatrix3x2fv);
-    SET_UniformMatrix3x4fv(disp, glUniformMatrix3x4fv);
-    SET_UniformMatrix4x2fv(disp, glUniformMatrix4x2fv);
-    SET_UniformMatrix4x3fv(disp, glUniformMatrix4x3fv);
-#endif
-
-#if GL_APPLE_vertex_array_object
-    SET_BindVertexArrayAPPLE(disp, glBindVertexArrayAPPLE);
-    SET_DeleteVertexArraysAPPLE(disp, glDeleteVertexArraysAPPLE);
-    SET_GenVertexArraysAPPLE(disp, glGenVertexArraysAPPLE);
-    SET_IsVertexArrayAPPLE(disp, glIsVertexArrayAPPLE);
-#endif
-
-#if GL_ARB_draw_buffers
-    SET_DrawBuffersARB(disp, glDrawBuffersARB);
-#endif
-
-#if GL_ARB_multisample
-    SET_SampleCoverageARB(disp, glSampleCoverageARB);
-#endif
-
-#if GL_ARB_multitexture
-    SET_ActiveTextureARB(disp, glActiveTextureARB);
-    SET_ClientActiveTextureARB(disp, glClientActiveTextureARB);
-    SET_MultiTexCoord1dARB(disp, glMultiTexCoord1dARB);
-    SET_MultiTexCoord1dvARB(disp, glMultiTexCoord1dvARB);
-    SET_MultiTexCoord1fARB(disp, glMultiTexCoord1fARB);
-    SET_MultiTexCoord1fvARB(disp, glMultiTexCoord1fvARB);
-    SET_MultiTexCoord1iARB(disp, glMultiTexCoord1iARB);
-    SET_MultiTexCoord1ivARB(disp, glMultiTexCoord1ivARB);
-    SET_MultiTexCoord1sARB(disp, glMultiTexCoord1sARB);
-    SET_MultiTexCoord1svARB(disp, glMultiTexCoord1svARB);
-    SET_MultiTexCoord2dARB(disp, glMultiTexCoord2dARB);
-    SET_MultiTexCoord2dvARB(disp, glMultiTexCoord2dvARB);
-    SET_MultiTexCoord2fARB(disp, glMultiTexCoord2fARB);
-    SET_MultiTexCoord2fvARB(disp, glMultiTexCoord2fvARB);
-    SET_MultiTexCoord2iARB(disp, glMultiTexCoord2iARB);
-    SET_MultiTexCoord2ivARB(disp, glMultiTexCoord2ivARB);
-    SET_MultiTexCoord2sARB(disp, glMultiTexCoord2sARB);
-    SET_MultiTexCoord2svARB(disp, glMultiTexCoord2svARB);
-    SET_MultiTexCoord3dARB(disp, glMultiTexCoord3dARB);
-    SET_MultiTexCoord3dvARB(disp, glMultiTexCoord3dvARB);
-    SET_MultiTexCoord3fARB(disp, glMultiTexCoord3fARB);
-    SET_MultiTexCoord3fvARB(disp, glMultiTexCoord3fvARB);
-    SET_MultiTexCoord3iARB(disp, glMultiTexCoord3iARB);
-    SET_MultiTexCoord3ivARB(disp, glMultiTexCoord3ivARB);
-    SET_MultiTexCoord3sARB(disp, glMultiTexCoord3sARB);
-    SET_MultiTexCoord3svARB(disp, glMultiTexCoord3svARB);
-    SET_MultiTexCoord4dARB(disp, glMultiTexCoord4dARB);
-    SET_MultiTexCoord4dvARB(disp, glMultiTexCoord4dvARB);
-    SET_MultiTexCoord4fARB(disp, glMultiTexCoord4fARB);
-    SET_MultiTexCoord4fvARB(disp, glMultiTexCoord4fvARB);
-    SET_MultiTexCoord4iARB(disp, glMultiTexCoord4iARB);
-    SET_MultiTexCoord4ivARB(disp, glMultiTexCoord4ivARB);
-    SET_MultiTexCoord4sARB(disp, glMultiTexCoord4sARB);
-    SET_MultiTexCoord4svARB(disp, glMultiTexCoord4svARB);
-#endif
-
-#if GL_ARB_occlusion_query
-    SET_BeginQueryARB(disp, glBeginQueryARB);
-    SET_DeleteQueriesARB(disp, glDeleteQueriesARB);
-    SET_EndQueryARB(disp, glEndQueryARB);
-    SET_GenQueriesARB(disp, glGenQueriesARB);
-    SET_GetQueryObjectivARB(disp, glGetQueryObjectivARB);
-    SET_GetQueryObjectuivARB(disp, glGetQueryObjectuivARB);
-    SET_GetQueryivARB(disp, glGetQueryivARB);
-    SET_IsQueryARB(disp, glIsQueryARB);
-#endif
-
-#if GL_ARB_shader_objects
-    SET_AttachObjectARB(disp, glAttachObjectARB);
-    SET_CompileShaderARB(disp, glCompileShaderARB);
-    SET_DeleteObjectARB(disp, glDeleteObjectARB);
-    SET_GetHandleARB(disp, glGetHandleARB);
-    SET_DetachObjectARB(disp, glDetachObjectARB);
-    SET_CreateProgramObjectARB(disp, glCreateProgramObjectARB);
-    SET_CreateShaderObjectARB(disp, glCreateShaderObjectARB);
-    SET_GetInfoLogARB(disp, glGetInfoLogARB);
-    SET_GetActiveUniformARB(disp, glGetActiveUniformARB);
-    SET_GetAttachedObjectsARB(disp, glGetAttachedObjectsARB);
-    SET_GetObjectParameterfvARB(disp, glGetObjectParameterfvARB);
-    SET_GetObjectParameterivARB(disp, glGetObjectParameterivARB);
-    SET_GetShaderSourceARB(disp, glGetShaderSourceARB);
-    SET_GetUniformLocationARB(disp, glGetUniformLocationARB);
-    SET_GetUniformfvARB(disp, glGetUniformfvARB);
-    SET_GetUniformivARB(disp, glGetUniformivARB);
-    SET_LinkProgramARB(disp, glLinkProgramARB);
-    SET_ShaderSourceARB(disp, glShaderSourceARB);
-    SET_Uniform1fARB(disp, glUniform1fARB);
-    SET_Uniform1fvARB(disp, glUniform1fvARB);
-    SET_Uniform1iARB(disp, glUniform1iARB);
-    SET_Uniform1ivARB(disp, glUniform1ivARB);
-    SET_Uniform2fARB(disp, glUniform2fARB);
-    SET_Uniform2fvARB(disp, glUniform2fvARB);
-    SET_Uniform2iARB(disp, glUniform2iARB);
-    SET_Uniform2ivARB(disp, glUniform2ivARB);
-    SET_Uniform3fARB(disp, glUniform3fARB);
-    SET_Uniform3fvARB(disp, glUniform3fvARB);
-    SET_Uniform3iARB(disp, glUniform3iARB);
-    SET_Uniform3ivARB(disp, glUniform3ivARB);
-    SET_Uniform4fARB(disp, glUniform4fARB);
-    SET_Uniform4fvARB(disp, glUniform4fvARB);
-    SET_Uniform4iARB(disp, glUniform4iARB);
-    SET_Uniform4ivARB(disp, glUniform4ivARB);
-    SET_UniformMatrix2fvARB(disp, glUniformMatrix2fvARB);
-    SET_UniformMatrix3fvARB(disp, glUniformMatrix3fvARB);
-    SET_UniformMatrix4fvARB(disp, glUniformMatrix4fvARB);
-    SET_UseProgramObjectARB(disp, glUseProgramObjectARB);
-    SET_ValidateProgramARB(disp, glValidateProgramARB);
-#endif
-
-#if GL_ARB_texture_compression
-    SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB);
-    SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB);
-    SET_CompressedTexImage3DARB(disp, glCompressedTexImage3DARB);
-    SET_CompressedTexSubImage1DARB(disp, glCompressedTexSubImage1DARB);
-    SET_CompressedTexSubImage2DARB(disp, glCompressedTexSubImage2DARB);
-    SET_CompressedTexSubImage3DARB(disp, glCompressedTexSubImage3DARB);
-    SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB);
-#endif
-
-#if GL_ARB_transpose_matrix
-    SET_LoadTransposeMatrixdARB(disp, glLoadTransposeMatrixdARB);
-    SET_LoadTransposeMatrixfARB(disp, glLoadTransposeMatrixfARB);
-    SET_MultTransposeMatrixdARB(disp, glMultTransposeMatrixdARB);
-    SET_MultTransposeMatrixfARB(disp, glMultTransposeMatrixfARB);
-#endif
-
-#if GL_ARB_vertex_buffer_object
-    SET_BindBufferARB(disp, glBindBufferARB);
-    SET_BufferDataARB(disp, glBufferDataARB);
-    SET_BufferSubDataARB(disp, glBufferSubDataARB);
-    SET_DeleteBuffersARB(disp, glDeleteBuffersARB);
-    SET_GenBuffersARB(disp, glGenBuffersARB);
-    SET_GetBufferParameterivARB(disp, glGetBufferParameterivARB);
-    SET_GetBufferPointervARB(disp, glGetBufferPointervARB);
-    SET_GetBufferSubDataARB(disp, glGetBufferSubDataARB);
-    SET_IsBufferARB(disp, glIsBufferARB);
-    SET_MapBufferARB(disp, glMapBufferARB);
-    SET_UnmapBufferARB(disp, glUnmapBufferARB);
-#endif
-
-#if GL_ARB_vertex_program
-    SET_DisableVertexAttribArrayARB(disp, glDisableVertexAttribArrayARB);
-    SET_EnableVertexAttribArrayARB(disp, glEnableVertexAttribArrayARB);
-    SET_GetProgramEnvParameterdvARB(disp, glGetProgramEnvParameterdvARB);
-    SET_GetProgramEnvParameterfvARB(disp, glGetProgramEnvParameterfvARB);
-    SET_GetProgramLocalParameterdvARB(disp, glGetProgramLocalParameterdvARB);
-    SET_GetProgramLocalParameterfvARB(disp, glGetProgramLocalParameterfvARB);
-    SET_GetProgramStringARB(disp, glGetProgramStringARB);
-    SET_GetProgramivARB(disp, glGetProgramivARB);
-    SET_GetVertexAttribdvARB(disp, glGetVertexAttribdvARB);
-    SET_GetVertexAttribfvARB(disp, glGetVertexAttribfvARB);
-    SET_GetVertexAttribivARB(disp, glGetVertexAttribivARB);
-    SET_ProgramEnvParameter4dARB(disp, glProgramEnvParameter4dARB);
-    SET_ProgramEnvParameter4dvARB(disp, glProgramEnvParameter4dvARB);
-    SET_ProgramEnvParameter4fARB(disp, glProgramEnvParameter4fARB);
-    SET_ProgramEnvParameter4fvARB(disp, glProgramEnvParameter4fvARB);
-    SET_ProgramLocalParameter4dARB(disp, glProgramLocalParameter4dARB);
-    SET_ProgramLocalParameter4dvARB(disp, glProgramLocalParameter4dvARB);
-    SET_ProgramLocalParameter4fARB(disp, glProgramLocalParameter4fARB);
-    SET_ProgramLocalParameter4fvARB(disp, glProgramLocalParameter4fvARB);
-    SET_ProgramStringARB(disp, glProgramStringARB);
-    SET_VertexAttrib1dARB(disp, glVertexAttrib1dARB);
-    SET_VertexAttrib1dvARB(disp, glVertexAttrib1dvARB);
-    SET_VertexAttrib1fARB(disp, glVertexAttrib1fARB);
-    SET_VertexAttrib1fvARB(disp, glVertexAttrib1fvARB);
-    SET_VertexAttrib1sARB(disp, glVertexAttrib1sARB);
-    SET_VertexAttrib1svARB(disp, glVertexAttrib1svARB);
-    SET_VertexAttrib2dARB(disp, glVertexAttrib2dARB);
-    SET_VertexAttrib2dvARB(disp, glVertexAttrib2dvARB);
-    SET_VertexAttrib2fARB(disp, glVertexAttrib2fARB);
-    SET_VertexAttrib2fvARB(disp, glVertexAttrib2fvARB);
-    SET_VertexAttrib2sARB(disp, glVertexAttrib2sARB);
-    SET_VertexAttrib2svARB(disp, glVertexAttrib2svARB);
-    SET_VertexAttrib3dARB(disp, glVertexAttrib3dARB);
-    SET_VertexAttrib3dvARB(disp, glVertexAttrib3dvARB);
-    SET_VertexAttrib3fARB(disp, glVertexAttrib3fARB);
-    SET_VertexAttrib3fvARB(disp, glVertexAttrib3fvARB);
-    SET_VertexAttrib3sARB(disp, glVertexAttrib3sARB);
-    SET_VertexAttrib3svARB(disp, glVertexAttrib3svARB);
-    SET_VertexAttrib4NbvARB(disp, glVertexAttrib4NbvARB);
-    SET_VertexAttrib4NivARB(disp, glVertexAttrib4NivARB);
-    SET_VertexAttrib4NsvARB(disp, glVertexAttrib4NsvARB);
-    SET_VertexAttrib4NubARB(disp, glVertexAttrib4NubARB);
-    SET_VertexAttrib4NubvARB(disp, glVertexAttrib4NubvARB);
-    SET_VertexAttrib4NuivARB(disp, glVertexAttrib4NuivARB);
-    SET_VertexAttrib4NusvARB(disp, glVertexAttrib4NusvARB);
-    SET_VertexAttrib4bvARB(disp, glVertexAttrib4bvARB);
-    SET_VertexAttrib4dARB(disp, glVertexAttrib4dARB);
-    SET_VertexAttrib4dvARB(disp, glVertexAttrib4dvARB);
-    SET_VertexAttrib4fARB(disp, glVertexAttrib4fARB);
-    SET_VertexAttrib4fvARB(disp, glVertexAttrib4fvARB);
-    SET_VertexAttrib4ivARB(disp, glVertexAttrib4ivARB);
-    SET_VertexAttrib4sARB(disp, glVertexAttrib4sARB);
-    SET_VertexAttrib4svARB(disp, glVertexAttrib4svARB);
-    SET_VertexAttrib4ubvARB(disp, glVertexAttrib4ubvARB);
-    SET_VertexAttrib4uivARB(disp, glVertexAttrib4uivARB);
-    SET_VertexAttrib4usvARB(disp, glVertexAttrib4usvARB);
-    SET_VertexAttribPointerARB(disp, glVertexAttribPointerARB);
-#endif
-
-#if GL_ARB_vertex_shader
-    SET_BindAttribLocationARB(disp, glBindAttribLocationARB);
-    SET_GetActiveAttribARB(disp, glGetActiveAttribARB);
-    SET_GetAttribLocationARB(disp, glGetAttribLocationARB);
-#endif
-
-#if GL_ARB_window_pos
-    SET_WindowPos2dMESA(disp, glWindowPos2dARB);
-    SET_WindowPos2dvMESA(disp, glWindowPos2dvARB);
-    SET_WindowPos2fMESA(disp, glWindowPos2fARB);
-    SET_WindowPos2fvMESA(disp, glWindowPos2fvARB);
-    SET_WindowPos2iMESA(disp, glWindowPos2iARB);
-    SET_WindowPos2ivMESA(disp, glWindowPos2ivARB);
-    SET_WindowPos2sMESA(disp, glWindowPos2sARB);
-    SET_WindowPos2svMESA(disp, glWindowPos2svARB);
-    SET_WindowPos3dMESA(disp, glWindowPos3dARB);
-    SET_WindowPos3dvMESA(disp, glWindowPos3dvARB);
-    SET_WindowPos3fMESA(disp, glWindowPos3fARB);
-    SET_WindowPos3fvMESA(disp, glWindowPos3fvARB);
-    SET_WindowPos3iMESA(disp, glWindowPos3iARB);
-    SET_WindowPos3ivMESA(disp, glWindowPos3ivARB);
-    SET_WindowPos3sMESA(disp, glWindowPos3sARB);
-    SET_WindowPos3svMESA(disp, glWindowPos3svARB);
-#endif
-
-#if GL_ATI_fragment_shader
-    SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1ATI);
-    SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2ATI);
-    SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3ATI);
-    SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderATI);
-    SET_BindFragmentShaderATI(disp, glBindFragmentShaderATI);
-    SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1ATI);
-    SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2ATI);
-    SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3ATI);
-    SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderATI);
-    SET_EndFragmentShaderATI(disp, glEndFragmentShaderATI);
-    SET_GenFragmentShadersATI(disp, glGenFragmentShadersATI);
-    SET_PassTexCoordATI(disp, glPassTexCoordATI);
-    SET_SampleMapATI(disp, glSampleMapATI);
-    SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantATI);
-#elif GL_EXT_fragment_shader
-    SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1EXT);
-    SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2EXT);
-    SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3EXT);
-    SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderEXT);
-    SET_BindFragmentShaderATI(disp, glBindFragmentShaderEXT);
-    SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1EXT);
-    SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2EXT);
-    SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3EXT);
-    SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderEXT);
-    SET_EndFragmentShaderATI(disp, glEndFragmentShaderEXT);
-    SET_GenFragmentShadersATI(disp, glGenFragmentShadersEXT);
-    SET_PassTexCoordATI(disp, glPassTexCoordEXT);
-    SET_SampleMapATI(disp, glSampleMapEXT);
-    SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantEXT);
-#endif
-
-#if GL_ATI_separate_stencil
-    SET_StencilFuncSeparateATI(disp, glStencilFuncSeparateATI);
-#endif
-
-#if GL_EXT_blend_equation_separate
-    SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT);
-#endif
-
-#if GL_EXT_blend_func_separate
-    SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT);
-#endif
-
-#if GL_EXT_depth_bounds_test
-    SET_DepthBoundsEXT(disp, glDepthBoundsEXT);
-#endif
-
-#if GL_EXT_compiled_vertex_array
-    SET_LockArraysEXT(disp, glLockArraysEXT);
-    SET_UnlockArraysEXT(disp, glUnlockArraysEXT);
-#endif
-
-#if GL_EXT_cull_vertex
-    SET_CullParameterdvEXT(disp, glCullParameterdvEXT);
-    SET_CullParameterfvEXT(disp, glCullParameterfvEXT);
-#endif
-
-#if GL_EXT_fog_coord
-    SET_FogCoordPointerEXT(disp, glFogCoordPointerEXT);
-    SET_FogCoorddEXT(disp, glFogCoorddEXT);
-    SET_FogCoorddvEXT(disp, glFogCoorddvEXT);
-    SET_FogCoordfEXT(disp, glFogCoordfEXT);
-    SET_FogCoordfvEXT(disp, glFogCoordfvEXT);
-#endif
-
-#if GL_EXT_framebuffer_blit
-    SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT);
-#endif
-
-#if GL_EXT_framebuffer_object
-    SET_BindFramebufferEXT(disp, glBindFramebufferEXT);
-    SET_BindRenderbufferEXT(disp, glBindRenderbufferEXT);
-    SET_CheckFramebufferStatusEXT(disp, glCheckFramebufferStatusEXT);
-    SET_DeleteFramebuffersEXT(disp, glDeleteFramebuffersEXT);
-    SET_DeleteRenderbuffersEXT(disp, glDeleteRenderbuffersEXT);
-    SET_FramebufferRenderbufferEXT(disp, glFramebufferRenderbufferEXT);
-    SET_FramebufferTexture1DEXT(disp, glFramebufferTexture1DEXT);
-    SET_FramebufferTexture2DEXT(disp, glFramebufferTexture2DEXT);
-    SET_FramebufferTexture3DEXT(disp, glFramebufferTexture3DEXT);
-    SET_GenerateMipmapEXT(disp, glGenerateMipmapEXT);
-    SET_GenFramebuffersEXT(disp, glGenFramebuffersEXT);
-    SET_GenRenderbuffersEXT(disp, glGenRenderbuffersEXT);
-    SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT);
-    SET_GetRenderbufferParameterivEXT(disp, glGetRenderbufferParameterivEXT);
-    SET_IsFramebufferEXT(disp, glIsFramebufferEXT);
-    SET_IsRenderbufferEXT(disp, glIsRenderbufferEXT);
-    SET_RenderbufferStorageEXT(disp, glRenderbufferStorageEXT);
-#endif
+    SET_TexImage1D(disp, dlsym(RTLD_DEFAULT, "glTexImage1D"));
+    SET_TexImage2D(disp, dlsym(RTLD_DEFAULT, "glTexImage2D"));
+    SET_TexImage3D(disp, dlsym(RTLD_DEFAULT, "glTexImage3D"));
+    SET_TexParameterf(disp, dlsym(RTLD_DEFAULT, "glTexParameterf"));
+    SET_TexParameterfv(disp, dlsym(RTLD_DEFAULT, "glTexParameterfv"));
+    SET_TexParameteri(disp, dlsym(RTLD_DEFAULT, "glTexParameteri"));
+    SET_TexParameteriv(disp, dlsym(RTLD_DEFAULT, "glTexParameteriv"));
+    SET_TexSubImage1D(disp, dlsym(RTLD_DEFAULT, "glTexSubImage1D"));
+    SET_TexSubImage2D(disp, dlsym(RTLD_DEFAULT, "glTexSubImage2D"));
+    SET_TexSubImage3D(disp, dlsym(RTLD_DEFAULT, "glTexSubImage3D"));
+    SET_Translated(disp, dlsym(RTLD_DEFAULT, "glTranslated"));
+    SET_Translatef(disp, dlsym(RTLD_DEFAULT, "glTranslatef"));
+    SET_Vertex2d(disp, dlsym(RTLD_DEFAULT, "glVertex2d"));
+    SET_Vertex2dv(disp, dlsym(RTLD_DEFAULT, "glVertex2dv"));
+    SET_Vertex2f(disp, dlsym(RTLD_DEFAULT, "glVertex2f"));
+    SET_Vertex2fv(disp, dlsym(RTLD_DEFAULT, "glVertex2fv"));
+    SET_Vertex2i(disp, dlsym(RTLD_DEFAULT, "glVertex2i"));
+    SET_Vertex2iv(disp, dlsym(RTLD_DEFAULT, "glVertex2iv"));
+    SET_Vertex2s(disp, dlsym(RTLD_DEFAULT, "glVertex2s"));
+    SET_Vertex2sv(disp, dlsym(RTLD_DEFAULT, "glVertex2sv"));
+    SET_Vertex3d(disp, dlsym(RTLD_DEFAULT, "glVertex3d"));
+    SET_Vertex3dv(disp, dlsym(RTLD_DEFAULT, "glVertex3dv"));
+    SET_Vertex3f(disp, dlsym(RTLD_DEFAULT, "glVertex3f"));
+    SET_Vertex3fv(disp, dlsym(RTLD_DEFAULT, "glVertex3fv"));
+    SET_Vertex3i(disp, dlsym(RTLD_DEFAULT, "glVertex3i"));
+    SET_Vertex3iv(disp, dlsym(RTLD_DEFAULT, "glVertex3iv"));
+    SET_Vertex3s(disp, dlsym(RTLD_DEFAULT, "glVertex3s"));
+    SET_Vertex3sv(disp, dlsym(RTLD_DEFAULT, "glVertex3sv"));
+    SET_Vertex4d(disp, dlsym(RTLD_DEFAULT, "glVertex4d"));
+    SET_Vertex4dv(disp, dlsym(RTLD_DEFAULT, "glVertex4dv"));
+    SET_Vertex4f(disp, dlsym(RTLD_DEFAULT, "glVertex4f"));
+    SET_Vertex4fv(disp, dlsym(RTLD_DEFAULT, "glVertex4fv"));
+    SET_Vertex4i(disp, dlsym(RTLD_DEFAULT, "glVertex4i"));
+    SET_Vertex4iv(disp, dlsym(RTLD_DEFAULT, "glVertex4iv"));
+    SET_Vertex4s(disp, dlsym(RTLD_DEFAULT, "glVertex4s"));
+    SET_Vertex4sv(disp, dlsym(RTLD_DEFAULT, "glVertex4sv"));
+    SET_VertexPointer(disp, dlsym(RTLD_DEFAULT, "glVertexPointer"));
+    SET_Viewport(disp, dlsym(RTLD_DEFAULT, "glViewport"));
+
+    /* GL_VERSION_2_0 */
+    SET_AttachShader(disp, dlsym(RTLD_DEFAULT, "glAttachShader"));
+    SET_DeleteShader(disp, dlsym(RTLD_DEFAULT, "glDeleteShader"));
+    SET_DetachShader(disp, dlsym(RTLD_DEFAULT, "glDetachShader"));
+    SET_GetAttachedShaders(disp, dlsym(RTLD_DEFAULT, "glGetAttachedShaders"));
+    SET_GetProgramInfoLog(disp, dlsym(RTLD_DEFAULT, "glGetProgramInfoLog"));
+    SET_GetShaderInfoLog(disp, dlsym(RTLD_DEFAULT, "glGetShaderInfoLog"));
+    SET_GetShaderiv(disp, dlsym(RTLD_DEFAULT, "glGetShaderiv"));
+    SET_IsShader(disp, dlsym(RTLD_DEFAULT, "glIsShader"));
+    SET_StencilFuncSeparate(disp, dlsym(RTLD_DEFAULT, "glStencilFuncSeparate"));
+    SET_StencilMaskSeparate(disp, dlsym(RTLD_DEFAULT, "glStencilMaskSeparate"));
+    SET_StencilOpSeparate(disp, dlsym(RTLD_DEFAULT, "glStencilOpSeparate"));
+
+    /* GL_VERSION_2_1 */
+    SET_UniformMatrix2x3fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix2x3fv"));
+    SET_UniformMatrix2x4fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix2x4fv"));
+    SET_UniformMatrix3x2fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix3x2fv"));
+    SET_UniformMatrix3x4fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix3x4fv"));
+    SET_UniformMatrix4x2fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix4x2fv"));
+    SET_UniformMatrix4x3fv(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix4x3fv"));
+
+    /* GL_APPLE_vertex_array_object */
+    SET_BindVertexArrayAPPLE(disp, dlsym(RTLD_DEFAULT, "glBindVertexArrayAPPLE"));
+    SET_DeleteVertexArraysAPPLE(disp, dlsym(RTLD_DEFAULT, "glDeleteVertexArraysAPPLE"));
+    SET_GenVertexArraysAPPLE(disp, dlsym(RTLD_DEFAULT, "glGenVertexArraysAPPLE"));
+    SET_IsVertexArrayAPPLE(disp, dlsym(RTLD_DEFAULT, "glIsVertexArrayAPPLE"));
+
+    /* GL_ARB_draw_buffers */
+    SET_DrawBuffersARB(disp, dlsym(RTLD_DEFAULT, "glDrawBuffersARB"));
+
+    /* GL_ARB_multisample */
+    SET_SampleCoverageARB(disp, dlsym(RTLD_DEFAULT, "glSampleCoverageARB"));
+
+    /* GL_ARB_multitexture */
+    SET_ActiveTextureARB(disp, dlsym(RTLD_DEFAULT, "glActiveTextureARB"));
+    SET_ClientActiveTextureARB(disp, dlsym(RTLD_DEFAULT, "glClientActiveTextureARB"));
+    SET_MultiTexCoord1dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1dARB"));
+    SET_MultiTexCoord1dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1dvARB"));
+    SET_MultiTexCoord1fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1fARB"));
+    SET_MultiTexCoord1fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1fvARB"));
+    SET_MultiTexCoord1iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1iARB"));
+    SET_MultiTexCoord1ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1ivARB"));
+    SET_MultiTexCoord1sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1sARB"));
+    SET_MultiTexCoord1svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord1svARB"));
+    SET_MultiTexCoord2dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2dARB"));
+    SET_MultiTexCoord2dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2dvARB"));
+    SET_MultiTexCoord2fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2fARB"));
+    SET_MultiTexCoord2fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2fvARB"));
+    SET_MultiTexCoord2iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2iARB"));
+    SET_MultiTexCoord2ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2ivARB"));
+    SET_MultiTexCoord2sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2sARB"));
+    SET_MultiTexCoord2svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord2svARB"));
+    SET_MultiTexCoord3dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3dARB"));
+    SET_MultiTexCoord3dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3dvARB"));
+    SET_MultiTexCoord3fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3fARB"));
+    SET_MultiTexCoord3fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3fvARB"));
+    SET_MultiTexCoord3iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3iARB"));
+    SET_MultiTexCoord3ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3ivARB"));
+    SET_MultiTexCoord3sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3sARB"));
+    SET_MultiTexCoord3svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord3svARB"));
+    SET_MultiTexCoord4dARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4dARB"));
+    SET_MultiTexCoord4dvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4dvARB"));
+    SET_MultiTexCoord4fARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4fARB"));
+    SET_MultiTexCoord4fvARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4fvARB"));
+    SET_MultiTexCoord4iARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4iARB"));
+    SET_MultiTexCoord4ivARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4ivARB"));
+    SET_MultiTexCoord4sARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4sARB"));
+    SET_MultiTexCoord4svARB(disp, dlsym(RTLD_DEFAULT, "glMultiTexCoord4svARB"));
+
+    /* GL_ARB_occlusion_query */
+    SET_BeginQueryARB(disp, dlsym(RTLD_DEFAULT, "glBeginQueryARB"));
+    SET_DeleteQueriesARB(disp, dlsym(RTLD_DEFAULT, "glDeleteQueriesARB"));
+    SET_EndQueryARB(disp, dlsym(RTLD_DEFAULT, "glEndQueryARB"));
+    SET_GenQueriesARB(disp, dlsym(RTLD_DEFAULT, "glGenQueriesARB"));
+    SET_GetQueryObjectivARB(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjectivARB"));
+    SET_GetQueryObjectuivARB(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjectuivARB"));
+    SET_GetQueryivARB(disp, dlsym(RTLD_DEFAULT, "glGetQueryivARB"));
+    SET_IsQueryARB(disp, dlsym(RTLD_DEFAULT, "glIsQueryARB"));
+
+    /* GL_ARB_shader_objects */
+    SET_AttachObjectARB(disp, dlsym(RTLD_DEFAULT, "glAttachObjectARB"));
+    SET_CompileShaderARB(disp, dlsym(RTLD_DEFAULT, "glCompileShaderARB"));
+    SET_DeleteObjectARB(disp, dlsym(RTLD_DEFAULT, "glDeleteObjectARB"));
+    SET_GetHandleARB(disp, dlsym(RTLD_DEFAULT, "glGetHandleARB"));
+    SET_DetachObjectARB(disp, dlsym(RTLD_DEFAULT, "glDetachObjectARB"));
+    SET_CreateProgramObjectARB(disp, dlsym(RTLD_DEFAULT, "glCreateProgramObjectARB"));
+    SET_CreateShaderObjectARB(disp, dlsym(RTLD_DEFAULT, "glCreateShaderObjectARB"));
+    SET_GetInfoLogARB(disp, dlsym(RTLD_DEFAULT, "glGetInfoLogARB"));
+    SET_GetActiveUniformARB(disp, dlsym(RTLD_DEFAULT, "glGetActiveUniformARB"));
+    SET_GetAttachedObjectsARB(disp, dlsym(RTLD_DEFAULT, "glGetAttachedObjectsARB"));
+    SET_GetObjectParameterfvARB(disp, dlsym(RTLD_DEFAULT, "glGetObjectParameterfvARB"));
+    SET_GetObjectParameterivARB(disp, dlsym(RTLD_DEFAULT, "glGetObjectParameterivARB"));
+    SET_GetShaderSourceARB(disp, dlsym(RTLD_DEFAULT, "glGetShaderSourceARB"));
+    SET_GetUniformLocationARB(disp, dlsym(RTLD_DEFAULT, "glGetUniformLocationARB"));
+    SET_GetUniformfvARB(disp, dlsym(RTLD_DEFAULT, "glGetUniformfvARB"));
+    SET_GetUniformivARB(disp, dlsym(RTLD_DEFAULT, "glGetUniformivARB"));
+    SET_LinkProgramARB(disp, dlsym(RTLD_DEFAULT, "glLinkProgramARB"));
+    SET_ShaderSourceARB(disp, dlsym(RTLD_DEFAULT, "glShaderSourceARB"));
+    SET_Uniform1fARB(disp, dlsym(RTLD_DEFAULT, "glUniform1fARB"));
+    SET_Uniform1fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform1fvARB"));
+    SET_Uniform1iARB(disp, dlsym(RTLD_DEFAULT, "glUniform1iARB"));
+    SET_Uniform1ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform1ivARB"));
+    SET_Uniform2fARB(disp, dlsym(RTLD_DEFAULT, "glUniform2fARB"));
+    SET_Uniform2fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform2fvARB"));
+    SET_Uniform2iARB(disp, dlsym(RTLD_DEFAULT, "glUniform2iARB"));
+    SET_Uniform2ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform2ivARB"));
+    SET_Uniform3fARB(disp, dlsym(RTLD_DEFAULT, "glUniform3fARB"));
+    SET_Uniform3fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform3fvARB"));
+    SET_Uniform3iARB(disp, dlsym(RTLD_DEFAULT, "glUniform3iARB"));
+    SET_Uniform3ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform3ivARB"));
+    SET_Uniform4fARB(disp, dlsym(RTLD_DEFAULT, "glUniform4fARB"));
+    SET_Uniform4fvARB(disp, dlsym(RTLD_DEFAULT, "glUniform4fvARB"));
+    SET_Uniform4iARB(disp, dlsym(RTLD_DEFAULT, "glUniform4iARB"));
+    SET_Uniform4ivARB(disp, dlsym(RTLD_DEFAULT, "glUniform4ivARB"));
+    SET_UniformMatrix2fvARB(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix2fvARB"));
+    SET_UniformMatrix3fvARB(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix3fvARB"));
+    SET_UniformMatrix4fvARB(disp, dlsym(RTLD_DEFAULT, "glUniformMatrix4fvARB"));
+    SET_UseProgramObjectARB(disp, dlsym(RTLD_DEFAULT, "glUseProgramObjectARB"));
+    SET_ValidateProgramARB(disp, dlsym(RTLD_DEFAULT, "glValidateProgramARB"));
+
+    /* GL_ARB_texture_compression */
+    SET_CompressedTexImage1DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexImage1DARB"));
+    SET_CompressedTexImage2DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexImage2DARB"));
+    SET_CompressedTexImage3DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexImage3DARB"));
+    SET_CompressedTexSubImage1DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexSubImage1DARB"));
+    SET_CompressedTexSubImage2DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexSubImage2DARB"));
+    SET_CompressedTexSubImage3DARB(disp, dlsym(RTLD_DEFAULT, "glCompressedTexSubImage3DARB"));
+    SET_GetCompressedTexImageARB(disp, dlsym(RTLD_DEFAULT, "glGetCompressedTexImageARB"));
+
+    /* GL_ARB_transpose_matrix */
+    SET_LoadTransposeMatrixdARB(disp, dlsym(RTLD_DEFAULT, "glLoadTransposeMatrixdARB"));
+    SET_LoadTransposeMatrixfARB(disp, dlsym(RTLD_DEFAULT, "glLoadTransposeMatrixfARB"));
+    SET_MultTransposeMatrixdARB(disp, dlsym(RTLD_DEFAULT, "glMultTransposeMatrixdARB"));
+    SET_MultTransposeMatrixfARB(disp, dlsym(RTLD_DEFAULT, "glMultTransposeMatrixfARB"));
+
+    /* GL_ARB_vertex_buffer_object */
+    SET_BindBufferARB(disp, dlsym(RTLD_DEFAULT, "glBindBufferARB"));
+    SET_BufferDataARB(disp, dlsym(RTLD_DEFAULT, "glBufferDataARB"));
+    SET_BufferSubDataARB(disp, dlsym(RTLD_DEFAULT, "glBufferSubDataARB"));
+    SET_DeleteBuffersARB(disp, dlsym(RTLD_DEFAULT, "glDeleteBuffersARB"));
+    SET_GenBuffersARB(disp, dlsym(RTLD_DEFAULT, "glGenBuffersARB"));
+    SET_GetBufferParameterivARB(disp, dlsym(RTLD_DEFAULT, "glGetBufferParameterivARB"));
+    SET_GetBufferPointervARB(disp, dlsym(RTLD_DEFAULT, "glGetBufferPointervARB"));
+    SET_GetBufferSubDataARB(disp, dlsym(RTLD_DEFAULT, "glGetBufferSubDataARB"));
+    SET_IsBufferARB(disp, dlsym(RTLD_DEFAULT, "glIsBufferARB"));
+    SET_MapBufferARB(disp, dlsym(RTLD_DEFAULT, "glMapBufferARB"));
+    SET_UnmapBufferARB(disp, dlsym(RTLD_DEFAULT, "glUnmapBufferARB"));
+
+    /* GL_ARB_vertex_program */
+    SET_DisableVertexAttribArrayARB(disp, dlsym(RTLD_DEFAULT, "glDisableVertexAttribArrayARB"));
+    SET_EnableVertexAttribArrayARB(disp, dlsym(RTLD_DEFAULT, "glEnableVertexAttribArrayARB"));
+    SET_GetProgramEnvParameterdvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramEnvParameterdvARB"));
+    SET_GetProgramEnvParameterfvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramEnvParameterfvARB"));
+    SET_GetProgramLocalParameterdvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramLocalParameterdvARB"));
+    SET_GetProgramLocalParameterfvARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramLocalParameterfvARB"));
+    SET_GetProgramStringARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramStringARB"));
+    SET_GetProgramivARB(disp, dlsym(RTLD_DEFAULT, "glGetProgramivARB"));
+    SET_GetVertexAttribdvARB(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribdvARB"));
+    SET_GetVertexAttribfvARB(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribfvARB"));
+    SET_GetVertexAttribivARB(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribivARB"));
+    SET_ProgramEnvParameter4dARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4dARB"));
+    SET_ProgramEnvParameter4dvARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4dvARB"));
+    SET_ProgramEnvParameter4fARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4fARB"));
+    SET_ProgramEnvParameter4fvARB(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameter4fvARB"));
+    SET_ProgramLocalParameter4dARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4dARB"));
+    SET_ProgramLocalParameter4dvARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4dvARB"));
+    SET_ProgramLocalParameter4fARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4fARB"));
+    SET_ProgramLocalParameter4fvARB(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameter4fvARB"));
+    SET_ProgramStringARB(disp, dlsym(RTLD_DEFAULT, "glProgramStringARB"));
+    SET_VertexAttrib1dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dARB"));
+    SET_VertexAttrib1dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dvARB"));
+    SET_VertexAttrib1fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fARB"));
+    SET_VertexAttrib1fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fvARB"));
+    SET_VertexAttrib1sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1sARB"));
+    SET_VertexAttrib1svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1svARB"));
+    SET_VertexAttrib2dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dARB"));
+    SET_VertexAttrib2dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dvARB"));
+    SET_VertexAttrib2fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fARB"));
+    SET_VertexAttrib2fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fvARB"));
+    SET_VertexAttrib2sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2sARB"));
+    SET_VertexAttrib2svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2svARB"));
+    SET_VertexAttrib3dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dARB"));
+    SET_VertexAttrib3dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dvARB"));
+    SET_VertexAttrib3fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fARB"));
+    SET_VertexAttrib3fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fvARB"));
+    SET_VertexAttrib3sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3sARB"));
+    SET_VertexAttrib3svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3svARB"));
+    SET_VertexAttrib4NbvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NbvARB"));
+    SET_VertexAttrib4NivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NivARB"));
+    SET_VertexAttrib4NsvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NsvARB"));
+    SET_VertexAttrib4NubARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NubARB"));
+    SET_VertexAttrib4NubvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NubvARB"));
+    SET_VertexAttrib4NuivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NuivARB"));
+    SET_VertexAttrib4NusvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4NusvARB"));
+    SET_VertexAttrib4bvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4bvARB"));
+    SET_VertexAttrib4dARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dARB"));
+    SET_VertexAttrib4dvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dvARB"));
+    SET_VertexAttrib4fARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fARB"));
+    SET_VertexAttrib4fvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fvARB"));
+    SET_VertexAttrib4ivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ivARB"));
+    SET_VertexAttrib4sARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4sARB"));
+    SET_VertexAttrib4svARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4svARB"));
+    SET_VertexAttrib4ubvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ubvARB"));
+    SET_VertexAttrib4uivARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4uivARB"));
+    SET_VertexAttrib4usvARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4usvARB"));
+    SET_VertexAttribPointerARB(disp, dlsym(RTLD_DEFAULT, "glVertexAttribPointerARB"));
+
+    /* GL_ARB_vertex_shader */
+    SET_BindAttribLocationARB(disp, dlsym(RTLD_DEFAULT, "glBindAttribLocationARB"));
+    SET_GetActiveAttribARB(disp, dlsym(RTLD_DEFAULT, "glGetActiveAttribARB"));
+    SET_GetAttribLocationARB(disp, dlsym(RTLD_DEFAULT, "glGetAttribLocationARB"));
+
+    /* GL_ARB_window_pos */
+    SET_WindowPos2dMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2dARB"));
+    SET_WindowPos2dvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2dvARB"));
+    SET_WindowPos2fMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2fARB"));
+    SET_WindowPos2fvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2fvARB"));
+    SET_WindowPos2iMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2iARB"));
+    SET_WindowPos2ivMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2ivARB"));
+    SET_WindowPos2sMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2sARB"));
+    SET_WindowPos2svMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos2svARB"));
+    SET_WindowPos3dMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3dARB"));
+    SET_WindowPos3dvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3dvARB"));
+    SET_WindowPos3fMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3fARB"));
+    SET_WindowPos3fvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3fvARB"));
+    SET_WindowPos3iMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3iARB"));
+    SET_WindowPos3ivMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3ivARB"));
+    SET_WindowPos3sMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3sARB"));
+    SET_WindowPos3svMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos3svARB"));
+
+    /* GL_ATI_fragment_shader / GL_EXT_fragment_shader */
+    if(dlsym(RTLD_DEFAULT, "glAlphaFragmentOp1ATI")) {
+        /* GL_ATI_fragment_shader */
+        SET_AlphaFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp1ATI"));
+        SET_AlphaFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp2ATI"));
+        SET_AlphaFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp3ATI"));
+        SET_BeginFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBeginFragmentShaderATI"));
+        SET_BindFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBindFragmentShaderATI"));
+        SET_ColorFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp1ATI"));
+        SET_ColorFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp2ATI"));
+        SET_ColorFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp3ATI"));
+        SET_DeleteFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glDeleteFragmentShaderATI"));
+        SET_EndFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glEndFragmentShaderATI"));
+        SET_GenFragmentShadersATI(disp, dlsym(RTLD_DEFAULT, "glGenFragmentShadersATI"));
+        SET_PassTexCoordATI(disp, dlsym(RTLD_DEFAULT, "glPassTexCoordATI"));
+        SET_SampleMapATI(disp, dlsym(RTLD_DEFAULT, "glSampleMapATI"));
+        SET_SetFragmentShaderConstantATI(disp, dlsym(RTLD_DEFAULT, "glSetFragmentShaderConstantATI"));
+    } else {
+        /* GL_EXT_fragment_shader */
+        SET_AlphaFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp1EXT"));
+        SET_AlphaFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp2EXT"));
+        SET_AlphaFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glAlphaFragmentOp3EXT"));
+        SET_BeginFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBeginFragmentShaderEXT"));
+        SET_BindFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glBindFragmentShaderEXT"));
+        SET_ColorFragmentOp1ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp1EXT"));
+        SET_ColorFragmentOp2ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp2EXT"));
+        SET_ColorFragmentOp3ATI(disp, dlsym(RTLD_DEFAULT, "glColorFragmentOp3EXT"));
+        SET_DeleteFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glDeleteFragmentShaderEXT"));
+        SET_EndFragmentShaderATI(disp, dlsym(RTLD_DEFAULT, "glEndFragmentShaderEXT"));
+        SET_GenFragmentShadersATI(disp, dlsym(RTLD_DEFAULT, "glGenFragmentShadersEXT"));
+        SET_PassTexCoordATI(disp, dlsym(RTLD_DEFAULT, "glPassTexCoordEXT"));
+        SET_SampleMapATI(disp, dlsym(RTLD_DEFAULT, "glSampleMapEXT"));
+        SET_SetFragmentShaderConstantATI(disp, dlsym(RTLD_DEFAULT, "glSetFragmentShaderConstantEXT"));
+    }
 
-#if GL_EXT_gpu_program_parameters
-    SET_ProgramEnvParameters4fvEXT(disp, glProgramEnvParameters4fvEXT);
-    SET_ProgramLocalParameters4fvEXT(disp, glProgramLocalParameters4fvEXT);
-#endif
+    /* GL_ATI_separate_stencil */
+    SET_StencilFuncSeparateATI(disp, dlsym(RTLD_DEFAULT, "glStencilFuncSeparateATI"));
+
+    /* GL_EXT_blend_equation_separate */
+    SET_BlendEquationSeparateEXT(disp, dlsym(RTLD_DEFAULT, "glBlendEquationSeparateEXT"));
+
+    /* GL_EXT_blend_func_separate */
+    SET_BlendFuncSeparateEXT(disp, dlsym(RTLD_DEFAULT, "glBlendFuncSeparateEXT"));
+
+    /* GL_EXT_depth_bounds_test */
+    SET_DepthBoundsEXT(disp, dlsym(RTLD_DEFAULT, "glDepthBoundsEXT"));
+
+    /* GL_EXT_compiled_vertex_array */
+    SET_LockArraysEXT(disp, dlsym(RTLD_DEFAULT, "glLockArraysEXT"));
+    SET_UnlockArraysEXT(disp, dlsym(RTLD_DEFAULT, "glUnlockArraysEXT"));
+
+    /* GL_EXT_cull_vertex */
+    SET_CullParameterdvEXT(disp, dlsym(RTLD_DEFAULT, "glCullParameterdvEXT"));
+    SET_CullParameterfvEXT(disp, dlsym(RTLD_DEFAULT, "glCullParameterfvEXT"));
+
+    /* GL_EXT_fog_coord */
+    SET_FogCoordPointerEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoordPointerEXT"));
+    SET_FogCoorddEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoorddEXT"));
+    SET_FogCoorddvEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoorddvEXT"));
+    SET_FogCoordfEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoordfEXT"));
+    SET_FogCoordfvEXT(disp, dlsym(RTLD_DEFAULT, "glFogCoordfvEXT"));
+
+    /* GL_EXT_framebuffer_blit */
+    SET_BlitFramebufferEXT(disp, dlsym(RTLD_DEFAULT, "glBlitFramebufferEXT"));
+
+    /* GL_EXT_framebuffer_object */
+    SET_BindFramebufferEXT(disp, dlsym(RTLD_DEFAULT, "glBindFramebufferEXT"));
+    SET_BindRenderbufferEXT(disp, dlsym(RTLD_DEFAULT, "glBindRenderbufferEXT"));
+    SET_CheckFramebufferStatusEXT(disp, dlsym(RTLD_DEFAULT, "glCheckFramebufferStatusEXT"));
+    SET_DeleteFramebuffersEXT(disp, dlsym(RTLD_DEFAULT, "glDeleteFramebuffersEXT"));
+    SET_DeleteRenderbuffersEXT(disp, dlsym(RTLD_DEFAULT, "glDeleteRenderbuffersEXT"));
+    SET_FramebufferRenderbufferEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferRenderbufferEXT"));
+    SET_FramebufferTexture1DEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTexture1DEXT"));
+    SET_FramebufferTexture2DEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTexture2DEXT"));
+    SET_FramebufferTexture3DEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTexture3DEXT"));
+    SET_GenerateMipmapEXT(disp, dlsym(RTLD_DEFAULT, "glGenerateMipmapEXT"));
+    SET_GenFramebuffersEXT(disp, dlsym(RTLD_DEFAULT, "glGenFramebuffersEXT"));
+    SET_GenRenderbuffersEXT(disp, dlsym(RTLD_DEFAULT, "glGenRenderbuffersEXT"));
+    SET_GetFramebufferAttachmentParameterivEXT(disp, dlsym(RTLD_DEFAULT, "glGetFramebufferAttachmentParameterivEXT"));
+    SET_GetRenderbufferParameterivEXT(disp, dlsym(RTLD_DEFAULT, "glGetRenderbufferParameterivEXT"));
+    SET_IsFramebufferEXT(disp, dlsym(RTLD_DEFAULT, "glIsFramebufferEXT"));
+    SET_IsRenderbufferEXT(disp, dlsym(RTLD_DEFAULT, "glIsRenderbufferEXT"));
+    SET_RenderbufferStorageEXT(disp, dlsym(RTLD_DEFAULT, "glRenderbufferStorageEXT"));
+
+    /* GL_EXT_gpu_program_parameters */
+    SET_ProgramEnvParameters4fvEXT(disp, dlsym(RTLD_DEFAULT, "glProgramEnvParameters4fvEXT"));
+    SET_ProgramLocalParameters4fvEXT(disp, dlsym(RTLD_DEFAULT, "glProgramLocalParameters4fvEXT"));
 
-#if GL_EXT_multi_draw_arrays
     /* Pointer Incompatability:
      * This warning can be safely ignored.  OpenGL.framework adds const to the
      * two pointers.
@@ -1414,206 +1311,193 @@ static void setup_dispatch_table(void) {
      *
      * void ( * MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
      */
-    SET_MultiDrawArraysEXT(disp, (void *)glMultiDrawArraysEXT);
-    SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT);
-#endif
-
-#if GL_EXT_point_parameters
-    SET_PointParameterfEXT(disp, glPointParameterfEXT);
-    SET_PointParameterfvEXT(disp, glPointParameterfvEXT);
-#elif GL_ARB_point_parameters
-    SET_PointParameterfEXT(disp, glPointParameterfARB);
-    SET_PointParameterfvEXT(disp, glPointParameterfvARB);
-#endif
-
-#if GL_EXT_polygon_offset
-    SET_PolygonOffsetEXT(disp, glPolygonOffsetEXT);
-#endif
 
-#if GL_EXT_secondary_color
-    SET_SecondaryColor3bEXT(disp, glSecondaryColor3bEXT);
-    SET_SecondaryColor3bvEXT(disp, glSecondaryColor3bvEXT);
-    SET_SecondaryColor3dEXT(disp, glSecondaryColor3dEXT);
-    SET_SecondaryColor3dvEXT(disp, glSecondaryColor3dvEXT);
-    SET_SecondaryColor3fEXT(disp, glSecondaryColor3fEXT);
-    SET_SecondaryColor3fvEXT(disp, glSecondaryColor3fvEXT);
-    SET_SecondaryColor3iEXT(disp, glSecondaryColor3iEXT);
-    SET_SecondaryColor3ivEXT(disp, glSecondaryColor3ivEXT);
-    SET_SecondaryColor3sEXT(disp, glSecondaryColor3sEXT);
-    SET_SecondaryColor3svEXT(disp, glSecondaryColor3svEXT);
-    SET_SecondaryColor3ubEXT(disp, glSecondaryColor3ubEXT);
-    SET_SecondaryColor3ubvEXT(disp, glSecondaryColor3ubvEXT);
-    SET_SecondaryColor3uiEXT(disp, glSecondaryColor3uiEXT);
-    SET_SecondaryColor3uivEXT(disp, glSecondaryColor3uivEXT);
-    SET_SecondaryColor3usEXT(disp, glSecondaryColor3usEXT);
-    SET_SecondaryColor3usvEXT(disp, glSecondaryColor3usvEXT);
-    SET_SecondaryColorPointerEXT(disp, glSecondaryColorPointerEXT);
-#endif
-
-#if GL_EXT_stencil_two_side
-    SET_ActiveStencilFaceEXT(disp, glActiveStencilFaceEXT);
-#endif
-
-#if GL_EXT_timer_query
-    SET_GetQueryObjecti64vEXT(disp, glGetQueryObjecti64vEXT);
-    SET_GetQueryObjectui64vEXT(disp, glGetQueryObjectui64vEXT);
-#endif
-
-#if GL_EXT_vertex_array
-    SET_ColorPointerEXT(disp, glColorPointerEXT);
-    SET_EdgeFlagPointerEXT(disp, glEdgeFlagPointerEXT);
-    SET_IndexPointerEXT(disp, glIndexPointerEXT);
-    SET_NormalPointerEXT(disp, glNormalPointerEXT);
-    SET_TexCoordPointerEXT(disp, glTexCoordPointerEXT);
-    SET_VertexPointerEXT(disp, glVertexPointerEXT);
-#endif
-
-#if GL_IBM_multimode_draw_arrays
-    SET_MultiModeDrawArraysIBM(disp, glMultiModeDrawArraysIBM);
-    SET_MultiModeDrawElementsIBM(disp, glMultiModeDrawElementsIBM);
-#endif
-
-#if GL_MESA_resize_buffers
-    SET_ResizeBuffersMESA(disp, glResizeBuffersMESA);
-#endif
-
-#if GL_MESA_window_pos
-    SET_WindowPos4dMESA(disp, glWindowPos4dMESA);
-    SET_WindowPos4dvMESA(disp, glWindowPos4dvMESA);
-    SET_WindowPos4fMESA(disp, glWindowPos4fMESA);
-    SET_WindowPos4fvMESA(disp, glWindowPos4fvMESA);
-    SET_WindowPos4iMESA(disp, glWindowPos4iMESA);
-    SET_WindowPos4ivMESA(disp, glWindowPos4ivMESA);
-    SET_WindowPos4sMESA(disp, glWindowPos4sMESA);
-    SET_WindowPos4svMESA(disp, glWindowPos4svMESA);
-#endif
-
-#if GL_NV_fence
-    SET_DeleteFencesNV(disp, glDeleteFencesNV);
-    SET_FinishFenceNV(disp, glFinishFenceNV);
-    SET_GenFencesNV(disp, glGenFencesNV);
-    SET_GetFenceivNV(disp, glGetFenceivNV);
-    SET_IsFenceNV(disp, glIsFenceNV);
-    SET_SetFenceNV(disp, glSetFenceNV);
-    SET_TestFenceNV(disp, glTestFenceNV);
-#endif
-
-#if GL_NV_fragment_program
-    SET_GetProgramNamedParameterdvNV(disp, glGetProgramNamedParameterdvNV);
-    SET_GetProgramNamedParameterfvNV(disp, glGetProgramNamedParameterfvNV);
-    SET_ProgramNamedParameter4dNV(disp, glProgramNamedParameter4dNV);
-    SET_ProgramNamedParameter4dvNV(disp, glProgramNamedParameter4dvNV);
-    SET_ProgramNamedParameter4fNV(disp, glProgramNamedParameter4fNV);
-    SET_ProgramNamedParameter4fvNV(disp, glProgramNamedParameter4fvNV);
-#endif
-
-#if GL_NV_geometry_program4
-    SET_FramebufferTextureLayerEXT(disp, glFramebufferTextureLayerEXT);
-#endif
-
-#if GL_NV_point_sprite
-    SET_PointParameteriNV(disp, glPointParameteriNV);
-    SET_PointParameterivNV(disp, glPointParameterivNV);
-#endif
-
-#if GL_NV_register_combiners
-    SET_CombinerInputNV(disp, glCombinerInputNV);
-    SET_CombinerOutputNV(disp, glCombinerOutputNV);
-    SET_CombinerParameterfNV(disp, glCombinerParameterfNV);
-    SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV);
-    SET_CombinerParameteriNV(disp, glCombinerParameteriNV);
-    SET_CombinerParameterivNV(disp, glCombinerParameterivNV);
-    SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV);
-    SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV);
-    SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV);
-    SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV);
-    SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV);
-    SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV);
-    SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV);
-#endif
-
-#if GL_NV_vertex_array_range
-    SET_FlushVertexArrayRangeNV(disp, glFlushVertexArrayRangeNV);
-    SET_VertexArrayRangeNV(disp, glVertexArrayRangeNV);
-#endif
-
-#if GL_NV_vertex_program
-    SET_AreProgramsResidentNV(disp, glAreProgramsResidentNV);
-    SET_BindProgramNV(disp, glBindProgramNV);
-    SET_DeleteProgramsNV(disp, glDeleteProgramsNV);
-    SET_ExecuteProgramNV(disp, glExecuteProgramNV);
-    SET_GenProgramsNV(disp, glGenProgramsNV);
-    SET_GetProgramParameterdvNV(disp, glGetProgramParameterdvNV);
-    SET_GetProgramParameterfvNV(disp, glGetProgramParameterfvNV);
-    SET_GetProgramStringNV(disp, glGetProgramStringNV);
-    SET_GetProgramivNV(disp, glGetProgramivNV);
-    SET_GetTrackMatrixivNV(disp, glGetTrackMatrixivNV);
-    SET_GetVertexAttribPointervNV(disp, glGetVertexAttribPointervNV);
-    SET_GetVertexAttribdvNV(disp, glGetVertexAttribdvNV);
-    SET_GetVertexAttribfvNV(disp, glGetVertexAttribfvNV);
-    SET_GetVertexAttribivNV(disp, glGetVertexAttribivNV);
-    SET_IsProgramNV(disp, glIsProgramNV);
-    SET_LoadProgramNV(disp, glLoadProgramNV);
-    SET_ProgramParameters4dvNV(disp, glProgramParameters4dvNV);
-    SET_ProgramParameters4fvNV(disp, glProgramParameters4fvNV);
-    SET_RequestResidentProgramsNV(disp, glRequestResidentProgramsNV);
-    SET_TrackMatrixNV(disp, glTrackMatrixNV);
-    SET_VertexAttrib1dNV(disp, glVertexAttrib1dNV)
-    SET_VertexAttrib1dvNV(disp, glVertexAttrib1dvNV)
-    SET_VertexAttrib1fNV(disp, glVertexAttrib1fNV)
-    SET_VertexAttrib1fvNV(disp, glVertexAttrib1fvNV)
-    SET_VertexAttrib1sNV(disp, glVertexAttrib1sNV)
-    SET_VertexAttrib1svNV(disp, glVertexAttrib1svNV)
-    SET_VertexAttrib2dNV(disp, glVertexAttrib2dNV)
-    SET_VertexAttrib2dvNV(disp, glVertexAttrib2dvNV)
-    SET_VertexAttrib2fNV(disp, glVertexAttrib2fNV)
-    SET_VertexAttrib2fvNV(disp, glVertexAttrib2fvNV)
-    SET_VertexAttrib2sNV(disp, glVertexAttrib2sNV)
-    SET_VertexAttrib2svNV(disp, glVertexAttrib2svNV)
-    SET_VertexAttrib3dNV(disp, glVertexAttrib3dNV)
-    SET_VertexAttrib3dvNV(disp, glVertexAttrib3dvNV)
-    SET_VertexAttrib3fNV(disp, glVertexAttrib3fNV)
-    SET_VertexAttrib3fvNV(disp, glVertexAttrib3fvNV)
-    SET_VertexAttrib3sNV(disp, glVertexAttrib3sNV)
-    SET_VertexAttrib3svNV(disp, glVertexAttrib3svNV)
-    SET_VertexAttrib4dNV(disp, glVertexAttrib4dNV)
-    SET_VertexAttrib4dvNV(disp, glVertexAttrib4dvNV)
-    SET_VertexAttrib4fNV(disp, glVertexAttrib4fNV)
-    SET_VertexAttrib4fvNV(disp, glVertexAttrib4fvNV)
-    SET_VertexAttrib4sNV(disp, glVertexAttrib4sNV)
-    SET_VertexAttrib4svNV(disp, glVertexAttrib4svNV)
-    SET_VertexAttrib4ubNV(disp, glVertexAttrib4ubNV)
-    SET_VertexAttrib4ubvNV(disp, glVertexAttrib4ubvNV)
-    SET_VertexAttribPointerNV(disp, glVertexAttribPointerNV)
-    SET_VertexAttribs1dvNV(disp, glVertexAttribs1dvNV)
-    SET_VertexAttribs1fvNV(disp, glVertexAttribs1fvNV)
-    SET_VertexAttribs1svNV(disp, glVertexAttribs1svNV)
-    SET_VertexAttribs2dvNV(disp, glVertexAttribs2dvNV)
-    SET_VertexAttribs2fvNV(disp, glVertexAttribs2fvNV)
-    SET_VertexAttribs2svNV(disp, glVertexAttribs2svNV)
-    SET_VertexAttribs3dvNV(disp, glVertexAttribs3dvNV)
-    SET_VertexAttribs3fvNV(disp, glVertexAttribs3fvNV)
-    SET_VertexAttribs3svNV(disp, glVertexAttribs3svNV)
-    SET_VertexAttribs4dvNV(disp, glVertexAttribs4dvNV)
-    SET_VertexAttribs4fvNV(disp, glVertexAttribs4fvNV)
-    SET_VertexAttribs4svNV(disp, glVertexAttribs4svNV)
-    SET_VertexAttribs4ubvNV(disp, glVertexAttribs4ubvNV)
-#endif
-
-#if GL_SGIS_multisample
-    SET_SampleMaskSGIS(disp, glSampleMaskSGIS);
-    SET_SamplePatternSGIS(disp, glSamplePatternSGIS);
-#endif
+    /* GL_EXT_multi_draw_arrays */
+    SET_MultiDrawArraysEXT(disp, (void *)dlsym(RTLD_DEFAULT, "glMultiDrawArraysEXT"));
+    SET_MultiDrawElementsEXT(disp, dlsym(RTLD_DEFAULT, "glMultiDrawElementsEXT"));
+
+    /* GL_EXT_point_parameters / GL_ARB_point_parameters */
+    if(dlsym(RTLD_DEFAULT, "glPointParameterfEXT")) {
+        /* GL_EXT_point_parameters */
+        SET_PointParameterfEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfEXT"));
+        SET_PointParameterfvEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfvEXT"));
+    } else {
+        /* GL_ARB_point_parameters */
+        SET_PointParameterfEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfARB"));
+        SET_PointParameterfvEXT(disp, dlsym(RTLD_DEFAULT, "glPointParameterfvARB"));
+    }
 
-#if GL_SGIS_pixel_texture
-    SET_GetPixelTexGenParameterfvSGIS(disp, glGetPixelTexGenParameterfvSGIS);
-    SET_GetPixelTexGenParameterivSGIS(disp, glGetPixelTexGenParameterivSGIS);
-    SET_PixelTexGenParameterfSGIS(disp, glPixelTexGenParameterfSGIS);
-    SET_PixelTexGenParameterfvSGIS(disp, glPixelTexGenParameterfvSGIS);
-    SET_PixelTexGenParameteriSGIS(disp, glPixelTexGenParameteriSGIS);
-    SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS);
-    SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX);
-#endif
+    /* GL_EXT_polygon_offset */
+    SET_PolygonOffsetEXT(disp, dlsym(RTLD_DEFAULT, "glPolygonOffsetEXT"));
+
+    /* GL_EXT_secondary_color */
+    SET_SecondaryColor3bEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3bEXT"));
+    SET_SecondaryColor3bvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3bvEXT"));
+    SET_SecondaryColor3dEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3dEXT"));
+    SET_SecondaryColor3dvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3dvEXT"));
+    SET_SecondaryColor3fEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3fEXT"));
+    SET_SecondaryColor3fvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3fvEXT"));
+    SET_SecondaryColor3iEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3iEXT"));
+    SET_SecondaryColor3ivEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3ivEXT"));
+    SET_SecondaryColor3sEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3sEXT"));
+    SET_SecondaryColor3svEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3svEXT"));
+    SET_SecondaryColor3ubEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3ubEXT"));
+    SET_SecondaryColor3ubvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3ubvEXT"));
+    SET_SecondaryColor3uiEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3uiEXT"));
+    SET_SecondaryColor3uivEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3uivEXT"));
+    SET_SecondaryColor3usEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3usEXT"));
+    SET_SecondaryColor3usvEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColor3usvEXT"));
+    SET_SecondaryColorPointerEXT(disp, dlsym(RTLD_DEFAULT, "glSecondaryColorPointerEXT"));
+
+    /* GL_EXT_stencil_two_side */
+    SET_ActiveStencilFaceEXT(disp, dlsym(RTLD_DEFAULT, "glActiveStencilFaceEXT"));
+
+    /* GL_EXT_timer_query */
+    SET_GetQueryObjecti64vEXT(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjecti64vEXT"));
+    SET_GetQueryObjectui64vEXT(disp, dlsym(RTLD_DEFAULT, "glGetQueryObjectui64vEXT"));
+
+    /* GL_EXT_vertex_array */
+    SET_ColorPointerEXT(disp, dlsym(RTLD_DEFAULT, "glColorPointerEXT"));
+    SET_EdgeFlagPointerEXT(disp, dlsym(RTLD_DEFAULT, "glEdgeFlagPointerEXT"));
+    SET_IndexPointerEXT(disp, dlsym(RTLD_DEFAULT, "glIndexPointerEXT"));
+    SET_NormalPointerEXT(disp, dlsym(RTLD_DEFAULT, "glNormalPointerEXT"));
+    SET_TexCoordPointerEXT(disp, dlsym(RTLD_DEFAULT, "glTexCoordPointerEXT"));
+    SET_VertexPointerEXT(disp, dlsym(RTLD_DEFAULT, "glVertexPointerEXT"));
+
+    /* GL_IBM_multimode_draw_arrays */
+    SET_MultiModeDrawArraysIBM(disp, dlsym(RTLD_DEFAULT, "glMultiModeDrawArraysIBM"));
+    SET_MultiModeDrawElementsIBM(disp, dlsym(RTLD_DEFAULT, "glMultiModeDrawElementsIBM"));
+
+    /* GL_MESA_resize_buffers */
+    SET_ResizeBuffersMESA(disp, dlsym(RTLD_DEFAULT, "glResizeBuffersMESA"));
+
+    /* GL_MESA_window_pos */
+    SET_WindowPos4dMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4dMESA"));
+    SET_WindowPos4dvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4dvMESA"));
+    SET_WindowPos4fMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4fMESA"));
+    SET_WindowPos4fvMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4fvMESA"));
+    SET_WindowPos4iMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4iMESA"));
+    SET_WindowPos4ivMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4ivMESA"));
+    SET_WindowPos4sMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4sMESA"));
+    SET_WindowPos4svMESA(disp, dlsym(RTLD_DEFAULT, "glWindowPos4svMESA"));
+
+    /* GL_NV_fence */
+    SET_DeleteFencesNV(disp, dlsym(RTLD_DEFAULT, "glDeleteFencesNV"));
+    SET_FinishFenceNV(disp, dlsym(RTLD_DEFAULT, "glFinishFenceNV"));
+    SET_GenFencesNV(disp, dlsym(RTLD_DEFAULT, "glGenFencesNV"));
+    SET_GetFenceivNV(disp, dlsym(RTLD_DEFAULT, "glGetFenceivNV"));
+    SET_IsFenceNV(disp, dlsym(RTLD_DEFAULT, "glIsFenceNV"));
+    SET_SetFenceNV(disp, dlsym(RTLD_DEFAULT, "glSetFenceNV"));
+    SET_TestFenceNV(disp, dlsym(RTLD_DEFAULT, "glTestFenceNV"));
+
+    /* GL_NV_fragment_program */
+    SET_GetProgramNamedParameterdvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramNamedParameterdvNV"));
+    SET_GetProgramNamedParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramNamedParameterfvNV"));
+    SET_ProgramNamedParameter4dNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4dNV"));
+    SET_ProgramNamedParameter4dvNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4dvNV"));
+    SET_ProgramNamedParameter4fNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4fNV"));
+    SET_ProgramNamedParameter4fvNV(disp, dlsym(RTLD_DEFAULT, "glProgramNamedParameter4fvNV"));
+
+    /* GL_NV_geometry_program4 */
+    SET_FramebufferTextureLayerEXT(disp, dlsym(RTLD_DEFAULT, "glFramebufferTextureLayerEXT"));
+
+    /* GL_NV_point_sprite */
+    SET_PointParameteriNV(disp, dlsym(RTLD_DEFAULT, "glPointParameteriNV"));
+    SET_PointParameterivNV(disp, dlsym(RTLD_DEFAULT, "glPointParameterivNV"));
+
+    /* GL_NV_register_combiners */
+    SET_CombinerInputNV(disp, dlsym(RTLD_DEFAULT, "glCombinerInputNV"));
+    SET_CombinerOutputNV(disp, dlsym(RTLD_DEFAULT, "glCombinerOutputNV"));
+    SET_CombinerParameterfNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameterfNV"));
+    SET_CombinerParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameterfvNV"));
+    SET_CombinerParameteriNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameteriNV"));
+    SET_CombinerParameterivNV(disp, dlsym(RTLD_DEFAULT, "glCombinerParameterivNV"));
+    SET_FinalCombinerInputNV(disp, dlsym(RTLD_DEFAULT, "glFinalCombinerInputNV"));
+    SET_GetCombinerInputParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerInputParameterfvNV"));
+    SET_GetCombinerInputParameterivNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerInputParameterivNV"));
+    SET_GetCombinerOutputParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerOutputParameterfvNV"));
+    SET_GetCombinerOutputParameterivNV(disp, dlsym(RTLD_DEFAULT, "glGetCombinerOutputParameterivNV"));
+    SET_GetFinalCombinerInputParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetFinalCombinerInputParameterfvNV"));
+    SET_GetFinalCombinerInputParameterivNV(disp, dlsym(RTLD_DEFAULT, "glGetFinalCombinerInputParameterivNV"));
+
+    /* GL_NV_vertex_array_range */
+    SET_FlushVertexArrayRangeNV(disp, dlsym(RTLD_DEFAULT, "glFlushVertexArrayRangeNV"));
+    SET_VertexArrayRangeNV(disp, dlsym(RTLD_DEFAULT, "glVertexArrayRangeNV"));
+
+    /* GL_NV_vertex_program */
+    SET_AreProgramsResidentNV(disp, dlsym(RTLD_DEFAULT, "glAreProgramsResidentNV"));
+    SET_BindProgramNV(disp, dlsym(RTLD_DEFAULT, "glBindProgramNV"));
+    SET_DeleteProgramsNV(disp, dlsym(RTLD_DEFAULT, "glDeleteProgramsNV"));
+    SET_ExecuteProgramNV(disp, dlsym(RTLD_DEFAULT, "glExecuteProgramNV"));
+    SET_GenProgramsNV(disp, dlsym(RTLD_DEFAULT, "glGenProgramsNV"));
+    SET_GetProgramParameterdvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramParameterdvNV"));
+    SET_GetProgramParameterfvNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramParameterfvNV"));
+    SET_GetProgramStringNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramStringNV"));
+    SET_GetProgramivNV(disp, dlsym(RTLD_DEFAULT, "glGetProgramivNV"));
+    SET_GetTrackMatrixivNV(disp, dlsym(RTLD_DEFAULT, "glGetTrackMatrixivNV"));
+    SET_GetVertexAttribPointervNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribPointervNV"));
+    SET_GetVertexAttribdvNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribdvNV"));
+    SET_GetVertexAttribfvNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribfvNV"));
+    SET_GetVertexAttribivNV(disp, dlsym(RTLD_DEFAULT, "glGetVertexAttribivNV"));
+    SET_IsProgramNV(disp, dlsym(RTLD_DEFAULT, "glIsProgramNV"));
+    SET_LoadProgramNV(disp, dlsym(RTLD_DEFAULT, "glLoadProgramNV"));
+    SET_ProgramParameters4dvNV(disp, dlsym(RTLD_DEFAULT, "glProgramParameters4dvNV"));
+    SET_ProgramParameters4fvNV(disp, dlsym(RTLD_DEFAULT, "glProgramParameters4fvNV"));
+    SET_RequestResidentProgramsNV(disp, dlsym(RTLD_DEFAULT, "glRequestResidentProgramsNV"));
+    SET_TrackMatrixNV(disp, dlsym(RTLD_DEFAULT, "glTrackMatrixNV"));
+    SET_VertexAttrib1dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dNV"));
+    SET_VertexAttrib1dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1dvNV"));
+    SET_VertexAttrib1fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fNV"));
+    SET_VertexAttrib1fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1fvNV"));
+    SET_VertexAttrib1sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1sNV"));
+    SET_VertexAttrib1svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib1svNV"));
+    SET_VertexAttrib2dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dNV"));
+    SET_VertexAttrib2dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2dvNV"));
+    SET_VertexAttrib2fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fNV"));
+    SET_VertexAttrib2fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2fvNV"));
+    SET_VertexAttrib2sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2sNV"));
+    SET_VertexAttrib2svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib2svNV"));
+    SET_VertexAttrib3dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dNV"));
+    SET_VertexAttrib3dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3dvNV"));
+    SET_VertexAttrib3fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fNV"));
+    SET_VertexAttrib3fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3fvNV"));
+    SET_VertexAttrib3sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3sNV"));
+    SET_VertexAttrib3svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib3svNV"));
+    SET_VertexAttrib4dNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dNV"));
+    SET_VertexAttrib4dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4dvNV"));
+    SET_VertexAttrib4fNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fNV"));
+    SET_VertexAttrib4fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4fvNV"));
+    SET_VertexAttrib4sNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4sNV"));
+    SET_VertexAttrib4svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4svNV"));
+    SET_VertexAttrib4ubNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ubNV"));
+    SET_VertexAttrib4ubvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttrib4ubvNV"));
+    SET_VertexAttribPointerNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribPointerNV"));
+    SET_VertexAttribs1dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs1dvNV"));
+    SET_VertexAttribs1fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs1fvNV"));
+    SET_VertexAttribs1svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs1svNV"));
+    SET_VertexAttribs2dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs2dvNV"));
+    SET_VertexAttribs2fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs2fvNV"));
+    SET_VertexAttribs2svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs2svNV"));
+    SET_VertexAttribs3dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs3dvNV"));
+    SET_VertexAttribs3fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs3fvNV"));
+    SET_VertexAttribs3svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs3svNV"));
+    SET_VertexAttribs4dvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4dvNV"));
+    SET_VertexAttribs4fvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4fvNV"));
+    SET_VertexAttribs4svNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4svNV"));
+    SET_VertexAttribs4ubvNV(disp, dlsym(RTLD_DEFAULT, "glVertexAttribs4ubvNV"));
+
+    /* GL_SGIS_multisample */
+    SET_SampleMaskSGIS(disp, dlsym(RTLD_DEFAULT, "glSampleMaskSGIS"));
+    SET_SamplePatternSGIS(disp, dlsym(RTLD_DEFAULT, "glSamplePatternSGIS"));
+
+    /* GL_SGIS_pixel_texture */
+    SET_GetPixelTexGenParameterfvSGIS(disp, dlsym(RTLD_DEFAULT, "glGetPixelTexGenParameterfvSGIS"));
+    SET_GetPixelTexGenParameterivSGIS(disp, dlsym(RTLD_DEFAULT, "glGetPixelTexGenParameterivSGIS"));
+    SET_PixelTexGenParameterfSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameterfSGIS"));
+    SET_PixelTexGenParameterfvSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameterfvSGIS"));
+    SET_PixelTexGenParameteriSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameteriSGIS"));
+    SET_PixelTexGenParameterivSGIS(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenParameterivSGIS"));
+    SET_PixelTexGenSGIX(disp, dlsym(RTLD_DEFAULT, "glPixelTexGenSGIX"));
 
     _glapi_set_dispatch(disp);
 }
commit 93a0e842f78b24e42e14262733b44e118127ea7f
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Jun 3 02:34:28 2011 -0400

    XQuartz: Remove explicit link against libGL
    
    This was indented to force a link against OpenGL.framework's libGL, but it
    actually resulted in linking against mesa's libGL due to the ordering of -L
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index 4b7b2bc..8e49ea8 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -39,7 +39,6 @@ X11_bin_LDADD += \
 	$(top_builddir)/glx/libglx.la
 
 X11_bin_LDFLAGS += \
-	-L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \
 	-Wl,-framework,OpenGL
 endif
 
commit 48b4b778f61daaa161483b510ab520f3fcb84925
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 21:55:06 2011 -0700

    XQuartz: xpbproxy: Correct NSUInteger format strings
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index 7964f51..b5f4dde 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -683,7 +683,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	return;
     }
 
+#ifdef __LP64__
+    DebugF ("pbtypes retainCount after containsObject: %lu\n", [pbtypes retainCount]);
+#else
     DebugF ("pbtypes retainCount after containsObject: %u\n", [pbtypes retainCount]);
+#endif
 
     data = [pb stringForType:NSStringPboardType];
 
@@ -704,7 +708,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	
 	if (length < 50) {
 	    DebugF ("UTF-8: %s\n", bytes);
+#ifdef __LP64__
+	    DebugF ("UTF-8 length: %lu\n", length); 
+#else
 	    DebugF ("UTF-8 length: %u\n", length); 
+#endif
 	}
     } 
     else 
@@ -1223,8 +1231,13 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	return;
     }
 
+#ifdef __LP64__
+    DebugF ("data retainCount before NSBitmapImageRep initWithData: %lu\n",
+	[data retainCount]);
+#else
     DebugF ("data retainCount before NSBitmapImageRep initWithData: %u\n",
 	[data retainCount]);
+#endif
 
     bmimage = [[NSBitmapImageRep alloc] initWithData:data];
 
@@ -1235,8 +1248,13 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	return;
     }
 
+#ifdef __LP64__
+    DebugF ("data retainCount after NSBitmapImageRep initWithData: %lu\n", 
+	[data retainCount]);
+#else
     DebugF ("data retainCount after NSBitmapImageRep initWithData: %u\n", 
 	[data retainCount]);
+#endif
 
     @try 
     {
@@ -1251,7 +1269,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	return;
     }
     
+#ifdef __LP64__
+    DebugF ("bmimage retainCount after TIFFRepresentation %lu\n", [bmimage retainCount]);
+#else
     DebugF ("bmimage retainCount after TIFFRepresentation %u\n", [bmimage retainCount]);
+#endif
 
     pbtypes = [NSArray arrayWithObjects:NSTIFFPboardType, nil];
 
@@ -1270,7 +1292,12 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 
     [data autorelease];
 
+#ifdef __LP64__
+    DebugF ("bmimage retainCount before release %lu\n", [bmimage retainCount]);
+#else
     DebugF ("bmimage retainCount before release %u\n", [bmimage retainCount]);
+#endif
+
     [bmimage autorelease];
 }
 
commit 971193b2750b98b28597ba194ed388e79b3489b6
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 21:18:03 2011 -0700

    XQuartz: ASL: Use xpbproxy subsystem for logging xpbproxy messages
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index a8c3a60..772c458 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -63,6 +63,17 @@ ErrorF(const char * f, ...)
     va_end(args);
 }
 
+/* TODO: Have this actually log to ASL */
+void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
+#ifdef DEBUG
+    va_list args;
+
+    va_start(args, fmt);
+    vfprintf(stderr, fmt, args);
+    va_end(args);
+#endif
+}
+
 int main (int argc, const char *argv[]) {
     const char *s;
     int i;
diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h
index fcbf4c4..c80a660 100644
--- a/hw/xquartz/pbproxy/pbproxy.h
+++ b/hw/xquartz/pbproxy/pbproxy.h
@@ -32,6 +32,8 @@
 
 #import  <Foundation/Foundation.h>
 
+#include <asl.h>
+
 #include <AvailabilityMacros.h>
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
 #if __LP64__ || NS_BUILD_32_LIKE_64
@@ -80,13 +82,12 @@ extern BOOL xpbproxy_input_register (void);
 /* os/log.c or app-main.m */
 extern void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
 
-#ifdef DEBUG
-/* BEWARE: this can cause a string memory leak, according to the leaks program. */
-# define DebugF(msg, args...) ErrorF("%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args)
-#else
-# define DebugF(...) /* */
-#endif
+/* from darwin.h */
+_X_ATTRIBUTE_PRINTF(6,7)
+extern void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...);
 
-#define TRACE() DebugF("TRACE\n")
+#define ASL_LOG(level, subsystem, msg, args...) xq_asl_log(level, subsystem, __FILE__, __FUNCTION__, __LINE__, msg, ##args)
+#define DebugF(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "xpbproxy", msg, ##args)
+#define TRACE() DebugF("TRACE")
 
 #endif /* PBPROXY_H */
commit 7dfd65705ccd3c6e2458d6892282520fe5ed8a6b
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 21:06:53 2011 -0700

    XQuartz: ASL: Use GLXAqua subsystem for logging GLXAqua messages
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index d15b9a3..c41840b 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -155,12 +155,8 @@ typedef long long GLint64EXT;
 
 __GLXprovider * GlxGetDRISWrastProvider (void);
 
-// Write debugging output, or not
-#ifdef GLAQUA_DEBUG
-#define GLAQUA_DEBUG_MSG ErrorF
-#else
-#define GLAQUA_DEBUG_MSG(a, ...)
-#endif
+#include "darwin.h"
+#define GLAQUA_DEBUG_MSG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "GLXAqua", msg, ##args)
 
 static void setup_dispatch_table(void);
 GLuint __glFloorLog2(GLuint val);
commit 19020b23efa15d72349bd833aebddcc64780a615
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 21:06:08 2011 -0700

    XQuartz: ASL: Use xpr subsystem for logging xpr messages
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h
index ebd89de..0b138dd 100644
--- a/hw/xquartz/xpr/xpr.h
+++ b/hw/xquartz/xpr/xpr.h
@@ -33,6 +33,11 @@
 #include "screenint.h"
 #include <Xplugin.h>
 
+#include "darwin.h"
+
+#undef DEBUG_LOG
+#define DEBUG_LOG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "xpr", msg, ##args)
+
 Bool QuartzModeBundleInit(void);
 
 void AppleDRIExtensionInit(void);
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index 216678e..2b31865 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -37,7 +37,6 @@
 
 #include "quartz.h"
 #include "xpr.h"
-#include "darwin.h"
 #include "darwinEvents.h"
 #include <Xplugin.h>
 
diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
index cc86c47..4e7ece6 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -44,7 +44,6 @@
 #include   "scrnintstr.h"
 #include   "mipointer.h"
 
-#include "darwin.h"
 #include "quartz.h"
 #include "quartzKeyboard.h"
 #include "darwinEvents.h"
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 98250e6..002355e 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -40,7 +40,6 @@
 #include "xpr.h"
 #include "xprEvent.h"
 #include "pseudoramiX.h"
-#include "darwin.h"
 #include "darwinEvents.h"
 #include "rootless.h"
 #include "dri.h"
commit a66400f8dba9b7c5b65f9d26996fff677c42d866
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 20:45:58 2011 -0700

    XQuartz: ASL: Update logging to support differnet levels and subsystems
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index fa8d4ce..29ab836 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -79,7 +79,7 @@
 
 aslclient aslc;
 
-void debug_asl (const char *file, const char *function, int line, const char *fmt, ...) {
+void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...) {
     va_list args;
     aslmsg msg = asl_new(ASL_TYPE_MSG);
 
@@ -93,10 +93,12 @@ void debug_asl (const char *file, const char *function, int line, const char *fm
             asl_set(msg, "Line", _line);
             free(_line);
         }
+        if(subsystem)
+            asl_set(msg, "Subsystem", subsystem);
     }
 
     va_start(args, fmt);
-    asl_vlog(aslc, msg, ASL_LEVEL_DEBUG, fmt, args);
+    asl_vlog(aslc, msg, level, fmt, args);
     va_end(args);
 
     if(msg)
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 659de43..aafc12f 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -76,9 +76,11 @@ extern int              darwinMainScreenY;
 // bundle-main.c
 extern char *bundle_id_prefix;
 
-extern void debug_asl (const char *file, const char *function, int line, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(4,5);
+_X_ATTRIBUTE_PRINTF(6,7)
+extern void xq_asl_log (int level, const char *subsystem, const char *file, const char *function, int line, const char *fmt, ...);
 
-#define DEBUG_LOG(msg, args...) debug_asl(__FILE__, __FUNCTION__, __LINE__, msg, ##args);
+#define ASL_LOG(level, subsystem, msg, args...) xq_asl_log(level, subsystem, __FILE__, __FUNCTION__, __LINE__, msg, ##args)
+#define DEBUG_LOG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "XQuartz", msg, ##args)
 #define TRACE() DEBUG_LOG("TRACE")
 
 #endif  /* _DARWIN_H */
commit c0077b41b4c8bb08129db97a2a01d0af55d13fa4
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 1 20:54:27 2011 -0700

    XQuartz: Add a semicolon after DEBUG_LOG
    
    Don't rely on the macro to provide it
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 7c41cbc..a51ee82 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -188,7 +188,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 
 - (void) activateX:(OSX_BOOL)state {
     size_t i;
-    DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
+    DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active);
     if (state) {
         if(bgMouseLocationUpdated) {
             DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
commit fbc8aae8e9b5c7b175073f02e79d7ff1d1363a31
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun May 29 01:20:44 2011 -0700

    XQuartz: Move -lXplugin to LDFLAGS from LDADD
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index 1ce54ad..4b7b2bc 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -22,9 +22,10 @@ X11_bin_LDADD = \
 	$(top_builddir)/dix/dixfonts.lo \
 	$(top_builddir)/miext/rootless/librootless.la \
 	$(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la \
-	$(DARWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
+	$(DARWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS)
 
 X11_bin_LDFLAGS =  \
+	$(XSERVER_SYS_LIBS) -lXplugin \
 	-XCClinker -Objc \
 	-Wl,-u,_miDCInitialize \
 	-Wl,-framework,Carbon \
commit 38df706c6b8a339c4267cae7be0881c4362f36da
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue May 31 13:01:05 2011 -0700

    XQuartz: GLX: Create a new dispatch table rather than modifying the existing one
    
    Fixes regression introduced by b0c665ac0fe6840dda581e4d0d0b76c703d62a7b
    
    0   X11.bin                       	0x0000000100118293 __glXAquaScreenCreateContext + 684
    1   X11.bin                       	0x00000001001315b0 DoCreateContext + 163
    2   X11.bin                       	0x000000010013509f __glXDispatch + 211
    3   X11.bin                       	0x00000001000c7dad Dispatch + 785
    4   X11.bin                       	0x00000001000b97e5 dix_main + 1022
    5   X11.bin                       	0x00000001000122bc server_thread + 50
    6   libSystem.B.dylib             	0x00007fff836554f6 _pthread_start + 331
    7   libSystem.B.dylib             	0x00007fff836553a9 thread_start + 13
    
    http://lists.apple.com/archives/X11-users/2011/May/msg00045.html
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 6da27c7..d15b9a3 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -666,7 +666,15 @@ GLuint __glFloorLog2(GLuint val)
 }
 
 static void setup_dispatch_table(void) {
-    struct _glapi_table *disp=_glapi_get_dispatch();
+    static struct _glapi_table *disp = NULL;
+
+    if(disp)  {
+        _glapi_set_dispatch(disp);
+        return;
+    }
+
+    disp=calloc(1,sizeof(struct _glapi_table));
+    assert(disp);
 
     /* to update:
      * for f in $(grep 'define SET_' ../../../glx/dispatch.h  | cut -f2 -d' ' | cut -f1 -d\( | sort -u); do grep -q $f indirect.c || echo $f ; done | grep -v by_offset | sed 's:SET_\(.*\)$:SET_\1(disp, gl\1)\;:' | pbcopy
@@ -1610,4 +1618,6 @@ static void setup_dispatch_table(void) {
     SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS);
     SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX);
 #endif
+
+    _glapi_set_dispatch(disp);
 }
commit c5b72fd350bbdfd1facd0ddd5085f238c4cf252a
Author: Marko Macek <Marko.Macek at gmx.net>
Date:   Sat May 21 13:30:59 2011 +0100

    DIX: Set backgroundState correctly for root window
    
    When we change the root window's background to None, and we've run with
    -wr or -br for a forced solid background, make sure we also change the
    background state to BackgroundPixel, so we don't try to lookup either
    pScreen->whitePixel or pScreen->blackPixel as a pixmap.
    
    Signed-off-by: Marko Macek <Marko.Macek at gmx.net>
    Reviewed-by: Walter Harms <wharms at bfs.de>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/window.c b/dix/window.c
index cd28d05..5defe58 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -475,6 +475,7 @@ InitRootWindow(WindowPtr pWin)
         pWin->background.pixel = pScreen->whitePixel;
         backFlag |= CWBackPixmap;
     } else {
+        pWin->backgroundState = BackgroundPixel;
 	if (whiteRoot)
             pWin->background.pixel = pScreen->whitePixel;
         else
@@ -973,6 +974,7 @@ SetRootWindowBackground(WindowPtr pWin, ScreenPtr pScreen, Mask *index2)
     else if (party_like_its_1989)
 	MakeRootTile(pWin);
     else {
+        pWin->backgroundState = BackgroundPixel;
 	if (whiteRoot)
 	    pWin->background.pixel = pScreen->whitePixel;
 	else
commit db228d3d07a6d831f53e4c05c878327ad4d045eb
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jun 1 11:20:10 2011 -0700

    Version bumped to 1.10.99.901 (1.11 RC1)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index fcb8ea9..22566c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.10.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="unreleased"
+AC_INIT([xorg-server], 1.10.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-06-01"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 0643c056512d10be8db223d18d6563292d57e916
Merge: a2e6cfc... d45f5b2...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue May 31 23:45:07 2011 -0700

    Merge remote-tracking branch 'ajax/xserver-next'

commit a2e6cfc18aec1c0027b51572b03ec9f2ab074b56
Merge: bc04065... 8d84fd2...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue May 31 23:42:52 2011 -0700

    Merge remote-tracking branch 'sandmann/for-keithp'

commit d45f5b2493bc0a2882bf972849b5c9c50cd533ca
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed May 25 05:54:35 2011 -0400

    fixes: Add support for pointer barriers
    
    Implements pointer barriers as specified by version 5 of the XFIXES
    protocol. Barriers are axis-aligned, zero-width lines that block pointer
    movement for relative input devices. Barriers may block motion in either
    the positive or negative direction, or both.
    
    v3:
    - Fix off-by-one in version_requests array
    - Port to non-glib test harness
    - Fix review notes from Søren Sandmann Pedersen, add tests to match
    
    Co-authored-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index 655c0e4..ba1d176 100644
--- a/configure.ac
+++ b/configure.ac
@@ -810,7 +810,7 @@ dnl specific modules against it
 PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
 REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
 
-REQUIRED_MODULES="[fixesproto >= 4.1] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
+REQUIRED_MODULES="[fixesproto >= 5.0] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
 
 if test "x$CONFIG_UDEV" = xyes &&
  { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
diff --git a/include/protocol-versions.h b/include/protocol-versions.h
index 8692ded..7b7a9f5 100644
--- a/include/protocol-versions.h
+++ b/include/protocol-versions.h
@@ -122,7 +122,7 @@
 #define SERVER_XF86VIDMODE_MINOR_VERSION	2
 
 /* Fixes */
-#define SERVER_XFIXES_MAJOR_VERSION		4
+#define SERVER_XFIXES_MAJOR_VERSION		5
 #define SERVER_XFIXES_MINOR_VERSION		0
 
 /* X Input */
diff --git a/test/Makefile.am b/test/Makefile.am
index b7ee070..5574e7d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
 SUBDIRS= . xi2
-noinst_PROGRAMS = xkb input xtest list misc
+noinst_PROGRAMS = xkb input xtest list misc fixes
 check_LTLIBRARIES = libxservertest.la
 
 TESTS=$(noinst_PROGRAMS)
@@ -19,6 +19,7 @@ input_LDADD=$(TEST_LDADD)
 xtest_LDADD=$(TEST_LDADD)
 list_LDADD=$(TEST_LDADD)
 misc_LDADD=$(TEST_LDADD)
+fixes_LDADD=$(TEST_LDADD)
 
 libxservertest_la_LIBADD = \
             $(XSERVER_LIBS) \
diff --git a/test/fixes.c b/test/fixes.c
new file mode 100644
index 0000000..8c804ba
--- /dev/null
+++ b/test/fixes.c
@@ -0,0 +1,327 @@
+/**
+ * Copyright © 2011 Red Hat, Inc.
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice (including the next
+ *  paragraph) shall be included in all copies or substantial portions of the
+ *  Software.
+ *
+ *  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
+ *  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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/X.h>
+#include <xfixesint.h>
+#include <X11/extensions/xfixeswire.h>
+
+static void
+_fixes_test_direction(struct PointerBarrier *barrier, int d[4], int permitted)
+{
+    BOOL blocking;
+    int i, j;
+    int dir = barrier_get_direction(d[0], d[1], d[2], d[3]);
+
+    barrier->directions = 0;
+    blocking = barrier_is_blocking_direction(barrier, dir);
+    assert(blocking);
+
+    for (j = 0; j <= BarrierNegativeY; j++)
+    {
+        for (i = 0; i <= BarrierNegativeY; i++)
+        {
+            barrier->directions |= 1 << i;
+            blocking = barrier_is_blocking_direction(barrier, dir);
+            assert((barrier->directions & permitted) == permitted ? !blocking : blocking);
+        }
+    }
+
+}
+
+static void
+fixes_pointer_barrier_direction_test(void)
+{
+    struct PointerBarrier barrier;
+
+    int x = 100;
+    int y = 100;
+
+    int directions[8][4] = {
+        { x, y, x, y + 100},            /* S  */
+        { x + 50, y, x - 50, y + 100},  /* SW */
+        { x + 100, y, x, y},            /* W  */
+        { x + 100, y + 50, x, y - 50},  /* NW */
+        { x, y + 100, x, y},            /* N  */
+        { x - 50, y + 100, x + 50, y},  /* NE */
+        { x, y, x + 100, y},            /* E  */
+        { x, y - 50, x + 100, y + 50},  /* SE */
+    };
+
+    barrier.x1 = x;
+    barrier.x2 = x;
+    barrier.y1 = y - 50;
+    barrier.y2 = y + 49;
+
+
+    _fixes_test_direction(&barrier, directions[0], BarrierPositiveY);
+    _fixes_test_direction(&barrier, directions[1], BarrierPositiveY | BarrierNegativeX);
+    _fixes_test_direction(&barrier, directions[2], BarrierNegativeX);
+    _fixes_test_direction(&barrier, directions[3], BarrierNegativeY | BarrierNegativeX);
+    _fixes_test_direction(&barrier, directions[4], BarrierNegativeY);
+    _fixes_test_direction(&barrier, directions[5], BarrierPositiveX | BarrierNegativeY);
+    _fixes_test_direction(&barrier, directions[6], BarrierPositiveX);
+    _fixes_test_direction(&barrier, directions[7], BarrierPositiveY | BarrierPositiveX);
+
+
+}
+
+
+static void
+fixes_pointer_barriers_test(void)
+{
+    struct PointerBarrier barrier;
+    int x1, y1, x2, y2;
+    double distance;
+
+    int x = 100;
+    int y = 100;
+
+    /* vert barrier */
+    barrier.x1 = x;
+    barrier.x2 = x;
+    barrier.y1 = y - 50;
+    barrier.y2 = y + 50;
+
+    /* across at half-way */
+    x1 = x + 1;
+    x2 = x - 1;
+    y1 = y;
+    y2 = y;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+    assert(distance == 1);
+
+    /* definitely not across */
+    x1 = x + 10;
+    x2 = x + 5;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* across, but outside of y range */
+    x1 = x + 1;
+    x2 = x -1;
+    y1 = y + 100;
+    y2 = y + 100;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* across, diagonally */
+    x1 = x + 5;
+    x2 = x - 5;
+    y1 = y + 5;
+    y2 = y - 5;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* across but outside boundary, diagonally */
+    x1 = x + 5;
+    x2 = x - 5;
+    y1 = y + 100;
+    y2 = y + 50;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: startpoint of movement on barrier → blocking */
+    x1 = x;
+    x2 = x - 1;
+    y1 = y;
+    y2 = y;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: startpoint of movement on barrier → not blocking, positive */
+    x1 = x;
+    x2 = x + 1;
+    y1 = y;
+    y2 = y;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: startpoint of movement on barrier → not blocking, negative */
+    x1 = x - 1;
+    x2 = x - 2;
+    y1 = y;
+    y2 = y;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: endpoint of movement on barrier → blocking */
+    x1 = x + 1;
+    x2 = x;
+    y1 = y;
+    y2 = y;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* startpoint on barrier but outside y range */
+    x1 = x;
+    x2 = x - 1;
+    y1 = y + 100;
+    y2 = y + 100;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* endpoint on barrier but outside y range */
+    x1 = x + 1;
+    x2 = x;
+    y1 = y + 100;
+    y2 = y + 100;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+
+    /* horizontal barrier */
+    barrier.x1 = x - 50;
+    barrier.x2 = x + 50;
+    barrier.y1 = y;
+    barrier.y2 = y;
+
+    /* across at half-way */
+    x1 = x;
+    x2 = x;
+    y1 = y - 1;
+    y2 = y + 1;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* definitely not across */
+    y1 = y + 10;
+    y2 = y + 5;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* across, but outside of y range */
+    x1 = x + 100;
+    x2 = x + 100;
+    y1 = y + 1;
+    y2 = y -1;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* across, diagonally */
+    y1 = y + 5;
+    y2 = y - 5;
+    x1 = x + 5;
+    x2 = x - 5;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* across but outside boundary, diagonally */
+    y1 = y + 5;
+    y2 = y - 5;
+    x1 = x + 100;
+    x2 = x + 50;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: startpoint of movement on barrier → blocking */
+    y1 = y;
+    y2 = y - 1;
+    x1 = x;
+    x2 = x;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: startpoint of movement on barrier → not blocking, positive */
+    y1 = y;
+    y2 = y + 1;
+    x1 = x;
+    x2 = x;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: startpoint of movement on barrier → not blocking, negative */
+    y1 = y - 1;
+    y2 = y - 2;
+    x1 = x;
+    x2 = x;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* edge case: endpoint of movement on barrier → blocking */
+    y1 = y + 1;
+    y2 = y;
+    x1 = x;
+    x2 = x;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* startpoint on barrier but outside y range */
+    y1 = y;
+    y2 = y - 1;
+    x1 = x + 100;
+    x2 = x + 100;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* endpoint on barrier but outside y range */
+    y1 = y + 1;
+    y2 = y;
+    x1 = x + 100;
+    x2 = x + 100;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+}
+
+static void fixes_pointer_barrier_clamp_test(void)
+{
+    struct PointerBarrier barrier;
+
+    int x = 100;
+    int y = 100;
+
+    int cx, cy; /* clamped */
+
+    /* vert barrier */
+    barrier.x1 = x;
+    barrier.x2 = x;
+    barrier.y1 = y - 50;
+    barrier.y2 = y + 49;
+    barrier.directions = 0;
+
+    cx = INT_MAX;
+    cy = INT_MAX;
+    barrier_clamp_to_barrier(&barrier, BarrierPositiveX, &cx, &cy);
+    assert(cx == barrier.x1 - 1);
+    assert(cy == INT_MAX);
+
+    cx = 0;
+    cy = INT_MAX;
+    barrier_clamp_to_barrier(&barrier, BarrierNegativeX, &cx, &cy);
+    assert(cx == barrier.x1);
+    assert(cy == INT_MAX);
+
+    /* horiz barrier */
+    barrier.x1 = x - 50;
+    barrier.x2 = x + 49;
+    barrier.y1 = y;
+    barrier.y2 = y;
+    barrier.directions = 0;
+
+    cx = INT_MAX;
+    cy = INT_MAX;
+    barrier_clamp_to_barrier(&barrier, BarrierPositiveY, &cx, &cy);
+    assert(cx == INT_MAX);
+    assert(cy == barrier.y1 - 1);
+
+    cx = INT_MAX;
+    cy = 0;
+    barrier_clamp_to_barrier(&barrier, BarrierNegativeY, &cx, &cy);
+    assert(cx == INT_MAX);
+    assert(cy == barrier.y1);
+}
+
+int main(int argc, char** argv)
+{
+
+    fixes_pointer_barriers_test();
+    fixes_pointer_barrier_direction_test();
+    fixes_pointer_barrier_clamp_test();
+
+    return 0;
+}
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index fb608f6..01eb70d 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2010 Red Hat, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -50,13 +51,16 @@
 #include "cursorstr.h"
 #include "dixevents.h"
 #include "servermd.h"
+#include "mipointer.h"
 #include "inputstr.h"
 #include "windowstr.h"
 #include "xace.h"
+#include "list.h"
 
 static RESTYPE		CursorClientType;
 static RESTYPE		CursorHideCountType;
 static RESTYPE		CursorWindowType;
+RESTYPE			PointerBarrierType;
 static CursorPtr	CursorCurrent[MAXDEVICES];
 
 static DevPrivateKeyRec CursorScreenPrivateKeyRec;
@@ -107,6 +111,14 @@ typedef struct _CursorHideCountRec {
     XID			 resource;
 } CursorHideCountRec;
 
+typedef struct PointerBarrierClient *PointerBarrierClientPtr;
+
+struct PointerBarrierClient {
+    ScreenPtr screen;
+    struct PointerBarrier barrier;
+    struct list entry;
+};
+
 /*
  * Wrap DisplayCursor to catch cursor change events
  */
@@ -114,7 +126,9 @@ typedef struct _CursorHideCountRec {
 typedef struct _CursorScreen {
     DisplayCursorProcPtr	DisplayCursor;
     CloseScreenProcPtr		CloseScreen;
+    ConstrainCursorHarderProcPtr ConstrainCursorHarder;
     CursorHideCountPtr          pCursorHideCounts;
+    struct list                 barriers;
 } CursorScreenRec, *CursorScreenPtr;
 
 #define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -184,9 +198,11 @@ CursorCloseScreen (int index, ScreenPtr pScreen)
     Bool		ret;
     CloseScreenProcPtr	close_proc;
     DisplayCursorProcPtr display_proc;
+    ConstrainCursorHarderProcPtr constrain_proc;
 
     Unwrap (cs, pScreen, CloseScreen, close_proc);
     Unwrap (cs, pScreen, DisplayCursor, display_proc);
+    Unwrap (cs, pScreen, ConstrainCursorHarder, constrain_proc);
     deleteCursorHideCountsForScreen(pScreen);
     ret = (*pScreen->CloseScreen) (index, pScreen);
     free(cs);
@@ -1029,6 +1045,382 @@ CursorFreeWindow (pointer data, XID id)
     return 1;
 }
 
+static BOOL
+barrier_is_horizontal(const struct PointerBarrier *barrier)
+{
+    return barrier->y1 == barrier->y2;
+}
+
+static BOOL
+barrier_is_vertical(const struct PointerBarrier *barrier)
+{
+    return barrier->x1 == barrier->x2;
+}
+
+/**
+ * @return The set of barrier movement directions the movement vector
+ * x1/y1 → x2/y2 represents.
+ */
+int
+barrier_get_direction(int x1, int y1, int x2, int y2)
+{
+    int direction = 0;
+
+    /* which way are we trying to go */
+    if (x2 > x1)
+	direction |= BarrierPositiveX;
+    if (x2 < x1)
+	direction |= BarrierNegativeX;
+    if (y2 > y1)
+	direction |= BarrierPositiveY;
+    if (y2 < y1)
+	direction |= BarrierNegativeY;
+
+    return direction;
+}
+
+/**
+ * Test if the barrier may block movement in the direction defined by
+ * x1/y1 → x2/y2. This function only tests whether the directions could be
+ * blocked, it does not test if the barrier actually blocks the movement.
+ *
+ * @return TRUE if the barrier blocks the direction of movement or FALSE
+ * otherwise.
+ */
+BOOL
+barrier_is_blocking_direction(const struct PointerBarrier *barrier, int direction)
+{
+    /* Barriers define which way is ok, not which way is blocking */
+    return (barrier->directions & direction) != direction;
+}
+
+/**
+ * Test if the movement vector x1/y1 → x2/y2 is intersecting with the
+ * barrier. A movement vector with the startpoint or endpoint adjacent to
+ * the barrier itself counts as intersecting.
+ *
+ * @param x1 X start coordinate of movement vector
+ * @param y1 Y start coordinate of movement vector
+ * @param x2 X end coordinate of movement vector
+ * @param y2 Y end coordinate of movement vector
+ * @param[out] distance The distance between the start point and the
+ * intersection with the barrier (if applicable).
+ * @return TRUE if the barrier intersects with the given vector
+ */
+BOOL
+barrier_is_blocking(const struct PointerBarrier *barrier,
+		    int x1, int y1, int x2, int y2,
+		    double *distance)
+{
+    BOOL rc = FALSE;
+    float ua, ub, ud;
+    int dir = barrier_get_direction(x1, y1, x2, y2);
+
+    /* Algorithm below doesn't handle edge cases well, hence the extra
+     * checks. */
+    if (barrier_is_vertical(barrier)) {
+	/* handle immediate barrier adjacency, moving away */
+	if (dir & BarrierPositiveX && x1 == barrier->x1)
+	    return FALSE;
+	if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
+	    return FALSE;
+	/* startpoint adjacent to barrier, moving towards -> block */
+	if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
+	    *distance = 0;
+	    return TRUE;
+	}
+    } else {
+	/* handle immediate barrier adjacency, moving away */
+	if (dir & BarrierPositiveY && y1 == barrier->y1)
+	    return FALSE;
+	if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
+	    return FALSE;
+	/* startpoint adjacent to barrier, moving towards -> block */
+	if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
+	    *distance = 0;
+	    return TRUE;
+        }
+    }
+
+    /* not an edge case, compute distance */
+    ua = 0;
+    ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 - barrier->x1) * (y2 - y1);
+    if (ud != 0) {
+	ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
+	     (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
+	ub = ((x2 - x1) * (y1 - barrier->y1) -
+	     (y2 - y1) * (x1 - barrier->x1)) / ud;
+	if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
+	    ua = 0;
+    }
+
+    if (ua > 0 && ua <= 1)
+    {
+	double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
+	double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
+
+	*distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
+	rc = TRUE;
+    }
+
+    return rc;
+}
+
+/**
+ * Find the nearest barrier that is blocking movement from x1/y1 to x2/y2.
+ *
+ * @param dir Only barriers blocking movement in direction dir are checked
+ * @param x1 X start coordinate of movement vector
+ * @param y1 Y start coordinate of movement vector
+ * @param x2 X end coordinate of movement vector
+ * @param y2 Y end coordinate of movement vector
+ * @return The barrier nearest to the movement origin that blocks this movement.
+ */
+static struct PointerBarrier*
+barrier_find_nearest(CursorScreenPtr cs, int dir,
+		     int x1, int y1, int x2, int y2)
+{
+    struct PointerBarrierClient *c;
+    struct PointerBarrier *nearest = NULL;
+    double min_distance = INT_MAX; /* can't get higher than that in X anyway */
+
+    list_for_each_entry(c, &cs->barriers, entry) {
+	struct PointerBarrier *b = &c->barrier;
+	double distance;
+
+	if (!barrier_is_blocking_direction(b, dir))
+	    continue;
+
+	if (barrier_is_blocking(b, x1, y1, x2, y2, &distance))
+	{
+	    if (min_distance > distance)
+	    {
+		min_distance = distance;
+		nearest = b;
+	    }
+	}
+    }
+
+    return nearest;
+}
+
+/**
+ * Clamp to the given barrier given the movement direction specified in dir.
+ *
+ * @param barrier The barrier to clamp to
+ * @param dir The movement direction
+ * @param[out] x The clamped x coordinate.
+ * @param[out] y The clamped x coordinate.
+ */
+void
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y)
+{
+    if (barrier_is_vertical(barrier))
+    {
+	if ((dir & BarrierNegativeX) & ~barrier->directions)
+	    *x = barrier->x1;
+	if ((dir & BarrierPositiveX) & ~barrier->directions)
+	    *x = barrier->x1 - 1;
+    }
+    if (barrier_is_horizontal(barrier))
+    {
+	if ((dir & BarrierNegativeY) & ~barrier->directions)
+	    *y = barrier->y1;
+	if ((dir & BarrierPositiveY) & ~barrier->directions)
+	    *y = barrier->y1 - 1;
+    }
+}
+
+static void
+CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y)
+{
+    CursorScreenPtr cs = GetCursorScreen(screen);
+
+    if (!list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
+	int ox, oy;
+	int dir;
+	struct PointerBarrier *nearest = NULL;
+
+	/* where are we coming from */
+	miPointerGetPosition(dev, &ox, &oy);
+
+	/* How this works:
+	 * Given the origin and the movement vector, get the nearest barrier
+	 * to the origin that is blocking the movement.
+	 * Clamp to that barrier.
+	 * Then, check from the clamped intersection to the original
+	 * destination, again finding the nearest barrier and clamping.
+	 */
+	dir = barrier_get_direction(ox, oy, *x, *y);
+
+	nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+	if (nearest) {
+	    barrier_clamp_to_barrier(nearest, dir, x, y);
+
+	    if (barrier_is_vertical(nearest)) {
+		dir &= ~(BarrierNegativeX | BarrierPositiveX);
+		ox = *x;
+	    } else if (barrier_is_horizontal(nearest)) {
+		dir &= ~(BarrierNegativeY | BarrierPositiveY);
+		oy = *y;
+	    }
+
+	    nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+	    if (nearest) {
+		barrier_clamp_to_barrier(nearest, dir, x, y);
+	    }
+	}
+    }
+
+    if (cs->ConstrainCursorHarder) {
+	screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
+	screen->ConstrainCursorHarder(dev, screen, mode, x, y);
+	screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
+    }
+}
+
+static struct PointerBarrierClient *
+CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
+			   xXFixesCreatePointerBarrierReq *stuff)
+{
+    CursorScreenPtr cs = GetCursorScreen(screen);
+    struct PointerBarrierClient *ret = malloc(sizeof(*ret));
+
+    if (ret) {
+	ret->screen = screen;
+	ret->barrier.x1 = min(stuff->x1, stuff->x2);
+	ret->barrier.x2 = max(stuff->x1, stuff->x2);
+	ret->barrier.y1 = min(stuff->y1, stuff->y2);
+	ret->barrier.y2 = max(stuff->y1, stuff->y2);
+	ret->barrier.directions = stuff->directions & 0x0f;
+	if (barrier_is_horizontal(&ret->barrier))
+	    ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
+	if (barrier_is_vertical(&ret->barrier))
+	    ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
+	list_add(&ret->entry, &cs->barriers);
+    }
+
+    return ret;
+}
+
+int
+ProcXFixesCreatePointerBarrier (ClientPtr client)
+{
+    int err;
+    WindowPtr pWin;
+    struct PointerBarrierClient *barrier;
+    struct PointerBarrier b;
+    REQUEST (xXFixesCreatePointerBarrierReq);
+
+    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    LEGAL_NEW_RESOURCE(stuff->barrier, client);
+
+    err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+    if (err != Success) {
+	client->errorValue = stuff->window;
+	return err;
+    }
+
+    /* This sure does need fixing. */
+    if (stuff->num_devices)
+	return BadImplementation;
+
+    b.x1 = stuff->x1;
+    b.x2 = stuff->x2;
+    b.y1 = stuff->y1;
+    b.y2 = stuff->y2;
+
+    if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
+	return BadValue;
+
+    /* no 0-sized barriers */
+    if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
+	return BadValue;
+
+    if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen,
+					       client, stuff)))
+	return BadAlloc;
+
+    if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
+	return BadAlloc;
+
+    return Success;
+}
+
+int
+SProcXFixesCreatePointerBarrier (ClientPtr client)
+{
+    int n;
+    REQUEST(xXFixesCreatePointerBarrierReq);
+
+    swaps(&stuff->length, n);
+    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    swapl(&stuff->barrier, n);
+    swapl(&stuff->window, n);
+    swaps(&stuff->x1, n);
+    swaps(&stuff->y1, n);
+    swaps(&stuff->x2, n);
+    swaps(&stuff->y2, n);
+    swapl(&stuff->directions, n);
+    return ProcXFixesVector[stuff->xfixesReqType](client);
+}
+
+static int
+CursorFreeBarrier(void *data, XID id)
+{
+    struct PointerBarrierClient *b = NULL, *barrier;
+    ScreenPtr screen;
+    CursorScreenPtr cs;
+
+    barrier = container_of(data, struct PointerBarrierClient, barrier);
+    screen = barrier->screen;
+    cs = GetCursorScreen(screen);
+
+    /* find and unlink from the screen private */
+    list_for_each_entry(b, &cs->barriers, entry) {
+	if (b == barrier) {
+	    list_del(&b->entry);
+	    break;
+	}
+    }
+
+    free(barrier);
+    return Success;
+}
+
+int
+ProcXFixesDestroyPointerBarrier (ClientPtr client)
+{
+    int err;
+    void *barrier;
+    REQUEST (xXFixesDestroyPointerBarrierReq);
+
+    REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
+
+    err = dixLookupResourceByType((void **)&barrier, stuff->barrier,
+				  PointerBarrierType, client,
+				  DixDestroyAccess);
+    if (err != Success) {
+	client->errorValue = stuff->barrier;
+	return err;
+    }
+
+    FreeResource(stuff->barrier, RT_NONE);
+    return Success;
+}
+
+int
+SProcXFixesDestroyPointerBarrier (ClientPtr client)
+{
+    int n;
+    REQUEST(xXFixesDestroyPointerBarrierReq);
+
+    swaps(&stuff->length, n);
+    REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
+    swapl(&stuff->barrier, n);
+    return ProcXFixesVector[stuff->xfixesReqType](client);
+}
+
 Bool
 XFixesCursorInit (void)
 {
@@ -1048,8 +1440,10 @@ XFixesCursorInit (void)
 	cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
 	if (!cs)
 	    return FALSE;
+	list_init(&cs->barriers);
 	Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
 	Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
+	Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
 	cs->pCursorHideCounts = NULL;
 	SetCursorScreen (pScreen, cs);
     }
@@ -1059,7 +1453,10 @@ XFixesCursorInit (void)
 						"XFixesCursorHideCount");
     CursorWindowType = CreateNewResourceType(CursorFreeWindow,
 					     "XFixesCursorWindow");
+    PointerBarrierType = CreateNewResourceType(CursorFreeBarrier,
+					      "XFixesPointerBarrier");
 
-    return CursorClientType && CursorHideCountType && CursorWindowType;
+    return CursorClientType && CursorHideCountType && CursorWindowType &&
+	   PointerBarrierType;
 }
 
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 54f0df3..e0ebedd 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2010 Red Hat, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -47,10 +48,6 @@
 
 #include "xfixesint.h"
 #include "protocol-versions.h"
-/*
- * Must use these instead of the constants from xfixeswire.h.  They advertise
- * what we implement, not what the protocol headers define.
- */
 
 static unsigned char	XFixesReqCode;
 int		XFixesEventBase;
@@ -97,11 +94,12 @@ ProcXFixesQueryVersion(ClientPtr client)
 
 /* Major version controls available requests */
 static const int version_requests[] = {
-    X_XFixesQueryVersion,	/* before client sends QueryVersion */
-    X_XFixesGetCursorImage,	/* Version 1 */
-    X_XFixesChangeCursorByName,	/* Version 2 */
-    X_XFixesExpandRegion,	/* Version 3 */
-    X_XFixesShowCursor,	        /* Version 4 */
+    X_XFixesQueryVersion,	    /* before client sends QueryVersion */
+    X_XFixesGetCursorImage,	    /* Version 1 */
+    X_XFixesChangeCursorByName,	    /* Version 2 */
+    X_XFixesExpandRegion,	    /* Version 3 */
+    X_XFixesShowCursor,		    /* Version 4 */
+    X_XFixesDestroyPointerBarrier,  /* Version 5 */
 };
 
 #define NUM_VERSION_REQUESTS	(sizeof (version_requests) / sizeof (version_requests[0]))
@@ -142,6 +140,9 @@ int	(*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
 /*************** Version 4 ****************/
     ProcXFixesHideCursor,
     ProcXFixesShowCursor,
+/*************** Version 5 ****************/
+    ProcXFixesCreatePointerBarrier,
+    ProcXFixesDestroyPointerBarrier,
 };
 
 static int
@@ -205,6 +206,9 @@ static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
 /*************** Version 4 ****************/
     SProcXFixesHideCursor,
     SProcXFixesShowCursor,
+/*************** Version 5 ****************/
+    SProcXFixesCreatePointerBarrier,
+    SProcXFixesDestroyPointerBarrier,
 };
 
 static int
@@ -260,6 +264,8 @@ XFixesExtensionInit(void)
 	EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
 	    (EventSwapPtr) SXFixesCursorNotifyEvent;
 	SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
+	SetResourceTypeErrorValue(PointerBarrierType,
+				  XFixesErrorBase + BadBarrier);
     }
 }
 
diff --git a/xfixes/xfixes.h b/xfixes/xfixes.h
index 1638350..5765e64 100644
--- a/xfixes/xfixes.h
+++ b/xfixes/xfixes.h
@@ -30,6 +30,7 @@
 #include "resource.h"
 
 extern _X_EXPORT RESTYPE RegionResType;
+extern _X_EXPORT RESTYPE PointerBarrierType;
 extern _X_EXPORT int XFixesErrorBase;
 
 #define VERIFY_REGION(pRegion, rid, client, mode)			\
@@ -51,5 +52,21 @@ extern _X_EXPORT int XFixesErrorBase;
 extern _X_EXPORT RegionPtr
 XFixesRegionCopy (RegionPtr pRegion);
 
+struct PointerBarrier {
+    CARD16 x1, x2, y1, y2;
+    CARD32 directions;
+};
+
+
+extern int
+barrier_get_direction(int, int, int, int);
+extern BOOL
+barrier_is_blocking(const struct PointerBarrier*, int, int, int, int, double*);
+extern BOOL
+barrier_is_blocking_direction(const struct PointerBarrier*, int);
+extern void
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y);
+
+
 
 #endif /* _XFIXES_H_ */
diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h
index d005369..6ba276e 100644
--- a/xfixes/xfixesint.h
+++ b/xfixes/xfixesint.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2010 Red Hat, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -278,6 +279,21 @@ ProcXFixesShowCursor (ClientPtr client);
 int 
 SProcXFixesShowCursor (ClientPtr client);
 
+/* Version 5 */
+
+int
+ProcXFixesCreatePointerBarrier (ClientPtr client);
+
+int
+SProcXFixesCreatePointerBarrier (ClientPtr client);
+
+int
+ProcXFixesDestroyPointerBarrier (ClientPtr client);
+
+int
+SProcXFixesDestroyPointerBarrier (ClientPtr client);
+
+/* Xinerama */
 extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr);
 void PanoramiXFixesInit (void);
 void PanoramiXFixesReset (void);
commit bc04065b5ce277f3ac3491ff221a60ef3c7605cf
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri May 20 19:24:34 2011 -0700

    "privates.h", line 198: warning: void function cannot return value
    
    Providing an argument to return in a function with void return type
    is not allowed by the C standard, and makes the Sun compilers unhappy.
    (They actually flag it as an error, unless using a new enough version
     to be able to downgrade it to a warning with "-features=extensions".)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>

diff --git a/include/privates.h b/include/privates.h
index 7ef2cb7..2b0040c 100644
--- a/include/privates.h
+++ b/include/privates.h
@@ -195,7 +195,7 @@ dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenP
 static inline void
 dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, pointer val)
 {
-    return dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
+    dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
 }
 
 static inline pointer
commit eadf5021794782fde861d471ed408675f4926b89
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon May 2 19:48:42 2011 -0700

    Use XORG_STRICT_OPTION from util-macros 1.14 to set -Werror flags
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/m4/xorg-tls.m4 b/m4/xorg-tls.m4
index 5638504..237fdcd 100644
--- a/m4/xorg-tls.m4
+++ b/m4/xorg-tls.m4
@@ -22,6 +22,7 @@ dnl
 dnl Authors: Jeremy Huddleston <jeremyhu at apple.com>
 
 AC_DEFUN([XORG_TLS], [
+    AC_REQUIRE([XORG_STRICT_OPTION])
     AC_MSG_CHECKING(for thread local storage (TLS) support)
     AC_CACHE_VAL(ac_cv_tls, [
         ac_cv_tls=none
@@ -36,10 +37,7 @@ AC_DEFUN([XORG_TLS], [
         AC_MSG_CHECKING(for tls_model attribute support)
         AC_CACHE_VAL(ac_cv_tls_model, [
             save_CFLAGS="$CFLAGS"
-            dnl -Werror causes clang's default -Wunknown-attributes to become an error
-            dnl We can't use -Werror=unknown-attributes because gcc doesn't understand it
-            dnl -Werror=attributes is for gcc, clang seems to ignore it
-            CFLAGS="$CFLAGS -Werror -Werror=attributes"
+            CFLAGS="$CFLAGS $STRICT_CFLAGS"
             AC_TRY_COMPILE([int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;], [],
                            ac_cv_tls_model=yes, ac_cv_tls_model=no)
             CFLAGS="$save_CFLAGS"
commit 9275b1fb6f82a6971c4177ddd3d5a859a8f24119
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon May 2 19:47:44 2011 -0700

    Use XORG_COMPILER_BRAND from util-macros 1.14 to check for SUNCC
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 655c0e4..262ea18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,10 +32,10 @@ AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
-# Require xorg-macros minimum of 1.13 for XORG_ENABLE_UNIT_TESTS
+# Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS
 m4_ifndef([XORG_MACROS_VERSION],
-          [m4_fatal([must install xorg-macros 1.13 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.13)
+          [m4_fatal([must install xorg-macros 1.14 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.14)
 XORG_DEFAULT_OPTIONS
 XORG_WITH_DOXYGEN(1.6.1)
 XORG_CHECK_SGML_DOCTOOLS(1.7)
@@ -1522,7 +1522,6 @@ if test "x$XORG" = xyes; then
 	    if test x$GCC = xyes; then
 		VISIBILITY_CFLAGS="-fvisibility=hidden"
 	    else
-		AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
 		if test x$SUNCC = xyes; then
 		    VISIBILITY_CFLAGS="-xldscope=hidden"
 		else
@@ -1631,7 +1630,6 @@ if test "x$XORG" = xyes; then
 		if test "${OS_MINOR}" -lt 8 ; then
 			AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
 		fi
-		AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
 		if test "x$SUNCC" = "xyes"; then
 			solaris_asm_inline="yes"
 		fi
commit 8d84fd2566f8466b6152724df7eefc73780df093
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Wed May 25 12:14:05 2011 -0400

    Don't call pixman_disable_out_of_bounds_workaround() anymore
    
    Pixman used to have a workaround for a bug in old X servers, and this
    function was used to disable that workaround in servers known to be
    fixed.
    
    Since 0.22, which the X server depends on, the workaround doesn't
    exist anymore, so there is no point disabling it.
    
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Signed-off-by: Soren Sandmann <sandmann at cs.au.dk>

diff --git a/dix/main.c b/dix/main.c
index bc958b8..955b7ea 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -139,8 +139,6 @@ int main(int argc, char *argv[], char *envp[])
 
     InitRegions();
 
-    pixman_disable_out_of_bounds_workaround();
-
     CheckUserParameters(argc, argv, envp);
 
     CheckUserAuthorization();


More information about the Xquartz-changes mailing list