From 96d6df5da9cddedf4931bf8e17f96e242467c661 Mon Sep 17 00:00:00 2001
From: marha <marha@users.sourceforge.net>
Date: Wed, 27 Apr 2011 06:58:32 +0000
Subject: xserver libX11 libxtrans mesa pixman xkeyboard-config git update 27
 Apr 2011

---
 X11/xtrans/Xtrans.h                                |    8 +
 X11/xtrans/Xtransint.h                             |   10 +
 X11/xtrans/transport.c                             |   10 +
 libX11/modules/im/ximcp/imDefIc.c                  |    3 +-
 libX11/modules/im/ximcp/imInt.c                    |    9 +-
 libX11/modules/im/ximcp/imLcIc.c                   |    3 +-
 libX11/modules/im/ximcp/imRm.c                     |   37 +-
 libX11/modules/im/ximcp/imRmAttr.c                 |   15 +-
 libX11/modules/im/ximcp/imThaiIc.c                 |    3 +-
 libX11/modules/im/ximcp/imTrX.c                    |    3 +-
 libX11/modules/im/ximcp/imTrans.c                  |  629 +-
 libX11/modules/lc/gen/lcGenConv.c                  |    3 +-
 libX11/modules/lc/xlocale/lcJis.c                  |    3 +-
 libX11/modules/om/generic/omGeneric.c              |   59 +-
 libX11/specs/libX11/CH02.xml                       | 6983 +++++++++---------
 libX11/src/FSWrap.c                                |    3 +-
 libX11/src/InitExt.c                               |    3 +-
 libX11/src/Quarks.c                                |    3 +-
 libX11/src/SetLocale.c                             |    3 +-
 libX11/src/Xrm.c                                   |    6 +-
 libX11/src/xcms/PrOfId.c                           |   11 +-
 libX11/src/xkb/XKBGAlloc.c                         | 2027 +++---
 libX11/src/xlibi18n/XDefaultIMIF.c                 |  940 ++-
 libX11/src/xlibi18n/XDefaultOMIF.c                 |   41 +-
 libX11/src/xlibi18n/XlcDL.c                        | 1264 ++--
 libX11/src/xlibi18n/lcCharSet.c                    |    3 +-
 libX11/src/xlibi18n/lcDB.c                         |   18 +-
 libX11/src/xlibi18n/lcFile.c                       |   14 +-
 libX11/src/xlibi18n/lcGeneric.c                    |   33 +-
 libX11/src/xlibi18n/lcPublic.c                     |    9 +-
 mesalib/Makefile                                   | 1021 +--
 mesalib/configure.ac                               |   32 +-
 mesalib/docs/GL3.txt                               |   12 +-
 mesalib/docs/README.WIN32                          |  105 +-
 mesalib/docs/WL_bind_wayland_display.spec          |  184 +-
 mesalib/docs/install.html                          |    1 -
 mesalib/docs/patents.txt                           |   31 +
 mesalib/docs/relnotes-7.11.html                    |   17 +-
 mesalib/include/EGL/eglext.h                       |  795 +-
 mesalib/include/EGL/eglplatform.h                  |  252 +-
 mesalib/src/SConscript                             |   65 +-
 mesalib/src/glsl/ast_function.cpp                  | 2586 +++----
 mesalib/src/glsl/ast_to_hir.cpp                    |   60 +-
 mesalib/src/glsl/glcpp/glcpp-parse.y               |    6 +-
 mesalib/src/glsl/ir_validate.cpp                   |    6 +-
 mesalib/src/glsl/linker.cpp                        |   12 +-
 mesalib/src/glu/sgi/SConscript                     |  138 +
 mesalib/src/glu/sgi/include/gluos.h                |    6 +-
 mesalib/src/glu/sgi/libutil/mipmap.c               |    4 +-
 mesalib/src/mapi/glapi/gen/ARB_robustness.xml      |  185 +
 mesalib/src/mapi/glapi/gen/Makefile                |    1 +
 mesalib/src/mapi/glapi/gen/gl_API.xml              |    2 +
 mesalib/src/mapi/glapi/gen/gl_XML.py               |    2 +-
 mesalib/src/mapi/glapi/glapi_mapi_tmp.h            | 1688 +++--
 mesalib/src/mapi/glapi/glapi_sparc.S               |  646 +-
 mesalib/src/mapi/glapi/glapi_x86-64.S              | 3506 +++++----
 mesalib/src/mapi/glapi/glapi_x86.S                 |  944 +--
 mesalib/src/mapi/glapi/glapitable.h                |  584 +-
 mesalib/src/mapi/glapi/glapitemp.h                 |  350 +-
 mesalib/src/mapi/glapi/glprocs.h                   | 1458 ++--
 mesalib/src/mesa/SConscript                        |   78 +-
 mesalib/src/mesa/drivers/SConscript                |    6 +
 mesalib/src/mesa/drivers/common/driverfuncs.c      |  661 +-
 mesalib/src/mesa/drivers/common/meta.c             |   81 +-
 mesalib/src/mesa/drivers/dri/common/spantmp2.h     | 1954 +++--
 mesalib/src/mesa/drivers/windows/fx/fx.rc          |   39 -
 mesalib/src/mesa/drivers/windows/fx/fxopengl.def   |  953 ---
 mesalib/src/mesa/drivers/windows/fx/fxwgl.c        | 1307 ----
 .../mesa/drivers/windows/gdi/InitCritSections.cpp  |   33 -
 mesalib/src/mesa/drivers/windows/gdi/SConscript    |   38 +
 mesalib/src/mesa/drivers/windows/gdi/mesa.def      |  107 -
 mesalib/src/mesa/drivers/windows/gdi/wgl.c         |    4 +-
 mesalib/src/mesa/drivers/windows/gdi/wmesa.c       |  274 +-
 mesalib/src/mesa/drivers/windows/gdi/wmesadef.h    |   86 +-
 mesalib/src/mesa/main/api_exec.c                   |    9 +
 mesalib/src/mesa/main/colortab.c                   |   18 +-
 mesalib/src/mesa/main/context.c                    |    4 +
 mesalib/src/mesa/main/convolve.c                   |  387 +-
 mesalib/src/mesa/main/depthstencil.c               | 1667 ++---
 mesalib/src/mesa/main/dlist.c                      |    4 +-
 mesalib/src/mesa/main/drawpix.c                    |   16 +-
 mesalib/src/mesa/main/enums.c                      | 6668 ++++++++---------
 mesalib/src/mesa/main/eval.c                       | 2093 +++---
 mesalib/src/mesa/main/extensions.c                 |    1 +
 mesalib/src/mesa/main/ff_fragment_shader.cpp       |   44 +-
 mesalib/src/mesa/main/get.c                        |    3 +
 mesalib/src/mesa/main/get.h                        |    4 +
 mesalib/src/mesa/main/getstring.c                  |  523 +-
 mesalib/src/mesa/main/glapidispatch.h              | 1252 ++--
 mesalib/src/mesa/main/histogram.c                  |  324 +-
 mesalib/src/mesa/main/mipmap.c                     |   81 +-
 mesalib/src/mesa/main/mtypes.h                     |   26 +-
 mesalib/src/mesa/main/pack.c                       |    4 +-
 mesalib/src/mesa/main/pbo.c                        |  106 +-
 mesalib/src/mesa/main/pbo.h                        |   11 +-
 mesalib/src/mesa/main/pixel.c                      |   74 +-
 mesalib/src/mesa/main/polygon.c                    |   16 +-
 mesalib/src/mesa/main/polygon.h                    |  137 +-
 mesalib/src/mesa/main/readpix.c                    |  501 +-
 mesalib/src/mesa/main/readpix.h                    |   90 +-
 mesalib/src/mesa/main/remap_helper.h               | 4023 +++++-----
 mesalib/src/mesa/main/renderbuffer.c               | 1135 ++-
 mesalib/src/mesa/main/renderbuffer.h               |  228 +-
 mesalib/src/mesa/main/samplerobj.c                 |    2 +-
 mesalib/src/mesa/main/samplerobj.h                 |    8 +
 mesalib/src/mesa/main/texformat.c                  |   42 +-
 mesalib/src/mesa/main/texgetimage.c                | 1868 ++---
 mesalib/src/mesa/main/texgetimage.h                |  125 +-
 mesalib/src/mesa/main/teximage.c                   | 7680 ++++++++++----------
 mesalib/src/mesa/main/texstore.c                   |    3 +-
 mesalib/src/mesa/main/uniforms.c                   |  106 +-
 mesalib/src/mesa/main/uniforms.h                   |  401 +-
 mesalib/src/mesa/program/arbprogparse.c            |   18 +-
 mesalib/src/mesa/program/hash_table.c              |   19 +
 mesalib/src/mesa/program/hash_table.h              |    7 +
 mesalib/src/mesa/program/prog_optimize.c           |   89 +
 mesalib/src/mesa/program/program.c                 | 2153 +++---
 mesalib/src/mesa/program/program_parse.y           |   11 +-
 mesalib/src/mesa/program/programopt.c              |   33 +-
 mesalib/src/mesa/program/programopt.h              |    4 +-
 mesalib/src/mesa/state_tracker/st_atom_sampler.c   |    4 +-
 mesalib/src/mesa/state_tracker/st_atom_texture.c   |    4 +-
 .../src/mesa/state_tracker/st_cb_bufferobjects.c   |  929 ++-
 mesalib/src/mesa/state_tracker/st_cb_readpixels.c  |   33 +-
 mesalib/src/mesa/state_tracker/st_cb_texture.c     |    9 +-
 mesalib/src/mesa/state_tracker/st_texture.h        |   15 -
 mesalib/src/mesa/swrast/s_accum.c                  | 1192 +--
 mesalib/src/mesa/swrast/s_context.c                | 1906 +++--
 mesalib/src/mesa/swrast/s_context.h                |  697 +-
 mesalib/src/mesa/swrast/s_fog.c                    |  488 +-
 mesalib/src/mesa/swrast/s_readpix.c                |   22 +-
 mesalib/src/mesa/swrast/s_span.c                   |    8 +-
 mesalib/src/mesa/tnl/t_context.c                   |  444 +-
 mesalib/src/mesa/vbo/vbo_exec_array.c              | 2678 ++++---
 mesalib/windows/VC8/mesa/gdi/gdi.vcproj            |  445 --
 .../glsl_apps_compile/glsl_apps_compile.vcproj     |  305 -
 mesalib/windows/VC8/mesa/glu/glu.vcproj            | 1202 ---
 mesalib/windows/VC8/mesa/mesa.sln                  |   77 -
 mesalib/windows/VC8/mesa/mesa/mesa.vcproj          | 2434 -------
 mesalib/windows/VC8/mesa/osmesa/osmesa.vcproj      |  413 --
 pixman/configure.ac                                |   51 +-
 pixman/demos/tri-test.c                            |   96 +-
 pixman/pixman/Makefile.am                          |    1 +
 pixman/pixman/pixman-arm-common.h                  |  863 +--
 pixman/pixman/pixman-arm-neon-asm-bilinear.S       |  768 ++
 pixman/pixman/pixman-arm-neon-asm.S                |  169 +
 pixman/pixman/pixman-arm-neon.c                    |  963 +--
 pixman/pixman/pixman-trap.c                        | 1325 ++--
 pixman/test/composite-traps-test.c                 |  514 +-
 xorg-server/Xext/xtest.c                           |    2 +-
 xorg-server/Xi/exevents.c                          |   11 +-
 xorg-server/Xi/extinit.c                           |    2 +-
 xorg-server/Xi/xichangehierarchy.c                 |    2 +
 xorg-server/Xi/xipassivegrab.c                     |  622 +-
 xorg-server/composite/compalloc.c                  | 1396 ++--
 xorg-server/configure.ac                           |   16 +-
 xorg-server/dix/devices.c                          |   49 +-
 xorg-server/dix/getevents.c                        |   21 +-
 xorg-server/dix/ptrveloc.c                         | 2484 +++----
 xorg-server/dix/resource.c                         | 1926 ++---
 xorg-server/glx/Makefile.am                        |  199 +-
 xorg-server/glx/glxcmds.c                          | 4665 ++++++------
 xorg-server/glx/glxdri2.c                          | 1583 ++--
 xorg-server/glx/glxext.c                           | 1108 +--
 xorg-server/hw/dmx/input/dmxevents.c               | 1600 ++--
 xorg-server/hw/kdrive/src/kinput.c                 |    4 +-
 xorg-server/hw/xfree86/common/xf86Configure.c      | 1517 ++--
 xorg-server/hw/xfree86/common/xf86Events.c         |    2 +-
 xorg-server/hw/xfree86/common/xf86Xinput.c         |   15 +-
 xorg-server/hw/xfree86/os-support/linux/lnx_init.c |  675 +-
 xorg-server/hw/xnest/Events.c                      |  466 +-
 xorg-server/hw/xquartz/X11Application.m            |   78 +-
 xorg-server/hw/xquartz/darwin.c                    |    3 -
 xorg-server/hw/xquartz/darwin.h                    |    1 -
 xorg-server/hw/xquartz/darwinEvents.c              |   50 +-
 xorg-server/hw/xquartz/darwinEvents.h              |    3 +-
 xorg-server/hw/xquartz/mach-startup/bundle-main.c  | 1389 ++--
 xorg-server/hw/xwin/winkeybd.c                     | 1062 +--
 xorg-server/include/dix-config.h.in                |    3 +
 xorg-server/include/input.h                        |   11 +-
 xorg-server/include/inputstr.h                     |    2 +-
 xorg-server/include/ptrveloc.h                     |  288 +-
 xorg-server/test/Makefile.am                       |    6 +-
 xorg-server/test/input.c                           |  523 +-
 xorg-server/test/list.c                            |  349 +-
 xorg-server/test/xi2/Makefile.am                   |   10 +-
 xorg-server/test/xi2/protocol-common.c             |  355 +-
 xorg-server/test/xi2/protocol-common.h             |   11 +-
 xorg-server/test/xi2/protocol-eventconvert.c       |  172 +-
 xorg-server/test/xi2/protocol-xigetclientpointer.c |   31 +-
 .../test/xi2/protocol-xigetselectedevents.c        |   28 +-
 .../test/xi2/protocol-xipassivegrabdevice.c        |  234 +
 xorg-server/test/xi2/protocol-xiquerydevice.c      |   98 +-
 xorg-server/test/xi2/protocol-xiquerypointer.c     |   38 +-
 xorg-server/test/xi2/protocol-xiqueryversion.c     |   28 +-
 xorg-server/test/xi2/protocol-xiselectevents.c     |   24 +-
 xorg-server/test/xi2/protocol-xisetclientpointer.c |   32 +-
 xorg-server/test/xi2/protocol-xiwarppointer.c      |   24 +-
 xorg-server/test/xkb.c                             |   76 +-
 xorg-server/test/xtest.c                           |  231 +-
 .../xkeyboard-config/rules/base.extras.xml.in      |   20 +-
 xorg-server/xkeyboard-config/symbols/apl           |    2 +-
 xorg-server/xkeyboard-config/symbols/et            |    2 +-
 xorg-server/xkeyboard-config/symbols/lv            |    2 +-
 xorg-server/xkeyboard-config/symbols/us            |    4 +-
 .../xkeyboard-config/tests/genLists4Comparizon.sh  |   94 +-
 206 files changed, 51664 insertions(+), 54534 deletions(-)
 create mode 100644 mesalib/docs/patents.txt
 create mode 100644 mesalib/src/glu/sgi/SConscript
 create mode 100644 mesalib/src/mapi/glapi/gen/ARB_robustness.xml
 create mode 100644 mesalib/src/mesa/drivers/SConscript
 delete mode 100644 mesalib/src/mesa/drivers/windows/fx/fx.rc
 delete mode 100644 mesalib/src/mesa/drivers/windows/fx/fxopengl.def
 delete mode 100644 mesalib/src/mesa/drivers/windows/fx/fxwgl.c
 delete mode 100644 mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp
 create mode 100644 mesalib/src/mesa/drivers/windows/gdi/SConscript
 delete mode 100644 mesalib/windows/VC8/mesa/gdi/gdi.vcproj
 delete mode 100644 mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcproj
 delete mode 100644 mesalib/windows/VC8/mesa/glu/glu.vcproj
 delete mode 100644 mesalib/windows/VC8/mesa/mesa.sln
 delete mode 100644 mesalib/windows/VC8/mesa/mesa/mesa.vcproj
 delete mode 100644 mesalib/windows/VC8/mesa/osmesa/osmesa.vcproj
 create mode 100644 pixman/pixman/pixman-arm-neon-asm-bilinear.S
 create mode 100644 xorg-server/test/xi2/protocol-xipassivegrabdevice.c

diff --git a/X11/xtrans/Xtrans.h b/X11/xtrans/Xtrans.h
index 7670d4811..5eac908d0 100644
--- a/X11/xtrans/Xtrans.h
+++ b/X11/xtrans/Xtrans.h
@@ -57,6 +57,11 @@ from The Open Group.
 #include <sys/socket.h>
 #endif
 
+#ifdef __clang__
+/* Not all clients make use of all provided statics */
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
+#endif
 
 /*
  * Set the functions names according to where this code is being compiled.
@@ -127,6 +132,9 @@ static char* __xtransname = "_XTrans";
 #endif
 #endif /* !TRANS */
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 
 /*
  * Create a single address structure that can be used wherever
diff --git a/X11/xtrans/Xtransint.h b/X11/xtrans/Xtransint.h
index dd1f683b3..ff3fd0b03 100644
--- a/X11/xtrans/Xtransint.h
+++ b/X11/xtrans/Xtransint.h
@@ -307,6 +307,12 @@ typedef struct _Xtransport_table {
 /* Flags to preserve when setting others */
 #define TRANS_KEEPFLAGS	(TRANS_NOUNLINK|TRANS_ABSTRACT)
 
+#ifdef __clang__
+/* Not all clients make use of all provided statics */
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
+#endif
+
 /*
  * readv() and writev() don't exist or don't work correctly on some
  * systems, so they may be emulated.
@@ -357,6 +363,10 @@ static int trans_mkdir (
 );
 #endif
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 /*
  * Some XTRANSDEBUG stuff
  */
diff --git a/X11/xtrans/transport.c b/X11/xtrans/transport.c
index 84a2915a1..0013b01d8 100644
--- a/X11/xtrans/transport.c
+++ b/X11/xtrans/transport.c
@@ -55,6 +55,12 @@ from The Open Group.
 
 #include "Xtransint.h"
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 #ifdef LOCALCONN
 #include "Xtranslcl.c"
 #endif
@@ -66,3 +72,7 @@ from The Open Group.
 #endif
 #include "Xtrans.c"
 #include "Xtransutil.c"
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
diff --git a/libX11/modules/im/ximcp/imDefIc.c b/libX11/modules/im/ximcp/imDefIc.c
index 9283c49c3..a962c1b0f 100644
--- a/libX11/modules/im/ximcp/imDefIc.c
+++ b/libX11/modules/im/ximcp/imDefIc.c
@@ -1425,10 +1425,9 @@ _XimProtoCreateIC(
     if (!(_XimGetInputStyle(arg, &input_style)))
 	return (XIC)NULL;
 
-    if ((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL)
+    if ((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL)
 	return (XIC)NULL;
 
-    bzero((char *)ic, sizeof(XicRec));
     ic->methods = &ic_methods;
     ic->core.im = (XIM)im;
     ic->core.input_style = input_style;
diff --git a/libX11/modules/im/ximcp/imInt.c b/libX11/modules/im/ximcp/imInt.c
index b19809237..26f4991a2 100644
--- a/libX11/modules/im/ximcp/imInt.c
+++ b/libX11/modules/im/ximcp/imInt.c
@@ -204,9 +204,8 @@ _XimOpenIM(
     Xim			 im;
     register int	 i;
 
-    if (!(im = (Xim)Xmalloc(sizeof(XimRec))))
+    if (!(im = Xcalloc(1, sizeof(XimRec))))
 	return (XIM)NULL;
-    bzero(im, sizeof(XimRec));
 
     im->core.lcd       = lcd;
     im->core.ic_chain  = (XIC)NULL;
@@ -215,14 +214,12 @@ _XimOpenIM(
     im->core.res_name  = NULL;
     im->core.res_class = NULL;
     if((res_name != NULL) && (*res_name != '\0')){
-	if(!(im->core.res_name  = (char *)Xmalloc(strlen(res_name)+1)))
+	if(!(im->core.res_name  = strdup(res_name)))
 	    goto Error1;
-	strcpy(im->core.res_name,res_name);
     }
     if((res_class != NULL) && (*res_class != '\0')){
-	if(!(im->core.res_class = (char *)Xmalloc(strlen(res_class)+1)))
+	if(!(im->core.res_class = strdup(res_class)))
 	    goto Error2;
-	strcpy(im->core.res_class,res_class);
     }
     if(!(im->core.im_name = _XimMakeImName(lcd)))
 	goto Error3;
diff --git a/libX11/modules/im/ximcp/imLcIc.c b/libX11/modules/im/ximcp/imLcIc.c
index c0728084f..49338853c 100644
--- a/libX11/modules/im/ximcp/imLcIc.c
+++ b/libX11/modules/im/ximcp/imLcIc.c
@@ -143,10 +143,9 @@ _XimLocalCreateIC(
     unsigned int	 num;
     int			 len;
 
-    if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) {
+    if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) {
 	return ((XIC)NULL);
     }
-    bzero((char *)ic, sizeof(XicRec));
 
     ic->methods = &Local_ic_methods;
     ic->core.im = im;
diff --git a/libX11/modules/im/ximcp/imRm.c b/libX11/modules/im/ximcp/imRm.c
index 3d09b8136..da1207ca1 100644
--- a/libX11/modules/im/ximcp/imRm.c
+++ b/libX11/modules/im/ximcp/imRm.c
@@ -360,10 +360,9 @@ _XimDefaultStyles(
 
     n = XIMNumber(supported_local_styles) - 1;
     len = sizeof(XIMStyles) + sizeof(XIMStyle) * n;
-    if(!(tmp = (XPointer)Xmalloc(len))) {
+    if(!(tmp = Xcalloc(1, len))) {
 	return False;
     }
-    bzero(tmp, len);
 
     styles = (XIMStyles *)tmp;
     if (n > 0) {
@@ -396,10 +395,9 @@ _XimDefaultIMValues(
 
     n = XIMNumber(supported_local_im_values_list);
     len = sizeof(XIMValuesList) + sizeof(char **) * n;
-    if(!(tmp = (XPointer)Xmalloc(len))) {
+    if(!(tmp = Xcalloc(1, len))) {
 	return False;
     }
-    bzero(tmp, len);
 
     values_list = (XIMValuesList *)tmp;
     if (n > 0) {
@@ -433,10 +431,9 @@ _XimDefaultICValues(
 
     n = XIMNumber(supported_local_ic_values_list);
     len = sizeof(XIMValuesList) + sizeof(char **) * n;
-    if(!(tmp = (XPointer)Xmalloc(len))) {
+    if(!(tmp = Xcalloc(1, len))) {
 	return False;
     }
-    bzero(tmp, len);
 
     values_list = (XIMValuesList *)tmp;
     if (n > 0) {
@@ -796,19 +793,15 @@ _XimEncodeString(
     XPointer	 	  top,
     XPointer	 	  val)
 {
-    int			  len;
     char		 *string;
     char		**out;
 
     if(val == (XPointer)NULL) {
 	return False;
     }
-    len = strlen((char *)val);
-    if(!(string = (char *)Xmalloc(len + 1))) {
+    if (!(string = strdup((char *)val))) {
 	return False;
     }
-    (void)strcpy(string, (char *)val);
-    string[len] = '\0';
 
     out = (char **)((char *)top + info->offset);
     if(*out) {
@@ -1085,10 +1078,9 @@ _XimDecodeStyles(
     num = styles->count_styles;
 
     len = sizeof(XIMStyles) + sizeof(XIMStyle) * num;
-    if(!(tmp = (XPointer)Xmalloc(len))) {
+    if(!(tmp = Xcalloc(1, len))) {
 	return False;
     }
-    bzero(tmp, len);
 
     out = (XIMStyles *)tmp;
     if(num >0) {
@@ -1124,10 +1116,9 @@ _XimDecodeValues(
     num = values_list->count_values;
 
     len = sizeof(XIMValuesList) + sizeof(char **) * num;
-    if(!(tmp = (char *)Xmalloc(len))) {
+    if(!(tmp = Xcalloc(1, len))) {
 	return False;
     }
-    bzero(tmp, len);
 
     out = (XIMValuesList *)tmp;
     if(num) {
@@ -1168,21 +1159,18 @@ _XimDecodeString(
     XPointer	 	 top,
     XPointer	 	 val)
 {
-    int			 len = 0;
     char		*in;
     char		*string;
 
     in = *((char **)((char *)top + info->offset));
-    if(in != (char *)NULL) {
-	len = strlen(in);
+    if (in != NULL) {
+	string = strdup(in);
+    } else {
+	string = Xcalloc(1, 1); /* strdup("") */
     }
-    if(!(string = (char *)Xmalloc(len + 1))) {
+    if (string == NULL) {
 	return False;
     }
-    if(in != (char *)NULL) {
-	(void)strcpy(string, in);
-    }
-    string[len] = '\0';
     *((char **)val) = string;
     return True;
 }
@@ -2143,10 +2131,9 @@ _XimSetResourceList(
     XIMResourceList	  res;
 
     len = sizeof(XIMResource) * num_resource;
-    if(!(res = (XIMResourceList)Xmalloc(len))) {
+    if(!(res = Xcalloc(1, len))) {
 	return False;
     }
-    bzero((char *)res, len);
 
     for(i = 0; i < num_resource; i++, id++) {
 	res[i]    = resource[i];
diff --git a/libX11/modules/im/ximcp/imRmAttr.c b/libX11/modules/im/ximcp/imRmAttr.c
index 27dcbc9cd..2e732658a 100644
--- a/libX11/modules/im/ximcp/imRmAttr.c
+++ b/libX11/modules/im/ximcp/imRmAttr.c
@@ -1408,7 +1408,6 @@ _XimGetAttributeID(
 {
     unsigned int	  n;
     XIMResourceList	  res;
-    int			  res_len;
     char		 *names;
     int			  names_len;
     XPointer		  tmp;
@@ -1426,18 +1425,15 @@ _XimGetAttributeID(
 
     if (!(n = _XimCountNumberOfAttr(buf[0], &buf[1], &names_len)))
 	return False;
-    res_len = sizeof(XIMResource) * n;
 
-    if (!(res = (XIMResourceList)Xmalloc(res_len)))
+    if (!(res = Xcalloc(n, sizeof(XIMResource))))
 	return False;
-    bzero((char *)res, res_len);
 
     values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len;
-    if (!(tmp = (XPointer)Xmalloc(values_len))) {
+    if (!(tmp = Xcalloc(1, values_len))) {
 	Xfree(res);
 	return False;
     }
-    bzero(tmp, values_len);
 
     values_list = (XIMValuesList *)tmp;
     values = (char **)((char *)tmp + sizeof(XIMValuesList));
@@ -1475,18 +1471,15 @@ _XimGetAttributeID(
 
     if (!(n = _XimCountNumberOfAttr(buf[0], &buf[2], &names_len)))
 	return False;
-    res_len = sizeof(XIMResource) * n;
 
-    if (!(res = (XIMResourceList)Xmalloc(res_len)))
+    if (!(res = Xcalloc(n, sizeof(XIMResource))))
 	return False;
-    bzero((char *)res, res_len);
 
     values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len;
-    if (!(tmp = (XPointer)Xmalloc(values_len))) {
+    if (!(tmp = Xcalloc(1, values_len))) {
 	Xfree(res);
 	return False;
     }
-    bzero(tmp, values_len);
 
     values_list = (XIMValuesList *)tmp;
     values = (char **)((char *)tmp + sizeof(XIMValuesList));
diff --git a/libX11/modules/im/ximcp/imThaiIc.c b/libX11/modules/im/ximcp/imThaiIc.c
index d1cb22a5e..95433f3d7 100644
--- a/libX11/modules/im/ximcp/imThaiIc.c
+++ b/libX11/modules/im/ximcp/imThaiIc.c
@@ -157,10 +157,9 @@ _XimThaiCreateIC(
     int			 len;
     DefTree             *tree;
 
-    if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) {
+    if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) {
 	return ((XIC)NULL);
     }
-    bzero((char *)ic,      sizeof(XicRec));
 
     ic->methods = &Thai_ic_methods;
     ic->core.im = im;
diff --git a/libX11/modules/im/ximcp/imTrX.c b/libX11/modules/im/ximcp/imTrX.c
index edcaf0852..d85d1d114 100644
--- a/libX11/modules/im/ximcp/imTrX.c
+++ b/libX11/modules/im/ximcp/imTrX.c
@@ -496,9 +496,8 @@ _XimXConf(Xim im, char *address)
 {
     XSpecRec	*spec;
 
-    if (!(spec = (XSpecRec *)Xmalloc(sizeof(XSpecRec))))
+    if (!(spec = Xcalloc(1, sizeof(XSpecRec))))
 	return False;
-    bzero(spec, sizeof(XSpecRec));
 
     spec->improtocolid = XInternAtom(im->core.display, _XIM_PROTOCOL, False);
     spec->imconnectid  = XInternAtom(im->core.display, _XIM_XCONNECT, False);
diff --git a/libX11/modules/im/ximcp/imTrans.c b/libX11/modules/im/ximcp/imTrans.c
index 7673279c6..0ac08aa60 100644
--- a/libX11/modules/im/ximcp/imTrans.c
+++ b/libX11/modules/im/ximcp/imTrans.c
@@ -1,316 +1,313 @@
-/*
- * Copyright 1992 Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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.
- */
-/******************************************************************
-
-           Copyright 1992, 1993, 1994 by FUJITSU LIMITED
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of FUJITSU LIMITED
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-FUJITSU LIMITED makes no representations about the suitability of
-this software for any purpose.
-It is provided "as is" without express or implied warranty.
-
-FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
-  Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
-          Takashi Fujiwara     FUJITSU LIMITED
-                               fujiwara@a80.tech.yk.fujitsu.co.jp
-
-******************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <X11/Xatom.h>
-#include <X11/Xmd.h>
-#include "Xlibint.h"
-#include <X11/Xtrans/Xtrans.h>
-#include "Xlcint.h"
-#include "Ximint.h"
-#include "XimTrans.h"
-#include "XimTrInt.h"
-
-#ifdef WIN32
-#include <X11/Xwindows.h>
-#endif
-
-
-#ifndef XIM_CONNECTION_RETRIES
-#define XIM_CONNECTION_RETRIES 5
-#endif
-
-
-Private Bool
-_XimTransConnect(
-    Xim			 im)
-{
-    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
-    int			connect_stat, retry;
-    Window		window;
-
-    for (retry = XIM_CONNECTION_RETRIES; retry >= 0; retry--)
-    {
-	if ((spec->trans_conn = _XimXTransOpenCOTSClient (
-	    spec->address)) == NULL)
-	{
-	    break;
-	}
-
-	if ((connect_stat = _XimXTransConnect (
-	    spec->trans_conn, spec->address)) < 0)
-	{
-	    _XimXTransClose (spec->trans_conn);
-	    spec->trans_conn = NULL;
-
-	    if (connect_stat == TRANS_TRY_CONNECT_AGAIN)
-		continue;
-	    else
-		break;
-	}
-	else
-	    break;
-    }
-
-    if (spec->trans_conn == NULL)
-	return False;
-
-    spec->fd = _XimXTransGetConnectionNumber (spec->trans_conn);
-
-    if (!(window = XCreateSimpleWindow(im->core.display,
-		DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0)))
-	return False;
-    spec->window = window;
-
-    _XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress,
-				_XimTransFilterWaitEvent, (XPointer)im);
-
-    return _XRegisterInternalConnection(im->core.display, spec->fd,
-			(_XInternalConnectionProc)_XimTransInternalConnection,
-			(XPointer)im);
-}
-
-
-Private Bool
-_XimTransShutdown(
-    Xim im)
-{
-    TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec;
-
-    _XimXTransDisconnect(spec->trans_conn);
-    (void)_XimXTransClose(spec->trans_conn);
-    _XimFreeTransIntrCallback(im);
-    _XUnregisterInternalConnection(im->core.display, spec->fd);
-    _XUnregisterFilter(im->core.display, spec->window,
-				_XimTransFilterWaitEvent, (XPointer)im);
-    XDestroyWindow(im->core.display, spec->window);
-    Xfree(spec->address);
-    Xfree(spec);
-    return True;
-}
-
-
-
-Public Bool
-_XimTransRegisterDispatcher(
-    Xim				 im,
-    Bool			 (*callback)(
-					     Xim, INT16, XPointer, XPointer
-					     ),
-    XPointer			 call_data)
-{
-    TransSpecRec		*spec = (TransSpecRec *)im->private.proto.spec;
-    TransIntrCallbackPtr	 rec;
-
-    if (!(rec = (TransIntrCallbackPtr)Xmalloc(sizeof(TransIntrCallbackRec))))
-        return False;
-
-    rec->func       = callback;
-    rec->call_data  = call_data;
-    rec->next       = spec->intr_cb;
-    spec->intr_cb   = rec;
-    return True;
-}
-
-
-Public void
-_XimFreeTransIntrCallback(
-    Xim				 im)
-{
-    TransSpecRec		*spec = (TransSpecRec *)im->private.proto.spec;
-    register TransIntrCallbackPtr	 rec, next;
-
-    for (rec = spec->intr_cb; rec;) {
-	next = rec->next;
-	Xfree(rec);
-	rec = next;
-    }
-    return;
-}
-
-
-Public Bool
-_XimTransCallDispatcher(Xim im, INT16 len, XPointer data)
-{
-    TransSpecRec		*spec = (TransSpecRec *)im->private.proto.spec;
-    TransIntrCallbackRec	*rec;
-
-    for (rec = spec->intr_cb; rec; rec = rec->next) {
-	if ((*rec->func)(im, len, data, rec->call_data))
-	    return True;
-    }
-    return False;
-}
-
-
-Public Bool
-_XimTransFilterWaitEvent(
-    Display		*d,
-    Window		 w,
-    XEvent		*ev,
-    XPointer		 arg)
-{
-    Xim			 im = (Xim)arg;
-    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
-
-    spec->is_putback  = False;
-    return _XimFilterWaitEvent(im);
-}
-
-
-Public void
-_XimTransInternalConnection(
-    Display		*d,
-    int			 fd,
-    XPointer		 arg)
-{
-    Xim			 im = (Xim)arg;
-    XEvent		 ev;
-    XKeyEvent		*kev;
-    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
-
-    if (spec->is_putback)
-	return;
-    kev = (XKeyEvent *)&ev;
-    kev->type = KeyPress;
-    kev->send_event = False;
-    kev->display = im->core.display;
-    kev->window = spec->window;
-    kev->keycode = 0;
-    XPutBackEvent(im->core.display, &ev);
-    XFlush(im->core.display);
-    spec->is_putback = True;
-    return;
-}
-
-
-Public Bool
-_XimTransWrite(Xim im, INT16 len, XPointer data)
-{
-    TransSpecRec	*spec	= (TransSpecRec *)im->private.proto.spec;
-    char		*buf = (char *)data;
-    register int	 nbyte;
-
-    while (len > 0) {
-	if ((nbyte = _XimXTransWrite(spec->trans_conn, buf, len)) <= 0)
-	    return False;
-	len -= nbyte;
-	buf += nbyte;
-    }
-    return True;
-}
-
-
-Public Bool
-_XimTransRead(
-    Xim			 im,
-    XPointer		 recv_buf,
-    int			 buf_len,
-    int			*ret_len)
-{
-    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
-    int			 len;
-
-    if (buf_len == 0) {
-	*ret_len = 0;
-	return True;
-    }
-    if ((len = _XimXTransRead(spec->trans_conn, recv_buf, buf_len)) <= 0)
-	return False;
-    *ret_len = len;
-    return True;
-}
-
-
-Public void
-_XimTransFlush(
-    Xim		 im)
-{
-    return;
-}
-
-
-
-Public Bool
-_XimTransConf(
-    Xim		   	 im,
-    char	 	*address)
-{
-    char		*paddr;
-    TransSpecRec	*spec;
-
-    if (!(paddr = (char *)Xmalloc(strlen(address) + 1)))
-	return False;
-
-    if (!(spec = (TransSpecRec *) Xmalloc(sizeof(TransSpecRec)))) {
-	Xfree(paddr);
-	return False;
-    }
-
-    bzero(spec, sizeof(TransSpecRec));
-
-    (void)strcpy(paddr, address);
-    spec->address   = paddr;
-
-    im->private.proto.spec     = (XPointer)spec;
-    im->private.proto.connect  = _XimTransConnect;
-    im->private.proto.shutdown = _XimTransShutdown;
-    im->private.proto.write    = _XimTransWrite;
-    im->private.proto.read     = _XimTransRead;
-    im->private.proto.flush    = _XimTransFlush;
-    im->private.proto.register_dispatcher = _XimTransRegisterDispatcher;
-    im->private.proto.call_dispatcher = _XimTransCallDispatcher;
-
-    return True;
-}
+/*
+ * Copyright 1992 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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.
+ */
+/******************************************************************
+
+           Copyright 1992, 1993, 1994 by FUJITSU LIMITED
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation, and that the name of FUJITSU LIMITED
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+FUJITSU LIMITED makes no representations about the suitability of
+this software for any purpose.
+It is provided "as is" without express or implied warranty.
+
+FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+  Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
+          Takashi Fujiwara     FUJITSU LIMITED
+                               fujiwara@a80.tech.yk.fujitsu.co.jp
+
+******************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xatom.h>
+#include <X11/Xmd.h>
+#include "Xlibint.h"
+#include <X11/Xtrans/Xtrans.h>
+#include "Xlcint.h"
+#include "Ximint.h"
+#include "XimTrans.h"
+#include "XimTrInt.h"
+
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
+
+#ifndef XIM_CONNECTION_RETRIES
+#define XIM_CONNECTION_RETRIES 5
+#endif
+
+
+Private Bool
+_XimTransConnect(
+    Xim			 im)
+{
+    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
+    int			connect_stat, retry;
+    Window		window;
+
+    for (retry = XIM_CONNECTION_RETRIES; retry >= 0; retry--)
+    {
+	if ((spec->trans_conn = _XimXTransOpenCOTSClient (
+	    spec->address)) == NULL)
+	{
+	    break;
+	}
+
+	if ((connect_stat = _XimXTransConnect (
+	    spec->trans_conn, spec->address)) < 0)
+	{
+	    _XimXTransClose (spec->trans_conn);
+	    spec->trans_conn = NULL;
+
+	    if (connect_stat == TRANS_TRY_CONNECT_AGAIN)
+		continue;
+	    else
+		break;
+	}
+	else
+	    break;
+    }
+
+    if (spec->trans_conn == NULL)
+	return False;
+
+    spec->fd = _XimXTransGetConnectionNumber (spec->trans_conn);
+
+    if (!(window = XCreateSimpleWindow(im->core.display,
+		DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0)))
+	return False;
+    spec->window = window;
+
+    _XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress,
+				_XimTransFilterWaitEvent, (XPointer)im);
+
+    return _XRegisterInternalConnection(im->core.display, spec->fd,
+			(_XInternalConnectionProc)_XimTransInternalConnection,
+			(XPointer)im);
+}
+
+
+Private Bool
+_XimTransShutdown(
+    Xim im)
+{
+    TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec;
+
+    _XimXTransDisconnect(spec->trans_conn);
+    (void)_XimXTransClose(spec->trans_conn);
+    _XimFreeTransIntrCallback(im);
+    _XUnregisterInternalConnection(im->core.display, spec->fd);
+    _XUnregisterFilter(im->core.display, spec->window,
+				_XimTransFilterWaitEvent, (XPointer)im);
+    XDestroyWindow(im->core.display, spec->window);
+    Xfree(spec->address);
+    Xfree(spec);
+    return True;
+}
+
+
+
+Public Bool
+_XimTransRegisterDispatcher(
+    Xim				 im,
+    Bool			 (*callback)(
+					     Xim, INT16, XPointer, XPointer
+					     ),
+    XPointer			 call_data)
+{
+    TransSpecRec		*spec = (TransSpecRec *)im->private.proto.spec;
+    TransIntrCallbackPtr	 rec;
+
+    if (!(rec = (TransIntrCallbackPtr)Xmalloc(sizeof(TransIntrCallbackRec))))
+        return False;
+
+    rec->func       = callback;
+    rec->call_data  = call_data;
+    rec->next       = spec->intr_cb;
+    spec->intr_cb   = rec;
+    return True;
+}
+
+
+Public void
+_XimFreeTransIntrCallback(
+    Xim				 im)
+{
+    TransSpecRec		*spec = (TransSpecRec *)im->private.proto.spec;
+    register TransIntrCallbackPtr	 rec, next;
+
+    for (rec = spec->intr_cb; rec;) {
+	next = rec->next;
+	Xfree(rec);
+	rec = next;
+    }
+    return;
+}
+
+
+Public Bool
+_XimTransCallDispatcher(Xim im, INT16 len, XPointer data)
+{
+    TransSpecRec		*spec = (TransSpecRec *)im->private.proto.spec;
+    TransIntrCallbackRec	*rec;
+
+    for (rec = spec->intr_cb; rec; rec = rec->next) {
+	if ((*rec->func)(im, len, data, rec->call_data))
+	    return True;
+    }
+    return False;
+}
+
+
+Public Bool
+_XimTransFilterWaitEvent(
+    Display		*d,
+    Window		 w,
+    XEvent		*ev,
+    XPointer		 arg)
+{
+    Xim			 im = (Xim)arg;
+    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
+
+    spec->is_putback  = False;
+    return _XimFilterWaitEvent(im);
+}
+
+
+Public void
+_XimTransInternalConnection(
+    Display		*d,
+    int			 fd,
+    XPointer		 arg)
+{
+    Xim			 im = (Xim)arg;
+    XEvent		 ev;
+    XKeyEvent		*kev;
+    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
+
+    if (spec->is_putback)
+	return;
+    kev = (XKeyEvent *)&ev;
+    kev->type = KeyPress;
+    kev->send_event = False;
+    kev->display = im->core.display;
+    kev->window = spec->window;
+    kev->keycode = 0;
+    XPutBackEvent(im->core.display, &ev);
+    XFlush(im->core.display);
+    spec->is_putback = True;
+    return;
+}
+
+
+Public Bool
+_XimTransWrite(Xim im, INT16 len, XPointer data)
+{
+    TransSpecRec	*spec	= (TransSpecRec *)im->private.proto.spec;
+    char		*buf = (char *)data;
+    register int	 nbyte;
+
+    while (len > 0) {
+	if ((nbyte = _XimXTransWrite(spec->trans_conn, buf, len)) <= 0)
+	    return False;
+	len -= nbyte;
+	buf += nbyte;
+    }
+    return True;
+}
+
+
+Public Bool
+_XimTransRead(
+    Xim			 im,
+    XPointer		 recv_buf,
+    int			 buf_len,
+    int			*ret_len)
+{
+    TransSpecRec	*spec = (TransSpecRec *)im->private.proto.spec;
+    int			 len;
+
+    if (buf_len == 0) {
+	*ret_len = 0;
+	return True;
+    }
+    if ((len = _XimXTransRead(spec->trans_conn, recv_buf, buf_len)) <= 0)
+	return False;
+    *ret_len = len;
+    return True;
+}
+
+
+Public void
+_XimTransFlush(
+    Xim		 im)
+{
+    return;
+}
+
+
+
+Public Bool
+_XimTransConf(
+    Xim		   	 im,
+    char	 	*address)
+{
+    char		*paddr;
+    TransSpecRec	*spec;
+
+    if (!(paddr = strdup(address)))
+	return False;
+
+    if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) {
+	Xfree(paddr);
+	return False;
+    }
+
+    spec->address   = paddr;
+
+    im->private.proto.spec     = (XPointer)spec;
+    im->private.proto.connect  = _XimTransConnect;
+    im->private.proto.shutdown = _XimTransShutdown;
+    im->private.proto.write    = _XimTransWrite;
+    im->private.proto.read     = _XimTransRead;
+    im->private.proto.flush    = _XimTransFlush;
+    im->private.proto.register_dispatcher = _XimTransRegisterDispatcher;
+    im->private.proto.call_dispatcher = _XimTransCallDispatcher;
+
+    return True;
+}
diff --git a/libX11/modules/lc/gen/lcGenConv.c b/libX11/modules/lc/gen/lcGenConv.c
index baac73a39..7a113a78a 100644
--- a/libX11/modules/lc/gen/lcGenConv.c
+++ b/libX11/modules/lc/gen/lcGenConv.c
@@ -2660,10 +2660,9 @@ create_conv(
     *conv->methods = *methods;
     conv->methods->reset = init_state;
 
-    conv->state = (XPointer) Xmalloc(sizeof(StateRec));
+    conv->state = Xcalloc(1, sizeof(StateRec));
     if (conv->state == NULL)
 	goto err;
-    bzero((char *) conv->state, sizeof(StateRec));
 
     state = (State) conv->state;
     state->lcd = lcd;
diff --git a/libX11/modules/lc/xlocale/lcJis.c b/libX11/modules/lc/xlocale/lcJis.c
index 594e6363c..551862d9b 100644
--- a/libX11/modules/lc/xlocale/lcJis.c
+++ b/libX11/modules/lc/xlocale/lcJis.c
@@ -545,10 +545,9 @@ create_conv(
     if (XLC_PUBLIC(lcd, is_state_depend))
 	conv->methods->reset = init_state;
 
-    conv->state = (XPointer) Xmalloc(sizeof(StateRec));
+    conv->state = Xcalloc(1, sizeof(StateRec));
     if (conv->state == NULL)
 	goto err;
-    bzero((char *) conv->state, sizeof(StateRec));
 
     state = (State) conv->state;
     state->lcd = lcd;
diff --git a/libX11/modules/om/generic/omGeneric.c b/libX11/modules/om/generic/omGeneric.c
index 44143ac2e..7f02c8565 100644
--- a/libX11/modules/om/generic/omGeneric.c
+++ b/libX11/modules/om/generic/omGeneric.c
@@ -523,9 +523,7 @@ get_font_name(
     if (list == NULL)
 	return NULL;
 
-    name = (char *) Xmalloc(strlen(*list) + 1);
-    if (name)
-	strcpy(name, *list);
+    name = strdup(*list);
 
     XFreeFontNames(list);
 
@@ -549,10 +547,9 @@ get_rotate_fontname(
        || len > XLFD_MAX_LEN)
 	return NULL;
 
-    pattern = (char *)Xmalloc(len + 1);
+    pattern = strdup(font_name);
     if(!pattern)
 	return NULL;
-    strcpy(pattern, font_name);
 
     memset(fields, 0, sizeof(char *) * 14);
     ptr = pattern;
@@ -661,10 +658,8 @@ get_font_name_from_list(
     for (i = 0; i < count; i++) {
         fname = list[i];
         if(is_match_charset(font_data, fname) == True) {
-             name = (char *) Xmalloc(strlen(fname) + 1);
-             if (name)
-	         strcpy(name, fname);
-             break;
+            name = strdup(fname);
+            break;
         }
     }
 
@@ -685,11 +680,10 @@ parse_all_name(
     if(is_match_charset(font_data, pattern) != True)
  	return False;
 
-    font_data->xlfd_name = (char *)Xmalloc(strlen(pattern)+1);
+    font_data->xlfd_name = strdup(pattern);
     if(font_data->xlfd_name == NULL)
 	return (-1);
 
-    strcpy(font_data->xlfd_name, pattern);
     return True;
 #else  /* OLDCODE */
     Display *dpy = oc->core.om->core.display;
@@ -723,11 +717,10 @@ parse_all_name(
         }
     }
 
-    font_data->xlfd_name = (char *)Xmalloc(strlen(pattern)+1);
+    font_data->xlfd_name = strdup(pattern);
     if(font_data->xlfd_name == NULL)
 	return (-1);
 
-    strcpy(font_data->xlfd_name, pattern);
     return True;
 #endif /* OLDCODE */
 }
@@ -946,12 +939,9 @@ parse_fontdata(
 		* -- jjw/pma (HP)
 		*/
 		if (font_data_return) {
-		    font_data_return->xlfd_name = (char *)Xmalloc
-			(strlen(font_data->xlfd_name) + 1);
+		    font_data_return->xlfd_name = strdup(font_data->xlfd_name);
 		    if (!font_data_return->xlfd_name) return -1;
 
-		    strcpy (font_data_return->xlfd_name, font_data->xlfd_name);
-
 		    font_data_return->side      = font_data->side;
 		}
 #ifdef FONTDEBUG
@@ -996,11 +986,9 @@ parse_fontdata(
 #ifdef FONTDEBUG
 		fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name);
 #endif
-		font_data_return->xlfd_name = (char *)Xmalloc
-			(strlen(font_data->xlfd_name) + 1);
+		font_data_return->xlfd_name = strdup(font_data->xlfd_name);
                 if (!font_data_return->xlfd_name) return -1;
 
-	        strcpy (font_data_return->xlfd_name, font_data->xlfd_name);
 	        font_data_return->side      = font_data->side;
 	    }
 
@@ -1192,11 +1180,10 @@ parse_fontname(
 		 * be matched. It returns the required information in
 		 * font_data_return.
 		 */
-		font_set->font_name = (char *)Xmalloc
-			(strlen(font_data_return.xlfd_name) + 1);
+		font_set->font_name = strdup(font_data_return.xlfd_name);
 		if(font_set->font_name == (char *) NULL)
 		    goto err;
-		strcpy(font_set->font_name, font_data_return.xlfd_name);
+
 		font_set->side = font_data_return.side;
 
                 Xfree (font_data_return.xlfd_name);
@@ -1223,11 +1210,10 @@ parse_fontname(
 			break;
 		    }
 		}
-		font_set->font_name = (char *)Xmalloc
-		    	(strlen(font_set->substitute[i].xlfd_name) + 1);
+		font_set->font_name = strdup(font_set->substitute[i].xlfd_name);
 		if(font_set->font_name == (char *) NULL)
 		    goto err;
-		strcpy(font_set->font_name,font_set->substitute[i].xlfd_name);
+
 		font_set->side = font_set->substitute[i].side;
 		if(parse_vw(oc, font_set, name_list, count) == -1)
 		    goto err;
@@ -1237,11 +1223,10 @@ parse_fontname(
 	}
     }
 
-    base_name = (char *) Xmalloc(strlen(oc->core.base_name_list) + 1);
+    base_name = strdup(oc->core.base_name_list);
     if (base_name == NULL)
 	goto err;
 
-    strcpy(base_name, oc->core.base_name_list);
     oc->core.base_name_list = base_name;
 
     XFreeStringList(name_list);
@@ -1654,10 +1639,9 @@ create_oc(
     XOCMethodsList methods_list = oc_methods_list;
     int count;
 
-    oc = (XOC) Xmalloc(sizeof(XOCGenericRec));
+    oc = Xcalloc(1, sizeof(XOCGenericRec));
     if (oc == NULL)
 	return (XOC) NULL;
-    bzero((char *) oc, sizeof(XOCGenericRec));
 
     oc->core.om = om;
 
@@ -1842,26 +1826,23 @@ create_om(
 {
     XOM om;
 
-    om = (XOM) Xmalloc(sizeof(XOMGenericRec));
+    om = Xcalloc(1, sizeof(XOMGenericRec));
     if (om == NULL)
 	return (XOM) NULL;
-    bzero((char *) om, sizeof(XOMGenericRec));
 
     om->methods = &methods;
     om->core.lcd = lcd;
     om->core.display = dpy;
     om->core.rdb = rdb;
     if (res_name) {
-	om->core.res_name = (char *) Xmalloc(strlen(res_name) + 1);
+	om->core.res_name = strdup(res_name);
 	if (om->core.res_name == NULL)
 	    goto err;
-	strcpy(om->core.res_name, res_name);
     }
     if (res_class) {
-	om->core.res_class = (char *) Xmalloc(strlen(res_class) + 1);
+	om->core.res_class = strdup(res_class);
 	if (om->core.res_class == NULL)
 	    goto err;
-	strcpy(om->core.res_class, res_class);
     }
 
     if (om_resources[0].xrm_name == NULLQUARK)
@@ -1913,10 +1894,9 @@ read_EncodingInfo(
     FontData font_data,ret;
     char *buf, *bufptr,*scp;
     int len;
-    font_data = (FontData) Xmalloc(sizeof(FontDataRec) * count);
+    font_data = Xcalloc(count, sizeof(FontDataRec));
     if (font_data == NULL)
         return NULL;
-    bzero((char *) font_data, sizeof(FontDataRec) * count);
 
     ret = font_data;
     for ( ; count-- > 0; font_data++) {
@@ -2017,10 +1997,9 @@ init_om(
 
     _XlcGetResource(lcd, "XLC_FONTSET", "object_name", &value, &count);
     if (count > 0) {
-	gen->object_name = (char *) Xmalloc(strlen(*value) + 1);
+	gen->object_name = strdup(*value);
 	if (gen->object_name == NULL)
 	    return False;
-	strcpy(gen->object_name, *value);
     }
 
     for (num = 0; ; num++) {
diff --git a/libX11/specs/libX11/CH02.xml b/libX11/specs/libX11/CH02.xml
index a00b7c283..f4ef1bcd8 100644
--- a/libX11/specs/libX11/CH02.xml
+++ b/libX11/specs/libX11/CH02.xml
@@ -1,3494 +1,3489 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
-	  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
-<chapter id="display_functions">
-<title>Display Functions</title>
-<para>
-Before your program can use a display, you must establish a connection
-to the X server.
-Once you have established a connection,
-you then can use the Xlib macros and functions discussed in this chapter
-to return information about the display.
-This chapter discusses how to:
-</para>
-<itemizedlist>
-  <listitem>
-    <para>
-Open (connect to) the display
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Obtain information about the display, image formats, or screens
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Generate a
-<systemitem>NoOperation</systemitem>
-protocol request
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Free client-created data
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Close (disconnect from) a display
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Use X Server connection close operations
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Use Xlib with threads
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Use internal connections
-    </para>
-  </listitem>
-</itemizedlist>
-<sect1 id="Opening_the_Display">
-<title>Opening the Display</title>
-<!-- .XS -->
-<!-- (SN Opening the Display -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-To open a connection to the X server that controls a display, use
-<function>XOpenDisplay</function>.
-<indexterm significance="preferred"><primary>XOpenDisplay</primary></indexterm>
-</para>
-<para>
-<!-- .LP -->
-<!-- .sM -->
-</para>
-<para>
-AllPlanes()
-</para>
-<para>
-XAllPlanes
-</para>
-
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display_name</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the hardware display name, which determines the display
-and communications domain to be used.
-On a <acronym>POSIX</acronym>-conformant system, if the display_name is NULL, 
-it defaults to the value of the DISPLAY environment variable. 
-<indexterm><primary>Environment</primary><secondary>DISPLAY</secondary></indexterm>
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The encoding and interpretation of the display name are
-implementation-dependent.
-Strings in the Host Portable Character Encoding are supported;
-support for other characters is implementation-dependent.
-On <acronym>POSIX</acronym>-conformant systems,
-the display name or DISPLAY environment variable can be a string in the format:
-</para>
-<!-- .LP -->
-<!-- .sM -->
-<literallayout class="monospaced">
-<!-- .TA 1i -->
-<!-- .ta 1i -->
-	<emphasis remap='I'>protocol</emphasis>/<emphasis remap='I'>hostname</emphasis>:<emphasis remap='I'>number</emphasis>.<emphasis remap='I'>screen_number</emphasis>
-</literallayout>
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>protocol</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies a protocol family or an alias for a protocol family.  Supported 
-protocol families are implementation dependent.  The protocol entry is 
-optional.  If protocol is not specified, the / separating protocol and 
-hostname must also not be specified.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>hostname</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the name of the host machine on which the display is physically
-attached.
-You follow the hostname with either a single colon (:) or a double colon (::).
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the number of the display server on that host machine.
-You may optionally follow this display number with a period (.).
-A single <acronym>CPU</acronym> can have more than one display.
-Multiple displays are usually numbered starting with zero.
-<indexterm><primary>Screen</primary></indexterm>
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the screen to be used on that server.
-Multiple screens can be controlled by a single X server.
-The screen_number sets an internal variable that can be accessed by
-using the 
-<function>DefaultScreen</function>
-macro or the 
-<function>XDefaultScreen</function>
-function if you are using languages other than C (see section 2.2.1).
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-For example, the following would specify screen 1 of display 0 on the 
-machine named ``dual-headed'':
-</para>
-<para>
-<!-- .LP -->
-<literallayout class="monospaced">
-dual-headed:0.1
-</literallayout>
-</para>
-<para>
-<!-- .LP -->
-The
-<function>XOpenDisplay</function>
-function returns a 
-<type>Display</type>
-structure that serves as the
-connection to the X server and that contains all the information
-about that X server.
-<function>XOpenDisplay</function>
-connects your application to the X server through <acronym>TCP</acronym>
-or DECnet communications protocols,
-or through some local inter-process communication protocol.
-<indexterm><primary>Protocol</primary><secondary><acronym>TCP</acronym></secondary></indexterm>
-<indexterm><primary>Protocol</primary><secondary>DECnet</secondary></indexterm>
-If the protocol is specified as "tcp", "inet", or "inet6", or
-if no protocol is specified and the hostname is a host machine name and a single colon (:)
-separates the hostname and display number,
-<function>XOpenDisplay</function>
-connects using <acronym>TCP</acronym> streams.  (If the protocol is specified as "inet", <acronym>TCP</acronym> over
-IPv4 is used.  If the protocol is specified as "inet6", <acronym>TCP</acronym> over IPv6 is used.
-Otherwise, the implementation determines which <acronym>IP</acronym> version is used.)
-If the hostname and protocol are both not specified,
-Xlib uses whatever it believes is the fastest transport.
-If the hostname is a host machine name and a double colon (::)
-separates the hostname and display number,
-<function>XOpenDisplay</function>
-connects using DECnet.
-A single X server can support any or all of these transport mechanisms
-simultaneously.
-A particular Xlib implementation can support many more of these transport
-mechanisms.
-</para>
-<para>
-<!-- .LP -->
-<indexterm><primary>Display</primary></indexterm>
-If successful, 
-<function>XOpenDisplay</function>
-returns a pointer to a 
-<type>Display</type>
-structure,
-which is defined in 
-<filename class="headerfile">&lt;X11/Xlib.h&gt;</filename>.
-<indexterm type="file"><primary><filename class="headerfile">X11/Xlib.h</filename></primary></indexterm>
-<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/Xlib.h&gt;</filename></secondary></indexterm>
-<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/Xlib.h&gt;</filename></secondary></indexterm>
-If 
-<function>XOpenDisplay</function>
-does not succeed, it returns NULL.
-After a successful call to
-<function>XOpenDisplay</function>,
-all of the screens in the display can be used by the client.
-The screen number specified in the display_name argument is returned 
-by the 
-<function>DefaultScreen</function>
-macro (or the
-<function>XDefaultScreen</function>
-function).
-You can access elements of the
-<type>Display</type>
-and
-<type>Screen</type>
-structures only by using the information macros or functions.
-For information about using macros and functions to obtain information from 
-the
-<type>Display</type>
-structure,
-see section 2.2.1.
-</para>
-<para>
-<!-- .LP -->
-X servers may implement various types of access control mechanisms
-(see section 9.8).
-</para>
-</sect1>
-<sect1 id="Obtaining_Information_about_the_Display_Image_Formats_or_Screens">
-<title>Obtaining Information about the Display, Image Formats, or Screens</title>
-<!-- .XS -->
-<!-- (SN Obtaining Information about the Display, Image Formats, or Screens -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-The Xlib library provides a number of useful macros 
-and corresponding functions that return data from the 
-<type>Display</type>
-structure.
-The macros are used for C programming, 
-and their corresponding function equivalents are for other language bindings.
-This section discusses the:
-</para>
-<itemizedlist>
-  <listitem>
-    <para>
-Display macros
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Image format functions and macros
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-Screen information macros
-    </para>
-  </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-<indexterm ><primary>Display</primary><secondary>data structure</secondary></indexterm>
-All other members of the 
-<type>Display</type>
-structure (that is, those for which no macros are defined) are private to Xlib 
-and must not be used.
-Applications must never directly modify or inspect these private members of the 
-<type>Display</type>
-structure.
-<!-- .NT Note -->
-The
-<function>XDisplayWidth</function>,
-<function>XDisplayHeight</function>,
-<function>XDisplayCells</function>,
-<function>XDisplayPlanes</function>,
-<function>XDisplayWidthMM</function>,
-and
-<function>XDisplayHeightMM</function>
-functions in the next sections are misnamed.
-These functions really should be named Screen<emphasis remap='I'>whatever</emphasis> 
-and XScreen<emphasis remap='I'>whatever</emphasis>, not Display<emphasis remap='I'>whatever</emphasis> or XDisplay<emphasis remap='I'>whatever</emphasis>.
-Our apologies for the resulting confusion.
-<!-- .NE -->
-</para>
-<sect2 id="Display_Macros_">
-<title>Display Macros </title>
-<!-- .XS -->
-<!-- (SN Display Macros -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-Applications should not directly modify any part of the
-<type>Display</type>
-and
-<type>Screen</type>
-structures.
-The members should be considered read-only,
-although they may change as the result of other operations on the display.
-</para>
-<para>
-<!-- .LP  -->
-The following lists the C language macros,
-their corresponding function equivalents that are for other language bindings,
-and what data both can return.
-</para>
-<para>AllPlanes()</para>
-<para>XAllPlanes()</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>AllPlanes</primary></indexterm>
-<indexterm significance="preferred"><primary>XAllPlanes</primary></indexterm>
-Both return a value with all bits set to 1 suitable for use in a plane argument to
-a procedure.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-Both 
-<function>BlackPixel</function>
-and 
-<function>WhitePixel</function>
-can be used in implementing a monochrome application.
-These pixel values are for permanently allocated entries in the default
-colormap.
-The actual <acronym>RGB</acronym> (red, green, and blue) values are settable on some screens 
-and, in any case, may not actually be black or white.
-The names are intended to convey the expected relative intensity of the colors.
-<!-- .sM -->
-</para>
-<para>
-BlackPixel(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XBlackPixel</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>BlackPixel</primary></indexterm>
-<indexterm significance="preferred"><primary>XBlackPixel</primary></indexterm>
-Both return the black pixel value for the specified screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-WhitePixel(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XWhitePixel</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>WhitePixel</primary></indexterm>
-<indexterm significance="preferred"><primary>XWhitePixel</primary></indexterm>
-Both return the white pixel value for the specified screen. 
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-ConnectionNumber(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XConnectionNumber</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>ConnectionNumber</primary></indexterm>
-<indexterm significance="preferred"><primary>XConnectionNumber</primary></indexterm>
-Both return a connection number for the specified display.
-On a <acronym>POSIX</acronym>-conformant system,
-this is the file descriptor of the connection.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultColormap(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Colormap <function>XDefaultColormap</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultColormap</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultColormap</primary></indexterm>
-Both return the default colormap ID for allocation on the specified screen.
-Most routine allocations of color should be made out of this colormap.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultDepth(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDefaultDepth</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultDepth</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultDepth</primary></indexterm>
-Both return the depth (number of planes) of the default root window for the
-specified screen.
-Other depths may also be supported on this screen (see
-<function>XMatchVisualInfo</function>).
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<indexterm significance="preferred"><primary>XListDepths</primary></indexterm>
-To determine the number of depths that are available on a given screen, use
-<function>XListDepths</function>.
-<!-- .sM -->
-</para>
-<para>
-DefaultGC(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>GC <function>XDefaultGC</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-  <paramdef>int<parameter> *count_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-<!-- .ds Cn depths -->
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>count_return</emphasis>
-    </term>
-    <listitem>
-      <para>
-Returns the number of (Cn.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XListDepths</function>
-function returns the array of depths 
-that are available on the specified screen.
-If the specified screen_number is valid and sufficient memory for the array
-can be allocated,
-<function>XListDepths</function>
-sets count_return to the number of available depths.
-Otherwise, it does not set count_return and returns NULL.
-To release the memory allocated for the array of depths, use
-<function>XFree</function>.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultGC(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>GC <function>XDefaultGC</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultGC</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultGC</primary></indexterm>
-Both return the default graphics context for the root window of the 
-specified screen.
-This GC is created for the convenience of simple applications
-and contains the default GC components with the foreground and
-background pixel values initialized to the black and white
-pixels for the screen, respectively.
-You can modify its contents freely because it is not used in any Xlib
-function.
-This GC should never be freed.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultRootWindow(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Window <function>XDefaultRootWindow</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultRootWindow</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultRootWindow</primary></indexterm>
-Both return the root window for the default screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultScreenOfDisplay(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Screen *<function>XDefaultScreenOfDisplay</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultScreenOfDisplay</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultScreenOfDisplay</primary></indexterm>
-Both return a pointer to the default screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-ScreenOfDisplay(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Screen *<function>XScreenOfDisplay</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>ScreenOfDisplay</primary></indexterm>
-<indexterm significance="preferred"><primary>XScreenOfDisplay</primary></indexterm>
-Both return a pointer to the indicated screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultScreen(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDefaultScreen</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultScreen</primary></indexterm>
-Both return the default screen number referenced by the 
-<function>XOpenDisplay</function>
-function. 
-This macro or function should be used to retrieve the screen number 
-in applications that will use only a single screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultVisual(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Visual *<function>XDefaultVisual</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultVisual</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultVisual</primary></indexterm>
-Both return the default visual type for the specified screen.
-For further information about visual types,
-see section 3.1.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayCells(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDisplayCells</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayCells</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayCells</primary></indexterm>
-Both return the number of entries in the default colormap.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayPlanes(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDisplayPlanes</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayPlanes</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayPlanes</primary></indexterm>
-Both return the depth of the root window of the specified screen.
-For an explanation of depth,
-see the glossary.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayString(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>char *<function>XDisplayString</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayString</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayString</primary></indexterm>
-Both return the string that was passed to 
-<function>XOpenDisplay</function>
-when the current display was opened. 
-On <acronym>POSIX</acronym>-conformant systems,
-if the passed string was NULL, these return the value of
-the DISPLAY environment variable when the current display was opened.
-<indexterm><primary><acronym>POSIX</acronym> System Call</primary><secondary>fork</secondary></indexterm>
-These are useful to applications that invoke the 
-<function>fork</function>
-system call and want to open a new connection to the same display from the 
-child process as well as for printing error messages.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-LastKnownRequestProcessed(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XLastKnownRequestProcessed</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>XExtendedMaxRequestSize</primary></indexterm>
-The
-<function>XExtendedMaxRequestSize</function>
-function returns zero if the specified display does not support an
-extended-length protocol encoding; otherwise,
-it returns the maximum request size (in 4-byte units) supported
-by the server using the extended-length encoding.
-The Xlib functions
-<function>XDrawLines</function>,
-<function>XDrawArcs</function>,
-<function>XFillPolygon</function>,
-<function>XChangeProperty</function>,
-<function>XSetClipRectangles</function>,
-and
-<function>XSetRegion</function>
-will use the extended-length encoding as necessary, if supported
-by the server.  Use of the extended-length encoding in other Xlib
-functions (for example,
-<function>XDrawPoints</function>,
-<function>XDrawRectangles</function>,
-<function>XDrawSegments</function>,
-<function>XFillArcs</function>,
-<function>XFillRectangles</function>,
-<function>XPutImage</function>)
-is permitted but not required; an Xlib implementation may choose to
-split the data across multiple smaller requests instead.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-LastKnownRequestProcessed(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XLastKnownRequestProcessed</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>XMaxRequestSize</primary></indexterm>
-The
-<function>XMaxRequestSize</function>
-function returns the maximum request size (in 4-byte units) supported
-by the server without using an extended-length protocol encoding.
-Single protocol requests to the server can be no larger than this size
-unless an extended-length protocol encoding is supported by the server.
-The protocol guarantees the size to be no smaller than 4096 units
-(16384 bytes).
-Xlib automatically breaks data up into multiple protocol requests
-as necessary for the following functions:
-<function>XDrawPoints</function>,
-<function>XDrawRectangles</function>,
-<function>XDrawSegments</function>,
-<function>XFillArcs</function>,
-<function>XFillRectangles</function>,
-and 
-<function>XPutImage</function>.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-LastKnownRequestProcessed(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XLastKnownRequestProcessed</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>LastKnownRequestProcessed</primary></indexterm>
-<indexterm significance="preferred"><primary>XLastKnownRequestProcessed</primary></indexterm>
-Both extract the full serial number of the last request known by Xlib
-to have been processed by the X server.
-Xlib automatically sets this number when replies, events, and errors
-are received.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-NextRequest(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XNextRequest</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>NextRequest</primary></indexterm>
-<indexterm significance="preferred"><primary>XNextRequest</primary></indexterm>
-Both extract the full serial number that is to be used for the next
-request.
-Serial numbers are maintained separately for each display connection.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-ProtocolVersion(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XProtocolVersion</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>ProtocolVersion</primary></indexterm>
-<indexterm significance="preferred"><primary>XProtocolVersion</primary></indexterm>
-Both return the major version number (11) of the X protocol associated with 
-the connected display.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-ProtocolRevision(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XProtocolRevision</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>ProtocolRevision</primary></indexterm>
-<indexterm significance="preferred"><primary>XProtocolRevision</primary></indexterm>
-Both return the minor protocol revision number of the X server.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-QLength(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XQLength</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>QLength</primary></indexterm>
-<indexterm significance="preferred"><primary>XQLength</primary></indexterm>
-Both return the length of the event queue for the connected display.
-Note that there may be more events that have not been read into
-the queue yet (see
-<function>XEventsQueued</function>).
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-RootWindow(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Window <function>XRootWindow</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm><primary>Window</primary><secondary>RootWindow</secondary></indexterm>
-<indexterm significance="preferred"><primary>RootWindow</primary></indexterm>
-<indexterm><primary>Window</primary><secondary>XRootWindow</secondary></indexterm>
-<indexterm significance="preferred"><primary>XRootWindow</primary></indexterm>
-Both return the root window.
-These are useful with functions that need a drawable of a particular screen
-and for creating top-level windows.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-ScreenCount(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XScreenCount</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>ScreenCount</primary></indexterm>
-<indexterm significance="preferred"><primary>XScreenCount</primary></indexterm>
-Both return the number of available screens.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-ServerVendor(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>char *<function>XServerVendor</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>ServerVendor</primary></indexterm>
-<indexterm significance="preferred"><primary>XServerVendor</primary></indexterm>
-Both return a pointer to a null-terminated string that provides
-some identification of the owner of the X server implementation.
-If the data returned by the server is in the Latin Portable Character Encoding,
-then the string is in the Host Portable Character Encoding.
-Otherwise, the contents of the string are implementation-dependent.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-VendorRelease(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XVendorRelease</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>VendorRelease</primary></indexterm>
-<indexterm significance="preferred"><primary>XVendorRelease</primary></indexterm>
-Both return a number related to a vendor's release of the X server.
-</para>
-</sect2>
-<sect2 id="Image_Format_Functions_and_Macros">
-<title>Image Format Functions and Macros</title>
-<!-- .XS -->
-<!-- (SN Image Format Functions and Macros -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-Applications are required to present data to the X server
-in a format that the server demands.
-To help simplify applications,
-most of the work required to convert the data is provided by Xlib
-(see sections 8.7 and 16.8).
-</para>
-<para>
-<!-- .LP -->
-The
-<structname>XPixmapFormatValues</structname>
-structure provides an interface to the pixmap format information
-that is returned at the time of a connection setup.
-It contains:
-</para>
-<para>
-<!-- .LP -->
-<!-- .sM -->
-<literallayout class="monospaced">
-<!-- .TA .5i 3i -->
-<!-- .ta .5i 3i -->
-typedef struct {
-	int depth;
-	int bits_per_pixel;
-	int scanline_pad;
-} XPixmapFormatValues;
-</literallayout>
-</para>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<!-- .sp -->
-To obtain the pixmap format information for a given display, use
-<function>XListPixmapFormats</function>.
-<indexterm significance="preferred"><primary>XListPixmapFormats</primary></indexterm>
-<!-- .sM -->
-</para>
-<para>
-ImageByteOrder(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XImageByteOrder</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> *count_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-<!-- .ds Cn pixmap formats that are supported by the display -->
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>count_return</emphasis>
-    </term>
-    <listitem>
-      <para>
-Returns the number of (Cn.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XListPixmapFormats</function>
-function returns an array of
-<structname>XPixmapFormatValues</structname>
-structures that describe the types of Z format images supported
-by the specified display.
-If insufficient memory is available,
-<function>XListPixmapFormats</function>
-returns NULL.
-To free the allocated storage for the
-<structname>XPixmapFormatValues</structname>
-structures, use
-<function>XFree</function>.
-</para>
-<para>
-<!-- .LP  -->
-The following lists the C language macros,
-their corresponding function equivalents that are for other language bindings,
-and what data they both return for the specified server and screen.
-These are often used by toolkits as well as by simple applications.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-ImageByteOrder(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XImageByteOrder</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>ImageByteOrder</primary></indexterm>
-<indexterm significance="preferred"><primary>XImageByteOrder</primary></indexterm>
-Both specify the required byte order for images for each scanline unit in 
-XY format (bitmap) or for each pixel value in 
-Z format.
-The macro or function can return either
-<symbol>LSBFirst</symbol>
-or 
-<symbol>MSBFirst</symbol>.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-BitmapUnit(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XBitmapUnit</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>BitmapUnit</primary></indexterm>
-<indexterm significance="preferred"><primary>XBitmapUnit</primary></indexterm>
-Both return the size of a bitmap's scanline unit in bits.
-The scanline is calculated in multiples of this value.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-BitmapBitOrder(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XBitmapBitOrder</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>BitmapBitOrder</primary></indexterm>
-<indexterm significance="preferred"><primary>XBitmapBitOrder</primary></indexterm>
-Within each bitmap unit, the left-most bit in the bitmap as displayed
-on the screen is either the least significant or most significant bit in the
-unit.
-This macro or function can return 
-<symbol>LSBFirst</symbol>
-or 
-<symbol>MSBFirst</symbol>.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-BitmapPad(<emphasis remap='I'>display</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XBitmapPad</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>BitmapPad</primary></indexterm>
-<indexterm significance="preferred"><primary>XBitmapPad</primary></indexterm>
-Each scanline must be padded to a multiple of bits returned
-by this macro or function.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayHeight(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDisplayHeight</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayHeight</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayHeight</primary></indexterm>
-Both return an integer that describes the height of the screen
-in pixels.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayHeightMM(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDisplayHeightMM</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayHeightMM</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayHeightMM</primary></indexterm>
-Both return the height of the specified screen in millimeters.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayWidth(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDisplayWidth</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayWidth</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayWidth</primary></indexterm>
-Both return the width of the screen in pixels.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayWidthMM(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDisplayWidthMM</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> screen_number</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen_number</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate screen number on the host server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayWidthMM</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayWidthMM</primary></indexterm>
-Both return the width of the specified screen in millimeters.
-</para>
-</sect2>
-<sect2 id="Screen_Information_Macros">
-<title>Screen Information Macros</title>
-<!-- .XS -->
-<!-- (SN Screen Information Macros -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-The following lists the C language macros,
-their corresponding function equivalents that are for other language bindings,
-and what data they both can return.
-These macros or functions all take a pointer to the appropriate screen
-structure.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-BlackPixelOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XBlackPixelOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>BlackPixelOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XBlackPixelOfScreen</primary></indexterm>
-Both return the black pixel value of the specified screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-WhitePixelOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>unsigned long <function>XWhitePixelOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>WhitePixelOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XWhitePixelOfScreen</primary></indexterm>
-Both return the white pixel value of the specified screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-CellsOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XCellsOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>CellsOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XCellsOfScreen</primary></indexterm>
-Both return the number of colormap cells in the default colormap 
-of the specified screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultColormapOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Colormap <function>XDefaultColormapOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultColormapOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultColormapOfScreen</primary></indexterm>
-Both return the default colormap of the specified screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultDepthOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDefaultDepthOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultDepthOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultDepthOfScreen</primary></indexterm>
-Both return the depth of the root window.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultGCOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>GC <function>XDefaultGCOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultGCOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultGCOfScreen</primary></indexterm>
-Both return a default graphics context (GC) of the specified screen,
-which has the same depth as the root window of the screen.
-The GC must never be freed.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DefaultVisualOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Visual *<function>XDefaultVisualOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DefaultVisualOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XDefaultVisualOfScreen</primary></indexterm>
-Both return the default visual of the specified screen.
-For information on visual types,
-see section 3.1.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DoesBackingStore(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XDoesBackingStore</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DoesBackingStore</primary></indexterm>
-<indexterm significance="preferred"><primary>XDoesBackingStore</primary></indexterm>
-Both return a value indicating whether the screen supports backing
-stores.
-The value returned can be one of 
-<symbol>WhenMapped</symbol>,
-<symbol>NotUseful</symbol>,
-or
-<symbol>Always</symbol>
-(see section 3.2.4).
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DoesSaveUnders(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Bool <function>XDoesSaveUnders</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DoesSaveUnders</primary></indexterm>
-<indexterm significance="preferred"><primary>XDoesSaveUnders</primary></indexterm>
-Both return a Boolean value indicating whether the
-screen supports save unders.
-If
-<symbol>True</symbol>,
-the screen supports save unders.
-If
-<symbol>False</symbol>,
-the screen does not support save unders (see section 3.2.5).
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-DisplayOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Display *<function>XDisplayOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>DisplayOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XDisplayOfScreen</primary></indexterm>
-Both return the display of the specified screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-<indexterm significance="preferred"><primary>XScreenNumberOfScreen</primary></indexterm>
-</para>
-<para>
-EventMaskOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>long <function>XEventMaskOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XScreenNumberOfScreen</function>
-function returns the screen index number of the specified screen.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-EventMaskOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>long <function>XEventMaskOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>EventMaskOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XEventMaskOfScreen</primary></indexterm>
-Both return the event mask of the root window for the specified screen
-at connection setup time.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-WidthOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XWidthOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>WidthOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XWidthOfScreen</primary></indexterm>
-Both return the width of the specified screen in pixels.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-HeightOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XHeightOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>HeightOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XHeightOfScreen</primary></indexterm>
-Both return the height of the specified screen in pixels.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-WidthMMOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XWidthMMOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>WidthMMOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XWidthMMOfScreen</primary></indexterm>
-Both return the width of the specified screen in millimeters.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-HeightMMOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XHeightMMOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>HeightMMOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XHeightMMOfScreen</primary></indexterm>
-Both return the height of the specified screen in millimeters.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-MaxCmapsOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XMaxCmapsOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>MaxCmapsOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XMaxCmapsOfScreen</primary></indexterm>
-Both return the maximum number of installed colormaps supported 
-by the specified screen (see section 9.3).
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-MinCmapsOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XMinCmapsOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>MinCmapsOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XMinCmapsOfScreen</primary></indexterm>
-Both return the minimum number of installed colormaps supported 
-by the specified screen (see section 9.3).
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-PlanesOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>int <function>XPlanesOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>PlanesOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XPlanesOfScreen</primary></indexterm>
-Both return the depth of the root window.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-<!-- .sM -->
-</para>
-<para>
-RootWindowOfScreen(<emphasis remap='I'>screen</emphasis>)
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Window <function>XRootWindowOfScreen</function></funcdef>
-  <paramdef>Screen<parameter> *screen</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>screen</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the appropriate 
-<type>Screen</type>
-structure.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-<indexterm significance="preferred"><primary>RootWindowOfScreen</primary></indexterm>
-<indexterm significance="preferred"><primary>XRootWindowOfScreen</primary></indexterm>
-Both return the root window of the specified screen.
-</para>
-</sect2>
-</sect1>
-<sect1 id="Generating_a_NoOperation_Protocol_Request">
-<title>Generating a NoOperation Protocol Request</title>
-<!-- .XS -->
-<!-- (SN Generating a NoOperation Protocol Request -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-To execute a 
-<systemitem>NoOperation</systemitem>
-protocol request, use
-<function>XNoOp</function>.
-<indexterm significance="preferred"><primary>XNoOp</primary></indexterm>
-<!-- .sM -->
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef><function>XNoOp</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-
-<variablelist>
-  <varlistentry>
-    <term><emphasis remap='I'>display</emphasis></term>
-    <listitem>
-      <para>Specifies the connection to the X server.</para>
-    </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XNoOp</function>
-function sends a 
-<systemitem>NoOperation</systemitem>
-protocol request to the X server,
-thereby exercising the connection.
-</para>
-</sect1>
-<sect1 id="Freeing_Client_Created_Data">
-<title>Freeing Client-Created Data</title>
-<!-- .XS -->
-<!-- (SN Freeing Client-Created Data -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-To free in-memory data that was created by an Xlib function, use
-<function>XFree</function>.
-<indexterm significance="preferred"><primary>XFree</primary></indexterm>
-<!-- .sM -->
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>XFree</funcdef>
-  <paramdef>void<parameter> *data</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>data</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the data that is to be freed.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XFree</function>
-function is a general-purpose Xlib routine that frees the specified data.
-You must use it to free any objects that were allocated by Xlib,
-unless an alternate function is explicitly specified for the object.
-A NULL pointer cannot be passed to this function.
-</para>
-</sect1>
-<sect1 id="Closing_the_Display">
-<title>Closing the Display</title>
-<!-- .XS -->
-<!-- (SN Closing the Display -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-To close a display or disconnect from the X server, use
-<function>XCloseDisplay</function>.
-<indexterm significance="preferred"><primary>XCloseDisplay</primary></indexterm>
-</para>
-<para>
-<!-- .LP -->
-<!-- .sM -->
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>XCloseDisplay</funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XCloseDisplay</function>
-function closes the connection to the X server for the display specified in the
-<type>Display</type>
-structure and destroys all windows, resource IDs
-(<type>Window</type>,
-<type>Font</type>,
-<type>Pixmap</type>,
-<type>Colormap</type>,
-<type>Cursor</type>,
-and
-<type>GContext</type>),
-or other resources that the client has created
-on this display, unless the close-down mode of the resource has been changed
-(see
-<function>XSetCloseDownMode</function>).
-Therefore, these windows, resource IDs, and other resources should never be 
-referenced again or an error will be generated.
-Before exiting, you should call
-<function>XCloseDisplay</function>
-explicitly so that any pending errors are reported as
-<function>XCloseDisplay</function>
-performs a final
-<function>XSync</function>
-operation.
-<indexterm><primary>Resource IDs</primary></indexterm>
-<indexterm><primary>XCloseDisplay</primary></indexterm>
-</para>
-<para>
-<!-- .LP -->
-<function>XCloseDisplay</function>
-can generate a
-<errorname>BadGC</errorname>
-error.
-<!-- .sp -->
-</para>
-<para>
-<!-- .LP -->
-Xlib provides a function to permit the resources owned by a client
-to survive after the client's connection is closed.
-To change a client's close-down mode, use
-<function>XSetCloseDownMode</function>.
-<indexterm significance="preferred"><primary>XSetCloseDownMode</primary></indexterm>
-<!-- .sM -->
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>XSetCloseDownMode</funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> close_mode</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>close_mode</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the client close-down mode.
-You can pass 
-<symbol>DestroyAll</symbol>,
-<symbol>RetainPermanent</symbol>,
-or
-<symbol>RetainTemporary</symbol>.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XSetCloseDownMode</function>
-defines what will happen to the client's resources at connection close.
-A connection starts in
-<symbol>DestroyAll</symbol>
-mode.
-For information on what happens to the client's resources when the
-close_mode argument is
-<symbol>RetainPermanent</symbol>
-or
-<symbol>RetainTemporary</symbol>,
-see section 2.6.
-</para>
-<para>
-<!-- .LP -->
-<function>XSetCloseDownMode</function>
-can generate a
-<errorname>BadValue</errorname>
-error.
-</para>
-</sect1>
-<sect1 id="Using_X_Server_Connection_Close_Operations_">
-<title>Using X Server Connection Close Operations </title>
-<!-- .XS -->
-<!-- (SN Using X Server Connection Close Operations -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-When the X server's connection to a client is closed
-either by an explicit call to
-<function>XCloseDisplay</function>
-or by a process that exits, the X server performs the following
-automatic operations:
-</para>
-<itemizedlist>
-  <listitem>
-    <para>
-It disowns all selections owned by the client
-(see 
-<function>XSetSelectionOwner</function>).
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It performs an
-<function>XUngrabPointer</function>
-and
-<function>XUngrabKeyboard</function>
-if the client has actively grabbed the pointer 
-or the keyboard.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It performs an
-<function>XUngrabServer</function>
-if the client has grabbed the server.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It releases all passive grabs made by the client.  
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It marks all resources (including colormap entries) allocated 
-by the client either as permanent or temporary, 
-depending on whether the close-down mode is 
-<symbol>RetainPermanent</symbol>
-or
-<symbol>RetainTemporary</symbol>.
-However, this does not prevent other client applications from explicitly
-destroying the resources (see 
-<function>XSetCloseDownMode</function>).
-    </para>
-  </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-When the close-down mode is
-<symbol>DestroyAll</symbol>,
-the X server destroys all of a client's resources as follows:
-</para>
-<itemizedlist>
-  <listitem>
-    <para>
-It examines each window in the client's save-set to determine if it is an inferior
-(subwindow) of a window created by the client.
-(The save-set is a list of other clients' windows
-that are referred to as save-set windows.)
-If so, the X server reparents the save-set window to the closest ancestor so
-that the save-set window is not an inferior of a window created by the client.
-The reparenting leaves unchanged the absolute coordinates (with respect to
-the root window) of the upper-left outer corner of the save-set
-window.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It performs a
-<systemitem>MapWindow</systemitem>
-request on the save-set window if the save-set window is unmapped.
-The X server does this even if the save-set window was not an inferior of 
-a window created by the client.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It destroys all windows created by the client.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It performs the appropriate free request on each nonwindow resource created by
-the client in the server (for example, 
-<type>Font</type>,
-<type>Pixmap</type>,
-<type>Cursor</type>,
-<type>Colormap</type>,
-and 
-<type>GContext</type>).
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It frees all colors and colormap entries allocated by a client application.
-    </para>
-  </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-Additional processing occurs when the last connection to the X server closes.
-An X server goes through a cycle of having no connections and having some
-connections.
-When the last connection to the X server closes as a result of a connection
-closing with the close_mode of
-<symbol>DestroyAll</symbol>,
-the X server does the following: 
-</para>
-<itemizedlist>
-  <listitem>
-    <para>
-It resets its state as if it had just been
-started.  
-The X server begins by destroying all lingering resources from
-clients that have terminated in 
-<symbol>RetainPermanent</symbol>
-or
-<symbol>RetainTemporary</symbol>
-mode.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It deletes all but the predefined atom identifiers.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It deletes all properties on all root windows (see section 4.3).
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It resets all device maps and attributes 
-(for example, key click, bell volume, and acceleration) 
-as well as the access control list.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It restores the standard root tiles and cursors.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It restores the default font path.
-    </para>
-  </listitem>
-  <listitem>
-    <para>
-It restores the input focus to state
-<symbol>PointerRoot</symbol>.
-    </para>
-  </listitem>
-</itemizedlist>
-<para>
-<!-- .LP -->
-However, the X server does not reset if you close a connection with a close-down
-mode set to
-<symbol>RetainPermanent</symbol>
-or
-<symbol>RetainTemporary</symbol>.
-</para>
-</sect1>
-<sect1 id="Using_Xlib_with_Threads">
-<title>Using Xlib with Threads</title>
-<!-- .XS -->
-<!-- (SN Using Xlib with Threads -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-On systems that have threads, support may be provided to permit
-multiple threads to use Xlib concurrently.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To initialize support for concurrent threads, use
-<function>XInitThreads</function>.
-<indexterm significance="preferred"><primary>XInitThreads</primary></indexterm>
-<!-- .sM -->
-</para>
-<para>Status XInitThreads();</para>
-<!-- .FN -->
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XInitThreads</function>
-function initializes Xlib support for concurrent threads.
-This function must be the first Xlib function a
-multi-threaded program calls, and it must complete
-before any other Xlib call is made.
-This function returns a nonzero status if initialization was
-successful; otherwise, it returns zero.
-On systems that do not support threads, this function always returns zero.
-</para>
-<para>
-<!-- .LP -->
-It is only necessary to call this function if multiple threads
-might use Xlib concurrently.  If all calls to Xlib functions
-are protected by some other access mechanism (for example,
-a mutual exclusion lock in a toolkit or through explicit client
-programming), Xlib thread initialization is not required.
-It is recommended that single-threaded programs not call this function.
-
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To lock a display across several Xlib calls, use
-<function>XLockDisplay</function>.
-<indexterm significance="preferred"><primary>XLockDisplay</primary></indexterm>
-<!-- .sM -->
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>XLockDisplay</funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XLockDisplay</function>
-function locks out all other threads from using the specified display.
-Other threads attempting to use the display will block until
-the display is unlocked by this thread.
-Nested calls to
-<function>XLockDisplay</function>
-work correctly; the display will not actually be unlocked until
-<function>XUnlockDisplay</function>
-has been called the same number of times as
-<function>XLockDisplay</function>.
-This function has no effect unless Xlib was successfully initialized
-for threads using
-<function>XInitThreads</function>.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To unlock a display, use
-<function>XUnlockDisplay</function>.
-<indexterm significance="preferred"><primary>XUnlockDisplay</primary></indexterm>
-<!-- .sM -->
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>XUnlockDisplay</funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XUnlockDisplay</function>
-function allows other threads to use the specified display again.
-Any threads that have blocked on the display are allowed to continue.
-Nested locking works correctly; if
-<function>XLockDisplay</function>
-has been called multiple times by a thread, then
-<function>XUnlockDisplay</function>
-must be called an equal number of times before the display is
-actually unlocked.
-This function has no effect unless Xlib was successfully initialized
-for threads using
-<function>XInitThreads</function>.
-</para>
-</sect1>
-<sect1 id="Using_Internal_Connections">
-<title>Using Internal Connections</title>
-<!-- .XS -->
-<!-- (SN Using Internal Connections -->
-<!-- .XE -->
-<para>
-<!-- .LP -->
-In addition to the connection to the X server, an Xlib implementation
-may require connections to other kinds of servers (for example, to
-input method servers as described in chapter 13).  Toolkits and clients
-that use multiple displays, or that use displays in combination with
-other inputs, need to obtain these additional connections to correctly
-block until input is available and need to process that input
-when it is available.  Simple clients that use a single display and
-block for input in an Xlib event function do not need to use these
-facilities.
-</para>
-<para>
-<!-- .LP -->
-To track internal connections for a display, use
-<function>XAddConnectionWatch</function>.
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>type void XConnectionWatchProc</funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>XPointer<parameter> client_data</parameter></paramdef>
-  <paramdef>int<parameter> fd</parameter></paramdef>
-  <paramdef>Bool<parameter> opening</parameter></paramdef>
-  <paramdef>XPointer<parameter> *watch_data</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Status XAddConnectionWatch</funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>XWatchProc<parameter> procedure</parameter></paramdef>
-  <paramdef>XPointer<parameter> client_data</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>procedure</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the procedure to be called.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>client_data</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the additional client data.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XAddConnectionWatch</function>
-function registers a procedure to be called each time Xlib opens or closes an
-internal connection for the specified display.  The procedure is passed the
-display, the specified client_data, the file descriptor for the connection,
-a Boolean indicating whether the connection is being opened or closed, and a
-pointer to a location for private watch data.  If opening is
-<symbol>True</symbol>,
-the procedure can store a pointer to private data in the location pointed
-to by watch_data;
-when the procedure is later called for this same connection and opening is
-<symbol>False</symbol>,
-the location pointed to by watch_data will hold this same private data pointer.
-</para>
-<para>
-<!-- .LP -->
-This function can be called at any time after a display is opened.
-If internal connections already exist, the registered procedure will
-immediately be called for each of them, before
-<function>XAddConnectionWatch</function>
-returns.
-<function>XAddConnectionWatch</function>
-returns a nonzero status if the procedure is successfully registered;
-otherwise, it returns zero.
-</para>
-<para>
-<!-- .LP -->
-The registered procedure should not call any Xlib functions.
-If the procedure directly or indirectly causes the state of internal
-connections or watch procedures to change, the result is not defined.
-If Xlib has been initialized for threads, the procedure is called with
-the display locked and the result of a call by the procedure to any
-Xlib function that locks the display is not defined unless the executing
-thread has externally locked the display using
-<function>XLockDisplay</function>.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To stop tracking internal connections for a display, use
-<function>XRemoveConnectionWatch</function>.
-<indexterm significance="preferred"><primary>XRemoveConnectionWatch</primary></indexterm>
-<!-- .sM -->
-</para>
-<para>
-()
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Status <function>XRemoveConnectionWatch</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>XWatchProc<parameter> procedure</parameter></paramdef>
-  <paramdef>XPointer<parameter> client_data</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>procedure</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the procedure to be called.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>client_data</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the additional client data.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XRemoveConnectionWatch</function>
-function removes a previously registered connection watch procedure.
-The client_data must match the client_data used when the procedure
-was initially registered.
-
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To process input on an internal connection, use
-<function>XProcessInternalConnection</function>.
-<indexterm significance="preferred"><primary>XProcessInternalConnection</primary></indexterm>
-<!-- .sM -->
-</para>
-<para>
-()
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>void <function>XProcessInternalConnection</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int<parameter> fd</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>fd</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the file descriptor.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XProcessInternalConnection</function>
-function processes input available on an internal connection.
-This function should be called for an internal connection only
-after an operating system facility (for example,
-<function>select</function>
-or
-<function>poll</function>)
-has indicated that input is available; otherwise,
-the effect is not defined.
-</para>
-<para>
-<!-- .LP -->
-<!-- .sp -->
-To obtain all of the current internal connections for a display, use
-<function>XInternalConnectionNumbers</function>.
-<indexterm significance="preferred"><primary>XInternalConnectionNumbers</primary></indexterm>
-<!-- .sM -->
-</para>
-<para>
-()
-</para>
-<funcsynopsis>
-<funcprototype>
-  <funcdef>Status <function>XInternalConnectionNumbers</function></funcdef>
-  <paramdef>Display<parameter> *display</parameter></paramdef>
-  <paramdef>int **<parameter> fd</parameter></paramdef>
-  <paramdef>int *<parameter> count_return</parameter></paramdef>
-</funcprototype>
-</funcsynopsis>
-<!-- .FN -->
-<variablelist>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>display</emphasis>
-    </term>
-    <listitem>
-      <para>
-Specifies the connection to the X server.
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>fd_return</emphasis>
-    </term>
-    <listitem>
-      <para>
-Returns the file descriptors.
-<!-- .ds Cn file descriptors -->
-      </para>
-    </listitem>
-  </varlistentry>
-  <varlistentry>
-    <term>
-      <emphasis remap='I'>count_return</emphasis>
-    </term>
-    <listitem>
-      <para>
-Returns the number of (Cn.
-    </para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<para>
-<!-- .LP -->
-<!-- .eM -->
-The
-<function>XInternalConnectionNumbers</function>
-function returns a list of the file descriptors for all internal
-connections currently open for the specified display.
-When the allocated list is no longer needed,
-free it by using
-<function>XFree</function>.
-This functions returns a nonzero status if the list is successfully allocated;
-otherwise, it returns zero.
-</para>
-</sect1>
-</chapter>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+	  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<chapter id="display_functions">
+<title>Display Functions</title>
+<para>
+Before your program can use a display, you must establish a connection
+to the X server.
+Once you have established a connection,
+you then can use the Xlib macros and functions discussed in this chapter
+to return information about the display.
+This chapter discusses how to:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Open (connect to) the display
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Obtain information about the display, image formats, or screens
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Generate a
+<systemitem>NoOperation</systemitem>
+protocol request
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Free client-created data
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Close (disconnect from) a display
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Use X Server connection close operations
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Use Xlib with threads
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Use internal connections
+    </para>
+  </listitem>
+</itemizedlist>
+<sect1 id="Opening_the_Display">
+<title>Opening the Display</title>
+<!-- .XS -->
+<!-- (SN Opening the Display -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To open a connection to the X server that controls a display, use
+<function>XOpenDisplay</function>.
+<indexterm significance="preferred"><primary>XOpenDisplay</primary></indexterm>
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Display *<function>XOpenDisplay</function></funcdef>
+  <paramdef>char *<parameter>display_name</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display_name</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the hardware display name, which determines the display
+and communications domain to be used.
+On a <acronym>POSIX</acronym>-conformant system, if the display_name is NULL, 
+it defaults to the value of the DISPLAY environment variable. 
+<indexterm><primary>Environment</primary><secondary>DISPLAY</secondary></indexterm>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The encoding and interpretation of the display name are
+implementation-dependent.
+Strings in the Host Portable Character Encoding are supported;
+support for other characters is implementation-dependent.
+On <acronym>POSIX</acronym>-conformant systems,
+the display name or DISPLAY environment variable can be a string in the format:
+</para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA 1i -->
+<!-- .ta 1i -->
+	<emphasis remap='I'>protocol</emphasis>/<emphasis remap='I'>hostname</emphasis>:<emphasis remap='I'>number</emphasis>.<emphasis remap='I'>screen_number</emphasis>
+</literallayout>
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>protocol</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a protocol family or an alias for a protocol family.  Supported 
+protocol families are implementation dependent.  The protocol entry is 
+optional.  If protocol is not specified, the / separating protocol and 
+hostname must also not be specified.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>hostname</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the name of the host machine on which the display is physically
+attached.
+You follow the hostname with either a single colon (:) or a double colon (::).
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of the display server on that host machine.
+You may optionally follow this display number with a period (.).
+A single <acronym>CPU</acronym> can have more than one display.
+Multiple displays are usually numbered starting with zero.
+<indexterm><primary>Screen</primary></indexterm>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the screen to be used on that server.
+Multiple screens can be controlled by a single X server.
+The screen_number sets an internal variable that can be accessed by
+using the 
+<function>DefaultScreen</function>
+macro or the 
+<function>XDefaultScreen</function>
+function if you are using languages other than C (see section 2.2.1).
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+For example, the following would specify screen 1 of display 0 on the 
+machine named ``dual-headed'':
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+dual-headed:0.1
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The
+<function>XOpenDisplay</function>
+function returns a 
+<type>Display</type>
+structure that serves as the
+connection to the X server and that contains all the information
+about that X server.
+<function>XOpenDisplay</function>
+connects your application to the X server through <acronym>TCP</acronym>
+or DECnet communications protocols,
+or through some local inter-process communication protocol.
+<indexterm><primary>Protocol</primary><secondary><acronym>TCP</acronym></secondary></indexterm>
+<indexterm><primary>Protocol</primary><secondary>DECnet</secondary></indexterm>
+If the protocol is specified as "tcp", "inet", or "inet6", or
+if no protocol is specified and the hostname is a host machine name and a single colon (:)
+separates the hostname and display number,
+<function>XOpenDisplay</function>
+connects using <acronym>TCP</acronym> streams.  (If the protocol is specified as "inet", <acronym>TCP</acronym> over
+IPv4 is used.  If the protocol is specified as "inet6", <acronym>TCP</acronym> over IPv6 is used.
+Otherwise, the implementation determines which <acronym>IP</acronym> version is used.)
+If the hostname and protocol are both not specified,
+Xlib uses whatever it believes is the fastest transport.
+If the hostname is a host machine name and a double colon (::)
+separates the hostname and display number,
+<function>XOpenDisplay</function>
+connects using DECnet.
+A single X server can support any or all of these transport mechanisms
+simultaneously.
+A particular Xlib implementation can support many more of these transport
+mechanisms.
+</para>
+<para>
+<!-- .LP -->
+<indexterm><primary>Display</primary></indexterm>
+If successful, 
+<function>XOpenDisplay</function>
+returns a pointer to a 
+<type>Display</type>
+structure,
+which is defined in 
+<filename class="headerfile">&lt;X11/Xlib.h&gt;</filename>.
+<indexterm type="file"><primary><filename class="headerfile">X11/Xlib.h</filename></primary></indexterm>
+<indexterm><primary>Files</primary><secondary><filename class="headerfile">&lt;X11/Xlib.h&gt;</filename></secondary></indexterm>
+<indexterm><primary>Headers</primary><secondary><filename class="headerfile">&lt;X11/Xlib.h&gt;</filename></secondary></indexterm>
+If 
+<function>XOpenDisplay</function>
+does not succeed, it returns NULL.
+After a successful call to
+<function>XOpenDisplay</function>,
+all of the screens in the display can be used by the client.
+The screen number specified in the display_name argument is returned 
+by the 
+<function>DefaultScreen</function>
+macro (or the
+<function>XDefaultScreen</function>
+function).
+You can access elements of the
+<type>Display</type>
+and
+<type>Screen</type>
+structures only by using the information macros or functions.
+For information about using macros and functions to obtain information from 
+the
+<type>Display</type>
+structure,
+see section 2.2.1.
+</para>
+<para>
+<!-- .LP -->
+X servers may implement various types of access control mechanisms
+(see section 9.8).
+</para>
+</sect1>
+<sect1 id="Obtaining_Information_about_the_Display_Image_Formats_or_Screens">
+<title>Obtaining Information about the Display, Image Formats, or Screens</title>
+<!-- .XS -->
+<!-- (SN Obtaining Information about the Display, Image Formats, or Screens -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The Xlib library provides a number of useful macros 
+and corresponding functions that return data from the 
+<type>Display</type>
+structure.
+The macros are used for C programming, 
+and their corresponding function equivalents are for other language bindings.
+This section discusses the:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Display macros
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Image format functions and macros
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Screen information macros
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+<indexterm ><primary>Display</primary><secondary>data structure</secondary></indexterm>
+All other members of the 
+<type>Display</type>
+structure (that is, those for which no macros are defined) are private to Xlib 
+and must not be used.
+Applications must never directly modify or inspect these private members of the 
+<type>Display</type>
+structure.
+<!-- .NT Note -->
+The
+<function>XDisplayWidth</function>,
+<function>XDisplayHeight</function>,
+<function>XDisplayCells</function>,
+<function>XDisplayPlanes</function>,
+<function>XDisplayWidthMM</function>,
+and
+<function>XDisplayHeightMM</function>
+functions in the next sections are misnamed.
+These functions really should be named Screen<emphasis remap='I'>whatever</emphasis> 
+and XScreen<emphasis remap='I'>whatever</emphasis>, not Display<emphasis remap='I'>whatever</emphasis> or XDisplay<emphasis remap='I'>whatever</emphasis>.
+Our apologies for the resulting confusion.
+<!-- .NE -->
+</para>
+<sect2 id="Display_Macros_">
+<title>Display Macros </title>
+<!-- .XS -->
+<!-- (SN Display Macros -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Applications should not directly modify any part of the
+<type>Display</type>
+and
+<type>Screen</type>
+structures.
+The members should be considered read-only,
+although they may change as the result of other operations on the display.
+</para>
+<para>
+<!-- .LP  -->
+The following lists the C language macros,
+their corresponding function equivalents that are for other language bindings,
+and what data both can return.
+</para>
+<para>AllPlanes()</para>
+<para>XAllPlanes()</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>AllPlanes</primary></indexterm>
+<indexterm significance="preferred"><primary>XAllPlanes</primary></indexterm>
+Both return a value with all bits set to 1 suitable for use in a plane argument to
+a procedure.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+Both 
+<function>BlackPixel</function>
+and 
+<function>WhitePixel</function>
+can be used in implementing a monochrome application.
+These pixel values are for permanently allocated entries in the default
+colormap.
+The actual <acronym>RGB</acronym> (red, green, and blue) values are settable on some screens 
+and, in any case, may not actually be black or white.
+The names are intended to convey the expected relative intensity of the colors.
+<!-- .sM -->
+</para>
+<para>
+BlackPixel(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XBlackPixel</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>BlackPixel</primary></indexterm>
+<indexterm significance="preferred"><primary>XBlackPixel</primary></indexterm>
+Both return the black pixel value for the specified screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+WhitePixel(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XWhitePixel</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>WhitePixel</primary></indexterm>
+<indexterm significance="preferred"><primary>XWhitePixel</primary></indexterm>
+Both return the white pixel value for the specified screen. 
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+ConnectionNumber(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XConnectionNumber</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>ConnectionNumber</primary></indexterm>
+<indexterm significance="preferred"><primary>XConnectionNumber</primary></indexterm>
+Both return a connection number for the specified display.
+On a <acronym>POSIX</acronym>-conformant system,
+this is the file descriptor of the connection.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultColormap(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Colormap <function>XDefaultColormap</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultColormap</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultColormap</primary></indexterm>
+Both return the default colormap ID for allocation on the specified screen.
+Most routine allocations of color should be made out of this colormap.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultDepth(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDefaultDepth</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultDepth</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultDepth</primary></indexterm>
+Both return the depth (number of planes) of the default root window for the
+specified screen.
+Other depths may also be supported on this screen (see
+<function>XMatchVisualInfo</function>).
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<indexterm significance="preferred"><primary>XListDepths</primary></indexterm>
+To determine the number of depths that are available on a given screen, use
+<function>XListDepths</function>.
+<!-- .sM -->
+</para>
+<para>
+DefaultGC(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>GC <function>XDefaultGC</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+  <paramdef>int<parameter> *count_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+<!-- .ds Cn depths -->
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>count_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of (Cn.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XListDepths</function>
+function returns the array of depths 
+that are available on the specified screen.
+If the specified screen_number is valid and sufficient memory for the array
+can be allocated,
+<function>XListDepths</function>
+sets count_return to the number of available depths.
+Otherwise, it does not set count_return and returns NULL.
+To release the memory allocated for the array of depths, use
+<function>XFree</function>.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultGC(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>GC <function>XDefaultGC</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultGC</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultGC</primary></indexterm>
+Both return the default graphics context for the root window of the 
+specified screen.
+This GC is created for the convenience of simple applications
+and contains the default GC components with the foreground and
+background pixel values initialized to the black and white
+pixels for the screen, respectively.
+You can modify its contents freely because it is not used in any Xlib
+function.
+This GC should never be freed.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultRootWindow(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Window <function>XDefaultRootWindow</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultRootWindow</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultRootWindow</primary></indexterm>
+Both return the root window for the default screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultScreenOfDisplay(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Screen *<function>XDefaultScreenOfDisplay</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultScreenOfDisplay</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultScreenOfDisplay</primary></indexterm>
+Both return a pointer to the default screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+ScreenOfDisplay(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Screen *<function>XScreenOfDisplay</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>ScreenOfDisplay</primary></indexterm>
+<indexterm significance="preferred"><primary>XScreenOfDisplay</primary></indexterm>
+Both return a pointer to the indicated screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultScreen(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDefaultScreen</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultScreen</primary></indexterm>
+Both return the default screen number referenced by the 
+<function>XOpenDisplay</function>
+function. 
+This macro or function should be used to retrieve the screen number 
+in applications that will use only a single screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultVisual(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Visual *<function>XDefaultVisual</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultVisual</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultVisual</primary></indexterm>
+Both return the default visual type for the specified screen.
+For further information about visual types,
+see section 3.1.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayCells(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDisplayCells</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayCells</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayCells</primary></indexterm>
+Both return the number of entries in the default colormap.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayPlanes(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDisplayPlanes</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayPlanes</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayPlanes</primary></indexterm>
+Both return the depth of the root window of the specified screen.
+For an explanation of depth,
+see the glossary.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayString(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>char *<function>XDisplayString</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayString</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayString</primary></indexterm>
+Both return the string that was passed to 
+<function>XOpenDisplay</function>
+when the current display was opened. 
+On <acronym>POSIX</acronym>-conformant systems,
+if the passed string was NULL, these return the value of
+the DISPLAY environment variable when the current display was opened.
+<indexterm><primary><acronym>POSIX</acronym> System Call</primary><secondary>fork</secondary></indexterm>
+These are useful to applications that invoke the 
+<function>fork</function>
+system call and want to open a new connection to the same display from the 
+child process as well as for printing error messages.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+LastKnownRequestProcessed(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XLastKnownRequestProcessed</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>XExtendedMaxRequestSize</primary></indexterm>
+The
+<function>XExtendedMaxRequestSize</function>
+function returns zero if the specified display does not support an
+extended-length protocol encoding; otherwise,
+it returns the maximum request size (in 4-byte units) supported
+by the server using the extended-length encoding.
+The Xlib functions
+<function>XDrawLines</function>,
+<function>XDrawArcs</function>,
+<function>XFillPolygon</function>,
+<function>XChangeProperty</function>,
+<function>XSetClipRectangles</function>,
+and
+<function>XSetRegion</function>
+will use the extended-length encoding as necessary, if supported
+by the server.  Use of the extended-length encoding in other Xlib
+functions (for example,
+<function>XDrawPoints</function>,
+<function>XDrawRectangles</function>,
+<function>XDrawSegments</function>,
+<function>XFillArcs</function>,
+<function>XFillRectangles</function>,
+<function>XPutImage</function>)
+is permitted but not required; an Xlib implementation may choose to
+split the data across multiple smaller requests instead.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+LastKnownRequestProcessed(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XLastKnownRequestProcessed</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>XMaxRequestSize</primary></indexterm>
+The
+<function>XMaxRequestSize</function>
+function returns the maximum request size (in 4-byte units) supported
+by the server without using an extended-length protocol encoding.
+Single protocol requests to the server can be no larger than this size
+unless an extended-length protocol encoding is supported by the server.
+The protocol guarantees the size to be no smaller than 4096 units
+(16384 bytes).
+Xlib automatically breaks data up into multiple protocol requests
+as necessary for the following functions:
+<function>XDrawPoints</function>,
+<function>XDrawRectangles</function>,
+<function>XDrawSegments</function>,
+<function>XFillArcs</function>,
+<function>XFillRectangles</function>,
+and 
+<function>XPutImage</function>.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+LastKnownRequestProcessed(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XLastKnownRequestProcessed</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>LastKnownRequestProcessed</primary></indexterm>
+<indexterm significance="preferred"><primary>XLastKnownRequestProcessed</primary></indexterm>
+Both extract the full serial number of the last request known by Xlib
+to have been processed by the X server.
+Xlib automatically sets this number when replies, events, and errors
+are received.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+NextRequest(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XNextRequest</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>NextRequest</primary></indexterm>
+<indexterm significance="preferred"><primary>XNextRequest</primary></indexterm>
+Both extract the full serial number that is to be used for the next
+request.
+Serial numbers are maintained separately for each display connection.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+ProtocolVersion(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XProtocolVersion</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>ProtocolVersion</primary></indexterm>
+<indexterm significance="preferred"><primary>XProtocolVersion</primary></indexterm>
+Both return the major version number (11) of the X protocol associated with 
+the connected display.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+ProtocolRevision(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XProtocolRevision</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>ProtocolRevision</primary></indexterm>
+<indexterm significance="preferred"><primary>XProtocolRevision</primary></indexterm>
+Both return the minor protocol revision number of the X server.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+QLength(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XQLength</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>QLength</primary></indexterm>
+<indexterm significance="preferred"><primary>XQLength</primary></indexterm>
+Both return the length of the event queue for the connected display.
+Note that there may be more events that have not been read into
+the queue yet (see
+<function>XEventsQueued</function>).
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+RootWindow(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Window <function>XRootWindow</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm><primary>Window</primary><secondary>RootWindow</secondary></indexterm>
+<indexterm significance="preferred"><primary>RootWindow</primary></indexterm>
+<indexterm><primary>Window</primary><secondary>XRootWindow</secondary></indexterm>
+<indexterm significance="preferred"><primary>XRootWindow</primary></indexterm>
+Both return the root window.
+These are useful with functions that need a drawable of a particular screen
+and for creating top-level windows.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+ScreenCount(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XScreenCount</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>ScreenCount</primary></indexterm>
+<indexterm significance="preferred"><primary>XScreenCount</primary></indexterm>
+Both return the number of available screens.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+ServerVendor(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>char *<function>XServerVendor</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>ServerVendor</primary></indexterm>
+<indexterm significance="preferred"><primary>XServerVendor</primary></indexterm>
+Both return a pointer to a null-terminated string that provides
+some identification of the owner of the X server implementation.
+If the data returned by the server is in the Latin Portable Character Encoding,
+then the string is in the Host Portable Character Encoding.
+Otherwise, the contents of the string are implementation-dependent.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+VendorRelease(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XVendorRelease</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>VendorRelease</primary></indexterm>
+<indexterm significance="preferred"><primary>XVendorRelease</primary></indexterm>
+Both return a number related to a vendor's release of the X server.
+</para>
+</sect2>
+<sect2 id="Image_Format_Functions_and_Macros">
+<title>Image Format Functions and Macros</title>
+<!-- .XS -->
+<!-- (SN Image Format Functions and Macros -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Applications are required to present data to the X server
+in a format that the server demands.
+To help simplify applications,
+most of the work required to convert the data is provided by Xlib
+(see sections 8.7 and 16.8).
+</para>
+<para>
+<!-- .LP -->
+The
+<structname>XPixmapFormatValues</structname>
+structure provides an interface to the pixmap format information
+that is returned at the time of a connection setup.
+It contains:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+	int depth;
+	int bits_per_pixel;
+	int scanline_pad;
+} XPixmapFormatValues;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<!-- .sp -->
+To obtain the pixmap format information for a given display, use
+<function>XListPixmapFormats</function>.
+<indexterm significance="preferred"><primary>XListPixmapFormats</primary></indexterm>
+<!-- .sM -->
+</para>
+<para>
+ImageByteOrder(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XImageByteOrder</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> *count_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+<!-- .ds Cn pixmap formats that are supported by the display -->
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>count_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of (Cn.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XListPixmapFormats</function>
+function returns an array of
+<structname>XPixmapFormatValues</structname>
+structures that describe the types of Z format images supported
+by the specified display.
+If insufficient memory is available,
+<function>XListPixmapFormats</function>
+returns NULL.
+To free the allocated storage for the
+<structname>XPixmapFormatValues</structname>
+structures, use
+<function>XFree</function>.
+</para>
+<para>
+<!-- .LP  -->
+The following lists the C language macros,
+their corresponding function equivalents that are for other language bindings,
+and what data they both return for the specified server and screen.
+These are often used by toolkits as well as by simple applications.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+ImageByteOrder(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XImageByteOrder</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>ImageByteOrder</primary></indexterm>
+<indexterm significance="preferred"><primary>XImageByteOrder</primary></indexterm>
+Both specify the required byte order for images for each scanline unit in 
+XY format (bitmap) or for each pixel value in 
+Z format.
+The macro or function can return either
+<symbol>LSBFirst</symbol>
+or 
+<symbol>MSBFirst</symbol>.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+BitmapUnit(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XBitmapUnit</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>BitmapUnit</primary></indexterm>
+<indexterm significance="preferred"><primary>XBitmapUnit</primary></indexterm>
+Both return the size of a bitmap's scanline unit in bits.
+The scanline is calculated in multiples of this value.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+BitmapBitOrder(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XBitmapBitOrder</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>BitmapBitOrder</primary></indexterm>
+<indexterm significance="preferred"><primary>XBitmapBitOrder</primary></indexterm>
+Within each bitmap unit, the left-most bit in the bitmap as displayed
+on the screen is either the least significant or most significant bit in the
+unit.
+This macro or function can return 
+<symbol>LSBFirst</symbol>
+or 
+<symbol>MSBFirst</symbol>.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+BitmapPad(<emphasis remap='I'>display</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XBitmapPad</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>BitmapPad</primary></indexterm>
+<indexterm significance="preferred"><primary>XBitmapPad</primary></indexterm>
+Each scanline must be padded to a multiple of bits returned
+by this macro or function.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayHeight(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDisplayHeight</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayHeight</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayHeight</primary></indexterm>
+Both return an integer that describes the height of the screen
+in pixels.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayHeightMM(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDisplayHeightMM</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayHeightMM</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayHeightMM</primary></indexterm>
+Both return the height of the specified screen in millimeters.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayWidth(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDisplayWidth</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayWidth</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayWidth</primary></indexterm>
+Both return the width of the screen in pixels.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayWidthMM(<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>screen_number</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDisplayWidthMM</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> screen_number</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen_number</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate screen number on the host server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayWidthMM</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayWidthMM</primary></indexterm>
+Both return the width of the specified screen in millimeters.
+</para>
+</sect2>
+<sect2 id="Screen_Information_Macros">
+<title>Screen Information Macros</title>
+<!-- .XS -->
+<!-- (SN Screen Information Macros -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The following lists the C language macros,
+their corresponding function equivalents that are for other language bindings,
+and what data they both can return.
+These macros or functions all take a pointer to the appropriate screen
+structure.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+BlackPixelOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XBlackPixelOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>BlackPixelOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XBlackPixelOfScreen</primary></indexterm>
+Both return the black pixel value of the specified screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+WhitePixelOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned long <function>XWhitePixelOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>WhitePixelOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XWhitePixelOfScreen</primary></indexterm>
+Both return the white pixel value of the specified screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+CellsOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XCellsOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>CellsOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XCellsOfScreen</primary></indexterm>
+Both return the number of colormap cells in the default colormap 
+of the specified screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultColormapOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Colormap <function>XDefaultColormapOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultColormapOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultColormapOfScreen</primary></indexterm>
+Both return the default colormap of the specified screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultDepthOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDefaultDepthOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultDepthOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultDepthOfScreen</primary></indexterm>
+Both return the depth of the root window.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultGCOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>GC <function>XDefaultGCOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultGCOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultGCOfScreen</primary></indexterm>
+Both return a default graphics context (GC) of the specified screen,
+which has the same depth as the root window of the screen.
+The GC must never be freed.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DefaultVisualOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Visual *<function>XDefaultVisualOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DefaultVisualOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XDefaultVisualOfScreen</primary></indexterm>
+Both return the default visual of the specified screen.
+For information on visual types,
+see section 3.1.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DoesBackingStore(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XDoesBackingStore</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DoesBackingStore</primary></indexterm>
+<indexterm significance="preferred"><primary>XDoesBackingStore</primary></indexterm>
+Both return a value indicating whether the screen supports backing
+stores.
+The value returned can be one of 
+<symbol>WhenMapped</symbol>,
+<symbol>NotUseful</symbol>,
+or
+<symbol>Always</symbol>
+(see section 3.2.4).
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DoesSaveUnders(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XDoesSaveUnders</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DoesSaveUnders</primary></indexterm>
+<indexterm significance="preferred"><primary>XDoesSaveUnders</primary></indexterm>
+Both return a Boolean value indicating whether the
+screen supports save unders.
+If
+<symbol>True</symbol>,
+the screen supports save unders.
+If
+<symbol>False</symbol>,
+the screen does not support save unders (see section 3.2.5).
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+DisplayOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Display *<function>XDisplayOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>DisplayOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XDisplayOfScreen</primary></indexterm>
+Both return the display of the specified screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+<indexterm significance="preferred"><primary>XScreenNumberOfScreen</primary></indexterm>
+</para>
+<para>
+EventMaskOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>long <function>XEventMaskOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XScreenNumberOfScreen</function>
+function returns the screen index number of the specified screen.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+EventMaskOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>long <function>XEventMaskOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>EventMaskOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XEventMaskOfScreen</primary></indexterm>
+Both return the event mask of the root window for the specified screen
+at connection setup time.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+WidthOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XWidthOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>WidthOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XWidthOfScreen</primary></indexterm>
+Both return the width of the specified screen in pixels.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+HeightOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XHeightOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>HeightOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XHeightOfScreen</primary></indexterm>
+Both return the height of the specified screen in pixels.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+WidthMMOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XWidthMMOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>WidthMMOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XWidthMMOfScreen</primary></indexterm>
+Both return the width of the specified screen in millimeters.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+HeightMMOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XHeightMMOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>HeightMMOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XHeightMMOfScreen</primary></indexterm>
+Both return the height of the specified screen in millimeters.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+MaxCmapsOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XMaxCmapsOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>MaxCmapsOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XMaxCmapsOfScreen</primary></indexterm>
+Both return the maximum number of installed colormaps supported 
+by the specified screen (see section 9.3).
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+MinCmapsOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XMinCmapsOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>MinCmapsOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XMinCmapsOfScreen</primary></indexterm>
+Both return the minimum number of installed colormaps supported 
+by the specified screen (see section 9.3).
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+PlanesOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function>XPlanesOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>PlanesOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XPlanesOfScreen</primary></indexterm>
+Both return the depth of the root window.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+<!-- .sM -->
+</para>
+<para>
+RootWindowOfScreen(<emphasis remap='I'>screen</emphasis>)
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Window <function>XRootWindowOfScreen</function></funcdef>
+  <paramdef>Screen<parameter> *screen</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>screen</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the appropriate 
+<type>Screen</type>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<indexterm significance="preferred"><primary>RootWindowOfScreen</primary></indexterm>
+<indexterm significance="preferred"><primary>XRootWindowOfScreen</primary></indexterm>
+Both return the root window of the specified screen.
+</para>
+</sect2>
+</sect1>
+<sect1 id="Generating_a_NoOperation_Protocol_Request">
+<title>Generating a NoOperation Protocol Request</title>
+<!-- .XS -->
+<!-- (SN Generating a NoOperation Protocol Request -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To execute a 
+<systemitem>NoOperation</systemitem>
+protocol request, use
+<function>XNoOp</function>.
+<indexterm significance="preferred"><primary>XNoOp</primary></indexterm>
+<!-- .sM -->
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef><function>XNoOp</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+  <varlistentry>
+    <term><emphasis remap='I'>display</emphasis></term>
+    <listitem>
+      <para>Specifies the connection to the X server.</para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XNoOp</function>
+function sends a 
+<systemitem>NoOperation</systemitem>
+protocol request to the X server,
+thereby exercising the connection.
+</para>
+</sect1>
+<sect1 id="Freeing_Client_Created_Data">
+<title>Freeing Client-Created Data</title>
+<!-- .XS -->
+<!-- (SN Freeing Client-Created Data -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To free in-memory data that was created by an Xlib function, use
+<function>XFree</function>.
+<indexterm significance="preferred"><primary>XFree</primary></indexterm>
+<!-- .sM -->
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XFree</funcdef>
+  <paramdef>void<parameter> *data</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>data</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the data that is to be freed.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XFree</function>
+function is a general-purpose Xlib routine that frees the specified data.
+You must use it to free any objects that were allocated by Xlib,
+unless an alternate function is explicitly specified for the object.
+A NULL pointer cannot be passed to this function.
+</para>
+</sect1>
+<sect1 id="Closing_the_Display">
+<title>Closing the Display</title>
+<!-- .XS -->
+<!-- (SN Closing the Display -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To close a display or disconnect from the X server, use
+<function>XCloseDisplay</function>.
+<indexterm significance="preferred"><primary>XCloseDisplay</primary></indexterm>
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XCloseDisplay</funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XCloseDisplay</function>
+function closes the connection to the X server for the display specified in the
+<type>Display</type>
+structure and destroys all windows, resource IDs
+(<type>Window</type>,
+<type>Font</type>,
+<type>Pixmap</type>,
+<type>Colormap</type>,
+<type>Cursor</type>,
+and
+<type>GContext</type>),
+or other resources that the client has created
+on this display, unless the close-down mode of the resource has been changed
+(see
+<function>XSetCloseDownMode</function>).
+Therefore, these windows, resource IDs, and other resources should never be 
+referenced again or an error will be generated.
+Before exiting, you should call
+<function>XCloseDisplay</function>
+explicitly so that any pending errors are reported as
+<function>XCloseDisplay</function>
+performs a final
+<function>XSync</function>
+operation.
+<indexterm><primary>Resource IDs</primary></indexterm>
+<indexterm><primary>XCloseDisplay</primary></indexterm>
+</para>
+<para>
+<!-- .LP -->
+<function>XCloseDisplay</function>
+can generate a
+<errorname>BadGC</errorname>
+error.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+Xlib provides a function to permit the resources owned by a client
+to survive after the client's connection is closed.
+To change a client's close-down mode, use
+<function>XSetCloseDownMode</function>.
+<indexterm significance="preferred"><primary>XSetCloseDownMode</primary></indexterm>
+<!-- .sM -->
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XSetCloseDownMode</funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> close_mode</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>close_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the client close-down mode.
+You can pass 
+<symbol>DestroyAll</symbol>,
+<symbol>RetainPermanent</symbol>,
+or
+<symbol>RetainTemporary</symbol>.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XSetCloseDownMode</function>
+defines what will happen to the client's resources at connection close.
+A connection starts in
+<symbol>DestroyAll</symbol>
+mode.
+For information on what happens to the client's resources when the
+close_mode argument is
+<symbol>RetainPermanent</symbol>
+or
+<symbol>RetainTemporary</symbol>,
+see section 2.6.
+</para>
+<para>
+<!-- .LP -->
+<function>XSetCloseDownMode</function>
+can generate a
+<errorname>BadValue</errorname>
+error.
+</para>
+</sect1>
+<sect1 id="Using_X_Server_Connection_Close_Operations_">
+<title>Using X Server Connection Close Operations </title>
+<!-- .XS -->
+<!-- (SN Using X Server Connection Close Operations -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+When the X server's connection to a client is closed
+either by an explicit call to
+<function>XCloseDisplay</function>
+or by a process that exits, the X server performs the following
+automatic operations:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+It disowns all selections owned by the client
+(see 
+<function>XSetSelectionOwner</function>).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It performs an
+<function>XUngrabPointer</function>
+and
+<function>XUngrabKeyboard</function>
+if the client has actively grabbed the pointer 
+or the keyboard.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It performs an
+<function>XUngrabServer</function>
+if the client has grabbed the server.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It releases all passive grabs made by the client.  
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It marks all resources (including colormap entries) allocated 
+by the client either as permanent or temporary, 
+depending on whether the close-down mode is 
+<symbol>RetainPermanent</symbol>
+or
+<symbol>RetainTemporary</symbol>.
+However, this does not prevent other client applications from explicitly
+destroying the resources (see 
+<function>XSetCloseDownMode</function>).
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+When the close-down mode is
+<symbol>DestroyAll</symbol>,
+the X server destroys all of a client's resources as follows:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+It examines each window in the client's save-set to determine if it is an inferior
+(subwindow) of a window created by the client.
+(The save-set is a list of other clients' windows
+that are referred to as save-set windows.)
+If so, the X server reparents the save-set window to the closest ancestor so
+that the save-set window is not an inferior of a window created by the client.
+The reparenting leaves unchanged the absolute coordinates (with respect to
+the root window) of the upper-left outer corner of the save-set
+window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It performs a
+<systemitem>MapWindow</systemitem>
+request on the save-set window if the save-set window is unmapped.
+The X server does this even if the save-set window was not an inferior of 
+a window created by the client.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It destroys all windows created by the client.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It performs the appropriate free request on each nonwindow resource created by
+the client in the server (for example, 
+<type>Font</type>,
+<type>Pixmap</type>,
+<type>Cursor</type>,
+<type>Colormap</type>,
+and 
+<type>GContext</type>).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It frees all colors and colormap entries allocated by a client application.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+Additional processing occurs when the last connection to the X server closes.
+An X server goes through a cycle of having no connections and having some
+connections.
+When the last connection to the X server closes as a result of a connection
+closing with the close_mode of
+<symbol>DestroyAll</symbol>,
+the X server does the following: 
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+It resets its state as if it had just been
+started.  
+The X server begins by destroying all lingering resources from
+clients that have terminated in 
+<symbol>RetainPermanent</symbol>
+or
+<symbol>RetainTemporary</symbol>
+mode.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It deletes all but the predefined atom identifiers.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It deletes all properties on all root windows (see section 4.3).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It resets all device maps and attributes 
+(for example, key click, bell volume, and acceleration) 
+as well as the access control list.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It restores the standard root tiles and cursors.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It restores the default font path.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It restores the input focus to state
+<symbol>PointerRoot</symbol>.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+However, the X server does not reset if you close a connection with a close-down
+mode set to
+<symbol>RetainPermanent</symbol>
+or
+<symbol>RetainTemporary</symbol>.
+</para>
+</sect1>
+<sect1 id="Using_Xlib_with_Threads">
+<title>Using Xlib with Threads</title>
+<!-- .XS -->
+<!-- (SN Using Xlib with Threads -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+On systems that have threads, support may be provided to permit
+multiple threads to use Xlib concurrently.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To initialize support for concurrent threads, use
+<function>XInitThreads</function>.
+<indexterm significance="preferred"><primary>XInitThreads</primary></indexterm>
+<!-- .sM -->
+</para>
+<para>Status XInitThreads();</para>
+<!-- .FN -->
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XInitThreads</function>
+function initializes Xlib support for concurrent threads.
+This function must be the first Xlib function a
+multi-threaded program calls, and it must complete
+before any other Xlib call is made.
+This function returns a nonzero status if initialization was
+successful; otherwise, it returns zero.
+On systems that do not support threads, this function always returns zero.
+</para>
+<para>
+<!-- .LP -->
+It is only necessary to call this function if multiple threads
+might use Xlib concurrently.  If all calls to Xlib functions
+are protected by some other access mechanism (for example,
+a mutual exclusion lock in a toolkit or through explicit client
+programming), Xlib thread initialization is not required.
+It is recommended that single-threaded programs not call this function.
+
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To lock a display across several Xlib calls, use
+<function>XLockDisplay</function>.
+<indexterm significance="preferred"><primary>XLockDisplay</primary></indexterm>
+<!-- .sM -->
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XLockDisplay</funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XLockDisplay</function>
+function locks out all other threads from using the specified display.
+Other threads attempting to use the display will block until
+the display is unlocked by this thread.
+Nested calls to
+<function>XLockDisplay</function>
+work correctly; the display will not actually be unlocked until
+<function>XUnlockDisplay</function>
+has been called the same number of times as
+<function>XLockDisplay</function>.
+This function has no effect unless Xlib was successfully initialized
+for threads using
+<function>XInitThreads</function>.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To unlock a display, use
+<function>XUnlockDisplay</function>.
+<indexterm significance="preferred"><primary>XUnlockDisplay</primary></indexterm>
+<!-- .sM -->
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XUnlockDisplay</funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XUnlockDisplay</function>
+function allows other threads to use the specified display again.
+Any threads that have blocked on the display are allowed to continue.
+Nested locking works correctly; if
+<function>XLockDisplay</function>
+has been called multiple times by a thread, then
+<function>XUnlockDisplay</function>
+must be called an equal number of times before the display is
+actually unlocked.
+This function has no effect unless Xlib was successfully initialized
+for threads using
+<function>XInitThreads</function>.
+</para>
+</sect1>
+<sect1 id="Using_Internal_Connections">
+<title>Using Internal Connections</title>
+<!-- .XS -->
+<!-- (SN Using Internal Connections -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+In addition to the connection to the X server, an Xlib implementation
+may require connections to other kinds of servers (for example, to
+input method servers as described in chapter 13).  Toolkits and clients
+that use multiple displays, or that use displays in combination with
+other inputs, need to obtain these additional connections to correctly
+block until input is available and need to process that input
+when it is available.  Simple clients that use a single display and
+block for input in an Xlib event function do not need to use these
+facilities.
+</para>
+<para>
+<!-- .LP -->
+To track internal connections for a display, use
+<function>XAddConnectionWatch</function>.
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>type void XConnectionWatchProc</funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XPointer<parameter> client_data</parameter></paramdef>
+  <paramdef>int<parameter> fd</parameter></paramdef>
+  <paramdef>Bool<parameter> opening</parameter></paramdef>
+  <paramdef>XPointer<parameter> *watch_data</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status XAddConnectionWatch</funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XWatchProc<parameter> procedure</parameter></paramdef>
+  <paramdef>XPointer<parameter> client_data</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>procedure</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the procedure to be called.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>client_data</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the additional client data.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XAddConnectionWatch</function>
+function registers a procedure to be called each time Xlib opens or closes an
+internal connection for the specified display.  The procedure is passed the
+display, the specified client_data, the file descriptor for the connection,
+a Boolean indicating whether the connection is being opened or closed, and a
+pointer to a location for private watch data.  If opening is
+<symbol>True</symbol>,
+the procedure can store a pointer to private data in the location pointed
+to by watch_data;
+when the procedure is later called for this same connection and opening is
+<symbol>False</symbol>,
+the location pointed to by watch_data will hold this same private data pointer.
+</para>
+<para>
+<!-- .LP -->
+This function can be called at any time after a display is opened.
+If internal connections already exist, the registered procedure will
+immediately be called for each of them, before
+<function>XAddConnectionWatch</function>
+returns.
+<function>XAddConnectionWatch</function>
+returns a nonzero status if the procedure is successfully registered;
+otherwise, it returns zero.
+</para>
+<para>
+<!-- .LP -->
+The registered procedure should not call any Xlib functions.
+If the procedure directly or indirectly causes the state of internal
+connections or watch procedures to change, the result is not defined.
+If Xlib has been initialized for threads, the procedure is called with
+the display locked and the result of a call by the procedure to any
+Xlib function that locks the display is not defined unless the executing
+thread has externally locked the display using
+<function>XLockDisplay</function>.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To stop tracking internal connections for a display, use
+<function>XRemoveConnectionWatch</function>.
+<indexterm significance="preferred"><primary>XRemoveConnectionWatch</primary></indexterm>
+<!-- .sM -->
+</para>
+<para>
+()
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRemoveConnectionWatch</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XWatchProc<parameter> procedure</parameter></paramdef>
+  <paramdef>XPointer<parameter> client_data</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>procedure</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the procedure to be called.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>client_data</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the additional client data.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XRemoveConnectionWatch</function>
+function removes a previously registered connection watch procedure.
+The client_data must match the client_data used when the procedure
+was initially registered.
+
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To process input on an internal connection, use
+<function>XProcessInternalConnection</function>.
+<indexterm significance="preferred"><primary>XProcessInternalConnection</primary></indexterm>
+<!-- .sM -->
+</para>
+<para>
+()
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XProcessInternalConnection</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> fd</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>fd</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the file descriptor.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XProcessInternalConnection</function>
+function processes input available on an internal connection.
+This function should be called for an internal connection only
+after an operating system facility (for example,
+<function>select</function>
+or
+<function>poll</function>)
+has indicated that input is available; otherwise,
+the effect is not defined.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sp -->
+To obtain all of the current internal connections for a display, use
+<function>XInternalConnectionNumbers</function>.
+<indexterm significance="preferred"><primary>XInternalConnectionNumbers</primary></indexterm>
+<!-- .sM -->
+</para>
+<para>
+()
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XInternalConnectionNumbers</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int **<parameter> fd</parameter></paramdef>
+  <paramdef>int *<parameter> count_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>fd_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the file descriptors.
+<!-- .ds Cn file descriptors -->
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>count_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of (Cn.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XInternalConnectionNumbers</function>
+function returns a list of the file descriptors for all internal
+connections currently open for the specified display.
+When the allocated list is no longer needed,
+free it by using
+<function>XFree</function>.
+This functions returns a nonzero status if the list is successfully allocated;
+otherwise, it returns zero.
+</para>
+</sect1>
+</chapter>
diff --git a/libX11/src/FSWrap.c b/libX11/src/FSWrap.c
index 94d94fbe9..45a2c34e3 100644
--- a/libX11/src/FSWrap.c
+++ b/libX11/src/FSWrap.c
@@ -85,10 +85,9 @@ _XParseBaseFontNameList(
     if (!*str)
 	return (char **)NULL;
 
-    if (!(ptr = Xmalloc((unsigned)strlen(str) + 1))) {
+    if (!(ptr = strdup(str))) {
 	return (char **)NULL;
     }
-    strcpy(ptr, str);
 
     psave = ptr;
     /* somebody who specifies more than XMAXLIST basefontnames will lose */
diff --git a/libX11/src/InitExt.c b/libX11/src/InitExt.c
index cb9191de6..19515ccd0 100644
--- a/libX11/src/InitExt.c
+++ b/libX11/src/InitExt.c
@@ -50,14 +50,13 @@ XExtCodes *XInitExtension (
 
 	LockDisplay (dpy);
 	if (! (ext = (_XExtension *) Xcalloc (1, sizeof (_XExtension))) ||
-	    ! (ext->name = Xmalloc((unsigned) strlen(name) + 1))) {
+	    ! (ext->name = strdup(name))) {
 	    if (ext) Xfree((char *) ext);
 	    UnlockDisplay(dpy);
 	    return (XExtCodes *) NULL;
 	}
 	codes.extension = dpy->ext_number++;
 	ext->codes = codes;
-	(void) strcpy(ext->name, name);
 
 	/* chain it onto the display list */
 	ext->next = dpy->ext_procs;
diff --git a/libX11/src/Quarks.c b/libX11/src/Quarks.c
index d0eb69018..7a704b101 100644
--- a/libX11/src/Quarks.c
+++ b/libX11/src/Quarks.c
@@ -210,10 +210,9 @@ ExpandQuarkTable(void)
 #endif
 	newmask = 0x1ff;
     }
-    entries = (Entry *)Xmalloc(sizeof(Entry) * (newmask + 1));
+    entries = Xcalloc(newmask + 1, sizeof(Entry));
     if (!entries)
 	return False;
-    bzero((char *)entries, sizeof(Entry) * (newmask + 1));
     quarkTable = entries;
     quarkMask = newmask;
     quarkRehash = quarkMask - 2;
diff --git a/libX11/src/SetLocale.c b/libX11/src/SetLocale.c
index 00c76ee45..c49cb2e4e 100644
--- a/libX11/src/SetLocale.c
+++ b/libX11/src/SetLocale.c
@@ -103,13 +103,12 @@ _Xsetlocale(
     if (!methods)
 	return NULL;
     name = (*methods->lcname)(state);
-    xsl_name = Xmalloc(strlen(name) + 1);
+    xsl_name = strdup(name);
     if (!xsl_name) {
 	xsl_name = old_name;
 	(*methods->destroy)(state);
 	return NULL;
     }
-    strcpy(xsl_name, name);
     if (old_name)
 	Xfree(old_name);
     (*methods->destroy)(state);
diff --git a/libX11/src/Xrm.c b/libX11/src/Xrm.c
index c466cae7f..53467aedc 100644
--- a/libX11/src/Xrm.c
+++ b/libX11/src/Xrm.c
@@ -581,23 +581,21 @@ static void GrowTable(
 	ltable = (LTable)table;
 	/* cons up a copy to make MoveValues look symmetric */
 	otable = *ltable;
-	ltable->buckets = (VEntry *)Xmalloc(i * sizeof(VEntry));
+	ltable->buckets = Xcalloc(i, sizeof(VEntry));
 	if (!ltable->buckets) {
 	    ltable->buckets = otable.buckets;
 	    return;
 	}
 	ltable->table.mask = i - 1;
-	bzero((char *)ltable->buckets, i * sizeof(VEntry));
 	MoveValues(&otable, ltable);
     } else {
 	register NTable ntable;
 
-	ntable = (NTable)Xmalloc(sizeof(NTableRec) + i * sizeof(NTable));
+	ntable = Xcalloc(1, sizeof(NTableRec) + (i * sizeof(NTable)));
 	if (!ntable)
 	    return;
 	*ntable = *table;
 	ntable->mask = i - 1;
-	bzero((char *)NodeBuckets(ntable), i * sizeof(NTable));
 	*prev = ntable;
 	MoveTables(table, ntable);
     }
diff --git a/libX11/src/xcms/PrOfId.c b/libX11/src/xcms/PrOfId.c
index 831f17ab9..a96d28cec 100644
--- a/libX11/src/xcms/PrOfId.c
+++ b/libX11/src/xcms/PrOfId.c
@@ -66,7 +66,6 @@ XcmsPrefixOfFormat(
  */
 {
     XcmsColorSpace	**papColorSpaces;
-    char *prefix;
 
     /*
      * First try Device-Independent color spaces
@@ -75,10 +74,7 @@ XcmsPrefixOfFormat(
     if (papColorSpaces != NULL) {
 	while (*papColorSpaces != NULL) {
 	    if ((*papColorSpaces)->id == id) {
-		prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
-		1) * sizeof(char));
-		strcpy(prefix, (*papColorSpaces)->prefix);
-		return(prefix);
+		return strdup((*papColorSpaces)->prefix);
 	    }
 	    papColorSpaces++;
 	}
@@ -91,10 +87,7 @@ XcmsPrefixOfFormat(
     if (papColorSpaces != NULL) {
 	while (*papColorSpaces != NULL) {
 	    if ((*papColorSpaces)->id == id) {
-		prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
-		1) * sizeof(char));
-		strcpy(prefix, (*papColorSpaces)->prefix);
-		return(prefix);
+		return strdup((*papColorSpaces)->prefix);
 	    }
 	    papColorSpaces++;
 	}
diff --git a/libX11/src/xkb/XKBGAlloc.c b/libX11/src/xkb/XKBGAlloc.c
index 832d28530..7679496e3 100644
--- a/libX11/src/xkb/XKBGAlloc.c
+++ b/libX11/src/xkb/XKBGAlloc.c
@@ -1,1016 +1,1011 @@
-/************************************************************
-Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#elif defined(HAVE_CONFIG_H)
-#include <config.h>
-#endif
-
-#ifndef XKB_IN_SERVER
-
-#include <stdio.h>
-#include "Xlibint.h"
-#include "XKBlibint.h"
-#include <X11/extensions/XKBgeom.h>
-#include <X11/extensions/XKBproto.h>
-
-#else
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
-#include <X11/extensions/XKBgeom.h>
-
-#endif /* XKB_IN_SERVER */
-
-#ifdef X_NOT_POSIX
-#define Size_t unsigned int
-#else
-#define Size_t size_t
-#endif
-
-/***====================================================================***/
-
-static void
-_XkbFreeGeomLeafElems(	Bool			freeAll,
-			int			first,
-			int 			count,
-			unsigned short *	num_inout,
-			unsigned short *	sz_inout,
-			char **			elems,
-			unsigned int		elem_sz)
-{
-    if ((freeAll)||(*elems==NULL)) {
-	*num_inout= *sz_inout= 0;
-	if (*elems!=NULL) {
-	    _XkbFree(*elems);
-	    *elems= NULL;
-	}
-	return;
-    }
-
-    if ((first>=(*num_inout))||(first<0)||(count<1))
-	return;
-
-    if (first+count>=(*num_inout)) {
-	/* truncating the array is easy */
-	(*num_inout)= first;
-    }
-    else {
-	char *	ptr;
-	int 	extra;
-	ptr= *elems;
-	extra= ((*num_inout)-(first+count))*elem_sz;
-	if (extra>0)
-	    memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],extra);
-	(*num_inout)-= count;
-    }
-    return;
-}
-
-typedef void (*ContentsClearFunc)(
-		char *		/* priv */
-);
-
-static void
-_XkbFreeGeomNonLeafElems(	Bool			freeAll,
-				int			first,
-				int 			count,
-				unsigned short *	num_inout,
-				unsigned short *	sz_inout,
-				char **			elems,
-				unsigned int		elem_sz,
-				ContentsClearFunc	freeFunc)
-{
-register int i;
-register char *ptr;
-
-    if (freeAll) {
-	first= 0;
-	count= (*num_inout);
-    }
-    else if ((first>=(*num_inout))||(first<0)||(count<1))
-	return;
-    else if (first+count>(*num_inout))
-	count= (*num_inout)-first;
-    if (*elems==NULL)
-	return;
-
-    if (freeFunc) {
-	ptr= *elems;
-	ptr+= first*elem_sz;
-	for (i=0;i<count;i++) {
-	    (*freeFunc)(ptr);
-	    ptr+= elem_sz;
-	}
-    }
-    if (freeAll) {
-	(*num_inout)= (*sz_inout)= 0;
-	if (*elems) {
-	    _XkbFree(*elems);
-	    *elems= NULL;
-	}
-    }
-    else if (first+count>=(*num_inout))
-	*num_inout= first;
-    else {
-	i= ((*num_inout)-(first+count))*elem_sz;
-	ptr= *elems;
-	memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],i);
-	(*num_inout)-= count;
-    }
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearProperty(char *prop_in)
-{
-XkbPropertyPtr	prop= (XkbPropertyPtr)prop_in;
-
-    if (prop->name) {
-	_XkbFree(prop->name);
-	prop->name= NULL;
-    }
-    if (prop->value) {
-	_XkbFree(prop->value);
-	prop->value= NULL;
-    }
-    return;
-}
-
-void
-XkbFreeGeomProperties(	XkbGeometryPtr	geom,
-			int		first,
-			int		count,
-			Bool		freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&geom->num_properties,&geom->sz_properties,
-				(char **)&geom->properties,
-				sizeof(XkbPropertyRec),_XkbClearProperty);
-    return;
-}
-
-/***====================================================================***/
-
-void
-XkbFreeGeomKeyAliases(	XkbGeometryPtr	geom,
-			int		first,
-			int		count,
-			Bool		freeAll)
-{
-    _XkbFreeGeomLeafElems(freeAll,first,count,
-				&geom->num_key_aliases,&geom->sz_key_aliases,
-				(char **)&geom->key_aliases,
-				sizeof(XkbKeyAliasRec));
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearColor(char *color_in)
-{
-XkbColorPtr	color= (XkbColorPtr)color_in;
-
-    if (color->spec)
-	_XkbFree(color->spec);
-    return;
-}
-
-void
-XkbFreeGeomColors(XkbGeometryPtr geom,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&geom->num_colors,&geom->sz_colors,
-				(char **)&geom->colors,
-				sizeof(XkbColorRec),_XkbClearColor);
-    return;
-}
-
-/***====================================================================***/
-
-void
-XkbFreeGeomPoints(XkbOutlinePtr outline,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomLeafElems(freeAll,first,count,
-				&outline->num_points,&outline->sz_points,
-				(char **)&outline->points,
-				sizeof(XkbPointRec));
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearOutline(char *outline_in)
-{
-XkbOutlinePtr	outline= (XkbOutlinePtr)outline_in;
-
-    if (outline->points!=NULL)
-	XkbFreeGeomPoints(outline,0,outline->num_points,True);
-    return;
-}
-
-void
-XkbFreeGeomOutlines(XkbShapePtr	shape,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&shape->num_outlines,&shape->sz_outlines,
-				(char **)&shape->outlines,
-				sizeof(XkbOutlineRec),_XkbClearOutline);
-
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearShape(char *shape_in)
-{
-XkbShapePtr	shape= (XkbShapePtr)shape_in;
-
-    if (shape->outlines)
-	XkbFreeGeomOutlines(shape,0,shape->num_outlines,True);
-    return;
-}
-
-void
-XkbFreeGeomShapes(XkbGeometryPtr geom,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&geom->num_shapes,&geom->sz_shapes,
-				(char **)&geom->shapes,
-				sizeof(XkbShapeRec),_XkbClearShape);
-    return;
-}
-
-/***====================================================================***/
-
-void
-XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomLeafElems(freeAll,first,count,
-				&row->num_keys,&row->sz_keys,
-				(char **)&row->keys,
-				sizeof(XkbOverlayKeyRec));
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearOverlayRow(char *row_in)
-{
-XkbOverlayRowPtr	row= (XkbOverlayRowPtr)row_in;
-
-    if (row->keys!=NULL)
-	XkbFreeGeomOverlayKeys(row,0,row->num_keys,True);
-    return;
-}
-
-void
-XkbFreeGeomOverlayRows(XkbOverlayPtr overlay,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&overlay->num_rows,&overlay->sz_rows,
-				(char **)&overlay->rows,
-				sizeof(XkbOverlayRowRec),_XkbClearOverlayRow);
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearOverlay(char *overlay_in)
-{
-XkbOverlayPtr	overlay= (XkbOverlayPtr)overlay_in;
-
-    if (overlay->rows!=NULL)
-	XkbFreeGeomOverlayRows(overlay,0,overlay->num_rows,True);
-    return;
-}
-
-void
-XkbFreeGeomOverlays(XkbSectionPtr section,int first,int	count,Bool freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&section->num_overlays,&section->sz_overlays,
-				(char **)&section->overlays,
-				sizeof(XkbOverlayRec),_XkbClearOverlay);
-    return;
-}
-
-/***====================================================================***/
-
-void
-XkbFreeGeomKeys(XkbRowPtr row,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomLeafElems(freeAll,first,count,
-				&row->num_keys,&row->sz_keys,
-				(char **)&row->keys,
-				sizeof(XkbKeyRec));
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearRow(char *row_in)
-{
-XkbRowPtr	row= (XkbRowPtr)row_in;
-
-    if (row->keys!=NULL)
-	XkbFreeGeomKeys(row,0,row->num_keys,True);
-    return;
-}
-
-void
-XkbFreeGeomRows(XkbSectionPtr section,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&section->num_rows,&section->sz_rows,
-				(char **)&section->rows,
-				sizeof(XkbRowRec),_XkbClearRow);
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearSection(char *section_in)
-{
-XkbSectionPtr	section= (XkbSectionPtr)section_in;
-
-    if (section->rows!=NULL)
-	XkbFreeGeomRows(section,0,section->num_rows,True);
-    if (section->doodads!=NULL) {
-	XkbFreeGeomDoodads(section->doodads,section->num_doodads,True);
-	section->doodads= NULL;
-    }
-    return;
-}
-
-void
-XkbFreeGeomSections(XkbGeometryPtr geom,int first,int count,Bool freeAll)
-{
-    _XkbFreeGeomNonLeafElems(freeAll,first,count,
-				&geom->num_sections,&geom->sz_sections,
-				(char **)&geom->sections,
-				sizeof(XkbSectionRec),_XkbClearSection);
-    return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearDoodad(char *doodad_in)
-{
-XkbDoodadPtr	doodad= (XkbDoodadPtr)doodad_in;
-
-    switch (doodad->any.type) {
-   	case XkbTextDoodad:
-	    {
-		if (doodad->text.text!=NULL) {
-		    _XkbFree(doodad->text.text);
-		    doodad->text.text= NULL;
-		}
-		if (doodad->text.font!=NULL) {
-		    _XkbFree(doodad->text.font);
-		    doodad->text.font= NULL;
-		}
-	    }
-	    break;
-   	case XkbLogoDoodad:
-	    {
-		if (doodad->logo.logo_name!=NULL) {
-		    _XkbFree(doodad->logo.logo_name);
-		    doodad->logo.logo_name= NULL;
-		}
-	    }
-	    break;
-    }
-    return;
-}
-
-void
-XkbFreeGeomDoodads(XkbDoodadPtr doodads,int nDoodads,Bool freeAll)
-{
-register int 		i;
-register XkbDoodadPtr	doodad;
-
-    if (doodads) {
-	for (i=0,doodad= doodads;i<nDoodads;i++,doodad++) {
-	    _XkbClearDoodad((char *)doodad);
-	}
-	if (freeAll)
-	    _XkbFree(doodads);
-    }
-    return;
-}
-
-void
-XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
-{
-    if (geom==NULL)
-	return;
-    if (freeMap)
-	which= XkbGeomAllMask;
-    if ((which&XkbGeomPropertiesMask)&&(geom->properties!=NULL))
-	XkbFreeGeomProperties(geom,0,geom->num_properties,True);
-    if ((which&XkbGeomColorsMask)&&(geom->colors!=NULL))
-	XkbFreeGeomColors(geom,0,geom->num_colors,True);
-    if ((which&XkbGeomShapesMask)&&(geom->shapes!=NULL))
-	XkbFreeGeomShapes(geom,0,geom->num_shapes,True);
-    if ((which&XkbGeomSectionsMask)&&(geom->sections!=NULL))
-	XkbFreeGeomSections(geom,0,geom->num_sections,True);
-    if ((which&XkbGeomDoodadsMask)&&(geom->doodads!= NULL)) {
-	XkbFreeGeomDoodads(geom->doodads,geom->num_doodads,True);
-	geom->doodads= NULL;
-	geom->num_doodads= geom->sz_doodads= 0;
-    }
-    if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
-	XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,True);
-    if (freeMap) {
-	if (geom->label_font!=NULL) {
-	    _XkbFree(geom->label_font);
-	    geom->label_font= NULL;
-	}
-	_XkbFree(geom);
-    }
-    return;
-}
-
-/***====================================================================***/
-
-static Status
-_XkbGeomAlloc(	XPointer *		old,
-		unsigned short *	num,
-		unsigned short *	total,
-		int			num_new,
-		Size_t			sz_elem)
-{
-    if (num_new<1)
-	return Success;
-    if ((*old)==NULL)
-	*num= *total= 0;
-
-    if ((*num)+num_new<=(*total))
-	return Success;
-
-    *total= (*num)+num_new;
-    if ((*old)!=NULL)
-	 (*old)= (XPointer)_XkbRealloc((*old),(*total)*sz_elem);
-    else (*old)= (XPointer)_XkbCalloc((*total),sz_elem);
-    if ((*old)==NULL) {
-	*total= *num= 0;
-	return BadAlloc;
-    }
-
-    if (*num>0) {
-	char *tmp= (char *)(*old);
-	bzero(&tmp[sz_elem*(*num)],(num_new*sz_elem));
-    }
-    return Success;
-}
-
-#define	_XkbAllocProps(g,n) _XkbGeomAlloc((XPointer *)&(g)->properties,\
-				&(g)->num_properties,&(g)->sz_properties,\
-				(n),sizeof(XkbPropertyRec))
-#define	_XkbAllocColors(g,n) _XkbGeomAlloc((XPointer *)&(g)->colors,\
-				&(g)->num_colors,&(g)->sz_colors,\
-				(n),sizeof(XkbColorRec))
-#define	_XkbAllocShapes(g,n) _XkbGeomAlloc((XPointer *)&(g)->shapes,\
-				&(g)->num_shapes,&(g)->sz_shapes,\
-				(n),sizeof(XkbShapeRec))
-#define	_XkbAllocSections(g,n) _XkbGeomAlloc((XPointer *)&(g)->sections,\
-				&(g)->num_sections,&(g)->sz_sections,\
-				(n),sizeof(XkbSectionRec))
-#define	_XkbAllocDoodads(g,n) _XkbGeomAlloc((XPointer *)&(g)->doodads,\
-				&(g)->num_doodads,&(g)->sz_doodads,\
-				(n),sizeof(XkbDoodadRec))
-#define	_XkbAllocKeyAliases(g,n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases,\
-				&(g)->num_key_aliases,&(g)->sz_key_aliases,\
-				(n),sizeof(XkbKeyAliasRec))
-
-#define	_XkbAllocOutlines(s,n) _XkbGeomAlloc((XPointer *)&(s)->outlines,\
-				&(s)->num_outlines,&(s)->sz_outlines,\
-				(n),sizeof(XkbOutlineRec))
-#define	_XkbAllocRows(s,n) _XkbGeomAlloc((XPointer *)&(s)->rows,\
-				&(s)->num_rows,&(s)->sz_rows,\
-				(n),sizeof(XkbRowRec))
-#define	_XkbAllocPoints(o,n) _XkbGeomAlloc((XPointer *)&(o)->points,\
-				&(o)->num_points,&(o)->sz_points,\
-				(n),sizeof(XkbPointRec))
-#define	_XkbAllocKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
-				&(r)->num_keys,&(r)->sz_keys,\
-				(n),sizeof(XkbKeyRec))
-#define	_XkbAllocOverlays(s,n) _XkbGeomAlloc((XPointer *)&(s)->overlays,\
-				&(s)->num_overlays,&(s)->sz_overlays,\
-				(n),sizeof(XkbOverlayRec))
-#define	_XkbAllocOverlayRows(o,n) _XkbGeomAlloc((XPointer *)&(o)->rows,\
-				&(o)->num_rows,&(o)->sz_rows,\
-				(n),sizeof(XkbOverlayRowRec))
-#define	_XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
-				&(r)->num_keys,&(r)->sz_keys,\
-				(n),sizeof(XkbOverlayKeyRec))
-
-Status
-XkbAllocGeomProps(XkbGeometryPtr geom,int nProps)
-{
-    return _XkbAllocProps(geom,nProps);
-}
-
-Status
-XkbAllocGeomColors(XkbGeometryPtr geom,int nColors)
-{
-    return _XkbAllocColors(geom,nColors);
-}
-
-Status
-XkbAllocGeomKeyAliases(XkbGeometryPtr geom,int nKeyAliases)
-{
-    return _XkbAllocKeyAliases(geom,nKeyAliases);
-}
-
-Status
-XkbAllocGeomShapes(XkbGeometryPtr geom,int nShapes)
-{
-    return _XkbAllocShapes(geom,nShapes);
-}
-
-Status
-XkbAllocGeomSections(XkbGeometryPtr geom,int nSections)
-{
-    return _XkbAllocSections(geom,nSections);
-}
-
-Status
-XkbAllocGeomOverlays(XkbSectionPtr section,int nOverlays)
-{
-    return _XkbAllocOverlays(section,nOverlays);
-}
-
-Status
-XkbAllocGeomOverlayRows(XkbOverlayPtr overlay,int nRows)
-{
-    return _XkbAllocOverlayRows(overlay,nRows);
-}
-
-Status
-XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row,int nKeys)
-{
-    return _XkbAllocOverlayKeys(row,nKeys);
-}
-
-Status
-XkbAllocGeomDoodads(XkbGeometryPtr geom,int nDoodads)
-{
-    return _XkbAllocDoodads(geom,nDoodads);
-}
-
-Status
-XkbAllocGeomSectionDoodads(XkbSectionPtr section,int nDoodads)
-{
-    return _XkbAllocDoodads(section,nDoodads);
-}
-
-Status
-XkbAllocGeomOutlines(XkbShapePtr shape,int nOL)
-{
-    return _XkbAllocOutlines(shape,nOL);
-}
-
-Status
-XkbAllocGeomRows(XkbSectionPtr section,int nRows)
-{
-    return _XkbAllocRows(section,nRows);
-}
-
-Status
-XkbAllocGeomPoints(XkbOutlinePtr ol,int nPts)
-{
-    return _XkbAllocPoints(ol,nPts);
-}
-
-Status
-XkbAllocGeomKeys(XkbRowPtr row,int nKeys)
-{
-    return _XkbAllocKeys(row,nKeys);
-}
-
-Status
-XkbAllocGeometry(XkbDescPtr xkb,XkbGeometrySizesPtr sizes)
-{
-XkbGeometryPtr	geom;
-Status		rtrn;
-
-    if (xkb->geom==NULL) {
-	xkb->geom= _XkbTypedCalloc(1,XkbGeometryRec);
-	if (!xkb->geom)
-	    return BadAlloc;
-    }
-    geom= xkb->geom;
-    if ((sizes->which&XkbGeomPropertiesMask)&&
-	((rtrn=_XkbAllocProps(geom,sizes->num_properties))!=Success)) {
-	goto BAIL;
-    }
-    if ((sizes->which&XkbGeomColorsMask)&&
-	((rtrn=_XkbAllocColors(geom,sizes->num_colors))!=Success)) {
-	goto BAIL;
-    }
-    if ((sizes->which&XkbGeomShapesMask)&&
-	((rtrn=_XkbAllocShapes(geom,sizes->num_shapes))!=Success)) {
-	goto BAIL;
-    }
-    if ((sizes->which&XkbGeomSectionsMask)&&
-	((rtrn=_XkbAllocSections(geom,sizes->num_sections))!=Success)) {
-	goto BAIL;
-    }
-    if ((sizes->which&XkbGeomDoodadsMask)&&
-	((rtrn=_XkbAllocDoodads(geom,sizes->num_doodads))!=Success)) {
-	goto BAIL;
-    }
-    if ((sizes->which&XkbGeomKeyAliasesMask)&&
-	((rtrn=_XkbAllocKeyAliases(geom,sizes->num_key_aliases))!=Success)) {
-	goto BAIL;
-    }
-    return Success;
-BAIL:
-    XkbFreeGeometry(geom,XkbGeomAllMask,True);
-    xkb->geom= NULL;
-    return rtrn;
-}
-
-/***====================================================================***/
-
-XkbPropertyPtr
-XkbAddGeomProperty(XkbGeometryPtr geom,char *name,char *value)
-{
-register int i;
-register XkbPropertyPtr prop;
-
-    if ((!geom)||(!name)||(!value))
-	return NULL;
-    for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
-	if ((prop->name)&&(strcmp(name,prop->name)==0)) {
-	    if (prop->value)
-		_XkbFree(prop->value);
-	    prop->value= (char *)_XkbAlloc(strlen(value)+1);
-	    if (prop->value)
-		strcpy(prop->value,value);
-	    return prop;
-	}
-    }
-    if ((geom->num_properties>=geom->sz_properties)&&
-					(_XkbAllocProps(geom,1)!=Success)) {
-	return NULL;
-    }
-    prop= &geom->properties[geom->num_properties];
-    prop->name= (char *)_XkbAlloc(strlen(name)+1);
-    if (!prop->name)
-	return NULL;
-    strcpy(prop->name,name);
-    prop->value= (char *)_XkbAlloc(strlen(value)+1);
-    if (!prop->value) {
-	_XkbFree(prop->name);
-	prop->name= NULL;
-	return NULL;
-    }
-    strcpy(prop->value,value);
-    geom->num_properties++;
-    return prop;
-}
-
-XkbKeyAliasPtr
-XkbAddGeomKeyAlias(XkbGeometryPtr geom,char *aliasStr,char *realStr)
-{
-register int i;
-register XkbKeyAliasPtr alias;
-
-    if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0]))
-	return NULL;
-    for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
-	if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
-	    bzero(alias->real,XkbKeyNameLength);
-	    strncpy(alias->real,realStr,XkbKeyNameLength);
-	    return alias;
-	}
-    }
-    if ((geom->num_key_aliases>=geom->sz_key_aliases)&&
-				(_XkbAllocKeyAliases(geom,1)!=Success)) {
-	return NULL;
-    }
-    alias= &geom->key_aliases[geom->num_key_aliases];
-    bzero(alias,sizeof(XkbKeyAliasRec));
-    strncpy(alias->alias,aliasStr,XkbKeyNameLength);
-    strncpy(alias->real,realStr,XkbKeyNameLength);
-    geom->num_key_aliases++;
-    return alias;
-}
-
-XkbColorPtr
-XkbAddGeomColor(XkbGeometryPtr geom,char *spec,unsigned int pixel)
-{
-register int i;
-register XkbColorPtr color;
-
-    if ((!geom)||(!spec))
-	return NULL;
-    for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
-	if ((color->spec)&&(strcmp(color->spec,spec)==0)) {
-	    color->pixel= pixel;
-	    return color;
-	}
-    }
-    if ((geom->num_colors>=geom->sz_colors)&&
-					(_XkbAllocColors(geom,1)!=Success)) {
-	return NULL;
-    }
-    color= &geom->colors[geom->num_colors];
-    color->pixel= pixel;
-    color->spec= (char *)_XkbAlloc(strlen(spec)+1);
-    if (!color->spec)
-	return NULL;
-    strcpy(color->spec,spec);
-    geom->num_colors++;
-    return color;
-}
-
-XkbOutlinePtr
-XkbAddGeomOutline(XkbShapePtr shape,int sz_points)
-{
-XkbOutlinePtr	outline;
-
-    if ((!shape)||(sz_points<0))
-	return NULL;
-    if ((shape->num_outlines>=shape->sz_outlines)&&
-					(_XkbAllocOutlines(shape,1)!=Success)) {
-	return NULL;
-    }
-    outline= &shape->outlines[shape->num_outlines];
-    bzero(outline,sizeof(XkbOutlineRec));
-    if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success))
-	return NULL;
-    shape->num_outlines++;
-    return outline;
-}
-
-XkbShapePtr
-XkbAddGeomShape(XkbGeometryPtr geom,Atom name,int sz_outlines)
-{
-XkbShapePtr	shape;
-register int	i;
-
-    if ((!geom)||(!name)||(sz_outlines<0))
-	return NULL;
-    if (geom->num_shapes>0) {
-	for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
-	    if (name==shape->name)
-		return shape;
-	}
-    }
-    if ((geom->num_shapes>=geom->sz_shapes)&&
-					(_XkbAllocShapes(geom,1)!=Success))
-	return NULL;
-    shape= &geom->shapes[geom->num_shapes];
-    bzero(shape,sizeof(XkbShapeRec));
-    if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success))
-	return NULL;
-    shape->name= name;
-    shape->primary= shape->approx= NULL;
-    geom->num_shapes++;
-    return shape;
-}
-
-XkbKeyPtr
-XkbAddGeomKey(XkbRowPtr row)
-{
-XkbKeyPtr	key;
-    if (!row)
-	return NULL;
-    if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success))
-	return NULL;
-    key= &row->keys[row->num_keys++];
-    bzero(key,sizeof(XkbKeyRec));
-    return key;
-}
-
-XkbRowPtr
-XkbAddGeomRow(XkbSectionPtr section,int sz_keys)
-{
-XkbRowPtr	row;
-
-    if ((!section)||(sz_keys<0))
-	return NULL;
-    if ((section->num_rows>=section->sz_rows)&&
-    					(_XkbAllocRows(section,1)!=Success))
-	return NULL;
-    row= &section->rows[section->num_rows];
-    bzero(row,sizeof(XkbRowRec));
-    if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success))
-	return NULL;
-    section->num_rows++;
-    return row;
-}
-
-XkbSectionPtr
-XkbAddGeomSection(	XkbGeometryPtr	geom,
-			Atom		name,
-			int		sz_rows,
-			int		sz_doodads,
-			int		sz_over)
-{
-register int	i;
-XkbSectionPtr	section;
-
-    if ((!geom)||(name==None)||(sz_rows<0))
-	return NULL;
-    for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
-	if (section->name!=name)
-	    continue;
-	if (((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))||
-	    ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success))||
-	    ((sz_over>0)&&(_XkbAllocOverlays(section,sz_over)!=Success)))
-	    return NULL;
-	return section;
-    }
-    if ((geom->num_sections>=geom->sz_sections)&&
-					(_XkbAllocSections(geom,1)!=Success))
-	return NULL;
-    section= &geom->sections[geom->num_sections];
-    if ((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))
-	return NULL;
-    if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
-	if (section->rows) {
-	    _XkbFree(section->rows);
-	    section->rows= NULL;
-	    section->sz_rows= section->num_rows= 0;
-	}
-	return NULL;
-    }
-    section->name= name;
-    geom->num_sections++;
-    return section;
-}
-
-XkbDoodadPtr
-XkbAddGeomDoodad(XkbGeometryPtr geom,XkbSectionPtr section,Atom name)
-{
-XkbDoodadPtr	old,doodad;
-register int	i,nDoodads;
-
-    if ((!geom)||(name==None))
-	return NULL;
-    if ((section!=NULL)&&(section->num_doodads>0)) {
-	old= section->doodads;
-	nDoodads= section->num_doodads;
-    }
-    else {
-	old= geom->doodads;
-	nDoodads= geom->num_doodads;
-    }
-    for (i=0,doodad=old;i<nDoodads;i++,doodad++) {
-	if (doodad->any.name==name)
-	    return doodad;
-    }
-    if (section) {
-	if ((section->num_doodads>=geom->sz_doodads)&&
-	    (_XkbAllocDoodads(section,1)!=Success)) {
-	    return NULL;
-	}
-	doodad= &section->doodads[section->num_doodads++];
-    }
-    else {
-	if ((geom->num_doodads>=geom->sz_doodads)&&
-					(_XkbAllocDoodads(geom,1)!=Success))
-	    return NULL;
-	doodad= &geom->doodads[geom->num_doodads++];
-    }
-    bzero(doodad,sizeof(XkbDoodadRec));
-    doodad->any.name= name;
-    return doodad;
-}
-
-XkbOverlayKeyPtr
-XkbAddGeomOverlayKey(	XkbOverlayPtr		overlay,
-			XkbOverlayRowPtr 	row,
-			char *			over,
-			char *			under)
-{
-register int	i;
-XkbOverlayKeyPtr key;
-XkbSectionPtr	section;
-XkbRowPtr	row_under;
-Bool		found;
-
-    if ((!overlay)||(!row)||(!over)||(!under))
-	return NULL;
-    section= overlay->section_under;
-    if (row->row_under>=section->num_rows)
-	return NULL;
-    row_under= &section->rows[row->row_under];
-    for (i=0,found=False;i<row_under->num_keys;i++) {
-	if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) {
-	    found= True;
-	    break;
-	}
-    }
-    if (!found)
-   	return NULL;
-    if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
-	return NULL;
-    key= &row->keys[row->num_keys];
-    strncpy(key->under.name,under,XkbKeyNameLength);
-    strncpy(key->over.name,over,XkbKeyNameLength);
-    row->num_keys++;
-    return key;
-}
-
-XkbOverlayRowPtr
-XkbAddGeomOverlayRow(XkbOverlayPtr overlay,int row_under,int sz_keys)
-{
-register int		i;
-XkbOverlayRowPtr	row;
-
-    if ((!overlay)||(sz_keys<0))
-	return NULL;
-    if (row_under>=overlay->section_under->num_rows)
-	return NULL;
-    for (i=0;i<overlay->num_rows;i++) {
-	if (overlay->rows[i].row_under==row_under) {
-	    row= &overlay->rows[i];
-	    if ((row->sz_keys<sz_keys)&&
-				(_XkbAllocOverlayKeys(row,sz_keys)!=Success)) {
-		return NULL;
-	    }
-	    return &overlay->rows[i];
-	}
-    }
-    if ((overlay->num_rows>=overlay->sz_rows)&&
-				(_XkbAllocOverlayRows(overlay,1)!=Success))
-	return NULL;
-    row= &overlay->rows[overlay->num_rows];
-    bzero(row,sizeof(XkbOverlayRowRec));
-    if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success))
-	return NULL;
-    row->row_under= row_under;
-    overlay->num_rows++;
-    return row;
-}
-
-XkbOverlayPtr
-XkbAddGeomOverlay(XkbSectionPtr section,Atom name,int sz_rows)
-{
-register int	i;
-XkbOverlayPtr	overlay;
-
-    if ((!section)||(name==None)||(sz_rows==0))
-	return NULL;
-
-    for (i=0,overlay=section->overlays;i<section->num_overlays;i++,overlay++) {
-	if (overlay->name==name) {
-	    if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
-		return NULL;
-	    return overlay;
-	}
-    }
-    if ((section->num_overlays>=section->sz_overlays)&&
-				(_XkbAllocOverlays(section,1)!=Success))
-	return NULL;
-    overlay= &section->overlays[section->num_overlays];
-    if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
-	return NULL;
-    overlay->name= name;
-    overlay->section_under= section;
-    section->num_overlays++;
-    return overlay;
-}
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#elif defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
+#ifndef XKB_IN_SERVER
+
+#include <stdio.h>
+#include "Xlibint.h"
+#include "XKBlibint.h"
+#include <X11/extensions/XKBgeom.h>
+#include <X11/extensions/XKBproto.h>
+
+#else
+
+#include <stdio.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "inputstr.h"
+#include <X11/extensions/XKBsrv.h>
+#include <X11/extensions/XKBgeom.h>
+
+#endif /* XKB_IN_SERVER */
+
+#ifdef X_NOT_POSIX
+#define Size_t unsigned int
+#else
+#define Size_t size_t
+#endif
+
+/***====================================================================***/
+
+static void
+_XkbFreeGeomLeafElems(	Bool			freeAll,
+			int			first,
+			int 			count,
+			unsigned short *	num_inout,
+			unsigned short *	sz_inout,
+			char **			elems,
+			unsigned int		elem_sz)
+{
+    if ((freeAll)||(*elems==NULL)) {
+	*num_inout= *sz_inout= 0;
+	if (*elems!=NULL) {
+	    _XkbFree(*elems);
+	    *elems= NULL;
+	}
+	return;
+    }
+
+    if ((first>=(*num_inout))||(first<0)||(count<1))
+	return;
+
+    if (first+count>=(*num_inout)) {
+	/* truncating the array is easy */
+	(*num_inout)= first;
+    }
+    else {
+	char *	ptr;
+	int 	extra;
+	ptr= *elems;
+	extra= ((*num_inout)-(first+count))*elem_sz;
+	if (extra>0)
+	    memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],extra);
+	(*num_inout)-= count;
+    }
+    return;
+}
+
+typedef void (*ContentsClearFunc)(
+		char *		/* priv */
+);
+
+static void
+_XkbFreeGeomNonLeafElems(	Bool			freeAll,
+				int			first,
+				int 			count,
+				unsigned short *	num_inout,
+				unsigned short *	sz_inout,
+				char **			elems,
+				unsigned int		elem_sz,
+				ContentsClearFunc	freeFunc)
+{
+register int i;
+register char *ptr;
+
+    if (freeAll) {
+	first= 0;
+	count= (*num_inout);
+    }
+    else if ((first>=(*num_inout))||(first<0)||(count<1))
+	return;
+    else if (first+count>(*num_inout))
+	count= (*num_inout)-first;
+    if (*elems==NULL)
+	return;
+
+    if (freeFunc) {
+	ptr= *elems;
+	ptr+= first*elem_sz;
+	for (i=0;i<count;i++) {
+	    (*freeFunc)(ptr);
+	    ptr+= elem_sz;
+	}
+    }
+    if (freeAll) {
+	(*num_inout)= (*sz_inout)= 0;
+	if (*elems) {
+	    _XkbFree(*elems);
+	    *elems= NULL;
+	}
+    }
+    else if (first+count>=(*num_inout))
+	*num_inout= first;
+    else {
+	i= ((*num_inout)-(first+count))*elem_sz;
+	ptr= *elems;
+	memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],i);
+	(*num_inout)-= count;
+    }
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearProperty(char *prop_in)
+{
+XkbPropertyPtr	prop= (XkbPropertyPtr)prop_in;
+
+    if (prop->name) {
+	_XkbFree(prop->name);
+	prop->name= NULL;
+    }
+    if (prop->value) {
+	_XkbFree(prop->value);
+	prop->value= NULL;
+    }
+    return;
+}
+
+void
+XkbFreeGeomProperties(	XkbGeometryPtr	geom,
+			int		first,
+			int		count,
+			Bool		freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&geom->num_properties,&geom->sz_properties,
+				(char **)&geom->properties,
+				sizeof(XkbPropertyRec),_XkbClearProperty);
+    return;
+}
+
+/***====================================================================***/
+
+void
+XkbFreeGeomKeyAliases(	XkbGeometryPtr	geom,
+			int		first,
+			int		count,
+			Bool		freeAll)
+{
+    _XkbFreeGeomLeafElems(freeAll,first,count,
+				&geom->num_key_aliases,&geom->sz_key_aliases,
+				(char **)&geom->key_aliases,
+				sizeof(XkbKeyAliasRec));
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearColor(char *color_in)
+{
+XkbColorPtr	color= (XkbColorPtr)color_in;
+
+    if (color->spec)
+	_XkbFree(color->spec);
+    return;
+}
+
+void
+XkbFreeGeomColors(XkbGeometryPtr geom,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&geom->num_colors,&geom->sz_colors,
+				(char **)&geom->colors,
+				sizeof(XkbColorRec),_XkbClearColor);
+    return;
+}
+
+/***====================================================================***/
+
+void
+XkbFreeGeomPoints(XkbOutlinePtr outline,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomLeafElems(freeAll,first,count,
+				&outline->num_points,&outline->sz_points,
+				(char **)&outline->points,
+				sizeof(XkbPointRec));
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearOutline(char *outline_in)
+{
+XkbOutlinePtr	outline= (XkbOutlinePtr)outline_in;
+
+    if (outline->points!=NULL)
+	XkbFreeGeomPoints(outline,0,outline->num_points,True);
+    return;
+}
+
+void
+XkbFreeGeomOutlines(XkbShapePtr	shape,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&shape->num_outlines,&shape->sz_outlines,
+				(char **)&shape->outlines,
+				sizeof(XkbOutlineRec),_XkbClearOutline);
+
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearShape(char *shape_in)
+{
+XkbShapePtr	shape= (XkbShapePtr)shape_in;
+
+    if (shape->outlines)
+	XkbFreeGeomOutlines(shape,0,shape->num_outlines,True);
+    return;
+}
+
+void
+XkbFreeGeomShapes(XkbGeometryPtr geom,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&geom->num_shapes,&geom->sz_shapes,
+				(char **)&geom->shapes,
+				sizeof(XkbShapeRec),_XkbClearShape);
+    return;
+}
+
+/***====================================================================***/
+
+void
+XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomLeafElems(freeAll,first,count,
+				&row->num_keys,&row->sz_keys,
+				(char **)&row->keys,
+				sizeof(XkbOverlayKeyRec));
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearOverlayRow(char *row_in)
+{
+XkbOverlayRowPtr	row= (XkbOverlayRowPtr)row_in;
+
+    if (row->keys!=NULL)
+	XkbFreeGeomOverlayKeys(row,0,row->num_keys,True);
+    return;
+}
+
+void
+XkbFreeGeomOverlayRows(XkbOverlayPtr overlay,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&overlay->num_rows,&overlay->sz_rows,
+				(char **)&overlay->rows,
+				sizeof(XkbOverlayRowRec),_XkbClearOverlayRow);
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearOverlay(char *overlay_in)
+{
+XkbOverlayPtr	overlay= (XkbOverlayPtr)overlay_in;
+
+    if (overlay->rows!=NULL)
+	XkbFreeGeomOverlayRows(overlay,0,overlay->num_rows,True);
+    return;
+}
+
+void
+XkbFreeGeomOverlays(XkbSectionPtr section,int first,int	count,Bool freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&section->num_overlays,&section->sz_overlays,
+				(char **)&section->overlays,
+				sizeof(XkbOverlayRec),_XkbClearOverlay);
+    return;
+}
+
+/***====================================================================***/
+
+void
+XkbFreeGeomKeys(XkbRowPtr row,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomLeafElems(freeAll,first,count,
+				&row->num_keys,&row->sz_keys,
+				(char **)&row->keys,
+				sizeof(XkbKeyRec));
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearRow(char *row_in)
+{
+XkbRowPtr	row= (XkbRowPtr)row_in;
+
+    if (row->keys!=NULL)
+	XkbFreeGeomKeys(row,0,row->num_keys,True);
+    return;
+}
+
+void
+XkbFreeGeomRows(XkbSectionPtr section,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&section->num_rows,&section->sz_rows,
+				(char **)&section->rows,
+				sizeof(XkbRowRec),_XkbClearRow);
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearSection(char *section_in)
+{
+XkbSectionPtr	section= (XkbSectionPtr)section_in;
+
+    if (section->rows!=NULL)
+	XkbFreeGeomRows(section,0,section->num_rows,True);
+    if (section->doodads!=NULL) {
+	XkbFreeGeomDoodads(section->doodads,section->num_doodads,True);
+	section->doodads= NULL;
+    }
+    return;
+}
+
+void
+XkbFreeGeomSections(XkbGeometryPtr geom,int first,int count,Bool freeAll)
+{
+    _XkbFreeGeomNonLeafElems(freeAll,first,count,
+				&geom->num_sections,&geom->sz_sections,
+				(char **)&geom->sections,
+				sizeof(XkbSectionRec),_XkbClearSection);
+    return;
+}
+
+/***====================================================================***/
+
+static void
+_XkbClearDoodad(char *doodad_in)
+{
+XkbDoodadPtr	doodad= (XkbDoodadPtr)doodad_in;
+
+    switch (doodad->any.type) {
+   	case XkbTextDoodad:
+	    {
+		if (doodad->text.text!=NULL) {
+		    _XkbFree(doodad->text.text);
+		    doodad->text.text= NULL;
+		}
+		if (doodad->text.font!=NULL) {
+		    _XkbFree(doodad->text.font);
+		    doodad->text.font= NULL;
+		}
+	    }
+	    break;
+   	case XkbLogoDoodad:
+	    {
+		if (doodad->logo.logo_name!=NULL) {
+		    _XkbFree(doodad->logo.logo_name);
+		    doodad->logo.logo_name= NULL;
+		}
+	    }
+	    break;
+    }
+    return;
+}
+
+void
+XkbFreeGeomDoodads(XkbDoodadPtr doodads,int nDoodads,Bool freeAll)
+{
+register int 		i;
+register XkbDoodadPtr	doodad;
+
+    if (doodads) {
+	for (i=0,doodad= doodads;i<nDoodads;i++,doodad++) {
+	    _XkbClearDoodad((char *)doodad);
+	}
+	if (freeAll)
+	    _XkbFree(doodads);
+    }
+    return;
+}
+
+void
+XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
+{
+    if (geom==NULL)
+	return;
+    if (freeMap)
+	which= XkbGeomAllMask;
+    if ((which&XkbGeomPropertiesMask)&&(geom->properties!=NULL))
+	XkbFreeGeomProperties(geom,0,geom->num_properties,True);
+    if ((which&XkbGeomColorsMask)&&(geom->colors!=NULL))
+	XkbFreeGeomColors(geom,0,geom->num_colors,True);
+    if ((which&XkbGeomShapesMask)&&(geom->shapes!=NULL))
+	XkbFreeGeomShapes(geom,0,geom->num_shapes,True);
+    if ((which&XkbGeomSectionsMask)&&(geom->sections!=NULL))
+	XkbFreeGeomSections(geom,0,geom->num_sections,True);
+    if ((which&XkbGeomDoodadsMask)&&(geom->doodads!= NULL)) {
+	XkbFreeGeomDoodads(geom->doodads,geom->num_doodads,True);
+	geom->doodads= NULL;
+	geom->num_doodads= geom->sz_doodads= 0;
+    }
+    if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
+	XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,True);
+    if (freeMap) {
+	if (geom->label_font!=NULL) {
+	    _XkbFree(geom->label_font);
+	    geom->label_font= NULL;
+	}
+	_XkbFree(geom);
+    }
+    return;
+}
+
+/***====================================================================***/
+
+static Status
+_XkbGeomAlloc(	XPointer *		old,
+		unsigned short *	num,
+		unsigned short *	total,
+		int			num_new,
+		Size_t			sz_elem)
+{
+    if (num_new<1)
+	return Success;
+    if ((*old)==NULL)
+	*num= *total= 0;
+
+    if ((*num)+num_new<=(*total))
+	return Success;
+
+    *total= (*num)+num_new;
+    if ((*old)!=NULL)
+	 (*old)= (XPointer)_XkbRealloc((*old),(*total)*sz_elem);
+    else (*old)= (XPointer)_XkbCalloc((*total),sz_elem);
+    if ((*old)==NULL) {
+	*total= *num= 0;
+	return BadAlloc;
+    }
+
+    if (*num>0) {
+	char *tmp= (char *)(*old);
+	bzero(&tmp[sz_elem*(*num)],(num_new*sz_elem));
+    }
+    return Success;
+}
+
+#define	_XkbAllocProps(g,n) _XkbGeomAlloc((XPointer *)&(g)->properties,\
+				&(g)->num_properties,&(g)->sz_properties,\
+				(n),sizeof(XkbPropertyRec))
+#define	_XkbAllocColors(g,n) _XkbGeomAlloc((XPointer *)&(g)->colors,\
+				&(g)->num_colors,&(g)->sz_colors,\
+				(n),sizeof(XkbColorRec))
+#define	_XkbAllocShapes(g,n) _XkbGeomAlloc((XPointer *)&(g)->shapes,\
+				&(g)->num_shapes,&(g)->sz_shapes,\
+				(n),sizeof(XkbShapeRec))
+#define	_XkbAllocSections(g,n) _XkbGeomAlloc((XPointer *)&(g)->sections,\
+				&(g)->num_sections,&(g)->sz_sections,\
+				(n),sizeof(XkbSectionRec))
+#define	_XkbAllocDoodads(g,n) _XkbGeomAlloc((XPointer *)&(g)->doodads,\
+				&(g)->num_doodads,&(g)->sz_doodads,\
+				(n),sizeof(XkbDoodadRec))
+#define	_XkbAllocKeyAliases(g,n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases,\
+				&(g)->num_key_aliases,&(g)->sz_key_aliases,\
+				(n),sizeof(XkbKeyAliasRec))
+
+#define	_XkbAllocOutlines(s,n) _XkbGeomAlloc((XPointer *)&(s)->outlines,\
+				&(s)->num_outlines,&(s)->sz_outlines,\
+				(n),sizeof(XkbOutlineRec))
+#define	_XkbAllocRows(s,n) _XkbGeomAlloc((XPointer *)&(s)->rows,\
+				&(s)->num_rows,&(s)->sz_rows,\
+				(n),sizeof(XkbRowRec))
+#define	_XkbAllocPoints(o,n) _XkbGeomAlloc((XPointer *)&(o)->points,\
+				&(o)->num_points,&(o)->sz_points,\
+				(n),sizeof(XkbPointRec))
+#define	_XkbAllocKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
+				&(r)->num_keys,&(r)->sz_keys,\
+				(n),sizeof(XkbKeyRec))
+#define	_XkbAllocOverlays(s,n) _XkbGeomAlloc((XPointer *)&(s)->overlays,\
+				&(s)->num_overlays,&(s)->sz_overlays,\
+				(n),sizeof(XkbOverlayRec))
+#define	_XkbAllocOverlayRows(o,n) _XkbGeomAlloc((XPointer *)&(o)->rows,\
+				&(o)->num_rows,&(o)->sz_rows,\
+				(n),sizeof(XkbOverlayRowRec))
+#define	_XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\
+				&(r)->num_keys,&(r)->sz_keys,\
+				(n),sizeof(XkbOverlayKeyRec))
+
+Status
+XkbAllocGeomProps(XkbGeometryPtr geom,int nProps)
+{
+    return _XkbAllocProps(geom,nProps);
+}
+
+Status
+XkbAllocGeomColors(XkbGeometryPtr geom,int nColors)
+{
+    return _XkbAllocColors(geom,nColors);
+}
+
+Status
+XkbAllocGeomKeyAliases(XkbGeometryPtr geom,int nKeyAliases)
+{
+    return _XkbAllocKeyAliases(geom,nKeyAliases);
+}
+
+Status
+XkbAllocGeomShapes(XkbGeometryPtr geom,int nShapes)
+{
+    return _XkbAllocShapes(geom,nShapes);
+}
+
+Status
+XkbAllocGeomSections(XkbGeometryPtr geom,int nSections)
+{
+    return _XkbAllocSections(geom,nSections);
+}
+
+Status
+XkbAllocGeomOverlays(XkbSectionPtr section,int nOverlays)
+{
+    return _XkbAllocOverlays(section,nOverlays);
+}
+
+Status
+XkbAllocGeomOverlayRows(XkbOverlayPtr overlay,int nRows)
+{
+    return _XkbAllocOverlayRows(overlay,nRows);
+}
+
+Status
+XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row,int nKeys)
+{
+    return _XkbAllocOverlayKeys(row,nKeys);
+}
+
+Status
+XkbAllocGeomDoodads(XkbGeometryPtr geom,int nDoodads)
+{
+    return _XkbAllocDoodads(geom,nDoodads);
+}
+
+Status
+XkbAllocGeomSectionDoodads(XkbSectionPtr section,int nDoodads)
+{
+    return _XkbAllocDoodads(section,nDoodads);
+}
+
+Status
+XkbAllocGeomOutlines(XkbShapePtr shape,int nOL)
+{
+    return _XkbAllocOutlines(shape,nOL);
+}
+
+Status
+XkbAllocGeomRows(XkbSectionPtr section,int nRows)
+{
+    return _XkbAllocRows(section,nRows);
+}
+
+Status
+XkbAllocGeomPoints(XkbOutlinePtr ol,int nPts)
+{
+    return _XkbAllocPoints(ol,nPts);
+}
+
+Status
+XkbAllocGeomKeys(XkbRowPtr row,int nKeys)
+{
+    return _XkbAllocKeys(row,nKeys);
+}
+
+Status
+XkbAllocGeometry(XkbDescPtr xkb,XkbGeometrySizesPtr sizes)
+{
+XkbGeometryPtr	geom;
+Status		rtrn;
+
+    if (xkb->geom==NULL) {
+	xkb->geom= _XkbTypedCalloc(1,XkbGeometryRec);
+	if (!xkb->geom)
+	    return BadAlloc;
+    }
+    geom= xkb->geom;
+    if ((sizes->which&XkbGeomPropertiesMask)&&
+	((rtrn=_XkbAllocProps(geom,sizes->num_properties))!=Success)) {
+	goto BAIL;
+    }
+    if ((sizes->which&XkbGeomColorsMask)&&
+	((rtrn=_XkbAllocColors(geom,sizes->num_colors))!=Success)) {
+	goto BAIL;
+    }
+    if ((sizes->which&XkbGeomShapesMask)&&
+	((rtrn=_XkbAllocShapes(geom,sizes->num_shapes))!=Success)) {
+	goto BAIL;
+    }
+    if ((sizes->which&XkbGeomSectionsMask)&&
+	((rtrn=_XkbAllocSections(geom,sizes->num_sections))!=Success)) {
+	goto BAIL;
+    }
+    if ((sizes->which&XkbGeomDoodadsMask)&&
+	((rtrn=_XkbAllocDoodads(geom,sizes->num_doodads))!=Success)) {
+	goto BAIL;
+    }
+    if ((sizes->which&XkbGeomKeyAliasesMask)&&
+	((rtrn=_XkbAllocKeyAliases(geom,sizes->num_key_aliases))!=Success)) {
+	goto BAIL;
+    }
+    return Success;
+BAIL:
+    XkbFreeGeometry(geom,XkbGeomAllMask,True);
+    xkb->geom= NULL;
+    return rtrn;
+}
+
+/***====================================================================***/
+
+XkbPropertyPtr
+XkbAddGeomProperty(XkbGeometryPtr geom,char *name,char *value)
+{
+register int i;
+register XkbPropertyPtr prop;
+
+    if ((!geom)||(!name)||(!value))
+	return NULL;
+    for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
+	if ((prop->name)&&(strcmp(name,prop->name)==0)) {
+	    if (prop->value)
+		_XkbFree(prop->value);
+	    prop->value= strdup(value);
+	    return prop;
+	}
+    }
+    if ((geom->num_properties>=geom->sz_properties)&&
+					(_XkbAllocProps(geom,1)!=Success)) {
+	return NULL;
+    }
+    prop= &geom->properties[geom->num_properties];
+    prop->name= strdup(name);
+    if (!prop->name)
+	return NULL;
+    prop->value= strdup(value);
+    if (!prop->value) {
+	_XkbFree(prop->name);
+	prop->name= NULL;
+	return NULL;
+    }
+    geom->num_properties++;
+    return prop;
+}
+
+XkbKeyAliasPtr
+XkbAddGeomKeyAlias(XkbGeometryPtr geom,char *aliasStr,char *realStr)
+{
+register int i;
+register XkbKeyAliasPtr alias;
+
+    if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0]))
+	return NULL;
+    for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
+	if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
+	    bzero(alias->real,XkbKeyNameLength);
+	    strncpy(alias->real,realStr,XkbKeyNameLength);
+	    return alias;
+	}
+    }
+    if ((geom->num_key_aliases>=geom->sz_key_aliases)&&
+				(_XkbAllocKeyAliases(geom,1)!=Success)) {
+	return NULL;
+    }
+    alias= &geom->key_aliases[geom->num_key_aliases];
+    bzero(alias,sizeof(XkbKeyAliasRec));
+    strncpy(alias->alias,aliasStr,XkbKeyNameLength);
+    strncpy(alias->real,realStr,XkbKeyNameLength);
+    geom->num_key_aliases++;
+    return alias;
+}
+
+XkbColorPtr
+XkbAddGeomColor(XkbGeometryPtr geom,char *spec,unsigned int pixel)
+{
+register int i;
+register XkbColorPtr color;
+
+    if ((!geom)||(!spec))
+	return NULL;
+    for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
+	if ((color->spec)&&(strcmp(color->spec,spec)==0)) {
+	    color->pixel= pixel;
+	    return color;
+	}
+    }
+    if ((geom->num_colors>=geom->sz_colors)&&
+					(_XkbAllocColors(geom,1)!=Success)) {
+	return NULL;
+    }
+    color= &geom->colors[geom->num_colors];
+    color->pixel= pixel;
+    color->spec= strdup(spec);
+    if (!color->spec)
+	return NULL;
+    geom->num_colors++;
+    return color;
+}
+
+XkbOutlinePtr
+XkbAddGeomOutline(XkbShapePtr shape,int sz_points)
+{
+XkbOutlinePtr	outline;
+
+    if ((!shape)||(sz_points<0))
+	return NULL;
+    if ((shape->num_outlines>=shape->sz_outlines)&&
+					(_XkbAllocOutlines(shape,1)!=Success)) {
+	return NULL;
+    }
+    outline= &shape->outlines[shape->num_outlines];
+    bzero(outline,sizeof(XkbOutlineRec));
+    if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success))
+	return NULL;
+    shape->num_outlines++;
+    return outline;
+}
+
+XkbShapePtr
+XkbAddGeomShape(XkbGeometryPtr geom,Atom name,int sz_outlines)
+{
+XkbShapePtr	shape;
+register int	i;
+
+    if ((!geom)||(!name)||(sz_outlines<0))
+	return NULL;
+    if (geom->num_shapes>0) {
+	for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
+	    if (name==shape->name)
+		return shape;
+	}
+    }
+    if ((geom->num_shapes>=geom->sz_shapes)&&
+					(_XkbAllocShapes(geom,1)!=Success))
+	return NULL;
+    shape= &geom->shapes[geom->num_shapes];
+    bzero(shape,sizeof(XkbShapeRec));
+    if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success))
+	return NULL;
+    shape->name= name;
+    shape->primary= shape->approx= NULL;
+    geom->num_shapes++;
+    return shape;
+}
+
+XkbKeyPtr
+XkbAddGeomKey(XkbRowPtr row)
+{
+XkbKeyPtr	key;
+    if (!row)
+	return NULL;
+    if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success))
+	return NULL;
+    key= &row->keys[row->num_keys++];
+    bzero(key,sizeof(XkbKeyRec));
+    return key;
+}
+
+XkbRowPtr
+XkbAddGeomRow(XkbSectionPtr section,int sz_keys)
+{
+XkbRowPtr	row;
+
+    if ((!section)||(sz_keys<0))
+	return NULL;
+    if ((section->num_rows>=section->sz_rows)&&
+    					(_XkbAllocRows(section,1)!=Success))
+	return NULL;
+    row= &section->rows[section->num_rows];
+    bzero(row,sizeof(XkbRowRec));
+    if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success))
+	return NULL;
+    section->num_rows++;
+    return row;
+}
+
+XkbSectionPtr
+XkbAddGeomSection(	XkbGeometryPtr	geom,
+			Atom		name,
+			int		sz_rows,
+			int		sz_doodads,
+			int		sz_over)
+{
+register int	i;
+XkbSectionPtr	section;
+
+    if ((!geom)||(name==None)||(sz_rows<0))
+	return NULL;
+    for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
+	if (section->name!=name)
+	    continue;
+	if (((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))||
+	    ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success))||
+	    ((sz_over>0)&&(_XkbAllocOverlays(section,sz_over)!=Success)))
+	    return NULL;
+	return section;
+    }
+    if ((geom->num_sections>=geom->sz_sections)&&
+					(_XkbAllocSections(geom,1)!=Success))
+	return NULL;
+    section= &geom->sections[geom->num_sections];
+    if ((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))
+	return NULL;
+    if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
+	if (section->rows) {
+	    _XkbFree(section->rows);
+	    section->rows= NULL;
+	    section->sz_rows= section->num_rows= 0;
+	}
+	return NULL;
+    }
+    section->name= name;
+    geom->num_sections++;
+    return section;
+}
+
+XkbDoodadPtr
+XkbAddGeomDoodad(XkbGeometryPtr geom,XkbSectionPtr section,Atom name)
+{
+XkbDoodadPtr	old,doodad;
+register int	i,nDoodads;
+
+    if ((!geom)||(name==None))
+	return NULL;
+    if ((section!=NULL)&&(section->num_doodads>0)) {
+	old= section->doodads;
+	nDoodads= section->num_doodads;
+    }
+    else {
+	old= geom->doodads;
+	nDoodads= geom->num_doodads;
+    }
+    for (i=0,doodad=old;i<nDoodads;i++,doodad++) {
+	if (doodad->any.name==name)
+	    return doodad;
+    }
+    if (section) {
+	if ((section->num_doodads>=geom->sz_doodads)&&
+	    (_XkbAllocDoodads(section,1)!=Success)) {
+	    return NULL;
+	}
+	doodad= &section->doodads[section->num_doodads++];
+    }
+    else {
+	if ((geom->num_doodads>=geom->sz_doodads)&&
+					(_XkbAllocDoodads(geom,1)!=Success))
+	    return NULL;
+	doodad= &geom->doodads[geom->num_doodads++];
+    }
+    bzero(doodad,sizeof(XkbDoodadRec));
+    doodad->any.name= name;
+    return doodad;
+}
+
+XkbOverlayKeyPtr
+XkbAddGeomOverlayKey(	XkbOverlayPtr		overlay,
+			XkbOverlayRowPtr 	row,
+			char *			over,
+			char *			under)
+{
+register int	i;
+XkbOverlayKeyPtr key;
+XkbSectionPtr	section;
+XkbRowPtr	row_under;
+Bool		found;
+
+    if ((!overlay)||(!row)||(!over)||(!under))
+	return NULL;
+    section= overlay->section_under;
+    if (row->row_under>=section->num_rows)
+	return NULL;
+    row_under= &section->rows[row->row_under];
+    for (i=0,found=False;i<row_under->num_keys;i++) {
+	if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) {
+	    found= True;
+	    break;
+	}
+    }
+    if (!found)
+   	return NULL;
+    if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
+	return NULL;
+    key= &row->keys[row->num_keys];
+    strncpy(key->under.name,under,XkbKeyNameLength);
+    strncpy(key->over.name,over,XkbKeyNameLength);
+    row->num_keys++;
+    return key;
+}
+
+XkbOverlayRowPtr
+XkbAddGeomOverlayRow(XkbOverlayPtr overlay,int row_under,int sz_keys)
+{
+register int		i;
+XkbOverlayRowPtr	row;
+
+    if ((!overlay)||(sz_keys<0))
+	return NULL;
+    if (row_under>=overlay->section_under->num_rows)
+	return NULL;
+    for (i=0;i<overlay->num_rows;i++) {
+	if (overlay->rows[i].row_under==row_under) {
+	    row= &overlay->rows[i];
+	    if ((row->sz_keys<sz_keys)&&
+				(_XkbAllocOverlayKeys(row,sz_keys)!=Success)) {
+		return NULL;
+	    }
+	    return &overlay->rows[i];
+	}
+    }
+    if ((overlay->num_rows>=overlay->sz_rows)&&
+				(_XkbAllocOverlayRows(overlay,1)!=Success))
+	return NULL;
+    row= &overlay->rows[overlay->num_rows];
+    bzero(row,sizeof(XkbOverlayRowRec));
+    if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success))
+	return NULL;
+    row->row_under= row_under;
+    overlay->num_rows++;
+    return row;
+}
+
+XkbOverlayPtr
+XkbAddGeomOverlay(XkbSectionPtr section,Atom name,int sz_rows)
+{
+register int	i;
+XkbOverlayPtr	overlay;
+
+    if ((!section)||(name==None)||(sz_rows==0))
+	return NULL;
+
+    for (i=0,overlay=section->overlays;i<section->num_overlays;i++,overlay++) {
+	if (overlay->name==name) {
+	    if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
+		return NULL;
+	    return overlay;
+	}
+    }
+    if ((section->num_overlays>=section->sz_overlays)&&
+				(_XkbAllocOverlays(section,1)!=Success))
+	return NULL;
+    overlay= &section->overlays[section->num_overlays];
+    if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
+	return NULL;
+    overlay->name= name;
+    overlay->section_under= section;
+    section->num_overlays++;
+    return overlay;
+}
diff --git a/libX11/src/xlibi18n/XDefaultIMIF.c b/libX11/src/xlibi18n/XDefaultIMIF.c
index c7a2fe9d3..e97d2f444 100644
--- a/libX11/src/xlibi18n/XDefaultIMIF.c
+++ b/libX11/src/xlibi18n/XDefaultIMIF.c
@@ -1,471 +1,469 @@
-/*
-Copyright 1985, 1986, 1987, 1991, 1998  The Open Group
-
-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 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
-OPEN GROUP 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
-EVEN IF ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
-
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-X Window System is a trademark of The Open Group
-
-OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
-logo, LBX, X Window System, and Xinerama are trademarks of the Open
-Group. All other trademarks and registered trademarks mentioned herein
-are the property of their respective owners. No right, title or
-interest in or to any trademark, service mark, logo or trade name of
-Sun Microsystems, Inc. or its licensors is granted.
-
-*/
-/*
- * Copyright 2000 Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include "Xlibint.h"
-#include "Xlcint.h"
-#include "XlcGeneric.h"
-
-#ifndef MAXINT
-#define MAXINT          (~((unsigned int)1 << (8 * sizeof(int)) - 1))
-#endif /* !MAXINT */
-
-typedef struct _StaticXIM *StaticXIM;
-
-typedef struct _XIMStaticXIMRec {
-    /* for CT => MB,WC converter */
-    XlcConv		 ctom_conv;
-    XlcConv		 ctow_conv;
-} XIMStaticXIMRec;
-
-typedef enum {
-    CREATE_IC = 1,
-    SET_ICVAL = 2,
-    GET_ICVAL = 3
-} XICOp_t;
-
-typedef struct _StaticXIM {
-    XIMMethods		methods;
-    XIMCoreRec		core;
-    XIMStaticXIMRec	*private;
-} StaticXIMRec;
-
-static Status _CloseIM(
-	XIM
-);
-
-static char *_SetIMValues(
-	XIM, XIMArg *
-);
-
-static char *_GetIMValues(
-	XIM, XIMArg*
-);
-
-static XIC _CreateIC(
-	XIM, XIMArg*
-);
-
-static _Xconst XIMMethodsRec local_im_methods = {
-    _CloseIM,		/* close */
-    _SetIMValues,	/* set_values */
-    _GetIMValues, 	/* get_values */
-    _CreateIC,		/* create_ic */
-    NULL,		/* ctstombs */
-    NULL		/* ctstowcs */
-};
-
-static void _DestroyIC(
-		       XIC
-);
-static void _SetFocus(
-		      XIC
-);
-static void _UnsetFocus(
-			XIC
-);
-static char* _SetICValues(
-			 XIC, XIMArg *
-);
-static char* _GetICValues(
-			 XIC, XIMArg *
-);
-static char *_MbReset(
-		      XIC
-);
-static wchar_t *_WcReset(
-			 XIC
-);
-static int _MbLookupString(
-	XIC, XKeyEvent *, char *, int, KeySym *, Status *
-);
-static int _WcLookupString(
-	XIC, XKeyEvent *, wchar_t *, int, KeySym *, Status *
-);
-
-static _Xconst XICMethodsRec local_ic_methods = {
-    _DestroyIC, 	/* destroy */
-    _SetFocus,		/* set_focus */
-    _UnsetFocus,	/* unset_focus */
-    _SetICValues,	/* set_values */
-    _GetICValues,	/* get_values */
-    _MbReset,		/* mb_reset */
-    _WcReset,		/* wc_reset */
-    NULL,		/* utf8_reset */		/* ??? */
-    _MbLookupString,	/* mb_lookup_string */
-    _WcLookupString,	/* wc_lookup_string */
-    NULL		/* utf8_lookup_string */	/* ??? */
-};
-
-XIM
-_XDefaultOpenIM(
-    XLCd                lcd,
-    Display             *dpy,
-    XrmDatabase         rdb,
-    char                *res_name,
-    char                *res_class)
-{
-    StaticXIM im;
-    XIMStaticXIMRec *local_impart;
-    XlcConv ctom_conv, ctow_conv;
-    int i;
-    char *mod;
-    char buf[BUFSIZ];
-
-    if (!(ctom_conv = _XlcOpenConverter(lcd,
-			XlcNCompoundText, lcd, XlcNMultiByte))) {
-	return((XIM)NULL);
-    }
-
-    if (!(ctow_conv = _XlcOpenConverter(lcd,
-			XlcNCompoundText, lcd, XlcNWideChar))) {
-	return((XIM)NULL);
-    }
-
-    if ((im = (StaticXIM)Xmalloc(sizeof(StaticXIMRec))) == (StaticXIM)NULL) {
-	return((XIM)NULL);
-    }
-    if ((local_impart = (XIMStaticXIMRec*)Xmalloc(sizeof(XIMStaticXIMRec)))
-	== (XIMStaticXIMRec *)NULL) {
-	Xfree(im);
-	return((XIM)NULL);
-    }
-    memset(im, 0, sizeof(StaticXIMRec));
-    memset(local_impart, 0, sizeof(XIMStaticXIMRec));
-
-    buf[0] = '\0';
-    i = 0;
-    if ((lcd->core->modifiers) && (*lcd->core->modifiers)) {
-#define	MODIFIER "@im="
-	mod = strstr(lcd->core->modifiers, MODIFIER);
-	if (mod) {
-	    mod += strlen(MODIFIER);
-	    while (*mod && *mod != '@' && i < BUFSIZ - 1) {
-		buf[i++] = *mod++;
-	    }
-	    buf[i] = '\0';
-	}
-    }
-#undef MODIFIER
-    if ((im->core.im_name = Xmalloc(i+1)) == NULL)
-	goto Error2;
-    strcpy(im->core.im_name, buf);
-
-    im->private = local_impart;
-    im->methods        = (XIMMethods)&local_im_methods;
-    im->core.lcd       = lcd;
-    im->core.ic_chain  = (XIC)NULL;
-    im->core.display   = dpy;
-    im->core.rdb       = rdb;
-    im->core.res_name  = NULL;
-    im->core.res_class = NULL;
-
-    local_impart->ctom_conv = ctom_conv;
-    local_impart->ctow_conv = ctow_conv;
-
-    if ((res_name != NULL) && (*res_name != '\0')){
-	im->core.res_name  = (char *)Xmalloc(strlen(res_name)+1);
-	strcpy(im->core.res_name,res_name);
-    }
-    if ((res_class != NULL) && (*res_class != '\0')){
-	im->core.res_class = (char *)Xmalloc(strlen(res_class)+1);
-	strcpy(im->core.res_class,res_class);
-    }
-
-    return (XIM)im;
-Error2 :
-    Xfree(im->private);
-    Xfree(im->core.im_name);
-    Xfree(im);
-    _XlcCloseConverter(ctom_conv);
-    _XlcCloseConverter(ctow_conv);
-    return(NULL);
-}
-
-static Status
-_CloseIM(XIM xim)
-{
-    StaticXIM im = (StaticXIM)xim;
-    _XlcCloseConverter(im->private->ctom_conv);
-    _XlcCloseConverter(im->private->ctow_conv);
-    XFree(im->private);
-    XFree(im->core.im_name);
-    if (im->core.res_name) XFree(im->core.res_name);
-    if (im->core.res_class) XFree(im->core.res_class);
-    return 1; /*bugID 4163122*/
-}
-
-static char *
-_SetIMValues(
-    XIM xim,
-    XIMArg *arg)
-{
-    return(arg->name);		/* evil */
-}
-
-static char *
-_GetIMValues(
-    XIM xim,
-    XIMArg *values)
-{
-    XIMArg *p;
-    XIMStyles *styles;
-
-    for (p = values; p->name != NULL; p++) {
-	if (strcmp(p->name, XNQueryInputStyle) == 0) {
-	    styles = (XIMStyles *)Xmalloc(sizeof(XIMStyles));
-	    *(XIMStyles **)p->value = styles;
-	    styles->count_styles = 1;
-	    styles->supported_styles =
-		(XIMStyle*)Xmalloc(styles->count_styles * sizeof(XIMStyle));
-	    styles->supported_styles[0] = (XIMPreeditNone | XIMStatusNone);
-	} else {
-	    break;
-	}
-    }
-    return (p->name);
-}
-
-static char*
-_SetICValueData(XIC ic, XIMArg *values, XICOp_t mode)
-{
-    XIMArg *p;
-    char *return_name = NULL;
-
-    for (p = values; p != NULL && p->name != NULL; p++) {
-	if(strcmp(p->name, XNInputStyle) == 0) {
-	    if (mode == CREATE_IC)
-		ic->core.input_style = (XIMStyle)p->value;
-	} else if (strcmp(p->name, XNClientWindow) == 0) {
-	    ic->core.client_window = (Window)p->value ;
-	} else if (strcmp(p->name, XNFocusWindow) == 0) {
-	    ic->core.focus_window = (Window)p->value ;
-	} else if (strcmp(p->name, XNPreeditAttributes) == 0
-		   || strcmp(p->name, XNStatusAttributes) == 0) {
-            return_name = _SetICValueData(ic, (XIMArg*)p->value, mode);
-            if (return_name) break;
-        } else {
-            return_name = p->name;
-            break;
-        }
-    }
-    return(return_name);
-}
-
-static char*
-_GetICValueData(XIC ic, XIMArg *values, XICOp_t mode)
-{
-    XIMArg *p;
-    char *return_name = NULL;
-
-    for (p = values; p->name != NULL; p++) {
-	if(strcmp(p->name, XNInputStyle) == 0) {
-	    *((XIMStyle *)(p->value)) = ic->core.input_style;
-	} else if (strcmp(p->name, XNClientWindow) == 0) {
-	    *((Window *)(p->value)) = ic->core.client_window;
-	} else if (strcmp(p->name, XNFocusWindow) == 0) {
-	    *((Window *)(p->value)) = ic->core.focus_window;
-	} else if (strcmp(p->name, XNFilterEvents) == 0) {
-	    *((unsigned long *)(p->value))= ic->core.filter_events;
-	} else if (strcmp(p->name, XNPreeditAttributes) == 0
-		   || strcmp(p->name, XNStatusAttributes) == 0) {
-	    return_name = _GetICValueData(ic, (XIMArg*)p->value, mode);
-	    if (return_name) break;
-	} else {
-	    return_name = p->name;
-	    break;
-	}
-    }
-    return(return_name);
-}
-
-static XIC
-_CreateIC(XIM im, XIMArg *arg)
-{
-    XIC ic;
-
-    if ((ic = (XIC)Xmalloc(sizeof(XICRec))) == (XIC)NULL) {
-	return ((XIC)NULL);
-    }
-    memset(ic, 0, sizeof(XICRec));
-
-    ic->methods = (XICMethods)&local_ic_methods;
-    ic->core.im = im;
-    ic->core.filter_events = KeyPressMask;
-
-    if (_SetICValueData(ic, arg, CREATE_IC) != NULL)
-	goto err_return;
-    if (!(ic->core.input_style))
-	goto err_return;
-
-    return (XIC)ic;
-err_return:
-    XFree(ic);
-    return ((XIC)NULL);
-}
-
-static void
-_DestroyIC(XIC ic)
-{
-/*BugId4255571. This Xfree() should be removed because XDestroyIC() still need ic after invoking _DestroyIC() and there is a XFree(ic) at the end of XDestroyIC() already.
-   if(ic)
-   	XFree(ic); */
-}
-
-static void
-_SetFocus(XIC ic)
-{
-}
-
-static void
-_UnsetFocus(XIC ic)
-{
-}
-
-static char*
-_SetICValues(XIC ic, XIMArg *args)
-{
-    char *ret = NULL;
-    if (!ic) {
-        return (args->name);
-    }
-    ret = _SetICValueData(ic, args, SET_ICVAL);
-    return(ret);
-}
-
-static char*
-_GetICValues(XIC ic, XIMArg *args)
-{
-    char *ret = NULL;
-    if (!ic) {
-        return (args->name);
-    }
-    ret = _GetICValueData(ic, args, GET_ICVAL);
-    return(ret);
-}
-
-static char *
-_MbReset(XIC xic)
-{
-    return(NULL);
-}
-
-static wchar_t *
-_WcReset(XIC xic)
-{
-    return(NULL);
-}
-
-static int
-_MbLookupString(
-    XIC xic,
-    XKeyEvent *ev,
-    char * buffer,
-    int bytes,
-    KeySym *keysym,
-    Status *status)
-{
-    XComposeStatus NotSupportedYet ;
-    int length;
-
-    length = XLookupString(ev, buffer, bytes, keysym, &NotSupportedYet);
-
-    if (keysym && *keysym == NoSymbol){
-	*status = XLookupNone;
-    } else if (length > 0) {
-	*status = XLookupBoth;
-    } else {
-	*status = XLookupKeySym;
-    }
-    return(length);
-}
-
-static int
-_WcLookupString(
-    XIC xic,
-    XKeyEvent *ev,
-    wchar_t * buffer,
-    int wlen,
-    KeySym *keysym,
-    Status *status)
-{
-    XComposeStatus NotSupportedYet ;
-    int length;
-    /* In single-byte, mb_len = wc_len */
-    char *mb_buf = (char *)Xmalloc(wlen);
-
-    length = XLookupString(ev, mb_buf, wlen, keysym, &NotSupportedYet);
-
-    if (keysym && *keysym == NoSymbol){
-	*status = XLookupNone;
-    } else if (length > 0) {
-	*status = XLookupBoth;
-    } else {
-	*status = XLookupKeySym;
-    }
-    mbstowcs(buffer, mb_buf, length);
-    XFree(mb_buf);
-    return(length);
-}
+/*
+Copyright 1985, 1986, 1987, 1991, 1998  The Open Group
+
+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 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
+OPEN GROUP 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
+EVEN IF ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+X Window System is a trademark of The Open Group
+
+OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
+logo, LBX, X Window System, and Xinerama are trademarks of the Open
+Group. All other trademarks and registered trademarks mentioned herein
+are the property of their respective owners. No right, title or
+interest in or to any trademark, service mark, logo or trade name of
+Sun Microsystems, Inc. or its licensors is granted.
+
+*/
+/*
+ * Copyright 2000 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include "Xlibint.h"
+#include "Xlcint.h"
+#include "XlcGeneric.h"
+
+#ifndef MAXINT
+#define MAXINT          (~((unsigned int)1 << (8 * sizeof(int)) - 1))
+#endif /* !MAXINT */
+
+typedef struct _StaticXIM *StaticXIM;
+
+typedef struct _XIMStaticXIMRec {
+    /* for CT => MB,WC converter */
+    XlcConv		 ctom_conv;
+    XlcConv		 ctow_conv;
+} XIMStaticXIMRec;
+
+typedef enum {
+    CREATE_IC = 1,
+    SET_ICVAL = 2,
+    GET_ICVAL = 3
+} XICOp_t;
+
+typedef struct _StaticXIM {
+    XIMMethods		methods;
+    XIMCoreRec		core;
+    XIMStaticXIMRec	*private;
+} StaticXIMRec;
+
+static Status _CloseIM(
+	XIM
+);
+
+static char *_SetIMValues(
+	XIM, XIMArg *
+);
+
+static char *_GetIMValues(
+	XIM, XIMArg*
+);
+
+static XIC _CreateIC(
+	XIM, XIMArg*
+);
+
+static _Xconst XIMMethodsRec local_im_methods = {
+    _CloseIM,		/* close */
+    _SetIMValues,	/* set_values */
+    _GetIMValues, 	/* get_values */
+    _CreateIC,		/* create_ic */
+    NULL,		/* ctstombs */
+    NULL		/* ctstowcs */
+};
+
+static void _DestroyIC(
+		       XIC
+);
+static void _SetFocus(
+		      XIC
+);
+static void _UnsetFocus(
+			XIC
+);
+static char* _SetICValues(
+			 XIC, XIMArg *
+);
+static char* _GetICValues(
+			 XIC, XIMArg *
+);
+static char *_MbReset(
+		      XIC
+);
+static wchar_t *_WcReset(
+			 XIC
+);
+static int _MbLookupString(
+	XIC, XKeyEvent *, char *, int, KeySym *, Status *
+);
+static int _WcLookupString(
+	XIC, XKeyEvent *, wchar_t *, int, KeySym *, Status *
+);
+
+static _Xconst XICMethodsRec local_ic_methods = {
+    _DestroyIC, 	/* destroy */
+    _SetFocus,		/* set_focus */
+    _UnsetFocus,	/* unset_focus */
+    _SetICValues,	/* set_values */
+    _GetICValues,	/* get_values */
+    _MbReset,		/* mb_reset */
+    _WcReset,		/* wc_reset */
+    NULL,		/* utf8_reset */		/* ??? */
+    _MbLookupString,	/* mb_lookup_string */
+    _WcLookupString,	/* wc_lookup_string */
+    NULL		/* utf8_lookup_string */	/* ??? */
+};
+
+XIM
+_XDefaultOpenIM(
+    XLCd                lcd,
+    Display             *dpy,
+    XrmDatabase         rdb,
+    char                *res_name,
+    char                *res_class)
+{
+    StaticXIM im;
+    XIMStaticXIMRec *local_impart;
+    XlcConv ctom_conv, ctow_conv;
+    int i;
+    char *mod;
+    char buf[BUFSIZ];
+
+    if (!(ctom_conv = _XlcOpenConverter(lcd,
+			XlcNCompoundText, lcd, XlcNMultiByte))) {
+	return((XIM)NULL);
+    }
+
+    if (!(ctow_conv = _XlcOpenConverter(lcd,
+			XlcNCompoundText, lcd, XlcNWideChar))) {
+	return((XIM)NULL);
+    }
+
+    if ((im = (StaticXIM)Xmalloc(sizeof(StaticXIMRec))) == (StaticXIM)NULL) {
+	return((XIM)NULL);
+    }
+    if ((local_impart = (XIMStaticXIMRec*)Xmalloc(sizeof(XIMStaticXIMRec)))
+	== (XIMStaticXIMRec *)NULL) {
+	Xfree(im);
+	return((XIM)NULL);
+    }
+    memset(im, 0, sizeof(StaticXIMRec));
+    memset(local_impart, 0, sizeof(XIMStaticXIMRec));
+
+    buf[0] = '\0';
+    i = 0;
+    if ((lcd->core->modifiers) && (*lcd->core->modifiers)) {
+#define	MODIFIER "@im="
+	mod = strstr(lcd->core->modifiers, MODIFIER);
+	if (mod) {
+	    mod += strlen(MODIFIER);
+	    while (*mod && *mod != '@' && i < BUFSIZ - 1) {
+		buf[i++] = *mod++;
+	    }
+	    buf[i] = '\0';
+	}
+    }
+#undef MODIFIER
+    if ((im->core.im_name = Xmalloc(i+1)) == NULL)
+	goto Error2;
+    strcpy(im->core.im_name, buf);
+
+    im->private = local_impart;
+    im->methods        = (XIMMethods)&local_im_methods;
+    im->core.lcd       = lcd;
+    im->core.ic_chain  = (XIC)NULL;
+    im->core.display   = dpy;
+    im->core.rdb       = rdb;
+    im->core.res_name  = NULL;
+    im->core.res_class = NULL;
+
+    local_impart->ctom_conv = ctom_conv;
+    local_impart->ctow_conv = ctow_conv;
+
+    if ((res_name != NULL) && (*res_name != '\0')){
+	im->core.res_name  = strdup(res_name);
+    }
+    if ((res_class != NULL) && (*res_class != '\0')){
+	im->core.res_class = strdup(res_class);
+    }
+
+    return (XIM)im;
+Error2 :
+    Xfree(im->private);
+    Xfree(im->core.im_name);
+    Xfree(im);
+    _XlcCloseConverter(ctom_conv);
+    _XlcCloseConverter(ctow_conv);
+    return(NULL);
+}
+
+static Status
+_CloseIM(XIM xim)
+{
+    StaticXIM im = (StaticXIM)xim;
+    _XlcCloseConverter(im->private->ctom_conv);
+    _XlcCloseConverter(im->private->ctow_conv);
+    XFree(im->private);
+    XFree(im->core.im_name);
+    if (im->core.res_name) XFree(im->core.res_name);
+    if (im->core.res_class) XFree(im->core.res_class);
+    return 1; /*bugID 4163122*/
+}
+
+static char *
+_SetIMValues(
+    XIM xim,
+    XIMArg *arg)
+{
+    return(arg->name);		/* evil */
+}
+
+static char *
+_GetIMValues(
+    XIM xim,
+    XIMArg *values)
+{
+    XIMArg *p;
+    XIMStyles *styles;
+
+    for (p = values; p->name != NULL; p++) {
+	if (strcmp(p->name, XNQueryInputStyle) == 0) {
+	    styles = (XIMStyles *)Xmalloc(sizeof(XIMStyles));
+	    *(XIMStyles **)p->value = styles;
+	    styles->count_styles = 1;
+	    styles->supported_styles =
+		(XIMStyle*)Xmalloc(styles->count_styles * sizeof(XIMStyle));
+	    styles->supported_styles[0] = (XIMPreeditNone | XIMStatusNone);
+	} else {
+	    break;
+	}
+    }
+    return (p->name);
+}
+
+static char*
+_SetICValueData(XIC ic, XIMArg *values, XICOp_t mode)
+{
+    XIMArg *p;
+    char *return_name = NULL;
+
+    for (p = values; p != NULL && p->name != NULL; p++) {
+	if(strcmp(p->name, XNInputStyle) == 0) {
+	    if (mode == CREATE_IC)
+		ic->core.input_style = (XIMStyle)p->value;
+	} else if (strcmp(p->name, XNClientWindow) == 0) {
+	    ic->core.client_window = (Window)p->value ;
+	} else if (strcmp(p->name, XNFocusWindow) == 0) {
+	    ic->core.focus_window = (Window)p->value ;
+	} else if (strcmp(p->name, XNPreeditAttributes) == 0
+		   || strcmp(p->name, XNStatusAttributes) == 0) {
+            return_name = _SetICValueData(ic, (XIMArg*)p->value, mode);
+            if (return_name) break;
+        } else {
+            return_name = p->name;
+            break;
+        }
+    }
+    return(return_name);
+}
+
+static char*
+_GetICValueData(XIC ic, XIMArg *values, XICOp_t mode)
+{
+    XIMArg *p;
+    char *return_name = NULL;
+
+    for (p = values; p->name != NULL; p++) {
+	if(strcmp(p->name, XNInputStyle) == 0) {
+	    *((XIMStyle *)(p->value)) = ic->core.input_style;
+	} else if (strcmp(p->name, XNClientWindow) == 0) {
+	    *((Window *)(p->value)) = ic->core.client_window;
+	} else if (strcmp(p->name, XNFocusWindow) == 0) {
+	    *((Window *)(p->value)) = ic->core.focus_window;
+	} else if (strcmp(p->name, XNFilterEvents) == 0) {
+	    *((unsigned long *)(p->value))= ic->core.filter_events;
+	} else if (strcmp(p->name, XNPreeditAttributes) == 0
+		   || strcmp(p->name, XNStatusAttributes) == 0) {
+	    return_name = _GetICValueData(ic, (XIMArg*)p->value, mode);
+	    if (return_name) break;
+	} else {
+	    return_name = p->name;
+	    break;
+	}
+    }
+    return(return_name);
+}
+
+static XIC
+_CreateIC(XIM im, XIMArg *arg)
+{
+    XIC ic;
+
+    if ((ic = (XIC)Xmalloc(sizeof(XICRec))) == (XIC)NULL) {
+	return ((XIC)NULL);
+    }
+    memset(ic, 0, sizeof(XICRec));
+
+    ic->methods = (XICMethods)&local_ic_methods;
+    ic->core.im = im;
+    ic->core.filter_events = KeyPressMask;
+
+    if (_SetICValueData(ic, arg, CREATE_IC) != NULL)
+	goto err_return;
+    if (!(ic->core.input_style))
+	goto err_return;
+
+    return (XIC)ic;
+err_return:
+    XFree(ic);
+    return ((XIC)NULL);
+}
+
+static void
+_DestroyIC(XIC ic)
+{
+/*BugId4255571. This Xfree() should be removed because XDestroyIC() still need ic after invoking _DestroyIC() and there is a XFree(ic) at the end of XDestroyIC() already.
+   if(ic)
+   	XFree(ic); */
+}
+
+static void
+_SetFocus(XIC ic)
+{
+}
+
+static void
+_UnsetFocus(XIC ic)
+{
+}
+
+static char*
+_SetICValues(XIC ic, XIMArg *args)
+{
+    char *ret = NULL;
+    if (!ic) {
+        return (args->name);
+    }
+    ret = _SetICValueData(ic, args, SET_ICVAL);
+    return(ret);
+}
+
+static char*
+_GetICValues(XIC ic, XIMArg *args)
+{
+    char *ret = NULL;
+    if (!ic) {
+        return (args->name);
+    }
+    ret = _GetICValueData(ic, args, GET_ICVAL);
+    return(ret);
+}
+
+static char *
+_MbReset(XIC xic)
+{
+    return(NULL);
+}
+
+static wchar_t *
+_WcReset(XIC xic)
+{
+    return(NULL);
+}
+
+static int
+_MbLookupString(
+    XIC xic,
+    XKeyEvent *ev,
+    char * buffer,
+    int bytes,
+    KeySym *keysym,
+    Status *status)
+{
+    XComposeStatus NotSupportedYet ;
+    int length;
+
+    length = XLookupString(ev, buffer, bytes, keysym, &NotSupportedYet);
+
+    if (keysym && *keysym == NoSymbol){
+	*status = XLookupNone;
+    } else if (length > 0) {
+	*status = XLookupBoth;
+    } else {
+	*status = XLookupKeySym;
+    }
+    return(length);
+}
+
+static int
+_WcLookupString(
+    XIC xic,
+    XKeyEvent *ev,
+    wchar_t * buffer,
+    int wlen,
+    KeySym *keysym,
+    Status *status)
+{
+    XComposeStatus NotSupportedYet ;
+    int length;
+    /* In single-byte, mb_len = wc_len */
+    char *mb_buf = (char *)Xmalloc(wlen);
+
+    length = XLookupString(ev, mb_buf, wlen, keysym, &NotSupportedYet);
+
+    if (keysym && *keysym == NoSymbol){
+	*status = XLookupNone;
+    } else if (length > 0) {
+	*status = XLookupBoth;
+    } else {
+	*status = XLookupKeySym;
+    }
+    mbstowcs(buffer, mb_buf, length);
+    XFree(mb_buf);
+    return(length);
+}
diff --git a/libX11/src/xlibi18n/XDefaultOMIF.c b/libX11/src/xlibi18n/XDefaultOMIF.c
index ae8ac79e4..b1dc66df6 100644
--- a/libX11/src/xlibi18n/XDefaultOMIF.c
+++ b/libX11/src/xlibi18n/XDefaultOMIF.c
@@ -128,10 +128,9 @@ init_fontset(
 
     data = XOM_GENERIC(oc->core.om)->data;
 
-    font_set = (FontSet) Xmalloc(sizeof(FontSetRec));
+    font_set = Xcalloc(1, sizeof(FontSetRec));
     if (font_set == NULL)
 	return False;
-    bzero((char *) font_set, sizeof(FontSetRec));
 
     gen = XOC_GENERIC(oc);
     gen->font_set = font_set;
@@ -217,9 +216,8 @@ check_fontname(
 		fname = prop_fname;
 	}
 	if (data) {
-	    font_set->font_name = (char *) Xmalloc(strlen(fname) + 1);
+	    font_set->font_name = strdup(fname);
 	    if (font_set->font_name) {
-		strcpy(font_set->font_name, fname);
 		found_num++;
 	    }
 	}
@@ -388,9 +386,7 @@ get_font_name(
 
     list = XListFonts(dpy, pattern, 1, &count);
     if (list != NULL) {
-	name = (char *) Xmalloc(strlen(*list) + 1);
-	if (name)
-	    strcpy(name, *list);
+	name = strdup(*list);
 
 	XFreeFontNames(list);
     } else {
@@ -460,13 +456,11 @@ parse_fontname(
 	    if (font_data == NULL)
 		continue;
 
-	    font_set->font_name = (char *) Xmalloc(strlen(font_name) + 1);
+	    font_set->font_name = strdup(font_name);
+	    Xfree(font_name);
 	    if (font_set->font_name == NULL) {
-		Xfree(font_name);
 		goto err;
 	    }
-	    strcpy(font_set->font_name, font_name);
-	    Xfree(font_name);
 	    found_num++;
 	    goto found;
 	}
@@ -549,11 +543,10 @@ Limit the length of the string copy to prevent stack corruption.
 	}
     }
   found:
-    base_name = (char *) Xmalloc(strlen(oc->core.base_name_list) + 1);
+    base_name = strdup(oc->core.base_name_list);
     if (base_name == NULL)
 	goto err;
 
-    strcpy(base_name, oc->core.base_name_list);
     oc->core.base_name_list = base_name;
 
     XFreeStringList(name_list);
@@ -1005,10 +998,9 @@ create_oc(
 {
     XOC oc;
 
-    oc = (XOC) Xmalloc(sizeof(XOCGenericRec));
+    oc = Xcalloc(1, sizeof(XOCGenericRec));
     if (oc == NULL)
 	return (XOC) NULL;
-    bzero((char *) oc, sizeof(XOCGenericRec));
 
     oc->core.om = om;
 
@@ -1126,15 +1118,13 @@ add_data(
     XOMGenericPart *gen = XOM_GENERIC(om);
     OMData new;
 
-    new = (OMData) Xmalloc(sizeof(OMDataRec));
+    new = Xcalloc(1, sizeof(OMDataRec));
 
     if (new == NULL)
         return NULL;
 
     gen->data = new;
 
-    bzero((char *) new, sizeof(OMDataRec));
-
     return new;
 }
 
@@ -1168,10 +1158,9 @@ init_om(
     if (data == NULL)
 	return False;
 
-    font_data = (FontData) Xmalloc(sizeof(FontDataRec) * count);
+    font_data = Xcalloc(count, sizeof(FontDataRec));
     if (font_data == NULL)
 	return False;
-    bzero((char *) font_data, sizeof(FontDataRec) * count);
     data->font_data = font_data;
     data->font_data_count = count;
 
@@ -1182,10 +1171,9 @@ This one is fine.  *value points to one of the local strings in
 supported_charset_list[].
 */
 	strcpy(buf, *value++);
-	font_data->name = (char *) Xmalloc(strlen(buf) + 1);
+	font_data->name = strdup(buf);
 	if (font_data->name == NULL)
 	    return False;
-	strcpy(font_data->name, buf);
     }
 
     length += strlen(data->font_data->name) + 1;
@@ -1237,26 +1225,23 @@ _XDefaultOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb,
 {
     XOM om;
 
-    om = (XOM) Xmalloc(sizeof(XOMGenericRec));
+    om = Xcalloc(1, sizeof(XOMGenericRec));
     if (om == NULL)
 	return (XOM) NULL;
-    bzero((char *) om, sizeof(XOMGenericRec));
 
     om->methods = (XOMMethods)&methods;
     om->core.lcd = lcd;
     om->core.display = dpy;
     om->core.rdb = rdb;
     if (res_name) {
-	om->core.res_name = (char *)Xmalloc(strlen(res_name) + 1);
+	om->core.res_name = strdup(res_name);
 	if (om->core.res_name == NULL)
 	    goto err;
-	strcpy(om->core.res_name, res_name);
     }
     if (res_class) {
-	om->core.res_class = (char *)Xmalloc(strlen(res_class) + 1);
+	om->core.res_class = strdup(res_class);
 	if (om->core.res_class == NULL)
 	    goto err;
-	strcpy(om->core.res_class, res_class);
     }
 
     if (om_resources[0].xrm_name == NULLQUARK)
diff --git a/libX11/src/xlibi18n/XlcDL.c b/libX11/src/xlibi18n/XlcDL.c
index 58e9ade87..75e193c05 100644
--- a/libX11/src/xlibi18n/XlcDL.c
+++ b/libX11/src/xlibi18n/XlcDL.c
@@ -1,652 +1,612 @@
-/*
-Copyright 1985, 1986, 1987, 1991, 1998  The Open Group
-
-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 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
-OPEN GROUP 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
-EVEN IF ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
-
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-X Window System is a trademark of The Open Group
-
-OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
-logo, LBX, X Window System, and Xinerama are trademarks of the Open
-Group. All other trademarks and registered trademarks mentioned herein
-are the property of their respective owners. No right, title or
-interest in or to any trademark, service mark, logo or trade name of
-Sun Microsystems, Inc. or its licensors is granted.
-
-*/
-/*
- * Copyright 2000 Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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_CONFIG_H
-# include <config.h>
-#else
-# if defined(hpux)
-#  define HAVE_DL_H
-# else
-#  define HAVE_DLFCN_H
-# endif
-#endif
-
-#include <stdio.h>
-
-#ifdef HAVE_DL_H
-#include <dl.h>
-#endif
-
-#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <ctype.h>
-
-#include "Xlibint.h"
-#include "XlcPublic.h"
-#include "XlcPubI.h"
-
-#if defined(_LP64)  && defined(__sparcv9)
-# define	_MACH64_NAME		"sparcv9"
-#else
-# undef _MACH64_NAME
-#endif /* defined(_LP64)  && defined(__sparcv9) */
-
-#ifdef _MACH64_NAME
-#  define	_MACH64_NAME_LEN	(sizeof (_MACH64_NAME) - 1)
-#endif
-
-#define XI18N_DLREL		2
-
-#define	iscomment(ch)	((ch) == '\0' || (ch) == '#')
-
-typedef enum {
-  XLC_OBJECT,
-  XIM_OBJECT,
-  XOM_OBJECT
-} XI18NDLType;
-
-typedef struct {
-  XI18NDLType type;
-  int	locale_name_len;
-  char *locale_name;
-  char *dl_name;
-  char *open;
-  char *im_register;
-  char *im_unregister;
-  int dl_release;
-  unsigned int refcount;
-#if defined(hpux)
-  shl_t dl_module;
-#else
-  void *dl_module;
-#endif
-} XI18NObjectsListRec, *XI18NObjectsList;
-
-#define OBJECT_INIT_LEN 8
-#define OBJECT_INC_LEN 4
-static int lc_len = 0;
-static XI18NObjectsListRec *xi18n_objects_list = NULL;
-static int lc_count = 0;
-
-static int
-parse_line(char *line, char **argv, int argsize)
-{
-    int argc = 0;
-    char *p = line;
-
-    while (argc < argsize) {
-	while (isspace(*p)) {
-	    ++p;
-	}
-	if (iscomment(*p)){
-	    break;
-	}
-	argv[argc++] = p;
-	while (!isspace(*p)) {
-	    ++p;
-	}
-	if (iscomment(*p)) {
-	    break;
-	}
-	*p++ = '\0';
-    }
-    return argc;
-}
-
-static char *
-strdup_with_underscore(const char *symbol)
-{
-	char *result;
-
-	if ((result = malloc(strlen(symbol) + 2)) == NULL)
-		return NULL;
-	result[0] = '_';
-	strcpy(result + 1, symbol);
-	return result;
-}
-
-#ifndef hpux
-static void *
-try_both_dlsym (void *handle, char *name)
-{
-    void    *ret;
-
-    ret = dlsym (handle, name);
-    if (!ret)
-    {
-	 name = strdup_with_underscore (name);
-	 if (name)
-	 {
-	     ret = dlsym (handle, name);
-	     free (name);
-	 }
-    }
-    return ret;
-}
-#endif
-
-static void
-resolve_object(char *path, const char *lc_name)
-{
-    char filename[BUFSIZ];
-    FILE *fp;
-    char buf[BUFSIZ];
-
-    if (lc_len == 0) { /* True only for the 1st time */
-      lc_len = OBJECT_INIT_LEN;
-      xi18n_objects_list = (XI18NObjectsList)
-	  Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
-      if (!xi18n_objects_list) return;
-    }
-/*
-1266793
-Limit the length of path to prevent stack buffer corruption.
-    sprintf(filename, "%s/%s", path, "XI18N_OBJS");
-*/
-    sprintf(filename, "%.*s/%s", BUFSIZ - 12, path, "XI18N_OBJS");
-    fp = fopen(filename, "r");
-    if (fp == (FILE *)NULL){
-	return;
-    }
-
-    while (fgets(buf, BUFSIZ, fp) != NULL){
-	char *p = buf;
-	int n;
-	char *args[6];
-	while (isspace(*p)){
-	    ++p;
-	}
-	if (iscomment(*p)){
-	    continue;
-	}
-
-	if (lc_count == lc_len) {
-	  lc_len += OBJECT_INC_LEN;
-	  xi18n_objects_list = (XI18NObjectsList)
-	    Xrealloc(xi18n_objects_list,
-		     sizeof(XI18NObjectsListRec) * lc_len);
-	  if (!xi18n_objects_list) return;
-	}
-	n = parse_line(p, args, 6);
-
-	if (n == 3 || n == 5) {
-	  if (!strcmp(args[0], "XLC")){
-	    xi18n_objects_list[lc_count].type = XLC_OBJECT;
-	  } else if (!strcmp(args[0], "XOM")){
-	    xi18n_objects_list[lc_count].type = XOM_OBJECT;
-	  } else if (!strcmp(args[0], "XIM")){
-	    xi18n_objects_list[lc_count].type = XIM_OBJECT;
-	  }
-	  xi18n_objects_list[lc_count].dl_name = strdup(args[1]);
-	  xi18n_objects_list[lc_count].open = strdup(args[2]);
-	  xi18n_objects_list[lc_count].dl_release = XI18N_DLREL;
-	  xi18n_objects_list[lc_count].locale_name = strdup(lc_name);
-	  xi18n_objects_list[lc_count].refcount = 0;
-	  xi18n_objects_list[lc_count].dl_module = (void*)NULL;
-	  if (n == 5) {
-	    xi18n_objects_list[lc_count].im_register = strdup(args[3]);
-	    xi18n_objects_list[lc_count].im_unregister = strdup(args[4]);
-	  } else {
-	    xi18n_objects_list[lc_count].im_register = NULL;
-	    xi18n_objects_list[lc_count].im_unregister = NULL;
-	  }
-	  lc_count++;
-	}
-    }
-    fclose(fp);
-}
-
-static char*
-__lc_path(const char *dl_name, const char *lc_dir)
-{
-    char *path;
-    size_t len;
-
-    /*
-     * reject this for possible security issue
-     */
-    if (strstr (dl_name, "../"))
-	return NULL;
-
-#if defined (_LP64) && defined (_MACH64_NAME)
-    len = (lc_dir ? strlen(lc_dir) : 0 ) +
-	(dl_name ? strlen(dl_name) : 0) + _MACH64_NAME_LEN + 10;
-    path = Xmalloc(len + 1);
-
-    if (strchr(dl_name, '/') != NULL) {
-	char *tmp = strdup(dl_name);
-	char *dl_dir, *dl_file;
-	char *slash_p;
-	slash_p = strchr(tmp, '/');
-	*slash_p = '\0';
-	dl_dir = tmp;
-	dl_file = ++slash_p;
-
-	slash_p = strrchr(lc_dir, '/');
-	*slash_p = '\0';
-	strcpy(path, lc_dir); strcat(path, "/");
-	strcat(path, dl_dir); strcat(path, "/");
-	strcat(path, _MACH64_NAME); strcat(path, "/");
-	strcat(path, dl_file); strcat(path, ".so.2");
-
-	*slash_p = '/';
-	Xfree(tmp);
-    } else {
-	strcpy(path, lc_dir); strcat(path, "/");
-	strcat(path, _MACH64_NAME); strcat(path, "/");
-	strcat(path, dl_name); strcat(path, ".so.2");
-    }
-#else
-    len = (lc_dir ? strlen(lc_dir) : 0 ) +
-	(dl_name ? strlen(dl_name) : 0) + 10;
-#if defined POSTLOCALELIBDIR
-    len += (strlen(POSTLOCALELIBDIR) + 1);
-#endif
-    path = Xmalloc(len + 1);
-
-    if (strchr(dl_name, '/') != NULL) {
-	char *slash_p;
-	slash_p = strrchr(lc_dir, '/');
-	*slash_p = '\0';
-	strcpy(path, lc_dir); strcat(path, "/");
-#if defined POSTLOCALELIBDIR
-	strcat(path, POSTLOCALELIBDIR); strcat(path, "/");
-#endif
-	strcat(path, dl_name); strcat(path, ".so.2");
-	*slash_p = '/';
-    } else {
-	strcpy(path, lc_dir); strcat(path, "/");
-#if defined POSTLOCALELIBDIR
-	strcat(path, POSTLOCALELIBDIR); strcat(path, "/");
-#endif
-	strcat(path, dl_name); strcat(path, ".so.2");
-    }
-#endif
-    return path;
-}
-
-/* We reference count dlopen() and dlclose() of modules; unfortunately,
- * since XCloseIM, XCloseOM, XlcClose aren't wrapped, but directly
- * call the close method of the object, we leak a reference count every
- * time we open then close a module. Fixing this would require
- * either creating proxy objects or hooks for close_im/close_om
- * in XLCd
- */
-static Bool
-open_object(
-     XI18NObjectsList object,
-     char *lc_dir)
-{
-  char *path;
-
-  if (object->refcount == 0) {
-      path = __lc_path(object->dl_name, lc_dir);
-      if (!path)
-	  return False;
-#if defined(hpux)
-      object->dl_module = shl_load(path, BIND_DEFERRED, 0L);
-#else
-      object->dl_module = dlopen(path, RTLD_LAZY);
-#endif
-      Xfree(path);
-
-      if (!object->dl_module)
-	  return False;
-    }
-
-  object->refcount++;
-  return True;
-}
-
-static void *
-fetch_symbol(
-     XI18NObjectsList object,
-     char *symbol)
-{
-    void *result = NULL;
-#if defined(hpux)
-    int getsyms_cnt, i;
-    struct shl_symbol *symbols;
-#endif
-
-    if (symbol == NULL)
-    	return NULL;
-
-#if defined(hpux)
-    getsyms_cnt = shl_getsymbols(object->dl_module, TYPE_PROCEDURE,
-				 EXPORT_SYMBOLS, malloc, &symbols);
-
-    for(i=0; i<getsyms_cnt; i++) {
-        if(!strcmp(symbols[i].name, symbol)) {
-	    result = symbols[i].value;
-	    break;
-         }
-    }
-
-    if(getsyms_cnt > 0) {
-        free(symbols);
-    }
-#else
-    result = try_both_dlsym(object->dl_module, symbol);
-#endif
-
-    return result;
-}
-
-static void
-close_object(XI18NObjectsList object)
-{
-  object->refcount--;
-  if (object->refcount == 0)
-    {
-#if defined(hpux)
-        shl_unload(object->dl_module);
-#else
-        dlclose(object->dl_module);
-#endif
-        object->dl_module = NULL;
-    }
-}
-
-
-typedef XLCd (*dynamicLoadProc)(const char *);
-
-XLCd
-_XlcDynamicLoad(const char *lc_name)
-{
-    XLCd lcd = (XLCd)NULL;
-    dynamicLoadProc lc_loader = (dynamicLoadProc)NULL;
-    int count;
-    XI18NObjectsList objects_list;
-    char lc_dir[BUFSIZE], lc_lib_dir[BUFSIZE];
-
-    if (lc_name == NULL) return (XLCd)NULL;
-
-    if (_XlcLocaleDirName(lc_dir, BUFSIZE, (char *)lc_name) == (char *)NULL)
-        return (XLCd)NULL;
-    if (_XlcLocaleLibDirName(lc_lib_dir, BUFSIZE, (char *)lc_name) == (char*)NULL)
-	return (XLCd)NULL;
-
-    resolve_object(lc_dir, lc_name);
-    resolve_object(lc_lib_dir, lc_name);
-
-    objects_list = xi18n_objects_list;
-    count = lc_count;
-    for (; count-- > 0; objects_list++) {
-        if (objects_list->type != XLC_OBJECT ||
-	    strcmp(objects_list->locale_name, lc_name)) continue;
-	if (!open_object (objects_list, lc_dir) && \
-            !open_object (objects_list, lc_lib_dir))
-	    continue;
-
-	lc_loader = (dynamicLoadProc)fetch_symbol (objects_list, objects_list->open);
-	if (!lc_loader) continue;
-	lcd = (*lc_loader)(lc_name);
-	if (lcd != (XLCd)NULL) {
-	    break;
-	}
-
-	close_object (objects_list);
-    }
-    return (XLCd)lcd;
-}
-
-
-typedef XIM (*dynamicOpenProcp)(XLCd, Display *, XrmDatabase, char *, char *);
-
-static XIM
-_XDynamicOpenIM(XLCd lcd, Display *display, XrmDatabase rdb,
-		char *res_name, char *res_class)
-{
-  XIM im = (XIM)NULL;
-  char lc_dir[BUFSIZE];
-  char *lc_name;
-  dynamicOpenProcp im_openIM = (dynamicOpenProcp)NULL;
-  int count;
-  XI18NObjectsList objects_list = xi18n_objects_list;
-
-  lc_name = lcd->core->name;
-
-  if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XIM)0;
-
-  count = lc_count;
-  for (; count-- > 0; objects_list++) {
-    if (objects_list->type != XIM_OBJECT ||
-	strcmp(objects_list->locale_name, lc_name)) continue;
-
-    if (!open_object (objects_list, lc_dir))
-        continue;
-
-    im_openIM = (dynamicOpenProcp)fetch_symbol(objects_list, objects_list->open);
-    if (!im_openIM) continue;
-    im = (*im_openIM)(lcd, display, rdb, res_name, res_class);
-    if (im != (XIM)NULL) {
-        break;
-    }
-
-    close_object (objects_list);
-  }
-  return (XIM)im;
-}
-
-typedef Bool (*dynamicRegisterCBProcp)(
-    XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer);
-
-static Bool
-_XDynamicRegisterIMInstantiateCallback(
-    XLCd	 lcd,
-    Display	*display,
-    XrmDatabase	 rdb,
-    char	*res_name,
-    char        *res_class,
-    XIDProc	 callback,
-    XPointer	 client_data)
-{
-  char lc_dir[BUFSIZE];
-  char *lc_name;
-  dynamicRegisterCBProcp im_registerIM = (dynamicRegisterCBProcp)NULL;
-  Bool ret_flag = False;
-  int count;
-  XI18NObjectsList objects_list = xi18n_objects_list;
-#if defined(hpux)
-  int getsyms_cnt, i;
-  struct shl_symbol *symbols;
-#endif
-
-  lc_name = lcd->core->name;
-
-  if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False;
-
-  count = lc_count;
-  for (; count-- > 0; objects_list++) {
-    if (objects_list->type != XIM_OBJECT ||
-	strcmp(objects_list->locale_name, lc_name)) continue;
-
-    if (!open_object (objects_list, lc_dir))
-        continue;
-    im_registerIM = (dynamicRegisterCBProcp)fetch_symbol(objects_list,
-					    objects_list->im_register);
-    if (!im_registerIM) continue;
-    ret_flag = (*im_registerIM)(lcd, display, rdb,
-				res_name, res_class,
-				callback, client_data);
-    if (ret_flag) break;
-
-    close_object (objects_list);
-  }
-  return (Bool)ret_flag;
-}
-
-typedef Bool (*dynamicUnregisterProcp)(
-    XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer);
-
-static Bool
-_XDynamicUnRegisterIMInstantiateCallback(
-    XLCd	 lcd,
-    Display	*display,
-    XrmDatabase	 rdb,
-    char	*res_name,
-    char        *res_class,
-    XIDProc	 callback,
-    XPointer	 client_data)
-{
-  char lc_dir[BUFSIZE];
-  char *lc_name;
-  dynamicUnregisterProcp im_unregisterIM = (dynamicUnregisterProcp)NULL;
-  Bool ret_flag = False;
-  int count;
-  XI18NObjectsList objects_list = xi18n_objects_list;
-#if defined(hpux)
-  int getsyms_cnt, i;
-  struct shl_symbol *symbols;
-#endif
-
-  lc_name = lcd->core->name;
-  if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False;
-
-  count = lc_count;
-  for (; count-- > 0; objects_list++) {
-    if (objects_list->type != XIM_OBJECT ||
-	strcmp(objects_list->locale_name, lc_name)) continue;
-
-    if (!objects_list->refcount) /* Must already be opened */
-        continue;
-
-    im_unregisterIM = (dynamicUnregisterProcp)fetch_symbol(objects_list,
-					      objects_list->im_unregister);
-
-    if (!im_unregisterIM) continue;
-    ret_flag = (*im_unregisterIM)(lcd, display, rdb,
-				  res_name, res_class,
-				  callback, client_data);
-    if (ret_flag) {
-        close_object (objects_list); /* opened in RegisterIMInstantiateCallback */
-	break;
-    }
-  }
-  return (Bool)ret_flag;
-}
-
-Bool
-_XInitDynamicIM(XLCd lcd)
-{
-    if(lcd == (XLCd)NULL)
-	return False;
-    lcd->methods->open_im = _XDynamicOpenIM;
-    lcd->methods->register_callback = _XDynamicRegisterIMInstantiateCallback;
-    lcd->methods->unregister_callback = _XDynamicUnRegisterIMInstantiateCallback;
-    return True;
-}
-
-
-typedef XOM (*dynamicIOpenProcp)(
-        XLCd, Display *, XrmDatabase, _Xconst char *, _Xconst char *);
-
-static XOM
-_XDynamicOpenOM(XLCd lcd, Display *display, XrmDatabase rdb,
-		_Xconst char *res_name, _Xconst char *res_class)
-{
-  XOM om = (XOM)NULL;
-  int count;
-  char lc_dir[BUFSIZE];
-  char *lc_name;
-  dynamicIOpenProcp om_openOM = (dynamicIOpenProcp)NULL;
-  XI18NObjectsList objects_list = xi18n_objects_list;
-#if defined(hpux)
-  int getsyms_cnt, i;
-  struct shl_symbol *symbols;
-#endif
-
-  lc_name = lcd->core->name;
-
-  if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XOM)0;
-
-  count = lc_count;
-  for (; count-- > 0; objects_list++) {
-    if (objects_list->type != XOM_OBJECT ||
-	strcmp(objects_list->locale_name, lc_name)) continue;
-    if (!open_object (objects_list, lc_dir))
-        continue;
-
-    om_openOM = (dynamicIOpenProcp)fetch_symbol(objects_list, objects_list->open);
-    if (!om_openOM) continue;
-    om = (*om_openOM)(lcd, display, rdb, res_name, res_class);
-    if (om != (XOM)NULL) {
-        break;
-    }
-    close_object(objects_list);
-  }
-  return (XOM)om;
-}
-
-Bool
-_XInitDynamicOM(XLCd lcd)
-{
-    if(lcd == (XLCd)NULL)
-	return False;
-
-    lcd->methods->open_om = _XDynamicOpenOM;
-
-    return True;
-}
+/*
+Copyright 1985, 1986, 1987, 1991, 1998  The Open Group
+
+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 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
+OPEN GROUP 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
+EVEN IF ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+X Window System is a trademark of The Open Group
+
+OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
+logo, LBX, X Window System, and Xinerama are trademarks of the Open
+Group. All other trademarks and registered trademarks mentioned herein
+are the property of their respective owners. No right, title or
+interest in or to any trademark, service mark, logo or trade name of
+Sun Microsystems, Inc. or its licensors is granted.
+
+*/
+/*
+ * Copyright 2000 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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_CONFIG_H
+# include <config.h>
+#else
+# if defined(hpux)
+#  define HAVE_DL_H
+# else
+#  define HAVE_DLFCN_H
+# endif
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_DL_H
+#include <dl.h>
+#endif
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <ctype.h>
+
+#include "Xlibint.h"
+#include "XlcPublic.h"
+#include "XlcPubI.h"
+
+#define XI18N_DLREL		2
+
+#define	iscomment(ch)	((ch) == '\0' || (ch) == '#')
+
+typedef enum {
+  XLC_OBJECT,
+  XIM_OBJECT,
+  XOM_OBJECT
+} XI18NDLType;
+
+typedef struct {
+  XI18NDLType type;
+  int	locale_name_len;
+  char *locale_name;
+  char *dl_name;
+  char *open;
+  char *im_register;
+  char *im_unregister;
+  int dl_release;
+  unsigned int refcount;
+#if defined(hpux)
+  shl_t dl_module;
+#else
+  void *dl_module;
+#endif
+} XI18NObjectsListRec, *XI18NObjectsList;
+
+#define OBJECT_INIT_LEN 8
+#define OBJECT_INC_LEN 4
+static int lc_len = 0;
+static XI18NObjectsListRec *xi18n_objects_list = NULL;
+static int lc_count = 0;
+
+static int
+parse_line(char *line, char **argv, int argsize)
+{
+    int argc = 0;
+    char *p = line;
+
+    while (argc < argsize) {
+	while (isspace(*p)) {
+	    ++p;
+	}
+	if (iscomment(*p)){
+	    break;
+	}
+	argv[argc++] = p;
+	while (!isspace(*p)) {
+	    ++p;
+	}
+	if (iscomment(*p)) {
+	    break;
+	}
+	*p++ = '\0';
+    }
+    return argc;
+}
+
+static char *
+strdup_with_underscore(const char *symbol)
+{
+	char *result;
+
+	if ((result = malloc(strlen(symbol) + 2)) == NULL)
+		return NULL;
+	result[0] = '_';
+	strcpy(result + 1, symbol);
+	return result;
+}
+
+#ifndef hpux
+static void *
+try_both_dlsym (void *handle, char *name)
+{
+    void    *ret;
+
+    ret = dlsym (handle, name);
+    if (!ret)
+    {
+	 name = strdup_with_underscore (name);
+	 if (name)
+	 {
+	     ret = dlsym (handle, name);
+	     free (name);
+	 }
+    }
+    return ret;
+}
+#endif
+
+static void
+resolve_object(char *path, const char *lc_name)
+{
+    char filename[BUFSIZ];
+    FILE *fp;
+    char buf[BUFSIZ];
+
+    if (lc_len == 0) { /* True only for the 1st time */
+      lc_len = OBJECT_INIT_LEN;
+      xi18n_objects_list = (XI18NObjectsList)
+	  Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
+      if (!xi18n_objects_list) return;
+    }
+/*
+1266793
+Limit the length of path to prevent stack buffer corruption.
+    sprintf(filename, "%s/%s", path, "XI18N_OBJS");
+*/
+    sprintf(filename, "%.*s/%s", BUFSIZ - 12, path, "XI18N_OBJS");
+    fp = fopen(filename, "r");
+    if (fp == (FILE *)NULL){
+	return;
+    }
+
+    while (fgets(buf, BUFSIZ, fp) != NULL){
+	char *p = buf;
+	int n;
+	char *args[6];
+	while (isspace(*p)){
+	    ++p;
+	}
+	if (iscomment(*p)){
+	    continue;
+	}
+
+	if (lc_count == lc_len) {
+	  lc_len += OBJECT_INC_LEN;
+	  xi18n_objects_list = (XI18NObjectsList)
+	    Xrealloc(xi18n_objects_list,
+		     sizeof(XI18NObjectsListRec) * lc_len);
+	  if (!xi18n_objects_list) return;
+	}
+	n = parse_line(p, args, 6);
+
+	if (n == 3 || n == 5) {
+	  if (!strcmp(args[0], "XLC")){
+	    xi18n_objects_list[lc_count].type = XLC_OBJECT;
+	  } else if (!strcmp(args[0], "XOM")){
+	    xi18n_objects_list[lc_count].type = XOM_OBJECT;
+	  } else if (!strcmp(args[0], "XIM")){
+	    xi18n_objects_list[lc_count].type = XIM_OBJECT;
+	  }
+	  xi18n_objects_list[lc_count].dl_name = strdup(args[1]);
+	  xi18n_objects_list[lc_count].open = strdup(args[2]);
+	  xi18n_objects_list[lc_count].dl_release = XI18N_DLREL;
+	  xi18n_objects_list[lc_count].locale_name = strdup(lc_name);
+	  xi18n_objects_list[lc_count].refcount = 0;
+	  xi18n_objects_list[lc_count].dl_module = (void*)NULL;
+	  if (n == 5) {
+	    xi18n_objects_list[lc_count].im_register = strdup(args[3]);
+	    xi18n_objects_list[lc_count].im_unregister = strdup(args[4]);
+	  } else {
+	    xi18n_objects_list[lc_count].im_register = NULL;
+	    xi18n_objects_list[lc_count].im_unregister = NULL;
+	  }
+	  lc_count++;
+	}
+    }
+    fclose(fp);
+}
+
+static char*
+__lc_path(const char *dl_name, const char *lc_dir)
+{
+    char *path;
+    size_t len;
+
+    /*
+     * reject this for possible security issue
+     */
+    if (strstr (dl_name, "../"))
+	return NULL;
+
+    len = (lc_dir ? strlen(lc_dir) : 0 ) +
+	(dl_name ? strlen(dl_name) : 0) + 10;
+#if defined POSTLOCALELIBDIR
+    len += (strlen(POSTLOCALELIBDIR) + 1);
+#endif
+    path = Xmalloc(len + 1);
+
+    if (strchr(dl_name, '/') != NULL) {
+	char *slash_p;
+	slash_p = strrchr(lc_dir, '/');
+	*slash_p = '\0';
+	strcpy(path, lc_dir); strcat(path, "/");
+#if defined POSTLOCALELIBDIR
+	strcat(path, POSTLOCALELIBDIR); strcat(path, "/");
+#endif
+	strcat(path, dl_name); strcat(path, ".so.2");
+	*slash_p = '/';
+    } else {
+	strcpy(path, lc_dir); strcat(path, "/");
+#if defined POSTLOCALELIBDIR
+	strcat(path, POSTLOCALELIBDIR); strcat(path, "/");
+#endif
+	strcat(path, dl_name); strcat(path, ".so.2");
+    }
+    return path;
+}
+
+/* We reference count dlopen() and dlclose() of modules; unfortunately,
+ * since XCloseIM, XCloseOM, XlcClose aren't wrapped, but directly
+ * call the close method of the object, we leak a reference count every
+ * time we open then close a module. Fixing this would require
+ * either creating proxy objects or hooks for close_im/close_om
+ * in XLCd
+ */
+static Bool
+open_object(
+     XI18NObjectsList object,
+     char *lc_dir)
+{
+  char *path;
+
+  if (object->refcount == 0) {
+      path = __lc_path(object->dl_name, lc_dir);
+      if (!path)
+	  return False;
+#if defined(hpux)
+      object->dl_module = shl_load(path, BIND_DEFERRED, 0L);
+#else
+      object->dl_module = dlopen(path, RTLD_LAZY);
+#endif
+      Xfree(path);
+
+      if (!object->dl_module)
+	  return False;
+    }
+
+  object->refcount++;
+  return True;
+}
+
+static void *
+fetch_symbol(
+     XI18NObjectsList object,
+     char *symbol)
+{
+    void *result = NULL;
+#if defined(hpux)
+    int getsyms_cnt, i;
+    struct shl_symbol *symbols;
+#endif
+
+    if (symbol == NULL)
+    	return NULL;
+
+#if defined(hpux)
+    getsyms_cnt = shl_getsymbols(object->dl_module, TYPE_PROCEDURE,
+				 EXPORT_SYMBOLS, malloc, &symbols);
+
+    for(i=0; i<getsyms_cnt; i++) {
+        if(!strcmp(symbols[i].name, symbol)) {
+	    result = symbols[i].value;
+	    break;
+         }
+    }
+
+    if(getsyms_cnt > 0) {
+        free(symbols);
+    }
+#else
+    result = try_both_dlsym(object->dl_module, symbol);
+#endif
+
+    return result;
+}
+
+static void
+close_object(XI18NObjectsList object)
+{
+  object->refcount--;
+  if (object->refcount == 0)
+    {
+#if defined(hpux)
+        shl_unload(object->dl_module);
+#else
+        dlclose(object->dl_module);
+#endif
+        object->dl_module = NULL;
+    }
+}
+
+
+typedef XLCd (*dynamicLoadProc)(const char *);
+
+XLCd
+_XlcDynamicLoad(const char *lc_name)
+{
+    XLCd lcd = (XLCd)NULL;
+    dynamicLoadProc lc_loader = (dynamicLoadProc)NULL;
+    int count;
+    XI18NObjectsList objects_list;
+    char lc_dir[BUFSIZE], lc_lib_dir[BUFSIZE];
+
+    if (lc_name == NULL) return (XLCd)NULL;
+
+    if (_XlcLocaleDirName(lc_dir, BUFSIZE, (char *)lc_name) == (char *)NULL)
+        return (XLCd)NULL;
+    if (_XlcLocaleLibDirName(lc_lib_dir, BUFSIZE, (char *)lc_name) == (char*)NULL)
+	return (XLCd)NULL;
+
+    resolve_object(lc_dir, lc_name);
+    resolve_object(lc_lib_dir, lc_name);
+
+    objects_list = xi18n_objects_list;
+    count = lc_count;
+    for (; count-- > 0; objects_list++) {
+        if (objects_list->type != XLC_OBJECT ||
+	    strcmp(objects_list->locale_name, lc_name)) continue;
+	if (!open_object (objects_list, lc_dir) && \
+            !open_object (objects_list, lc_lib_dir))
+	    continue;
+
+	lc_loader = (dynamicLoadProc)fetch_symbol (objects_list, objects_list->open);
+	if (!lc_loader) continue;
+	lcd = (*lc_loader)(lc_name);
+	if (lcd != (XLCd)NULL) {
+	    break;
+	}
+
+	close_object (objects_list);
+    }
+    return (XLCd)lcd;
+}
+
+
+typedef XIM (*dynamicOpenProcp)(XLCd, Display *, XrmDatabase, char *, char *);
+
+static XIM
+_XDynamicOpenIM(XLCd lcd, Display *display, XrmDatabase rdb,
+		char *res_name, char *res_class)
+{
+  XIM im = (XIM)NULL;
+  char lc_dir[BUFSIZE];
+  char *lc_name;
+  dynamicOpenProcp im_openIM = (dynamicOpenProcp)NULL;
+  int count;
+  XI18NObjectsList objects_list = xi18n_objects_list;
+
+  lc_name = lcd->core->name;
+
+  if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XIM)0;
+
+  count = lc_count;
+  for (; count-- > 0; objects_list++) {
+    if (objects_list->type != XIM_OBJECT ||
+	strcmp(objects_list->locale_name, lc_name)) continue;
+
+    if (!open_object (objects_list, lc_dir))
+        continue;
+
+    im_openIM = (dynamicOpenProcp)fetch_symbol(objects_list, objects_list->open);
+    if (!im_openIM) continue;
+    im = (*im_openIM)(lcd, display, rdb, res_name, res_class);
+    if (im != (XIM)NULL) {
+        break;
+    }
+
+    close_object (objects_list);
+  }
+  return (XIM)im;
+}
+
+typedef Bool (*dynamicRegisterCBProcp)(
+    XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer);
+
+static Bool
+_XDynamicRegisterIMInstantiateCallback(
+    XLCd	 lcd,
+    Display	*display,
+    XrmDatabase	 rdb,
+    char	*res_name,
+    char        *res_class,
+    XIDProc	 callback,
+    XPointer	 client_data)
+{
+  char lc_dir[BUFSIZE];
+  char *lc_name;
+  dynamicRegisterCBProcp im_registerIM = (dynamicRegisterCBProcp)NULL;
+  Bool ret_flag = False;
+  int count;
+  XI18NObjectsList objects_list = xi18n_objects_list;
+#if defined(hpux)
+  int getsyms_cnt, i;
+  struct shl_symbol *symbols;
+#endif
+
+  lc_name = lcd->core->name;
+
+  if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False;
+
+  count = lc_count;
+  for (; count-- > 0; objects_list++) {
+    if (objects_list->type != XIM_OBJECT ||
+	strcmp(objects_list->locale_name, lc_name)) continue;
+
+    if (!open_object (objects_list, lc_dir))
+        continue;
+    im_registerIM = (dynamicRegisterCBProcp)fetch_symbol(objects_list,
+					    objects_list->im_register);
+    if (!im_registerIM) continue;
+    ret_flag = (*im_registerIM)(lcd, display, rdb,
+				res_name, res_class,
+				callback, client_data);
+    if (ret_flag) break;
+
+    close_object (objects_list);
+  }
+  return (Bool)ret_flag;
+}
+
+typedef Bool (*dynamicUnregisterProcp)(
+    XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer);
+
+static Bool
+_XDynamicUnRegisterIMInstantiateCallback(
+    XLCd	 lcd,
+    Display	*display,
+    XrmDatabase	 rdb,
+    char	*res_name,
+    char        *res_class,
+    XIDProc	 callback,
+    XPointer	 client_data)
+{
+  char lc_dir[BUFSIZE];
+  char *lc_name;
+  dynamicUnregisterProcp im_unregisterIM = (dynamicUnregisterProcp)NULL;
+  Bool ret_flag = False;
+  int count;
+  XI18NObjectsList objects_list = xi18n_objects_list;
+#if defined(hpux)
+  int getsyms_cnt, i;
+  struct shl_symbol *symbols;
+#endif
+
+  lc_name = lcd->core->name;
+  if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False;
+
+  count = lc_count;
+  for (; count-- > 0; objects_list++) {
+    if (objects_list->type != XIM_OBJECT ||
+	strcmp(objects_list->locale_name, lc_name)) continue;
+
+    if (!objects_list->refcount) /* Must already be opened */
+        continue;
+
+    im_unregisterIM = (dynamicUnregisterProcp)fetch_symbol(objects_list,
+					      objects_list->im_unregister);
+
+    if (!im_unregisterIM) continue;
+    ret_flag = (*im_unregisterIM)(lcd, display, rdb,
+				  res_name, res_class,
+				  callback, client_data);
+    if (ret_flag) {
+        close_object (objects_list); /* opened in RegisterIMInstantiateCallback */
+	break;
+    }
+  }
+  return (Bool)ret_flag;
+}
+
+Bool
+_XInitDynamicIM(XLCd lcd)
+{
+    if(lcd == (XLCd)NULL)
+	return False;
+    lcd->methods->open_im = _XDynamicOpenIM;
+    lcd->methods->register_callback = _XDynamicRegisterIMInstantiateCallback;
+    lcd->methods->unregister_callback = _XDynamicUnRegisterIMInstantiateCallback;
+    return True;
+}
+
+
+typedef XOM (*dynamicIOpenProcp)(
+        XLCd, Display *, XrmDatabase, _Xconst char *, _Xconst char *);
+
+static XOM
+_XDynamicOpenOM(XLCd lcd, Display *display, XrmDatabase rdb,
+		_Xconst char *res_name, _Xconst char *res_class)
+{
+  XOM om = (XOM)NULL;
+  int count;
+  char lc_dir[BUFSIZE];
+  char *lc_name;
+  dynamicIOpenProcp om_openOM = (dynamicIOpenProcp)NULL;
+  XI18NObjectsList objects_list = xi18n_objects_list;
+#if defined(hpux)
+  int getsyms_cnt, i;
+  struct shl_symbol *symbols;
+#endif
+
+  lc_name = lcd->core->name;
+
+  if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XOM)0;
+
+  count = lc_count;
+  for (; count-- > 0; objects_list++) {
+    if (objects_list->type != XOM_OBJECT ||
+	strcmp(objects_list->locale_name, lc_name)) continue;
+    if (!open_object (objects_list, lc_dir))
+        continue;
+
+    om_openOM = (dynamicIOpenProcp)fetch_symbol(objects_list, objects_list->open);
+    if (!om_openOM) continue;
+    om = (*om_openOM)(lcd, display, rdb, res_name, res_class);
+    if (om != (XOM)NULL) {
+        break;
+    }
+    close_object(objects_list);
+  }
+  return (XOM)om;
+}
+
+Bool
+_XInitDynamicOM(XLCd lcd)
+{
+    if(lcd == (XLCd)NULL)
+	return False;
+
+    lcd->methods->open_om = _XDynamicOpenOM;
+
+    return True;
+}
diff --git a/libX11/src/xlibi18n/lcCharSet.c b/libX11/src/xlibi18n/lcCharSet.c
index 0fa39d869..5d287811c 100644
--- a/libX11/src/xlibi18n/lcCharSet.c
+++ b/libX11/src/xlibi18n/lcCharSet.c
@@ -176,10 +176,9 @@ _XlcCreateDefaultCharSet(
     const char *colon;
     char *tmp;
 
-    charset = (XlcCharSet) Xmalloc(sizeof(XlcCharSetRec));
+    charset = Xcalloc(1, sizeof(XlcCharSetRec));
     if (charset == NULL)
 	return (XlcCharSet) NULL;
-    bzero((char *) charset, sizeof(XlcCharSetRec));
 
     name_len = strlen(name);
     ct_sequence_len = strlen(ct_sequence);
diff --git a/libX11/src/xlibi18n/lcDB.c b/libX11/src/xlibi18n/lcDB.c
index afff17455..97b22ac44 100644
--- a/libX11/src/xlibi18n/lcDB.c
+++ b/libX11/src/xlibi18n/lcDB.c
@@ -591,26 +591,23 @@ store_to_database(
 	goto err;
     }
 
-    new = (Database)Xmalloc(sizeof(DatabaseRec));
+    new = Xcalloc(1, sizeof(DatabaseRec));
     if (new == (Database)NULL) {
 	goto err;
     }
-    bzero(new, sizeof(DatabaseRec));
 
-    new->category = (char *)Xmalloc(strlen(parse_info.category) + 1);
+    new->category = strdup(parse_info.category);
     if (new->category == NULL) {
 	goto err;
     }
-    strcpy(new->category, parse_info.category);
 
     if (! construct_name(name, sizeof(name))) {
 	goto err;
     }
-    new->name = (char *)Xmalloc(strlen(name) + 1);
+    new->name = strdup(name);
     if (new->name == NULL) {
 	goto err;
     }
-    strcpy(new->name, name);
     new->next = *db;
     new->value = parse_info.value;
     new->value_num = parse_info.value_num;
@@ -944,10 +941,9 @@ f_default(
     case S_NULL:
 	if (parse_info.category != NULL)
 	    goto err;
-	p = (char *)Xmalloc(strlen(wordp) + 1);
+	p = strdup(wordp);
 	if (p == NULL)
 	    goto err;
-	strcpy(p, wordp);
 	parse_info.category = p;
 	parse_info.pre_state = S_CATEGORY;
 	break;
@@ -961,10 +957,9 @@ f_default(
 		break;
 	    }
 	}
-	p = (char *)Xmalloc(strlen(wordp) + 1);
+	p = strdup(wordp);
 	if (p == NULL)
 	    goto err;
-	strcpy(p, wordp);
 	if (parse_info.name[parse_info.nest_depth] != NULL) {
 	    Xfree(parse_info.name[parse_info.nest_depth]);
 	}
@@ -1309,10 +1304,9 @@ _XlcCreateLocaleDataBase(
 	return (XPointer)NULL;
     }
     n = CountDatabase(database);
-    lc_db = (XlcDatabase)Xmalloc(sizeof(XlcDatabaseRec) * (n + 1));
+    lc_db = Xcalloc(n + 1, sizeof(XlcDatabaseRec));
     if (lc_db == (XlcDatabase)NULL)
 	goto err;
-    bzero(lc_db, sizeof(XlcDatabaseRec) * (n + 1));
     for (p = database, i = 0; p && i < n; p = p->next, ++i) {
 	lc_db[i].category_q = XrmStringToQuark(p->category);
 	lc_db[i].name_q = XrmStringToQuark(p->name);
diff --git a/libX11/src/xlibi18n/lcFile.c b/libX11/src/xlibi18n/lcFile.c
index 18756c1ca..4e4439773 100644
--- a/libX11/src/xlibi18n/lcFile.c
+++ b/libX11/src/xlibi18n/lcFile.c
@@ -423,10 +423,7 @@ resolve_name(
 	    from = args[1], to = args[0];	/* right to left */
 	}
 	if (! strcmp(from, lc_name)) {
-	    name = Xmalloc(strlen(to) + 1);
-	    if (name != NULL) {
-		strcpy(name, to);
-	    }
+	    name = strdup(to);
 	    break;
 	}
     }
@@ -579,8 +576,7 @@ _XlcResolveLocaleName(
 
     if (name == NULL) {
 	/* vendor locale name == Xlocale name, no expansion of alias */
-	pub->siname = Xmalloc (strlen (lc_name) + 1);
-	strcpy (pub->siname, lc_name);
+	pub->siname = strdup (lc_name);
     } else {
 	pub->siname = name;
     }
@@ -729,8 +725,7 @@ _XlcLocaleDirName(char *dir_name, size_t dir_len, char *lc_name)
     last_dir_len = strlen (dir_name) + 1;
     last_dir_name = Xmalloc (last_dir_len);
     strcpy (last_dir_name, dir_name);
-    last_lc_name = Xmalloc (strlen (lc_name) + 1);
-    strcpy (last_lc_name, lc_name);
+    last_lc_name = strdup (lc_name);
 
     return dir_name;
 }
@@ -828,8 +823,7 @@ _XlcLocaleLibDirName(char *dir_name, size_t dir_len, char *lc_name)
     last_dir_len = strlen (dir_name) + 1;
     last_dir_name = Xmalloc (last_dir_len);
     strcpy (last_dir_name, dir_name);
-    last_lc_name = Xmalloc (strlen (lc_name) + 1);
-    strcpy (last_lc_name, lc_name);
+    last_lc_name = strdup (lc_name);
 
     return dir_name;
 }
diff --git a/libX11/src/xlibi18n/lcGeneric.c b/libX11/src/xlibi18n/lcGeneric.c
index 688a4cfc4..619cb47f9 100644
--- a/libX11/src/xlibi18n/lcGeneric.c
+++ b/libX11/src/xlibi18n/lcGeneric.c
@@ -60,15 +60,13 @@ create(
     XLCd lcd;
     XLCdPublicMethods new;
 
-    lcd = (XLCd) Xmalloc(sizeof(XLCdRec));
+    lcd = Xcalloc(1, sizeof(XLCdRec));
     if (lcd == NULL)
         return (XLCd) NULL;
-    bzero((char *) lcd, sizeof(XLCdRec));
 
-    lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdGenericRec));
+    lcd->core = Xcalloc(1, sizeof(XLCdGenericRec));
     if (lcd->core == NULL)
 	goto err;
-    bzero((char *) lcd->core, sizeof(XLCdGenericRec));
 
     new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
     if (new == NULL)
@@ -180,10 +178,9 @@ add_codeset(
     CodeSet new, *new_list;
     int num;
 
-    new = (CodeSet) Xmalloc(sizeof(CodeSetRec));
+    new = Xcalloc(1, sizeof(CodeSetRec));
     if (new == NULL)
         return NULL;
-    bzero((char *) new, sizeof(CodeSetRec));
 
     if ((num = gen->codeset_num))
         new_list = (CodeSet *) Xrealloc(gen->codeset_list,
@@ -218,21 +215,18 @@ add_parse_list(
     unsigned char ch;
     int num;
 
-    str = (char *) Xmalloc(strlen(encoding) + 1);
+    str = strdup(encoding);
     if (str == NULL)
         return False;
-    strcpy(str, encoding);
 
-    new = (ParseInfo) Xmalloc(sizeof(ParseInfoRec));
+    new = Xcalloc(1, sizeof(ParseInfoRec));
     if (new == NULL)
         goto err;
-    bzero((char *) new, sizeof(ParseInfoRec));
 
     if (gen->mb_parse_table == NULL) {
-        gen->mb_parse_table = (unsigned char *) Xmalloc(256); /* 2^8 */
+        gen->mb_parse_table = Xcalloc(1, 256); /* 2^8 */
         if (gen->mb_parse_table == NULL)
             goto err;
-        bzero((char *) gen->mb_parse_table, 256);
     }
 
     if ((num = gen->mb_parse_list_num))
@@ -468,10 +462,9 @@ read_charset_define(
                 break;
         }
         if (new) {
-            tmp = (char *)Xmalloc(strlen(cset_name)+1);
+            tmp = strdup(cset_name);
             if (tmp == NULL)
                 return;
-            strcpy(tmp,cset_name);
             charsetd->name = tmp;
         }
         /* side   */
@@ -527,8 +520,7 @@ read_charset_define(
                 Xfree(charsetd->encoding_name);
             }
 */
-            tmp = (char *)Xmalloc(strlen(value[0])+1);
-            strcpy(tmp,value[0]);
+            tmp = strdup(value[0]);
             charsetd->encoding_name = tmp;
             charsetd->xrm_encoding_name = XrmStringToQuark(tmp);
         }
@@ -598,10 +590,9 @@ read_segmentconversion(
         if (num > 0) {
             char *tmp;
             _XlcDbg_printValue(name,value,num);
-            tmp = (char *)Xmalloc(strlen(value[0])+1);
+            tmp = strdup(value[0]);
             if (tmp == NULL)
                 return;
-            strcpy(tmp,value[0]);
             conversion->source_encoding = tmp;
             conversion->source = srch_charset_define(tmp,&new);
         }
@@ -611,10 +602,9 @@ read_segmentconversion(
         if (num > 0) {
             char *tmp;
             _XlcDbg_printValue(name,value,num);
-            tmp = (char *)Xmalloc(strlen(value[0])+1);
+            tmp = strdup(value[0]);
             if (tmp == NULL)
                 return;
-            strcpy(tmp,value[0]);
             conversion->destination_encoding = tmp;
             conversion->dest = srch_charset_define(tmp,&new);
         }
@@ -650,12 +640,11 @@ create_ctextseg(
     ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec));
     if (ret == NULL)
         return NULL;
-    ret->name = (char *)Xmalloc(strlen(value[0]) + 1);
+    ret->name = strdup(value[0]);
     if (ret->name == NULL) {
         Xfree (ret);
         return NULL;
     }
-    strcpy(ret->name,value[0]);
     cset_name = (char*) Xmalloc (strlen(ret->name) + 1);
     if (cset_name == NULL) {
         Xfree (ret->name);
diff --git a/libX11/src/xlibi18n/lcPublic.c b/libX11/src/xlibi18n/lcPublic.c
index 2c02f5fba..1b1fb548a 100644
--- a/libX11/src/xlibi18n/lcPublic.c
+++ b/libX11/src/xlibi18n/lcPublic.c
@@ -80,15 +80,13 @@ create(
     XLCd lcd;
     XLCdPublicMethods new;
 
-    lcd = (XLCd) Xmalloc(sizeof(XLCdRec));
+    lcd = Xcalloc(1, sizeof(XLCdRec));
     if (lcd == NULL)
         return (XLCd) NULL;
-    bzero((char *) lcd, sizeof(XLCdRec));
 
-    lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdPublicRec));
+    lcd->core = Xcalloc(1, sizeof(XLCdPublicRec));
     if (lcd->core == NULL)
 	goto err;
-    bzero((char *) lcd->core, sizeof(XLCdPublicRec));
 
     new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
     if (new == NULL)
@@ -130,10 +128,9 @@ load_public(
 
     _XlcGetResource(lcd, "XLC_XLOCALE", "encoding_name", &values, &num);
     str = (num > 0) ? values[0] : "STRING";
-    pub->encoding_name = (char*) Xmalloc(strlen(str) + 1);
+    pub->encoding_name = strdup(str);
     if (pub->encoding_name == NULL)
 	return False;
-    strcpy(pub->encoding_name, str);
 
     return True;
 }
diff --git a/mesalib/Makefile b/mesalib/Makefile
index 8c926bda6..41d1654b4 100644
--- a/mesalib/Makefile
+++ b/mesalib/Makefile
@@ -1,502 +1,519 @@
-# Top-level Mesa makefile
-
-TOP = .
-
-SUBDIRS = src
-
-
-# The git command below generates an empty string when we're not
-# building in a GIT tree (i.e., building from a release tarball).
-default: $(TOP)/configs/current
-	@$(TOP)/bin/extract_git_sha1
-	@for dir in $(SUBDIRS) ; do \
-		if [ -d $$dir ] ; then \
-			(cd $$dir && $(MAKE)) || exit 1 ; \
-		fi \
-	done
-
-all: default
-
-
-doxygen:
-	cd doxygen && $(MAKE)
-
-clean:
-	-@touch $(TOP)/configs/current
-	-@for dir in $(SUBDIRS) ; do \
-		if [ -d $$dir ] ; then \
-			(cd $$dir && $(MAKE) clean) ; \
-		fi \
-	done
-	-@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current
-
-
-realclean: clean
-	-rm -rf lib*
-	-rm -f $(TOP)/configs/current
-	-rm -f $(TOP)/configs/autoconf
-	-rm -rf autom4te.cache
-	-find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
-	  -name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
-
-
-distclean: realclean
-
-
-install:
-	@for dir in $(SUBDIRS) ; do \
-		if [ -d $$dir ] ; then \
-			(cd $$dir && $(MAKE) install) || exit 1 ; \
-		fi \
-	done
-
-
-.PHONY: default doxygen clean realclean distclean install
-
-# If there's no current configuration file
-$(TOP)/configs/current:
-	@echo
-	@echo
-	@echo "Please choose a configuration from the following list:"
-	@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*"
-	@echo
-	@echo "Then type 'make <config>' (ex: 'make linux-x86')"
-	@echo
-	@echo "Or, run './configure' then 'make'"
-	@echo "See './configure --help' for details"
-	@echo
-	@echo "(ignore the following error message)"
-	@exit 1
-
-
-# Rules to set/install a specific build configuration
-aix \
-aix-64 \
-aix-64-static \
-aix-gcc \
-aix-static \
-autoconf \
-bluegene-osmesa \
-bluegene-xlc-osmesa \
-beos \
-catamount-osmesa-pgi \
-darwin \
-darwin-fat-32bit \
-darwin-fat-all \
-freebsd \
-freebsd-dri \
-freebsd-dri-amd64 \
-freebsd-dri-x86 \
-hpux10 \
-hpux10-gcc \
-hpux10-static \
-hpux11-32 \
-hpux11-32-static \
-hpux11-32-static-nothreads \
-hpux11-64 \
-hpux11-64-static \
-hpux11-ia64 \
-hpux11-ia64-static \
-hpux9 \
-hpux9-gcc \
-irix6-64 \
-irix6-64-static \
-irix6-n32 \
-irix6-n32-static \
-irix6-o32 \
-irix6-o32-static \
-linux \
-linux-i965 \
-linux-alpha \
-linux-alpha-static \
-linux-cell \
-linux-cell-debug \
-linux-debug \
-linux-dri \
-linux-dri-debug \
-linux-dri-x86 \
-linux-dri-x86-64 \
-linux-dri-ppc \
-linux-dri-xcb \
-linux-egl \
-linux-indirect \
-linux-fbdev \
-linux-ia64-icc \
-linux-ia64-icc-static \
-linux-icc \
-linux-icc-static \
-linux-llvm \
-linux-llvm-debug \
-linux-opengl-es \
-linux-osmesa \
-linux-osmesa-static \
-linux-osmesa16 \
-linux-osmesa16-static \
-linux-osmesa32 \
-linux-ppc \
-linux-ppc-static \
-linux-profile \
-linux-sparc \
-linux-sparc5 \
-linux-static \
-linux-ultrasparc \
-linux-tcc \
-linux-x86 \
-linux-x86-debug \
-linux-x86-32 \
-linux-x86-64 \
-linux-x86-64-debug \
-linux-x86-64-profile \
-linux-x86-64-static \
-linux-x86-profile \
-linux-x86-static \
-netbsd \
-openbsd \
-osf1 \
-osf1-static \
-solaris-x86 \
-solaris-x86-gcc \
-solaris-x86-gcc-static \
-sunos4 \
-sunos4-gcc \
-sunos4-static \
-sunos5 \
-sunos5-gcc \
-sunos5-64-gcc \
-sunos5-smp \
-sunos5-v8 \
-sunos5-v8-static \
-sunos5-v9 \
-sunos5-v9-static \
-sunos5-v9-cc-g++ \
-ultrix-gcc:
-	@ if test -f configs/current -o -L configs/current; then \
-		if ! cmp configs/$@ configs/current > /dev/null; then \
-			echo "Please run 'make realclean' before changing configs" ; \
-			exit 1 ; \
-		fi ; \
-	else \
-		cd configs && rm -f current && ln -s $@ current ; \
-	fi
-	$(MAKE) default
-
-
-# Rules for making release tarballs
-
-VERSION=7.11-devel
-DIRECTORY = Mesa-$(VERSION)
-LIB_NAME = MesaLib-$(VERSION)
-GLUT_NAME = MesaGLUT-$(VERSION)
-
-# This is part of MAIN_FILES
-MAIN_ES_FILES = \
-	$(DIRECTORY)/src/mesa/main/*.xml				\
-	$(DIRECTORY)/src/mesa/main/*.py					\
-	$(DIRECTORY)/src/mesa/main/*.dtd
-
-MAIN_FILES = \
-	$(DIRECTORY)/Makefile*						\
-	$(DIRECTORY)/configure						\
-	$(DIRECTORY)/configure.ac					\
-	$(DIRECTORY)/acinclude.m4					\
-	$(DIRECTORY)/aclocal.m4						\
-	$(DIRECTORY)/bin/config.guess					\
-	$(DIRECTORY)/bin/config.sub					\
-	$(DIRECTORY)/bin/extract_git_sha1				\
-	$(DIRECTORY)/bin/install-sh					\
-	$(DIRECTORY)/bin/mklib						\
-	$(DIRECTORY)/bin/minstall					\
-	$(DIRECTORY)/bin/version.mk					\
-	$(DIRECTORY)/configs/[a-z]*					\
-	$(DIRECTORY)/docs/*.html					\
-	$(DIRECTORY)/docs/COPYING					\
-	$(DIRECTORY)/docs/README.*					\
-	$(DIRECTORY)/docs/RELNOTES*					\
-	$(DIRECTORY)/docs/*.spec					\
-	$(DIRECTORY)/include/GL/gl.h					\
-	$(DIRECTORY)/include/GL/glext.h					\
-	$(DIRECTORY)/include/GL/gl_mangle.h				\
-	$(DIRECTORY)/include/GL/glu.h					\
-	$(DIRECTORY)/include/GL/glu_mangle.h				\
-	$(DIRECTORY)/include/GL/glx.h					\
-	$(DIRECTORY)/include/GL/glxext.h				\
-	$(DIRECTORY)/include/GL/glx_mangle.h				\
-	$(DIRECTORY)/include/GL/glfbdev.h				\
-	$(DIRECTORY)/include/GL/mesa_wgl.h				\
-	$(DIRECTORY)/include/GL/osmesa.h				\
-	$(DIRECTORY)/include/GL/vms_x_fix.h				\
-	$(DIRECTORY)/include/GL/wglext.h				\
-	$(DIRECTORY)/include/GL/wmesa.h					\
-	$(DIRECTORY)/src/glsl/Makefile					\
-	$(DIRECTORY)/src/glsl/Makefile.template				\
-	$(DIRECTORY)/src/glsl/SConscript				\
-	$(DIRECTORY)/src/glsl/*.[ch]					\
-	$(DIRECTORY)/src/glsl/*.[cly]pp					\
-	$(DIRECTORY)/src/glsl/README					\
-	$(DIRECTORY)/src/glsl/glcpp/*.[chly]				\
-	$(DIRECTORY)/src/glsl/glcpp/README				\
-	$(DIRECTORY)/src/glsl/builtins					\
-	$(DIRECTORY)/src/Makefile					\
-	$(DIRECTORY)/src/mesa/Makefile*					\
-	$(DIRECTORY)/src/mesa/sources.mak				\
-	$(DIRECTORY)/src/mesa/descrip.mms				\
-	$(DIRECTORY)/src/mesa/gl.pc.in					\
-	$(DIRECTORY)/src/mesa/osmesa.pc.in				\
-	$(DIRECTORY)/src/mesa/depend					\
-	$(MAIN_ES_FILES)						\
-	$(DIRECTORY)/src/mesa/main/*.[chS]				\
-	$(DIRECTORY)/src/mesa/main/descrip.mms				\
-	$(DIRECTORY)/src/mesa/math/*.[ch]				\
-	$(DIRECTORY)/src/mesa/math/descrip.mms				\
-	$(DIRECTORY)/src/mesa/program/*.[chly]				\
-	$(DIRECTORY)/src/mesa/program/*.cpp				\
-	$(DIRECTORY)/src/mesa/program/Makefile				\
-	$(DIRECTORY)/src/mesa/program/descrip.mms			\
-	$(DIRECTORY)/src/mesa/swrast/*.[ch]				\
-	$(DIRECTORY)/src/mesa/swrast/descrip.mms			\
-	$(DIRECTORY)/src/mesa/swrast_setup/*.[ch]			\
-	$(DIRECTORY)/src/mesa/swrast_setup/descrip.mms			\
-	$(DIRECTORY)/src/mesa/vbo/*.[chS]				\
-	$(DIRECTORY)/src/mesa/vbo/descrip.mms				\
-	$(DIRECTORY)/src/mesa/tnl/*.[chS]				\
-	$(DIRECTORY)/src/mesa/tnl/descrip.mms				\
-	$(DIRECTORY)/src/mesa/tnl_dd/*.[ch]				\
-	$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch]				\
-	$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm			\
-	$(DIRECTORY)/src/mesa/drivers/Makefile				\
-	$(DIRECTORY)/src/mesa/drivers/beos/*.cpp			\
-	$(DIRECTORY)/src/mesa/drivers/beos/Makefile			\
-	$(DIRECTORY)/src/mesa/drivers/common/*.[ch]			\
-	$(DIRECTORY)/src/mesa/drivers/common/descrip.mms		\
-	$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile			\
-	$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c			\
-	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile			\
-	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win		\
-	$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms		\
-	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def			\
-	$(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch]			\
-	$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch]			\
-	$(DIRECTORY)/src/mesa/drivers/windows/*/*.def			\
-	$(DIRECTORY)/src/mesa/drivers/x11/Makefile			\
-	$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms			\
-	$(DIRECTORY)/src/mesa/drivers/x11/*.[ch]			\
-	$(DIRECTORY)/src/mesa/ppc/*.[ch]				\
-	$(DIRECTORY)/src/mesa/sparc/*.[chS]				\
-	$(DIRECTORY)/src/mesa/x86/Makefile				\
-	$(DIRECTORY)/src/mesa/x86/*.[ch]				\
-	$(DIRECTORY)/src/mesa/x86/*.S					\
-	$(DIRECTORY)/src/mesa/x86/rtasm/*.[ch]				\
-	$(DIRECTORY)/src/mesa/x86-64/*.[chS]				\
-	$(DIRECTORY)/src/mesa/x86-64/Makefile
-
-MAPI_FILES = \
-	$(DIRECTORY)/include/GLES/*.h					\
-	$(DIRECTORY)/include/GLES2/*.h					\
-	$(DIRECTORY)/include/VG/*.h					\
-	$(DIRECTORY)/src/mapi/es?api/Makefile				\
-	$(DIRECTORY)/src/mapi/es?api/*.pc.in				\
-	$(DIRECTORY)/src/mapi/glapi/gen/Makefile			\
-	$(DIRECTORY)/src/mapi/glapi/gen/*.xml				\
-	$(DIRECTORY)/src/mapi/glapi/gen/*.py				\
-	$(DIRECTORY)/src/mapi/glapi/gen/*.dtd				\
-	$(DIRECTORY)/src/mapi/glapi/gen-es/Makefile			\
-	$(DIRECTORY)/src/mapi/glapi/gen-es/*.xml			\
-	$(DIRECTORY)/src/mapi/glapi/gen-es/*.py				\
-	$(DIRECTORY)/src/mapi/glapi/Makefile				\
-	$(DIRECTORY)/src/mapi/glapi/SConscript				\
-	$(DIRECTORY)/src/mapi/glapi/sources.mak				\
-	$(DIRECTORY)/src/mapi/glapi/*.[chS]				\
-	$(DIRECTORY)/src/mapi/mapi/mapi_abi.py				\
-	$(DIRECTORY)/src/mapi/mapi/sources.mak				\
-	$(DIRECTORY)/src/mapi/mapi/*.[ch]				\
-	$(DIRECTORY)/src/mapi/vgapi/Makefile				\
-	$(DIRECTORY)/src/mapi/vgapi/vgapi.csv				\
-	$(DIRECTORY)/src/mapi/vgapi/vg.pc.in
-
-EGL_FILES = \
-	$(DIRECTORY)/include/KHR/*.h					\
-	$(DIRECTORY)/include/EGL/*.h					\
-	$(DIRECTORY)/src/egl/Makefile					\
-	$(DIRECTORY)/src/egl/*/Makefile					\
-	$(DIRECTORY)/src/egl/*/Makefile.template			\
-	$(DIRECTORY)/src/egl/*/*.[ch]					\
-	$(DIRECTORY)/src/egl/*/*/Makefile				\
-	$(DIRECTORY)/src/egl/*/*/*.[ch]					\
-	$(DIRECTORY)/src/egl/main/*.pc.in				\
-	$(DIRECTORY)/src/egl/main/*.def
-
-GALLIUM_FILES = \
-	$(DIRECTORY)/src/mesa/state_tracker/*[ch]			\
-	$(DIRECTORY)/src/gallium/Makefile				\
-	$(DIRECTORY)/src/gallium/Makefile.template			\
-	$(DIRECTORY)/src/gallium/SConscript				\
-	$(DIRECTORY)/src/gallium/targets/Makefile.dri			\
-	$(DIRECTORY)/src/gallium/targets/Makefile.xorg			\
-	$(DIRECTORY)/src/gallium/targets/SConscript.dri			\
-	$(DIRECTORY)/src/gallium/*/Makefile				\
-	$(DIRECTORY)/src/gallium/*/SConscript				\
-	$(DIRECTORY)/src/gallium/*/*/Makefile				\
-	$(DIRECTORY)/src/gallium/*/*/SConscript				\
-	$(DIRECTORY)/src/gallium/*/*/*.[ch]				\
-	$(DIRECTORY)/src/gallium/auxiliary/gallivm/*.cpp		\
-	$(DIRECTORY)/src/gallium/*/*/*.py				\
-	$(DIRECTORY)/src/gallium/*/*/*.csv				\
-	$(DIRECTORY)/src/gallium/*/*/*/Makefile				\
-	$(DIRECTORY)/src/gallium/*/*/*/SConscript			\
-	$(DIRECTORY)/src/gallium/*/*/*/*.[ch]				\
-	$(DIRECTORY)/src/gallium/*/*/*/*.py
-
-
-DRI_FILES = \
-	$(DIRECTORY)/include/GL/internal/dri_interface.h		\
-	$(DIRECTORY)/include/GL/internal/sarea.h			\
-	$(DIRECTORY)/src/glx/Makefile					\
-	$(DIRECTORY)/src/glx/*.[ch]					\
-	$(DIRECTORY)/src/mesa/drivers/dri/Makefile			\
-	$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template		\
-	$(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in			\
-	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po		\
-	$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS]			\
-	$(DIRECTORY)/src/mesa/drivers/dri/*/*.cpp			\
-	$(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS]			\
-	$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile			\
-	$(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile			\
-	$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile
-
-SGI_GLU_FILES = \
-	$(DIRECTORY)/src/glu/Makefile					\
-	$(DIRECTORY)/src/glu/glu.pc.in					\
-	$(DIRECTORY)/src/glu/sgi/Makefile				\
-	$(DIRECTORY)/src/glu/sgi/Makefile.mgw				\
-	$(DIRECTORY)/src/glu/sgi/Makefile.win				\
-	$(DIRECTORY)/src/glu/sgi/glu.def				\
-	$(DIRECTORY)/src/glu/sgi/dummy.cc				\
-	$(DIRECTORY)/src/glu/sgi/glu.exports				\
-	$(DIRECTORY)/src/glu/sgi/glu.exports.darwin			\
-	$(DIRECTORY)/src/glu/sgi/mesaglu.opt				\
-	$(DIRECTORY)/src/glu/sgi/include/gluos.h			\
-	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.h			\
-	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.cc		\
-	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.h			\
-	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.cc		\
-	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.h			\
-	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.cc			\
-	$(DIRECTORY)/src/glu/sgi/libtess/README				\
-	$(DIRECTORY)/src/glu/sgi/libtess/alg-outline			\
-	$(DIRECTORY)/src/glu/sgi/libtess/*.[ch]				\
-	$(DIRECTORY)/src/glu/sgi/libutil/*.[ch]
-
-GLW_FILES = \
-	$(DIRECTORY)/src/glw/*.[ch]			\
-	$(DIRECTORY)/src/glw/Makefile*			\
-	$(DIRECTORY)/src/glw/README			\
-	$(DIRECTORY)/src/glw/glw.pc.in			\
-	$(DIRECTORY)/src/glw/depend
-
-GLUT_FILES = \
-	$(DIRECTORY)/include/GL/glut.h			\
-	$(DIRECTORY)/include/GL/glutf90.h		\
-	$(DIRECTORY)/src/glut/glx/Makefile*		\
-	$(DIRECTORY)/src/glut/glx/depend		\
-	$(DIRECTORY)/src/glut/glx/glut.pc.in		\
-	$(DIRECTORY)/src/glut/glx/*def			\
-	$(DIRECTORY)/src/glut/glx/*.[ch]		\
-	$(DIRECTORY)/src/glut/beos/*.[ch]		\
-	$(DIRECTORY)/src/glut/beos/*.cpp		\
-	$(DIRECTORY)/src/glut/beos/Makefile
-
-DEPEND_FILES = \
-	$(TOP)/src/mesa/depend		\
-	$(TOP)/src/glx/depend		\
-	$(TOP)/src/glw/depend		\
-	$(TOP)/src/glut/glx/depend	\
-	$(TOP)/src/glu/sgi/depend
-
-
-LIB_FILES = \
-	$(MAIN_FILES)		\
-	$(MAPI_FILES)		\
-	$(ES_FILES)		\
-	$(EGL_FILES)		\
-	$(GALLIUM_FILES)	\
-	$(DRI_FILES)		\
-	$(SGI_GLU_FILES)	\
-	$(GLW_FILES)
-
-
-parsers: configure
-	-@touch $(TOP)/configs/current
-	$(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp
-	$(MAKE) -C src/glsl/glcpp glcpp-lex.c glcpp-parse.c glcpp-parse.h
-	$(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c program_parse.tab.h
-
-# Everything for new a Mesa release:
-ARCHIVES = $(LIB_NAME).tar.gz \
-	$(LIB_NAME).tar.bz2 \
-	$(LIB_NAME).zip \
-	$(GLUT_NAME).tar.gz \
-	$(GLUT_NAME).tar.bz2 \
-	$(GLUT_NAME).zip
-
-tarballs: md5
-	rm -f ../$(LIB_NAME).tar
-
-# Helper for autoconf builds
-ACLOCAL = aclocal
-ACLOCAL_FLAGS =
-AUTOCONF = autoconf
-AC_FLAGS =
-aclocal.m4: configure.ac acinclude.m4
-	$(ACLOCAL) $(ACLOCAL_FLAGS)
-configure: rm_depend configure.ac aclocal.m4 acinclude.m4
-	$(AUTOCONF) $(AC_FLAGS)
-
-rm_depend:
-	@for dep in $(DEPEND_FILES) ; do \
-		rm -f $$dep ; \
-		touch $$dep ; \
-	done
-
-rm_config: parsers
-	rm -f configs/current
-	rm -f configs/autoconf
-
-$(LIB_NAME).tar: rm_config
-	cd .. ; tar -cf $(DIRECTORY)/$(LIB_NAME).tar $(LIB_FILES)
-
-$(LIB_NAME).tar.gz: $(LIB_NAME).tar
-	gzip --stdout --best $(LIB_NAME).tar > $(LIB_NAME).tar.gz
-
-$(GLUT_NAME).tar: rm_depend
-	cd .. ; tar -cf $(DIRECTORY)/$(GLUT_NAME).tar $(GLUT_FILES)
-
-$(GLUT_NAME).tar.gz: $(GLUT_NAME).tar
-	gzip --stdout --best $(GLUT_NAME).tar > $(GLUT_NAME).tar.gz
-
-$(LIB_NAME).tar.bz2: $(LIB_NAME).tar
-	bzip2 --stdout --best $(LIB_NAME).tar > $(LIB_NAME).tar.bz2
-
-$(GLUT_NAME).tar.bz2: $(GLUT_NAME).tar
-	bzip2 --stdout --best $(GLUT_NAME).tar > $(GLUT_NAME).tar.bz2
-
-$(LIB_NAME).zip: rm_config
-	rm -f $(LIB_NAME).zip ; \
-	cd .. ; \
-	zip -qr $(LIB_NAME).zip $(LIB_FILES) ; \
-	mv $(LIB_NAME).zip $(DIRECTORY)
-
-$(GLUT_NAME).zip:
-	rm -f $(GLUT_NAME).zip ; \
-	cd .. ; \
-	zip -qr $(GLUT_NAME).zip $(GLUT_FILES) ; \
-	mv $(GLUT_NAME).zip $(DIRECTORY)
-
-md5: $(ARCHIVES)
-	@-md5sum $(LIB_NAME).tar.gz
-	@-md5sum $(LIB_NAME).tar.bz2
-	@-md5sum $(LIB_NAME).zip
-	@-md5sum $(GLUT_NAME).tar.gz
-	@-md5sum $(GLUT_NAME).tar.bz2
-	@-md5sum $(GLUT_NAME).zip
-
-.PHONY: tarballs rm_depend rm_config md5
+# Top-level Mesa makefile
+
+TOP = .
+
+SUBDIRS = src
+
+
+# The git command below generates an empty string when we're not
+# building in a GIT tree (i.e., building from a release tarball).
+default: $(TOP)/configs/current
+	@$(TOP)/bin/extract_git_sha1
+	@for dir in $(SUBDIRS) ; do \
+		if [ -d $$dir ] ; then \
+			(cd $$dir && $(MAKE)) || exit 1 ; \
+		fi \
+	done
+
+all: default
+
+
+doxygen:
+	cd doxygen && $(MAKE)
+
+clean:
+	-@touch $(TOP)/configs/current
+	-@for dir in $(SUBDIRS) ; do \
+		if [ -d $$dir ] ; then \
+			(cd $$dir && $(MAKE) clean) ; \
+		fi \
+	done
+	-@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current
+
+
+realclean: clean
+	-rm -rf lib*
+	-rm -f $(TOP)/configs/current
+	-rm -f $(TOP)/configs/autoconf
+	-rm -rf autom4te.cache
+	-find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
+	  -name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
+
+
+distclean: realclean
+
+
+install:
+	@for dir in $(SUBDIRS) ; do \
+		if [ -d $$dir ] ; then \
+			(cd $$dir && $(MAKE) install) || exit 1 ; \
+		fi \
+	done
+
+
+.PHONY: default doxygen clean realclean distclean install
+
+# If there's no current configuration file
+$(TOP)/configs/current:
+	@echo
+	@echo
+	@echo "Please choose a configuration from the following list:"
+	@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*"
+	@echo
+	@echo "Then type 'make <config>' (ex: 'make linux-x86')"
+	@echo
+	@echo "Or, run './configure' then 'make'"
+	@echo "See './configure --help' for details"
+	@echo
+	@echo "(ignore the following error message)"
+	@exit 1
+
+
+# Rules to set/install a specific build configuration
+aix \
+aix-64 \
+aix-64-static \
+aix-gcc \
+aix-static \
+autoconf \
+bluegene-osmesa \
+bluegene-xlc-osmesa \
+beos \
+catamount-osmesa-pgi \
+darwin \
+darwin-fat-32bit \
+darwin-fat-all \
+freebsd \
+freebsd-dri \
+freebsd-dri-amd64 \
+freebsd-dri-x86 \
+hpux10 \
+hpux10-gcc \
+hpux10-static \
+hpux11-32 \
+hpux11-32-static \
+hpux11-32-static-nothreads \
+hpux11-64 \
+hpux11-64-static \
+hpux11-ia64 \
+hpux11-ia64-static \
+hpux9 \
+hpux9-gcc \
+irix6-64 \
+irix6-64-static \
+irix6-n32 \
+irix6-n32-static \
+irix6-o32 \
+irix6-o32-static \
+linux \
+linux-i965 \
+linux-alpha \
+linux-alpha-static \
+linux-cell \
+linux-cell-debug \
+linux-debug \
+linux-dri \
+linux-dri-debug \
+linux-dri-x86 \
+linux-dri-x86-64 \
+linux-dri-ppc \
+linux-dri-xcb \
+linux-egl \
+linux-indirect \
+linux-fbdev \
+linux-ia64-icc \
+linux-ia64-icc-static \
+linux-icc \
+linux-icc-static \
+linux-llvm \
+linux-llvm-debug \
+linux-opengl-es \
+linux-osmesa \
+linux-osmesa-static \
+linux-osmesa16 \
+linux-osmesa16-static \
+linux-osmesa32 \
+linux-ppc \
+linux-ppc-static \
+linux-profile \
+linux-sparc \
+linux-sparc5 \
+linux-static \
+linux-ultrasparc \
+linux-tcc \
+linux-x86 \
+linux-x86-debug \
+linux-x86-32 \
+linux-x86-64 \
+linux-x86-64-debug \
+linux-x86-64-profile \
+linux-x86-64-static \
+linux-x86-profile \
+linux-x86-static \
+netbsd \
+openbsd \
+osf1 \
+osf1-static \
+solaris-x86 \
+solaris-x86-gcc \
+solaris-x86-gcc-static \
+sunos4 \
+sunos4-gcc \
+sunos4-static \
+sunos5 \
+sunos5-gcc \
+sunos5-64-gcc \
+sunos5-smp \
+sunos5-v8 \
+sunos5-v8-static \
+sunos5-v9 \
+sunos5-v9-static \
+sunos5-v9-cc-g++ \
+ultrix-gcc:
+	@ if test -f configs/current -o -L configs/current; then \
+		if ! cmp configs/$@ configs/current > /dev/null; then \
+			echo "Please run 'make realclean' before changing configs" ; \
+			exit 1 ; \
+		fi ; \
+	else \
+		cd configs && rm -f current && ln -s $@ current ; \
+	fi
+	$(MAKE) default
+
+
+# Rules for making release tarballs
+
+VERSION=7.11-devel
+DIRECTORY = Mesa-$(VERSION)
+LIB_NAME = MesaLib-$(VERSION)
+GLUT_NAME = MesaGLUT-$(VERSION)
+
+# This is part of MAIN_FILES
+MAIN_ES_FILES = \
+	$(DIRECTORY)/src/mesa/main/*.xml				\
+	$(DIRECTORY)/src/mesa/main/*.py					\
+	$(DIRECTORY)/src/mesa/main/*.dtd
+
+MAIN_FILES = \
+	$(DIRECTORY)/Makefile*						\
+	$(DIRECTORY)/configure						\
+	$(DIRECTORY)/configure.ac					\
+	$(DIRECTORY)/acinclude.m4					\
+	$(DIRECTORY)/aclocal.m4						\
+	$(DIRECTORY)/SConstruct						\
+	$(DIRECTORY)/common.py						\
+	$(DIRECTORY)/scons/*py						\
+	$(DIRECTORY)/bin/config.guess					\
+	$(DIRECTORY)/bin/config.sub					\
+	$(DIRECTORY)/bin/extract_git_sha1				\
+	$(DIRECTORY)/bin/install-sh					\
+	$(DIRECTORY)/bin/mklib						\
+	$(DIRECTORY)/bin/minstall					\
+	$(DIRECTORY)/bin/version.mk					\
+	$(DIRECTORY)/configs/[a-z]*					\
+	$(DIRECTORY)/docs/*.html					\
+	$(DIRECTORY)/docs/COPYING					\
+	$(DIRECTORY)/docs/README.*					\
+	$(DIRECTORY)/docs/RELNOTES*					\
+	$(DIRECTORY)/docs/*.spec					\
+	$(DIRECTORY)/include/GL/gl.h					\
+	$(DIRECTORY)/include/GL/glext.h					\
+	$(DIRECTORY)/include/GL/gl_mangle.h				\
+	$(DIRECTORY)/include/GL/glu.h					\
+	$(DIRECTORY)/include/GL/glu_mangle.h				\
+	$(DIRECTORY)/include/GL/glx.h					\
+	$(DIRECTORY)/include/GL/glxext.h				\
+	$(DIRECTORY)/include/GL/glx_mangle.h				\
+	$(DIRECTORY)/include/GL/glfbdev.h				\
+	$(DIRECTORY)/include/GL/mesa_wgl.h				\
+	$(DIRECTORY)/include/GL/osmesa.h				\
+	$(DIRECTORY)/include/GL/vms_x_fix.h				\
+	$(DIRECTORY)/include/GL/wglext.h				\
+	$(DIRECTORY)/include/GL/wmesa.h					\
+	$(DIRECTORY)/src/getopt/SConscript				\
+	$(DIRECTORY)/src/getopt/getopt*.[ch]				\
+	$(DIRECTORY)/src/glsl/Makefile					\
+	$(DIRECTORY)/src/glsl/Makefile.template				\
+	$(DIRECTORY)/src/glsl/SConscript				\
+	$(DIRECTORY)/src/glsl/*.[ch]					\
+	$(DIRECTORY)/src/glsl/*.ll					\
+	$(DIRECTORY)/src/glsl/*.yy					\
+	$(DIRECTORY)/src/glsl/*.[cly]pp					\
+	$(DIRECTORY)/src/glsl/README					\
+	$(DIRECTORY)/src/glsl/glcpp/*.[chly]				\
+	$(DIRECTORY)/src/glsl/glcpp/README				\
+	$(DIRECTORY)/src/glsl/builtins					\
+	$(DIRECTORY)/src/Makefile					\
+	$(DIRECTORY)/src/SConscript					\
+	$(DIRECTORY)/src/mesa/Makefile*					\
+	$(DIRECTORY)/src/mesa/SConscript				\
+	$(DIRECTORY)/src/mesa/sources.mak				\
+	$(DIRECTORY)/src/mesa/descrip.mms				\
+	$(DIRECTORY)/src/mesa/gl.pc.in					\
+	$(DIRECTORY)/src/mesa/osmesa.pc.in				\
+	$(DIRECTORY)/src/mesa/depend					\
+	$(MAIN_ES_FILES)						\
+	$(DIRECTORY)/src/mesa/main/*.[chS]				\
+	$(DIRECTORY)/src/mesa/main/*.cpp				\
+	$(DIRECTORY)/src/mesa/main/descrip.mms				\
+	$(DIRECTORY)/src/mesa/math/*.[ch]				\
+	$(DIRECTORY)/src/mesa/math/descrip.mms				\
+	$(DIRECTORY)/src/mesa/program/*.[chly]				\
+	$(DIRECTORY)/src/mesa/program/*.cpp				\
+	$(DIRECTORY)/src/mesa/program/descrip.mms			\
+	$(DIRECTORY)/src/mesa/swrast/*.[ch]				\
+	$(DIRECTORY)/src/mesa/swrast/descrip.mms			\
+	$(DIRECTORY)/src/mesa/swrast_setup/*.[ch]			\
+	$(DIRECTORY)/src/mesa/swrast_setup/descrip.mms			\
+	$(DIRECTORY)/src/mesa/vbo/*.[chS]				\
+	$(DIRECTORY)/src/mesa/vbo/descrip.mms				\
+	$(DIRECTORY)/src/mesa/tnl/*.[chS]				\
+	$(DIRECTORY)/src/mesa/tnl/descrip.mms				\
+	$(DIRECTORY)/src/mesa/tnl_dd/*.[ch]				\
+	$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch]				\
+	$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm			\
+	$(DIRECTORY)/src/mesa/vf/*.[ch]					\
+	$(DIRECTORY)/src/mesa/drivers/Makefile				\
+	$(DIRECTORY)/src/mesa/drivers/beos/*.cpp			\
+	$(DIRECTORY)/src/mesa/drivers/beos/Makefile			\
+	$(DIRECTORY)/src/mesa/drivers/common/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/common/descrip.mms		\
+	$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile			\
+	$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c			\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile			\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win		\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms		\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def			\
+	$(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/*.[ch]		\
+	$(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/Makefile	\
+	$(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/SConscript	\
+	$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch]			\
+	$(DIRECTORY)/src/mesa/drivers/windows/*/*.def			\
+	$(DIRECTORY)/src/mesa/drivers/x11/Makefile			\
+	$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms			\
+	$(DIRECTORY)/src/mesa/drivers/x11/*.[ch]			\
+	$(DIRECTORY)/src/mesa/ppc/*.[ch]				\
+	$(DIRECTORY)/src/mesa/sparc/*.[chS]				\
+	$(DIRECTORY)/src/mesa/x86/Makefile				\
+	$(DIRECTORY)/src/mesa/x86/*.[ch]				\
+	$(DIRECTORY)/src/mesa/x86/*.S					\
+	$(DIRECTORY)/src/mesa/x86/rtasm/*.[ch]				\
+	$(DIRECTORY)/src/mesa/x86-64/*.[chS]				\
+	$(DIRECTORY)/src/mesa/x86-64/Makefile
+
+MAPI_FILES = \
+	$(DIRECTORY)/include/GLES/*.h					\
+	$(DIRECTORY)/include/GLES2/*.h					\
+	$(DIRECTORY)/include/VG/*.h					\
+	$(DIRECTORY)/src/mapi/es?api/Makefile				\
+	$(DIRECTORY)/src/mapi/es?api/*.pc.in				\
+	$(DIRECTORY)/src/mapi/glapi/gen/Makefile			\
+	$(DIRECTORY)/src/mapi/glapi/gen/*.xml				\
+	$(DIRECTORY)/src/mapi/glapi/gen/*.py				\
+	$(DIRECTORY)/src/mapi/glapi/gen/*.dtd				\
+	$(DIRECTORY)/src/mapi/glapi/gen-es/Makefile			\
+	$(DIRECTORY)/src/mapi/glapi/gen-es/*.xml			\
+	$(DIRECTORY)/src/mapi/glapi/gen-es/*.py				\
+	$(DIRECTORY)/src/mapi/glapi/Makefile				\
+	$(DIRECTORY)/src/mapi/glapi/SConscript				\
+	$(DIRECTORY)/src/mapi/glapi/sources.mak				\
+	$(DIRECTORY)/src/mapi/glapi/*.[chS]				\
+	$(DIRECTORY)/src/mapi/mapi/mapi_abi.py				\
+	$(DIRECTORY)/src/mapi/mapi/sources.mak				\
+	$(DIRECTORY)/src/mapi/mapi/*.[ch]				\
+	$(DIRECTORY)/src/mapi/shared-glapi/SConscript			\
+	$(DIRECTORY)/src/mapi/vgapi/Makefile				\
+	$(DIRECTORY)/src/mapi/vgapi/SConscript				\
+	$(DIRECTORY)/src/mapi/vgapi/vgapi.csv				\
+	$(DIRECTORY)/src/mapi/vgapi/vg.pc.in
+
+EGL_FILES = \
+	$(DIRECTORY)/include/KHR/*.h					\
+	$(DIRECTORY)/include/EGL/*.h					\
+	$(DIRECTORY)/src/egl/Makefile					\
+	$(DIRECTORY)/src/egl/*/Makefile					\
+	$(DIRECTORY)/src/egl/*/Makefile.template			\
+	$(DIRECTORY)/src/egl/*/*.[ch]					\
+	$(DIRECTORY)/src/egl/*/*/Makefile				\
+	$(DIRECTORY)/src/egl/*/*/*.[ch]					\
+	$(DIRECTORY)/src/egl/main/SConscript				\
+	$(DIRECTORY)/src/egl/main/*.pc.in				\
+	$(DIRECTORY)/src/egl/main/*.def
+
+GALLIUM_FILES = \
+	$(DIRECTORY)/src/mesa/state_tracker/*[ch]			\
+	$(DIRECTORY)/src/gallium/Makefile				\
+	$(DIRECTORY)/src/gallium/Makefile.template			\
+	$(DIRECTORY)/src/gallium/SConscript				\
+	$(DIRECTORY)/src/gallium/targets/Makefile.dri			\
+	$(DIRECTORY)/src/gallium/targets/Makefile.xorg			\
+	$(DIRECTORY)/src/gallium/targets/SConscript.dri			\
+	$(DIRECTORY)/src/gallium/*/Makefile				\
+	$(DIRECTORY)/src/gallium/*/SConscript				\
+	$(DIRECTORY)/src/gallium/*/*/Makefile				\
+	$(DIRECTORY)/src/gallium/*/*/SConscript				\
+	$(DIRECTORY)/src/gallium/*/*/*.[ch]				\
+	$(DIRECTORY)/src/gallium/auxiliary/gallivm/*.cpp		\
+	$(DIRECTORY)/src/gallium/*/*/*.py				\
+	$(DIRECTORY)/src/gallium/*/*/*.csv				\
+	$(DIRECTORY)/src/gallium/*/*/*/Makefile				\
+	$(DIRECTORY)/src/gallium/*/*/*/SConscript			\
+	$(DIRECTORY)/src/gallium/*/*/*/*.[ch]				\
+	$(DIRECTORY)/src/gallium/*/*/*/*.py
+
+
+DRI_FILES = \
+	$(DIRECTORY)/include/GL/internal/dri_interface.h		\
+	$(DIRECTORY)/include/GL/internal/sarea.h			\
+	$(DIRECTORY)/src/glx/Makefile					\
+	$(DIRECTORY)/src/glx/*.[ch]					\
+	$(DIRECTORY)/src/mesa/drivers/dri/Makefile			\
+	$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template		\
+	$(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in			\
+	$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po		\
+	$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS]			\
+	$(DIRECTORY)/src/mesa/drivers/dri/*/*.cpp			\
+	$(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS]			\
+	$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile			\
+	$(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile			\
+	$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile
+
+SGI_GLU_FILES = \
+	$(DIRECTORY)/src/glu/Makefile					\
+	$(DIRECTORY)/src/glu/glu.pc.in					\
+	$(DIRECTORY)/src/glu/sgi/Makefile				\
+	$(DIRECTORY)/src/glu/sgi/Makefile.mgw				\
+	$(DIRECTORY)/src/glu/sgi/Makefile.win				\
+	$(DIRECTORY)/src/glu/sgi/glu.def				\
+	$(DIRECTORY)/src/glu/sgi/dummy.cc				\
+	$(DIRECTORY)/src/glu/sgi/glu.exports				\
+	$(DIRECTORY)/src/glu/sgi/glu.exports.darwin			\
+	$(DIRECTORY)/src/glu/sgi/mesaglu.opt				\
+	$(DIRECTORY)/src/glu/sgi/include/gluos.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.cc		\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.cc		\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.h			\
+	$(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.cc			\
+	$(DIRECTORY)/src/glu/sgi/libtess/README				\
+	$(DIRECTORY)/src/glu/sgi/libtess/alg-outline			\
+	$(DIRECTORY)/src/glu/sgi/libtess/*.[ch]				\
+	$(DIRECTORY)/src/glu/sgi/libutil/*.[ch]
+
+GLW_FILES = \
+	$(DIRECTORY)/src/glw/*.[ch]			\
+	$(DIRECTORY)/src/glw/Makefile*			\
+	$(DIRECTORY)/src/glw/README			\
+	$(DIRECTORY)/src/glw/glw.pc.in			\
+	$(DIRECTORY)/src/glw/depend
+
+GLUT_FILES = \
+	$(DIRECTORY)/include/GL/glut.h			\
+	$(DIRECTORY)/include/GL/glutf90.h		\
+	$(DIRECTORY)/src/glut/glx/Makefile*		\
+	$(DIRECTORY)/src/glut/glx/SConscript		\
+	$(DIRECTORY)/src/glut/glx/depend		\
+	$(DIRECTORY)/src/glut/glx/glut.pc.in		\
+	$(DIRECTORY)/src/glut/glx/*def			\
+	$(DIRECTORY)/src/glut/glx/*.[ch]		\
+	$(DIRECTORY)/src/glut/beos/*.[ch]		\
+	$(DIRECTORY)/src/glut/beos/*.cpp		\
+	$(DIRECTORY)/src/glut/beos/Makefile
+
+DEPEND_FILES = \
+	$(TOP)/src/mesa/depend		\
+	$(TOP)/src/glx/depend		\
+	$(TOP)/src/glw/depend		\
+	$(TOP)/src/glut/glx/depend	\
+	$(TOP)/src/glu/sgi/depend
+
+
+LIB_FILES = \
+	$(MAIN_FILES)		\
+	$(MAPI_FILES)		\
+	$(ES_FILES)		\
+	$(EGL_FILES)		\
+	$(GALLIUM_FILES)	\
+	$(DRI_FILES)		\
+	$(SGI_GLU_FILES)	\
+	$(GLW_FILES)
+
+
+parsers: configure
+	-@touch $(TOP)/configs/current
+	$(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp
+	$(MAKE) -C src/glsl/glcpp glcpp-lex.c glcpp-parse.c glcpp-parse.h
+	$(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c program_parse.tab.h
+
+# Everything for new a Mesa release:
+ARCHIVES = $(LIB_NAME).tar.gz \
+	$(LIB_NAME).tar.bz2 \
+	$(LIB_NAME).zip \
+	$(GLUT_NAME).tar.gz \
+	$(GLUT_NAME).tar.bz2 \
+	$(GLUT_NAME).zip
+
+tarballs: md5
+	rm -f ../$(LIB_NAME).tar
+
+# Helper for autoconf builds
+ACLOCAL = aclocal
+ACLOCAL_FLAGS =
+AUTOCONF = autoconf
+AC_FLAGS =
+aclocal.m4: configure.ac acinclude.m4
+	$(ACLOCAL) $(ACLOCAL_FLAGS)
+configure: rm_depend configure.ac aclocal.m4 acinclude.m4
+	$(AUTOCONF) $(AC_FLAGS)
+
+rm_depend:
+	@for dep in $(DEPEND_FILES) ; do \
+		rm -f $$dep ; \
+		touch $$dep ; \
+	done
+
+rm_config: parsers
+	rm -f configs/current
+	rm -f configs/autoconf
+
+$(LIB_NAME).tar: rm_config
+	cd .. ; tar -cf $(DIRECTORY)/$(LIB_NAME).tar $(LIB_FILES)
+
+$(LIB_NAME).tar.gz: $(LIB_NAME).tar
+	gzip --stdout --best $(LIB_NAME).tar > $(LIB_NAME).tar.gz
+
+$(GLUT_NAME).tar: rm_depend
+	cd .. ; tar -cf $(DIRECTORY)/$(GLUT_NAME).tar $(GLUT_FILES)
+
+$(GLUT_NAME).tar.gz: $(GLUT_NAME).tar
+	gzip --stdout --best $(GLUT_NAME).tar > $(GLUT_NAME).tar.gz
+
+$(LIB_NAME).tar.bz2: $(LIB_NAME).tar
+	bzip2 --stdout --best $(LIB_NAME).tar > $(LIB_NAME).tar.bz2
+
+$(GLUT_NAME).tar.bz2: $(GLUT_NAME).tar
+	bzip2 --stdout --best $(GLUT_NAME).tar > $(GLUT_NAME).tar.bz2
+
+$(LIB_NAME).zip: rm_config
+	rm -f $(LIB_NAME).zip ; \
+	cd .. ; \
+	zip -qr $(LIB_NAME).zip $(LIB_FILES) ; \
+	mv $(LIB_NAME).zip $(DIRECTORY)
+
+$(GLUT_NAME).zip:
+	rm -f $(GLUT_NAME).zip ; \
+	cd .. ; \
+	zip -qr $(GLUT_NAME).zip $(GLUT_FILES) ; \
+	mv $(GLUT_NAME).zip $(DIRECTORY)
+
+md5: $(ARCHIVES)
+	@-md5sum $(LIB_NAME).tar.gz
+	@-md5sum $(LIB_NAME).tar.bz2
+	@-md5sum $(LIB_NAME).zip
+	@-md5sum $(GLUT_NAME).tar.gz
+	@-md5sum $(GLUT_NAME).tar.bz2
+	@-md5sum $(GLUT_NAME).zip
+
+.PHONY: tarballs rm_depend rm_config md5
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index ddd860813..3b05ca353 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -1636,6 +1636,7 @@ yes)
 		PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
 				  [AC_MSG_ERROR([cannot find libwayland-client])])
 		WAYLAND_EGL_LIB_DEPS="$WAYLAND_LIBS $LIBDRM_LIBS"
+                GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
 	fi
     done
     EGL_PLATFORMS="$egl_platforms"
@@ -1687,9 +1688,14 @@ dnl Gallium LLVM
 dnl
 AC_ARG_ENABLE([gallium-llvm],
     [AS_HELP_STRING([--enable-gallium-llvm],
-        [build gallium LLVM support @<:@default=disabled@:>@])],
+        [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
     [enable_gallium_llvm="$enableval"],
     [enable_gallium_llvm=auto])
+if test "x$enable_gallium_llvm" = xauto; then
+    case "$host_cpu" in
+    i*86|x86_64) enable_gallium_llvm=yes;;
+    esac
+fi
 if test "x$enable_gallium_llvm" = xyes; then
     if test "x$LLVM_CONFIG" != xno; then
 	LLVM_VERSION=`$LLVM_CONFIG --version`
@@ -1773,16 +1779,22 @@ fi
 dnl
 dnl Gallium Radeon r300g configuration
 dnl
-AC_ARG_ENABLE([gallium-radeon],
-    [AS_HELP_STRING([--enable-gallium-radeon],
-        [build gallium radeon @<:@default=disabled@:>@])],
-    [enable_gallium_radeon="$enableval"],
-    [enable_gallium_radeon=auto])
-if test "x$enable_gallium_radeon" = xauto; then
+AC_ARG_ENABLE([gallium-r300],
+    [AS_HELP_STRING([--enable-gallium-r300],
+        [build gallium r300 @<:@default=build DRI driver only@:>@])],
+    [enable_gallium_r300="$enableval"],
+    [enable_gallium_r300=auto])
+if test "x$enable_gallium_r300" != xno; then
+    if test "x$MESA_LLVM" = x0; then
+        case "$host_cpu" in
+        i*86|x86_64) AC_MSG_ERROR([LLVM is required to build Gallium R300 on x86 and x86_64]);;
+        esac
+    fi
+fi
+if test "x$enable_gallium_r300" = xauto; then
     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
     gallium_check_st "radeon/drm" "dri-r300"
-fi
-if test "x$enable_gallium_radeon" = xyes; then
+elif test "x$enable_gallium_r300" = xyes; then
     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
     gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
 fi
@@ -1792,7 +1804,7 @@ dnl Gallium Radeon r600g configuration
 dnl
 AC_ARG_ENABLE([gallium-r600],
     [AS_HELP_STRING([--enable-gallium-r600],
-        [build gallium radeon @<:@default=disabled@:>@])],
+        [build gallium r600 @<:@default=disabled@:>@])],
     [enable_gallium_r600="$enableval"],
     [enable_gallium_r600=auto])
 if test "x$enable_gallium_r600" = xyes; then
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index e373a9453..f3138afa3 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -12,13 +12,13 @@ Feature                                               Status
 
 GL 3.0:
 
-GLSL 1.30 (GL_EXT_gpu_shader4, etc.)                  not started
-Conditional rendering (GL_NV_conditional_render)      DONE (swrast & softpipe)
+GLSL 1.30 (GL_EXT_gpu_shader4, etc.)                  started
+Conditional rendering (GL_NV_conditional_render)      DONE (swrast, softpipe, i965)
 Map buffer subranges (GL_ARB_map_buffer_range)        DONE
 Clamping controls (GL_ARB_color_buffer_float)         DONE
 Float textures, renderbuffers (GL_ARB_texture_float)  DONE (gallium r300)
-GL_EXT_packed_float                                   not started
-GL_EXT_texture_shared_exponent                        not started
+GL_EXT_packed_float                                   started
+GL_EXT_texture_shared_exponent                        started
 Float depth buffers (GL_ARB_depth_buffer_float)       not started
 Framebuffer objects (GL_EXT_framebuffer_object)       DONE
 Half-float                                            DONE
@@ -80,7 +80,7 @@ GL_ARB_occlusion_query2                               DONE (swrast, gallium)
 GL_ARB_sampler_objects                                DONE (gallium)
 GL_ARB_texture_rgb10_a2ui                             not started
 GL_ARB_texture_swizzle                                DONE (same as EXT version)
-GL_ARB_timer_query                                    DONE (only Xlib sw driver)
+GL_ARB_timer_query                                    ~60% done (the EXT variant)
 GL_ARB_instanced_arrays                               DONE (gallium)
 GL_ARB_vertex_type_2_10_10_10_rev                     not started
 
@@ -105,7 +105,7 @@ GL_ARB_transform_feedback3                           not started
 GL 4.1:
 
 GLSL 4.1                                             not started
-GL_ARB_ES2_compatibility                             not started
+GL_ARB_ES2_compatibility                             mostly done (Intel?)
 GL_ARB_get_program_binary                            not started
 GL_ARB_separate_shader_objects                       some infrastructure done
 GL_ARB_shader_precision                              not started
diff --git a/mesalib/docs/README.WIN32 b/mesalib/docs/README.WIN32
index 986b5994f..ab0df573b 100644
--- a/mesalib/docs/README.WIN32
+++ b/mesalib/docs/README.WIN32
@@ -1,114 +1,33 @@
 File: docs/README.WIN32
 
-Last updated: Apr 25, 2007
-
-NOTE: This information only applies to Mesa 7.8 and older.  Nowadays
-it's probably better to use Scons to build for Windows.
+Last updated: 23 April 2011
 
 
 Quick Start
 ----- -----
 
-Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
-directory.  The libs and demos build separately, so if you do not care
-about the demos or GLUT, you only need to unzip MesaLib.  If you unzip
-more than one ZIP file, they all need to be unzipped into the same
-directory.  Don't worry, you will not overwrite anything.
-
-The Windows build system uses Microsoft Visual Studio.  Project files
-for a specific version of Visual Studio are in their own directory in
-the top-level "windows" directory.  For example, Visual Studio 8 files
-are in windows/VC8.
+Windows drivers are build with SCons.  Makefiles or Visual Studio projects are
+no longer shipped or supported.
 
-Support has been dropped for versions of Visual Studio prior to 8. The
-main reason is because Microsoft now provides a free compiler and
-developer environment.  Visual Studio Express can be found at
+Run
 
-http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
+  scons osmesa mesagdi
 
-You'll also need the Platform SDK.  Instructions for obtaining and
-using the SDK with Visual Studio Express can be found at
+to build classic mesa Windows GDI drivers; or
 
-http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
+  scons libgl-gdi
 
-The project files to build the core Mesa library, Windows Mesa
-drivers, OSMesa, and GLU are in the mesa directory.  The project files
-to build GLUT and some demo programs are in the progs directory.
-
-Makefiles are no longer shipped or supported, but can be generated
-from the projects using Visual Studio.
+to build gallium based GDI driver.
 
 
 Windows Drivers
 ------- -------
 
-At this time, only the GDI driver is known to work.  Most of the demos
-in progs/demos should work with this driver.
+At this time, only the gallium GDI driver is known to work.
 
 Source code also exists in the tree for other drivers in
 src/mesa/drivers/windows, but the status of this code is unknown.
 
-The GDI driver operates basically by writing pixel spans into a DIB
-section and then blitting the DIB to the window.  The driver was
-recently cleaned up and rewitten and so may have bugs or may be
-missing some functionality.  The older versions of the CVS source may
-be useful in figuring out any problems, or report them to me.
-
-To build Mesa with the GDI driver, build the mesa, gdi, and glu
-projects in the Visual Studio workspace found at
-
-	windows/VC8/mesa/mesa.sln
-
-The osmesa DLL can also be built with the osmesa project.
-
-The build system creates a lib top-level directory and copies
-resulting LIB and DLL files to this lib directory.  The files are:
-
-	OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
-	OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
-
-If the MesaDemos ZIP file was extracted, the DLL files are also copied
-to the demos directory.  This facilitates running the demos as described
-below.
-
-
-GLUT and Demos
----- --- -----
-
-A Visual Studio workspace can be found at 
-
-	windows/VC8/progs/progs.sln
-
-It can be used to build GLUT and a few demos.  The GLUT lib and DLL
-are copied to the top-level lib directory, along with the Mesa libs.
-
-The demo build system expects to find the LIB files in the top level
-lib directory, so you must build the Mesa libs first.  The demo
-executables are placed in the demos directory, because some of them
-rely on data files found there.  Also, the Mesa lib DLL's were copied
-there by the Mesa lib build process.  Therefore, you should be able to
-simply run the demo executables from the demo directory.
-
-If you want to run the demos from the Visual Studio, you may have to
-change the startup directory and explicitly state where the executables are.
-
-You may also build all the demo programs by using a makefile.  Go to
-the progs/demos directory and make sure you have executed VCVARS32.BAT
-or whatever setup script is appropriate for your compiler.  Then,
-
-	nmake -f Makefile.win
-
-should build all the demos.
-
-
-Build System Notes
------ ------ -----
-
-VC8
----
-
-No notes.
-
 
 General
 -------
@@ -128,11 +47,5 @@ the linker import files associated with the DLL files.
 The si-glu sources are used to build the GLU libs.  This was done
 mainly to get the better tessellator code.
 
-To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
-to the project settings.  You will also need to edit src/mesa.def to
-change all the gl* symbols to mgl*.  Because this is easy to do with a
-global replace operation in a text editor, no additional mangled
-version of mesa.def is maintained or shipped.
-
 If you have a Windows-related build problem or question, please post
 to the mesa-dev or mesa-users list.
diff --git a/mesalib/docs/WL_bind_wayland_display.spec b/mesalib/docs/WL_bind_wayland_display.spec
index 577496af0..e2fde3c50 100644
--- a/mesalib/docs/WL_bind_wayland_display.spec
+++ b/mesalib/docs/WL_bind_wayland_display.spec
@@ -1,92 +1,92 @@
-Name
-
-    WL_bind_wayland_display
-
-Name Strings
-
-    EGL_WL_bind_wayland_display
-
-Contact
-
-    Kristian Høgsberg <krh@bitplanet.net>
-    Benjamin Franzke <benjaminfranzke@googlemail.com>
-
-Status
-
-    Proposal
-
-Version
-
-    Version 1, March 1, 2011
-
-Number
-
-    EGL Extension #not assigned
-
-Dependencies
-
-    Requires EGL 1.4 or later.  This extension is written against the
-    wording of the EGL 1.4 specification.
-
-    EGL_KHR_base_image is required.
-
-Overview
-
-    This extension provides entry points for binding and unbinding the
-    wl_display of a Wayland compositor to an EGLDisplay.  Binding a
-    wl_display means that the EGL implementation should provide one or
-    more interfaces in the Wayland protocol to allow clients to create
-    wl_buffer objects.  On the server side, this extension also
-    provides a new target for eglCreateImageKHR, to create an EGLImage
-    from a wl_buffer
-
-    Adding an implementation specific wayland interface, allows the
-    EGL implementation to define specific wayland requests and events,
-    needed for buffer sharing in an EGL wayland platform.
-
-IP Status
-
-    Open-source; freely implementable.
-
-New Procedures and Functions
-
-    EGLBoolean eglBindWaylandDisplayWL(EGLDisplay dpy,
-                                       struct wl_display *display);
-
-    EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy,
-                                         struct wl_display *display);
-
-New Tokens
-
-    Accepted as <target> in eglCreateImageKHR
-
-        EGL_WAYLAND_BUFFER_WL                   0x31D5
-
-Additions to the EGL 1.4 Specification:
-
-    To bind a server side wl_display to an EGLDisplay, call
-
-        EGLBoolean eglBindWaylandDisplayWL(EGLDisplay dpy,
-                                           struct wl_display *display);
-
-    To unbind a server side wl_display from an EGLDisplay, call
-    
-        EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy,
-                                             struct wl_display *display);
-
-    eglBindWaylandDisplayWL returns EGL_FALSE when there is already a
-    wl_display bound to EGLDisplay otherwise EGL_TRUE.
-
-    eglUnbindWaylandDisplayWL returns EGL_FALSE when there is no
-    wl_display bound to the EGLDisplay currently otherwise EGL_TRUE.
-
-    Import a wl_buffer by calling eglCreateImageKHR with
-    wl_buffer as EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target,
-    and an empty attribute_list.
-
-Issues
-
-Revision History
-
-    Version 1, March 1, 2011
-        Initial draft (Benjamin Franzke)
+Name
+
+    WL_bind_wayland_display
+
+Name Strings
+
+    EGL_WL_bind_wayland_display
+
+Contact
+
+    Kristian Høgsberg <krh@bitplanet.net>
+    Benjamin Franzke <benjaminfranzke@googlemail.com>
+
+Status
+
+    Proposal
+
+Version
+
+    Version 1, March 1, 2011
+
+Number
+
+    EGL Extension #not assigned
+
+Dependencies
+
+    Requires EGL 1.4 or later.  This extension is written against the
+    wording of the EGL 1.4 specification.
+
+    EGL_KHR_base_image is required.
+
+Overview
+
+    This extension provides entry points for binding and unbinding the
+    wl_display of a Wayland compositor to an EGLDisplay.  Binding a
+    wl_display means that the EGL implementation should provide one or
+    more interfaces in the Wayland protocol to allow clients to create
+    wl_buffer objects.  On the server side, this extension also
+    provides a new target for eglCreateImageKHR, to create an EGLImage
+    from a wl_buffer
+
+    Adding an implementation specific wayland interface, allows the
+    EGL implementation to define specific wayland requests and events,
+    needed for buffer sharing in an EGL wayland platform.
+
+IP Status
+
+    Open-source; freely implementable.
+
+New Procedures and Functions
+
+    EGLBoolean eglBindWaylandDisplayWL(EGLDisplay dpy,
+                                       struct wl_display *display);
+
+    EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy,
+                                         struct wl_display *display);
+
+New Tokens
+
+    Accepted as <target> in eglCreateImageKHR
+
+        EGL_WAYLAND_BUFFER_WL                   0x31D5
+
+Additions to the EGL 1.4 Specification:
+
+    To bind a server side wl_display to an EGLDisplay, call
+
+        EGLBoolean eglBindWaylandDisplayWL(EGLDisplay dpy,
+                                           struct wl_display *display);
+
+    To unbind a server side wl_display from an EGLDisplay, call
+    
+        EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy,
+                                             struct wl_display *display);
+
+    eglBindWaylandDisplayWL returns EGL_FALSE when there is already a
+    wl_display bound to EGLDisplay otherwise EGL_TRUE.
+
+    eglUnbindWaylandDisplayWL returns EGL_FALSE when there is no
+    wl_display bound to the EGLDisplay currently otherwise EGL_TRUE.
+
+    Import a wl_buffer by calling eglCreateImageKHR with
+    wl_buffer as EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target,
+    NULL context and an empty attribute_list.
+
+Issues
+
+Revision History
+
+    Version 1, March 1, 2011
+        Initial draft (Benjamin Franzke)
diff --git a/mesalib/docs/install.html b/mesalib/docs/install.html
index bfa3bb8f8..e1018119a 100644
--- a/mesalib/docs/install.html
+++ b/mesalib/docs/install.html
@@ -274,7 +274,6 @@ For example, compiling and linking a GLUT application can be done with:
 
 <p>
 Please see the <a href="#scons">instructions on building with SCons</a>.
-Alternatively see <a href="README.WIN32">README.WIN32</a> file.
 </p>
 
 
diff --git a/mesalib/docs/patents.txt b/mesalib/docs/patents.txt
new file mode 100644
index 000000000..3834e255c
--- /dev/null
+++ b/mesalib/docs/patents.txt
@@ -0,0 +1,31 @@
+ARB_texture_float:
+
+    Silicon Graphics, Inc. owns US Patent #6,650,327, issued November 18,
+    2003 [1].
+
+    SGI believes this patent contains necessary IP for graphics systems
+    implementing floating point rasterization and floating point
+    framebuffer capabilities described in ARB_texture_float extension, and
+    will discuss licensing on RAND terms, on an individual basis with
+    companies wishing to use this IP in the context of conformant OpenGL
+    implementations [2].
+
+    The source code to implement ARB_texture_float extension is included
+    and can be toggled on at compile time, for those who purchased a
+    license from SGI, or are in a country where the patent does not apply,
+    etc.
+
+    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.
+
+    You should contact a lawyer or SGI's legal department if you want to
+    enable this extension.
+
+
+[1] http://www.google.com/patents/about?id=mIIOAAAAEBAJ&dq=6650327
+[2] http://www.opengl.org/registry/specs/ARB/texture_float.txt
diff --git a/mesalib/docs/relnotes-7.11.html b/mesalib/docs/relnotes-7.11.html
index 131fecd18..3b7f9a21d 100644
--- a/mesalib/docs/relnotes-7.11.html
+++ b/mesalib/docs/relnotes-7.11.html
@@ -36,21 +36,23 @@ tbd
 
 <h2>New features</h2>
 <ul>
-<li>GL_ARB_color_buffer_float (gallium drivers)
+<li>GL_ARB_color_buffer_float (gallium drivers, i965)
 <li>GL_ARB_draw_buffers_blend (gallium)
 <li>GL_ARB_draw_instanced extension (gallium drivers, swrast)
 <li>GL_ARB_instanced_arrays extension (gallium drivers)
 <li>GL_ARB_occlusion_query2 (gallium drivers, swrast)
+<li>GL_ARB_robustness (all drivers)
 <li>GL_ARB_sampler_objects (gallium drivers)
-<li>GL_ARB_texture_compression_rgtc (gallium drivers, swrast)
-<li>GL_ARB_texture_float (gallium)
+<li>GL_ARB_texture_compression_rgtc (gallium drivers, swrast, i965)
+<li>GL_ARB_texture_float (gallium, i965)
 <li>GL_EXT_texture_compression_latc (gallium drivers, swrast)
-<li>GL_EXT_texture_compression_rgtc (gallium drivers, swrast)
+<li>GL_EXT_texture_compression_rgtc (gallium drivers, swrast, i965)
 <li>GL_EXT_texture_sRGB_decode (gallium drivers, swrast, i965)
 <li>GL_EXT_texture_snorm (gallium drivers)
 <li>GL_ATI_draw_buffers (all drivers)
 <li>GL_ATI_texture_compression_3dc (gallium drivers, swrast)
-<li>GL_ATI_texture_float (gallium)
+<li>GL_ATI_texture_float (gallium, i965)
+<li>GL_NV_conditional_render (i965)
 <li>GL_NV_texture_barrier (gallium drivers)
 </ul>
 
@@ -62,8 +64,9 @@ tbd
 
 <h2>Changes</h2>
 <ul>
-<li>The Windows MSVC project files have been removed.  They haven't been maintained
-in quite a while.  Building with SCons is an alterantive.
+<li>The Windows MSVC project files have been removed.
+They haven't been maintained in quite a while.
+Building with SCons is an alternative.
 <li>Removed GL_SGI_texture_color_table support from swrast driver - the only
 driver that implemented it.
 </ul>
diff --git a/mesalib/include/EGL/eglext.h b/mesalib/include/EGL/eglext.h
index 4a789c607..a93cfb556 100644
--- a/mesalib/include/EGL/eglext.h
+++ b/mesalib/include/EGL/eglext.h
@@ -1,398 +1,397 @@
-#ifndef __eglext_h_
-#define __eglext_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2007-2010 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE 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
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-#include <EGL/eglplatform.h>
-
-/*************************************************************/
-
-/* Header file version number */
-/* Current version at http://www.khronos.org/registry/egl/ */
-/* $Revision$ on $Date: 2010-07-27 20:12:35 -0700 (Tue, 27 Jul 2010) $ */
-#define EGL_EGLEXT_VERSION 7
-
-#ifndef EGL_KHR_config_attribs
-#define EGL_KHR_config_attribs 1
-#define EGL_CONFORMANT_KHR			0x3042	/* EGLConfig attribute */
-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR	0x0020	/* EGL_SURFACE_TYPE bitfield */
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR		0x0040	/* EGL_SURFACE_TYPE bitfield */
-#endif
-
-#ifndef EGL_KHR_lock_surface
-#define EGL_KHR_lock_surface 1
-#define EGL_READ_SURFACE_BIT_KHR		0x0001	/* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_WRITE_SURFACE_BIT_KHR		0x0002	/* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_LOCK_SURFACE_BIT_KHR		0x0080	/* EGL_SURFACE_TYPE bitfield */
-#define EGL_OPTIMAL_FORMAT_BIT_KHR		0x0100	/* EGL_SURFACE_TYPE bitfield */
-#define EGL_MATCH_FORMAT_KHR			0x3043	/* EGLConfig attribute */
-#define EGL_FORMAT_RGB_565_EXACT_KHR		0x30C0	/* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGB_565_KHR			0x30C1	/* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_EXACT_KHR		0x30C2	/* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_KHR		0x30C3	/* EGL_MATCH_FORMAT_KHR value */
-#define EGL_MAP_PRESERVE_PIXELS_KHR		0x30C4	/* eglLockSurfaceKHR attribute */
-#define EGL_LOCK_USAGE_HINT_KHR			0x30C5	/* eglLockSurfaceKHR attribute */
-#define EGL_BITMAP_POINTER_KHR			0x30C6	/* eglQuerySurface attribute */
-#define EGL_BITMAP_PITCH_KHR			0x30C7	/* eglQuerySurface attribute */
-#define EGL_BITMAP_ORIGIN_KHR			0x30C8	/* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR		0x30C9	/* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR	0x30CA	/* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR	0x30CB	/* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR	0x30CC	/* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR	0x30CD	/* eglQuerySurface attribute */
-#define EGL_LOWER_LEFT_KHR			0x30CE	/* EGL_BITMAP_ORIGIN_KHR value */
-#define EGL_UPPER_LEFT_KHR			0x30CF	/* EGL_BITMAP_ORIGIN_KHR value */
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
-#endif
-
-#ifndef EGL_KHR_image
-#define EGL_KHR_image 1
-#define EGL_NATIVE_PIXMAP_KHR			0x30B0	/* eglCreateImageKHR target */
-typedef void *EGLImageKHR;
-#define EGL_NO_IMAGE_KHR			((EGLImageKHR)0)
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
-#endif
-
-#ifndef EGL_KHR_vg_parent_image
-#define EGL_KHR_vg_parent_image 1
-#define EGL_VG_PARENT_IMAGE_KHR			0x30BA	/* eglCreateImageKHR target */
-#endif
-
-#ifndef EGL_KHR_gl_texture_2D_image
-#define EGL_KHR_gl_texture_2D_image 1
-#define EGL_GL_TEXTURE_2D_KHR			0x30B1	/* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_LEVEL_KHR		0x30BC	/* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_gl_texture_cubemap_image
-#define EGL_KHR_gl_texture_cubemap_image 1
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR	0x30B3	/* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR	0x30B4	/* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR	0x30B5	/* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR	0x30B6	/* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR	0x30B7	/* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR	0x30B8	/* eglCreateImageKHR target */
-#endif
-
-#ifndef EGL_KHR_gl_texture_3D_image
-#define EGL_KHR_gl_texture_3D_image 1
-#define EGL_GL_TEXTURE_3D_KHR			0x30B2	/* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_ZOFFSET_KHR		0x30BD	/* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_gl_renderbuffer_image
-#define EGL_KHR_gl_renderbuffer_image 1
-#define EGL_GL_RENDERBUFFER_KHR			0x30B9	/* eglCreateImageKHR target */
-#endif
-
-#ifndef EGL_MESA_drm_image
-#define EGL_MESA_drm_image 1
-#define EGL_DRM_BUFFER_FORMAT_MESA		0x31D0	/* eglCreateImageKHR attribute */
-#define EGL_DRM_BUFFER_USE_MESA			0x31D1
-
-/* EGL_DRM_BUFFER_FORMAT_MESA tokens */
-#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA	0x31D2
-
-/* EGL_DRM_BUFFER_USE_MESA bits */
-#define EGL_DRM_BUFFER_USE_SCANOUT_MESA		0x0001
-#define EGL_DRM_BUFFER_USE_SHARE_MESA		0x0002
-
-#define EGL_DRM_BUFFER_MESA			0x31D3  /* eglCreateImageKHR target */
-#define EGL_DRM_BUFFER_STRIDE_MESA		0x31D4	/* eglCreateImageKHR attribute */
-
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESA) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESA) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif
-
-#ifndef EGL_WL_bind_wayland_display
-#define EGL_WL_bind_wayland_display 1
-
-#define EGL_WAYLAND_BUFFER_WL			0x31D5 /* eglCreateImageKHR target */
-struct wl_display;
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
-#else
-typedef EGLBoolean (EGLAPIENTRY PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
-typedef EGLBoolean (EGLAPIENTRY PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
-#endif
-#endif
-
-#if KHRONOS_SUPPORT_INT64   /* EGLTimeKHR requires 64-bit uint support */
-#ifndef EGL_KHR_reusable_sync
-#define EGL_KHR_reusable_sync 1
-
-typedef void* EGLSyncKHR;
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
-
-#define EGL_SYNC_STATUS_KHR			0x30F1
-#define EGL_SIGNALED_KHR			0x30F2
-#define EGL_UNSIGNALED_KHR			0x30F3
-#define EGL_TIMEOUT_EXPIRED_KHR			0x30F5
-#define EGL_CONDITION_SATISFIED_KHR		0x30F6
-#define EGL_SYNC_TYPE_KHR			0x30F7
-#define EGL_SYNC_REUSABLE_KHR			0x30FA
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR		0x0001	/* eglClientWaitSyncKHR <flags> bitfield */
-#define EGL_FOREVER_KHR				0xFFFFFFFFFFFFFFFFull
-#define EGL_NO_SYNC_KHR				((EGLSyncKHR)0)
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif
-#endif
-
-/* EGL_MESA_screen extension  >>> PRELIMINARY <<< */
-#ifndef EGL_MESA_screen_surface
-#define EGL_MESA_screen_surface 1
-
-#define EGL_BAD_SCREEN_MESA                    0x4000
-#define EGL_BAD_MODE_MESA                      0x4001
-#define EGL_SCREEN_COUNT_MESA                  0x4002
-#define EGL_SCREEN_POSITION_MESA               0x4003
-#define EGL_SCREEN_POSITION_GRANULARITY_MESA   0x4004
-#define EGL_MODE_ID_MESA                       0x4005
-#define EGL_REFRESH_RATE_MESA                  0x4006
-#define EGL_OPTIMAL_MESA                       0x4007
-#define EGL_INTERLACED_MESA                    0x4008
-#define EGL_SCREEN_BIT_MESA                    0x08
-
-typedef khronos_uint32_t EGLScreenMESA;
-typedef khronos_uint32_t EGLModeMESA;
-
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-EGLAPI EGLSurface EGLAPIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-EGLAPI const char * EGLAPIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSEMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMODESMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGetModeATTRIBMESA) (EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSCRREENSMESA) (EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESCREENSURFACEMESA) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSHOWSCREENSURFACEMESA) (EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSCREENPOSIITONMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENSURFACEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-typedef const char * (EGLAPIENTRYP PFNEGLQUERYMODESTRINGMESA) (EGLDisplay dpy, EGLModeMESA mode);
-
-#endif /* EGL_MESA_screen_surface */
-
-
-#ifndef EGL_MESA_copy_context
-#define EGL_MESA_copy_context 1
-
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
-
-#endif /* EGL_MESA_copy_context */
-
-#ifndef EGL_MESA_drm_display
-#define EGL_MESA_drm_display 1
-
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDRMDisplayMESA(int fd);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-
-typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) (int fd);
-
-#endif /* EGL_MESA_drm_display */
-
-#ifndef EGL_KHR_image_base
-#define EGL_KHR_image_base 1
-/* Most interfaces defined by EGL_KHR_image_pixmap above */
-#define EGL_IMAGE_PRESERVED_KHR			0x30D2	/* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_image_pixmap
-#define EGL_KHR_image_pixmap 1
-/* Interfaces defined by EGL_KHR_image above */
-#endif
-
-#ifndef EGL_IMG_context_priority
-#define EGL_IMG_context_priority 1
-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG		0x3100
-#define EGL_CONTEXT_PRIORITY_HIGH_IMG		0x3101
-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG		0x3102
-#define EGL_CONTEXT_PRIORITY_LOW_IMG		0x3103
-#endif
-
-#ifndef EGL_KHR_lock_surface2
-#define EGL_KHR_lock_surface2 1
-#define EGL_BITMAP_PIXEL_SIZE_KHR		0x3110
-#endif
-
-#ifndef EGL_NV_coverage_sample
-#define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
-#endif
-
-#ifndef EGL_NV_depth_nonlinear
-#define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV 0x30E2
-#define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
-#endif
-
-#if KHRONOS_SUPPORT_INT64   /* EGLTimeNV requires 64-bit uint support */
-#ifndef EGL_NV_sync
-#define EGL_NV_sync 1
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV	0x30E6
-#define EGL_SYNC_STATUS_NV			0x30E7
-#define EGL_SIGNALED_NV				0x30E8
-#define EGL_UNSIGNALED_NV			0x30E9
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV		0x0001
-#define EGL_FOREVER_NV				0xFFFFFFFFFFFFFFFFull
-#define EGL_ALREADY_SIGNALED_NV			0x30EA
-#define EGL_TIMEOUT_EXPIRED_NV			0x30EB
-#define EGL_CONDITION_SATISFIED_NV		0x30EC
-#define EGL_SYNC_TYPE_NV			0x30ED
-#define EGL_SYNC_CONDITION_NV			0x30EE
-#define EGL_SYNC_FENCE_NV			0x30EF
-#define EGL_NO_SYNC_NV				((EGLSyncNV)0)
-typedef void* EGLSyncNV;
-typedef khronos_utime_nanoseconds_t EGLTimeNV;
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
-EGLBoolean eglFenceNV (EGLSyncNV sync);
-EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif
-#endif
-
-#if KHRONOS_SUPPORT_INT64   /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
-#ifndef EGL_KHR_fence_sync
-#define EGL_KHR_fence_sync 1
-/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR	0x30F0
-#define EGL_SYNC_CONDITION_KHR			0x30F8
-#define EGL_SYNC_FENCE_KHR			0x30F9
-#endif
-#endif
-
-#ifndef EGL_HI_clientpixmap
-#define EGL_HI_clientpixmap 1
-
-/* Surface Attribute */
-#define EGL_CLIENT_PIXMAP_POINTER_HI		0x8F74
-/*
- * Structure representing a client pixmap
- * (pixmap's data is in client-space memory).
- */
-struct EGLClientPixmapHI
-{
-	void*		pData;
-	EGLint		iWidth;
-	EGLint		iHeight;
-	EGLint		iStride;
-};
-
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
-#endif	/* EGL_HI_clientpixmap */
-
-#ifndef EGL_HI_colorformats
-#define EGL_HI_colorformats 1
-/* Config Attribute */
-#define EGL_COLOR_FORMAT_HI			0x8F70
-/* Color Formats */
-#define EGL_COLOR_RGB_HI			0x8F71
-#define EGL_COLOR_RGBA_HI			0x8F72
-#define EGL_COLOR_ARGB_HI			0x8F73
-#endif /* EGL_HI_colorformats */
-
-#ifndef EGL_NOK_swap_region
-#define EGL_NOK_swap_region 1
-
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
-#endif
-
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
-#endif
-
-
-#ifndef EGL_NOK_texture_from_pixmap
-#define EGL_NOK_texture_from_pixmap 1
-
-#define EGL_Y_INVERTED_NOK			0x307F
-#endif /* EGL_NOK_texture_from_pixmap */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+#ifndef __eglext_h_
+#define __eglext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2010 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+#include <EGL/eglplatform.h>
+
+/*************************************************************/
+
+/* Header file version number */
+/* Current version at http://www.khronos.org/registry/egl/ */
+/* $Revision$ on $Date: 2010-07-27 20:12:35 -0700 (Tue, 27 Jul 2010) $ */
+#define EGL_EGLEXT_VERSION 7
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR			0x3042	/* EGLConfig attribute */
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR	0x0020	/* EGL_SURFACE_TYPE bitfield */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR		0x0040	/* EGL_SURFACE_TYPE bitfield */
+#endif
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR		0x0001	/* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_WRITE_SURFACE_BIT_KHR		0x0002	/* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_LOCK_SURFACE_BIT_KHR		0x0080	/* EGL_SURFACE_TYPE bitfield */
+#define EGL_OPTIMAL_FORMAT_BIT_KHR		0x0100	/* EGL_SURFACE_TYPE bitfield */
+#define EGL_MATCH_FORMAT_KHR			0x3043	/* EGLConfig attribute */
+#define EGL_FORMAT_RGB_565_EXACT_KHR		0x30C0	/* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGB_565_KHR			0x30C1	/* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR		0x30C2	/* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_KHR		0x30C3	/* EGL_MATCH_FORMAT_KHR value */
+#define EGL_MAP_PRESERVE_PIXELS_KHR		0x30C4	/* eglLockSurfaceKHR attribute */
+#define EGL_LOCK_USAGE_HINT_KHR			0x30C5	/* eglLockSurfaceKHR attribute */
+#define EGL_BITMAP_POINTER_KHR			0x30C6	/* eglQuerySurface attribute */
+#define EGL_BITMAP_PITCH_KHR			0x30C7	/* eglQuerySurface attribute */
+#define EGL_BITMAP_ORIGIN_KHR			0x30C8	/* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR		0x30C9	/* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR	0x30CA	/* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR	0x30CB	/* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR	0x30CC	/* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR	0x30CD	/* eglQuerySurface attribute */
+#define EGL_LOWER_LEFT_KHR			0x30CE	/* EGL_BITMAP_ORIGIN_KHR value */
+#define EGL_UPPER_LEFT_KHR			0x30CF	/* EGL_BITMAP_ORIGIN_KHR value */
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
+#endif
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+#define EGL_NATIVE_PIXMAP_KHR			0x30B0	/* eglCreateImageKHR target */
+typedef void *EGLImageKHR;
+#define EGL_NO_IMAGE_KHR			((EGLImageKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#endif
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR			0x30BA	/* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR			0x30B1	/* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_LEVEL_KHR		0x30BC	/* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR	0x30B3	/* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR	0x30B4	/* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR	0x30B5	/* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR	0x30B6	/* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR	0x30B7	/* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR	0x30B8	/* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR			0x30B2	/* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_ZOFFSET_KHR		0x30BD	/* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR			0x30B9	/* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA		0x31D0	/* eglCreateImageKHR attribute */
+#define EGL_DRM_BUFFER_USE_MESA			0x31D1
+
+/* EGL_DRM_BUFFER_FORMAT_MESA tokens */
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA	0x31D2
+
+/* EGL_DRM_BUFFER_USE_MESA bits */
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA		0x0001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA		0x0002
+
+#define EGL_DRM_BUFFER_MESA			0x31D3  /* eglCreateImageKHR target */
+#define EGL_DRM_BUFFER_STRIDE_MESA		0x31D4	/* eglCreateImageKHR attribute */
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESA) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESA) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+
+#ifndef EGL_WL_bind_wayland_display
+#define EGL_WL_bind_wayland_display 1
+
+#define EGL_WAYLAND_BUFFER_WL			0x31D5 /* eglCreateImageKHR target */
+struct wl_display;
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
+#endif
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+#endif
+
+#if KHRONOS_SUPPORT_INT64   /* EGLTimeKHR requires 64-bit uint support */
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+
+typedef void* EGLSyncKHR;
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+
+#define EGL_SYNC_STATUS_KHR			0x30F1
+#define EGL_SIGNALED_KHR			0x30F2
+#define EGL_UNSIGNALED_KHR			0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR			0x30F5
+#define EGL_CONDITION_SATISFIED_KHR		0x30F6
+#define EGL_SYNC_TYPE_KHR			0x30F7
+#define EGL_SYNC_REUSABLE_KHR			0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR		0x0001	/* eglClientWaitSyncKHR <flags> bitfield */
+#define EGL_FOREVER_KHR				0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR				((EGLSyncKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+#endif
+
+/* EGL_MESA_screen extension  >>> PRELIMINARY <<< */
+#ifndef EGL_MESA_screen_surface
+#define EGL_MESA_screen_surface 1
+
+#define EGL_BAD_SCREEN_MESA                    0x4000
+#define EGL_BAD_MODE_MESA                      0x4001
+#define EGL_SCREEN_COUNT_MESA                  0x4002
+#define EGL_SCREEN_POSITION_MESA               0x4003
+#define EGL_SCREEN_POSITION_GRANULARITY_MESA   0x4004
+#define EGL_MODE_ID_MESA                       0x4005
+#define EGL_REFRESH_RATE_MESA                  0x4006
+#define EGL_OPTIMAL_MESA                       0x4007
+#define EGL_INTERLACED_MESA                    0x4008
+#define EGL_SCREEN_BIT_MESA                    0x08
+
+typedef khronos_uint32_t EGLScreenMESA;
+typedef khronos_uint32_t EGLModeMESA;
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
+EGLAPI EGLSurface EGLAPIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
+EGLAPI const char * EGLAPIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSEMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMODESMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGetModeATTRIBMESA) (EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSCRREENSMESA) (EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESCREENSURFACEMESA) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSHOWSCREENSURFACEMESA) (EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSCREENPOSIITONMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENSURFACEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
+typedef const char * (EGLAPIENTRYP PFNEGLQUERYMODESTRINGMESA) (EGLDisplay dpy, EGLModeMESA mode);
+
+#endif /* EGL_MESA_screen_surface */
+
+
+#ifndef EGL_MESA_copy_context
+#define EGL_MESA_copy_context 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
+
+#endif /* EGL_MESA_copy_context */
+
+#ifndef EGL_MESA_drm_display
+#define EGL_MESA_drm_display 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDRMDisplayMESA(int fd);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) (int fd);
+
+#endif /* EGL_MESA_drm_display */
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+/* Most interfaces defined by EGL_KHR_image_pixmap above */
+#define EGL_IMAGE_PRESERVED_KHR			0x30D2	/* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+/* Interfaces defined by EGL_KHR_image above */
+#endif
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG		0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG		0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG		0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG		0x3103
+#endif
+
+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR		0x3110
+#endif
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif
+
+#if KHRONOS_SUPPORT_INT64   /* EGLTimeNV requires 64-bit uint support */
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV	0x30E6
+#define EGL_SYNC_STATUS_NV			0x30E7
+#define EGL_SIGNALED_NV				0x30E8
+#define EGL_UNSIGNALED_NV			0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV		0x0001
+#define EGL_FOREVER_NV				0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV			0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV			0x30EB
+#define EGL_CONDITION_SATISFIED_NV		0x30EC
+#define EGL_SYNC_TYPE_NV			0x30ED
+#define EGL_SYNC_CONDITION_NV			0x30EE
+#define EGL_SYNC_FENCE_NV			0x30EF
+#define EGL_NO_SYNC_NV				((EGLSyncNV)0)
+typedef void* EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
+EGLBoolean eglFenceNV (EGLSyncNV sync);
+EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif
+
+#if KHRONOS_SUPPORT_INT64   /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR	0x30F0
+#define EGL_SYNC_CONDITION_KHR			0x30F8
+#define EGL_SYNC_FENCE_KHR			0x30F9
+#endif
+#endif
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+
+/* Surface Attribute */
+#define EGL_CLIENT_PIXMAP_POINTER_HI		0x8F74
+/*
+ * Structure representing a client pixmap
+ * (pixmap's data is in client-space memory).
+ */
+struct EGLClientPixmapHI
+{
+	void*		pData;
+	EGLint		iWidth;
+	EGLint		iHeight;
+	EGLint		iStride;
+};
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
+#endif	/* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+/* Config Attribute */
+#define EGL_COLOR_FORMAT_HI			0x8F70
+/* Color Formats */
+#define EGL_COLOR_RGB_HI			0x8F71
+#define EGL_COLOR_RGBA_HI			0x8F72
+#define EGL_COLOR_ARGB_HI			0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
+#endif
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
+#endif
+
+
+#ifndef EGL_NOK_texture_from_pixmap
+#define EGL_NOK_texture_from_pixmap 1
+
+#define EGL_Y_INVERTED_NOK			0x307F
+#endif /* EGL_NOK_texture_from_pixmap */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mesalib/include/EGL/eglplatform.h b/mesalib/include/EGL/eglplatform.h
index 98ae998ae..b632a47fb 100644
--- a/mesalib/include/EGL/eglplatform.h
+++ b/mesalib/include/EGL/eglplatform.h
@@ -1,126 +1,126 @@
-#ifndef __eglplatform_h_
-#define __eglplatform_h_
-
-/*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE 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
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Platform-specific types and definitions for egl.h
- * $Revision$ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * You are encouraged to submit all modifications to the Khronos group so that
- * they can be included in future versions of this file.  Please submit changes
- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
- * by filing a bug against product "EGL" component "Registry".
- */
-
-#include <KHR/khrplatform.h>
-
-/* Macros used in EGL function prototype declarations.
- *
- * EGL functions should be prototyped as:
- *
- * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
- * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
- *
- * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
- */
-
-#ifndef EGLAPI
-#define EGLAPI KHRONOS_APICALL
-#endif
-
-#ifndef EGLAPIENTRY
-#define EGLAPIENTRY  KHRONOS_APIENTRY
-#endif
-#define EGLAPIENTRYP EGLAPIENTRY*
-
-/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
- * are aliases of window-system-dependent types, such as X Display * or
- * Windows Device Context. They must be defined in platform-specific
- * code below. The EGL-prefixed versions of Native*Type are the same
- * types, renamed in EGL 1.3 so all types in the API start with "EGL".
- */
-
-#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#include <windows.h>
-
-typedef HDC     EGLNativeDisplayType;
-typedef HBITMAP EGLNativePixmapType;
-typedef HWND    EGLNativeWindowType;
-
-#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
-
-typedef int   EGLNativeDisplayType;
-typedef void *EGLNativeWindowType;
-typedef void *EGLNativePixmapType;
-
-#elif defined(WL_EGL_PLATFORM)
-
-typedef struct wl_egl_display *EGLNativeDisplayType;
-typedef struct wl_egl_pixmap  *EGLNativePixmapType;
-typedef struct wl_egl_window  *EGLNativeWindowType;
-
-#elif defined(__unix__) || defined(__unix)
-
-#ifdef MESA_EGL_NO_X11_HEADERS
-
-typedef void            *EGLNativeDisplayType;
-typedef khronos_uint32_t EGLNativePixmapType;
-typedef khronos_uint32_t EGLNativeWindowType;
-
-#else
-
-/* X11 (tentative)  */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef Display *EGLNativeDisplayType;
-typedef Pixmap   EGLNativePixmapType;
-typedef Window   EGLNativeWindowType;
-
-#endif /* MESA_EGL_NO_X11_HEADERS */
-
-#else
-#error "Platform not recognized"
-#endif
-
-/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
-typedef EGLNativeDisplayType NativeDisplayType;
-typedef EGLNativePixmapType  NativePixmapType;
-typedef EGLNativeWindowType  NativeWindowType;
-
-
-/* Define EGLint. This must be a signed integral type large enough to contain
- * all legal attribute names and values passed into and out of EGL, whether
- * their type is boolean, bitmask, enumerant (symbolic constant), integer,
- * handle, or other.  While in general a 32-bit integer will suffice, if
- * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
- * integer type.
- */
-typedef khronos_int32_t EGLint;
-
-#endif /* __eglplatform_h */
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Platform-specific types and definitions for egl.h
+ * $Revision$ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file.  Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "EGL" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+/* Macros used in EGL function prototype declarations.
+ *
+ * EGL functions should be prototyped as:
+ *
+ * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+ * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+ *
+ * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+ */
+
+#ifndef EGLAPI
+#define EGLAPI KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY  KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+ * are aliases of window-system-dependent types, such as X Display * or
+ * Windows Device Context. They must be defined in platform-specific
+ * code below. The EGL-prefixed versions of Native*Type are the same
+ * types, renamed in EGL 1.3 so all types in the API start with "EGL".
+ */
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+
+typedef HDC     EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND    EGLNativeWindowType;
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
+
+typedef int   EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#elif defined(WL_EGL_PLATFORM)
+
+typedef struct wl_display     *EGLNativeDisplayType;
+typedef struct wl_egl_pixmap  *EGLNativePixmapType;
+typedef struct wl_egl_window  *EGLNativeWindowType;
+
+#elif defined(__unix__) || defined(__unix)
+
+#ifdef MESA_EGL_NO_X11_HEADERS
+
+typedef void            *EGLNativeDisplayType;
+typedef khronos_uint32_t EGLNativePixmapType;
+typedef khronos_uint32_t EGLNativeWindowType;
+
+#else
+
+/* X11 (tentative)  */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap   EGLNativePixmapType;
+typedef Window   EGLNativeWindowType;
+
+#endif /* MESA_EGL_NO_X11_HEADERS */
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType  NativePixmapType;
+typedef EGLNativeWindowType  NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+ * all legal attribute names and values passed into and out of EGL, whether
+ * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+ * handle, or other.  While in general a 32-bit integer will suffice, if
+ * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+ * integer type.
+ */
+typedef khronos_int32_t EGLint;
+
+#endif /* __eglplatform_h */
diff --git a/mesalib/src/SConscript b/mesalib/src/SConscript
index f5951fc9d..7b614daee 100644
--- a/mesalib/src/SConscript
+++ b/mesalib/src/SConscript
@@ -1,32 +1,33 @@
-Import('*')
-
-
-if env['platform'] == 'windows':
-    SConscript('getopt/SConscript')
-
-SConscript('glsl/SConscript')
-
-if env['hostonly']:
-    # We are just compiling the things necessary on the host for cross
-    # compilation
-    Return()
-
-
-# When env['gles'] is set, the targets defined in mapi/glapi/SConscript are not
-# used.  libgl-xlib and libgl-gdi adapt themselves to use the targets defined
-# in mapi/glapi-shared/SConscript.  mesa/SConscript also adapts itself to
-# enable OpenGL ES support.
-SConscript('mapi/glapi/SConscript')
-SConscript('mesa/SConscript')
-
-SConscript('mapi/vgapi/SConscript')
-
-if env['platform'] != 'embedded':
-    SConscript('egl/main/SConscript')
-    SConscript('glut/glx/SConscript')
-
-    if env['gles']:
-        SConscript('mapi/shared-glapi/SConscript')
-
-SConscript('gallium/SConscript')
-
+Import('*')
+
+
+if env['platform'] == 'windows':
+    SConscript('getopt/SConscript')
+
+SConscript('glsl/SConscript')
+
+if env['hostonly']:
+    # We are just compiling the things necessary on the host for cross
+    # compilation
+    Return()
+
+
+# When env['gles'] is set, the targets defined in mapi/glapi/SConscript are not
+# used.  libgl-xlib and libgl-gdi adapt themselves to use the targets defined
+# in mapi/glapi-shared/SConscript.  mesa/SConscript also adapts itself to
+# enable OpenGL ES support.
+SConscript('mapi/glapi/SConscript')
+SConscript('mesa/SConscript')
+
+SConscript('mapi/vgapi/SConscript')
+
+if env['platform'] != 'embedded':
+    SConscript('egl/main/SConscript')
+    SConscript('glu/sgi/SConscript')
+    SConscript('glut/glx/SConscript')
+
+    if env['gles']:
+        SConscript('mapi/shared-glapi/SConscript')
+
+SConscript('gallium/SConscript')
+
diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp
index 8247ceffd..67147b671 100644
--- a/mesalib/src/glsl/ast_function.cpp
+++ b/mesalib/src/glsl/ast_function.cpp
@@ -1,1291 +1,1295 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * 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.
- */
-
-#include "glsl_symbol_table.h"
-#include "ast.h"
-#include "glsl_types.h"
-#include "ir.h"
-#include "main/core.h" /* for MIN2 */
-
-static ir_rvalue *
-convert_component(ir_rvalue *src, const glsl_type *desired_type);
-
-bool
-apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from,
-                          struct _mesa_glsl_parse_state *state);
-
-static unsigned
-process_parameters(exec_list *instructions, exec_list *actual_parameters,
-		   exec_list *parameters,
-		   struct _mesa_glsl_parse_state *state)
-{
-   unsigned count = 0;
-
-   foreach_list (n, parameters) {
-      ast_node *const ast = exec_node_data(ast_node, n, link);
-      ir_rvalue *result = ast->hir(instructions, state);
-
-      ir_constant *const constant = result->constant_expression_value();
-      if (constant != NULL)
-	 result = constant;
-
-      actual_parameters->push_tail(result);
-      count++;
-   }
-
-   return count;
-}
-
-
-/**
- * Generate a source prototype for a function signature
- *
- * \param return_type Return type of the function.  May be \c NULL.
- * \param name        Name of the function.
- * \param parameters  Parameter list for the function.  This may be either a
- *                    formal or actual parameter list.  Only the type is used.
- *
- * \return
- * A ralloced string representing the prototype of the function.
- */
-char *
-prototype_string(const glsl_type *return_type, const char *name,
-		 exec_list *parameters)
-{
-   char *str = NULL;
-
-   if (return_type != NULL)
-      str = ralloc_asprintf(NULL, "%s ", return_type->name);
-
-   ralloc_asprintf_append(&str, "%s(", name);
-
-   const char *comma = "";
-   foreach_list(node, parameters) {
-      const ir_instruction *const param = (ir_instruction *) node;
-
-      ralloc_asprintf_append(&str, "%s%s", comma, param->type->name);
-      comma = ", ";
-   }
-
-   ralloc_strcat(&str, ")");
-   return str;
-}
-
-
-static ir_rvalue *
-match_function_by_name(exec_list *instructions, const char *name,
-		       YYLTYPE *loc, exec_list *actual_parameters,
-		       struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   ir_function *f = state->symbols->get_function(name);
-   ir_function_signature *sig;
-
-   sig = f ? f->matching_signature(actual_parameters) : NULL;
-
-   /* FINISHME: This doesn't handle the case where shader X contains a
-    * FINISHME: matching signature but shader X + N contains an _exact_
-    * FINISHME: matching signature.
-    */
-   if (sig == NULL && (f == NULL || state->es_shader || !f->has_user_signature()) && state->symbols->get_type(name) == NULL && (state->language_version == 110 || state->symbols->get_variable(name) == NULL)) {
-      /* The current shader doesn't contain a matching function or signature.
-       * Before giving up, look for the prototype in the built-in functions.
-       */
-      for (unsigned i = 0; i < state->num_builtins_to_link; i++) {
-	 ir_function *builtin;
-	 builtin = state->builtins_to_link[i]->symbols->get_function(name);
-	 sig = builtin ? builtin->matching_signature(actual_parameters) : NULL;
-	 if (sig != NULL) {
-	    if (f == NULL) {
-	       f = new(ctx) ir_function(name);
-	       state->symbols->add_global_function(f);
-	       emit_function(state, instructions, f);
-	    }
-
-	    f->add_signature(sig->clone_prototype(f, NULL));
-	    break;
-	 }
-      }
-   }
-
-   if (sig != NULL) {
-      /* Verify that 'out' and 'inout' actual parameters are lvalues.  This
-       * isn't done in ir_function::matching_signature because that function
-       * cannot generate the necessary diagnostics.
-       *
-       * Also, validate that 'const_in' formal parameters (an extension of our
-       * IR) correspond to ir_constant actual parameters.
-       */
-      exec_list_iterator actual_iter = actual_parameters->iterator();
-      exec_list_iterator formal_iter = sig->parameters.iterator();
-
-      while (actual_iter.has_next()) {
-	 ir_rvalue *actual = (ir_rvalue *) actual_iter.get();
-	 ir_variable *formal = (ir_variable *) formal_iter.get();
-
-	 assert(actual != NULL);
-	 assert(formal != NULL);
-
-	 if (formal->mode == ir_var_const_in && !actual->as_constant()) {
-	    _mesa_glsl_error(loc, state,
-			     "parameter `%s' must be a constant expression",
-			     formal->name);
-	 }
-
-	 if ((formal->mode == ir_var_out)
-	     || (formal->mode == ir_var_inout)) {
-	    const char *mode = NULL;
-	    switch (formal->mode) {
-	    case ir_var_out:   mode = "out";   break;
-	    case ir_var_inout: mode = "inout"; break;
-	    default:           assert(false);  break;
-	    }
-            /* FIXME: 'loc' is incorrect (as of 2011-01-21). It is always
-             * FIXME: 0:0(0).
-             */
-	    if (actual->variable_referenced()
-	        && actual->variable_referenced()->read_only) {
-	       _mesa_glsl_error(loc, state,
-	                        "function parameter '%s %s' references the "
-	                        "read-only variable '%s'",
-	                        mode, formal->name,
-	                        actual->variable_referenced()->name);
-
-	    } else if (!actual->is_lvalue()) {
-               _mesa_glsl_error(loc, state,
-                                "function parameter '%s %s' is not an lvalue",
-                                mode, formal->name);
-	    }
-	 }
-
-	 if (formal->type->is_numeric() || formal->type->is_boolean()) {
-	    ir_rvalue *converted = convert_component(actual, formal->type);
-	    actual->replace_with(converted);
-	 }
-
-	 actual_iter.next();
-	 formal_iter.next();
-      }
-
-      /* Always insert the call in the instruction stream, and return a deref
-       * of its return val if it returns a value, since we don't know if
-       * the rvalue is going to be assigned to anything or not.
-       */
-      ir_call *call = new(ctx) ir_call(sig, actual_parameters);
-      if (!sig->return_type->is_void()) {
-	 ir_variable *var;
-	 ir_dereference_variable *deref;
-
-	 var = new(ctx) ir_variable(sig->return_type,
-				    ralloc_asprintf(ctx, "%s_retval",
-						    sig->function_name()),
-				    ir_var_temporary);
-	 instructions->push_tail(var);
-
-	 deref = new(ctx) ir_dereference_variable(var);
-	 ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL);
-	 instructions->push_tail(assign);
-	 if (state->language_version >= 120)
-	    var->constant_value = call->constant_expression_value();
-
-	 deref = new(ctx) ir_dereference_variable(var);
-	 return deref;
-      } else {
-	 instructions->push_tail(call);
-	 return NULL;
-      }
-   } else {
-      char *str = prototype_string(NULL, name, actual_parameters);
-
-      _mesa_glsl_error(loc, state, "no matching function for call to `%s'",
-		       str);
-      ralloc_free(str);
-
-      const char *prefix = "candidates are: ";
-
-      for (int i = -1; i < (int) state->num_builtins_to_link; i++) {
-	 glsl_symbol_table *syms = i >= 0 ? state->builtins_to_link[i]->symbols
-					  : state->symbols;
-	 f = syms->get_function(name);
-	 if (f == NULL)
-	    continue;
-
-	 foreach_list (node, &f->signatures) {
-	    ir_function_signature *sig = (ir_function_signature *) node;
-
-	    str = prototype_string(sig->return_type, f->name, &sig->parameters);
-	    _mesa_glsl_error(loc, state, "%s%s\n", prefix, str);
-	    ralloc_free(str);
-
-	    prefix = "                ";
-	 }
-
-      }
-
-      return ir_call::get_error_instruction(ctx);
-   }
-}
-
-
-/**
- * Perform automatic type conversion of constructor parameters
- *
- * This implements the rules in the "Conversion and Scalar Constructors"
- * section (GLSL 1.10 section 5.4.1), not the "Implicit Conversions" rules.
- */
-static ir_rvalue *
-convert_component(ir_rvalue *src, const glsl_type *desired_type)
-{
-   void *ctx = ralloc_parent(src);
-   const unsigned a = desired_type->base_type;
-   const unsigned b = src->type->base_type;
-   ir_expression *result = NULL;
-
-   if (src->type->is_error())
-      return src;
-
-   assert(a <= GLSL_TYPE_BOOL);
-   assert(b <= GLSL_TYPE_BOOL);
-
-   if ((a == b) || (src->type->is_integer() && desired_type->is_integer()))
-      return src;
-
-   switch (a) {
-   case GLSL_TYPE_UINT:
-   case GLSL_TYPE_INT:
-      if (b == GLSL_TYPE_FLOAT)
-	 result = new(ctx) ir_expression(ir_unop_f2i, desired_type, src, NULL);
-      else {
-	 assert(b == GLSL_TYPE_BOOL);
-	 result = new(ctx) ir_expression(ir_unop_b2i, desired_type, src, NULL);
-      }
-      break;
-   case GLSL_TYPE_FLOAT:
-      switch (b) {
-      case GLSL_TYPE_UINT:
-	 result = new(ctx) ir_expression(ir_unop_u2f, desired_type, src, NULL);
-	 break;
-      case GLSL_TYPE_INT:
-	 result = new(ctx) ir_expression(ir_unop_i2f, desired_type, src, NULL);
-	 break;
-      case GLSL_TYPE_BOOL:
-	 result = new(ctx) ir_expression(ir_unop_b2f, desired_type, src, NULL);
-	 break;
-      }
-      break;
-   case GLSL_TYPE_BOOL:
-      switch (b) {
-      case GLSL_TYPE_UINT:
-      case GLSL_TYPE_INT:
-	 result = new(ctx) ir_expression(ir_unop_i2b, desired_type, src, NULL);
-	 break;
-      case GLSL_TYPE_FLOAT:
-	 result = new(ctx) ir_expression(ir_unop_f2b, desired_type, src, NULL);
-	 break;
-      }
-      break;
-   }
-
-   assert(result != NULL);
-
-   /* Try constant folding; it may fold in the conversion we just added. */
-   ir_constant *const constant = result->constant_expression_value();
-   return (constant != NULL) ? (ir_rvalue *) constant : (ir_rvalue *) result;
-}
-
-/**
- * Dereference a specific component from a scalar, vector, or matrix
- */
-static ir_rvalue *
-dereference_component(ir_rvalue *src, unsigned component)
-{
-   void *ctx = ralloc_parent(src);
-   assert(component < src->type->components());
-
-   /* If the source is a constant, just create a new constant instead of a
-    * dereference of the existing constant.
-    */
-   ir_constant *constant = src->as_constant();
-   if (constant)
-      return new(ctx) ir_constant(constant, component);
-
-   if (src->type->is_scalar()) {
-      return src;
-   } else if (src->type->is_vector()) {
-      return new(ctx) ir_swizzle(src, component, 0, 0, 0, 1);
-   } else {
-      assert(src->type->is_matrix());
-
-      /* Dereference a row of the matrix, then call this function again to get
-       * a specific element from that row.
-       */
-      const int c = component / src->type->column_type()->vector_elements;
-      const int r = component % src->type->column_type()->vector_elements;
-      ir_constant *const col_index = new(ctx) ir_constant(c);
-      ir_dereference *const col = new(ctx) ir_dereference_array(src, col_index);
-
-      col->type = src->type->column_type();
-
-      return dereference_component(col, r);
-   }
-
-   assert(!"Should not get here.");
-   return NULL;
-}
-
-
-static ir_rvalue *
-process_array_constructor(exec_list *instructions,
-			  const glsl_type *constructor_type,
-			  YYLTYPE *loc, exec_list *parameters,
-			  struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   /* Array constructors come in two forms: sized and unsized.  Sized array
-    * constructors look like 'vec4[2](a, b)', where 'a' and 'b' are vec4
-    * variables.  In this case the number of parameters must exactly match the
-    * specified size of the array.
-    *
-    * Unsized array constructors look like 'vec4[](a, b)', where 'a' and 'b'
-    * are vec4 variables.  In this case the size of the array being constructed
-    * is determined by the number of parameters.
-    *
-    * From page 52 (page 58 of the PDF) of the GLSL 1.50 spec:
-    *
-    *    "There must be exactly the same number of arguments as the size of
-    *    the array being constructed. If no size is present in the
-    *    constructor, then the array is explicitly sized to the number of
-    *    arguments provided. The arguments are assigned in order, starting at
-    *    element 0, to the elements of the constructed array. Each argument
-    *    must be the same type as the element type of the array, or be a type
-    *    that can be converted to the element type of the array according to
-    *    Section 4.1.10 "Implicit Conversions.""
-    */
-   exec_list actual_parameters;
-   const unsigned parameter_count =
-      process_parameters(instructions, &actual_parameters, parameters, state);
-
-   if ((parameter_count == 0)
-       || ((constructor_type->length != 0)
-	   && (constructor_type->length != parameter_count))) {
-      const unsigned min_param = (constructor_type->length == 0)
-	 ? 1 : constructor_type->length;
-
-      _mesa_glsl_error(loc, state, "array constructor must have %s %u "
-		       "parameter%s",
-		       (constructor_type->length != 0) ? "at least" : "exactly",
-		       min_param, (min_param <= 1) ? "" : "s");
-      return ir_call::get_error_instruction(ctx);
-   }
-
-   if (constructor_type->length == 0) {
-      constructor_type =
-	 glsl_type::get_array_instance(constructor_type->element_type(),
-				       parameter_count);
-      assert(constructor_type != NULL);
-      assert(constructor_type->length == parameter_count);
-   }
-
-   bool all_parameters_are_constant = true;
-
-   /* Type cast each parameter and, if possible, fold constants. */
-   foreach_list_safe(n, &actual_parameters) {
-      ir_rvalue *ir = (ir_rvalue *) n;
-      ir_rvalue *result = ir;
-
-      /* Apply implicit conversions (not the scalar constructor rules!) */
-      if (constructor_type->element_type()->is_float()) {
-	 const glsl_type *desired_type =
-	    glsl_type::get_instance(GLSL_TYPE_FLOAT,
-				    ir->type->vector_elements,
-				    ir->type->matrix_columns);
-	 result = convert_component(ir, desired_type);
-      }
-
-      if (result->type != constructor_type->element_type()) {
-	 _mesa_glsl_error(loc, state, "type error in array constructor: "
-			  "expected: %s, found %s",
-			  constructor_type->element_type()->name,
-			  result->type->name);
-      }
-
-      /* Attempt to convert the parameter to a constant valued expression.
-       * After doing so, track whether or not all the parameters to the
-       * constructor are trivially constant valued expressions.
-       */
-      ir_rvalue *const constant = result->constant_expression_value();
-
-      if (constant != NULL)
-         result = constant;
-      else
-         all_parameters_are_constant = false;
-
-      ir->replace_with(result);
-   }
-
-   if (all_parameters_are_constant)
-      return new(ctx) ir_constant(constructor_type, &actual_parameters);
-
-   ir_variable *var = new(ctx) ir_variable(constructor_type, "array_ctor",
-					   ir_var_temporary);
-   instructions->push_tail(var);
-
-   int i = 0;
-   foreach_list(node, &actual_parameters) {
-      ir_rvalue *rhs = (ir_rvalue *) node;
-      ir_rvalue *lhs = new(ctx) ir_dereference_array(var,
-						     new(ctx) ir_constant(i));
-
-      ir_instruction *assignment = new(ctx) ir_assignment(lhs, rhs, NULL);
-      instructions->push_tail(assignment);
-
-      i++;
-   }
-
-   return new(ctx) ir_dereference_variable(var);
-}
-
-
-/**
- * Try to convert a record constructor to a constant expression
- */
-static ir_constant *
-constant_record_constructor(const glsl_type *constructor_type,
-			    exec_list *parameters, void *mem_ctx)
-{
-   foreach_list(node, parameters) {
-      ir_constant *constant = ((ir_instruction *) node)->as_constant();
-      if (constant == NULL)
-	 return NULL;
-      node->replace_with(constant);
-   }
-
-   return new(mem_ctx) ir_constant(constructor_type, parameters);
-}
-
-
-/**
- * Determine if a list consists of a single scalar r-value
- */
-bool
-single_scalar_parameter(exec_list *parameters)
-{
-   const ir_rvalue *const p = (ir_rvalue *) parameters->head;
-   assert(((ir_rvalue *)p)->as_rvalue() != NULL);
-
-   return (p->type->is_scalar() && p->next->is_tail_sentinel());
-}
-
-
-/**
- * Generate inline code for a vector constructor
- *
- * The generated constructor code will consist of a temporary variable
- * declaration of the same type as the constructor.  A sequence of assignments
- * from constructor parameters to the temporary will follow.
- *
- * \return
- * An \c ir_dereference_variable of the temprorary generated in the constructor
- * body.
- */
-ir_rvalue *
-emit_inline_vector_constructor(const glsl_type *type,
-			       exec_list *instructions,
-			       exec_list *parameters,
-			       void *ctx)
-{
-   assert(!parameters->is_empty());
-
-   ir_variable *var = new(ctx) ir_variable(type, "vec_ctor", ir_var_temporary);
-   instructions->push_tail(var);
-
-   /* There are two kinds of vector constructors.
-    *
-    *  - Construct a vector from a single scalar by replicating that scalar to
-    *    all components of the vector.
-    *
-    *  - Construct a vector from an arbirary combination of vectors and
-    *    scalars.  The components of the constructor parameters are assigned
-    *    to the vector in order until the vector is full.
-    */
-   const unsigned lhs_components = type->components();
-   if (single_scalar_parameter(parameters)) {
-      ir_rvalue *first_param = (ir_rvalue *)parameters->head;
-      ir_rvalue *rhs = new(ctx) ir_swizzle(first_param, 0, 0, 0, 0,
-					   lhs_components);
-      ir_dereference_variable *lhs = new(ctx) ir_dereference_variable(var);
-      const unsigned mask = (1U << lhs_components) - 1;
-
-      assert(rhs->type == lhs->type);
-
-      ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, mask);
-      instructions->push_tail(inst);
-   } else {
-      unsigned base_component = 0;
-      unsigned base_lhs_component = 0;
-      ir_constant_data data;
-      unsigned constant_mask = 0, constant_components = 0;
-
-      memset(&data, 0, sizeof(data));
-
-      foreach_list(node, parameters) {
-	 ir_rvalue *param = (ir_rvalue *) node;
-	 unsigned rhs_components = param->type->components();
-
-	 /* Do not try to assign more components to the vector than it has!
-	  */
-	 if ((rhs_components + base_lhs_component) > lhs_components) {
-	    rhs_components = lhs_components - base_lhs_component;
-	 }
-
-	 const ir_constant *const c = param->as_constant();
-	 if (c != NULL) {
-	    for (unsigned i = 0; i < rhs_components; i++) {
-	       switch (c->type->base_type) {
-	       case GLSL_TYPE_UINT:
-		  data.u[i + base_component] = c->get_uint_component(i);
-		  break;
-	       case GLSL_TYPE_INT:
-		  data.i[i + base_component] = c->get_int_component(i);
-		  break;
-	       case GLSL_TYPE_FLOAT:
-		  data.f[i + base_component] = c->get_float_component(i);
-		  break;
-	       case GLSL_TYPE_BOOL:
-		  data.b[i + base_component] = c->get_bool_component(i);
-		  break;
-	       default:
-		  assert(!"Should not get here.");
-		  break;
-	       }
-	    }
-
-	    /* Mask of fields to be written in the assignment.
-	     */
-	    constant_mask |= ((1U << rhs_components) - 1) << base_lhs_component;
-	    constant_components += rhs_components;
-
-	    base_component += rhs_components;
-	 }
-	 /* Advance the component index by the number of components
-	  * that were just assigned.
-	  */
-	 base_lhs_component += rhs_components;
-      }
-
-      if (constant_mask != 0) {
-	 ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
-	 const glsl_type *rhs_type = glsl_type::get_instance(var->type->base_type,
-							     constant_components,
-							     1);
-	 ir_rvalue *rhs = new(ctx) ir_constant(rhs_type, &data);
-
-	 ir_instruction *inst =
-	    new(ctx) ir_assignment(lhs, rhs, NULL, constant_mask);
-	 instructions->push_tail(inst);
-      }
-
-      base_component = 0;
-      foreach_list(node, parameters) {
-	 ir_rvalue *param = (ir_rvalue *) node;
-	 unsigned rhs_components = param->type->components();
-
-	 /* Do not try to assign more components to the vector than it has!
-	  */
-	 if ((rhs_components + base_component) > lhs_components) {
-	    rhs_components = lhs_components - base_component;
-	 }
-
-	 const ir_constant *const c = param->as_constant();
-	 if (c == NULL) {
-	    /* Mask of fields to be written in the assignment.
-	     */
-	    const unsigned write_mask = ((1U << rhs_components) - 1)
-	       << base_component;
-
-	    ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
-
-	    /* Generate a swizzle so that LHS and RHS sizes match.
-	     */
-	    ir_rvalue *rhs =
-	       new(ctx) ir_swizzle(param, 0, 1, 2, 3, rhs_components);
-
-	    ir_instruction *inst =
-	       new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
-	    instructions->push_tail(inst);
-	 }
-
-	 /* Advance the component index by the number of components that were
-	  * just assigned.
-	  */
-	 base_component += rhs_components;
-      }
-   }
-   return new(ctx) ir_dereference_variable(var);
-}
-
-
-/**
- * Generate assignment of a portion of a vector to a portion of a matrix column
- *
- * \param src_base  First component of the source to be used in assignment
- * \param column    Column of destination to be assiged
- * \param row_base  First component of the destination column to be assigned
- * \param count     Number of components to be assigned
- *
- * \note
- * \c src_base + \c count must be less than or equal to the number of components
- * in the source vector.
- */
-ir_instruction *
-assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
-			ir_rvalue *src, unsigned src_base, unsigned count,
-			void *mem_ctx)
-{
-   ir_constant *col_idx = new(mem_ctx) ir_constant(column);
-   ir_dereference *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx);
-
-   assert(column_ref->type->components() >= (row_base + count));
-   assert(src->type->components() >= (src_base + count));
-
-   /* Generate a swizzle that extracts the number of components from the source
-    * that are to be assigned to the column of the matrix.
-    */
-   if (count < src->type->vector_elements) {
-      src = new(mem_ctx) ir_swizzle(src,
-				    src_base + 0, src_base + 1,
-				    src_base + 2, src_base + 3,
-				    count);
-   }
-
-   /* Mask of fields to be written in the assignment.
-    */
-   const unsigned write_mask = ((1U << count) - 1) << row_base;
-
-   return new(mem_ctx) ir_assignment(column_ref, src, NULL, write_mask);
-}
-
-
-/**
- * Generate inline code for a matrix constructor
- *
- * The generated constructor code will consist of a temporary variable
- * declaration of the same type as the constructor.  A sequence of assignments
- * from constructor parameters to the temporary will follow.
- *
- * \return
- * An \c ir_dereference_variable of the temprorary generated in the constructor
- * body.
- */
-ir_rvalue *
-emit_inline_matrix_constructor(const glsl_type *type,
-			       exec_list *instructions,
-			       exec_list *parameters,
-			       void *ctx)
-{
-   assert(!parameters->is_empty());
-
-   ir_variable *var = new(ctx) ir_variable(type, "mat_ctor", ir_var_temporary);
-   instructions->push_tail(var);
-
-   /* There are three kinds of matrix constructors.
-    *
-    *  - Construct a matrix from a single scalar by replicating that scalar to
-    *    along the diagonal of the matrix and setting all other components to
-    *    zero.
-    *
-    *  - Construct a matrix from an arbirary combination of vectors and
-    *    scalars.  The components of the constructor parameters are assigned
-    *    to the matrix in colum-major order until the matrix is full.
-    *
-    *  - Construct a matrix from a single matrix.  The source matrix is copied
-    *    to the upper left portion of the constructed matrix, and the remaining
-    *    elements take values from the identity matrix.
-    */
-   ir_rvalue *const first_param = (ir_rvalue *) parameters->head;
-   if (single_scalar_parameter(parameters)) {
-      /* Assign the scalar to the X component of a vec4, and fill the remaining
-       * components with zero.
-       */
-      ir_variable *rhs_var =
-	 new(ctx) ir_variable(glsl_type::vec4_type, "mat_ctor_vec",
-			      ir_var_temporary);
-      instructions->push_tail(rhs_var);
-
-      ir_constant_data zero;
-      zero.f[0] = 0.0;
-      zero.f[1] = 0.0;
-      zero.f[2] = 0.0;
-      zero.f[3] = 0.0;
-
-      ir_instruction *inst =
-	 new(ctx) ir_assignment(new(ctx) ir_dereference_variable(rhs_var),
-				new(ctx) ir_constant(rhs_var->type, &zero),
-				NULL);
-      instructions->push_tail(inst);
-
-      ir_dereference *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
-
-      inst = new(ctx) ir_assignment(rhs_ref, first_param, NULL, 0x01);
-      instructions->push_tail(inst);
-
-      /* Assign the temporary vector to each column of the destination matrix
-       * with a swizzle that puts the X component on the diagonal of the
-       * matrix.  In some cases this may mean that the X component does not
-       * get assigned into the column at all (i.e., when the matrix has more
-       * columns than rows).
-       */
-      static const unsigned rhs_swiz[4][4] = {
-	 { 0, 1, 1, 1 },
-	 { 1, 0, 1, 1 },
-	 { 1, 1, 0, 1 },
-	 { 1, 1, 1, 0 }
-      };
-
-      const unsigned cols_to_init = MIN2(type->matrix_columns,
-					 type->vector_elements);
-      for (unsigned i = 0; i < cols_to_init; i++) {
-	 ir_constant *const col_idx = new(ctx) ir_constant(i);
-	 ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx);
-
-	 ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
-	 ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, rhs_swiz[i],
-						    type->vector_elements);
-
-	 inst = new(ctx) ir_assignment(col_ref, rhs, NULL);
-	 instructions->push_tail(inst);
-      }
-
-      for (unsigned i = cols_to_init; i < type->matrix_columns; i++) {
-	 ir_constant *const col_idx = new(ctx) ir_constant(i);
-	 ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx);
-
-	 ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
-	 ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, 1, 1, 1, 1,
-						    type->vector_elements);
-
-	 inst = new(ctx) ir_assignment(col_ref, rhs, NULL);
-	 instructions->push_tail(inst);
-      }
-   } else if (first_param->type->is_matrix()) {
-      /* From page 50 (56 of the PDF) of the GLSL 1.50 spec:
-       *
-       *     "If a matrix is constructed from a matrix, then each component
-       *     (column i, row j) in the result that has a corresponding
-       *     component (column i, row j) in the argument will be initialized
-       *     from there. All other components will be initialized to the
-       *     identity matrix. If a matrix argument is given to a matrix
-       *     constructor, it is an error to have any other arguments."
-       */
-      assert(first_param->next->is_tail_sentinel());
-      ir_rvalue *const src_matrix = first_param;
-
-      /* If the source matrix is smaller, pre-initialize the relavent parts of
-       * the destination matrix to the identity matrix.
-       */
-      if ((src_matrix->type->matrix_columns < var->type->matrix_columns)
-	  || (src_matrix->type->vector_elements < var->type->vector_elements)) {
-
-	 /* If the source matrix has fewer rows, every column of the destination
-	  * must be initialized.  Otherwise only the columns in the destination
-	  * that do not exist in the source must be initialized.
-	  */
-	 unsigned col =
-	    (src_matrix->type->vector_elements < var->type->vector_elements)
-	    ? 0 : src_matrix->type->matrix_columns;
-
-	 const glsl_type *const col_type = var->type->column_type();
-	 for (/* empty */; col < var->type->matrix_columns; col++) {
-	    ir_constant_data ident;
-
-	    ident.f[0] = 0.0;
-	    ident.f[1] = 0.0;
-	    ident.f[2] = 0.0;
-	    ident.f[3] = 0.0;
-
-	    ident.f[col] = 1.0;
-
-	    ir_rvalue *const rhs = new(ctx) ir_constant(col_type, &ident);
-
-	    ir_rvalue *const lhs =
-	       new(ctx) ir_dereference_array(var, new(ctx) ir_constant(col));
-
-	    ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL);
-	    instructions->push_tail(inst);
-	 }
-      }
-
-      /* Assign columns from the source matrix to the destination matrix.
-       *
-       * Since the parameter will be used in the RHS of multiple assignments,
-       * generate a temporary and copy the paramter there.
-       */
-      ir_variable *const rhs_var =
-	 new(ctx) ir_variable(first_param->type, "mat_ctor_mat",
-			      ir_var_temporary);
-      instructions->push_tail(rhs_var);
-
-      ir_dereference *const rhs_var_ref =
-	 new(ctx) ir_dereference_variable(rhs_var);
-      ir_instruction *const inst =
-	 new(ctx) ir_assignment(rhs_var_ref, first_param, NULL);
-      instructions->push_tail(inst);
-
-      const unsigned last_row = MIN2(src_matrix->type->vector_elements,
-				     var->type->vector_elements);
-      const unsigned last_col = MIN2(src_matrix->type->matrix_columns,
-				     var->type->matrix_columns);
-
-      unsigned swiz[4] = { 0, 0, 0, 0 };
-      for (unsigned i = 1; i < last_row; i++)
-	 swiz[i] = i;
-
-      const unsigned write_mask = (1U << last_row) - 1;
-
-      for (unsigned i = 0; i < last_col; i++) {
-	 ir_dereference *const lhs =
-	    new(ctx) ir_dereference_array(var, new(ctx) ir_constant(i));
-	 ir_rvalue *const rhs_col =
-	    new(ctx) ir_dereference_array(rhs_var, new(ctx) ir_constant(i));
-
-	 /* If one matrix has columns that are smaller than the columns of the
-	  * other matrix, wrap the column access of the larger with a swizzle
-	  * so that the LHS and RHS of the assignment have the same size (and
-	  * therefore have the same type).
-	  *
-	  * It would be perfectly valid to unconditionally generate the
-	  * swizzles, this this will typically result in a more compact IR tree.
-	  */
-	 ir_rvalue *rhs;
-	 if (lhs->type->vector_elements != rhs_col->type->vector_elements) {
-	    rhs = new(ctx) ir_swizzle(rhs_col, swiz, last_row);
-	 } else {
-	    rhs = rhs_col;
-	 }
-
-	 ir_instruction *inst =
-	    new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
-	 instructions->push_tail(inst);
-      }
-   } else {
-      const unsigned cols = type->matrix_columns;
-      const unsigned rows = type->vector_elements;
-      unsigned col_idx = 0;
-      unsigned row_idx = 0;
-
-      foreach_list (node, parameters) {
-	 ir_rvalue *const rhs = (ir_rvalue *) node;
-	 const unsigned components_remaining_this_column = rows - row_idx;
-	 unsigned rhs_components = rhs->type->components();
-	 unsigned rhs_base = 0;
-
-	 /* Since the parameter might be used in the RHS of two assignments,
-	  * generate a temporary and copy the paramter there.
-	  */
-	 ir_variable *rhs_var =
-	    new(ctx) ir_variable(rhs->type, "mat_ctor_vec", ir_var_temporary);
-	 instructions->push_tail(rhs_var);
-
-	 ir_dereference *rhs_var_ref =
-	    new(ctx) ir_dereference_variable(rhs_var);
-	 ir_instruction *inst = new(ctx) ir_assignment(rhs_var_ref, rhs, NULL);
-	 instructions->push_tail(inst);
-
-	 /* Assign the current parameter to as many components of the matrix
-	  * as it will fill.
-	  *
-	  * NOTE: A single vector parameter can span two matrix columns.  A
-	  * single vec4, for example, can completely fill a mat2.
-	  */
-	 if (rhs_components >= components_remaining_this_column) {
-	    const unsigned count = MIN2(rhs_components,
-					components_remaining_this_column);
-
-	    rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var);
-
-	    ir_instruction *inst = assign_to_matrix_column(var, col_idx,
-							   row_idx,
-							   rhs_var_ref, 0,
-							   count, ctx);
-	    instructions->push_tail(inst);
-
-	    rhs_base = count;
-
-	    col_idx++;
-	    row_idx = 0;
-	 }
-
-	 /* If there is data left in the parameter and components left to be
-	  * set in the destination, emit another assignment.  It is possible
-	  * that the assignment could be of a vec4 to the last element of the
-	  * matrix.  In this case col_idx==cols, but there is still data
-	  * left in the source parameter.  Obviously, don't emit an assignment
-	  * to data outside the destination matrix.
-	  */
-	 if ((col_idx < cols) && (rhs_base < rhs_components)) {
-	    const unsigned count = rhs_components - rhs_base;
-
-	    rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var);
-
-	    ir_instruction *inst = assign_to_matrix_column(var, col_idx,
-							   row_idx,
-							   rhs_var_ref,
-							   rhs_base,
-							   count, ctx);
-	    instructions->push_tail(inst);
-
-	    row_idx += count;
-	 }
-      }
-   }
-
-   return new(ctx) ir_dereference_variable(var);
-}
-
-
-ir_rvalue *
-emit_inline_record_constructor(const glsl_type *type,
-			       exec_list *instructions,
-			       exec_list *parameters,
-			       void *mem_ctx)
-{
-   ir_variable *const var =
-      new(mem_ctx) ir_variable(type, "record_ctor", ir_var_temporary);
-   ir_dereference_variable *const d = new(mem_ctx) ir_dereference_variable(var);
-
-   instructions->push_tail(var);
-
-   exec_node *node = parameters->head;
-   for (unsigned i = 0; i < type->length; i++) {
-      assert(!node->is_tail_sentinel());
-
-      ir_dereference *const lhs =
-	 new(mem_ctx) ir_dereference_record(d->clone(mem_ctx, NULL),
-					    type->fields.structure[i].name);
-
-      ir_rvalue *const rhs = ((ir_instruction *) node)->as_rvalue();
-      assert(rhs != NULL);
-
-      ir_instruction *const assign = new(mem_ctx) ir_assignment(lhs, rhs, NULL);
-
-      instructions->push_tail(assign);
-      node = node->next;
-   }
-
-   return d;
-}
-
-
-ir_rvalue *
-ast_function_expression::hir(exec_list *instructions,
-			     struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   /* There are three sorts of function calls.
-    *
-    * 1. constructors - The first subexpression is an ast_type_specifier.
-    * 2. methods - Only the .length() method of array types.
-    * 3. functions - Calls to regular old functions.
-    *
-    * Method calls are actually detected when the ast_field_selection
-    * expression is handled.
-    */
-   if (is_constructor()) {
-      const ast_type_specifier *type = (ast_type_specifier *) subexpressions[0];
-      YYLTYPE loc = type->get_location();
-      const char *name;
-
-      const glsl_type *const constructor_type = type->glsl_type(& name, state);
-
-      /* constructor_type can be NULL if a variable with the same name as the
-       * structure has come into scope.
-       */
-      if (constructor_type == NULL) {
-	 _mesa_glsl_error(& loc, state, "unknown type `%s' (structure name "
-			  "may be shadowed by a variable with the same name)",
-			  type->type_name);
-	 return ir_call::get_error_instruction(ctx);
-      }
-
-
-      /* Constructors for samplers are illegal.
-       */
-      if (constructor_type->is_sampler()) {
-	 _mesa_glsl_error(& loc, state, "cannot construct sampler type `%s'",
-			  constructor_type->name);
-	 return ir_call::get_error_instruction(ctx);
-      }
-
-      if (constructor_type->is_array()) {
-	 if (state->language_version <= 110) {
-	    _mesa_glsl_error(& loc, state,
-			     "array constructors forbidden in GLSL 1.10");
-	    return ir_call::get_error_instruction(ctx);
-	 }
-
-	 return process_array_constructor(instructions, constructor_type,
-					  & loc, &this->expressions, state);
-      }
-
-
-      /* There are two kinds of constructor call.  Constructors for built-in
-       * language types, such as mat4 and vec2, are free form.  The only
-       * requirement is that the parameters must provide enough values of the
-       * correct scalar type.  Constructors for arrays and structures must
-       * have the exact number of parameters with matching types in the
-       * correct order.  These constructors follow essentially the same type
-       * matching rules as functions.
-       */
-      if (constructor_type->is_record()) {
-	 exec_list actual_parameters;
-
-	 process_parameters(instructions, &actual_parameters,
-			    &this->expressions, state);
-
-	 exec_node *node = actual_parameters.head;
-	 for (unsigned i = 0; i < constructor_type->length; i++) {
-	    ir_rvalue *ir = (ir_rvalue *) node;
-
-	    if (node->is_tail_sentinel()) {
-	       _mesa_glsl_error(&loc, state,
-				"insufficient parameters to constructor "
-				"for `%s'",
-				constructor_type->name);
-	       return ir_call::get_error_instruction(ctx);
-	    }
-
-	    if (apply_implicit_conversion(constructor_type->fields.structure[i].type,
-					  ir, state)) {
-	       node->replace_with(ir);
-	    } else {
-	       _mesa_glsl_error(&loc, state,
-				"parameter type mismatch in constructor "
-				"for `%s.%s' (%s vs %s)",
-				constructor_type->name,
-				constructor_type->fields.structure[i].name,
-				ir->type->name,
-				constructor_type->fields.structure[i].type->name);
-	       return ir_call::get_error_instruction(ctx);;
-	    }
-
-	    node = node->next;
-	 }
-
-	 if (!node->is_tail_sentinel()) {
-	    _mesa_glsl_error(&loc, state, "too many parameters in constructor "
-			     "for `%s'", constructor_type->name);
-	    return ir_call::get_error_instruction(ctx);
-	 }
-
-	 ir_rvalue *const constant =
-	    constant_record_constructor(constructor_type, &actual_parameters,
-					state);
-
-	 return (constant != NULL)
-	    ? constant
-	    : emit_inline_record_constructor(constructor_type, instructions,
-					     &actual_parameters, state);
-      }
-
-      if (!constructor_type->is_numeric() && !constructor_type->is_boolean())
-	 return ir_call::get_error_instruction(ctx);
-
-      /* Total number of components of the type being constructed. */
-      const unsigned type_components = constructor_type->components();
-
-      /* Number of components from parameters that have actually been
-       * consumed.  This is used to perform several kinds of error checking.
-       */
-      unsigned components_used = 0;
-
-      unsigned matrix_parameters = 0;
-      unsigned nonmatrix_parameters = 0;
-      exec_list actual_parameters;
-
-      foreach_list (n, &this->expressions) {
-	 ast_node *ast = exec_node_data(ast_node, n, link);
-	 ir_rvalue *result = ast->hir(instructions, state)->as_rvalue();
-
-	 /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec:
-	  *
-	  *    "It is an error to provide extra arguments beyond this
-	  *    last used argument."
-	  */
-	 if (components_used >= type_components) {
-	    _mesa_glsl_error(& loc, state, "too many parameters to `%s' "
-			     "constructor",
-			     constructor_type->name);
-	    return ir_call::get_error_instruction(ctx);
-	 }
-
-	 if (!result->type->is_numeric() && !result->type->is_boolean()) {
-	    _mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
-			     "non-numeric data type",
-			     constructor_type->name);
-	    return ir_call::get_error_instruction(ctx);
-	 }
-
-	 /* Count the number of matrix and nonmatrix parameters.  This
-	  * is used below to enforce some of the constructor rules.
-	  */
-	 if (result->type->is_matrix())
-	    matrix_parameters++;
-	 else
-	    nonmatrix_parameters++;
-
-	 actual_parameters.push_tail(result);
-	 components_used += result->type->components();
-      }
-
-      /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec:
-       *
-       *    "It is an error to construct matrices from other matrices. This
-       *    is reserved for future use."
-       */
-      if (state->language_version == 110 && matrix_parameters > 0
-	  && constructor_type->is_matrix()) {
-	 _mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
-			  "matrix in GLSL 1.10",
-			  constructor_type->name);
-	 return ir_call::get_error_instruction(ctx);
-      }
-
-      /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec:
-       *
-       *    "If a matrix argument is given to a matrix constructor, it is
-       *    an error to have any other arguments."
-       */
-      if ((matrix_parameters > 0)
-	  && ((matrix_parameters + nonmatrix_parameters) > 1)
-	  && constructor_type->is_matrix()) {
-	 _mesa_glsl_error(& loc, state, "for matrix `%s' constructor, "
-			  "matrix must be only parameter",
-			  constructor_type->name);
-	 return ir_call::get_error_instruction(ctx);
-      }
-
-      /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec:
-       *
-       *    "In these cases, there must be enough components provided in the
-       *    arguments to provide an initializer for every component in the
-       *    constructed value."
-       */
-      if (components_used < type_components && components_used != 1
-	  && matrix_parameters == 0) {
-	 _mesa_glsl_error(& loc, state, "too few components to construct "
-			  "`%s'",
-			  constructor_type->name);
-	 return ir_call::get_error_instruction(ctx);
-      }
-
-      /* Later, we cast each parameter to the same base type as the
-       * constructor.  Since there are no non-floating point matrices, we
-       * need to break them up into a series of column vectors.
-       */
-      if (constructor_type->base_type != GLSL_TYPE_FLOAT) {
-	 foreach_list_safe(n, &actual_parameters) {
-	    ir_rvalue *matrix = (ir_rvalue *) n;
-
-	    if (!matrix->type->is_matrix())
-	       continue;
-
-	    /* Create a temporary containing the matrix. */
-	    ir_variable *var = new(ctx) ir_variable(matrix->type, "matrix_tmp",
-						    ir_var_temporary);
-	    instructions->push_tail(var);
-	    instructions->push_tail(new(ctx) ir_assignment(new(ctx)
-	       ir_dereference_variable(var), matrix, NULL));
-	    var->constant_value = matrix->constant_expression_value();
-
-	    /* Replace the matrix with dereferences of its columns. */
-	    for (int i = 0; i < matrix->type->matrix_columns; i++) {
-	       matrix->insert_before(new (ctx) ir_dereference_array(var,
-		  new(ctx) ir_constant(i)));
-	    }
-	    matrix->remove();
-	 }
-      }
-
-      bool all_parameters_are_constant = true;
-
-      /* Type cast each parameter and, if possible, fold constants.*/
-      foreach_list_safe(n, &actual_parameters) {
-	 ir_rvalue *ir = (ir_rvalue *) n;
-
-	 const glsl_type *desired_type =
-	    glsl_type::get_instance(constructor_type->base_type,
-				    ir->type->vector_elements,
-				    ir->type->matrix_columns);
-	 ir_rvalue *result = convert_component(ir, desired_type);
-
-	 /* Attempt to convert the parameter to a constant valued expression.
-	  * After doing so, track whether or not all the parameters to the
-	  * constructor are trivially constant valued expressions.
-	  */
-	 ir_rvalue *const constant = result->constant_expression_value();
-
-	 if (constant != NULL)
-	    result = constant;
-	 else
-	    all_parameters_are_constant = false;
-
-	 if (result != ir) {
-	    ir->replace_with(result);
-	 }
-      }
-
-      /* If all of the parameters are trivially constant, create a
-       * constant representing the complete collection of parameters.
-       */
-      if (all_parameters_are_constant) {
-	 return new(ctx) ir_constant(constructor_type, &actual_parameters);
-      } else if (constructor_type->is_scalar()) {
-	 return dereference_component((ir_rvalue *) actual_parameters.head,
-				      0);
-      } else if (constructor_type->is_vector()) {
-	 return emit_inline_vector_constructor(constructor_type,
-					       instructions,
-					       &actual_parameters,
-					       ctx);
-      } else {
-	 assert(constructor_type->is_matrix());
-	 return emit_inline_matrix_constructor(constructor_type,
-					       instructions,
-					       &actual_parameters,
-					       ctx);
-      }
-   } else {
-      const ast_expression *id = subexpressions[0];
-      YYLTYPE loc = id->get_location();
-      exec_list actual_parameters;
-
-      process_parameters(instructions, &actual_parameters, &this->expressions,
-			 state);
-
-      return match_function_by_name(instructions, 
-				    id->primary_expression.identifier, & loc,
-				    &actual_parameters, state);
-   }
-
-   return ir_call::get_error_instruction(ctx);
-}
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * 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.
+ */
+
+#include "glsl_symbol_table.h"
+#include "ast.h"
+#include "glsl_types.h"
+#include "ir.h"
+#include "main/core.h" /* for MIN2 */
+
+static ir_rvalue *
+convert_component(ir_rvalue *src, const glsl_type *desired_type);
+
+bool
+apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from,
+                          struct _mesa_glsl_parse_state *state);
+
+static unsigned
+process_parameters(exec_list *instructions, exec_list *actual_parameters,
+		   exec_list *parameters,
+		   struct _mesa_glsl_parse_state *state)
+{
+   unsigned count = 0;
+
+   foreach_list (n, parameters) {
+      ast_node *const ast = exec_node_data(ast_node, n, link);
+      ir_rvalue *result = ast->hir(instructions, state);
+
+      ir_constant *const constant = result->constant_expression_value();
+      if (constant != NULL)
+	 result = constant;
+
+      actual_parameters->push_tail(result);
+      count++;
+   }
+
+   return count;
+}
+
+
+/**
+ * Generate a source prototype for a function signature
+ *
+ * \param return_type Return type of the function.  May be \c NULL.
+ * \param name        Name of the function.
+ * \param parameters  Parameter list for the function.  This may be either a
+ *                    formal or actual parameter list.  Only the type is used.
+ *
+ * \return
+ * A ralloced string representing the prototype of the function.
+ */
+char *
+prototype_string(const glsl_type *return_type, const char *name,
+		 exec_list *parameters)
+{
+   char *str = NULL;
+
+   if (return_type != NULL)
+      str = ralloc_asprintf(NULL, "%s ", return_type->name);
+
+   ralloc_asprintf_append(&str, "%s(", name);
+
+   const char *comma = "";
+   foreach_list(node, parameters) {
+      const ir_instruction *const param = (ir_instruction *) node;
+
+      ralloc_asprintf_append(&str, "%s%s", comma, param->type->name);
+      comma = ", ";
+   }
+
+   ralloc_strcat(&str, ")");
+   return str;
+}
+
+
+static ir_rvalue *
+match_function_by_name(exec_list *instructions, const char *name,
+		       YYLTYPE *loc, exec_list *actual_parameters,
+		       struct _mesa_glsl_parse_state *state)
+{
+   void *ctx = state;
+   ir_function *f = state->symbols->get_function(name);
+   ir_function_signature *sig;
+
+   sig = f ? f->matching_signature(actual_parameters) : NULL;
+
+   /* FINISHME: This doesn't handle the case where shader X contains a
+    * FINISHME: matching signature but shader X + N contains an _exact_
+    * FINISHME: matching signature.
+    */
+   if (sig == NULL
+       && (f == NULL || state->es_shader || !f->has_user_signature())
+       && state->symbols->get_type(name) == NULL
+       && (state->language_version == 110
+	   || state->symbols->get_variable(name) == NULL)) {
+      /* The current shader doesn't contain a matching function or signature.
+       * Before giving up, look for the prototype in the built-in functions.
+       */
+      for (unsigned i = 0; i < state->num_builtins_to_link; i++) {
+	 ir_function *builtin;
+	 builtin = state->builtins_to_link[i]->symbols->get_function(name);
+	 sig = builtin ? builtin->matching_signature(actual_parameters) : NULL;
+	 if (sig != NULL) {
+	    if (f == NULL) {
+	       f = new(ctx) ir_function(name);
+	       state->symbols->add_global_function(f);
+	       emit_function(state, instructions, f);
+	    }
+
+	    f->add_signature(sig->clone_prototype(f, NULL));
+	    break;
+	 }
+      }
+   }
+
+   if (sig != NULL) {
+      /* Verify that 'out' and 'inout' actual parameters are lvalues.  This
+       * isn't done in ir_function::matching_signature because that function
+       * cannot generate the necessary diagnostics.
+       *
+       * Also, validate that 'const_in' formal parameters (an extension of our
+       * IR) correspond to ir_constant actual parameters.
+       */
+      exec_list_iterator actual_iter = actual_parameters->iterator();
+      exec_list_iterator formal_iter = sig->parameters.iterator();
+
+      while (actual_iter.has_next()) {
+	 ir_rvalue *actual = (ir_rvalue *) actual_iter.get();
+	 ir_variable *formal = (ir_variable *) formal_iter.get();
+
+	 assert(actual != NULL);
+	 assert(formal != NULL);
+
+	 if (formal->mode == ir_var_const_in && !actual->as_constant()) {
+	    _mesa_glsl_error(loc, state,
+			     "parameter `%s' must be a constant expression",
+			     formal->name);
+	 }
+
+	 if ((formal->mode == ir_var_out)
+	     || (formal->mode == ir_var_inout)) {
+	    const char *mode = NULL;
+	    switch (formal->mode) {
+	    case ir_var_out:   mode = "out";   break;
+	    case ir_var_inout: mode = "inout"; break;
+	    default:           assert(false);  break;
+	    }
+            /* FIXME: 'loc' is incorrect (as of 2011-01-21). It is always
+             * FIXME: 0:0(0).
+             */
+	    if (actual->variable_referenced()
+	        && actual->variable_referenced()->read_only) {
+	       _mesa_glsl_error(loc, state,
+	                        "function parameter '%s %s' references the "
+	                        "read-only variable '%s'",
+	                        mode, formal->name,
+	                        actual->variable_referenced()->name);
+
+	    } else if (!actual->is_lvalue()) {
+               _mesa_glsl_error(loc, state,
+                                "function parameter '%s %s' is not an lvalue",
+                                mode, formal->name);
+	    }
+	 }
+
+	 if (formal->type->is_numeric() || formal->type->is_boolean()) {
+	    ir_rvalue *converted = convert_component(actual, formal->type);
+	    actual->replace_with(converted);
+	 }
+
+	 actual_iter.next();
+	 formal_iter.next();
+      }
+
+      /* Always insert the call in the instruction stream, and return a deref
+       * of its return val if it returns a value, since we don't know if
+       * the rvalue is going to be assigned to anything or not.
+       */
+      ir_call *call = new(ctx) ir_call(sig, actual_parameters);
+      if (!sig->return_type->is_void()) {
+	 ir_variable *var;
+	 ir_dereference_variable *deref;
+
+	 var = new(ctx) ir_variable(sig->return_type,
+				    ralloc_asprintf(ctx, "%s_retval",
+						    sig->function_name()),
+				    ir_var_temporary);
+	 instructions->push_tail(var);
+
+	 deref = new(ctx) ir_dereference_variable(var);
+	 ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL);
+	 instructions->push_tail(assign);
+	 if (state->language_version >= 120)
+	    var->constant_value = call->constant_expression_value();
+
+	 deref = new(ctx) ir_dereference_variable(var);
+	 return deref;
+      } else {
+	 instructions->push_tail(call);
+	 return NULL;
+      }
+   } else {
+      char *str = prototype_string(NULL, name, actual_parameters);
+
+      _mesa_glsl_error(loc, state, "no matching function for call to `%s'",
+		       str);
+      ralloc_free(str);
+
+      const char *prefix = "candidates are: ";
+
+      for (int i = -1; i < (int) state->num_builtins_to_link; i++) {
+	 glsl_symbol_table *syms = i >= 0 ? state->builtins_to_link[i]->symbols
+					  : state->symbols;
+	 f = syms->get_function(name);
+	 if (f == NULL)
+	    continue;
+
+	 foreach_list (node, &f->signatures) {
+	    ir_function_signature *sig = (ir_function_signature *) node;
+
+	    str = prototype_string(sig->return_type, f->name, &sig->parameters);
+	    _mesa_glsl_error(loc, state, "%s%s\n", prefix, str);
+	    ralloc_free(str);
+
+	    prefix = "                ";
+	 }
+
+      }
+
+      return ir_call::get_error_instruction(ctx);
+   }
+}
+
+
+/**
+ * Perform automatic type conversion of constructor parameters
+ *
+ * This implements the rules in the "Conversion and Scalar Constructors"
+ * section (GLSL 1.10 section 5.4.1), not the "Implicit Conversions" rules.
+ */
+static ir_rvalue *
+convert_component(ir_rvalue *src, const glsl_type *desired_type)
+{
+   void *ctx = ralloc_parent(src);
+   const unsigned a = desired_type->base_type;
+   const unsigned b = src->type->base_type;
+   ir_expression *result = NULL;
+
+   if (src->type->is_error())
+      return src;
+
+   assert(a <= GLSL_TYPE_BOOL);
+   assert(b <= GLSL_TYPE_BOOL);
+
+   if ((a == b) || (src->type->is_integer() && desired_type->is_integer()))
+      return src;
+
+   switch (a) {
+   case GLSL_TYPE_UINT:
+   case GLSL_TYPE_INT:
+      if (b == GLSL_TYPE_FLOAT)
+	 result = new(ctx) ir_expression(ir_unop_f2i, desired_type, src, NULL);
+      else {
+	 assert(b == GLSL_TYPE_BOOL);
+	 result = new(ctx) ir_expression(ir_unop_b2i, desired_type, src, NULL);
+      }
+      break;
+   case GLSL_TYPE_FLOAT:
+      switch (b) {
+      case GLSL_TYPE_UINT:
+	 result = new(ctx) ir_expression(ir_unop_u2f, desired_type, src, NULL);
+	 break;
+      case GLSL_TYPE_INT:
+	 result = new(ctx) ir_expression(ir_unop_i2f, desired_type, src, NULL);
+	 break;
+      case GLSL_TYPE_BOOL:
+	 result = new(ctx) ir_expression(ir_unop_b2f, desired_type, src, NULL);
+	 break;
+      }
+      break;
+   case GLSL_TYPE_BOOL:
+      switch (b) {
+      case GLSL_TYPE_UINT:
+      case GLSL_TYPE_INT:
+	 result = new(ctx) ir_expression(ir_unop_i2b, desired_type, src, NULL);
+	 break;
+      case GLSL_TYPE_FLOAT:
+	 result = new(ctx) ir_expression(ir_unop_f2b, desired_type, src, NULL);
+	 break;
+      }
+      break;
+   }
+
+   assert(result != NULL);
+
+   /* Try constant folding; it may fold in the conversion we just added. */
+   ir_constant *const constant = result->constant_expression_value();
+   return (constant != NULL) ? (ir_rvalue *) constant : (ir_rvalue *) result;
+}
+
+/**
+ * Dereference a specific component from a scalar, vector, or matrix
+ */
+static ir_rvalue *
+dereference_component(ir_rvalue *src, unsigned component)
+{
+   void *ctx = ralloc_parent(src);
+   assert(component < src->type->components());
+
+   /* If the source is a constant, just create a new constant instead of a
+    * dereference of the existing constant.
+    */
+   ir_constant *constant = src->as_constant();
+   if (constant)
+      return new(ctx) ir_constant(constant, component);
+
+   if (src->type->is_scalar()) {
+      return src;
+   } else if (src->type->is_vector()) {
+      return new(ctx) ir_swizzle(src, component, 0, 0, 0, 1);
+   } else {
+      assert(src->type->is_matrix());
+
+      /* Dereference a row of the matrix, then call this function again to get
+       * a specific element from that row.
+       */
+      const int c = component / src->type->column_type()->vector_elements;
+      const int r = component % src->type->column_type()->vector_elements;
+      ir_constant *const col_index = new(ctx) ir_constant(c);
+      ir_dereference *const col = new(ctx) ir_dereference_array(src, col_index);
+
+      col->type = src->type->column_type();
+
+      return dereference_component(col, r);
+   }
+
+   assert(!"Should not get here.");
+   return NULL;
+}
+
+
+static ir_rvalue *
+process_array_constructor(exec_list *instructions,
+			  const glsl_type *constructor_type,
+			  YYLTYPE *loc, exec_list *parameters,
+			  struct _mesa_glsl_parse_state *state)
+{
+   void *ctx = state;
+   /* Array constructors come in two forms: sized and unsized.  Sized array
+    * constructors look like 'vec4[2](a, b)', where 'a' and 'b' are vec4
+    * variables.  In this case the number of parameters must exactly match the
+    * specified size of the array.
+    *
+    * Unsized array constructors look like 'vec4[](a, b)', where 'a' and 'b'
+    * are vec4 variables.  In this case the size of the array being constructed
+    * is determined by the number of parameters.
+    *
+    * From page 52 (page 58 of the PDF) of the GLSL 1.50 spec:
+    *
+    *    "There must be exactly the same number of arguments as the size of
+    *    the array being constructed. If no size is present in the
+    *    constructor, then the array is explicitly sized to the number of
+    *    arguments provided. The arguments are assigned in order, starting at
+    *    element 0, to the elements of the constructed array. Each argument
+    *    must be the same type as the element type of the array, or be a type
+    *    that can be converted to the element type of the array according to
+    *    Section 4.1.10 "Implicit Conversions.""
+    */
+   exec_list actual_parameters;
+   const unsigned parameter_count =
+      process_parameters(instructions, &actual_parameters, parameters, state);
+
+   if ((parameter_count == 0)
+       || ((constructor_type->length != 0)
+	   && (constructor_type->length != parameter_count))) {
+      const unsigned min_param = (constructor_type->length == 0)
+	 ? 1 : constructor_type->length;
+
+      _mesa_glsl_error(loc, state, "array constructor must have %s %u "
+		       "parameter%s",
+		       (constructor_type->length != 0) ? "at least" : "exactly",
+		       min_param, (min_param <= 1) ? "" : "s");
+      return ir_call::get_error_instruction(ctx);
+   }
+
+   if (constructor_type->length == 0) {
+      constructor_type =
+	 glsl_type::get_array_instance(constructor_type->element_type(),
+				       parameter_count);
+      assert(constructor_type != NULL);
+      assert(constructor_type->length == parameter_count);
+   }
+
+   bool all_parameters_are_constant = true;
+
+   /* Type cast each parameter and, if possible, fold constants. */
+   foreach_list_safe(n, &actual_parameters) {
+      ir_rvalue *ir = (ir_rvalue *) n;
+      ir_rvalue *result = ir;
+
+      /* Apply implicit conversions (not the scalar constructor rules!) */
+      if (constructor_type->element_type()->is_float()) {
+	 const glsl_type *desired_type =
+	    glsl_type::get_instance(GLSL_TYPE_FLOAT,
+				    ir->type->vector_elements,
+				    ir->type->matrix_columns);
+	 result = convert_component(ir, desired_type);
+      }
+
+      if (result->type != constructor_type->element_type()) {
+	 _mesa_glsl_error(loc, state, "type error in array constructor: "
+			  "expected: %s, found %s",
+			  constructor_type->element_type()->name,
+			  result->type->name);
+      }
+
+      /* Attempt to convert the parameter to a constant valued expression.
+       * After doing so, track whether or not all the parameters to the
+       * constructor are trivially constant valued expressions.
+       */
+      ir_rvalue *const constant = result->constant_expression_value();
+
+      if (constant != NULL)
+         result = constant;
+      else
+         all_parameters_are_constant = false;
+
+      ir->replace_with(result);
+   }
+
+   if (all_parameters_are_constant)
+      return new(ctx) ir_constant(constructor_type, &actual_parameters);
+
+   ir_variable *var = new(ctx) ir_variable(constructor_type, "array_ctor",
+					   ir_var_temporary);
+   instructions->push_tail(var);
+
+   int i = 0;
+   foreach_list(node, &actual_parameters) {
+      ir_rvalue *rhs = (ir_rvalue *) node;
+      ir_rvalue *lhs = new(ctx) ir_dereference_array(var,
+						     new(ctx) ir_constant(i));
+
+      ir_instruction *assignment = new(ctx) ir_assignment(lhs, rhs, NULL);
+      instructions->push_tail(assignment);
+
+      i++;
+   }
+
+   return new(ctx) ir_dereference_variable(var);
+}
+
+
+/**
+ * Try to convert a record constructor to a constant expression
+ */
+static ir_constant *
+constant_record_constructor(const glsl_type *constructor_type,
+			    exec_list *parameters, void *mem_ctx)
+{
+   foreach_list(node, parameters) {
+      ir_constant *constant = ((ir_instruction *) node)->as_constant();
+      if (constant == NULL)
+	 return NULL;
+      node->replace_with(constant);
+   }
+
+   return new(mem_ctx) ir_constant(constructor_type, parameters);
+}
+
+
+/**
+ * Determine if a list consists of a single scalar r-value
+ */
+bool
+single_scalar_parameter(exec_list *parameters)
+{
+   const ir_rvalue *const p = (ir_rvalue *) parameters->head;
+   assert(((ir_rvalue *)p)->as_rvalue() != NULL);
+
+   return (p->type->is_scalar() && p->next->is_tail_sentinel());
+}
+
+
+/**
+ * Generate inline code for a vector constructor
+ *
+ * The generated constructor code will consist of a temporary variable
+ * declaration of the same type as the constructor.  A sequence of assignments
+ * from constructor parameters to the temporary will follow.
+ *
+ * \return
+ * An \c ir_dereference_variable of the temprorary generated in the constructor
+ * body.
+ */
+ir_rvalue *
+emit_inline_vector_constructor(const glsl_type *type,
+			       exec_list *instructions,
+			       exec_list *parameters,
+			       void *ctx)
+{
+   assert(!parameters->is_empty());
+
+   ir_variable *var = new(ctx) ir_variable(type, "vec_ctor", ir_var_temporary);
+   instructions->push_tail(var);
+
+   /* There are two kinds of vector constructors.
+    *
+    *  - Construct a vector from a single scalar by replicating that scalar to
+    *    all components of the vector.
+    *
+    *  - Construct a vector from an arbirary combination of vectors and
+    *    scalars.  The components of the constructor parameters are assigned
+    *    to the vector in order until the vector is full.
+    */
+   const unsigned lhs_components = type->components();
+   if (single_scalar_parameter(parameters)) {
+      ir_rvalue *first_param = (ir_rvalue *)parameters->head;
+      ir_rvalue *rhs = new(ctx) ir_swizzle(first_param, 0, 0, 0, 0,
+					   lhs_components);
+      ir_dereference_variable *lhs = new(ctx) ir_dereference_variable(var);
+      const unsigned mask = (1U << lhs_components) - 1;
+
+      assert(rhs->type == lhs->type);
+
+      ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, mask);
+      instructions->push_tail(inst);
+   } else {
+      unsigned base_component = 0;
+      unsigned base_lhs_component = 0;
+      ir_constant_data data;
+      unsigned constant_mask = 0, constant_components = 0;
+
+      memset(&data, 0, sizeof(data));
+
+      foreach_list(node, parameters) {
+	 ir_rvalue *param = (ir_rvalue *) node;
+	 unsigned rhs_components = param->type->components();
+
+	 /* Do not try to assign more components to the vector than it has!
+	  */
+	 if ((rhs_components + base_lhs_component) > lhs_components) {
+	    rhs_components = lhs_components - base_lhs_component;
+	 }
+
+	 const ir_constant *const c = param->as_constant();
+	 if (c != NULL) {
+	    for (unsigned i = 0; i < rhs_components; i++) {
+	       switch (c->type->base_type) {
+	       case GLSL_TYPE_UINT:
+		  data.u[i + base_component] = c->get_uint_component(i);
+		  break;
+	       case GLSL_TYPE_INT:
+		  data.i[i + base_component] = c->get_int_component(i);
+		  break;
+	       case GLSL_TYPE_FLOAT:
+		  data.f[i + base_component] = c->get_float_component(i);
+		  break;
+	       case GLSL_TYPE_BOOL:
+		  data.b[i + base_component] = c->get_bool_component(i);
+		  break;
+	       default:
+		  assert(!"Should not get here.");
+		  break;
+	       }
+	    }
+
+	    /* Mask of fields to be written in the assignment.
+	     */
+	    constant_mask |= ((1U << rhs_components) - 1) << base_lhs_component;
+	    constant_components += rhs_components;
+
+	    base_component += rhs_components;
+	 }
+	 /* Advance the component index by the number of components
+	  * that were just assigned.
+	  */
+	 base_lhs_component += rhs_components;
+      }
+
+      if (constant_mask != 0) {
+	 ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
+	 const glsl_type *rhs_type = glsl_type::get_instance(var->type->base_type,
+							     constant_components,
+							     1);
+	 ir_rvalue *rhs = new(ctx) ir_constant(rhs_type, &data);
+
+	 ir_instruction *inst =
+	    new(ctx) ir_assignment(lhs, rhs, NULL, constant_mask);
+	 instructions->push_tail(inst);
+      }
+
+      base_component = 0;
+      foreach_list(node, parameters) {
+	 ir_rvalue *param = (ir_rvalue *) node;
+	 unsigned rhs_components = param->type->components();
+
+	 /* Do not try to assign more components to the vector than it has!
+	  */
+	 if ((rhs_components + base_component) > lhs_components) {
+	    rhs_components = lhs_components - base_component;
+	 }
+
+	 const ir_constant *const c = param->as_constant();
+	 if (c == NULL) {
+	    /* Mask of fields to be written in the assignment.
+	     */
+	    const unsigned write_mask = ((1U << rhs_components) - 1)
+	       << base_component;
+
+	    ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
+
+	    /* Generate a swizzle so that LHS and RHS sizes match.
+	     */
+	    ir_rvalue *rhs =
+	       new(ctx) ir_swizzle(param, 0, 1, 2, 3, rhs_components);
+
+	    ir_instruction *inst =
+	       new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
+	    instructions->push_tail(inst);
+	 }
+
+	 /* Advance the component index by the number of components that were
+	  * just assigned.
+	  */
+	 base_component += rhs_components;
+      }
+   }
+   return new(ctx) ir_dereference_variable(var);
+}
+
+
+/**
+ * Generate assignment of a portion of a vector to a portion of a matrix column
+ *
+ * \param src_base  First component of the source to be used in assignment
+ * \param column    Column of destination to be assiged
+ * \param row_base  First component of the destination column to be assigned
+ * \param count     Number of components to be assigned
+ *
+ * \note
+ * \c src_base + \c count must be less than or equal to the number of components
+ * in the source vector.
+ */
+ir_instruction *
+assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
+			ir_rvalue *src, unsigned src_base, unsigned count,
+			void *mem_ctx)
+{
+   ir_constant *col_idx = new(mem_ctx) ir_constant(column);
+   ir_dereference *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx);
+
+   assert(column_ref->type->components() >= (row_base + count));
+   assert(src->type->components() >= (src_base + count));
+
+   /* Generate a swizzle that extracts the number of components from the source
+    * that are to be assigned to the column of the matrix.
+    */
+   if (count < src->type->vector_elements) {
+      src = new(mem_ctx) ir_swizzle(src,
+				    src_base + 0, src_base + 1,
+				    src_base + 2, src_base + 3,
+				    count);
+   }
+
+   /* Mask of fields to be written in the assignment.
+    */
+   const unsigned write_mask = ((1U << count) - 1) << row_base;
+
+   return new(mem_ctx) ir_assignment(column_ref, src, NULL, write_mask);
+}
+
+
+/**
+ * Generate inline code for a matrix constructor
+ *
+ * The generated constructor code will consist of a temporary variable
+ * declaration of the same type as the constructor.  A sequence of assignments
+ * from constructor parameters to the temporary will follow.
+ *
+ * \return
+ * An \c ir_dereference_variable of the temprorary generated in the constructor
+ * body.
+ */
+ir_rvalue *
+emit_inline_matrix_constructor(const glsl_type *type,
+			       exec_list *instructions,
+			       exec_list *parameters,
+			       void *ctx)
+{
+   assert(!parameters->is_empty());
+
+   ir_variable *var = new(ctx) ir_variable(type, "mat_ctor", ir_var_temporary);
+   instructions->push_tail(var);
+
+   /* There are three kinds of matrix constructors.
+    *
+    *  - Construct a matrix from a single scalar by replicating that scalar to
+    *    along the diagonal of the matrix and setting all other components to
+    *    zero.
+    *
+    *  - Construct a matrix from an arbirary combination of vectors and
+    *    scalars.  The components of the constructor parameters are assigned
+    *    to the matrix in colum-major order until the matrix is full.
+    *
+    *  - Construct a matrix from a single matrix.  The source matrix is copied
+    *    to the upper left portion of the constructed matrix, and the remaining
+    *    elements take values from the identity matrix.
+    */
+   ir_rvalue *const first_param = (ir_rvalue *) parameters->head;
+   if (single_scalar_parameter(parameters)) {
+      /* Assign the scalar to the X component of a vec4, and fill the remaining
+       * components with zero.
+       */
+      ir_variable *rhs_var =
+	 new(ctx) ir_variable(glsl_type::vec4_type, "mat_ctor_vec",
+			      ir_var_temporary);
+      instructions->push_tail(rhs_var);
+
+      ir_constant_data zero;
+      zero.f[0] = 0.0;
+      zero.f[1] = 0.0;
+      zero.f[2] = 0.0;
+      zero.f[3] = 0.0;
+
+      ir_instruction *inst =
+	 new(ctx) ir_assignment(new(ctx) ir_dereference_variable(rhs_var),
+				new(ctx) ir_constant(rhs_var->type, &zero),
+				NULL);
+      instructions->push_tail(inst);
+
+      ir_dereference *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
+
+      inst = new(ctx) ir_assignment(rhs_ref, first_param, NULL, 0x01);
+      instructions->push_tail(inst);
+
+      /* Assign the temporary vector to each column of the destination matrix
+       * with a swizzle that puts the X component on the diagonal of the
+       * matrix.  In some cases this may mean that the X component does not
+       * get assigned into the column at all (i.e., when the matrix has more
+       * columns than rows).
+       */
+      static const unsigned rhs_swiz[4][4] = {
+	 { 0, 1, 1, 1 },
+	 { 1, 0, 1, 1 },
+	 { 1, 1, 0, 1 },
+	 { 1, 1, 1, 0 }
+      };
+
+      const unsigned cols_to_init = MIN2(type->matrix_columns,
+					 type->vector_elements);
+      for (unsigned i = 0; i < cols_to_init; i++) {
+	 ir_constant *const col_idx = new(ctx) ir_constant(i);
+	 ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx);
+
+	 ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
+	 ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, rhs_swiz[i],
+						    type->vector_elements);
+
+	 inst = new(ctx) ir_assignment(col_ref, rhs, NULL);
+	 instructions->push_tail(inst);
+      }
+
+      for (unsigned i = cols_to_init; i < type->matrix_columns; i++) {
+	 ir_constant *const col_idx = new(ctx) ir_constant(i);
+	 ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx);
+
+	 ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
+	 ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, 1, 1, 1, 1,
+						    type->vector_elements);
+
+	 inst = new(ctx) ir_assignment(col_ref, rhs, NULL);
+	 instructions->push_tail(inst);
+      }
+   } else if (first_param->type->is_matrix()) {
+      /* From page 50 (56 of the PDF) of the GLSL 1.50 spec:
+       *
+       *     "If a matrix is constructed from a matrix, then each component
+       *     (column i, row j) in the result that has a corresponding
+       *     component (column i, row j) in the argument will be initialized
+       *     from there. All other components will be initialized to the
+       *     identity matrix. If a matrix argument is given to a matrix
+       *     constructor, it is an error to have any other arguments."
+       */
+      assert(first_param->next->is_tail_sentinel());
+      ir_rvalue *const src_matrix = first_param;
+
+      /* If the source matrix is smaller, pre-initialize the relavent parts of
+       * the destination matrix to the identity matrix.
+       */
+      if ((src_matrix->type->matrix_columns < var->type->matrix_columns)
+	  || (src_matrix->type->vector_elements < var->type->vector_elements)) {
+
+	 /* If the source matrix has fewer rows, every column of the destination
+	  * must be initialized.  Otherwise only the columns in the destination
+	  * that do not exist in the source must be initialized.
+	  */
+	 unsigned col =
+	    (src_matrix->type->vector_elements < var->type->vector_elements)
+	    ? 0 : src_matrix->type->matrix_columns;
+
+	 const glsl_type *const col_type = var->type->column_type();
+	 for (/* empty */; col < var->type->matrix_columns; col++) {
+	    ir_constant_data ident;
+
+	    ident.f[0] = 0.0;
+	    ident.f[1] = 0.0;
+	    ident.f[2] = 0.0;
+	    ident.f[3] = 0.0;
+
+	    ident.f[col] = 1.0;
+
+	    ir_rvalue *const rhs = new(ctx) ir_constant(col_type, &ident);
+
+	    ir_rvalue *const lhs =
+	       new(ctx) ir_dereference_array(var, new(ctx) ir_constant(col));
+
+	    ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL);
+	    instructions->push_tail(inst);
+	 }
+      }
+
+      /* Assign columns from the source matrix to the destination matrix.
+       *
+       * Since the parameter will be used in the RHS of multiple assignments,
+       * generate a temporary and copy the paramter there.
+       */
+      ir_variable *const rhs_var =
+	 new(ctx) ir_variable(first_param->type, "mat_ctor_mat",
+			      ir_var_temporary);
+      instructions->push_tail(rhs_var);
+
+      ir_dereference *const rhs_var_ref =
+	 new(ctx) ir_dereference_variable(rhs_var);
+      ir_instruction *const inst =
+	 new(ctx) ir_assignment(rhs_var_ref, first_param, NULL);
+      instructions->push_tail(inst);
+
+      const unsigned last_row = MIN2(src_matrix->type->vector_elements,
+				     var->type->vector_elements);
+      const unsigned last_col = MIN2(src_matrix->type->matrix_columns,
+				     var->type->matrix_columns);
+
+      unsigned swiz[4] = { 0, 0, 0, 0 };
+      for (unsigned i = 1; i < last_row; i++)
+	 swiz[i] = i;
+
+      const unsigned write_mask = (1U << last_row) - 1;
+
+      for (unsigned i = 0; i < last_col; i++) {
+	 ir_dereference *const lhs =
+	    new(ctx) ir_dereference_array(var, new(ctx) ir_constant(i));
+	 ir_rvalue *const rhs_col =
+	    new(ctx) ir_dereference_array(rhs_var, new(ctx) ir_constant(i));
+
+	 /* If one matrix has columns that are smaller than the columns of the
+	  * other matrix, wrap the column access of the larger with a swizzle
+	  * so that the LHS and RHS of the assignment have the same size (and
+	  * therefore have the same type).
+	  *
+	  * It would be perfectly valid to unconditionally generate the
+	  * swizzles, this this will typically result in a more compact IR tree.
+	  */
+	 ir_rvalue *rhs;
+	 if (lhs->type->vector_elements != rhs_col->type->vector_elements) {
+	    rhs = new(ctx) ir_swizzle(rhs_col, swiz, last_row);
+	 } else {
+	    rhs = rhs_col;
+	 }
+
+	 ir_instruction *inst =
+	    new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
+	 instructions->push_tail(inst);
+      }
+   } else {
+      const unsigned cols = type->matrix_columns;
+      const unsigned rows = type->vector_elements;
+      unsigned col_idx = 0;
+      unsigned row_idx = 0;
+
+      foreach_list (node, parameters) {
+	 ir_rvalue *const rhs = (ir_rvalue *) node;
+	 const unsigned components_remaining_this_column = rows - row_idx;
+	 unsigned rhs_components = rhs->type->components();
+	 unsigned rhs_base = 0;
+
+	 /* Since the parameter might be used in the RHS of two assignments,
+	  * generate a temporary and copy the paramter there.
+	  */
+	 ir_variable *rhs_var =
+	    new(ctx) ir_variable(rhs->type, "mat_ctor_vec", ir_var_temporary);
+	 instructions->push_tail(rhs_var);
+
+	 ir_dereference *rhs_var_ref =
+	    new(ctx) ir_dereference_variable(rhs_var);
+	 ir_instruction *inst = new(ctx) ir_assignment(rhs_var_ref, rhs, NULL);
+	 instructions->push_tail(inst);
+
+	 /* Assign the current parameter to as many components of the matrix
+	  * as it will fill.
+	  *
+	  * NOTE: A single vector parameter can span two matrix columns.  A
+	  * single vec4, for example, can completely fill a mat2.
+	  */
+	 if (rhs_components >= components_remaining_this_column) {
+	    const unsigned count = MIN2(rhs_components,
+					components_remaining_this_column);
+
+	    rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var);
+
+	    ir_instruction *inst = assign_to_matrix_column(var, col_idx,
+							   row_idx,
+							   rhs_var_ref, 0,
+							   count, ctx);
+	    instructions->push_tail(inst);
+
+	    rhs_base = count;
+
+	    col_idx++;
+	    row_idx = 0;
+	 }
+
+	 /* If there is data left in the parameter and components left to be
+	  * set in the destination, emit another assignment.  It is possible
+	  * that the assignment could be of a vec4 to the last element of the
+	  * matrix.  In this case col_idx==cols, but there is still data
+	  * left in the source parameter.  Obviously, don't emit an assignment
+	  * to data outside the destination matrix.
+	  */
+	 if ((col_idx < cols) && (rhs_base < rhs_components)) {
+	    const unsigned count = rhs_components - rhs_base;
+
+	    rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var);
+
+	    ir_instruction *inst = assign_to_matrix_column(var, col_idx,
+							   row_idx,
+							   rhs_var_ref,
+							   rhs_base,
+							   count, ctx);
+	    instructions->push_tail(inst);
+
+	    row_idx += count;
+	 }
+      }
+   }
+
+   return new(ctx) ir_dereference_variable(var);
+}
+
+
+ir_rvalue *
+emit_inline_record_constructor(const glsl_type *type,
+			       exec_list *instructions,
+			       exec_list *parameters,
+			       void *mem_ctx)
+{
+   ir_variable *const var =
+      new(mem_ctx) ir_variable(type, "record_ctor", ir_var_temporary);
+   ir_dereference_variable *const d = new(mem_ctx) ir_dereference_variable(var);
+
+   instructions->push_tail(var);
+
+   exec_node *node = parameters->head;
+   for (unsigned i = 0; i < type->length; i++) {
+      assert(!node->is_tail_sentinel());
+
+      ir_dereference *const lhs =
+	 new(mem_ctx) ir_dereference_record(d->clone(mem_ctx, NULL),
+					    type->fields.structure[i].name);
+
+      ir_rvalue *const rhs = ((ir_instruction *) node)->as_rvalue();
+      assert(rhs != NULL);
+
+      ir_instruction *const assign = new(mem_ctx) ir_assignment(lhs, rhs, NULL);
+
+      instructions->push_tail(assign);
+      node = node->next;
+   }
+
+   return d;
+}
+
+
+ir_rvalue *
+ast_function_expression::hir(exec_list *instructions,
+			     struct _mesa_glsl_parse_state *state)
+{
+   void *ctx = state;
+   /* There are three sorts of function calls.
+    *
+    * 1. constructors - The first subexpression is an ast_type_specifier.
+    * 2. methods - Only the .length() method of array types.
+    * 3. functions - Calls to regular old functions.
+    *
+    * Method calls are actually detected when the ast_field_selection
+    * expression is handled.
+    */
+   if (is_constructor()) {
+      const ast_type_specifier *type = (ast_type_specifier *) subexpressions[0];
+      YYLTYPE loc = type->get_location();
+      const char *name;
+
+      const glsl_type *const constructor_type = type->glsl_type(& name, state);
+
+      /* constructor_type can be NULL if a variable with the same name as the
+       * structure has come into scope.
+       */
+      if (constructor_type == NULL) {
+	 _mesa_glsl_error(& loc, state, "unknown type `%s' (structure name "
+			  "may be shadowed by a variable with the same name)",
+			  type->type_name);
+	 return ir_call::get_error_instruction(ctx);
+      }
+
+
+      /* Constructors for samplers are illegal.
+       */
+      if (constructor_type->is_sampler()) {
+	 _mesa_glsl_error(& loc, state, "cannot construct sampler type `%s'",
+			  constructor_type->name);
+	 return ir_call::get_error_instruction(ctx);
+      }
+
+      if (constructor_type->is_array()) {
+	 if (state->language_version <= 110) {
+	    _mesa_glsl_error(& loc, state,
+			     "array constructors forbidden in GLSL 1.10");
+	    return ir_call::get_error_instruction(ctx);
+	 }
+
+	 return process_array_constructor(instructions, constructor_type,
+					  & loc, &this->expressions, state);
+      }
+
+
+      /* There are two kinds of constructor call.  Constructors for built-in
+       * language types, such as mat4 and vec2, are free form.  The only
+       * requirement is that the parameters must provide enough values of the
+       * correct scalar type.  Constructors for arrays and structures must
+       * have the exact number of parameters with matching types in the
+       * correct order.  These constructors follow essentially the same type
+       * matching rules as functions.
+       */
+      if (constructor_type->is_record()) {
+	 exec_list actual_parameters;
+
+	 process_parameters(instructions, &actual_parameters,
+			    &this->expressions, state);
+
+	 exec_node *node = actual_parameters.head;
+	 for (unsigned i = 0; i < constructor_type->length; i++) {
+	    ir_rvalue *ir = (ir_rvalue *) node;
+
+	    if (node->is_tail_sentinel()) {
+	       _mesa_glsl_error(&loc, state,
+				"insufficient parameters to constructor "
+				"for `%s'",
+				constructor_type->name);
+	       return ir_call::get_error_instruction(ctx);
+	    }
+
+	    if (apply_implicit_conversion(constructor_type->fields.structure[i].type,
+					  ir, state)) {
+	       node->replace_with(ir);
+	    } else {
+	       _mesa_glsl_error(&loc, state,
+				"parameter type mismatch in constructor "
+				"for `%s.%s' (%s vs %s)",
+				constructor_type->name,
+				constructor_type->fields.structure[i].name,
+				ir->type->name,
+				constructor_type->fields.structure[i].type->name);
+	       return ir_call::get_error_instruction(ctx);;
+	    }
+
+	    node = node->next;
+	 }
+
+	 if (!node->is_tail_sentinel()) {
+	    _mesa_glsl_error(&loc, state, "too many parameters in constructor "
+			     "for `%s'", constructor_type->name);
+	    return ir_call::get_error_instruction(ctx);
+	 }
+
+	 ir_rvalue *const constant =
+	    constant_record_constructor(constructor_type, &actual_parameters,
+					state);
+
+	 return (constant != NULL)
+	    ? constant
+	    : emit_inline_record_constructor(constructor_type, instructions,
+					     &actual_parameters, state);
+      }
+
+      if (!constructor_type->is_numeric() && !constructor_type->is_boolean())
+	 return ir_call::get_error_instruction(ctx);
+
+      /* Total number of components of the type being constructed. */
+      const unsigned type_components = constructor_type->components();
+
+      /* Number of components from parameters that have actually been
+       * consumed.  This is used to perform several kinds of error checking.
+       */
+      unsigned components_used = 0;
+
+      unsigned matrix_parameters = 0;
+      unsigned nonmatrix_parameters = 0;
+      exec_list actual_parameters;
+
+      foreach_list (n, &this->expressions) {
+	 ast_node *ast = exec_node_data(ast_node, n, link);
+	 ir_rvalue *result = ast->hir(instructions, state)->as_rvalue();
+
+	 /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec:
+	  *
+	  *    "It is an error to provide extra arguments beyond this
+	  *    last used argument."
+	  */
+	 if (components_used >= type_components) {
+	    _mesa_glsl_error(& loc, state, "too many parameters to `%s' "
+			     "constructor",
+			     constructor_type->name);
+	    return ir_call::get_error_instruction(ctx);
+	 }
+
+	 if (!result->type->is_numeric() && !result->type->is_boolean()) {
+	    _mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
+			     "non-numeric data type",
+			     constructor_type->name);
+	    return ir_call::get_error_instruction(ctx);
+	 }
+
+	 /* Count the number of matrix and nonmatrix parameters.  This
+	  * is used below to enforce some of the constructor rules.
+	  */
+	 if (result->type->is_matrix())
+	    matrix_parameters++;
+	 else
+	    nonmatrix_parameters++;
+
+	 actual_parameters.push_tail(result);
+	 components_used += result->type->components();
+      }
+
+      /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec:
+       *
+       *    "It is an error to construct matrices from other matrices. This
+       *    is reserved for future use."
+       */
+      if (state->language_version == 110 && matrix_parameters > 0
+	  && constructor_type->is_matrix()) {
+	 _mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
+			  "matrix in GLSL 1.10",
+			  constructor_type->name);
+	 return ir_call::get_error_instruction(ctx);
+      }
+
+      /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec:
+       *
+       *    "If a matrix argument is given to a matrix constructor, it is
+       *    an error to have any other arguments."
+       */
+      if ((matrix_parameters > 0)
+	  && ((matrix_parameters + nonmatrix_parameters) > 1)
+	  && constructor_type->is_matrix()) {
+	 _mesa_glsl_error(& loc, state, "for matrix `%s' constructor, "
+			  "matrix must be only parameter",
+			  constructor_type->name);
+	 return ir_call::get_error_instruction(ctx);
+      }
+
+      /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec:
+       *
+       *    "In these cases, there must be enough components provided in the
+       *    arguments to provide an initializer for every component in the
+       *    constructed value."
+       */
+      if (components_used < type_components && components_used != 1
+	  && matrix_parameters == 0) {
+	 _mesa_glsl_error(& loc, state, "too few components to construct "
+			  "`%s'",
+			  constructor_type->name);
+	 return ir_call::get_error_instruction(ctx);
+      }
+
+      /* Later, we cast each parameter to the same base type as the
+       * constructor.  Since there are no non-floating point matrices, we
+       * need to break them up into a series of column vectors.
+       */
+      if (constructor_type->base_type != GLSL_TYPE_FLOAT) {
+	 foreach_list_safe(n, &actual_parameters) {
+	    ir_rvalue *matrix = (ir_rvalue *) n;
+
+	    if (!matrix->type->is_matrix())
+	       continue;
+
+	    /* Create a temporary containing the matrix. */
+	    ir_variable *var = new(ctx) ir_variable(matrix->type, "matrix_tmp",
+						    ir_var_temporary);
+	    instructions->push_tail(var);
+	    instructions->push_tail(new(ctx) ir_assignment(new(ctx)
+	       ir_dereference_variable(var), matrix, NULL));
+	    var->constant_value = matrix->constant_expression_value();
+
+	    /* Replace the matrix with dereferences of its columns. */
+	    for (int i = 0; i < matrix->type->matrix_columns; i++) {
+	       matrix->insert_before(new (ctx) ir_dereference_array(var,
+		  new(ctx) ir_constant(i)));
+	    }
+	    matrix->remove();
+	 }
+      }
+
+      bool all_parameters_are_constant = true;
+
+      /* Type cast each parameter and, if possible, fold constants.*/
+      foreach_list_safe(n, &actual_parameters) {
+	 ir_rvalue *ir = (ir_rvalue *) n;
+
+	 const glsl_type *desired_type =
+	    glsl_type::get_instance(constructor_type->base_type,
+				    ir->type->vector_elements,
+				    ir->type->matrix_columns);
+	 ir_rvalue *result = convert_component(ir, desired_type);
+
+	 /* Attempt to convert the parameter to a constant valued expression.
+	  * After doing so, track whether or not all the parameters to the
+	  * constructor are trivially constant valued expressions.
+	  */
+	 ir_rvalue *const constant = result->constant_expression_value();
+
+	 if (constant != NULL)
+	    result = constant;
+	 else
+	    all_parameters_are_constant = false;
+
+	 if (result != ir) {
+	    ir->replace_with(result);
+	 }
+      }
+
+      /* If all of the parameters are trivially constant, create a
+       * constant representing the complete collection of parameters.
+       */
+      if (all_parameters_are_constant) {
+	 return new(ctx) ir_constant(constructor_type, &actual_parameters);
+      } else if (constructor_type->is_scalar()) {
+	 return dereference_component((ir_rvalue *) actual_parameters.head,
+				      0);
+      } else if (constructor_type->is_vector()) {
+	 return emit_inline_vector_constructor(constructor_type,
+					       instructions,
+					       &actual_parameters,
+					       ctx);
+      } else {
+	 assert(constructor_type->is_matrix());
+	 return emit_inline_matrix_constructor(constructor_type,
+					       instructions,
+					       &actual_parameters,
+					       ctx);
+      }
+   } else {
+      const ast_expression *id = subexpressions[0];
+      YYLTYPE loc = id->get_location();
+      exec_list actual_parameters;
+
+      process_parameters(instructions, &actual_parameters, &this->expressions,
+			 state);
+
+      return match_function_by_name(instructions, 
+				    id->primary_expression.identifier, & loc,
+				    &actual_parameters, state);
+   }
+
+   return ir_call::get_error_instruction(ctx);
+}
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index a11bfbab8..3b87f0d56 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -940,7 +940,7 @@ ast_expression::hir(exec_list *instructions,
    };
    ir_rvalue *result = NULL;
    ir_rvalue *op[3];
-   const struct glsl_type *type = glsl_type::error_type;
+   const struct glsl_type *type; /* a temporary variable for switch cases */
    bool error_emitted = false;
    YYLTYPE loc;
 
@@ -954,7 +954,6 @@ ast_expression::hir(exec_list *instructions,
       result = do_assignment(instructions, state, op[0], op[1], false,
 			     this->subexpressions[0]->get_location());
       error_emitted = result->type->is_error();
-      type = result->type;
       break;
    }
 
@@ -1078,9 +1077,7 @@ ast_expression::hir(exec_list *instructions,
       } else {
 	 result = do_comparison(ctx, operations[this->oper], op[0], op[1]);
 	 assert(result->type == glsl_type::bool_type);
-	 type = glsl_type::bool_type;
       }
-
       break;
 
    case ast_bit_and:
@@ -1209,7 +1206,6 @@ ast_expression::hir(exec_list *instructions,
 
       result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
 				      op[0], op[1]);
-      type = glsl_type::bool_type;
       break;
 
    case ast_logic_not:
@@ -1218,7 +1214,6 @@ ast_expression::hir(exec_list *instructions,
 
       result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
 				      op[0], NULL);
-      type = glsl_type::bool_type;
       break;
 
    case ast_mul_assign:
@@ -1238,7 +1233,6 @@ ast_expression::hir(exec_list *instructions,
       result = do_assignment(instructions, state,
 			     op[0]->clone(ctx, NULL), temp_rhs, false,
 			     this->subexpressions[0]->get_location());
-      type = result->type;
       error_emitted = (op[0]->type->is_error());
 
       /* GLSL 1.10 does not allow array assignment.  However, we don't have to
@@ -1264,7 +1258,6 @@ ast_expression::hir(exec_list *instructions,
       result = do_assignment(instructions, state,
 			     op[0]->clone(ctx, NULL), temp_rhs, false,
 			     this->subexpressions[0]->get_location());
-      type = result->type;
       error_emitted = type->is_error();
       break;
    }
@@ -1406,7 +1399,6 @@ ast_expression::hir(exec_list *instructions,
       result = do_assignment(instructions, state,
 			     op[0]->clone(ctx, NULL), temp_rhs, false,
 			     this->subexpressions[0]->get_location());
-      type = result->type;
       error_emitted = op[0]->type->is_error();
       break;
    }
@@ -1436,14 +1428,12 @@ ast_expression::hir(exec_list *instructions,
 			  op[0]->clone(ctx, NULL), temp_rhs, false,
 			  this->subexpressions[0]->get_location());
 
-      type = result->type;
       error_emitted = op[0]->type->is_error();
       break;
    }
 
    case ast_field_selection:
       result = _mesa_ast_field_selection_to_hir(this, instructions, state);
-      type = result->type;
       break;
 
    case ast_array_index: {
@@ -1600,7 +1590,6 @@ ast_expression::hir(exec_list *instructions,
       if (error_emitted)
 	 result->type = glsl_type::error_type;
 
-      type = result->type;
       break;
    }
 
@@ -1623,7 +1612,6 @@ ast_expression::hir(exec_list *instructions,
 
       if (var != NULL) {
 	 var->used = true;
-	 type = result->type;
       } else {
 	 _mesa_glsl_error(& loc, state, "`%s' undeclared",
 			  this->primary_expression.identifier);
@@ -1634,22 +1622,18 @@ ast_expression::hir(exec_list *instructions,
    }
 
    case ast_int_constant:
-      type = glsl_type::int_type;
       result = new(ctx) ir_constant(this->primary_expression.int_constant);
       break;
 
    case ast_uint_constant:
-      type = glsl_type::uint_type;
       result = new(ctx) ir_constant(this->primary_expression.uint_constant);
       break;
 
    case ast_float_constant:
-      type = glsl_type::float_type;
       result = new(ctx) ir_constant(this->primary_expression.float_constant);
       break;
 
    case ast_bool_constant:
-      type = glsl_type::bool_type;
       result = new(ctx) ir_constant(bool(this->primary_expression.bool_constant));
       break;
 
@@ -1664,10 +1648,42 @@ ast_expression::hir(exec_list *instructions,
        * therefore add instructions to the instruction list), they get dropped
        * on the floor.
        */
-      foreach_list_typed (ast_node, ast, link, &this->expressions)
-	 result = ast->hir(instructions, state);
+      exec_node *previous_tail_pred = NULL;
+      YYLTYPE previous_operand_loc = loc;
+
+      foreach_list_typed (ast_node, ast, link, &this->expressions) {
+	 /* If one of the operands of comma operator does not generate any
+	  * code, we want to emit a warning.  At each pass through the loop
+	  * previous_tail_pred will point to the last instruction in the
+	  * stream *before* processing the previous operand.  Naturally,
+	  * instructions->tail_pred will point to the last instruction in the
+	  * stream *after* processing the previous operand.  If the two
+	  * pointers match, then the previous operand had no effect.
+	  *
+	  * The warning behavior here differs slightly from GCC.  GCC will
+	  * only emit a warning if none of the left-hand operands have an
+	  * effect.  However, it will emit a warning for each.  I believe that
+	  * there are some cases in C (especially with GCC extensions) where
+	  * it is useful to have an intermediate step in a sequence have no
+	  * effect, but I don't think these cases exist in GLSL.  Either way,
+	  * it would be a giant hassle to replicate that behavior.
+	  */
+	 if (previous_tail_pred == instructions->tail_pred) {
+	    _mesa_glsl_warning(&previous_operand_loc, state,
+			       "left-hand operand of comma expression has "
+			       "no effect");
+	 }
+
+	 /* tail_pred is directly accessed instead of using the get_tail()
+	  * method for performance reasons.  get_tail() has extra code to
+	  * return NULL when the list is empty.  We don't care about that
+	  * here, so using tail_pred directly is fine.
+	  */
+	 previous_tail_pred = instructions->tail_pred;
+	 previous_operand_loc = ast->get_location();
 
-      type = result->type;
+	 result = ast->hir(instructions, state);
+      }
 
       /* Any errors should have already been emitted in the loop above.
        */
@@ -1675,8 +1691,10 @@ ast_expression::hir(exec_list *instructions,
       break;
    }
    }
+   type = NULL; /* use result->type, not type. */
+   assert(result != NULL);
 
-   if (type->is_error() && !error_emitted)
+   if (result->type->is_error() && !error_emitted)
       _mesa_glsl_error(& loc, state, "type mismatch");
 
    return result;
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index fdc946780..6f15e85a1 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -1563,6 +1563,7 @@ _glcpp_parser_expand_token_list (glcpp_parser_t *parser,
 	token_node_t *node_prev;
 	token_node_t *node, *last = NULL;
 	token_list_t *expansion;
+	active_list_t *active_initial = parser->active;
 
 	if (list == NULL)
 		return;
@@ -1617,7 +1618,10 @@ _glcpp_parser_expand_token_list (glcpp_parser_t *parser,
 		node = node_prev ? node_prev->next : list->head;
 	}
 
-	while (parser->active)
+	/* Remove any lingering effects of this invocation on the
+	 * active list. That is, pop until the list looks like it did
+	 * at the beginning of this function. */
+	while (parser->active && parser->active != active_initial)
 		_parser_active_list_pop (parser);
 
 	list->non_space_tail = list->tail;
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index ec79d05ca..7b1c19d65 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -254,7 +254,7 @@ ir_validate::visit_leave(ir_expression *ir)
 
    case ir_unop_f2i:
       assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
-      assert(ir->type->base_type == GLSL_TYPE_INT);
+      assert(ir->type->is_integer());
       break;
    case ir_unop_i2f:
       assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
@@ -269,12 +269,12 @@ ir_validate::visit_leave(ir_expression *ir)
       assert(ir->type->base_type == GLSL_TYPE_FLOAT);
       break;
    case ir_unop_i2b:
-      assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
+      assert(ir->operands[0]->type->is_integer());
       assert(ir->type->base_type == GLSL_TYPE_BOOL);
       break;
    case ir_unop_b2i:
       assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
-      assert(ir->type->base_type == GLSL_TYPE_INT);
+      assert(ir->type->is_integer());
       break;
    case ir_unop_u2f:
       assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 17492357f..255edc6a7 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -510,7 +510,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
 	  */
 	 if (input->type != output->type) {
 	    /* There is a bit of a special case for gl_TexCoord.  This
-	     * built-in is unsized by default.  Appliations that variable
+	     * built-in is unsized by default.  Applications that variable
 	     * access it must redeclare it with a size.  There is some
 	     * language in the GLSL spec that implies the fragment shader
 	     * and vertex shader do not have to agree on this size.  Other
@@ -997,7 +997,7 @@ update_array_sizes(struct gl_shader_program *prog)
 	    /* If this is a built-in uniform (i.e., it's backed by some
 	     * fixed-function state), adjust the number of state slots to
 	     * match the new array size.  The number of slots per array entry
-	     * is not known.  It seems saft to assume that the total number of
+	     * is not known.  It seems safe to assume that the total number of
 	     * slots is an integer multiple of the number of array elements.
 	     * Determine the number of slots per array element by dividing by
 	     * the old (total) size.
@@ -1163,7 +1163,7 @@ assign_uniform_locations(struct gl_shader_program *prog)
 
 
 /**
- * Find a contiguous set of available bits in a bitmask
+ * Find a contiguous set of available bits in a bitmask.
  *
  * \param used_mask     Bits representing used (1) and unused (0) locations
  * \param needed_count  Number of contiguous bits needed.
@@ -1210,7 +1210,7 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index
     * 1. Invalidate the location assignments for all vertex shader inputs.
     *
     * 2. Assign locations for inputs that have user-defined (via
-    *    glBindVertexAttribLocation) locatoins.
+    *    glBindVertexAttribLocation) locations.
     *
     * 3. Sort the attributes without assigned locations by number of slots
     *    required in decreasing order.  Fragmentation caused by attribute
@@ -1349,7 +1349,7 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index
 
    qsort(to_assign, num_attr, sizeof(to_assign[0]), temp_attr::compare);
 
-   /* VERT_ATTRIB_GENERIC0 is a psdueo-alias for VERT_ATTRIB_POS.  It can only
+   /* VERT_ATTRIB_GENERIC0 is a pseudo-alias for VERT_ATTRIB_POS.  It can only
     * be explicitly assigned by via glBindAttribLocation.  Mark it as reserved
     * to prevent it from being automatically allocated below.
     */
@@ -1610,7 +1610,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
 	    break;
       }
 
-      /* Validate the inputs of each stage with the output of the preceeding
+      /* Validate the inputs of each stage with the output of the preceding
        * stage.
        */
       for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) {
diff --git a/mesalib/src/glu/sgi/SConscript b/mesalib/src/glu/sgi/SConscript
new file mode 100644
index 000000000..a0c6c6584
--- /dev/null
+++ b/mesalib/src/glu/sgi/SConscript
@@ -0,0 +1,138 @@
+Import('*')
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+    'include',
+    'internals',
+    'libnurbs/internals',
+    'libnurbs/interface',
+    'libnurbs/nurbtess',
+])
+
+env.Prepend(CPPDEFINES = [
+    'NDEBUG',
+    'LIBRARYBUILD',
+    'RESOLVE_3D_TEXTURE_SUPPORT',
+])
+
+sources = [
+    'libutil/error.c',
+    'libutil/glue.c',
+    'libutil/mipmap.c',
+    'libutil/project.c',
+    'libutil/quad.c',
+    'libutil/registry.c',
+    'libtess/dict.c',
+    'libtess/geom.c',
+    'libtess/memalloc.c',
+    'libtess/mesh.c',
+    'libtess/normal.c',
+    'libtess/priorityq.c',
+    'libtess/render.c',
+    'libtess/sweep.c',
+    'libtess/tess.c',
+    'libtess/tessmono.c',
+    'libnurbs/interface/bezierEval.cc',
+    'libnurbs/interface/bezierPatch.cc',
+    'libnurbs/interface/bezierPatchMesh.cc',
+    'libnurbs/interface/glcurveval.cc',
+    'libnurbs/interface/glinterface.cc',
+    'libnurbs/interface/glrenderer.cc',
+    'libnurbs/interface/glsurfeval.cc',
+    'libnurbs/interface/incurveeval.cc',
+    'libnurbs/interface/insurfeval.cc',
+    'libnurbs/internals/arc.cc',
+    'libnurbs/internals/arcsorter.cc',
+    'libnurbs/internals/arctess.cc',
+    'libnurbs/internals/backend.cc',
+    'libnurbs/internals/basiccrveval.cc',
+    'libnurbs/internals/basicsurfeval.cc',
+    'libnurbs/internals/bin.cc',
+    'libnurbs/internals/bufpool.cc',
+    'libnurbs/internals/cachingeval.cc',
+    'libnurbs/internals/ccw.cc',
+    'libnurbs/internals/coveandtiler.cc',
+    'libnurbs/internals/curve.cc',
+    'libnurbs/internals/curvelist.cc',
+    'libnurbs/internals/curvesub.cc',
+    'libnurbs/internals/dataTransform.cc',
+    'libnurbs/internals/displaylist.cc',
+    'libnurbs/internals/flist.cc',
+    'libnurbs/internals/flistsorter.cc',
+    'libnurbs/internals/hull.cc',
+    'libnurbs/internals/intersect.cc',
+    'libnurbs/internals/knotvector.cc',
+    'libnurbs/internals/mapdesc.cc',
+    'libnurbs/internals/mapdescv.cc',
+    'libnurbs/internals/maplist.cc',
+    'libnurbs/internals/mesher.cc',
+    'libnurbs/internals/monoTriangulationBackend.cc',
+    'libnurbs/internals/monotonizer.cc',
+    'libnurbs/internals/mycode.cc',
+    'libnurbs/internals/nurbsinterfac.cc',
+    'libnurbs/internals/nurbstess.cc',
+    'libnurbs/internals/patch.cc',
+    'libnurbs/internals/patchlist.cc',
+    'libnurbs/internals/quilt.cc',
+    'libnurbs/internals/reader.cc',
+    'libnurbs/internals/renderhints.cc',
+    'libnurbs/internals/slicer.cc',
+    'libnurbs/internals/sorter.cc',
+    'libnurbs/internals/splitarcs.cc',
+    'libnurbs/internals/subdivider.cc',
+    'libnurbs/internals/tobezier.cc',
+    'libnurbs/internals/trimline.cc',
+    'libnurbs/internals/trimregion.cc',
+    'libnurbs/internals/trimvertpool.cc',
+    'libnurbs/internals/uarray.cc',
+    'libnurbs/internals/varray.cc',
+    'libnurbs/nurbtess/directedLine.cc',
+    'libnurbs/nurbtess/gridWrap.cc',
+    'libnurbs/nurbtess/monoChain.cc',
+    'libnurbs/nurbtess/monoPolyPart.cc',
+    'libnurbs/nurbtess/monoTriangulation.cc',
+    'libnurbs/nurbtess/partitionX.cc',
+    'libnurbs/nurbtess/partitionY.cc',
+    'libnurbs/nurbtess/polyDBG.cc',
+    'libnurbs/nurbtess/polyUtil.cc',
+    'libnurbs/nurbtess/primitiveStream.cc',
+    'libnurbs/nurbtess/quicksort.cc',
+    'libnurbs/nurbtess/rectBlock.cc',
+    'libnurbs/nurbtess/sampleComp.cc',
+    'libnurbs/nurbtess/sampleCompBot.cc',
+    'libnurbs/nurbtess/sampleCompRight.cc',
+    'libnurbs/nurbtess/sampleCompTop.cc',
+    'libnurbs/nurbtess/sampleMonoPoly.cc',
+    'libnurbs/nurbtess/sampledLine.cc',
+    'libnurbs/nurbtess/searchTree.cc',
+]
+
+if env['platform'] == 'windows':
+    # -D_OPENGL32_ -Iinclude -DBUILD_GL32
+    env.PrependUnique(LIBS = [
+        'gdi32', 
+        'user32', 
+        'opengl32', 
+    ])
+    target = 'glu32'
+    sources += ['glu.def']
+else:
+    env.PrependUnique(LIBS = [
+        'GL',
+    ])
+    target = 'glu'
+
+glu = env.SharedLibrary(
+    target = target,
+    source = sources
+)
+
+env.Alias('glu', env.InstallSharedLibrary(glu, version=(1, 3, 0)))
+
+if env['platform'] == 'windows':
+    glu = env.FindIxes(glu, 'LIBPREFIX', 'LIBSUFFIX')
+else:
+    glu = env.FindIxes(glu, 'SHLIBPREFIX', 'SHLIBSUFFIX')
+
+Export('glu')
diff --git a/mesalib/src/glu/sgi/include/gluos.h b/mesalib/src/glu/sgi/include/gluos.h
index 8eaa7a153..802aa8402 100644
--- a/mesalib/src/glu/sgi/include/gluos.h
+++ b/mesalib/src/glu/sgi/include/gluos.h
@@ -40,7 +40,9 @@
 #define NOIME
 #define NOMINMAX
 
-#define _WIN32_WINNT 0x0400
+#ifndef _WIN32_WINNT
+  #define _WIN32_WINNT 0x0400
+#endif
 #ifndef STRICT
   #define STRICT 1
 #endif
@@ -48,9 +50,11 @@
 #include <windows.h>
 
 /* Disable warnings */
+#if defined(_MSC_VER)
 #pragma warning(disable : 4101)
 #pragma warning(disable : 4244)
 #pragma warning(disable : 4761)
+#endif
 
 #if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1300
 #pragma comment(linker, "/OPT:NOWIN98")
diff --git a/mesalib/src/glu/sgi/libutil/mipmap.c b/mesalib/src/glu/sgi/libutil/mipmap.c
index 026ab849c..415dfaa54 100644
--- a/mesalib/src/glu/sgi/libutil/mipmap.c
+++ b/mesalib/src/glu/sgi/libutil/mipmap.c
@@ -6631,7 +6631,7 @@ static TexImage3Dproc pTexImage3D = 0;
 #  include <dlfcn.h>
 #  include <sys/types.h>
 #else
-  WINGDIAPI PROC  WINAPI wglGetProcAddress(LPCSTR);
+#  include <windows.h>
 #endif
 
 static void gluTexImage3D( GLenum target, GLint level,
@@ -6648,7 +6648,7 @@ static void gluTexImage3D( GLenum target, GLint level,
 	 pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3DEXT");
 #else
       void *libHandle = dlopen("libgl.so", RTLD_LAZY);
-      pTexImage3D = TexImage3Dproc) dlsym(libHandle, "glTexImage3D" );
+      pTexImage3D = (TexImage3Dproc) dlsym(libHandle, "glTexImage3D" );
       if (!pTexImage3D)
 	 pTexImage3D = (TexImage3Dproc) dlsym(libHandle,"glTexImage3DEXT");
       dlclose(libHandle);
diff --git a/mesalib/src/mapi/glapi/gen/ARB_robustness.xml b/mesalib/src/mapi/glapi/gen/ARB_robustness.xml
new file mode 100644
index 000000000..b347ef35c
--- /dev/null
+++ b/mesalib/src/mapi/glapi/gen/ARB_robustness.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_ARB_robustness" number="105">
+
+    <enum name="GUILTY_CONTEXT_RESET_ARB"                 value="0x8253"/>
+    <enum name="INNOCENT_CONTEXT_RESET_ARB"               value="0x8254"/>
+    <enum name="UNKNOWN_CONTEXT_RESET_ARB"                value="0x8255"/>
+
+    <enum name="RESET_NOTIFICATION_STRATEGY_ARB" count="1" value="0x8256">
+        <size name="Get" mode="get"/>
+    </enum>
+    <enum name="LOSE_CONTEXT_ON_RESET_ARB"                value="0x8252"/>
+    <enum name="NO_RESET_NOTIFICATION_ARB"                value="0x8261"/>
+
+    <enum name="CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB"       value="0x00000004"/>
+
+    <function name="GetGraphicsResetStatusARB" offset="assign">
+        <return type="GLenum"/>
+    </function>
+
+<!-- OpenGL 1.0 sized buffer queries -->
+    <function name="GetnMapdvARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="query" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="v" type="GLdouble *" output="true"/>
+    </function>
+
+    <function name="GetnMapfvARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="query" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="v" type="GLfloat *" output="true"/>
+    </function>
+
+    <function name="GetnMapivARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="query" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="v" type="GLint *" output="true"/>
+    </function>
+
+
+
+    <function name="GetnPixelMapfvARB" offset="assign">
+        <param name="map" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="values" type="GLfloat *" output="true"/>
+    </function>
+
+    <function name="GetnPixelMapuivARB" offset="assign">
+        <param name="map" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="values" type="GLuint *" output="true"/>
+    </function>
+
+    <function name="GetnPixelMapusvARB" offset="assign">
+        <param name="map" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="values" type="GLushort *" output="true"/>
+    </function>
+
+
+
+    <function name="GetnPolygonStippleARB" offset="assign">
+        <param name="bufSize" type="GLsizei"/>
+        <param name="pattern" type="GLubyte *" output="true"/>
+    </function>
+
+    <function name="GetnTexImageARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="level" type="GLint"/>
+        <param name="format" type="GLenum"/>
+        <param name="type" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="img" type="GLvoid *" output="true"/>
+    </function>
+
+    <function name="ReadnPixelsARB" offset="assign">
+        <param name="x" type="GLint"/>
+        <param name="y" type="GLint"/>
+        <param name="width" type="GLsizei"/>
+        <param name="height" type="GLsizei"/>
+        <param name="format" type="GLenum"/>
+        <param name="type" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="data" type="GLvoid *" output="true"/>
+    </function>
+
+
+<!-- ARB_imaging sized buffer queries -->
+    <function name="GetnColorTableARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="format" type="GLenum"/>
+        <param name="type" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="table" type="GLvoid *" output="true"/>
+    </function>
+
+    <function name="GetnConvolutionFilterARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="format" type="GLenum"/>
+        <param name="type" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="image" type="GLvoid *" output="true"/>
+    </function>
+
+    <function name="GetnSeparableFilterARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="format" type="GLenum"/>
+        <param name="type" type="GLenum"/>
+        <param name="rowBufSize" type="GLsizei"/>
+        <param name="row" type="GLvoid *" output="true"/>
+        <param name="columnBufSize" type="GLsizei"/>
+        <param name="column" type="GLvoid *" output="true"/>
+        <param name="span" type="GLvoid *" output="true"/>
+    </function>
+
+    <function name="GetnHistogramARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="reset" type="GLboolean"/>
+        <param name="format" type="GLenum"/>
+        <param name="type" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="values" type="GLvoid *" output="true"/>
+    </function>
+
+    <function name="GetnMinmaxARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="reset" type="GLboolean"/>
+        <param name="format" type="GLenum"/>
+        <param name="type" type="GLenum"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="values" type="GLvoid *" output="true"/>
+    </function>
+
+
+<!-- OpenGL 1.3 sized buffer queries -->
+    <function name="GetnCompressedTexImageARB" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="lod" type="GLint"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="img" type="GLvoid *" output="true"/>
+    </function>
+
+
+<!-- OpenGL 2.0 sized buffer queries -->
+    <function name="GetnUniformfvARB" offset="assign">
+        <param name="program" type="GLhandleARB"/>
+        <param name="location" type="GLint"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="params" type="GLfloat *" output="true"/>
+    </function>
+
+    <function name="GetnUniformivARB" offset="assign">
+        <param name="program" type="GLhandleARB"/>
+        <param name="location" type="GLint"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="params" type="GLint *" output="true"/>
+    </function>
+
+    <function name="GetnUniformuivARB" offset="assign">
+        <param name="program" type="GLhandleARB"/>
+        <param name="location" type="GLint"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="params" type="GLuint *" output="true"/>
+    </function>
+
+    <function name="GetnUniformdvARB" offset="assign">
+        <param name="program" type="GLhandleARB"/>
+        <param name="location" type="GLint"/>
+        <param name="bufSize" type="GLsizei"/>
+        <param name="params" type="GLdouble *" output="true"/>
+    </function>
+
+</category>
+
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile
index b56ce8639..f02e5d274 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile
+++ b/mesalib/src/mapi/glapi/gen/Makefile
@@ -80,6 +80,7 @@ API_XML = \
 	ARB_geometry_shader4.xml \
 	ARB_instanced_arrays.xml \
 	ARB_map_buffer_range.xml \
+	ARB_robustness.xml \
 	ARB_sampler_objects.xml \
 	ARB_seamless_cube_map.xml \
 	ARB_sync.xml \
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index ef68ad62c..669be6064 100644
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -7983,6 +7983,8 @@
 
 <xi:include href="ARB_color_buffer_float.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
+<xi:include href="ARB_robustness.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
 <!-- Non-ARB extensions sorted by extension number. -->
 
 <category name="GL_EXT_blend_color" number="2">
diff --git a/mesalib/src/mapi/glapi/gen/gl_XML.py b/mesalib/src/mapi/glapi/gen/gl_XML.py
index 660c8cfb7..4d414e8b0 100644
--- a/mesalib/src/mapi/glapi/gen/gl_XML.py
+++ b/mesalib/src/mapi/glapi/gen/gl_XML.py
@@ -224,7 +224,7 @@ class gl_print_base:
 		"""
 
 		self.undef_list.append(S)
-		print """#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
+		print """#  if (defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) && defined(__ELF__))
 #    define %s  __attribute__((visibility("%s")))
 #  else
 #    define %s
diff --git a/mesalib/src/mapi/glapi/glapi_mapi_tmp.h b/mesalib/src/mapi/glapi/glapi_mapi_tmp.h
index 02a541edc..b3ee552c6 100644
--- a/mesalib/src/mapi/glapi/glapi_mapi_tmp.h
+++ b/mesalib/src/mapi/glapi/glapi_mapi_tmp.h
@@ -836,25 +836,45 @@ GLAPI void APIENTRY GLAPI_PREFIX(ShaderBinary)(GLsizei n, const GLuint *shaders,
 void APIENTRY GLAPI_PREFIX(_dispatch_stub_626)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
 void APIENTRY GLAPI_PREFIX(_dispatch_stub_627)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
 void APIENTRY GLAPI_PREFIX(_dispatch_stub_628)(GLuint program, GLenum pname, GLint value);
+GLAPI GLenum APIENTRY GLAPI_PREFIX(GetGraphicsResetStatusARB)(void);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnColorTableARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnCompressedTexImageARB)(GLenum target, GLint lod, GLsizei bufSize, GLvoid *img);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnConvolutionFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnHistogramARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMapdvARB)(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMapfvARB)(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMapivARB)(GLenum target, GLenum query, GLsizei bufSize, GLint *v);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMinmaxARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPixelMapfvARB)(GLenum map, GLsizei bufSize, GLfloat *values);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPixelMapuivARB)(GLenum map, GLsizei bufSize, GLuint *values);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPixelMapusvARB)(GLenum map, GLsizei bufSize, GLushort *values);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPolygonStippleARB)(GLsizei bufSize, GLubyte *pattern);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnSeparableFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnTexImageARB)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformdvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLdouble *params);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformfvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLfloat *params);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLint *params);
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformuivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLuint *params);
+GLAPI void APIENTRY GLAPI_PREFIX(ReadnPixelsARB)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
 GLAPI void APIENTRY GLAPI_PREFIX(PolygonOffsetEXT)(GLfloat factor, GLfloat bias);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_630)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_631)(const GLfloat *coords);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_632)(GLint x, GLint y, GLint z, GLint width, GLint height);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_633)(const GLint *coords);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_634)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_635)(const GLshort *coords);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_636)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_637)(const GLfixed *coords);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_638)(GLenum type, GLsizei stride, const GLvoid *pointer);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_639)(GLenum pname, GLfloat *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_640)(GLenum pname, GLint *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_641)(GLenum pname, GLfloat param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_642)(GLenum pname, const GLfloat *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_643)(GLenum pname, GLint param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_644)(GLenum pname, const GLint *params);
-GLbitfield APIENTRY GLAPI_PREFIX(_dispatch_stub_645)(GLfixed *mantissa, GLint *exponent);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_646)(GLclampf value, GLboolean invert);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_647)(GLenum pattern);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_650)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_651)(const GLfloat *coords);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_652)(GLint x, GLint y, GLint z, GLint width, GLint height);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_653)(const GLint *coords);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_654)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_655)(const GLshort *coords);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_656)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_657)(const GLfixed *coords);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_658)(GLenum type, GLsizei stride, const GLvoid *pointer);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_659)(GLenum pname, GLfloat *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_660)(GLenum pname, GLint *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_661)(GLenum pname, GLfloat param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_662)(GLenum pname, const GLfloat *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_663)(GLenum pname, GLint param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_664)(GLenum pname, const GLint *params);
+GLbitfield APIENTRY GLAPI_PREFIX(_dispatch_stub_665)(GLfixed *mantissa, GLint *exponent);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_666)(GLclampf value, GLboolean invert);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_667)(GLenum pattern);
 GLAPI void APIENTRY GLAPI_PREFIX(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
 GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean *pointer);
 GLAPI void APIENTRY GLAPI_PREFIX(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
@@ -917,7 +937,7 @@ GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfEXT)(GLfloat coord);
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordf)(GLfloat coord);
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfvEXT)(const GLfloat *coord);
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfv)(const GLfloat *coord);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_682)(GLenum mode);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_702)(GLenum mode);
 GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
 GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
 GLAPI void APIENTRY GLAPI_PREFIX(FlushVertexArrayRangeNV)(void);
@@ -992,15 +1012,15 @@ GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLi
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4ivMESA)(const GLint *v);
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w);
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4svMESA)(const GLshort *v);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_724)(const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_725)(const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_726)(GLsizei n, const GLuint *fences);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_727)(GLuint fence);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_728)(GLsizei n, GLuint *fences);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_729)(GLuint fence, GLenum pname, GLint *params);
-GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_730)(GLuint fence);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_731)(GLuint fence, GLenum condition);
-GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_732)(GLuint fence);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_744)(const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_745)(const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_746)(GLsizei n, const GLuint *fences);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_747)(GLuint fence);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_748)(GLsizei n, GLuint *fences);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_749)(GLuint fence, GLenum pname, GLint *params);
+GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_750)(GLuint fence);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_751)(GLuint fence, GLenum condition);
+GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_752)(GLuint fence);
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreProgramsResidentNV)(GLsizei n, const GLuint *ids, GLboolean *residences);
 GLAPI void APIENTRY GLAPI_PREFIX(BindProgramNV)(GLenum target, GLuint program);
 GLAPI void APIENTRY GLAPI_PREFIX(BindProgramARB)(GLenum target, GLuint program);
@@ -1089,12 +1109,12 @@ GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriNV)(GLenum pname, GLint param);
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameteri)(GLenum pname, GLint param);
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterivNV)(GLenum pname, const GLint *params);
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriv)(GLenum pname, const GLint *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_813)(GLenum face);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_814)(GLuint array);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_815)(GLsizei n, const GLuint *arrays);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_833)(GLenum face);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_834)(GLuint array);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_835)(GLsizei n, const GLuint *arrays);
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteVertexArrays)(GLsizei n, const GLuint *arrays);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_816)(GLsizei n, GLuint *arrays);
-GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_817)(GLuint array);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_836)(GLsizei n, GLuint *arrays);
+GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_837)(GLuint array);
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsVertexArray)(GLuint array);
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
@@ -1105,54 +1125,54 @@ GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4fvNV)(GLuint id, GLsizei
 GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndexNV)(GLuint index);
 GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndex)(GLuint index);
 GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartNV)(void);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_826)(GLenum func, GLclampx ref);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_827)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_828)(GLclampx depth);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_829)(GLenum plane, const GLfixed *equation);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_830)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_831)(GLclampx zNear, GLclampx zFar);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_832)(GLenum pname, GLfixed param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_833)(GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_834)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_835)(GLenum plane, GLfixed *equation);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_836)(GLenum pname, GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_837)(GLenum light, GLenum pname, GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_838)(GLenum face, GLenum pname, GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_839)(GLenum target, GLenum pname, GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_840)(GLenum coord, GLenum pname, GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_841)(GLenum target, GLenum pname, GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_842)(GLenum pname, GLfixed param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_843)(GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_844)(GLenum light, GLenum pname, GLfixed param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_845)(GLenum light, GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_846)(GLfixed width);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_847)(const GLfixed *m);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_848)(GLenum face, GLenum pname, GLfixed param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_849)(GLenum face, GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_850)(const GLfixed *m);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_851)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_852)(GLfixed nx, GLfixed ny, GLfixed nz);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_853)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_854)(GLenum pname, GLfixed param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_855)(GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_856)(GLfixed size);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_857)(GLfixed factor, GLfixed units);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_858)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_859)(GLclampx value, GLboolean invert);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_860)(GLfixed x, GLfixed y, GLfixed z);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_861)(GLenum target, GLenum pname, GLfixed param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_862)(GLenum target, GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_863)(GLenum coord, GLenum pname, GLint param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_864)(GLenum coord, GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_865)(GLenum target, GLenum pname, GLfixed param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_866)(GLenum target, GLenum pname, const GLfixed *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_867)(GLfixed x, GLfixed y, GLfixed z);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_868)(GLenum plane, const GLfloat *equation);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_869)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_870)(GLenum plane, GLfloat *equation);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_871)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_872)(GLclampd zmin, GLclampd zmax);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_873)(GLenum modeRGB, GLenum modeA);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_846)(GLenum func, GLclampx ref);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_847)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_848)(GLclampx depth);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_849)(GLenum plane, const GLfixed *equation);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_850)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_851)(GLclampx zNear, GLclampx zFar);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_852)(GLenum pname, GLfixed param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_853)(GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_854)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_855)(GLenum plane, GLfixed *equation);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_856)(GLenum pname, GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_857)(GLenum light, GLenum pname, GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_858)(GLenum face, GLenum pname, GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_859)(GLenum target, GLenum pname, GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_860)(GLenum coord, GLenum pname, GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_861)(GLenum target, GLenum pname, GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_862)(GLenum pname, GLfixed param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_863)(GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_864)(GLenum light, GLenum pname, GLfixed param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_865)(GLenum light, GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_866)(GLfixed width);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_867)(const GLfixed *m);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_868)(GLenum face, GLenum pname, GLfixed param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_869)(GLenum face, GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_870)(const GLfixed *m);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_871)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_872)(GLfixed nx, GLfixed ny, GLfixed nz);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_873)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_874)(GLenum pname, GLfixed param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_875)(GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_876)(GLfixed size);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_877)(GLfixed factor, GLfixed units);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_878)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_879)(GLclampx value, GLboolean invert);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_880)(GLfixed x, GLfixed y, GLfixed z);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_881)(GLenum target, GLenum pname, GLfixed param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_882)(GLenum target, GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_883)(GLenum coord, GLenum pname, GLint param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_884)(GLenum coord, GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_885)(GLenum target, GLenum pname, GLfixed param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_886)(GLenum target, GLenum pname, const GLfixed *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_887)(GLfixed x, GLfixed y, GLfixed z);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_888)(GLenum plane, const GLfloat *equation);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_889)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_890)(GLenum plane, GLfloat *equation);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_891)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_892)(GLclampd zmin, GLclampd zmax);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_893)(GLenum modeRGB, GLenum modeA);
 GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA);
 GLAPI void APIENTRY GLAPI_PREFIX(BindFramebufferEXT)(GLenum target, GLuint framebuffer);
 GLAPI void APIENTRY GLAPI_PREFIX(BindFramebuffer)(GLenum target, GLuint framebuffer);
@@ -1188,10 +1208,10 @@ GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbufferEXT)(GLuint renderbuffer);
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbuffer)(GLuint renderbuffer);
 GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
 GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_891)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_911)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
 GLAPI void APIENTRY GLAPI_PREFIX(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_892)(GLenum target, GLenum pname, GLint param);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_893)(GLenum target, GLintptr offset, GLsizeiptr size);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_912)(GLenum target, GLenum pname, GLint param);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_913)(GLenum target, GLintptr offset, GLsizeiptr size);
 GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar *name);
 GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocation)(GLuint program, GLuint colorNumber, const GLchar *name);
 GLAPI GLint APIENTRY GLAPI_PREFIX(GetFragDataLocationEXT)(GLuint program, const GLchar *name);
@@ -1303,8 +1323,8 @@ GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryingsEXT)(GLuint program, G
 GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryings)(GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
 GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertexEXT)(GLenum mode);
 GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertex)(GLenum mode);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_951)(GLenum target, GLenum pname, GLvoid **params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_952)(GLenum target, GLsizei length, GLvoid *pointer);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_971)(GLenum target, GLenum pname, GLvoid **params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_972)(GLenum target, GLsizei length, GLvoid *pointer);
 GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint *value);
 GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option);
 GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option);
@@ -1312,11 +1332,11 @@ GLAPI void APIENTRY GLAPI_PREFIX(ActiveProgramEXT)(GLuint program);
 GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateShaderProgramEXT)(GLenum type, const GLchar *string);
 GLAPI void APIENTRY GLAPI_PREFIX(UseShaderProgramEXT)(GLenum type, GLuint program);
 GLAPI void APIENTRY GLAPI_PREFIX(TextureBarrierNV)(void);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_960)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_961)(GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_962)(GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_963)(GLuint id, GLenum pname, GLint64EXT *params);
-void APIENTRY GLAPI_PREFIX(_dispatch_stub_964)(GLuint id, GLenum pname, GLuint64EXT *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_980)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_981)(GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_982)(GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_983)(GLuint id, GLenum pname, GLint64EXT *params);
+void APIENTRY GLAPI_PREFIX(_dispatch_stub_984)(GLuint id, GLenum pname, GLuint64EXT *params);
 GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid *writeOffset);
 GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetTexture2DOES)(GLenum target, GLvoid *writeOffset);
 #undef MAPI_TMP_DEFINES
@@ -6944,2747 +6964,2887 @@ GLAPI void APIENTRY GLAPI_PREFIX(ShaderBinary)(GLsizei n, const GLuint *shaders,
    ((void (APIENTRY *)(GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)) _func)(n, shaders, binaryformat, binary, length);
 }
 
-GLAPI void APIENTRY GLAPI_PREFIX(PolygonOffsetEXT)(GLfloat factor, GLfloat bias)
+GLAPI GLenum APIENTRY GLAPI_PREFIX(GetGraphicsResetStatusARB)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
    mapi_func _func = ((const mapi_func *) _tbl)[629];
+   return ((GLenum (APIENTRY *)(void)) _func)();
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnColorTableARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[630];
+   ((void (APIENTRY *)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table)) _func)(target, format, type, bufSize, table);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnCompressedTexImageARB)(GLenum target, GLint lod, GLsizei bufSize, GLvoid *img)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[631];
+   ((void (APIENTRY *)(GLenum target, GLint lod, GLsizei bufSize, GLvoid *img)) _func)(target, lod, bufSize, img);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnConvolutionFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[632];
+   ((void (APIENTRY *)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image)) _func)(target, format, type, bufSize, image);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnHistogramARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[633];
+   ((void (APIENTRY *)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values)) _func)(target, reset, format, type, bufSize, values);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMapdvARB)(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[634];
+   ((void (APIENTRY *)(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)) _func)(target, query, bufSize, v);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMapfvARB)(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[635];
+   ((void (APIENTRY *)(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)) _func)(target, query, bufSize, v);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMapivARB)(GLenum target, GLenum query, GLsizei bufSize, GLint *v)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[636];
+   ((void (APIENTRY *)(GLenum target, GLenum query, GLsizei bufSize, GLint *v)) _func)(target, query, bufSize, v);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnMinmaxARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[637];
+   ((void (APIENTRY *)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values)) _func)(target, reset, format, type, bufSize, values);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPixelMapfvARB)(GLenum map, GLsizei bufSize, GLfloat *values)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[638];
+   ((void (APIENTRY *)(GLenum map, GLsizei bufSize, GLfloat *values)) _func)(map, bufSize, values);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPixelMapuivARB)(GLenum map, GLsizei bufSize, GLuint *values)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[639];
+   ((void (APIENTRY *)(GLenum map, GLsizei bufSize, GLuint *values)) _func)(map, bufSize, values);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPixelMapusvARB)(GLenum map, GLsizei bufSize, GLushort *values)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[640];
+   ((void (APIENTRY *)(GLenum map, GLsizei bufSize, GLushort *values)) _func)(map, bufSize, values);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnPolygonStippleARB)(GLsizei bufSize, GLubyte *pattern)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[641];
+   ((void (APIENTRY *)(GLsizei bufSize, GLubyte *pattern)) _func)(bufSize, pattern);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnSeparableFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[642];
+   ((void (APIENTRY *)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span)) _func)(target, format, type, rowBufSize, row, columnBufSize, column, span);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnTexImageARB)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[643];
+   ((void (APIENTRY *)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img)) _func)(target, level, format, type, bufSize, img);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformdvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLdouble *params)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[644];
+   ((void (APIENTRY *)(GLhandleARB program, GLint location, GLsizei bufSize, GLdouble *params)) _func)(program, location, bufSize, params);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformfvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLfloat *params)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[645];
+   ((void (APIENTRY *)(GLhandleARB program, GLint location, GLsizei bufSize, GLfloat *params)) _func)(program, location, bufSize, params);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLint *params)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[646];
+   ((void (APIENTRY *)(GLhandleARB program, GLint location, GLsizei bufSize, GLint *params)) _func)(program, location, bufSize, params);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(GetnUniformuivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLuint *params)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[647];
+   ((void (APIENTRY *)(GLhandleARB program, GLint location, GLsizei bufSize, GLuint *params)) _func)(program, location, bufSize, params);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(ReadnPixelsARB)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[648];
+   ((void (APIENTRY *)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data)) _func)(x, y, width, height, format, type, bufSize, data);
+}
+
+GLAPI void APIENTRY GLAPI_PREFIX(PolygonOffsetEXT)(GLfloat factor, GLfloat bias)
+{
+   const struct mapi_table *_tbl = entry_current_get();
+   mapi_func _func = ((const mapi_func *) _tbl)[649];
    ((void (APIENTRY *)(GLfloat factor, GLfloat bias)) _func)(factor, bias);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[648];
+   mapi_func _func = ((const mapi_func *) _tbl)[668];
    ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(size, type, stride, count, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[649];
+   mapi_func _func = ((const mapi_func *) _tbl)[669];
    ((void (APIENTRY *)(GLsizei stride, GLsizei count, const GLboolean *pointer)) _func)(stride, count, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[650];
+   mapi_func _func = ((const mapi_func *) _tbl)[670];
    ((void (APIENTRY *)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(type, stride, count, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[651];
+   mapi_func _func = ((const mapi_func *) _tbl)[671];
    ((void (APIENTRY *)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(type, stride, count, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[652];
+   mapi_func _func = ((const mapi_func *) _tbl)[672];
    ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(size, type, stride, count, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[653];
+   mapi_func _func = ((const mapi_func *) _tbl)[673];
    ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(size, type, stride, count, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfEXT)(GLenum pname, GLfloat param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[654];
+   mapi_func _func = ((const mapi_func *) _tbl)[674];
    ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterf)(GLenum pname, GLfloat param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[654];
+   mapi_func _func = ((const mapi_func *) _tbl)[674];
    ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfARB)(GLenum pname, GLfloat param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[654];
+   mapi_func _func = ((const mapi_func *) _tbl)[674];
    ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfvEXT)(GLenum pname, const GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[655];
+   mapi_func _func = ((const mapi_func *) _tbl)[675];
    ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfv)(GLenum pname, const GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[655];
+   mapi_func _func = ((const mapi_func *) _tbl)[675];
    ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfvARB)(GLenum pname, const GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[655];
+   mapi_func _func = ((const mapi_func *) _tbl)[675];
    ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(LockArraysEXT)(GLint first, GLsizei count)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[656];
+   mapi_func _func = ((const mapi_func *) _tbl)[676];
    ((void (APIENTRY *)(GLint first, GLsizei count)) _func)(first, count);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(UnlockArraysEXT)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[657];
+   mapi_func _func = ((const mapi_func *) _tbl)[677];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[658];
+   mapi_func _func = ((const mapi_func *) _tbl)[678];
    ((void (APIENTRY *)(GLbyte red, GLbyte green, GLbyte blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[658];
+   mapi_func _func = ((const mapi_func *) _tbl)[678];
    ((void (APIENTRY *)(GLbyte red, GLbyte green, GLbyte blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bvEXT)(const GLbyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[659];
+   mapi_func _func = ((const mapi_func *) _tbl)[679];
    ((void (APIENTRY *)(const GLbyte *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bv)(const GLbyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[659];
+   mapi_func _func = ((const mapi_func *) _tbl)[679];
    ((void (APIENTRY *)(const GLbyte *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[660];
+   mapi_func _func = ((const mapi_func *) _tbl)[680];
    ((void (APIENTRY *)(GLdouble red, GLdouble green, GLdouble blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[660];
+   mapi_func _func = ((const mapi_func *) _tbl)[680];
    ((void (APIENTRY *)(GLdouble red, GLdouble green, GLdouble blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dvEXT)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[661];
+   mapi_func _func = ((const mapi_func *) _tbl)[681];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dv)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[661];
+   mapi_func _func = ((const mapi_func *) _tbl)[681];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[662];
+   mapi_func _func = ((const mapi_func *) _tbl)[682];
    ((void (APIENTRY *)(GLfloat red, GLfloat green, GLfloat blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[662];
+   mapi_func _func = ((const mapi_func *) _tbl)[682];
    ((void (APIENTRY *)(GLfloat red, GLfloat green, GLfloat blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fvEXT)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[663];
+   mapi_func _func = ((const mapi_func *) _tbl)[683];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fv)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[663];
+   mapi_func _func = ((const mapi_func *) _tbl)[683];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[664];
+   mapi_func _func = ((const mapi_func *) _tbl)[684];
    ((void (APIENTRY *)(GLint red, GLint green, GLint blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3i)(GLint red, GLint green, GLint blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[664];
+   mapi_func _func = ((const mapi_func *) _tbl)[684];
    ((void (APIENTRY *)(GLint red, GLint green, GLint blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ivEXT)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[665];
+   mapi_func _func = ((const mapi_func *) _tbl)[685];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3iv)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[665];
+   mapi_func _func = ((const mapi_func *) _tbl)[685];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[666];
+   mapi_func _func = ((const mapi_func *) _tbl)[686];
    ((void (APIENTRY *)(GLshort red, GLshort green, GLshort blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[666];
+   mapi_func _func = ((const mapi_func *) _tbl)[686];
    ((void (APIENTRY *)(GLshort red, GLshort green, GLshort blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3svEXT)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[667];
+   mapi_func _func = ((const mapi_func *) _tbl)[687];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3sv)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[667];
+   mapi_func _func = ((const mapi_func *) _tbl)[687];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[668];
+   mapi_func _func = ((const mapi_func *) _tbl)[688];
    ((void (APIENTRY *)(GLubyte red, GLubyte green, GLubyte blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[668];
+   mapi_func _func = ((const mapi_func *) _tbl)[688];
    ((void (APIENTRY *)(GLubyte red, GLubyte green, GLubyte blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubvEXT)(const GLubyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[669];
+   mapi_func _func = ((const mapi_func *) _tbl)[689];
    ((void (APIENTRY *)(const GLubyte *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubv)(const GLubyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[669];
+   mapi_func _func = ((const mapi_func *) _tbl)[689];
    ((void (APIENTRY *)(const GLubyte *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[670];
+   mapi_func _func = ((const mapi_func *) _tbl)[690];
    ((void (APIENTRY *)(GLuint red, GLuint green, GLuint blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[670];
+   mapi_func _func = ((const mapi_func *) _tbl)[690];
    ((void (APIENTRY *)(GLuint red, GLuint green, GLuint blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uivEXT)(const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[671];
+   mapi_func _func = ((const mapi_func *) _tbl)[691];
    ((void (APIENTRY *)(const GLuint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uiv)(const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[671];
+   mapi_func _func = ((const mapi_func *) _tbl)[691];
    ((void (APIENTRY *)(const GLuint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[672];
+   mapi_func _func = ((const mapi_func *) _tbl)[692];
    ((void (APIENTRY *)(GLushort red, GLushort green, GLushort blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[672];
+   mapi_func _func = ((const mapi_func *) _tbl)[692];
    ((void (APIENTRY *)(GLushort red, GLushort green, GLushort blue)) _func)(red, green, blue);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usvEXT)(const GLushort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[673];
+   mapi_func _func = ((const mapi_func *) _tbl)[693];
    ((void (APIENTRY *)(const GLushort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usv)(const GLushort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[673];
+   mapi_func _func = ((const mapi_func *) _tbl)[693];
    ((void (APIENTRY *)(const GLushort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[674];
+   mapi_func _func = ((const mapi_func *) _tbl)[694];
    ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(size, type, stride, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[674];
+   mapi_func _func = ((const mapi_func *) _tbl)[694];
    ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(size, type, stride, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawArraysEXT)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[675];
+   mapi_func _func = ((const mapi_func *) _tbl)[695];
    ((void (APIENTRY *)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)) _func)(mode, first, count, primcount);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawArrays)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[675];
+   mapi_func _func = ((const mapi_func *) _tbl)[695];
    ((void (APIENTRY *)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)) _func)(mode, first, count, primcount);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[676];
+   mapi_func _func = ((const mapi_func *) _tbl)[696];
    ((void (APIENTRY *)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)) _func)(mode, count, type, indices, primcount);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElements)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[676];
+   mapi_func _func = ((const mapi_func *) _tbl)[696];
    ((void (APIENTRY *)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)) _func)(mode, count, type, indices, primcount);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[677];
+   mapi_func _func = ((const mapi_func *) _tbl)[697];
    ((void (APIENTRY *)(GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(type, stride, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[677];
+   mapi_func _func = ((const mapi_func *) _tbl)[697];
    ((void (APIENTRY *)(GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(type, stride, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddEXT)(GLdouble coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[678];
+   mapi_func _func = ((const mapi_func *) _tbl)[698];
    ((void (APIENTRY *)(GLdouble coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordd)(GLdouble coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[678];
+   mapi_func _func = ((const mapi_func *) _tbl)[698];
    ((void (APIENTRY *)(GLdouble coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddvEXT)(const GLdouble *coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[679];
+   mapi_func _func = ((const mapi_func *) _tbl)[699];
    ((void (APIENTRY *)(const GLdouble *coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddv)(const GLdouble *coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[679];
+   mapi_func _func = ((const mapi_func *) _tbl)[699];
    ((void (APIENTRY *)(const GLdouble *coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfEXT)(GLfloat coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[680];
+   mapi_func _func = ((const mapi_func *) _tbl)[700];
    ((void (APIENTRY *)(GLfloat coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordf)(GLfloat coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[680];
+   mapi_func _func = ((const mapi_func *) _tbl)[700];
    ((void (APIENTRY *)(GLfloat coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfvEXT)(const GLfloat *coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[681];
+   mapi_func _func = ((const mapi_func *) _tbl)[701];
    ((void (APIENTRY *)(const GLfloat *coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfv)(const GLfloat *coord)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[681];
+   mapi_func _func = ((const mapi_func *) _tbl)[701];
    ((void (APIENTRY *)(const GLfloat *coord)) _func)(coord);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[683];
+   mapi_func _func = ((const mapi_func *) _tbl)[703];
    ((void (APIENTRY *)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)) _func)(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[683];
+   mapi_func _func = ((const mapi_func *) _tbl)[703];
    ((void (APIENTRY *)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)) _func)(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FlushVertexArrayRangeNV)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[684];
+   mapi_func _func = ((const mapi_func *) _tbl)[704];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexArrayRangeNV)(GLsizei length, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[685];
+   mapi_func _func = ((const mapi_func *) _tbl)[705];
    ((void (APIENTRY *)(GLsizei length, const GLvoid *pointer)) _func)(length, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[686];
+   mapi_func _func = ((const mapi_func *) _tbl)[706];
    ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)) _func)(stage, portion, variable, input, mapping, componentUsage);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[687];
+   mapi_func _func = ((const mapi_func *) _tbl)[707];
    ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum)) _func)(stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterfNV)(GLenum pname, GLfloat param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[688];
+   mapi_func _func = ((const mapi_func *) _tbl)[708];
    ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterfvNV)(GLenum pname, const GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[689];
+   mapi_func _func = ((const mapi_func *) _tbl)[709];
    ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameteriNV)(GLenum pname, GLint param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[690];
+   mapi_func _func = ((const mapi_func *) _tbl)[710];
    ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterivNV)(GLenum pname, const GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[691];
+   mapi_func _func = ((const mapi_func *) _tbl)[711];
    ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[692];
+   mapi_func _func = ((const mapi_func *) _tbl)[712];
    ((void (APIENTRY *)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)) _func)(variable, input, mapping, componentUsage);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[693];
+   mapi_func _func = ((const mapi_func *) _tbl)[713];
    ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params)) _func)(stage, portion, variable, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[694];
+   mapi_func _func = ((const mapi_func *) _tbl)[714];
    ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params)) _func)(stage, portion, variable, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[695];
+   mapi_func _func = ((const mapi_func *) _tbl)[715];
    ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum pname, GLfloat *params)) _func)(stage, portion, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[696];
+   mapi_func _func = ((const mapi_func *) _tbl)[716];
    ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum pname, GLint *params)) _func)(stage, portion, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[697];
+   mapi_func _func = ((const mapi_func *) _tbl)[717];
    ((void (APIENTRY *)(GLenum variable, GLenum pname, GLfloat *params)) _func)(variable, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[698];
+   mapi_func _func = ((const mapi_func *) _tbl)[718];
    ((void (APIENTRY *)(GLenum variable, GLenum pname, GLint *params)) _func)(variable, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ResizeBuffersMESA)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[699];
+   mapi_func _func = ((const mapi_func *) _tbl)[719];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dMESA)(GLdouble x, GLdouble y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[700];
+   mapi_func _func = ((const mapi_func *) _tbl)[720];
    ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2d)(GLdouble x, GLdouble y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[700];
+   mapi_func _func = ((const mapi_func *) _tbl)[720];
    ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dARB)(GLdouble x, GLdouble y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[700];
+   mapi_func _func = ((const mapi_func *) _tbl)[720];
    ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dvMESA)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[701];
+   mapi_func _func = ((const mapi_func *) _tbl)[721];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dv)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[701];
+   mapi_func _func = ((const mapi_func *) _tbl)[721];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dvARB)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[701];
+   mapi_func _func = ((const mapi_func *) _tbl)[721];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fMESA)(GLfloat x, GLfloat y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[702];
+   mapi_func _func = ((const mapi_func *) _tbl)[722];
    ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2f)(GLfloat x, GLfloat y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[702];
+   mapi_func _func = ((const mapi_func *) _tbl)[722];
    ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fARB)(GLfloat x, GLfloat y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[702];
+   mapi_func _func = ((const mapi_func *) _tbl)[722];
    ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fvMESA)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[703];
+   mapi_func _func = ((const mapi_func *) _tbl)[723];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fv)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[703];
+   mapi_func _func = ((const mapi_func *) _tbl)[723];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fvARB)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[703];
+   mapi_func _func = ((const mapi_func *) _tbl)[723];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iMESA)(GLint x, GLint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[704];
+   mapi_func _func = ((const mapi_func *) _tbl)[724];
    ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2i)(GLint x, GLint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[704];
+   mapi_func _func = ((const mapi_func *) _tbl)[724];
    ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iARB)(GLint x, GLint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[704];
+   mapi_func _func = ((const mapi_func *) _tbl)[724];
    ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2ivMESA)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[705];
+   mapi_func _func = ((const mapi_func *) _tbl)[725];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iv)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[705];
+   mapi_func _func = ((const mapi_func *) _tbl)[725];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2ivARB)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[705];
+   mapi_func _func = ((const mapi_func *) _tbl)[725];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sMESA)(GLshort x, GLshort y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[706];
+   mapi_func _func = ((const mapi_func *) _tbl)[726];
    ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2s)(GLshort x, GLshort y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[706];
+   mapi_func _func = ((const mapi_func *) _tbl)[726];
    ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sARB)(GLshort x, GLshort y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[706];
+   mapi_func _func = ((const mapi_func *) _tbl)[726];
    ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2svMESA)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[707];
+   mapi_func _func = ((const mapi_func *) _tbl)[727];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sv)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[707];
+   mapi_func _func = ((const mapi_func *) _tbl)[727];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2svARB)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[707];
+   mapi_func _func = ((const mapi_func *) _tbl)[727];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[708];
+   mapi_func _func = ((const mapi_func *) _tbl)[728];
    ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[708];
+   mapi_func _func = ((const mapi_func *) _tbl)[728];
    ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[708];
+   mapi_func _func = ((const mapi_func *) _tbl)[728];
    ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dvMESA)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[709];
+   mapi_func _func = ((const mapi_func *) _tbl)[729];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dv)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[709];
+   mapi_func _func = ((const mapi_func *) _tbl)[729];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dvARB)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[709];
+   mapi_func _func = ((const mapi_func *) _tbl)[729];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[710];
+   mapi_func _func = ((const mapi_func *) _tbl)[730];
    ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[710];
+   mapi_func _func = ((const mapi_func *) _tbl)[730];
    ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[710];
+   mapi_func _func = ((const mapi_func *) _tbl)[730];
    ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fvMESA)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[711];
+   mapi_func _func = ((const mapi_func *) _tbl)[731];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fv)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[711];
+   mapi_func _func = ((const mapi_func *) _tbl)[731];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fvARB)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[711];
+   mapi_func _func = ((const mapi_func *) _tbl)[731];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iMESA)(GLint x, GLint y, GLint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[712];
+   mapi_func _func = ((const mapi_func *) _tbl)[732];
    ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3i)(GLint x, GLint y, GLint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[712];
+   mapi_func _func = ((const mapi_func *) _tbl)[732];
    ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iARB)(GLint x, GLint y, GLint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[712];
+   mapi_func _func = ((const mapi_func *) _tbl)[732];
    ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3ivMESA)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[713];
+   mapi_func _func = ((const mapi_func *) _tbl)[733];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iv)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[713];
+   mapi_func _func = ((const mapi_func *) _tbl)[733];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3ivARB)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[713];
+   mapi_func _func = ((const mapi_func *) _tbl)[733];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[714];
+   mapi_func _func = ((const mapi_func *) _tbl)[734];
    ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3s)(GLshort x, GLshort y, GLshort z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[714];
+   mapi_func _func = ((const mapi_func *) _tbl)[734];
    ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sARB)(GLshort x, GLshort y, GLshort z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[714];
+   mapi_func _func = ((const mapi_func *) _tbl)[734];
    ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3svMESA)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[715];
+   mapi_func _func = ((const mapi_func *) _tbl)[735];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sv)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[715];
+   mapi_func _func = ((const mapi_func *) _tbl)[735];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3svARB)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[715];
+   mapi_func _func = ((const mapi_func *) _tbl)[735];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[716];
+   mapi_func _func = ((const mapi_func *) _tbl)[736];
    ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4dvMESA)(const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[717];
+   mapi_func _func = ((const mapi_func *) _tbl)[737];
    ((void (APIENTRY *)(const GLdouble *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[718];
+   mapi_func _func = ((const mapi_func *) _tbl)[738];
    ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4fvMESA)(const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[719];
+   mapi_func _func = ((const mapi_func *) _tbl)[739];
    ((void (APIENTRY *)(const GLfloat *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[720];
+   mapi_func _func = ((const mapi_func *) _tbl)[740];
    ((void (APIENTRY *)(GLint x, GLint y, GLint z, GLint w)) _func)(x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4ivMESA)(const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[721];
+   mapi_func _func = ((const mapi_func *) _tbl)[741];
    ((void (APIENTRY *)(const GLint *v)) _func)(v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[722];
+   mapi_func _func = ((const mapi_func *) _tbl)[742];
    ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z, GLshort w)) _func)(x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4svMESA)(const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[723];
+   mapi_func _func = ((const mapi_func *) _tbl)[743];
    ((void (APIENTRY *)(const GLshort *v)) _func)(v);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreProgramsResidentNV)(GLsizei n, const GLuint *ids, GLboolean *residences)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[733];
+   mapi_func _func = ((const mapi_func *) _tbl)[753];
    return ((GLboolean (APIENTRY *)(GLsizei n, const GLuint *ids, GLboolean *residences)) _func)(n, ids, residences);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindProgramNV)(GLenum target, GLuint program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[734];
+   mapi_func _func = ((const mapi_func *) _tbl)[754];
    ((void (APIENTRY *)(GLenum target, GLuint program)) _func)(target, program);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindProgramARB)(GLenum target, GLuint program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[734];
+   mapi_func _func = ((const mapi_func *) _tbl)[754];
    ((void (APIENTRY *)(GLenum target, GLuint program)) _func)(target, program);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgramsNV)(GLsizei n, const GLuint *programs)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[735];
+   mapi_func _func = ((const mapi_func *) _tbl)[755];
    ((void (APIENTRY *)(GLsizei n, const GLuint *programs)) _func)(n, programs);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgramsARB)(GLsizei n, const GLuint *programs)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[735];
+   mapi_func _func = ((const mapi_func *) _tbl)[755];
    ((void (APIENTRY *)(GLsizei n, const GLuint *programs)) _func)(n, programs);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[736];
+   mapi_func _func = ((const mapi_func *) _tbl)[756];
    ((void (APIENTRY *)(GLenum target, GLuint id, const GLfloat *params)) _func)(target, id, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenProgramsNV)(GLsizei n, GLuint *programs)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[737];
+   mapi_func _func = ((const mapi_func *) _tbl)[757];
    ((void (APIENTRY *)(GLsizei n, GLuint *programs)) _func)(n, programs);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenProgramsARB)(GLsizei n, GLuint *programs)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[737];
+   mapi_func _func = ((const mapi_func *) _tbl)[757];
    ((void (APIENTRY *)(GLsizei n, GLuint *programs)) _func)(n, programs);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[738];
+   mapi_func _func = ((const mapi_func *) _tbl)[758];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLenum pname, GLdouble *params)) _func)(target, index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[739];
+   mapi_func _func = ((const mapi_func *) _tbl)[759];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLenum pname, GLfloat *params)) _func)(target, index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte *program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[740];
+   mapi_func _func = ((const mapi_func *) _tbl)[760];
    ((void (APIENTRY *)(GLuint id, GLenum pname, GLubyte *program)) _func)(id, pname, program);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramivNV)(GLuint id, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[741];
+   mapi_func _func = ((const mapi_func *) _tbl)[761];
    ((void (APIENTRY *)(GLuint id, GLenum pname, GLint *params)) _func)(id, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[742];
+   mapi_func _func = ((const mapi_func *) _tbl)[762];
    ((void (APIENTRY *)(GLenum target, GLuint address, GLenum pname, GLint *params)) _func)(target, address, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid **pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[743];
+   mapi_func _func = ((const mapi_func *) _tbl)[763];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLvoid **pointer)) _func)(index, pname, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid **pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[743];
+   mapi_func _func = ((const mapi_func *) _tbl)[763];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLvoid **pointer)) _func)(index, pname, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid **pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[743];
+   mapi_func _func = ((const mapi_func *) _tbl)[763];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLvoid **pointer)) _func)(index, pname, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[744];
+   mapi_func _func = ((const mapi_func *) _tbl)[764];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLdouble *params)) _func)(index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[745];
+   mapi_func _func = ((const mapi_func *) _tbl)[765];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLfloat *params)) _func)(index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[746];
+   mapi_func _func = ((const mapi_func *) _tbl)[766];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgramNV)(GLuint program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[747];
+   mapi_func _func = ((const mapi_func *) _tbl)[767];
    return ((GLboolean (APIENTRY *)(GLuint program)) _func)(program);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgramARB)(GLuint program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[747];
+   mapi_func _func = ((const mapi_func *) _tbl)[767];
    return ((GLboolean (APIENTRY *)(GLuint program)) _func)(program);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte *program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[748];
+   mapi_func _func = ((const mapi_func *) _tbl)[768];
    ((void (APIENTRY *)(GLenum target, GLuint id, GLsizei len, const GLubyte *program)) _func)(target, id, len, program);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[749];
+   mapi_func _func = ((const mapi_func *) _tbl)[769];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLsizei num, const GLdouble *params)) _func)(target, index, num, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[750];
+   mapi_func _func = ((const mapi_func *) _tbl)[770];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLsizei num, const GLfloat *params)) _func)(target, index, num, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(RequestResidentProgramsNV)(GLsizei n, const GLuint *ids)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[751];
+   mapi_func _func = ((const mapi_func *) _tbl)[771];
    ((void (APIENTRY *)(GLsizei n, const GLuint *ids)) _func)(n, ids);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[752];
+   mapi_func _func = ((const mapi_func *) _tbl)[772];
    ((void (APIENTRY *)(GLenum target, GLuint address, GLenum matrix, GLenum transform)) _func)(target, address, matrix, transform);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dNV)(GLuint index, GLdouble x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[753];
+   mapi_func _func = ((const mapi_func *) _tbl)[773];
    ((void (APIENTRY *)(GLuint index, GLdouble x)) _func)(index, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dvNV)(GLuint index, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[754];
+   mapi_func _func = ((const mapi_func *) _tbl)[774];
    ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fNV)(GLuint index, GLfloat x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[755];
+   mapi_func _func = ((const mapi_func *) _tbl)[775];
    ((void (APIENTRY *)(GLuint index, GLfloat x)) _func)(index, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fvNV)(GLuint index, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[756];
+   mapi_func _func = ((const mapi_func *) _tbl)[776];
    ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1sNV)(GLuint index, GLshort x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[757];
+   mapi_func _func = ((const mapi_func *) _tbl)[777];
    ((void (APIENTRY *)(GLuint index, GLshort x)) _func)(index, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1svNV)(GLuint index, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[758];
+   mapi_func _func = ((const mapi_func *) _tbl)[778];
    ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[759];
+   mapi_func _func = ((const mapi_func *) _tbl)[779];
    ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y)) _func)(index, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dvNV)(GLuint index, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[760];
+   mapi_func _func = ((const mapi_func *) _tbl)[780];
    ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[761];
+   mapi_func _func = ((const mapi_func *) _tbl)[781];
    ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y)) _func)(index, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fvNV)(GLuint index, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[762];
+   mapi_func _func = ((const mapi_func *) _tbl)[782];
    ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[763];
+   mapi_func _func = ((const mapi_func *) _tbl)[783];
    ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y)) _func)(index, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2svNV)(GLuint index, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[764];
+   mapi_func _func = ((const mapi_func *) _tbl)[784];
    ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[765];
+   mapi_func _func = ((const mapi_func *) _tbl)[785];
    ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z)) _func)(index, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dvNV)(GLuint index, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[766];
+   mapi_func _func = ((const mapi_func *) _tbl)[786];
    ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[767];
+   mapi_func _func = ((const mapi_func *) _tbl)[787];
    ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z)) _func)(index, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fvNV)(GLuint index, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[768];
+   mapi_func _func = ((const mapi_func *) _tbl)[788];
    ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[769];
+   mapi_func _func = ((const mapi_func *) _tbl)[789];
    ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z)) _func)(index, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3svNV)(GLuint index, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[770];
+   mapi_func _func = ((const mapi_func *) _tbl)[790];
    ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[771];
+   mapi_func _func = ((const mapi_func *) _tbl)[791];
    ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dvNV)(GLuint index, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[772];
+   mapi_func _func = ((const mapi_func *) _tbl)[792];
    ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[773];
+   mapi_func _func = ((const mapi_func *) _tbl)[793];
    ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fvNV)(GLuint index, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[774];
+   mapi_func _func = ((const mapi_func *) _tbl)[794];
    ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[775];
+   mapi_func _func = ((const mapi_func *) _tbl)[795];
    ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4svNV)(GLuint index, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[776];
+   mapi_func _func = ((const mapi_func *) _tbl)[796];
    ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[777];
+   mapi_func _func = ((const mapi_func *) _tbl)[797];
    ((void (APIENTRY *)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubvNV)(GLuint index, const GLubyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[778];
+   mapi_func _func = ((const mapi_func *) _tbl)[798];
    ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[779];
+   mapi_func _func = ((const mapi_func *) _tbl)[799];
    ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, stride, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[780];
+   mapi_func _func = ((const mapi_func *) _tbl)[800];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[781];
+   mapi_func _func = ((const mapi_func *) _tbl)[801];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[782];
+   mapi_func _func = ((const mapi_func *) _tbl)[802];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[783];
+   mapi_func _func = ((const mapi_func *) _tbl)[803];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[784];
+   mapi_func _func = ((const mapi_func *) _tbl)[804];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[785];
+   mapi_func _func = ((const mapi_func *) _tbl)[805];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[786];
+   mapi_func _func = ((const mapi_func *) _tbl)[806];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[787];
+   mapi_func _func = ((const mapi_func *) _tbl)[807];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[788];
+   mapi_func _func = ((const mapi_func *) _tbl)[808];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[789];
+   mapi_func _func = ((const mapi_func *) _tbl)[809];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[790];
+   mapi_func _func = ((const mapi_func *) _tbl)[810];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[791];
+   mapi_func _func = ((const mapi_func *) _tbl)[811];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[792];
+   mapi_func _func = ((const mapi_func *) _tbl)[812];
    ((void (APIENTRY *)(GLuint index, GLsizei n, const GLubyte *v)) _func)(index, n, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTexBumpParameterfvATI)(GLenum pname, GLfloat *param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[793];
+   mapi_func _func = ((const mapi_func *) _tbl)[813];
    ((void (APIENTRY *)(GLenum pname, GLfloat *param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTexBumpParameterivATI)(GLenum pname, GLint *param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[794];
+   mapi_func _func = ((const mapi_func *) _tbl)[814];
    ((void (APIENTRY *)(GLenum pname, GLint *param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TexBumpParameterfvATI)(GLenum pname, const GLfloat *param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[795];
+   mapi_func _func = ((const mapi_func *) _tbl)[815];
    ((void (APIENTRY *)(GLenum pname, const GLfloat *param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TexBumpParameterivATI)(GLenum pname, const GLint *param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[796];
+   mapi_func _func = ((const mapi_func *) _tbl)[816];
    ((void (APIENTRY *)(GLenum pname, const GLint *param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[797];
+   mapi_func _func = ((const mapi_func *) _tbl)[817];
    ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)) _func)(op, dst, dstMod, arg1, arg1Rep, arg1Mod);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[798];
+   mapi_func _func = ((const mapi_func *) _tbl)[818];
    ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)) _func)(op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[799];
+   mapi_func _func = ((const mapi_func *) _tbl)[819];
    ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)) _func)(op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BeginFragmentShaderATI)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[800];
+   mapi_func _func = ((const mapi_func *) _tbl)[820];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindFragmentShaderATI)(GLuint id)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[801];
+   mapi_func _func = ((const mapi_func *) _tbl)[821];
    ((void (APIENTRY *)(GLuint id)) _func)(id);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[802];
+   mapi_func _func = ((const mapi_func *) _tbl)[822];
    ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)) _func)(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[803];
+   mapi_func _func = ((const mapi_func *) _tbl)[823];
    ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)) _func)(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[804];
+   mapi_func _func = ((const mapi_func *) _tbl)[824];
    ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)) _func)(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteFragmentShaderATI)(GLuint id)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[805];
+   mapi_func _func = ((const mapi_func *) _tbl)[825];
    ((void (APIENTRY *)(GLuint id)) _func)(id);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EndFragmentShaderATI)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[806];
+   mapi_func _func = ((const mapi_func *) _tbl)[826];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI GLuint APIENTRY GLAPI_PREFIX(GenFragmentShadersATI)(GLuint range)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[807];
+   mapi_func _func = ((const mapi_func *) _tbl)[827];
    return ((GLuint (APIENTRY *)(GLuint range)) _func)(range);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[808];
+   mapi_func _func = ((const mapi_func *) _tbl)[828];
    ((void (APIENTRY *)(GLuint dst, GLuint coord, GLenum swizzle)) _func)(dst, coord, swizzle);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[809];
+   mapi_func _func = ((const mapi_func *) _tbl)[829];
    ((void (APIENTRY *)(GLuint dst, GLuint interp, GLenum swizzle)) _func)(dst, interp, swizzle);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(SetFragmentShaderConstantATI)(GLuint dst, const GLfloat *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[810];
+   mapi_func _func = ((const mapi_func *) _tbl)[830];
    ((void (APIENTRY *)(GLuint dst, const GLfloat *value)) _func)(dst, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriNV)(GLenum pname, GLint param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[811];
+   mapi_func _func = ((const mapi_func *) _tbl)[831];
    ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameteri)(GLenum pname, GLint param)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[811];
+   mapi_func _func = ((const mapi_func *) _tbl)[831];
    ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameterivNV)(GLenum pname, const GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[812];
+   mapi_func _func = ((const mapi_func *) _tbl)[832];
    ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriv)(GLenum pname, const GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[812];
+   mapi_func _func = ((const mapi_func *) _tbl)[832];
    ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteVertexArrays)(GLsizei n, const GLuint *arrays)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[815];
+   mapi_func _func = ((const mapi_func *) _tbl)[835];
    ((void (APIENTRY *)(GLsizei n, const GLuint *arrays)) _func)(n, arrays);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsVertexArray)(GLuint array)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[817];
+   mapi_func _func = ((const mapi_func *) _tbl)[837];
    return ((GLboolean (APIENTRY *)(GLuint array)) _func)(array);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[818];
+   mapi_func _func = ((const mapi_func *) _tbl)[838];
    ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params)) _func)(id, len, name, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[819];
+   mapi_func _func = ((const mapi_func *) _tbl)[839];
    ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params)) _func)(id, len, name, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[820];
+   mapi_func _func = ((const mapi_func *) _tbl)[840];
    ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(id, len, name, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[821];
+   mapi_func _func = ((const mapi_func *) _tbl)[841];
    ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v)) _func)(id, len, name, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[822];
+   mapi_func _func = ((const mapi_func *) _tbl)[842];
    ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(id, len, name, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[823];
+   mapi_func _func = ((const mapi_func *) _tbl)[843];
    ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v)) _func)(id, len, name, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndexNV)(GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[824];
+   mapi_func _func = ((const mapi_func *) _tbl)[844];
    ((void (APIENTRY *)(GLuint index)) _func)(index);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndex)(GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[824];
+   mapi_func _func = ((const mapi_func *) _tbl)[844];
    ((void (APIENTRY *)(GLuint index)) _func)(index);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartNV)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[825];
+   mapi_func _func = ((const mapi_func *) _tbl)[845];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[873];
+   mapi_func _func = ((const mapi_func *) _tbl)[893];
    ((void (APIENTRY *)(GLenum modeRGB, GLenum modeA)) _func)(modeRGB, modeA);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindFramebufferEXT)(GLenum target, GLuint framebuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[874];
+   mapi_func _func = ((const mapi_func *) _tbl)[894];
    ((void (APIENTRY *)(GLenum target, GLuint framebuffer)) _func)(target, framebuffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindFramebuffer)(GLenum target, GLuint framebuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[874];
+   mapi_func _func = ((const mapi_func *) _tbl)[894];
    ((void (APIENTRY *)(GLenum target, GLuint framebuffer)) _func)(target, framebuffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindRenderbufferEXT)(GLenum target, GLuint renderbuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[875];
+   mapi_func _func = ((const mapi_func *) _tbl)[895];
    ((void (APIENTRY *)(GLenum target, GLuint renderbuffer)) _func)(target, renderbuffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindRenderbuffer)(GLenum target, GLuint renderbuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[875];
+   mapi_func _func = ((const mapi_func *) _tbl)[895];
    ((void (APIENTRY *)(GLenum target, GLuint renderbuffer)) _func)(target, renderbuffer);
 }
 
 GLAPI GLenum APIENTRY GLAPI_PREFIX(CheckFramebufferStatusEXT)(GLenum target)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[876];
+   mapi_func _func = ((const mapi_func *) _tbl)[896];
    return ((GLenum (APIENTRY *)(GLenum target)) _func)(target);
 }
 
 GLAPI GLenum APIENTRY GLAPI_PREFIX(CheckFramebufferStatus)(GLenum target)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[876];
+   mapi_func _func = ((const mapi_func *) _tbl)[896];
    return ((GLenum (APIENTRY *)(GLenum target)) _func)(target);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[877];
+   mapi_func _func = ((const mapi_func *) _tbl)[897];
    ((void (APIENTRY *)(GLsizei n, const GLuint *framebuffers)) _func)(n, framebuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteFramebuffers)(GLsizei n, const GLuint *framebuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[877];
+   mapi_func _func = ((const mapi_func *) _tbl)[897];
    ((void (APIENTRY *)(GLsizei n, const GLuint *framebuffers)) _func)(n, framebuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[878];
+   mapi_func _func = ((const mapi_func *) _tbl)[898];
    ((void (APIENTRY *)(GLsizei n, const GLuint *renderbuffers)) _func)(n, renderbuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DeleteRenderbuffers)(GLsizei n, const GLuint *renderbuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[878];
+   mapi_func _func = ((const mapi_func *) _tbl)[898];
    ((void (APIENTRY *)(GLsizei n, const GLuint *renderbuffers)) _func)(n, renderbuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[879];
+   mapi_func _func = ((const mapi_func *) _tbl)[899];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) _func)(target, attachment, renderbuffertarget, renderbuffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[879];
+   mapi_func _func = ((const mapi_func *) _tbl)[899];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) _func)(target, attachment, renderbuffertarget, renderbuffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[880];
+   mapi_func _func = ((const mapi_func *) _tbl)[900];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture1D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[880];
+   mapi_func _func = ((const mapi_func *) _tbl)[900];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[881];
+   mapi_func _func = ((const mapi_func *) _tbl)[901];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[881];
+   mapi_func _func = ((const mapi_func *) _tbl)[901];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[882];
+   mapi_func _func = ((const mapi_func *) _tbl)[902];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)) _func)(target, attachment, textarget, texture, level, zoffset);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture3D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[882];
+   mapi_func _func = ((const mapi_func *) _tbl)[902];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)) _func)(target, attachment, textarget, texture, level, zoffset);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenFramebuffersEXT)(GLsizei n, GLuint *framebuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[883];
+   mapi_func _func = ((const mapi_func *) _tbl)[903];
    ((void (APIENTRY *)(GLsizei n, GLuint *framebuffers)) _func)(n, framebuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenFramebuffers)(GLsizei n, GLuint *framebuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[883];
+   mapi_func _func = ((const mapi_func *) _tbl)[903];
    ((void (APIENTRY *)(GLsizei n, GLuint *framebuffers)) _func)(n, framebuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[884];
+   mapi_func _func = ((const mapi_func *) _tbl)[904];
    ((void (APIENTRY *)(GLsizei n, GLuint *renderbuffers)) _func)(n, renderbuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenRenderbuffers)(GLsizei n, GLuint *renderbuffers)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[884];
+   mapi_func _func = ((const mapi_func *) _tbl)[904];
    ((void (APIENTRY *)(GLsizei n, GLuint *renderbuffers)) _func)(n, renderbuffers);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenerateMipmapEXT)(GLenum target)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[885];
+   mapi_func _func = ((const mapi_func *) _tbl)[905];
    ((void (APIENTRY *)(GLenum target)) _func)(target);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GenerateMipmap)(GLenum target)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[885];
+   mapi_func _func = ((const mapi_func *) _tbl)[905];
    ((void (APIENTRY *)(GLenum target)) _func)(target);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[886];
+   mapi_func _func = ((const mapi_func *) _tbl)[906];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum pname, GLint *params)) _func)(target, attachment, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[886];
+   mapi_func _func = ((const mapi_func *) _tbl)[906];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum pname, GLint *params)) _func)(target, attachment, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[887];
+   mapi_func _func = ((const mapi_func *) _tbl)[907];
    ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[887];
+   mapi_func _func = ((const mapi_func *) _tbl)[907];
    ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsFramebufferEXT)(GLuint framebuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[888];
+   mapi_func _func = ((const mapi_func *) _tbl)[908];
    return ((GLboolean (APIENTRY *)(GLuint framebuffer)) _func)(framebuffer);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsFramebuffer)(GLuint framebuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[888];
+   mapi_func _func = ((const mapi_func *) _tbl)[908];
    return ((GLboolean (APIENTRY *)(GLuint framebuffer)) _func)(framebuffer);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbufferEXT)(GLuint renderbuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[889];
+   mapi_func _func = ((const mapi_func *) _tbl)[909];
    return ((GLboolean (APIENTRY *)(GLuint renderbuffer)) _func)(renderbuffer);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbuffer)(GLuint renderbuffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[889];
+   mapi_func _func = ((const mapi_func *) _tbl)[909];
    return ((GLboolean (APIENTRY *)(GLuint renderbuffer)) _func)(renderbuffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[890];
+   mapi_func _func = ((const mapi_func *) _tbl)[910];
    ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) _func)(target, internalformat, width, height);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[890];
+   mapi_func _func = ((const mapi_func *) _tbl)[910];
    ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) _func)(target, internalformat, width, height);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[891];
+   mapi_func _func = ((const mapi_func *) _tbl)[911];
    ((void (APIENTRY *)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)) _func)(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar *name)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[894];
+   mapi_func _func = ((const mapi_func *) _tbl)[914];
    ((void (APIENTRY *)(GLuint program, GLuint colorNumber, const GLchar *name)) _func)(program, colorNumber, name);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocation)(GLuint program, GLuint colorNumber, const GLchar *name)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[894];
+   mapi_func _func = ((const mapi_func *) _tbl)[914];
    ((void (APIENTRY *)(GLuint program, GLuint colorNumber, const GLchar *name)) _func)(program, colorNumber, name);
 }
 
 GLAPI GLint APIENTRY GLAPI_PREFIX(GetFragDataLocationEXT)(GLuint program, const GLchar *name)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[895];
+   mapi_func _func = ((const mapi_func *) _tbl)[915];
    return ((GLint (APIENTRY *)(GLuint program, const GLchar *name)) _func)(program, name);
 }
 
 GLAPI GLint APIENTRY GLAPI_PREFIX(GetFragDataLocation)(GLuint program, const GLchar *name)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[895];
+   mapi_func _func = ((const mapi_func *) _tbl)[915];
    return ((GLint (APIENTRY *)(GLuint program, const GLchar *name)) _func)(program, name);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetUniformuivEXT)(GLuint program, GLint location, GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[896];
+   mapi_func _func = ((const mapi_func *) _tbl)[916];
    ((void (APIENTRY *)(GLuint program, GLint location, GLuint *params)) _func)(program, location, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetUniformuiv)(GLuint program, GLint location, GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[896];
+   mapi_func _func = ((const mapi_func *) _tbl)[916];
    ((void (APIENTRY *)(GLuint program, GLint location, GLuint *params)) _func)(program, location, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[897];
+   mapi_func _func = ((const mapi_func *) _tbl)[917];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIiv)(GLuint index, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[897];
+   mapi_func _func = ((const mapi_func *) _tbl)[917];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[898];
+   mapi_func _func = ((const mapi_func *) _tbl)[918];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLuint *params)) _func)(index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIuiv)(GLuint index, GLenum pname, GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[898];
+   mapi_func _func = ((const mapi_func *) _tbl)[918];
    ((void (APIENTRY *)(GLuint index, GLenum pname, GLuint *params)) _func)(index, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uiEXT)(GLint location, GLuint x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[899];
+   mapi_func _func = ((const mapi_func *) _tbl)[919];
    ((void (APIENTRY *)(GLint location, GLuint x)) _func)(location, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform1ui)(GLint location, GLuint x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[899];
+   mapi_func _func = ((const mapi_func *) _tbl)[919];
    ((void (APIENTRY *)(GLint location, GLuint x)) _func)(location, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uivEXT)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[900];
+   mapi_func _func = ((const mapi_func *) _tbl)[920];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uiv)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[900];
+   mapi_func _func = ((const mapi_func *) _tbl)[920];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uiEXT)(GLint location, GLuint x, GLuint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[901];
+   mapi_func _func = ((const mapi_func *) _tbl)[921];
    ((void (APIENTRY *)(GLint location, GLuint x, GLuint y)) _func)(location, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform2ui)(GLint location, GLuint x, GLuint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[901];
+   mapi_func _func = ((const mapi_func *) _tbl)[921];
    ((void (APIENTRY *)(GLint location, GLuint x, GLuint y)) _func)(location, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uivEXT)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[902];
+   mapi_func _func = ((const mapi_func *) _tbl)[922];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uiv)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[902];
+   mapi_func _func = ((const mapi_func *) _tbl)[922];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[903];
+   mapi_func _func = ((const mapi_func *) _tbl)[923];
    ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z)) _func)(location, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform3ui)(GLint location, GLuint x, GLuint y, GLuint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[903];
+   mapi_func _func = ((const mapi_func *) _tbl)[923];
    ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z)) _func)(location, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uivEXT)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[904];
+   mapi_func _func = ((const mapi_func *) _tbl)[924];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uiv)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[904];
+   mapi_func _func = ((const mapi_func *) _tbl)[924];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[905];
+   mapi_func _func = ((const mapi_func *) _tbl)[925];
    ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(location, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform4ui)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[905];
+   mapi_func _func = ((const mapi_func *) _tbl)[925];
    ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(location, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uivEXT)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[906];
+   mapi_func _func = ((const mapi_func *) _tbl)[926];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uiv)(GLint location, GLsizei count, const GLuint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[906];
+   mapi_func _func = ((const mapi_func *) _tbl)[926];
    ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1iEXT)(GLuint index, GLint x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[907];
+   mapi_func _func = ((const mapi_func *) _tbl)[927];
    ((void (APIENTRY *)(GLuint index, GLint x)) _func)(index, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1i)(GLuint index, GLint x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[907];
+   mapi_func _func = ((const mapi_func *) _tbl)[927];
    ((void (APIENTRY *)(GLuint index, GLint x)) _func)(index, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1ivEXT)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[908];
+   mapi_func _func = ((const mapi_func *) _tbl)[928];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1iv)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[908];
+   mapi_func _func = ((const mapi_func *) _tbl)[928];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uiEXT)(GLuint index, GLuint x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[909];
+   mapi_func _func = ((const mapi_func *) _tbl)[929];
    ((void (APIENTRY *)(GLuint index, GLuint x)) _func)(index, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1ui)(GLuint index, GLuint x)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[909];
+   mapi_func _func = ((const mapi_func *) _tbl)[929];
    ((void (APIENTRY *)(GLuint index, GLuint x)) _func)(index, x);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uivEXT)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[910];
+   mapi_func _func = ((const mapi_func *) _tbl)[930];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uiv)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[910];
+   mapi_func _func = ((const mapi_func *) _tbl)[930];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2iEXT)(GLuint index, GLint x, GLint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[911];
+   mapi_func _func = ((const mapi_func *) _tbl)[931];
    ((void (APIENTRY *)(GLuint index, GLint x, GLint y)) _func)(index, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2i)(GLuint index, GLint x, GLint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[911];
+   mapi_func _func = ((const mapi_func *) _tbl)[931];
    ((void (APIENTRY *)(GLuint index, GLint x, GLint y)) _func)(index, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2ivEXT)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[912];
+   mapi_func _func = ((const mapi_func *) _tbl)[932];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2iv)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[912];
+   mapi_func _func = ((const mapi_func *) _tbl)[932];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[913];
+   mapi_func _func = ((const mapi_func *) _tbl)[933];
    ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y)) _func)(index, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[913];
+   mapi_func _func = ((const mapi_func *) _tbl)[933];
    ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y)) _func)(index, x, y);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uivEXT)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[914];
+   mapi_func _func = ((const mapi_func *) _tbl)[934];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uiv)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[914];
+   mapi_func _func = ((const mapi_func *) _tbl)[934];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[915];
+   mapi_func _func = ((const mapi_func *) _tbl)[935];
    ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z)) _func)(index, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[915];
+   mapi_func _func = ((const mapi_func *) _tbl)[935];
    ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z)) _func)(index, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3ivEXT)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[916];
+   mapi_func _func = ((const mapi_func *) _tbl)[936];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3iv)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[916];
+   mapi_func _func = ((const mapi_func *) _tbl)[936];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[917];
+   mapi_func _func = ((const mapi_func *) _tbl)[937];
    ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z)) _func)(index, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[917];
+   mapi_func _func = ((const mapi_func *) _tbl)[937];
    ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z)) _func)(index, x, y, z);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uivEXT)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[918];
+   mapi_func _func = ((const mapi_func *) _tbl)[938];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uiv)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[918];
+   mapi_func _func = ((const mapi_func *) _tbl)[938];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4bvEXT)(GLuint index, const GLbyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[919];
+   mapi_func _func = ((const mapi_func *) _tbl)[939];
    ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4bv)(GLuint index, const GLbyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[919];
+   mapi_func _func = ((const mapi_func *) _tbl)[939];
    ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[920];
+   mapi_func _func = ((const mapi_func *) _tbl)[940];
    ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z, GLint w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[920];
+   mapi_func _func = ((const mapi_func *) _tbl)[940];
    ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z, GLint w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ivEXT)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[921];
+   mapi_func _func = ((const mapi_func *) _tbl)[941];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4iv)(GLuint index, const GLint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[921];
+   mapi_func _func = ((const mapi_func *) _tbl)[941];
    ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4svEXT)(GLuint index, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[922];
+   mapi_func _func = ((const mapi_func *) _tbl)[942];
    ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4sv)(GLuint index, const GLshort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[922];
+   mapi_func _func = ((const mapi_func *) _tbl)[942];
    ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ubvEXT)(GLuint index, const GLubyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[923];
+   mapi_func _func = ((const mapi_func *) _tbl)[943];
    ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ubv)(GLuint index, const GLubyte *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[923];
+   mapi_func _func = ((const mapi_func *) _tbl)[943];
    ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[924];
+   mapi_func _func = ((const mapi_func *) _tbl)[944];
    ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[924];
+   mapi_func _func = ((const mapi_func *) _tbl)[944];
    ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(index, x, y, z, w);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uivEXT)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[925];
+   mapi_func _func = ((const mapi_func *) _tbl)[945];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uiv)(GLuint index, const GLuint *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[925];
+   mapi_func _func = ((const mapi_func *) _tbl)[945];
    ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4usvEXT)(GLuint index, const GLushort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[926];
+   mapi_func _func = ((const mapi_func *) _tbl)[946];
    ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4usv)(GLuint index, const GLushort *v)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[926];
+   mapi_func _func = ((const mapi_func *) _tbl)[946];
    ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[927];
+   mapi_func _func = ((const mapi_func *) _tbl)[947];
    ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, stride, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribIPointer)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[927];
+   mapi_func _func = ((const mapi_func *) _tbl)[947];
    ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, stride, pointer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[928];
+   mapi_func _func = ((const mapi_func *) _tbl)[948];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)) _func)(target, attachment, texture, level, layer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureLayer)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[928];
+   mapi_func _func = ((const mapi_func *) _tbl)[948];
    ((void (APIENTRY *)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)) _func)(target, attachment, texture, level, layer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[929];
+   mapi_func _func = ((const mapi_func *) _tbl)[949];
    ((void (APIENTRY *)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)) _func)(buf, r, g, b, a);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ColorMaski)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[929];
+   mapi_func _func = ((const mapi_func *) _tbl)[949];
    ((void (APIENTRY *)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)) _func)(buf, r, g, b, a);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(DisableIndexedEXT)(GLenum target, GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[930];
+   mapi_func _func = ((const mapi_func *) _tbl)[950];
    ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Disablei)(GLenum target, GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[930];
+   mapi_func _func = ((const mapi_func *) _tbl)[950];
    ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EnableIndexedEXT)(GLenum target, GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[931];
+   mapi_func _func = ((const mapi_func *) _tbl)[951];
    ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(Enablei)(GLenum target, GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[931];
+   mapi_func _func = ((const mapi_func *) _tbl)[951];
    ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean *data)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[932];
+   mapi_func _func = ((const mapi_func *) _tbl)[952];
    ((void (APIENTRY *)(GLenum value, GLuint index, GLboolean *data)) _func)(value, index, data);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetBooleani_v)(GLenum value, GLuint index, GLboolean *data)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[932];
+   mapi_func _func = ((const mapi_func *) _tbl)[952];
    ((void (APIENTRY *)(GLenum value, GLuint index, GLboolean *data)) _func)(value, index, data);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint *data)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[933];
+   mapi_func _func = ((const mapi_func *) _tbl)[953];
    ((void (APIENTRY *)(GLenum value, GLuint index, GLint *data)) _func)(value, index, data);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetIntegeri_v)(GLenum value, GLuint index, GLint *data)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[933];
+   mapi_func _func = ((const mapi_func *) _tbl)[953];
    ((void (APIENTRY *)(GLenum value, GLuint index, GLint *data)) _func)(value, index, data);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabledIndexedEXT)(GLenum target, GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[934];
+   mapi_func _func = ((const mapi_func *) _tbl)[954];
    return ((GLboolean (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index);
 }
 
 GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabledi)(GLenum target, GLuint index)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[934];
+   mapi_func _func = ((const mapi_func *) _tbl)[954];
    return ((GLboolean (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[935];
+   mapi_func _func = ((const mapi_func *) _tbl)[955];
    ((void (APIENTRY *)(GLint r, GLint g, GLint b, GLint a)) _func)(r, g, b, a);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[936];
+   mapi_func _func = ((const mapi_func *) _tbl)[956];
    ((void (APIENTRY *)(GLuint r, GLuint g, GLuint b, GLuint a)) _func)(r, g, b, a);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[937];
+   mapi_func _func = ((const mapi_func *) _tbl)[957];
    ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIiv)(GLenum target, GLenum pname, GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[937];
+   mapi_func _func = ((const mapi_func *) _tbl)[957];
    ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[938];
+   mapi_func _func = ((const mapi_func *) _tbl)[958];
    ((void (APIENTRY *)(GLenum target, GLenum pname, GLuint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIuiv)(GLenum target, GLenum pname, GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[938];
+   mapi_func _func = ((const mapi_func *) _tbl)[958];
    ((void (APIENTRY *)(GLenum target, GLenum pname, GLuint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIivEXT)(GLenum target, GLenum pname, const GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[939];
+   mapi_func _func = ((const mapi_func *) _tbl)[959];
    ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIiv)(GLenum target, GLenum pname, const GLint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[939];
+   mapi_func _func = ((const mapi_func *) _tbl)[959];
    ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[940];
+   mapi_func _func = ((const mapi_func *) _tbl)[960];
    ((void (APIENTRY *)(GLenum target, GLenum pname, const GLuint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIuiv)(GLenum target, GLenum pname, const GLuint *params)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[940];
+   mapi_func _func = ((const mapi_func *) _tbl)[960];
    ((void (APIENTRY *)(GLenum target, GLenum pname, const GLuint *params)) _func)(target, pname, params);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BeginConditionalRenderNV)(GLuint query, GLenum mode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[941];
+   mapi_func _func = ((const mapi_func *) _tbl)[961];
    ((void (APIENTRY *)(GLuint query, GLenum mode)) _func)(query, mode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BeginConditionalRender)(GLuint query, GLenum mode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[941];
+   mapi_func _func = ((const mapi_func *) _tbl)[961];
    ((void (APIENTRY *)(GLuint query, GLenum mode)) _func)(query, mode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EndConditionalRenderNV)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[942];
+   mapi_func _func = ((const mapi_func *) _tbl)[962];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EndConditionalRender)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[942];
+   mapi_func _func = ((const mapi_func *) _tbl)[962];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BeginTransformFeedbackEXT)(GLenum mode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[943];
+   mapi_func _func = ((const mapi_func *) _tbl)[963];
    ((void (APIENTRY *)(GLenum mode)) _func)(mode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BeginTransformFeedback)(GLenum mode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[943];
+   mapi_func _func = ((const mapi_func *) _tbl)[963];
    ((void (APIENTRY *)(GLenum mode)) _func)(mode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[944];
+   mapi_func _func = ((const mapi_func *) _tbl)[964];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer)) _func)(target, index, buffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindBufferBase)(GLenum target, GLuint index, GLuint buffer)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[944];
+   mapi_func _func = ((const mapi_func *) _tbl)[964];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer)) _func)(target, index, buffer);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[945];
+   mapi_func _func = ((const mapi_func *) _tbl)[965];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer, GLintptr offset)) _func)(target, index, buffer, offset);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[946];
+   mapi_func _func = ((const mapi_func *) _tbl)[966];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)) _func)(target, index, buffer, offset, size);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(BindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[946];
+   mapi_func _func = ((const mapi_func *) _tbl)[966];
    ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)) _func)(target, index, buffer, offset, size);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EndTransformFeedbackEXT)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[947];
+   mapi_func _func = ((const mapi_func *) _tbl)[967];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EndTransformFeedback)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[947];
+   mapi_func _func = ((const mapi_func *) _tbl)[967];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[948];
+   mapi_func _func = ((const mapi_func *) _tbl)[968];
    ((void (APIENTRY *)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)) _func)(program, index, bufSize, length, size, type, name);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[948];
+   mapi_func _func = ((const mapi_func *) _tbl)[968];
    ((void (APIENTRY *)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)) _func)(program, index, bufSize, length, size, type, name);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char **varyings, GLenum bufferMode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[949];
+   mapi_func _func = ((const mapi_func *) _tbl)[969];
    ((void (APIENTRY *)(GLuint program, GLsizei count, const char **varyings, GLenum bufferMode)) _func)(program, count, varyings, bufferMode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryings)(GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[949];
+   mapi_func _func = ((const mapi_func *) _tbl)[969];
    ((void (APIENTRY *)(GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode)) _func)(program, count, varyings, bufferMode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertexEXT)(GLenum mode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[950];
+   mapi_func _func = ((const mapi_func *) _tbl)[970];
    ((void (APIENTRY *)(GLenum mode)) _func)(mode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertex)(GLenum mode)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[950];
+   mapi_func _func = ((const mapi_func *) _tbl)[970];
    ((void (APIENTRY *)(GLenum mode)) _func)(mode);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint *value)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[953];
+   mapi_func _func = ((const mapi_func *) _tbl)[973];
    ((void (APIENTRY *)(GLenum objectType, GLuint name, GLenum pname, GLint *value)) _func)(objectType, name, pname, value);
 }
 
 GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[954];
+   mapi_func _func = ((const mapi_func *) _tbl)[974];
    return ((GLenum (APIENTRY *)(GLenum objectType, GLuint name, GLenum option)) _func)(objectType, name, option);
 }
 
 GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[955];
+   mapi_func _func = ((const mapi_func *) _tbl)[975];
    return ((GLenum (APIENTRY *)(GLenum objectType, GLuint name, GLenum option)) _func)(objectType, name, option);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(ActiveProgramEXT)(GLuint program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[956];
+   mapi_func _func = ((const mapi_func *) _tbl)[976];
    ((void (APIENTRY *)(GLuint program)) _func)(program);
 }
 
 GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateShaderProgramEXT)(GLenum type, const GLchar *string)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[957];
+   mapi_func _func = ((const mapi_func *) _tbl)[977];
    return ((GLuint (APIENTRY *)(GLenum type, const GLchar *string)) _func)(type, string);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(UseShaderProgramEXT)(GLenum type, GLuint program)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[958];
+   mapi_func _func = ((const mapi_func *) _tbl)[978];
    ((void (APIENTRY *)(GLenum type, GLuint program)) _func)(type, program);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(TextureBarrierNV)(void)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[959];
+   mapi_func _func = ((const mapi_func *) _tbl)[979];
    ((void (APIENTRY *)(void)) _func)();
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid *writeOffset)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[965];
+   mapi_func _func = ((const mapi_func *) _tbl)[985];
    ((void (APIENTRY *)(GLenum target, GLvoid *writeOffset)) _func)(target, writeOffset);
 }
 
 GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetTexture2DOES)(GLenum target, GLvoid *writeOffset)
 {
    const struct mapi_table *_tbl = entry_current_get();
-   mapi_func _func = ((const mapi_func *) _tbl)[966];
+   mapi_func _func = ((const mapi_func *) _tbl)[986];
    ((void (APIENTRY *)(GLenum target, GLvoid *writeOffset)) _func)(target, writeOffset);
 }
 
@@ -12111,29 +12271,89 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ReleaseShaderCompiler))"\n"
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ShaderBinary))"\n"
 "\t"STUB_ASM_CODE("625")"\n"
 
-STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PolygonOffsetEXT))"\n"
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetGraphicsResetStatusARB))"\n"
 "\t"STUB_ASM_CODE("629")"\n"
 
-STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorPointerEXT))"\n"
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnColorTableARB))"\n"
+"\t"STUB_ASM_CODE("630")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnCompressedTexImageARB))"\n"
+"\t"STUB_ASM_CODE("631")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnConvolutionFilterARB))"\n"
+"\t"STUB_ASM_CODE("632")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnHistogramARB))"\n"
+"\t"STUB_ASM_CODE("633")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnMapdvARB))"\n"
+"\t"STUB_ASM_CODE("634")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnMapfvARB))"\n"
+"\t"STUB_ASM_CODE("635")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnMapivARB))"\n"
+"\t"STUB_ASM_CODE("636")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnMinmaxARB))"\n"
+"\t"STUB_ASM_CODE("637")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnPixelMapfvARB))"\n"
+"\t"STUB_ASM_CODE("638")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnPixelMapuivARB))"\n"
+"\t"STUB_ASM_CODE("639")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnPixelMapusvARB))"\n"
+"\t"STUB_ASM_CODE("640")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnPolygonStippleARB))"\n"
+"\t"STUB_ASM_CODE("641")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnSeparableFilterARB))"\n"
+"\t"STUB_ASM_CODE("642")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnTexImageARB))"\n"
+"\t"STUB_ASM_CODE("643")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnUniformdvARB))"\n"
+"\t"STUB_ASM_CODE("644")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnUniformfvARB))"\n"
+"\t"STUB_ASM_CODE("645")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnUniformivARB))"\n"
+"\t"STUB_ASM_CODE("646")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetnUniformuivARB))"\n"
+"\t"STUB_ASM_CODE("647")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ReadnPixelsARB))"\n"
 "\t"STUB_ASM_CODE("648")"\n"
 
-STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EdgeFlagPointerEXT))"\n"
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PolygonOffsetEXT))"\n"
 "\t"STUB_ASM_CODE("649")"\n"
 
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorPointerEXT))"\n"
+"\t"STUB_ASM_CODE("668")"\n"
+
+STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EdgeFlagPointerEXT))"\n"
+"\t"STUB_ASM_CODE("669")"\n"
+
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IndexPointerEXT))"\n"
-"\t"STUB_ASM_CODE("650")"\n"
+"\t"STUB_ASM_CODE("670")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(NormalPointerEXT))"\n"
-"\t"STUB_ASM_CODE("651")"\n"
+"\t"STUB_ASM_CODE("671")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoordPointerEXT))"\n"
-"\t"STUB_ASM_CODE("652")"\n"
+"\t"STUB_ASM_CODE("672")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexPointerEXT))"\n"
-"\t"STUB_ASM_CODE("653")"\n"
+"\t"STUB_ASM_CODE("673")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterfEXT))"\n"
-"\t"STUB_ASM_CODE("654")"\n"
+"\t"STUB_ASM_CODE("674")"\n"
 
 ".globl "GLAPI_PREFIX_STR(PointParameterf)"\n"
 ".set "GLAPI_PREFIX_STR(PointParameterf)", "GLAPI_PREFIX_STR(PointParameterfEXT)"\n"
@@ -12142,7 +12362,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterfEXT))"\n"
 ".set "GLAPI_PREFIX_STR(PointParameterfARB)", "GLAPI_PREFIX_STR(PointParameterfEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterfvEXT))"\n"
-"\t"STUB_ASM_CODE("655")"\n"
+"\t"STUB_ASM_CODE("675")"\n"
 
 ".globl "GLAPI_PREFIX_STR(PointParameterfv)"\n"
 ".set "GLAPI_PREFIX_STR(PointParameterfv)", "GLAPI_PREFIX_STR(PointParameterfvEXT)"\n"
@@ -12151,211 +12371,211 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterfvEXT))"\n"
 ".set "GLAPI_PREFIX_STR(PointParameterfvARB)", "GLAPI_PREFIX_STR(PointParameterfvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LockArraysEXT))"\n"
-"\t"STUB_ASM_CODE("656")"\n"
+"\t"STUB_ASM_CODE("676")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UnlockArraysEXT))"\n"
-"\t"STUB_ASM_CODE("657")"\n"
+"\t"STUB_ASM_CODE("677")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3bEXT))"\n"
-"\t"STUB_ASM_CODE("658")"\n"
+"\t"STUB_ASM_CODE("678")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3b)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3b)", "GLAPI_PREFIX_STR(SecondaryColor3bEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3bvEXT))"\n"
-"\t"STUB_ASM_CODE("659")"\n"
+"\t"STUB_ASM_CODE("679")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3bv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3bv)", "GLAPI_PREFIX_STR(SecondaryColor3bvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3dEXT))"\n"
-"\t"STUB_ASM_CODE("660")"\n"
+"\t"STUB_ASM_CODE("680")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3d)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3d)", "GLAPI_PREFIX_STR(SecondaryColor3dEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3dvEXT))"\n"
-"\t"STUB_ASM_CODE("661")"\n"
+"\t"STUB_ASM_CODE("681")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3dv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3dv)", "GLAPI_PREFIX_STR(SecondaryColor3dvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3fEXT))"\n"
-"\t"STUB_ASM_CODE("662")"\n"
+"\t"STUB_ASM_CODE("682")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3f)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3f)", "GLAPI_PREFIX_STR(SecondaryColor3fEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3fvEXT))"\n"
-"\t"STUB_ASM_CODE("663")"\n"
+"\t"STUB_ASM_CODE("683")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3fv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3fv)", "GLAPI_PREFIX_STR(SecondaryColor3fvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3iEXT))"\n"
-"\t"STUB_ASM_CODE("664")"\n"
+"\t"STUB_ASM_CODE("684")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3i)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3i)", "GLAPI_PREFIX_STR(SecondaryColor3iEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3ivEXT))"\n"
-"\t"STUB_ASM_CODE("665")"\n"
+"\t"STUB_ASM_CODE("685")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3iv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3iv)", "GLAPI_PREFIX_STR(SecondaryColor3ivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3sEXT))"\n"
-"\t"STUB_ASM_CODE("666")"\n"
+"\t"STUB_ASM_CODE("686")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3s)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3s)", "GLAPI_PREFIX_STR(SecondaryColor3sEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3svEXT))"\n"
-"\t"STUB_ASM_CODE("667")"\n"
+"\t"STUB_ASM_CODE("687")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3sv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3sv)", "GLAPI_PREFIX_STR(SecondaryColor3svEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3ubEXT))"\n"
-"\t"STUB_ASM_CODE("668")"\n"
+"\t"STUB_ASM_CODE("688")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3ub)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3ub)", "GLAPI_PREFIX_STR(SecondaryColor3ubEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3ubvEXT))"\n"
-"\t"STUB_ASM_CODE("669")"\n"
+"\t"STUB_ASM_CODE("689")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3ubv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3ubv)", "GLAPI_PREFIX_STR(SecondaryColor3ubvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3uiEXT))"\n"
-"\t"STUB_ASM_CODE("670")"\n"
+"\t"STUB_ASM_CODE("690")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3ui)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3ui)", "GLAPI_PREFIX_STR(SecondaryColor3uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3uivEXT))"\n"
-"\t"STUB_ASM_CODE("671")"\n"
+"\t"STUB_ASM_CODE("691")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3uiv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3uiv)", "GLAPI_PREFIX_STR(SecondaryColor3uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3usEXT))"\n"
-"\t"STUB_ASM_CODE("672")"\n"
+"\t"STUB_ASM_CODE("692")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3us)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3us)", "GLAPI_PREFIX_STR(SecondaryColor3usEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3usvEXT))"\n"
-"\t"STUB_ASM_CODE("673")"\n"
+"\t"STUB_ASM_CODE("693")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColor3usv)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColor3usv)", "GLAPI_PREFIX_STR(SecondaryColor3usvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColorPointerEXT))"\n"
-"\t"STUB_ASM_CODE("674")"\n"
+"\t"STUB_ASM_CODE("694")"\n"
 
 ".globl "GLAPI_PREFIX_STR(SecondaryColorPointer)"\n"
 ".set "GLAPI_PREFIX_STR(SecondaryColorPointer)", "GLAPI_PREFIX_STR(SecondaryColorPointerEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiDrawArraysEXT))"\n"
-"\t"STUB_ASM_CODE("675")"\n"
+"\t"STUB_ASM_CODE("695")"\n"
 
 ".globl "GLAPI_PREFIX_STR(MultiDrawArrays)"\n"
 ".set "GLAPI_PREFIX_STR(MultiDrawArrays)", "GLAPI_PREFIX_STR(MultiDrawArraysEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiDrawElementsEXT))"\n"
-"\t"STUB_ASM_CODE("676")"\n"
+"\t"STUB_ASM_CODE("696")"\n"
 
 ".globl "GLAPI_PREFIX_STR(MultiDrawElements)"\n"
 ".set "GLAPI_PREFIX_STR(MultiDrawElements)", "GLAPI_PREFIX_STR(MultiDrawElementsEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoordPointerEXT))"\n"
-"\t"STUB_ASM_CODE("677")"\n"
+"\t"STUB_ASM_CODE("697")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FogCoordPointer)"\n"
 ".set "GLAPI_PREFIX_STR(FogCoordPointer)", "GLAPI_PREFIX_STR(FogCoordPointerEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoorddEXT))"\n"
-"\t"STUB_ASM_CODE("678")"\n"
+"\t"STUB_ASM_CODE("698")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FogCoordd)"\n"
 ".set "GLAPI_PREFIX_STR(FogCoordd)", "GLAPI_PREFIX_STR(FogCoorddEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoorddvEXT))"\n"
-"\t"STUB_ASM_CODE("679")"\n"
+"\t"STUB_ASM_CODE("699")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FogCoorddv)"\n"
 ".set "GLAPI_PREFIX_STR(FogCoorddv)", "GLAPI_PREFIX_STR(FogCoorddvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoordfEXT))"\n"
-"\t"STUB_ASM_CODE("680")"\n"
+"\t"STUB_ASM_CODE("700")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FogCoordf)"\n"
 ".set "GLAPI_PREFIX_STR(FogCoordf)", "GLAPI_PREFIX_STR(FogCoordfEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoordfvEXT))"\n"
-"\t"STUB_ASM_CODE("681")"\n"
+"\t"STUB_ASM_CODE("701")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FogCoordfv)"\n"
 ".set "GLAPI_PREFIX_STR(FogCoordfv)", "GLAPI_PREFIX_STR(FogCoordfvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendFuncSeparateEXT))"\n"
-"\t"STUB_ASM_CODE("683")"\n"
+"\t"STUB_ASM_CODE("703")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BlendFuncSeparate)"\n"
 ".set "GLAPI_PREFIX_STR(BlendFuncSeparate)", "GLAPI_PREFIX_STR(BlendFuncSeparateEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FlushVertexArrayRangeNV))"\n"
-"\t"STUB_ASM_CODE("684")"\n"
+"\t"STUB_ASM_CODE("704")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexArrayRangeNV))"\n"
-"\t"STUB_ASM_CODE("685")"\n"
+"\t"STUB_ASM_CODE("705")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerInputNV))"\n"
-"\t"STUB_ASM_CODE("686")"\n"
+"\t"STUB_ASM_CODE("706")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerOutputNV))"\n"
-"\t"STUB_ASM_CODE("687")"\n"
+"\t"STUB_ASM_CODE("707")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameterfNV))"\n"
-"\t"STUB_ASM_CODE("688")"\n"
+"\t"STUB_ASM_CODE("708")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameterfvNV))"\n"
-"\t"STUB_ASM_CODE("689")"\n"
+"\t"STUB_ASM_CODE("709")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameteriNV))"\n"
-"\t"STUB_ASM_CODE("690")"\n"
+"\t"STUB_ASM_CODE("710")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameterivNV))"\n"
-"\t"STUB_ASM_CODE("691")"\n"
+"\t"STUB_ASM_CODE("711")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FinalCombinerInputNV))"\n"
-"\t"STUB_ASM_CODE("692")"\n"
+"\t"STUB_ASM_CODE("712")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerInputParameterfvNV))"\n"
-"\t"STUB_ASM_CODE("693")"\n"
+"\t"STUB_ASM_CODE("713")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerInputParameterivNV))"\n"
-"\t"STUB_ASM_CODE("694")"\n"
+"\t"STUB_ASM_CODE("714")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerOutputParameterfvNV))"\n"
-"\t"STUB_ASM_CODE("695")"\n"
+"\t"STUB_ASM_CODE("715")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerOutputParameterivNV))"\n"
-"\t"STUB_ASM_CODE("696")"\n"
+"\t"STUB_ASM_CODE("716")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFinalCombinerInputParameterfvNV))"\n"
-"\t"STUB_ASM_CODE("697")"\n"
+"\t"STUB_ASM_CODE("717")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFinalCombinerInputParameterivNV))"\n"
-"\t"STUB_ASM_CODE("698")"\n"
+"\t"STUB_ASM_CODE("718")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ResizeBuffersMESA))"\n"
-"\t"STUB_ASM_CODE("699")"\n"
+"\t"STUB_ASM_CODE("719")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2dMESA))"\n"
-"\t"STUB_ASM_CODE("700")"\n"
+"\t"STUB_ASM_CODE("720")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2d)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2d)", "GLAPI_PREFIX_STR(WindowPos2dMESA)"\n"
@@ -12364,7 +12584,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2dMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2dARB)", "GLAPI_PREFIX_STR(WindowPos2dMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2dvMESA))"\n"
-"\t"STUB_ASM_CODE("701")"\n"
+"\t"STUB_ASM_CODE("721")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2dv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2dv)", "GLAPI_PREFIX_STR(WindowPos2dvMESA)"\n"
@@ -12373,7 +12593,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2dvMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2dvARB)", "GLAPI_PREFIX_STR(WindowPos2dvMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2fMESA))"\n"
-"\t"STUB_ASM_CODE("702")"\n"
+"\t"STUB_ASM_CODE("722")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2f)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2f)", "GLAPI_PREFIX_STR(WindowPos2fMESA)"\n"
@@ -12382,7 +12602,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2fMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2fARB)", "GLAPI_PREFIX_STR(WindowPos2fMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2fvMESA))"\n"
-"\t"STUB_ASM_CODE("703")"\n"
+"\t"STUB_ASM_CODE("723")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2fv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2fv)", "GLAPI_PREFIX_STR(WindowPos2fvMESA)"\n"
@@ -12391,7 +12611,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2fvMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2fvARB)", "GLAPI_PREFIX_STR(WindowPos2fvMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2iMESA))"\n"
-"\t"STUB_ASM_CODE("704")"\n"
+"\t"STUB_ASM_CODE("724")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2i)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2i)", "GLAPI_PREFIX_STR(WindowPos2iMESA)"\n"
@@ -12400,7 +12620,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2iMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2iARB)", "GLAPI_PREFIX_STR(WindowPos2iMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2ivMESA))"\n"
-"\t"STUB_ASM_CODE("705")"\n"
+"\t"STUB_ASM_CODE("725")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2iv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2iv)", "GLAPI_PREFIX_STR(WindowPos2ivMESA)"\n"
@@ -12409,7 +12629,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2ivMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2ivARB)", "GLAPI_PREFIX_STR(WindowPos2ivMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2sMESA))"\n"
-"\t"STUB_ASM_CODE("706")"\n"
+"\t"STUB_ASM_CODE("726")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2s)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2s)", "GLAPI_PREFIX_STR(WindowPos2sMESA)"\n"
@@ -12418,7 +12638,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2sMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2sARB)", "GLAPI_PREFIX_STR(WindowPos2sMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2svMESA))"\n"
-"\t"STUB_ASM_CODE("707")"\n"
+"\t"STUB_ASM_CODE("727")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos2sv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2sv)", "GLAPI_PREFIX_STR(WindowPos2svMESA)"\n"
@@ -12427,7 +12647,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2svMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos2svARB)", "GLAPI_PREFIX_STR(WindowPos2svMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3dMESA))"\n"
-"\t"STUB_ASM_CODE("708")"\n"
+"\t"STUB_ASM_CODE("728")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3d)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3d)", "GLAPI_PREFIX_STR(WindowPos3dMESA)"\n"
@@ -12436,7 +12656,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3dMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3dARB)", "GLAPI_PREFIX_STR(WindowPos3dMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3dvMESA))"\n"
-"\t"STUB_ASM_CODE("709")"\n"
+"\t"STUB_ASM_CODE("729")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3dv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3dv)", "GLAPI_PREFIX_STR(WindowPos3dvMESA)"\n"
@@ -12445,7 +12665,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3dvMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3dvARB)", "GLAPI_PREFIX_STR(WindowPos3dvMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3fMESA))"\n"
-"\t"STUB_ASM_CODE("710")"\n"
+"\t"STUB_ASM_CODE("730")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3f)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3f)", "GLAPI_PREFIX_STR(WindowPos3fMESA)"\n"
@@ -12454,7 +12674,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3fMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3fARB)", "GLAPI_PREFIX_STR(WindowPos3fMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3fvMESA))"\n"
-"\t"STUB_ASM_CODE("711")"\n"
+"\t"STUB_ASM_CODE("731")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3fv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3fv)", "GLAPI_PREFIX_STR(WindowPos3fvMESA)"\n"
@@ -12463,7 +12683,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3fvMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3fvARB)", "GLAPI_PREFIX_STR(WindowPos3fvMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3iMESA))"\n"
-"\t"STUB_ASM_CODE("712")"\n"
+"\t"STUB_ASM_CODE("732")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3i)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3i)", "GLAPI_PREFIX_STR(WindowPos3iMESA)"\n"
@@ -12472,7 +12692,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3iMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3iARB)", "GLAPI_PREFIX_STR(WindowPos3iMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3ivMESA))"\n"
-"\t"STUB_ASM_CODE("713")"\n"
+"\t"STUB_ASM_CODE("733")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3iv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3iv)", "GLAPI_PREFIX_STR(WindowPos3ivMESA)"\n"
@@ -12481,7 +12701,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3ivMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3ivARB)", "GLAPI_PREFIX_STR(WindowPos3ivMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3sMESA))"\n"
-"\t"STUB_ASM_CODE("714")"\n"
+"\t"STUB_ASM_CODE("734")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3s)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3s)", "GLAPI_PREFIX_STR(WindowPos3sMESA)"\n"
@@ -12490,7 +12710,7 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3sMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3sARB)", "GLAPI_PREFIX_STR(WindowPos3sMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3svMESA))"\n"
-"\t"STUB_ASM_CODE("715")"\n"
+"\t"STUB_ASM_CODE("735")"\n"
 
 ".globl "GLAPI_PREFIX_STR(WindowPos3sv)"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3sv)", "GLAPI_PREFIX_STR(WindowPos3svMESA)"\n"
@@ -12499,70 +12719,70 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3svMESA))"\n"
 ".set "GLAPI_PREFIX_STR(WindowPos3svARB)", "GLAPI_PREFIX_STR(WindowPos3svMESA)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4dMESA))"\n"
-"\t"STUB_ASM_CODE("716")"\n"
+"\t"STUB_ASM_CODE("736")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4dvMESA))"\n"
-"\t"STUB_ASM_CODE("717")"\n"
+"\t"STUB_ASM_CODE("737")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4fMESA))"\n"
-"\t"STUB_ASM_CODE("718")"\n"
+"\t"STUB_ASM_CODE("738")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4fvMESA))"\n"
-"\t"STUB_ASM_CODE("719")"\n"
+"\t"STUB_ASM_CODE("739")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4iMESA))"\n"
-"\t"STUB_ASM_CODE("720")"\n"
+"\t"STUB_ASM_CODE("740")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4ivMESA))"\n"
-"\t"STUB_ASM_CODE("721")"\n"
+"\t"STUB_ASM_CODE("741")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4sMESA))"\n"
-"\t"STUB_ASM_CODE("722")"\n"
+"\t"STUB_ASM_CODE("742")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4svMESA))"\n"
-"\t"STUB_ASM_CODE("723")"\n"
+"\t"STUB_ASM_CODE("743")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AreProgramsResidentNV))"\n"
-"\t"STUB_ASM_CODE("733")"\n"
+"\t"STUB_ASM_CODE("753")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindProgramNV))"\n"
-"\t"STUB_ASM_CODE("734")"\n"
+"\t"STUB_ASM_CODE("754")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BindProgramARB)"\n"
 ".set "GLAPI_PREFIX_STR(BindProgramARB)", "GLAPI_PREFIX_STR(BindProgramNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteProgramsNV))"\n"
-"\t"STUB_ASM_CODE("735")"\n"
+"\t"STUB_ASM_CODE("755")"\n"
 
 ".globl "GLAPI_PREFIX_STR(DeleteProgramsARB)"\n"
 ".set "GLAPI_PREFIX_STR(DeleteProgramsARB)", "GLAPI_PREFIX_STR(DeleteProgramsNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ExecuteProgramNV))"\n"
-"\t"STUB_ASM_CODE("736")"\n"
+"\t"STUB_ASM_CODE("756")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenProgramsNV))"\n"
-"\t"STUB_ASM_CODE("737")"\n"
+"\t"STUB_ASM_CODE("757")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GenProgramsARB)"\n"
 ".set "GLAPI_PREFIX_STR(GenProgramsARB)", "GLAPI_PREFIX_STR(GenProgramsNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramParameterdvNV))"\n"
-"\t"STUB_ASM_CODE("738")"\n"
+"\t"STUB_ASM_CODE("758")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramParameterfvNV))"\n"
-"\t"STUB_ASM_CODE("739")"\n"
+"\t"STUB_ASM_CODE("759")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramStringNV))"\n"
-"\t"STUB_ASM_CODE("740")"\n"
+"\t"STUB_ASM_CODE("760")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramivNV))"\n"
-"\t"STUB_ASM_CODE("741")"\n"
+"\t"STUB_ASM_CODE("761")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTrackMatrixivNV))"\n"
-"\t"STUB_ASM_CODE("742")"\n"
+"\t"STUB_ASM_CODE("762")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribPointervNV))"\n"
-"\t"STUB_ASM_CODE("743")"\n"
+"\t"STUB_ASM_CODE("763")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetVertexAttribPointerv)"\n"
 ".set "GLAPI_PREFIX_STR(GetVertexAttribPointerv)", "GLAPI_PREFIX_STR(GetVertexAttribPointervNV)"\n"
@@ -12571,721 +12791,721 @@ STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribPointervNV))"\n"
 ".set "GLAPI_PREFIX_STR(GetVertexAttribPointervARB)", "GLAPI_PREFIX_STR(GetVertexAttribPointervNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribdvNV))"\n"
-"\t"STUB_ASM_CODE("744")"\n"
+"\t"STUB_ASM_CODE("764")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribfvNV))"\n"
-"\t"STUB_ASM_CODE("745")"\n"
+"\t"STUB_ASM_CODE("765")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribivNV))"\n"
-"\t"STUB_ASM_CODE("746")"\n"
+"\t"STUB_ASM_CODE("766")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsProgramNV))"\n"
-"\t"STUB_ASM_CODE("747")"\n"
+"\t"STUB_ASM_CODE("767")"\n"
 
 ".globl "GLAPI_PREFIX_STR(IsProgramARB)"\n"
 ".set "GLAPI_PREFIX_STR(IsProgramARB)", "GLAPI_PREFIX_STR(IsProgramNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadProgramNV))"\n"
-"\t"STUB_ASM_CODE("748")"\n"
+"\t"STUB_ASM_CODE("768")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramParameters4dvNV))"\n"
-"\t"STUB_ASM_CODE("749")"\n"
+"\t"STUB_ASM_CODE("769")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramParameters4fvNV))"\n"
-"\t"STUB_ASM_CODE("750")"\n"
+"\t"STUB_ASM_CODE("770")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RequestResidentProgramsNV))"\n"
-"\t"STUB_ASM_CODE("751")"\n"
+"\t"STUB_ASM_CODE("771")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TrackMatrixNV))"\n"
-"\t"STUB_ASM_CODE("752")"\n"
+"\t"STUB_ASM_CODE("772")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1dNV))"\n"
-"\t"STUB_ASM_CODE("753")"\n"
+"\t"STUB_ASM_CODE("773")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1dvNV))"\n"
-"\t"STUB_ASM_CODE("754")"\n"
+"\t"STUB_ASM_CODE("774")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1fNV))"\n"
-"\t"STUB_ASM_CODE("755")"\n"
+"\t"STUB_ASM_CODE("775")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1fvNV))"\n"
-"\t"STUB_ASM_CODE("756")"\n"
+"\t"STUB_ASM_CODE("776")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1sNV))"\n"
-"\t"STUB_ASM_CODE("757")"\n"
+"\t"STUB_ASM_CODE("777")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1svNV))"\n"
-"\t"STUB_ASM_CODE("758")"\n"
+"\t"STUB_ASM_CODE("778")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2dNV))"\n"
-"\t"STUB_ASM_CODE("759")"\n"
+"\t"STUB_ASM_CODE("779")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2dvNV))"\n"
-"\t"STUB_ASM_CODE("760")"\n"
+"\t"STUB_ASM_CODE("780")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2fNV))"\n"
-"\t"STUB_ASM_CODE("761")"\n"
+"\t"STUB_ASM_CODE("781")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2fvNV))"\n"
-"\t"STUB_ASM_CODE("762")"\n"
+"\t"STUB_ASM_CODE("782")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2sNV))"\n"
-"\t"STUB_ASM_CODE("763")"\n"
+"\t"STUB_ASM_CODE("783")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2svNV))"\n"
-"\t"STUB_ASM_CODE("764")"\n"
+"\t"STUB_ASM_CODE("784")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3dNV))"\n"
-"\t"STUB_ASM_CODE("765")"\n"
+"\t"STUB_ASM_CODE("785")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3dvNV))"\n"
-"\t"STUB_ASM_CODE("766")"\n"
+"\t"STUB_ASM_CODE("786")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3fNV))"\n"
-"\t"STUB_ASM_CODE("767")"\n"
+"\t"STUB_ASM_CODE("787")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3fvNV))"\n"
-"\t"STUB_ASM_CODE("768")"\n"
+"\t"STUB_ASM_CODE("788")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3sNV))"\n"
-"\t"STUB_ASM_CODE("769")"\n"
+"\t"STUB_ASM_CODE("789")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3svNV))"\n"
-"\t"STUB_ASM_CODE("770")"\n"
+"\t"STUB_ASM_CODE("790")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4dNV))"\n"
-"\t"STUB_ASM_CODE("771")"\n"
+"\t"STUB_ASM_CODE("791")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4dvNV))"\n"
-"\t"STUB_ASM_CODE("772")"\n"
+"\t"STUB_ASM_CODE("792")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4fNV))"\n"
-"\t"STUB_ASM_CODE("773")"\n"
+"\t"STUB_ASM_CODE("793")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4fvNV))"\n"
-"\t"STUB_ASM_CODE("774")"\n"
+"\t"STUB_ASM_CODE("794")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4sNV))"\n"
-"\t"STUB_ASM_CODE("775")"\n"
+"\t"STUB_ASM_CODE("795")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4svNV))"\n"
-"\t"STUB_ASM_CODE("776")"\n"
+"\t"STUB_ASM_CODE("796")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4ubNV))"\n"
-"\t"STUB_ASM_CODE("777")"\n"
+"\t"STUB_ASM_CODE("797")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4ubvNV))"\n"
-"\t"STUB_ASM_CODE("778")"\n"
+"\t"STUB_ASM_CODE("798")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribPointerNV))"\n"
-"\t"STUB_ASM_CODE("779")"\n"
+"\t"STUB_ASM_CODE("799")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs1dvNV))"\n"
-"\t"STUB_ASM_CODE("780")"\n"
+"\t"STUB_ASM_CODE("800")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs1fvNV))"\n"
-"\t"STUB_ASM_CODE("781")"\n"
+"\t"STUB_ASM_CODE("801")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs1svNV))"\n"
-"\t"STUB_ASM_CODE("782")"\n"
+"\t"STUB_ASM_CODE("802")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs2dvNV))"\n"
-"\t"STUB_ASM_CODE("783")"\n"
+"\t"STUB_ASM_CODE("803")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs2fvNV))"\n"
-"\t"STUB_ASM_CODE("784")"\n"
+"\t"STUB_ASM_CODE("804")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs2svNV))"\n"
-"\t"STUB_ASM_CODE("785")"\n"
+"\t"STUB_ASM_CODE("805")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs3dvNV))"\n"
-"\t"STUB_ASM_CODE("786")"\n"
+"\t"STUB_ASM_CODE("806")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs3fvNV))"\n"
-"\t"STUB_ASM_CODE("787")"\n"
+"\t"STUB_ASM_CODE("807")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs3svNV))"\n"
-"\t"STUB_ASM_CODE("788")"\n"
+"\t"STUB_ASM_CODE("808")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4dvNV))"\n"
-"\t"STUB_ASM_CODE("789")"\n"
+"\t"STUB_ASM_CODE("809")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4fvNV))"\n"
-"\t"STUB_ASM_CODE("790")"\n"
+"\t"STUB_ASM_CODE("810")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4svNV))"\n"
-"\t"STUB_ASM_CODE("791")"\n"
+"\t"STUB_ASM_CODE("811")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4ubvNV))"\n"
-"\t"STUB_ASM_CODE("792")"\n"
+"\t"STUB_ASM_CODE("812")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexBumpParameterfvATI))"\n"
-"\t"STUB_ASM_CODE("793")"\n"
+"\t"STUB_ASM_CODE("813")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexBumpParameterivATI))"\n"
-"\t"STUB_ASM_CODE("794")"\n"
+"\t"STUB_ASM_CODE("814")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexBumpParameterfvATI))"\n"
-"\t"STUB_ASM_CODE("795")"\n"
+"\t"STUB_ASM_CODE("815")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexBumpParameterivATI))"\n"
-"\t"STUB_ASM_CODE("796")"\n"
+"\t"STUB_ASM_CODE("816")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AlphaFragmentOp1ATI))"\n"
-"\t"STUB_ASM_CODE("797")"\n"
+"\t"STUB_ASM_CODE("817")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AlphaFragmentOp2ATI))"\n"
-"\t"STUB_ASM_CODE("798")"\n"
+"\t"STUB_ASM_CODE("818")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AlphaFragmentOp3ATI))"\n"
-"\t"STUB_ASM_CODE("799")"\n"
+"\t"STUB_ASM_CODE("819")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BeginFragmentShaderATI))"\n"
-"\t"STUB_ASM_CODE("800")"\n"
+"\t"STUB_ASM_CODE("820")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindFragmentShaderATI))"\n"
-"\t"STUB_ASM_CODE("801")"\n"
+"\t"STUB_ASM_CODE("821")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorFragmentOp1ATI))"\n"
-"\t"STUB_ASM_CODE("802")"\n"
+"\t"STUB_ASM_CODE("822")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorFragmentOp2ATI))"\n"
-"\t"STUB_ASM_CODE("803")"\n"
+"\t"STUB_ASM_CODE("823")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorFragmentOp3ATI))"\n"
-"\t"STUB_ASM_CODE("804")"\n"
+"\t"STUB_ASM_CODE("824")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteFragmentShaderATI))"\n"
-"\t"STUB_ASM_CODE("805")"\n"
+"\t"STUB_ASM_CODE("825")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndFragmentShaderATI))"\n"
-"\t"STUB_ASM_CODE("806")"\n"
+"\t"STUB_ASM_CODE("826")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenFragmentShadersATI))"\n"
-"\t"STUB_ASM_CODE("807")"\n"
+"\t"STUB_ASM_CODE("827")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PassTexCoordATI))"\n"
-"\t"STUB_ASM_CODE("808")"\n"
+"\t"STUB_ASM_CODE("828")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SampleMapATI))"\n"
-"\t"STUB_ASM_CODE("809")"\n"
+"\t"STUB_ASM_CODE("829")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SetFragmentShaderConstantATI))"\n"
-"\t"STUB_ASM_CODE("810")"\n"
+"\t"STUB_ASM_CODE("830")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameteriNV))"\n"
-"\t"STUB_ASM_CODE("811")"\n"
+"\t"STUB_ASM_CODE("831")"\n"
 
 ".globl "GLAPI_PREFIX_STR(PointParameteri)"\n"
 ".set "GLAPI_PREFIX_STR(PointParameteri)", "GLAPI_PREFIX_STR(PointParameteriNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterivNV))"\n"
-"\t"STUB_ASM_CODE("812")"\n"
+"\t"STUB_ASM_CODE("832")"\n"
 
 ".globl "GLAPI_PREFIX_STR(PointParameteriv)"\n"
 ".set "GLAPI_PREFIX_STR(PointParameteriv)", "GLAPI_PREFIX_STR(PointParameterivNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteVertexArrays))"\n"
-"\t"STUB_ASM_CODE("815")"\n"
+"\t"STUB_ASM_CODE("835")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsVertexArray))"\n"
-"\t"STUB_ASM_CODE("817")"\n"
+"\t"STUB_ASM_CODE("837")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramNamedParameterdvNV))"\n"
-"\t"STUB_ASM_CODE("818")"\n"
+"\t"STUB_ASM_CODE("838")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramNamedParameterfvNV))"\n"
-"\t"STUB_ASM_CODE("819")"\n"
+"\t"STUB_ASM_CODE("839")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4dNV))"\n"
-"\t"STUB_ASM_CODE("820")"\n"
+"\t"STUB_ASM_CODE("840")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4dvNV))"\n"
-"\t"STUB_ASM_CODE("821")"\n"
+"\t"STUB_ASM_CODE("841")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4fNV))"\n"
-"\t"STUB_ASM_CODE("822")"\n"
+"\t"STUB_ASM_CODE("842")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4fvNV))"\n"
-"\t"STUB_ASM_CODE("823")"\n"
+"\t"STUB_ASM_CODE("843")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PrimitiveRestartIndexNV))"\n"
-"\t"STUB_ASM_CODE("824")"\n"
+"\t"STUB_ASM_CODE("844")"\n"
 
 ".globl "GLAPI_PREFIX_STR(PrimitiveRestartIndex)"\n"
 ".set "GLAPI_PREFIX_STR(PrimitiveRestartIndex)", "GLAPI_PREFIX_STR(PrimitiveRestartIndexNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PrimitiveRestartNV))"\n"
-"\t"STUB_ASM_CODE("825")"\n"
+"\t"STUB_ASM_CODE("845")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendEquationSeparate))"\n"
-"\t"STUB_ASM_CODE("873")"\n"
+"\t"STUB_ASM_CODE("893")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindFramebufferEXT))"\n"
-"\t"STUB_ASM_CODE("874")"\n"
+"\t"STUB_ASM_CODE("894")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BindFramebuffer)"\n"
 ".set "GLAPI_PREFIX_STR(BindFramebuffer)", "GLAPI_PREFIX_STR(BindFramebufferEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindRenderbufferEXT))"\n"
-"\t"STUB_ASM_CODE("875")"\n"
+"\t"STUB_ASM_CODE("895")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BindRenderbuffer)"\n"
 ".set "GLAPI_PREFIX_STR(BindRenderbuffer)", "GLAPI_PREFIX_STR(BindRenderbufferEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CheckFramebufferStatusEXT))"\n"
-"\t"STUB_ASM_CODE("876")"\n"
+"\t"STUB_ASM_CODE("896")"\n"
 
 ".globl "GLAPI_PREFIX_STR(CheckFramebufferStatus)"\n"
 ".set "GLAPI_PREFIX_STR(CheckFramebufferStatus)", "GLAPI_PREFIX_STR(CheckFramebufferStatusEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteFramebuffersEXT))"\n"
-"\t"STUB_ASM_CODE("877")"\n"
+"\t"STUB_ASM_CODE("897")"\n"
 
 ".globl "GLAPI_PREFIX_STR(DeleteFramebuffers)"\n"
 ".set "GLAPI_PREFIX_STR(DeleteFramebuffers)", "GLAPI_PREFIX_STR(DeleteFramebuffersEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteRenderbuffersEXT))"\n"
-"\t"STUB_ASM_CODE("878")"\n"
+"\t"STUB_ASM_CODE("898")"\n"
 
 ".globl "GLAPI_PREFIX_STR(DeleteRenderbuffers)"\n"
 ".set "GLAPI_PREFIX_STR(DeleteRenderbuffers)", "GLAPI_PREFIX_STR(DeleteRenderbuffersEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferRenderbufferEXT))"\n"
-"\t"STUB_ASM_CODE("879")"\n"
+"\t"STUB_ASM_CODE("899")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FramebufferRenderbuffer)"\n"
 ".set "GLAPI_PREFIX_STR(FramebufferRenderbuffer)", "GLAPI_PREFIX_STR(FramebufferRenderbufferEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTexture1DEXT))"\n"
-"\t"STUB_ASM_CODE("880")"\n"
+"\t"STUB_ASM_CODE("900")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FramebufferTexture1D)"\n"
 ".set "GLAPI_PREFIX_STR(FramebufferTexture1D)", "GLAPI_PREFIX_STR(FramebufferTexture1DEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTexture2DEXT))"\n"
-"\t"STUB_ASM_CODE("881")"\n"
+"\t"STUB_ASM_CODE("901")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FramebufferTexture2D)"\n"
 ".set "GLAPI_PREFIX_STR(FramebufferTexture2D)", "GLAPI_PREFIX_STR(FramebufferTexture2DEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTexture3DEXT))"\n"
-"\t"STUB_ASM_CODE("882")"\n"
+"\t"STUB_ASM_CODE("902")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FramebufferTexture3D)"\n"
 ".set "GLAPI_PREFIX_STR(FramebufferTexture3D)", "GLAPI_PREFIX_STR(FramebufferTexture3DEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenFramebuffersEXT))"\n"
-"\t"STUB_ASM_CODE("883")"\n"
+"\t"STUB_ASM_CODE("903")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GenFramebuffers)"\n"
 ".set "GLAPI_PREFIX_STR(GenFramebuffers)", "GLAPI_PREFIX_STR(GenFramebuffersEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenRenderbuffersEXT))"\n"
-"\t"STUB_ASM_CODE("884")"\n"
+"\t"STUB_ASM_CODE("904")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GenRenderbuffers)"\n"
 ".set "GLAPI_PREFIX_STR(GenRenderbuffers)", "GLAPI_PREFIX_STR(GenRenderbuffersEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenerateMipmapEXT))"\n"
-"\t"STUB_ASM_CODE("885")"\n"
+"\t"STUB_ASM_CODE("905")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GenerateMipmap)"\n"
 ".set "GLAPI_PREFIX_STR(GenerateMipmap)", "GLAPI_PREFIX_STR(GenerateMipmapEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFramebufferAttachmentParameterivEXT))"\n"
-"\t"STUB_ASM_CODE("886")"\n"
+"\t"STUB_ASM_CODE("906")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetFramebufferAttachmentParameteriv)"\n"
 ".set "GLAPI_PREFIX_STR(GetFramebufferAttachmentParameteriv)", "GLAPI_PREFIX_STR(GetFramebufferAttachmentParameterivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetRenderbufferParameterivEXT))"\n"
-"\t"STUB_ASM_CODE("887")"\n"
+"\t"STUB_ASM_CODE("907")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetRenderbufferParameteriv)"\n"
 ".set "GLAPI_PREFIX_STR(GetRenderbufferParameteriv)", "GLAPI_PREFIX_STR(GetRenderbufferParameterivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsFramebufferEXT))"\n"
-"\t"STUB_ASM_CODE("888")"\n"
+"\t"STUB_ASM_CODE("908")"\n"
 
 ".globl "GLAPI_PREFIX_STR(IsFramebuffer)"\n"
 ".set "GLAPI_PREFIX_STR(IsFramebuffer)", "GLAPI_PREFIX_STR(IsFramebufferEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsRenderbufferEXT))"\n"
-"\t"STUB_ASM_CODE("889")"\n"
+"\t"STUB_ASM_CODE("909")"\n"
 
 ".globl "GLAPI_PREFIX_STR(IsRenderbuffer)"\n"
 ".set "GLAPI_PREFIX_STR(IsRenderbuffer)", "GLAPI_PREFIX_STR(IsRenderbufferEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RenderbufferStorageEXT))"\n"
-"\t"STUB_ASM_CODE("890")"\n"
+"\t"STUB_ASM_CODE("910")"\n"
 
 ".globl "GLAPI_PREFIX_STR(RenderbufferStorage)"\n"
 ".set "GLAPI_PREFIX_STR(RenderbufferStorage)", "GLAPI_PREFIX_STR(RenderbufferStorageEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlitFramebuffer))"\n"
-"\t"STUB_ASM_CODE("891")"\n"
+"\t"STUB_ASM_CODE("911")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindFragDataLocationEXT))"\n"
-"\t"STUB_ASM_CODE("894")"\n"
+"\t"STUB_ASM_CODE("914")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BindFragDataLocation)"\n"
 ".set "GLAPI_PREFIX_STR(BindFragDataLocation)", "GLAPI_PREFIX_STR(BindFragDataLocationEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFragDataLocationEXT))"\n"
-"\t"STUB_ASM_CODE("895")"\n"
+"\t"STUB_ASM_CODE("915")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetFragDataLocation)"\n"
 ".set "GLAPI_PREFIX_STR(GetFragDataLocation)", "GLAPI_PREFIX_STR(GetFragDataLocationEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetUniformuivEXT))"\n"
-"\t"STUB_ASM_CODE("896")"\n"
+"\t"STUB_ASM_CODE("916")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetUniformuiv)"\n"
 ".set "GLAPI_PREFIX_STR(GetUniformuiv)", "GLAPI_PREFIX_STR(GetUniformuivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribIivEXT))"\n"
-"\t"STUB_ASM_CODE("897")"\n"
+"\t"STUB_ASM_CODE("917")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetVertexAttribIiv)"\n"
 ".set "GLAPI_PREFIX_STR(GetVertexAttribIiv)", "GLAPI_PREFIX_STR(GetVertexAttribIivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribIuivEXT))"\n"
-"\t"STUB_ASM_CODE("898")"\n"
+"\t"STUB_ASM_CODE("918")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetVertexAttribIuiv)"\n"
 ".set "GLAPI_PREFIX_STR(GetVertexAttribIuiv)", "GLAPI_PREFIX_STR(GetVertexAttribIuivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1uiEXT))"\n"
-"\t"STUB_ASM_CODE("899")"\n"
+"\t"STUB_ASM_CODE("919")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform1ui)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform1ui)", "GLAPI_PREFIX_STR(Uniform1uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1uivEXT))"\n"
-"\t"STUB_ASM_CODE("900")"\n"
+"\t"STUB_ASM_CODE("920")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform1uiv)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform1uiv)", "GLAPI_PREFIX_STR(Uniform1uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2uiEXT))"\n"
-"\t"STUB_ASM_CODE("901")"\n"
+"\t"STUB_ASM_CODE("921")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform2ui)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform2ui)", "GLAPI_PREFIX_STR(Uniform2uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2uivEXT))"\n"
-"\t"STUB_ASM_CODE("902")"\n"
+"\t"STUB_ASM_CODE("922")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform2uiv)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform2uiv)", "GLAPI_PREFIX_STR(Uniform2uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3uiEXT))"\n"
-"\t"STUB_ASM_CODE("903")"\n"
+"\t"STUB_ASM_CODE("923")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform3ui)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform3ui)", "GLAPI_PREFIX_STR(Uniform3uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3uivEXT))"\n"
-"\t"STUB_ASM_CODE("904")"\n"
+"\t"STUB_ASM_CODE("924")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform3uiv)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform3uiv)", "GLAPI_PREFIX_STR(Uniform3uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4uiEXT))"\n"
-"\t"STUB_ASM_CODE("905")"\n"
+"\t"STUB_ASM_CODE("925")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform4ui)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform4ui)", "GLAPI_PREFIX_STR(Uniform4uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4uivEXT))"\n"
-"\t"STUB_ASM_CODE("906")"\n"
+"\t"STUB_ASM_CODE("926")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Uniform4uiv)"\n"
 ".set "GLAPI_PREFIX_STR(Uniform4uiv)", "GLAPI_PREFIX_STR(Uniform4uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1iEXT))"\n"
-"\t"STUB_ASM_CODE("907")"\n"
+"\t"STUB_ASM_CODE("927")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI1i)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI1i)", "GLAPI_PREFIX_STR(VertexAttribI1iEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1ivEXT))"\n"
-"\t"STUB_ASM_CODE("908")"\n"
+"\t"STUB_ASM_CODE("928")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI1iv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI1iv)", "GLAPI_PREFIX_STR(VertexAttribI1ivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1uiEXT))"\n"
-"\t"STUB_ASM_CODE("909")"\n"
+"\t"STUB_ASM_CODE("929")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI1ui)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI1ui)", "GLAPI_PREFIX_STR(VertexAttribI1uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1uivEXT))"\n"
-"\t"STUB_ASM_CODE("910")"\n"
+"\t"STUB_ASM_CODE("930")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI1uiv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI1uiv)", "GLAPI_PREFIX_STR(VertexAttribI1uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2iEXT))"\n"
-"\t"STUB_ASM_CODE("911")"\n"
+"\t"STUB_ASM_CODE("931")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI2i)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI2i)", "GLAPI_PREFIX_STR(VertexAttribI2iEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2ivEXT))"\n"
-"\t"STUB_ASM_CODE("912")"\n"
+"\t"STUB_ASM_CODE("932")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI2iv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI2iv)", "GLAPI_PREFIX_STR(VertexAttribI2ivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2uiEXT))"\n"
-"\t"STUB_ASM_CODE("913")"\n"
+"\t"STUB_ASM_CODE("933")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI2ui)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI2ui)", "GLAPI_PREFIX_STR(VertexAttribI2uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2uivEXT))"\n"
-"\t"STUB_ASM_CODE("914")"\n"
+"\t"STUB_ASM_CODE("934")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI2uiv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI2uiv)", "GLAPI_PREFIX_STR(VertexAttribI2uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3iEXT))"\n"
-"\t"STUB_ASM_CODE("915")"\n"
+"\t"STUB_ASM_CODE("935")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI3i)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI3i)", "GLAPI_PREFIX_STR(VertexAttribI3iEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3ivEXT))"\n"
-"\t"STUB_ASM_CODE("916")"\n"
+"\t"STUB_ASM_CODE("936")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI3iv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI3iv)", "GLAPI_PREFIX_STR(VertexAttribI3ivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3uiEXT))"\n"
-"\t"STUB_ASM_CODE("917")"\n"
+"\t"STUB_ASM_CODE("937")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI3ui)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI3ui)", "GLAPI_PREFIX_STR(VertexAttribI3uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3uivEXT))"\n"
-"\t"STUB_ASM_CODE("918")"\n"
+"\t"STUB_ASM_CODE("938")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI3uiv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI3uiv)", "GLAPI_PREFIX_STR(VertexAttribI3uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4bvEXT))"\n"
-"\t"STUB_ASM_CODE("919")"\n"
+"\t"STUB_ASM_CODE("939")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4bv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4bv)", "GLAPI_PREFIX_STR(VertexAttribI4bvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4iEXT))"\n"
-"\t"STUB_ASM_CODE("920")"\n"
+"\t"STUB_ASM_CODE("940")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4i)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4i)", "GLAPI_PREFIX_STR(VertexAttribI4iEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4ivEXT))"\n"
-"\t"STUB_ASM_CODE("921")"\n"
+"\t"STUB_ASM_CODE("941")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4iv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4iv)", "GLAPI_PREFIX_STR(VertexAttribI4ivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4svEXT))"\n"
-"\t"STUB_ASM_CODE("922")"\n"
+"\t"STUB_ASM_CODE("942")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4sv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4sv)", "GLAPI_PREFIX_STR(VertexAttribI4svEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4ubvEXT))"\n"
-"\t"STUB_ASM_CODE("923")"\n"
+"\t"STUB_ASM_CODE("943")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4ubv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4ubv)", "GLAPI_PREFIX_STR(VertexAttribI4ubvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4uiEXT))"\n"
-"\t"STUB_ASM_CODE("924")"\n"
+"\t"STUB_ASM_CODE("944")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4ui)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4ui)", "GLAPI_PREFIX_STR(VertexAttribI4uiEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4uivEXT))"\n"
-"\t"STUB_ASM_CODE("925")"\n"
+"\t"STUB_ASM_CODE("945")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4uiv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4uiv)", "GLAPI_PREFIX_STR(VertexAttribI4uivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4usvEXT))"\n"
-"\t"STUB_ASM_CODE("926")"\n"
+"\t"STUB_ASM_CODE("946")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribI4usv)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribI4usv)", "GLAPI_PREFIX_STR(VertexAttribI4usvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribIPointerEXT))"\n"
-"\t"STUB_ASM_CODE("927")"\n"
+"\t"STUB_ASM_CODE("947")"\n"
 
 ".globl "GLAPI_PREFIX_STR(VertexAttribIPointer)"\n"
 ".set "GLAPI_PREFIX_STR(VertexAttribIPointer)", "GLAPI_PREFIX_STR(VertexAttribIPointerEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTextureLayerEXT))"\n"
-"\t"STUB_ASM_CODE("928")"\n"
+"\t"STUB_ASM_CODE("948")"\n"
 
 ".globl "GLAPI_PREFIX_STR(FramebufferTextureLayer)"\n"
 ".set "GLAPI_PREFIX_STR(FramebufferTextureLayer)", "GLAPI_PREFIX_STR(FramebufferTextureLayerEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorMaskIndexedEXT))"\n"
-"\t"STUB_ASM_CODE("929")"\n"
+"\t"STUB_ASM_CODE("949")"\n"
 
 ".globl "GLAPI_PREFIX_STR(ColorMaski)"\n"
 ".set "GLAPI_PREFIX_STR(ColorMaski)", "GLAPI_PREFIX_STR(ColorMaskIndexedEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DisableIndexedEXT))"\n"
-"\t"STUB_ASM_CODE("930")"\n"
+"\t"STUB_ASM_CODE("950")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Disablei)"\n"
 ".set "GLAPI_PREFIX_STR(Disablei)", "GLAPI_PREFIX_STR(DisableIndexedEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EnableIndexedEXT))"\n"
-"\t"STUB_ASM_CODE("931")"\n"
+"\t"STUB_ASM_CODE("951")"\n"
 
 ".globl "GLAPI_PREFIX_STR(Enablei)"\n"
 ".set "GLAPI_PREFIX_STR(Enablei)", "GLAPI_PREFIX_STR(EnableIndexedEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetBooleanIndexedvEXT))"\n"
-"\t"STUB_ASM_CODE("932")"\n"
+"\t"STUB_ASM_CODE("952")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetBooleani_v)"\n"
 ".set "GLAPI_PREFIX_STR(GetBooleani_v)", "GLAPI_PREFIX_STR(GetBooleanIndexedvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetIntegerIndexedvEXT))"\n"
-"\t"STUB_ASM_CODE("933")"\n"
+"\t"STUB_ASM_CODE("953")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetIntegeri_v)"\n"
 ".set "GLAPI_PREFIX_STR(GetIntegeri_v)", "GLAPI_PREFIX_STR(GetIntegerIndexedvEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsEnabledIndexedEXT))"\n"
-"\t"STUB_ASM_CODE("934")"\n"
+"\t"STUB_ASM_CODE("954")"\n"
 
 ".globl "GLAPI_PREFIX_STR(IsEnabledi)"\n"
 ".set "GLAPI_PREFIX_STR(IsEnabledi)", "GLAPI_PREFIX_STR(IsEnabledIndexedEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearColorIiEXT))"\n"
-"\t"STUB_ASM_CODE("935")"\n"
+"\t"STUB_ASM_CODE("955")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearColorIuiEXT))"\n"
-"\t"STUB_ASM_CODE("936")"\n"
+"\t"STUB_ASM_CODE("956")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexParameterIivEXT))"\n"
-"\t"STUB_ASM_CODE("937")"\n"
+"\t"STUB_ASM_CODE("957")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetTexParameterIiv)"\n"
 ".set "GLAPI_PREFIX_STR(GetTexParameterIiv)", "GLAPI_PREFIX_STR(GetTexParameterIivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexParameterIuivEXT))"\n"
-"\t"STUB_ASM_CODE("938")"\n"
+"\t"STUB_ASM_CODE("958")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetTexParameterIuiv)"\n"
 ".set "GLAPI_PREFIX_STR(GetTexParameterIuiv)", "GLAPI_PREFIX_STR(GetTexParameterIuivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameterIivEXT))"\n"
-"\t"STUB_ASM_CODE("939")"\n"
+"\t"STUB_ASM_CODE("959")"\n"
 
 ".globl "GLAPI_PREFIX_STR(TexParameterIiv)"\n"
 ".set "GLAPI_PREFIX_STR(TexParameterIiv)", "GLAPI_PREFIX_STR(TexParameterIivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameterIuivEXT))"\n"
-"\t"STUB_ASM_CODE("940")"\n"
+"\t"STUB_ASM_CODE("960")"\n"
 
 ".globl "GLAPI_PREFIX_STR(TexParameterIuiv)"\n"
 ".set "GLAPI_PREFIX_STR(TexParameterIuiv)", "GLAPI_PREFIX_STR(TexParameterIuivEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BeginConditionalRenderNV))"\n"
-"\t"STUB_ASM_CODE("941")"\n"
+"\t"STUB_ASM_CODE("961")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BeginConditionalRender)"\n"
 ".set "GLAPI_PREFIX_STR(BeginConditionalRender)", "GLAPI_PREFIX_STR(BeginConditionalRenderNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndConditionalRenderNV))"\n"
-"\t"STUB_ASM_CODE("942")"\n"
+"\t"STUB_ASM_CODE("962")"\n"
 
 ".globl "GLAPI_PREFIX_STR(EndConditionalRender)"\n"
 ".set "GLAPI_PREFIX_STR(EndConditionalRender)", "GLAPI_PREFIX_STR(EndConditionalRenderNV)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BeginTransformFeedbackEXT))"\n"
-"\t"STUB_ASM_CODE("943")"\n"
+"\t"STUB_ASM_CODE("963")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BeginTransformFeedback)"\n"
 ".set "GLAPI_PREFIX_STR(BeginTransformFeedback)", "GLAPI_PREFIX_STR(BeginTransformFeedbackEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindBufferBaseEXT))"\n"
-"\t"STUB_ASM_CODE("944")"\n"
+"\t"STUB_ASM_CODE("964")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BindBufferBase)"\n"
 ".set "GLAPI_PREFIX_STR(BindBufferBase)", "GLAPI_PREFIX_STR(BindBufferBaseEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindBufferOffsetEXT))"\n"
-"\t"STUB_ASM_CODE("945")"\n"
+"\t"STUB_ASM_CODE("965")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindBufferRangeEXT))"\n"
-"\t"STUB_ASM_CODE("946")"\n"
+"\t"STUB_ASM_CODE("966")"\n"
 
 ".globl "GLAPI_PREFIX_STR(BindBufferRange)"\n"
 ".set "GLAPI_PREFIX_STR(BindBufferRange)", "GLAPI_PREFIX_STR(BindBufferRangeEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndTransformFeedbackEXT))"\n"
-"\t"STUB_ASM_CODE("947")"\n"
+"\t"STUB_ASM_CODE("967")"\n"
 
 ".globl "GLAPI_PREFIX_STR(EndTransformFeedback)"\n"
 ".set "GLAPI_PREFIX_STR(EndTransformFeedback)", "GLAPI_PREFIX_STR(EndTransformFeedbackEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTransformFeedbackVaryingEXT))"\n"
-"\t"STUB_ASM_CODE("948")"\n"
+"\t"STUB_ASM_CODE("968")"\n"
 
 ".globl "GLAPI_PREFIX_STR(GetTransformFeedbackVarying)"\n"
 ".set "GLAPI_PREFIX_STR(GetTransformFeedbackVarying)", "GLAPI_PREFIX_STR(GetTransformFeedbackVaryingEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TransformFeedbackVaryingsEXT))"\n"
-"\t"STUB_ASM_CODE("949")"\n"
+"\t"STUB_ASM_CODE("969")"\n"
 
 ".globl "GLAPI_PREFIX_STR(TransformFeedbackVaryings)"\n"
 ".set "GLAPI_PREFIX_STR(TransformFeedbackVaryings)", "GLAPI_PREFIX_STR(TransformFeedbackVaryingsEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProvokingVertexEXT))"\n"
-"\t"STUB_ASM_CODE("950")"\n"
+"\t"STUB_ASM_CODE("970")"\n"
 
 ".globl "GLAPI_PREFIX_STR(ProvokingVertex)"\n"
 ".set "GLAPI_PREFIX_STR(ProvokingVertex)", "GLAPI_PREFIX_STR(ProvokingVertexEXT)"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetObjectParameterivAPPLE))"\n"
-"\t"STUB_ASM_CODE("953")"\n"
+"\t"STUB_ASM_CODE("973")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ObjectPurgeableAPPLE))"\n"
-"\t"STUB_ASM_CODE("954")"\n"
+"\t"STUB_ASM_CODE("974")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ObjectUnpurgeableAPPLE))"\n"
-"\t"STUB_ASM_CODE("955")"\n"
+"\t"STUB_ASM_CODE("975")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ActiveProgramEXT))"\n"
-"\t"STUB_ASM_CODE("956")"\n"
+"\t"STUB_ASM_CODE("976")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CreateShaderProgramEXT))"\n"
-"\t"STUB_ASM_CODE("957")"\n"
+"\t"STUB_ASM_CODE("977")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UseShaderProgramEXT))"\n"
-"\t"STUB_ASM_CODE("958")"\n"
+"\t"STUB_ASM_CODE("978")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TextureBarrierNV))"\n"
-"\t"STUB_ASM_CODE("959")"\n"
+"\t"STUB_ASM_CODE("979")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EGLImageTargetRenderbufferStorageOES))"\n"
-"\t"STUB_ASM_CODE("965")"\n"
+"\t"STUB_ASM_CODE("985")"\n"
 
 STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EGLImageTargetTexture2DOES))"\n"
-"\t"STUB_ASM_CODE("966")"\n"
+"\t"STUB_ASM_CODE("986")"\n"
 
 );
 #undef MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
diff --git a/mesalib/src/mapi/glapi/glapi_sparc.S b/mesalib/src/mapi/glapi/glapi_sparc.S
index f62e1258b..cff25f8cc 100644
--- a/mesalib/src/mapi/glapi/glapi_sparc.S
+++ b/mesalib/src/mapi/glapi/glapi_sparc.S
@@ -821,323 +821,343 @@ gl_dispatch_functions_start:
 	GL_STUB(glGetShaderPrecisionFormat, 623)
 	GL_STUB(glReleaseShaderCompiler, 624)
 	GL_STUB(glShaderBinary, 625)
-	GL_STUB(glPolygonOffsetEXT, 626)
-	GL_STUB(gl_dispatch_stub_627, 627)
-	HIDDEN(gl_dispatch_stub_627)
-	GL_STUB(gl_dispatch_stub_628, 628)
-	HIDDEN(gl_dispatch_stub_628)
-	GL_STUB(gl_dispatch_stub_629, 629)
-	HIDDEN(gl_dispatch_stub_629)
-	GL_STUB(gl_dispatch_stub_630, 630)
-	HIDDEN(gl_dispatch_stub_630)
-	GL_STUB(gl_dispatch_stub_631, 631)
-	HIDDEN(gl_dispatch_stub_631)
-	GL_STUB(gl_dispatch_stub_632, 632)
-	HIDDEN(gl_dispatch_stub_632)
-	GL_STUB(gl_dispatch_stub_633, 633)
-	HIDDEN(gl_dispatch_stub_633)
-	GL_STUB(gl_dispatch_stub_634, 634)
-	HIDDEN(gl_dispatch_stub_634)
-	GL_STUB(glColorPointerEXT, 635)
-	GL_STUB(glEdgeFlagPointerEXT, 636)
-	GL_STUB(glIndexPointerEXT, 637)
-	GL_STUB(glNormalPointerEXT, 638)
-	GL_STUB(glTexCoordPointerEXT, 639)
-	GL_STUB(glVertexPointerEXT, 640)
-	GL_STUB(glPointParameterfEXT, 641)
-	GL_STUB(glPointParameterfvEXT, 642)
-	GL_STUB(glLockArraysEXT, 643)
-	GL_STUB(glUnlockArraysEXT, 644)
-	GL_STUB(glSecondaryColor3bEXT, 645)
-	GL_STUB(glSecondaryColor3bvEXT, 646)
-	GL_STUB(glSecondaryColor3dEXT, 647)
-	GL_STUB(glSecondaryColor3dvEXT, 648)
-	GL_STUB(glSecondaryColor3fEXT, 649)
-	GL_STUB(glSecondaryColor3fvEXT, 650)
-	GL_STUB(glSecondaryColor3iEXT, 651)
-	GL_STUB(glSecondaryColor3ivEXT, 652)
-	GL_STUB(glSecondaryColor3sEXT, 653)
-	GL_STUB(glSecondaryColor3svEXT, 654)
-	GL_STUB(glSecondaryColor3ubEXT, 655)
-	GL_STUB(glSecondaryColor3ubvEXT, 656)
-	GL_STUB(glSecondaryColor3uiEXT, 657)
-	GL_STUB(glSecondaryColor3uivEXT, 658)
-	GL_STUB(glSecondaryColor3usEXT, 659)
-	GL_STUB(glSecondaryColor3usvEXT, 660)
-	GL_STUB(glSecondaryColorPointerEXT, 661)
-	GL_STUB(glMultiDrawArraysEXT, 662)
-	GL_STUB(glMultiDrawElementsEXT, 663)
-	GL_STUB(glFogCoordPointerEXT, 664)
-	GL_STUB(glFogCoorddEXT, 665)
-	GL_STUB(glFogCoorddvEXT, 666)
-	GL_STUB(glFogCoordfEXT, 667)
-	GL_STUB(glFogCoordfvEXT, 668)
-	GL_STUB(gl_dispatch_stub_669, 669)
-	HIDDEN(gl_dispatch_stub_669)
-	GL_STUB(glBlendFuncSeparateEXT, 670)
-	GL_STUB(glFlushVertexArrayRangeNV, 671)
-	GL_STUB(glVertexArrayRangeNV, 672)
-	GL_STUB(glCombinerInputNV, 673)
-	GL_STUB(glCombinerOutputNV, 674)
-	GL_STUB(glCombinerParameterfNV, 675)
-	GL_STUB(glCombinerParameterfvNV, 676)
-	GL_STUB(glCombinerParameteriNV, 677)
-	GL_STUB(glCombinerParameterivNV, 678)
-	GL_STUB(glFinalCombinerInputNV, 679)
-	GL_STUB(glGetCombinerInputParameterfvNV, 680)
-	GL_STUB(glGetCombinerInputParameterivNV, 681)
-	GL_STUB(glGetCombinerOutputParameterfvNV, 682)
-	GL_STUB(glGetCombinerOutputParameterivNV, 683)
-	GL_STUB(glGetFinalCombinerInputParameterfvNV, 684)
-	GL_STUB(glGetFinalCombinerInputParameterivNV, 685)
-	GL_STUB(glResizeBuffersMESA, 686)
-	GL_STUB(glWindowPos2dMESA, 687)
-	GL_STUB(glWindowPos2dvMESA, 688)
-	GL_STUB(glWindowPos2fMESA, 689)
-	GL_STUB(glWindowPos2fvMESA, 690)
-	GL_STUB(glWindowPos2iMESA, 691)
-	GL_STUB(glWindowPos2ivMESA, 692)
-	GL_STUB(glWindowPos2sMESA, 693)
-	GL_STUB(glWindowPos2svMESA, 694)
-	GL_STUB(glWindowPos3dMESA, 695)
-	GL_STUB(glWindowPos3dvMESA, 696)
-	GL_STUB(glWindowPos3fMESA, 697)
-	GL_STUB(glWindowPos3fvMESA, 698)
-	GL_STUB(glWindowPos3iMESA, 699)
-	GL_STUB(glWindowPos3ivMESA, 700)
-	GL_STUB(glWindowPos3sMESA, 701)
-	GL_STUB(glWindowPos3svMESA, 702)
-	GL_STUB(glWindowPos4dMESA, 703)
-	GL_STUB(glWindowPos4dvMESA, 704)
-	GL_STUB(glWindowPos4fMESA, 705)
-	GL_STUB(glWindowPos4fvMESA, 706)
-	GL_STUB(glWindowPos4iMESA, 707)
-	GL_STUB(glWindowPos4ivMESA, 708)
-	GL_STUB(glWindowPos4sMESA, 709)
-	GL_STUB(glWindowPos4svMESA, 710)
-	GL_STUB(gl_dispatch_stub_711, 711)
-	HIDDEN(gl_dispatch_stub_711)
-	GL_STUB(gl_dispatch_stub_712, 712)
-	HIDDEN(gl_dispatch_stub_712)
-	GL_STUB(gl_dispatch_stub_713, 713)
-	HIDDEN(gl_dispatch_stub_713)
-	GL_STUB(gl_dispatch_stub_714, 714)
-	HIDDEN(gl_dispatch_stub_714)
-	GL_STUB(gl_dispatch_stub_715, 715)
-	HIDDEN(gl_dispatch_stub_715)
-	GL_STUB(gl_dispatch_stub_716, 716)
-	HIDDEN(gl_dispatch_stub_716)
-	GL_STUB(gl_dispatch_stub_717, 717)
-	HIDDEN(gl_dispatch_stub_717)
-	GL_STUB(gl_dispatch_stub_718, 718)
-	HIDDEN(gl_dispatch_stub_718)
-	GL_STUB(gl_dispatch_stub_719, 719)
-	HIDDEN(gl_dispatch_stub_719)
-	GL_STUB(glAreProgramsResidentNV, 720)
-	GL_STUB(glBindProgramNV, 721)
-	GL_STUB(glDeleteProgramsNV, 722)
-	GL_STUB(glExecuteProgramNV, 723)
-	GL_STUB(glGenProgramsNV, 724)
-	GL_STUB(glGetProgramParameterdvNV, 725)
-	GL_STUB(glGetProgramParameterfvNV, 726)
-	GL_STUB(glGetProgramStringNV, 727)
-	GL_STUB(glGetProgramivNV, 728)
-	GL_STUB(glGetTrackMatrixivNV, 729)
-	GL_STUB(glGetVertexAttribPointervNV, 730)
-	GL_STUB(glGetVertexAttribdvNV, 731)
-	GL_STUB(glGetVertexAttribfvNV, 732)
-	GL_STUB(glGetVertexAttribivNV, 733)
-	GL_STUB(glIsProgramNV, 734)
-	GL_STUB(glLoadProgramNV, 735)
-	GL_STUB(glProgramParameters4dvNV, 736)
-	GL_STUB(glProgramParameters4fvNV, 737)
-	GL_STUB(glRequestResidentProgramsNV, 738)
-	GL_STUB(glTrackMatrixNV, 739)
-	GL_STUB(glVertexAttrib1dNV, 740)
-	GL_STUB(glVertexAttrib1dvNV, 741)
-	GL_STUB(glVertexAttrib1fNV, 742)
-	GL_STUB(glVertexAttrib1fvNV, 743)
-	GL_STUB(glVertexAttrib1sNV, 744)
-	GL_STUB(glVertexAttrib1svNV, 745)
-	GL_STUB(glVertexAttrib2dNV, 746)
-	GL_STUB(glVertexAttrib2dvNV, 747)
-	GL_STUB(glVertexAttrib2fNV, 748)
-	GL_STUB(glVertexAttrib2fvNV, 749)
-	GL_STUB(glVertexAttrib2sNV, 750)
-	GL_STUB(glVertexAttrib2svNV, 751)
-	GL_STUB(glVertexAttrib3dNV, 752)
-	GL_STUB(glVertexAttrib3dvNV, 753)
-	GL_STUB(glVertexAttrib3fNV, 754)
-	GL_STUB(glVertexAttrib3fvNV, 755)
-	GL_STUB(glVertexAttrib3sNV, 756)
-	GL_STUB(glVertexAttrib3svNV, 757)
-	GL_STUB(glVertexAttrib4dNV, 758)
-	GL_STUB(glVertexAttrib4dvNV, 759)
-	GL_STUB(glVertexAttrib4fNV, 760)
-	GL_STUB(glVertexAttrib4fvNV, 761)
-	GL_STUB(glVertexAttrib4sNV, 762)
-	GL_STUB(glVertexAttrib4svNV, 763)
-	GL_STUB(glVertexAttrib4ubNV, 764)
-	GL_STUB(glVertexAttrib4ubvNV, 765)
-	GL_STUB(glVertexAttribPointerNV, 766)
-	GL_STUB(glVertexAttribs1dvNV, 767)
-	GL_STUB(glVertexAttribs1fvNV, 768)
-	GL_STUB(glVertexAttribs1svNV, 769)
-	GL_STUB(glVertexAttribs2dvNV, 770)
-	GL_STUB(glVertexAttribs2fvNV, 771)
-	GL_STUB(glVertexAttribs2svNV, 772)
-	GL_STUB(glVertexAttribs3dvNV, 773)
-	GL_STUB(glVertexAttribs3fvNV, 774)
-	GL_STUB(glVertexAttribs3svNV, 775)
-	GL_STUB(glVertexAttribs4dvNV, 776)
-	GL_STUB(glVertexAttribs4fvNV, 777)
-	GL_STUB(glVertexAttribs4svNV, 778)
-	GL_STUB(glVertexAttribs4ubvNV, 779)
-	GL_STUB(glGetTexBumpParameterfvATI, 780)
-	GL_STUB(glGetTexBumpParameterivATI, 781)
-	GL_STUB(glTexBumpParameterfvATI, 782)
-	GL_STUB(glTexBumpParameterivATI, 783)
-	GL_STUB(glAlphaFragmentOp1ATI, 784)
-	GL_STUB(glAlphaFragmentOp2ATI, 785)
-	GL_STUB(glAlphaFragmentOp3ATI, 786)
-	GL_STUB(glBeginFragmentShaderATI, 787)
-	GL_STUB(glBindFragmentShaderATI, 788)
-	GL_STUB(glColorFragmentOp1ATI, 789)
-	GL_STUB(glColorFragmentOp2ATI, 790)
-	GL_STUB(glColorFragmentOp3ATI, 791)
-	GL_STUB(glDeleteFragmentShaderATI, 792)
-	GL_STUB(glEndFragmentShaderATI, 793)
-	GL_STUB(glGenFragmentShadersATI, 794)
-	GL_STUB(glPassTexCoordATI, 795)
-	GL_STUB(glSampleMapATI, 796)
-	GL_STUB(glSetFragmentShaderConstantATI, 797)
-	GL_STUB(glPointParameteriNV, 798)
-	GL_STUB(glPointParameterivNV, 799)
-	GL_STUB(gl_dispatch_stub_800, 800)
-	HIDDEN(gl_dispatch_stub_800)
-	GL_STUB(gl_dispatch_stub_801, 801)
-	HIDDEN(gl_dispatch_stub_801)
-	GL_STUB(gl_dispatch_stub_802, 802)
-	HIDDEN(gl_dispatch_stub_802)
-	GL_STUB(gl_dispatch_stub_803, 803)
-	HIDDEN(gl_dispatch_stub_803)
-	GL_STUB(gl_dispatch_stub_804, 804)
-	HIDDEN(gl_dispatch_stub_804)
-	GL_STUB(glGetProgramNamedParameterdvNV, 805)
-	GL_STUB(glGetProgramNamedParameterfvNV, 806)
-	GL_STUB(glProgramNamedParameter4dNV, 807)
-	GL_STUB(glProgramNamedParameter4dvNV, 808)
-	GL_STUB(glProgramNamedParameter4fNV, 809)
-	GL_STUB(glProgramNamedParameter4fvNV, 810)
-	GL_STUB(glPrimitiveRestartIndexNV, 811)
-	GL_STUB(glPrimitiveRestartNV, 812)
-	GL_STUB(gl_dispatch_stub_813, 813)
-	HIDDEN(gl_dispatch_stub_813)
-	GL_STUB(gl_dispatch_stub_814, 814)
-	HIDDEN(gl_dispatch_stub_814)
-	GL_STUB(glBindFramebufferEXT, 815)
-	GL_STUB(glBindRenderbufferEXT, 816)
-	GL_STUB(glCheckFramebufferStatusEXT, 817)
-	GL_STUB(glDeleteFramebuffersEXT, 818)
-	GL_STUB(glDeleteRenderbuffersEXT, 819)
-	GL_STUB(glFramebufferRenderbufferEXT, 820)
-	GL_STUB(glFramebufferTexture1DEXT, 821)
-	GL_STUB(glFramebufferTexture2DEXT, 822)
-	GL_STUB(glFramebufferTexture3DEXT, 823)
-	GL_STUB(glGenFramebuffersEXT, 824)
-	GL_STUB(glGenRenderbuffersEXT, 825)
-	GL_STUB(glGenerateMipmapEXT, 826)
-	GL_STUB(glGetFramebufferAttachmentParameterivEXT, 827)
-	GL_STUB(glGetRenderbufferParameterivEXT, 828)
-	GL_STUB(glIsFramebufferEXT, 829)
-	GL_STUB(glIsRenderbufferEXT, 830)
-	GL_STUB(glRenderbufferStorageEXT, 831)
-	GL_STUB(gl_dispatch_stub_832, 832)
-	HIDDEN(gl_dispatch_stub_832)
+	GL_STUB(glGetGraphicsResetStatusARB, 626)
+	GL_STUB(glGetnColorTableARB, 627)
+	GL_STUB(glGetnCompressedTexImageARB, 628)
+	GL_STUB(glGetnConvolutionFilterARB, 629)
+	GL_STUB(glGetnHistogramARB, 630)
+	GL_STUB(glGetnMapdvARB, 631)
+	GL_STUB(glGetnMapfvARB, 632)
+	GL_STUB(glGetnMapivARB, 633)
+	GL_STUB(glGetnMinmaxARB, 634)
+	GL_STUB(glGetnPixelMapfvARB, 635)
+	GL_STUB(glGetnPixelMapuivARB, 636)
+	GL_STUB(glGetnPixelMapusvARB, 637)
+	GL_STUB(glGetnPolygonStippleARB, 638)
+	GL_STUB(glGetnSeparableFilterARB, 639)
+	GL_STUB(glGetnTexImageARB, 640)
+	GL_STUB(glGetnUniformdvARB, 641)
+	GL_STUB(glGetnUniformfvARB, 642)
+	GL_STUB(glGetnUniformivARB, 643)
+	GL_STUB(glGetnUniformuivARB, 644)
+	GL_STUB(glReadnPixelsARB, 645)
+	GL_STUB(glPolygonOffsetEXT, 646)
+	GL_STUB(gl_dispatch_stub_647, 647)
+	HIDDEN(gl_dispatch_stub_647)
+	GL_STUB(gl_dispatch_stub_648, 648)
+	HIDDEN(gl_dispatch_stub_648)
+	GL_STUB(gl_dispatch_stub_649, 649)
+	HIDDEN(gl_dispatch_stub_649)
+	GL_STUB(gl_dispatch_stub_650, 650)
+	HIDDEN(gl_dispatch_stub_650)
+	GL_STUB(gl_dispatch_stub_651, 651)
+	HIDDEN(gl_dispatch_stub_651)
+	GL_STUB(gl_dispatch_stub_652, 652)
+	HIDDEN(gl_dispatch_stub_652)
+	GL_STUB(gl_dispatch_stub_653, 653)
+	HIDDEN(gl_dispatch_stub_653)
+	GL_STUB(gl_dispatch_stub_654, 654)
+	HIDDEN(gl_dispatch_stub_654)
+	GL_STUB(glColorPointerEXT, 655)
+	GL_STUB(glEdgeFlagPointerEXT, 656)
+	GL_STUB(glIndexPointerEXT, 657)
+	GL_STUB(glNormalPointerEXT, 658)
+	GL_STUB(glTexCoordPointerEXT, 659)
+	GL_STUB(glVertexPointerEXT, 660)
+	GL_STUB(glPointParameterfEXT, 661)
+	GL_STUB(glPointParameterfvEXT, 662)
+	GL_STUB(glLockArraysEXT, 663)
+	GL_STUB(glUnlockArraysEXT, 664)
+	GL_STUB(glSecondaryColor3bEXT, 665)
+	GL_STUB(glSecondaryColor3bvEXT, 666)
+	GL_STUB(glSecondaryColor3dEXT, 667)
+	GL_STUB(glSecondaryColor3dvEXT, 668)
+	GL_STUB(glSecondaryColor3fEXT, 669)
+	GL_STUB(glSecondaryColor3fvEXT, 670)
+	GL_STUB(glSecondaryColor3iEXT, 671)
+	GL_STUB(glSecondaryColor3ivEXT, 672)
+	GL_STUB(glSecondaryColor3sEXT, 673)
+	GL_STUB(glSecondaryColor3svEXT, 674)
+	GL_STUB(glSecondaryColor3ubEXT, 675)
+	GL_STUB(glSecondaryColor3ubvEXT, 676)
+	GL_STUB(glSecondaryColor3uiEXT, 677)
+	GL_STUB(glSecondaryColor3uivEXT, 678)
+	GL_STUB(glSecondaryColor3usEXT, 679)
+	GL_STUB(glSecondaryColor3usvEXT, 680)
+	GL_STUB(glSecondaryColorPointerEXT, 681)
+	GL_STUB(glMultiDrawArraysEXT, 682)
+	GL_STUB(glMultiDrawElementsEXT, 683)
+	GL_STUB(glFogCoordPointerEXT, 684)
+	GL_STUB(glFogCoorddEXT, 685)
+	GL_STUB(glFogCoorddvEXT, 686)
+	GL_STUB(glFogCoordfEXT, 687)
+	GL_STUB(glFogCoordfvEXT, 688)
+	GL_STUB(gl_dispatch_stub_689, 689)
+	HIDDEN(gl_dispatch_stub_689)
+	GL_STUB(glBlendFuncSeparateEXT, 690)
+	GL_STUB(glFlushVertexArrayRangeNV, 691)
+	GL_STUB(glVertexArrayRangeNV, 692)
+	GL_STUB(glCombinerInputNV, 693)
+	GL_STUB(glCombinerOutputNV, 694)
+	GL_STUB(glCombinerParameterfNV, 695)
+	GL_STUB(glCombinerParameterfvNV, 696)
+	GL_STUB(glCombinerParameteriNV, 697)
+	GL_STUB(glCombinerParameterivNV, 698)
+	GL_STUB(glFinalCombinerInputNV, 699)
+	GL_STUB(glGetCombinerInputParameterfvNV, 700)
+	GL_STUB(glGetCombinerInputParameterivNV, 701)
+	GL_STUB(glGetCombinerOutputParameterfvNV, 702)
+	GL_STUB(glGetCombinerOutputParameterivNV, 703)
+	GL_STUB(glGetFinalCombinerInputParameterfvNV, 704)
+	GL_STUB(glGetFinalCombinerInputParameterivNV, 705)
+	GL_STUB(glResizeBuffersMESA, 706)
+	GL_STUB(glWindowPos2dMESA, 707)
+	GL_STUB(glWindowPos2dvMESA, 708)
+	GL_STUB(glWindowPos2fMESA, 709)
+	GL_STUB(glWindowPos2fvMESA, 710)
+	GL_STUB(glWindowPos2iMESA, 711)
+	GL_STUB(glWindowPos2ivMESA, 712)
+	GL_STUB(glWindowPos2sMESA, 713)
+	GL_STUB(glWindowPos2svMESA, 714)
+	GL_STUB(glWindowPos3dMESA, 715)
+	GL_STUB(glWindowPos3dvMESA, 716)
+	GL_STUB(glWindowPos3fMESA, 717)
+	GL_STUB(glWindowPos3fvMESA, 718)
+	GL_STUB(glWindowPos3iMESA, 719)
+	GL_STUB(glWindowPos3ivMESA, 720)
+	GL_STUB(glWindowPos3sMESA, 721)
+	GL_STUB(glWindowPos3svMESA, 722)
+	GL_STUB(glWindowPos4dMESA, 723)
+	GL_STUB(glWindowPos4dvMESA, 724)
+	GL_STUB(glWindowPos4fMESA, 725)
+	GL_STUB(glWindowPos4fvMESA, 726)
+	GL_STUB(glWindowPos4iMESA, 727)
+	GL_STUB(glWindowPos4ivMESA, 728)
+	GL_STUB(glWindowPos4sMESA, 729)
+	GL_STUB(glWindowPos4svMESA, 730)
+	GL_STUB(gl_dispatch_stub_731, 731)
+	HIDDEN(gl_dispatch_stub_731)
+	GL_STUB(gl_dispatch_stub_732, 732)
+	HIDDEN(gl_dispatch_stub_732)
+	GL_STUB(gl_dispatch_stub_733, 733)
+	HIDDEN(gl_dispatch_stub_733)
+	GL_STUB(gl_dispatch_stub_734, 734)
+	HIDDEN(gl_dispatch_stub_734)
+	GL_STUB(gl_dispatch_stub_735, 735)
+	HIDDEN(gl_dispatch_stub_735)
+	GL_STUB(gl_dispatch_stub_736, 736)
+	HIDDEN(gl_dispatch_stub_736)
+	GL_STUB(gl_dispatch_stub_737, 737)
+	HIDDEN(gl_dispatch_stub_737)
+	GL_STUB(gl_dispatch_stub_738, 738)
+	HIDDEN(gl_dispatch_stub_738)
+	GL_STUB(gl_dispatch_stub_739, 739)
+	HIDDEN(gl_dispatch_stub_739)
+	GL_STUB(glAreProgramsResidentNV, 740)
+	GL_STUB(glBindProgramNV, 741)
+	GL_STUB(glDeleteProgramsNV, 742)
+	GL_STUB(glExecuteProgramNV, 743)
+	GL_STUB(glGenProgramsNV, 744)
+	GL_STUB(glGetProgramParameterdvNV, 745)
+	GL_STUB(glGetProgramParameterfvNV, 746)
+	GL_STUB(glGetProgramStringNV, 747)
+	GL_STUB(glGetProgramivNV, 748)
+	GL_STUB(glGetTrackMatrixivNV, 749)
+	GL_STUB(glGetVertexAttribPointervNV, 750)
+	GL_STUB(glGetVertexAttribdvNV, 751)
+	GL_STUB(glGetVertexAttribfvNV, 752)
+	GL_STUB(glGetVertexAttribivNV, 753)
+	GL_STUB(glIsProgramNV, 754)
+	GL_STUB(glLoadProgramNV, 755)
+	GL_STUB(glProgramParameters4dvNV, 756)
+	GL_STUB(glProgramParameters4fvNV, 757)
+	GL_STUB(glRequestResidentProgramsNV, 758)
+	GL_STUB(glTrackMatrixNV, 759)
+	GL_STUB(glVertexAttrib1dNV, 760)
+	GL_STUB(glVertexAttrib1dvNV, 761)
+	GL_STUB(glVertexAttrib1fNV, 762)
+	GL_STUB(glVertexAttrib1fvNV, 763)
+	GL_STUB(glVertexAttrib1sNV, 764)
+	GL_STUB(glVertexAttrib1svNV, 765)
+	GL_STUB(glVertexAttrib2dNV, 766)
+	GL_STUB(glVertexAttrib2dvNV, 767)
+	GL_STUB(glVertexAttrib2fNV, 768)
+	GL_STUB(glVertexAttrib2fvNV, 769)
+	GL_STUB(glVertexAttrib2sNV, 770)
+	GL_STUB(glVertexAttrib2svNV, 771)
+	GL_STUB(glVertexAttrib3dNV, 772)
+	GL_STUB(glVertexAttrib3dvNV, 773)
+	GL_STUB(glVertexAttrib3fNV, 774)
+	GL_STUB(glVertexAttrib3fvNV, 775)
+	GL_STUB(glVertexAttrib3sNV, 776)
+	GL_STUB(glVertexAttrib3svNV, 777)
+	GL_STUB(glVertexAttrib4dNV, 778)
+	GL_STUB(glVertexAttrib4dvNV, 779)
+	GL_STUB(glVertexAttrib4fNV, 780)
+	GL_STUB(glVertexAttrib4fvNV, 781)
+	GL_STUB(glVertexAttrib4sNV, 782)
+	GL_STUB(glVertexAttrib4svNV, 783)
+	GL_STUB(glVertexAttrib4ubNV, 784)
+	GL_STUB(glVertexAttrib4ubvNV, 785)
+	GL_STUB(glVertexAttribPointerNV, 786)
+	GL_STUB(glVertexAttribs1dvNV, 787)
+	GL_STUB(glVertexAttribs1fvNV, 788)
+	GL_STUB(glVertexAttribs1svNV, 789)
+	GL_STUB(glVertexAttribs2dvNV, 790)
+	GL_STUB(glVertexAttribs2fvNV, 791)
+	GL_STUB(glVertexAttribs2svNV, 792)
+	GL_STUB(glVertexAttribs3dvNV, 793)
+	GL_STUB(glVertexAttribs3fvNV, 794)
+	GL_STUB(glVertexAttribs3svNV, 795)
+	GL_STUB(glVertexAttribs4dvNV, 796)
+	GL_STUB(glVertexAttribs4fvNV, 797)
+	GL_STUB(glVertexAttribs4svNV, 798)
+	GL_STUB(glVertexAttribs4ubvNV, 799)
+	GL_STUB(glGetTexBumpParameterfvATI, 800)
+	GL_STUB(glGetTexBumpParameterivATI, 801)
+	GL_STUB(glTexBumpParameterfvATI, 802)
+	GL_STUB(glTexBumpParameterivATI, 803)
+	GL_STUB(glAlphaFragmentOp1ATI, 804)
+	GL_STUB(glAlphaFragmentOp2ATI, 805)
+	GL_STUB(glAlphaFragmentOp3ATI, 806)
+	GL_STUB(glBeginFragmentShaderATI, 807)
+	GL_STUB(glBindFragmentShaderATI, 808)
+	GL_STUB(glColorFragmentOp1ATI, 809)
+	GL_STUB(glColorFragmentOp2ATI, 810)
+	GL_STUB(glColorFragmentOp3ATI, 811)
+	GL_STUB(glDeleteFragmentShaderATI, 812)
+	GL_STUB(glEndFragmentShaderATI, 813)
+	GL_STUB(glGenFragmentShadersATI, 814)
+	GL_STUB(glPassTexCoordATI, 815)
+	GL_STUB(glSampleMapATI, 816)
+	GL_STUB(glSetFragmentShaderConstantATI, 817)
+	GL_STUB(glPointParameteriNV, 818)
+	GL_STUB(glPointParameterivNV, 819)
+	GL_STUB(gl_dispatch_stub_820, 820)
+	HIDDEN(gl_dispatch_stub_820)
+	GL_STUB(gl_dispatch_stub_821, 821)
+	HIDDEN(gl_dispatch_stub_821)
+	GL_STUB(gl_dispatch_stub_822, 822)
+	HIDDEN(gl_dispatch_stub_822)
+	GL_STUB(gl_dispatch_stub_823, 823)
+	HIDDEN(gl_dispatch_stub_823)
+	GL_STUB(gl_dispatch_stub_824, 824)
+	HIDDEN(gl_dispatch_stub_824)
+	GL_STUB(glGetProgramNamedParameterdvNV, 825)
+	GL_STUB(glGetProgramNamedParameterfvNV, 826)
+	GL_STUB(glProgramNamedParameter4dNV, 827)
+	GL_STUB(glProgramNamedParameter4dvNV, 828)
+	GL_STUB(glProgramNamedParameter4fNV, 829)
+	GL_STUB(glProgramNamedParameter4fvNV, 830)
+	GL_STUB(glPrimitiveRestartIndexNV, 831)
+	GL_STUB(glPrimitiveRestartNV, 832)
 	GL_STUB(gl_dispatch_stub_833, 833)
 	HIDDEN(gl_dispatch_stub_833)
 	GL_STUB(gl_dispatch_stub_834, 834)
 	HIDDEN(gl_dispatch_stub_834)
-	GL_STUB(glBindFragDataLocationEXT, 835)
-	GL_STUB(glGetFragDataLocationEXT, 836)
-	GL_STUB(glGetUniformuivEXT, 837)
-	GL_STUB(glGetVertexAttribIivEXT, 838)
-	GL_STUB(glGetVertexAttribIuivEXT, 839)
-	GL_STUB(glUniform1uiEXT, 840)
-	GL_STUB(glUniform1uivEXT, 841)
-	GL_STUB(glUniform2uiEXT, 842)
-	GL_STUB(glUniform2uivEXT, 843)
-	GL_STUB(glUniform3uiEXT, 844)
-	GL_STUB(glUniform3uivEXT, 845)
-	GL_STUB(glUniform4uiEXT, 846)
-	GL_STUB(glUniform4uivEXT, 847)
-	GL_STUB(glVertexAttribI1iEXT, 848)
-	GL_STUB(glVertexAttribI1ivEXT, 849)
-	GL_STUB(glVertexAttribI1uiEXT, 850)
-	GL_STUB(glVertexAttribI1uivEXT, 851)
-	GL_STUB(glVertexAttribI2iEXT, 852)
-	GL_STUB(glVertexAttribI2ivEXT, 853)
-	GL_STUB(glVertexAttribI2uiEXT, 854)
-	GL_STUB(glVertexAttribI2uivEXT, 855)
-	GL_STUB(glVertexAttribI3iEXT, 856)
-	GL_STUB(glVertexAttribI3ivEXT, 857)
-	GL_STUB(glVertexAttribI3uiEXT, 858)
-	GL_STUB(glVertexAttribI3uivEXT, 859)
-	GL_STUB(glVertexAttribI4bvEXT, 860)
-	GL_STUB(glVertexAttribI4iEXT, 861)
-	GL_STUB(glVertexAttribI4ivEXT, 862)
-	GL_STUB(glVertexAttribI4svEXT, 863)
-	GL_STUB(glVertexAttribI4ubvEXT, 864)
-	GL_STUB(glVertexAttribI4uiEXT, 865)
-	GL_STUB(glVertexAttribI4uivEXT, 866)
-	GL_STUB(glVertexAttribI4usvEXT, 867)
-	GL_STUB(glVertexAttribIPointerEXT, 868)
-	GL_STUB(glFramebufferTextureLayerEXT, 869)
-	GL_STUB(glColorMaskIndexedEXT, 870)
-	GL_STUB(glDisableIndexedEXT, 871)
-	GL_STUB(glEnableIndexedEXT, 872)
-	GL_STUB(glGetBooleanIndexedvEXT, 873)
-	GL_STUB(glGetIntegerIndexedvEXT, 874)
-	GL_STUB(glIsEnabledIndexedEXT, 875)
-	GL_STUB(glClearColorIiEXT, 876)
-	GL_STUB(glClearColorIuiEXT, 877)
-	GL_STUB(glGetTexParameterIivEXT, 878)
-	GL_STUB(glGetTexParameterIuivEXT, 879)
-	GL_STUB(glTexParameterIivEXT, 880)
-	GL_STUB(glTexParameterIuivEXT, 881)
-	GL_STUB(glBeginConditionalRenderNV, 882)
-	GL_STUB(glEndConditionalRenderNV, 883)
-	GL_STUB(glBeginTransformFeedbackEXT, 884)
-	GL_STUB(glBindBufferBaseEXT, 885)
-	GL_STUB(glBindBufferOffsetEXT, 886)
-	GL_STUB(glBindBufferRangeEXT, 887)
-	GL_STUB(glEndTransformFeedbackEXT, 888)
-	GL_STUB(glGetTransformFeedbackVaryingEXT, 889)
-	GL_STUB(glTransformFeedbackVaryingsEXT, 890)
-	GL_STUB(glProvokingVertexEXT, 891)
-	GL_STUB(gl_dispatch_stub_892, 892)
-	HIDDEN(gl_dispatch_stub_892)
-	GL_STUB(gl_dispatch_stub_893, 893)
-	HIDDEN(gl_dispatch_stub_893)
-	GL_STUB(glGetObjectParameterivAPPLE, 894)
-	GL_STUB(glObjectPurgeableAPPLE, 895)
-	GL_STUB(glObjectUnpurgeableAPPLE, 896)
-	GL_STUB(glActiveProgramEXT, 897)
-	GL_STUB(glCreateShaderProgramEXT, 898)
-	GL_STUB(glUseShaderProgramEXT, 899)
-	GL_STUB(glTextureBarrierNV, 900)
-	GL_STUB(gl_dispatch_stub_901, 901)
-	HIDDEN(gl_dispatch_stub_901)
-	GL_STUB(gl_dispatch_stub_902, 902)
-	HIDDEN(gl_dispatch_stub_902)
-	GL_STUB(gl_dispatch_stub_903, 903)
-	HIDDEN(gl_dispatch_stub_903)
-	GL_STUB(gl_dispatch_stub_904, 904)
-	HIDDEN(gl_dispatch_stub_904)
-	GL_STUB(gl_dispatch_stub_905, 905)
-	HIDDEN(gl_dispatch_stub_905)
-	GL_STUB(glEGLImageTargetRenderbufferStorageOES, 906)
-	GL_STUB(glEGLImageTargetTexture2DOES, 907)
+	GL_STUB(glBindFramebufferEXT, 835)
+	GL_STUB(glBindRenderbufferEXT, 836)
+	GL_STUB(glCheckFramebufferStatusEXT, 837)
+	GL_STUB(glDeleteFramebuffersEXT, 838)
+	GL_STUB(glDeleteRenderbuffersEXT, 839)
+	GL_STUB(glFramebufferRenderbufferEXT, 840)
+	GL_STUB(glFramebufferTexture1DEXT, 841)
+	GL_STUB(glFramebufferTexture2DEXT, 842)
+	GL_STUB(glFramebufferTexture3DEXT, 843)
+	GL_STUB(glGenFramebuffersEXT, 844)
+	GL_STUB(glGenRenderbuffersEXT, 845)
+	GL_STUB(glGenerateMipmapEXT, 846)
+	GL_STUB(glGetFramebufferAttachmentParameterivEXT, 847)
+	GL_STUB(glGetRenderbufferParameterivEXT, 848)
+	GL_STUB(glIsFramebufferEXT, 849)
+	GL_STUB(glIsRenderbufferEXT, 850)
+	GL_STUB(glRenderbufferStorageEXT, 851)
+	GL_STUB(gl_dispatch_stub_852, 852)
+	HIDDEN(gl_dispatch_stub_852)
+	GL_STUB(gl_dispatch_stub_853, 853)
+	HIDDEN(gl_dispatch_stub_853)
+	GL_STUB(gl_dispatch_stub_854, 854)
+	HIDDEN(gl_dispatch_stub_854)
+	GL_STUB(glBindFragDataLocationEXT, 855)
+	GL_STUB(glGetFragDataLocationEXT, 856)
+	GL_STUB(glGetUniformuivEXT, 857)
+	GL_STUB(glGetVertexAttribIivEXT, 858)
+	GL_STUB(glGetVertexAttribIuivEXT, 859)
+	GL_STUB(glUniform1uiEXT, 860)
+	GL_STUB(glUniform1uivEXT, 861)
+	GL_STUB(glUniform2uiEXT, 862)
+	GL_STUB(glUniform2uivEXT, 863)
+	GL_STUB(glUniform3uiEXT, 864)
+	GL_STUB(glUniform3uivEXT, 865)
+	GL_STUB(glUniform4uiEXT, 866)
+	GL_STUB(glUniform4uivEXT, 867)
+	GL_STUB(glVertexAttribI1iEXT, 868)
+	GL_STUB(glVertexAttribI1ivEXT, 869)
+	GL_STUB(glVertexAttribI1uiEXT, 870)
+	GL_STUB(glVertexAttribI1uivEXT, 871)
+	GL_STUB(glVertexAttribI2iEXT, 872)
+	GL_STUB(glVertexAttribI2ivEXT, 873)
+	GL_STUB(glVertexAttribI2uiEXT, 874)
+	GL_STUB(glVertexAttribI2uivEXT, 875)
+	GL_STUB(glVertexAttribI3iEXT, 876)
+	GL_STUB(glVertexAttribI3ivEXT, 877)
+	GL_STUB(glVertexAttribI3uiEXT, 878)
+	GL_STUB(glVertexAttribI3uivEXT, 879)
+	GL_STUB(glVertexAttribI4bvEXT, 880)
+	GL_STUB(glVertexAttribI4iEXT, 881)
+	GL_STUB(glVertexAttribI4ivEXT, 882)
+	GL_STUB(glVertexAttribI4svEXT, 883)
+	GL_STUB(glVertexAttribI4ubvEXT, 884)
+	GL_STUB(glVertexAttribI4uiEXT, 885)
+	GL_STUB(glVertexAttribI4uivEXT, 886)
+	GL_STUB(glVertexAttribI4usvEXT, 887)
+	GL_STUB(glVertexAttribIPointerEXT, 888)
+	GL_STUB(glFramebufferTextureLayerEXT, 889)
+	GL_STUB(glColorMaskIndexedEXT, 890)
+	GL_STUB(glDisableIndexedEXT, 891)
+	GL_STUB(glEnableIndexedEXT, 892)
+	GL_STUB(glGetBooleanIndexedvEXT, 893)
+	GL_STUB(glGetIntegerIndexedvEXT, 894)
+	GL_STUB(glIsEnabledIndexedEXT, 895)
+	GL_STUB(glClearColorIiEXT, 896)
+	GL_STUB(glClearColorIuiEXT, 897)
+	GL_STUB(glGetTexParameterIivEXT, 898)
+	GL_STUB(glGetTexParameterIuivEXT, 899)
+	GL_STUB(glTexParameterIivEXT, 900)
+	GL_STUB(glTexParameterIuivEXT, 901)
+	GL_STUB(glBeginConditionalRenderNV, 902)
+	GL_STUB(glEndConditionalRenderNV, 903)
+	GL_STUB(glBeginTransformFeedbackEXT, 904)
+	GL_STUB(glBindBufferBaseEXT, 905)
+	GL_STUB(glBindBufferOffsetEXT, 906)
+	GL_STUB(glBindBufferRangeEXT, 907)
+	GL_STUB(glEndTransformFeedbackEXT, 908)
+	GL_STUB(glGetTransformFeedbackVaryingEXT, 909)
+	GL_STUB(glTransformFeedbackVaryingsEXT, 910)
+	GL_STUB(glProvokingVertexEXT, 911)
+	GL_STUB(gl_dispatch_stub_912, 912)
+	HIDDEN(gl_dispatch_stub_912)
+	GL_STUB(gl_dispatch_stub_913, 913)
+	HIDDEN(gl_dispatch_stub_913)
+	GL_STUB(glGetObjectParameterivAPPLE, 914)
+	GL_STUB(glObjectPurgeableAPPLE, 915)
+	GL_STUB(glObjectUnpurgeableAPPLE, 916)
+	GL_STUB(glActiveProgramEXT, 917)
+	GL_STUB(glCreateShaderProgramEXT, 918)
+	GL_STUB(glUseShaderProgramEXT, 919)
+	GL_STUB(glTextureBarrierNV, 920)
+	GL_STUB(gl_dispatch_stub_921, 921)
+	HIDDEN(gl_dispatch_stub_921)
+	GL_STUB(gl_dispatch_stub_922, 922)
+	HIDDEN(gl_dispatch_stub_922)
+	GL_STUB(gl_dispatch_stub_923, 923)
+	HIDDEN(gl_dispatch_stub_923)
+	GL_STUB(gl_dispatch_stub_924, 924)
+	HIDDEN(gl_dispatch_stub_924)
+	GL_STUB(gl_dispatch_stub_925, 925)
+	HIDDEN(gl_dispatch_stub_925)
+	GL_STUB(glEGLImageTargetRenderbufferStorageOES, 926)
+	GL_STUB(glEGLImageTargetTexture2DOES, 927)
 	GL_STUB_ALIAS(glArrayElementEXT, glArrayElement)
 	GL_STUB_ALIAS(glBindTextureEXT, glBindTexture)
 	GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays)
diff --git a/mesalib/src/mapi/glapi/glapi_x86-64.S b/mesalib/src/mapi/glapi/glapi_x86-64.S
index 9b81f52d7..b21d9717d 100644
--- a/mesalib/src/mapi/glapi/glapi_x86-64.S
+++ b/mesalib/src/mapi/glapi/glapi_x86-64.S
@@ -23593,13 +23593,905 @@ GL_PREFIX(ShaderBinary):
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ShaderBinary), .-GL_PREFIX(ShaderBinary)
 
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetGraphicsResetStatusARB)
+	.type	GL_PREFIX(GetGraphicsResetStatusARB), @function
+GL_PREFIX(GetGraphicsResetStatusARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5008(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	movq	5008(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5008(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	movq	5008(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetGraphicsResetStatusARB), .-GL_PREFIX(GetGraphicsResetStatusARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnColorTableARB)
+	.type	GL_PREFIX(GetnColorTableARB), @function
+GL_PREFIX(GetnColorTableARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5016(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	call	_x86_64_get_dispatch@PLT
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5016(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5016(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	call	_glapi_get_dispatch
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5016(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnColorTableARB), .-GL_PREFIX(GetnColorTableARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnCompressedTexImageARB)
+	.type	GL_PREFIX(GetnCompressedTexImageARB), @function
+GL_PREFIX(GetnCompressedTexImageARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5024(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5024(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5024(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5024(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnCompressedTexImageARB), .-GL_PREFIX(GetnCompressedTexImageARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnConvolutionFilterARB)
+	.type	GL_PREFIX(GetnConvolutionFilterARB), @function
+GL_PREFIX(GetnConvolutionFilterARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5032(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	call	_x86_64_get_dispatch@PLT
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5032(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5032(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	call	_glapi_get_dispatch
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5032(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnConvolutionFilterARB), .-GL_PREFIX(GetnConvolutionFilterARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnHistogramARB)
+	.type	GL_PREFIX(GetnHistogramARB), @function
+GL_PREFIX(GetnHistogramARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5040(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5040(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5040(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5040(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnHistogramARB), .-GL_PREFIX(GetnHistogramARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnMapdvARB)
+	.type	GL_PREFIX(GetnMapdvARB), @function
+GL_PREFIX(GetnMapdvARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5048(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5048(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5048(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5048(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnMapdvARB), .-GL_PREFIX(GetnMapdvARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnMapfvARB)
+	.type	GL_PREFIX(GetnMapfvARB), @function
+GL_PREFIX(GetnMapfvARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5056(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5056(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5056(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5056(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnMapfvARB), .-GL_PREFIX(GetnMapfvARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnMapivARB)
+	.type	GL_PREFIX(GetnMapivARB), @function
+GL_PREFIX(GetnMapivARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5064(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5064(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5064(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5064(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnMapivARB), .-GL_PREFIX(GetnMapivARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnMinmaxARB)
+	.type	GL_PREFIX(GetnMinmaxARB), @function
+GL_PREFIX(GetnMinmaxARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5072(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5072(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5072(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5072(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnMinmaxARB), .-GL_PREFIX(GetnMinmaxARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnPixelMapfvARB)
+	.type	GL_PREFIX(GetnPixelMapfvARB), @function
+GL_PREFIX(GetnPixelMapfvARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5080(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	call	_x86_64_get_dispatch@PLT
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5080(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5080(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	call	_glapi_get_dispatch
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5080(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnPixelMapfvARB), .-GL_PREFIX(GetnPixelMapfvARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnPixelMapuivARB)
+	.type	GL_PREFIX(GetnPixelMapuivARB), @function
+GL_PREFIX(GetnPixelMapuivARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5088(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	call	_x86_64_get_dispatch@PLT
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5088(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5088(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	call	_glapi_get_dispatch
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5088(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnPixelMapuivARB), .-GL_PREFIX(GetnPixelMapuivARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnPixelMapusvARB)
+	.type	GL_PREFIX(GetnPixelMapusvARB), @function
+GL_PREFIX(GetnPixelMapusvARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5096(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	call	_x86_64_get_dispatch@PLT
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5096(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5096(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	call	_glapi_get_dispatch
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5096(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnPixelMapusvARB), .-GL_PREFIX(GetnPixelMapusvARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnPolygonStippleARB)
+	.type	GL_PREFIX(GetnPolygonStippleARB), @function
+GL_PREFIX(GetnPolygonStippleARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5104(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rsi
+	popq	%rdi
+	movq	5104(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5104(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rsi
+	popq	%rdi
+	movq	5104(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnPolygonStippleARB), .-GL_PREFIX(GetnPolygonStippleARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnSeparableFilterARB)
+	.type	GL_PREFIX(GetnSeparableFilterARB), @function
+GL_PREFIX(GetnSeparableFilterARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5112(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5112(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5112(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5112(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnSeparableFilterARB), .-GL_PREFIX(GetnSeparableFilterARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnTexImageARB)
+	.type	GL_PREFIX(GetnTexImageARB), @function
+GL_PREFIX(GetnTexImageARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5120(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5120(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5120(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5120(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnTexImageARB), .-GL_PREFIX(GetnTexImageARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnUniformdvARB)
+	.type	GL_PREFIX(GetnUniformdvARB), @function
+GL_PREFIX(GetnUniformdvARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5128(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5128(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5128(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5128(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnUniformdvARB), .-GL_PREFIX(GetnUniformdvARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnUniformfvARB)
+	.type	GL_PREFIX(GetnUniformfvARB), @function
+GL_PREFIX(GetnUniformfvARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5136(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5136(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5136(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5136(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnUniformfvARB), .-GL_PREFIX(GetnUniformfvARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnUniformivARB)
+	.type	GL_PREFIX(GetnUniformivARB), @function
+GL_PREFIX(GetnUniformivARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5144(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5144(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5144(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5144(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnUniformivARB), .-GL_PREFIX(GetnUniformivARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(GetnUniformuivARB)
+	.type	GL_PREFIX(GetnUniformuivARB), @function
+GL_PREFIX(GetnUniformuivARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5152(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5152(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5152(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5152(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(GetnUniformuivARB), .-GL_PREFIX(GetnUniformuivARB)
+
+	.p2align	4,,15
+	.globl	GL_PREFIX(ReadnPixelsARB)
+	.type	GL_PREFIX(ReadnPixelsARB), @function
+GL_PREFIX(ReadnPixelsARB):
+#if defined(GLX_USE_TLS)
+	call	_x86_64_get_dispatch@PLT
+	movq	5160(%rax), %r11
+	jmp	*%r11
+#elif defined(PTHREADS)
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_x86_64_get_dispatch@PLT
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5160(%rax), %r11
+	jmp	*%r11
+#else
+	movq	_glapi_Dispatch(%rip), %rax
+	testq	%rax, %rax
+	je	1f
+	movq	5160(%rax), %r11
+	jmp	*%r11
+1:
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
+	pushq	%r8
+	pushq	%r9
+	pushq	%rbp
+	call	_glapi_get_dispatch
+	popq	%rbp
+	popq	%r9
+	popq	%r8
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	movq	5160(%rax), %r11
+	jmp	*%r11
+#endif /* defined(GLX_USE_TLS) */
+	.size	GL_PREFIX(ReadnPixelsARB), .-GL_PREFIX(ReadnPixelsARB)
+
 	.p2align	4,,15
 	.globl	GL_PREFIX(PolygonOffsetEXT)
 	.type	GL_PREFIX(PolygonOffsetEXT), @function
 GL_PREFIX(PolygonOffsetEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5008(%rax), %r11
+	movq	5168(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -23609,13 +24501,13 @@ GL_PREFIX(PolygonOffsetEXT):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5008(%rax), %r11
+	movq	5168(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5008(%rax), %r11
+	movq	5168(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -23625,19 +24517,19 @@ GL_PREFIX(PolygonOffsetEXT):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5008(%rax), %r11
+	movq	5168(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PolygonOffsetEXT), .-GL_PREFIX(PolygonOffsetEXT)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_627)
-	.type	GL_PREFIX(_dispatch_stub_627), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_627))
-GL_PREFIX(_dispatch_stub_627):
+	.globl	GL_PREFIX(_dispatch_stub_647)
+	.type	GL_PREFIX(_dispatch_stub_647), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_647))
+GL_PREFIX(_dispatch_stub_647):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5016(%rax), %r11
+	movq	5176(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23647,13 +24539,13 @@ GL_PREFIX(_dispatch_stub_627):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5016(%rax), %r11
+	movq	5176(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5016(%rax), %r11
+	movq	5176(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -23663,19 +24555,19 @@ GL_PREFIX(_dispatch_stub_627):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5016(%rax), %r11
+	movq	5176(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_627), .-GL_PREFIX(_dispatch_stub_627)
+	.size	GL_PREFIX(_dispatch_stub_647), .-GL_PREFIX(_dispatch_stub_647)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_628)
-	.type	GL_PREFIX(_dispatch_stub_628), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_628))
-GL_PREFIX(_dispatch_stub_628):
+	.globl	GL_PREFIX(_dispatch_stub_648)
+	.type	GL_PREFIX(_dispatch_stub_648), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_648))
+GL_PREFIX(_dispatch_stub_648):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5024(%rax), %r11
+	movq	5184(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23685,13 +24577,13 @@ GL_PREFIX(_dispatch_stub_628):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5024(%rax), %r11
+	movq	5184(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5024(%rax), %r11
+	movq	5184(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -23701,19 +24593,19 @@ GL_PREFIX(_dispatch_stub_628):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5024(%rax), %r11
+	movq	5184(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_628), .-GL_PREFIX(_dispatch_stub_628)
+	.size	GL_PREFIX(_dispatch_stub_648), .-GL_PREFIX(_dispatch_stub_648)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_629)
-	.type	GL_PREFIX(_dispatch_stub_629), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_629))
-GL_PREFIX(_dispatch_stub_629):
+	.globl	GL_PREFIX(_dispatch_stub_649)
+	.type	GL_PREFIX(_dispatch_stub_649), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_649))
+GL_PREFIX(_dispatch_stub_649):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5032(%rax), %r11
+	movq	5192(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -23723,13 +24615,13 @@ GL_PREFIX(_dispatch_stub_629):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5032(%rax), %r11
+	movq	5192(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5032(%rax), %r11
+	movq	5192(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -23739,19 +24631,19 @@ GL_PREFIX(_dispatch_stub_629):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5032(%rax), %r11
+	movq	5192(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_629), .-GL_PREFIX(_dispatch_stub_629)
+	.size	GL_PREFIX(_dispatch_stub_649), .-GL_PREFIX(_dispatch_stub_649)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_630)
-	.type	GL_PREFIX(_dispatch_stub_630), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_630))
-GL_PREFIX(_dispatch_stub_630):
+	.globl	GL_PREFIX(_dispatch_stub_650)
+	.type	GL_PREFIX(_dispatch_stub_650), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_650))
+GL_PREFIX(_dispatch_stub_650):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5040(%rax), %r11
+	movq	5200(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23761,13 +24653,13 @@ GL_PREFIX(_dispatch_stub_630):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5040(%rax), %r11
+	movq	5200(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5040(%rax), %r11
+	movq	5200(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -23777,19 +24669,19 @@ GL_PREFIX(_dispatch_stub_630):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5040(%rax), %r11
+	movq	5200(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_630), .-GL_PREFIX(_dispatch_stub_630)
+	.size	GL_PREFIX(_dispatch_stub_650), .-GL_PREFIX(_dispatch_stub_650)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_631)
-	.type	GL_PREFIX(_dispatch_stub_631), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_631))
-GL_PREFIX(_dispatch_stub_631):
+	.globl	GL_PREFIX(_dispatch_stub_651)
+	.type	GL_PREFIX(_dispatch_stub_651), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_651))
+GL_PREFIX(_dispatch_stub_651):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5048(%rax), %r11
+	movq	5208(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23799,13 +24691,13 @@ GL_PREFIX(_dispatch_stub_631):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5048(%rax), %r11
+	movq	5208(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5048(%rax), %r11
+	movq	5208(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -23815,19 +24707,19 @@ GL_PREFIX(_dispatch_stub_631):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5048(%rax), %r11
+	movq	5208(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_631), .-GL_PREFIX(_dispatch_stub_631)
+	.size	GL_PREFIX(_dispatch_stub_651), .-GL_PREFIX(_dispatch_stub_651)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_632)
-	.type	GL_PREFIX(_dispatch_stub_632), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_632))
-GL_PREFIX(_dispatch_stub_632):
+	.globl	GL_PREFIX(_dispatch_stub_652)
+	.type	GL_PREFIX(_dispatch_stub_652), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_652))
+GL_PREFIX(_dispatch_stub_652):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5056(%rax), %r11
+	movq	5216(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23837,13 +24729,13 @@ GL_PREFIX(_dispatch_stub_632):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5056(%rax), %r11
+	movq	5216(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5056(%rax), %r11
+	movq	5216(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -23853,19 +24745,19 @@ GL_PREFIX(_dispatch_stub_632):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5056(%rax), %r11
+	movq	5216(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_632), .-GL_PREFIX(_dispatch_stub_632)
+	.size	GL_PREFIX(_dispatch_stub_652), .-GL_PREFIX(_dispatch_stub_652)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_633)
-	.type	GL_PREFIX(_dispatch_stub_633), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_633))
-GL_PREFIX(_dispatch_stub_633):
+	.globl	GL_PREFIX(_dispatch_stub_653)
+	.type	GL_PREFIX(_dispatch_stub_653), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_653))
+GL_PREFIX(_dispatch_stub_653):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5064(%rax), %r11
+	movq	5224(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23875,13 +24767,13 @@ GL_PREFIX(_dispatch_stub_633):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5064(%rax), %r11
+	movq	5224(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5064(%rax), %r11
+	movq	5224(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -23891,40 +24783,40 @@ GL_PREFIX(_dispatch_stub_633):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5064(%rax), %r11
+	movq	5224(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_633), .-GL_PREFIX(_dispatch_stub_633)
+	.size	GL_PREFIX(_dispatch_stub_653), .-GL_PREFIX(_dispatch_stub_653)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_634)
-	.type	GL_PREFIX(_dispatch_stub_634), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_634))
-GL_PREFIX(_dispatch_stub_634):
+	.globl	GL_PREFIX(_dispatch_stub_654)
+	.type	GL_PREFIX(_dispatch_stub_654), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_654))
+GL_PREFIX(_dispatch_stub_654):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5072(%rax), %r11
+	movq	5232(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5072(%rax), %r11
+	movq	5232(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5072(%rax), %r11
+	movq	5232(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5072(%rax), %r11
+	movq	5232(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_634), .-GL_PREFIX(_dispatch_stub_634)
+	.size	GL_PREFIX(_dispatch_stub_654), .-GL_PREFIX(_dispatch_stub_654)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(ColorPointerEXT)
@@ -23932,7 +24824,7 @@ GL_PREFIX(_dispatch_stub_634):
 GL_PREFIX(ColorPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5080(%rax), %r11
+	movq	5240(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23946,13 +24838,13 @@ GL_PREFIX(ColorPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5080(%rax), %r11
+	movq	5240(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5080(%rax), %r11
+	movq	5240(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -23966,7 +24858,7 @@ GL_PREFIX(ColorPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5080(%rax), %r11
+	movq	5240(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ColorPointerEXT), .-GL_PREFIX(ColorPointerEXT)
@@ -23977,7 +24869,7 @@ GL_PREFIX(ColorPointerEXT):
 GL_PREFIX(EdgeFlagPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5088(%rax), %r11
+	movq	5248(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -23987,13 +24879,13 @@ GL_PREFIX(EdgeFlagPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5088(%rax), %r11
+	movq	5248(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5088(%rax), %r11
+	movq	5248(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24003,7 +24895,7 @@ GL_PREFIX(EdgeFlagPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5088(%rax), %r11
+	movq	5248(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(EdgeFlagPointerEXT), .-GL_PREFIX(EdgeFlagPointerEXT)
@@ -24014,7 +24906,7 @@ GL_PREFIX(EdgeFlagPointerEXT):
 GL_PREFIX(IndexPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5096(%rax), %r11
+	movq	5256(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24028,13 +24920,13 @@ GL_PREFIX(IndexPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5096(%rax), %r11
+	movq	5256(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5096(%rax), %r11
+	movq	5256(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24048,7 +24940,7 @@ GL_PREFIX(IndexPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5096(%rax), %r11
+	movq	5256(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(IndexPointerEXT), .-GL_PREFIX(IndexPointerEXT)
@@ -24059,7 +24951,7 @@ GL_PREFIX(IndexPointerEXT):
 GL_PREFIX(NormalPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5104(%rax), %r11
+	movq	5264(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24073,13 +24965,13 @@ GL_PREFIX(NormalPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5104(%rax), %r11
+	movq	5264(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5104(%rax), %r11
+	movq	5264(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24093,7 +24985,7 @@ GL_PREFIX(NormalPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5104(%rax), %r11
+	movq	5264(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(NormalPointerEXT), .-GL_PREFIX(NormalPointerEXT)
@@ -24104,7 +24996,7 @@ GL_PREFIX(NormalPointerEXT):
 GL_PREFIX(TexCoordPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5112(%rax), %r11
+	movq	5272(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24118,13 +25010,13 @@ GL_PREFIX(TexCoordPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5112(%rax), %r11
+	movq	5272(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5112(%rax), %r11
+	movq	5272(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24138,7 +25030,7 @@ GL_PREFIX(TexCoordPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5112(%rax), %r11
+	movq	5272(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TexCoordPointerEXT), .-GL_PREFIX(TexCoordPointerEXT)
@@ -24149,7 +25041,7 @@ GL_PREFIX(TexCoordPointerEXT):
 GL_PREFIX(VertexPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5120(%rax), %r11
+	movq	5280(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24163,13 +25055,13 @@ GL_PREFIX(VertexPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5120(%rax), %r11
+	movq	5280(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5120(%rax), %r11
+	movq	5280(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24183,7 +25075,7 @@ GL_PREFIX(VertexPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5120(%rax), %r11
+	movq	5280(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexPointerEXT), .-GL_PREFIX(VertexPointerEXT)
@@ -24194,7 +25086,7 @@ GL_PREFIX(VertexPointerEXT):
 GL_PREFIX(PointParameterfEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5128(%rax), %r11
+	movq	5288(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -24204,13 +25096,13 @@ GL_PREFIX(PointParameterfEXT):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5128(%rax), %r11
+	movq	5288(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5128(%rax), %r11
+	movq	5288(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -24220,7 +25112,7 @@ GL_PREFIX(PointParameterfEXT):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5128(%rax), %r11
+	movq	5288(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PointParameterfEXT), .-GL_PREFIX(PointParameterfEXT)
@@ -24231,7 +25123,7 @@ GL_PREFIX(PointParameterfEXT):
 GL_PREFIX(PointParameterfvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5136(%rax), %r11
+	movq	5296(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24241,13 +25133,13 @@ GL_PREFIX(PointParameterfvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5136(%rax), %r11
+	movq	5296(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5136(%rax), %r11
+	movq	5296(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24257,7 +25149,7 @@ GL_PREFIX(PointParameterfvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5136(%rax), %r11
+	movq	5296(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PointParameterfvEXT), .-GL_PREFIX(PointParameterfvEXT)
@@ -24268,7 +25160,7 @@ GL_PREFIX(PointParameterfvEXT):
 GL_PREFIX(LockArraysEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5144(%rax), %r11
+	movq	5304(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24278,13 +25170,13 @@ GL_PREFIX(LockArraysEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5144(%rax), %r11
+	movq	5304(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5144(%rax), %r11
+	movq	5304(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24294,7 +25186,7 @@ GL_PREFIX(LockArraysEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5144(%rax), %r11
+	movq	5304(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(LockArraysEXT), .-GL_PREFIX(LockArraysEXT)
@@ -24305,25 +25197,25 @@ GL_PREFIX(LockArraysEXT):
 GL_PREFIX(UnlockArraysEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5152(%rax), %r11
+	movq	5312(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	5152(%rax), %r11
+	movq	5312(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5152(%rax), %r11
+	movq	5312(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	5152(%rax), %r11
+	movq	5312(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(UnlockArraysEXT), .-GL_PREFIX(UnlockArraysEXT)
@@ -24334,7 +25226,7 @@ GL_PREFIX(UnlockArraysEXT):
 GL_PREFIX(SecondaryColor3bEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5160(%rax), %r11
+	movq	5320(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24344,13 +25236,13 @@ GL_PREFIX(SecondaryColor3bEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5160(%rax), %r11
+	movq	5320(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5160(%rax), %r11
+	movq	5320(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24360,7 +25252,7 @@ GL_PREFIX(SecondaryColor3bEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5160(%rax), %r11
+	movq	5320(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3bEXT), .-GL_PREFIX(SecondaryColor3bEXT)
@@ -24371,25 +25263,25 @@ GL_PREFIX(SecondaryColor3bEXT):
 GL_PREFIX(SecondaryColor3bvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5168(%rax), %r11
+	movq	5328(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5168(%rax), %r11
+	movq	5328(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5168(%rax), %r11
+	movq	5328(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5168(%rax), %r11
+	movq	5328(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3bvEXT), .-GL_PREFIX(SecondaryColor3bvEXT)
@@ -24400,7 +25292,7 @@ GL_PREFIX(SecondaryColor3bvEXT):
 GL_PREFIX(SecondaryColor3dEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5176(%rax), %r11
+	movq	5336(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -24412,13 +25304,13 @@ GL_PREFIX(SecondaryColor3dEXT):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5176(%rax), %r11
+	movq	5336(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5176(%rax), %r11
+	movq	5336(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -24430,7 +25322,7 @@ GL_PREFIX(SecondaryColor3dEXT):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5176(%rax), %r11
+	movq	5336(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3dEXT), .-GL_PREFIX(SecondaryColor3dEXT)
@@ -24441,25 +25333,25 @@ GL_PREFIX(SecondaryColor3dEXT):
 GL_PREFIX(SecondaryColor3dvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5184(%rax), %r11
+	movq	5344(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5184(%rax), %r11
+	movq	5344(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5184(%rax), %r11
+	movq	5344(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5184(%rax), %r11
+	movq	5344(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3dvEXT), .-GL_PREFIX(SecondaryColor3dvEXT)
@@ -24470,7 +25362,7 @@ GL_PREFIX(SecondaryColor3dvEXT):
 GL_PREFIX(SecondaryColor3fEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5192(%rax), %r11
+	movq	5352(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -24482,13 +25374,13 @@ GL_PREFIX(SecondaryColor3fEXT):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5192(%rax), %r11
+	movq	5352(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5192(%rax), %r11
+	movq	5352(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -24500,7 +25392,7 @@ GL_PREFIX(SecondaryColor3fEXT):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5192(%rax), %r11
+	movq	5352(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3fEXT), .-GL_PREFIX(SecondaryColor3fEXT)
@@ -24511,25 +25403,25 @@ GL_PREFIX(SecondaryColor3fEXT):
 GL_PREFIX(SecondaryColor3fvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5200(%rax), %r11
+	movq	5360(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5200(%rax), %r11
+	movq	5360(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5200(%rax), %r11
+	movq	5360(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5200(%rax), %r11
+	movq	5360(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3fvEXT), .-GL_PREFIX(SecondaryColor3fvEXT)
@@ -24540,7 +25432,7 @@ GL_PREFIX(SecondaryColor3fvEXT):
 GL_PREFIX(SecondaryColor3iEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5208(%rax), %r11
+	movq	5368(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24550,13 +25442,13 @@ GL_PREFIX(SecondaryColor3iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5208(%rax), %r11
+	movq	5368(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5208(%rax), %r11
+	movq	5368(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24566,7 +25458,7 @@ GL_PREFIX(SecondaryColor3iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5208(%rax), %r11
+	movq	5368(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3iEXT), .-GL_PREFIX(SecondaryColor3iEXT)
@@ -24577,25 +25469,25 @@ GL_PREFIX(SecondaryColor3iEXT):
 GL_PREFIX(SecondaryColor3ivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5216(%rax), %r11
+	movq	5376(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5216(%rax), %r11
+	movq	5376(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5216(%rax), %r11
+	movq	5376(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5216(%rax), %r11
+	movq	5376(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3ivEXT), .-GL_PREFIX(SecondaryColor3ivEXT)
@@ -24606,7 +25498,7 @@ GL_PREFIX(SecondaryColor3ivEXT):
 GL_PREFIX(SecondaryColor3sEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5224(%rax), %r11
+	movq	5384(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24616,13 +25508,13 @@ GL_PREFIX(SecondaryColor3sEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5224(%rax), %r11
+	movq	5384(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5224(%rax), %r11
+	movq	5384(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24632,7 +25524,7 @@ GL_PREFIX(SecondaryColor3sEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5224(%rax), %r11
+	movq	5384(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3sEXT), .-GL_PREFIX(SecondaryColor3sEXT)
@@ -24643,25 +25535,25 @@ GL_PREFIX(SecondaryColor3sEXT):
 GL_PREFIX(SecondaryColor3svEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5232(%rax), %r11
+	movq	5392(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5232(%rax), %r11
+	movq	5392(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5232(%rax), %r11
+	movq	5392(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5232(%rax), %r11
+	movq	5392(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3svEXT), .-GL_PREFIX(SecondaryColor3svEXT)
@@ -24672,7 +25564,7 @@ GL_PREFIX(SecondaryColor3svEXT):
 GL_PREFIX(SecondaryColor3ubEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5240(%rax), %r11
+	movq	5400(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24682,13 +25574,13 @@ GL_PREFIX(SecondaryColor3ubEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5240(%rax), %r11
+	movq	5400(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5240(%rax), %r11
+	movq	5400(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24698,7 +25590,7 @@ GL_PREFIX(SecondaryColor3ubEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5240(%rax), %r11
+	movq	5400(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3ubEXT), .-GL_PREFIX(SecondaryColor3ubEXT)
@@ -24709,25 +25601,25 @@ GL_PREFIX(SecondaryColor3ubEXT):
 GL_PREFIX(SecondaryColor3ubvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5248(%rax), %r11
+	movq	5408(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5248(%rax), %r11
+	movq	5408(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5248(%rax), %r11
+	movq	5408(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5248(%rax), %r11
+	movq	5408(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3ubvEXT), .-GL_PREFIX(SecondaryColor3ubvEXT)
@@ -24738,7 +25630,7 @@ GL_PREFIX(SecondaryColor3ubvEXT):
 GL_PREFIX(SecondaryColor3uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5256(%rax), %r11
+	movq	5416(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24748,13 +25640,13 @@ GL_PREFIX(SecondaryColor3uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5256(%rax), %r11
+	movq	5416(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5256(%rax), %r11
+	movq	5416(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24764,7 +25656,7 @@ GL_PREFIX(SecondaryColor3uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5256(%rax), %r11
+	movq	5416(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3uiEXT), .-GL_PREFIX(SecondaryColor3uiEXT)
@@ -24775,25 +25667,25 @@ GL_PREFIX(SecondaryColor3uiEXT):
 GL_PREFIX(SecondaryColor3uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5264(%rax), %r11
+	movq	5424(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5264(%rax), %r11
+	movq	5424(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5264(%rax), %r11
+	movq	5424(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5264(%rax), %r11
+	movq	5424(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3uivEXT), .-GL_PREFIX(SecondaryColor3uivEXT)
@@ -24804,7 +25696,7 @@ GL_PREFIX(SecondaryColor3uivEXT):
 GL_PREFIX(SecondaryColor3usEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5272(%rax), %r11
+	movq	5432(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24814,13 +25706,13 @@ GL_PREFIX(SecondaryColor3usEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5272(%rax), %r11
+	movq	5432(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5272(%rax), %r11
+	movq	5432(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24830,7 +25722,7 @@ GL_PREFIX(SecondaryColor3usEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5272(%rax), %r11
+	movq	5432(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3usEXT), .-GL_PREFIX(SecondaryColor3usEXT)
@@ -24841,25 +25733,25 @@ GL_PREFIX(SecondaryColor3usEXT):
 GL_PREFIX(SecondaryColor3usvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5280(%rax), %r11
+	movq	5440(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5280(%rax), %r11
+	movq	5440(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5280(%rax), %r11
+	movq	5440(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5280(%rax), %r11
+	movq	5440(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColor3usvEXT), .-GL_PREFIX(SecondaryColor3usvEXT)
@@ -24870,7 +25762,7 @@ GL_PREFIX(SecondaryColor3usvEXT):
 GL_PREFIX(SecondaryColorPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5288(%rax), %r11
+	movq	5448(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24884,13 +25776,13 @@ GL_PREFIX(SecondaryColorPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5288(%rax), %r11
+	movq	5448(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5288(%rax), %r11
+	movq	5448(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24904,7 +25796,7 @@ GL_PREFIX(SecondaryColorPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5288(%rax), %r11
+	movq	5448(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SecondaryColorPointerEXT), .-GL_PREFIX(SecondaryColorPointerEXT)
@@ -24915,7 +25807,7 @@ GL_PREFIX(SecondaryColorPointerEXT):
 GL_PREFIX(MultiDrawArraysEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5296(%rax), %r11
+	movq	5456(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24929,13 +25821,13 @@ GL_PREFIX(MultiDrawArraysEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5296(%rax), %r11
+	movq	5456(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5296(%rax), %r11
+	movq	5456(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24949,7 +25841,7 @@ GL_PREFIX(MultiDrawArraysEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5296(%rax), %r11
+	movq	5456(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(MultiDrawArraysEXT), .-GL_PREFIX(MultiDrawArraysEXT)
@@ -24960,7 +25852,7 @@ GL_PREFIX(MultiDrawArraysEXT):
 GL_PREFIX(MultiDrawElementsEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5304(%rax), %r11
+	movq	5464(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -24974,13 +25866,13 @@ GL_PREFIX(MultiDrawElementsEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5304(%rax), %r11
+	movq	5464(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5304(%rax), %r11
+	movq	5464(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -24994,7 +25886,7 @@ GL_PREFIX(MultiDrawElementsEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5304(%rax), %r11
+	movq	5464(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(MultiDrawElementsEXT), .-GL_PREFIX(MultiDrawElementsEXT)
@@ -25005,7 +25897,7 @@ GL_PREFIX(MultiDrawElementsEXT):
 GL_PREFIX(FogCoordPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5312(%rax), %r11
+	movq	5472(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25015,13 +25907,13 @@ GL_PREFIX(FogCoordPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5312(%rax), %r11
+	movq	5472(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5312(%rax), %r11
+	movq	5472(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25031,7 +25923,7 @@ GL_PREFIX(FogCoordPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5312(%rax), %r11
+	movq	5472(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FogCoordPointerEXT), .-GL_PREFIX(FogCoordPointerEXT)
@@ -25042,7 +25934,7 @@ GL_PREFIX(FogCoordPointerEXT):
 GL_PREFIX(FogCoorddEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5320(%rax), %r11
+	movq	5480(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$8, %rsp
@@ -25050,13 +25942,13 @@ GL_PREFIX(FogCoorddEXT):
 	call	_x86_64_get_dispatch@PLT
 	movq	(%rsp), %xmm0
 	addq	$8, %rsp
-	movq	5320(%rax), %r11
+	movq	5480(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5320(%rax), %r11
+	movq	5480(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$8, %rsp
@@ -25064,7 +25956,7 @@ GL_PREFIX(FogCoorddEXT):
 	call	_glapi_get_dispatch
 	movq	(%rsp), %xmm0
 	addq	$8, %rsp
-	movq	5320(%rax), %r11
+	movq	5480(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FogCoorddEXT), .-GL_PREFIX(FogCoorddEXT)
@@ -25075,25 +25967,25 @@ GL_PREFIX(FogCoorddEXT):
 GL_PREFIX(FogCoorddvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5328(%rax), %r11
+	movq	5488(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5328(%rax), %r11
+	movq	5488(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5328(%rax), %r11
+	movq	5488(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5328(%rax), %r11
+	movq	5488(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FogCoorddvEXT), .-GL_PREFIX(FogCoorddvEXT)
@@ -25104,7 +25996,7 @@ GL_PREFIX(FogCoorddvEXT):
 GL_PREFIX(FogCoordfEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5336(%rax), %r11
+	movq	5496(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$8, %rsp
@@ -25112,13 +26004,13 @@ GL_PREFIX(FogCoordfEXT):
 	call	_x86_64_get_dispatch@PLT
 	movq	(%rsp), %xmm0
 	addq	$8, %rsp
-	movq	5336(%rax), %r11
+	movq	5496(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5336(%rax), %r11
+	movq	5496(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$8, %rsp
@@ -25126,7 +26018,7 @@ GL_PREFIX(FogCoordfEXT):
 	call	_glapi_get_dispatch
 	movq	(%rsp), %xmm0
 	addq	$8, %rsp
-	movq	5336(%rax), %r11
+	movq	5496(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FogCoordfEXT), .-GL_PREFIX(FogCoordfEXT)
@@ -25137,58 +26029,58 @@ GL_PREFIX(FogCoordfEXT):
 GL_PREFIX(FogCoordfvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5344(%rax), %r11
+	movq	5504(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5344(%rax), %r11
+	movq	5504(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5344(%rax), %r11
+	movq	5504(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5344(%rax), %r11
+	movq	5504(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FogCoordfvEXT), .-GL_PREFIX(FogCoordfvEXT)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_669)
-	.type	GL_PREFIX(_dispatch_stub_669), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_669))
-GL_PREFIX(_dispatch_stub_669):
+	.globl	GL_PREFIX(_dispatch_stub_689)
+	.type	GL_PREFIX(_dispatch_stub_689), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_689))
+GL_PREFIX(_dispatch_stub_689):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5352(%rax), %r11
+	movq	5512(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5352(%rax), %r11
+	movq	5512(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5352(%rax), %r11
+	movq	5512(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5352(%rax), %r11
+	movq	5512(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_669), .-GL_PREFIX(_dispatch_stub_669)
+	.size	GL_PREFIX(_dispatch_stub_689), .-GL_PREFIX(_dispatch_stub_689)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(BlendFuncSeparateEXT)
@@ -25196,7 +26088,7 @@ GL_PREFIX(_dispatch_stub_669):
 GL_PREFIX(BlendFuncSeparateEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5360(%rax), %r11
+	movq	5520(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25210,13 +26102,13 @@ GL_PREFIX(BlendFuncSeparateEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5360(%rax), %r11
+	movq	5520(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5360(%rax), %r11
+	movq	5520(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25230,7 +26122,7 @@ GL_PREFIX(BlendFuncSeparateEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5360(%rax), %r11
+	movq	5520(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BlendFuncSeparateEXT), .-GL_PREFIX(BlendFuncSeparateEXT)
@@ -25241,25 +26133,25 @@ GL_PREFIX(BlendFuncSeparateEXT):
 GL_PREFIX(FlushVertexArrayRangeNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5368(%rax), %r11
+	movq	5528(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	5368(%rax), %r11
+	movq	5528(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5368(%rax), %r11
+	movq	5528(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	5368(%rax), %r11
+	movq	5528(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FlushVertexArrayRangeNV), .-GL_PREFIX(FlushVertexArrayRangeNV)
@@ -25270,7 +26162,7 @@ GL_PREFIX(FlushVertexArrayRangeNV):
 GL_PREFIX(VertexArrayRangeNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5376(%rax), %r11
+	movq	5536(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25280,13 +26172,13 @@ GL_PREFIX(VertexArrayRangeNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5376(%rax), %r11
+	movq	5536(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5376(%rax), %r11
+	movq	5536(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25296,7 +26188,7 @@ GL_PREFIX(VertexArrayRangeNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5376(%rax), %r11
+	movq	5536(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexArrayRangeNV), .-GL_PREFIX(VertexArrayRangeNV)
@@ -25307,7 +26199,7 @@ GL_PREFIX(VertexArrayRangeNV):
 GL_PREFIX(CombinerInputNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5384(%rax), %r11
+	movq	5544(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25325,13 +26217,13 @@ GL_PREFIX(CombinerInputNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5384(%rax), %r11
+	movq	5544(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5384(%rax), %r11
+	movq	5544(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25349,7 +26241,7 @@ GL_PREFIX(CombinerInputNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5384(%rax), %r11
+	movq	5544(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CombinerInputNV), .-GL_PREFIX(CombinerInputNV)
@@ -25360,7 +26252,7 @@ GL_PREFIX(CombinerInputNV):
 GL_PREFIX(CombinerOutputNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5392(%rax), %r11
+	movq	5552(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25378,13 +26270,13 @@ GL_PREFIX(CombinerOutputNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5392(%rax), %r11
+	movq	5552(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5392(%rax), %r11
+	movq	5552(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25402,7 +26294,7 @@ GL_PREFIX(CombinerOutputNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5392(%rax), %r11
+	movq	5552(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CombinerOutputNV), .-GL_PREFIX(CombinerOutputNV)
@@ -25413,7 +26305,7 @@ GL_PREFIX(CombinerOutputNV):
 GL_PREFIX(CombinerParameterfNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5400(%rax), %r11
+	movq	5560(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -25423,13 +26315,13 @@ GL_PREFIX(CombinerParameterfNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5400(%rax), %r11
+	movq	5560(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5400(%rax), %r11
+	movq	5560(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -25439,7 +26331,7 @@ GL_PREFIX(CombinerParameterfNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5400(%rax), %r11
+	movq	5560(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CombinerParameterfNV), .-GL_PREFIX(CombinerParameterfNV)
@@ -25450,7 +26342,7 @@ GL_PREFIX(CombinerParameterfNV):
 GL_PREFIX(CombinerParameterfvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5408(%rax), %r11
+	movq	5568(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25460,13 +26352,13 @@ GL_PREFIX(CombinerParameterfvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5408(%rax), %r11
+	movq	5568(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5408(%rax), %r11
+	movq	5568(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25476,7 +26368,7 @@ GL_PREFIX(CombinerParameterfvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5408(%rax), %r11
+	movq	5568(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CombinerParameterfvNV), .-GL_PREFIX(CombinerParameterfvNV)
@@ -25487,7 +26379,7 @@ GL_PREFIX(CombinerParameterfvNV):
 GL_PREFIX(CombinerParameteriNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5416(%rax), %r11
+	movq	5576(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25497,13 +26389,13 @@ GL_PREFIX(CombinerParameteriNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5416(%rax), %r11
+	movq	5576(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5416(%rax), %r11
+	movq	5576(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25513,7 +26405,7 @@ GL_PREFIX(CombinerParameteriNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5416(%rax), %r11
+	movq	5576(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CombinerParameteriNV), .-GL_PREFIX(CombinerParameteriNV)
@@ -25524,7 +26416,7 @@ GL_PREFIX(CombinerParameteriNV):
 GL_PREFIX(CombinerParameterivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5424(%rax), %r11
+	movq	5584(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25534,13 +26426,13 @@ GL_PREFIX(CombinerParameterivNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5424(%rax), %r11
+	movq	5584(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5424(%rax), %r11
+	movq	5584(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25550,7 +26442,7 @@ GL_PREFIX(CombinerParameterivNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5424(%rax), %r11
+	movq	5584(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CombinerParameterivNV), .-GL_PREFIX(CombinerParameterivNV)
@@ -25561,7 +26453,7 @@ GL_PREFIX(CombinerParameterivNV):
 GL_PREFIX(FinalCombinerInputNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5432(%rax), %r11
+	movq	5592(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25575,13 +26467,13 @@ GL_PREFIX(FinalCombinerInputNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5432(%rax), %r11
+	movq	5592(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5432(%rax), %r11
+	movq	5592(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25595,7 +26487,7 @@ GL_PREFIX(FinalCombinerInputNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5432(%rax), %r11
+	movq	5592(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FinalCombinerInputNV), .-GL_PREFIX(FinalCombinerInputNV)
@@ -25606,7 +26498,7 @@ GL_PREFIX(FinalCombinerInputNV):
 GL_PREFIX(GetCombinerInputParameterfvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5440(%rax), %r11
+	movq	5600(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25620,13 +26512,13 @@ GL_PREFIX(GetCombinerInputParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5440(%rax), %r11
+	movq	5600(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5440(%rax), %r11
+	movq	5600(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25640,7 +26532,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5440(%rax), %r11
+	movq	5600(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetCombinerInputParameterfvNV), .-GL_PREFIX(GetCombinerInputParameterfvNV)
@@ -25651,7 +26543,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV):
 GL_PREFIX(GetCombinerInputParameterivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5448(%rax), %r11
+	movq	5608(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25665,13 +26557,13 @@ GL_PREFIX(GetCombinerInputParameterivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5448(%rax), %r11
+	movq	5608(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5448(%rax), %r11
+	movq	5608(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25685,7 +26577,7 @@ GL_PREFIX(GetCombinerInputParameterivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5448(%rax), %r11
+	movq	5608(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetCombinerInputParameterivNV), .-GL_PREFIX(GetCombinerInputParameterivNV)
@@ -25696,7 +26588,7 @@ GL_PREFIX(GetCombinerInputParameterivNV):
 GL_PREFIX(GetCombinerOutputParameterfvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5456(%rax), %r11
+	movq	5616(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25710,13 +26602,13 @@ GL_PREFIX(GetCombinerOutputParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5456(%rax), %r11
+	movq	5616(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5456(%rax), %r11
+	movq	5616(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25730,7 +26622,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5456(%rax), %r11
+	movq	5616(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetCombinerOutputParameterfvNV), .-GL_PREFIX(GetCombinerOutputParameterfvNV)
@@ -25741,7 +26633,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV):
 GL_PREFIX(GetCombinerOutputParameterivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5464(%rax), %r11
+	movq	5624(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25755,13 +26647,13 @@ GL_PREFIX(GetCombinerOutputParameterivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5464(%rax), %r11
+	movq	5624(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5464(%rax), %r11
+	movq	5624(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25775,7 +26667,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5464(%rax), %r11
+	movq	5624(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetCombinerOutputParameterivNV), .-GL_PREFIX(GetCombinerOutputParameterivNV)
@@ -25786,7 +26678,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV):
 GL_PREFIX(GetFinalCombinerInputParameterfvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5472(%rax), %r11
+	movq	5632(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25796,13 +26688,13 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5472(%rax), %r11
+	movq	5632(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5472(%rax), %r11
+	movq	5632(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25812,7 +26704,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5472(%rax), %r11
+	movq	5632(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetFinalCombinerInputParameterfvNV), .-GL_PREFIX(GetFinalCombinerInputParameterfvNV)
@@ -25823,7 +26715,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV):
 GL_PREFIX(GetFinalCombinerInputParameterivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5480(%rax), %r11
+	movq	5640(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -25833,13 +26725,13 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5480(%rax), %r11
+	movq	5640(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5480(%rax), %r11
+	movq	5640(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -25849,7 +26741,7 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5480(%rax), %r11
+	movq	5640(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetFinalCombinerInputParameterivNV), .-GL_PREFIX(GetFinalCombinerInputParameterivNV)
@@ -25860,25 +26752,25 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV):
 GL_PREFIX(ResizeBuffersMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5488(%rax), %r11
+	movq	5648(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	5488(%rax), %r11
+	movq	5648(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5488(%rax), %r11
+	movq	5648(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	5488(%rax), %r11
+	movq	5648(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ResizeBuffersMESA), .-GL_PREFIX(ResizeBuffersMESA)
@@ -25889,7 +26781,7 @@ GL_PREFIX(ResizeBuffersMESA):
 GL_PREFIX(WindowPos2dMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5496(%rax), %r11
+	movq	5656(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -25899,13 +26791,13 @@ GL_PREFIX(WindowPos2dMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5496(%rax), %r11
+	movq	5656(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5496(%rax), %r11
+	movq	5656(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -25915,7 +26807,7 @@ GL_PREFIX(WindowPos2dMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5496(%rax), %r11
+	movq	5656(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2dMESA), .-GL_PREFIX(WindowPos2dMESA)
@@ -25926,25 +26818,25 @@ GL_PREFIX(WindowPos2dMESA):
 GL_PREFIX(WindowPos2dvMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5504(%rax), %r11
+	movq	5664(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5504(%rax), %r11
+	movq	5664(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5504(%rax), %r11
+	movq	5664(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5504(%rax), %r11
+	movq	5664(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2dvMESA), .-GL_PREFIX(WindowPos2dvMESA)
@@ -25955,7 +26847,7 @@ GL_PREFIX(WindowPos2dvMESA):
 GL_PREFIX(WindowPos2fMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5512(%rax), %r11
+	movq	5672(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -25965,13 +26857,13 @@ GL_PREFIX(WindowPos2fMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5512(%rax), %r11
+	movq	5672(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5512(%rax), %r11
+	movq	5672(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -25981,7 +26873,7 @@ GL_PREFIX(WindowPos2fMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5512(%rax), %r11
+	movq	5672(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2fMESA), .-GL_PREFIX(WindowPos2fMESA)
@@ -25992,25 +26884,25 @@ GL_PREFIX(WindowPos2fMESA):
 GL_PREFIX(WindowPos2fvMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5520(%rax), %r11
+	movq	5680(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5520(%rax), %r11
+	movq	5680(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5520(%rax), %r11
+	movq	5680(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5520(%rax), %r11
+	movq	5680(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2fvMESA), .-GL_PREFIX(WindowPos2fvMESA)
@@ -26021,7 +26913,7 @@ GL_PREFIX(WindowPos2fvMESA):
 GL_PREFIX(WindowPos2iMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5528(%rax), %r11
+	movq	5688(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26031,13 +26923,13 @@ GL_PREFIX(WindowPos2iMESA):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5528(%rax), %r11
+	movq	5688(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5528(%rax), %r11
+	movq	5688(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26047,7 +26939,7 @@ GL_PREFIX(WindowPos2iMESA):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5528(%rax), %r11
+	movq	5688(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2iMESA), .-GL_PREFIX(WindowPos2iMESA)
@@ -26058,25 +26950,25 @@ GL_PREFIX(WindowPos2iMESA):
 GL_PREFIX(WindowPos2ivMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5536(%rax), %r11
+	movq	5696(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5536(%rax), %r11
+	movq	5696(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5536(%rax), %r11
+	movq	5696(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5536(%rax), %r11
+	movq	5696(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2ivMESA), .-GL_PREFIX(WindowPos2ivMESA)
@@ -26087,7 +26979,7 @@ GL_PREFIX(WindowPos2ivMESA):
 GL_PREFIX(WindowPos2sMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5544(%rax), %r11
+	movq	5704(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26097,13 +26989,13 @@ GL_PREFIX(WindowPos2sMESA):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5544(%rax), %r11
+	movq	5704(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5544(%rax), %r11
+	movq	5704(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26113,7 +27005,7 @@ GL_PREFIX(WindowPos2sMESA):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5544(%rax), %r11
+	movq	5704(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2sMESA), .-GL_PREFIX(WindowPos2sMESA)
@@ -26124,25 +27016,25 @@ GL_PREFIX(WindowPos2sMESA):
 GL_PREFIX(WindowPos2svMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5552(%rax), %r11
+	movq	5712(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5552(%rax), %r11
+	movq	5712(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5552(%rax), %r11
+	movq	5712(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5552(%rax), %r11
+	movq	5712(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos2svMESA), .-GL_PREFIX(WindowPos2svMESA)
@@ -26153,7 +27045,7 @@ GL_PREFIX(WindowPos2svMESA):
 GL_PREFIX(WindowPos3dMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5560(%rax), %r11
+	movq	5720(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -26165,13 +27057,13 @@ GL_PREFIX(WindowPos3dMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5560(%rax), %r11
+	movq	5720(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5560(%rax), %r11
+	movq	5720(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -26183,7 +27075,7 @@ GL_PREFIX(WindowPos3dMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5560(%rax), %r11
+	movq	5720(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3dMESA), .-GL_PREFIX(WindowPos3dMESA)
@@ -26194,25 +27086,25 @@ GL_PREFIX(WindowPos3dMESA):
 GL_PREFIX(WindowPos3dvMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5568(%rax), %r11
+	movq	5728(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5568(%rax), %r11
+	movq	5728(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5568(%rax), %r11
+	movq	5728(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5568(%rax), %r11
+	movq	5728(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3dvMESA), .-GL_PREFIX(WindowPos3dvMESA)
@@ -26223,7 +27115,7 @@ GL_PREFIX(WindowPos3dvMESA):
 GL_PREFIX(WindowPos3fMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5576(%rax), %r11
+	movq	5736(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -26235,13 +27127,13 @@ GL_PREFIX(WindowPos3fMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5576(%rax), %r11
+	movq	5736(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5576(%rax), %r11
+	movq	5736(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -26253,7 +27145,7 @@ GL_PREFIX(WindowPos3fMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$24, %rsp
-	movq	5576(%rax), %r11
+	movq	5736(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3fMESA), .-GL_PREFIX(WindowPos3fMESA)
@@ -26264,25 +27156,25 @@ GL_PREFIX(WindowPos3fMESA):
 GL_PREFIX(WindowPos3fvMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5584(%rax), %r11
+	movq	5744(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5584(%rax), %r11
+	movq	5744(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5584(%rax), %r11
+	movq	5744(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5584(%rax), %r11
+	movq	5744(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3fvMESA), .-GL_PREFIX(WindowPos3fvMESA)
@@ -26293,7 +27185,7 @@ GL_PREFIX(WindowPos3fvMESA):
 GL_PREFIX(WindowPos3iMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5592(%rax), %r11
+	movq	5752(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26303,13 +27195,13 @@ GL_PREFIX(WindowPos3iMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5592(%rax), %r11
+	movq	5752(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5592(%rax), %r11
+	movq	5752(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26319,7 +27211,7 @@ GL_PREFIX(WindowPos3iMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5592(%rax), %r11
+	movq	5752(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3iMESA), .-GL_PREFIX(WindowPos3iMESA)
@@ -26330,25 +27222,25 @@ GL_PREFIX(WindowPos3iMESA):
 GL_PREFIX(WindowPos3ivMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5600(%rax), %r11
+	movq	5760(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5600(%rax), %r11
+	movq	5760(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5600(%rax), %r11
+	movq	5760(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5600(%rax), %r11
+	movq	5760(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3ivMESA), .-GL_PREFIX(WindowPos3ivMESA)
@@ -26359,7 +27251,7 @@ GL_PREFIX(WindowPos3ivMESA):
 GL_PREFIX(WindowPos3sMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5608(%rax), %r11
+	movq	5768(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26369,13 +27261,13 @@ GL_PREFIX(WindowPos3sMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5608(%rax), %r11
+	movq	5768(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5608(%rax), %r11
+	movq	5768(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26385,7 +27277,7 @@ GL_PREFIX(WindowPos3sMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5608(%rax), %r11
+	movq	5768(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3sMESA), .-GL_PREFIX(WindowPos3sMESA)
@@ -26396,25 +27288,25 @@ GL_PREFIX(WindowPos3sMESA):
 GL_PREFIX(WindowPos3svMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5616(%rax), %r11
+	movq	5776(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5616(%rax), %r11
+	movq	5776(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5616(%rax), %r11
+	movq	5776(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5616(%rax), %r11
+	movq	5776(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos3svMESA), .-GL_PREFIX(WindowPos3svMESA)
@@ -26425,7 +27317,7 @@ GL_PREFIX(WindowPos3svMESA):
 GL_PREFIX(WindowPos4dMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5624(%rax), %r11
+	movq	5784(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$40, %rsp
@@ -26439,13 +27331,13 @@ GL_PREFIX(WindowPos4dMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$40, %rsp
-	movq	5624(%rax), %r11
+	movq	5784(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5624(%rax), %r11
+	movq	5784(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$40, %rsp
@@ -26459,7 +27351,7 @@ GL_PREFIX(WindowPos4dMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$40, %rsp
-	movq	5624(%rax), %r11
+	movq	5784(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4dMESA), .-GL_PREFIX(WindowPos4dMESA)
@@ -26470,25 +27362,25 @@ GL_PREFIX(WindowPos4dMESA):
 GL_PREFIX(WindowPos4dvMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5632(%rax), %r11
+	movq	5792(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5632(%rax), %r11
+	movq	5792(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5632(%rax), %r11
+	movq	5792(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5632(%rax), %r11
+	movq	5792(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4dvMESA), .-GL_PREFIX(WindowPos4dvMESA)
@@ -26499,7 +27391,7 @@ GL_PREFIX(WindowPos4dvMESA):
 GL_PREFIX(WindowPos4fMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5640(%rax), %r11
+	movq	5800(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$40, %rsp
@@ -26513,13 +27405,13 @@ GL_PREFIX(WindowPos4fMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$40, %rsp
-	movq	5640(%rax), %r11
+	movq	5800(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5640(%rax), %r11
+	movq	5800(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$40, %rsp
@@ -26533,7 +27425,7 @@ GL_PREFIX(WindowPos4fMESA):
 	movq	8(%rsp), %xmm1
 	movq	(%rsp), %xmm0
 	addq	$40, %rsp
-	movq	5640(%rax), %r11
+	movq	5800(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4fMESA), .-GL_PREFIX(WindowPos4fMESA)
@@ -26544,25 +27436,25 @@ GL_PREFIX(WindowPos4fMESA):
 GL_PREFIX(WindowPos4fvMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5648(%rax), %r11
+	movq	5808(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5648(%rax), %r11
+	movq	5808(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5648(%rax), %r11
+	movq	5808(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5648(%rax), %r11
+	movq	5808(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4fvMESA), .-GL_PREFIX(WindowPos4fvMESA)
@@ -26573,7 +27465,7 @@ GL_PREFIX(WindowPos4fvMESA):
 GL_PREFIX(WindowPos4iMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5656(%rax), %r11
+	movq	5816(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26587,13 +27479,13 @@ GL_PREFIX(WindowPos4iMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5656(%rax), %r11
+	movq	5816(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5656(%rax), %r11
+	movq	5816(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26607,7 +27499,7 @@ GL_PREFIX(WindowPos4iMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5656(%rax), %r11
+	movq	5816(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4iMESA), .-GL_PREFIX(WindowPos4iMESA)
@@ -26618,25 +27510,25 @@ GL_PREFIX(WindowPos4iMESA):
 GL_PREFIX(WindowPos4ivMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5664(%rax), %r11
+	movq	5824(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5664(%rax), %r11
+	movq	5824(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5664(%rax), %r11
+	movq	5824(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5664(%rax), %r11
+	movq	5824(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4ivMESA), .-GL_PREFIX(WindowPos4ivMESA)
@@ -26647,7 +27539,7 @@ GL_PREFIX(WindowPos4ivMESA):
 GL_PREFIX(WindowPos4sMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5672(%rax), %r11
+	movq	5832(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26661,13 +27553,13 @@ GL_PREFIX(WindowPos4sMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5672(%rax), %r11
+	movq	5832(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5672(%rax), %r11
+	movq	5832(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26681,7 +27573,7 @@ GL_PREFIX(WindowPos4sMESA):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5672(%rax), %r11
+	movq	5832(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4sMESA), .-GL_PREFIX(WindowPos4sMESA)
@@ -26692,37 +27584,37 @@ GL_PREFIX(WindowPos4sMESA):
 GL_PREFIX(WindowPos4svMESA):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5680(%rax), %r11
+	movq	5840(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5680(%rax), %r11
+	movq	5840(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5680(%rax), %r11
+	movq	5840(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5680(%rax), %r11
+	movq	5840(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(WindowPos4svMESA), .-GL_PREFIX(WindowPos4svMESA)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_711)
-	.type	GL_PREFIX(_dispatch_stub_711), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_711))
-GL_PREFIX(_dispatch_stub_711):
+	.globl	GL_PREFIX(_dispatch_stub_731)
+	.type	GL_PREFIX(_dispatch_stub_731), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_731))
+GL_PREFIX(_dispatch_stub_731):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5688(%rax), %r11
+	movq	5848(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26736,13 +27628,13 @@ GL_PREFIX(_dispatch_stub_711):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5688(%rax), %r11
+	movq	5848(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5688(%rax), %r11
+	movq	5848(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26756,19 +27648,19 @@ GL_PREFIX(_dispatch_stub_711):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5688(%rax), %r11
+	movq	5848(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_711), .-GL_PREFIX(_dispatch_stub_711)
+	.size	GL_PREFIX(_dispatch_stub_731), .-GL_PREFIX(_dispatch_stub_731)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_712)
-	.type	GL_PREFIX(_dispatch_stub_712), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_712))
-GL_PREFIX(_dispatch_stub_712):
+	.globl	GL_PREFIX(_dispatch_stub_732)
+	.type	GL_PREFIX(_dispatch_stub_732), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_732))
+GL_PREFIX(_dispatch_stub_732):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5696(%rax), %r11
+	movq	5856(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26786,13 +27678,13 @@ GL_PREFIX(_dispatch_stub_712):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5696(%rax), %r11
+	movq	5856(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5696(%rax), %r11
+	movq	5856(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26810,19 +27702,19 @@ GL_PREFIX(_dispatch_stub_712):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5696(%rax), %r11
+	movq	5856(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_712), .-GL_PREFIX(_dispatch_stub_712)
+	.size	GL_PREFIX(_dispatch_stub_732), .-GL_PREFIX(_dispatch_stub_732)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_713)
-	.type	GL_PREFIX(_dispatch_stub_713), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_713))
-GL_PREFIX(_dispatch_stub_713):
+	.globl	GL_PREFIX(_dispatch_stub_733)
+	.type	GL_PREFIX(_dispatch_stub_733), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_733))
+GL_PREFIX(_dispatch_stub_733):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5704(%rax), %r11
+	movq	5864(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26832,13 +27724,13 @@ GL_PREFIX(_dispatch_stub_713):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5704(%rax), %r11
+	movq	5864(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5704(%rax), %r11
+	movq	5864(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26848,49 +27740,49 @@ GL_PREFIX(_dispatch_stub_713):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5704(%rax), %r11
+	movq	5864(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_713), .-GL_PREFIX(_dispatch_stub_713)
+	.size	GL_PREFIX(_dispatch_stub_733), .-GL_PREFIX(_dispatch_stub_733)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_714)
-	.type	GL_PREFIX(_dispatch_stub_714), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_714))
-GL_PREFIX(_dispatch_stub_714):
+	.globl	GL_PREFIX(_dispatch_stub_734)
+	.type	GL_PREFIX(_dispatch_stub_734), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_734))
+GL_PREFIX(_dispatch_stub_734):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5712(%rax), %r11
+	movq	5872(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5712(%rax), %r11
+	movq	5872(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5712(%rax), %r11
+	movq	5872(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5712(%rax), %r11
+	movq	5872(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_714), .-GL_PREFIX(_dispatch_stub_714)
+	.size	GL_PREFIX(_dispatch_stub_734), .-GL_PREFIX(_dispatch_stub_734)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_715)
-	.type	GL_PREFIX(_dispatch_stub_715), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_715))
-GL_PREFIX(_dispatch_stub_715):
+	.globl	GL_PREFIX(_dispatch_stub_735)
+	.type	GL_PREFIX(_dispatch_stub_735), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_735))
+GL_PREFIX(_dispatch_stub_735):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5720(%rax), %r11
+	movq	5880(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26900,13 +27792,13 @@ GL_PREFIX(_dispatch_stub_715):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5720(%rax), %r11
+	movq	5880(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5720(%rax), %r11
+	movq	5880(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26916,19 +27808,19 @@ GL_PREFIX(_dispatch_stub_715):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5720(%rax), %r11
+	movq	5880(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_715), .-GL_PREFIX(_dispatch_stub_715)
+	.size	GL_PREFIX(_dispatch_stub_735), .-GL_PREFIX(_dispatch_stub_735)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_716)
-	.type	GL_PREFIX(_dispatch_stub_716), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_716))
-GL_PREFIX(_dispatch_stub_716):
+	.globl	GL_PREFIX(_dispatch_stub_736)
+	.type	GL_PREFIX(_dispatch_stub_736), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_736))
+GL_PREFIX(_dispatch_stub_736):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5728(%rax), %r11
+	movq	5888(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -26938,13 +27830,13 @@ GL_PREFIX(_dispatch_stub_716):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5728(%rax), %r11
+	movq	5888(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5728(%rax), %r11
+	movq	5888(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -26954,49 +27846,49 @@ GL_PREFIX(_dispatch_stub_716):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5728(%rax), %r11
+	movq	5888(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_716), .-GL_PREFIX(_dispatch_stub_716)
+	.size	GL_PREFIX(_dispatch_stub_736), .-GL_PREFIX(_dispatch_stub_736)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_717)
-	.type	GL_PREFIX(_dispatch_stub_717), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_717))
-GL_PREFIX(_dispatch_stub_717):
+	.globl	GL_PREFIX(_dispatch_stub_737)
+	.type	GL_PREFIX(_dispatch_stub_737), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_737))
+GL_PREFIX(_dispatch_stub_737):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5736(%rax), %r11
+	movq	5896(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5736(%rax), %r11
+	movq	5896(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5736(%rax), %r11
+	movq	5896(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5736(%rax), %r11
+	movq	5896(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_717), .-GL_PREFIX(_dispatch_stub_717)
+	.size	GL_PREFIX(_dispatch_stub_737), .-GL_PREFIX(_dispatch_stub_737)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_718)
-	.type	GL_PREFIX(_dispatch_stub_718), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_718))
-GL_PREFIX(_dispatch_stub_718):
+	.globl	GL_PREFIX(_dispatch_stub_738)
+	.type	GL_PREFIX(_dispatch_stub_738), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_738))
+GL_PREFIX(_dispatch_stub_738):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5744(%rax), %r11
+	movq	5904(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27006,13 +27898,13 @@ GL_PREFIX(_dispatch_stub_718):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5744(%rax), %r11
+	movq	5904(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5744(%rax), %r11
+	movq	5904(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27022,40 +27914,40 @@ GL_PREFIX(_dispatch_stub_718):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5744(%rax), %r11
+	movq	5904(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_718), .-GL_PREFIX(_dispatch_stub_718)
+	.size	GL_PREFIX(_dispatch_stub_738), .-GL_PREFIX(_dispatch_stub_738)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_719)
-	.type	GL_PREFIX(_dispatch_stub_719), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_719))
-GL_PREFIX(_dispatch_stub_719):
+	.globl	GL_PREFIX(_dispatch_stub_739)
+	.type	GL_PREFIX(_dispatch_stub_739), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_739))
+GL_PREFIX(_dispatch_stub_739):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5752(%rax), %r11
+	movq	5912(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5752(%rax), %r11
+	movq	5912(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5752(%rax), %r11
+	movq	5912(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5752(%rax), %r11
+	movq	5912(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_719), .-GL_PREFIX(_dispatch_stub_719)
+	.size	GL_PREFIX(_dispatch_stub_739), .-GL_PREFIX(_dispatch_stub_739)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(AreProgramsResidentNV)
@@ -27063,7 +27955,7 @@ GL_PREFIX(_dispatch_stub_719):
 GL_PREFIX(AreProgramsResidentNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5760(%rax), %r11
+	movq	5920(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27073,13 +27965,13 @@ GL_PREFIX(AreProgramsResidentNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5760(%rax), %r11
+	movq	5920(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5760(%rax), %r11
+	movq	5920(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27089,7 +27981,7 @@ GL_PREFIX(AreProgramsResidentNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5760(%rax), %r11
+	movq	5920(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(AreProgramsResidentNV), .-GL_PREFIX(AreProgramsResidentNV)
@@ -27100,7 +27992,7 @@ GL_PREFIX(AreProgramsResidentNV):
 GL_PREFIX(BindProgramNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5768(%rax), %r11
+	movq	5928(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27110,13 +28002,13 @@ GL_PREFIX(BindProgramNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5768(%rax), %r11
+	movq	5928(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5768(%rax), %r11
+	movq	5928(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27126,7 +28018,7 @@ GL_PREFIX(BindProgramNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5768(%rax), %r11
+	movq	5928(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindProgramNV), .-GL_PREFIX(BindProgramNV)
@@ -27137,7 +28029,7 @@ GL_PREFIX(BindProgramNV):
 GL_PREFIX(DeleteProgramsNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5776(%rax), %r11
+	movq	5936(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27147,13 +28039,13 @@ GL_PREFIX(DeleteProgramsNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5776(%rax), %r11
+	movq	5936(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5776(%rax), %r11
+	movq	5936(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27163,7 +28055,7 @@ GL_PREFIX(DeleteProgramsNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5776(%rax), %r11
+	movq	5936(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(DeleteProgramsNV), .-GL_PREFIX(DeleteProgramsNV)
@@ -27174,7 +28066,7 @@ GL_PREFIX(DeleteProgramsNV):
 GL_PREFIX(ExecuteProgramNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5784(%rax), %r11
+	movq	5944(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27184,13 +28076,13 @@ GL_PREFIX(ExecuteProgramNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5784(%rax), %r11
+	movq	5944(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5784(%rax), %r11
+	movq	5944(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27200,7 +28092,7 @@ GL_PREFIX(ExecuteProgramNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5784(%rax), %r11
+	movq	5944(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ExecuteProgramNV), .-GL_PREFIX(ExecuteProgramNV)
@@ -27211,7 +28103,7 @@ GL_PREFIX(ExecuteProgramNV):
 GL_PREFIX(GenProgramsNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5792(%rax), %r11
+	movq	5952(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27221,13 +28113,13 @@ GL_PREFIX(GenProgramsNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5792(%rax), %r11
+	movq	5952(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5792(%rax), %r11
+	movq	5952(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27237,7 +28129,7 @@ GL_PREFIX(GenProgramsNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5792(%rax), %r11
+	movq	5952(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GenProgramsNV), .-GL_PREFIX(GenProgramsNV)
@@ -27248,7 +28140,7 @@ GL_PREFIX(GenProgramsNV):
 GL_PREFIX(GetProgramParameterdvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5800(%rax), %r11
+	movq	5960(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27262,13 +28154,13 @@ GL_PREFIX(GetProgramParameterdvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5800(%rax), %r11
+	movq	5960(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5800(%rax), %r11
+	movq	5960(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27282,7 +28174,7 @@ GL_PREFIX(GetProgramParameterdvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5800(%rax), %r11
+	movq	5960(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetProgramParameterdvNV), .-GL_PREFIX(GetProgramParameterdvNV)
@@ -27293,7 +28185,7 @@ GL_PREFIX(GetProgramParameterdvNV):
 GL_PREFIX(GetProgramParameterfvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5808(%rax), %r11
+	movq	5968(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27307,13 +28199,13 @@ GL_PREFIX(GetProgramParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5808(%rax), %r11
+	movq	5968(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5808(%rax), %r11
+	movq	5968(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27327,7 +28219,7 @@ GL_PREFIX(GetProgramParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5808(%rax), %r11
+	movq	5968(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetProgramParameterfvNV), .-GL_PREFIX(GetProgramParameterfvNV)
@@ -27338,7 +28230,7 @@ GL_PREFIX(GetProgramParameterfvNV):
 GL_PREFIX(GetProgramStringNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5816(%rax), %r11
+	movq	5976(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27348,13 +28240,13 @@ GL_PREFIX(GetProgramStringNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5816(%rax), %r11
+	movq	5976(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5816(%rax), %r11
+	movq	5976(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27364,7 +28256,7 @@ GL_PREFIX(GetProgramStringNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5816(%rax), %r11
+	movq	5976(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetProgramStringNV), .-GL_PREFIX(GetProgramStringNV)
@@ -27375,7 +28267,7 @@ GL_PREFIX(GetProgramStringNV):
 GL_PREFIX(GetProgramivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5824(%rax), %r11
+	movq	5984(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27385,13 +28277,13 @@ GL_PREFIX(GetProgramivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5824(%rax), %r11
+	movq	5984(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5824(%rax), %r11
+	movq	5984(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27401,7 +28293,7 @@ GL_PREFIX(GetProgramivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5824(%rax), %r11
+	movq	5984(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetProgramivNV), .-GL_PREFIX(GetProgramivNV)
@@ -27412,7 +28304,7 @@ GL_PREFIX(GetProgramivNV):
 GL_PREFIX(GetTrackMatrixivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5832(%rax), %r11
+	movq	5992(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27426,13 +28318,13 @@ GL_PREFIX(GetTrackMatrixivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5832(%rax), %r11
+	movq	5992(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5832(%rax), %r11
+	movq	5992(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27446,7 +28338,7 @@ GL_PREFIX(GetTrackMatrixivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5832(%rax), %r11
+	movq	5992(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetTrackMatrixivNV), .-GL_PREFIX(GetTrackMatrixivNV)
@@ -27457,7 +28349,7 @@ GL_PREFIX(GetTrackMatrixivNV):
 GL_PREFIX(GetVertexAttribPointervNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5840(%rax), %r11
+	movq	6000(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27467,13 +28359,13 @@ GL_PREFIX(GetVertexAttribPointervNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5840(%rax), %r11
+	movq	6000(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5840(%rax), %r11
+	movq	6000(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27483,7 +28375,7 @@ GL_PREFIX(GetVertexAttribPointervNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5840(%rax), %r11
+	movq	6000(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetVertexAttribPointervNV), .-GL_PREFIX(GetVertexAttribPointervNV)
@@ -27494,7 +28386,7 @@ GL_PREFIX(GetVertexAttribPointervNV):
 GL_PREFIX(GetVertexAttribdvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5848(%rax), %r11
+	movq	6008(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27504,13 +28396,13 @@ GL_PREFIX(GetVertexAttribdvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5848(%rax), %r11
+	movq	6008(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5848(%rax), %r11
+	movq	6008(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27520,7 +28412,7 @@ GL_PREFIX(GetVertexAttribdvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5848(%rax), %r11
+	movq	6008(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetVertexAttribdvNV), .-GL_PREFIX(GetVertexAttribdvNV)
@@ -27531,7 +28423,7 @@ GL_PREFIX(GetVertexAttribdvNV):
 GL_PREFIX(GetVertexAttribfvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5856(%rax), %r11
+	movq	6016(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27541,13 +28433,13 @@ GL_PREFIX(GetVertexAttribfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5856(%rax), %r11
+	movq	6016(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5856(%rax), %r11
+	movq	6016(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27557,7 +28449,7 @@ GL_PREFIX(GetVertexAttribfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5856(%rax), %r11
+	movq	6016(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetVertexAttribfvNV), .-GL_PREFIX(GetVertexAttribfvNV)
@@ -27568,7 +28460,7 @@ GL_PREFIX(GetVertexAttribfvNV):
 GL_PREFIX(GetVertexAttribivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5864(%rax), %r11
+	movq	6024(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27578,13 +28470,13 @@ GL_PREFIX(GetVertexAttribivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5864(%rax), %r11
+	movq	6024(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5864(%rax), %r11
+	movq	6024(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27594,7 +28486,7 @@ GL_PREFIX(GetVertexAttribivNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5864(%rax), %r11
+	movq	6024(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetVertexAttribivNV), .-GL_PREFIX(GetVertexAttribivNV)
@@ -27605,25 +28497,25 @@ GL_PREFIX(GetVertexAttribivNV):
 GL_PREFIX(IsProgramNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5872(%rax), %r11
+	movq	6032(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	5872(%rax), %r11
+	movq	6032(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5872(%rax), %r11
+	movq	6032(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	5872(%rax), %r11
+	movq	6032(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(IsProgramNV), .-GL_PREFIX(IsProgramNV)
@@ -27634,7 +28526,7 @@ GL_PREFIX(IsProgramNV):
 GL_PREFIX(LoadProgramNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5880(%rax), %r11
+	movq	6040(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27648,13 +28540,13 @@ GL_PREFIX(LoadProgramNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5880(%rax), %r11
+	movq	6040(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5880(%rax), %r11
+	movq	6040(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27668,7 +28560,7 @@ GL_PREFIX(LoadProgramNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5880(%rax), %r11
+	movq	6040(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(LoadProgramNV), .-GL_PREFIX(LoadProgramNV)
@@ -27679,7 +28571,7 @@ GL_PREFIX(LoadProgramNV):
 GL_PREFIX(ProgramParameters4dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5888(%rax), %r11
+	movq	6048(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27693,13 +28585,13 @@ GL_PREFIX(ProgramParameters4dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5888(%rax), %r11
+	movq	6048(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5888(%rax), %r11
+	movq	6048(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27713,7 +28605,7 @@ GL_PREFIX(ProgramParameters4dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5888(%rax), %r11
+	movq	6048(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ProgramParameters4dvNV), .-GL_PREFIX(ProgramParameters4dvNV)
@@ -27724,7 +28616,7 @@ GL_PREFIX(ProgramParameters4dvNV):
 GL_PREFIX(ProgramParameters4fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5896(%rax), %r11
+	movq	6056(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27738,13 +28630,13 @@ GL_PREFIX(ProgramParameters4fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5896(%rax), %r11
+	movq	6056(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5896(%rax), %r11
+	movq	6056(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27758,7 +28650,7 @@ GL_PREFIX(ProgramParameters4fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5896(%rax), %r11
+	movq	6056(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ProgramParameters4fvNV), .-GL_PREFIX(ProgramParameters4fvNV)
@@ -27769,7 +28661,7 @@ GL_PREFIX(ProgramParameters4fvNV):
 GL_PREFIX(RequestResidentProgramsNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5904(%rax), %r11
+	movq	6064(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27779,13 +28671,13 @@ GL_PREFIX(RequestResidentProgramsNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5904(%rax), %r11
+	movq	6064(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5904(%rax), %r11
+	movq	6064(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27795,7 +28687,7 @@ GL_PREFIX(RequestResidentProgramsNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5904(%rax), %r11
+	movq	6064(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(RequestResidentProgramsNV), .-GL_PREFIX(RequestResidentProgramsNV)
@@ -27806,7 +28698,7 @@ GL_PREFIX(RequestResidentProgramsNV):
 GL_PREFIX(TrackMatrixNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5912(%rax), %r11
+	movq	6072(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27820,13 +28712,13 @@ GL_PREFIX(TrackMatrixNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5912(%rax), %r11
+	movq	6072(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5912(%rax), %r11
+	movq	6072(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27840,7 +28732,7 @@ GL_PREFIX(TrackMatrixNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	5912(%rax), %r11
+	movq	6072(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TrackMatrixNV), .-GL_PREFIX(TrackMatrixNV)
@@ -27851,7 +28743,7 @@ GL_PREFIX(TrackMatrixNV):
 GL_PREFIX(VertexAttrib1dNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5920(%rax), %r11
+	movq	6080(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -27861,13 +28753,13 @@ GL_PREFIX(VertexAttrib1dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5920(%rax), %r11
+	movq	6080(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5920(%rax), %r11
+	movq	6080(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -27877,7 +28769,7 @@ GL_PREFIX(VertexAttrib1dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5920(%rax), %r11
+	movq	6080(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib1dNV), .-GL_PREFIX(VertexAttrib1dNV)
@@ -27888,7 +28780,7 @@ GL_PREFIX(VertexAttrib1dNV):
 GL_PREFIX(VertexAttrib1dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5928(%rax), %r11
+	movq	6088(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27898,13 +28790,13 @@ GL_PREFIX(VertexAttrib1dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5928(%rax), %r11
+	movq	6088(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5928(%rax), %r11
+	movq	6088(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27914,7 +28806,7 @@ GL_PREFIX(VertexAttrib1dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5928(%rax), %r11
+	movq	6088(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib1dvNV), .-GL_PREFIX(VertexAttrib1dvNV)
@@ -27925,7 +28817,7 @@ GL_PREFIX(VertexAttrib1dvNV):
 GL_PREFIX(VertexAttrib1fNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5936(%rax), %r11
+	movq	6096(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -27935,13 +28827,13 @@ GL_PREFIX(VertexAttrib1fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5936(%rax), %r11
+	movq	6096(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5936(%rax), %r11
+	movq	6096(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -27951,7 +28843,7 @@ GL_PREFIX(VertexAttrib1fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5936(%rax), %r11
+	movq	6096(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib1fNV), .-GL_PREFIX(VertexAttrib1fNV)
@@ -27962,7 +28854,7 @@ GL_PREFIX(VertexAttrib1fNV):
 GL_PREFIX(VertexAttrib1fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5944(%rax), %r11
+	movq	6104(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -27972,13 +28864,13 @@ GL_PREFIX(VertexAttrib1fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5944(%rax), %r11
+	movq	6104(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5944(%rax), %r11
+	movq	6104(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -27988,7 +28880,7 @@ GL_PREFIX(VertexAttrib1fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5944(%rax), %r11
+	movq	6104(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib1fvNV), .-GL_PREFIX(VertexAttrib1fvNV)
@@ -27999,7 +28891,7 @@ GL_PREFIX(VertexAttrib1fvNV):
 GL_PREFIX(VertexAttrib1sNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5952(%rax), %r11
+	movq	6112(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28009,13 +28901,13 @@ GL_PREFIX(VertexAttrib1sNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5952(%rax), %r11
+	movq	6112(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5952(%rax), %r11
+	movq	6112(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28025,7 +28917,7 @@ GL_PREFIX(VertexAttrib1sNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5952(%rax), %r11
+	movq	6112(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib1sNV), .-GL_PREFIX(VertexAttrib1sNV)
@@ -28036,7 +28928,7 @@ GL_PREFIX(VertexAttrib1sNV):
 GL_PREFIX(VertexAttrib1svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5960(%rax), %r11
+	movq	6120(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28046,13 +28938,13 @@ GL_PREFIX(VertexAttrib1svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5960(%rax), %r11
+	movq	6120(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5960(%rax), %r11
+	movq	6120(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28062,7 +28954,7 @@ GL_PREFIX(VertexAttrib1svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5960(%rax), %r11
+	movq	6120(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib1svNV), .-GL_PREFIX(VertexAttrib1svNV)
@@ -28073,7 +28965,7 @@ GL_PREFIX(VertexAttrib1svNV):
 GL_PREFIX(VertexAttrib2dNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5968(%rax), %r11
+	movq	6128(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -28085,13 +28977,13 @@ GL_PREFIX(VertexAttrib2dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5968(%rax), %r11
+	movq	6128(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5968(%rax), %r11
+	movq	6128(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -28103,7 +28995,7 @@ GL_PREFIX(VertexAttrib2dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5968(%rax), %r11
+	movq	6128(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib2dNV), .-GL_PREFIX(VertexAttrib2dNV)
@@ -28114,7 +29006,7 @@ GL_PREFIX(VertexAttrib2dNV):
 GL_PREFIX(VertexAttrib2dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5976(%rax), %r11
+	movq	6136(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28124,13 +29016,13 @@ GL_PREFIX(VertexAttrib2dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5976(%rax), %r11
+	movq	6136(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5976(%rax), %r11
+	movq	6136(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28140,7 +29032,7 @@ GL_PREFIX(VertexAttrib2dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5976(%rax), %r11
+	movq	6136(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib2dvNV), .-GL_PREFIX(VertexAttrib2dvNV)
@@ -28151,7 +29043,7 @@ GL_PREFIX(VertexAttrib2dvNV):
 GL_PREFIX(VertexAttrib2fNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5984(%rax), %r11
+	movq	6144(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$24, %rsp
@@ -28163,13 +29055,13 @@ GL_PREFIX(VertexAttrib2fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5984(%rax), %r11
+	movq	6144(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5984(%rax), %r11
+	movq	6144(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$24, %rsp
@@ -28181,7 +29073,7 @@ GL_PREFIX(VertexAttrib2fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$24, %rsp
-	movq	5984(%rax), %r11
+	movq	6144(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib2fNV), .-GL_PREFIX(VertexAttrib2fNV)
@@ -28192,7 +29084,7 @@ GL_PREFIX(VertexAttrib2fNV):
 GL_PREFIX(VertexAttrib2fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	5992(%rax), %r11
+	movq	6152(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28202,13 +29094,13 @@ GL_PREFIX(VertexAttrib2fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5992(%rax), %r11
+	movq	6152(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	5992(%rax), %r11
+	movq	6152(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28218,7 +29110,7 @@ GL_PREFIX(VertexAttrib2fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	5992(%rax), %r11
+	movq	6152(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib2fvNV), .-GL_PREFIX(VertexAttrib2fvNV)
@@ -28229,7 +29121,7 @@ GL_PREFIX(VertexAttrib2fvNV):
 GL_PREFIX(VertexAttrib2sNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6000(%rax), %r11
+	movq	6160(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28239,13 +29131,13 @@ GL_PREFIX(VertexAttrib2sNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6000(%rax), %r11
+	movq	6160(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6000(%rax), %r11
+	movq	6160(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28255,7 +29147,7 @@ GL_PREFIX(VertexAttrib2sNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6000(%rax), %r11
+	movq	6160(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib2sNV), .-GL_PREFIX(VertexAttrib2sNV)
@@ -28266,7 +29158,7 @@ GL_PREFIX(VertexAttrib2sNV):
 GL_PREFIX(VertexAttrib2svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6008(%rax), %r11
+	movq	6168(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28276,13 +29168,13 @@ GL_PREFIX(VertexAttrib2svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6008(%rax), %r11
+	movq	6168(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6008(%rax), %r11
+	movq	6168(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28292,7 +29184,7 @@ GL_PREFIX(VertexAttrib2svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6008(%rax), %r11
+	movq	6168(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib2svNV), .-GL_PREFIX(VertexAttrib2svNV)
@@ -28303,7 +29195,7 @@ GL_PREFIX(VertexAttrib2svNV):
 GL_PREFIX(VertexAttrib3dNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6016(%rax), %r11
+	movq	6176(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$40, %rsp
@@ -28317,13 +29209,13 @@ GL_PREFIX(VertexAttrib3dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6016(%rax), %r11
+	movq	6176(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6016(%rax), %r11
+	movq	6176(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$40, %rsp
@@ -28337,7 +29229,7 @@ GL_PREFIX(VertexAttrib3dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6016(%rax), %r11
+	movq	6176(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib3dNV), .-GL_PREFIX(VertexAttrib3dNV)
@@ -28348,7 +29240,7 @@ GL_PREFIX(VertexAttrib3dNV):
 GL_PREFIX(VertexAttrib3dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6024(%rax), %r11
+	movq	6184(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28358,13 +29250,13 @@ GL_PREFIX(VertexAttrib3dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6024(%rax), %r11
+	movq	6184(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6024(%rax), %r11
+	movq	6184(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28374,7 +29266,7 @@ GL_PREFIX(VertexAttrib3dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6024(%rax), %r11
+	movq	6184(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib3dvNV), .-GL_PREFIX(VertexAttrib3dvNV)
@@ -28385,7 +29277,7 @@ GL_PREFIX(VertexAttrib3dvNV):
 GL_PREFIX(VertexAttrib3fNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6032(%rax), %r11
+	movq	6192(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$40, %rsp
@@ -28399,13 +29291,13 @@ GL_PREFIX(VertexAttrib3fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6032(%rax), %r11
+	movq	6192(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6032(%rax), %r11
+	movq	6192(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$40, %rsp
@@ -28419,7 +29311,7 @@ GL_PREFIX(VertexAttrib3fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6032(%rax), %r11
+	movq	6192(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib3fNV), .-GL_PREFIX(VertexAttrib3fNV)
@@ -28430,7 +29322,7 @@ GL_PREFIX(VertexAttrib3fNV):
 GL_PREFIX(VertexAttrib3fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6040(%rax), %r11
+	movq	6200(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28440,13 +29332,13 @@ GL_PREFIX(VertexAttrib3fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6040(%rax), %r11
+	movq	6200(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6040(%rax), %r11
+	movq	6200(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28456,7 +29348,7 @@ GL_PREFIX(VertexAttrib3fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6040(%rax), %r11
+	movq	6200(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib3fvNV), .-GL_PREFIX(VertexAttrib3fvNV)
@@ -28467,7 +29359,7 @@ GL_PREFIX(VertexAttrib3fvNV):
 GL_PREFIX(VertexAttrib3sNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6048(%rax), %r11
+	movq	6208(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28481,13 +29373,13 @@ GL_PREFIX(VertexAttrib3sNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6048(%rax), %r11
+	movq	6208(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6048(%rax), %r11
+	movq	6208(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28501,7 +29393,7 @@ GL_PREFIX(VertexAttrib3sNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6048(%rax), %r11
+	movq	6208(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib3sNV), .-GL_PREFIX(VertexAttrib3sNV)
@@ -28512,7 +29404,7 @@ GL_PREFIX(VertexAttrib3sNV):
 GL_PREFIX(VertexAttrib3svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6056(%rax), %r11
+	movq	6216(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28522,13 +29414,13 @@ GL_PREFIX(VertexAttrib3svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6056(%rax), %r11
+	movq	6216(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6056(%rax), %r11
+	movq	6216(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28538,7 +29430,7 @@ GL_PREFIX(VertexAttrib3svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6056(%rax), %r11
+	movq	6216(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib3svNV), .-GL_PREFIX(VertexAttrib3svNV)
@@ -28549,7 +29441,7 @@ GL_PREFIX(VertexAttrib3svNV):
 GL_PREFIX(VertexAttrib4dNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6064(%rax), %r11
+	movq	6224(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$40, %rsp
@@ -28565,13 +29457,13 @@ GL_PREFIX(VertexAttrib4dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6064(%rax), %r11
+	movq	6224(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6064(%rax), %r11
+	movq	6224(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$40, %rsp
@@ -28587,7 +29479,7 @@ GL_PREFIX(VertexAttrib4dNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6064(%rax), %r11
+	movq	6224(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4dNV), .-GL_PREFIX(VertexAttrib4dNV)
@@ -28598,7 +29490,7 @@ GL_PREFIX(VertexAttrib4dNV):
 GL_PREFIX(VertexAttrib4dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6072(%rax), %r11
+	movq	6232(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28608,13 +29500,13 @@ GL_PREFIX(VertexAttrib4dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6072(%rax), %r11
+	movq	6232(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6072(%rax), %r11
+	movq	6232(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28624,7 +29516,7 @@ GL_PREFIX(VertexAttrib4dvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6072(%rax), %r11
+	movq	6232(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4dvNV), .-GL_PREFIX(VertexAttrib4dvNV)
@@ -28635,7 +29527,7 @@ GL_PREFIX(VertexAttrib4dvNV):
 GL_PREFIX(VertexAttrib4fNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6080(%rax), %r11
+	movq	6240(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$40, %rsp
@@ -28651,13 +29543,13 @@ GL_PREFIX(VertexAttrib4fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6080(%rax), %r11
+	movq	6240(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6080(%rax), %r11
+	movq	6240(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$40, %rsp
@@ -28673,7 +29565,7 @@ GL_PREFIX(VertexAttrib4fNV):
 	movq	8(%rsp), %xmm0
 	movq	(%rsp), %rdi
 	addq	$40, %rsp
-	movq	6080(%rax), %r11
+	movq	6240(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4fNV), .-GL_PREFIX(VertexAttrib4fNV)
@@ -28684,7 +29576,7 @@ GL_PREFIX(VertexAttrib4fNV):
 GL_PREFIX(VertexAttrib4fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6088(%rax), %r11
+	movq	6248(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28694,13 +29586,13 @@ GL_PREFIX(VertexAttrib4fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6088(%rax), %r11
+	movq	6248(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6088(%rax), %r11
+	movq	6248(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28710,7 +29602,7 @@ GL_PREFIX(VertexAttrib4fvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6088(%rax), %r11
+	movq	6248(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4fvNV), .-GL_PREFIX(VertexAttrib4fvNV)
@@ -28721,7 +29613,7 @@ GL_PREFIX(VertexAttrib4fvNV):
 GL_PREFIX(VertexAttrib4sNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6096(%rax), %r11
+	movq	6256(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28735,13 +29627,13 @@ GL_PREFIX(VertexAttrib4sNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6096(%rax), %r11
+	movq	6256(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6096(%rax), %r11
+	movq	6256(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28755,7 +29647,7 @@ GL_PREFIX(VertexAttrib4sNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6096(%rax), %r11
+	movq	6256(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4sNV), .-GL_PREFIX(VertexAttrib4sNV)
@@ -28766,7 +29658,7 @@ GL_PREFIX(VertexAttrib4sNV):
 GL_PREFIX(VertexAttrib4svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6104(%rax), %r11
+	movq	6264(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28776,13 +29668,13 @@ GL_PREFIX(VertexAttrib4svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6104(%rax), %r11
+	movq	6264(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6104(%rax), %r11
+	movq	6264(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28792,7 +29684,7 @@ GL_PREFIX(VertexAttrib4svNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6104(%rax), %r11
+	movq	6264(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4svNV), .-GL_PREFIX(VertexAttrib4svNV)
@@ -28803,7 +29695,7 @@ GL_PREFIX(VertexAttrib4svNV):
 GL_PREFIX(VertexAttrib4ubNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6112(%rax), %r11
+	movq	6272(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28817,13 +29709,13 @@ GL_PREFIX(VertexAttrib4ubNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6112(%rax), %r11
+	movq	6272(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6112(%rax), %r11
+	movq	6272(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28837,7 +29729,7 @@ GL_PREFIX(VertexAttrib4ubNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6112(%rax), %r11
+	movq	6272(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4ubNV), .-GL_PREFIX(VertexAttrib4ubNV)
@@ -28848,7 +29740,7 @@ GL_PREFIX(VertexAttrib4ubNV):
 GL_PREFIX(VertexAttrib4ubvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6120(%rax), %r11
+	movq	6280(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28858,13 +29750,13 @@ GL_PREFIX(VertexAttrib4ubvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6120(%rax), %r11
+	movq	6280(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6120(%rax), %r11
+	movq	6280(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28874,7 +29766,7 @@ GL_PREFIX(VertexAttrib4ubvNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6120(%rax), %r11
+	movq	6280(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttrib4ubvNV), .-GL_PREFIX(VertexAttrib4ubvNV)
@@ -28885,7 +29777,7 @@ GL_PREFIX(VertexAttrib4ubvNV):
 GL_PREFIX(VertexAttribPointerNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6128(%rax), %r11
+	movq	6288(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28899,13 +29791,13 @@ GL_PREFIX(VertexAttribPointerNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6128(%rax), %r11
+	movq	6288(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6128(%rax), %r11
+	movq	6288(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28919,7 +29811,7 @@ GL_PREFIX(VertexAttribPointerNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6128(%rax), %r11
+	movq	6288(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribPointerNV), .-GL_PREFIX(VertexAttribPointerNV)
@@ -28930,7 +29822,7 @@ GL_PREFIX(VertexAttribPointerNV):
 GL_PREFIX(VertexAttribs1dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6136(%rax), %r11
+	movq	6296(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28940,13 +29832,13 @@ GL_PREFIX(VertexAttribs1dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6136(%rax), %r11
+	movq	6296(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6136(%rax), %r11
+	movq	6296(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28956,7 +29848,7 @@ GL_PREFIX(VertexAttribs1dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6136(%rax), %r11
+	movq	6296(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs1dvNV), .-GL_PREFIX(VertexAttribs1dvNV)
@@ -28967,7 +29859,7 @@ GL_PREFIX(VertexAttribs1dvNV):
 GL_PREFIX(VertexAttribs1fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6144(%rax), %r11
+	movq	6304(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -28977,13 +29869,13 @@ GL_PREFIX(VertexAttribs1fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6144(%rax), %r11
+	movq	6304(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6144(%rax), %r11
+	movq	6304(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -28993,7 +29885,7 @@ GL_PREFIX(VertexAttribs1fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6144(%rax), %r11
+	movq	6304(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs1fvNV), .-GL_PREFIX(VertexAttribs1fvNV)
@@ -29004,7 +29896,7 @@ GL_PREFIX(VertexAttribs1fvNV):
 GL_PREFIX(VertexAttribs1svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6152(%rax), %r11
+	movq	6312(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29014,13 +29906,13 @@ GL_PREFIX(VertexAttribs1svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6152(%rax), %r11
+	movq	6312(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6152(%rax), %r11
+	movq	6312(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29030,7 +29922,7 @@ GL_PREFIX(VertexAttribs1svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6152(%rax), %r11
+	movq	6312(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs1svNV), .-GL_PREFIX(VertexAttribs1svNV)
@@ -29041,7 +29933,7 @@ GL_PREFIX(VertexAttribs1svNV):
 GL_PREFIX(VertexAttribs2dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6160(%rax), %r11
+	movq	6320(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29051,13 +29943,13 @@ GL_PREFIX(VertexAttribs2dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6160(%rax), %r11
+	movq	6320(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6160(%rax), %r11
+	movq	6320(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29067,7 +29959,7 @@ GL_PREFIX(VertexAttribs2dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6160(%rax), %r11
+	movq	6320(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs2dvNV), .-GL_PREFIX(VertexAttribs2dvNV)
@@ -29078,7 +29970,7 @@ GL_PREFIX(VertexAttribs2dvNV):
 GL_PREFIX(VertexAttribs2fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6168(%rax), %r11
+	movq	6328(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29088,13 +29980,13 @@ GL_PREFIX(VertexAttribs2fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6168(%rax), %r11
+	movq	6328(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6168(%rax), %r11
+	movq	6328(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29104,7 +29996,7 @@ GL_PREFIX(VertexAttribs2fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6168(%rax), %r11
+	movq	6328(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs2fvNV), .-GL_PREFIX(VertexAttribs2fvNV)
@@ -29115,7 +30007,7 @@ GL_PREFIX(VertexAttribs2fvNV):
 GL_PREFIX(VertexAttribs2svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6176(%rax), %r11
+	movq	6336(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29125,13 +30017,13 @@ GL_PREFIX(VertexAttribs2svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6176(%rax), %r11
+	movq	6336(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6176(%rax), %r11
+	movq	6336(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29141,7 +30033,7 @@ GL_PREFIX(VertexAttribs2svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6176(%rax), %r11
+	movq	6336(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs2svNV), .-GL_PREFIX(VertexAttribs2svNV)
@@ -29152,7 +30044,7 @@ GL_PREFIX(VertexAttribs2svNV):
 GL_PREFIX(VertexAttribs3dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6184(%rax), %r11
+	movq	6344(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29162,13 +30054,13 @@ GL_PREFIX(VertexAttribs3dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6184(%rax), %r11
+	movq	6344(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6184(%rax), %r11
+	movq	6344(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29178,7 +30070,7 @@ GL_PREFIX(VertexAttribs3dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6184(%rax), %r11
+	movq	6344(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs3dvNV), .-GL_PREFIX(VertexAttribs3dvNV)
@@ -29189,7 +30081,7 @@ GL_PREFIX(VertexAttribs3dvNV):
 GL_PREFIX(VertexAttribs3fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6192(%rax), %r11
+	movq	6352(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29199,13 +30091,13 @@ GL_PREFIX(VertexAttribs3fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6192(%rax), %r11
+	movq	6352(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6192(%rax), %r11
+	movq	6352(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29215,7 +30107,7 @@ GL_PREFIX(VertexAttribs3fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6192(%rax), %r11
+	movq	6352(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs3fvNV), .-GL_PREFIX(VertexAttribs3fvNV)
@@ -29226,7 +30118,7 @@ GL_PREFIX(VertexAttribs3fvNV):
 GL_PREFIX(VertexAttribs3svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6200(%rax), %r11
+	movq	6360(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29236,13 +30128,13 @@ GL_PREFIX(VertexAttribs3svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6200(%rax), %r11
+	movq	6360(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6200(%rax), %r11
+	movq	6360(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29252,7 +30144,7 @@ GL_PREFIX(VertexAttribs3svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6200(%rax), %r11
+	movq	6360(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs3svNV), .-GL_PREFIX(VertexAttribs3svNV)
@@ -29263,7 +30155,7 @@ GL_PREFIX(VertexAttribs3svNV):
 GL_PREFIX(VertexAttribs4dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6208(%rax), %r11
+	movq	6368(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29273,13 +30165,13 @@ GL_PREFIX(VertexAttribs4dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6208(%rax), %r11
+	movq	6368(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6208(%rax), %r11
+	movq	6368(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29289,7 +30181,7 @@ GL_PREFIX(VertexAttribs4dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6208(%rax), %r11
+	movq	6368(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs4dvNV), .-GL_PREFIX(VertexAttribs4dvNV)
@@ -29300,7 +30192,7 @@ GL_PREFIX(VertexAttribs4dvNV):
 GL_PREFIX(VertexAttribs4fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6216(%rax), %r11
+	movq	6376(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29310,13 +30202,13 @@ GL_PREFIX(VertexAttribs4fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6216(%rax), %r11
+	movq	6376(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6216(%rax), %r11
+	movq	6376(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29326,7 +30218,7 @@ GL_PREFIX(VertexAttribs4fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6216(%rax), %r11
+	movq	6376(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs4fvNV), .-GL_PREFIX(VertexAttribs4fvNV)
@@ -29337,7 +30229,7 @@ GL_PREFIX(VertexAttribs4fvNV):
 GL_PREFIX(VertexAttribs4svNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6224(%rax), %r11
+	movq	6384(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29347,13 +30239,13 @@ GL_PREFIX(VertexAttribs4svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6224(%rax), %r11
+	movq	6384(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6224(%rax), %r11
+	movq	6384(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29363,7 +30255,7 @@ GL_PREFIX(VertexAttribs4svNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6224(%rax), %r11
+	movq	6384(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs4svNV), .-GL_PREFIX(VertexAttribs4svNV)
@@ -29374,7 +30266,7 @@ GL_PREFIX(VertexAttribs4svNV):
 GL_PREFIX(VertexAttribs4ubvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6232(%rax), %r11
+	movq	6392(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29384,13 +30276,13 @@ GL_PREFIX(VertexAttribs4ubvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6232(%rax), %r11
+	movq	6392(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6232(%rax), %r11
+	movq	6392(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29400,7 +30292,7 @@ GL_PREFIX(VertexAttribs4ubvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6232(%rax), %r11
+	movq	6392(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribs4ubvNV), .-GL_PREFIX(VertexAttribs4ubvNV)
@@ -29411,7 +30303,7 @@ GL_PREFIX(VertexAttribs4ubvNV):
 GL_PREFIX(GetTexBumpParameterfvATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6240(%rax), %r11
+	movq	6400(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29421,13 +30313,13 @@ GL_PREFIX(GetTexBumpParameterfvATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6240(%rax), %r11
+	movq	6400(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6240(%rax), %r11
+	movq	6400(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29437,7 +30329,7 @@ GL_PREFIX(GetTexBumpParameterfvATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6240(%rax), %r11
+	movq	6400(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetTexBumpParameterfvATI), .-GL_PREFIX(GetTexBumpParameterfvATI)
@@ -29448,7 +30340,7 @@ GL_PREFIX(GetTexBumpParameterfvATI):
 GL_PREFIX(GetTexBumpParameterivATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6248(%rax), %r11
+	movq	6408(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29458,13 +30350,13 @@ GL_PREFIX(GetTexBumpParameterivATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6248(%rax), %r11
+	movq	6408(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6248(%rax), %r11
+	movq	6408(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29474,7 +30366,7 @@ GL_PREFIX(GetTexBumpParameterivATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6248(%rax), %r11
+	movq	6408(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetTexBumpParameterivATI), .-GL_PREFIX(GetTexBumpParameterivATI)
@@ -29485,7 +30377,7 @@ GL_PREFIX(GetTexBumpParameterivATI):
 GL_PREFIX(TexBumpParameterfvATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6256(%rax), %r11
+	movq	6416(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29495,13 +30387,13 @@ GL_PREFIX(TexBumpParameterfvATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6256(%rax), %r11
+	movq	6416(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6256(%rax), %r11
+	movq	6416(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29511,7 +30403,7 @@ GL_PREFIX(TexBumpParameterfvATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6256(%rax), %r11
+	movq	6416(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TexBumpParameterfvATI), .-GL_PREFIX(TexBumpParameterfvATI)
@@ -29522,7 +30414,7 @@ GL_PREFIX(TexBumpParameterfvATI):
 GL_PREFIX(TexBumpParameterivATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6264(%rax), %r11
+	movq	6424(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29532,13 +30424,13 @@ GL_PREFIX(TexBumpParameterivATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6264(%rax), %r11
+	movq	6424(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6264(%rax), %r11
+	movq	6424(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29548,7 +30440,7 @@ GL_PREFIX(TexBumpParameterivATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6264(%rax), %r11
+	movq	6424(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TexBumpParameterivATI), .-GL_PREFIX(TexBumpParameterivATI)
@@ -29559,7 +30451,7 @@ GL_PREFIX(TexBumpParameterivATI):
 GL_PREFIX(AlphaFragmentOp1ATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6272(%rax), %r11
+	movq	6432(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29577,13 +30469,13 @@ GL_PREFIX(AlphaFragmentOp1ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6272(%rax), %r11
+	movq	6432(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6272(%rax), %r11
+	movq	6432(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29601,7 +30493,7 @@ GL_PREFIX(AlphaFragmentOp1ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6272(%rax), %r11
+	movq	6432(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(AlphaFragmentOp1ATI), .-GL_PREFIX(AlphaFragmentOp1ATI)
@@ -29612,7 +30504,7 @@ GL_PREFIX(AlphaFragmentOp1ATI):
 GL_PREFIX(AlphaFragmentOp2ATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6280(%rax), %r11
+	movq	6440(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29630,13 +30522,13 @@ GL_PREFIX(AlphaFragmentOp2ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6280(%rax), %r11
+	movq	6440(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6280(%rax), %r11
+	movq	6440(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29654,7 +30546,7 @@ GL_PREFIX(AlphaFragmentOp2ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6280(%rax), %r11
+	movq	6440(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(AlphaFragmentOp2ATI), .-GL_PREFIX(AlphaFragmentOp2ATI)
@@ -29665,7 +30557,7 @@ GL_PREFIX(AlphaFragmentOp2ATI):
 GL_PREFIX(AlphaFragmentOp3ATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6288(%rax), %r11
+	movq	6448(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29683,13 +30575,13 @@ GL_PREFIX(AlphaFragmentOp3ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6288(%rax), %r11
+	movq	6448(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6288(%rax), %r11
+	movq	6448(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29707,7 +30599,7 @@ GL_PREFIX(AlphaFragmentOp3ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6288(%rax), %r11
+	movq	6448(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(AlphaFragmentOp3ATI), .-GL_PREFIX(AlphaFragmentOp3ATI)
@@ -29718,25 +30610,25 @@ GL_PREFIX(AlphaFragmentOp3ATI):
 GL_PREFIX(BeginFragmentShaderATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6296(%rax), %r11
+	movq	6456(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	6296(%rax), %r11
+	movq	6456(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6296(%rax), %r11
+	movq	6456(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	6296(%rax), %r11
+	movq	6456(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BeginFragmentShaderATI), .-GL_PREFIX(BeginFragmentShaderATI)
@@ -29747,25 +30639,25 @@ GL_PREFIX(BeginFragmentShaderATI):
 GL_PREFIX(BindFragmentShaderATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6304(%rax), %r11
+	movq	6464(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6304(%rax), %r11
+	movq	6464(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6304(%rax), %r11
+	movq	6464(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6304(%rax), %r11
+	movq	6464(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindFragmentShaderATI), .-GL_PREFIX(BindFragmentShaderATI)
@@ -29776,7 +30668,7 @@ GL_PREFIX(BindFragmentShaderATI):
 GL_PREFIX(ColorFragmentOp1ATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6312(%rax), %r11
+	movq	6472(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29794,13 +30686,13 @@ GL_PREFIX(ColorFragmentOp1ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6312(%rax), %r11
+	movq	6472(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6312(%rax), %r11
+	movq	6472(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29818,7 +30710,7 @@ GL_PREFIX(ColorFragmentOp1ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6312(%rax), %r11
+	movq	6472(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ColorFragmentOp1ATI), .-GL_PREFIX(ColorFragmentOp1ATI)
@@ -29829,7 +30721,7 @@ GL_PREFIX(ColorFragmentOp1ATI):
 GL_PREFIX(ColorFragmentOp2ATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6320(%rax), %r11
+	movq	6480(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29847,13 +30739,13 @@ GL_PREFIX(ColorFragmentOp2ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6320(%rax), %r11
+	movq	6480(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6320(%rax), %r11
+	movq	6480(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29871,7 +30763,7 @@ GL_PREFIX(ColorFragmentOp2ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6320(%rax), %r11
+	movq	6480(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ColorFragmentOp2ATI), .-GL_PREFIX(ColorFragmentOp2ATI)
@@ -29882,7 +30774,7 @@ GL_PREFIX(ColorFragmentOp2ATI):
 GL_PREFIX(ColorFragmentOp3ATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6328(%rax), %r11
+	movq	6488(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -29900,13 +30792,13 @@ GL_PREFIX(ColorFragmentOp3ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6328(%rax), %r11
+	movq	6488(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6328(%rax), %r11
+	movq	6488(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -29924,7 +30816,7 @@ GL_PREFIX(ColorFragmentOp3ATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6328(%rax), %r11
+	movq	6488(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ColorFragmentOp3ATI), .-GL_PREFIX(ColorFragmentOp3ATI)
@@ -29935,25 +30827,25 @@ GL_PREFIX(ColorFragmentOp3ATI):
 GL_PREFIX(DeleteFragmentShaderATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6336(%rax), %r11
+	movq	6496(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6336(%rax), %r11
+	movq	6496(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6336(%rax), %r11
+	movq	6496(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6336(%rax), %r11
+	movq	6496(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(DeleteFragmentShaderATI), .-GL_PREFIX(DeleteFragmentShaderATI)
@@ -29964,25 +30856,25 @@ GL_PREFIX(DeleteFragmentShaderATI):
 GL_PREFIX(EndFragmentShaderATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6344(%rax), %r11
+	movq	6504(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	6344(%rax), %r11
+	movq	6504(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6344(%rax), %r11
+	movq	6504(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	6344(%rax), %r11
+	movq	6504(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(EndFragmentShaderATI), .-GL_PREFIX(EndFragmentShaderATI)
@@ -29993,25 +30885,25 @@ GL_PREFIX(EndFragmentShaderATI):
 GL_PREFIX(GenFragmentShadersATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6352(%rax), %r11
+	movq	6512(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6352(%rax), %r11
+	movq	6512(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6352(%rax), %r11
+	movq	6512(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6352(%rax), %r11
+	movq	6512(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GenFragmentShadersATI), .-GL_PREFIX(GenFragmentShadersATI)
@@ -30022,7 +30914,7 @@ GL_PREFIX(GenFragmentShadersATI):
 GL_PREFIX(PassTexCoordATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6360(%rax), %r11
+	movq	6520(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30032,13 +30924,13 @@ GL_PREFIX(PassTexCoordATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6360(%rax), %r11
+	movq	6520(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6360(%rax), %r11
+	movq	6520(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30048,7 +30940,7 @@ GL_PREFIX(PassTexCoordATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6360(%rax), %r11
+	movq	6520(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PassTexCoordATI), .-GL_PREFIX(PassTexCoordATI)
@@ -30059,7 +30951,7 @@ GL_PREFIX(PassTexCoordATI):
 GL_PREFIX(SampleMapATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6368(%rax), %r11
+	movq	6528(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30069,13 +30961,13 @@ GL_PREFIX(SampleMapATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6368(%rax), %r11
+	movq	6528(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6368(%rax), %r11
+	movq	6528(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30085,7 +30977,7 @@ GL_PREFIX(SampleMapATI):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6368(%rax), %r11
+	movq	6528(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SampleMapATI), .-GL_PREFIX(SampleMapATI)
@@ -30096,7 +30988,7 @@ GL_PREFIX(SampleMapATI):
 GL_PREFIX(SetFragmentShaderConstantATI):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6376(%rax), %r11
+	movq	6536(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30106,13 +30998,13 @@ GL_PREFIX(SetFragmentShaderConstantATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6376(%rax), %r11
+	movq	6536(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6376(%rax), %r11
+	movq	6536(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30122,7 +31014,7 @@ GL_PREFIX(SetFragmentShaderConstantATI):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6376(%rax), %r11
+	movq	6536(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(SetFragmentShaderConstantATI), .-GL_PREFIX(SetFragmentShaderConstantATI)
@@ -30133,7 +31025,7 @@ GL_PREFIX(SetFragmentShaderConstantATI):
 GL_PREFIX(PointParameteriNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6384(%rax), %r11
+	movq	6544(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30143,13 +31035,13 @@ GL_PREFIX(PointParameteriNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6384(%rax), %r11
+	movq	6544(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6384(%rax), %r11
+	movq	6544(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30159,7 +31051,7 @@ GL_PREFIX(PointParameteriNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6384(%rax), %r11
+	movq	6544(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PointParameteriNV), .-GL_PREFIX(PointParameteriNV)
@@ -30170,7 +31062,7 @@ GL_PREFIX(PointParameteriNV):
 GL_PREFIX(PointParameterivNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6392(%rax), %r11
+	movq	6552(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30180,13 +31072,13 @@ GL_PREFIX(PointParameterivNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6392(%rax), %r11
+	movq	6552(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6392(%rax), %r11
+	movq	6552(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30196,79 +31088,79 @@ GL_PREFIX(PointParameterivNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6392(%rax), %r11
+	movq	6552(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_800)
-	.type	GL_PREFIX(_dispatch_stub_800), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_800))
-GL_PREFIX(_dispatch_stub_800):
+	.globl	GL_PREFIX(_dispatch_stub_820)
+	.type	GL_PREFIX(_dispatch_stub_820), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_820))
+GL_PREFIX(_dispatch_stub_820):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6400(%rax), %r11
+	movq	6560(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6400(%rax), %r11
+	movq	6560(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6400(%rax), %r11
+	movq	6560(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6400(%rax), %r11
+	movq	6560(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_800), .-GL_PREFIX(_dispatch_stub_800)
+	.size	GL_PREFIX(_dispatch_stub_820), .-GL_PREFIX(_dispatch_stub_820)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_801)
-	.type	GL_PREFIX(_dispatch_stub_801), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_801))
-GL_PREFIX(_dispatch_stub_801):
+	.globl	GL_PREFIX(_dispatch_stub_821)
+	.type	GL_PREFIX(_dispatch_stub_821), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_821))
+GL_PREFIX(_dispatch_stub_821):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6408(%rax), %r11
+	movq	6568(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6408(%rax), %r11
+	movq	6568(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6408(%rax), %r11
+	movq	6568(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6408(%rax), %r11
+	movq	6568(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_801), .-GL_PREFIX(_dispatch_stub_801)
+	.size	GL_PREFIX(_dispatch_stub_821), .-GL_PREFIX(_dispatch_stub_821)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_802)
-	.type	GL_PREFIX(_dispatch_stub_802), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_802))
-GL_PREFIX(_dispatch_stub_802):
+	.globl	GL_PREFIX(_dispatch_stub_822)
+	.type	GL_PREFIX(_dispatch_stub_822), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_822))
+GL_PREFIX(_dispatch_stub_822):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6416(%rax), %r11
+	movq	6576(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30278,13 +31170,13 @@ GL_PREFIX(_dispatch_stub_802):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6416(%rax), %r11
+	movq	6576(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6416(%rax), %r11
+	movq	6576(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30294,19 +31186,19 @@ GL_PREFIX(_dispatch_stub_802):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6416(%rax), %r11
+	movq	6576(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_802), .-GL_PREFIX(_dispatch_stub_802)
+	.size	GL_PREFIX(_dispatch_stub_822), .-GL_PREFIX(_dispatch_stub_822)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_803)
-	.type	GL_PREFIX(_dispatch_stub_803), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_803))
-GL_PREFIX(_dispatch_stub_803):
+	.globl	GL_PREFIX(_dispatch_stub_823)
+	.type	GL_PREFIX(_dispatch_stub_823), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_823))
+GL_PREFIX(_dispatch_stub_823):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6424(%rax), %r11
+	movq	6584(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30316,13 +31208,13 @@ GL_PREFIX(_dispatch_stub_803):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6424(%rax), %r11
+	movq	6584(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6424(%rax), %r11
+	movq	6584(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30332,40 +31224,40 @@ GL_PREFIX(_dispatch_stub_803):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6424(%rax), %r11
+	movq	6584(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_803), .-GL_PREFIX(_dispatch_stub_803)
+	.size	GL_PREFIX(_dispatch_stub_823), .-GL_PREFIX(_dispatch_stub_823)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_804)
-	.type	GL_PREFIX(_dispatch_stub_804), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_804))
-GL_PREFIX(_dispatch_stub_804):
+	.globl	GL_PREFIX(_dispatch_stub_824)
+	.type	GL_PREFIX(_dispatch_stub_824), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_824))
+GL_PREFIX(_dispatch_stub_824):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6432(%rax), %r11
+	movq	6592(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6432(%rax), %r11
+	movq	6592(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6432(%rax), %r11
+	movq	6592(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6432(%rax), %r11
+	movq	6592(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_804), .-GL_PREFIX(_dispatch_stub_804)
+	.size	GL_PREFIX(_dispatch_stub_824), .-GL_PREFIX(_dispatch_stub_824)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(GetProgramNamedParameterdvNV)
@@ -30373,7 +31265,7 @@ GL_PREFIX(_dispatch_stub_804):
 GL_PREFIX(GetProgramNamedParameterdvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6440(%rax), %r11
+	movq	6600(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30387,13 +31279,13 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6440(%rax), %r11
+	movq	6600(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6440(%rax), %r11
+	movq	6600(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30407,7 +31299,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6440(%rax), %r11
+	movq	6600(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetProgramNamedParameterdvNV), .-GL_PREFIX(GetProgramNamedParameterdvNV)
@@ -30418,7 +31310,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
 GL_PREFIX(GetProgramNamedParameterfvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6448(%rax), %r11
+	movq	6608(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30432,13 +31324,13 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6448(%rax), %r11
+	movq	6608(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6448(%rax), %r11
+	movq	6608(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30452,7 +31344,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6448(%rax), %r11
+	movq	6608(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetProgramNamedParameterfvNV), .-GL_PREFIX(GetProgramNamedParameterfvNV)
@@ -30463,7 +31355,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
 GL_PREFIX(ProgramNamedParameter4dNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6456(%rax), %r11
+	movq	6616(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$56, %rsp
@@ -30483,13 +31375,13 @@ GL_PREFIX(ProgramNamedParameter4dNV):
 	movq	8(%rsp), %rsi
 	movq	(%rsp), %rdi
 	addq	$56, %rsp
-	movq	6456(%rax), %r11
+	movq	6616(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6456(%rax), %r11
+	movq	6616(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$56, %rsp
@@ -30509,7 +31401,7 @@ GL_PREFIX(ProgramNamedParameter4dNV):
 	movq	8(%rsp), %rsi
 	movq	(%rsp), %rdi
 	addq	$56, %rsp
-	movq	6456(%rax), %r11
+	movq	6616(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ProgramNamedParameter4dNV), .-GL_PREFIX(ProgramNamedParameter4dNV)
@@ -30520,7 +31412,7 @@ GL_PREFIX(ProgramNamedParameter4dNV):
 GL_PREFIX(ProgramNamedParameter4dvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6464(%rax), %r11
+	movq	6624(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30534,13 +31426,13 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6464(%rax), %r11
+	movq	6624(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6464(%rax), %r11
+	movq	6624(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30554,7 +31446,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6464(%rax), %r11
+	movq	6624(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ProgramNamedParameter4dvNV), .-GL_PREFIX(ProgramNamedParameter4dvNV)
@@ -30565,7 +31457,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
 GL_PREFIX(ProgramNamedParameter4fNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6472(%rax), %r11
+	movq	6632(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	subq	$56, %rsp
@@ -30585,13 +31477,13 @@ GL_PREFIX(ProgramNamedParameter4fNV):
 	movq	8(%rsp), %rsi
 	movq	(%rsp), %rdi
 	addq	$56, %rsp
-	movq	6472(%rax), %r11
+	movq	6632(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6472(%rax), %r11
+	movq	6632(%rax), %r11
 	jmp	*%r11
 1:
 	subq	$56, %rsp
@@ -30611,7 +31503,7 @@ GL_PREFIX(ProgramNamedParameter4fNV):
 	movq	8(%rsp), %rsi
 	movq	(%rsp), %rdi
 	addq	$56, %rsp
-	movq	6472(%rax), %r11
+	movq	6632(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ProgramNamedParameter4fNV), .-GL_PREFIX(ProgramNamedParameter4fNV)
@@ -30622,7 +31514,7 @@ GL_PREFIX(ProgramNamedParameter4fNV):
 GL_PREFIX(ProgramNamedParameter4fvNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6480(%rax), %r11
+	movq	6640(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30636,13 +31528,13 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6480(%rax), %r11
+	movq	6640(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6480(%rax), %r11
+	movq	6640(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30656,7 +31548,7 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6480(%rax), %r11
+	movq	6640(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ProgramNamedParameter4fvNV), .-GL_PREFIX(ProgramNamedParameter4fvNV)
@@ -30667,25 +31559,25 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
 GL_PREFIX(PrimitiveRestartIndexNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6488(%rax), %r11
+	movq	6648(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6488(%rax), %r11
+	movq	6648(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6488(%rax), %r11
+	movq	6648(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6488(%rax), %r11
+	movq	6648(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PrimitiveRestartIndexNV), .-GL_PREFIX(PrimitiveRestartIndexNV)
@@ -30696,37 +31588,37 @@ GL_PREFIX(PrimitiveRestartIndexNV):
 GL_PREFIX(PrimitiveRestartNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6496(%rax), %r11
+	movq	6656(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	6496(%rax), %r11
+	movq	6656(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6496(%rax), %r11
+	movq	6656(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	6496(%rax), %r11
+	movq	6656(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(PrimitiveRestartNV), .-GL_PREFIX(PrimitiveRestartNV)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_813)
-	.type	GL_PREFIX(_dispatch_stub_813), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_813))
-GL_PREFIX(_dispatch_stub_813):
+	.globl	GL_PREFIX(_dispatch_stub_833)
+	.type	GL_PREFIX(_dispatch_stub_833), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_833))
+GL_PREFIX(_dispatch_stub_833):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6504(%rax), %r11
+	movq	6664(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30736,13 +31628,13 @@ GL_PREFIX(_dispatch_stub_813):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6504(%rax), %r11
+	movq	6664(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6504(%rax), %r11
+	movq	6664(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30752,19 +31644,19 @@ GL_PREFIX(_dispatch_stub_813):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6504(%rax), %r11
+	movq	6664(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_813), .-GL_PREFIX(_dispatch_stub_813)
+	.size	GL_PREFIX(_dispatch_stub_833), .-GL_PREFIX(_dispatch_stub_833)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_814)
-	.type	GL_PREFIX(_dispatch_stub_814), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_814))
-GL_PREFIX(_dispatch_stub_814):
+	.globl	GL_PREFIX(_dispatch_stub_834)
+	.type	GL_PREFIX(_dispatch_stub_834), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_834))
+GL_PREFIX(_dispatch_stub_834):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6512(%rax), %r11
+	movq	6672(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30774,13 +31666,13 @@ GL_PREFIX(_dispatch_stub_814):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6512(%rax), %r11
+	movq	6672(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6512(%rax), %r11
+	movq	6672(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30790,10 +31682,10 @@ GL_PREFIX(_dispatch_stub_814):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6512(%rax), %r11
+	movq	6672(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_814), .-GL_PREFIX(_dispatch_stub_814)
+	.size	GL_PREFIX(_dispatch_stub_834), .-GL_PREFIX(_dispatch_stub_834)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(BindFramebufferEXT)
@@ -30801,7 +31693,7 @@ GL_PREFIX(_dispatch_stub_814):
 GL_PREFIX(BindFramebufferEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6520(%rax), %r11
+	movq	6680(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30811,13 +31703,13 @@ GL_PREFIX(BindFramebufferEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6520(%rax), %r11
+	movq	6680(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6520(%rax), %r11
+	movq	6680(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30827,7 +31719,7 @@ GL_PREFIX(BindFramebufferEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6520(%rax), %r11
+	movq	6680(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT)
@@ -30838,7 +31730,7 @@ GL_PREFIX(BindFramebufferEXT):
 GL_PREFIX(BindRenderbufferEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6528(%rax), %r11
+	movq	6688(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30848,13 +31740,13 @@ GL_PREFIX(BindRenderbufferEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6528(%rax), %r11
+	movq	6688(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6528(%rax), %r11
+	movq	6688(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30864,7 +31756,7 @@ GL_PREFIX(BindRenderbufferEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6528(%rax), %r11
+	movq	6688(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT)
@@ -30875,25 +31767,25 @@ GL_PREFIX(BindRenderbufferEXT):
 GL_PREFIX(CheckFramebufferStatusEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6536(%rax), %r11
+	movq	6696(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6536(%rax), %r11
+	movq	6696(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6536(%rax), %r11
+	movq	6696(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6536(%rax), %r11
+	movq	6696(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT)
@@ -30904,7 +31796,7 @@ GL_PREFIX(CheckFramebufferStatusEXT):
 GL_PREFIX(DeleteFramebuffersEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6544(%rax), %r11
+	movq	6704(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30914,13 +31806,13 @@ GL_PREFIX(DeleteFramebuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6544(%rax), %r11
+	movq	6704(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6544(%rax), %r11
+	movq	6704(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30930,7 +31822,7 @@ GL_PREFIX(DeleteFramebuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6544(%rax), %r11
+	movq	6704(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT)
@@ -30941,7 +31833,7 @@ GL_PREFIX(DeleteFramebuffersEXT):
 GL_PREFIX(DeleteRenderbuffersEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6552(%rax), %r11
+	movq	6712(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30951,13 +31843,13 @@ GL_PREFIX(DeleteRenderbuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6552(%rax), %r11
+	movq	6712(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6552(%rax), %r11
+	movq	6712(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -30967,7 +31859,7 @@ GL_PREFIX(DeleteRenderbuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6552(%rax), %r11
+	movq	6712(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT)
@@ -30978,7 +31870,7 @@ GL_PREFIX(DeleteRenderbuffersEXT):
 GL_PREFIX(FramebufferRenderbufferEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6560(%rax), %r11
+	movq	6720(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -30992,13 +31884,13 @@ GL_PREFIX(FramebufferRenderbufferEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6560(%rax), %r11
+	movq	6720(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6560(%rax), %r11
+	movq	6720(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31012,7 +31904,7 @@ GL_PREFIX(FramebufferRenderbufferEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6560(%rax), %r11
+	movq	6720(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT)
@@ -31023,7 +31915,7 @@ GL_PREFIX(FramebufferRenderbufferEXT):
 GL_PREFIX(FramebufferTexture1DEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6568(%rax), %r11
+	movq	6728(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31037,13 +31929,13 @@ GL_PREFIX(FramebufferTexture1DEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6568(%rax), %r11
+	movq	6728(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6568(%rax), %r11
+	movq	6728(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31057,7 +31949,7 @@ GL_PREFIX(FramebufferTexture1DEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6568(%rax), %r11
+	movq	6728(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT)
@@ -31068,7 +31960,7 @@ GL_PREFIX(FramebufferTexture1DEXT):
 GL_PREFIX(FramebufferTexture2DEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6576(%rax), %r11
+	movq	6736(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31082,13 +31974,13 @@ GL_PREFIX(FramebufferTexture2DEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6576(%rax), %r11
+	movq	6736(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6576(%rax), %r11
+	movq	6736(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31102,7 +31994,7 @@ GL_PREFIX(FramebufferTexture2DEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6576(%rax), %r11
+	movq	6736(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT)
@@ -31113,7 +32005,7 @@ GL_PREFIX(FramebufferTexture2DEXT):
 GL_PREFIX(FramebufferTexture3DEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6584(%rax), %r11
+	movq	6744(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31131,13 +32023,13 @@ GL_PREFIX(FramebufferTexture3DEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6584(%rax), %r11
+	movq	6744(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6584(%rax), %r11
+	movq	6744(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31155,7 +32047,7 @@ GL_PREFIX(FramebufferTexture3DEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6584(%rax), %r11
+	movq	6744(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT)
@@ -31166,7 +32058,7 @@ GL_PREFIX(FramebufferTexture3DEXT):
 GL_PREFIX(GenFramebuffersEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6592(%rax), %r11
+	movq	6752(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31176,13 +32068,13 @@ GL_PREFIX(GenFramebuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6592(%rax), %r11
+	movq	6752(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6592(%rax), %r11
+	movq	6752(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31192,7 +32084,7 @@ GL_PREFIX(GenFramebuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6592(%rax), %r11
+	movq	6752(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT)
@@ -31203,7 +32095,7 @@ GL_PREFIX(GenFramebuffersEXT):
 GL_PREFIX(GenRenderbuffersEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6600(%rax), %r11
+	movq	6760(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31213,13 +32105,13 @@ GL_PREFIX(GenRenderbuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6600(%rax), %r11
+	movq	6760(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6600(%rax), %r11
+	movq	6760(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31229,7 +32121,7 @@ GL_PREFIX(GenRenderbuffersEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6600(%rax), %r11
+	movq	6760(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT)
@@ -31240,25 +32132,25 @@ GL_PREFIX(GenRenderbuffersEXT):
 GL_PREFIX(GenerateMipmapEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6608(%rax), %r11
+	movq	6768(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6608(%rax), %r11
+	movq	6768(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6608(%rax), %r11
+	movq	6768(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6608(%rax), %r11
+	movq	6768(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT)
@@ -31269,7 +32161,7 @@ GL_PREFIX(GenerateMipmapEXT):
 GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6616(%rax), %r11
+	movq	6776(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31283,13 +32175,13 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6616(%rax), %r11
+	movq	6776(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6616(%rax), %r11
+	movq	6776(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31303,7 +32195,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6616(%rax), %r11
+	movq	6776(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT)
@@ -31314,7 +32206,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
 GL_PREFIX(GetRenderbufferParameterivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6624(%rax), %r11
+	movq	6784(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31324,13 +32216,13 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6624(%rax), %r11
+	movq	6784(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6624(%rax), %r11
+	movq	6784(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31340,7 +32232,7 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6624(%rax), %r11
+	movq	6784(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT)
@@ -31351,25 +32243,25 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
 GL_PREFIX(IsFramebufferEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6632(%rax), %r11
+	movq	6792(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6632(%rax), %r11
+	movq	6792(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6632(%rax), %r11
+	movq	6792(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6632(%rax), %r11
+	movq	6792(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT)
@@ -31380,25 +32272,25 @@ GL_PREFIX(IsFramebufferEXT):
 GL_PREFIX(IsRenderbufferEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6640(%rax), %r11
+	movq	6800(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	6640(%rax), %r11
+	movq	6800(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6640(%rax), %r11
+	movq	6800(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	6640(%rax), %r11
+	movq	6800(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT)
@@ -31409,7 +32301,7 @@ GL_PREFIX(IsRenderbufferEXT):
 GL_PREFIX(RenderbufferStorageEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6648(%rax), %r11
+	movq	6808(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31423,13 +32315,13 @@ GL_PREFIX(RenderbufferStorageEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6648(%rax), %r11
+	movq	6808(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6648(%rax), %r11
+	movq	6808(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31443,19 +32335,19 @@ GL_PREFIX(RenderbufferStorageEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6648(%rax), %r11
+	movq	6808(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_832)
-	.type	GL_PREFIX(_dispatch_stub_832), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_832))
-GL_PREFIX(_dispatch_stub_832):
+	.globl	GL_PREFIX(_dispatch_stub_852)
+	.type	GL_PREFIX(_dispatch_stub_852), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_852))
+GL_PREFIX(_dispatch_stub_852):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6656(%rax), %r11
+	movq	6816(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31473,13 +32365,13 @@ GL_PREFIX(_dispatch_stub_832):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6656(%rax), %r11
+	movq	6816(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6656(%rax), %r11
+	movq	6816(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31497,19 +32389,19 @@ GL_PREFIX(_dispatch_stub_832):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6656(%rax), %r11
+	movq	6816(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_832), .-GL_PREFIX(_dispatch_stub_832)
+	.size	GL_PREFIX(_dispatch_stub_852), .-GL_PREFIX(_dispatch_stub_852)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_833)
-	.type	GL_PREFIX(_dispatch_stub_833), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_833))
-GL_PREFIX(_dispatch_stub_833):
+	.globl	GL_PREFIX(_dispatch_stub_853)
+	.type	GL_PREFIX(_dispatch_stub_853), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_853))
+GL_PREFIX(_dispatch_stub_853):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6664(%rax), %r11
+	movq	6824(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31519,13 +32411,13 @@ GL_PREFIX(_dispatch_stub_833):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6664(%rax), %r11
+	movq	6824(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6664(%rax), %r11
+	movq	6824(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31535,19 +32427,19 @@ GL_PREFIX(_dispatch_stub_833):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6664(%rax), %r11
+	movq	6824(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_833), .-GL_PREFIX(_dispatch_stub_833)
+	.size	GL_PREFIX(_dispatch_stub_853), .-GL_PREFIX(_dispatch_stub_853)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_834)
-	.type	GL_PREFIX(_dispatch_stub_834), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_834))
-GL_PREFIX(_dispatch_stub_834):
+	.globl	GL_PREFIX(_dispatch_stub_854)
+	.type	GL_PREFIX(_dispatch_stub_854), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_854))
+GL_PREFIX(_dispatch_stub_854):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6672(%rax), %r11
+	movq	6832(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31557,13 +32449,13 @@ GL_PREFIX(_dispatch_stub_834):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6672(%rax), %r11
+	movq	6832(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6672(%rax), %r11
+	movq	6832(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31573,10 +32465,10 @@ GL_PREFIX(_dispatch_stub_834):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6672(%rax), %r11
+	movq	6832(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_834), .-GL_PREFIX(_dispatch_stub_834)
+	.size	GL_PREFIX(_dispatch_stub_854), .-GL_PREFIX(_dispatch_stub_854)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(BindFragDataLocationEXT)
@@ -31584,7 +32476,7 @@ GL_PREFIX(_dispatch_stub_834):
 GL_PREFIX(BindFragDataLocationEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6680(%rax), %r11
+	movq	6840(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31594,13 +32486,13 @@ GL_PREFIX(BindFragDataLocationEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6680(%rax), %r11
+	movq	6840(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6680(%rax), %r11
+	movq	6840(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31610,7 +32502,7 @@ GL_PREFIX(BindFragDataLocationEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6680(%rax), %r11
+	movq	6840(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindFragDataLocationEXT), .-GL_PREFIX(BindFragDataLocationEXT)
@@ -31621,7 +32513,7 @@ GL_PREFIX(BindFragDataLocationEXT):
 GL_PREFIX(GetFragDataLocationEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6688(%rax), %r11
+	movq	6848(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31631,13 +32523,13 @@ GL_PREFIX(GetFragDataLocationEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6688(%rax), %r11
+	movq	6848(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6688(%rax), %r11
+	movq	6848(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31647,7 +32539,7 @@ GL_PREFIX(GetFragDataLocationEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6688(%rax), %r11
+	movq	6848(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetFragDataLocationEXT), .-GL_PREFIX(GetFragDataLocationEXT)
@@ -31658,7 +32550,7 @@ GL_PREFIX(GetFragDataLocationEXT):
 GL_PREFIX(GetUniformuivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6696(%rax), %r11
+	movq	6856(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31668,13 +32560,13 @@ GL_PREFIX(GetUniformuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6696(%rax), %r11
+	movq	6856(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6696(%rax), %r11
+	movq	6856(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31684,7 +32576,7 @@ GL_PREFIX(GetUniformuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6696(%rax), %r11
+	movq	6856(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetUniformuivEXT), .-GL_PREFIX(GetUniformuivEXT)
@@ -31695,7 +32587,7 @@ GL_PREFIX(GetUniformuivEXT):
 GL_PREFIX(GetVertexAttribIivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6704(%rax), %r11
+	movq	6864(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31705,13 +32597,13 @@ GL_PREFIX(GetVertexAttribIivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6704(%rax), %r11
+	movq	6864(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6704(%rax), %r11
+	movq	6864(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31721,7 +32613,7 @@ GL_PREFIX(GetVertexAttribIivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6704(%rax), %r11
+	movq	6864(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetVertexAttribIivEXT), .-GL_PREFIX(GetVertexAttribIivEXT)
@@ -31732,7 +32624,7 @@ GL_PREFIX(GetVertexAttribIivEXT):
 GL_PREFIX(GetVertexAttribIuivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6712(%rax), %r11
+	movq	6872(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31742,13 +32634,13 @@ GL_PREFIX(GetVertexAttribIuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6712(%rax), %r11
+	movq	6872(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6712(%rax), %r11
+	movq	6872(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31758,7 +32650,7 @@ GL_PREFIX(GetVertexAttribIuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6712(%rax), %r11
+	movq	6872(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetVertexAttribIuivEXT), .-GL_PREFIX(GetVertexAttribIuivEXT)
@@ -31769,7 +32661,7 @@ GL_PREFIX(GetVertexAttribIuivEXT):
 GL_PREFIX(Uniform1uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6720(%rax), %r11
+	movq	6880(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31779,13 +32671,13 @@ GL_PREFIX(Uniform1uiEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6720(%rax), %r11
+	movq	6880(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6720(%rax), %r11
+	movq	6880(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31795,7 +32687,7 @@ GL_PREFIX(Uniform1uiEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6720(%rax), %r11
+	movq	6880(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform1uiEXT), .-GL_PREFIX(Uniform1uiEXT)
@@ -31806,7 +32698,7 @@ GL_PREFIX(Uniform1uiEXT):
 GL_PREFIX(Uniform1uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6728(%rax), %r11
+	movq	6888(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31816,13 +32708,13 @@ GL_PREFIX(Uniform1uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6728(%rax), %r11
+	movq	6888(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6728(%rax), %r11
+	movq	6888(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31832,7 +32724,7 @@ GL_PREFIX(Uniform1uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6728(%rax), %r11
+	movq	6888(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform1uivEXT), .-GL_PREFIX(Uniform1uivEXT)
@@ -31843,7 +32735,7 @@ GL_PREFIX(Uniform1uivEXT):
 GL_PREFIX(Uniform2uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6736(%rax), %r11
+	movq	6896(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31853,13 +32745,13 @@ GL_PREFIX(Uniform2uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6736(%rax), %r11
+	movq	6896(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6736(%rax), %r11
+	movq	6896(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31869,7 +32761,7 @@ GL_PREFIX(Uniform2uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6736(%rax), %r11
+	movq	6896(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform2uiEXT), .-GL_PREFIX(Uniform2uiEXT)
@@ -31880,7 +32772,7 @@ GL_PREFIX(Uniform2uiEXT):
 GL_PREFIX(Uniform2uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6744(%rax), %r11
+	movq	6904(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31890,13 +32782,13 @@ GL_PREFIX(Uniform2uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6744(%rax), %r11
+	movq	6904(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6744(%rax), %r11
+	movq	6904(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31906,7 +32798,7 @@ GL_PREFIX(Uniform2uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6744(%rax), %r11
+	movq	6904(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform2uivEXT), .-GL_PREFIX(Uniform2uivEXT)
@@ -31917,7 +32809,7 @@ GL_PREFIX(Uniform2uivEXT):
 GL_PREFIX(Uniform3uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6752(%rax), %r11
+	movq	6912(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31931,13 +32823,13 @@ GL_PREFIX(Uniform3uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6752(%rax), %r11
+	movq	6912(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6752(%rax), %r11
+	movq	6912(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31951,7 +32843,7 @@ GL_PREFIX(Uniform3uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6752(%rax), %r11
+	movq	6912(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform3uiEXT), .-GL_PREFIX(Uniform3uiEXT)
@@ -31962,7 +32854,7 @@ GL_PREFIX(Uniform3uiEXT):
 GL_PREFIX(Uniform3uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6760(%rax), %r11
+	movq	6920(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -31972,13 +32864,13 @@ GL_PREFIX(Uniform3uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6760(%rax), %r11
+	movq	6920(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6760(%rax), %r11
+	movq	6920(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -31988,7 +32880,7 @@ GL_PREFIX(Uniform3uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6760(%rax), %r11
+	movq	6920(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform3uivEXT), .-GL_PREFIX(Uniform3uivEXT)
@@ -31999,7 +32891,7 @@ GL_PREFIX(Uniform3uivEXT):
 GL_PREFIX(Uniform4uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6768(%rax), %r11
+	movq	6928(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32013,13 +32905,13 @@ GL_PREFIX(Uniform4uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6768(%rax), %r11
+	movq	6928(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6768(%rax), %r11
+	movq	6928(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32033,7 +32925,7 @@ GL_PREFIX(Uniform4uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6768(%rax), %r11
+	movq	6928(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform4uiEXT), .-GL_PREFIX(Uniform4uiEXT)
@@ -32044,7 +32936,7 @@ GL_PREFIX(Uniform4uiEXT):
 GL_PREFIX(Uniform4uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6776(%rax), %r11
+	movq	6936(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32054,13 +32946,13 @@ GL_PREFIX(Uniform4uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6776(%rax), %r11
+	movq	6936(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6776(%rax), %r11
+	movq	6936(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32070,7 +32962,7 @@ GL_PREFIX(Uniform4uivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6776(%rax), %r11
+	movq	6936(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(Uniform4uivEXT), .-GL_PREFIX(Uniform4uivEXT)
@@ -32081,7 +32973,7 @@ GL_PREFIX(Uniform4uivEXT):
 GL_PREFIX(VertexAttribI1iEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6784(%rax), %r11
+	movq	6944(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32091,13 +32983,13 @@ GL_PREFIX(VertexAttribI1iEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6784(%rax), %r11
+	movq	6944(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6784(%rax), %r11
+	movq	6944(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32107,7 +32999,7 @@ GL_PREFIX(VertexAttribI1iEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6784(%rax), %r11
+	movq	6944(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI1iEXT), .-GL_PREFIX(VertexAttribI1iEXT)
@@ -32118,7 +33010,7 @@ GL_PREFIX(VertexAttribI1iEXT):
 GL_PREFIX(VertexAttribI1ivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6792(%rax), %r11
+	movq	6952(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32128,13 +33020,13 @@ GL_PREFIX(VertexAttribI1ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6792(%rax), %r11
+	movq	6952(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6792(%rax), %r11
+	movq	6952(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32144,7 +33036,7 @@ GL_PREFIX(VertexAttribI1ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6792(%rax), %r11
+	movq	6952(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI1ivEXT), .-GL_PREFIX(VertexAttribI1ivEXT)
@@ -32155,7 +33047,7 @@ GL_PREFIX(VertexAttribI1ivEXT):
 GL_PREFIX(VertexAttribI1uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6800(%rax), %r11
+	movq	6960(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32165,13 +33057,13 @@ GL_PREFIX(VertexAttribI1uiEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6800(%rax), %r11
+	movq	6960(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6800(%rax), %r11
+	movq	6960(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32181,7 +33073,7 @@ GL_PREFIX(VertexAttribI1uiEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6800(%rax), %r11
+	movq	6960(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI1uiEXT), .-GL_PREFIX(VertexAttribI1uiEXT)
@@ -32192,7 +33084,7 @@ GL_PREFIX(VertexAttribI1uiEXT):
 GL_PREFIX(VertexAttribI1uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6808(%rax), %r11
+	movq	6968(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32202,13 +33094,13 @@ GL_PREFIX(VertexAttribI1uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6808(%rax), %r11
+	movq	6968(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6808(%rax), %r11
+	movq	6968(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32218,7 +33110,7 @@ GL_PREFIX(VertexAttribI1uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6808(%rax), %r11
+	movq	6968(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI1uivEXT), .-GL_PREFIX(VertexAttribI1uivEXT)
@@ -32229,7 +33121,7 @@ GL_PREFIX(VertexAttribI1uivEXT):
 GL_PREFIX(VertexAttribI2iEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6816(%rax), %r11
+	movq	6976(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32239,13 +33131,13 @@ GL_PREFIX(VertexAttribI2iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6816(%rax), %r11
+	movq	6976(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6816(%rax), %r11
+	movq	6976(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32255,7 +33147,7 @@ GL_PREFIX(VertexAttribI2iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6816(%rax), %r11
+	movq	6976(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI2iEXT), .-GL_PREFIX(VertexAttribI2iEXT)
@@ -32266,7 +33158,7 @@ GL_PREFIX(VertexAttribI2iEXT):
 GL_PREFIX(VertexAttribI2ivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6824(%rax), %r11
+	movq	6984(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32276,13 +33168,13 @@ GL_PREFIX(VertexAttribI2ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6824(%rax), %r11
+	movq	6984(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6824(%rax), %r11
+	movq	6984(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32292,7 +33184,7 @@ GL_PREFIX(VertexAttribI2ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6824(%rax), %r11
+	movq	6984(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI2ivEXT), .-GL_PREFIX(VertexAttribI2ivEXT)
@@ -32303,7 +33195,7 @@ GL_PREFIX(VertexAttribI2ivEXT):
 GL_PREFIX(VertexAttribI2uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6832(%rax), %r11
+	movq	6992(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32313,13 +33205,13 @@ GL_PREFIX(VertexAttribI2uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6832(%rax), %r11
+	movq	6992(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6832(%rax), %r11
+	movq	6992(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32329,7 +33221,7 @@ GL_PREFIX(VertexAttribI2uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6832(%rax), %r11
+	movq	6992(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI2uiEXT), .-GL_PREFIX(VertexAttribI2uiEXT)
@@ -32340,7 +33232,7 @@ GL_PREFIX(VertexAttribI2uiEXT):
 GL_PREFIX(VertexAttribI2uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6840(%rax), %r11
+	movq	7000(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32350,13 +33242,13 @@ GL_PREFIX(VertexAttribI2uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6840(%rax), %r11
+	movq	7000(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6840(%rax), %r11
+	movq	7000(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32366,7 +33258,7 @@ GL_PREFIX(VertexAttribI2uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6840(%rax), %r11
+	movq	7000(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI2uivEXT), .-GL_PREFIX(VertexAttribI2uivEXT)
@@ -32377,7 +33269,7 @@ GL_PREFIX(VertexAttribI2uivEXT):
 GL_PREFIX(VertexAttribI3iEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6848(%rax), %r11
+	movq	7008(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32391,13 +33283,13 @@ GL_PREFIX(VertexAttribI3iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6848(%rax), %r11
+	movq	7008(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6848(%rax), %r11
+	movq	7008(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32411,7 +33303,7 @@ GL_PREFIX(VertexAttribI3iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6848(%rax), %r11
+	movq	7008(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI3iEXT), .-GL_PREFIX(VertexAttribI3iEXT)
@@ -32422,7 +33314,7 @@ GL_PREFIX(VertexAttribI3iEXT):
 GL_PREFIX(VertexAttribI3ivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6856(%rax), %r11
+	movq	7016(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32432,13 +33324,13 @@ GL_PREFIX(VertexAttribI3ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6856(%rax), %r11
+	movq	7016(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6856(%rax), %r11
+	movq	7016(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32448,7 +33340,7 @@ GL_PREFIX(VertexAttribI3ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6856(%rax), %r11
+	movq	7016(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI3ivEXT), .-GL_PREFIX(VertexAttribI3ivEXT)
@@ -32459,7 +33351,7 @@ GL_PREFIX(VertexAttribI3ivEXT):
 GL_PREFIX(VertexAttribI3uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6864(%rax), %r11
+	movq	7024(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32473,13 +33365,13 @@ GL_PREFIX(VertexAttribI3uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6864(%rax), %r11
+	movq	7024(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6864(%rax), %r11
+	movq	7024(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32493,7 +33385,7 @@ GL_PREFIX(VertexAttribI3uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6864(%rax), %r11
+	movq	7024(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI3uiEXT), .-GL_PREFIX(VertexAttribI3uiEXT)
@@ -32504,7 +33396,7 @@ GL_PREFIX(VertexAttribI3uiEXT):
 GL_PREFIX(VertexAttribI3uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6872(%rax), %r11
+	movq	7032(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32514,13 +33406,13 @@ GL_PREFIX(VertexAttribI3uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6872(%rax), %r11
+	movq	7032(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6872(%rax), %r11
+	movq	7032(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32530,7 +33422,7 @@ GL_PREFIX(VertexAttribI3uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6872(%rax), %r11
+	movq	7032(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI3uivEXT), .-GL_PREFIX(VertexAttribI3uivEXT)
@@ -32541,7 +33433,7 @@ GL_PREFIX(VertexAttribI3uivEXT):
 GL_PREFIX(VertexAttribI4bvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6880(%rax), %r11
+	movq	7040(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32551,13 +33443,13 @@ GL_PREFIX(VertexAttribI4bvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6880(%rax), %r11
+	movq	7040(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6880(%rax), %r11
+	movq	7040(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32567,7 +33459,7 @@ GL_PREFIX(VertexAttribI4bvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6880(%rax), %r11
+	movq	7040(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4bvEXT), .-GL_PREFIX(VertexAttribI4bvEXT)
@@ -32578,7 +33470,7 @@ GL_PREFIX(VertexAttribI4bvEXT):
 GL_PREFIX(VertexAttribI4iEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6888(%rax), %r11
+	movq	7048(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32592,13 +33484,13 @@ GL_PREFIX(VertexAttribI4iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6888(%rax), %r11
+	movq	7048(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6888(%rax), %r11
+	movq	7048(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32612,7 +33504,7 @@ GL_PREFIX(VertexAttribI4iEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6888(%rax), %r11
+	movq	7048(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4iEXT), .-GL_PREFIX(VertexAttribI4iEXT)
@@ -32623,7 +33515,7 @@ GL_PREFIX(VertexAttribI4iEXT):
 GL_PREFIX(VertexAttribI4ivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6896(%rax), %r11
+	movq	7056(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32633,13 +33525,13 @@ GL_PREFIX(VertexAttribI4ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6896(%rax), %r11
+	movq	7056(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6896(%rax), %r11
+	movq	7056(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32649,7 +33541,7 @@ GL_PREFIX(VertexAttribI4ivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6896(%rax), %r11
+	movq	7056(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4ivEXT), .-GL_PREFIX(VertexAttribI4ivEXT)
@@ -32660,7 +33552,7 @@ GL_PREFIX(VertexAttribI4ivEXT):
 GL_PREFIX(VertexAttribI4svEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6904(%rax), %r11
+	movq	7064(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32670,13 +33562,13 @@ GL_PREFIX(VertexAttribI4svEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6904(%rax), %r11
+	movq	7064(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6904(%rax), %r11
+	movq	7064(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32686,7 +33578,7 @@ GL_PREFIX(VertexAttribI4svEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6904(%rax), %r11
+	movq	7064(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4svEXT), .-GL_PREFIX(VertexAttribI4svEXT)
@@ -32697,7 +33589,7 @@ GL_PREFIX(VertexAttribI4svEXT):
 GL_PREFIX(VertexAttribI4ubvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6912(%rax), %r11
+	movq	7072(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32707,13 +33599,13 @@ GL_PREFIX(VertexAttribI4ubvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6912(%rax), %r11
+	movq	7072(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6912(%rax), %r11
+	movq	7072(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32723,7 +33615,7 @@ GL_PREFIX(VertexAttribI4ubvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6912(%rax), %r11
+	movq	7072(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4ubvEXT), .-GL_PREFIX(VertexAttribI4ubvEXT)
@@ -32734,7 +33626,7 @@ GL_PREFIX(VertexAttribI4ubvEXT):
 GL_PREFIX(VertexAttribI4uiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6920(%rax), %r11
+	movq	7080(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32748,13 +33640,13 @@ GL_PREFIX(VertexAttribI4uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6920(%rax), %r11
+	movq	7080(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6920(%rax), %r11
+	movq	7080(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32768,7 +33660,7 @@ GL_PREFIX(VertexAttribI4uiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6920(%rax), %r11
+	movq	7080(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4uiEXT), .-GL_PREFIX(VertexAttribI4uiEXT)
@@ -32779,7 +33671,7 @@ GL_PREFIX(VertexAttribI4uiEXT):
 GL_PREFIX(VertexAttribI4uivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6928(%rax), %r11
+	movq	7088(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32789,13 +33681,13 @@ GL_PREFIX(VertexAttribI4uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6928(%rax), %r11
+	movq	7088(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6928(%rax), %r11
+	movq	7088(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32805,7 +33697,7 @@ GL_PREFIX(VertexAttribI4uivEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6928(%rax), %r11
+	movq	7088(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4uivEXT), .-GL_PREFIX(VertexAttribI4uivEXT)
@@ -32816,7 +33708,7 @@ GL_PREFIX(VertexAttribI4uivEXT):
 GL_PREFIX(VertexAttribI4usvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6936(%rax), %r11
+	movq	7096(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32826,13 +33718,13 @@ GL_PREFIX(VertexAttribI4usvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6936(%rax), %r11
+	movq	7096(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6936(%rax), %r11
+	movq	7096(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32842,7 +33734,7 @@ GL_PREFIX(VertexAttribI4usvEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6936(%rax), %r11
+	movq	7096(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribI4usvEXT), .-GL_PREFIX(VertexAttribI4usvEXT)
@@ -32853,7 +33745,7 @@ GL_PREFIX(VertexAttribI4usvEXT):
 GL_PREFIX(VertexAttribIPointerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6944(%rax), %r11
+	movq	7104(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32867,13 +33759,13 @@ GL_PREFIX(VertexAttribIPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6944(%rax), %r11
+	movq	7104(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6944(%rax), %r11
+	movq	7104(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32887,7 +33779,7 @@ GL_PREFIX(VertexAttribIPointerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6944(%rax), %r11
+	movq	7104(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(VertexAttribIPointerEXT), .-GL_PREFIX(VertexAttribIPointerEXT)
@@ -32898,7 +33790,7 @@ GL_PREFIX(VertexAttribIPointerEXT):
 GL_PREFIX(FramebufferTextureLayerEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6952(%rax), %r11
+	movq	7112(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32912,13 +33804,13 @@ GL_PREFIX(FramebufferTextureLayerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6952(%rax), %r11
+	movq	7112(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6952(%rax), %r11
+	movq	7112(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32932,7 +33824,7 @@ GL_PREFIX(FramebufferTextureLayerEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6952(%rax), %r11
+	movq	7112(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT)
@@ -32943,7 +33835,7 @@ GL_PREFIX(FramebufferTextureLayerEXT):
 GL_PREFIX(ColorMaskIndexedEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6960(%rax), %r11
+	movq	7120(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32957,13 +33849,13 @@ GL_PREFIX(ColorMaskIndexedEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6960(%rax), %r11
+	movq	7120(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6960(%rax), %r11
+	movq	7120(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -32977,7 +33869,7 @@ GL_PREFIX(ColorMaskIndexedEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6960(%rax), %r11
+	movq	7120(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ColorMaskIndexedEXT), .-GL_PREFIX(ColorMaskIndexedEXT)
@@ -32988,7 +33880,7 @@ GL_PREFIX(ColorMaskIndexedEXT):
 GL_PREFIX(DisableIndexedEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6968(%rax), %r11
+	movq	7128(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -32998,13 +33890,13 @@ GL_PREFIX(DisableIndexedEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6968(%rax), %r11
+	movq	7128(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6968(%rax), %r11
+	movq	7128(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33014,7 +33906,7 @@ GL_PREFIX(DisableIndexedEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6968(%rax), %r11
+	movq	7128(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(DisableIndexedEXT), .-GL_PREFIX(DisableIndexedEXT)
@@ -33025,7 +33917,7 @@ GL_PREFIX(DisableIndexedEXT):
 GL_PREFIX(EnableIndexedEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6976(%rax), %r11
+	movq	7136(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33035,13 +33927,13 @@ GL_PREFIX(EnableIndexedEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6976(%rax), %r11
+	movq	7136(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6976(%rax), %r11
+	movq	7136(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33051,7 +33943,7 @@ GL_PREFIX(EnableIndexedEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	6976(%rax), %r11
+	movq	7136(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(EnableIndexedEXT), .-GL_PREFIX(EnableIndexedEXT)
@@ -33062,7 +33954,7 @@ GL_PREFIX(EnableIndexedEXT):
 GL_PREFIX(GetBooleanIndexedvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6984(%rax), %r11
+	movq	7144(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33072,13 +33964,13 @@ GL_PREFIX(GetBooleanIndexedvEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6984(%rax), %r11
+	movq	7144(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6984(%rax), %r11
+	movq	7144(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33088,7 +33980,7 @@ GL_PREFIX(GetBooleanIndexedvEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6984(%rax), %r11
+	movq	7144(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetBooleanIndexedvEXT), .-GL_PREFIX(GetBooleanIndexedvEXT)
@@ -33099,7 +33991,7 @@ GL_PREFIX(GetBooleanIndexedvEXT):
 GL_PREFIX(GetIntegerIndexedvEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	6992(%rax), %r11
+	movq	7152(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33109,13 +34001,13 @@ GL_PREFIX(GetIntegerIndexedvEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6992(%rax), %r11
+	movq	7152(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	6992(%rax), %r11
+	movq	7152(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33125,7 +34017,7 @@ GL_PREFIX(GetIntegerIndexedvEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	6992(%rax), %r11
+	movq	7152(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetIntegerIndexedvEXT), .-GL_PREFIX(GetIntegerIndexedvEXT)
@@ -33136,7 +34028,7 @@ GL_PREFIX(GetIntegerIndexedvEXT):
 GL_PREFIX(IsEnabledIndexedEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7000(%rax), %r11
+	movq	7160(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33146,13 +34038,13 @@ GL_PREFIX(IsEnabledIndexedEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7000(%rax), %r11
+	movq	7160(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7000(%rax), %r11
+	movq	7160(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33162,7 +34054,7 @@ GL_PREFIX(IsEnabledIndexedEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7000(%rax), %r11
+	movq	7160(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(IsEnabledIndexedEXT), .-GL_PREFIX(IsEnabledIndexedEXT)
@@ -33173,7 +34065,7 @@ GL_PREFIX(IsEnabledIndexedEXT):
 GL_PREFIX(ClearColorIiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7008(%rax), %r11
+	movq	7168(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33187,13 +34079,13 @@ GL_PREFIX(ClearColorIiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7008(%rax), %r11
+	movq	7168(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7008(%rax), %r11
+	movq	7168(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33207,7 +34099,7 @@ GL_PREFIX(ClearColorIiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7008(%rax), %r11
+	movq	7168(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ClearColorIiEXT), .-GL_PREFIX(ClearColorIiEXT)
@@ -33218,7 +34110,7 @@ GL_PREFIX(ClearColorIiEXT):
 GL_PREFIX(ClearColorIuiEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7016(%rax), %r11
+	movq	7176(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33232,13 +34124,13 @@ GL_PREFIX(ClearColorIuiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7016(%rax), %r11
+	movq	7176(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7016(%rax), %r11
+	movq	7176(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33252,7 +34144,7 @@ GL_PREFIX(ClearColorIuiEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7016(%rax), %r11
+	movq	7176(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ClearColorIuiEXT), .-GL_PREFIX(ClearColorIuiEXT)
@@ -33263,7 +34155,7 @@ GL_PREFIX(ClearColorIuiEXT):
 GL_PREFIX(GetTexParameterIivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7024(%rax), %r11
+	movq	7184(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33273,13 +34165,13 @@ GL_PREFIX(GetTexParameterIivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7024(%rax), %r11
+	movq	7184(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7024(%rax), %r11
+	movq	7184(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33289,7 +34181,7 @@ GL_PREFIX(GetTexParameterIivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7024(%rax), %r11
+	movq	7184(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetTexParameterIivEXT), .-GL_PREFIX(GetTexParameterIivEXT)
@@ -33300,7 +34192,7 @@ GL_PREFIX(GetTexParameterIivEXT):
 GL_PREFIX(GetTexParameterIuivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7032(%rax), %r11
+	movq	7192(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33310,13 +34202,13 @@ GL_PREFIX(GetTexParameterIuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7032(%rax), %r11
+	movq	7192(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7032(%rax), %r11
+	movq	7192(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33326,7 +34218,7 @@ GL_PREFIX(GetTexParameterIuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7032(%rax), %r11
+	movq	7192(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetTexParameterIuivEXT), .-GL_PREFIX(GetTexParameterIuivEXT)
@@ -33337,7 +34229,7 @@ GL_PREFIX(GetTexParameterIuivEXT):
 GL_PREFIX(TexParameterIivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7040(%rax), %r11
+	movq	7200(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33347,13 +34239,13 @@ GL_PREFIX(TexParameterIivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7040(%rax), %r11
+	movq	7200(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7040(%rax), %r11
+	movq	7200(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33363,7 +34255,7 @@ GL_PREFIX(TexParameterIivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7040(%rax), %r11
+	movq	7200(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TexParameterIivEXT), .-GL_PREFIX(TexParameterIivEXT)
@@ -33374,7 +34266,7 @@ GL_PREFIX(TexParameterIivEXT):
 GL_PREFIX(TexParameterIuivEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7048(%rax), %r11
+	movq	7208(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33384,13 +34276,13 @@ GL_PREFIX(TexParameterIuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7048(%rax), %r11
+	movq	7208(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7048(%rax), %r11
+	movq	7208(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33400,7 +34292,7 @@ GL_PREFIX(TexParameterIuivEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7048(%rax), %r11
+	movq	7208(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TexParameterIuivEXT), .-GL_PREFIX(TexParameterIuivEXT)
@@ -33411,7 +34303,7 @@ GL_PREFIX(TexParameterIuivEXT):
 GL_PREFIX(BeginConditionalRenderNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7056(%rax), %r11
+	movq	7216(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33421,13 +34313,13 @@ GL_PREFIX(BeginConditionalRenderNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7056(%rax), %r11
+	movq	7216(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7056(%rax), %r11
+	movq	7216(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33437,7 +34329,7 @@ GL_PREFIX(BeginConditionalRenderNV):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7056(%rax), %r11
+	movq	7216(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BeginConditionalRenderNV), .-GL_PREFIX(BeginConditionalRenderNV)
@@ -33448,25 +34340,25 @@ GL_PREFIX(BeginConditionalRenderNV):
 GL_PREFIX(EndConditionalRenderNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7064(%rax), %r11
+	movq	7224(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	7064(%rax), %r11
+	movq	7224(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7064(%rax), %r11
+	movq	7224(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	7064(%rax), %r11
+	movq	7224(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(EndConditionalRenderNV), .-GL_PREFIX(EndConditionalRenderNV)
@@ -33477,25 +34369,25 @@ GL_PREFIX(EndConditionalRenderNV):
 GL_PREFIX(BeginTransformFeedbackEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7072(%rax), %r11
+	movq	7232(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	7072(%rax), %r11
+	movq	7232(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7072(%rax), %r11
+	movq	7232(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	7072(%rax), %r11
+	movq	7232(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BeginTransformFeedbackEXT), .-GL_PREFIX(BeginTransformFeedbackEXT)
@@ -33506,7 +34398,7 @@ GL_PREFIX(BeginTransformFeedbackEXT):
 GL_PREFIX(BindBufferBaseEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7080(%rax), %r11
+	movq	7240(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33516,13 +34408,13 @@ GL_PREFIX(BindBufferBaseEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7080(%rax), %r11
+	movq	7240(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7080(%rax), %r11
+	movq	7240(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33532,7 +34424,7 @@ GL_PREFIX(BindBufferBaseEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7080(%rax), %r11
+	movq	7240(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindBufferBaseEXT), .-GL_PREFIX(BindBufferBaseEXT)
@@ -33543,7 +34435,7 @@ GL_PREFIX(BindBufferBaseEXT):
 GL_PREFIX(BindBufferOffsetEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7088(%rax), %r11
+	movq	7248(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33557,13 +34449,13 @@ GL_PREFIX(BindBufferOffsetEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7088(%rax), %r11
+	movq	7248(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7088(%rax), %r11
+	movq	7248(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33577,7 +34469,7 @@ GL_PREFIX(BindBufferOffsetEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7088(%rax), %r11
+	movq	7248(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindBufferOffsetEXT), .-GL_PREFIX(BindBufferOffsetEXT)
@@ -33588,7 +34480,7 @@ GL_PREFIX(BindBufferOffsetEXT):
 GL_PREFIX(BindBufferRangeEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7096(%rax), %r11
+	movq	7256(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33602,13 +34494,13 @@ GL_PREFIX(BindBufferRangeEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7096(%rax), %r11
+	movq	7256(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7096(%rax), %r11
+	movq	7256(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33622,7 +34514,7 @@ GL_PREFIX(BindBufferRangeEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7096(%rax), %r11
+	movq	7256(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(BindBufferRangeEXT), .-GL_PREFIX(BindBufferRangeEXT)
@@ -33633,25 +34525,25 @@ GL_PREFIX(BindBufferRangeEXT):
 GL_PREFIX(EndTransformFeedbackEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7104(%rax), %r11
+	movq	7264(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	7104(%rax), %r11
+	movq	7264(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7104(%rax), %r11
+	movq	7264(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	7104(%rax), %r11
+	movq	7264(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(EndTransformFeedbackEXT), .-GL_PREFIX(EndTransformFeedbackEXT)
@@ -33662,7 +34554,7 @@ GL_PREFIX(EndTransformFeedbackEXT):
 GL_PREFIX(GetTransformFeedbackVaryingEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7112(%rax), %r11
+	movq	7272(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33680,13 +34572,13 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7112(%rax), %r11
+	movq	7272(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7112(%rax), %r11
+	movq	7272(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33704,7 +34596,7 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7112(%rax), %r11
+	movq	7272(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetTransformFeedbackVaryingEXT), .-GL_PREFIX(GetTransformFeedbackVaryingEXT)
@@ -33715,7 +34607,7 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT):
 GL_PREFIX(TransformFeedbackVaryingsEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7120(%rax), %r11
+	movq	7280(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33729,13 +34621,13 @@ GL_PREFIX(TransformFeedbackVaryingsEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7120(%rax), %r11
+	movq	7280(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7120(%rax), %r11
+	movq	7280(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33749,7 +34641,7 @@ GL_PREFIX(TransformFeedbackVaryingsEXT):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7120(%rax), %r11
+	movq	7280(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TransformFeedbackVaryingsEXT), .-GL_PREFIX(TransformFeedbackVaryingsEXT)
@@ -33760,37 +34652,37 @@ GL_PREFIX(TransformFeedbackVaryingsEXT):
 GL_PREFIX(ProvokingVertexEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7128(%rax), %r11
+	movq	7288(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	7128(%rax), %r11
+	movq	7288(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7128(%rax), %r11
+	movq	7288(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	7128(%rax), %r11
+	movq	7288(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ProvokingVertexEXT), .-GL_PREFIX(ProvokingVertexEXT)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_892)
-	.type	GL_PREFIX(_dispatch_stub_892), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_892))
-GL_PREFIX(_dispatch_stub_892):
+	.globl	GL_PREFIX(_dispatch_stub_912)
+	.type	GL_PREFIX(_dispatch_stub_912), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_912))
+GL_PREFIX(_dispatch_stub_912):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7136(%rax), %r11
+	movq	7296(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33800,13 +34692,13 @@ GL_PREFIX(_dispatch_stub_892):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7136(%rax), %r11
+	movq	7296(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7136(%rax), %r11
+	movq	7296(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33816,19 +34708,19 @@ GL_PREFIX(_dispatch_stub_892):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7136(%rax), %r11
+	movq	7296(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_892), .-GL_PREFIX(_dispatch_stub_892)
+	.size	GL_PREFIX(_dispatch_stub_912), .-GL_PREFIX(_dispatch_stub_912)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_893)
-	.type	GL_PREFIX(_dispatch_stub_893), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_893))
-GL_PREFIX(_dispatch_stub_893):
+	.globl	GL_PREFIX(_dispatch_stub_913)
+	.type	GL_PREFIX(_dispatch_stub_913), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_913))
+GL_PREFIX(_dispatch_stub_913):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7144(%rax), %r11
+	movq	7304(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33838,13 +34730,13 @@ GL_PREFIX(_dispatch_stub_893):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7144(%rax), %r11
+	movq	7304(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7144(%rax), %r11
+	movq	7304(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33854,10 +34746,10 @@ GL_PREFIX(_dispatch_stub_893):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7144(%rax), %r11
+	movq	7304(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_893), .-GL_PREFIX(_dispatch_stub_893)
+	.size	GL_PREFIX(_dispatch_stub_913), .-GL_PREFIX(_dispatch_stub_913)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(GetObjectParameterivAPPLE)
@@ -33865,7 +34757,7 @@ GL_PREFIX(_dispatch_stub_893):
 GL_PREFIX(GetObjectParameterivAPPLE):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7152(%rax), %r11
+	movq	7312(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33879,13 +34771,13 @@ GL_PREFIX(GetObjectParameterivAPPLE):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7152(%rax), %r11
+	movq	7312(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7152(%rax), %r11
+	movq	7312(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33899,7 +34791,7 @@ GL_PREFIX(GetObjectParameterivAPPLE):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7152(%rax), %r11
+	movq	7312(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(GetObjectParameterivAPPLE), .-GL_PREFIX(GetObjectParameterivAPPLE)
@@ -33910,7 +34802,7 @@ GL_PREFIX(GetObjectParameterivAPPLE):
 GL_PREFIX(ObjectPurgeableAPPLE):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7160(%rax), %r11
+	movq	7320(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33920,13 +34812,13 @@ GL_PREFIX(ObjectPurgeableAPPLE):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7160(%rax), %r11
+	movq	7320(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7160(%rax), %r11
+	movq	7320(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33936,7 +34828,7 @@ GL_PREFIX(ObjectPurgeableAPPLE):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7160(%rax), %r11
+	movq	7320(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ObjectPurgeableAPPLE), .-GL_PREFIX(ObjectPurgeableAPPLE)
@@ -33947,7 +34839,7 @@ GL_PREFIX(ObjectPurgeableAPPLE):
 GL_PREFIX(ObjectUnpurgeableAPPLE):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7168(%rax), %r11
+	movq	7328(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -33957,13 +34849,13 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7168(%rax), %r11
+	movq	7328(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7168(%rax), %r11
+	movq	7328(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -33973,7 +34865,7 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7168(%rax), %r11
+	movq	7328(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ObjectUnpurgeableAPPLE), .-GL_PREFIX(ObjectUnpurgeableAPPLE)
@@ -33984,25 +34876,25 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
 GL_PREFIX(ActiveProgramEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7176(%rax), %r11
+	movq	7336(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
 	call	_x86_64_get_dispatch@PLT
 	popq	%rdi
-	movq	7176(%rax), %r11
+	movq	7336(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7176(%rax), %r11
+	movq	7336(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
 	call	_glapi_get_dispatch
 	popq	%rdi
-	movq	7176(%rax), %r11
+	movq	7336(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(ActiveProgramEXT), .-GL_PREFIX(ActiveProgramEXT)
@@ -34013,7 +34905,7 @@ GL_PREFIX(ActiveProgramEXT):
 GL_PREFIX(CreateShaderProgramEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7184(%rax), %r11
+	movq	7344(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34023,13 +34915,13 @@ GL_PREFIX(CreateShaderProgramEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7184(%rax), %r11
+	movq	7344(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7184(%rax), %r11
+	movq	7344(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34039,7 +34931,7 @@ GL_PREFIX(CreateShaderProgramEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7184(%rax), %r11
+	movq	7344(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(CreateShaderProgramEXT), .-GL_PREFIX(CreateShaderProgramEXT)
@@ -34050,7 +34942,7 @@ GL_PREFIX(CreateShaderProgramEXT):
 GL_PREFIX(UseShaderProgramEXT):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7192(%rax), %r11
+	movq	7352(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34060,13 +34952,13 @@ GL_PREFIX(UseShaderProgramEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7192(%rax), %r11
+	movq	7352(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7192(%rax), %r11
+	movq	7352(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34076,7 +34968,7 @@ GL_PREFIX(UseShaderProgramEXT):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7192(%rax), %r11
+	movq	7352(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(UseShaderProgramEXT), .-GL_PREFIX(UseShaderProgramEXT)
@@ -34087,37 +34979,37 @@ GL_PREFIX(UseShaderProgramEXT):
 GL_PREFIX(TextureBarrierNV):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7200(%rax), %r11
+	movq	7360(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rbp
 	call	_x86_64_get_dispatch@PLT
 	popq	%rbp
-	movq	7200(%rax), %r11
+	movq	7360(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7200(%rax), %r11
+	movq	7360(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rbp
 	call	_glapi_get_dispatch
 	popq	%rbp
-	movq	7200(%rax), %r11
+	movq	7360(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(TextureBarrierNV), .-GL_PREFIX(TextureBarrierNV)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_901)
-	.type	GL_PREFIX(_dispatch_stub_901), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_901))
-GL_PREFIX(_dispatch_stub_901):
+	.globl	GL_PREFIX(_dispatch_stub_921)
+	.type	GL_PREFIX(_dispatch_stub_921), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_921))
+GL_PREFIX(_dispatch_stub_921):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7208(%rax), %r11
+	movq	7368(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34131,13 +35023,13 @@ GL_PREFIX(_dispatch_stub_901):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7208(%rax), %r11
+	movq	7368(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7208(%rax), %r11
+	movq	7368(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34151,19 +35043,19 @@ GL_PREFIX(_dispatch_stub_901):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7208(%rax), %r11
+	movq	7368(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_901), .-GL_PREFIX(_dispatch_stub_901)
+	.size	GL_PREFIX(_dispatch_stub_921), .-GL_PREFIX(_dispatch_stub_921)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_902)
-	.type	GL_PREFIX(_dispatch_stub_902), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_902))
-GL_PREFIX(_dispatch_stub_902):
+	.globl	GL_PREFIX(_dispatch_stub_922)
+	.type	GL_PREFIX(_dispatch_stub_922), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_922))
+GL_PREFIX(_dispatch_stub_922):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7216(%rax), %r11
+	movq	7376(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34177,13 +35069,13 @@ GL_PREFIX(_dispatch_stub_902):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7216(%rax), %r11
+	movq	7376(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7216(%rax), %r11
+	movq	7376(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34197,19 +35089,19 @@ GL_PREFIX(_dispatch_stub_902):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7216(%rax), %r11
+	movq	7376(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_902), .-GL_PREFIX(_dispatch_stub_902)
+	.size	GL_PREFIX(_dispatch_stub_922), .-GL_PREFIX(_dispatch_stub_922)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_903)
-	.type	GL_PREFIX(_dispatch_stub_903), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_903))
-GL_PREFIX(_dispatch_stub_903):
+	.globl	GL_PREFIX(_dispatch_stub_923)
+	.type	GL_PREFIX(_dispatch_stub_923), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_923))
+GL_PREFIX(_dispatch_stub_923):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7224(%rax), %r11
+	movq	7384(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34223,13 +35115,13 @@ GL_PREFIX(_dispatch_stub_903):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7224(%rax), %r11
+	movq	7384(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7224(%rax), %r11
+	movq	7384(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34243,19 +35135,19 @@ GL_PREFIX(_dispatch_stub_903):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7224(%rax), %r11
+	movq	7384(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_903), .-GL_PREFIX(_dispatch_stub_903)
+	.size	GL_PREFIX(_dispatch_stub_923), .-GL_PREFIX(_dispatch_stub_923)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_904)
-	.type	GL_PREFIX(_dispatch_stub_904), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_904))
-GL_PREFIX(_dispatch_stub_904):
+	.globl	GL_PREFIX(_dispatch_stub_924)
+	.type	GL_PREFIX(_dispatch_stub_924), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_924))
+GL_PREFIX(_dispatch_stub_924):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7232(%rax), %r11
+	movq	7392(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34265,13 +35157,13 @@ GL_PREFIX(_dispatch_stub_904):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7232(%rax), %r11
+	movq	7392(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7232(%rax), %r11
+	movq	7392(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34281,19 +35173,19 @@ GL_PREFIX(_dispatch_stub_904):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7232(%rax), %r11
+	movq	7392(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_904), .-GL_PREFIX(_dispatch_stub_904)
+	.size	GL_PREFIX(_dispatch_stub_924), .-GL_PREFIX(_dispatch_stub_924)
 
 	.p2align	4,,15
-	.globl	GL_PREFIX(_dispatch_stub_905)
-	.type	GL_PREFIX(_dispatch_stub_905), @function
-	HIDDEN(GL_PREFIX(_dispatch_stub_905))
-GL_PREFIX(_dispatch_stub_905):
+	.globl	GL_PREFIX(_dispatch_stub_925)
+	.type	GL_PREFIX(_dispatch_stub_925), @function
+	HIDDEN(GL_PREFIX(_dispatch_stub_925))
+GL_PREFIX(_dispatch_stub_925):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7240(%rax), %r11
+	movq	7400(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34303,13 +35195,13 @@ GL_PREFIX(_dispatch_stub_905):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7240(%rax), %r11
+	movq	7400(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7240(%rax), %r11
+	movq	7400(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34319,10 +35211,10 @@ GL_PREFIX(_dispatch_stub_905):
 	popq	%rdx
 	popq	%rsi
 	popq	%rdi
-	movq	7240(%rax), %r11
+	movq	7400(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
-	.size	GL_PREFIX(_dispatch_stub_905), .-GL_PREFIX(_dispatch_stub_905)
+	.size	GL_PREFIX(_dispatch_stub_925), .-GL_PREFIX(_dispatch_stub_925)
 
 	.p2align	4,,15
 	.globl	GL_PREFIX(EGLImageTargetRenderbufferStorageOES)
@@ -34330,7 +35222,7 @@ GL_PREFIX(_dispatch_stub_905):
 GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7248(%rax), %r11
+	movq	7408(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34340,13 +35232,13 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7248(%rax), %r11
+	movq	7408(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7248(%rax), %r11
+	movq	7408(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34356,7 +35248,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7248(%rax), %r11
+	movq	7408(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(EGLImageTargetRenderbufferStorageOES), .-GL_PREFIX(EGLImageTargetRenderbufferStorageOES)
@@ -34367,7 +35259,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
 GL_PREFIX(EGLImageTargetTexture2DOES):
 #if defined(GLX_USE_TLS)
 	call	_x86_64_get_dispatch@PLT
-	movq	7256(%rax), %r11
+	movq	7416(%rax), %r11
 	jmp	*%r11
 #elif defined(PTHREADS)
 	pushq	%rdi
@@ -34377,13 +35269,13 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7256(%rax), %r11
+	movq	7416(%rax), %r11
 	jmp	*%r11
 #else
 	movq	_glapi_Dispatch(%rip), %rax
 	testq	%rax, %rax
 	je	1f
-	movq	7256(%rax), %r11
+	movq	7416(%rax), %r11
 	jmp	*%r11
 1:
 	pushq	%rdi
@@ -34393,7 +35285,7 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
 	popq	%rbp
 	popq	%rsi
 	popq	%rdi
-	movq	7256(%rax), %r11
+	movq	7416(%rax), %r11
 	jmp	*%r11
 #endif /* defined(GLX_USE_TLS) */
 	.size	GL_PREFIX(EGLImageTargetTexture2DOES), .-GL_PREFIX(EGLImageTargetTexture2DOES)
@@ -34656,10 +35548,10 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
 	.globl GL_PREFIX(IsProgramARB) ; .set GL_PREFIX(IsProgramARB), GL_PREFIX(IsProgramNV)
 	.globl GL_PREFIX(PointParameteri) ; .set GL_PREFIX(PointParameteri), GL_PREFIX(PointParameteriNV)
 	.globl GL_PREFIX(PointParameteriv) ; .set GL_PREFIX(PointParameteriv), GL_PREFIX(PointParameterivNV)
-	.globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_802)
-	.globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_804)
+	.globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_822)
+	.globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_824)
 	.globl GL_PREFIX(PrimitiveRestartIndex) ; .set GL_PREFIX(PrimitiveRestartIndex), GL_PREFIX(PrimitiveRestartIndexNV)
-	.globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_814)
+	.globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_834)
 	.globl GL_PREFIX(BindFramebuffer) ; .set GL_PREFIX(BindFramebuffer), GL_PREFIX(BindFramebufferEXT)
 	.globl GL_PREFIX(BindRenderbuffer) ; .set GL_PREFIX(BindRenderbuffer), GL_PREFIX(BindRenderbufferEXT)
 	.globl GL_PREFIX(CheckFramebufferStatus) ; .set GL_PREFIX(CheckFramebufferStatus), GL_PREFIX(CheckFramebufferStatusEXT)
@@ -34677,7 +35569,7 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
 	.globl GL_PREFIX(IsFramebuffer) ; .set GL_PREFIX(IsFramebuffer), GL_PREFIX(IsFramebufferEXT)
 	.globl GL_PREFIX(IsRenderbuffer) ; .set GL_PREFIX(IsRenderbuffer), GL_PREFIX(IsRenderbufferEXT)
 	.globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT)
-	.globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_832)
+	.globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_852)
 	.globl GL_PREFIX(BindFragDataLocation) ; .set GL_PREFIX(BindFragDataLocation), GL_PREFIX(BindFragDataLocationEXT)
 	.globl GL_PREFIX(GetFragDataLocation) ; .set GL_PREFIX(GetFragDataLocation), GL_PREFIX(GetFragDataLocationEXT)
 	.globl GL_PREFIX(GetUniformuiv) ; .set GL_PREFIX(GetUniformuiv), GL_PREFIX(GetUniformuivEXT)
diff --git a/mesalib/src/mapi/glapi/glapi_x86.S b/mesalib/src/mapi/glapi/glapi_x86.S
index f56dc748d..d5084da17 100644
--- a/mesalib/src/mapi/glapi/glapi_x86.S
+++ b/mesalib/src/mapi/glapi/glapi_x86.S
@@ -776,323 +776,343 @@ GLNAME(gl_dispatch_functions_start):
 	GL_STUB(GetShaderPrecisionFormat, 623, GetShaderPrecisionFormat@16)
 	GL_STUB(ReleaseShaderCompiler, 624, ReleaseShaderCompiler@0)
 	GL_STUB(ShaderBinary, 625, ShaderBinary@20)
-	GL_STUB(PolygonOffsetEXT, 626, PolygonOffsetEXT@8)
-	GL_STUB(_dispatch_stub_627, 627, _dispatch_stub_627@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_627, _dispatch_stub_627@8))
-	GL_STUB(_dispatch_stub_628, 628, _dispatch_stub_628@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_628, _dispatch_stub_628@8))
-	GL_STUB(_dispatch_stub_629, 629, _dispatch_stub_629@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_629, _dispatch_stub_629@8))
-	GL_STUB(_dispatch_stub_630, 630, _dispatch_stub_630@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_630, _dispatch_stub_630@8))
-	GL_STUB(_dispatch_stub_631, 631, _dispatch_stub_631@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_631, _dispatch_stub_631@8))
-	GL_STUB(_dispatch_stub_632, 632, _dispatch_stub_632@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_632, _dispatch_stub_632@8))
-	GL_STUB(_dispatch_stub_633, 633, _dispatch_stub_633@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_633, _dispatch_stub_633@8))
-	GL_STUB(_dispatch_stub_634, 634, _dispatch_stub_634@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_634, _dispatch_stub_634@4))
-	GL_STUB(ColorPointerEXT, 635, ColorPointerEXT@20)
-	GL_STUB(EdgeFlagPointerEXT, 636, EdgeFlagPointerEXT@12)
-	GL_STUB(IndexPointerEXT, 637, IndexPointerEXT@16)
-	GL_STUB(NormalPointerEXT, 638, NormalPointerEXT@16)
-	GL_STUB(TexCoordPointerEXT, 639, TexCoordPointerEXT@20)
-	GL_STUB(VertexPointerEXT, 640, VertexPointerEXT@20)
-	GL_STUB(PointParameterfEXT, 641, PointParameterfEXT@8)
-	GL_STUB(PointParameterfvEXT, 642, PointParameterfvEXT@8)
-	GL_STUB(LockArraysEXT, 643, LockArraysEXT@8)
-	GL_STUB(UnlockArraysEXT, 644, UnlockArraysEXT@0)
-	GL_STUB(SecondaryColor3bEXT, 645, SecondaryColor3bEXT@12)
-	GL_STUB(SecondaryColor3bvEXT, 646, SecondaryColor3bvEXT@4)
-	GL_STUB(SecondaryColor3dEXT, 647, SecondaryColor3dEXT@24)
-	GL_STUB(SecondaryColor3dvEXT, 648, SecondaryColor3dvEXT@4)
-	GL_STUB(SecondaryColor3fEXT, 649, SecondaryColor3fEXT@12)
-	GL_STUB(SecondaryColor3fvEXT, 650, SecondaryColor3fvEXT@4)
-	GL_STUB(SecondaryColor3iEXT, 651, SecondaryColor3iEXT@12)
-	GL_STUB(SecondaryColor3ivEXT, 652, SecondaryColor3ivEXT@4)
-	GL_STUB(SecondaryColor3sEXT, 653, SecondaryColor3sEXT@12)
-	GL_STUB(SecondaryColor3svEXT, 654, SecondaryColor3svEXT@4)
-	GL_STUB(SecondaryColor3ubEXT, 655, SecondaryColor3ubEXT@12)
-	GL_STUB(SecondaryColor3ubvEXT, 656, SecondaryColor3ubvEXT@4)
-	GL_STUB(SecondaryColor3uiEXT, 657, SecondaryColor3uiEXT@12)
-	GL_STUB(SecondaryColor3uivEXT, 658, SecondaryColor3uivEXT@4)
-	GL_STUB(SecondaryColor3usEXT, 659, SecondaryColor3usEXT@12)
-	GL_STUB(SecondaryColor3usvEXT, 660, SecondaryColor3usvEXT@4)
-	GL_STUB(SecondaryColorPointerEXT, 661, SecondaryColorPointerEXT@16)
-	GL_STUB(MultiDrawArraysEXT, 662, MultiDrawArraysEXT@16)
-	GL_STUB(MultiDrawElementsEXT, 663, MultiDrawElementsEXT@20)
-	GL_STUB(FogCoordPointerEXT, 664, FogCoordPointerEXT@12)
-	GL_STUB(FogCoorddEXT, 665, FogCoorddEXT@8)
-	GL_STUB(FogCoorddvEXT, 666, FogCoorddvEXT@4)
-	GL_STUB(FogCoordfEXT, 667, FogCoordfEXT@4)
-	GL_STUB(FogCoordfvEXT, 668, FogCoordfvEXT@4)
-	GL_STUB(_dispatch_stub_669, 669, _dispatch_stub_669@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_669, _dispatch_stub_669@4))
-	GL_STUB(BlendFuncSeparateEXT, 670, BlendFuncSeparateEXT@16)
-	GL_STUB(FlushVertexArrayRangeNV, 671, FlushVertexArrayRangeNV@0)
-	GL_STUB(VertexArrayRangeNV, 672, VertexArrayRangeNV@8)
-	GL_STUB(CombinerInputNV, 673, CombinerInputNV@24)
-	GL_STUB(CombinerOutputNV, 674, CombinerOutputNV@40)
-	GL_STUB(CombinerParameterfNV, 675, CombinerParameterfNV@8)
-	GL_STUB(CombinerParameterfvNV, 676, CombinerParameterfvNV@8)
-	GL_STUB(CombinerParameteriNV, 677, CombinerParameteriNV@8)
-	GL_STUB(CombinerParameterivNV, 678, CombinerParameterivNV@8)
-	GL_STUB(FinalCombinerInputNV, 679, FinalCombinerInputNV@16)
-	GL_STUB(GetCombinerInputParameterfvNV, 680, GetCombinerInputParameterfvNV@20)
-	GL_STUB(GetCombinerInputParameterivNV, 681, GetCombinerInputParameterivNV@20)
-	GL_STUB(GetCombinerOutputParameterfvNV, 682, GetCombinerOutputParameterfvNV@16)
-	GL_STUB(GetCombinerOutputParameterivNV, 683, GetCombinerOutputParameterivNV@16)
-	GL_STUB(GetFinalCombinerInputParameterfvNV, 684, GetFinalCombinerInputParameterfvNV@12)
-	GL_STUB(GetFinalCombinerInputParameterivNV, 685, GetFinalCombinerInputParameterivNV@12)
-	GL_STUB(ResizeBuffersMESA, 686, ResizeBuffersMESA@0)
-	GL_STUB(WindowPos2dMESA, 687, WindowPos2dMESA@16)
-	GL_STUB(WindowPos2dvMESA, 688, WindowPos2dvMESA@4)
-	GL_STUB(WindowPos2fMESA, 689, WindowPos2fMESA@8)
-	GL_STUB(WindowPos2fvMESA, 690, WindowPos2fvMESA@4)
-	GL_STUB(WindowPos2iMESA, 691, WindowPos2iMESA@8)
-	GL_STUB(WindowPos2ivMESA, 692, WindowPos2ivMESA@4)
-	GL_STUB(WindowPos2sMESA, 693, WindowPos2sMESA@8)
-	GL_STUB(WindowPos2svMESA, 694, WindowPos2svMESA@4)
-	GL_STUB(WindowPos3dMESA, 695, WindowPos3dMESA@24)
-	GL_STUB(WindowPos3dvMESA, 696, WindowPos3dvMESA@4)
-	GL_STUB(WindowPos3fMESA, 697, WindowPos3fMESA@12)
-	GL_STUB(WindowPos3fvMESA, 698, WindowPos3fvMESA@4)
-	GL_STUB(WindowPos3iMESA, 699, WindowPos3iMESA@12)
-	GL_STUB(WindowPos3ivMESA, 700, WindowPos3ivMESA@4)
-	GL_STUB(WindowPos3sMESA, 701, WindowPos3sMESA@12)
-	GL_STUB(WindowPos3svMESA, 702, WindowPos3svMESA@4)
-	GL_STUB(WindowPos4dMESA, 703, WindowPos4dMESA@32)
-	GL_STUB(WindowPos4dvMESA, 704, WindowPos4dvMESA@4)
-	GL_STUB(WindowPos4fMESA, 705, WindowPos4fMESA@16)
-	GL_STUB(WindowPos4fvMESA, 706, WindowPos4fvMESA@4)
-	GL_STUB(WindowPos4iMESA, 707, WindowPos4iMESA@16)
-	GL_STUB(WindowPos4ivMESA, 708, WindowPos4ivMESA@4)
-	GL_STUB(WindowPos4sMESA, 709, WindowPos4sMESA@16)
-	GL_STUB(WindowPos4svMESA, 710, WindowPos4svMESA@4)
-	GL_STUB(_dispatch_stub_711, 711, _dispatch_stub_711@20)
-	HIDDEN(GL_PREFIX(_dispatch_stub_711, _dispatch_stub_711@20))
-	GL_STUB(_dispatch_stub_712, 712, _dispatch_stub_712@24)
-	HIDDEN(GL_PREFIX(_dispatch_stub_712, _dispatch_stub_712@24))
-	GL_STUB(_dispatch_stub_713, 713, _dispatch_stub_713@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_713, _dispatch_stub_713@8))
-	GL_STUB(_dispatch_stub_714, 714, _dispatch_stub_714@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_714, _dispatch_stub_714@4))
-	GL_STUB(_dispatch_stub_715, 715, _dispatch_stub_715@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_715, _dispatch_stub_715@8))
-	GL_STUB(_dispatch_stub_716, 716, _dispatch_stub_716@12)
-	HIDDEN(GL_PREFIX(_dispatch_stub_716, _dispatch_stub_716@12))
-	GL_STUB(_dispatch_stub_717, 717, _dispatch_stub_717@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_717, _dispatch_stub_717@4))
-	GL_STUB(_dispatch_stub_718, 718, _dispatch_stub_718@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_718, _dispatch_stub_718@8))
-	GL_STUB(_dispatch_stub_719, 719, _dispatch_stub_719@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_719, _dispatch_stub_719@4))
-	GL_STUB(AreProgramsResidentNV, 720, AreProgramsResidentNV@12)
-	GL_STUB(BindProgramNV, 721, BindProgramNV@8)
-	GL_STUB(DeleteProgramsNV, 722, DeleteProgramsNV@8)
-	GL_STUB(ExecuteProgramNV, 723, ExecuteProgramNV@12)
-	GL_STUB(GenProgramsNV, 724, GenProgramsNV@8)
-	GL_STUB(GetProgramParameterdvNV, 725, GetProgramParameterdvNV@16)
-	GL_STUB(GetProgramParameterfvNV, 726, GetProgramParameterfvNV@16)
-	GL_STUB(GetProgramStringNV, 727, GetProgramStringNV@12)
-	GL_STUB(GetProgramivNV, 728, GetProgramivNV@12)
-	GL_STUB(GetTrackMatrixivNV, 729, GetTrackMatrixivNV@16)
-	GL_STUB(GetVertexAttribPointervNV, 730, GetVertexAttribPointervNV@12)
-	GL_STUB(GetVertexAttribdvNV, 731, GetVertexAttribdvNV@12)
-	GL_STUB(GetVertexAttribfvNV, 732, GetVertexAttribfvNV@12)
-	GL_STUB(GetVertexAttribivNV, 733, GetVertexAttribivNV@12)
-	GL_STUB(IsProgramNV, 734, IsProgramNV@4)
-	GL_STUB(LoadProgramNV, 735, LoadProgramNV@16)
-	GL_STUB(ProgramParameters4dvNV, 736, ProgramParameters4dvNV@16)
-	GL_STUB(ProgramParameters4fvNV, 737, ProgramParameters4fvNV@16)
-	GL_STUB(RequestResidentProgramsNV, 738, RequestResidentProgramsNV@8)
-	GL_STUB(TrackMatrixNV, 739, TrackMatrixNV@16)
-	GL_STUB(VertexAttrib1dNV, 740, VertexAttrib1dNV@12)
-	GL_STUB(VertexAttrib1dvNV, 741, VertexAttrib1dvNV@8)
-	GL_STUB(VertexAttrib1fNV, 742, VertexAttrib1fNV@8)
-	GL_STUB(VertexAttrib1fvNV, 743, VertexAttrib1fvNV@8)
-	GL_STUB(VertexAttrib1sNV, 744, VertexAttrib1sNV@8)
-	GL_STUB(VertexAttrib1svNV, 745, VertexAttrib1svNV@8)
-	GL_STUB(VertexAttrib2dNV, 746, VertexAttrib2dNV@20)
-	GL_STUB(VertexAttrib2dvNV, 747, VertexAttrib2dvNV@8)
-	GL_STUB(VertexAttrib2fNV, 748, VertexAttrib2fNV@12)
-	GL_STUB(VertexAttrib2fvNV, 749, VertexAttrib2fvNV@8)
-	GL_STUB(VertexAttrib2sNV, 750, VertexAttrib2sNV@12)
-	GL_STUB(VertexAttrib2svNV, 751, VertexAttrib2svNV@8)
-	GL_STUB(VertexAttrib3dNV, 752, VertexAttrib3dNV@28)
-	GL_STUB(VertexAttrib3dvNV, 753, VertexAttrib3dvNV@8)
-	GL_STUB(VertexAttrib3fNV, 754, VertexAttrib3fNV@16)
-	GL_STUB(VertexAttrib3fvNV, 755, VertexAttrib3fvNV@8)
-	GL_STUB(VertexAttrib3sNV, 756, VertexAttrib3sNV@16)
-	GL_STUB(VertexAttrib3svNV, 757, VertexAttrib3svNV@8)
-	GL_STUB(VertexAttrib4dNV, 758, VertexAttrib4dNV@36)
-	GL_STUB(VertexAttrib4dvNV, 759, VertexAttrib4dvNV@8)
-	GL_STUB(VertexAttrib4fNV, 760, VertexAttrib4fNV@20)
-	GL_STUB(VertexAttrib4fvNV, 761, VertexAttrib4fvNV@8)
-	GL_STUB(VertexAttrib4sNV, 762, VertexAttrib4sNV@20)
-	GL_STUB(VertexAttrib4svNV, 763, VertexAttrib4svNV@8)
-	GL_STUB(VertexAttrib4ubNV, 764, VertexAttrib4ubNV@20)
-	GL_STUB(VertexAttrib4ubvNV, 765, VertexAttrib4ubvNV@8)
-	GL_STUB(VertexAttribPointerNV, 766, VertexAttribPointerNV@20)
-	GL_STUB(VertexAttribs1dvNV, 767, VertexAttribs1dvNV@12)
-	GL_STUB(VertexAttribs1fvNV, 768, VertexAttribs1fvNV@12)
-	GL_STUB(VertexAttribs1svNV, 769, VertexAttribs1svNV@12)
-	GL_STUB(VertexAttribs2dvNV, 770, VertexAttribs2dvNV@12)
-	GL_STUB(VertexAttribs2fvNV, 771, VertexAttribs2fvNV@12)
-	GL_STUB(VertexAttribs2svNV, 772, VertexAttribs2svNV@12)
-	GL_STUB(VertexAttribs3dvNV, 773, VertexAttribs3dvNV@12)
-	GL_STUB(VertexAttribs3fvNV, 774, VertexAttribs3fvNV@12)
-	GL_STUB(VertexAttribs3svNV, 775, VertexAttribs3svNV@12)
-	GL_STUB(VertexAttribs4dvNV, 776, VertexAttribs4dvNV@12)
-	GL_STUB(VertexAttribs4fvNV, 777, VertexAttribs4fvNV@12)
-	GL_STUB(VertexAttribs4svNV, 778, VertexAttribs4svNV@12)
-	GL_STUB(VertexAttribs4ubvNV, 779, VertexAttribs4ubvNV@12)
-	GL_STUB(GetTexBumpParameterfvATI, 780, GetTexBumpParameterfvATI@8)
-	GL_STUB(GetTexBumpParameterivATI, 781, GetTexBumpParameterivATI@8)
-	GL_STUB(TexBumpParameterfvATI, 782, TexBumpParameterfvATI@8)
-	GL_STUB(TexBumpParameterivATI, 783, TexBumpParameterivATI@8)
-	GL_STUB(AlphaFragmentOp1ATI, 784, AlphaFragmentOp1ATI@24)
-	GL_STUB(AlphaFragmentOp2ATI, 785, AlphaFragmentOp2ATI@36)
-	GL_STUB(AlphaFragmentOp3ATI, 786, AlphaFragmentOp3ATI@48)
-	GL_STUB(BeginFragmentShaderATI, 787, BeginFragmentShaderATI@0)
-	GL_STUB(BindFragmentShaderATI, 788, BindFragmentShaderATI@4)
-	GL_STUB(ColorFragmentOp1ATI, 789, ColorFragmentOp1ATI@28)
-	GL_STUB(ColorFragmentOp2ATI, 790, ColorFragmentOp2ATI@40)
-	GL_STUB(ColorFragmentOp3ATI, 791, ColorFragmentOp3ATI@52)
-	GL_STUB(DeleteFragmentShaderATI, 792, DeleteFragmentShaderATI@4)
-	GL_STUB(EndFragmentShaderATI, 793, EndFragmentShaderATI@0)
-	GL_STUB(GenFragmentShadersATI, 794, GenFragmentShadersATI@4)
-	GL_STUB(PassTexCoordATI, 795, PassTexCoordATI@12)
-	GL_STUB(SampleMapATI, 796, SampleMapATI@12)
-	GL_STUB(SetFragmentShaderConstantATI, 797, SetFragmentShaderConstantATI@8)
-	GL_STUB(PointParameteriNV, 798, PointParameteriNV@8)
-	GL_STUB(PointParameterivNV, 799, PointParameterivNV@8)
-	GL_STUB(_dispatch_stub_800, 800, _dispatch_stub_800@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_800, _dispatch_stub_800@4))
-	GL_STUB(_dispatch_stub_801, 801, _dispatch_stub_801@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_801, _dispatch_stub_801@4))
-	GL_STUB(_dispatch_stub_802, 802, _dispatch_stub_802@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_802, _dispatch_stub_802@8))
-	GL_STUB(_dispatch_stub_803, 803, _dispatch_stub_803@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_803, _dispatch_stub_803@8))
-	GL_STUB(_dispatch_stub_804, 804, _dispatch_stub_804@4)
-	HIDDEN(GL_PREFIX(_dispatch_stub_804, _dispatch_stub_804@4))
-	GL_STUB(GetProgramNamedParameterdvNV, 805, GetProgramNamedParameterdvNV@16)
-	GL_STUB(GetProgramNamedParameterfvNV, 806, GetProgramNamedParameterfvNV@16)
-	GL_STUB(ProgramNamedParameter4dNV, 807, ProgramNamedParameter4dNV@44)
-	GL_STUB(ProgramNamedParameter4dvNV, 808, ProgramNamedParameter4dvNV@16)
-	GL_STUB(ProgramNamedParameter4fNV, 809, ProgramNamedParameter4fNV@28)
-	GL_STUB(ProgramNamedParameter4fvNV, 810, ProgramNamedParameter4fvNV@16)
-	GL_STUB(PrimitiveRestartIndexNV, 811, PrimitiveRestartIndexNV@4)
-	GL_STUB(PrimitiveRestartNV, 812, PrimitiveRestartNV@0)
-	GL_STUB(_dispatch_stub_813, 813, _dispatch_stub_813@16)
-	HIDDEN(GL_PREFIX(_dispatch_stub_813, _dispatch_stub_813@16))
-	GL_STUB(_dispatch_stub_814, 814, _dispatch_stub_814@8)
-	HIDDEN(GL_PREFIX(_dispatch_stub_814, _dispatch_stub_814@8))
-	GL_STUB(BindFramebufferEXT, 815, BindFramebufferEXT@8)
-	GL_STUB(BindRenderbufferEXT, 816, BindRenderbufferEXT@8)
-	GL_STUB(CheckFramebufferStatusEXT, 817, CheckFramebufferStatusEXT@4)
-	GL_STUB(DeleteFramebuffersEXT, 818, DeleteFramebuffersEXT@8)
-	GL_STUB(DeleteRenderbuffersEXT, 819, DeleteRenderbuffersEXT@8)
-	GL_STUB(FramebufferRenderbufferEXT, 820, FramebufferRenderbufferEXT@16)
-	GL_STUB(FramebufferTexture1DEXT, 821, FramebufferTexture1DEXT@20)
-	GL_STUB(FramebufferTexture2DEXT, 822, FramebufferTexture2DEXT@20)
-	GL_STUB(FramebufferTexture3DEXT, 823, FramebufferTexture3DEXT@24)
-	GL_STUB(GenFramebuffersEXT, 824, GenFramebuffersEXT@8)
-	GL_STUB(GenRenderbuffersEXT, 825, GenRenderbuffersEXT@8)
-	GL_STUB(GenerateMipmapEXT, 826, GenerateMipmapEXT@4)
-	GL_STUB(GetFramebufferAttachmentParameterivEXT, 827, GetFramebufferAttachmentParameterivEXT@16)
-	GL_STUB(GetRenderbufferParameterivEXT, 828, GetRenderbufferParameterivEXT@12)
-	GL_STUB(IsFramebufferEXT, 829, IsFramebufferEXT@4)
-	GL_STUB(IsRenderbufferEXT, 830, IsRenderbufferEXT@4)
-	GL_STUB(RenderbufferStorageEXT, 831, RenderbufferStorageEXT@16)
-	GL_STUB(_dispatch_stub_832, 832, _dispatch_stub_832@40)
-	HIDDEN(GL_PREFIX(_dispatch_stub_832, _dispatch_stub_832@40))
-	GL_STUB(_dispatch_stub_833, 833, _dispatch_stub_833@12)
-	HIDDEN(GL_PREFIX(_dispatch_stub_833, _dispatch_stub_833@12))
-	GL_STUB(_dispatch_stub_834, 834, _dispatch_stub_834@12)
-	HIDDEN(GL_PREFIX(_dispatch_stub_834, _dispatch_stub_834@12))
-	GL_STUB(BindFragDataLocationEXT, 835, BindFragDataLocationEXT@12)
-	GL_STUB(GetFragDataLocationEXT, 836, GetFragDataLocationEXT@8)
-	GL_STUB(GetUniformuivEXT, 837, GetUniformuivEXT@12)
-	GL_STUB(GetVertexAttribIivEXT, 838, GetVertexAttribIivEXT@12)
-	GL_STUB(GetVertexAttribIuivEXT, 839, GetVertexAttribIuivEXT@12)
-	GL_STUB(Uniform1uiEXT, 840, Uniform1uiEXT@8)
-	GL_STUB(Uniform1uivEXT, 841, Uniform1uivEXT@12)
-	GL_STUB(Uniform2uiEXT, 842, Uniform2uiEXT@12)
-	GL_STUB(Uniform2uivEXT, 843, Uniform2uivEXT@12)
-	GL_STUB(Uniform3uiEXT, 844, Uniform3uiEXT@16)
-	GL_STUB(Uniform3uivEXT, 845, Uniform3uivEXT@12)
-	GL_STUB(Uniform4uiEXT, 846, Uniform4uiEXT@20)
-	GL_STUB(Uniform4uivEXT, 847, Uniform4uivEXT@12)
-	GL_STUB(VertexAttribI1iEXT, 848, VertexAttribI1iEXT@8)
-	GL_STUB(VertexAttribI1ivEXT, 849, VertexAttribI1ivEXT@8)
-	GL_STUB(VertexAttribI1uiEXT, 850, VertexAttribI1uiEXT@8)
-	GL_STUB(VertexAttribI1uivEXT, 851, VertexAttribI1uivEXT@8)
-	GL_STUB(VertexAttribI2iEXT, 852, VertexAttribI2iEXT@12)
-	GL_STUB(VertexAttribI2ivEXT, 853, VertexAttribI2ivEXT@8)
-	GL_STUB(VertexAttribI2uiEXT, 854, VertexAttribI2uiEXT@12)
-	GL_STUB(VertexAttribI2uivEXT, 855, VertexAttribI2uivEXT@8)
-	GL_STUB(VertexAttribI3iEXT, 856, VertexAttribI3iEXT@16)
-	GL_STUB(VertexAttribI3ivEXT, 857, VertexAttribI3ivEXT@8)
-	GL_STUB(VertexAttribI3uiEXT, 858, VertexAttribI3uiEXT@16)
-	GL_STUB(VertexAttribI3uivEXT, 859, VertexAttribI3uivEXT@8)
-	GL_STUB(VertexAttribI4bvEXT, 860, VertexAttribI4bvEXT@8)
-	GL_STUB(VertexAttribI4iEXT, 861, VertexAttribI4iEXT@20)
-	GL_STUB(VertexAttribI4ivEXT, 862, VertexAttribI4ivEXT@8)
-	GL_STUB(VertexAttribI4svEXT, 863, VertexAttribI4svEXT@8)
-	GL_STUB(VertexAttribI4ubvEXT, 864, VertexAttribI4ubvEXT@8)
-	GL_STUB(VertexAttribI4uiEXT, 865, VertexAttribI4uiEXT@20)
-	GL_STUB(VertexAttribI4uivEXT, 866, VertexAttribI4uivEXT@8)
-	GL_STUB(VertexAttribI4usvEXT, 867, VertexAttribI4usvEXT@8)
-	GL_STUB(VertexAttribIPointerEXT, 868, VertexAttribIPointerEXT@20)
-	GL_STUB(FramebufferTextureLayerEXT, 869, FramebufferTextureLayerEXT@20)
-	GL_STUB(ColorMaskIndexedEXT, 870, ColorMaskIndexedEXT@20)
-	GL_STUB(DisableIndexedEXT, 871, DisableIndexedEXT@8)
-	GL_STUB(EnableIndexedEXT, 872, EnableIndexedEXT@8)
-	GL_STUB(GetBooleanIndexedvEXT, 873, GetBooleanIndexedvEXT@12)
-	GL_STUB(GetIntegerIndexedvEXT, 874, GetIntegerIndexedvEXT@12)
-	GL_STUB(IsEnabledIndexedEXT, 875, IsEnabledIndexedEXT@8)
-	GL_STUB(ClearColorIiEXT, 876, ClearColorIiEXT@16)
-	GL_STUB(ClearColorIuiEXT, 877, ClearColorIuiEXT@16)
-	GL_STUB(GetTexParameterIivEXT, 878, GetTexParameterIivEXT@12)
-	GL_STUB(GetTexParameterIuivEXT, 879, GetTexParameterIuivEXT@12)
-	GL_STUB(TexParameterIivEXT, 880, TexParameterIivEXT@12)
-	GL_STUB(TexParameterIuivEXT, 881, TexParameterIuivEXT@12)
-	GL_STUB(BeginConditionalRenderNV, 882, BeginConditionalRenderNV@8)
-	GL_STUB(EndConditionalRenderNV, 883, EndConditionalRenderNV@0)
-	GL_STUB(BeginTransformFeedbackEXT, 884, BeginTransformFeedbackEXT@4)
-	GL_STUB(BindBufferBaseEXT, 885, BindBufferBaseEXT@12)
-	GL_STUB(BindBufferOffsetEXT, 886, BindBufferOffsetEXT@16)
-	GL_STUB(BindBufferRangeEXT, 887, BindBufferRangeEXT@20)
-	GL_STUB(EndTransformFeedbackEXT, 888, EndTransformFeedbackEXT@0)
-	GL_STUB(GetTransformFeedbackVaryingEXT, 889, GetTransformFeedbackVaryingEXT@28)
-	GL_STUB(TransformFeedbackVaryingsEXT, 890, TransformFeedbackVaryingsEXT@16)
-	GL_STUB(ProvokingVertexEXT, 891, ProvokingVertexEXT@4)
-	GL_STUB(_dispatch_stub_892, 892, _dispatch_stub_892@12)
-	HIDDEN(GL_PREFIX(_dispatch_stub_892, _dispatch_stub_892@12))
-	GL_STUB(_dispatch_stub_893, 893, _dispatch_stub_893@12)
-	HIDDEN(GL_PREFIX(_dispatch_stub_893, _dispatch_stub_893@12))
-	GL_STUB(GetObjectParameterivAPPLE, 894, GetObjectParameterivAPPLE@16)
-	GL_STUB(ObjectPurgeableAPPLE, 895, ObjectPurgeableAPPLE@12)
-	GL_STUB(ObjectUnpurgeableAPPLE, 896, ObjectUnpurgeableAPPLE@12)
-	GL_STUB(ActiveProgramEXT, 897, ActiveProgramEXT@4)
-	GL_STUB(CreateShaderProgramEXT, 898, CreateShaderProgramEXT@8)
-	GL_STUB(UseShaderProgramEXT, 899, UseShaderProgramEXT@8)
-	GL_STUB(TextureBarrierNV, 900, TextureBarrierNV@0)
-	GL_STUB(_dispatch_stub_901, 901, _dispatch_stub_901@16)
-	HIDDEN(GL_PREFIX(_dispatch_stub_901, _dispatch_stub_901@16))
-	GL_STUB(_dispatch_stub_902, 902, _dispatch_stub_902@16)
-	HIDDEN(GL_PREFIX(_dispatch_stub_902, _dispatch_stub_902@16))
-	GL_STUB(_dispatch_stub_903, 903, _dispatch_stub_903@16)
-	HIDDEN(GL_PREFIX(_dispatch_stub_903, _dispatch_stub_903@16))
-	GL_STUB(_dispatch_stub_904, 904, _dispatch_stub_904@12)
-	HIDDEN(GL_PREFIX(_dispatch_stub_904, _dispatch_stub_904@12))
-	GL_STUB(_dispatch_stub_905, 905, _dispatch_stub_905@12)
-	HIDDEN(GL_PREFIX(_dispatch_stub_905, _dispatch_stub_905@12))
-	GL_STUB(EGLImageTargetRenderbufferStorageOES, 906, EGLImageTargetRenderbufferStorageOES@8)
-	GL_STUB(EGLImageTargetTexture2DOES, 907, EGLImageTargetTexture2DOES@8)
+	GL_STUB(GetGraphicsResetStatusARB, 626, GetGraphicsResetStatusARB@0)
+	GL_STUB(GetnColorTableARB, 627, GetnColorTableARB@20)
+	GL_STUB(GetnCompressedTexImageARB, 628, GetnCompressedTexImageARB@16)
+	GL_STUB(GetnConvolutionFilterARB, 629, GetnConvolutionFilterARB@20)
+	GL_STUB(GetnHistogramARB, 630, GetnHistogramARB@24)
+	GL_STUB(GetnMapdvARB, 631, GetnMapdvARB@16)
+	GL_STUB(GetnMapfvARB, 632, GetnMapfvARB@16)
+	GL_STUB(GetnMapivARB, 633, GetnMapivARB@16)
+	GL_STUB(GetnMinmaxARB, 634, GetnMinmaxARB@24)
+	GL_STUB(GetnPixelMapfvARB, 635, GetnPixelMapfvARB@12)
+	GL_STUB(GetnPixelMapuivARB, 636, GetnPixelMapuivARB@12)
+	GL_STUB(GetnPixelMapusvARB, 637, GetnPixelMapusvARB@12)
+	GL_STUB(GetnPolygonStippleARB, 638, GetnPolygonStippleARB@8)
+	GL_STUB(GetnSeparableFilterARB, 639, GetnSeparableFilterARB@32)
+	GL_STUB(GetnTexImageARB, 640, GetnTexImageARB@24)
+	GL_STUB(GetnUniformdvARB, 641, GetnUniformdvARB@16)
+	GL_STUB(GetnUniformfvARB, 642, GetnUniformfvARB@16)
+	GL_STUB(GetnUniformivARB, 643, GetnUniformivARB@16)
+	GL_STUB(GetnUniformuivARB, 644, GetnUniformuivARB@16)
+	GL_STUB(ReadnPixelsARB, 645, ReadnPixelsARB@32)
+	GL_STUB(PolygonOffsetEXT, 646, PolygonOffsetEXT@8)
+	GL_STUB(_dispatch_stub_647, 647, _dispatch_stub_647@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_647, _dispatch_stub_647@8))
+	GL_STUB(_dispatch_stub_648, 648, _dispatch_stub_648@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_648, _dispatch_stub_648@8))
+	GL_STUB(_dispatch_stub_649, 649, _dispatch_stub_649@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_649, _dispatch_stub_649@8))
+	GL_STUB(_dispatch_stub_650, 650, _dispatch_stub_650@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_650, _dispatch_stub_650@8))
+	GL_STUB(_dispatch_stub_651, 651, _dispatch_stub_651@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_651, _dispatch_stub_651@8))
+	GL_STUB(_dispatch_stub_652, 652, _dispatch_stub_652@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_652, _dispatch_stub_652@8))
+	GL_STUB(_dispatch_stub_653, 653, _dispatch_stub_653@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_653, _dispatch_stub_653@8))
+	GL_STUB(_dispatch_stub_654, 654, _dispatch_stub_654@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_654, _dispatch_stub_654@4))
+	GL_STUB(ColorPointerEXT, 655, ColorPointerEXT@20)
+	GL_STUB(EdgeFlagPointerEXT, 656, EdgeFlagPointerEXT@12)
+	GL_STUB(IndexPointerEXT, 657, IndexPointerEXT@16)
+	GL_STUB(NormalPointerEXT, 658, NormalPointerEXT@16)
+	GL_STUB(TexCoordPointerEXT, 659, TexCoordPointerEXT@20)
+	GL_STUB(VertexPointerEXT, 660, VertexPointerEXT@20)
+	GL_STUB(PointParameterfEXT, 661, PointParameterfEXT@8)
+	GL_STUB(PointParameterfvEXT, 662, PointParameterfvEXT@8)
+	GL_STUB(LockArraysEXT, 663, LockArraysEXT@8)
+	GL_STUB(UnlockArraysEXT, 664, UnlockArraysEXT@0)
+	GL_STUB(SecondaryColor3bEXT, 665, SecondaryColor3bEXT@12)
+	GL_STUB(SecondaryColor3bvEXT, 666, SecondaryColor3bvEXT@4)
+	GL_STUB(SecondaryColor3dEXT, 667, SecondaryColor3dEXT@24)
+	GL_STUB(SecondaryColor3dvEXT, 668, SecondaryColor3dvEXT@4)
+	GL_STUB(SecondaryColor3fEXT, 669, SecondaryColor3fEXT@12)
+	GL_STUB(SecondaryColor3fvEXT, 670, SecondaryColor3fvEXT@4)
+	GL_STUB(SecondaryColor3iEXT, 671, SecondaryColor3iEXT@12)
+	GL_STUB(SecondaryColor3ivEXT, 672, SecondaryColor3ivEXT@4)
+	GL_STUB(SecondaryColor3sEXT, 673, SecondaryColor3sEXT@12)
+	GL_STUB(SecondaryColor3svEXT, 674, SecondaryColor3svEXT@4)
+	GL_STUB(SecondaryColor3ubEXT, 675, SecondaryColor3ubEXT@12)
+	GL_STUB(SecondaryColor3ubvEXT, 676, SecondaryColor3ubvEXT@4)
+	GL_STUB(SecondaryColor3uiEXT, 677, SecondaryColor3uiEXT@12)
+	GL_STUB(SecondaryColor3uivEXT, 678, SecondaryColor3uivEXT@4)
+	GL_STUB(SecondaryColor3usEXT, 679, SecondaryColor3usEXT@12)
+	GL_STUB(SecondaryColor3usvEXT, 680, SecondaryColor3usvEXT@4)
+	GL_STUB(SecondaryColorPointerEXT, 681, SecondaryColorPointerEXT@16)
+	GL_STUB(MultiDrawArraysEXT, 682, MultiDrawArraysEXT@16)
+	GL_STUB(MultiDrawElementsEXT, 683, MultiDrawElementsEXT@20)
+	GL_STUB(FogCoordPointerEXT, 684, FogCoordPointerEXT@12)
+	GL_STUB(FogCoorddEXT, 685, FogCoorddEXT@8)
+	GL_STUB(FogCoorddvEXT, 686, FogCoorddvEXT@4)
+	GL_STUB(FogCoordfEXT, 687, FogCoordfEXT@4)
+	GL_STUB(FogCoordfvEXT, 688, FogCoordfvEXT@4)
+	GL_STUB(_dispatch_stub_689, 689, _dispatch_stub_689@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_689, _dispatch_stub_689@4))
+	GL_STUB(BlendFuncSeparateEXT, 690, BlendFuncSeparateEXT@16)
+	GL_STUB(FlushVertexArrayRangeNV, 691, FlushVertexArrayRangeNV@0)
+	GL_STUB(VertexArrayRangeNV, 692, VertexArrayRangeNV@8)
+	GL_STUB(CombinerInputNV, 693, CombinerInputNV@24)
+	GL_STUB(CombinerOutputNV, 694, CombinerOutputNV@40)
+	GL_STUB(CombinerParameterfNV, 695, CombinerParameterfNV@8)
+	GL_STUB(CombinerParameterfvNV, 696, CombinerParameterfvNV@8)
+	GL_STUB(CombinerParameteriNV, 697, CombinerParameteriNV@8)
+	GL_STUB(CombinerParameterivNV, 698, CombinerParameterivNV@8)
+	GL_STUB(FinalCombinerInputNV, 699, FinalCombinerInputNV@16)
+	GL_STUB(GetCombinerInputParameterfvNV, 700, GetCombinerInputParameterfvNV@20)
+	GL_STUB(GetCombinerInputParameterivNV, 701, GetCombinerInputParameterivNV@20)
+	GL_STUB(GetCombinerOutputParameterfvNV, 702, GetCombinerOutputParameterfvNV@16)
+	GL_STUB(GetCombinerOutputParameterivNV, 703, GetCombinerOutputParameterivNV@16)
+	GL_STUB(GetFinalCombinerInputParameterfvNV, 704, GetFinalCombinerInputParameterfvNV@12)
+	GL_STUB(GetFinalCombinerInputParameterivNV, 705, GetFinalCombinerInputParameterivNV@12)
+	GL_STUB(ResizeBuffersMESA, 706, ResizeBuffersMESA@0)
+	GL_STUB(WindowPos2dMESA, 707, WindowPos2dMESA@16)
+	GL_STUB(WindowPos2dvMESA, 708, WindowPos2dvMESA@4)
+	GL_STUB(WindowPos2fMESA, 709, WindowPos2fMESA@8)
+	GL_STUB(WindowPos2fvMESA, 710, WindowPos2fvMESA@4)
+	GL_STUB(WindowPos2iMESA, 711, WindowPos2iMESA@8)
+	GL_STUB(WindowPos2ivMESA, 712, WindowPos2ivMESA@4)
+	GL_STUB(WindowPos2sMESA, 713, WindowPos2sMESA@8)
+	GL_STUB(WindowPos2svMESA, 714, WindowPos2svMESA@4)
+	GL_STUB(WindowPos3dMESA, 715, WindowPos3dMESA@24)
+	GL_STUB(WindowPos3dvMESA, 716, WindowPos3dvMESA@4)
+	GL_STUB(WindowPos3fMESA, 717, WindowPos3fMESA@12)
+	GL_STUB(WindowPos3fvMESA, 718, WindowPos3fvMESA@4)
+	GL_STUB(WindowPos3iMESA, 719, WindowPos3iMESA@12)
+	GL_STUB(WindowPos3ivMESA, 720, WindowPos3ivMESA@4)
+	GL_STUB(WindowPos3sMESA, 721, WindowPos3sMESA@12)
+	GL_STUB(WindowPos3svMESA, 722, WindowPos3svMESA@4)
+	GL_STUB(WindowPos4dMESA, 723, WindowPos4dMESA@32)
+	GL_STUB(WindowPos4dvMESA, 724, WindowPos4dvMESA@4)
+	GL_STUB(WindowPos4fMESA, 725, WindowPos4fMESA@16)
+	GL_STUB(WindowPos4fvMESA, 726, WindowPos4fvMESA@4)
+	GL_STUB(WindowPos4iMESA, 727, WindowPos4iMESA@16)
+	GL_STUB(WindowPos4ivMESA, 728, WindowPos4ivMESA@4)
+	GL_STUB(WindowPos4sMESA, 729, WindowPos4sMESA@16)
+	GL_STUB(WindowPos4svMESA, 730, WindowPos4svMESA@4)
+	GL_STUB(_dispatch_stub_731, 731, _dispatch_stub_731@20)
+	HIDDEN(GL_PREFIX(_dispatch_stub_731, _dispatch_stub_731@20))
+	GL_STUB(_dispatch_stub_732, 732, _dispatch_stub_732@24)
+	HIDDEN(GL_PREFIX(_dispatch_stub_732, _dispatch_stub_732@24))
+	GL_STUB(_dispatch_stub_733, 733, _dispatch_stub_733@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_733, _dispatch_stub_733@8))
+	GL_STUB(_dispatch_stub_734, 734, _dispatch_stub_734@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_734, _dispatch_stub_734@4))
+	GL_STUB(_dispatch_stub_735, 735, _dispatch_stub_735@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_735, _dispatch_stub_735@8))
+	GL_STUB(_dispatch_stub_736, 736, _dispatch_stub_736@12)
+	HIDDEN(GL_PREFIX(_dispatch_stub_736, _dispatch_stub_736@12))
+	GL_STUB(_dispatch_stub_737, 737, _dispatch_stub_737@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_737, _dispatch_stub_737@4))
+	GL_STUB(_dispatch_stub_738, 738, _dispatch_stub_738@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_738, _dispatch_stub_738@8))
+	GL_STUB(_dispatch_stub_739, 739, _dispatch_stub_739@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_739, _dispatch_stub_739@4))
+	GL_STUB(AreProgramsResidentNV, 740, AreProgramsResidentNV@12)
+	GL_STUB(BindProgramNV, 741, BindProgramNV@8)
+	GL_STUB(DeleteProgramsNV, 742, DeleteProgramsNV@8)
+	GL_STUB(ExecuteProgramNV, 743, ExecuteProgramNV@12)
+	GL_STUB(GenProgramsNV, 744, GenProgramsNV@8)
+	GL_STUB(GetProgramParameterdvNV, 745, GetProgramParameterdvNV@16)
+	GL_STUB(GetProgramParameterfvNV, 746, GetProgramParameterfvNV@16)
+	GL_STUB(GetProgramStringNV, 747, GetProgramStringNV@12)
+	GL_STUB(GetProgramivNV, 748, GetProgramivNV@12)
+	GL_STUB(GetTrackMatrixivNV, 749, GetTrackMatrixivNV@16)
+	GL_STUB(GetVertexAttribPointervNV, 750, GetVertexAttribPointervNV@12)
+	GL_STUB(GetVertexAttribdvNV, 751, GetVertexAttribdvNV@12)
+	GL_STUB(GetVertexAttribfvNV, 752, GetVertexAttribfvNV@12)
+	GL_STUB(GetVertexAttribivNV, 753, GetVertexAttribivNV@12)
+	GL_STUB(IsProgramNV, 754, IsProgramNV@4)
+	GL_STUB(LoadProgramNV, 755, LoadProgramNV@16)
+	GL_STUB(ProgramParameters4dvNV, 756, ProgramParameters4dvNV@16)
+	GL_STUB(ProgramParameters4fvNV, 757, ProgramParameters4fvNV@16)
+	GL_STUB(RequestResidentProgramsNV, 758, RequestResidentProgramsNV@8)
+	GL_STUB(TrackMatrixNV, 759, TrackMatrixNV@16)
+	GL_STUB(VertexAttrib1dNV, 760, VertexAttrib1dNV@12)
+	GL_STUB(VertexAttrib1dvNV, 761, VertexAttrib1dvNV@8)
+	GL_STUB(VertexAttrib1fNV, 762, VertexAttrib1fNV@8)
+	GL_STUB(VertexAttrib1fvNV, 763, VertexAttrib1fvNV@8)
+	GL_STUB(VertexAttrib1sNV, 764, VertexAttrib1sNV@8)
+	GL_STUB(VertexAttrib1svNV, 765, VertexAttrib1svNV@8)
+	GL_STUB(VertexAttrib2dNV, 766, VertexAttrib2dNV@20)
+	GL_STUB(VertexAttrib2dvNV, 767, VertexAttrib2dvNV@8)
+	GL_STUB(VertexAttrib2fNV, 768, VertexAttrib2fNV@12)
+	GL_STUB(VertexAttrib2fvNV, 769, VertexAttrib2fvNV@8)
+	GL_STUB(VertexAttrib2sNV, 770, VertexAttrib2sNV@12)
+	GL_STUB(VertexAttrib2svNV, 771, VertexAttrib2svNV@8)
+	GL_STUB(VertexAttrib3dNV, 772, VertexAttrib3dNV@28)
+	GL_STUB(VertexAttrib3dvNV, 773, VertexAttrib3dvNV@8)
+	GL_STUB(VertexAttrib3fNV, 774, VertexAttrib3fNV@16)
+	GL_STUB(VertexAttrib3fvNV, 775, VertexAttrib3fvNV@8)
+	GL_STUB(VertexAttrib3sNV, 776, VertexAttrib3sNV@16)
+	GL_STUB(VertexAttrib3svNV, 777, VertexAttrib3svNV@8)
+	GL_STUB(VertexAttrib4dNV, 778, VertexAttrib4dNV@36)
+	GL_STUB(VertexAttrib4dvNV, 779, VertexAttrib4dvNV@8)
+	GL_STUB(VertexAttrib4fNV, 780, VertexAttrib4fNV@20)
+	GL_STUB(VertexAttrib4fvNV, 781, VertexAttrib4fvNV@8)
+	GL_STUB(VertexAttrib4sNV, 782, VertexAttrib4sNV@20)
+	GL_STUB(VertexAttrib4svNV, 783, VertexAttrib4svNV@8)
+	GL_STUB(VertexAttrib4ubNV, 784, VertexAttrib4ubNV@20)
+	GL_STUB(VertexAttrib4ubvNV, 785, VertexAttrib4ubvNV@8)
+	GL_STUB(VertexAttribPointerNV, 786, VertexAttribPointerNV@20)
+	GL_STUB(VertexAttribs1dvNV, 787, VertexAttribs1dvNV@12)
+	GL_STUB(VertexAttribs1fvNV, 788, VertexAttribs1fvNV@12)
+	GL_STUB(VertexAttribs1svNV, 789, VertexAttribs1svNV@12)
+	GL_STUB(VertexAttribs2dvNV, 790, VertexAttribs2dvNV@12)
+	GL_STUB(VertexAttribs2fvNV, 791, VertexAttribs2fvNV@12)
+	GL_STUB(VertexAttribs2svNV, 792, VertexAttribs2svNV@12)
+	GL_STUB(VertexAttribs3dvNV, 793, VertexAttribs3dvNV@12)
+	GL_STUB(VertexAttribs3fvNV, 794, VertexAttribs3fvNV@12)
+	GL_STUB(VertexAttribs3svNV, 795, VertexAttribs3svNV@12)
+	GL_STUB(VertexAttribs4dvNV, 796, VertexAttribs4dvNV@12)
+	GL_STUB(VertexAttribs4fvNV, 797, VertexAttribs4fvNV@12)
+	GL_STUB(VertexAttribs4svNV, 798, VertexAttribs4svNV@12)
+	GL_STUB(VertexAttribs4ubvNV, 799, VertexAttribs4ubvNV@12)
+	GL_STUB(GetTexBumpParameterfvATI, 800, GetTexBumpParameterfvATI@8)
+	GL_STUB(GetTexBumpParameterivATI, 801, GetTexBumpParameterivATI@8)
+	GL_STUB(TexBumpParameterfvATI, 802, TexBumpParameterfvATI@8)
+	GL_STUB(TexBumpParameterivATI, 803, TexBumpParameterivATI@8)
+	GL_STUB(AlphaFragmentOp1ATI, 804, AlphaFragmentOp1ATI@24)
+	GL_STUB(AlphaFragmentOp2ATI, 805, AlphaFragmentOp2ATI@36)
+	GL_STUB(AlphaFragmentOp3ATI, 806, AlphaFragmentOp3ATI@48)
+	GL_STUB(BeginFragmentShaderATI, 807, BeginFragmentShaderATI@0)
+	GL_STUB(BindFragmentShaderATI, 808, BindFragmentShaderATI@4)
+	GL_STUB(ColorFragmentOp1ATI, 809, ColorFragmentOp1ATI@28)
+	GL_STUB(ColorFragmentOp2ATI, 810, ColorFragmentOp2ATI@40)
+	GL_STUB(ColorFragmentOp3ATI, 811, ColorFragmentOp3ATI@52)
+	GL_STUB(DeleteFragmentShaderATI, 812, DeleteFragmentShaderATI@4)
+	GL_STUB(EndFragmentShaderATI, 813, EndFragmentShaderATI@0)
+	GL_STUB(GenFragmentShadersATI, 814, GenFragmentShadersATI@4)
+	GL_STUB(PassTexCoordATI, 815, PassTexCoordATI@12)
+	GL_STUB(SampleMapATI, 816, SampleMapATI@12)
+	GL_STUB(SetFragmentShaderConstantATI, 817, SetFragmentShaderConstantATI@8)
+	GL_STUB(PointParameteriNV, 818, PointParameteriNV@8)
+	GL_STUB(PointParameterivNV, 819, PointParameterivNV@8)
+	GL_STUB(_dispatch_stub_820, 820, _dispatch_stub_820@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_820, _dispatch_stub_820@4))
+	GL_STUB(_dispatch_stub_821, 821, _dispatch_stub_821@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_821, _dispatch_stub_821@4))
+	GL_STUB(_dispatch_stub_822, 822, _dispatch_stub_822@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_822, _dispatch_stub_822@8))
+	GL_STUB(_dispatch_stub_823, 823, _dispatch_stub_823@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_823, _dispatch_stub_823@8))
+	GL_STUB(_dispatch_stub_824, 824, _dispatch_stub_824@4)
+	HIDDEN(GL_PREFIX(_dispatch_stub_824, _dispatch_stub_824@4))
+	GL_STUB(GetProgramNamedParameterdvNV, 825, GetProgramNamedParameterdvNV@16)
+	GL_STUB(GetProgramNamedParameterfvNV, 826, GetProgramNamedParameterfvNV@16)
+	GL_STUB(ProgramNamedParameter4dNV, 827, ProgramNamedParameter4dNV@44)
+	GL_STUB(ProgramNamedParameter4dvNV, 828, ProgramNamedParameter4dvNV@16)
+	GL_STUB(ProgramNamedParameter4fNV, 829, ProgramNamedParameter4fNV@28)
+	GL_STUB(ProgramNamedParameter4fvNV, 830, ProgramNamedParameter4fvNV@16)
+	GL_STUB(PrimitiveRestartIndexNV, 831, PrimitiveRestartIndexNV@4)
+	GL_STUB(PrimitiveRestartNV, 832, PrimitiveRestartNV@0)
+	GL_STUB(_dispatch_stub_833, 833, _dispatch_stub_833@16)
+	HIDDEN(GL_PREFIX(_dispatch_stub_833, _dispatch_stub_833@16))
+	GL_STUB(_dispatch_stub_834, 834, _dispatch_stub_834@8)
+	HIDDEN(GL_PREFIX(_dispatch_stub_834, _dispatch_stub_834@8))
+	GL_STUB(BindFramebufferEXT, 835, BindFramebufferEXT@8)
+	GL_STUB(BindRenderbufferEXT, 836, BindRenderbufferEXT@8)
+	GL_STUB(CheckFramebufferStatusEXT, 837, CheckFramebufferStatusEXT@4)
+	GL_STUB(DeleteFramebuffersEXT, 838, DeleteFramebuffersEXT@8)
+	GL_STUB(DeleteRenderbuffersEXT, 839, DeleteRenderbuffersEXT@8)
+	GL_STUB(FramebufferRenderbufferEXT, 840, FramebufferRenderbufferEXT@16)
+	GL_STUB(FramebufferTexture1DEXT, 841, FramebufferTexture1DEXT@20)
+	GL_STUB(FramebufferTexture2DEXT, 842, FramebufferTexture2DEXT@20)
+	GL_STUB(FramebufferTexture3DEXT, 843, FramebufferTexture3DEXT@24)
+	GL_STUB(GenFramebuffersEXT, 844, GenFramebuffersEXT@8)
+	GL_STUB(GenRenderbuffersEXT, 845, GenRenderbuffersEXT@8)
+	GL_STUB(GenerateMipmapEXT, 846, GenerateMipmapEXT@4)
+	GL_STUB(GetFramebufferAttachmentParameterivEXT, 847, GetFramebufferAttachmentParameterivEXT@16)
+	GL_STUB(GetRenderbufferParameterivEXT, 848, GetRenderbufferParameterivEXT@12)
+	GL_STUB(IsFramebufferEXT, 849, IsFramebufferEXT@4)
+	GL_STUB(IsRenderbufferEXT, 850, IsRenderbufferEXT@4)
+	GL_STUB(RenderbufferStorageEXT, 851, RenderbufferStorageEXT@16)
+	GL_STUB(_dispatch_stub_852, 852, _dispatch_stub_852@40)
+	HIDDEN(GL_PREFIX(_dispatch_stub_852, _dispatch_stub_852@40))
+	GL_STUB(_dispatch_stub_853, 853, _dispatch_stub_853@12)
+	HIDDEN(GL_PREFIX(_dispatch_stub_853, _dispatch_stub_853@12))
+	GL_STUB(_dispatch_stub_854, 854, _dispatch_stub_854@12)
+	HIDDEN(GL_PREFIX(_dispatch_stub_854, _dispatch_stub_854@12))
+	GL_STUB(BindFragDataLocationEXT, 855, BindFragDataLocationEXT@12)
+	GL_STUB(GetFragDataLocationEXT, 856, GetFragDataLocationEXT@8)
+	GL_STUB(GetUniformuivEXT, 857, GetUniformuivEXT@12)
+	GL_STUB(GetVertexAttribIivEXT, 858, GetVertexAttribIivEXT@12)
+	GL_STUB(GetVertexAttribIuivEXT, 859, GetVertexAttribIuivEXT@12)
+	GL_STUB(Uniform1uiEXT, 860, Uniform1uiEXT@8)
+	GL_STUB(Uniform1uivEXT, 861, Uniform1uivEXT@12)
+	GL_STUB(Uniform2uiEXT, 862, Uniform2uiEXT@12)
+	GL_STUB(Uniform2uivEXT, 863, Uniform2uivEXT@12)
+	GL_STUB(Uniform3uiEXT, 864, Uniform3uiEXT@16)
+	GL_STUB(Uniform3uivEXT, 865, Uniform3uivEXT@12)
+	GL_STUB(Uniform4uiEXT, 866, Uniform4uiEXT@20)
+	GL_STUB(Uniform4uivEXT, 867, Uniform4uivEXT@12)
+	GL_STUB(VertexAttribI1iEXT, 868, VertexAttribI1iEXT@8)
+	GL_STUB(VertexAttribI1ivEXT, 869, VertexAttribI1ivEXT@8)
+	GL_STUB(VertexAttribI1uiEXT, 870, VertexAttribI1uiEXT@8)
+	GL_STUB(VertexAttribI1uivEXT, 871, VertexAttribI1uivEXT@8)
+	GL_STUB(VertexAttribI2iEXT, 872, VertexAttribI2iEXT@12)
+	GL_STUB(VertexAttribI2ivEXT, 873, VertexAttribI2ivEXT@8)
+	GL_STUB(VertexAttribI2uiEXT, 874, VertexAttribI2uiEXT@12)
+	GL_STUB(VertexAttribI2uivEXT, 875, VertexAttribI2uivEXT@8)
+	GL_STUB(VertexAttribI3iEXT, 876, VertexAttribI3iEXT@16)
+	GL_STUB(VertexAttribI3ivEXT, 877, VertexAttribI3ivEXT@8)
+	GL_STUB(VertexAttribI3uiEXT, 878, VertexAttribI3uiEXT@16)
+	GL_STUB(VertexAttribI3uivEXT, 879, VertexAttribI3uivEXT@8)
+	GL_STUB(VertexAttribI4bvEXT, 880, VertexAttribI4bvEXT@8)
+	GL_STUB(VertexAttribI4iEXT, 881, VertexAttribI4iEXT@20)
+	GL_STUB(VertexAttribI4ivEXT, 882, VertexAttribI4ivEXT@8)
+	GL_STUB(VertexAttribI4svEXT, 883, VertexAttribI4svEXT@8)
+	GL_STUB(VertexAttribI4ubvEXT, 884, VertexAttribI4ubvEXT@8)
+	GL_STUB(VertexAttribI4uiEXT, 885, VertexAttribI4uiEXT@20)
+	GL_STUB(VertexAttribI4uivEXT, 886, VertexAttribI4uivEXT@8)
+	GL_STUB(VertexAttribI4usvEXT, 887, VertexAttribI4usvEXT@8)
+	GL_STUB(VertexAttribIPointerEXT, 888, VertexAttribIPointerEXT@20)
+	GL_STUB(FramebufferTextureLayerEXT, 889, FramebufferTextureLayerEXT@20)
+	GL_STUB(ColorMaskIndexedEXT, 890, ColorMaskIndexedEXT@20)
+	GL_STUB(DisableIndexedEXT, 891, DisableIndexedEXT@8)
+	GL_STUB(EnableIndexedEXT, 892, EnableIndexedEXT@8)
+	GL_STUB(GetBooleanIndexedvEXT, 893, GetBooleanIndexedvEXT@12)
+	GL_STUB(GetIntegerIndexedvEXT, 894, GetIntegerIndexedvEXT@12)
+	GL_STUB(IsEnabledIndexedEXT, 895, IsEnabledIndexedEXT@8)
+	GL_STUB(ClearColorIiEXT, 896, ClearColorIiEXT@16)
+	GL_STUB(ClearColorIuiEXT, 897, ClearColorIuiEXT@16)
+	GL_STUB(GetTexParameterIivEXT, 898, GetTexParameterIivEXT@12)
+	GL_STUB(GetTexParameterIuivEXT, 899, GetTexParameterIuivEXT@12)
+	GL_STUB(TexParameterIivEXT, 900, TexParameterIivEXT@12)
+	GL_STUB(TexParameterIuivEXT, 901, TexParameterIuivEXT@12)
+	GL_STUB(BeginConditionalRenderNV, 902, BeginConditionalRenderNV@8)
+	GL_STUB(EndConditionalRenderNV, 903, EndConditionalRenderNV@0)
+	GL_STUB(BeginTransformFeedbackEXT, 904, BeginTransformFeedbackEXT@4)
+	GL_STUB(BindBufferBaseEXT, 905, BindBufferBaseEXT@12)
+	GL_STUB(BindBufferOffsetEXT, 906, BindBufferOffsetEXT@16)
+	GL_STUB(BindBufferRangeEXT, 907, BindBufferRangeEXT@20)
+	GL_STUB(EndTransformFeedbackEXT, 908, EndTransformFeedbackEXT@0)
+	GL_STUB(GetTransformFeedbackVaryingEXT, 909, GetTransformFeedbackVaryingEXT@28)
+	GL_STUB(TransformFeedbackVaryingsEXT, 910, TransformFeedbackVaryingsEXT@16)
+	GL_STUB(ProvokingVertexEXT, 911, ProvokingVertexEXT@4)
+	GL_STUB(_dispatch_stub_912, 912, _dispatch_stub_912@12)
+	HIDDEN(GL_PREFIX(_dispatch_stub_912, _dispatch_stub_912@12))
+	GL_STUB(_dispatch_stub_913, 913, _dispatch_stub_913@12)
+	HIDDEN(GL_PREFIX(_dispatch_stub_913, _dispatch_stub_913@12))
+	GL_STUB(GetObjectParameterivAPPLE, 914, GetObjectParameterivAPPLE@16)
+	GL_STUB(ObjectPurgeableAPPLE, 915, ObjectPurgeableAPPLE@12)
+	GL_STUB(ObjectUnpurgeableAPPLE, 916, ObjectUnpurgeableAPPLE@12)
+	GL_STUB(ActiveProgramEXT, 917, ActiveProgramEXT@4)
+	GL_STUB(CreateShaderProgramEXT, 918, CreateShaderProgramEXT@8)
+	GL_STUB(UseShaderProgramEXT, 919, UseShaderProgramEXT@8)
+	GL_STUB(TextureBarrierNV, 920, TextureBarrierNV@0)
+	GL_STUB(_dispatch_stub_921, 921, _dispatch_stub_921@16)
+	HIDDEN(GL_PREFIX(_dispatch_stub_921, _dispatch_stub_921@16))
+	GL_STUB(_dispatch_stub_922, 922, _dispatch_stub_922@16)
+	HIDDEN(GL_PREFIX(_dispatch_stub_922, _dispatch_stub_922@16))
+	GL_STUB(_dispatch_stub_923, 923, _dispatch_stub_923@16)
+	HIDDEN(GL_PREFIX(_dispatch_stub_923, _dispatch_stub_923@16))
+	GL_STUB(_dispatch_stub_924, 924, _dispatch_stub_924@12)
+	HIDDEN(GL_PREFIX(_dispatch_stub_924, _dispatch_stub_924@12))
+	GL_STUB(_dispatch_stub_925, 925, _dispatch_stub_925@12)
+	HIDDEN(GL_PREFIX(_dispatch_stub_925, _dispatch_stub_925@12))
+	GL_STUB(EGLImageTargetRenderbufferStorageOES, 926, EGLImageTargetRenderbufferStorageOES@8)
+	GL_STUB(EGLImageTargetTexture2DOES, 927, EGLImageTargetTexture2DOES@8)
 	GL_STUB_ALIAS(ArrayElementEXT, 306, ArrayElementEXT@4, ArrayElement, ArrayElement@4)
 	GL_STUB_ALIAS(BindTextureEXT, 307, BindTextureEXT@8, BindTexture, BindTexture@8)
 	GL_STUB_ALIAS(DrawArraysEXT, 310, DrawArraysEXT@12, DrawArrays, DrawArrays@12)
@@ -1282,151 +1302,151 @@ GLNAME(gl_dispatch_functions_start):
 	GL_STUB_ALIAS(DrawElementsInstancedEXT, 574, DrawElementsInstancedEXT@20, DrawElementsInstancedARB, DrawElementsInstancedARB@20)
 	GL_STUB_ALIAS(DrawElementsInstanced, 574, DrawElementsInstanced@20, DrawElementsInstancedARB, DrawElementsInstancedARB@20)
 	GL_STUB_ALIAS(RenderbufferStorageMultisampleEXT, 575, RenderbufferStorageMultisampleEXT@20, RenderbufferStorageMultisample, RenderbufferStorageMultisample@20)
-	GL_STUB_ALIAS(PointParameterf, 641, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8)
-	GL_STUB_ALIAS(PointParameterfARB, 641, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8)
-	GL_STUB_ALIAS(PointParameterfv, 642, PointParameterfv@8, PointParameterfvEXT, PointParameterfvEXT@8)
-	GL_STUB_ALIAS(PointParameterfvARB, 642, PointParameterfvARB@8, PointParameterfvEXT, PointParameterfvEXT@8)
-	GL_STUB_ALIAS(SecondaryColor3b, 645, SecondaryColor3b@12, SecondaryColor3bEXT, SecondaryColor3bEXT@12)
-	GL_STUB_ALIAS(SecondaryColor3bv, 646, SecondaryColor3bv@4, SecondaryColor3bvEXT, SecondaryColor3bvEXT@4)
-	GL_STUB_ALIAS(SecondaryColor3d, 647, SecondaryColor3d@24, SecondaryColor3dEXT, SecondaryColor3dEXT@24)
-	GL_STUB_ALIAS(SecondaryColor3dv, 648, SecondaryColor3dv@4, SecondaryColor3dvEXT, SecondaryColor3dvEXT@4)
-	GL_STUB_ALIAS(SecondaryColor3f, 649, SecondaryColor3f@12, SecondaryColor3fEXT, SecondaryColor3fEXT@12)
-	GL_STUB_ALIAS(SecondaryColor3fv, 650, SecondaryColor3fv@4, SecondaryColor3fvEXT, SecondaryColor3fvEXT@4)
-	GL_STUB_ALIAS(SecondaryColor3i, 651, SecondaryColor3i@12, SecondaryColor3iEXT, SecondaryColor3iEXT@12)
-	GL_STUB_ALIAS(SecondaryColor3iv, 652, SecondaryColor3iv@4, SecondaryColor3ivEXT, SecondaryColor3ivEXT@4)
-	GL_STUB_ALIAS(SecondaryColor3s, 653, SecondaryColor3s@12, SecondaryColor3sEXT, SecondaryColor3sEXT@12)
-	GL_STUB_ALIAS(SecondaryColor3sv, 654, SecondaryColor3sv@4, SecondaryColor3svEXT, SecondaryColor3svEXT@4)
-	GL_STUB_ALIAS(SecondaryColor3ub, 655, SecondaryColor3ub@12, SecondaryColor3ubEXT, SecondaryColor3ubEXT@12)
-	GL_STUB_ALIAS(SecondaryColor3ubv, 656, SecondaryColor3ubv@4, SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4)
-	GL_STUB_ALIAS(SecondaryColor3ui, 657, SecondaryColor3ui@12, SecondaryColor3uiEXT, SecondaryColor3uiEXT@12)
-	GL_STUB_ALIAS(SecondaryColor3uiv, 658, SecondaryColor3uiv@4, SecondaryColor3uivEXT, SecondaryColor3uivEXT@4)
-	GL_STUB_ALIAS(SecondaryColor3us, 659, SecondaryColor3us@12, SecondaryColor3usEXT, SecondaryColor3usEXT@12)
-	GL_STUB_ALIAS(SecondaryColor3usv, 660, SecondaryColor3usv@4, SecondaryColor3usvEXT, SecondaryColor3usvEXT@4)
-	GL_STUB_ALIAS(SecondaryColorPointer, 661, SecondaryColorPointer@16, SecondaryColorPointerEXT, SecondaryColorPointerEXT@16)
-	GL_STUB_ALIAS(MultiDrawArrays, 662, MultiDrawArrays@16, MultiDrawArraysEXT, MultiDrawArraysEXT@16)
-	GL_STUB_ALIAS(MultiDrawElements, 663, MultiDrawElements@20, MultiDrawElementsEXT, MultiDrawElementsEXT@20)
-	GL_STUB_ALIAS(FogCoordPointer, 664, FogCoordPointer@12, FogCoordPointerEXT, FogCoordPointerEXT@12)
-	GL_STUB_ALIAS(FogCoordd, 665, FogCoordd@8, FogCoorddEXT, FogCoorddEXT@8)
-	GL_STUB_ALIAS(FogCoorddv, 666, FogCoorddv@4, FogCoorddvEXT, FogCoorddvEXT@4)
-	GL_STUB_ALIAS(FogCoordf, 667, FogCoordf@4, FogCoordfEXT, FogCoordfEXT@4)
-	GL_STUB_ALIAS(FogCoordfv, 668, FogCoordfv@4, FogCoordfvEXT, FogCoordfvEXT@4)
-	GL_STUB_ALIAS(BlendFuncSeparate, 670, BlendFuncSeparate@16, BlendFuncSeparateEXT, BlendFuncSeparateEXT@16)
-	GL_STUB_ALIAS(WindowPos2d, 687, WindowPos2d@16, WindowPos2dMESA, WindowPos2dMESA@16)
-	GL_STUB_ALIAS(WindowPos2dARB, 687, WindowPos2dARB@16, WindowPos2dMESA, WindowPos2dMESA@16)
-	GL_STUB_ALIAS(WindowPos2dv, 688, WindowPos2dv@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
-	GL_STUB_ALIAS(WindowPos2dvARB, 688, WindowPos2dvARB@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
-	GL_STUB_ALIAS(WindowPos2f, 689, WindowPos2f@8, WindowPos2fMESA, WindowPos2fMESA@8)
-	GL_STUB_ALIAS(WindowPos2fARB, 689, WindowPos2fARB@8, WindowPos2fMESA, WindowPos2fMESA@8)
-	GL_STUB_ALIAS(WindowPos2fv, 690, WindowPos2fv@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
-	GL_STUB_ALIAS(WindowPos2fvARB, 690, WindowPos2fvARB@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
-	GL_STUB_ALIAS(WindowPos2i, 691, WindowPos2i@8, WindowPos2iMESA, WindowPos2iMESA@8)
-	GL_STUB_ALIAS(WindowPos2iARB, 691, WindowPos2iARB@8, WindowPos2iMESA, WindowPos2iMESA@8)
-	GL_STUB_ALIAS(WindowPos2iv, 692, WindowPos2iv@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
-	GL_STUB_ALIAS(WindowPos2ivARB, 692, WindowPos2ivARB@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
-	GL_STUB_ALIAS(WindowPos2s, 693, WindowPos2s@8, WindowPos2sMESA, WindowPos2sMESA@8)
-	GL_STUB_ALIAS(WindowPos2sARB, 693, WindowPos2sARB@8, WindowPos2sMESA, WindowPos2sMESA@8)
-	GL_STUB_ALIAS(WindowPos2sv, 694, WindowPos2sv@4, WindowPos2svMESA, WindowPos2svMESA@4)
-	GL_STUB_ALIAS(WindowPos2svARB, 694, WindowPos2svARB@4, WindowPos2svMESA, WindowPos2svMESA@4)
-	GL_STUB_ALIAS(WindowPos3d, 695, WindowPos3d@24, WindowPos3dMESA, WindowPos3dMESA@24)
-	GL_STUB_ALIAS(WindowPos3dARB, 695, WindowPos3dARB@24, WindowPos3dMESA, WindowPos3dMESA@24)
-	GL_STUB_ALIAS(WindowPos3dv, 696, WindowPos3dv@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
-	GL_STUB_ALIAS(WindowPos3dvARB, 696, WindowPos3dvARB@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
-	GL_STUB_ALIAS(WindowPos3f, 697, WindowPos3f@12, WindowPos3fMESA, WindowPos3fMESA@12)
-	GL_STUB_ALIAS(WindowPos3fARB, 697, WindowPos3fARB@12, WindowPos3fMESA, WindowPos3fMESA@12)
-	GL_STUB_ALIAS(WindowPos3fv, 698, WindowPos3fv@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
-	GL_STUB_ALIAS(WindowPos3fvARB, 698, WindowPos3fvARB@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
-	GL_STUB_ALIAS(WindowPos3i, 699, WindowPos3i@12, WindowPos3iMESA, WindowPos3iMESA@12)
-	GL_STUB_ALIAS(WindowPos3iARB, 699, WindowPos3iARB@12, WindowPos3iMESA, WindowPos3iMESA@12)
-	GL_STUB_ALIAS(WindowPos3iv, 700, WindowPos3iv@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
-	GL_STUB_ALIAS(WindowPos3ivARB, 700, WindowPos3ivARB@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
-	GL_STUB_ALIAS(WindowPos3s, 701, WindowPos3s@12, WindowPos3sMESA, WindowPos3sMESA@12)
-	GL_STUB_ALIAS(WindowPos3sARB, 701, WindowPos3sARB@12, WindowPos3sMESA, WindowPos3sMESA@12)
-	GL_STUB_ALIAS(WindowPos3sv, 702, WindowPos3sv@4, WindowPos3svMESA, WindowPos3svMESA@4)
-	GL_STUB_ALIAS(WindowPos3svARB, 702, WindowPos3svARB@4, WindowPos3svMESA, WindowPos3svMESA@4)
-	GL_STUB_ALIAS(BindProgramARB, 721, BindProgramARB@8, BindProgramNV, BindProgramNV@8)
-	GL_STUB_ALIAS(DeleteProgramsARB, 722, DeleteProgramsARB@8, DeleteProgramsNV, DeleteProgramsNV@8)
-	GL_STUB_ALIAS(GenProgramsARB, 724, GenProgramsARB@8, GenProgramsNV, GenProgramsNV@8)
-	GL_STUB_ALIAS(GetVertexAttribPointerv, 730, GetVertexAttribPointerv@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
-	GL_STUB_ALIAS(GetVertexAttribPointervARB, 730, GetVertexAttribPointervARB@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
-	GL_STUB_ALIAS(IsProgramARB, 734, IsProgramARB@4, IsProgramNV, IsProgramNV@4)
-	GL_STUB_ALIAS(PointParameteri, 798, PointParameteri@8, PointParameteriNV, PointParameteriNV@8)
-	GL_STUB_ALIAS(PointParameteriv, 799, PointParameteriv@8, PointParameterivNV, PointParameterivNV@8)
-	GL_STUB_ALIAS(DeleteVertexArrays, 802, DeleteVertexArrays@8, _dispatch_stub_802, _dispatch_stub_802@8)
-	GL_STUB_ALIAS(IsVertexArray, 804, IsVertexArray@4, _dispatch_stub_804, _dispatch_stub_804@4)
-	GL_STUB_ALIAS(PrimitiveRestartIndex, 811, PrimitiveRestartIndex@4, PrimitiveRestartIndexNV, PrimitiveRestartIndexNV@4)
-	GL_STUB_ALIAS(BlendEquationSeparate, 814, BlendEquationSeparate@8, _dispatch_stub_814, _dispatch_stub_814@8)
-	GL_STUB_ALIAS(BindFramebuffer, 815, BindFramebuffer@8, BindFramebufferEXT, BindFramebufferEXT@8)
-	GL_STUB_ALIAS(BindRenderbuffer, 816, BindRenderbuffer@8, BindRenderbufferEXT, BindRenderbufferEXT@8)
-	GL_STUB_ALIAS(CheckFramebufferStatus, 817, CheckFramebufferStatus@4, CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4)
-	GL_STUB_ALIAS(DeleteFramebuffers, 818, DeleteFramebuffers@8, DeleteFramebuffersEXT, DeleteFramebuffersEXT@8)
-	GL_STUB_ALIAS(DeleteRenderbuffers, 819, DeleteRenderbuffers@8, DeleteRenderbuffersEXT, DeleteRenderbuffersEXT@8)
-	GL_STUB_ALIAS(FramebufferRenderbuffer, 820, FramebufferRenderbuffer@16, FramebufferRenderbufferEXT, FramebufferRenderbufferEXT@16)
-	GL_STUB_ALIAS(FramebufferTexture1D, 821, FramebufferTexture1D@20, FramebufferTexture1DEXT, FramebufferTexture1DEXT@20)
-	GL_STUB_ALIAS(FramebufferTexture2D, 822, FramebufferTexture2D@20, FramebufferTexture2DEXT, FramebufferTexture2DEXT@20)
-	GL_STUB_ALIAS(FramebufferTexture3D, 823, FramebufferTexture3D@24, FramebufferTexture3DEXT, FramebufferTexture3DEXT@24)
-	GL_STUB_ALIAS(GenFramebuffers, 824, GenFramebuffers@8, GenFramebuffersEXT, GenFramebuffersEXT@8)
-	GL_STUB_ALIAS(GenRenderbuffers, 825, GenRenderbuffers@8, GenRenderbuffersEXT, GenRenderbuffersEXT@8)
-	GL_STUB_ALIAS(GenerateMipmap, 826, GenerateMipmap@4, GenerateMipmapEXT, GenerateMipmapEXT@4)
-	GL_STUB_ALIAS(GetFramebufferAttachmentParameteriv, 827, GetFramebufferAttachmentParameteriv@16, GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameterivEXT@16)
-	GL_STUB_ALIAS(GetRenderbufferParameteriv, 828, GetRenderbufferParameteriv@12, GetRenderbufferParameterivEXT, GetRenderbufferParameterivEXT@12)
-	GL_STUB_ALIAS(IsFramebuffer, 829, IsFramebuffer@4, IsFramebufferEXT, IsFramebufferEXT@4)
-	GL_STUB_ALIAS(IsRenderbuffer, 830, IsRenderbuffer@4, IsRenderbufferEXT, IsRenderbufferEXT@4)
-	GL_STUB_ALIAS(RenderbufferStorage, 831, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16)
-	GL_STUB_ALIAS(BlitFramebuffer, 832, BlitFramebuffer@40, _dispatch_stub_832, _dispatch_stub_832@40)
-	GL_STUB_ALIAS(BindFragDataLocation, 835, BindFragDataLocation@12, BindFragDataLocationEXT, BindFragDataLocationEXT@12)
-	GL_STUB_ALIAS(GetFragDataLocation, 836, GetFragDataLocation@8, GetFragDataLocationEXT, GetFragDataLocationEXT@8)
-	GL_STUB_ALIAS(GetUniformuiv, 837, GetUniformuiv@12, GetUniformuivEXT, GetUniformuivEXT@12)
-	GL_STUB_ALIAS(GetVertexAttribIiv, 838, GetVertexAttribIiv@12, GetVertexAttribIivEXT, GetVertexAttribIivEXT@12)
-	GL_STUB_ALIAS(GetVertexAttribIuiv, 839, GetVertexAttribIuiv@12, GetVertexAttribIuivEXT, GetVertexAttribIuivEXT@12)
-	GL_STUB_ALIAS(Uniform1ui, 840, Uniform1ui@8, Uniform1uiEXT, Uniform1uiEXT@8)
-	GL_STUB_ALIAS(Uniform1uiv, 841, Uniform1uiv@12, Uniform1uivEXT, Uniform1uivEXT@12)
-	GL_STUB_ALIAS(Uniform2ui, 842, Uniform2ui@12, Uniform2uiEXT, Uniform2uiEXT@12)
-	GL_STUB_ALIAS(Uniform2uiv, 843, Uniform2uiv@12, Uniform2uivEXT, Uniform2uivEXT@12)
-	GL_STUB_ALIAS(Uniform3ui, 844, Uniform3ui@16, Uniform3uiEXT, Uniform3uiEXT@16)
-	GL_STUB_ALIAS(Uniform3uiv, 845, Uniform3uiv@12, Uniform3uivEXT, Uniform3uivEXT@12)
-	GL_STUB_ALIAS(Uniform4ui, 846, Uniform4ui@20, Uniform4uiEXT, Uniform4uiEXT@20)
-	GL_STUB_ALIAS(Uniform4uiv, 847, Uniform4uiv@12, Uniform4uivEXT, Uniform4uivEXT@12)
-	GL_STUB_ALIAS(VertexAttribI1i, 848, VertexAttribI1i@8, VertexAttribI1iEXT, VertexAttribI1iEXT@8)
-	GL_STUB_ALIAS(VertexAttribI1iv, 849, VertexAttribI1iv@8, VertexAttribI1ivEXT, VertexAttribI1ivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI1ui, 850, VertexAttribI1ui@8, VertexAttribI1uiEXT, VertexAttribI1uiEXT@8)
-	GL_STUB_ALIAS(VertexAttribI1uiv, 851, VertexAttribI1uiv@8, VertexAttribI1uivEXT, VertexAttribI1uivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI2i, 852, VertexAttribI2i@12, VertexAttribI2iEXT, VertexAttribI2iEXT@12)
-	GL_STUB_ALIAS(VertexAttribI2iv, 853, VertexAttribI2iv@8, VertexAttribI2ivEXT, VertexAttribI2ivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI2ui, 854, VertexAttribI2ui@12, VertexAttribI2uiEXT, VertexAttribI2uiEXT@12)
-	GL_STUB_ALIAS(VertexAttribI2uiv, 855, VertexAttribI2uiv@8, VertexAttribI2uivEXT, VertexAttribI2uivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI3i, 856, VertexAttribI3i@16, VertexAttribI3iEXT, VertexAttribI3iEXT@16)
-	GL_STUB_ALIAS(VertexAttribI3iv, 857, VertexAttribI3iv@8, VertexAttribI3ivEXT, VertexAttribI3ivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI3ui, 858, VertexAttribI3ui@16, VertexAttribI3uiEXT, VertexAttribI3uiEXT@16)
-	GL_STUB_ALIAS(VertexAttribI3uiv, 859, VertexAttribI3uiv@8, VertexAttribI3uivEXT, VertexAttribI3uivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI4bv, 860, VertexAttribI4bv@8, VertexAttribI4bvEXT, VertexAttribI4bvEXT@8)
-	GL_STUB_ALIAS(VertexAttribI4i, 861, VertexAttribI4i@20, VertexAttribI4iEXT, VertexAttribI4iEXT@20)
-	GL_STUB_ALIAS(VertexAttribI4iv, 862, VertexAttribI4iv@8, VertexAttribI4ivEXT, VertexAttribI4ivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI4sv, 863, VertexAttribI4sv@8, VertexAttribI4svEXT, VertexAttribI4svEXT@8)
-	GL_STUB_ALIAS(VertexAttribI4ubv, 864, VertexAttribI4ubv@8, VertexAttribI4ubvEXT, VertexAttribI4ubvEXT@8)
-	GL_STUB_ALIAS(VertexAttribI4ui, 865, VertexAttribI4ui@20, VertexAttribI4uiEXT, VertexAttribI4uiEXT@20)
-	GL_STUB_ALIAS(VertexAttribI4uiv, 866, VertexAttribI4uiv@8, VertexAttribI4uivEXT, VertexAttribI4uivEXT@8)
-	GL_STUB_ALIAS(VertexAttribI4usv, 867, VertexAttribI4usv@8, VertexAttribI4usvEXT, VertexAttribI4usvEXT@8)
-	GL_STUB_ALIAS(VertexAttribIPointer, 868, VertexAttribIPointer@20, VertexAttribIPointerEXT, VertexAttribIPointerEXT@20)
-	GL_STUB_ALIAS(FramebufferTextureLayer, 869, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20)
-	GL_STUB_ALIAS(ColorMaski, 870, ColorMaski@20, ColorMaskIndexedEXT, ColorMaskIndexedEXT@20)
-	GL_STUB_ALIAS(Disablei, 871, Disablei@8, DisableIndexedEXT, DisableIndexedEXT@8)
-	GL_STUB_ALIAS(Enablei, 872, Enablei@8, EnableIndexedEXT, EnableIndexedEXT@8)
-	GL_STUB_ALIAS(GetBooleani_v, 873, GetBooleani_v@12, GetBooleanIndexedvEXT, GetBooleanIndexedvEXT@12)
-	GL_STUB_ALIAS(GetIntegeri_v, 874, GetIntegeri_v@12, GetIntegerIndexedvEXT, GetIntegerIndexedvEXT@12)
-	GL_STUB_ALIAS(IsEnabledi, 875, IsEnabledi@8, IsEnabledIndexedEXT, IsEnabledIndexedEXT@8)
-	GL_STUB_ALIAS(GetTexParameterIiv, 878, GetTexParameterIiv@12, GetTexParameterIivEXT, GetTexParameterIivEXT@12)
-	GL_STUB_ALIAS(GetTexParameterIuiv, 879, GetTexParameterIuiv@12, GetTexParameterIuivEXT, GetTexParameterIuivEXT@12)
-	GL_STUB_ALIAS(TexParameterIiv, 880, TexParameterIiv@12, TexParameterIivEXT, TexParameterIivEXT@12)
-	GL_STUB_ALIAS(TexParameterIuiv, 881, TexParameterIuiv@12, TexParameterIuivEXT, TexParameterIuivEXT@12)
-	GL_STUB_ALIAS(BeginConditionalRender, 882, BeginConditionalRender@8, BeginConditionalRenderNV, BeginConditionalRenderNV@8)
-	GL_STUB_ALIAS(EndConditionalRender, 883, EndConditionalRender@0, EndConditionalRenderNV, EndConditionalRenderNV@0)
-	GL_STUB_ALIAS(BeginTransformFeedback, 884, BeginTransformFeedback@4, BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4)
-	GL_STUB_ALIAS(BindBufferBase, 885, BindBufferBase@12, BindBufferBaseEXT, BindBufferBaseEXT@12)
-	GL_STUB_ALIAS(BindBufferRange, 887, BindBufferRange@20, BindBufferRangeEXT, BindBufferRangeEXT@20)
-	GL_STUB_ALIAS(EndTransformFeedback, 888, EndTransformFeedback@0, EndTransformFeedbackEXT, EndTransformFeedbackEXT@0)
-	GL_STUB_ALIAS(GetTransformFeedbackVarying, 889, GetTransformFeedbackVarying@28, GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28)
-	GL_STUB_ALIAS(TransformFeedbackVaryings, 890, TransformFeedbackVaryings@16, TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16)
-	GL_STUB_ALIAS(ProvokingVertex, 891, ProvokingVertex@4, ProvokingVertexEXT, ProvokingVertexEXT@4)
+	GL_STUB_ALIAS(PointParameterf, 661, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8)
+	GL_STUB_ALIAS(PointParameterfARB, 661, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8)
+	GL_STUB_ALIAS(PointParameterfv, 662, PointParameterfv@8, PointParameterfvEXT, PointParameterfvEXT@8)
+	GL_STUB_ALIAS(PointParameterfvARB, 662, PointParameterfvARB@8, PointParameterfvEXT, PointParameterfvEXT@8)
+	GL_STUB_ALIAS(SecondaryColor3b, 665, SecondaryColor3b@12, SecondaryColor3bEXT, SecondaryColor3bEXT@12)
+	GL_STUB_ALIAS(SecondaryColor3bv, 666, SecondaryColor3bv@4, SecondaryColor3bvEXT, SecondaryColor3bvEXT@4)
+	GL_STUB_ALIAS(SecondaryColor3d, 667, SecondaryColor3d@24, SecondaryColor3dEXT, SecondaryColor3dEXT@24)
+	GL_STUB_ALIAS(SecondaryColor3dv, 668, SecondaryColor3dv@4, SecondaryColor3dvEXT, SecondaryColor3dvEXT@4)
+	GL_STUB_ALIAS(SecondaryColor3f, 669, SecondaryColor3f@12, SecondaryColor3fEXT, SecondaryColor3fEXT@12)
+	GL_STUB_ALIAS(SecondaryColor3fv, 670, SecondaryColor3fv@4, SecondaryColor3fvEXT, SecondaryColor3fvEXT@4)
+	GL_STUB_ALIAS(SecondaryColor3i, 671, SecondaryColor3i@12, SecondaryColor3iEXT, SecondaryColor3iEXT@12)
+	GL_STUB_ALIAS(SecondaryColor3iv, 672, SecondaryColor3iv@4, SecondaryColor3ivEXT, SecondaryColor3ivEXT@4)
+	GL_STUB_ALIAS(SecondaryColor3s, 673, SecondaryColor3s@12, SecondaryColor3sEXT, SecondaryColor3sEXT@12)
+	GL_STUB_ALIAS(SecondaryColor3sv, 674, SecondaryColor3sv@4, SecondaryColor3svEXT, SecondaryColor3svEXT@4)
+	GL_STUB_ALIAS(SecondaryColor3ub, 675, SecondaryColor3ub@12, SecondaryColor3ubEXT, SecondaryColor3ubEXT@12)
+	GL_STUB_ALIAS(SecondaryColor3ubv, 676, SecondaryColor3ubv@4, SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4)
+	GL_STUB_ALIAS(SecondaryColor3ui, 677, SecondaryColor3ui@12, SecondaryColor3uiEXT, SecondaryColor3uiEXT@12)
+	GL_STUB_ALIAS(SecondaryColor3uiv, 678, SecondaryColor3uiv@4, SecondaryColor3uivEXT, SecondaryColor3uivEXT@4)
+	GL_STUB_ALIAS(SecondaryColor3us, 679, SecondaryColor3us@12, SecondaryColor3usEXT, SecondaryColor3usEXT@12)
+	GL_STUB_ALIAS(SecondaryColor3usv, 680, SecondaryColor3usv@4, SecondaryColor3usvEXT, SecondaryColor3usvEXT@4)
+	GL_STUB_ALIAS(SecondaryColorPointer, 681, SecondaryColorPointer@16, SecondaryColorPointerEXT, SecondaryColorPointerEXT@16)
+	GL_STUB_ALIAS(MultiDrawArrays, 682, MultiDrawArrays@16, MultiDrawArraysEXT, MultiDrawArraysEXT@16)
+	GL_STUB_ALIAS(MultiDrawElements, 683, MultiDrawElements@20, MultiDrawElementsEXT, MultiDrawElementsEXT@20)
+	GL_STUB_ALIAS(FogCoordPointer, 684, FogCoordPointer@12, FogCoordPointerEXT, FogCoordPointerEXT@12)
+	GL_STUB_ALIAS(FogCoordd, 685, FogCoordd@8, FogCoorddEXT, FogCoorddEXT@8)
+	GL_STUB_ALIAS(FogCoorddv, 686, FogCoorddv@4, FogCoorddvEXT, FogCoorddvEXT@4)
+	GL_STUB_ALIAS(FogCoordf, 687, FogCoordf@4, FogCoordfEXT, FogCoordfEXT@4)
+	GL_STUB_ALIAS(FogCoordfv, 688, FogCoordfv@4, FogCoordfvEXT, FogCoordfvEXT@4)
+	GL_STUB_ALIAS(BlendFuncSeparate, 690, BlendFuncSeparate@16, BlendFuncSeparateEXT, BlendFuncSeparateEXT@16)
+	GL_STUB_ALIAS(WindowPos2d, 707, WindowPos2d@16, WindowPos2dMESA, WindowPos2dMESA@16)
+	GL_STUB_ALIAS(WindowPos2dARB, 707, WindowPos2dARB@16, WindowPos2dMESA, WindowPos2dMESA@16)
+	GL_STUB_ALIAS(WindowPos2dv, 708, WindowPos2dv@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
+	GL_STUB_ALIAS(WindowPos2dvARB, 708, WindowPos2dvARB@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
+	GL_STUB_ALIAS(WindowPos2f, 709, WindowPos2f@8, WindowPos2fMESA, WindowPos2fMESA@8)
+	GL_STUB_ALIAS(WindowPos2fARB, 709, WindowPos2fARB@8, WindowPos2fMESA, WindowPos2fMESA@8)
+	GL_STUB_ALIAS(WindowPos2fv, 710, WindowPos2fv@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
+	GL_STUB_ALIAS(WindowPos2fvARB, 710, WindowPos2fvARB@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
+	GL_STUB_ALIAS(WindowPos2i, 711, WindowPos2i@8, WindowPos2iMESA, WindowPos2iMESA@8)
+	GL_STUB_ALIAS(WindowPos2iARB, 711, WindowPos2iARB@8, WindowPos2iMESA, WindowPos2iMESA@8)
+	GL_STUB_ALIAS(WindowPos2iv, 712, WindowPos2iv@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
+	GL_STUB_ALIAS(WindowPos2ivARB, 712, WindowPos2ivARB@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
+	GL_STUB_ALIAS(WindowPos2s, 713, WindowPos2s@8, WindowPos2sMESA, WindowPos2sMESA@8)
+	GL_STUB_ALIAS(WindowPos2sARB, 713, WindowPos2sARB@8, WindowPos2sMESA, WindowPos2sMESA@8)
+	GL_STUB_ALIAS(WindowPos2sv, 714, WindowPos2sv@4, WindowPos2svMESA, WindowPos2svMESA@4)
+	GL_STUB_ALIAS(WindowPos2svARB, 714, WindowPos2svARB@4, WindowPos2svMESA, WindowPos2svMESA@4)
+	GL_STUB_ALIAS(WindowPos3d, 715, WindowPos3d@24, WindowPos3dMESA, WindowPos3dMESA@24)
+	GL_STUB_ALIAS(WindowPos3dARB, 715, WindowPos3dARB@24, WindowPos3dMESA, WindowPos3dMESA@24)
+	GL_STUB_ALIAS(WindowPos3dv, 716, WindowPos3dv@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
+	GL_STUB_ALIAS(WindowPos3dvARB, 716, WindowPos3dvARB@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
+	GL_STUB_ALIAS(WindowPos3f, 717, WindowPos3f@12, WindowPos3fMESA, WindowPos3fMESA@12)
+	GL_STUB_ALIAS(WindowPos3fARB, 717, WindowPos3fARB@12, WindowPos3fMESA, WindowPos3fMESA@12)
+	GL_STUB_ALIAS(WindowPos3fv, 718, WindowPos3fv@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
+	GL_STUB_ALIAS(WindowPos3fvARB, 718, WindowPos3fvARB@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
+	GL_STUB_ALIAS(WindowPos3i, 719, WindowPos3i@12, WindowPos3iMESA, WindowPos3iMESA@12)
+	GL_STUB_ALIAS(WindowPos3iARB, 719, WindowPos3iARB@12, WindowPos3iMESA, WindowPos3iMESA@12)
+	GL_STUB_ALIAS(WindowPos3iv, 720, WindowPos3iv@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
+	GL_STUB_ALIAS(WindowPos3ivARB, 720, WindowPos3ivARB@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
+	GL_STUB_ALIAS(WindowPos3s, 721, WindowPos3s@12, WindowPos3sMESA, WindowPos3sMESA@12)
+	GL_STUB_ALIAS(WindowPos3sARB, 721, WindowPos3sARB@12, WindowPos3sMESA, WindowPos3sMESA@12)
+	GL_STUB_ALIAS(WindowPos3sv, 722, WindowPos3sv@4, WindowPos3svMESA, WindowPos3svMESA@4)
+	GL_STUB_ALIAS(WindowPos3svARB, 722, WindowPos3svARB@4, WindowPos3svMESA, WindowPos3svMESA@4)
+	GL_STUB_ALIAS(BindProgramARB, 741, BindProgramARB@8, BindProgramNV, BindProgramNV@8)
+	GL_STUB_ALIAS(DeleteProgramsARB, 742, DeleteProgramsARB@8, DeleteProgramsNV, DeleteProgramsNV@8)
+	GL_STUB_ALIAS(GenProgramsARB, 744, GenProgramsARB@8, GenProgramsNV, GenProgramsNV@8)
+	GL_STUB_ALIAS(GetVertexAttribPointerv, 750, GetVertexAttribPointerv@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
+	GL_STUB_ALIAS(GetVertexAttribPointervARB, 750, GetVertexAttribPointervARB@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
+	GL_STUB_ALIAS(IsProgramARB, 754, IsProgramARB@4, IsProgramNV, IsProgramNV@4)
+	GL_STUB_ALIAS(PointParameteri, 818, PointParameteri@8, PointParameteriNV, PointParameteriNV@8)
+	GL_STUB_ALIAS(PointParameteriv, 819, PointParameteriv@8, PointParameterivNV, PointParameterivNV@8)
+	GL_STUB_ALIAS(DeleteVertexArrays, 822, DeleteVertexArrays@8, _dispatch_stub_822, _dispatch_stub_822@8)
+	GL_STUB_ALIAS(IsVertexArray, 824, IsVertexArray@4, _dispatch_stub_824, _dispatch_stub_824@4)
+	GL_STUB_ALIAS(PrimitiveRestartIndex, 831, PrimitiveRestartIndex@4, PrimitiveRestartIndexNV, PrimitiveRestartIndexNV@4)
+	GL_STUB_ALIAS(BlendEquationSeparate, 834, BlendEquationSeparate@8, _dispatch_stub_834, _dispatch_stub_834@8)
+	GL_STUB_ALIAS(BindFramebuffer, 835, BindFramebuffer@8, BindFramebufferEXT, BindFramebufferEXT@8)
+	GL_STUB_ALIAS(BindRenderbuffer, 836, BindRenderbuffer@8, BindRenderbufferEXT, BindRenderbufferEXT@8)
+	GL_STUB_ALIAS(CheckFramebufferStatus, 837, CheckFramebufferStatus@4, CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4)
+	GL_STUB_ALIAS(DeleteFramebuffers, 838, DeleteFramebuffers@8, DeleteFramebuffersEXT, DeleteFramebuffersEXT@8)
+	GL_STUB_ALIAS(DeleteRenderbuffers, 839, DeleteRenderbuffers@8, DeleteRenderbuffersEXT, DeleteRenderbuffersEXT@8)
+	GL_STUB_ALIAS(FramebufferRenderbuffer, 840, FramebufferRenderbuffer@16, FramebufferRenderbufferEXT, FramebufferRenderbufferEXT@16)
+	GL_STUB_ALIAS(FramebufferTexture1D, 841, FramebufferTexture1D@20, FramebufferTexture1DEXT, FramebufferTexture1DEXT@20)
+	GL_STUB_ALIAS(FramebufferTexture2D, 842, FramebufferTexture2D@20, FramebufferTexture2DEXT, FramebufferTexture2DEXT@20)
+	GL_STUB_ALIAS(FramebufferTexture3D, 843, FramebufferTexture3D@24, FramebufferTexture3DEXT, FramebufferTexture3DEXT@24)
+	GL_STUB_ALIAS(GenFramebuffers, 844, GenFramebuffers@8, GenFramebuffersEXT, GenFramebuffersEXT@8)
+	GL_STUB_ALIAS(GenRenderbuffers, 845, GenRenderbuffers@8, GenRenderbuffersEXT, GenRenderbuffersEXT@8)
+	GL_STUB_ALIAS(GenerateMipmap, 846, GenerateMipmap@4, GenerateMipmapEXT, GenerateMipmapEXT@4)
+	GL_STUB_ALIAS(GetFramebufferAttachmentParameteriv, 847, GetFramebufferAttachmentParameteriv@16, GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameterivEXT@16)
+	GL_STUB_ALIAS(GetRenderbufferParameteriv, 848, GetRenderbufferParameteriv@12, GetRenderbufferParameterivEXT, GetRenderbufferParameterivEXT@12)
+	GL_STUB_ALIAS(IsFramebuffer, 849, IsFramebuffer@4, IsFramebufferEXT, IsFramebufferEXT@4)
+	GL_STUB_ALIAS(IsRenderbuffer, 850, IsRenderbuffer@4, IsRenderbufferEXT, IsRenderbufferEXT@4)
+	GL_STUB_ALIAS(RenderbufferStorage, 851, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16)
+	GL_STUB_ALIAS(BlitFramebuffer, 852, BlitFramebuffer@40, _dispatch_stub_852, _dispatch_stub_852@40)
+	GL_STUB_ALIAS(BindFragDataLocation, 855, BindFragDataLocation@12, BindFragDataLocationEXT, BindFragDataLocationEXT@12)
+	GL_STUB_ALIAS(GetFragDataLocation, 856, GetFragDataLocation@8, GetFragDataLocationEXT, GetFragDataLocationEXT@8)
+	GL_STUB_ALIAS(GetUniformuiv, 857, GetUniformuiv@12, GetUniformuivEXT, GetUniformuivEXT@12)
+	GL_STUB_ALIAS(GetVertexAttribIiv, 858, GetVertexAttribIiv@12, GetVertexAttribIivEXT, GetVertexAttribIivEXT@12)
+	GL_STUB_ALIAS(GetVertexAttribIuiv, 859, GetVertexAttribIuiv@12, GetVertexAttribIuivEXT, GetVertexAttribIuivEXT@12)
+	GL_STUB_ALIAS(Uniform1ui, 860, Uniform1ui@8, Uniform1uiEXT, Uniform1uiEXT@8)
+	GL_STUB_ALIAS(Uniform1uiv, 861, Uniform1uiv@12, Uniform1uivEXT, Uniform1uivEXT@12)
+	GL_STUB_ALIAS(Uniform2ui, 862, Uniform2ui@12, Uniform2uiEXT, Uniform2uiEXT@12)
+	GL_STUB_ALIAS(Uniform2uiv, 863, Uniform2uiv@12, Uniform2uivEXT, Uniform2uivEXT@12)
+	GL_STUB_ALIAS(Uniform3ui, 864, Uniform3ui@16, Uniform3uiEXT, Uniform3uiEXT@16)
+	GL_STUB_ALIAS(Uniform3uiv, 865, Uniform3uiv@12, Uniform3uivEXT, Uniform3uivEXT@12)
+	GL_STUB_ALIAS(Uniform4ui, 866, Uniform4ui@20, Uniform4uiEXT, Uniform4uiEXT@20)
+	GL_STUB_ALIAS(Uniform4uiv, 867, Uniform4uiv@12, Uniform4uivEXT, Uniform4uivEXT@12)
+	GL_STUB_ALIAS(VertexAttribI1i, 868, VertexAttribI1i@8, VertexAttribI1iEXT, VertexAttribI1iEXT@8)
+	GL_STUB_ALIAS(VertexAttribI1iv, 869, VertexAttribI1iv@8, VertexAttribI1ivEXT, VertexAttribI1ivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI1ui, 870, VertexAttribI1ui@8, VertexAttribI1uiEXT, VertexAttribI1uiEXT@8)
+	GL_STUB_ALIAS(VertexAttribI1uiv, 871, VertexAttribI1uiv@8, VertexAttribI1uivEXT, VertexAttribI1uivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI2i, 872, VertexAttribI2i@12, VertexAttribI2iEXT, VertexAttribI2iEXT@12)
+	GL_STUB_ALIAS(VertexAttribI2iv, 873, VertexAttribI2iv@8, VertexAttribI2ivEXT, VertexAttribI2ivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI2ui, 874, VertexAttribI2ui@12, VertexAttribI2uiEXT, VertexAttribI2uiEXT@12)
+	GL_STUB_ALIAS(VertexAttribI2uiv, 875, VertexAttribI2uiv@8, VertexAttribI2uivEXT, VertexAttribI2uivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI3i, 876, VertexAttribI3i@16, VertexAttribI3iEXT, VertexAttribI3iEXT@16)
+	GL_STUB_ALIAS(VertexAttribI3iv, 877, VertexAttribI3iv@8, VertexAttribI3ivEXT, VertexAttribI3ivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI3ui, 878, VertexAttribI3ui@16, VertexAttribI3uiEXT, VertexAttribI3uiEXT@16)
+	GL_STUB_ALIAS(VertexAttribI3uiv, 879, VertexAttribI3uiv@8, VertexAttribI3uivEXT, VertexAttribI3uivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI4bv, 880, VertexAttribI4bv@8, VertexAttribI4bvEXT, VertexAttribI4bvEXT@8)
+	GL_STUB_ALIAS(VertexAttribI4i, 881, VertexAttribI4i@20, VertexAttribI4iEXT, VertexAttribI4iEXT@20)
+	GL_STUB_ALIAS(VertexAttribI4iv, 882, VertexAttribI4iv@8, VertexAttribI4ivEXT, VertexAttribI4ivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI4sv, 883, VertexAttribI4sv@8, VertexAttribI4svEXT, VertexAttribI4svEXT@8)
+	GL_STUB_ALIAS(VertexAttribI4ubv, 884, VertexAttribI4ubv@8, VertexAttribI4ubvEXT, VertexAttribI4ubvEXT@8)
+	GL_STUB_ALIAS(VertexAttribI4ui, 885, VertexAttribI4ui@20, VertexAttribI4uiEXT, VertexAttribI4uiEXT@20)
+	GL_STUB_ALIAS(VertexAttribI4uiv, 886, VertexAttribI4uiv@8, VertexAttribI4uivEXT, VertexAttribI4uivEXT@8)
+	GL_STUB_ALIAS(VertexAttribI4usv, 887, VertexAttribI4usv@8, VertexAttribI4usvEXT, VertexAttribI4usvEXT@8)
+	GL_STUB_ALIAS(VertexAttribIPointer, 888, VertexAttribIPointer@20, VertexAttribIPointerEXT, VertexAttribIPointerEXT@20)
+	GL_STUB_ALIAS(FramebufferTextureLayer, 889, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20)
+	GL_STUB_ALIAS(ColorMaski, 890, ColorMaski@20, ColorMaskIndexedEXT, ColorMaskIndexedEXT@20)
+	GL_STUB_ALIAS(Disablei, 891, Disablei@8, DisableIndexedEXT, DisableIndexedEXT@8)
+	GL_STUB_ALIAS(Enablei, 892, Enablei@8, EnableIndexedEXT, EnableIndexedEXT@8)
+	GL_STUB_ALIAS(GetBooleani_v, 893, GetBooleani_v@12, GetBooleanIndexedvEXT, GetBooleanIndexedvEXT@12)
+	GL_STUB_ALIAS(GetIntegeri_v, 894, GetIntegeri_v@12, GetIntegerIndexedvEXT, GetIntegerIndexedvEXT@12)
+	GL_STUB_ALIAS(IsEnabledi, 895, IsEnabledi@8, IsEnabledIndexedEXT, IsEnabledIndexedEXT@8)
+	GL_STUB_ALIAS(GetTexParameterIiv, 898, GetTexParameterIiv@12, GetTexParameterIivEXT, GetTexParameterIivEXT@12)
+	GL_STUB_ALIAS(GetTexParameterIuiv, 899, GetTexParameterIuiv@12, GetTexParameterIuivEXT, GetTexParameterIuivEXT@12)
+	GL_STUB_ALIAS(TexParameterIiv, 900, TexParameterIiv@12, TexParameterIivEXT, TexParameterIivEXT@12)
+	GL_STUB_ALIAS(TexParameterIuiv, 901, TexParameterIuiv@12, TexParameterIuivEXT, TexParameterIuivEXT@12)
+	GL_STUB_ALIAS(BeginConditionalRender, 902, BeginConditionalRender@8, BeginConditionalRenderNV, BeginConditionalRenderNV@8)
+	GL_STUB_ALIAS(EndConditionalRender, 903, EndConditionalRender@0, EndConditionalRenderNV, EndConditionalRenderNV@0)
+	GL_STUB_ALIAS(BeginTransformFeedback, 904, BeginTransformFeedback@4, BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4)
+	GL_STUB_ALIAS(BindBufferBase, 905, BindBufferBase@12, BindBufferBaseEXT, BindBufferBaseEXT@12)
+	GL_STUB_ALIAS(BindBufferRange, 907, BindBufferRange@20, BindBufferRangeEXT, BindBufferRangeEXT@20)
+	GL_STUB_ALIAS(EndTransformFeedback, 908, EndTransformFeedback@0, EndTransformFeedbackEXT, EndTransformFeedbackEXT@0)
+	GL_STUB_ALIAS(GetTransformFeedbackVarying, 909, GetTransformFeedbackVarying@28, GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28)
+	GL_STUB_ALIAS(TransformFeedbackVaryings, 910, TransformFeedbackVaryings@16, TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16)
+	GL_STUB_ALIAS(ProvokingVertex, 911, ProvokingVertex@4, ProvokingVertexEXT, ProvokingVertexEXT@4)
 
 		GLOBL	GLNAME(gl_dispatch_functions_end)
 		HIDDEN(GLNAME(gl_dispatch_functions_end))
diff --git a/mesalib/src/mapi/glapi/glapitable.h b/mesalib/src/mapi/glapi/glapitable.h
index 5b7aeee67..da278c559 100644
--- a/mesalib/src/mapi/glapi/glapitable.h
+++ b/mesalib/src/mapi/glapi/glapitable.h
@@ -666,288 +666,308 @@ struct _glapi_table
    void (GLAPIENTRYP GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); /* 623 */
    void (GLAPIENTRYP ReleaseShaderCompiler)(void); /* 624 */
    void (GLAPIENTRYP ShaderBinary)(GLsizei n, const GLuint * shaders, GLenum binaryformat, const GLvoid * binary, GLsizei length); /* 625 */
-   void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 626 */
-   void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 627 */
-   void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 628 */
-   void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 629 */
-   void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 630 */
-   void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 631 */
-   void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 632 */
-   void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 633 */
-   void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 634 */
-   void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 635 */
-   void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 636 */
-   void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 637 */
-   void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 638 */
-   void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 639 */
-   void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 640 */
-   void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 641 */
-   void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 642 */
-   void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 643 */
-   void (GLAPIENTRYP UnlockArraysEXT)(void); /* 644 */
-   void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 645 */
-   void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 646 */
-   void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 647 */
-   void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 648 */
-   void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 649 */
-   void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 650 */
-   void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 651 */
-   void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 652 */
-   void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 653 */
-   void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 654 */
-   void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 655 */
-   void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 656 */
-   void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 657 */
-   void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 658 */
-   void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 659 */
-   void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 660 */
-   void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 661 */
-   void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 662 */
-   void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 663 */
-   void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 664 */
-   void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 665 */
-   void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 666 */
-   void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 667 */
-   void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 668 */
-   void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 669 */
-   void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 670 */
-   void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 671 */
-   void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 672 */
-   void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 673 */
-   void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 674 */
-   void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 675 */
-   void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 676 */
-   void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 677 */
-   void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 678 */
-   void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 679 */
-   void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 680 */
-   void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 681 */
-   void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 682 */
-   void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 683 */
-   void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 684 */
-   void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 685 */
-   void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 686 */
-   void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 687 */
-   void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 688 */
-   void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 689 */
-   void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 690 */
-   void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 691 */
-   void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 692 */
-   void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 693 */
-   void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 694 */
-   void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 695 */
-   void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 696 */
-   void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 697 */
-   void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 698 */
-   void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 699 */
-   void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 700 */
-   void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 701 */
-   void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 702 */
-   void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 703 */
-   void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 704 */
-   void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 705 */
-   void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 706 */
-   void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 707 */
-   void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 708 */
-   void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 709 */
-   void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 710 */
-   void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 711 */
-   void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 712 */
-   void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 713 */
-   void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 714 */
-   void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 715 */
-   void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 716 */
-   GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 717 */
-   void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 718 */
-   GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 719 */
-   GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 720 */
-   void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 721 */
-   void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 722 */
-   void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 723 */
-   void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 724 */
-   void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 725 */
-   void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 726 */
-   void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 727 */
-   void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 728 */
-   void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 729 */
-   void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 730 */
-   void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 731 */
-   void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 732 */
-   void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 733 */
-   GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 734 */
-   void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 735 */
-   void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble * params); /* 736 */
-   void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat * params); /* 737 */
-   void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 738 */
-   void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 739 */
-   void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 740 */
-   void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 741 */
-   void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 742 */
-   void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 743 */
-   void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 744 */
-   void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 745 */
-   void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 746 */
-   void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 747 */
-   void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 748 */
-   void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 749 */
-   void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 750 */
-   void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 751 */
-   void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 752 */
-   void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 753 */
-   void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 754 */
-   void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 755 */
-   void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 756 */
-   void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 757 */
-   void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 758 */
-   void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 759 */
-   void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 760 */
-   void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 761 */
-   void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 762 */
-   void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 763 */
-   void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 764 */
-   void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 765 */
-   void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 766 */
-   void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 767 */
-   void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 768 */
-   void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 769 */
-   void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 770 */
-   void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 771 */
-   void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 772 */
-   void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 773 */
-   void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 774 */
-   void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 775 */
-   void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 776 */
-   void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 777 */
-   void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 778 */
-   void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 779 */
-   void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 780 */
-   void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 781 */
-   void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 782 */
-   void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 783 */
-   void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 784 */
-   void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 785 */
-   void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 786 */
-   void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 787 */
-   void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 788 */
-   void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 789 */
-   void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 790 */
-   void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 791 */
-   void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 792 */
-   void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 793 */
-   GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 794 */
-   void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 795 */
-   void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 796 */
-   void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 797 */
-   void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 798 */
-   void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 799 */
-   void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 800 */
-   void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 801 */
-   void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 802 */
-   void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 803 */
-   GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 804 */
-   void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 805 */
-   void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 806 */
-   void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 807 */
-   void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 808 */
-   void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 809 */
-   void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 810 */
-   void (GLAPIENTRYP PrimitiveRestartIndexNV)(GLuint index); /* 811 */
-   void (GLAPIENTRYP PrimitiveRestartNV)(void); /* 812 */
-   void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 813 */
-   void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 814 */
-   void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 815 */
-   void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 816 */
-   GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 817 */
-   void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 818 */
-   void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 819 */
-   void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 820 */
-   void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 821 */
-   void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 822 */
-   void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 823 */
-   void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 824 */
-   void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 825 */
-   void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 826 */
-   void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 827 */
-   void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 828 */
-   GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 829 */
-   GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 830 */
-   void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 831 */
-   void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 832 */
-   void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 833 */
-   void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 834 */
-   void (GLAPIENTRYP BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar * name); /* 835 */
-   GLint (GLAPIENTRYP GetFragDataLocationEXT)(GLuint program, const GLchar * name); /* 836 */
-   void (GLAPIENTRYP GetUniformuivEXT)(GLuint program, GLint location, GLuint * params); /* 837 */
-   void (GLAPIENTRYP GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint * params); /* 838 */
-   void (GLAPIENTRYP GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint * params); /* 839 */
-   void (GLAPIENTRYP Uniform1uiEXT)(GLint location, GLuint x); /* 840 */
-   void (GLAPIENTRYP Uniform1uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 841 */
-   void (GLAPIENTRYP Uniform2uiEXT)(GLint location, GLuint x, GLuint y); /* 842 */
-   void (GLAPIENTRYP Uniform2uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 843 */
-   void (GLAPIENTRYP Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z); /* 844 */
-   void (GLAPIENTRYP Uniform3uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 845 */
-   void (GLAPIENTRYP Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); /* 846 */
-   void (GLAPIENTRYP Uniform4uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 847 */
-   void (GLAPIENTRYP VertexAttribI1iEXT)(GLuint index, GLint x); /* 848 */
-   void (GLAPIENTRYP VertexAttribI1ivEXT)(GLuint index, const GLint * v); /* 849 */
-   void (GLAPIENTRYP VertexAttribI1uiEXT)(GLuint index, GLuint x); /* 850 */
-   void (GLAPIENTRYP VertexAttribI1uivEXT)(GLuint index, const GLuint * v); /* 851 */
-   void (GLAPIENTRYP VertexAttribI2iEXT)(GLuint index, GLint x, GLint y); /* 852 */
-   void (GLAPIENTRYP VertexAttribI2ivEXT)(GLuint index, const GLint * v); /* 853 */
-   void (GLAPIENTRYP VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y); /* 854 */
-   void (GLAPIENTRYP VertexAttribI2uivEXT)(GLuint index, const GLuint * v); /* 855 */
-   void (GLAPIENTRYP VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z); /* 856 */
-   void (GLAPIENTRYP VertexAttribI3ivEXT)(GLuint index, const GLint * v); /* 857 */
-   void (GLAPIENTRYP VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z); /* 858 */
-   void (GLAPIENTRYP VertexAttribI3uivEXT)(GLuint index, const GLuint * v); /* 859 */
-   void (GLAPIENTRYP VertexAttribI4bvEXT)(GLuint index, const GLbyte * v); /* 860 */
-   void (GLAPIENTRYP VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w); /* 861 */
-   void (GLAPIENTRYP VertexAttribI4ivEXT)(GLuint index, const GLint * v); /* 862 */
-   void (GLAPIENTRYP VertexAttribI4svEXT)(GLuint index, const GLshort * v); /* 863 */
-   void (GLAPIENTRYP VertexAttribI4ubvEXT)(GLuint index, const GLubyte * v); /* 864 */
-   void (GLAPIENTRYP VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); /* 865 */
-   void (GLAPIENTRYP VertexAttribI4uivEXT)(GLuint index, const GLuint * v); /* 866 */
-   void (GLAPIENTRYP VertexAttribI4usvEXT)(GLuint index, const GLushort * v); /* 867 */
-   void (GLAPIENTRYP VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 868 */
-   void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 869 */
-   void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 870 */
-   void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 871 */
-   void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 872 */
-   void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 873 */
-   void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 874 */
-   GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 875 */
-   void (GLAPIENTRYP ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a); /* 876 */
-   void (GLAPIENTRYP ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a); /* 877 */
-   void (GLAPIENTRYP GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint * params); /* 878 */
-   void (GLAPIENTRYP GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint * params); /* 879 */
-   void (GLAPIENTRYP TexParameterIivEXT)(GLenum target, GLenum pname, const GLint * params); /* 880 */
-   void (GLAPIENTRYP TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint * params); /* 881 */
-   void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 882 */
-   void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 883 */
-   void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 884 */
-   void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 885 */
-   void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 886 */
-   void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 887 */
-   void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 888 */
-   void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 889 */
-   void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 890 */
-   void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 891 */
-   void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 892 */
-   void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 893 */
-   void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 894 */
-   GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 895 */
-   GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 896 */
-   void (GLAPIENTRYP ActiveProgramEXT)(GLuint program); /* 897 */
-   GLuint (GLAPIENTRYP CreateShaderProgramEXT)(GLenum type, const GLchar * string); /* 898 */
-   void (GLAPIENTRYP UseShaderProgramEXT)(GLenum type, GLuint program); /* 899 */
-   void (GLAPIENTRYP TextureBarrierNV)(void); /* 900 */
-   void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 901 */
-   void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 902 */
-   void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 903 */
-   void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 904 */
-   void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 905 */
-   void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 906 */
-   void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 907 */
+   GLenum (GLAPIENTRYP GetGraphicsResetStatusARB)(void); /* 626 */
+   void (GLAPIENTRYP GetnColorTableARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * table); /* 627 */
+   void (GLAPIENTRYP GetnCompressedTexImageARB)(GLenum target, GLint lod, GLsizei bufSize, GLvoid * img); /* 628 */
+   void (GLAPIENTRYP GetnConvolutionFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * image); /* 629 */
+   void (GLAPIENTRYP GetnHistogramARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values); /* 630 */
+   void (GLAPIENTRYP GetnMapdvARB)(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v); /* 631 */
+   void (GLAPIENTRYP GetnMapfvARB)(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v); /* 632 */
+   void (GLAPIENTRYP GetnMapivARB)(GLenum target, GLenum query, GLsizei bufSize, GLint * v); /* 633 */
+   void (GLAPIENTRYP GetnMinmaxARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values); /* 634 */
+   void (GLAPIENTRYP GetnPixelMapfvARB)(GLenum map, GLsizei bufSize, GLfloat * values); /* 635 */
+   void (GLAPIENTRYP GetnPixelMapuivARB)(GLenum map, GLsizei bufSize, GLuint * values); /* 636 */
+   void (GLAPIENTRYP GetnPixelMapusvARB)(GLenum map, GLsizei bufSize, GLushort * values); /* 637 */
+   void (GLAPIENTRYP GetnPolygonStippleARB)(GLsizei bufSize, GLubyte * pattern); /* 638 */
+   void (GLAPIENTRYP GetnSeparableFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid * row, GLsizei columnBufSize, GLvoid * column, GLvoid * span); /* 639 */
+   void (GLAPIENTRYP GetnTexImageARB)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid * img); /* 640 */
+   void (GLAPIENTRYP GetnUniformdvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLdouble * params); /* 641 */
+   void (GLAPIENTRYP GetnUniformfvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLfloat * params); /* 642 */
+   void (GLAPIENTRYP GetnUniformivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLint * params); /* 643 */
+   void (GLAPIENTRYP GetnUniformuivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLuint * params); /* 644 */
+   void (GLAPIENTRYP ReadnPixelsARB)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid * data); /* 645 */
+   void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 646 */
+   void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 647 */
+   void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 648 */
+   void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 649 */
+   void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 650 */
+   void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 651 */
+   void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 652 */
+   void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 653 */
+   void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 654 */
+   void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 655 */
+   void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 656 */
+   void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 657 */
+   void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 658 */
+   void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 659 */
+   void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 660 */
+   void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 661 */
+   void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 662 */
+   void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 663 */
+   void (GLAPIENTRYP UnlockArraysEXT)(void); /* 664 */
+   void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 665 */
+   void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 666 */
+   void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 667 */
+   void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 668 */
+   void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 669 */
+   void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 670 */
+   void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 671 */
+   void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 672 */
+   void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 673 */
+   void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 674 */
+   void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 675 */
+   void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 676 */
+   void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 677 */
+   void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 678 */
+   void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 679 */
+   void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 680 */
+   void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 681 */
+   void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 682 */
+   void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 683 */
+   void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 684 */
+   void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 685 */
+   void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 686 */
+   void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 687 */
+   void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 688 */
+   void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 689 */
+   void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 690 */
+   void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 691 */
+   void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 692 */
+   void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 693 */
+   void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 694 */
+   void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 695 */
+   void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 696 */
+   void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 697 */
+   void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 698 */
+   void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 699 */
+   void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 700 */
+   void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 701 */
+   void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 702 */
+   void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 703 */
+   void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 704 */
+   void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 705 */
+   void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 706 */
+   void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 707 */
+   void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 708 */
+   void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 709 */
+   void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 710 */
+   void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 711 */
+   void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 712 */
+   void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 713 */
+   void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 714 */
+   void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 715 */
+   void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 716 */
+   void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 717 */
+   void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 718 */
+   void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 719 */
+   void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 720 */
+   void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 721 */
+   void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 722 */
+   void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 723 */
+   void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 724 */
+   void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 725 */
+   void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 726 */
+   void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 727 */
+   void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 728 */
+   void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 729 */
+   void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 730 */
+   void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 731 */
+   void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 732 */
+   void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 733 */
+   void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 734 */
+   void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 735 */
+   void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 736 */
+   GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 737 */
+   void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 738 */
+   GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 739 */
+   GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 740 */
+   void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 741 */
+   void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 742 */
+   void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 743 */
+   void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 744 */
+   void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 745 */
+   void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 746 */
+   void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 747 */
+   void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 748 */
+   void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 749 */
+   void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 750 */
+   void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 751 */
+   void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 752 */
+   void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 753 */
+   GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 754 */
+   void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 755 */
+   void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble * params); /* 756 */
+   void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat * params); /* 757 */
+   void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 758 */
+   void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 759 */
+   void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 760 */
+   void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 761 */
+   void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 762 */
+   void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 763 */
+   void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 764 */
+   void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 765 */
+   void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 766 */
+   void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 767 */
+   void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 768 */
+   void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 769 */
+   void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 770 */
+   void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 771 */
+   void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 772 */
+   void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 773 */
+   void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 774 */
+   void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 775 */
+   void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 776 */
+   void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 777 */
+   void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 778 */
+   void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 779 */
+   void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 780 */
+   void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 781 */
+   void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 782 */
+   void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 783 */
+   void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 784 */
+   void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 785 */
+   void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 786 */
+   void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 787 */
+   void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 788 */
+   void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 789 */
+   void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 790 */
+   void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 791 */
+   void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 792 */
+   void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 793 */
+   void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 794 */
+   void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 795 */
+   void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 796 */
+   void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 797 */
+   void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 798 */
+   void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 799 */
+   void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 800 */
+   void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 801 */
+   void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 802 */
+   void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 803 */
+   void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 804 */
+   void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 805 */
+   void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 806 */
+   void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 807 */
+   void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 808 */
+   void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 809 */
+   void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 810 */
+   void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 811 */
+   void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 812 */
+   void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 813 */
+   GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 814 */
+   void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 815 */
+   void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 816 */
+   void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 817 */
+   void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 818 */
+   void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 819 */
+   void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 820 */
+   void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 821 */
+   void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 822 */
+   void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 823 */
+   GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 824 */
+   void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 825 */
+   void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 826 */
+   void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 827 */
+   void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 828 */
+   void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 829 */
+   void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 830 */
+   void (GLAPIENTRYP PrimitiveRestartIndexNV)(GLuint index); /* 831 */
+   void (GLAPIENTRYP PrimitiveRestartNV)(void); /* 832 */
+   void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 833 */
+   void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 834 */
+   void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 835 */
+   void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 836 */
+   GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 837 */
+   void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 838 */
+   void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 839 */
+   void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 840 */
+   void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 841 */
+   void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 842 */
+   void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 843 */
+   void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 844 */
+   void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 845 */
+   void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 846 */
+   void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 847 */
+   void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 848 */
+   GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 849 */
+   GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 850 */
+   void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 851 */
+   void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 852 */
+   void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 853 */
+   void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 854 */
+   void (GLAPIENTRYP BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar * name); /* 855 */
+   GLint (GLAPIENTRYP GetFragDataLocationEXT)(GLuint program, const GLchar * name); /* 856 */
+   void (GLAPIENTRYP GetUniformuivEXT)(GLuint program, GLint location, GLuint * params); /* 857 */
+   void (GLAPIENTRYP GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint * params); /* 858 */
+   void (GLAPIENTRYP GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint * params); /* 859 */
+   void (GLAPIENTRYP Uniform1uiEXT)(GLint location, GLuint x); /* 860 */
+   void (GLAPIENTRYP Uniform1uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 861 */
+   void (GLAPIENTRYP Uniform2uiEXT)(GLint location, GLuint x, GLuint y); /* 862 */
+   void (GLAPIENTRYP Uniform2uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 863 */
+   void (GLAPIENTRYP Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z); /* 864 */
+   void (GLAPIENTRYP Uniform3uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 865 */
+   void (GLAPIENTRYP Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); /* 866 */
+   void (GLAPIENTRYP Uniform4uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 867 */
+   void (GLAPIENTRYP VertexAttribI1iEXT)(GLuint index, GLint x); /* 868 */
+   void (GLAPIENTRYP VertexAttribI1ivEXT)(GLuint index, const GLint * v); /* 869 */
+   void (GLAPIENTRYP VertexAttribI1uiEXT)(GLuint index, GLuint x); /* 870 */
+   void (GLAPIENTRYP VertexAttribI1uivEXT)(GLuint index, const GLuint * v); /* 871 */
+   void (GLAPIENTRYP VertexAttribI2iEXT)(GLuint index, GLint x, GLint y); /* 872 */
+   void (GLAPIENTRYP VertexAttribI2ivEXT)(GLuint index, const GLint * v); /* 873 */
+   void (GLAPIENTRYP VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y); /* 874 */
+   void (GLAPIENTRYP VertexAttribI2uivEXT)(GLuint index, const GLuint * v); /* 875 */
+   void (GLAPIENTRYP VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z); /* 876 */
+   void (GLAPIENTRYP VertexAttribI3ivEXT)(GLuint index, const GLint * v); /* 877 */
+   void (GLAPIENTRYP VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z); /* 878 */
+   void (GLAPIENTRYP VertexAttribI3uivEXT)(GLuint index, const GLuint * v); /* 879 */
+   void (GLAPIENTRYP VertexAttribI4bvEXT)(GLuint index, const GLbyte * v); /* 880 */
+   void (GLAPIENTRYP VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w); /* 881 */
+   void (GLAPIENTRYP VertexAttribI4ivEXT)(GLuint index, const GLint * v); /* 882 */
+   void (GLAPIENTRYP VertexAttribI4svEXT)(GLuint index, const GLshort * v); /* 883 */
+   void (GLAPIENTRYP VertexAttribI4ubvEXT)(GLuint index, const GLubyte * v); /* 884 */
+   void (GLAPIENTRYP VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); /* 885 */
+   void (GLAPIENTRYP VertexAttribI4uivEXT)(GLuint index, const GLuint * v); /* 886 */
+   void (GLAPIENTRYP VertexAttribI4usvEXT)(GLuint index, const GLushort * v); /* 887 */
+   void (GLAPIENTRYP VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 888 */
+   void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 889 */
+   void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 890 */
+   void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 891 */
+   void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 892 */
+   void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 893 */
+   void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 894 */
+   GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 895 */
+   void (GLAPIENTRYP ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a); /* 896 */
+   void (GLAPIENTRYP ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a); /* 897 */
+   void (GLAPIENTRYP GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint * params); /* 898 */
+   void (GLAPIENTRYP GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint * params); /* 899 */
+   void (GLAPIENTRYP TexParameterIivEXT)(GLenum target, GLenum pname, const GLint * params); /* 900 */
+   void (GLAPIENTRYP TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint * params); /* 901 */
+   void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 902 */
+   void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 903 */
+   void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 904 */
+   void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 905 */
+   void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 906 */
+   void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 907 */
+   void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 908 */
+   void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 909 */
+   void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 910 */
+   void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 911 */
+   void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 912 */
+   void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 913 */
+   void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 914 */
+   GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 915 */
+   GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 916 */
+   void (GLAPIENTRYP ActiveProgramEXT)(GLuint program); /* 917 */
+   GLuint (GLAPIENTRYP CreateShaderProgramEXT)(GLenum type, const GLchar * string); /* 918 */
+   void (GLAPIENTRYP UseShaderProgramEXT)(GLenum type, GLuint program); /* 919 */
+   void (GLAPIENTRYP TextureBarrierNV)(void); /* 920 */
+   void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 921 */
+   void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 922 */
+   void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 923 */
+   void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 924 */
+   void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 925 */
+   void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 926 */
+   void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 927 */
 };
 
 #endif /* !defined( _GLAPI_TABLE_H_ ) */
diff --git a/mesalib/src/mapi/glapi/glapitemp.h b/mesalib/src/mapi/glapi/glapitemp.h
index 4eb486159..46e6e2758 100644
--- a/mesalib/src/mapi/glapi/glapitemp.h
+++ b/mesalib/src/mapi/glapi/glapitemp.h
@@ -27,7 +27,7 @@
  */
 
 
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
+#  if (defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) && defined(__ELF__))
 #    define HIDDEN  __attribute__((visibility("hidden")))
 #  else
 #    define HIDDEN
@@ -4192,63 +4192,163 @@ KEYWORD1 void KEYWORD2 NAME(ShaderBinary)(GLsizei n, const GLuint * shaders, GLe
    DISPATCH(ShaderBinary, (n, shaders, binaryformat, binary, length), (F, "glShaderBinary(%d, %p, 0x%x, %p, %d);\n", n, (const void *) shaders, binaryformat, (const void *) binary, length));
 }
 
+KEYWORD1 GLenum KEYWORD2 NAME(GetGraphicsResetStatusARB)(void)
+{
+   RETURN_DISPATCH(GetGraphicsResetStatusARB, (), (F, "glGetGraphicsResetStatusARB();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnColorTableARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * table)
+{
+   DISPATCH(GetnColorTableARB, (target, format, type, bufSize, table), (F, "glGetnColorTableARB(0x%x, 0x%x, 0x%x, %d, %p);\n", target, format, type, bufSize, (const void *) table));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnCompressedTexImageARB)(GLenum target, GLint lod, GLsizei bufSize, GLvoid * img)
+{
+   DISPATCH(GetnCompressedTexImageARB, (target, lod, bufSize, img), (F, "glGetnCompressedTexImageARB(0x%x, %d, %d, %p);\n", target, lod, bufSize, (const void *) img));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnConvolutionFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * image)
+{
+   DISPATCH(GetnConvolutionFilterARB, (target, format, type, bufSize, image), (F, "glGetnConvolutionFilterARB(0x%x, 0x%x, 0x%x, %d, %p);\n", target, format, type, bufSize, (const void *) image));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnHistogramARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values)
+{
+   DISPATCH(GetnHistogramARB, (target, reset, format, type, bufSize, values), (F, "glGetnHistogramARB(0x%x, %d, 0x%x, 0x%x, %d, %p);\n", target, reset, format, type, bufSize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnMapdvARB)(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v)
+{
+   DISPATCH(GetnMapdvARB, (target, query, bufSize, v), (F, "glGetnMapdvARB(0x%x, 0x%x, %d, %p);\n", target, query, bufSize, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnMapfvARB)(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v)
+{
+   DISPATCH(GetnMapfvARB, (target, query, bufSize, v), (F, "glGetnMapfvARB(0x%x, 0x%x, %d, %p);\n", target, query, bufSize, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnMapivARB)(GLenum target, GLenum query, GLsizei bufSize, GLint * v)
+{
+   DISPATCH(GetnMapivARB, (target, query, bufSize, v), (F, "glGetnMapivARB(0x%x, 0x%x, %d, %p);\n", target, query, bufSize, (const void *) v));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnMinmaxARB)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values)
+{
+   DISPATCH(GetnMinmaxARB, (target, reset, format, type, bufSize, values), (F, "glGetnMinmaxARB(0x%x, %d, 0x%x, 0x%x, %d, %p);\n", target, reset, format, type, bufSize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnPixelMapfvARB)(GLenum map, GLsizei bufSize, GLfloat * values)
+{
+   DISPATCH(GetnPixelMapfvARB, (map, bufSize, values), (F, "glGetnPixelMapfvARB(0x%x, %d, %p);\n", map, bufSize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnPixelMapuivARB)(GLenum map, GLsizei bufSize, GLuint * values)
+{
+   DISPATCH(GetnPixelMapuivARB, (map, bufSize, values), (F, "glGetnPixelMapuivARB(0x%x, %d, %p);\n", map, bufSize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnPixelMapusvARB)(GLenum map, GLsizei bufSize, GLushort * values)
+{
+   DISPATCH(GetnPixelMapusvARB, (map, bufSize, values), (F, "glGetnPixelMapusvARB(0x%x, %d, %p);\n", map, bufSize, (const void *) values));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnPolygonStippleARB)(GLsizei bufSize, GLubyte * pattern)
+{
+   DISPATCH(GetnPolygonStippleARB, (bufSize, pattern), (F, "glGetnPolygonStippleARB(%d, %p);\n", bufSize, (const void *) pattern));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnSeparableFilterARB)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid * row, GLsizei columnBufSize, GLvoid * column, GLvoid * span)
+{
+   DISPATCH(GetnSeparableFilterARB, (target, format, type, rowBufSize, row, columnBufSize, column, span), (F, "glGetnSeparableFilterARB(0x%x, 0x%x, 0x%x, %d, %p, %d, %p, %p);\n", target, format, type, rowBufSize, (const void *) row, columnBufSize, (const void *) column, (const void *) span));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnTexImageARB)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid * img)
+{
+   DISPATCH(GetnTexImageARB, (target, level, format, type, bufSize, img), (F, "glGetnTexImageARB(0x%x, %d, 0x%x, 0x%x, %d, %p);\n", target, level, format, type, bufSize, (const void *) img));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnUniformdvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLdouble * params)
+{
+   DISPATCH(GetnUniformdvARB, (program, location, bufSize, params), (F, "glGetnUniformdvARB(%d, %d, %d, %p);\n", program, location, bufSize, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnUniformfvARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLfloat * params)
+{
+   DISPATCH(GetnUniformfvARB, (program, location, bufSize, params), (F, "glGetnUniformfvARB(%d, %d, %d, %p);\n", program, location, bufSize, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnUniformivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLint * params)
+{
+   DISPATCH(GetnUniformivARB, (program, location, bufSize, params), (F, "glGetnUniformivARB(%d, %d, %d, %p);\n", program, location, bufSize, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetnUniformuivARB)(GLhandleARB program, GLint location, GLsizei bufSize, GLuint * params)
+{
+   DISPATCH(GetnUniformuivARB, (program, location, bufSize, params), (F, "glGetnUniformuivARB(%d, %d, %d, %p);\n", program, location, bufSize, (const void *) params));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ReadnPixelsARB)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid * data)
+{
+   DISPATCH(ReadnPixelsARB, (x, y, width, height, format, type, bufSize, data), (F, "glReadnPixelsARB(%d, %d, %d, %d, 0x%x, 0x%x, %d, %p);\n", x, y, width, height, format, type, bufSize, (const void *) data));
+}
+
 KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias)
 {
    DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_627)(GLenum pname, GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_647)(GLenum pname, GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_627)(GLenum pname, GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_647)(GLenum pname, GLfloat * params)
 {
    DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_628)(GLenum pname, GLint * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_648)(GLenum pname, GLint * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_628)(GLenum pname, GLint * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_648)(GLenum pname, GLint * params)
 {
    DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_629)(GLenum pname, GLfloat param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_649)(GLenum pname, GLfloat param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_629)(GLenum pname, GLfloat param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_649)(GLenum pname, GLfloat param)
 {
    DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_630)(GLenum pname, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(GLenum pname, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_630)(GLenum pname, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(GLenum pname, const GLfloat * params)
 {
    DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_631)(GLenum pname, GLint param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(GLenum pname, GLint param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_631)(GLenum pname, GLint param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(GLenum pname, GLint param)
 {
    DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_632)(GLenum pname, const GLint * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLenum pname, const GLint * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_632)(GLenum pname, const GLint * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLenum pname, const GLint * params)
 {
    DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_633)(GLclampf value, GLboolean invert);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLclampf value, GLboolean invert);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_633)(GLclampf value, GLboolean invert)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLclampf value, GLboolean invert)
 {
    DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_634)(GLenum pattern);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLenum pattern);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_634)(GLenum pattern)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLenum pattern)
 {
    DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern));
 }
@@ -4298,9 +4398,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param)
    DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_641)(GLenum pname, GLfloat param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_661)(GLenum pname, GLfloat param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_641)(GLenum pname, GLfloat param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_661)(GLenum pname, GLfloat param)
 {
    DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param));
 }
@@ -4320,9 +4420,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * p
    DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_642)(GLenum pname, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_662)(GLenum pname, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_642)(GLenum pname, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_662)(GLenum pname, const GLfloat * params)
 {
    DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
@@ -4577,9 +4677,9 @@ KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord)
    DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_669)(GLenum mode);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_689)(GLenum mode);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_669)(GLenum mode)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_689)(GLenum mode)
 {
    DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode));
 }
@@ -4594,9 +4694,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfac
    DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_670)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_690)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_670)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_690)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
 {
    DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha));
 }
@@ -4961,65 +5061,65 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v)
    DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_711)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_731)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_711)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_731)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride)
 {
    DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_712)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_732)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_712)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_732)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride)
 {
    DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_713)(GLsizei n, const GLuint * fences);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_733)(GLsizei n, const GLuint * fences);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_713)(GLsizei n, const GLuint * fences)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_733)(GLsizei n, const GLuint * fences)
 {
    DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_714)(GLuint fence);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_734)(GLuint fence);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_714)(GLuint fence)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_734)(GLuint fence)
 {
    DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_715)(GLsizei n, GLuint * fences);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_735)(GLsizei n, GLuint * fences);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_715)(GLsizei n, GLuint * fences)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_735)(GLsizei n, GLuint * fences)
 {
    DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_716)(GLuint fence, GLenum pname, GLint * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_736)(GLuint fence, GLenum pname, GLint * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_716)(GLuint fence, GLenum pname, GLint * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_736)(GLuint fence, GLenum pname, GLint * params)
 {
    DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params));
 }
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_717)(GLuint fence);
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_737)(GLuint fence);
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_717)(GLuint fence)
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_737)(GLuint fence)
 {
    RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_718)(GLuint fence, GLenum condition);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_738)(GLuint fence, GLenum condition);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_718)(GLuint fence, GLenum condition)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_738)(GLuint fence, GLenum condition)
 {
    DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition));
 }
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_719)(GLuint fence);
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_739)(GLuint fence);
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_719)(GLuint fence)
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_739)(GLuint fence)
 {
    RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence));
 }
@@ -5464,16 +5564,16 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * para
    DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_800)(GLenum face);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum face);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_800)(GLenum face)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum face)
 {
    DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_801)(GLuint array);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLuint array);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_801)(GLuint array)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLuint array)
 {
    DISPATCH(BindVertexArrayAPPLE, (array), (F, "glBindVertexArrayAPPLE(%d);\n", array));
 }
@@ -5483,16 +5583,16 @@ KEYWORD1 void KEYWORD2 NAME(DeleteVertexArrays)(GLsizei n, const GLuint * arrays
    DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArrays(%d, %p);\n", n, (const void *) arrays));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_802)(GLsizei n, const GLuint * arrays);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLsizei n, const GLuint * arrays);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_802)(GLsizei n, const GLuint * arrays)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLsizei n, const GLuint * arrays)
 {
    DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLsizei n, GLuint * arrays);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_823)(GLsizei n, GLuint * arrays);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLsizei n, GLuint * arrays)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_823)(GLsizei n, GLuint * arrays)
 {
    DISPATCH(GenVertexArraysAPPLE, (n, arrays), (F, "glGenVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays));
 }
@@ -5502,9 +5602,9 @@ KEYWORD1 GLboolean KEYWORD2 NAME(IsVertexArray)(GLuint array)
    RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArray(%d);\n", array));
 }
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_804)(GLuint array);
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_824)(GLuint array);
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_804)(GLuint array)
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_824)(GLuint array)
 {
    RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArrayAPPLE(%d);\n", array));
 }
@@ -5554,9 +5654,9 @@ KEYWORD1 void KEYWORD2 NAME(PrimitiveRestartNV)(void)
    DISPATCH(PrimitiveRestartNV, (), (F, "glPrimitiveRestartNV();\n"));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_813)(GLclampd zmin, GLclampd zmax);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_833)(GLclampd zmin, GLclampd zmax);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_813)(GLclampd zmin, GLclampd zmax)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_833)(GLclampd zmin, GLclampd zmax)
 {
    DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax));
 }
@@ -5566,9 +5666,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA)
    DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparate(0x%x, 0x%x);\n", modeRGB, modeA));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_814)(GLenum modeRGB, GLenum modeA);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_834)(GLenum modeRGB, GLenum modeA);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_814)(GLenum modeRGB, GLenum modeA)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_834)(GLenum modeRGB, GLenum modeA)
 {
    DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA));
 }
@@ -5748,23 +5848,23 @@ KEYWORD1 void KEYWORD2 NAME(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint src
    DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_832)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_852)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_832)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_852)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
 {
    DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_833)(GLenum target, GLenum pname, GLint param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_853)(GLenum target, GLenum pname, GLint param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_833)(GLenum target, GLenum pname, GLint param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_853)(GLenum target, GLenum pname, GLint param)
 {
    DISPATCH(BufferParameteriAPPLE, (target, pname, param), (F, "glBufferParameteriAPPLE(0x%x, 0x%x, %d);\n", target, pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_834)(GLenum target, GLintptr offset, GLsizeiptr size);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_854)(GLenum target, GLintptr offset, GLsizeiptr size);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_834)(GLenum target, GLintptr offset, GLsizeiptr size)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_854)(GLenum target, GLintptr offset, GLsizeiptr size)
 {
    DISPATCH(FlushMappedBufferRangeAPPLE, (target, offset, size), (F, "glFlushMappedBufferRangeAPPLE(0x%x, %d, %d);\n", target, offset, size));
 }
@@ -6324,16 +6424,16 @@ KEYWORD1 void KEYWORD2 NAME(ProvokingVertex)(GLenum mode)
    DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertex(0x%x);\n", mode));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_892)(GLenum target, GLenum pname, GLvoid ** params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_912)(GLenum target, GLenum pname, GLvoid ** params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_892)(GLenum target, GLenum pname, GLvoid ** params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_912)(GLenum target, GLenum pname, GLvoid ** params)
 {
    DISPATCH(GetTexParameterPointervAPPLE, (target, pname, params), (F, "glGetTexParameterPointervAPPLE(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_893)(GLenum target, GLsizei length, GLvoid * pointer);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_913)(GLenum target, GLsizei length, GLvoid * pointer);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_893)(GLenum target, GLsizei length, GLvoid * pointer)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_913)(GLenum target, GLsizei length, GLvoid * pointer)
 {
    DISPATCH(TextureRangeAPPLE, (target, length, pointer), (F, "glTextureRangeAPPLE(0x%x, %d, %p);\n", target, length, (const void *) pointer));
 }
@@ -6373,37 +6473,37 @@ KEYWORD1 void KEYWORD2 NAME(TextureBarrierNV)(void)
    DISPATCH(TextureBarrierNV, (), (F, "glTextureBarrierNV();\n"));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_901)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_921)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_901)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_921)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)
 {
    DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_902)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_922)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_902)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_922)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
 {
    DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_903)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_923)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_903)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_923)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
 {
    DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_904)(GLuint id, GLenum pname, GLint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_924)(GLuint id, GLenum pname, GLint64EXT * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_904)(GLuint id, GLenum pname, GLint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_924)(GLuint id, GLenum pname, GLint64EXT * params)
 {
    DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_905)(GLuint id, GLenum pname, GLuint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_925)(GLuint id, GLenum pname, GLuint64EXT * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_905)(GLuint id, GLenum pname, GLuint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_925)(GLuint id, GLenum pname, GLuint64EXT * params)
 {
    DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params));
 }
@@ -7197,15 +7297,35 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(GetShaderPrecisionFormat),
    TABLE_ENTRY(ReleaseShaderCompiler),
    TABLE_ENTRY(ShaderBinary),
+   TABLE_ENTRY(GetGraphicsResetStatusARB),
+   TABLE_ENTRY(GetnColorTableARB),
+   TABLE_ENTRY(GetnCompressedTexImageARB),
+   TABLE_ENTRY(GetnConvolutionFilterARB),
+   TABLE_ENTRY(GetnHistogramARB),
+   TABLE_ENTRY(GetnMapdvARB),
+   TABLE_ENTRY(GetnMapfvARB),
+   TABLE_ENTRY(GetnMapivARB),
+   TABLE_ENTRY(GetnMinmaxARB),
+   TABLE_ENTRY(GetnPixelMapfvARB),
+   TABLE_ENTRY(GetnPixelMapuivARB),
+   TABLE_ENTRY(GetnPixelMapusvARB),
+   TABLE_ENTRY(GetnPolygonStippleARB),
+   TABLE_ENTRY(GetnSeparableFilterARB),
+   TABLE_ENTRY(GetnTexImageARB),
+   TABLE_ENTRY(GetnUniformdvARB),
+   TABLE_ENTRY(GetnUniformfvARB),
+   TABLE_ENTRY(GetnUniformivARB),
+   TABLE_ENTRY(GetnUniformuivARB),
+   TABLE_ENTRY(ReadnPixelsARB),
    TABLE_ENTRY(PolygonOffsetEXT),
-   TABLE_ENTRY(_dispatch_stub_627),
-   TABLE_ENTRY(_dispatch_stub_628),
-   TABLE_ENTRY(_dispatch_stub_629),
-   TABLE_ENTRY(_dispatch_stub_630),
-   TABLE_ENTRY(_dispatch_stub_631),
-   TABLE_ENTRY(_dispatch_stub_632),
-   TABLE_ENTRY(_dispatch_stub_633),
-   TABLE_ENTRY(_dispatch_stub_634),
+   TABLE_ENTRY(_dispatch_stub_647),
+   TABLE_ENTRY(_dispatch_stub_648),
+   TABLE_ENTRY(_dispatch_stub_649),
+   TABLE_ENTRY(_dispatch_stub_650),
+   TABLE_ENTRY(_dispatch_stub_651),
+   TABLE_ENTRY(_dispatch_stub_652),
+   TABLE_ENTRY(_dispatch_stub_653),
+   TABLE_ENTRY(_dispatch_stub_654),
    TABLE_ENTRY(ColorPointerEXT),
    TABLE_ENTRY(EdgeFlagPointerEXT),
    TABLE_ENTRY(IndexPointerEXT),
@@ -7240,7 +7360,7 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(FogCoorddvEXT),
    TABLE_ENTRY(FogCoordfEXT),
    TABLE_ENTRY(FogCoordfvEXT),
-   TABLE_ENTRY(_dispatch_stub_669),
+   TABLE_ENTRY(_dispatch_stub_689),
    TABLE_ENTRY(BlendFuncSeparateEXT),
    TABLE_ENTRY(FlushVertexArrayRangeNV),
    TABLE_ENTRY(VertexArrayRangeNV),
@@ -7282,15 +7402,15 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(WindowPos4ivMESA),
    TABLE_ENTRY(WindowPos4sMESA),
    TABLE_ENTRY(WindowPos4svMESA),
-   TABLE_ENTRY(_dispatch_stub_711),
-   TABLE_ENTRY(_dispatch_stub_712),
-   TABLE_ENTRY(_dispatch_stub_713),
-   TABLE_ENTRY(_dispatch_stub_714),
-   TABLE_ENTRY(_dispatch_stub_715),
-   TABLE_ENTRY(_dispatch_stub_716),
-   TABLE_ENTRY(_dispatch_stub_717),
-   TABLE_ENTRY(_dispatch_stub_718),
-   TABLE_ENTRY(_dispatch_stub_719),
+   TABLE_ENTRY(_dispatch_stub_731),
+   TABLE_ENTRY(_dispatch_stub_732),
+   TABLE_ENTRY(_dispatch_stub_733),
+   TABLE_ENTRY(_dispatch_stub_734),
+   TABLE_ENTRY(_dispatch_stub_735),
+   TABLE_ENTRY(_dispatch_stub_736),
+   TABLE_ENTRY(_dispatch_stub_737),
+   TABLE_ENTRY(_dispatch_stub_738),
+   TABLE_ENTRY(_dispatch_stub_739),
    TABLE_ENTRY(AreProgramsResidentNV),
    TABLE_ENTRY(BindProgramNV),
    TABLE_ENTRY(DeleteProgramsNV),
@@ -7371,11 +7491,11 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(SetFragmentShaderConstantATI),
    TABLE_ENTRY(PointParameteriNV),
    TABLE_ENTRY(PointParameterivNV),
-   TABLE_ENTRY(_dispatch_stub_800),
-   TABLE_ENTRY(_dispatch_stub_801),
-   TABLE_ENTRY(_dispatch_stub_802),
-   TABLE_ENTRY(_dispatch_stub_803),
-   TABLE_ENTRY(_dispatch_stub_804),
+   TABLE_ENTRY(_dispatch_stub_820),
+   TABLE_ENTRY(_dispatch_stub_821),
+   TABLE_ENTRY(_dispatch_stub_822),
+   TABLE_ENTRY(_dispatch_stub_823),
+   TABLE_ENTRY(_dispatch_stub_824),
    TABLE_ENTRY(GetProgramNamedParameterdvNV),
    TABLE_ENTRY(GetProgramNamedParameterfvNV),
    TABLE_ENTRY(ProgramNamedParameter4dNV),
@@ -7384,8 +7504,8 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(ProgramNamedParameter4fvNV),
    TABLE_ENTRY(PrimitiveRestartIndexNV),
    TABLE_ENTRY(PrimitiveRestartNV),
-   TABLE_ENTRY(_dispatch_stub_813),
-   TABLE_ENTRY(_dispatch_stub_814),
+   TABLE_ENTRY(_dispatch_stub_833),
+   TABLE_ENTRY(_dispatch_stub_834),
    TABLE_ENTRY(BindFramebufferEXT),
    TABLE_ENTRY(BindRenderbufferEXT),
    TABLE_ENTRY(CheckFramebufferStatusEXT),
@@ -7403,9 +7523,9 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(IsFramebufferEXT),
    TABLE_ENTRY(IsRenderbufferEXT),
    TABLE_ENTRY(RenderbufferStorageEXT),
-   TABLE_ENTRY(_dispatch_stub_832),
-   TABLE_ENTRY(_dispatch_stub_833),
-   TABLE_ENTRY(_dispatch_stub_834),
+   TABLE_ENTRY(_dispatch_stub_852),
+   TABLE_ENTRY(_dispatch_stub_853),
+   TABLE_ENTRY(_dispatch_stub_854),
    TABLE_ENTRY(BindFragDataLocationEXT),
    TABLE_ENTRY(GetFragDataLocationEXT),
    TABLE_ENTRY(GetUniformuivEXT),
@@ -7463,8 +7583,8 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(GetTransformFeedbackVaryingEXT),
    TABLE_ENTRY(TransformFeedbackVaryingsEXT),
    TABLE_ENTRY(ProvokingVertexEXT),
-   TABLE_ENTRY(_dispatch_stub_892),
-   TABLE_ENTRY(_dispatch_stub_893),
+   TABLE_ENTRY(_dispatch_stub_912),
+   TABLE_ENTRY(_dispatch_stub_913),
    TABLE_ENTRY(GetObjectParameterivAPPLE),
    TABLE_ENTRY(ObjectPurgeableAPPLE),
    TABLE_ENTRY(ObjectUnpurgeableAPPLE),
@@ -7472,11 +7592,11 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(CreateShaderProgramEXT),
    TABLE_ENTRY(UseShaderProgramEXT),
    TABLE_ENTRY(TextureBarrierNV),
-   TABLE_ENTRY(_dispatch_stub_901),
-   TABLE_ENTRY(_dispatch_stub_902),
-   TABLE_ENTRY(_dispatch_stub_903),
-   TABLE_ENTRY(_dispatch_stub_904),
-   TABLE_ENTRY(_dispatch_stub_905),
+   TABLE_ENTRY(_dispatch_stub_921),
+   TABLE_ENTRY(_dispatch_stub_922),
+   TABLE_ENTRY(_dispatch_stub_923),
+   TABLE_ENTRY(_dispatch_stub_924),
+   TABLE_ENTRY(_dispatch_stub_925),
    TABLE_ENTRY(EGLImageTargetRenderbufferStorageOES),
    TABLE_ENTRY(EGLImageTargetTexture2DOES),
    /* A whole bunch of no-op functions.  These might be called
@@ -7783,10 +7903,10 @@ _glapi_proc UNUSED_TABLE_NAME[] = {
    TABLE_ENTRY(RenderbufferStorageMultisampleEXT),
    TABLE_ENTRY(PointParameterf),
    TABLE_ENTRY(PointParameterfARB),
-   TABLE_ENTRY(_dispatch_stub_641),
+   TABLE_ENTRY(_dispatch_stub_661),
    TABLE_ENTRY(PointParameterfv),
    TABLE_ENTRY(PointParameterfvARB),
-   TABLE_ENTRY(_dispatch_stub_642),
+   TABLE_ENTRY(_dispatch_stub_662),
    TABLE_ENTRY(SecondaryColor3b),
    TABLE_ENTRY(SecondaryColor3bv),
    TABLE_ENTRY(SecondaryColor3d),
@@ -7812,7 +7932,7 @@ _glapi_proc UNUSED_TABLE_NAME[] = {
    TABLE_ENTRY(FogCoordf),
    TABLE_ENTRY(FogCoordfv),
    TABLE_ENTRY(BlendFuncSeparate),
-   TABLE_ENTRY(_dispatch_stub_670),
+   TABLE_ENTRY(_dispatch_stub_690),
    TABLE_ENTRY(WindowPos2d),
    TABLE_ENTRY(WindowPos2dARB),
    TABLE_ENTRY(WindowPos2dv),
diff --git a/mesalib/src/mapi/glapi/glprocs.h b/mesalib/src/mapi/glapi/glprocs.h
index b11bca21c..9da75011b 100644
--- a/mesalib/src/mapi/glapi/glprocs.h
+++ b/mesalib/src/mapi/glapi/glprocs.h
@@ -678,6 +678,26 @@ static const char gl_string_table[] =
     "glGetShaderPrecisionFormat\0"
     "glReleaseShaderCompiler\0"
     "glShaderBinary\0"
+    "glGetGraphicsResetStatusARB\0"
+    "glGetnColorTableARB\0"
+    "glGetnCompressedTexImageARB\0"
+    "glGetnConvolutionFilterARB\0"
+    "glGetnHistogramARB\0"
+    "glGetnMapdvARB\0"
+    "glGetnMapfvARB\0"
+    "glGetnMapivARB\0"
+    "glGetnMinmaxARB\0"
+    "glGetnPixelMapfvARB\0"
+    "glGetnPixelMapuivARB\0"
+    "glGetnPixelMapusvARB\0"
+    "glGetnPolygonStippleARB\0"
+    "glGetnSeparableFilterARB\0"
+    "glGetnTexImageARB\0"
+    "glGetnUniformdvARB\0"
+    "glGetnUniformfvARB\0"
+    "glGetnUniformivARB\0"
+    "glGetnUniformuivARB\0"
+    "glReadnPixelsARB\0"
     "glPolygonOffsetEXT\0"
     "glGetPixelTexGenParameterfvSGIS\0"
     "glGetPixelTexGenParameterivSGIS\0"
@@ -1336,41 +1356,41 @@ static const char gl_string_table[] =
 #define gl_dispatch_stub_364 mgl_dispatch_stub_364
 #define gl_dispatch_stub_365 mgl_dispatch_stub_365
 #define gl_dispatch_stub_366 mgl_dispatch_stub_366
-#define gl_dispatch_stub_627 mgl_dispatch_stub_627
-#define gl_dispatch_stub_628 mgl_dispatch_stub_628
-#define gl_dispatch_stub_629 mgl_dispatch_stub_629
-#define gl_dispatch_stub_630 mgl_dispatch_stub_630
-#define gl_dispatch_stub_631 mgl_dispatch_stub_631
-#define gl_dispatch_stub_632 mgl_dispatch_stub_632
-#define gl_dispatch_stub_633 mgl_dispatch_stub_633
-#define gl_dispatch_stub_634 mgl_dispatch_stub_634
-#define gl_dispatch_stub_669 mgl_dispatch_stub_669
-#define gl_dispatch_stub_711 mgl_dispatch_stub_711
-#define gl_dispatch_stub_712 mgl_dispatch_stub_712
-#define gl_dispatch_stub_713 mgl_dispatch_stub_713
-#define gl_dispatch_stub_714 mgl_dispatch_stub_714
-#define gl_dispatch_stub_715 mgl_dispatch_stub_715
-#define gl_dispatch_stub_716 mgl_dispatch_stub_716
-#define gl_dispatch_stub_717 mgl_dispatch_stub_717
-#define gl_dispatch_stub_718 mgl_dispatch_stub_718
-#define gl_dispatch_stub_719 mgl_dispatch_stub_719
-#define gl_dispatch_stub_800 mgl_dispatch_stub_800
-#define gl_dispatch_stub_801 mgl_dispatch_stub_801
-#define gl_dispatch_stub_802 mgl_dispatch_stub_802
-#define gl_dispatch_stub_803 mgl_dispatch_stub_803
-#define gl_dispatch_stub_804 mgl_dispatch_stub_804
-#define gl_dispatch_stub_813 mgl_dispatch_stub_813
-#define gl_dispatch_stub_814 mgl_dispatch_stub_814
-#define gl_dispatch_stub_832 mgl_dispatch_stub_832
+#define gl_dispatch_stub_647 mgl_dispatch_stub_647
+#define gl_dispatch_stub_648 mgl_dispatch_stub_648
+#define gl_dispatch_stub_649 mgl_dispatch_stub_649
+#define gl_dispatch_stub_650 mgl_dispatch_stub_650
+#define gl_dispatch_stub_651 mgl_dispatch_stub_651
+#define gl_dispatch_stub_652 mgl_dispatch_stub_652
+#define gl_dispatch_stub_653 mgl_dispatch_stub_653
+#define gl_dispatch_stub_654 mgl_dispatch_stub_654
+#define gl_dispatch_stub_689 mgl_dispatch_stub_689
+#define gl_dispatch_stub_731 mgl_dispatch_stub_731
+#define gl_dispatch_stub_732 mgl_dispatch_stub_732
+#define gl_dispatch_stub_733 mgl_dispatch_stub_733
+#define gl_dispatch_stub_734 mgl_dispatch_stub_734
+#define gl_dispatch_stub_735 mgl_dispatch_stub_735
+#define gl_dispatch_stub_736 mgl_dispatch_stub_736
+#define gl_dispatch_stub_737 mgl_dispatch_stub_737
+#define gl_dispatch_stub_738 mgl_dispatch_stub_738
+#define gl_dispatch_stub_739 mgl_dispatch_stub_739
+#define gl_dispatch_stub_820 mgl_dispatch_stub_820
+#define gl_dispatch_stub_821 mgl_dispatch_stub_821
+#define gl_dispatch_stub_822 mgl_dispatch_stub_822
+#define gl_dispatch_stub_823 mgl_dispatch_stub_823
+#define gl_dispatch_stub_824 mgl_dispatch_stub_824
 #define gl_dispatch_stub_833 mgl_dispatch_stub_833
 #define gl_dispatch_stub_834 mgl_dispatch_stub_834
-#define gl_dispatch_stub_892 mgl_dispatch_stub_892
-#define gl_dispatch_stub_893 mgl_dispatch_stub_893
-#define gl_dispatch_stub_901 mgl_dispatch_stub_901
-#define gl_dispatch_stub_902 mgl_dispatch_stub_902
-#define gl_dispatch_stub_903 mgl_dispatch_stub_903
-#define gl_dispatch_stub_904 mgl_dispatch_stub_904
-#define gl_dispatch_stub_905 mgl_dispatch_stub_905
+#define gl_dispatch_stub_852 mgl_dispatch_stub_852
+#define gl_dispatch_stub_853 mgl_dispatch_stub_853
+#define gl_dispatch_stub_854 mgl_dispatch_stub_854
+#define gl_dispatch_stub_912 mgl_dispatch_stub_912
+#define gl_dispatch_stub_913 mgl_dispatch_stub_913
+#define gl_dispatch_stub_921 mgl_dispatch_stub_921
+#define gl_dispatch_stub_922 mgl_dispatch_stub_922
+#define gl_dispatch_stub_923 mgl_dispatch_stub_923
+#define gl_dispatch_stub_924 mgl_dispatch_stub_924
+#define gl_dispatch_stub_925 mgl_dispatch_stub_925
 #endif /* USE_MGL_NAMESPACE */
 
 
@@ -1388,41 +1408,41 @@ void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params
 void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
 void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params);
 void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_627(GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_628(GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_629(GLenum pname, GLfloat param);
-void GLAPIENTRY gl_dispatch_stub_630(GLenum pname, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_631(GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_632(GLenum pname, const GLint * params);
-void GLAPIENTRY gl_dispatch_stub_633(GLclampf value, GLboolean invert);
-void GLAPIENTRY gl_dispatch_stub_634(GLenum pattern);
-void GLAPIENTRY gl_dispatch_stub_669(GLenum mode);
-void GLAPIENTRY gl_dispatch_stub_711(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_712(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_713(GLsizei n, const GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_714(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_715(GLsizei n, GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_716(GLuint fence, GLenum pname, GLint * params);
-GLboolean GLAPIENTRY gl_dispatch_stub_717(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_718(GLuint fence, GLenum condition);
-GLboolean GLAPIENTRY gl_dispatch_stub_719(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_800(GLenum face);
-void GLAPIENTRY gl_dispatch_stub_801(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_802(GLsizei n, const GLuint * arrays);
-void GLAPIENTRY gl_dispatch_stub_803(GLsizei n, GLuint * arrays);
-GLboolean GLAPIENTRY gl_dispatch_stub_804(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_813(GLclampd zmin, GLclampd zmax);
-void GLAPIENTRY gl_dispatch_stub_814(GLenum modeRGB, GLenum modeA);
-void GLAPIENTRY gl_dispatch_stub_832(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-void GLAPIENTRY gl_dispatch_stub_833(GLenum target, GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_834(GLenum target, GLintptr offset, GLsizeiptr size);
-void GLAPIENTRY gl_dispatch_stub_892(GLenum target, GLenum pname, GLvoid ** params);
-void GLAPIENTRY gl_dispatch_stub_893(GLenum target, GLsizei length, GLvoid * pointer);
-void GLAPIENTRY gl_dispatch_stub_901(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-void GLAPIENTRY gl_dispatch_stub_902(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_903(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_904(GLuint id, GLenum pname, GLint64EXT * params);
-void GLAPIENTRY gl_dispatch_stub_905(GLuint id, GLenum pname, GLuint64EXT * params);
+void GLAPIENTRY gl_dispatch_stub_647(GLenum pname, GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_648(GLenum pname, GLint * params);
+void GLAPIENTRY gl_dispatch_stub_649(GLenum pname, GLfloat param);
+void GLAPIENTRY gl_dispatch_stub_650(GLenum pname, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_651(GLenum pname, GLint param);
+void GLAPIENTRY gl_dispatch_stub_652(GLenum pname, const GLint * params);
+void GLAPIENTRY gl_dispatch_stub_653(GLclampf value, GLboolean invert);
+void GLAPIENTRY gl_dispatch_stub_654(GLenum pattern);
+void GLAPIENTRY gl_dispatch_stub_689(GLenum mode);
+void GLAPIENTRY gl_dispatch_stub_731(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
+void GLAPIENTRY gl_dispatch_stub_732(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
+void GLAPIENTRY gl_dispatch_stub_733(GLsizei n, const GLuint * fences);
+void GLAPIENTRY gl_dispatch_stub_734(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_735(GLsizei n, GLuint * fences);
+void GLAPIENTRY gl_dispatch_stub_736(GLuint fence, GLenum pname, GLint * params);
+GLboolean GLAPIENTRY gl_dispatch_stub_737(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_738(GLuint fence, GLenum condition);
+GLboolean GLAPIENTRY gl_dispatch_stub_739(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_820(GLenum face);
+void GLAPIENTRY gl_dispatch_stub_821(GLuint array);
+void GLAPIENTRY gl_dispatch_stub_822(GLsizei n, const GLuint * arrays);
+void GLAPIENTRY gl_dispatch_stub_823(GLsizei n, GLuint * arrays);
+GLboolean GLAPIENTRY gl_dispatch_stub_824(GLuint array);
+void GLAPIENTRY gl_dispatch_stub_833(GLclampd zmin, GLclampd zmax);
+void GLAPIENTRY gl_dispatch_stub_834(GLenum modeRGB, GLenum modeA);
+void GLAPIENTRY gl_dispatch_stub_852(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+void GLAPIENTRY gl_dispatch_stub_853(GLenum target, GLenum pname, GLint param);
+void GLAPIENTRY gl_dispatch_stub_854(GLenum target, GLintptr offset, GLsizeiptr size);
+void GLAPIENTRY gl_dispatch_stub_912(GLenum target, GLenum pname, GLvoid ** params);
+void GLAPIENTRY gl_dispatch_stub_913(GLenum target, GLsizei length, GLvoid * pointer);
+void GLAPIENTRY gl_dispatch_stub_921(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+void GLAPIENTRY gl_dispatch_stub_922(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_923(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_924(GLuint id, GLenum pname, GLint64EXT * params);
+void GLAPIENTRY gl_dispatch_stub_925(GLuint id, GLenum pname, GLuint64EXT * params);
 #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
 
 static const glprocs_table_t static_functions[] = {
@@ -2052,647 +2072,667 @@ static const glprocs_table_t static_functions[] = {
     NAME_FUNC_OFFSET(10200, glGetShaderPrecisionFormat, glGetShaderPrecisionFormat, NULL, 623),
     NAME_FUNC_OFFSET(10227, glReleaseShaderCompiler, glReleaseShaderCompiler, NULL, 624),
     NAME_FUNC_OFFSET(10251, glShaderBinary, glShaderBinary, NULL, 625),
-    NAME_FUNC_OFFSET(10266, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 626),
-    NAME_FUNC_OFFSET(10285, gl_dispatch_stub_627, gl_dispatch_stub_627, NULL, 627),
-    NAME_FUNC_OFFSET(10317, gl_dispatch_stub_628, gl_dispatch_stub_628, NULL, 628),
-    NAME_FUNC_OFFSET(10349, gl_dispatch_stub_629, gl_dispatch_stub_629, NULL, 629),
-    NAME_FUNC_OFFSET(10377, gl_dispatch_stub_630, gl_dispatch_stub_630, NULL, 630),
-    NAME_FUNC_OFFSET(10406, gl_dispatch_stub_631, gl_dispatch_stub_631, NULL, 631),
-    NAME_FUNC_OFFSET(10434, gl_dispatch_stub_632, gl_dispatch_stub_632, NULL, 632),
-    NAME_FUNC_OFFSET(10463, gl_dispatch_stub_633, gl_dispatch_stub_633, NULL, 633),
-    NAME_FUNC_OFFSET(10480, gl_dispatch_stub_634, gl_dispatch_stub_634, NULL, 634),
-    NAME_FUNC_OFFSET(10500, glColorPointerEXT, glColorPointerEXT, NULL, 635),
-    NAME_FUNC_OFFSET(10518, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, 636),
-    NAME_FUNC_OFFSET(10539, glIndexPointerEXT, glIndexPointerEXT, NULL, 637),
-    NAME_FUNC_OFFSET(10557, glNormalPointerEXT, glNormalPointerEXT, NULL, 638),
-    NAME_FUNC_OFFSET(10576, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, 639),
-    NAME_FUNC_OFFSET(10597, glVertexPointerEXT, glVertexPointerEXT, NULL, 640),
-    NAME_FUNC_OFFSET(10616, glPointParameterfEXT, glPointParameterfEXT, NULL, 641),
-    NAME_FUNC_OFFSET(10637, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 642),
-    NAME_FUNC_OFFSET(10659, glLockArraysEXT, glLockArraysEXT, NULL, 643),
-    NAME_FUNC_OFFSET(10675, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 644),
-    NAME_FUNC_OFFSET(10693, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 645),
-    NAME_FUNC_OFFSET(10715, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 646),
-    NAME_FUNC_OFFSET(10738, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 647),
-    NAME_FUNC_OFFSET(10760, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 648),
-    NAME_FUNC_OFFSET(10783, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 649),
-    NAME_FUNC_OFFSET(10805, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 650),
-    NAME_FUNC_OFFSET(10828, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 651),
-    NAME_FUNC_OFFSET(10850, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 652),
-    NAME_FUNC_OFFSET(10873, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 653),
-    NAME_FUNC_OFFSET(10895, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 654),
-    NAME_FUNC_OFFSET(10918, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 655),
-    NAME_FUNC_OFFSET(10941, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 656),
-    NAME_FUNC_OFFSET(10965, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 657),
-    NAME_FUNC_OFFSET(10988, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 658),
-    NAME_FUNC_OFFSET(11012, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 659),
-    NAME_FUNC_OFFSET(11035, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 660),
-    NAME_FUNC_OFFSET(11059, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 661),
-    NAME_FUNC_OFFSET(11086, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 662),
-    NAME_FUNC_OFFSET(11107, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 663),
-    NAME_FUNC_OFFSET(11130, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 664),
-    NAME_FUNC_OFFSET(11151, glFogCoorddEXT, glFogCoorddEXT, NULL, 665),
-    NAME_FUNC_OFFSET(11166, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 666),
-    NAME_FUNC_OFFSET(11182, glFogCoordfEXT, glFogCoordfEXT, NULL, 667),
-    NAME_FUNC_OFFSET(11197, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 668),
-    NAME_FUNC_OFFSET(11213, gl_dispatch_stub_669, gl_dispatch_stub_669, NULL, 669),
-    NAME_FUNC_OFFSET(11231, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 670),
-    NAME_FUNC_OFFSET(11254, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, 671),
-    NAME_FUNC_OFFSET(11280, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, 672),
-    NAME_FUNC_OFFSET(11301, glCombinerInputNV, glCombinerInputNV, NULL, 673),
-    NAME_FUNC_OFFSET(11319, glCombinerOutputNV, glCombinerOutputNV, NULL, 674),
-    NAME_FUNC_OFFSET(11338, glCombinerParameterfNV, glCombinerParameterfNV, NULL, 675),
-    NAME_FUNC_OFFSET(11361, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, 676),
-    NAME_FUNC_OFFSET(11385, glCombinerParameteriNV, glCombinerParameteriNV, NULL, 677),
-    NAME_FUNC_OFFSET(11408, glCombinerParameterivNV, glCombinerParameterivNV, NULL, 678),
-    NAME_FUNC_OFFSET(11432, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, 679),
-    NAME_FUNC_OFFSET(11455, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, 680),
-    NAME_FUNC_OFFSET(11487, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, 681),
-    NAME_FUNC_OFFSET(11519, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, 682),
-    NAME_FUNC_OFFSET(11552, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, 683),
-    NAME_FUNC_OFFSET(11585, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, 684),
-    NAME_FUNC_OFFSET(11622, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, 685),
-    NAME_FUNC_OFFSET(11659, glResizeBuffersMESA, glResizeBuffersMESA, NULL, 686),
-    NAME_FUNC_OFFSET(11679, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 687),
-    NAME_FUNC_OFFSET(11697, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 688),
-    NAME_FUNC_OFFSET(11716, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 689),
-    NAME_FUNC_OFFSET(11734, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 690),
-    NAME_FUNC_OFFSET(11753, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 691),
-    NAME_FUNC_OFFSET(11771, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 692),
-    NAME_FUNC_OFFSET(11790, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 693),
-    NAME_FUNC_OFFSET(11808, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 694),
-    NAME_FUNC_OFFSET(11827, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 695),
-    NAME_FUNC_OFFSET(11845, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 696),
-    NAME_FUNC_OFFSET(11864, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 697),
-    NAME_FUNC_OFFSET(11882, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 698),
-    NAME_FUNC_OFFSET(11901, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 699),
-    NAME_FUNC_OFFSET(11919, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 700),
-    NAME_FUNC_OFFSET(11938, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 701),
-    NAME_FUNC_OFFSET(11956, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 702),
-    NAME_FUNC_OFFSET(11975, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 703),
-    NAME_FUNC_OFFSET(11993, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 704),
-    NAME_FUNC_OFFSET(12012, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 705),
-    NAME_FUNC_OFFSET(12030, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 706),
-    NAME_FUNC_OFFSET(12049, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 707),
-    NAME_FUNC_OFFSET(12067, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 708),
-    NAME_FUNC_OFFSET(12086, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 709),
-    NAME_FUNC_OFFSET(12104, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 710),
-    NAME_FUNC_OFFSET(12123, gl_dispatch_stub_711, gl_dispatch_stub_711, NULL, 711),
-    NAME_FUNC_OFFSET(12148, gl_dispatch_stub_712, gl_dispatch_stub_712, NULL, 712),
-    NAME_FUNC_OFFSET(12175, gl_dispatch_stub_713, gl_dispatch_stub_713, NULL, 713),
-    NAME_FUNC_OFFSET(12192, gl_dispatch_stub_714, gl_dispatch_stub_714, NULL, 714),
-    NAME_FUNC_OFFSET(12208, gl_dispatch_stub_715, gl_dispatch_stub_715, NULL, 715),
-    NAME_FUNC_OFFSET(12222, gl_dispatch_stub_716, gl_dispatch_stub_716, NULL, 716),
-    NAME_FUNC_OFFSET(12237, gl_dispatch_stub_717, gl_dispatch_stub_717, NULL, 717),
-    NAME_FUNC_OFFSET(12249, gl_dispatch_stub_718, gl_dispatch_stub_718, NULL, 718),
-    NAME_FUNC_OFFSET(12262, gl_dispatch_stub_719, gl_dispatch_stub_719, NULL, 719),
-    NAME_FUNC_OFFSET(12276, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, 720),
-    NAME_FUNC_OFFSET(12300, glBindProgramNV, glBindProgramNV, NULL, 721),
-    NAME_FUNC_OFFSET(12316, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 722),
-    NAME_FUNC_OFFSET(12335, glExecuteProgramNV, glExecuteProgramNV, NULL, 723),
-    NAME_FUNC_OFFSET(12354, glGenProgramsNV, glGenProgramsNV, NULL, 724),
-    NAME_FUNC_OFFSET(12370, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, 725),
-    NAME_FUNC_OFFSET(12396, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, 726),
-    NAME_FUNC_OFFSET(12422, glGetProgramStringNV, glGetProgramStringNV, NULL, 727),
-    NAME_FUNC_OFFSET(12443, glGetProgramivNV, glGetProgramivNV, NULL, 728),
-    NAME_FUNC_OFFSET(12460, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, 729),
-    NAME_FUNC_OFFSET(12481, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 730),
-    NAME_FUNC_OFFSET(12509, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, 731),
-    NAME_FUNC_OFFSET(12531, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, 732),
-    NAME_FUNC_OFFSET(12553, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, 733),
-    NAME_FUNC_OFFSET(12575, glIsProgramNV, glIsProgramNV, NULL, 734),
-    NAME_FUNC_OFFSET(12589, glLoadProgramNV, glLoadProgramNV, NULL, 735),
-    NAME_FUNC_OFFSET(12605, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, 736),
-    NAME_FUNC_OFFSET(12630, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, 737),
-    NAME_FUNC_OFFSET(12655, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, 738),
-    NAME_FUNC_OFFSET(12683, glTrackMatrixNV, glTrackMatrixNV, NULL, 739),
-    NAME_FUNC_OFFSET(12699, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 740),
-    NAME_FUNC_OFFSET(12718, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, 741),
-    NAME_FUNC_OFFSET(12738, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 742),
-    NAME_FUNC_OFFSET(12757, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, 743),
-    NAME_FUNC_OFFSET(12777, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 744),
-    NAME_FUNC_OFFSET(12796, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, 745),
-    NAME_FUNC_OFFSET(12816, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 746),
-    NAME_FUNC_OFFSET(12835, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, 747),
-    NAME_FUNC_OFFSET(12855, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 748),
-    NAME_FUNC_OFFSET(12874, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, 749),
-    NAME_FUNC_OFFSET(12894, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 750),
-    NAME_FUNC_OFFSET(12913, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, 751),
-    NAME_FUNC_OFFSET(12933, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 752),
-    NAME_FUNC_OFFSET(12952, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, 753),
-    NAME_FUNC_OFFSET(12972, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 754),
-    NAME_FUNC_OFFSET(12991, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, 755),
-    NAME_FUNC_OFFSET(13011, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 756),
-    NAME_FUNC_OFFSET(13030, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, 757),
-    NAME_FUNC_OFFSET(13050, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 758),
-    NAME_FUNC_OFFSET(13069, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, 759),
-    NAME_FUNC_OFFSET(13089, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 760),
-    NAME_FUNC_OFFSET(13108, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, 761),
-    NAME_FUNC_OFFSET(13128, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 762),
-    NAME_FUNC_OFFSET(13147, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, 763),
-    NAME_FUNC_OFFSET(13167, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, 764),
-    NAME_FUNC_OFFSET(13187, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, 765),
-    NAME_FUNC_OFFSET(13208, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, 766),
-    NAME_FUNC_OFFSET(13232, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, 767),
-    NAME_FUNC_OFFSET(13253, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, 768),
-    NAME_FUNC_OFFSET(13274, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, 769),
-    NAME_FUNC_OFFSET(13295, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, 770),
-    NAME_FUNC_OFFSET(13316, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, 771),
-    NAME_FUNC_OFFSET(13337, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, 772),
-    NAME_FUNC_OFFSET(13358, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, 773),
-    NAME_FUNC_OFFSET(13379, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, 774),
-    NAME_FUNC_OFFSET(13400, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, 775),
-    NAME_FUNC_OFFSET(13421, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, 776),
-    NAME_FUNC_OFFSET(13442, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, 777),
-    NAME_FUNC_OFFSET(13463, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, 778),
-    NAME_FUNC_OFFSET(13484, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, 779),
-    NAME_FUNC_OFFSET(13506, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, 780),
-    NAME_FUNC_OFFSET(13533, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, 781),
-    NAME_FUNC_OFFSET(13560, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, 782),
-    NAME_FUNC_OFFSET(13584, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, 783),
-    NAME_FUNC_OFFSET(13608, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, 784),
-    NAME_FUNC_OFFSET(13630, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, 785),
-    NAME_FUNC_OFFSET(13652, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, 786),
-    NAME_FUNC_OFFSET(13674, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, 787),
-    NAME_FUNC_OFFSET(13699, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, 788),
-    NAME_FUNC_OFFSET(13723, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, 789),
-    NAME_FUNC_OFFSET(13745, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, 790),
-    NAME_FUNC_OFFSET(13767, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, 791),
-    NAME_FUNC_OFFSET(13789, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, 792),
-    NAME_FUNC_OFFSET(13815, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, 793),
-    NAME_FUNC_OFFSET(13838, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, 794),
-    NAME_FUNC_OFFSET(13862, glPassTexCoordATI, glPassTexCoordATI, NULL, 795),
-    NAME_FUNC_OFFSET(13880, glSampleMapATI, glSampleMapATI, NULL, 796),
-    NAME_FUNC_OFFSET(13895, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, 797),
-    NAME_FUNC_OFFSET(13926, glPointParameteriNV, glPointParameteriNV, NULL, 798),
-    NAME_FUNC_OFFSET(13946, glPointParameterivNV, glPointParameterivNV, NULL, 799),
-    NAME_FUNC_OFFSET(13967, gl_dispatch_stub_800, gl_dispatch_stub_800, NULL, 800),
-    NAME_FUNC_OFFSET(13990, gl_dispatch_stub_801, gl_dispatch_stub_801, NULL, 801),
-    NAME_FUNC_OFFSET(14013, gl_dispatch_stub_802, gl_dispatch_stub_802, NULL, 802),
-    NAME_FUNC_OFFSET(14039, gl_dispatch_stub_803, gl_dispatch_stub_803, NULL, 803),
-    NAME_FUNC_OFFSET(14062, gl_dispatch_stub_804, gl_dispatch_stub_804, NULL, 804),
-    NAME_FUNC_OFFSET(14083, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, 805),
-    NAME_FUNC_OFFSET(14114, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, 806),
-    NAME_FUNC_OFFSET(14145, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, 807),
-    NAME_FUNC_OFFSET(14173, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, 808),
-    NAME_FUNC_OFFSET(14202, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, 809),
-    NAME_FUNC_OFFSET(14230, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, 810),
-    NAME_FUNC_OFFSET(14259, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 811),
-    NAME_FUNC_OFFSET(14285, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL, 812),
-    NAME_FUNC_OFFSET(14306, gl_dispatch_stub_813, gl_dispatch_stub_813, NULL, 813),
-    NAME_FUNC_OFFSET(14323, gl_dispatch_stub_814, gl_dispatch_stub_814, NULL, 814),
-    NAME_FUNC_OFFSET(14350, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 815),
-    NAME_FUNC_OFFSET(14371, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 816),
-    NAME_FUNC_OFFSET(14393, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 817),
-    NAME_FUNC_OFFSET(14421, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 818),
-    NAME_FUNC_OFFSET(14445, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 819),
-    NAME_FUNC_OFFSET(14470, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 820),
-    NAME_FUNC_OFFSET(14499, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 821),
-    NAME_FUNC_OFFSET(14525, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 822),
-    NAME_FUNC_OFFSET(14551, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 823),
-    NAME_FUNC_OFFSET(14577, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 824),
-    NAME_FUNC_OFFSET(14598, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 825),
-    NAME_FUNC_OFFSET(14620, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 826),
-    NAME_FUNC_OFFSET(14640, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 827),
-    NAME_FUNC_OFFSET(14681, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 828),
-    NAME_FUNC_OFFSET(14713, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 829),
-    NAME_FUNC_OFFSET(14732, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 830),
-    NAME_FUNC_OFFSET(14752, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 831),
-    NAME_FUNC_OFFSET(14777, gl_dispatch_stub_832, gl_dispatch_stub_832, NULL, 832),
-    NAME_FUNC_OFFSET(14798, gl_dispatch_stub_833, gl_dispatch_stub_833, NULL, 833),
-    NAME_FUNC_OFFSET(14822, gl_dispatch_stub_834, gl_dispatch_stub_834, NULL, 834),
-    NAME_FUNC_OFFSET(14852, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 835),
-    NAME_FUNC_OFFSET(14878, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 836),
-    NAME_FUNC_OFFSET(14903, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 837),
-    NAME_FUNC_OFFSET(14922, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 838),
-    NAME_FUNC_OFFSET(14946, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 839),
-    NAME_FUNC_OFFSET(14971, glUniform1uiEXT, glUniform1uiEXT, NULL, 840),
-    NAME_FUNC_OFFSET(14987, glUniform1uivEXT, glUniform1uivEXT, NULL, 841),
-    NAME_FUNC_OFFSET(15004, glUniform2uiEXT, glUniform2uiEXT, NULL, 842),
-    NAME_FUNC_OFFSET(15020, glUniform2uivEXT, glUniform2uivEXT, NULL, 843),
-    NAME_FUNC_OFFSET(15037, glUniform3uiEXT, glUniform3uiEXT, NULL, 844),
-    NAME_FUNC_OFFSET(15053, glUniform3uivEXT, glUniform3uivEXT, NULL, 845),
-    NAME_FUNC_OFFSET(15070, glUniform4uiEXT, glUniform4uiEXT, NULL, 846),
-    NAME_FUNC_OFFSET(15086, glUniform4uivEXT, glUniform4uivEXT, NULL, 847),
-    NAME_FUNC_OFFSET(15103, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 848),
-    NAME_FUNC_OFFSET(15124, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 849),
-    NAME_FUNC_OFFSET(15146, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 850),
-    NAME_FUNC_OFFSET(15168, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 851),
-    NAME_FUNC_OFFSET(15191, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 852),
-    NAME_FUNC_OFFSET(15212, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 853),
-    NAME_FUNC_OFFSET(15234, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 854),
-    NAME_FUNC_OFFSET(15256, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 855),
-    NAME_FUNC_OFFSET(15279, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 856),
-    NAME_FUNC_OFFSET(15300, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 857),
-    NAME_FUNC_OFFSET(15322, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 858),
-    NAME_FUNC_OFFSET(15344, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 859),
-    NAME_FUNC_OFFSET(15367, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 860),
-    NAME_FUNC_OFFSET(15389, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 861),
-    NAME_FUNC_OFFSET(15410, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 862),
-    NAME_FUNC_OFFSET(15432, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 863),
-    NAME_FUNC_OFFSET(15454, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 864),
-    NAME_FUNC_OFFSET(15477, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 865),
-    NAME_FUNC_OFFSET(15499, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 866),
-    NAME_FUNC_OFFSET(15522, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 867),
-    NAME_FUNC_OFFSET(15545, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 868),
-    NAME_FUNC_OFFSET(15571, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 869),
-    NAME_FUNC_OFFSET(15600, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 870),
-    NAME_FUNC_OFFSET(15622, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 871),
-    NAME_FUNC_OFFSET(15642, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 872),
-    NAME_FUNC_OFFSET(15661, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 873),
-    NAME_FUNC_OFFSET(15685, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 874),
-    NAME_FUNC_OFFSET(15709, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 875),
-    NAME_FUNC_OFFSET(15731, glClearColorIiEXT, glClearColorIiEXT, NULL, 876),
-    NAME_FUNC_OFFSET(15749, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 877),
-    NAME_FUNC_OFFSET(15768, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 878),
-    NAME_FUNC_OFFSET(15792, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 879),
-    NAME_FUNC_OFFSET(15817, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 880),
-    NAME_FUNC_OFFSET(15838, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 881),
-    NAME_FUNC_OFFSET(15860, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 882),
-    NAME_FUNC_OFFSET(15887, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 883),
-    NAME_FUNC_OFFSET(15912, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 884),
-    NAME_FUNC_OFFSET(15940, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 885),
-    NAME_FUNC_OFFSET(15960, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, 886),
-    NAME_FUNC_OFFSET(15982, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 887),
-    NAME_FUNC_OFFSET(16003, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 888),
-    NAME_FUNC_OFFSET(16029, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 889),
-    NAME_FUNC_OFFSET(16062, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 890),
-    NAME_FUNC_OFFSET(16093, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 891),
-    NAME_FUNC_OFFSET(16114, gl_dispatch_stub_892, gl_dispatch_stub_892, NULL, 892),
-    NAME_FUNC_OFFSET(16145, gl_dispatch_stub_893, gl_dispatch_stub_893, NULL, 893),
-    NAME_FUNC_OFFSET(16165, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, 894),
-    NAME_FUNC_OFFSET(16193, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, 895),
-    NAME_FUNC_OFFSET(16216, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, 896),
-    NAME_FUNC_OFFSET(16241, glActiveProgramEXT, glActiveProgramEXT, NULL, 897),
-    NAME_FUNC_OFFSET(16260, glCreateShaderProgramEXT, glCreateShaderProgramEXT, NULL, 898),
-    NAME_FUNC_OFFSET(16285, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL, 899),
-    NAME_FUNC_OFFSET(16307, glTextureBarrierNV, glTextureBarrierNV, NULL, 900),
-    NAME_FUNC_OFFSET(16326, gl_dispatch_stub_901, gl_dispatch_stub_901, NULL, 901),
-    NAME_FUNC_OFFSET(16351, gl_dispatch_stub_902, gl_dispatch_stub_902, NULL, 902),
-    NAME_FUNC_OFFSET(16380, gl_dispatch_stub_903, gl_dispatch_stub_903, NULL, 903),
-    NAME_FUNC_OFFSET(16411, gl_dispatch_stub_904, gl_dispatch_stub_904, NULL, 904),
-    NAME_FUNC_OFFSET(16435, gl_dispatch_stub_905, gl_dispatch_stub_905, NULL, 905),
-    NAME_FUNC_OFFSET(16460, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, 906),
-    NAME_FUNC_OFFSET(16499, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, 907),
-    NAME_FUNC_OFFSET(16528, glArrayElement, glArrayElement, NULL, 306),
-    NAME_FUNC_OFFSET(16546, glBindTexture, glBindTexture, NULL, 307),
-    NAME_FUNC_OFFSET(16563, glDrawArrays, glDrawArrays, NULL, 310),
-    NAME_FUNC_OFFSET(16579, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, 322),
-    NAME_FUNC_OFFSET(16604, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
-    NAME_FUNC_OFFSET(16624, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
-    NAME_FUNC_OFFSET(16644, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
-    NAME_FUNC_OFFSET(16667, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
-    NAME_FUNC_OFFSET(16690, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, 327),
-    NAME_FUNC_OFFSET(16710, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, 328),
-    NAME_FUNC_OFFSET(16727, glGetPointerv, glGetPointerv, NULL, 329),
-    NAME_FUNC_OFFSET(16744, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
-    NAME_FUNC_OFFSET(16759, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
-    NAME_FUNC_OFFSET(16783, glTexSubImage1D, glTexSubImage1D, NULL, 332),
-    NAME_FUNC_OFFSET(16802, glTexSubImage2D, glTexSubImage2D, NULL, 333),
-    NAME_FUNC_OFFSET(16821, glBlendColor, glBlendColor, NULL, 336),
-    NAME_FUNC_OFFSET(16837, glBlendEquation, glBlendEquation, NULL, 337),
-    NAME_FUNC_OFFSET(16856, glDrawRangeElements, glDrawRangeElements, NULL, 338),
-    NAME_FUNC_OFFSET(16879, glColorTable, glColorTable, NULL, 339),
-    NAME_FUNC_OFFSET(16895, glColorTable, glColorTable, NULL, 339),
-    NAME_FUNC_OFFSET(16911, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
-    NAME_FUNC_OFFSET(16938, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
-    NAME_FUNC_OFFSET(16965, glCopyColorTable, glCopyColorTable, NULL, 342),
-    NAME_FUNC_OFFSET(16985, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
-    NAME_FUNC_OFFSET(17004, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
-    NAME_FUNC_OFFSET(17023, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
-    NAME_FUNC_OFFSET(17053, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
-    NAME_FUNC_OFFSET(17083, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
-    NAME_FUNC_OFFSET(17113, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
-    NAME_FUNC_OFFSET(17143, glColorSubTable, glColorSubTable, NULL, 346),
-    NAME_FUNC_OFFSET(17162, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
-    NAME_FUNC_OFFSET(17185, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
-    NAME_FUNC_OFFSET(17210, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
-    NAME_FUNC_OFFSET(17235, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
-    NAME_FUNC_OFFSET(17262, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
-    NAME_FUNC_OFFSET(17290, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
-    NAME_FUNC_OFFSET(17317, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
-    NAME_FUNC_OFFSET(17345, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
-    NAME_FUNC_OFFSET(17374, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
-    NAME_FUNC_OFFSET(17403, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, 356),
-    NAME_FUNC_OFFSET(17429, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, 357),
-    NAME_FUNC_OFFSET(17460, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, 358),
-    NAME_FUNC_OFFSET(17491, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, 359),
-    NAME_FUNC_OFFSET(17515, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
-    NAME_FUNC_OFFSET(17538, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, 361),
-    NAME_FUNC_OFFSET(17556, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, 362),
-    NAME_FUNC_OFFSET(17585, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, 363),
-    NAME_FUNC_OFFSET(17614, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, 364),
-    NAME_FUNC_OFFSET(17629, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, 365),
-    NAME_FUNC_OFFSET(17655, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, 366),
-    NAME_FUNC_OFFSET(17681, glHistogram, glHistogram, NULL, 367),
-    NAME_FUNC_OFFSET(17696, glMinmax, glMinmax, NULL, 368),
-    NAME_FUNC_OFFSET(17708, glResetHistogram, glResetHistogram, NULL, 369),
-    NAME_FUNC_OFFSET(17728, glResetMinmax, glResetMinmax, NULL, 370),
-    NAME_FUNC_OFFSET(17745, glTexImage3D, glTexImage3D, NULL, 371),
-    NAME_FUNC_OFFSET(17761, glTexSubImage3D, glTexSubImage3D, NULL, 372),
-    NAME_FUNC_OFFSET(17780, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
-    NAME_FUNC_OFFSET(17803, glActiveTextureARB, glActiveTextureARB, NULL, 374),
-    NAME_FUNC_OFFSET(17819, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
-    NAME_FUNC_OFFSET(17841, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
-    NAME_FUNC_OFFSET(17859, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
-    NAME_FUNC_OFFSET(17878, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
-    NAME_FUNC_OFFSET(17896, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
-    NAME_FUNC_OFFSET(17915, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
-    NAME_FUNC_OFFSET(17933, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
-    NAME_FUNC_OFFSET(17952, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
-    NAME_FUNC_OFFSET(17970, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
-    NAME_FUNC_OFFSET(17989, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
-    NAME_FUNC_OFFSET(18007, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
-    NAME_FUNC_OFFSET(18026, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
-    NAME_FUNC_OFFSET(18044, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
-    NAME_FUNC_OFFSET(18063, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
-    NAME_FUNC_OFFSET(18081, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
-    NAME_FUNC_OFFSET(18100, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
-    NAME_FUNC_OFFSET(18118, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
-    NAME_FUNC_OFFSET(18137, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
-    NAME_FUNC_OFFSET(18155, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
-    NAME_FUNC_OFFSET(18174, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
-    NAME_FUNC_OFFSET(18192, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
-    NAME_FUNC_OFFSET(18211, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
-    NAME_FUNC_OFFSET(18229, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
-    NAME_FUNC_OFFSET(18248, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
-    NAME_FUNC_OFFSET(18266, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
-    NAME_FUNC_OFFSET(18285, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
-    NAME_FUNC_OFFSET(18303, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
-    NAME_FUNC_OFFSET(18322, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
-    NAME_FUNC_OFFSET(18340, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
-    NAME_FUNC_OFFSET(18359, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
-    NAME_FUNC_OFFSET(18377, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
-    NAME_FUNC_OFFSET(18396, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
-    NAME_FUNC_OFFSET(18414, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
-    NAME_FUNC_OFFSET(18433, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
-    NAME_FUNC_OFFSET(18456, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
-    NAME_FUNC_OFFSET(18479, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
-    NAME_FUNC_OFFSET(18502, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
-    NAME_FUNC_OFFSET(18525, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
-    NAME_FUNC_OFFSET(18548, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
-    NAME_FUNC_OFFSET(18565, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
-    NAME_FUNC_OFFSET(18588, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
-    NAME_FUNC_OFFSET(18611, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
-    NAME_FUNC_OFFSET(18634, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
-    NAME_FUNC_OFFSET(18660, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
-    NAME_FUNC_OFFSET(18686, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
-    NAME_FUNC_OFFSET(18712, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
-    NAME_FUNC_OFFSET(18736, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
-    NAME_FUNC_OFFSET(18763, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
-    NAME_FUNC_OFFSET(18789, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
-    NAME_FUNC_OFFSET(18809, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
-    NAME_FUNC_OFFSET(18829, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
-    NAME_FUNC_OFFSET(18849, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
-    NAME_FUNC_OFFSET(18872, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
-    NAME_FUNC_OFFSET(18896, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
-    NAME_FUNC_OFFSET(18919, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
-    NAME_FUNC_OFFSET(18943, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
-    NAME_FUNC_OFFSET(18960, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
-    NAME_FUNC_OFFSET(18978, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
-    NAME_FUNC_OFFSET(18995, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
-    NAME_FUNC_OFFSET(19013, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
-    NAME_FUNC_OFFSET(19030, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
-    NAME_FUNC_OFFSET(19048, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
-    NAME_FUNC_OFFSET(19065, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
-    NAME_FUNC_OFFSET(19083, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
-    NAME_FUNC_OFFSET(19100, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
-    NAME_FUNC_OFFSET(19118, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
-    NAME_FUNC_OFFSET(19135, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
-    NAME_FUNC_OFFSET(19153, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
-    NAME_FUNC_OFFSET(19170, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
-    NAME_FUNC_OFFSET(19188, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
-    NAME_FUNC_OFFSET(19205, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
-    NAME_FUNC_OFFSET(19223, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
-    NAME_FUNC_OFFSET(19240, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
-    NAME_FUNC_OFFSET(19258, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
-    NAME_FUNC_OFFSET(19277, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
-    NAME_FUNC_OFFSET(19296, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
-    NAME_FUNC_OFFSET(19315, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
-    NAME_FUNC_OFFSET(19334, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
-    NAME_FUNC_OFFSET(19354, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
-    NAME_FUNC_OFFSET(19374, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
-    NAME_FUNC_OFFSET(19394, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
-    NAME_FUNC_OFFSET(19412, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
-    NAME_FUNC_OFFSET(19429, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
-    NAME_FUNC_OFFSET(19447, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
-    NAME_FUNC_OFFSET(19464, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
-    NAME_FUNC_OFFSET(19482, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
-    NAME_FUNC_OFFSET(19500, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
-    NAME_FUNC_OFFSET(19517, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
-    NAME_FUNC_OFFSET(19535, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
-    NAME_FUNC_OFFSET(19554, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
-    NAME_FUNC_OFFSET(19573, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
-    NAME_FUNC_OFFSET(19592, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
-    NAME_FUNC_OFFSET(19614, glBindBufferARB, glBindBufferARB, NULL, 510),
-    NAME_FUNC_OFFSET(19627, glBufferDataARB, glBufferDataARB, NULL, 511),
-    NAME_FUNC_OFFSET(19640, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
-    NAME_FUNC_OFFSET(19656, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
-    NAME_FUNC_OFFSET(19672, glGenBuffersARB, glGenBuffersARB, NULL, 514),
-    NAME_FUNC_OFFSET(19685, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
-    NAME_FUNC_OFFSET(19708, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
-    NAME_FUNC_OFFSET(19728, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
-    NAME_FUNC_OFFSET(19747, glIsBufferARB, glIsBufferARB, NULL, 518),
-    NAME_FUNC_OFFSET(19758, glMapBufferARB, glMapBufferARB, NULL, 519),
-    NAME_FUNC_OFFSET(19770, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
-    NAME_FUNC_OFFSET(19784, glBeginQueryARB, glBeginQueryARB, NULL, 521),
-    NAME_FUNC_OFFSET(19797, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
-    NAME_FUNC_OFFSET(19813, glEndQueryARB, glEndQueryARB, NULL, 523),
-    NAME_FUNC_OFFSET(19824, glGenQueriesARB, glGenQueriesARB, NULL, 524),
-    NAME_FUNC_OFFSET(19837, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
-    NAME_FUNC_OFFSET(19856, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
-    NAME_FUNC_OFFSET(19876, glGetQueryivARB, glGetQueryivARB, NULL, 527),
-    NAME_FUNC_OFFSET(19889, glIsQueryARB, glIsQueryARB, NULL, 528),
-    NAME_FUNC_OFFSET(19899, glCompileShaderARB, glCompileShaderARB, NULL, 530),
-    NAME_FUNC_OFFSET(19915, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
-    NAME_FUNC_OFFSET(19934, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
-    NAME_FUNC_OFFSET(19952, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
-    NAME_FUNC_OFFSET(19973, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
-    NAME_FUNC_OFFSET(19988, glGetUniformivARB, glGetUniformivARB, NULL, 544),
-    NAME_FUNC_OFFSET(20003, glLinkProgramARB, glLinkProgramARB, NULL, 545),
-    NAME_FUNC_OFFSET(20017, glShaderSourceARB, glShaderSourceARB, NULL, 546),
-    NAME_FUNC_OFFSET(20032, glUniform1fARB, glUniform1fARB, NULL, 547),
-    NAME_FUNC_OFFSET(20044, glUniform1fvARB, glUniform1fvARB, NULL, 548),
-    NAME_FUNC_OFFSET(20057, glUniform1iARB, glUniform1iARB, NULL, 549),
-    NAME_FUNC_OFFSET(20069, glUniform1ivARB, glUniform1ivARB, NULL, 550),
-    NAME_FUNC_OFFSET(20082, glUniform2fARB, glUniform2fARB, NULL, 551),
-    NAME_FUNC_OFFSET(20094, glUniform2fvARB, glUniform2fvARB, NULL, 552),
-    NAME_FUNC_OFFSET(20107, glUniform2iARB, glUniform2iARB, NULL, 553),
-    NAME_FUNC_OFFSET(20119, glUniform2ivARB, glUniform2ivARB, NULL, 554),
-    NAME_FUNC_OFFSET(20132, glUniform3fARB, glUniform3fARB, NULL, 555),
-    NAME_FUNC_OFFSET(20144, glUniform3fvARB, glUniform3fvARB, NULL, 556),
-    NAME_FUNC_OFFSET(20157, glUniform3iARB, glUniform3iARB, NULL, 557),
-    NAME_FUNC_OFFSET(20169, glUniform3ivARB, glUniform3ivARB, NULL, 558),
-    NAME_FUNC_OFFSET(20182, glUniform4fARB, glUniform4fARB, NULL, 559),
-    NAME_FUNC_OFFSET(20194, glUniform4fvARB, glUniform4fvARB, NULL, 560),
-    NAME_FUNC_OFFSET(20207, glUniform4iARB, glUniform4iARB, NULL, 561),
-    NAME_FUNC_OFFSET(20219, glUniform4ivARB, glUniform4ivARB, NULL, 562),
-    NAME_FUNC_OFFSET(20232, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
-    NAME_FUNC_OFFSET(20251, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
-    NAME_FUNC_OFFSET(20270, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
-    NAME_FUNC_OFFSET(20289, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
-    NAME_FUNC_OFFSET(20302, glValidateProgramARB, glValidateProgramARB, NULL, 567),
-    NAME_FUNC_OFFSET(20320, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
-    NAME_FUNC_OFFSET(20341, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
-    NAME_FUNC_OFFSET(20359, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
-    NAME_FUNC_OFFSET(20379, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(20393, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(20410, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
-    NAME_FUNC_OFFSET(20435, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
-    NAME_FUNC_OFFSET(20457, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
-    NAME_FUNC_OFFSET(20484, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
-    NAME_FUNC_OFFSET(20508, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 575),
-    NAME_FUNC_OFFSET(20544, gl_dispatch_stub_633, gl_dispatch_stub_633, NULL, 633),
-    NAME_FUNC_OFFSET(20560, gl_dispatch_stub_634, gl_dispatch_stub_634, NULL, 634),
-    NAME_FUNC_OFFSET(20579, glPointParameterfEXT, glPointParameterfEXT, NULL, 641),
-    NAME_FUNC_OFFSET(20597, glPointParameterfEXT, glPointParameterfEXT, NULL, 641),
-    NAME_FUNC_OFFSET(20618, glPointParameterfEXT, glPointParameterfEXT, NULL, 641),
-    NAME_FUNC_OFFSET(20640, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 642),
-    NAME_FUNC_OFFSET(20659, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 642),
-    NAME_FUNC_OFFSET(20681, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 642),
-    NAME_FUNC_OFFSET(20704, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 645),
-    NAME_FUNC_OFFSET(20723, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 646),
-    NAME_FUNC_OFFSET(20743, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 647),
-    NAME_FUNC_OFFSET(20762, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 648),
-    NAME_FUNC_OFFSET(20782, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 649),
-    NAME_FUNC_OFFSET(20801, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 650),
-    NAME_FUNC_OFFSET(20821, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 651),
-    NAME_FUNC_OFFSET(20840, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 652),
-    NAME_FUNC_OFFSET(20860, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 653),
-    NAME_FUNC_OFFSET(20879, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 654),
-    NAME_FUNC_OFFSET(20899, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 655),
-    NAME_FUNC_OFFSET(20919, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 656),
-    NAME_FUNC_OFFSET(20940, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 657),
-    NAME_FUNC_OFFSET(20960, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 658),
-    NAME_FUNC_OFFSET(20981, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 659),
-    NAME_FUNC_OFFSET(21001, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 660),
-    NAME_FUNC_OFFSET(21022, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 661),
-    NAME_FUNC_OFFSET(21046, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 662),
-    NAME_FUNC_OFFSET(21064, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 663),
-    NAME_FUNC_OFFSET(21084, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 664),
-    NAME_FUNC_OFFSET(21102, glFogCoorddEXT, glFogCoorddEXT, NULL, 665),
-    NAME_FUNC_OFFSET(21114, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 666),
-    NAME_FUNC_OFFSET(21127, glFogCoordfEXT, glFogCoordfEXT, NULL, 667),
-    NAME_FUNC_OFFSET(21139, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 668),
-    NAME_FUNC_OFFSET(21152, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 670),
-    NAME_FUNC_OFFSET(21172, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 670),
-    NAME_FUNC_OFFSET(21196, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 687),
-    NAME_FUNC_OFFSET(21210, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 687),
-    NAME_FUNC_OFFSET(21227, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 688),
-    NAME_FUNC_OFFSET(21242, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 688),
-    NAME_FUNC_OFFSET(21260, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 689),
-    NAME_FUNC_OFFSET(21274, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 689),
-    NAME_FUNC_OFFSET(21291, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 690),
-    NAME_FUNC_OFFSET(21306, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 690),
-    NAME_FUNC_OFFSET(21324, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 691),
-    NAME_FUNC_OFFSET(21338, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 691),
-    NAME_FUNC_OFFSET(21355, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 692),
-    NAME_FUNC_OFFSET(21370, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 692),
-    NAME_FUNC_OFFSET(21388, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 693),
-    NAME_FUNC_OFFSET(21402, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 693),
-    NAME_FUNC_OFFSET(21419, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 694),
-    NAME_FUNC_OFFSET(21434, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 694),
-    NAME_FUNC_OFFSET(21452, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 695),
-    NAME_FUNC_OFFSET(21466, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 695),
-    NAME_FUNC_OFFSET(21483, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 696),
-    NAME_FUNC_OFFSET(21498, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 696),
-    NAME_FUNC_OFFSET(21516, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 697),
-    NAME_FUNC_OFFSET(21530, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 697),
-    NAME_FUNC_OFFSET(21547, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 698),
-    NAME_FUNC_OFFSET(21562, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 698),
-    NAME_FUNC_OFFSET(21580, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 699),
-    NAME_FUNC_OFFSET(21594, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 699),
-    NAME_FUNC_OFFSET(21611, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 700),
-    NAME_FUNC_OFFSET(21626, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 700),
-    NAME_FUNC_OFFSET(21644, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 701),
-    NAME_FUNC_OFFSET(21658, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 701),
-    NAME_FUNC_OFFSET(21675, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 702),
-    NAME_FUNC_OFFSET(21690, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 702),
-    NAME_FUNC_OFFSET(21708, glBindProgramNV, glBindProgramNV, NULL, 721),
-    NAME_FUNC_OFFSET(21725, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 722),
-    NAME_FUNC_OFFSET(21745, glGenProgramsNV, glGenProgramsNV, NULL, 724),
-    NAME_FUNC_OFFSET(21762, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 730),
-    NAME_FUNC_OFFSET(21788, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 730),
-    NAME_FUNC_OFFSET(21817, glIsProgramNV, glIsProgramNV, NULL, 734),
-    NAME_FUNC_OFFSET(21832, glPointParameteriNV, glPointParameteriNV, NULL, 798),
-    NAME_FUNC_OFFSET(21850, glPointParameterivNV, glPointParameterivNV, NULL, 799),
-    NAME_FUNC_OFFSET(21869, gl_dispatch_stub_802, gl_dispatch_stub_802, NULL, 802),
-    NAME_FUNC_OFFSET(21890, gl_dispatch_stub_804, gl_dispatch_stub_804, NULL, 804),
-    NAME_FUNC_OFFSET(21906, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 811),
-    NAME_FUNC_OFFSET(21930, gl_dispatch_stub_814, gl_dispatch_stub_814, NULL, 814),
-    NAME_FUNC_OFFSET(21954, gl_dispatch_stub_814, gl_dispatch_stub_814, NULL, 814),
-    NAME_FUNC_OFFSET(21981, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 815),
-    NAME_FUNC_OFFSET(21999, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 816),
-    NAME_FUNC_OFFSET(22018, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 817),
-    NAME_FUNC_OFFSET(22043, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 818),
-    NAME_FUNC_OFFSET(22064, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 819),
-    NAME_FUNC_OFFSET(22086, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 820),
-    NAME_FUNC_OFFSET(22112, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 821),
-    NAME_FUNC_OFFSET(22135, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 822),
-    NAME_FUNC_OFFSET(22158, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 823),
-    NAME_FUNC_OFFSET(22181, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 824),
-    NAME_FUNC_OFFSET(22199, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 825),
-    NAME_FUNC_OFFSET(22218, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 826),
-    NAME_FUNC_OFFSET(22235, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 827),
-    NAME_FUNC_OFFSET(22273, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 828),
-    NAME_FUNC_OFFSET(22302, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 829),
-    NAME_FUNC_OFFSET(22318, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 830),
-    NAME_FUNC_OFFSET(22335, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 831),
-    NAME_FUNC_OFFSET(22357, gl_dispatch_stub_832, gl_dispatch_stub_832, NULL, 832),
-    NAME_FUNC_OFFSET(22375, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 835),
-    NAME_FUNC_OFFSET(22398, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 836),
-    NAME_FUNC_OFFSET(22420, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 837),
-    NAME_FUNC_OFFSET(22436, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 838),
-    NAME_FUNC_OFFSET(22457, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 839),
-    NAME_FUNC_OFFSET(22479, glUniform1uiEXT, glUniform1uiEXT, NULL, 840),
-    NAME_FUNC_OFFSET(22492, glUniform1uivEXT, glUniform1uivEXT, NULL, 841),
-    NAME_FUNC_OFFSET(22506, glUniform2uiEXT, glUniform2uiEXT, NULL, 842),
-    NAME_FUNC_OFFSET(22519, glUniform2uivEXT, glUniform2uivEXT, NULL, 843),
-    NAME_FUNC_OFFSET(22533, glUniform3uiEXT, glUniform3uiEXT, NULL, 844),
-    NAME_FUNC_OFFSET(22546, glUniform3uivEXT, glUniform3uivEXT, NULL, 845),
-    NAME_FUNC_OFFSET(22560, glUniform4uiEXT, glUniform4uiEXT, NULL, 846),
-    NAME_FUNC_OFFSET(22573, glUniform4uivEXT, glUniform4uivEXT, NULL, 847),
-    NAME_FUNC_OFFSET(22587, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 848),
-    NAME_FUNC_OFFSET(22605, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 849),
-    NAME_FUNC_OFFSET(22624, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 850),
-    NAME_FUNC_OFFSET(22643, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 851),
-    NAME_FUNC_OFFSET(22663, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 852),
-    NAME_FUNC_OFFSET(22681, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 853),
-    NAME_FUNC_OFFSET(22700, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 854),
-    NAME_FUNC_OFFSET(22719, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 855),
-    NAME_FUNC_OFFSET(22739, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 856),
-    NAME_FUNC_OFFSET(22757, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 857),
-    NAME_FUNC_OFFSET(22776, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 858),
-    NAME_FUNC_OFFSET(22795, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 859),
-    NAME_FUNC_OFFSET(22815, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 860),
-    NAME_FUNC_OFFSET(22834, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 861),
-    NAME_FUNC_OFFSET(22852, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 862),
-    NAME_FUNC_OFFSET(22871, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 863),
-    NAME_FUNC_OFFSET(22890, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 864),
-    NAME_FUNC_OFFSET(22910, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 865),
-    NAME_FUNC_OFFSET(22929, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 866),
-    NAME_FUNC_OFFSET(22949, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 867),
-    NAME_FUNC_OFFSET(22969, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 868),
-    NAME_FUNC_OFFSET(22992, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 869),
-    NAME_FUNC_OFFSET(23018, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 870),
-    NAME_FUNC_OFFSET(23031, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 871),
-    NAME_FUNC_OFFSET(23042, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 872),
-    NAME_FUNC_OFFSET(23052, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 873),
-    NAME_FUNC_OFFSET(23068, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 874),
-    NAME_FUNC_OFFSET(23084, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 875),
-    NAME_FUNC_OFFSET(23097, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 878),
-    NAME_FUNC_OFFSET(23118, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 879),
-    NAME_FUNC_OFFSET(23140, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 880),
-    NAME_FUNC_OFFSET(23158, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 881),
-    NAME_FUNC_OFFSET(23177, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 882),
-    NAME_FUNC_OFFSET(23202, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 883),
-    NAME_FUNC_OFFSET(23225, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 884),
-    NAME_FUNC_OFFSET(23250, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 885),
-    NAME_FUNC_OFFSET(23267, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 887),
-    NAME_FUNC_OFFSET(23285, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 888),
-    NAME_FUNC_OFFSET(23308, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 889),
-    NAME_FUNC_OFFSET(23338, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 890),
-    NAME_FUNC_OFFSET(23366, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 891),
+    NAME_FUNC_OFFSET(10266, glGetGraphicsResetStatusARB, glGetGraphicsResetStatusARB, NULL, 626),
+    NAME_FUNC_OFFSET(10294, glGetnColorTableARB, glGetnColorTableARB, NULL, 627),
+    NAME_FUNC_OFFSET(10314, glGetnCompressedTexImageARB, glGetnCompressedTexImageARB, NULL, 628),
+    NAME_FUNC_OFFSET(10342, glGetnConvolutionFilterARB, glGetnConvolutionFilterARB, NULL, 629),
+    NAME_FUNC_OFFSET(10369, glGetnHistogramARB, glGetnHistogramARB, NULL, 630),
+    NAME_FUNC_OFFSET(10388, glGetnMapdvARB, glGetnMapdvARB, NULL, 631),
+    NAME_FUNC_OFFSET(10403, glGetnMapfvARB, glGetnMapfvARB, NULL, 632),
+    NAME_FUNC_OFFSET(10418, glGetnMapivARB, glGetnMapivARB, NULL, 633),
+    NAME_FUNC_OFFSET(10433, glGetnMinmaxARB, glGetnMinmaxARB, NULL, 634),
+    NAME_FUNC_OFFSET(10449, glGetnPixelMapfvARB, glGetnPixelMapfvARB, NULL, 635),
+    NAME_FUNC_OFFSET(10469, glGetnPixelMapuivARB, glGetnPixelMapuivARB, NULL, 636),
+    NAME_FUNC_OFFSET(10490, glGetnPixelMapusvARB, glGetnPixelMapusvARB, NULL, 637),
+    NAME_FUNC_OFFSET(10511, glGetnPolygonStippleARB, glGetnPolygonStippleARB, NULL, 638),
+    NAME_FUNC_OFFSET(10535, glGetnSeparableFilterARB, glGetnSeparableFilterARB, NULL, 639),
+    NAME_FUNC_OFFSET(10560, glGetnTexImageARB, glGetnTexImageARB, NULL, 640),
+    NAME_FUNC_OFFSET(10578, glGetnUniformdvARB, glGetnUniformdvARB, NULL, 641),
+    NAME_FUNC_OFFSET(10597, glGetnUniformfvARB, glGetnUniformfvARB, NULL, 642),
+    NAME_FUNC_OFFSET(10616, glGetnUniformivARB, glGetnUniformivARB, NULL, 643),
+    NAME_FUNC_OFFSET(10635, glGetnUniformuivARB, glGetnUniformuivARB, NULL, 644),
+    NAME_FUNC_OFFSET(10655, glReadnPixelsARB, glReadnPixelsARB, NULL, 645),
+    NAME_FUNC_OFFSET(10672, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 646),
+    NAME_FUNC_OFFSET(10691, gl_dispatch_stub_647, gl_dispatch_stub_647, NULL, 647),
+    NAME_FUNC_OFFSET(10723, gl_dispatch_stub_648, gl_dispatch_stub_648, NULL, 648),
+    NAME_FUNC_OFFSET(10755, gl_dispatch_stub_649, gl_dispatch_stub_649, NULL, 649),
+    NAME_FUNC_OFFSET(10783, gl_dispatch_stub_650, gl_dispatch_stub_650, NULL, 650),
+    NAME_FUNC_OFFSET(10812, gl_dispatch_stub_651, gl_dispatch_stub_651, NULL, 651),
+    NAME_FUNC_OFFSET(10840, gl_dispatch_stub_652, gl_dispatch_stub_652, NULL, 652),
+    NAME_FUNC_OFFSET(10869, gl_dispatch_stub_653, gl_dispatch_stub_653, NULL, 653),
+    NAME_FUNC_OFFSET(10886, gl_dispatch_stub_654, gl_dispatch_stub_654, NULL, 654),
+    NAME_FUNC_OFFSET(10906, glColorPointerEXT, glColorPointerEXT, NULL, 655),
+    NAME_FUNC_OFFSET(10924, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, 656),
+    NAME_FUNC_OFFSET(10945, glIndexPointerEXT, glIndexPointerEXT, NULL, 657),
+    NAME_FUNC_OFFSET(10963, glNormalPointerEXT, glNormalPointerEXT, NULL, 658),
+    NAME_FUNC_OFFSET(10982, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, 659),
+    NAME_FUNC_OFFSET(11003, glVertexPointerEXT, glVertexPointerEXT, NULL, 660),
+    NAME_FUNC_OFFSET(11022, glPointParameterfEXT, glPointParameterfEXT, NULL, 661),
+    NAME_FUNC_OFFSET(11043, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 662),
+    NAME_FUNC_OFFSET(11065, glLockArraysEXT, glLockArraysEXT, NULL, 663),
+    NAME_FUNC_OFFSET(11081, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 664),
+    NAME_FUNC_OFFSET(11099, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 665),
+    NAME_FUNC_OFFSET(11121, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 666),
+    NAME_FUNC_OFFSET(11144, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 667),
+    NAME_FUNC_OFFSET(11166, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 668),
+    NAME_FUNC_OFFSET(11189, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 669),
+    NAME_FUNC_OFFSET(11211, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 670),
+    NAME_FUNC_OFFSET(11234, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 671),
+    NAME_FUNC_OFFSET(11256, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 672),
+    NAME_FUNC_OFFSET(11279, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 673),
+    NAME_FUNC_OFFSET(11301, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 674),
+    NAME_FUNC_OFFSET(11324, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 675),
+    NAME_FUNC_OFFSET(11347, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 676),
+    NAME_FUNC_OFFSET(11371, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 677),
+    NAME_FUNC_OFFSET(11394, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 678),
+    NAME_FUNC_OFFSET(11418, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 679),
+    NAME_FUNC_OFFSET(11441, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 680),
+    NAME_FUNC_OFFSET(11465, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 681),
+    NAME_FUNC_OFFSET(11492, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 682),
+    NAME_FUNC_OFFSET(11513, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 683),
+    NAME_FUNC_OFFSET(11536, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 684),
+    NAME_FUNC_OFFSET(11557, glFogCoorddEXT, glFogCoorddEXT, NULL, 685),
+    NAME_FUNC_OFFSET(11572, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 686),
+    NAME_FUNC_OFFSET(11588, glFogCoordfEXT, glFogCoordfEXT, NULL, 687),
+    NAME_FUNC_OFFSET(11603, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 688),
+    NAME_FUNC_OFFSET(11619, gl_dispatch_stub_689, gl_dispatch_stub_689, NULL, 689),
+    NAME_FUNC_OFFSET(11637, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 690),
+    NAME_FUNC_OFFSET(11660, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, 691),
+    NAME_FUNC_OFFSET(11686, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, 692),
+    NAME_FUNC_OFFSET(11707, glCombinerInputNV, glCombinerInputNV, NULL, 693),
+    NAME_FUNC_OFFSET(11725, glCombinerOutputNV, glCombinerOutputNV, NULL, 694),
+    NAME_FUNC_OFFSET(11744, glCombinerParameterfNV, glCombinerParameterfNV, NULL, 695),
+    NAME_FUNC_OFFSET(11767, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, 696),
+    NAME_FUNC_OFFSET(11791, glCombinerParameteriNV, glCombinerParameteriNV, NULL, 697),
+    NAME_FUNC_OFFSET(11814, glCombinerParameterivNV, glCombinerParameterivNV, NULL, 698),
+    NAME_FUNC_OFFSET(11838, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, 699),
+    NAME_FUNC_OFFSET(11861, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, 700),
+    NAME_FUNC_OFFSET(11893, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, 701),
+    NAME_FUNC_OFFSET(11925, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, 702),
+    NAME_FUNC_OFFSET(11958, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, 703),
+    NAME_FUNC_OFFSET(11991, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, 704),
+    NAME_FUNC_OFFSET(12028, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, 705),
+    NAME_FUNC_OFFSET(12065, glResizeBuffersMESA, glResizeBuffersMESA, NULL, 706),
+    NAME_FUNC_OFFSET(12085, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 707),
+    NAME_FUNC_OFFSET(12103, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 708),
+    NAME_FUNC_OFFSET(12122, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 709),
+    NAME_FUNC_OFFSET(12140, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 710),
+    NAME_FUNC_OFFSET(12159, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 711),
+    NAME_FUNC_OFFSET(12177, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 712),
+    NAME_FUNC_OFFSET(12196, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 713),
+    NAME_FUNC_OFFSET(12214, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 714),
+    NAME_FUNC_OFFSET(12233, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 715),
+    NAME_FUNC_OFFSET(12251, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 716),
+    NAME_FUNC_OFFSET(12270, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 717),
+    NAME_FUNC_OFFSET(12288, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 718),
+    NAME_FUNC_OFFSET(12307, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 719),
+    NAME_FUNC_OFFSET(12325, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 720),
+    NAME_FUNC_OFFSET(12344, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 721),
+    NAME_FUNC_OFFSET(12362, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 722),
+    NAME_FUNC_OFFSET(12381, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 723),
+    NAME_FUNC_OFFSET(12399, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 724),
+    NAME_FUNC_OFFSET(12418, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 725),
+    NAME_FUNC_OFFSET(12436, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 726),
+    NAME_FUNC_OFFSET(12455, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 727),
+    NAME_FUNC_OFFSET(12473, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 728),
+    NAME_FUNC_OFFSET(12492, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 729),
+    NAME_FUNC_OFFSET(12510, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 730),
+    NAME_FUNC_OFFSET(12529, gl_dispatch_stub_731, gl_dispatch_stub_731, NULL, 731),
+    NAME_FUNC_OFFSET(12554, gl_dispatch_stub_732, gl_dispatch_stub_732, NULL, 732),
+    NAME_FUNC_OFFSET(12581, gl_dispatch_stub_733, gl_dispatch_stub_733, NULL, 733),
+    NAME_FUNC_OFFSET(12598, gl_dispatch_stub_734, gl_dispatch_stub_734, NULL, 734),
+    NAME_FUNC_OFFSET(12614, gl_dispatch_stub_735, gl_dispatch_stub_735, NULL, 735),
+    NAME_FUNC_OFFSET(12628, gl_dispatch_stub_736, gl_dispatch_stub_736, NULL, 736),
+    NAME_FUNC_OFFSET(12643, gl_dispatch_stub_737, gl_dispatch_stub_737, NULL, 737),
+    NAME_FUNC_OFFSET(12655, gl_dispatch_stub_738, gl_dispatch_stub_738, NULL, 738),
+    NAME_FUNC_OFFSET(12668, gl_dispatch_stub_739, gl_dispatch_stub_739, NULL, 739),
+    NAME_FUNC_OFFSET(12682, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, 740),
+    NAME_FUNC_OFFSET(12706, glBindProgramNV, glBindProgramNV, NULL, 741),
+    NAME_FUNC_OFFSET(12722, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 742),
+    NAME_FUNC_OFFSET(12741, glExecuteProgramNV, glExecuteProgramNV, NULL, 743),
+    NAME_FUNC_OFFSET(12760, glGenProgramsNV, glGenProgramsNV, NULL, 744),
+    NAME_FUNC_OFFSET(12776, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, 745),
+    NAME_FUNC_OFFSET(12802, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, 746),
+    NAME_FUNC_OFFSET(12828, glGetProgramStringNV, glGetProgramStringNV, NULL, 747),
+    NAME_FUNC_OFFSET(12849, glGetProgramivNV, glGetProgramivNV, NULL, 748),
+    NAME_FUNC_OFFSET(12866, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, 749),
+    NAME_FUNC_OFFSET(12887, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 750),
+    NAME_FUNC_OFFSET(12915, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, 751),
+    NAME_FUNC_OFFSET(12937, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, 752),
+    NAME_FUNC_OFFSET(12959, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, 753),
+    NAME_FUNC_OFFSET(12981, glIsProgramNV, glIsProgramNV, NULL, 754),
+    NAME_FUNC_OFFSET(12995, glLoadProgramNV, glLoadProgramNV, NULL, 755),
+    NAME_FUNC_OFFSET(13011, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, 756),
+    NAME_FUNC_OFFSET(13036, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, 757),
+    NAME_FUNC_OFFSET(13061, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, 758),
+    NAME_FUNC_OFFSET(13089, glTrackMatrixNV, glTrackMatrixNV, NULL, 759),
+    NAME_FUNC_OFFSET(13105, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 760),
+    NAME_FUNC_OFFSET(13124, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, 761),
+    NAME_FUNC_OFFSET(13144, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 762),
+    NAME_FUNC_OFFSET(13163, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, 763),
+    NAME_FUNC_OFFSET(13183, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 764),
+    NAME_FUNC_OFFSET(13202, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, 765),
+    NAME_FUNC_OFFSET(13222, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 766),
+    NAME_FUNC_OFFSET(13241, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, 767),
+    NAME_FUNC_OFFSET(13261, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 768),
+    NAME_FUNC_OFFSET(13280, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, 769),
+    NAME_FUNC_OFFSET(13300, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 770),
+    NAME_FUNC_OFFSET(13319, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, 771),
+    NAME_FUNC_OFFSET(13339, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 772),
+    NAME_FUNC_OFFSET(13358, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, 773),
+    NAME_FUNC_OFFSET(13378, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 774),
+    NAME_FUNC_OFFSET(13397, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, 775),
+    NAME_FUNC_OFFSET(13417, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 776),
+    NAME_FUNC_OFFSET(13436, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, 777),
+    NAME_FUNC_OFFSET(13456, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 778),
+    NAME_FUNC_OFFSET(13475, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, 779),
+    NAME_FUNC_OFFSET(13495, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 780),
+    NAME_FUNC_OFFSET(13514, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, 781),
+    NAME_FUNC_OFFSET(13534, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 782),
+    NAME_FUNC_OFFSET(13553, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, 783),
+    NAME_FUNC_OFFSET(13573, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, 784),
+    NAME_FUNC_OFFSET(13593, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, 785),
+    NAME_FUNC_OFFSET(13614, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, 786),
+    NAME_FUNC_OFFSET(13638, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, 787),
+    NAME_FUNC_OFFSET(13659, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, 788),
+    NAME_FUNC_OFFSET(13680, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, 789),
+    NAME_FUNC_OFFSET(13701, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, 790),
+    NAME_FUNC_OFFSET(13722, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, 791),
+    NAME_FUNC_OFFSET(13743, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, 792),
+    NAME_FUNC_OFFSET(13764, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, 793),
+    NAME_FUNC_OFFSET(13785, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, 794),
+    NAME_FUNC_OFFSET(13806, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, 795),
+    NAME_FUNC_OFFSET(13827, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, 796),
+    NAME_FUNC_OFFSET(13848, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, 797),
+    NAME_FUNC_OFFSET(13869, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, 798),
+    NAME_FUNC_OFFSET(13890, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, 799),
+    NAME_FUNC_OFFSET(13912, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, 800),
+    NAME_FUNC_OFFSET(13939, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, 801),
+    NAME_FUNC_OFFSET(13966, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, 802),
+    NAME_FUNC_OFFSET(13990, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, 803),
+    NAME_FUNC_OFFSET(14014, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, 804),
+    NAME_FUNC_OFFSET(14036, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, 805),
+    NAME_FUNC_OFFSET(14058, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, 806),
+    NAME_FUNC_OFFSET(14080, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, 807),
+    NAME_FUNC_OFFSET(14105, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, 808),
+    NAME_FUNC_OFFSET(14129, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, 809),
+    NAME_FUNC_OFFSET(14151, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, 810),
+    NAME_FUNC_OFFSET(14173, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, 811),
+    NAME_FUNC_OFFSET(14195, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, 812),
+    NAME_FUNC_OFFSET(14221, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, 813),
+    NAME_FUNC_OFFSET(14244, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, 814),
+    NAME_FUNC_OFFSET(14268, glPassTexCoordATI, glPassTexCoordATI, NULL, 815),
+    NAME_FUNC_OFFSET(14286, glSampleMapATI, glSampleMapATI, NULL, 816),
+    NAME_FUNC_OFFSET(14301, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, 817),
+    NAME_FUNC_OFFSET(14332, glPointParameteriNV, glPointParameteriNV, NULL, 818),
+    NAME_FUNC_OFFSET(14352, glPointParameterivNV, glPointParameterivNV, NULL, 819),
+    NAME_FUNC_OFFSET(14373, gl_dispatch_stub_820, gl_dispatch_stub_820, NULL, 820),
+    NAME_FUNC_OFFSET(14396, gl_dispatch_stub_821, gl_dispatch_stub_821, NULL, 821),
+    NAME_FUNC_OFFSET(14419, gl_dispatch_stub_822, gl_dispatch_stub_822, NULL, 822),
+    NAME_FUNC_OFFSET(14445, gl_dispatch_stub_823, gl_dispatch_stub_823, NULL, 823),
+    NAME_FUNC_OFFSET(14468, gl_dispatch_stub_824, gl_dispatch_stub_824, NULL, 824),
+    NAME_FUNC_OFFSET(14489, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, 825),
+    NAME_FUNC_OFFSET(14520, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, 826),
+    NAME_FUNC_OFFSET(14551, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, 827),
+    NAME_FUNC_OFFSET(14579, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, 828),
+    NAME_FUNC_OFFSET(14608, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, 829),
+    NAME_FUNC_OFFSET(14636, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, 830),
+    NAME_FUNC_OFFSET(14665, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 831),
+    NAME_FUNC_OFFSET(14691, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL, 832),
+    NAME_FUNC_OFFSET(14712, gl_dispatch_stub_833, gl_dispatch_stub_833, NULL, 833),
+    NAME_FUNC_OFFSET(14729, gl_dispatch_stub_834, gl_dispatch_stub_834, NULL, 834),
+    NAME_FUNC_OFFSET(14756, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 835),
+    NAME_FUNC_OFFSET(14777, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 836),
+    NAME_FUNC_OFFSET(14799, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 837),
+    NAME_FUNC_OFFSET(14827, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 838),
+    NAME_FUNC_OFFSET(14851, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 839),
+    NAME_FUNC_OFFSET(14876, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 840),
+    NAME_FUNC_OFFSET(14905, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 841),
+    NAME_FUNC_OFFSET(14931, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 842),
+    NAME_FUNC_OFFSET(14957, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 843),
+    NAME_FUNC_OFFSET(14983, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 844),
+    NAME_FUNC_OFFSET(15004, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 845),
+    NAME_FUNC_OFFSET(15026, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 846),
+    NAME_FUNC_OFFSET(15046, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 847),
+    NAME_FUNC_OFFSET(15087, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 848),
+    NAME_FUNC_OFFSET(15119, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 849),
+    NAME_FUNC_OFFSET(15138, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 850),
+    NAME_FUNC_OFFSET(15158, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 851),
+    NAME_FUNC_OFFSET(15183, gl_dispatch_stub_852, gl_dispatch_stub_852, NULL, 852),
+    NAME_FUNC_OFFSET(15204, gl_dispatch_stub_853, gl_dispatch_stub_853, NULL, 853),
+    NAME_FUNC_OFFSET(15228, gl_dispatch_stub_854, gl_dispatch_stub_854, NULL, 854),
+    NAME_FUNC_OFFSET(15258, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 855),
+    NAME_FUNC_OFFSET(15284, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 856),
+    NAME_FUNC_OFFSET(15309, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 857),
+    NAME_FUNC_OFFSET(15328, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 858),
+    NAME_FUNC_OFFSET(15352, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 859),
+    NAME_FUNC_OFFSET(15377, glUniform1uiEXT, glUniform1uiEXT, NULL, 860),
+    NAME_FUNC_OFFSET(15393, glUniform1uivEXT, glUniform1uivEXT, NULL, 861),
+    NAME_FUNC_OFFSET(15410, glUniform2uiEXT, glUniform2uiEXT, NULL, 862),
+    NAME_FUNC_OFFSET(15426, glUniform2uivEXT, glUniform2uivEXT, NULL, 863),
+    NAME_FUNC_OFFSET(15443, glUniform3uiEXT, glUniform3uiEXT, NULL, 864),
+    NAME_FUNC_OFFSET(15459, glUniform3uivEXT, glUniform3uivEXT, NULL, 865),
+    NAME_FUNC_OFFSET(15476, glUniform4uiEXT, glUniform4uiEXT, NULL, 866),
+    NAME_FUNC_OFFSET(15492, glUniform4uivEXT, glUniform4uivEXT, NULL, 867),
+    NAME_FUNC_OFFSET(15509, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 868),
+    NAME_FUNC_OFFSET(15530, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 869),
+    NAME_FUNC_OFFSET(15552, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 870),
+    NAME_FUNC_OFFSET(15574, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 871),
+    NAME_FUNC_OFFSET(15597, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 872),
+    NAME_FUNC_OFFSET(15618, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 873),
+    NAME_FUNC_OFFSET(15640, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 874),
+    NAME_FUNC_OFFSET(15662, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 875),
+    NAME_FUNC_OFFSET(15685, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 876),
+    NAME_FUNC_OFFSET(15706, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 877),
+    NAME_FUNC_OFFSET(15728, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 878),
+    NAME_FUNC_OFFSET(15750, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 879),
+    NAME_FUNC_OFFSET(15773, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 880),
+    NAME_FUNC_OFFSET(15795, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 881),
+    NAME_FUNC_OFFSET(15816, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 882),
+    NAME_FUNC_OFFSET(15838, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 883),
+    NAME_FUNC_OFFSET(15860, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 884),
+    NAME_FUNC_OFFSET(15883, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 885),
+    NAME_FUNC_OFFSET(15905, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 886),
+    NAME_FUNC_OFFSET(15928, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 887),
+    NAME_FUNC_OFFSET(15951, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 888),
+    NAME_FUNC_OFFSET(15977, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 889),
+    NAME_FUNC_OFFSET(16006, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 890),
+    NAME_FUNC_OFFSET(16028, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 891),
+    NAME_FUNC_OFFSET(16048, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 892),
+    NAME_FUNC_OFFSET(16067, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 893),
+    NAME_FUNC_OFFSET(16091, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 894),
+    NAME_FUNC_OFFSET(16115, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 895),
+    NAME_FUNC_OFFSET(16137, glClearColorIiEXT, glClearColorIiEXT, NULL, 896),
+    NAME_FUNC_OFFSET(16155, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 897),
+    NAME_FUNC_OFFSET(16174, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 898),
+    NAME_FUNC_OFFSET(16198, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 899),
+    NAME_FUNC_OFFSET(16223, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 900),
+    NAME_FUNC_OFFSET(16244, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 901),
+    NAME_FUNC_OFFSET(16266, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 902),
+    NAME_FUNC_OFFSET(16293, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 903),
+    NAME_FUNC_OFFSET(16318, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 904),
+    NAME_FUNC_OFFSET(16346, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 905),
+    NAME_FUNC_OFFSET(16366, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, 906),
+    NAME_FUNC_OFFSET(16388, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 907),
+    NAME_FUNC_OFFSET(16409, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 908),
+    NAME_FUNC_OFFSET(16435, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 909),
+    NAME_FUNC_OFFSET(16468, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 910),
+    NAME_FUNC_OFFSET(16499, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 911),
+    NAME_FUNC_OFFSET(16520, gl_dispatch_stub_912, gl_dispatch_stub_912, NULL, 912),
+    NAME_FUNC_OFFSET(16551, gl_dispatch_stub_913, gl_dispatch_stub_913, NULL, 913),
+    NAME_FUNC_OFFSET(16571, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, 914),
+    NAME_FUNC_OFFSET(16599, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, 915),
+    NAME_FUNC_OFFSET(16622, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, 916),
+    NAME_FUNC_OFFSET(16647, glActiveProgramEXT, glActiveProgramEXT, NULL, 917),
+    NAME_FUNC_OFFSET(16666, glCreateShaderProgramEXT, glCreateShaderProgramEXT, NULL, 918),
+    NAME_FUNC_OFFSET(16691, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL, 919),
+    NAME_FUNC_OFFSET(16713, glTextureBarrierNV, glTextureBarrierNV, NULL, 920),
+    NAME_FUNC_OFFSET(16732, gl_dispatch_stub_921, gl_dispatch_stub_921, NULL, 921),
+    NAME_FUNC_OFFSET(16757, gl_dispatch_stub_922, gl_dispatch_stub_922, NULL, 922),
+    NAME_FUNC_OFFSET(16786, gl_dispatch_stub_923, gl_dispatch_stub_923, NULL, 923),
+    NAME_FUNC_OFFSET(16817, gl_dispatch_stub_924, gl_dispatch_stub_924, NULL, 924),
+    NAME_FUNC_OFFSET(16841, gl_dispatch_stub_925, gl_dispatch_stub_925, NULL, 925),
+    NAME_FUNC_OFFSET(16866, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, 926),
+    NAME_FUNC_OFFSET(16905, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, 927),
+    NAME_FUNC_OFFSET(16934, glArrayElement, glArrayElement, NULL, 306),
+    NAME_FUNC_OFFSET(16952, glBindTexture, glBindTexture, NULL, 307),
+    NAME_FUNC_OFFSET(16969, glDrawArrays, glDrawArrays, NULL, 310),
+    NAME_FUNC_OFFSET(16985, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, 322),
+    NAME_FUNC_OFFSET(17010, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
+    NAME_FUNC_OFFSET(17030, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
+    NAME_FUNC_OFFSET(17050, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
+    NAME_FUNC_OFFSET(17073, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
+    NAME_FUNC_OFFSET(17096, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, 327),
+    NAME_FUNC_OFFSET(17116, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, 328),
+    NAME_FUNC_OFFSET(17133, glGetPointerv, glGetPointerv, NULL, 329),
+    NAME_FUNC_OFFSET(17150, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
+    NAME_FUNC_OFFSET(17165, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
+    NAME_FUNC_OFFSET(17189, glTexSubImage1D, glTexSubImage1D, NULL, 332),
+    NAME_FUNC_OFFSET(17208, glTexSubImage2D, glTexSubImage2D, NULL, 333),
+    NAME_FUNC_OFFSET(17227, glBlendColor, glBlendColor, NULL, 336),
+    NAME_FUNC_OFFSET(17243, glBlendEquation, glBlendEquation, NULL, 337),
+    NAME_FUNC_OFFSET(17262, glDrawRangeElements, glDrawRangeElements, NULL, 338),
+    NAME_FUNC_OFFSET(17285, glColorTable, glColorTable, NULL, 339),
+    NAME_FUNC_OFFSET(17301, glColorTable, glColorTable, NULL, 339),
+    NAME_FUNC_OFFSET(17317, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
+    NAME_FUNC_OFFSET(17344, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
+    NAME_FUNC_OFFSET(17371, glCopyColorTable, glCopyColorTable, NULL, 342),
+    NAME_FUNC_OFFSET(17391, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
+    NAME_FUNC_OFFSET(17410, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
+    NAME_FUNC_OFFSET(17429, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
+    NAME_FUNC_OFFSET(17459, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
+    NAME_FUNC_OFFSET(17489, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
+    NAME_FUNC_OFFSET(17519, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
+    NAME_FUNC_OFFSET(17549, glColorSubTable, glColorSubTable, NULL, 346),
+    NAME_FUNC_OFFSET(17568, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
+    NAME_FUNC_OFFSET(17591, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
+    NAME_FUNC_OFFSET(17616, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
+    NAME_FUNC_OFFSET(17641, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
+    NAME_FUNC_OFFSET(17668, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
+    NAME_FUNC_OFFSET(17696, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
+    NAME_FUNC_OFFSET(17723, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
+    NAME_FUNC_OFFSET(17751, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
+    NAME_FUNC_OFFSET(17780, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
+    NAME_FUNC_OFFSET(17809, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, 356),
+    NAME_FUNC_OFFSET(17835, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, 357),
+    NAME_FUNC_OFFSET(17866, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, 358),
+    NAME_FUNC_OFFSET(17897, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, 359),
+    NAME_FUNC_OFFSET(17921, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
+    NAME_FUNC_OFFSET(17944, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, 361),
+    NAME_FUNC_OFFSET(17962, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, 362),
+    NAME_FUNC_OFFSET(17991, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, 363),
+    NAME_FUNC_OFFSET(18020, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, 364),
+    NAME_FUNC_OFFSET(18035, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, 365),
+    NAME_FUNC_OFFSET(18061, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, 366),
+    NAME_FUNC_OFFSET(18087, glHistogram, glHistogram, NULL, 367),
+    NAME_FUNC_OFFSET(18102, glMinmax, glMinmax, NULL, 368),
+    NAME_FUNC_OFFSET(18114, glResetHistogram, glResetHistogram, NULL, 369),
+    NAME_FUNC_OFFSET(18134, glResetMinmax, glResetMinmax, NULL, 370),
+    NAME_FUNC_OFFSET(18151, glTexImage3D, glTexImage3D, NULL, 371),
+    NAME_FUNC_OFFSET(18167, glTexSubImage3D, glTexSubImage3D, NULL, 372),
+    NAME_FUNC_OFFSET(18186, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
+    NAME_FUNC_OFFSET(18209, glActiveTextureARB, glActiveTextureARB, NULL, 374),
+    NAME_FUNC_OFFSET(18225, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
+    NAME_FUNC_OFFSET(18247, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
+    NAME_FUNC_OFFSET(18265, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
+    NAME_FUNC_OFFSET(18284, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
+    NAME_FUNC_OFFSET(18302, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
+    NAME_FUNC_OFFSET(18321, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
+    NAME_FUNC_OFFSET(18339, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
+    NAME_FUNC_OFFSET(18358, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
+    NAME_FUNC_OFFSET(18376, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
+    NAME_FUNC_OFFSET(18395, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
+    NAME_FUNC_OFFSET(18413, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
+    NAME_FUNC_OFFSET(18432, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
+    NAME_FUNC_OFFSET(18450, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
+    NAME_FUNC_OFFSET(18469, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
+    NAME_FUNC_OFFSET(18487, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
+    NAME_FUNC_OFFSET(18506, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
+    NAME_FUNC_OFFSET(18524, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
+    NAME_FUNC_OFFSET(18543, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
+    NAME_FUNC_OFFSET(18561, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
+    NAME_FUNC_OFFSET(18580, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
+    NAME_FUNC_OFFSET(18598, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
+    NAME_FUNC_OFFSET(18617, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
+    NAME_FUNC_OFFSET(18635, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
+    NAME_FUNC_OFFSET(18654, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
+    NAME_FUNC_OFFSET(18672, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
+    NAME_FUNC_OFFSET(18691, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
+    NAME_FUNC_OFFSET(18709, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
+    NAME_FUNC_OFFSET(18728, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
+    NAME_FUNC_OFFSET(18746, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
+    NAME_FUNC_OFFSET(18765, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
+    NAME_FUNC_OFFSET(18783, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
+    NAME_FUNC_OFFSET(18802, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
+    NAME_FUNC_OFFSET(18820, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
+    NAME_FUNC_OFFSET(18839, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
+    NAME_FUNC_OFFSET(18862, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
+    NAME_FUNC_OFFSET(18885, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
+    NAME_FUNC_OFFSET(18908, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
+    NAME_FUNC_OFFSET(18931, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
+    NAME_FUNC_OFFSET(18954, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
+    NAME_FUNC_OFFSET(18971, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
+    NAME_FUNC_OFFSET(18994, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
+    NAME_FUNC_OFFSET(19017, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
+    NAME_FUNC_OFFSET(19040, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
+    NAME_FUNC_OFFSET(19066, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
+    NAME_FUNC_OFFSET(19092, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
+    NAME_FUNC_OFFSET(19118, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
+    NAME_FUNC_OFFSET(19142, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
+    NAME_FUNC_OFFSET(19169, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
+    NAME_FUNC_OFFSET(19195, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
+    NAME_FUNC_OFFSET(19215, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
+    NAME_FUNC_OFFSET(19235, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
+    NAME_FUNC_OFFSET(19255, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
+    NAME_FUNC_OFFSET(19278, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
+    NAME_FUNC_OFFSET(19302, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
+    NAME_FUNC_OFFSET(19325, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
+    NAME_FUNC_OFFSET(19349, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
+    NAME_FUNC_OFFSET(19366, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
+    NAME_FUNC_OFFSET(19384, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
+    NAME_FUNC_OFFSET(19401, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
+    NAME_FUNC_OFFSET(19419, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
+    NAME_FUNC_OFFSET(19436, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
+    NAME_FUNC_OFFSET(19454, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
+    NAME_FUNC_OFFSET(19471, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
+    NAME_FUNC_OFFSET(19489, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
+    NAME_FUNC_OFFSET(19506, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
+    NAME_FUNC_OFFSET(19524, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
+    NAME_FUNC_OFFSET(19541, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
+    NAME_FUNC_OFFSET(19559, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
+    NAME_FUNC_OFFSET(19576, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
+    NAME_FUNC_OFFSET(19594, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
+    NAME_FUNC_OFFSET(19611, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
+    NAME_FUNC_OFFSET(19629, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
+    NAME_FUNC_OFFSET(19646, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
+    NAME_FUNC_OFFSET(19664, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
+    NAME_FUNC_OFFSET(19683, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
+    NAME_FUNC_OFFSET(19702, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
+    NAME_FUNC_OFFSET(19721, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
+    NAME_FUNC_OFFSET(19740, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
+    NAME_FUNC_OFFSET(19760, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
+    NAME_FUNC_OFFSET(19780, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
+    NAME_FUNC_OFFSET(19800, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
+    NAME_FUNC_OFFSET(19818, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
+    NAME_FUNC_OFFSET(19835, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
+    NAME_FUNC_OFFSET(19853, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
+    NAME_FUNC_OFFSET(19870, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
+    NAME_FUNC_OFFSET(19888, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
+    NAME_FUNC_OFFSET(19906, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
+    NAME_FUNC_OFFSET(19923, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
+    NAME_FUNC_OFFSET(19941, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
+    NAME_FUNC_OFFSET(19960, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
+    NAME_FUNC_OFFSET(19979, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
+    NAME_FUNC_OFFSET(19998, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
+    NAME_FUNC_OFFSET(20020, glBindBufferARB, glBindBufferARB, NULL, 510),
+    NAME_FUNC_OFFSET(20033, glBufferDataARB, glBufferDataARB, NULL, 511),
+    NAME_FUNC_OFFSET(20046, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
+    NAME_FUNC_OFFSET(20062, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
+    NAME_FUNC_OFFSET(20078, glGenBuffersARB, glGenBuffersARB, NULL, 514),
+    NAME_FUNC_OFFSET(20091, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
+    NAME_FUNC_OFFSET(20114, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
+    NAME_FUNC_OFFSET(20134, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
+    NAME_FUNC_OFFSET(20153, glIsBufferARB, glIsBufferARB, NULL, 518),
+    NAME_FUNC_OFFSET(20164, glMapBufferARB, glMapBufferARB, NULL, 519),
+    NAME_FUNC_OFFSET(20176, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
+    NAME_FUNC_OFFSET(20190, glBeginQueryARB, glBeginQueryARB, NULL, 521),
+    NAME_FUNC_OFFSET(20203, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
+    NAME_FUNC_OFFSET(20219, glEndQueryARB, glEndQueryARB, NULL, 523),
+    NAME_FUNC_OFFSET(20230, glGenQueriesARB, glGenQueriesARB, NULL, 524),
+    NAME_FUNC_OFFSET(20243, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
+    NAME_FUNC_OFFSET(20262, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
+    NAME_FUNC_OFFSET(20282, glGetQueryivARB, glGetQueryivARB, NULL, 527),
+    NAME_FUNC_OFFSET(20295, glIsQueryARB, glIsQueryARB, NULL, 528),
+    NAME_FUNC_OFFSET(20305, glCompileShaderARB, glCompileShaderARB, NULL, 530),
+    NAME_FUNC_OFFSET(20321, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
+    NAME_FUNC_OFFSET(20340, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
+    NAME_FUNC_OFFSET(20358, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
+    NAME_FUNC_OFFSET(20379, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
+    NAME_FUNC_OFFSET(20394, glGetUniformivARB, glGetUniformivARB, NULL, 544),
+    NAME_FUNC_OFFSET(20409, glLinkProgramARB, glLinkProgramARB, NULL, 545),
+    NAME_FUNC_OFFSET(20423, glShaderSourceARB, glShaderSourceARB, NULL, 546),
+    NAME_FUNC_OFFSET(20438, glUniform1fARB, glUniform1fARB, NULL, 547),
+    NAME_FUNC_OFFSET(20450, glUniform1fvARB, glUniform1fvARB, NULL, 548),
+    NAME_FUNC_OFFSET(20463, glUniform1iARB, glUniform1iARB, NULL, 549),
+    NAME_FUNC_OFFSET(20475, glUniform1ivARB, glUniform1ivARB, NULL, 550),
+    NAME_FUNC_OFFSET(20488, glUniform2fARB, glUniform2fARB, NULL, 551),
+    NAME_FUNC_OFFSET(20500, glUniform2fvARB, glUniform2fvARB, NULL, 552),
+    NAME_FUNC_OFFSET(20513, glUniform2iARB, glUniform2iARB, NULL, 553),
+    NAME_FUNC_OFFSET(20525, glUniform2ivARB, glUniform2ivARB, NULL, 554),
+    NAME_FUNC_OFFSET(20538, glUniform3fARB, glUniform3fARB, NULL, 555),
+    NAME_FUNC_OFFSET(20550, glUniform3fvARB, glUniform3fvARB, NULL, 556),
+    NAME_FUNC_OFFSET(20563, glUniform3iARB, glUniform3iARB, NULL, 557),
+    NAME_FUNC_OFFSET(20575, glUniform3ivARB, glUniform3ivARB, NULL, 558),
+    NAME_FUNC_OFFSET(20588, glUniform4fARB, glUniform4fARB, NULL, 559),
+    NAME_FUNC_OFFSET(20600, glUniform4fvARB, glUniform4fvARB, NULL, 560),
+    NAME_FUNC_OFFSET(20613, glUniform4iARB, glUniform4iARB, NULL, 561),
+    NAME_FUNC_OFFSET(20625, glUniform4ivARB, glUniform4ivARB, NULL, 562),
+    NAME_FUNC_OFFSET(20638, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
+    NAME_FUNC_OFFSET(20657, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
+    NAME_FUNC_OFFSET(20676, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
+    NAME_FUNC_OFFSET(20695, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
+    NAME_FUNC_OFFSET(20708, glValidateProgramARB, glValidateProgramARB, NULL, 567),
+    NAME_FUNC_OFFSET(20726, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
+    NAME_FUNC_OFFSET(20747, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
+    NAME_FUNC_OFFSET(20765, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
+    NAME_FUNC_OFFSET(20785, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+    NAME_FUNC_OFFSET(20799, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+    NAME_FUNC_OFFSET(20816, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
+    NAME_FUNC_OFFSET(20841, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 573),
+    NAME_FUNC_OFFSET(20863, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
+    NAME_FUNC_OFFSET(20890, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 574),
+    NAME_FUNC_OFFSET(20914, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 575),
+    NAME_FUNC_OFFSET(20950, gl_dispatch_stub_653, gl_dispatch_stub_653, NULL, 653),
+    NAME_FUNC_OFFSET(20966, gl_dispatch_stub_654, gl_dispatch_stub_654, NULL, 654),
+    NAME_FUNC_OFFSET(20985, glPointParameterfEXT, glPointParameterfEXT, NULL, 661),
+    NAME_FUNC_OFFSET(21003, glPointParameterfEXT, glPointParameterfEXT, NULL, 661),
+    NAME_FUNC_OFFSET(21024, glPointParameterfEXT, glPointParameterfEXT, NULL, 661),
+    NAME_FUNC_OFFSET(21046, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 662),
+    NAME_FUNC_OFFSET(21065, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 662),
+    NAME_FUNC_OFFSET(21087, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 662),
+    NAME_FUNC_OFFSET(21110, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 665),
+    NAME_FUNC_OFFSET(21129, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 666),
+    NAME_FUNC_OFFSET(21149, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 667),
+    NAME_FUNC_OFFSET(21168, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 668),
+    NAME_FUNC_OFFSET(21188, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 669),
+    NAME_FUNC_OFFSET(21207, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 670),
+    NAME_FUNC_OFFSET(21227, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 671),
+    NAME_FUNC_OFFSET(21246, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 672),
+    NAME_FUNC_OFFSET(21266, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 673),
+    NAME_FUNC_OFFSET(21285, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 674),
+    NAME_FUNC_OFFSET(21305, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 675),
+    NAME_FUNC_OFFSET(21325, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 676),
+    NAME_FUNC_OFFSET(21346, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 677),
+    NAME_FUNC_OFFSET(21366, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 678),
+    NAME_FUNC_OFFSET(21387, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 679),
+    NAME_FUNC_OFFSET(21407, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 680),
+    NAME_FUNC_OFFSET(21428, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 681),
+    NAME_FUNC_OFFSET(21452, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 682),
+    NAME_FUNC_OFFSET(21470, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 683),
+    NAME_FUNC_OFFSET(21490, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 684),
+    NAME_FUNC_OFFSET(21508, glFogCoorddEXT, glFogCoorddEXT, NULL, 685),
+    NAME_FUNC_OFFSET(21520, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 686),
+    NAME_FUNC_OFFSET(21533, glFogCoordfEXT, glFogCoordfEXT, NULL, 687),
+    NAME_FUNC_OFFSET(21545, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 688),
+    NAME_FUNC_OFFSET(21558, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 690),
+    NAME_FUNC_OFFSET(21578, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 690),
+    NAME_FUNC_OFFSET(21602, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 707),
+    NAME_FUNC_OFFSET(21616, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 707),
+    NAME_FUNC_OFFSET(21633, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 708),
+    NAME_FUNC_OFFSET(21648, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 708),
+    NAME_FUNC_OFFSET(21666, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 709),
+    NAME_FUNC_OFFSET(21680, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 709),
+    NAME_FUNC_OFFSET(21697, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 710),
+    NAME_FUNC_OFFSET(21712, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 710),
+    NAME_FUNC_OFFSET(21730, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 711),
+    NAME_FUNC_OFFSET(21744, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 711),
+    NAME_FUNC_OFFSET(21761, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 712),
+    NAME_FUNC_OFFSET(21776, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 712),
+    NAME_FUNC_OFFSET(21794, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 713),
+    NAME_FUNC_OFFSET(21808, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 713),
+    NAME_FUNC_OFFSET(21825, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 714),
+    NAME_FUNC_OFFSET(21840, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 714),
+    NAME_FUNC_OFFSET(21858, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 715),
+    NAME_FUNC_OFFSET(21872, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 715),
+    NAME_FUNC_OFFSET(21889, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 716),
+    NAME_FUNC_OFFSET(21904, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 716),
+    NAME_FUNC_OFFSET(21922, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 717),
+    NAME_FUNC_OFFSET(21936, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 717),
+    NAME_FUNC_OFFSET(21953, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 718),
+    NAME_FUNC_OFFSET(21968, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 718),
+    NAME_FUNC_OFFSET(21986, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 719),
+    NAME_FUNC_OFFSET(22000, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 719),
+    NAME_FUNC_OFFSET(22017, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 720),
+    NAME_FUNC_OFFSET(22032, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 720),
+    NAME_FUNC_OFFSET(22050, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 721),
+    NAME_FUNC_OFFSET(22064, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 721),
+    NAME_FUNC_OFFSET(22081, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 722),
+    NAME_FUNC_OFFSET(22096, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 722),
+    NAME_FUNC_OFFSET(22114, glBindProgramNV, glBindProgramNV, NULL, 741),
+    NAME_FUNC_OFFSET(22131, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 742),
+    NAME_FUNC_OFFSET(22151, glGenProgramsNV, glGenProgramsNV, NULL, 744),
+    NAME_FUNC_OFFSET(22168, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 750),
+    NAME_FUNC_OFFSET(22194, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 750),
+    NAME_FUNC_OFFSET(22223, glIsProgramNV, glIsProgramNV, NULL, 754),
+    NAME_FUNC_OFFSET(22238, glPointParameteriNV, glPointParameteriNV, NULL, 818),
+    NAME_FUNC_OFFSET(22256, glPointParameterivNV, glPointParameterivNV, NULL, 819),
+    NAME_FUNC_OFFSET(22275, gl_dispatch_stub_822, gl_dispatch_stub_822, NULL, 822),
+    NAME_FUNC_OFFSET(22296, gl_dispatch_stub_824, gl_dispatch_stub_824, NULL, 824),
+    NAME_FUNC_OFFSET(22312, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 831),
+    NAME_FUNC_OFFSET(22336, gl_dispatch_stub_834, gl_dispatch_stub_834, NULL, 834),
+    NAME_FUNC_OFFSET(22360, gl_dispatch_stub_834, gl_dispatch_stub_834, NULL, 834),
+    NAME_FUNC_OFFSET(22387, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 835),
+    NAME_FUNC_OFFSET(22405, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 836),
+    NAME_FUNC_OFFSET(22424, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 837),
+    NAME_FUNC_OFFSET(22449, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 838),
+    NAME_FUNC_OFFSET(22470, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 839),
+    NAME_FUNC_OFFSET(22492, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 840),
+    NAME_FUNC_OFFSET(22518, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 841),
+    NAME_FUNC_OFFSET(22541, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 842),
+    NAME_FUNC_OFFSET(22564, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 843),
+    NAME_FUNC_OFFSET(22587, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 844),
+    NAME_FUNC_OFFSET(22605, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 845),
+    NAME_FUNC_OFFSET(22624, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 846),
+    NAME_FUNC_OFFSET(22641, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 847),
+    NAME_FUNC_OFFSET(22679, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 848),
+    NAME_FUNC_OFFSET(22708, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 849),
+    NAME_FUNC_OFFSET(22724, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 850),
+    NAME_FUNC_OFFSET(22741, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 851),
+    NAME_FUNC_OFFSET(22763, gl_dispatch_stub_852, gl_dispatch_stub_852, NULL, 852),
+    NAME_FUNC_OFFSET(22781, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 855),
+    NAME_FUNC_OFFSET(22804, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 856),
+    NAME_FUNC_OFFSET(22826, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 857),
+    NAME_FUNC_OFFSET(22842, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 858),
+    NAME_FUNC_OFFSET(22863, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 859),
+    NAME_FUNC_OFFSET(22885, glUniform1uiEXT, glUniform1uiEXT, NULL, 860),
+    NAME_FUNC_OFFSET(22898, glUniform1uivEXT, glUniform1uivEXT, NULL, 861),
+    NAME_FUNC_OFFSET(22912, glUniform2uiEXT, glUniform2uiEXT, NULL, 862),
+    NAME_FUNC_OFFSET(22925, glUniform2uivEXT, glUniform2uivEXT, NULL, 863),
+    NAME_FUNC_OFFSET(22939, glUniform3uiEXT, glUniform3uiEXT, NULL, 864),
+    NAME_FUNC_OFFSET(22952, glUniform3uivEXT, glUniform3uivEXT, NULL, 865),
+    NAME_FUNC_OFFSET(22966, glUniform4uiEXT, glUniform4uiEXT, NULL, 866),
+    NAME_FUNC_OFFSET(22979, glUniform4uivEXT, glUniform4uivEXT, NULL, 867),
+    NAME_FUNC_OFFSET(22993, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 868),
+    NAME_FUNC_OFFSET(23011, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 869),
+    NAME_FUNC_OFFSET(23030, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 870),
+    NAME_FUNC_OFFSET(23049, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 871),
+    NAME_FUNC_OFFSET(23069, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 872),
+    NAME_FUNC_OFFSET(23087, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 873),
+    NAME_FUNC_OFFSET(23106, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 874),
+    NAME_FUNC_OFFSET(23125, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 875),
+    NAME_FUNC_OFFSET(23145, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 876),
+    NAME_FUNC_OFFSET(23163, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 877),
+    NAME_FUNC_OFFSET(23182, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 878),
+    NAME_FUNC_OFFSET(23201, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 879),
+    NAME_FUNC_OFFSET(23221, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 880),
+    NAME_FUNC_OFFSET(23240, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 881),
+    NAME_FUNC_OFFSET(23258, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 882),
+    NAME_FUNC_OFFSET(23277, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 883),
+    NAME_FUNC_OFFSET(23296, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 884),
+    NAME_FUNC_OFFSET(23316, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 885),
+    NAME_FUNC_OFFSET(23335, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 886),
+    NAME_FUNC_OFFSET(23355, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 887),
+    NAME_FUNC_OFFSET(23375, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 888),
+    NAME_FUNC_OFFSET(23398, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 889),
+    NAME_FUNC_OFFSET(23424, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 890),
+    NAME_FUNC_OFFSET(23437, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 891),
+    NAME_FUNC_OFFSET(23448, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 892),
+    NAME_FUNC_OFFSET(23458, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 893),
+    NAME_FUNC_OFFSET(23474, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 894),
+    NAME_FUNC_OFFSET(23490, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 895),
+    NAME_FUNC_OFFSET(23503, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 898),
+    NAME_FUNC_OFFSET(23524, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 899),
+    NAME_FUNC_OFFSET(23546, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 900),
+    NAME_FUNC_OFFSET(23564, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 901),
+    NAME_FUNC_OFFSET(23583, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 902),
+    NAME_FUNC_OFFSET(23608, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 903),
+    NAME_FUNC_OFFSET(23631, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 904),
+    NAME_FUNC_OFFSET(23656, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 905),
+    NAME_FUNC_OFFSET(23673, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 907),
+    NAME_FUNC_OFFSET(23691, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 908),
+    NAME_FUNC_OFFSET(23714, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 909),
+    NAME_FUNC_OFFSET(23744, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 910),
+    NAME_FUNC_OFFSET(23772, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 911),
     NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
 };
 
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index 39388c8e4..2d8a17727 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -144,6 +144,65 @@ math_sources = [
     'math/m_xform.c',
 ]
 
+math_xform_sources = [
+    'math/m_xform.c'
+]
+
+swrast_sources = [
+    'swrast/s_aaline.c',
+    'swrast/s_aatriangle.c',
+    'swrast/s_accum.c',
+    'swrast/s_alpha.c',
+    'swrast/s_atifragshader.c',
+    'swrast/s_bitmap.c',
+    'swrast/s_blend.c',
+    'swrast/s_blit.c',
+    'swrast/s_clear.c',
+    'swrast/s_copypix.c',
+    'swrast/s_context.c',
+    'swrast/s_depth.c',
+    'swrast/s_drawpix.c',
+    'swrast/s_feedback.c',
+    'swrast/s_fog.c',
+    'swrast/s_fragprog.c',
+    'swrast/s_lines.c',
+    'swrast/s_logic.c',
+    'swrast/s_masking.c',
+    'swrast/s_points.c',
+    'swrast/s_readpix.c',
+    'swrast/s_span.c',
+    'swrast/s_stencil.c',
+    'swrast/s_texcombine.c',
+    'swrast/s_texfilter.c',
+    'swrast/s_triangle.c',
+    'swrast/s_zoom.c',
+]
+
+swrast_setup_sources = [
+    'swrast_setup/ss_context.c',
+    'swrast_setup/ss_triangle.c',
+]
+
+tnl_sources = [
+    'tnl/t_context.c',
+    'tnl/t_pipeline.c',
+    'tnl/t_draw.c',
+    'tnl/t_rasterpos.c',
+    'tnl/t_vb_program.c',
+    'tnl/t_vb_render.c',
+    'tnl/t_vb_texgen.c',
+    'tnl/t_vb_texmat.c',
+    'tnl/t_vb_vertex.c',
+    'tnl/t_vb_fog.c',
+    'tnl/t_vb_light.c',
+    'tnl/t_vb_normals.c',
+    'tnl/t_vb_points.c',
+    'tnl/t_vp_build.c',
+    'tnl/t_vertex.c',
+    'tnl/t_vertex_sse.c',
+    'tnl/t_vertex_generic.c',
+]
+
 vbo_sources = [
     'vbo/vbo_context.c',
     'vbo/vbo_exec.c',
@@ -161,12 +220,6 @@ vbo_sources = [
     'vbo/vbo_save_loopback.c',
 ]
 
-vf_sources = [
-    'vf/vf.c',
-    'vf/vf_generic.c',
-    'vf/vf_sse.c',
-]
-
 statetracker_sources = [
     'state_tracker/st_atom.c',
     'state_tracker/st_atom_blend.c',
@@ -251,12 +304,21 @@ program_sources = [
     program_parse[0],
 ]
 
+common_driver_sources =	[
+    'drivers/common/driverfuncs.c',
+    'drivers/common/meta.c',
+]
+
 mesa_sources = (
     main_sources +
     math_sources +
+    math_xform_sources +
     program_sources +
     vbo_sources +
-    vf_sources +
+    tnl_sources +
+    swrast_sources +
+    swrast_setup_sources +
+    common_driver_sources +
     statetracker_sources
 )
 
@@ -415,3 +477,5 @@ mesa = env.ConvenienceLibrary(
 env.Alias('mesa', mesa)
 
 Export('mesa')
+
+SConscript('drivers/SConscript')
diff --git a/mesalib/src/mesa/drivers/SConscript b/mesalib/src/mesa/drivers/SConscript
new file mode 100644
index 000000000..ab0f89432
--- /dev/null
+++ b/mesalib/src/mesa/drivers/SConscript
@@ -0,0 +1,6 @@
+Import('*')
+
+SConscript('osmesa/SConscript')
+
+if env['platform'] == 'windows':
+    SConscript('windows/gdi/SConscript')
diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c
index 8f898f6af..0dbc7c3e8 100644
--- a/mesalib/src/mesa/drivers/common/driverfuncs.c
+++ b/mesalib/src/mesa/drivers/common/driverfuncs.c
@@ -1,329 +1,332 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/arrayobj.h"
-#include "main/context.h"
-#include "main/framebuffer.h"
-#include "main/mipmap.h"
-#include "main/queryobj.h"
-#include "main/renderbuffer.h"
-#include "main/shaderobj.h"
-#include "main/texcompress.h"
-#include "main/texformat.h"
-#include "main/texgetimage.h"
-#include "main/teximage.h"
-#include "main/texobj.h"
-#include "main/texstore.h"
-#include "main/bufferobj.h"
-#include "main/fbobject.h"
-#include "main/texrender.h"
-#include "main/syncobj.h"
-#include "main/texturebarrier.h"
-#include "main/transformfeedback.h"
-
-#include "program/program.h"
-#include "tnl/tnl.h"
-#include "swrast/swrast.h"
-
-#include "driverfuncs.h"
-#include "meta.h"
-
-
-
-/**
- * Plug in default functions for all pointers in the dd_function_table
- * structure.
- * Device drivers should call this function and then plug in any
- * functions which it wants to override.
- * Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
- *
- * \param table the dd_function_table to initialize
- */
-void
-_mesa_init_driver_functions(struct dd_function_table *driver)
-{
-   memset(driver, 0, sizeof(*driver));
-
-   driver->GetString = NULL;  /* REQUIRED! */
-   driver->UpdateState = NULL;  /* REQUIRED! */
-   driver->GetBufferSize = NULL;  /* REQUIRED! */
-   driver->ResizeBuffers = _mesa_resize_framebuffer;
-   driver->Error = NULL;
-
-   driver->Finish = NULL;
-   driver->Flush = NULL;
-
-   /* framebuffer/image functions */
-   driver->Clear = _swrast_Clear;
-   driver->Accum = _swrast_Accum;
-   driver->RasterPos = _tnl_RasterPos;
-   driver->DrawPixels = _swrast_DrawPixels;
-   driver->ReadPixels = _swrast_ReadPixels;
-   driver->CopyPixels = _swrast_CopyPixels;
-   driver->Bitmap = _swrast_Bitmap;
-
-   /* Texture functions */
-   driver->ChooseTextureFormat = _mesa_choose_tex_format;
-   driver->TexImage1D = _mesa_store_teximage1d;
-   driver->TexImage2D = _mesa_store_teximage2d;
-   driver->TexImage3D = _mesa_store_teximage3d;
-   driver->TexSubImage1D = _mesa_store_texsubimage1d;
-   driver->TexSubImage2D = _mesa_store_texsubimage2d;
-   driver->TexSubImage3D = _mesa_store_texsubimage3d;
-   driver->GetTexImage = _mesa_get_teximage;
-   driver->CopyTexImage1D = _mesa_meta_CopyTexImage1D;
-   driver->CopyTexImage2D = _mesa_meta_CopyTexImage2D;
-   driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
-   driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
-   driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D;
-   driver->GenerateMipmap = _mesa_meta_GenerateMipmap;
-   driver->TestProxyTexImage = _mesa_test_proxy_teximage;
-   driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
-   driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
-   driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d;
-   driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
-   driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
-   driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
-   driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
-   driver->BindTexture = NULL;
-   driver->NewTextureObject = _mesa_new_texture_object;
-   driver->DeleteTexture = _mesa_delete_texture_object;
-   driver->NewTextureImage = _mesa_new_texture_image;
-   driver->FreeTexImageData = _mesa_free_texture_image_data; 
-   driver->MapTexture = NULL;
-   driver->UnmapTexture = NULL;
-   driver->TextureMemCpy = memcpy;
-   driver->IsTextureResident = NULL;
-   driver->UpdateTexturePalette = NULL;
-
-   /* imaging */
-   driver->CopyColorTable = _mesa_meta_CopyColorTable;
-   driver->CopyColorSubTable = _mesa_meta_CopyColorSubTable;
-
-   /* Vertex/fragment programs */
-   driver->BindProgram = NULL;
-   driver->NewProgram = _mesa_new_program;
-   driver->DeleteProgram = _mesa_delete_program;
-
-   /* simple state commands */
-   driver->AlphaFunc = NULL;
-   driver->BlendColor = NULL;
-   driver->BlendEquationSeparate = NULL;
-   driver->BlendFuncSeparate = NULL;
-   driver->ClearColor = NULL;
-   driver->ClearDepth = NULL;
-   driver->ClearStencil = NULL;
-   driver->ClipPlane = NULL;
-   driver->ColorMask = NULL;
-   driver->ColorMaterial = NULL;
-   driver->CullFace = NULL;
-   driver->DrawBuffer = NULL;
-   driver->DrawBuffers = NULL;
-   driver->FrontFace = NULL;
-   driver->DepthFunc = NULL;
-   driver->DepthMask = NULL;
-   driver->DepthRange = NULL;
-   driver->Enable = NULL;
-   driver->Fogfv = NULL;
-   driver->Hint = NULL;
-   driver->Lightfv = NULL;
-   driver->LightModelfv = NULL;
-   driver->LineStipple = NULL;
-   driver->LineWidth = NULL;
-   driver->LogicOpcode = NULL;
-   driver->PointParameterfv = NULL;
-   driver->PointSize = NULL;
-   driver->PolygonMode = NULL;
-   driver->PolygonOffset = NULL;
-   driver->PolygonStipple = NULL;
-   driver->ReadBuffer = NULL;
-   driver->RenderMode = NULL;
-   driver->Scissor = NULL;
-   driver->ShadeModel = NULL;
-   driver->StencilFuncSeparate = NULL;
-   driver->StencilOpSeparate = NULL;
-   driver->StencilMaskSeparate = NULL;
-   driver->TexGen = NULL;
-   driver->TexEnv = NULL;
-   driver->TexParameter = NULL;
-   driver->Viewport = NULL;
-
-   /* buffer objects */
-   _mesa_init_buffer_object_functions(driver);
-
-   /* query objects */
-   _mesa_init_query_object_functions(driver);
-
-   _mesa_init_sync_object_functions(driver);
-
-   driver->NewFramebuffer = _mesa_new_framebuffer;
-   driver->NewRenderbuffer = _mesa_new_soft_renderbuffer;
-   driver->RenderTexture = _mesa_render_texture;
-   driver->FinishRenderTexture = _mesa_finish_render_texture;
-   driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
-   driver->ValidateFramebuffer = _mesa_validate_framebuffer;
-
-   driver->BlitFramebuffer = _swrast_BlitFramebuffer;
-
-   _mesa_init_texture_barrier_functions(driver);
-
-   /* APPLE_vertex_array_object */
-   driver->NewArrayObject = _mesa_new_array_object;
-   driver->DeleteArrayObject = _mesa_delete_array_object;
-   driver->BindArrayObject = NULL;
-
-   _mesa_init_shader_object_functions(driver);
-
-   _mesa_init_transform_feedback_functions(driver);
-
-   /* T&L stuff */
-   driver->NeedValidate = GL_FALSE;
-   driver->ValidateTnlModule = NULL;
-   driver->CurrentExecPrimitive = 0;
-   driver->CurrentSavePrimitive = 0;
-   driver->NeedFlush = 0;
-   driver->SaveNeedFlush = 0;
-
-   driver->ProgramStringNotify = _tnl_program_string;
-   driver->FlushVertices = NULL;
-   driver->SaveFlushVertices = NULL;
-   driver->NotifySaveBegin = NULL;
-   driver->LightingSpaceChange = NULL;
-
-   /* display list */
-   driver->NewList = NULL;
-   driver->EndList = NULL;
-   driver->BeginCallList = NULL;
-   driver->EndCallList = NULL;
-}
-
-
-/**
- * Call the ctx->Driver.* state functions with current values to initialize
- * driver state.
- * Only the Intel drivers use this so far.
- */
-void
-_mesa_init_driver_state(struct gl_context *ctx)
-{
-   ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
-
-   ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor);
-
-   ctx->Driver.BlendEquationSeparate(ctx,
-                                     ctx->Color.Blend[0].EquationRGB,
-                                     ctx->Color.Blend[0].EquationA);
-
-   ctx->Driver.BlendFuncSeparate(ctx,
-                                 ctx->Color.Blend[0].SrcRGB,
-                                 ctx->Color.Blend[0].DstRGB,
-                                 ctx->Color.Blend[0].SrcA,
-                                 ctx->Color.Blend[0].DstA);
-
-   if (ctx->Driver.ColorMaskIndexed) {
-      GLuint i;
-      for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-         ctx->Driver.ColorMaskIndexed(ctx, i,
-                                      ctx->Color.ColorMask[0][RCOMP],
-                                      ctx->Color.ColorMask[0][GCOMP],
-                                      ctx->Color.ColorMask[0][BCOMP],
-                                      ctx->Color.ColorMask[0][ACOMP]);
-      }
-   }
-   else {
-      ctx->Driver.ColorMask(ctx,
-                            ctx->Color.ColorMask[0][RCOMP],
-                            ctx->Color.ColorMask[0][GCOMP],
-                            ctx->Color.ColorMask[0][BCOMP],
-                            ctx->Color.ColorMask[0][ACOMP]);
-   }
-
-   ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode);
-   ctx->Driver.DepthFunc(ctx, ctx->Depth.Func);
-   ctx->Driver.DepthMask(ctx, ctx->Depth.Mask);
-
-   ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled);
-   ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled);
-   ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled);
-   ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled);
-   ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag);
-   ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
-   ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag);
-   ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled);
-   ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled);
-   ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag);
-   ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag);
-   ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled);
-   ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
-   ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
-   ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
-   ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE);
-   ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE);
-   ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
-
-   ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
-   ctx->Driver.Fogfv(ctx, GL_FOG_MODE, 0);
-   ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
-   ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start);
-   ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
-
-   ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
-
-   {
-      GLfloat f = (GLfloat) ctx->Light.Model.ColorControl;
-      ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f);
-   }
-
-   ctx->Driver.LineWidth(ctx, ctx->Line.Width);
-   ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
-   ctx->Driver.PointSize(ctx, ctx->Point.Size);
-   ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
-   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
-                       ctx->Scissor.Width, ctx->Scissor.Height);
-   ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
-   ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
-                                   ctx->Stencil.Function[0],
-                                   ctx->Stencil.Ref[0],
-                                   ctx->Stencil.ValueMask[0]);
-   ctx->Driver.StencilFuncSeparate(ctx, GL_BACK,
-                                   ctx->Stencil.Function[1],
-                                   ctx->Stencil.Ref[1],
-                                   ctx->Stencil.ValueMask[1]);
-   ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]);
-   ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]);
-   ctx->Driver.StencilOpSeparate(ctx, GL_FRONT,
-                                 ctx->Stencil.FailFunc[0],
-                                 ctx->Stencil.ZFailFunc[0],
-                                 ctx->Stencil.ZPassFunc[0]);
-   ctx->Driver.StencilOpSeparate(ctx, GL_BACK,
-                                 ctx->Stencil.FailFunc[1],
-                                 ctx->Stencil.ZFailFunc[1],
-                                 ctx->Stencil.ZPassFunc[1]);
-
-
-   ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/arrayobj.h"
+#include "main/context.h"
+#include "main/framebuffer.h"
+#include "main/mipmap.h"
+#include "main/queryobj.h"
+#include "main/renderbuffer.h"
+#include "main/shaderobj.h"
+#include "main/texcompress.h"
+#include "main/texformat.h"
+#include "main/texgetimage.h"
+#include "main/teximage.h"
+#include "main/texobj.h"
+#include "main/texstore.h"
+#include "main/bufferobj.h"
+#include "main/fbobject.h"
+#include "main/texrender.h"
+#include "main/samplerobj.h"
+#include "main/syncobj.h"
+#include "main/texturebarrier.h"
+#include "main/transformfeedback.h"
+
+#include "program/program.h"
+#include "tnl/tnl.h"
+#include "swrast/swrast.h"
+
+#include "driverfuncs.h"
+#include "meta.h"
+
+
+
+/**
+ * Plug in default functions for all pointers in the dd_function_table
+ * structure.
+ * Device drivers should call this function and then plug in any
+ * functions which it wants to override.
+ * Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
+ *
+ * \param table the dd_function_table to initialize
+ */
+void
+_mesa_init_driver_functions(struct dd_function_table *driver)
+{
+   memset(driver, 0, sizeof(*driver));
+
+   driver->GetString = NULL;  /* REQUIRED! */
+   driver->UpdateState = NULL;  /* REQUIRED! */
+   driver->GetBufferSize = NULL;  /* REQUIRED! */
+   driver->ResizeBuffers = _mesa_resize_framebuffer;
+   driver->Error = NULL;
+
+   driver->Finish = NULL;
+   driver->Flush = NULL;
+
+   /* framebuffer/image functions */
+   driver->Clear = _swrast_Clear;
+   driver->Accum = _swrast_Accum;
+   driver->RasterPos = _tnl_RasterPos;
+   driver->DrawPixels = _swrast_DrawPixels;
+   driver->ReadPixels = _swrast_ReadPixels;
+   driver->CopyPixels = _swrast_CopyPixels;
+   driver->Bitmap = _swrast_Bitmap;
+
+   /* Texture functions */
+   driver->ChooseTextureFormat = _mesa_choose_tex_format;
+   driver->TexImage1D = _mesa_store_teximage1d;
+   driver->TexImage2D = _mesa_store_teximage2d;
+   driver->TexImage3D = _mesa_store_teximage3d;
+   driver->TexSubImage1D = _mesa_store_texsubimage1d;
+   driver->TexSubImage2D = _mesa_store_texsubimage2d;
+   driver->TexSubImage3D = _mesa_store_texsubimage3d;
+   driver->GetTexImage = _mesa_get_teximage;
+   driver->CopyTexImage1D = _mesa_meta_CopyTexImage1D;
+   driver->CopyTexImage2D = _mesa_meta_CopyTexImage2D;
+   driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
+   driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
+   driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D;
+   driver->GenerateMipmap = _mesa_meta_GenerateMipmap;
+   driver->TestProxyTexImage = _mesa_test_proxy_teximage;
+   driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
+   driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
+   driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d;
+   driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
+   driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
+   driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
+   driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
+   driver->BindTexture = NULL;
+   driver->NewTextureObject = _mesa_new_texture_object;
+   driver->DeleteTexture = _mesa_delete_texture_object;
+   driver->NewTextureImage = _mesa_new_texture_image;
+   driver->FreeTexImageData = _mesa_free_texture_image_data; 
+   driver->MapTexture = NULL;
+   driver->UnmapTexture = NULL;
+   driver->TextureMemCpy = memcpy;
+   driver->IsTextureResident = NULL;
+   driver->UpdateTexturePalette = NULL;
+
+   /* imaging */
+   driver->CopyColorTable = _mesa_meta_CopyColorTable;
+   driver->CopyColorSubTable = _mesa_meta_CopyColorSubTable;
+
+   /* Vertex/fragment programs */
+   driver->BindProgram = NULL;
+   driver->NewProgram = _mesa_new_program;
+   driver->DeleteProgram = _mesa_delete_program;
+
+   /* simple state commands */
+   driver->AlphaFunc = NULL;
+   driver->BlendColor = NULL;
+   driver->BlendEquationSeparate = NULL;
+   driver->BlendFuncSeparate = NULL;
+   driver->ClearColor = NULL;
+   driver->ClearDepth = NULL;
+   driver->ClearStencil = NULL;
+   driver->ClipPlane = NULL;
+   driver->ColorMask = NULL;
+   driver->ColorMaterial = NULL;
+   driver->CullFace = NULL;
+   driver->DrawBuffer = NULL;
+   driver->DrawBuffers = NULL;
+   driver->FrontFace = NULL;
+   driver->DepthFunc = NULL;
+   driver->DepthMask = NULL;
+   driver->DepthRange = NULL;
+   driver->Enable = NULL;
+   driver->Fogfv = NULL;
+   driver->Hint = NULL;
+   driver->Lightfv = NULL;
+   driver->LightModelfv = NULL;
+   driver->LineStipple = NULL;
+   driver->LineWidth = NULL;
+   driver->LogicOpcode = NULL;
+   driver->PointParameterfv = NULL;
+   driver->PointSize = NULL;
+   driver->PolygonMode = NULL;
+   driver->PolygonOffset = NULL;
+   driver->PolygonStipple = NULL;
+   driver->ReadBuffer = NULL;
+   driver->RenderMode = NULL;
+   driver->Scissor = NULL;
+   driver->ShadeModel = NULL;
+   driver->StencilFuncSeparate = NULL;
+   driver->StencilOpSeparate = NULL;
+   driver->StencilMaskSeparate = NULL;
+   driver->TexGen = NULL;
+   driver->TexEnv = NULL;
+   driver->TexParameter = NULL;
+   driver->Viewport = NULL;
+
+   /* buffer objects */
+   _mesa_init_buffer_object_functions(driver);
+
+   /* query objects */
+   _mesa_init_query_object_functions(driver);
+
+   _mesa_init_sync_object_functions(driver);
+
+   driver->NewFramebuffer = _mesa_new_framebuffer;
+   driver->NewRenderbuffer = _mesa_new_soft_renderbuffer;
+   driver->RenderTexture = _mesa_render_texture;
+   driver->FinishRenderTexture = _mesa_finish_render_texture;
+   driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
+   driver->ValidateFramebuffer = _mesa_validate_framebuffer;
+
+   driver->BlitFramebuffer = _swrast_BlitFramebuffer;
+
+   _mesa_init_texture_barrier_functions(driver);
+
+   /* APPLE_vertex_array_object */
+   driver->NewArrayObject = _mesa_new_array_object;
+   driver->DeleteArrayObject = _mesa_delete_array_object;
+   driver->BindArrayObject = NULL;
+
+   _mesa_init_shader_object_functions(driver);
+
+   _mesa_init_transform_feedback_functions(driver);
+
+   _mesa_init_sampler_object_functions(driver);
+
+   /* T&L stuff */
+   driver->NeedValidate = GL_FALSE;
+   driver->ValidateTnlModule = NULL;
+   driver->CurrentExecPrimitive = 0;
+   driver->CurrentSavePrimitive = 0;
+   driver->NeedFlush = 0;
+   driver->SaveNeedFlush = 0;
+
+   driver->ProgramStringNotify = _tnl_program_string;
+   driver->FlushVertices = NULL;
+   driver->SaveFlushVertices = NULL;
+   driver->NotifySaveBegin = NULL;
+   driver->LightingSpaceChange = NULL;
+
+   /* display list */
+   driver->NewList = NULL;
+   driver->EndList = NULL;
+   driver->BeginCallList = NULL;
+   driver->EndCallList = NULL;
+}
+
+
+/**
+ * Call the ctx->Driver.* state functions with current values to initialize
+ * driver state.
+ * Only the Intel drivers use this so far.
+ */
+void
+_mesa_init_driver_state(struct gl_context *ctx)
+{
+   ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
+
+   ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor);
+
+   ctx->Driver.BlendEquationSeparate(ctx,
+                                     ctx->Color.Blend[0].EquationRGB,
+                                     ctx->Color.Blend[0].EquationA);
+
+   ctx->Driver.BlendFuncSeparate(ctx,
+                                 ctx->Color.Blend[0].SrcRGB,
+                                 ctx->Color.Blend[0].DstRGB,
+                                 ctx->Color.Blend[0].SrcA,
+                                 ctx->Color.Blend[0].DstA);
+
+   if (ctx->Driver.ColorMaskIndexed) {
+      GLuint i;
+      for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+         ctx->Driver.ColorMaskIndexed(ctx, i,
+                                      ctx->Color.ColorMask[0][RCOMP],
+                                      ctx->Color.ColorMask[0][GCOMP],
+                                      ctx->Color.ColorMask[0][BCOMP],
+                                      ctx->Color.ColorMask[0][ACOMP]);
+      }
+   }
+   else {
+      ctx->Driver.ColorMask(ctx,
+                            ctx->Color.ColorMask[0][RCOMP],
+                            ctx->Color.ColorMask[0][GCOMP],
+                            ctx->Color.ColorMask[0][BCOMP],
+                            ctx->Color.ColorMask[0][ACOMP]);
+   }
+
+   ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode);
+   ctx->Driver.DepthFunc(ctx, ctx->Depth.Func);
+   ctx->Driver.DepthMask(ctx, ctx->Depth.Mask);
+
+   ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled);
+   ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled);
+   ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled);
+   ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled);
+   ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag);
+   ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
+   ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag);
+   ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled);
+   ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled);
+   ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag);
+   ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag);
+   ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled);
+   ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
+   ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
+   ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
+   ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE);
+   ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE);
+   ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
+
+   ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
+   ctx->Driver.Fogfv(ctx, GL_FOG_MODE, 0);
+   ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
+   ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start);
+   ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
+
+   ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
+
+   {
+      GLfloat f = (GLfloat) ctx->Light.Model.ColorControl;
+      ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f);
+   }
+
+   ctx->Driver.LineWidth(ctx, ctx->Line.Width);
+   ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
+   ctx->Driver.PointSize(ctx, ctx->Point.Size);
+   ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
+   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
+                       ctx->Scissor.Width, ctx->Scissor.Height);
+   ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
+   ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
+                                   ctx->Stencil.Function[0],
+                                   ctx->Stencil.Ref[0],
+                                   ctx->Stencil.ValueMask[0]);
+   ctx->Driver.StencilFuncSeparate(ctx, GL_BACK,
+                                   ctx->Stencil.Function[1],
+                                   ctx->Stencil.Ref[1],
+                                   ctx->Stencil.ValueMask[1]);
+   ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]);
+   ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]);
+   ctx->Driver.StencilOpSeparate(ctx, GL_FRONT,
+                                 ctx->Stencil.FailFunc[0],
+                                 ctx->Stencil.ZFailFunc[0],
+                                 ctx->Stencil.ZPassFunc[0]);
+   ctx->Driver.StencilOpSeparate(ctx, GL_BACK,
+                                 ctx->Stencil.FailFunc[1],
+                                 ctx->Stencil.ZFailFunc[1],
+                                 ctx->Stencil.ZPassFunc[1]);
+
+
+   ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
+}
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index c92bf29c3..a3964798b 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -40,6 +40,7 @@
 #include "main/bufferobj.h"
 #include "main/buffers.h"
 #include "main/colortab.h"
+#include "main/condrender.h"
 #include "main/depth.h"
 #include "main/enable.h"
 #include "main/fbobject.h"
@@ -92,6 +93,9 @@
 #define META_TEXTURE        0x1000
 #define META_VERTEX         0x2000
 #define META_VIEWPORT       0x4000
+#define META_CLAMP_FRAGMENT_COLOR 0x8000
+#define META_CLAMP_VERTEX_COLOR 0x10000
+#define META_CONDITIONAL_RENDER 0x20000
 /*@}*/
 
 
@@ -180,6 +184,16 @@ struct save_state
    GLint ViewportX, ViewportY, ViewportW, ViewportH;
    GLclampd DepthNear, DepthFar;
 
+   /** META_CLAMP_FRAGMENT_COLOR */
+   GLenum ClampFragmentColor;
+
+   /** META_CLAMP_VERTEX_COLOR */
+   GLenum ClampVertexColor;
+
+   /** META_CONDITIONAL_RENDER */
+   struct gl_query_object *CondRenderQuery;
+   GLenum CondRenderMode;
+
    /** Miscellaneous (always disabled) */
    GLboolean Lighting;
 };
@@ -569,6 +583,34 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
       _mesa_DepthRange(0.0, 1.0);
    }
 
+   if (state & META_CLAMP_FRAGMENT_COLOR) {
+      save->ClampFragmentColor = ctx->Color.ClampFragmentColor;
+
+      /* Generally in here we want to do clamping according to whether
+       * it's for the pixel path (ClampFragmentColor is GL_TRUE),
+       * regardless of the internal implementation of the metaops.
+       */
+      if (ctx->Color.ClampFragmentColor != GL_TRUE)
+	 _mesa_ClampColorARB(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
+   }
+
+   if (state & META_CLAMP_VERTEX_COLOR) {
+      save->ClampVertexColor = ctx->Light.ClampVertexColor;
+
+      /* Generally in here we never want vertex color clamping --
+       * result clamping is only dependent on fragment clamping.
+       */
+      _mesa_ClampColorARB(GL_CLAMP_VERTEX_COLOR, GL_FALSE);
+   }
+
+   if (state & META_CONDITIONAL_RENDER) {
+      save->CondRenderQuery = ctx->Query.CondRenderQuery;
+      save->CondRenderMode = ctx->Query.CondRenderMode;
+
+      if (ctx->Query.CondRenderQuery)
+	 _mesa_EndConditionalRender();
+   }
+
    /* misc */
    {
       save->Lighting = ctx->Light.Enabled;
@@ -833,6 +875,20 @@ _mesa_meta_end(struct gl_context *ctx)
       _mesa_DepthRange(save->DepthNear, save->DepthFar);
    }
 
+   if (state & META_CLAMP_FRAGMENT_COLOR) {
+      _mesa_ClampColorARB(GL_CLAMP_FRAGMENT_COLOR, save->ClampFragmentColor);
+   }
+
+   if (state & META_CLAMP_VERTEX_COLOR) {
+      _mesa_ClampColorARB(GL_CLAMP_VERTEX_COLOR, save->ClampVertexColor);
+   }
+
+   if (state & META_CONDITIONAL_RENDER) {
+      if (save->CondRenderQuery)
+	 _mesa_BeginConditionalRender(save->CondRenderQuery->Id,
+				      save->CondRenderMode);
+   }
+
    /* misc */
    if (save->Lighting) {
       _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
@@ -1406,7 +1462,10 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
    };
    struct vertex verts[4];
    /* save all state but scissor, pixel pack/unpack */
-   GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE;
+   GLbitfield metaSave = (META_ALL -
+			  META_SCISSOR -
+			  META_PIXEL_STORE -
+			  META_CONDITIONAL_RENDER);
    const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
 
    if (buffers & BUFFER_BITS_COLOR) {
@@ -1441,6 +1500,9 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
    /* GL_COLOR_BUFFER_BIT */
    if (buffers & BUFFER_BITS_COLOR) {
       /* leave colormask, glDrawBuffer state as-is */
+
+      /* Clears never have the color clamped. */
+      _mesa_ClampColorARB(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
    }
    else {
       ASSERT(metaSave & META_COLOR_MASK);
@@ -1494,10 +1556,10 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
 
       /* vertex colors */
       for (i = 0; i < 4; i++) {
-         verts[i].r = ctx->Color.ClearColor[0];
-         verts[i].g = ctx->Color.ClearColor[1];
-         verts[i].b = ctx->Color.ClearColor[2];
-         verts[i].a = ctx->Color.ClearColor[3];
+         verts[i].r = ctx->Color.ClearColorUnclamped[0];
+         verts[i].g = ctx->Color.ClearColorUnclamped[1];
+         verts[i].b = ctx->Color.ClearColorUnclamped[2];
+         verts[i].a = ctx->Color.ClearColorUnclamped[3];
       }
 
       /* upload new vertex data */
@@ -1803,6 +1865,14 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
          texIntFormat = format;
       else
          texIntFormat = GL_RGBA;
+
+      /* If we're not supposed to clamp the resulting color, then just
+       * promote our texture to fully float.  We could do better by
+       * just going for the matching set of channels, in floating
+       * point.
+       */
+      if (ctx->Color.ClampFragmentColor != GL_TRUE)
+	 texIntFormat = GL_RGBA32F;
    }
    else if (_mesa_is_stencil_format(format)) {
       if (ctx->Extensions.ARB_fragment_program &&
@@ -1861,6 +1931,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
                           META_TRANSFORM |
                           META_VERTEX |
                           META_VIEWPORT |
+			  META_CLAMP_FRAGMENT_COLOR |
                           metaExtraSave));
 
    newTex = alloc_texture(tex, width, height, texIntFormat);
diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp2.h b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
index 160836a77..abd79562f 100644
--- a/mesalib/src/mesa/drivers/dri/common/spantmp2.h
+++ b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
@@ -1,1038 +1,916 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (C) Copyright IBM Corporation 2004
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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.
- */
-
-/**
- * \file spantmp2.h
- *
- * Template file of span read / write functions.
- *
- * \author Keith Whitwell <keithw@tungstengraphics.com>
- * \author Gareth Hughes <gareth@nvidia.com>
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "main/colormac.h"
-#include "spantmp_common.h"
-
-#ifndef DBG
-#define DBG 0
-#endif
-
-#ifndef HW_READ_CLIPLOOP
-#define HW_READ_CLIPLOOP()	HW_CLIPLOOP()
-#endif
-
-#ifndef HW_WRITE_CLIPLOOP
-#define HW_WRITE_CLIPLOOP()	HW_CLIPLOOP()
-#endif
-
-#ifdef SPANTMP_MESA_FMT
-#define SPANTMP_PIXEL_FMT GL_NONE
-#define SPANTMP_PIXEL_TYPE GL_NONE
-#endif
-
-#ifndef SPANTMP_MESA_FMT
-#define SPANTMP_MESA_FMT MESA_FORMAT_COUNT
-#endif
-
-#if (SPANTMP_PIXEL_FMT == GL_RGB)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
-
-/**
- ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-#define INIT_MONO_PIXEL(p, color) \
-  p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a )				\
-   PUT_VALUE(_x, _y, ((((int)r & 0xf8) << 8) |				\
-		      (((int)g & 0xfc) << 3) |				\
-		      (((int)b & 0xf8) >> 3)))				\
-
-#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )					\
-   do {									\
-      GLushort p = GET_VALUE(_x, _y);					\
-      rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8;				\
-      rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc;				\
-      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
-      rgba[3] = 0xff;							\
-   } while (0)
-
-#elif (SPANTMP_PIXEL_FMT == GL_RGB)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5_REV)
-
-/**
- ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-#define INIT_MONO_PIXEL(p, color) \
-  p = PACK_COLOR_565_REV( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a )				\
-   PUT_VALUE(_x, _y, PACK_COLOR_565_REV( r, g, b ))
-
-#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )					\
-   do {									\
-      GLushort p = GET_VALUE(_x, _y);					\
-      p = p << 8 | p >> 8;						\
-      rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8;				\
-      rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc;				\
-      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
-      rgba[3] = 0xff;							\
-   } while (0)
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4)
-
-/**
- ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-#define INIT_MONO_PIXEL(p, color) \
-   p = PACK_COLOR_4444_REV(color[3], color[0], color[1], color[2])
-
-#define WRITE_RGBA( _x, _y, r, g, b, a )				\
-   PUT_VALUE(_x, _y, PACK_COLOR_4444_REV(a, r, g, b))			\
-
-#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )					\
-   do {									\
-      GLushort p = GET_VALUE(_x, _y);					\
-      rgba[0] = ((p >> 0) & 0xf) * 0x11;				\
-      rgba[1] = ((p >> 12) & 0xf) * 0x11;				\
-      rgba[2] = ((p >> 4) & 0xf) * 0x11;				\
-      rgba[3] = ((p >> 8) & 0xf) * 0x11;				\
-   } while (0)
-
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV)
-
-/**
- ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-#define INIT_MONO_PIXEL(p, color) \
-   p = PACK_COLOR_4444(color[3], color[0], color[1], color[2])
-
-#define WRITE_RGBA( _x, _y, r, g, b, a )				\
-   PUT_VALUE(_x, _y, PACK_COLOR_4444(a, r, g, b))			\
-
-#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )					\
-   do {									\
-      GLushort p = GET_VALUE(_x, _y);					\
-      rgba[0] = ((p >> 8) & 0xf) * 0x11;				\
-      rgba[1] = ((p >> 4) & 0xf) * 0x11;				\
-      rgba[2] = ((p >> 0) & 0xf) * 0x11;				\
-      rgba[3] = ((p >> 12) & 0xf) * 0x11;				\
-   } while (0)
-
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5_REV)
-
-/**
- ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-#define INIT_MONO_PIXEL(p, color) \
-   p = PACK_COLOR_1555(color[3], color[0], color[1], color[2])
-
-#define WRITE_RGBA( _x, _y, r, g, b, a )				\
-   PUT_VALUE(_x, _y, PACK_COLOR_1555(a, r, g, b))			\
-
-#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )					\
-   do {									\
-      GLushort p = GET_VALUE(_x, _y);					\
-      rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8;				\
-      rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8;				\
-      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
-      rgba[3] = ((p >> 15) & 0x1) * 0xff;				\
-   } while (0)
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5)
-
-/**
- ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-#define INIT_MONO_PIXEL(p, color) \
-   p = PACK_COLOR_1555_REV(color[3], color[0], color[1], color[2])
-
-#define WRITE_RGBA( _x, _y, r, g, b, a )				\
-   PUT_VALUE(_x, _y, PACK_COLOR_1555_REV(a, r, g, b))			\
-
-#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )					\
-   do {									\
-      GLushort p = GET_VALUE(_x, _y);					\
-      p = p << 8 | p >> 8;						\
-      rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8;				\
-      rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8;				\
-      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
-      rgba[3] = ((p >> 15) & 0x1) * 0xff;				\
-   } while (0)
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-
-/**
- ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-     p = PACK_COLOR_8888(color[3], color[0], color[1], color[2]) 
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
-   PUT_VALUE(_x, _y, ((r << 16) |					\
-		      (g << 8) |					\
-		      (b << 0) |					\
-		      (a << 24)))
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-# if defined( USE_X86_ASM )
-#  define READ_RGBA(rgba, _x, _y)                                       \
-    do {                                                                \
-       GLuint p = GET_VALUE(_x, _y);					\
-       __asm__ __volatile__( "bswap	%0; rorl $8, %0"                \
-				: "=r" (p) : "0" (p) );                 \
-       ((GLuint *)rgba)[0] = p;                                         \
-    } while (0)
-# elif defined( MESA_BIG_ENDIAN )
-    /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
-     * rotlwi instruction.  It also produces good code on SPARC.
-     */
-#  define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLuint p = GET_VALUE(_x, _y);					\
-        GLuint t = p;                                                   \
-        *((uint32_t *) rgba) = (t >> 24) | (p << 8);                    \
-     } while (0)
-# else
-#  define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLuint p = GET_VALUE(_x, _y);					\
-	rgba[0] = (p >> 16) & 0xff;					\
-	rgba[1] = (p >>  8) & 0xff;					\
-	rgba[2] = (p >>  0) & 0xff;					\
-	rgba[3] = (p >> 24) & 0xff;					\
-     } while (0)
-# endif
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8)
-
-/**
- ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-     p = PACK_COLOR_8888(color[2], color[1], color[0], color[3]) 
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
-   PUT_VALUE(_x, _y, ((r << 8) |					\
-		      (g << 16) |					\
-		      (b << 24) |					\
-		      (a << 0)))
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-# if defined( USE_X86_ASM )
-#  define READ_RGBA(rgba, _x, _y)                                       \
-    do {                                                                \
-       GLuint p = GET_VALUE(_x, _y);					\
-       __asm__ __volatile__( "rorl $8, %0"				\
-				: "=r" (p) : "0" (p) );                 \
-       ((GLuint *)rgba)[0] = p;                                         \
-    } while (0)
-# elif defined( MESA_BIG_ENDIAN )
-    /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
-     * rotlwi instruction.  It also produces good code on SPARC.
-     */
-#  define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLuint p = CPU_TO_LE32(GET_VALUE(_x, _y));                      \
-        GLuint t = p;                                                   \
-        *((uint32_t *) rgba) = (t >> 24) | (p << 8);                    \
-     } while (0)
-# else
-#  define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLuint p = GET_VALUE(_x, _y);					\
-	rgba[0] = (p >>  8) & 0xff;					\
-	rgba[1] = (p >> 16) & 0xff;					\
-	rgba[2] = (p >> 24) & 0xff;					\
-	rgba[3] = (p >>  0) & 0xff;					\
-     } while (0)
-# endif
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGR) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-
-/**
- ** GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV
- **
- ** This is really for MESA_FORMAT_XRGB8888.  The spantmp code needs to be
- ** kicked to the curb, and we need to just code-gen this.
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-     p = PACK_COLOR_8888(0xff, color[0], color[1], color[2])
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)					\
-   PUT_VALUE(_x, _y, ((r << 16) |					\
-		      (g << 8) |					\
-		      (b << 0) |					\
-		      (0xff << 24)))
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-# if defined( USE_X86_ASM )
-#  define READ_RGBA(rgba, _x, _y)                                       \
-    do {                                                                \
-       GLuint p = GET_VALUE(_x, _y);					\
-       __asm__ __volatile__( "bswap	%0; rorl $8, %0"                \
-				: "=r" (p) : "0" (p) );                 \
-       ((GLuint *)rgba)[0] = p | 0xff000000;				\
-    } while (0)
-# elif defined( MESA_BIG_ENDIAN )
-    /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
-     * rotlwi instruction.  It also produces good code on SPARC.
-     */
-#  define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLuint p = GET_VALUE(_x, _y);					\
-        *((uint32_t *) rgba) = (p << 8) | 0xff;				\
-     } while (0)
-# else
-#  define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLuint p = GET_VALUE(_x, _y);					\
-	rgba[0] = (p >> 16) & 0xff;					\
-	rgba[1] = (p >>  8) & 0xff;					\
-	rgba[2] = (p >>  0) & 0xff;					\
-	rgba[3] = 0xff;							\
-     } while (0)
-# endif
-
-#elif (SPANTMP_PIXEL_FMT == GL_ALPHA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_BYTE)
-
-/**
- ** GL_ALPHA, GL_UNSIGNED_BYTE
- **/
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLubyte *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLubyte *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-     p = color[3]
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
-   PUT_VALUE(_x, _y, a | (r & 0 /* quiet warnings */))
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLubyte p = GET_VALUE(_x, _y);					\
-	rgba[0] = 0;							\
-	rgba[1] = 0;							\
-	rgba[2] = 0;							\
-	rgba[3] = p;							\
-     } while (0)
-
-#elif (SPANTMP_MESA_FMT == MESA_FORMAT_R8)
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLubyte *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLubyte *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-     p = color[0]
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
-   PUT_VALUE(_x, _y, r)
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLubyte p = GET_VALUE(_x, _y);					\
-	rgba[0] = p;							\
-	rgba[1] = 0;							\
-	rgba[2] = 0;							\
-	rgba[3] = 0;							\
-     } while (0)
-
-#elif (SPANTMP_MESA_FMT == MESA_FORMAT_RG88)
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-   PACK_COLOR_8888(color[0], color[1], 0, 0)
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
-   PUT_VALUE(_x, _y, r)
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLushort p = GET_VALUE(_x, _y);					\
-	rgba[0] = p & 0xff;						\
-	rgba[1] = (p >> 8) & 0xff;					\
-	rgba[2] = 0;							\
-	rgba[3] = 0;							\
-     } while (0)
-
-#elif (SPANTMP_MESA_FMT == MESA_FORMAT_R16)
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-     p = color[0]
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
-   PUT_VALUE(_x, _y, r)
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLushort p = GET_VALUE(_x, _y);					\
-	rgba[0] = p;							\
-	rgba[1] = 0;							\
-	rgba[2] = 0;							\
-	rgba[3] = 0;							\
-     } while (0)
-
-#elif (SPANTMP_MESA_FMT == MESA_FORMAT_RG1616)
-
-#ifndef GET_VALUE
-#ifndef GET_PTR
-#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
-#endif
-
-#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
-#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
-#endif /* GET_VALUE */
-
-# define INIT_MONO_PIXEL(p, color)                       \
-   ((color[1] << 16) | (color[0]))
-
-# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
-   PUT_VALUE(_x, _y, r)
-
-#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
-
-#define READ_RGBA( rgba, _x, _y )				        \
-     do {								\
-        GLuint p = GET_VALUE(_x, _y);					\
-	rgba[0] = p & 0xffff;						\
-	rgba[1] = (p >> 16) & 0xffff;					\
-	rgba[2] = 0;							\
-	rgba[3] = 0;							\
-     } while (0)
-
-#else
-#error SPANTMP_PIXEL_FMT must be set to a valid value!
-#endif
-
-
-
-/**
- ** Assembly routines.
- **/
-
-#if defined( USE_MMX_ASM ) || defined( USE_SSE_ASM )
-#include "x86/read_rgba_span_x86.h"
-#include "x86/common_x86_asm.h"
-#endif
-
-static void TAG(WriteRGBASpan)( struct gl_context *ctx,
-                                struct gl_renderbuffer *rb,
-				GLuint n, GLint x, GLint y,
-				const void *values, const GLubyte mask[] )
-{
-   HW_WRITE_LOCK()
-      {
-         const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
-	 GLint x1;
-	 GLint n1;
-	 LOCAL_VARS;
-
-	 y = Y_FLIP(y);
-
-	 HW_WRITE_CLIPLOOP()
-	    {
-	       GLint i = 0;
-	       CLIPSPAN(x,y,n,x1,n1,i);
-
-	       if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n",
-				(int)i, (int)n1, (int)x1);
-
-	       if (mask)
-	       {
-		  for (;n1>0;i++,x1++,n1--)
-		     if (mask[i])
-			WRITE_RGBA( x1, y,
-				    rgba[i][0], rgba[i][1],
-				    rgba[i][2], rgba[i][3] );
-	       }
-	       else
-	       {
-		  for (;n1>0;i++,x1++,n1--)
-		     WRITE_RGBA( x1, y,
-				 rgba[i][0], rgba[i][1],
-				 rgba[i][2], rgba[i][3] );
-	       }
-	    }
-	 HW_ENDCLIPLOOP();
-      }
-   HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBSpan)( struct gl_context *ctx,
-                               struct gl_renderbuffer *rb,
-			       GLuint n, GLint x, GLint y,
-			       const void *values, const GLubyte mask[] )
-{
-   HW_WRITE_LOCK()
-      {
-         const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
-	 GLint x1;
-	 GLint n1;
-	 LOCAL_VARS;
-
-	 y = Y_FLIP(y);
-
-	 HW_WRITE_CLIPLOOP()
-	    {
-	       GLint i = 0;
-	       CLIPSPAN(x,y,n,x1,n1,i);
-
-	       if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n",
-				(int)i, (int)n1, (int)x1);
-
-	       if (mask)
-	       {
-		  for (;n1>0;i++,x1++,n1--)
-		     if (mask[i])
-			WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
-	       }
-	       else
-	       {
-		  for (;n1>0;i++,x1++,n1--)
-		     WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
-	       }
-	    }
-	 HW_ENDCLIPLOOP();
-      }
-   HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBAPixels)( struct gl_context *ctx,
-                                  struct gl_renderbuffer *rb,
-                                  GLuint n, const GLint x[], const GLint y[],
-                                  const void *values, const GLubyte mask[] )
-{
-   HW_WRITE_LOCK()
-      {
-         const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
-	 GLint i;
-	 LOCAL_VARS;
-
-	 if (DBG) fprintf(stderr, "WriteRGBAPixels\n");
-
-	 HW_WRITE_CLIPLOOP()
-	    {
-	       if (mask)
-	       {
-	          for (i=0;i<n;i++)
-	          {
-		     if (mask[i]) {
-		        const int fy = Y_FLIP(y[i]);
-		        if (CLIPPIXEL(x[i],fy))
-			   WRITE_RGBA( x[i], fy,
-				       rgba[i][0], rgba[i][1],
-				       rgba[i][2], rgba[i][3] );
-		     }
-	          }
-	       }
-	       else
-	       {
-	          for (i=0;i<n;i++)
-	          {
-		     const int fy = Y_FLIP(y[i]);
-		     if (CLIPPIXEL(x[i],fy))
-			WRITE_RGBA( x[i], fy,
-				    rgba[i][0], rgba[i][1],
-				    rgba[i][2], rgba[i][3] );
-	          }
-	       }
-	    }
-	 HW_ENDCLIPLOOP();
-      }
-   HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx,	
-                                    struct gl_renderbuffer *rb,
-				    GLuint n, GLint x, GLint y, 
-				    const void *value, const GLubyte mask[] )
-{
-   HW_WRITE_LOCK()
-      {
-         const GLubyte *color = (const GLubyte *) value;
-	 GLint x1;
-	 GLint n1;
-	 LOCAL_VARS;
-	 INIT_MONO_PIXEL(p, color);
-
-	 y = Y_FLIP( y );
-
-	 if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n");
-
-	 HW_WRITE_CLIPLOOP()
-	    {
-	       GLint i = 0;
-	       CLIPSPAN(x,y,n,x1,n1,i);
-	       if (mask)
-	       {
-	          for (;n1>0;i++,x1++,n1--)
-		     if (mask[i])
-		        WRITE_PIXEL( x1, y, p );
-	       }
-	       else
-	       {
-	          for (;n1>0;i++,x1++,n1--)
-		     WRITE_PIXEL( x1, y, p );
-	       }
-	    }
-	 HW_ENDCLIPLOOP();
-      }
-   HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx,
-                                      struct gl_renderbuffer *rb,
-				      GLuint n,
-				      const GLint x[], const GLint y[],
-				      const void *value,
-				      const GLubyte mask[] ) 
-{
-   HW_WRITE_LOCK()
-      {
-         const GLubyte *color = (const GLubyte *) value;
-	 GLint i;
-	 LOCAL_VARS;
-	 INIT_MONO_PIXEL(p, color);
-
-	 if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n");
-
-	 HW_WRITE_CLIPLOOP()
-	    {
-	       if (mask)
-	       {
-		  for (i=0;i<n;i++)
-		     if (mask[i]) {
-			int fy = Y_FLIP(y[i]);
-			if (CLIPPIXEL( x[i], fy ))
-			   WRITE_PIXEL( x[i], fy, p );
-		     }
-	       }
-	       else
-	       {
-		  for (i=0;i<n;i++) {
-		     int fy = Y_FLIP(y[i]);
-		     if (CLIPPIXEL( x[i], fy ))
-			WRITE_PIXEL( x[i], fy, p );
-		  }
-	       }
-	    }
-	 HW_ENDCLIPLOOP();
-      }
-   HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(ReadRGBASpan)( struct gl_context *ctx,
-                               struct gl_renderbuffer *rb,
-			       GLuint n, GLint x, GLint y, void *values)
-{
-   HW_READ_LOCK()
-      {
-         GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
-	 GLint x1,n1;
-	 LOCAL_VARS;
-
-	 y = Y_FLIP(y);
-
-	 if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
-	 HW_READ_CLIPLOOP()
-	    {
-	       GLint i = 0;
-	       CLIPSPAN(x,y,n,x1,n1,i);
-	       for (;n1>0;i++,x1++,n1--)
-		  READ_RGBA( rgba[i], x1, y );
-	    }
-         HW_ENDCLIPLOOP();
-      }
-   HW_READ_UNLOCK();
-}
-
-
-#if defined(GET_PTR) && \
-   defined(USE_MMX_ASM) && \
-   (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
-	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
-    ((SPANTMP_PIXEL_FMT == GL_RGB) && \
-	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
-static void TAG2(ReadRGBASpan,_MMX)( struct gl_context *ctx,
-                                     struct gl_renderbuffer *rb,
-                                     GLuint n, GLint x, GLint y, void *values)
-{
-#ifndef USE_INNER_EMMS
-   /* The EMMS instruction is directly in-lined here because using GCC's
-    * built-in _mm_empty function was found to utterly destroy performance.
-    */
-   __asm__ __volatile__( "emms" );
-#endif
-
-   HW_READ_LOCK()
-     {
-        GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
-	GLint x1,n1;
-	LOCAL_VARS;
-
-	y = Y_FLIP(y);
-
-	if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
-	HW_READ_CLIPLOOP()
-	  {
-	     GLint i = 0;
-	     CLIPSPAN(x,y,n,x1,n1,i);
-
-	       {
-		  const void * src = GET_PTR( x1, y );
-#if (SPANTMP_PIXEL_FMT == GL_RGB) && \
-		  (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
-		  _generic_read_RGBA_span_RGB565_MMX( src, rgba[i], n1 );
-#else
-		  _generic_read_RGBA_span_BGRA8888_REV_MMX( src, rgba[i], n1 );
-#endif
-	       }
-	  }
-	HW_ENDCLIPLOOP();
-     }
-   HW_READ_UNLOCK();
-#ifndef USE_INNER_EMMS
-   __asm__ __volatile__( "emms" );
-#endif
-}
-#endif
-
-
-#if defined(GET_PTR) &&	\
-   defined(USE_SSE_ASM) && \
-   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
-     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE2)( struct gl_context *ctx,
-                                      struct gl_renderbuffer *rb,
-                                      GLuint n, GLint x, GLint y,
-                                      void *values)
-{
-   HW_READ_LOCK()
-     {
-        GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
-	GLint x1,n1;
-	LOCAL_VARS;
-
-	y = Y_FLIP(y);
-
-	if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
-	HW_READ_CLIPLOOP()
-	  {
-	     GLint i = 0;
-	     CLIPSPAN(x,y,n,x1,n1,i);
-
-	       {
-		  const void * src = GET_PTR( x1, y );
-		  _generic_read_RGBA_span_BGRA8888_REV_SSE2( src, rgba[i], n1 );
-	       }
-	  }
-	HW_ENDCLIPLOOP();
-     }
-   HW_READ_UNLOCK();
-}
-#endif
-
-#if defined(GET_PTR) &&	\
-   defined(USE_SSE_ASM) && \
-   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
-     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE)( struct gl_context *ctx,
-                                     struct gl_renderbuffer *rb,
-                                     GLuint n, GLint x, GLint y,
-                                     void *values)
-{
-#ifndef USE_INNER_EMMS
-   /* The EMMS instruction is directly in-lined here because using GCC's
-    * built-in _mm_empty function was found to utterly destroy performance.
-    */
-   __asm__ __volatile__( "emms" );
-#endif
-
-   HW_READ_LOCK()
-     {
-        GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
-	GLint x1,n1;
-	LOCAL_VARS;
-
-	y = Y_FLIP(y);
-
-	if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
-	HW_READ_CLIPLOOP()
-	  {
-	     GLint i = 0;
-	     CLIPSPAN(x,y,n,x1,n1,i);
-
-	       {
-		  const void * src = GET_PTR( x1, y );
-		  _generic_read_RGBA_span_BGRA8888_REV_SSE( src, rgba[i], n1 );
-	       }
-	  }
-	HW_ENDCLIPLOOP();
-     }
-   HW_READ_UNLOCK();
-#ifndef USE_INNER_EMMS
-   __asm__ __volatile__( "emms" );
-#endif
-}
-#endif
-
-
-static void TAG(ReadRGBAPixels)( struct gl_context *ctx,
-                                 struct gl_renderbuffer *rb,
-				 GLuint n, const GLint x[], const GLint y[],
-				 void *values )
-{
-   HW_READ_LOCK()
-      {
-         GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
-	 GLint i;
-	 LOCAL_VARS;
-
-	 if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
-
-	 HW_READ_CLIPLOOP()
-	    {
-               for (i=0;i<n;i++) {
-                  int fy = Y_FLIP( y[i] );
-                     if (CLIPPIXEL( x[i], fy ))
-                        READ_RGBA( rgba[i], x[i], fy );
-               }
-	    }
-	 HW_ENDCLIPLOOP();
-      }
-   HW_READ_UNLOCK();
-}
-
-static void TAG(InitPointers)(struct gl_renderbuffer *rb)
-{
-   rb->PutRow = TAG(WriteRGBASpan);
-   rb->PutRowRGB = TAG(WriteRGBSpan);
-   rb->PutMonoRow = TAG(WriteMonoRGBASpan);
-   rb->PutValues = TAG(WriteRGBAPixels);
-   rb->PutMonoValues = TAG(WriteMonoRGBAPixels);
-   rb->GetValues = TAG(ReadRGBAPixels);
-
-#if defined(GET_PTR)
-#if defined(USE_SSE_ASM) && \
-   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
-     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-   if ( cpu_has_xmm2 ) {
-      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" );
-      rb->GetRow = TAG2(ReadRGBASpan, _SSE2);
-   }
-   else
-#endif
-#if defined(USE_SSE_ASM) && \
-   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
-     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-   if ( cpu_has_xmm ) {
-      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" );
-      rb->GetRow = TAG2(ReadRGBASpan, _SSE);
-   }
-   else
-#endif
-#if defined(USE_MMX_ASM) && \
-   (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
-	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
-    ((SPANTMP_PIXEL_FMT == GL_RGB) && \
-	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
-   if ( cpu_has_mmx ) {
-      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" );
-      rb->GetRow = TAG2(ReadRGBASpan, _MMX);
-   }
-   else
-#endif
-#endif /* GET_PTR */
-   {
-      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" );
-      rb->GetRow = TAG(ReadRGBASpan);
-   }
-
-}
-
-
-#undef INIT_MONO_PIXEL
-#undef WRITE_PIXEL
-#undef WRITE_RGBA
-#undef READ_RGBA
-#undef TAG
-#undef TAG2
-#undef GET_VALUE
-#undef PUT_VALUE
-#undef GET_PTR
-#undef SPANTMP_PIXEL_FMT
-#undef SPANTMP_PIXEL_TYPE
-#undef SPANTMP_MESA_FMT
+/*
+ * Copyright 2000-2001 VA Linux Systems, Inc.
+ * (C) Copyright IBM Corporation 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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.
+ */
+
+/**
+ * \file spantmp2.h
+ *
+ * Template file of span read / write functions.
+ *
+ * \author Keith Whitwell <keithw@tungstengraphics.com>
+ * \author Gareth Hughes <gareth@nvidia.com>
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#include "main/colormac.h"
+#include "spantmp_common.h"
+
+#ifndef DBG
+#define DBG 0
+#endif
+
+#ifndef HW_READ_CLIPLOOP
+#define HW_READ_CLIPLOOP()	HW_CLIPLOOP()
+#endif
+
+#ifndef HW_WRITE_CLIPLOOP
+#define HW_WRITE_CLIPLOOP()	HW_CLIPLOOP()
+#endif
+
+#if (SPANTMP_PIXEL_FMT == GL_RGB)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
+
+/**
+ ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+  p = PACK_COLOR_565( color[0], color[1], color[2] )
+
+#define WRITE_RGBA( _x, _y, r, g, b, a )				\
+   PUT_VALUE(_x, _y, ((((int)r & 0xf8) << 8) |				\
+		      (((int)g & 0xfc) << 3) |				\
+		      (((int)b & 0xf8) >> 3)))				\
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )					\
+   do {									\
+      GLushort p = GET_VALUE(_x, _y);					\
+      rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8;				\
+      rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc;				\
+      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
+      rgba[3] = 0xff;							\
+   } while (0)
+
+#elif (SPANTMP_PIXEL_FMT == GL_RGB)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5_REV)
+
+/**
+ ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+  p = PACK_COLOR_565_REV( color[0], color[1], color[2] )
+
+#define WRITE_RGBA( _x, _y, r, g, b, a )				\
+   PUT_VALUE(_x, _y, PACK_COLOR_565_REV( r, g, b ))
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )					\
+   do {									\
+      GLushort p = GET_VALUE(_x, _y);					\
+      p = p << 8 | p >> 8;						\
+      rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8;				\
+      rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc;				\
+      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
+      rgba[3] = 0xff;							\
+   } while (0)
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+   p = PACK_COLOR_4444_REV(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a )				\
+   PUT_VALUE(_x, _y, PACK_COLOR_4444_REV(a, r, g, b))			\
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )					\
+   do {									\
+      GLushort p = GET_VALUE(_x, _y);					\
+      rgba[0] = ((p >> 0) & 0xf) * 0x11;				\
+      rgba[1] = ((p >> 12) & 0xf) * 0x11;				\
+      rgba[2] = ((p >> 4) & 0xf) * 0x11;				\
+      rgba[3] = ((p >> 8) & 0xf) * 0x11;				\
+   } while (0)
+
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+   p = PACK_COLOR_4444(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a )				\
+   PUT_VALUE(_x, _y, PACK_COLOR_4444(a, r, g, b))			\
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )					\
+   do {									\
+      GLushort p = GET_VALUE(_x, _y);					\
+      rgba[0] = ((p >> 8) & 0xf) * 0x11;				\
+      rgba[1] = ((p >> 4) & 0xf) * 0x11;				\
+      rgba[2] = ((p >> 0) & 0xf) * 0x11;				\
+      rgba[3] = ((p >> 12) & 0xf) * 0x11;				\
+   } while (0)
+
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5_REV)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+   p = PACK_COLOR_1555(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a )				\
+   PUT_VALUE(_x, _y, PACK_COLOR_1555(a, r, g, b))			\
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )					\
+   do {									\
+      GLushort p = GET_VALUE(_x, _y);					\
+      rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8;				\
+      rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8;				\
+      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
+      rgba[3] = ((p >> 15) & 0x1) * 0xff;				\
+   } while (0)
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+   p = PACK_COLOR_1555_REV(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a )				\
+   PUT_VALUE(_x, _y, PACK_COLOR_1555_REV(a, r, g, b))			\
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )					\
+   do {									\
+      GLushort p = GET_VALUE(_x, _y);					\
+      p = p << 8 | p >> 8;						\
+      rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8;				\
+      rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8;				\
+      rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8;				\
+      rgba[3] = ((p >> 15) & 0x1) * 0xff;				\
+   } while (0)
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+     p = PACK_COLOR_8888(color[3], color[0], color[1], color[2]) 
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
+   PUT_VALUE(_x, _y, ((r << 16) |					\
+		      (g << 8) |					\
+		      (b << 0) |					\
+		      (a << 24)))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+# if defined( USE_X86_ASM )
+#  define READ_RGBA(rgba, _x, _y)                                       \
+    do {                                                                \
+       GLuint p = GET_VALUE(_x, _y);					\
+       __asm__ __volatile__( "bswap	%0; rorl $8, %0"                \
+				: "=r" (p) : "0" (p) );                 \
+       ((GLuint *)rgba)[0] = p;                                         \
+    } while (0)
+# elif defined( MESA_BIG_ENDIAN )
+    /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+     * rotlwi instruction.  It also produces good code on SPARC.
+     */
+#  define READ_RGBA( rgba, _x, _y )				        \
+     do {								\
+        GLuint p = GET_VALUE(_x, _y);					\
+        GLuint t = p;                                                   \
+        *((uint32_t *) rgba) = (t >> 24) | (p << 8);                    \
+     } while (0)
+# else
+#  define READ_RGBA( rgba, _x, _y )				        \
+     do {								\
+        GLuint p = GET_VALUE(_x, _y);					\
+	rgba[0] = (p >> 16) & 0xff;					\
+	rgba[1] = (p >>  8) & 0xff;					\
+	rgba[2] = (p >>  0) & 0xff;					\
+	rgba[3] = (p >> 24) & 0xff;					\
+     } while (0)
+# endif
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+     p = PACK_COLOR_8888(color[2], color[1], color[0], color[3]) 
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
+   PUT_VALUE(_x, _y, ((r << 8) |					\
+		      (g << 16) |					\
+		      (b << 24) |					\
+		      (a << 0)))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+# if defined( USE_X86_ASM )
+#  define READ_RGBA(rgba, _x, _y)                                       \
+    do {                                                                \
+       GLuint p = GET_VALUE(_x, _y);					\
+       __asm__ __volatile__( "rorl $8, %0"				\
+				: "=r" (p) : "0" (p) );                 \
+       ((GLuint *)rgba)[0] = p;                                         \
+    } while (0)
+# elif defined( MESA_BIG_ENDIAN )
+    /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+     * rotlwi instruction.  It also produces good code on SPARC.
+     */
+#  define READ_RGBA( rgba, _x, _y )				        \
+     do {								\
+        GLuint p = CPU_TO_LE32(GET_VALUE(_x, _y));                      \
+        GLuint t = p;                                                   \
+        *((uint32_t *) rgba) = (t >> 24) | (p << 8);                    \
+     } while (0)
+# else
+#  define READ_RGBA( rgba, _x, _y )				        \
+     do {								\
+        GLuint p = GET_VALUE(_x, _y);					\
+	rgba[0] = (p >>  8) & 0xff;					\
+	rgba[1] = (p >> 16) & 0xff;					\
+	rgba[2] = (p >> 24) & 0xff;					\
+	rgba[3] = (p >>  0) & 0xff;					\
+     } while (0)
+# endif
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGR) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
+
+/**
+ ** GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV
+ **
+ ** This is really for MESA_FORMAT_XRGB8888.  The spantmp code needs to be
+ ** kicked to the curb, and we need to just code-gen this.
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+     p = PACK_COLOR_8888(0xff, color[0], color[1], color[2])
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)					\
+   PUT_VALUE(_x, _y, ((r << 16) |					\
+		      (g << 8) |					\
+		      (b << 0) |					\
+		      (0xff << 24)))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+# if defined( USE_X86_ASM )
+#  define READ_RGBA(rgba, _x, _y)                                       \
+    do {                                                                \
+       GLuint p = GET_VALUE(_x, _y);					\
+       __asm__ __volatile__( "bswap	%0; rorl $8, %0"                \
+				: "=r" (p) : "0" (p) );                 \
+       ((GLuint *)rgba)[0] = p | 0xff000000;				\
+    } while (0)
+# elif defined( MESA_BIG_ENDIAN )
+    /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+     * rotlwi instruction.  It also produces good code on SPARC.
+     */
+#  define READ_RGBA( rgba, _x, _y )				        \
+     do {								\
+        GLuint p = GET_VALUE(_x, _y);					\
+        *((uint32_t *) rgba) = (p << 8) | 0xff;				\
+     } while (0)
+# else
+#  define READ_RGBA( rgba, _x, _y )				        \
+     do {								\
+        GLuint p = GET_VALUE(_x, _y);					\
+	rgba[0] = (p >> 16) & 0xff;					\
+	rgba[1] = (p >>  8) & 0xff;					\
+	rgba[2] = (p >>  0) & 0xff;					\
+	rgba[3] = 0xff;							\
+     } while (0)
+# endif
+
+#elif (SPANTMP_PIXEL_FMT == GL_ALPHA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_BYTE)
+
+/**
+ ** GL_ALPHA, GL_UNSIGNED_BYTE
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLubyte *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLubyte *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+     p = color[3]
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
+   PUT_VALUE(_x, _y, a | (r & 0 /* quiet warnings */))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )				        \
+     do {								\
+        GLubyte p = GET_VALUE(_x, _y);					\
+	rgba[0] = 0;							\
+	rgba[1] = 0;							\
+	rgba[2] = 0;							\
+	rgba[3] = p;							\
+     } while (0)
+
+#else
+#error SPANTMP_PIXEL_FMT must be set to a valid value!
+#endif
+
+
+
+/**
+ ** Assembly routines.
+ **/
+
+#if defined( USE_MMX_ASM ) || defined( USE_SSE_ASM )
+#include "x86/read_rgba_span_x86.h"
+#include "x86/common_x86_asm.h"
+#endif
+
+static void TAG(WriteRGBASpan)( struct gl_context *ctx,
+                                struct gl_renderbuffer *rb,
+				GLuint n, GLint x, GLint y,
+				const void *values, const GLubyte mask[] )
+{
+   HW_WRITE_LOCK()
+      {
+         const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
+	 GLint x1;
+	 GLint n1;
+	 LOCAL_VARS;
+
+	 y = Y_FLIP(y);
+
+	 HW_WRITE_CLIPLOOP()
+	    {
+	       GLint i = 0;
+	       CLIPSPAN(x,y,n,x1,n1,i);
+
+	       if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n",
+				(int)i, (int)n1, (int)x1);
+
+	       if (mask)
+	       {
+		  for (;n1>0;i++,x1++,n1--)
+		     if (mask[i])
+			WRITE_RGBA( x1, y,
+				    rgba[i][0], rgba[i][1],
+				    rgba[i][2], rgba[i][3] );
+	       }
+	       else
+	       {
+		  for (;n1>0;i++,x1++,n1--)
+		     WRITE_RGBA( x1, y,
+				 rgba[i][0], rgba[i][1],
+				 rgba[i][2], rgba[i][3] );
+	       }
+	    }
+	 HW_ENDCLIPLOOP();
+      }
+   HW_WRITE_UNLOCK();
+}
+
+static void TAG(WriteRGBSpan)( struct gl_context *ctx,
+                               struct gl_renderbuffer *rb,
+			       GLuint n, GLint x, GLint y,
+			       const void *values, const GLubyte mask[] )
+{
+   HW_WRITE_LOCK()
+      {
+         const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
+	 GLint x1;
+	 GLint n1;
+	 LOCAL_VARS;
+
+	 y = Y_FLIP(y);
+
+	 HW_WRITE_CLIPLOOP()
+	    {
+	       GLint i = 0;
+	       CLIPSPAN(x,y,n,x1,n1,i);
+
+	       if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n",
+				(int)i, (int)n1, (int)x1);
+
+	       if (mask)
+	       {
+		  for (;n1>0;i++,x1++,n1--)
+		     if (mask[i])
+			WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
+	       }
+	       else
+	       {
+		  for (;n1>0;i++,x1++,n1--)
+		     WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
+	       }
+	    }
+	 HW_ENDCLIPLOOP();
+      }
+   HW_WRITE_UNLOCK();
+}
+
+static void TAG(WriteRGBAPixels)( struct gl_context *ctx,
+                                  struct gl_renderbuffer *rb,
+                                  GLuint n, const GLint x[], const GLint y[],
+                                  const void *values, const GLubyte mask[] )
+{
+   HW_WRITE_LOCK()
+      {
+         const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
+	 GLint i;
+	 LOCAL_VARS;
+
+	 if (DBG) fprintf(stderr, "WriteRGBAPixels\n");
+
+	 HW_WRITE_CLIPLOOP()
+	    {
+	       if (mask)
+	       {
+	          for (i=0;i<n;i++)
+	          {
+		     if (mask[i]) {
+		        const int fy = Y_FLIP(y[i]);
+		        if (CLIPPIXEL(x[i],fy))
+			   WRITE_RGBA( x[i], fy,
+				       rgba[i][0], rgba[i][1],
+				       rgba[i][2], rgba[i][3] );
+		     }
+	          }
+	       }
+	       else
+	       {
+	          for (i=0;i<n;i++)
+	          {
+		     const int fy = Y_FLIP(y[i]);
+		     if (CLIPPIXEL(x[i],fy))
+			WRITE_RGBA( x[i], fy,
+				    rgba[i][0], rgba[i][1],
+				    rgba[i][2], rgba[i][3] );
+	          }
+	       }
+	    }
+	 HW_ENDCLIPLOOP();
+      }
+   HW_WRITE_UNLOCK();
+}
+
+
+static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx,	
+                                    struct gl_renderbuffer *rb,
+				    GLuint n, GLint x, GLint y, 
+				    const void *value, const GLubyte mask[] )
+{
+   HW_WRITE_LOCK()
+      {
+         const GLubyte *color = (const GLubyte *) value;
+	 GLint x1;
+	 GLint n1;
+	 LOCAL_VARS;
+	 INIT_MONO_PIXEL(p, color);
+
+	 y = Y_FLIP( y );
+
+	 if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n");
+
+	 HW_WRITE_CLIPLOOP()
+	    {
+	       GLint i = 0;
+	       CLIPSPAN(x,y,n,x1,n1,i);
+	       if (mask)
+	       {
+	          for (;n1>0;i++,x1++,n1--)
+		     if (mask[i])
+		        WRITE_PIXEL( x1, y, p );
+	       }
+	       else
+	       {
+	          for (;n1>0;i++,x1++,n1--)
+		     WRITE_PIXEL( x1, y, p );
+	       }
+	    }
+	 HW_ENDCLIPLOOP();
+      }
+   HW_WRITE_UNLOCK();
+}
+
+
+static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx,
+                                      struct gl_renderbuffer *rb,
+				      GLuint n,
+				      const GLint x[], const GLint y[],
+				      const void *value,
+				      const GLubyte mask[] ) 
+{
+   HW_WRITE_LOCK()
+      {
+         const GLubyte *color = (const GLubyte *) value;
+	 GLint i;
+	 LOCAL_VARS;
+	 INIT_MONO_PIXEL(p, color);
+
+	 if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n");
+
+	 HW_WRITE_CLIPLOOP()
+	    {
+	       if (mask)
+	       {
+		  for (i=0;i<n;i++)
+		     if (mask[i]) {
+			int fy = Y_FLIP(y[i]);
+			if (CLIPPIXEL( x[i], fy ))
+			   WRITE_PIXEL( x[i], fy, p );
+		     }
+	       }
+	       else
+	       {
+		  for (i=0;i<n;i++) {
+		     int fy = Y_FLIP(y[i]);
+		     if (CLIPPIXEL( x[i], fy ))
+			WRITE_PIXEL( x[i], fy, p );
+		  }
+	       }
+	    }
+	 HW_ENDCLIPLOOP();
+      }
+   HW_WRITE_UNLOCK();
+}
+
+
+static void TAG(ReadRGBASpan)( struct gl_context *ctx,
+                               struct gl_renderbuffer *rb,
+			       GLuint n, GLint x, GLint y, void *values)
+{
+   HW_READ_LOCK()
+      {
+         GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
+	 GLint x1,n1;
+	 LOCAL_VARS;
+
+	 y = Y_FLIP(y);
+
+	 if (DBG) fprintf(stderr, "ReadRGBASpan\n");
+
+	 HW_READ_CLIPLOOP()
+	    {
+	       GLint i = 0;
+	       CLIPSPAN(x,y,n,x1,n1,i);
+	       for (;n1>0;i++,x1++,n1--)
+		  READ_RGBA( rgba[i], x1, y );
+	    }
+         HW_ENDCLIPLOOP();
+      }
+   HW_READ_UNLOCK();
+}
+
+
+#if defined(GET_PTR) && \
+   defined(USE_MMX_ASM) && \
+   (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
+	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
+    ((SPANTMP_PIXEL_FMT == GL_RGB) && \
+	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
+static void TAG2(ReadRGBASpan,_MMX)( struct gl_context *ctx,
+                                     struct gl_renderbuffer *rb,
+                                     GLuint n, GLint x, GLint y, void *values)
+{
+#ifndef USE_INNER_EMMS
+   /* The EMMS instruction is directly in-lined here because using GCC's
+    * built-in _mm_empty function was found to utterly destroy performance.
+    */
+   __asm__ __volatile__( "emms" );
+#endif
+
+   HW_READ_LOCK()
+     {
+        GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
+	GLint x1,n1;
+	LOCAL_VARS;
+
+	y = Y_FLIP(y);
+
+	if (DBG) fprintf(stderr, "ReadRGBASpan\n");
+
+	HW_READ_CLIPLOOP()
+	  {
+	     GLint i = 0;
+	     CLIPSPAN(x,y,n,x1,n1,i);
+
+	       {
+		  const void * src = GET_PTR( x1, y );
+#if (SPANTMP_PIXEL_FMT == GL_RGB) && \
+		  (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
+		  _generic_read_RGBA_span_RGB565_MMX( src, rgba[i], n1 );
+#else
+		  _generic_read_RGBA_span_BGRA8888_REV_MMX( src, rgba[i], n1 );
+#endif
+	       }
+	  }
+	HW_ENDCLIPLOOP();
+     }
+   HW_READ_UNLOCK();
+#ifndef USE_INNER_EMMS
+   __asm__ __volatile__( "emms" );
+#endif
+}
+#endif
+
+
+#if defined(GET_PTR) &&	\
+   defined(USE_SSE_ASM) && \
+   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
+static void TAG2(ReadRGBASpan,_SSE2)( struct gl_context *ctx,
+                                      struct gl_renderbuffer *rb,
+                                      GLuint n, GLint x, GLint y,
+                                      void *values)
+{
+   HW_READ_LOCK()
+     {
+        GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
+	GLint x1,n1;
+	LOCAL_VARS;
+
+	y = Y_FLIP(y);
+
+	if (DBG) fprintf(stderr, "ReadRGBASpan\n");
+
+	HW_READ_CLIPLOOP()
+	  {
+	     GLint i = 0;
+	     CLIPSPAN(x,y,n,x1,n1,i);
+
+	       {
+		  const void * src = GET_PTR( x1, y );
+		  _generic_read_RGBA_span_BGRA8888_REV_SSE2( src, rgba[i], n1 );
+	       }
+	  }
+	HW_ENDCLIPLOOP();
+     }
+   HW_READ_UNLOCK();
+}
+#endif
+
+#if defined(GET_PTR) &&	\
+   defined(USE_SSE_ASM) && \
+   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
+static void TAG2(ReadRGBASpan,_SSE)( struct gl_context *ctx,
+                                     struct gl_renderbuffer *rb,
+                                     GLuint n, GLint x, GLint y,
+                                     void *values)
+{
+#ifndef USE_INNER_EMMS
+   /* The EMMS instruction is directly in-lined here because using GCC's
+    * built-in _mm_empty function was found to utterly destroy performance.
+    */
+   __asm__ __volatile__( "emms" );
+#endif
+
+   HW_READ_LOCK()
+     {
+        GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
+	GLint x1,n1;
+	LOCAL_VARS;
+
+	y = Y_FLIP(y);
+
+	if (DBG) fprintf(stderr, "ReadRGBASpan\n");
+
+	HW_READ_CLIPLOOP()
+	  {
+	     GLint i = 0;
+	     CLIPSPAN(x,y,n,x1,n1,i);
+
+	       {
+		  const void * src = GET_PTR( x1, y );
+		  _generic_read_RGBA_span_BGRA8888_REV_SSE( src, rgba[i], n1 );
+	       }
+	  }
+	HW_ENDCLIPLOOP();
+     }
+   HW_READ_UNLOCK();
+#ifndef USE_INNER_EMMS
+   __asm__ __volatile__( "emms" );
+#endif
+}
+#endif
+
+
+static void TAG(ReadRGBAPixels)( struct gl_context *ctx,
+                                 struct gl_renderbuffer *rb,
+				 GLuint n, const GLint x[], const GLint y[],
+				 void *values )
+{
+   HW_READ_LOCK()
+      {
+         GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
+	 GLint i;
+	 LOCAL_VARS;
+
+	 if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
+
+	 HW_READ_CLIPLOOP()
+	    {
+               for (i=0;i<n;i++) {
+                  int fy = Y_FLIP( y[i] );
+                     if (CLIPPIXEL( x[i], fy ))
+                        READ_RGBA( rgba[i], x[i], fy );
+               }
+	    }
+	 HW_ENDCLIPLOOP();
+      }
+   HW_READ_UNLOCK();
+}
+
+static void TAG(InitPointers)(struct gl_renderbuffer *rb)
+{
+   rb->PutRow = TAG(WriteRGBASpan);
+   rb->PutRowRGB = TAG(WriteRGBSpan);
+   rb->PutMonoRow = TAG(WriteMonoRGBASpan);
+   rb->PutValues = TAG(WriteRGBAPixels);
+   rb->PutMonoValues = TAG(WriteMonoRGBAPixels);
+   rb->GetValues = TAG(ReadRGBAPixels);
+
+#if defined(GET_PTR)
+#if defined(USE_SSE_ASM) && \
+   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
+   if ( cpu_has_xmm2 ) {
+      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" );
+      rb->GetRow = TAG2(ReadRGBASpan, _SSE2);
+   }
+   else
+#endif
+#if defined(USE_SSE_ASM) && \
+   (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+     (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
+   if ( cpu_has_xmm ) {
+      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" );
+      rb->GetRow = TAG2(ReadRGBASpan, _SSE);
+   }
+   else
+#endif
+#if defined(USE_MMX_ASM) && \
+   (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
+	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
+    ((SPANTMP_PIXEL_FMT == GL_RGB) && \
+	(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
+   if ( cpu_has_mmx ) {
+      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" );
+      rb->GetRow = TAG2(ReadRGBASpan, _MMX);
+   }
+   else
+#endif
+#endif /* GET_PTR */
+   {
+      if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" );
+      rb->GetRow = TAG(ReadRGBASpan);
+   }
+
+}
+
+
+#undef INIT_MONO_PIXEL
+#undef WRITE_PIXEL
+#undef WRITE_RGBA
+#undef READ_RGBA
+#undef TAG
+#undef TAG2
+#undef GET_VALUE
+#undef PUT_VALUE
+#undef GET_PTR
+#undef SPANTMP_PIXEL_FMT
+#undef SPANTMP_PIXEL_TYPE
diff --git a/mesalib/src/mesa/drivers/windows/fx/fx.rc b/mesalib/src/mesa/drivers/windows/fx/fx.rc
deleted file mode 100644
index a9aedfc97..000000000
--- a/mesalib/src/mesa/drivers/windows/fx/fx.rc
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <windows.h>
-
-#define PRODNAME                "Mesa 6.x"
-#define CONTACTSTR              "http://www.mesa3d.org"
-#define HWSTR                   "3dfx Voodoo Graphics, Voodoo Rush, Voodoo^2, Voodoo Banshee, Velocity 100/200, Voodoo3, Voodoo4, Voodoo5"
-#define COPYRIGHTSTR            "Copyright \251 Brian E. Paul"
-
-#define VERSIONSTR              "6.3.0.1"
-#define MANVERSION              6
-#define MANREVISION             3
-#define BUILD_NUMBER            1
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
- PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
- FILEFLAGSMASK 0x0030003FL
-
- FILEOS VOS_DOS_WINDOWS32
- FILETYPE VFT_DRV
- FILESUBTYPE VFT2_DRV_INSTALLABLE
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904E4"
-        BEGIN
-            VALUE "FileDescription", PRODNAME
-            VALUE "FileVersion", VERSIONSTR
-            VALUE "LegalCopyright", COPYRIGHTSTR
-            VALUE "ProductName", PRODNAME
-            VALUE "Graphics Subsystem", HWSTR
-            VALUE "Contact", CONTACTSTR
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        /* the following line should be extended for localized versions */
-        VALUE "Translation", 0x409, 1252
-    END
-END
diff --git a/mesalib/src/mesa/drivers/windows/fx/fxopengl.def b/mesalib/src/mesa/drivers/windows/fx/fxopengl.def
deleted file mode 100644
index 8714ae983..000000000
--- a/mesalib/src/mesa/drivers/windows/fx/fxopengl.def
+++ /dev/null
@@ -1,953 +0,0 @@
-LIBRARY OpenGL32
-DESCRIPTION "Mesa 5.1"
-EXPORTS
- glAccum
- glActiveStencilFaceEXT
- glActiveTexture
- glActiveTextureARB
- glAlphaFunc
- glAreProgramsResidentNV
- glAreTexturesResident
- glAreTexturesResidentEXT
- glArrayElement
- glArrayElementEXT
- glBegin
- glBeginQueryARB
- glBindBufferARB
- glBindProgramARB
- glBindProgramNV
- glBindTexture
- glBindTextureEXT
- glBitmap
-;glBlendColor
-;glBlendColorEXT
- glBlendEquation
- glBlendEquationEXT
- glBlendFunc
- glBlendFuncSeparate
- glBlendFuncSeparateEXT
- glBlendFuncSeparateINGR
- glBufferDataARB
- glBufferSubDataARB
- glCallList
- glCallLists
- glClear
- glClearAccum
- glClearColor
- glClearDepth
- glClearIndex
- glClearStencil
- glClientActiveTexture
- glClientActiveTextureARB
- glClipPlane
- glColorMask
- glColorMaterial
- glColorPointer
- glColorPointerEXT
- glColorSubTable
- glColorSubTableEXT
- glColorTable
- glColorTableEXT
- glColorTableParameterfv
- glColorTableParameterfvSGI
- glColorTableParameteriv
- glColorTableParameterivSGI
- glColorTableSGI
- glColor3b
- glColor3bv
- glColor3d
- glColor3dv
- glColor3f
- glColor3fv
- glColor3i
- glColor3iv
- glColor3s
- glColor3sv
- glColor3ub
- glColor3ubv
- glColor3ui
- glColor3uiv
- glColor3us
- glColor3usv
- glColor4b
- glColor4bv
- glColor4d
- glColor4dv
- glColor4f
- glColor4fv
- glColor4i
- glColor4iv
- glColor4s
- glColor4sv
- glColor4ub
- glColor4ubv
- glColor4ui
- glColor4uiv
- glColor4us
- glColor4usv
- glCombinerInputNV
- glCombinerOutputNV
- glCombinerParameterfNV
- glCombinerParameterfvNV
- glCombinerParameteriNV
- glCombinerParameterivNV
- glCompressedTexImage1D
- glCompressedTexImage1DARB
- glCompressedTexImage2D
- glCompressedTexImage2DARB
- glCompressedTexImage3D
- glCompressedTexImage3DARB
- glCompressedTexSubImage1D
- glCompressedTexSubImage1DARB
- glCompressedTexSubImage2D
- glCompressedTexSubImage2DARB
- glCompressedTexSubImage3D
- glCompressedTexSubImage3DARB
- glConvolutionFilter1D
- glConvolutionFilter1DEXT
- glConvolutionFilter2D
- glConvolutionFilter2DEXT
- glConvolutionParameterf
- glConvolutionParameterfEXT
- glConvolutionParameterfv
- glConvolutionParameterfvEXT
- glConvolutionParameteri
- glConvolutionParameteriEXT
- glConvolutionParameteriv
- glConvolutionParameterivEXT
- glCopyColorSubTable
- glCopyColorSubTableEXT
- glCopyColorTable
- glCopyColorTableSGI
- glCopyConvolutionFilter1D
- glCopyConvolutionFilter1DEXT
- glCopyConvolutionFilter2D
- glCopyConvolutionFilter2DEXT
- glCopyPixels
- glCopyTexImage1D
- glCopyTexImage1DEXT
- glCopyTexImage2D
- glCopyTexImage2DEXT
- glCopyTexSubImage1D
- glCopyTexSubImage1DEXT
- glCopyTexSubImage2D
- glCopyTexSubImage2DEXT
- glCopyTexSubImage3D
- glCopyTexSubImage3DEXT
- glCullFace
- glDeleteBuffersARB
- glDeleteFencesNV
- glDeleteLists
- glDeleteProgramsARB
- glDeleteProgramsNV
- glDeleteQueriesARB
- glDeleteTextures
- glDeleteTexturesEXT
- glDepthBoundsEXT
- glDepthFunc
- glDepthMask
- glDepthRange
- glDetailTexFuncSGIS
- glDisable
- glDisableClientState
- glDisableVertexAttribArrayARB
- glDrawArrays
- glDrawArraysEXT
- glDrawBuffer
- glDrawElements
- glDrawPixels
- glDrawRangeElements
- glDrawRangeElementsEXT
- glEdgeFlag
- glEdgeFlagPointer
- glEdgeFlagPointerEXT
- glEdgeFlagv
- glEnable
- glEnableClientState
- glEnableVertexAttribArrayARB
- glEnd
- glEndList
- glEndQueryARB
- glEvalCoord1d
- glEvalCoord1dv
- glEvalCoord1f
- glEvalCoord1fv
- glEvalCoord2d
- glEvalCoord2dv
- glEvalCoord2f
- glEvalCoord2fv
- glEvalMesh1
- glEvalMesh2
- glEvalPoint1
- glEvalPoint2
- glExecuteProgramNV
- glFeedbackBuffer
- glFinalCombinerInputNV
- glFinish
- glFinishFenceNV
- glFlush
- glFlushRasterSGIX
- glFlushVertexArrayRangeNV
- glFogCoordd
- glFogCoorddEXT
- glFogCoorddv
- glFogCoorddvEXT
- glFogCoordf
- glFogCoordfEXT
- glFogCoordfv
- glFogCoordfvEXT
- glFogCoordPointer
- glFogCoordPointerEXT
- glFogf
- glFogfv
- glFogi
- glFogiv
- glFragmentColorMaterialSGIX
- glFragmentLightfSGIX
- glFragmentLightfvSGIX
- glFragmentLightiSGIX
- glFragmentLightivSGIX
- glFragmentLightModelfSGIX
- glFragmentLightModelfvSGIX
- glFragmentLightModeliSGIX
- glFragmentLightModelivSGIX
- glFragmentMaterialfSGIX
- glFragmentMaterialfvSGIX
- glFragmentMaterialiSGIX
- glFragmentMaterialivSGIX
- glFrameZoomSGIX
- glFrontFace
- glFrustum
- glGenBuffersARB
- glGenFencesNV
- glGenLists
- glGenProgramsARB
- glGenProgramsNV
- glGenQueriesARB
- glGenTextures
- glGenTexturesEXT
- glGetBooleanv
- glGetBufferParameterivARB
- glGetBufferPointervARB
- glGetBufferSubDataARB
- glGetClipPlane
- glGetColorTable
- glGetColorTableEXT
- glGetColorTableParameterfv
- glGetColorTableParameterfvEXT
- glGetColorTableParameterfvSGI
- glGetColorTableParameteriv
- glGetColorTableParameterivEXT
- glGetColorTableParameterivSGI
- glGetColorTableSGI
- glGetCombinerInputParameterfvNV
- glGetCombinerInputParameterivNV
- glGetCombinerOutputParameterfvNV
- glGetCombinerOutputParameterivNV
- glGetCompressedTexImage
- glGetCompressedTexImageARB
- glGetConvolutionFilter
- glGetConvolutionFilterEXT
- glGetConvolutionParameterfv
- glGetConvolutionParameterfvEXT
- glGetConvolutionParameteriv
- glGetConvolutionParameterivEXT
- glGetDetailTexFuncSGIS
- glGetDoublev
- glGetError
- glGetFenceivNV
- glGetFinalCombinerInputParameterfvNV
- glGetFinalCombinerInputParameterivNV
- glGetFloatv
- glGetFragmentLightfvSGIX
- glGetFragmentLightivSGIX
- glGetFragmentMaterialfvSGIX
- glGetFragmentMaterialivSGIX
- glGetHistogram
- glGetHistogramEXT
- glGetHistogramParameterfv
- glGetHistogramParameterfvEXT
- glGetHistogramParameteriv
- glGetHistogramParameterivEXT
- glGetInstrumentsSGIX
- glGetIntegerv
- glGetLightfv
- glGetLightiv
- glGetListParameterfvSGIX
- glGetListParameterivSGIX
- glGetMapdv
- glGetMapfv
- glGetMapiv
- glGetMaterialfv
- glGetMaterialiv
- glGetMinmax
- glGetMinmaxEXT
- glGetMinmaxParameterfv
- glGetMinmaxParameterfvEXT
- glGetMinmaxParameteriv
- glGetMinmaxParameterivEXT
- glGetPixelMapfv
- glGetPixelMapuiv
- glGetPixelMapusv
- glGetPixelTexGenParameterfvSGIS
- glGetPixelTexGenParameterivSGIS
- glGetPointerv
- glGetPointervEXT
- glGetPolygonStipple
- glGetProgramEnvParameterdvARB
- glGetProgramEnvParameterfvARB
- glGetProgramivARB
- glGetProgramivNV
- glGetProgramLocalParameterdvARB
- glGetProgramLocalParameterfvARB
- glGetProgramNamedParameterdvNV
- glGetProgramNamedParameterfvNV
- glGetProgramParameterdvNV
- glGetProgramParameterfvNV
- glGetProgramStringARB
- glGetProgramStringNV
- glGetQueryivARB
- glGetQueryObjectivARB
- glGetQueryObjectuivARB
- glGetSeparableFilter
- glGetSeparableFilterEXT
- glGetSharpenTexFuncSGIS
- glGetString
- glGetTexEnvfv
- glGetTexEnviv
- glGetTexFilterFuncSGIS
- glGetTexGendv
- glGetTexGenfv
- glGetTexGeniv
- glGetTexImage
- glGetTexLevelParameterfv
- glGetTexLevelParameteriv
- glGetTexParameterfv
- glGetTexParameteriv
- glGetTrackMatrixivNV
- glGetVertexAttribdvARB
- glGetVertexAttribdvNV
- glGetVertexAttribfvARB
- glGetVertexAttribfvNV
- glGetVertexAttribivARB
- glGetVertexAttribivNV
- glGetVertexAttribPointervARB
- glGetVertexAttribPointervNV
- glHint
- glHintPGI
- glHistogram
- glHistogramEXT
- glIndexd
- glIndexdv
- glIndexf
- glIndexFuncEXT
- glIndexfv
- glIndexi
- glIndexiv
- glIndexMask
- glIndexMaterialEXT
- glIndexPointer
- glIndexPointerEXT
- glIndexs
- glIndexsv
- glIndexub
- glIndexubv
- glInitNames
- glInstrumentsBufferSGIX
- glInterleavedArrays
- glIsBufferARB
- glIsEnabled
- glIsFenceNV
- glIsList
- glIsProgramARB
- glIsProgramNV
- glIsQueryARB
- glIsTexture
- glIsTextureEXT
- glLightEnviSGIX
- glLightf
- glLightfv
- glLighti
- glLightiv
- glLightModelf
- glLightModelfv
- glLightModeli
- glLightModeliv
- glLineStipple
- glLineWidth
- glListBase
- glListParameterfSGIX
- glListParameterfvSGIX
- glListParameteriSGIX
- glListParameterivSGIX
- glLoadIdentity
- glLoadMatrixd
- glLoadMatrixf
- glLoadName
- glLoadProgramNV
- glLoadTransposeMatrixd
- glLoadTransposeMatrixdARB
- glLoadTransposeMatrixf
- glLoadTransposeMatrixfARB
- glLockArraysEXT
- glLogicOp
- glMapBufferARB
- glMapGrid1d
- glMapGrid1f
- glMapGrid2d
- glMapGrid2f
- glMap1d
- glMap1f
- glMap2d
- glMap2f
- glMaterialf
- glMaterialfv
- glMateriali
- glMaterialiv
- glMatrixMode
- glMinmax
- glMinmaxEXT
- glMultiDrawArrays
- glMultiDrawArraysEXT
- glMultiDrawElements
- glMultiDrawElementsEXT
- glMultiModeDrawArraysIBM
- glMultiModeDrawElementsIBM
- glMultiTexCoord1d
- glMultiTexCoord1dARB
- glMultiTexCoord1dv
- glMultiTexCoord1dvARB
- glMultiTexCoord1f
- glMultiTexCoord1fARB
- glMultiTexCoord1fv
- glMultiTexCoord1fvARB
- glMultiTexCoord1i
- glMultiTexCoord1iARB
- glMultiTexCoord1iv
- glMultiTexCoord1ivARB
- glMultiTexCoord1s
- glMultiTexCoord1sARB
- glMultiTexCoord1sv
- glMultiTexCoord1svARB
- glMultiTexCoord2d
- glMultiTexCoord2dARB
- glMultiTexCoord2dv
- glMultiTexCoord2dvARB
- glMultiTexCoord2f
- glMultiTexCoord2fARB
- glMultiTexCoord2fv
- glMultiTexCoord2fvARB
- glMultiTexCoord2i
- glMultiTexCoord2iARB
- glMultiTexCoord2iv
- glMultiTexCoord2ivARB
- glMultiTexCoord2s
- glMultiTexCoord2sARB
- glMultiTexCoord2sv
- glMultiTexCoord2svARB
- glMultiTexCoord3d
- glMultiTexCoord3dARB
- glMultiTexCoord3dv
- glMultiTexCoord3dvARB
- glMultiTexCoord3f
- glMultiTexCoord3fARB
- glMultiTexCoord3fv
- glMultiTexCoord3fvARB
- glMultiTexCoord3i
- glMultiTexCoord3iARB
- glMultiTexCoord3iv
- glMultiTexCoord3ivARB
- glMultiTexCoord3s
- glMultiTexCoord3sARB
- glMultiTexCoord3sv
- glMultiTexCoord3svARB
- glMultiTexCoord4d
- glMultiTexCoord4dARB
- glMultiTexCoord4dv
- glMultiTexCoord4dvARB
- glMultiTexCoord4f
- glMultiTexCoord4fARB
- glMultiTexCoord4fv
- glMultiTexCoord4fvARB
- glMultiTexCoord4i
- glMultiTexCoord4iARB
- glMultiTexCoord4iv
- glMultiTexCoord4ivARB
- glMultiTexCoord4s
- glMultiTexCoord4sARB
- glMultiTexCoord4sv
- glMultiTexCoord4svARB
- glMultMatrixd
- glMultMatrixf
- glMultTransposeMatrixd
- glMultTransposeMatrixdARB
- glMultTransposeMatrixf
- glMultTransposeMatrixfARB
- glNewList
- glNormalPointer
- glNormalPointerEXT
- glNormal3b
- glNormal3bv
- glNormal3d
- glNormal3dv
- glNormal3f
- glNormal3fv
- glNormal3i
- glNormal3iv
- glNormal3s
- glNormal3sv
- glOrtho
- glPassThrough
- glPixelMapfv
- glPixelMapuiv
- glPixelMapusv
- glPixelStoref
- glPixelStorei
- glPixelTexGenParameterfSGIS
- glPixelTexGenParameterfvSGIS
- glPixelTexGenParameteriSGIS
- glPixelTexGenParameterivSGIS
- glPixelTexGenSGIX
- glPixelTransferf
- glPixelTransferi
- glPixelZoom
- glPointParameterf
- glPointParameterfARB
- glPointParameterfEXT
- glPointParameterfSGIS
- glPointParameterfv
- glPointParameterfvARB
- glPointParameterfvEXT
- glPointParameterfvSGIS
- glPointParameteri
- glPointParameteriNV
- glPointParameteriv
- glPointParameterivNV
- glPointSize
- glPollInstrumentsSGIX
- glPolygonMode
- glPolygonOffset
- glPolygonOffsetEXT
- glPolygonStipple
- glPopAttrib
- glPopClientAttrib
- glPopMatrix
- glPopName
- glPrioritizeTextures
- glPrioritizeTexturesEXT
- glProgramEnvParameter4dARB
- glProgramEnvParameter4dvARB
- glProgramEnvParameter4fARB
- glProgramEnvParameter4fvARB
- glProgramLocalParameter4dARB
- glProgramLocalParameter4dvARB
- glProgramLocalParameter4fARB
- glProgramLocalParameter4fvARB
- glProgramNamedParameter4dNV
- glProgramNamedParameter4dvNV
- glProgramNamedParameter4fNV
- glProgramNamedParameter4fvNV
- glProgramParameters4dvNV
- glProgramParameters4fvNV
- glProgramParameter4dNV
- glProgramParameter4dvNV
- glProgramParameter4fNV
- glProgramParameter4fvNV
- glProgramStringARB
- glPushAttrib
- glPushClientAttrib
- glPushMatrix
- glPushName
- glRasterPos2d
- glRasterPos2dv
- glRasterPos2f
- glRasterPos2fv
- glRasterPos2i
- glRasterPos2iv
- glRasterPos2s
- glRasterPos2sv
- glRasterPos3d
- glRasterPos3dv
- glRasterPos3f
- glRasterPos3fv
- glRasterPos3i
- glRasterPos3iv
- glRasterPos3s
- glRasterPos3sv
- glRasterPos4d
- glRasterPos4dv
- glRasterPos4f
- glRasterPos4fv
- glRasterPos4i
- glRasterPos4iv
- glRasterPos4s
- glRasterPos4sv
- glReadBuffer
- glReadInstrumentsSGIX
- glReadPixels
- glRectd
- glRectdv
- glRectf
- glRectfv
- glRecti
- glRectiv
- glRects
- glRectsv
- glReferencePlaneSGIX
- glRenderMode
- glRequestResidentProgramsNV
- glResetHistogram
- glResetHistogramEXT
- glResetMinmax
- glResetMinmaxEXT
- glResizeBuffersMESA
- glRotated
- glRotatef
- glSampleCoverage
- glSampleCoverageARB
- glSampleMaskEXT
- glSampleMaskSGIS
- glSamplePatternEXT
- glSamplePatternSGIS
- glScaled
- glScalef
- glScissor
- glSecondaryColorPointer
- glSecondaryColorPointerEXT
- glSecondaryColor3b
- glSecondaryColor3bEXT
- glSecondaryColor3bv
- glSecondaryColor3bvEXT
- glSecondaryColor3d
- glSecondaryColor3dEXT
- glSecondaryColor3dv
- glSecondaryColor3dvEXT
- glSecondaryColor3f
- glSecondaryColor3fEXT
- glSecondaryColor3fv
- glSecondaryColor3fvEXT
- glSecondaryColor3i
- glSecondaryColor3iEXT
- glSecondaryColor3iv
- glSecondaryColor3ivEXT
- glSecondaryColor3s
- glSecondaryColor3sEXT
- glSecondaryColor3sv
- glSecondaryColor3svEXT
- glSecondaryColor3ub
- glSecondaryColor3ubEXT
- glSecondaryColor3ubv
- glSecondaryColor3ubvEXT
- glSecondaryColor3ui
- glSecondaryColor3uiEXT
- glSecondaryColor3uiv
- glSecondaryColor3uivEXT
- glSecondaryColor3us
- glSecondaryColor3usEXT
- glSecondaryColor3usv
- glSecondaryColor3usvEXT
- glSelectBuffer
- glSeparableFilter2D
- glSeparableFilter2DEXT
- glSetFenceNV
- glShadeModel
- glSharpenTexFuncSGIS
- glSpriteParameterfSGIX
- glSpriteParameterfvSGIX
- glSpriteParameteriSGIX
- glSpriteParameterivSGIX
- glStartInstrumentsSGIX
- glStencilFunc
- glStencilMask
- glStencilOp
- glStopInstrumentsSGIX
- glTagSampleBufferSGIX
- glTbufferMask3DFX
- glTestFenceNV
- glTexCoordPointer
- glTexCoordPointerEXT
- glTexCoord1d
- glTexCoord1dv
- glTexCoord1f
- glTexCoord1fv
- glTexCoord1i
- glTexCoord1iv
- glTexCoord1s
- glTexCoord1sv
- glTexCoord2d
- glTexCoord2dv
- glTexCoord2f
- glTexCoord2fv
- glTexCoord2i
- glTexCoord2iv
- glTexCoord2s
- glTexCoord2sv
- glTexCoord3d
- glTexCoord3dv
- glTexCoord3f
- glTexCoord3fv
- glTexCoord3i
- glTexCoord3iv
- glTexCoord3s
- glTexCoord3sv
- glTexCoord4d
- glTexCoord4dv
- glTexCoord4f
- glTexCoord4fv
- glTexCoord4i
- glTexCoord4iv
- glTexCoord4s
- glTexCoord4sv
- glTexEnvf
- glTexEnvfv
- glTexEnvi
- glTexEnviv
- glTexFilterFuncSGIS
- glTexGend
- glTexGendv
- glTexGenf
- glTexGenfv
- glTexGeni
- glTexGeniv
- glTexImage1D
- glTexImage2D
- glTexImage3D
- glTexImage3DEXT
- glTexImage4DSGIS
- glTexParameterf
- glTexParameterfv
- glTexParameteri
- glTexParameteriv
- glTexSubImage1D
- glTexSubImage1DEXT
- glTexSubImage2D
- glTexSubImage2DEXT
- glTexSubImage3D
- glTexSubImage3DEXT
- glTexSubImage4DSGIS
- glTrackMatrixNV
- glTranslated
- glTranslatef
- glUnlockArraysEXT
- glUnmapBufferARB
- glVertexArrayRangeNV
- glVertexAttribPointerARB
- glVertexAttribPointerNV
- glVertexAttribs1dvNV
- glVertexAttribs1fvNV
- glVertexAttribs1svNV
- glVertexAttribs2dvNV
- glVertexAttribs2fvNV
- glVertexAttribs2svNV
- glVertexAttribs3dvNV
- glVertexAttribs3fvNV
- glVertexAttribs3svNV
- glVertexAttribs4dvNV
- glVertexAttribs4fvNV
- glVertexAttribs4svNV
- glVertexAttribs4ubvNV
- glVertexAttrib1dARB
- glVertexAttrib1dNV
- glVertexAttrib1dvARB
- glVertexAttrib1dvNV
- glVertexAttrib1fARB
- glVertexAttrib1fNV
- glVertexAttrib1fvARB
- glVertexAttrib1fvNV
- glVertexAttrib1sARB
- glVertexAttrib1sNV
- glVertexAttrib1svARB
- glVertexAttrib1svNV
- glVertexAttrib2dARB
- glVertexAttrib2dNV
- glVertexAttrib2dvARB
- glVertexAttrib2dvNV
- glVertexAttrib2fARB
- glVertexAttrib2fNV
- glVertexAttrib2fvARB
- glVertexAttrib2fvNV
- glVertexAttrib2sARB
- glVertexAttrib2sNV
- glVertexAttrib2svARB
- glVertexAttrib2svNV
- glVertexAttrib3dARB
- glVertexAttrib3dNV
- glVertexAttrib3dvARB
- glVertexAttrib3dvNV
- glVertexAttrib3fARB
- glVertexAttrib3fNV
- glVertexAttrib3fvARB
- glVertexAttrib3fvNV
- glVertexAttrib3sARB
- glVertexAttrib3sNV
- glVertexAttrib3svARB
- glVertexAttrib3svNV
- glVertexAttrib4bvARB
- glVertexAttrib4dARB
- glVertexAttrib4dNV
- glVertexAttrib4dvARB
- glVertexAttrib4dvNV
- glVertexAttrib4fARB
- glVertexAttrib4fNV
- glVertexAttrib4fvARB
- glVertexAttrib4fvNV
- glVertexAttrib4ivARB
- glVertexAttrib4NbvARB
- glVertexAttrib4NivARB
- glVertexAttrib4NsvARB
- glVertexAttrib4NubARB
- glVertexAttrib4NubvARB
- glVertexAttrib4NuivARB
- glVertexAttrib4NusvARB
- glVertexAttrib4sARB
- glVertexAttrib4sNV
- glVertexAttrib4svARB
- glVertexAttrib4svNV
- glVertexAttrib4ubNV
- glVertexAttrib4ubvARB
- glVertexAttrib4ubvNV
- glVertexAttrib4uivARB
- glVertexAttrib4usvARB
- glVertexPointer
- glVertexPointerEXT
- glVertexWeightfEXT
- glVertexWeightfvEXT
- glVertexWeightPointerEXT
- glVertex2d
- glVertex2dv
- glVertex2f
- glVertex2fv
- glVertex2i
- glVertex2iv
- glVertex2s
- glVertex2sv
- glVertex3d
- glVertex3dv
- glVertex3f
- glVertex3fv
- glVertex3i
- glVertex3iv
- glVertex3s
- glVertex3sv
- glVertex4d
- glVertex4dv
- glVertex4f
- glVertex4fv
- glVertex4i
- glVertex4iv
- glVertex4s
- glVertex4sv
- glViewport
- glWindowPos2d
- glWindowPos2dARB
- glWindowPos2dMESA
- glWindowPos2dv
- glWindowPos2dvARB
- glWindowPos2dvMESA
- glWindowPos2f
- glWindowPos2fARB
- glWindowPos2fMESA
- glWindowPos2fv
- glWindowPos2fvARB
- glWindowPos2fvMESA
- glWindowPos2i
- glWindowPos2iARB
- glWindowPos2iMESA
- glWindowPos2iv
- glWindowPos2ivARB
- glWindowPos2ivMESA
- glWindowPos2s
- glWindowPos2sARB
- glWindowPos2sMESA
- glWindowPos2sv
- glWindowPos2svARB
- glWindowPos2svMESA
- glWindowPos3d
- glWindowPos3dARB
- glWindowPos3dMESA
- glWindowPos3dv
- glWindowPos3dvARB
- glWindowPos3dvMESA
- glWindowPos3f
- glWindowPos3fARB
- glWindowPos3fMESA
- glWindowPos3fv
- glWindowPos3fvARB
- glWindowPos3fvMESA
- glWindowPos3i
- glWindowPos3iARB
- glWindowPos3iMESA
- glWindowPos3iv
- glWindowPos3ivARB
- glWindowPos3ivMESA
- glWindowPos3s
- glWindowPos3sARB
- glWindowPos3sMESA
- glWindowPos3sv
- glWindowPos3svARB
- glWindowPos3svMESA
- glWindowPos4dMESA
- glWindowPos4dvMESA
- glWindowPos4fMESA
- glWindowPos4fvMESA
- glWindowPos4iMESA
- glWindowPos4ivMESA
- glWindowPos4sMESA
- glWindowPos4svMESA
- fxCloseHardware
-;fxGetScreenGeometry
- fxMesaCreateBestContext
- fxMesaCreateContext
- fxMesaDestroyContext
- fxMesaGetCurrentContext
- fxMesaMakeCurrent
- fxMesaSelectCurrentBoard
-;fxMesaSetNearFar
- fxMesaSwapBuffers
- fxMesaUpdateScreenSize
- wglChoosePixelFormat
- wglCopyContext
- wglCreateContext
- wglCreateLayerContext
- wglDeleteContext
- wglDescribeLayerPlane
- wglDescribePixelFormat
- wglGetCurrentContext
- wglGetCurrentDC
- wglGetDefaultProcAddress
- wglGetLayerPaletteEntries
- wglGetPixelFormat
- wglGetProcAddress
- wglMakeCurrent
- wglRealizeLayerPalette
- wglSetLayerPaletteEntries
- wglSetPixelFormat
- wglShareLists
- wglSwapBuffers
- wglSwapLayerBuffers
- wglUseFontBitmapsA
- wglUseFontBitmapsW
- wglUseFontOutlinesA
- wglUseFontOutlinesW
- ChoosePixelFormat
- DescribePixelFormat
- GetPixelFormat
- SetPixelFormat
- SwapBuffers
- DrvCopyContext
- DrvCreateContext
- DrvCreateLayerContext
- DrvDeleteContext
- DrvDescribeLayerPlane
- DrvDescribePixelFormat
- DrvGetLayerPaletteEntries
- DrvGetProcAddress
- DrvReleaseContext
- DrvRealizeLayerPalette
- DrvSetContext
- DrvSetLayerPaletteEntries
- DrvSetPixelFormat
- DrvShareLists
- DrvSwapBuffers
- DrvSwapLayerBuffers
- DrvValidateVersion
diff --git a/mesalib/src/mesa/drivers/windows/fx/fxwgl.c b/mesalib/src/mesa/drivers/windows/fx/fxwgl.c
deleted file mode 100644
index ce76ecd15..000000000
--- a/mesalib/src/mesa/drivers/windows/fx/fxwgl.c
+++ /dev/null
@@ -1,1307 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  4.0
- *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- *    David Bucciarelli
- *    Brian Paul
- *    Keith Whitwell
- *    Hiroshi Morii
- *    Daniel Borca
- */
-
-/* fxwgl.c - Microsoft wgl functions emulation for
- *           3Dfx VooDoo/Mesa interface
- */
-
-
-#ifdef _WIN32
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include "GL/gl.h"
-#include "GL/glext.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#include "GL/fxmesa.h"
-#include "glheader.h"
-#include "glapi.h"
-#include "imports.h"
-#include "../../glide/fxdrv.h"
-
-#define MAX_MESA_ATTRS  20
-
-#if (_MSC_VER >= 1200)
-#pragma warning( push )
-#pragma warning( disable : 4273 )
-#endif
-
-struct __extensions__ {
-   PROC proc;
-   char *name;
-};
-
-struct __pixelformat__ {
-   PIXELFORMATDESCRIPTOR pfd;
-   GLint mesaAttr[MAX_MESA_ATTRS];
-};
-
-WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
-static GLushort gammaTable[3 * 256];
-
-struct __pixelformat__ pix[] = {
-   /* 16bit RGB565 single buffer with depth */
-   {
-    {sizeof(PIXELFORMATDESCRIPTOR), 1,
-     PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
-     PFD_TYPE_RGBA,
-     16,
-     5, 0, 6, 5, 5, 11, 0, 0,
-     0, 0, 0, 0, 0,
-     16,
-     0,
-     0,
-     PFD_MAIN_PLANE,
-     0, 0, 0, 0}
-    ,
-    {FXMESA_COLORDEPTH, 16,
-     FXMESA_ALPHA_SIZE, 0,
-     FXMESA_DEPTH_SIZE, 16,
-     FXMESA_STENCIL_SIZE, 0,
-     FXMESA_ACCUM_SIZE, 0,
-     FXMESA_NONE}
-   }
-   ,
-   /* 16bit RGB565 double buffer with depth */
-   {
-    {sizeof(PIXELFORMATDESCRIPTOR), 1,
-     PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
-     PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
-     PFD_TYPE_RGBA,
-     16,
-     5, 0, 6, 5, 5, 11, 0, 0,
-     0, 0, 0, 0, 0,
-     16,
-     0,
-     0,
-     PFD_MAIN_PLANE,
-     0, 0, 0, 0}
-    ,
-    {FXMESA_COLORDEPTH, 16,
-     FXMESA_DOUBLEBUFFER,
-     FXMESA_ALPHA_SIZE, 0,
-     FXMESA_DEPTH_SIZE, 16,
-     FXMESA_STENCIL_SIZE, 0,
-     FXMESA_ACCUM_SIZE, 0,
-     FXMESA_NONE}
-   }
-   ,
-   /* 16bit ARGB1555 single buffer with depth */
-   {
-    {sizeof(PIXELFORMATDESCRIPTOR), 1,
-     PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
-     PFD_TYPE_RGBA,
-     16,
-     5, 0, 5, 5, 5, 10, 1, 15,
-     0, 0, 0, 0, 0,
-     16,
-     0,
-     0,
-     PFD_MAIN_PLANE,
-     0, 0, 0, 0}
-    ,
-    {FXMESA_COLORDEPTH, 15,
-     FXMESA_ALPHA_SIZE, 1,
-     FXMESA_DEPTH_SIZE, 16,
-     FXMESA_STENCIL_SIZE, 0,
-     FXMESA_ACCUM_SIZE, 0,
-     FXMESA_NONE}
-   }
-   ,
-   /* 16bit ARGB1555 double buffer with depth */
-   {
-    {sizeof(PIXELFORMATDESCRIPTOR), 1,
-     PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
-     PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
-     PFD_TYPE_RGBA,
-     16,
-     5, 0, 5, 5, 5, 10, 1, 15,
-     0, 0, 0, 0, 0,
-     16,
-     0,
-     0,
-     PFD_MAIN_PLANE,
-     0, 0, 0, 0}
-    ,
-    {FXMESA_COLORDEPTH, 15,
-     FXMESA_DOUBLEBUFFER,
-     FXMESA_ALPHA_SIZE, 1,
-     FXMESA_DEPTH_SIZE, 16,
-     FXMESA_STENCIL_SIZE, 0,
-     FXMESA_ACCUM_SIZE, 0,
-     FXMESA_NONE}
-   }
-   ,
-   /* 32bit ARGB8888 single buffer with depth */
-   {
-    {sizeof(PIXELFORMATDESCRIPTOR), 1,
-     PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
-     PFD_TYPE_RGBA,
-     32,
-     8, 0, 8, 8, 8, 16, 8, 24,
-     0, 0, 0, 0, 0,
-     24,
-     8,
-     0,
-     PFD_MAIN_PLANE,
-     0, 0, 0, 0}
-    ,
-    {FXMESA_COLORDEPTH, 32,
-     FXMESA_ALPHA_SIZE, 8,
-     FXMESA_DEPTH_SIZE, 24,
-     FXMESA_STENCIL_SIZE, 8,
-     FXMESA_ACCUM_SIZE, 0,
-     FXMESA_NONE}
-   }
-   ,
-   /* 32bit ARGB8888 double buffer with depth */
-   {
-    {sizeof(PIXELFORMATDESCRIPTOR), 1,
-     PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
-     PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
-     PFD_TYPE_RGBA,
-     32,
-     8, 0, 8, 8, 8, 16, 8, 24,
-     0, 0, 0, 0, 0,
-     24,
-     8,
-     0,
-     PFD_MAIN_PLANE,
-     0, 0, 0, 0}
-    ,
-    {FXMESA_COLORDEPTH, 32,
-     FXMESA_DOUBLEBUFFER,
-     FXMESA_ALPHA_SIZE, 8,
-     FXMESA_DEPTH_SIZE, 24,
-     FXMESA_STENCIL_SIZE, 8,
-     FXMESA_ACCUM_SIZE, 0,
-     FXMESA_NONE}
-   }
-};
-
-static fxMesaContext ctx = NULL;
-static WNDPROC hWNDOldProc;
-static int curPFD = 0;
-static HDC hDC;
-static HWND hWND;
-
-static GLboolean haveDualHead;
-
-/* For the in-window-rendering hack */
-
-#ifndef GR_CONTROL_RESIZE
-/* Apparently GR_CONTROL_RESIZE can be ignored. OK? */
-#define GR_CONTROL_RESIZE -1
-#endif
-
-static GLboolean gdiWindowHack;
-static void *dibSurfacePtr;
-static BITMAPINFO *dibBMI;
-static HBITMAP dibHBM;
-static HWND dibWnd;
-
-static int
-env_check (const char *var, int val)
-{
-   const char *env = getenv(var);
-   return (env && (env[0] == val));
-}
-
-static LRESULT APIENTRY
-__wglMonitor (HWND hwnd, UINT message, UINT wParam, LONG lParam)
-{
-   long ret;                    /* Now gives the resized window at the end to hWNDOldProc */
-
-   if (ctx && hwnd == hWND) {
-      switch (message) {
-         case WM_PAINT:
-         case WM_MOVE:
-            break;
-         case WM_DISPLAYCHANGE:
-         case WM_SIZE:
-#if 0
-            if (wParam != SIZE_MINIMIZED) {
-               static int moving = 0;
-               if (!moving) {
-                  if (!FX_grSstControl(GR_CONTROL_RESIZE)) {
-                     moving = 1;
-                     SetWindowPos(hwnd, 0, 0, 0, 300, 300, SWP_NOMOVE | SWP_NOZORDER);
-                     moving = 0;
-                     if (!FX_grSstControl(GR_CONTROL_RESIZE)) {
-                        /*MessageBox(0,_T("Error changing windowsize"),_T("fxMESA"),MB_OK);*/
-                        PostMessage(hWND, WM_CLOSE, 0, 0);
-                     }
-                  }
-                  /* Do the clipping in the glide library */
-                  grClipWindow(0, 0, FX_grSstScreenWidth(), FX_grSstScreenHeight());
-                  /* And let the new size set in the context */
-                  fxMesaUpdateScreenSize(ctx);
-               }
-            }
-#endif
-            break;
-         case WM_ACTIVATE:
-            break;
-         case WM_SHOWWINDOW:
-            break;
-         case WM_SYSKEYDOWN:
-         case WM_SYSCHAR:
-            break;
-      }
-   }
-
-   /* Finally call the hWNDOldProc, which handles the resize with the
-    * now changed window sizes */
-   ret = CallWindowProc(hWNDOldProc, hwnd, message, wParam, lParam);
-
-   return ret;
-}
-
-static void
-wgl_error (long error)
-{
-#define WGL_INVALID_PIXELFORMAT ERROR_INVALID_PIXEL_FORMAT
-   SetLastError(0xC0000000      /* error severity */
-               |0x00070000      /* error facility (who we are) */
-               |error);
-}
-
-GLAPI BOOL GLAPIENTRY
-wglCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
-{
-   return FALSE;
-}
-
-GLAPI HGLRC GLAPIENTRY
-wglCreateContext (HDC hdc)
-{
-   HWND hWnd;
-   WNDPROC oldProc;
-   int error;
-
-   if (ctx) {
-      SetLastError(0);
-      return NULL;
-   }
-
-   if (!(hWnd = WindowFromDC(hdc))) {
-      SetLastError(0);
-      return NULL;
-   }
-
-   if (curPFD == 0) {
-      wgl_error(WGL_INVALID_PIXELFORMAT);
-      return NULL;
-   }
-
-   if ((oldProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC)) != __wglMonitor) {
-      hWNDOldProc = oldProc;
-      SetWindowLong(hWnd, GWL_WNDPROC, (LONG)__wglMonitor);
-   }
-
-   /* always log when debugging, or if user demands */
-   if (TDFX_DEBUG || env_check("MESA_FX_INFO", 'r')) {
-      freopen("MESA.LOG", "w", stderr);
-   }
-
-   {
-      RECT cliRect;
-      ShowWindow(hWnd, SW_SHOWNORMAL);
-      SetForegroundWindow(hWnd);
-      Sleep(100);               /* a hack for win95 */
-      if (env_check("MESA_GLX_FX", 'w') && !(GetWindowLong(hWnd, GWL_STYLE) & WS_POPUP)) {
-         /* XXX todo - windowed modes */
-         error = !(ctx = fxMesaCreateContext((GLuint) hWnd, GR_RESOLUTION_NONE, GR_REFRESH_NONE, pix[curPFD - 1].mesaAttr));
-      } else {
-         GetClientRect(hWnd, &cliRect);
-         error = !(ctx = fxMesaCreateBestContext((GLuint) hWnd, cliRect.right, cliRect.bottom, pix[curPFD - 1].mesaAttr));
-      }
-   }
-
-   /*if (getenv("SST_DUALHEAD"))
-      haveDualHead =
-         ((atoi(getenv("SST_DUALHEAD")) == 1) ? GL_TRUE : GL_FALSE);
-   else
-      haveDualHead = GL_FALSE;*/
-
-   if (error) {
-      SetLastError(0);
-      return NULL;
-   }
-
-   hDC = hdc;
-   hWND = hWnd;
-
-   /* Required by the OpenGL Optimizer 1.1 (is it a Optimizer bug ?) */
-   wglMakeCurrent(hdc, (HGLRC)1);
-
-   return (HGLRC)1;
-}
-
-GLAPI HGLRC GLAPIENTRY
-wglCreateLayerContext (HDC hdc, int iLayerPlane)
-{
-   SetLastError(0);
-   return NULL;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglDeleteContext (HGLRC hglrc)
-{
-   if (ctx && hglrc == (HGLRC)1) {
-
-      fxMesaDestroyContext(ctx);
-
-      SetWindowLong(WindowFromDC(hDC), GWL_WNDPROC, (LONG) hWNDOldProc);
-
-      ctx = NULL;
-      hDC = 0;
-      return TRUE;
-   }
-
-   SetLastError(0);
-
-   return FALSE;
-}
-
-GLAPI HGLRC GLAPIENTRY
-wglGetCurrentContext (VOID)
-{
-   if (ctx)
-      return (HGLRC)1;
-
-   SetLastError(0);
-   return NULL;
-}
-
-GLAPI HDC GLAPIENTRY
-wglGetCurrentDC (VOID)
-{
-   if (ctx)
-      return hDC;
-
-   SetLastError(0);
-   return NULL;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglSwapIntervalEXT (int interval)
-{
-   if (ctx == NULL) {
-      return FALSE;
-   }
-   if (interval < 0) {
-      interval = 0;
-   } else if (interval > 3) {
-      interval = 3;
-   }
-   ctx->swapInterval = interval;
-   return TRUE;
-}
-
-GLAPI int GLAPIENTRY
-wglGetSwapIntervalEXT (void)
-{
-   return (ctx == NULL) ? -1 : ctx->swapInterval;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglGetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
-{
-   /* gammaTable should be per-context */
-   memcpy(arrays, gammaTable, 3 * 256 * sizeof(GLushort));
-   return TRUE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglSetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
-{
-   GLint i, tableSize, inc, index;
-   GLushort *red, *green, *blue;
-   FxU32 gammaTableR[256], gammaTableG[256], gammaTableB[256];
-
-   /* gammaTable should be per-context */
-   memcpy(gammaTable, arrays, 3 * 256 * sizeof(GLushort));
-
-   tableSize = FX_grGetInteger(GR_GAMMA_TABLE_ENTRIES);
-   inc = 256 / tableSize;
-   red = (GLushort *)arrays;
-   green = (GLushort *)arrays + 256;
-   blue = (GLushort *)arrays + 512;
-   for (i = 0, index = 0; i < tableSize; i++, index += inc) {
-      gammaTableR[i] = red[index] >> 8;
-      gammaTableG[i] = green[index] >> 8;
-      gammaTableB[i] = blue[index] >> 8;
-   }
-
-   grLoadGammaTable(tableSize, gammaTableR, gammaTableG, gammaTableB);
-
-   return TRUE;
-}
-
-typedef void *HPBUFFERARB;
-
-/* WGL_ARB_pixel_format */
-GLAPI BOOL GLAPIENTRY
-wglGetPixelFormatAttribivARB (HDC hdc,
-                              int iPixelFormat,
-                              int iLayerPlane,
-                              UINT nAttributes,
-                              const int *piAttributes,
-                              int *piValues)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglGetPixelFormatAttribfvARB (HDC hdc,
-                              int iPixelFormat,
-                              int iLayerPlane,
-                              UINT nAttributes,
-                              const int *piAttributes,
-                              FLOAT *pfValues)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglChoosePixelFormatARB (HDC hdc,
-                         const int *piAttribIList,
-                         const FLOAT *pfAttribFList,
-                         UINT nMaxFormats,
-                         int *piFormats,
-                         UINT *nNumFormats)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-/* WGL_ARB_render_texture */
-GLAPI BOOL GLAPIENTRY
-wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglSetPbufferAttribARB (HPBUFFERARB hPbuffer,
-                        const int *piAttribList)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-/* WGL_ARB_pbuffer */
-GLAPI HPBUFFERARB GLAPIENTRY
-wglCreatePbufferARB (HDC hDC,
-                     int iPixelFormat,
-                     int iWidth,
-                     int iHeight,
-                     const int *piAttribList)
-{
-   SetLastError(0);
-   return NULL;
-}
-
-GLAPI HDC GLAPIENTRY
-wglGetPbufferDCARB (HPBUFFERARB hPbuffer)
-{
-   SetLastError(0);
-   return NULL;
-}
-
-GLAPI int GLAPIENTRY
-wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC)
-{
-   SetLastError(0);
-   return -1;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglDestroyPbufferARB (HPBUFFERARB hPbuffer)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglQueryPbufferARB (HPBUFFERARB hPbuffer,
-                    int iAttribute,
-                    int *piValue)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI const char * GLAPIENTRY
-wglGetExtensionsStringEXT (void)
-{
-   return "WGL_3DFX_gamma_control "
-          "WGL_EXT_swap_control "
-          "WGL_EXT_extensions_string WGL_ARB_extensions_string"
-         /*WGL_ARB_pixel_format WGL_ARB_render_texture WGL_ARB_pbuffer*/;
-}
-
-GLAPI const char * GLAPIENTRY
-wglGetExtensionsStringARB (HDC hdc)
-{
-   return wglGetExtensionsStringEXT();
-}
-
-static struct {
-   const char *name;
-   PROC func;
-} wgl_ext[] = {
-       {"wglGetExtensionsStringARB",    (PROC)wglGetExtensionsStringARB},
-       {"wglGetExtensionsStringEXT",    (PROC)wglGetExtensionsStringEXT},
-       {"wglSwapIntervalEXT",           (PROC)wglSwapIntervalEXT},
-       {"wglGetSwapIntervalEXT",        (PROC)wglGetSwapIntervalEXT},
-       {"wglGetDeviceGammaRamp3DFX",    (PROC)wglGetDeviceGammaRamp3DFX},
-       {"wglSetDeviceGammaRamp3DFX",    (PROC)wglSetDeviceGammaRamp3DFX},
-       /* WGL_ARB_pixel_format */
-       {"wglGetPixelFormatAttribivARB", (PROC)wglGetPixelFormatAttribivARB},
-       {"wglGetPixelFormatAttribfvARB", (PROC)wglGetPixelFormatAttribfvARB},
-       {"wglChoosePixelFormatARB",      (PROC)wglChoosePixelFormatARB},
-       /* WGL_ARB_render_texture */
-       {"wglBindTexImageARB",           (PROC)wglBindTexImageARB},
-       {"wglReleaseTexImageARB",        (PROC)wglReleaseTexImageARB},
-       {"wglSetPbufferAttribARB",       (PROC)wglSetPbufferAttribARB},
-       /* WGL_ARB_pbuffer */
-       {"wglCreatePbufferARB",          (PROC)wglCreatePbufferARB},
-       {"wglGetPbufferDCARB",           (PROC)wglGetPbufferDCARB},
-       {"wglReleasePbufferDCARB",       (PROC)wglReleasePbufferDCARB},
-       {"wglDestroyPbufferARB",         (PROC)wglDestroyPbufferARB},
-       {"wglQueryPbufferARB",           (PROC)wglQueryPbufferARB},
-       {NULL, NULL}
-};
-
-GLAPI PROC GLAPIENTRY
-wglGetProcAddress (LPCSTR lpszProc)
-{
-   int i;
-   PROC p = (PROC)_glapi_get_proc_address((const char *)lpszProc);
-
-   /* we can't BlendColor. work around buggy applications */
-   if (p && strcmp(lpszProc, "glBlendColor")
-         && strcmp(lpszProc, "glBlendColorEXT"))
-      return p;
-
-   for (i = 0; wgl_ext[i].name; i++) {
-      if (!strcmp(lpszProc, wgl_ext[i].name)) {
-         return wgl_ext[i].func;
-      }
-   }
-
-   SetLastError(0);
-   return NULL;
-}
-
-GLAPI PROC GLAPIENTRY
-wglGetDefaultProcAddress (LPCSTR lpszProc)
-{
-   SetLastError(0);
-   return NULL;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglMakeCurrent (HDC hdc, HGLRC hglrc)
-{
-   if ((hdc == NULL) && (hglrc == NULL))
-      return TRUE;
-
-   if (!ctx || hglrc != (HGLRC)1 || WindowFromDC(hdc) != hWND) {
-      SetLastError(0);
-      return FALSE;
-   }
-
-   hDC = hdc;
-
-   fxMesaMakeCurrent(ctx);
-
-   return TRUE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglShareLists (HGLRC hglrc1, HGLRC hglrc2)
-{
-   if (!ctx || hglrc1 != (HGLRC)1 || hglrc1 != hglrc2) {
-      SetLastError(0);
-      return FALSE;
-   }
-
-   return TRUE;
-}
-
-static BOOL
-wglUseFontBitmaps_FX (HDC fontDevice, DWORD firstChar, DWORD numChars,
-                      DWORD listBase)
-{
-   TEXTMETRIC metric;
-   BITMAPINFO *dibInfo;
-   HDC bitDevice;
-   COLORREF tempColor;
-   int i;
-
-   GetTextMetrics(fontDevice, &metric);
-
-   dibInfo = (BITMAPINFO *)calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1);
-   dibInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-   dibInfo->bmiHeader.biPlanes = 1;
-   dibInfo->bmiHeader.biBitCount = 1;
-   dibInfo->bmiHeader.biCompression = BI_RGB;
-
-   bitDevice = CreateCompatibleDC(fontDevice);
-
-   /* Swap fore and back colors so the bitmap has the right polarity */
-   tempColor = GetBkColor(bitDevice);
-   SetBkColor(bitDevice, GetTextColor(bitDevice));
-   SetTextColor(bitDevice, tempColor);
-
-   /* Place chars based on base line */
-   SetTextAlign(bitDevice, TA_BASELINE);
-
-   for (i = 0; i < (int)numChars; i++) {
-      SIZE size;
-      char curChar;
-      int charWidth, charHeight, bmapWidth, bmapHeight, numBytes, res;
-      HBITMAP bitObject;
-      HGDIOBJ origBmap;
-      unsigned char *bmap;
-
-      curChar = (char)(i + firstChar); /* [koolsmoky] explicit cast */
-
-      /* Find how high/wide this character is */
-      GetTextExtentPoint32(bitDevice, &curChar, 1, &size);
-
-      /* Create the output bitmap */
-      charWidth = size.cx;
-      charHeight = size.cy;
-      bmapWidth = ((charWidth + 31) / 32) * 32; /* Round up to the next multiple of 32 bits */
-      bmapHeight = charHeight;
-      bitObject = CreateCompatibleBitmap(bitDevice, bmapWidth, bmapHeight);
-      /*VERIFY(bitObject);*/
-
-      /* Assign the output bitmap to the device */
-      origBmap = SelectObject(bitDevice, bitObject);
-
-      PatBlt(bitDevice, 0, 0, bmapWidth, bmapHeight, BLACKNESS);
-
-      /* Use our source font on the device */
-      SelectObject(bitDevice, GetCurrentObject(fontDevice, OBJ_FONT));
-
-      /* Draw the character */
-      TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1);
-
-      /* Unselect our bmap object */
-      SelectObject(bitDevice, origBmap);
-
-      /* Convert the display dependant representation to a 1 bit deep DIB */
-      numBytes = (bmapWidth * bmapHeight) / 8;
-      bmap = MALLOC(numBytes);
-      dibInfo->bmiHeader.biWidth = bmapWidth;
-      dibInfo->bmiHeader.biHeight = bmapHeight;
-      res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
-                      dibInfo, DIB_RGB_COLORS);
-
-      /* Create the GL object */
-      glNewList(i + listBase, GL_COMPILE);
-      glBitmap(bmapWidth, bmapHeight, 0.0, metric.tmDescent,
-               charWidth, 0.0, bmap);
-      glEndList();
-      /* CheckGL(); */
-
-      /* Destroy the bmap object */
-      DeleteObject(bitObject);
-
-      /* Deallocate the bitmap data */
-      FREE(bmap);
-   }
-
-   /* Destroy the DC */
-   DeleteDC(bitDevice);
-
-   FREE(dibInfo);
-
-   return TRUE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglUseFontBitmapsW (HDC hdc, DWORD first, DWORD count, DWORD listBase)
-{
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglUseFontOutlinesA (HDC hdc, DWORD first, DWORD count,
-                     DWORD listBase, FLOAT deviation,
-                     FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglUseFontOutlinesW (HDC hdc, DWORD first, DWORD count,
-                     DWORD listBase, FLOAT deviation,
-                     FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-
-GLAPI BOOL GLAPIENTRY
-wglSwapLayerBuffers (HDC hdc, UINT fuPlanes)
-{
-   if (ctx && WindowFromDC(hdc) == hWND) {
-      fxMesaSwapBuffers();
-
-      return TRUE;
-   }
-
-   SetLastError(0);
-   return FALSE;
-}
-
-static int
-pfd_tablen (void)
-{
-   /* we should take an envvar for `fxMesaSelectCurrentBoard' */
-   return (fxMesaSelectCurrentBoard(0) < GR_SSTTYPE_Voodoo4)
-         ? 2                      /* only 16bit entries */
-         : sizeof(pix) / sizeof(pix[0]);  /* full table */
-}
-
-GLAPI int GLAPIENTRY
-wglChoosePixelFormat (HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd)
-{
-   int i, best = -1, qt_valid_pix;
-   PIXELFORMATDESCRIPTOR pfd = *ppfd;
-
-   qt_valid_pix = pfd_tablen();
-
-#if 1 || QUAKE2 || GORE
-   /* QUAKE2: 24+32 */
-   /* GORE  : 24+16 */
-   if ((pfd.cColorBits == 24) || (pfd.cColorBits == 32)) {
-      /* the first 2 entries are 16bit */
-      pfd.cColorBits = (qt_valid_pix > 2) ? 32 : 16;
-   }
-   if (pfd.cColorBits == 32) {
-      pfd.cDepthBits = 24;
-   } else if (pfd.cColorBits == 16) {
-      pfd.cDepthBits = 16;
-   }
-#endif
-
-   if (pfd.nSize != sizeof(PIXELFORMATDESCRIPTOR) || pfd.nVersion != 1) {
-      SetLastError(0);
-      return 0;
-   }
-
-   for (i = 0; i < qt_valid_pix; i++) {
-      if (pfd.cColorBits > 0 && pix[i].pfd.cColorBits != pfd.cColorBits)
-         continue;
-
-      if ((pfd.dwFlags & PFD_DRAW_TO_WINDOW)
-          && !(pix[i].pfd.dwFlags & PFD_DRAW_TO_WINDOW)) continue;
-      if ((pfd.dwFlags & PFD_DRAW_TO_BITMAP)
-          && !(pix[i].pfd.dwFlags & PFD_DRAW_TO_BITMAP)) continue;
-      if ((pfd.dwFlags & PFD_SUPPORT_GDI)
-          && !(pix[i].pfd.dwFlags & PFD_SUPPORT_GDI)) continue;
-      if ((pfd.dwFlags & PFD_SUPPORT_OPENGL)
-          && !(pix[i].pfd.dwFlags & PFD_SUPPORT_OPENGL)) continue;
-      if (!(pfd.dwFlags & PFD_DOUBLEBUFFER_DONTCARE)
-          && ((pfd.dwFlags & PFD_DOUBLEBUFFER) !=
-              (pix[i].pfd.dwFlags & PFD_DOUBLEBUFFER))) continue;
-#if 1 /* Doom3 fails here! */
-      if (!(pfd.dwFlags & PFD_STEREO_DONTCARE)
-          && ((pfd.dwFlags & PFD_STEREO) !=
-              (pix[i].pfd.dwFlags & PFD_STEREO))) continue;
-#endif
-
-      if (pfd.cDepthBits > 0 && pix[i].pfd.cDepthBits == 0)
-         continue;              /* need depth buffer */
-
-      if (pfd.cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0)
-         continue;              /* need alpha buffer */
-
-#if 0                           /* regression bug? */
-      if (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0)
-         continue;              /* need stencil buffer */
-#endif
-
-      if (pfd.iPixelType == pix[i].pfd.iPixelType) {
-         best = i + 1;
-         break;
-      }
-   }
-
-   if (best == -1) {
-      FILE *err = fopen("MESA.LOG", "w");
-      if (err != NULL) {
-         fprintf(err, "wglChoosePixelFormat failed\n");
-         fprintf(err, "\tnSize           = %d\n", ppfd->nSize);
-         fprintf(err, "\tnVersion        = %d\n", ppfd->nVersion);
-         fprintf(err, "\tdwFlags         = %lu\n", ppfd->dwFlags);
-         fprintf(err, "\tiPixelType      = %d\n", ppfd->iPixelType);
-         fprintf(err, "\tcColorBits      = %d\n", ppfd->cColorBits);
-         fprintf(err, "\tcRedBits        = %d\n", ppfd->cRedBits);
-         fprintf(err, "\tcRedShift       = %d\n", ppfd->cRedShift);
-         fprintf(err, "\tcGreenBits      = %d\n", ppfd->cGreenBits);
-         fprintf(err, "\tcGreenShift     = %d\n", ppfd->cGreenShift);
-         fprintf(err, "\tcBlueBits       = %d\n", ppfd->cBlueBits);
-         fprintf(err, "\tcBlueShift      = %d\n", ppfd->cBlueShift);
-         fprintf(err, "\tcAlphaBits      = %d\n", ppfd->cAlphaBits);
-         fprintf(err, "\tcAlphaShift     = %d\n", ppfd->cAlphaShift);
-         fprintf(err, "\tcAccumBits      = %d\n", ppfd->cAccumBits);
-         fprintf(err, "\tcAccumRedBits   = %d\n", ppfd->cAccumRedBits);
-         fprintf(err, "\tcAccumGreenBits = %d\n", ppfd->cAccumGreenBits);
-         fprintf(err, "\tcAccumBlueBits  = %d\n", ppfd->cAccumBlueBits);
-         fprintf(err, "\tcAccumAlphaBits = %d\n", ppfd->cAccumAlphaBits);
-         fprintf(err, "\tcDepthBits      = %d\n", ppfd->cDepthBits);
-         fprintf(err, "\tcStencilBits    = %d\n", ppfd->cStencilBits);
-         fprintf(err, "\tcAuxBuffers     = %d\n", ppfd->cAuxBuffers);
-         fprintf(err, "\tiLayerType      = %d\n", ppfd->iLayerType);
-         fprintf(err, "\tbReserved       = %d\n", ppfd->bReserved);
-         fprintf(err, "\tdwLayerMask     = %lu\n", ppfd->dwLayerMask);
-         fprintf(err, "\tdwVisibleMask   = %lu\n", ppfd->dwVisibleMask);
-         fprintf(err, "\tdwDamageMask    = %lu\n", ppfd->dwDamageMask);
-         fclose(err);
-      }
-
-      SetLastError(0);
-      return 0;
-   }
-
-   return best;
-}
-
-GLAPI int GLAPIENTRY
-ChoosePixelFormat (HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd)
-{
-
-   return wglChoosePixelFormat(hdc, ppfd);
-}
-
-GLAPI int GLAPIENTRY
-wglDescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes,
-                        LPPIXELFORMATDESCRIPTOR ppfd)
-{
-   int qt_valid_pix;
-
-   qt_valid_pix = pfd_tablen();
-
-   if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix ||
-       ((nBytes != sizeof(PIXELFORMATDESCRIPTOR)) && (nBytes != 0))) {
-      SetLastError(0);
-      return qt_valid_pix;
-   }
-
-   if (nBytes != 0)
-      *ppfd = pix[iPixelFormat - 1].pfd;
-
-   return qt_valid_pix;
-}
-
-GLAPI int GLAPIENTRY
-DescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes,
-                     LPPIXELFORMATDESCRIPTOR ppfd)
-{
-   return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
-}
-
-GLAPI int GLAPIENTRY
-wglGetPixelFormat (HDC hdc)
-{
-   if (curPFD == 0) {
-      SetLastError(0);
-      return 0;
-   }
-
-   return curPFD;
-}
-
-GLAPI int GLAPIENTRY
-GetPixelFormat (HDC hdc)
-{
-   return wglGetPixelFormat(hdc);
-}
-
-GLAPI BOOL GLAPIENTRY
-wglSetPixelFormat (HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
-{
-   int qt_valid_pix;
-
-   qt_valid_pix = pfd_tablen();
-
-   if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) {
-      if (ppfd == NULL) {
-         PIXELFORMATDESCRIPTOR my_pfd;
-         if (!wglDescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &my_pfd)) {
-            SetLastError(0);
-            return FALSE;
-         }
-      } else if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
-         SetLastError(0);
-         return FALSE;
-      }
-   }
-   curPFD = iPixelFormat;
-
-   return TRUE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglSwapBuffers (HDC hdc)
-{
-   if (!ctx) {
-      SetLastError(0);
-      return FALSE;
-   }
-
-   fxMesaSwapBuffers();
-
-   return TRUE;
-}
-
-GLAPI BOOL GLAPIENTRY
-SetPixelFormat (HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
-{
-   return wglSetPixelFormat(hdc, iPixelFormat, ppfd);
-}
-
-GLAPI BOOL GLAPIENTRY
-SwapBuffers(HDC hdc)
-{
-   return wglSwapBuffers(hdc);
-}
-
-static FIXED
-FixedFromDouble (double d)
-{
-   struct {
-      FIXED f;
-      long l;
-   } pun;
-   pun.l = (long)(d * 65536L);
-   return pun.f;
-}
-
-/*
-** This was yanked from windows/gdi/wgl.c
-*/
-GLAPI BOOL GLAPIENTRY
-wglUseFontBitmapsA (HDC hdc, DWORD first, DWORD count, DWORD listBase)
-{
-   int i;
-   GLuint font_list;
-   DWORD size;
-   GLYPHMETRICS gm;
-   HANDLE hBits;
-   LPSTR lpBits;
-   MAT2 mat;
-   int success = TRUE;
-
-   font_list = listBase;
-
-   mat.eM11 = FixedFromDouble(1);
-   mat.eM12 = FixedFromDouble(0);
-   mat.eM21 = FixedFromDouble(0);
-   mat.eM22 = FixedFromDouble(-1);
-
-   memset(&gm, 0, sizeof(gm));
-
-   /*
-    ** If we can't get the glyph outline, it may be because this is a fixed
-    ** font.  Try processing it that way.
-    */
-   if (GetGlyphOutline(hdc, first, GGO_BITMAP, &gm, 0, NULL, &mat) == GDI_ERROR) {
-      return wglUseFontBitmaps_FX(hdc, first, count, listBase);
-   }
-
-   /*
-    ** Otherwise process all desired characters.
-    */
-   for (i = 0; i < count; i++) {
-      DWORD err;
-
-      glNewList(font_list + i, GL_COMPILE);
-
-      /* allocate space for the bitmap/outline */
-      size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, 0, NULL, &mat);
-      if (size == GDI_ERROR) {
-         glEndList();
-         err = GetLastError();
-         success = FALSE;
-         continue;
-      }
-
-      hBits = GlobalAlloc(GHND, size + 1);
-      lpBits = GlobalLock(hBits);
-
-      err = GetGlyphOutline(hdc,        /* handle to device context */
-                            first + i,  /* character to query */
-                            GGO_BITMAP, /* format of data to return */
-                            &gm,        /* pointer to structure for metrics */
-                            size,       /* size of buffer for data */
-                            lpBits,     /* pointer to buffer for data */
-                            &mat        /* pointer to transformation */
-                                        /* matrix structure */
-          );
-
-      if (err == GDI_ERROR) {
-         GlobalUnlock(hBits);
-         GlobalFree(hBits);
-
-         glEndList();
-         err = GetLastError();
-         success = FALSE;
-         continue;
-      }
-
-      glBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY,
-               -gm.gmptGlyphOrigin.x,
-               gm.gmptGlyphOrigin.y,
-               gm.gmCellIncX, gm.gmCellIncY,
-               (const GLubyte *)lpBits);
-
-      GlobalUnlock(hBits);
-      GlobalFree(hBits);
-
-      glEndList();
-   }
-
-   return success;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglDescribeLayerPlane (HDC hdc, int iPixelFormat, int iLayerPlane,
-                       UINT nBytes, LPLAYERPLANEDESCRIPTOR ppfd)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI int GLAPIENTRY
-wglGetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart,
-                           int cEntries, COLORREF *pcr)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI BOOL GLAPIENTRY
-wglRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-GLAPI int GLAPIENTRY
-wglSetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart,
-                           int cEntries, CONST COLORREF *pcr)
-{
-   SetLastError(0);
-   return FALSE;
-}
-
-
-/***************************************************************************
- * [dBorca] simplistic ICD implementation, based on ICD code by Gregor Anich
- */
-
-typedef struct _icdTable {
-   DWORD size;
-   PROC table[336];
-} ICDTABLE, *PICDTABLE;
-
-#ifdef USE_MGL_NAMESPACE
-#define GL_FUNC(func) mgl##func
-#else
-#define GL_FUNC(func) gl##func
-#endif
-
-static ICDTABLE icdTable = { 336, {
-#define ICD_ENTRY(func) (PROC)GL_FUNC(func),
-#include "../icd/icdlist.h"
-#undef ICD_ENTRY
-} };
-
-
-GLAPI BOOL GLAPIENTRY
-DrvCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
-{
-   return wglCopyContext(hglrcSrc, hglrcDst, mask);
-}
-
-
-GLAPI HGLRC GLAPIENTRY
-DrvCreateContext (HDC hdc)
-{
-   return wglCreateContext(hdc);
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvDeleteContext (HGLRC hglrc)
-{
-   return wglDeleteContext(hglrc);
-}
-
-
-GLAPI HGLRC GLAPIENTRY
-DrvCreateLayerContext (HDC hdc, int iLayerPlane)
-{
-   return wglCreateContext(hdc);
-}
-
-
-GLAPI PICDTABLE GLAPIENTRY
-DrvSetContext (HDC hdc, HGLRC hglrc, void *callback)
-{
-   return wglMakeCurrent(hdc, hglrc) ? &icdTable : NULL;
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvReleaseContext (HGLRC hglrc)
-{
-   return TRUE;
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvShareLists (HGLRC hglrc1, HGLRC hglrc2)
-{
-   return wglShareLists(hglrc1, hglrc2);
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvDescribeLayerPlane (HDC hdc, int iPixelFormat,
-                       int iLayerPlane, UINT nBytes,
-                       LPLAYERPLANEDESCRIPTOR plpd)
-{
-   return wglDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd);
-}
-
-
-GLAPI int GLAPIENTRY
-DrvSetLayerPaletteEntries (HDC hdc, int iLayerPlane,
-                           int iStart, int cEntries, CONST COLORREF *pcr)
-{
-   return wglSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
-}
-
-
-GLAPI int GLAPIENTRY
-DrvGetLayerPaletteEntries (HDC hdc, int iLayerPlane,
-                           int iStart, int cEntries, COLORREF *pcr)
-{
-   return wglGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize)
-{
-   return wglRealizeLayerPalette(hdc, iLayerPlane, bRealize);
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvSwapLayerBuffers (HDC hdc, UINT fuPlanes)
-{
-   return wglSwapLayerBuffers(hdc, fuPlanes);
-}
-
-GLAPI int GLAPIENTRY
-DrvDescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes,
-                        LPPIXELFORMATDESCRIPTOR ppfd)
-{
-   return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
-}
-
-
-GLAPI PROC GLAPIENTRY
-DrvGetProcAddress (LPCSTR lpszProc)
-{
-   return wglGetProcAddress(lpszProc);
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvSetPixelFormat (HDC hdc, int iPixelFormat)
-{
-   return wglSetPixelFormat(hdc, iPixelFormat, NULL);
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvSwapBuffers (HDC hdc)
-{
-   return wglSwapBuffers(hdc);
-}
-
-
-GLAPI BOOL GLAPIENTRY
-DrvValidateVersion (DWORD version)
-{
-   (void)version;
-   return TRUE;
-}
-
-
-#if (_MSC_VER >= 1200)
-#pragma warning( pop )
-#endif
-
-#endif /* FX */
diff --git a/mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp b/mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp
deleted file mode 100644
index 78e5f3851..000000000
--- a/mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "glapi.h"
-#include "glThread.h"
-
-#ifdef WIN32
-
-extern "C" _glthread_Mutex OneTimeLock;
-extern "C" _glthread_Mutex GenTexturesLock;
-
-extern "C" void FreeAllTSD(void);
-
-class _CriticalSectionInit
-{
-public:
-	static _CriticalSectionInit	m_inst;
-
-	_CriticalSectionInit()
-	{
-		_glthread_INIT_MUTEX(OneTimeLock);
-		_glthread_INIT_MUTEX(GenTexturesLock);
-	}
-
-	~_CriticalSectionInit()
-	{
-		_glthread_DESTROY_MUTEX(OneTimeLock);
-		_glthread_DESTROY_MUTEX(GenTexturesLock);
-		FreeAllTSD();
-	}
-};
-
-_CriticalSectionInit _CriticalSectionInit::m_inst;
-
-
-#endif /* WIN32 */
diff --git a/mesalib/src/mesa/drivers/windows/gdi/SConscript b/mesalib/src/mesa/drivers/windows/gdi/SConscript
new file mode 100644
index 000000000..10a7eeaa1
--- /dev/null
+++ b/mesalib/src/mesa/drivers/windows/gdi/SConscript
@@ -0,0 +1,38 @@
+Import('*')
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+    '#src/mapi',
+    '#src/mesa',
+])
+
+env.AppendUnique(CPPDEFINES = [
+    '_GDI32_', # prevent wgl* being declared __declspec(dllimport)
+    'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 
+])
+if not env['gles']:
+    # prevent _glapi_* from being declared __declspec(dllimport)
+    env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
+
+env.Prepend(LIBS = [
+    glapi,
+    mesa,
+    glsl,
+    'gdi32',
+    'user32',
+    'kernel32',
+])
+
+sources = [
+    'mesa.def',
+    'wgl.c',
+    'wmesa.c',
+]
+
+mesagdi = env.SharedLibrary(
+    target = 'opengl32',
+    source = sources,
+)
+
+env.Alias('mesagdi', mesagdi)
diff --git a/mesalib/src/mesa/drivers/windows/gdi/mesa.def b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
index b537b3460..d5c98801d 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/mesa.def
+++ b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
@@ -26,9 +26,6 @@ VERSION 6.5
 ; be needed (for the gl* functions) since the entry
 ; points are compiled with dllexport declspec.
 ;
-; However, this file is still needed to export "internal"
-; Mesa symbols for the benefit of the OSMESA32.DLL.
-;
 EXPORTS
 	glNewList
 	glEndList
@@ -857,107 +854,3 @@ EXPORTS
 	wglUseFontOutlinesA
 	wglUseFontOutlinesW
 	wglGetExtensionsStringARB
-;
-; Mesa internals - mostly for OSMESA
-	_vbo_CreateContext
-	_vbo_DestroyContext
-	_vbo_InvalidateState
-	_glapi_check_multithread
-	_glapi_get_context
-	_glapi_get_proc_address
-	_mesa_add_soft_renderbuffers
-	_mesa_add_renderbuffer
-	_mesa_check_conditional_render
-	_mesa_choose_tex_format
-	_mesa_create_framebuffer
-	_mesa_create_visual
-	_mesa_delete_array_object
-	_mesa_delete_program
-	_mesa_delete_texture_object
-	_mesa_destroy_framebuffer
-	_mesa_destroy_visual
-	_mesa_enable_1_3_extensions
-	_mesa_enable_1_4_extensions
-	_mesa_enable_1_5_extensions
-	_mesa_enable_2_0_extensions
-	_mesa_enable_2_1_extensions
-	_mesa_enable_sw_extensions
-	_mesa_error
-	_mesa_finish_render_texture
-	_mesa_framebuffer_renderbuffer
-	_mesa_free_context_data
-	_mesa_free_texture_image_data
-	_mesa_generate_mipmap
-	_mesa_get_compressed_teximage
-	_mesa_get_current_context
-	_mesa_get_teximage
-	_mesa_init_driver_functions
-	_mesa_init_glsl_driver_functions
-	_mesa_init_renderbuffer
-	_mesa_initialize_context
-	_mesa_make_current
-	_mesa_new_array_object
-	_mesa_new_framebuffer
-	_mesa_new_program
-	_mesa_new_renderbuffer
-	_mesa_new_soft_renderbuffer
-	_mesa_new_texture_image
-	_mesa_new_texture_object
-	_mesa_problem
-	_mesa_reference_renderbuffer
-	_mesa_remove_renderbuffer
-	_mesa_render_texture
-	_mesa_ResizeBuffersMESA
-	_mesa_resize_framebuffer
-	_mesa_store_compressed_teximage1d
-	_mesa_store_compressed_teximage2d
-	_mesa_store_compressed_teximage3d
-	_mesa_store_compressed_texsubimage1d
-	_mesa_store_compressed_texsubimage2d
-	_mesa_store_compressed_texsubimage3d
-	_mesa_store_teximage1d
-	_mesa_store_teximage2d
-	_mesa_store_teximage3d
-	_mesa_store_texsubimage1d
-	_mesa_store_texsubimage2d
-	_mesa_store_texsubimage3d
-	_mesa_test_proxy_teximage
-	_mesa_reference_framebuffer
-	_mesa_update_framebuffer_visual
-	_mesa_use_program
-	_mesa_Viewport
-	_mesa_meta_init
-	_mesa_meta_free
-	_mesa_meta_CopyColorSubTable
-	_mesa_meta_CopyColorTable
-	_mesa_meta_CopyConvolutionFilter1D
-	_mesa_meta_CopyConvolutionFilter2D
-	_mesa_meta_CopyTexImage1D
-	_mesa_meta_CopyTexImage2D
-	_mesa_meta_CopyTexSubImage1D
-	_mesa_meta_CopyTexSubImage2D
-	_mesa_meta_CopyTexSubImage3D
-	_swrast_Accum
-	_swrast_Bitmap
-	_swrast_BlitFramebuffer
-	_swrast_CopyPixels
-	_swrast_DrawPixels
-	_swrast_GetDeviceDriverReference
-	_swrast_Clear
-	_swrast_choose_line
-	_swrast_choose_triangle
-	_swrast_CreateContext
-	_swrast_DestroyContext
-	_swrast_exec_fragment_program
-	_swrast_InvalidateState
-	_swrast_ReadPixels
-	_swsetup_Wakeup
-	_swsetup_CreateContext
-	_swsetup_DestroyContext
-	_swsetup_InvalidateState
-	_tnl_CreateContext
-	_tnl_DestroyContext
-	_tnl_InvalidateState
-	_tnl_run_pipeline
-	_tnl_program_string
-	_tnl_RasterPos
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wgl.c b/mesalib/src/mesa/drivers/windows/gdi/wgl.c
index 8d8087067..1dafe6e29 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wgl.c
+++ b/mesalib/src/mesa/drivers/windows/gdi/wgl.c
@@ -54,8 +54,8 @@
 #include <windows.h>
 
 #endif
-#include "config.h"
-#include "glapi.h"
+#include "main/config.h"
+#include "glapi/glapi.h"
 #include "GL/wmesa.h"   /* protos for wmesa* functions */
 
 /*
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
index 4a8b1b283..35a150d06 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
@@ -5,12 +5,13 @@
 
 #include "wmesadef.h"
 #include "colors.h"
-#include <GL/wmesa.h>
+#include "GL/wmesa.h"
 #include <winuser.h>
-#include "context.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
+#include "main/context.h"
+#include "main/extensions.h"
+#include "main/framebuffer.h"
+#include "main/renderbuffer.h"
+#include "main/macros.h"
 #include "drivers/common/driverfuncs.h"
 #include "drivers/common/meta.h"
 #include "vbo/vbo.h"
@@ -29,7 +30,7 @@ static WMesaFramebuffer FirstFramebuffer = NULL;
  * Create a new WMesaFramebuffer object which will correspond to the
  * given HDC (Window handle).
  */
-WMesaFramebuffer
+static WMesaFramebuffer
 wmesa_new_framebuffer(HDC hdc, struct gl_config *visual)
 {
     WMesaFramebuffer pwfb
@@ -47,7 +48,7 @@ wmesa_new_framebuffer(HDC hdc, struct gl_config *visual)
 /**
  * Given an hdc, free the corresponding WMesaFramebuffer
  */
-void
+static void
 wmesa_free_framebuffer(HDC hdc)
 {
     WMesaFramebuffer pwfb, prev;
@@ -70,7 +71,7 @@ wmesa_free_framebuffer(HDC hdc)
 /**
  * Given an hdc, return the corresponding WMesaFramebuffer
  */
-WMesaFramebuffer
+static WMesaFramebuffer
 wmesa_lookup_framebuffer(HDC hdc)
 {
     WMesaFramebuffer pwfb;
@@ -146,9 +147,8 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC)
  * We write into this memory with the span routines and then blit it
  * to the window on a buffer swap.
  */
-BOOL wmCreateBackingStore(WMesaFramebuffer pwfb, long lxSize, long lySize)
+static BOOL wmCreateBackingStore(WMesaFramebuffer pwfb, long lxSize, long lySize)
 {
-    HDC          hdc = pwfb->hDC;
     LPBITMAPINFO pbmi = &(pwfb->bmi);
     HDC          hic;
 
@@ -185,7 +185,7 @@ BOOL wmCreateBackingStore(WMesaFramebuffer pwfb, long lxSize, long lySize)
 }
 
 
-static wmDeleteBackingStore(WMesaFramebuffer pwfb)
+static void wmDeleteBackingStore(WMesaFramebuffer pwfb)
 {
     if (pwfb->hbmDIB) {
 	SelectObject(pwfb->dib_hDC, pwfb->hOldBitmap);
@@ -226,7 +226,6 @@ wmesa_get_buffer_size(struct gl_framebuffer *buffer, GLuint *width, GLuint *heig
 
 static void wmesa_flush(struct gl_context *ctx)
 {
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->WinSysDrawBuffer);
 
     if (ctx->Visual.doubleBufferMode == 1) {
@@ -253,9 +252,7 @@ static void wmesa_flush(struct gl_context *ctx)
 static void clear_color(struct gl_context *ctx, const GLfloat color[4])
 {
     WMesaContext pwc = wmesa_context(ctx);
-    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     GLubyte col[3];
-    UINT    bytesPerPixel = pwfb->cColorBits / 8; 
 
     CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
     CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
@@ -447,21 +444,15 @@ static void clear(struct gl_context *ctx, GLbitfield mask)
  **/
 
 /* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_front(const struct gl_context *ctx, 
-				   struct gl_renderbuffer *rb, 
-				   GLuint n, GLint x, GLint y,
-				   const GLubyte rgba[][4], 
-				   const GLubyte mask[] )
+static void write_rgba_span_front(struct gl_context *ctx, 
+				  struct gl_renderbuffer *rb, 
+				  GLuint n, GLint x, GLint y,
+				  const void *values, 
+				  const GLubyte *mask)
 {
+   const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
    WMesaContext pwc = wmesa_context(ctx);
    WMesaFramebuffer pwfb = wmesa_lookup_framebuffer(pwc->hDC);
-   CONST BITMAPINFO bmi=
-   {
-      {
-         sizeof(BITMAPINFOHEADER),
-         n, 1, 1, 32, BI_RGB, 0, 1, 1, 0, 0
-      }
-   };
    HBITMAP bmp=0;
    HDC mdc=0;
    typedef union
@@ -534,12 +525,13 @@ static void write_rgba_span_front(const struct gl_context *ctx,
 }
 
 /* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_front(const struct gl_context *ctx, 
-				  struct gl_renderbuffer *rb, 
-				  GLuint n, GLint x, GLint y,
-				  const GLubyte rgb[][3], 
-				  const GLubyte mask[] )
+static void write_rgb_span_front(struct gl_context *ctx, 
+				 struct gl_renderbuffer *rb, 
+				 GLuint n, GLint x, GLint y,
+				 const void *values, 
+				 const GLubyte *mask)
 {
+    const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
     WMesaContext pwc = wmesa_context(ctx);
     GLuint i;
     
@@ -563,12 +555,13 @@ static void write_rgb_span_front(const struct gl_context *ctx,
  * Write a horizontal span of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_span_front(const struct gl_context *ctx, 
-					struct gl_renderbuffer *rb,
-					GLuint n, GLint x, GLint y,
-					const GLchan color[4], 
-					const GLubyte mask[])
+static void write_mono_rgba_span_front(struct gl_context *ctx, 
+                                       struct gl_renderbuffer *rb,
+                                       GLuint n, GLint x, GLint y,
+                                       const void *value, 
+                                       const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     GLuint i;
     WMesaContext pwc = wmesa_context(ctx);
     COLORREF colorref;
@@ -588,13 +581,14 @@ static void write_mono_rgba_span_front(const struct gl_context *ctx,
 }
 
 /* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_front(const struct gl_context *ctx, 
-				     struct gl_renderbuffer *rb,
-				     GLuint n, 
-				     const GLint x[], const GLint y[],
-				     const GLubyte rgba[][4], 
-				     const GLubyte mask[] )
+static void write_rgba_pixels_front(struct gl_context *ctx, 
+                                    struct gl_renderbuffer *rb,
+                                    GLuint n, 
+                                    const GLint x[], const GLint y[],
+                                    const void *values, 
+                                    const GLubyte *mask)
 {
+    const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
     GLuint i;
     WMesaContext pwc = wmesa_context(ctx);
     (void) ctx;
@@ -611,13 +605,14 @@ static void write_rgba_pixels_front(const struct gl_context *ctx,
  * Write an array of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_pixels_front(const struct gl_context *ctx, 
-					  struct gl_renderbuffer *rb,
-					  GLuint n,
-					  const GLint x[], const GLint y[],
-					  const GLchan color[4],
-					  const GLubyte mask[] )
+static void write_mono_rgba_pixels_front(struct gl_context *ctx, 
+                                         struct gl_renderbuffer *rb,
+                                         GLuint n,
+                                         const GLint x[], const GLint y[],
+                                         const void *value,
+                                         const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     GLuint i;
     WMesaContext pwc = wmesa_context(ctx);
     COLORREF colorref;
@@ -629,11 +624,12 @@ static void write_mono_rgba_pixels_front(const struct gl_context *ctx,
 }
 
 /* Read a horizontal span of color pixels. */
-static void read_rgba_span_front(const struct gl_context *ctx, 
-				  struct gl_renderbuffer *rb,
-				  GLuint n, GLint x, GLint y,
-				  GLubyte rgba[][4] )
+static void read_rgba_span_front(struct gl_context *ctx, 
+                                 struct gl_renderbuffer *rb,
+                                 GLuint n, GLint x, GLint y,
+                                 void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     WMesaContext pwc = wmesa_context(ctx);
     GLuint i;
     COLORREF Color;
@@ -649,11 +645,12 @@ static void read_rgba_span_front(const struct gl_context *ctx,
 
 
 /* Read an array of color pixels. */
-static void read_rgba_pixels_front(const struct gl_context *ctx, 
-				    struct gl_renderbuffer *rb,
-				    GLuint n, const GLint x[], const GLint y[],
-				    GLubyte rgba[][4])
+static void read_rgba_pixels_front(struct gl_context *ctx, 
+                                   struct gl_renderbuffer *rb,
+                                   GLuint n, const GLint x[], const GLint y[],
+                                   void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     WMesaContext pwc = wmesa_context(ctx);
     GLuint i;
     COLORREF Color;
@@ -678,13 +675,13 @@ LPDWORD lpdw = ((LPDWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \
 
 
 /* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_32(const struct gl_context *ctx, 
+static void write_rgba_span_32(struct gl_context *ctx, 
 			       struct gl_renderbuffer *rb, 
 			       GLuint n, GLint x, GLint y,
-			       const GLubyte rgba[][4], 
-			       const GLubyte mask[] )
+			       const void *values, 
+			       const GLubyte *mask)
 {
-    WMesaContext pwc = wmesa_context(ctx);
+    const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     GLuint i;
     LPDWORD lpdw;
@@ -708,13 +705,13 @@ static void write_rgba_span_32(const struct gl_context *ctx,
 
 
 /* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_32(const struct gl_context *ctx, 
+static void write_rgb_span_32(struct gl_context *ctx, 
 			      struct gl_renderbuffer *rb, 
 			      GLuint n, GLint x, GLint y,
-			      const GLubyte rgb[][3], 
-			      const GLubyte mask[] )
+			      const void *values, 
+			      const GLubyte *mask)
 {
-    WMesaContext pwc = wmesa_context(ctx);
+    const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     GLuint i;
     LPDWORD lpdw;
@@ -740,16 +737,16 @@ static void write_rgb_span_32(const struct gl_context *ctx,
  * Write a horizontal span of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_span_32(const struct gl_context *ctx, 
+static void write_mono_rgba_span_32(struct gl_context *ctx, 
 				    struct gl_renderbuffer *rb,
 				    GLuint n, GLint x, GLint y,
-				    const GLchan color[4], 
-				    const GLubyte mask[])
+				    const void *value, 
+				    const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     LPDWORD lpdw;
     DWORD pixel;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;
     y=FLIP(y);
@@ -766,14 +763,14 @@ static void write_mono_rgba_span_32(const struct gl_context *ctx,
 }
 
 /* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_32(const struct gl_context *ctx, 
+static void write_rgba_pixels_32(struct gl_context *ctx, 
 				 struct gl_renderbuffer *rb,
 				 GLuint n, const GLint x[], const GLint y[],
-				 const GLubyte rgba[][4], 
-				 const GLubyte mask[])
+				 const void *values, 
+				 const GLubyte *mask)
 {
+    const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     for (i=0; i<n; i++)
 	if (mask[i])
@@ -785,15 +782,15 @@ static void write_rgba_pixels_32(const struct gl_context *ctx,
  * Write an array of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_pixels_32(const struct gl_context *ctx, 
+static void write_mono_rgba_pixels_32(struct gl_context *ctx, 
 				      struct gl_renderbuffer *rb,
 				      GLuint n,
 				      const GLint x[], const GLint y[],
-				      const GLchan color[4],
-				      const GLubyte mask[])
+				      const void *value,
+				      const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     for (i=0; i<n; i++)
 	if (mask[i])
@@ -802,15 +799,15 @@ static void write_mono_rgba_pixels_32(const struct gl_context *ctx,
 }
 
 /* Read a horizontal span of color pixels. */
-static void read_rgba_span_32(const struct gl_context *ctx, 
+static void read_rgba_span_32(struct gl_context *ctx, 
 			      struct gl_renderbuffer *rb,
 			      GLuint n, GLint x, GLint y,
-			      GLubyte rgba[][4] )
+			      void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     GLuint i;
     DWORD pixel;
     LPDWORD lpdw;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     
     y = FLIP(y);
@@ -826,15 +823,15 @@ static void read_rgba_span_32(const struct gl_context *ctx,
 
 
 /* Read an array of color pixels. */
-static void read_rgba_pixels_32(const struct gl_context *ctx, 
+static void read_rgba_pixels_32(struct gl_context *ctx, 
 				struct gl_renderbuffer *rb,
 				GLuint n, const GLint x[], const GLint y[],
-				GLubyte rgba[][4])
+				void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     GLuint i;
     DWORD pixel;
     LPDWORD lpdw;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
 
     for (i=0; i<n; i++) {
@@ -860,13 +857,13 @@ lpb[1] = (g); \
 lpb[2] = (r); }
 
 /* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_24(const struct gl_context *ctx, 
+static void write_rgba_span_24(struct gl_context *ctx, 
 			       struct gl_renderbuffer *rb, 
 			       GLuint n, GLint x, GLint y,
-			       const GLubyte rgba[][4], 
-			       const GLubyte mask[] )
+			       const void *values, 
+			       const GLubyte *mask)
 {
-    WMesaContext pwc = wmesa_context(ctx);
+    const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     GLuint i;
     LPBYTE lpb;
@@ -894,13 +891,13 @@ static void write_rgba_span_24(const struct gl_context *ctx,
 
 
 /* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_24(const struct gl_context *ctx, 
+static void write_rgb_span_24(struct gl_context *ctx, 
 			      struct gl_renderbuffer *rb, 
 			      GLuint n, GLint x, GLint y,
-			      const GLubyte rgb[][3], 
-			      const GLubyte mask[] )
+			      const void *values, 
+			      const GLubyte *mask)
 {
-    WMesaContext pwc = wmesa_context(ctx);
+    const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     GLuint i;
     LPBYTE lpb;
@@ -930,15 +927,15 @@ static void write_rgb_span_24(const struct gl_context *ctx,
  * Write a horizontal span of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_span_24(const struct gl_context *ctx, 
+static void write_mono_rgba_span_24(struct gl_context *ctx, 
 				    struct gl_renderbuffer *rb,
 				    GLuint n, GLint x, GLint y,
-				    const GLchan color[4], 
-				    const GLubyte mask[])
+				    const void *value, 
+				    const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     LPBYTE lpb;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     lpb = ((LPBYTE)(pwfb->pbPixels + pwfb->ScanWidth * y)) + (3 * x);
     y=FLIP(y);
@@ -959,14 +956,14 @@ static void write_mono_rgba_span_24(const struct gl_context *ctx,
 }
 
 /* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_24(const struct gl_context *ctx, 
+static void write_rgba_pixels_24(struct gl_context *ctx, 
 				 struct gl_renderbuffer *rb,
 				 GLuint n, const GLint x[], const GLint y[],
-				 const GLubyte rgba[][4], 
-				 const GLubyte mask[])
+				 const void *values, 
+				 const GLubyte *mask)
 {
+    const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     for (i=0; i<n; i++)
 	if (mask[i])
@@ -978,15 +975,15 @@ static void write_rgba_pixels_24(const struct gl_context *ctx,
  * Write an array of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_pixels_24(const struct gl_context *ctx, 
+static void write_mono_rgba_pixels_24(struct gl_context *ctx, 
 				      struct gl_renderbuffer *rb,
 				      GLuint n,
 				      const GLint x[], const GLint y[],
-				      const GLchan color[4],
-				      const GLubyte mask[])
+				      const void *value,
+				      const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     for (i=0; i<n; i++)
 	if (mask[i])
@@ -995,14 +992,14 @@ static void write_mono_rgba_pixels_24(const struct gl_context *ctx,
 }
 
 /* Read a horizontal span of color pixels. */
-static void read_rgba_span_24(const struct gl_context *ctx, 
+static void read_rgba_span_24(struct gl_context *ctx, 
 			      struct gl_renderbuffer *rb,
 			      GLuint n, GLint x, GLint y,
-			      GLubyte rgba[][4] )
+			      void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     GLuint i;
     LPBYTE lpb;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     
     y = FLIP(y);
@@ -1017,14 +1014,14 @@ static void read_rgba_span_24(const struct gl_context *ctx,
 
 
 /* Read an array of color pixels. */
-static void read_rgba_pixels_24(const struct gl_context *ctx, 
+static void read_rgba_pixels_24(struct gl_context *ctx, 
 				struct gl_renderbuffer *rb,
 				GLuint n, const GLint x[], const GLint y[],
-				GLubyte rgba[][4])
+				void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     GLuint i;
     LPBYTE lpb;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
 
     for (i=0; i<n; i++) {
@@ -1049,13 +1046,13 @@ LPWORD lpw = ((LPWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \
 
 
 /* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_16(const struct gl_context *ctx, 
+static void write_rgba_span_16(struct gl_context *ctx, 
 			       struct gl_renderbuffer *rb, 
 			       GLuint n, GLint x, GLint y,
-			       const GLubyte rgba[][4], 
-			       const GLubyte mask[] )
+			       const void *values, 
+			       const GLubyte *mask)
 {
-    WMesaContext pwc = wmesa_context(ctx);
+    const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     GLuint i;
     LPWORD lpw;
@@ -1079,13 +1076,13 @@ static void write_rgba_span_16(const struct gl_context *ctx,
 
 
 /* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_16(const struct gl_context *ctx, 
+static void write_rgb_span_16(struct gl_context *ctx, 
 			      struct gl_renderbuffer *rb, 
 			      GLuint n, GLint x, GLint y,
-			      const GLubyte rgb[][3], 
-			      const GLubyte mask[] )
+			      const void *values, 
+			      const GLubyte *mask)
 {
-    WMesaContext pwc = wmesa_context(ctx);
+    const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     GLuint i;
     LPWORD lpw;
@@ -1111,16 +1108,16 @@ static void write_rgb_span_16(const struct gl_context *ctx,
  * Write a horizontal span of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_span_16(const struct gl_context *ctx, 
+static void write_mono_rgba_span_16(struct gl_context *ctx, 
 				    struct gl_renderbuffer *rb,
 				    GLuint n, GLint x, GLint y,
-				    const GLchan color[4], 
-				    const GLubyte mask[])
+				    const void *value, 
+				    const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     LPWORD lpw;
     WORD pixel;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     (void) ctx;
     lpw = ((LPWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;
@@ -1138,14 +1135,14 @@ static void write_mono_rgba_span_16(const struct gl_context *ctx,
 }
 
 /* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_16(const struct gl_context *ctx, 
+static void write_rgba_pixels_16(struct gl_context *ctx, 
 				 struct gl_renderbuffer *rb,
 				 GLuint n, const GLint x[], const GLint y[],
-				 const GLubyte rgba[][4], 
-				 const GLubyte mask[])
+				 const void *values, 
+				 const GLubyte *mask)
 {
+    const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     (void) ctx;
     for (i=0; i<n; i++)
@@ -1158,15 +1155,15 @@ static void write_rgba_pixels_16(const struct gl_context *ctx,
  * Write an array of pixels with a boolean mask.  The current color
  * is used for all pixels.
  */
-static void write_mono_rgba_pixels_16(const struct gl_context *ctx, 
+static void write_mono_rgba_pixels_16(struct gl_context *ctx, 
 				      struct gl_renderbuffer *rb,
 				      GLuint n,
 				      const GLint x[], const GLint y[],
-				      const GLchan color[4],
-				      const GLubyte mask[])
+				      const void *value,
+				      const GLubyte *mask)
 {
+    const GLchan *color = (const GLchan *)value;
     GLuint i;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     (void) ctx;
     for (i=0; i<n; i++)
@@ -1176,14 +1173,14 @@ static void write_mono_rgba_pixels_16(const struct gl_context *ctx,
 }
 
 /* Read a horizontal span of color pixels. */
-static void read_rgba_span_16(const struct gl_context *ctx, 
+static void read_rgba_span_16(struct gl_context *ctx, 
 			      struct gl_renderbuffer *rb,
 			      GLuint n, GLint x, GLint y,
-			      GLubyte rgba[][4] )
+			      void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     GLuint i, pixel;
     LPWORD lpw;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
     
     y = FLIP(y);
@@ -1200,14 +1197,14 @@ static void read_rgba_span_16(const struct gl_context *ctx,
 
 
 /* Read an array of color pixels. */
-static void read_rgba_pixels_16(const struct gl_context *ctx, 
+static void read_rgba_pixels_16(struct gl_context *ctx, 
 				struct gl_renderbuffer *rb,
 				GLuint n, const GLint x[], const GLint y[],
-				GLubyte rgba[][4])
+				void *values)
 {
+    GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
     GLuint i, pixel;
     LPWORD lpw;
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
 
     for (i=0; i<n; i++) {
@@ -1260,8 +1257,9 @@ wmesa_renderbuffer_storage(struct gl_context *ctx,
  * Plug in the Get/PutRow/Values functions for a renderbuffer depending
  * on if we're drawing to the front or back color buffer.
  */
-void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
-                                  int cColorBits, int double_buffer)
+static void
+wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
+                             int cColorBits, int double_buffer)
 {
     if (double_buffer) {
         /* back buffer */
@@ -1323,7 +1321,6 @@ static void
 wmesa_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *buffer,
                      GLuint width, GLuint height)
 {
-    WMesaContext pwc = wmesa_context(ctx);
     WMesaFramebuffer pwfb = wmesa_framebuffer(buffer);
 
     if (pwfb->Base.Width != width || pwfb->Base.Height != height) {
@@ -1352,7 +1349,6 @@ static void wmesa_viewport(struct gl_context *ctx,
 			   GLint x, GLint y, 
 			   GLsizei width, GLsizei height)
 {
-    WMesaContext pwc = wmesa_context(ctx);
     GLuint new_width, new_height;
 
     wmesa_get_buffer_size(ctx->WinSysDrawBuffer, &new_width, &new_height);
@@ -1552,7 +1548,7 @@ void WMesaDestroyContext( WMesaContext pwc )
 /**
  * Create a new color renderbuffer.
  */
-struct gl_renderbuffer *
+static struct gl_renderbuffer *
 wmesa_new_renderbuffer(void)
 {
     struct gl_renderbuffer *rb = CALLOC_STRUCT(gl_renderbuffer);
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h b/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h
index 530673373..9fda88390 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h
+++ b/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h
@@ -1,43 +1,43 @@
-#ifndef WMESADEF_H
-#define WMESADEF_H
-#ifdef __MINGW32__
-#include <windows.h>
-#endif
-#include "context.h"
-
-
-/**
- * The Windows Mesa rendering context, derived from struct gl_context.
- */
-struct wmesa_context {
-    struct gl_context           gl_ctx;	        /* The core GL/Mesa context */
-    HDC                 hDC;
-    COLORREF		clearColorRef;
-    HPEN                clearPen;
-    HBRUSH              clearBrush;
-};
-
-
-/**
- * Windows framebuffer, derived from gl_framebuffer
- */
-struct wmesa_framebuffer
-{
-    struct gl_framebuffer Base;
-    HDC                 hDC;
-    int			pixelformat;
-    GLuint		ScanWidth;
-    int			cColorBits;
-    /* back buffer DIB fields */
-    HDC                 dib_hDC;
-    BITMAPINFO          bmi;
-    HBITMAP             hbmDIB;
-    HBITMAP             hOldBitmap;
-    PBYTE               pbPixels;
-    struct wmesa_framebuffer *next;
-};
-
-typedef struct wmesa_framebuffer *WMesaFramebuffer;
-
-
-#endif /* WMESADEF_H */
+#ifndef WMESADEF_H
+#define WMESADEF_H
+
+#include <windows.h>
+
+#include "main/context.h"
+
+
+/**
+ * The Windows Mesa rendering context, derived from struct gl_context.
+ */
+struct wmesa_context {
+    struct gl_context           gl_ctx;	        /* The core GL/Mesa context */
+    HDC                 hDC;
+    COLORREF		clearColorRef;
+    HPEN                clearPen;
+    HBRUSH              clearBrush;
+};
+
+
+/**
+ * Windows framebuffer, derived from gl_framebuffer
+ */
+struct wmesa_framebuffer
+{
+    struct gl_framebuffer Base;
+    HDC                 hDC;
+    int			pixelformat;
+    GLuint		ScanWidth;
+    int			cColorBits;
+    /* back buffer DIB fields */
+    HDC                 dib_hDC;
+    BITMAPINFO          bmi;
+    HBITMAP             hbmDIB;
+    HBITMAP             hOldBitmap;
+    PBYTE               pbPixels;
+    struct wmesa_framebuffer *next;
+};
+
+typedef struct wmesa_framebuffer *WMesaFramebuffer;
+
+
+#endif /* WMESADEF_H */
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index d0298df20..93214dd0b 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -502,6 +502,9 @@ _mesa_create_exec_table(void)
    SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
    SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
    SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
+
+   /* ARB 104. GL_ARB_robustness */
+   SET_GetnCompressedTexImageARB(exec, _mesa_GetnCompressedTexImageARB);
 #endif
 
    /* ARB 14. GL_ARB_point_parameters */
@@ -597,6 +600,12 @@ _mesa_create_exec_table(void)
    SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
 #endif
 
+   /* ARB 104. GL_ARB_robustness */
+   SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB);
+   SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB);
+   SET_GetnTexImageARB(exec, _mesa_GetnTexImageARB);
+   SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB);
+
    /* GL_ARB_sync */
    _mesa_init_sync_dispatch(exec);
 
diff --git a/mesalib/src/mesa/main/colortab.c b/mesalib/src/mesa/main/colortab.c
index 35b3096f6..ddb0f1f65 100644
--- a/mesalib/src/mesa/main/colortab.c
+++ b/mesalib/src/mesa/main/colortab.c
@@ -190,7 +190,7 @@ store_colortable_entries(struct gl_context *ctx, struct gl_color_table *table,
 {
    data = _mesa_map_validate_pbo_source(ctx, 
                                         1, &ctx->Unpack, count, 1, 1,
-                                        format, type, data,
+                                        format, type, INT_MAX, data,
                                         "glColor[Sub]Table");
    if (!data)
       return;
@@ -509,8 +509,8 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start,
 
 
 static void GLAPIENTRY
-_mesa_GetColorTable( GLenum target, GLenum format,
-                     GLenum type, GLvoid *data )
+_mesa_GetnColorTableARB( GLenum target, GLenum format, GLenum type,
+                         GLsizei bufSize, GLvoid *data )
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
@@ -614,7 +614,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
 
    data = _mesa_map_validate_pbo_dest(ctx, 
                                       1, &ctx->Pack, table->Size, 1, 1,
-                                      format, type, data,
+                                      format, type, bufSize, data,
                                       "glGetColorTable");
    if (!data)
       return;
@@ -630,6 +630,13 @@ _mesa_GetColorTable( GLenum target, GLenum format,
 }
 
 
+static void GLAPIENTRY
+_mesa_GetColorTable( GLenum target, GLenum format,
+                     GLenum type, GLvoid *data )
+{
+   _mesa_GetnColorTableARB(target, format, type, INT_MAX, data);
+}
+
 
 static void GLAPIENTRY
 _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
@@ -790,6 +797,9 @@ _mesa_init_colortable_dispatch(struct _glapi_table *disp)
    SET_GetColorTable(disp, _mesa_GetColorTable);
    SET_GetColorTableParameterfv(disp, _mesa_GetColorTableParameterfv);
    SET_GetColorTableParameteriv(disp, _mesa_GetColorTableParameteriv);
+
+   /* GL_ARB_robustness */
+   SET_GetnColorTableARB(disp, _mesa_GetnColorTableARB);
 }
 
 
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 8053edc23..ea13bdd68 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -658,6 +658,9 @@ _mesa_init_constants(struct gl_context *ctx)
    /** GL_EXT_gpu_shader4 */
    ctx->Const.MinProgramTexelOffset = -8;
    ctx->Const.MaxProgramTexelOffset = 7;
+
+   /* GL_ARB_robustness */
+   ctx->Const.ResetStrategy = GL_NO_RESET_NOTIFICATION_ARB;
 }
 
 
@@ -793,6 +796,7 @@ init_attrib_groups(struct gl_context *ctx)
    /* Miscellaneous */
    ctx->NewState = _NEW_ALL;
    ctx->ErrorValue = (GLenum) GL_NO_ERROR;
+   ctx->ResetStatus = (GLenum) GL_NO_ERROR;
    ctx->varying_vp_inputs = ~0;
 
    return GL_TRUE;
diff --git a/mesalib/src/mesa/main/convolve.c b/mesalib/src/mesa/main/convolve.c
index 1e789dd8c..74f28da87 100644
--- a/mesalib/src/mesa/main/convolve.c
+++ b/mesalib/src/mesa/main/convolve.c
@@ -1,182 +1,205 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.2
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/*
- * Image convolution functions.
- *
- * Notes: filter kernel elements are indexed by <n> and <m> as in
- * the GL spec.
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "colormac.h"
-#include "convolve.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_convolve
-
-static void GLAPIENTRY
-_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D");
-}
-
-static void GLAPIENTRY
-_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D");
-}
-
-
-static void GLAPIENTRY
-_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf");
-}
-
-
-static void GLAPIENTRY
-_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv");
-}
-
-
-static void GLAPIENTRY
-_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri");
-}
-
-
-static void GLAPIENTRY
-_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv");
-}
-
-
-static void GLAPIENTRY
-_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D");
-}
-
-
-static void GLAPIENTRY
-_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
-                           GLvoid *image)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
-                         GLvoid *row, GLvoid *column, GLvoid *span)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter");
-}
-
-
-static void GLAPIENTRY
-_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D");
-}
-
-void
-_mesa_init_convolve_dispatch(struct _glapi_table *disp)
-{
-   SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D);
-   SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D);
-   SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf);
-   SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv);
-   SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri);
-   SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv);
-   SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D);
-   SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D);
-   SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter);
-   SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv);
-   SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv);
-   SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D);
-   SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter);
-}
-
-
-#endif /* FEATURE_convolve */
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5.2
+ *
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Image convolution functions.
+ *
+ * Notes: filter kernel elements are indexed by <n> and <m> as in
+ * the GL spec.
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "colormac.h"
+#include "convolve.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+#include "main/dispatch.h"
+
+
+#if FEATURE_convolve
+
+static void GLAPIENTRY
+_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D");
+}
+
+static void GLAPIENTRY
+_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D");
+}
+
+
+static void GLAPIENTRY
+_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf");
+}
+
+
+static void GLAPIENTRY
+_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv");
+}
+
+
+static void GLAPIENTRY
+_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri");
+}
+
+
+static void GLAPIENTRY
+_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv");
+}
+
+
+static void GLAPIENTRY
+_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D");
+}
+
+
+static void GLAPIENTRY
+_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetnConvolutionFilterARB(GLenum target, GLenum format, GLenum type,
+                               GLsizei bufSize, GLvoid *image)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
+                           GLvoid *image)
+{
+   _mesa_GetnConvolutionFilterARB(target, format, type, INT_MAX, image);
+}
+
+
+static void GLAPIENTRY
+_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetnSeparableFilterARB(GLenum target, GLenum format, GLenum type,
+                             GLsizei rowBufSize, GLvoid *row,
+                             GLsizei columnBufSize,  GLvoid *column,
+                             GLvoid *span)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
+                         GLvoid *row, GLvoid *column, GLvoid *span)
+{
+   _mesa_GetnSeparableFilterARB(target, format, type, INT_MAX, row,
+                                INT_MAX, column, span);
+}
+
+
+static void GLAPIENTRY
+_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D");
+}
+
+void
+_mesa_init_convolve_dispatch(struct _glapi_table *disp)
+{
+   SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D);
+   SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D);
+   SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf);
+   SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv);
+   SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri);
+   SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv);
+   SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D);
+   SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D);
+   SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter);
+   SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv);
+   SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv);
+   SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D);
+   SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter);
+
+   /* GL_ARB_robustness */
+   SET_GetnConvolutionFilterARB(disp, _mesa_GetnConvolutionFilterARB);
+   SET_GetnSeparableFilterARB(disp, _mesa_GetnSeparableFilterARB);
+}
+
+
+#endif /* FEATURE_convolve */
diff --git a/mesalib/src/mesa/main/depthstencil.c b/mesalib/src/mesa/main/depthstencil.c
index a1f206b9c..ab62c97fe 100644
--- a/mesalib/src/mesa/main/depthstencil.c
+++ b/mesalib/src/mesa/main/depthstencil.c
@@ -1,832 +1,835 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "formats.h"
-#include "mtypes.h"
-#include "depthstencil.h"
-#include "renderbuffer.h"
-
-
-/**
- * Adaptor/wrappers for GL_DEPTH_STENCIL renderbuffers.
- *
- * The problem with a GL_DEPTH_STENCIL renderbuffer is that sometimes we
- * want to treat it as a stencil buffer, other times we want to treat it
- * as a depth/z buffer and still other times when we want to treat it as
- * a combined Z+stencil buffer!  That implies we need three different sets
- * of Get/Put functions.
- *
- * We solve this by wrapping the Z24_S8 or S8_Z24 renderbuffer with depth and
- * stencil adaptors, each with the right kind of depth/stencil Get/Put functions.
- */
-
-
-static void *
-nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
-{
-   (void) ctx;
-   (void) rb;
-   (void) x;
-   (void) y;
-   return NULL;
-}
-
-
-/**
- * Delete a depth or stencil wrapper renderbuffer.
- */
-static void
-delete_wrapper(struct gl_renderbuffer *rb)
-{
-   ASSERT(rb->Format == MESA_FORMAT_S8 ||
-          rb->Format == MESA_FORMAT_X8_Z24);
-   _mesa_reference_renderbuffer(&rb->Wrapped, NULL);
-   free(rb);
-}
-
-
-/**
- * Realloc storage for wrapper.
- */
-static GLboolean
-alloc_wrapper_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                      GLenum internalFormat, GLuint width, GLuint height)
-{
-   /* just pass this on to the wrapped renderbuffer */
-   struct gl_renderbuffer *dsrb = rb->Wrapped;
-   GLboolean retVal;
-
-   (void) internalFormat;
-
-   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
-          dsrb->Format == MESA_FORMAT_Z24_X8 ||
-          dsrb->Format == MESA_FORMAT_S8_Z24 ||
-          dsrb->Format == MESA_FORMAT_X8_Z24);
-
-   retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height);
-   if (retVal) {
-      rb->Width = width;
-      rb->Height = height;
-   }
-   return retVal;
-}
-
-
-
-
-/*======================================================================
- * Depth wrapper around depth/stencil renderbuffer
- */
-
-static void
-get_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
-            GLint x, GLint y, void *values)
-{
-   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
-   GLuint temp[MAX_WIDTH], i;
-   GLuint *dst = (GLuint *) values;
-   const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
-   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (!src) {
-      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      src = temp;
-   }
-   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-      for (i = 0; i < count; i++) {
-         dst[i] = src[i] >> 8;
-      }
-   }
-   else {
-      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-      for (i = 0; i < count; i++) {
-         dst[i] = src[i] & 0xffffff;
-      }
-   }
-}
-
-static void
-get_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
-               const GLint x[], const GLint y[], void *values)
-{
-   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
-   GLuint temp[MAX_WIDTH], i;
-   GLuint *dst = (GLuint *) values;
-   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   ASSERT(count <= MAX_WIDTH);
-   /* don't bother trying direct access */
-   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-      for (i = 0; i < count; i++) {
-         dst[i] = temp[i] >> 8;
-      }
-   }
-   else {
-      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-      for (i = 0; i < count; i++) {
-         dst[i] = temp[i] & 0xffffff;
-      }
-   }
-}
-
-static void
-put_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
-            GLint x, GLint y, const void *values, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
-   const GLuint *src = (const GLuint *) values;
-   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
-   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (dst) {
-      /* direct access */
-      GLuint i;
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = (src[i] << 8) | (dst[i] & 0xff);
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = (src[i] & 0xffffff) | (dst[i] & 0xff000000);
-            }
-         }
-      }
-   }
-   else {
-      /* get, modify, put */
-      GLuint temp[MAX_WIDTH], i;
-      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (src[i] << 8) | (temp[i] & 0xff);
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
-            }
-         }
-      }
-      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
-   }
-}
-
-static void
-put_mono_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
-                 GLint x, GLint y, const void *value, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
-   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
-   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (dst) {
-      /* direct access */
-      GLuint i;
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         const GLuint shiftedVal = *((GLuint *) value) << 8;
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = shiftedVal | (dst[i] & 0xff);
-            }
-         }
-      }
-      else {
-         const GLuint shiftedVal = *((GLuint *) value);
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = shiftedVal | (dst[i] & 0xff000000);
-            }
-         }
-      }
-   }
-   else {
-      /* get, modify, put */
-      GLuint temp[MAX_WIDTH], i;
-      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         const GLuint shiftedVal = *((GLuint *) value) << 8;
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = shiftedVal | (temp[i] & 0xff);
-            }
-         }
-      }
-      else {
-         const GLuint shiftedVal = *((GLuint *) value);
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = shiftedVal | (temp[i] & 0xff000000);
-            }
-         }
-      }
-      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
-   }
-}
-
-static void
-put_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
-               const GLint x[], const GLint y[],
-               const void *values, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
-   const GLuint *src = (const GLuint *) values;
-   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
-      /* direct access */
-      GLuint i;
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
-               *dst = (src[i] << 8) | (*dst & 0xff);
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
-               *dst = (src[i] & 0xffffff) | (*dst & 0xff000000);
-            }
-         }
-      }
-   }
-   else {
-      /* get, modify, put */
-      GLuint temp[MAX_WIDTH], i;
-      dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (src[i] << 8) | (temp[i] & 0xff);
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
-            }
-         }
-      }
-      dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
-   }
-}
-
-static void
-put_mono_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb,
-                    GLuint count, const GLint x[], const GLint y[],
-                    const void *value, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
-   GLuint temp[MAX_WIDTH], i;
-   /* get, modify, put */
-   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-      const GLuint shiftedVal = *((GLuint *) value) << 8;
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = shiftedVal | (temp[i] & 0xff);
-         }
-      }
-   }
-   else {
-      const GLuint shiftedVal = *((GLuint *) value);
-      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = shiftedVal | (temp[i] & 0xff000000);
-         }
-      }
-   }
-   dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
-}
-
-
-/**
- * Wrap the given GL_DEPTH_STENCIL renderbuffer so that it acts like
- * a depth renderbuffer.
- * \return new depth renderbuffer
- */
-struct gl_renderbuffer *
-_mesa_new_z24_renderbuffer_wrapper(struct gl_context *ctx,
-                                   struct gl_renderbuffer *dsrb)
-{
-   struct gl_renderbuffer *z24rb;
-
-   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
-          dsrb->Format == MESA_FORMAT_Z24_X8 ||
-          dsrb->Format == MESA_FORMAT_S8_Z24 ||
-          dsrb->Format == MESA_FORMAT_X8_Z24);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-
-   z24rb = ctx->Driver.NewRenderbuffer(ctx, 0);
-   if (!z24rb)
-      return NULL;
-
-   /* NOTE: need to do manual refcounting here */
-   z24rb->Wrapped = dsrb;
-   dsrb->RefCount++;
-
-   z24rb->Name = dsrb->Name;
-   z24rb->RefCount = 0;
-   z24rb->Width = dsrb->Width;
-   z24rb->Height = dsrb->Height;
-   z24rb->InternalFormat = GL_DEPTH_COMPONENT24;
-   z24rb->Format = MESA_FORMAT_X8_Z24;
-   z24rb->_BaseFormat = GL_DEPTH_COMPONENT;
-   z24rb->DataType = GL_UNSIGNED_INT;
-   z24rb->Data = NULL;
-   z24rb->Delete = delete_wrapper;
-   z24rb->AllocStorage = alloc_wrapper_storage;
-   z24rb->GetPointer = nop_get_pointer;
-   z24rb->GetRow = get_row_z24;
-   z24rb->GetValues = get_values_z24;
-   z24rb->PutRow = put_row_z24;
-   z24rb->PutRowRGB = NULL;
-   z24rb->PutMonoRow = put_mono_row_z24;
-   z24rb->PutValues = put_values_z24;
-   z24rb->PutMonoValues = put_mono_values_z24;
-
-   return z24rb;
-}
-
-
-/*======================================================================
- * Stencil wrapper around depth/stencil renderbuffer
- */
-
-static void
-get_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
-           GLint x, GLint y, void *values)
-{
-   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
-   GLuint temp[MAX_WIDTH], i;
-   GLubyte *dst = (GLubyte *) values;
-   const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
-   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (!src) {
-      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      src = temp;
-   }
-   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-      for (i = 0; i < count; i++) {
-         dst[i] = src[i] & 0xff;
-      }
-   }
-   else {
-      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-      for (i = 0; i < count; i++) {
-         dst[i] = src[i] >> 24;
-      }
-   }
-}
-
-static void
-get_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
-              const GLint x[], const GLint y[], void *values)
-{
-   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
-   GLuint temp[MAX_WIDTH], i;
-   GLubyte *dst = (GLubyte *) values;
-   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   ASSERT(count <= MAX_WIDTH);
-   /* don't bother trying direct access */
-   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-      for (i = 0; i < count; i++) {
-         dst[i] = temp[i] & 0xff;
-      }
-   }
-   else {
-      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-      for (i = 0; i < count; i++) {
-         dst[i] = temp[i] >> 24;
-      }
-   }
-}
-
-static void
-put_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
-           GLint x, GLint y, const void *values, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
-   const GLubyte *src = (const GLubyte *) values;
-   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
-   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (dst) {
-      /* direct access */
-      GLuint i;
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = (dst[i] & 0xffffff00) | src[i];
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = (dst[i] & 0xffffff) | (src[i] << 24);
-            }
-         }
-      }
-   }
-   else {
-      /* get, modify, put */
-      GLuint temp[MAX_WIDTH], i;
-      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (temp[i] & 0xffffff00) | src[i];
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
-            }
-         }
-      }
-      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
-   }
-}
-
-static void
-put_mono_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
-                GLint x, GLint y, const void *value, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
-   const GLubyte val = *((GLubyte *) value);
-   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
-   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (dst) {
-      /* direct access */
-      GLuint i;
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = (dst[i] & 0xffffff00) | val;
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               dst[i] = (dst[i] & 0xffffff) | (val << 24);
-            }
-         }
-      }
-   }
-   else {
-      /* get, modify, put */
-      GLuint temp[MAX_WIDTH], i;
-      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (temp[i] & 0xffffff00) | val;
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (temp[i] & 0xffffff) | (val << 24);
-            }
-         }
-      }
-      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
-   }
-}
-
-static void
-put_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
-              const GLint x[], const GLint y[],
-              const void *values, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
-   const GLubyte *src = (const GLubyte *) values;
-   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
-      /* direct access */
-      GLuint i;
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
-               *dst = (*dst & 0xffffff00) | src[i];
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
-               *dst = (*dst & 0xffffff) | (src[i] << 24);
-            }
-         }
-      }
-   }
-   else {
-      /* get, modify, put */
-      GLuint temp[MAX_WIDTH], i;
-      dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (temp[i] & 0xffffff00) | src[i];
-            }
-         }
-      }
-      else {
-         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-         for (i = 0; i < count; i++) {
-            if (!mask || mask[i]) {
-               temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
-            }
-         }
-      }
-      dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
-   }
-}
-
-static void
-put_mono_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
-                   const GLint x[], const GLint y[],
-                   const void *value, const GLubyte *mask)
-{
-   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
-   GLuint temp[MAX_WIDTH], i;
-   const GLubyte val = *((GLubyte *) value);
-   /* get, modify, put */
-   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = (temp[i] & 0xffffff00) | val;
-         }
-      }
-   }
-   else {
-      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = (temp[i] & 0xffffff) | (val << 24);
-         }
-      }
-   }
-   dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
-}
-
-
-/**
- * Wrap the given GL_DEPTH_STENCIL renderbuffer so that it acts like
- * a stencil renderbuffer.
- * \return new stencil renderbuffer
- */
-struct gl_renderbuffer *
-_mesa_new_s8_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb)
-{
-   struct gl_renderbuffer *s8rb;
-
-   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
-          dsrb->Format == MESA_FORMAT_S8_Z24);
-   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-
-   s8rb = ctx->Driver.NewRenderbuffer(ctx, 0);
-   if (!s8rb)
-      return NULL;
-
-   /* NOTE: need to do manual refcounting here */
-   s8rb->Wrapped = dsrb;
-   dsrb->RefCount++;
-
-   s8rb->Name = dsrb->Name;
-   s8rb->RefCount = 0;
-   s8rb->Width = dsrb->Width;
-   s8rb->Height = dsrb->Height;
-   s8rb->InternalFormat = GL_STENCIL_INDEX8_EXT;
-   s8rb->Format = MESA_FORMAT_S8;
-   s8rb->_BaseFormat = GL_STENCIL_INDEX;
-   s8rb->DataType = GL_UNSIGNED_BYTE;
-   s8rb->Data = NULL;
-   s8rb->Delete = delete_wrapper;
-   s8rb->AllocStorage = alloc_wrapper_storage;
-   s8rb->GetPointer = nop_get_pointer;
-   s8rb->GetRow = get_row_s8;
-   s8rb->GetValues = get_values_s8;
-   s8rb->PutRow = put_row_s8;
-   s8rb->PutRowRGB = NULL;
-   s8rb->PutMonoRow = put_mono_row_s8;
-   s8rb->PutValues = put_values_s8;
-   s8rb->PutMonoValues = put_mono_values_s8;
-
-   return s8rb;
-}
-
-
-
-/**
- ** The following functions are useful for hardware drivers that only
- ** implement combined depth/stencil buffers.
- ** The GL_EXT_framebuffer_object extension allows indepedent depth and
- ** stencil buffers to be used in any combination.
- ** Therefore, we sometimes have to merge separate depth and stencil
- ** renderbuffers into a single depth+stencil renderbuffer.  And sometimes
- ** we have to split combined depth+stencil renderbuffers into separate
- ** renderbuffers.
- **/
-
-
-/**
- * Extract stencil values from the combined depth/stencil renderbuffer, storing
- * the values into a separate stencil renderbuffer.
- * \param dsRb  the source depth/stencil renderbuffer
- * \param stencilRb  the destination stencil renderbuffer
- *                   (either 8-bit or 32-bit)
- */
-void
-_mesa_extract_stencil(struct gl_context *ctx,
-                      struct gl_renderbuffer *dsRb,
-                      struct gl_renderbuffer *stencilRb)
-{
-   GLuint row, width, height;
-
-   ASSERT(dsRb);
-   ASSERT(stencilRb);
-
-   ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8);
-   ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 ||
-          stencilRb->Format == MESA_FORMAT_S8);
-   ASSERT(dsRb->Width == stencilRb->Width);
-   ASSERT(dsRb->Height == stencilRb->Height);
-
-   width = dsRb->Width;
-   height = dsRb->Height;
-
-   for (row = 0; row < height; row++) {
-      GLuint depthStencil[MAX_WIDTH];
-      dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil);
-      if (stencilRb->Format == MESA_FORMAT_S8) {
-         /* 8bpp stencil */
-         GLubyte stencil[MAX_WIDTH];
-         GLuint i;
-         for (i = 0; i < width; i++) {
-            stencil[i] = depthStencil[i] & 0xff;
-         }
-         stencilRb->PutRow(ctx, stencilRb, width, 0, row, stencil, NULL);
-      }
-      else {
-         /* 32bpp stencil */
-         /* the 24 depth bits will be ignored */
-         ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8);
-         ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-         stencilRb->PutRow(ctx, stencilRb, width, 0, row, depthStencil, NULL);
-      }
-   }
-}
-
-
-/**
- * Copy stencil values from a stencil renderbuffer into a combined
- * depth/stencil renderbuffer.
- * \param dsRb  the destination depth/stencil renderbuffer
- * \param stencilRb  the source stencil buffer (either 8-bit or 32-bit)
- */
-void
-_mesa_insert_stencil(struct gl_context *ctx,
-                     struct gl_renderbuffer *dsRb,
-                     struct gl_renderbuffer *stencilRb)
-{
-   GLuint row, width, height;
-
-   ASSERT(dsRb);
-   ASSERT(stencilRb);
-
-   ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8);
-   ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 ||
-          stencilRb->Format == MESA_FORMAT_S8);
-
-   ASSERT(dsRb->Width == stencilRb->Width);
-   ASSERT(dsRb->Height == stencilRb->Height);
-
-   width = dsRb->Width;
-   height = dsRb->Height;
-
-   for (row = 0; row < height; row++) {
-      GLuint depthStencil[MAX_WIDTH];
-
-      dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil);
-
-      if (stencilRb->Format == MESA_FORMAT_S8) {
-         /* 8bpp stencil */
-         GLubyte stencil[MAX_WIDTH];
-         GLuint i;
-         stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil);
-         for (i = 0; i < width; i++) {
-            depthStencil[i] = (depthStencil[i] & 0xffffff00) | stencil[i];
-         }
-      }
-      else {
-         /* 32bpp stencil buffer */
-         GLuint stencil[MAX_WIDTH], i;
-         ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8);
-         ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-         stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil);
-         for (i = 0; i < width; i++) {
-            depthStencil[i]
-               = (depthStencil[i] & 0xffffff00) | (stencil[i] & 0xff);
-         }
-      }
-
-      dsRb->PutRow(ctx, dsRb, width, 0, row, depthStencil, NULL);
-   }
-}
-
-
-/**
- * Convert the stencil buffer from 8bpp to 32bpp depth/stencil.
- * \param stencilRb  the stencil renderbuffer to promote
- */
-void
-_mesa_promote_stencil(struct gl_context *ctx, struct gl_renderbuffer *stencilRb)
-{
-   const GLsizei width = stencilRb->Width;
-   const GLsizei height = stencilRb->Height;
-   GLubyte *data;
-   GLint i, j, k;
-
-   ASSERT(stencilRb->Format == MESA_FORMAT_S8);
-   ASSERT(stencilRb->Data);
-
-   data = (GLubyte *) stencilRb->Data;
-   stencilRb->Data = NULL;
-   stencilRb->AllocStorage(ctx, stencilRb, GL_DEPTH24_STENCIL8_EXT,
-                           width, height);
-
-   ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-
-   k = 0;
-   for (i = 0; i < height; i++) {
-      GLuint depthStencil[MAX_WIDTH];
-      for (j = 0; j < width; j++) {
-         depthStencil[j] = data[k++];
-      }
-      stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL);
-   }
-   free(data);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5
+ *
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "context.h"
+#include "formats.h"
+#include "mtypes.h"
+#include "depthstencil.h"
+#include "renderbuffer.h"
+
+
+/**
+ * Adaptor/wrappers for GL_DEPTH_STENCIL renderbuffers.
+ *
+ * The problem with a GL_DEPTH_STENCIL renderbuffer is that sometimes we
+ * want to treat it as a stencil buffer, other times we want to treat it
+ * as a depth/z buffer and still other times when we want to treat it as
+ * a combined Z+stencil buffer!  That implies we need three different sets
+ * of Get/Put functions.
+ *
+ * We solve this by wrapping the Z24_S8 or S8_Z24 renderbuffer with depth and
+ * stencil adaptors, each with the right kind of depth/stencil Get/Put functions.
+ */
+
+
+static void *
+nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
+{
+   (void) ctx;
+   (void) rb;
+   (void) x;
+   (void) y;
+   return NULL;
+}
+
+
+/**
+ * Delete a depth or stencil wrapper renderbuffer.
+ */
+static void
+delete_wrapper(struct gl_renderbuffer *rb)
+{
+   ASSERT(rb->Format == MESA_FORMAT_S8 ||
+          rb->Format == MESA_FORMAT_X8_Z24);
+   _mesa_reference_renderbuffer(&rb->Wrapped, NULL);
+   free(rb);
+}
+
+
+/**
+ * Realloc storage for wrapper.
+ */
+static GLboolean
+alloc_wrapper_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
+                      GLenum internalFormat, GLuint width, GLuint height)
+{
+   /* just pass this on to the wrapped renderbuffer */
+   struct gl_renderbuffer *dsrb = rb->Wrapped;
+   GLboolean retVal;
+
+   (void) internalFormat;
+
+   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
+          dsrb->Format == MESA_FORMAT_Z24_X8 ||
+          dsrb->Format == MESA_FORMAT_S8_Z24 ||
+          dsrb->Format == MESA_FORMAT_X8_Z24);
+
+   retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height);
+   if (retVal) {
+      rb->Width = width;
+      rb->Height = height;
+      rb->RowStride = dsrb->RowStride;
+   }
+   return retVal;
+}
+
+
+
+
+/*======================================================================
+ * Depth wrapper around depth/stencil renderbuffer
+ */
+
+static void
+get_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+            GLint x, GLint y, void *values)
+{
+   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
+   GLuint temp[MAX_WIDTH], i;
+   GLuint *dst = (GLuint *) values;
+   const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
+   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (!src) {
+      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
+      src = temp;
+   }
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] >> 8;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] & 0xffffff;
+      }
+   }
+}
+
+static void
+get_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+               const GLint x[], const GLint y[], void *values)
+{
+   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
+   GLuint temp[MAX_WIDTH], i;
+   GLuint *dst = (GLuint *) values;
+   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   ASSERT(count <= MAX_WIDTH);
+   /* don't bother trying direct access */
+   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] >> 8;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] & 0xffffff;
+      }
+   }
+}
+
+static void
+put_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+            GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
+   const GLuint *src = (const GLuint *) values;
+   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
+   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (dst) {
+      /* direct access */
+      GLuint i;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (src[i] << 8) | (dst[i] & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (src[i] & 0xffffff) | (dst[i] & 0xff000000);
+            }
+         }
+      }
+   }
+   else {
+      /* get, modify, put */
+      GLuint temp[MAX_WIDTH], i;
+      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] << 8) | (temp[i] & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
+            }
+         }
+      }
+      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
+   }
+}
+
+static void
+put_mono_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+                 GLint x, GLint y, const void *value, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
+   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
+   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (dst) {
+      /* direct access */
+      GLuint i;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         const GLuint shiftedVal = *((GLuint *) value) << 8;
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = shiftedVal | (dst[i] & 0xff);
+            }
+         }
+      }
+      else {
+         const GLuint shiftedVal = *((GLuint *) value);
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = shiftedVal | (dst[i] & 0xff000000);
+            }
+         }
+      }
+   }
+   else {
+      /* get, modify, put */
+      GLuint temp[MAX_WIDTH], i;
+      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         const GLuint shiftedVal = *((GLuint *) value) << 8;
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = shiftedVal | (temp[i] & 0xff);
+            }
+         }
+      }
+      else {
+         const GLuint shiftedVal = *((GLuint *) value);
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = shiftedVal | (temp[i] & 0xff000000);
+            }
+         }
+      }
+      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
+   }
+}
+
+static void
+put_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+               const GLint x[], const GLint y[],
+               const void *values, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
+   const GLuint *src = (const GLuint *) values;
+   ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
+      /* direct access */
+      GLuint i;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (src[i] << 8) | (*dst & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (src[i] & 0xffffff) | (*dst & 0xff000000);
+            }
+         }
+      }
+   }
+   else {
+      /* get, modify, put */
+      GLuint temp[MAX_WIDTH], i;
+      dsrb->GetValues(ctx, dsrb, count, x, y, temp);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] << 8) | (temp[i] & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
+            }
+         }
+      }
+      dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
+   }
+}
+
+static void
+put_mono_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb,
+                    GLuint count, const GLint x[], const GLint y[],
+                    const void *value, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = z24rb->Wrapped;
+   GLuint temp[MAX_WIDTH], i;
+   /* get, modify, put */
+   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      const GLuint shiftedVal = *((GLuint *) value) << 8;
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = shiftedVal | (temp[i] & 0xff);
+         }
+      }
+   }
+   else {
+      const GLuint shiftedVal = *((GLuint *) value);
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = shiftedVal | (temp[i] & 0xff000000);
+         }
+      }
+   }
+   dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
+}
+
+
+/**
+ * Wrap the given GL_DEPTH_STENCIL renderbuffer so that it acts like
+ * a depth renderbuffer.
+ * \return new depth renderbuffer
+ */
+struct gl_renderbuffer *
+_mesa_new_z24_renderbuffer_wrapper(struct gl_context *ctx,
+                                   struct gl_renderbuffer *dsrb)
+{
+   struct gl_renderbuffer *z24rb;
+
+   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
+          dsrb->Format == MESA_FORMAT_Z24_X8 ||
+          dsrb->Format == MESA_FORMAT_S8_Z24 ||
+          dsrb->Format == MESA_FORMAT_X8_Z24);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+
+   z24rb = ctx->Driver.NewRenderbuffer(ctx, 0);
+   if (!z24rb)
+      return NULL;
+
+   /* NOTE: need to do manual refcounting here */
+   z24rb->Wrapped = dsrb;
+   dsrb->RefCount++;
+
+   z24rb->Name = dsrb->Name;
+   z24rb->RefCount = 0;
+   z24rb->Width = dsrb->Width;
+   z24rb->Height = dsrb->Height;
+   z24rb->RowStride = dsrb->RowStride;
+   z24rb->InternalFormat = GL_DEPTH_COMPONENT24;
+   z24rb->Format = MESA_FORMAT_X8_Z24;
+   z24rb->_BaseFormat = GL_DEPTH_COMPONENT;
+   z24rb->DataType = GL_UNSIGNED_INT;
+   z24rb->Data = NULL;
+   z24rb->Delete = delete_wrapper;
+   z24rb->AllocStorage = alloc_wrapper_storage;
+   z24rb->GetPointer = nop_get_pointer;
+   z24rb->GetRow = get_row_z24;
+   z24rb->GetValues = get_values_z24;
+   z24rb->PutRow = put_row_z24;
+   z24rb->PutRowRGB = NULL;
+   z24rb->PutMonoRow = put_mono_row_z24;
+   z24rb->PutValues = put_values_z24;
+   z24rb->PutMonoValues = put_mono_values_z24;
+
+   return z24rb;
+}
+
+
+/*======================================================================
+ * Stencil wrapper around depth/stencil renderbuffer
+ */
+
+static void
+get_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+           GLint x, GLint y, void *values)
+{
+   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
+   GLuint temp[MAX_WIDTH], i;
+   GLubyte *dst = (GLubyte *) values;
+   const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
+   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (!src) {
+      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
+      src = temp;
+   }
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] & 0xff;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] >> 24;
+      }
+   }
+}
+
+static void
+get_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+              const GLint x[], const GLint y[], void *values)
+{
+   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
+   GLuint temp[MAX_WIDTH], i;
+   GLubyte *dst = (GLubyte *) values;
+   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   ASSERT(count <= MAX_WIDTH);
+   /* don't bother trying direct access */
+   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] & 0xff;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] >> 24;
+      }
+   }
+}
+
+static void
+put_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+           GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
+   const GLubyte *src = (const GLubyte *) values;
+   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
+   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (dst) {
+      /* direct access */
+      GLuint i;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff) | (src[i] << 24);
+            }
+         }
+      }
+   }
+   else {
+      /* get, modify, put */
+      GLuint temp[MAX_WIDTH], i;
+      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
+            }
+         }
+      }
+      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
+   }
+}
+
+static void
+put_mono_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+                GLint x, GLint y, const void *value, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
+   const GLubyte val = *((GLubyte *) value);
+   GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
+   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (dst) {
+      /* direct access */
+      GLuint i;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff00) | val;
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff) | (val << 24);
+            }
+         }
+      }
+   }
+   else {
+      /* get, modify, put */
+      GLuint temp[MAX_WIDTH], i;
+      dsrb->GetRow(ctx, dsrb, count, x, y, temp);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff00) | val;
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff) | (val << 24);
+            }
+         }
+      }
+      dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
+   }
+}
+
+static void
+put_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+              const GLint x[], const GLint y[],
+              const void *values, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
+   const GLubyte *src = (const GLubyte *) values;
+   ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
+      /* direct access */
+      GLuint i;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (*dst & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (*dst & 0xffffff) | (src[i] << 24);
+            }
+         }
+      }
+   }
+   else {
+      /* get, modify, put */
+      GLuint temp[MAX_WIDTH], i;
+      dsrb->GetValues(ctx, dsrb, count, x, y, temp);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
+            }
+         }
+      }
+      dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
+   }
+}
+
+static void
+put_mono_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+                   const GLint x[], const GLint y[],
+                   const void *value, const GLubyte *mask)
+{
+   struct gl_renderbuffer *dsrb = s8rb->Wrapped;
+   GLuint temp[MAX_WIDTH], i;
+   const GLubyte val = *((GLubyte *) value);
+   /* get, modify, put */
+   dsrb->GetValues(ctx, dsrb, count, x, y, temp);
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = (temp[i] & 0xffffff00) | val;
+         }
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = (temp[i] & 0xffffff) | (val << 24);
+         }
+      }
+   }
+   dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
+}
+
+
+/**
+ * Wrap the given GL_DEPTH_STENCIL renderbuffer so that it acts like
+ * a stencil renderbuffer.
+ * \return new stencil renderbuffer
+ */
+struct gl_renderbuffer *
+_mesa_new_s8_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb)
+{
+   struct gl_renderbuffer *s8rb;
+
+   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
+          dsrb->Format == MESA_FORMAT_S8_Z24);
+   ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+
+   s8rb = ctx->Driver.NewRenderbuffer(ctx, 0);
+   if (!s8rb)
+      return NULL;
+
+   /* NOTE: need to do manual refcounting here */
+   s8rb->Wrapped = dsrb;
+   dsrb->RefCount++;
+
+   s8rb->Name = dsrb->Name;
+   s8rb->RefCount = 0;
+   s8rb->Width = dsrb->Width;
+   s8rb->Height = dsrb->Height;
+   s8rb->RowStride = dsrb->RowStride;
+   s8rb->InternalFormat = GL_STENCIL_INDEX8_EXT;
+   s8rb->Format = MESA_FORMAT_S8;
+   s8rb->_BaseFormat = GL_STENCIL_INDEX;
+   s8rb->DataType = GL_UNSIGNED_BYTE;
+   s8rb->Data = NULL;
+   s8rb->Delete = delete_wrapper;
+   s8rb->AllocStorage = alloc_wrapper_storage;
+   s8rb->GetPointer = nop_get_pointer;
+   s8rb->GetRow = get_row_s8;
+   s8rb->GetValues = get_values_s8;
+   s8rb->PutRow = put_row_s8;
+   s8rb->PutRowRGB = NULL;
+   s8rb->PutMonoRow = put_mono_row_s8;
+   s8rb->PutValues = put_values_s8;
+   s8rb->PutMonoValues = put_mono_values_s8;
+
+   return s8rb;
+}
+
+
+
+/**
+ ** The following functions are useful for hardware drivers that only
+ ** implement combined depth/stencil buffers.
+ ** The GL_EXT_framebuffer_object extension allows indepedent depth and
+ ** stencil buffers to be used in any combination.
+ ** Therefore, we sometimes have to merge separate depth and stencil
+ ** renderbuffers into a single depth+stencil renderbuffer.  And sometimes
+ ** we have to split combined depth+stencil renderbuffers into separate
+ ** renderbuffers.
+ **/
+
+
+/**
+ * Extract stencil values from the combined depth/stencil renderbuffer, storing
+ * the values into a separate stencil renderbuffer.
+ * \param dsRb  the source depth/stencil renderbuffer
+ * \param stencilRb  the destination stencil renderbuffer
+ *                   (either 8-bit or 32-bit)
+ */
+void
+_mesa_extract_stencil(struct gl_context *ctx,
+                      struct gl_renderbuffer *dsRb,
+                      struct gl_renderbuffer *stencilRb)
+{
+   GLuint row, width, height;
+
+   ASSERT(dsRb);
+   ASSERT(stencilRb);
+
+   ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8);
+   ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 ||
+          stencilRb->Format == MESA_FORMAT_S8);
+   ASSERT(dsRb->Width == stencilRb->Width);
+   ASSERT(dsRb->Height == stencilRb->Height);
+
+   width = dsRb->Width;
+   height = dsRb->Height;
+
+   for (row = 0; row < height; row++) {
+      GLuint depthStencil[MAX_WIDTH];
+      dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil);
+      if (stencilRb->Format == MESA_FORMAT_S8) {
+         /* 8bpp stencil */
+         GLubyte stencil[MAX_WIDTH];
+         GLuint i;
+         for (i = 0; i < width; i++) {
+            stencil[i] = depthStencil[i] & 0xff;
+         }
+         stencilRb->PutRow(ctx, stencilRb, width, 0, row, stencil, NULL);
+      }
+      else {
+         /* 32bpp stencil */
+         /* the 24 depth bits will be ignored */
+         ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8);
+         ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+         stencilRb->PutRow(ctx, stencilRb, width, 0, row, depthStencil, NULL);
+      }
+   }
+}
+
+
+/**
+ * Copy stencil values from a stencil renderbuffer into a combined
+ * depth/stencil renderbuffer.
+ * \param dsRb  the destination depth/stencil renderbuffer
+ * \param stencilRb  the source stencil buffer (either 8-bit or 32-bit)
+ */
+void
+_mesa_insert_stencil(struct gl_context *ctx,
+                     struct gl_renderbuffer *dsRb,
+                     struct gl_renderbuffer *stencilRb)
+{
+   GLuint row, width, height;
+
+   ASSERT(dsRb);
+   ASSERT(stencilRb);
+
+   ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8);
+   ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+   ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 ||
+          stencilRb->Format == MESA_FORMAT_S8);
+
+   ASSERT(dsRb->Width == stencilRb->Width);
+   ASSERT(dsRb->Height == stencilRb->Height);
+
+   width = dsRb->Width;
+   height = dsRb->Height;
+
+   for (row = 0; row < height; row++) {
+      GLuint depthStencil[MAX_WIDTH];
+
+      dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil);
+
+      if (stencilRb->Format == MESA_FORMAT_S8) {
+         /* 8bpp stencil */
+         GLubyte stencil[MAX_WIDTH];
+         GLuint i;
+         stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil);
+         for (i = 0; i < width; i++) {
+            depthStencil[i] = (depthStencil[i] & 0xffffff00) | stencil[i];
+         }
+      }
+      else {
+         /* 32bpp stencil buffer */
+         GLuint stencil[MAX_WIDTH], i;
+         ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8);
+         ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+         stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil);
+         for (i = 0; i < width; i++) {
+            depthStencil[i]
+               = (depthStencil[i] & 0xffffff00) | (stencil[i] & 0xff);
+         }
+      }
+
+      dsRb->PutRow(ctx, dsRb, width, 0, row, depthStencil, NULL);
+   }
+}
+
+
+/**
+ * Convert the stencil buffer from 8bpp to 32bpp depth/stencil.
+ * \param stencilRb  the stencil renderbuffer to promote
+ */
+void
+_mesa_promote_stencil(struct gl_context *ctx, struct gl_renderbuffer *stencilRb)
+{
+   const GLsizei width = stencilRb->Width;
+   const GLsizei height = stencilRb->Height;
+   GLubyte *data;
+   GLint i, j, k;
+
+   ASSERT(stencilRb->Format == MESA_FORMAT_S8);
+   ASSERT(stencilRb->Data);
+
+   data = (GLubyte *) stencilRb->Data;
+   stencilRb->Data = NULL;
+   stencilRb->AllocStorage(ctx, stencilRb, GL_DEPTH24_STENCIL8_EXT,
+                           width, height);
+
+   ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
+
+   k = 0;
+   for (i = 0; i < height; i++) {
+      GLuint depthStencil[MAX_WIDTH];
+      for (j = 0; j < width; j++) {
+         depthStencil[j] = data[k++];
+      }
+      stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL);
+   }
+   free(data);
+}
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index f66082e7f..63653df45 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -859,8 +859,8 @@ unpack_image(struct gl_context *ctx, GLuint dimensions,
       }
       return image;
    }
-   else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
-                                      format, type, pixels)) {
+   else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
+                                      depth, format, type, INT_MAX, pixels)) {
       const GLubyte *map, *src;
       GLvoid *image;
 
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index fb86036a1..89c2b2697 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -90,10 +90,10 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
          GLint x = IROUND(ctx->Current.RasterPos[0]);
          GLint y = IROUND(ctx->Current.RasterPos[1]);
 
-         if (ctx->Unpack.BufferObj->Name) {
+         if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
             /* unpack from PBO */
-            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
-                                           format, type, pixels)) {
+            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height,
+                                           1, format, type, INT_MAX, pixels)) {
                _mesa_error(ctx, GL_INVALID_OPERATION,
                            "glDrawPixels(invalid PBO access)");
                goto end;
@@ -188,7 +188,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
       goto end;
    }
 
-   if (!ctx->Current.RasterPosValid || width ==0 || height == 0) {
+   if (!ctx->Current.RasterPosValid || width == 0 || height == 0) {
       goto end; /* no-op, not an error */
    }
 
@@ -249,11 +249,11 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
          GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig);
          GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig);
 
-         if (ctx->Unpack.BufferObj->Name) {
+         if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
             /* unpack from PBO */
-            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
-                                           GL_COLOR_INDEX, GL_BITMAP,
-                                           (GLvoid *) bitmap)) {
+            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height,
+                                           1, GL_COLOR_INDEX, GL_BITMAP,
+                                           INT_MAX, (const GLvoid *) bitmap)) {
                _mesa_error(ctx, GL_INVALID_OPERATION,
                            "glBitmap(invalid PBO access)");
                return;
diff --git a/mesalib/src/mesa/main/enums.c b/mesalib/src/mesa/main/enums.c
index 98cbbf53b..8a50e2656 100644
--- a/mesalib/src/mesa/main/enums.c
+++ b/mesalib/src/mesa/main/enums.c
@@ -366,6 +366,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_CONTEXT_CORE_PROFILE_BIT\0"
    "GL_CONTEXT_FLAGS\0"
    "GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT\0"
+   "GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB\0"
    "GL_CONTEXT_PROFILE_MASK\0"
    "GL_CONVOLUTION_1D\0"
    "GL_CONVOLUTION_2D\0"
@@ -739,6 +740,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_GREEN_INTEGER\0"
    "GL_GREEN_INTEGER_EXT\0"
    "GL_GREEN_SCALE\0"
+   "GL_GUILTY_CONTEXT_RESET_ARB\0"
    "GL_HALF_FLOAT\0"
    "GL_HALF_FLOAT_OES\0"
    "GL_HIGH_FLOAT\0"
@@ -786,6 +788,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_INDEX_SHIFT\0"
    "GL_INDEX_WRITEMASK\0"
    "GL_INFO_LOG_LENGTH\0"
+   "GL_INNOCENT_CONTEXT_RESET_ARB\0"
    "GL_INT\0"
    "GL_INTENSITY\0"
    "GL_INTENSITY12\0"
@@ -894,6 +897,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_LOAD\0"
    "GL_LOGIC_OP\0"
    "GL_LOGIC_OP_MODE\0"
+   "GL_LOSE_CONTEXT_ON_RESET_ARB\0"
    "GL_LOWER_LEFT\0"
    "GL_LOW_FLOAT\0"
    "GL_LOW_INT\0"
@@ -1277,6 +1281,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_NORMAL_MAP_OES\0"
    "GL_NOTEQUAL\0"
    "GL_NO_ERROR\0"
+   "GL_NO_RESET_NOTIFICATION_ARB\0"
    "GL_NUM_COMPRESSED_TEXTURE_FORMATS\0"
    "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB\0"
    "GL_NUM_EXTENSIONS\0"
@@ -1637,6 +1642,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_REPLICATE_BORDER_HP\0"
    "GL_RESCALE_NORMAL\0"
    "GL_RESCALE_NORMAL_EXT\0"
+   "GL_RESET_NOTIFICATION_STRATEGY_ARB\0"
    "GL_RETAINED_APPLE\0"
    "GL_RETURN\0"
    "GL_RG16_SNORM\0"
@@ -2193,6 +2199,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_TRIANGLE_STRIP_ADJACENCY_ARB\0"
    "GL_TRUE\0"
    "GL_UNDEFINED_APPLE\0"
+   "GL_UNKNOWN_CONTEXT_RESET_ARB\0"
    "GL_UNPACK_ALIGNMENT\0"
    "GL_UNPACK_IMAGE_HEIGHT\0"
    "GL_UNPACK_LSB_FIRST\0"
@@ -2345,7 +2352,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_ZOOM_Y\0"
    ;
 
-static const enum_elt all_enums[2306] =
+static const enum_elt all_enums[2313] =
 {
    {     0, 0x00000600 }, /* GL_2D */
    {     6, 0x00001407 }, /* GL_2_BYTES */
@@ -2676,2408 +2683,2415 @@ static const enum_elt all_enums[2306] =
    {  6607, 0x00000001 }, /* GL_CONTEXT_CORE_PROFILE_BIT */
    {  6635, 0x0000821E }, /* GL_CONTEXT_FLAGS */
    {  6652, 0x00000001 }, /* GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */
-   {  6691, 0x00009126 }, /* GL_CONTEXT_PROFILE_MASK */
-   {  6715, 0x00008010 }, /* GL_CONVOLUTION_1D */
-   {  6733, 0x00008011 }, /* GL_CONVOLUTION_2D */
-   {  6751, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */
-   {  6779, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */
-   {  6810, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */
-   {  6837, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */
-   {  6868, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */
-   {  6895, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */
-   {  6926, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */
-   {  6954, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */
-   {  6986, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */
-   {  7008, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */
-   {  7034, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */
-   {  7056, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */
-   {  7082, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */
-   {  7103, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */
-   {  7128, 0x00008862 }, /* GL_COORD_REPLACE */
-   {  7145, 0x00008862 }, /* GL_COORD_REPLACE_ARB */
-   {  7166, 0x00008862 }, /* GL_COORD_REPLACE_NV */
-   {  7186, 0x00008862 }, /* GL_COORD_REPLACE_OES */
-   {  7207, 0x00001503 }, /* GL_COPY */
-   {  7215, 0x0000150C }, /* GL_COPY_INVERTED */
-   {  7232, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */
-   {  7252, 0x00008F36 }, /* GL_COPY_READ_BUFFER */
-   {  7272, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */
-   {  7293, 0x00000B44 }, /* GL_CULL_FACE */
-   {  7306, 0x00000B45 }, /* GL_CULL_FACE_MODE */
-   {  7324, 0x000081AA }, /* GL_CULL_VERTEX_EXT */
-   {  7343, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
-   {  7375, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
-   {  7410, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */
-   {  7431, 0x00000001 }, /* GL_CURRENT_BIT */
-   {  7446, 0x00000B00 }, /* GL_CURRENT_COLOR */
-   {  7463, 0x00008453 }, /* GL_CURRENT_FOG_COORD */
-   {  7484, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */
-   {  7510, 0x00000B01 }, /* GL_CURRENT_INDEX */
-   {  7527, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */
-   {  7549, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */
-   {  7577, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */
-   {  7598, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
-   {  7632, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */
-   {  7665, 0x00000B02 }, /* GL_CURRENT_NORMAL */
-   {  7683, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */
-   {  7713, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_OES */
-   {  7743, 0x00008B8D }, /* GL_CURRENT_PROGRAM */
-   {  7762, 0x00008865 }, /* GL_CURRENT_QUERY */
-   {  7779, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */
-   {  7800, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */
-   {  7824, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */
-   {  7851, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */
-   {  7875, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */
-   {  7902, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */
-   {  7935, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
-   {  7969, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
-   {  8002, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */
-   {  8029, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */
-   {  8055, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */
-   {  8080, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */
-   {  8109, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */
-   {  8131, 0x00000900 }, /* GL_CW */
-   {  8137, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */
-   {  8158, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */
-   {  8179, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */
-   {  8199, 0x00002101 }, /* GL_DECAL */
-   {  8208, 0x00001E03 }, /* GL_DECR */
-   {  8216, 0x00008508 }, /* GL_DECR_WRAP */
-   {  8229, 0x00008508 }, /* GL_DECR_WRAP_EXT */
-   {  8246, 0x00008B80 }, /* GL_DELETE_STATUS */
-   {  8263, 0x00001801 }, /* GL_DEPTH */
-   {  8272, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
-   {  8292, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */
-   {  8316, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_OES */
-   {  8340, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
-   {  8360, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
-   {  8384, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_OES */
-   {  8408, 0x00000D1F }, /* GL_DEPTH_BIAS */
-   {  8422, 0x00000D56 }, /* GL_DEPTH_BITS */
-   {  8436, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
-   {  8456, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
-   {  8481, 0x00008223 }, /* GL_DEPTH_BUFFER */
-   {  8497, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
-   {  8517, 0x0000864F }, /* GL_DEPTH_CLAMP */
-   {  8532, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
-   {  8550, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
-   {  8571, 0x00001902 }, /* GL_DEPTH_COMPONENT */
-   {  8590, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
-   {  8611, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
-   {  8636, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_OES */
-   {  8661, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
-   {  8687, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
-   {  8708, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
-   {  8733, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_OES */
-   {  8758, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
-   {  8784, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
-   {  8805, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
-   {  8830, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_OES */
-   {  8855, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
-   {  8881, 0x00000B74 }, /* GL_DEPTH_FUNC */
-   {  8895, 0x00000B70 }, /* GL_DEPTH_RANGE */
-   {  8910, 0x00000D1E }, /* GL_DEPTH_SCALE */
-   {  8925, 0x000084F9 }, /* GL_DEPTH_STENCIL */
-   {  8942, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
-   {  8970, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */
-   {  8991, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
-   {  9011, 0x000084F9 }, /* GL_DEPTH_STENCIL_OES */
-   {  9032, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-   {  9060, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-   {  9088, 0x00000B71 }, /* GL_DEPTH_TEST */
-   {  9102, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
-   {  9124, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
-   {  9150, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
-   {  9169, 0x00001201 }, /* GL_DIFFUSE */
-   {  9180, 0x00000BD0 }, /* GL_DITHER */
-   {  9190, 0x00000A02 }, /* GL_DOMAIN */
-   {  9200, 0x00001100 }, /* GL_DONT_CARE */
-   {  9213, 0x000086AE }, /* GL_DOT3_RGB */
-   {  9225, 0x000086AF }, /* GL_DOT3_RGBA */
-   {  9238, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
-   {  9255, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
-   {  9272, 0x000086AE }, /* GL_DOT3_RGB_ARB */
-   {  9288, 0x00008740 }, /* GL_DOT3_RGB_EXT */
-   {  9304, 0x0000140A }, /* GL_DOUBLE */
-   {  9314, 0x00000C32 }, /* GL_DOUBLEBUFFER */
-   {  9330, 0x00000C01 }, /* GL_DRAW_BUFFER */
-   {  9345, 0x00008825 }, /* GL_DRAW_BUFFER0 */
-   {  9361, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
-   {  9381, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
-   {  9401, 0x00008826 }, /* GL_DRAW_BUFFER1 */
-   {  9417, 0x0000882F }, /* GL_DRAW_BUFFER10 */
-   {  9434, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
-   {  9455, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
-   {  9476, 0x00008830 }, /* GL_DRAW_BUFFER11 */
-   {  9493, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
-   {  9514, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
-   {  9535, 0x00008831 }, /* GL_DRAW_BUFFER12 */
-   {  9552, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
-   {  9573, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
-   {  9594, 0x00008832 }, /* GL_DRAW_BUFFER13 */
-   {  9611, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
-   {  9632, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
-   {  9653, 0x00008833 }, /* GL_DRAW_BUFFER14 */
-   {  9670, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
-   {  9691, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
-   {  9712, 0x00008834 }, /* GL_DRAW_BUFFER15 */
-   {  9729, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
-   {  9750, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
-   {  9771, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
-   {  9791, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
-   {  9811, 0x00008827 }, /* GL_DRAW_BUFFER2 */
-   {  9827, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
-   {  9847, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
-   {  9867, 0x00008828 }, /* GL_DRAW_BUFFER3 */
-   {  9883, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
-   {  9903, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
-   {  9923, 0x00008829 }, /* GL_DRAW_BUFFER4 */
-   {  9939, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
-   {  9959, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
-   {  9979, 0x0000882A }, /* GL_DRAW_BUFFER5 */
-   {  9995, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
-   { 10015, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
-   { 10035, 0x0000882B }, /* GL_DRAW_BUFFER6 */
-   { 10051, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
-   { 10071, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
-   { 10091, 0x0000882C }, /* GL_DRAW_BUFFER7 */
-   { 10107, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
-   { 10127, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
-   { 10147, 0x0000882D }, /* GL_DRAW_BUFFER8 */
-   { 10163, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
-   { 10183, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
-   { 10203, 0x0000882E }, /* GL_DRAW_BUFFER9 */
-   { 10219, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
-   { 10239, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
-   { 10259, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
-   { 10279, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */
-   { 10307, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
-   { 10339, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
-   { 10363, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
-   { 10383, 0x00000304 }, /* GL_DST_ALPHA */
-   { 10396, 0x00000306 }, /* GL_DST_COLOR */
-   { 10409, 0x0000877A }, /* GL_DU8DV8_ATI */
-   { 10423, 0x00008779 }, /* GL_DUDV_ATI */
-   { 10435, 0x000088EA }, /* GL_DYNAMIC_COPY */
-   { 10451, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
-   { 10471, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
-   { 10487, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
-   { 10507, 0x000088E9 }, /* GL_DYNAMIC_READ */
-   { 10523, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
-   { 10543, 0x00000B43 }, /* GL_EDGE_FLAG */
-   { 10556, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
-   { 10575, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-   { 10609, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
-   { 10647, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
-   { 10674, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-   { 10700, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
-   { 10724, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-   { 10756, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
-   { 10792, 0x00001600 }, /* GL_EMISSION */
-   { 10804, 0x00002000 }, /* GL_ENABLE_BIT */
-   { 10818, 0x00000202 }, /* GL_EQUAL */
-   { 10827, 0x00001509 }, /* GL_EQUIV */
-   { 10836, 0x00010000 }, /* GL_EVAL_BIT */
-   { 10848, 0x00000800 }, /* GL_EXP */
-   { 10855, 0x00000801 }, /* GL_EXP2 */
-   { 10863, 0x00001F03 }, /* GL_EXTENSIONS */
-   { 10877, 0x00002400 }, /* GL_EYE_LINEAR */
-   { 10891, 0x00002502 }, /* GL_EYE_PLANE */
-   { 10904, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
-   { 10929, 0x0000855B }, /* GL_EYE_RADIAL_NV */
-   { 10946, 0x00000000 }, /* GL_FALSE */
-   { 10955, 0x00001101 }, /* GL_FASTEST */
-   { 10966, 0x00001C01 }, /* GL_FEEDBACK */
-   { 10978, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
-   { 11005, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
-   { 11029, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
-   { 11053, 0x00001B02 }, /* GL_FILL */
-   { 11061, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */
-   { 11088, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */
-   { 11119, 0x0000140C }, /* GL_FIXED */
-   { 11128, 0x0000140C }, /* GL_FIXED_OES */
-   { 11141, 0x0000891D }, /* GL_FIXED_ONLY */
-   { 11155, 0x0000891D }, /* GL_FIXED_ONLY_ARB */
-   { 11173, 0x00001D00 }, /* GL_FLAT */
-   { 11181, 0x00001406 }, /* GL_FLOAT */
-   { 11190, 0x00008B5A }, /* GL_FLOAT_MAT2 */
-   { 11204, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
-   { 11222, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
-   { 11238, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
-   { 11254, 0x00008B5B }, /* GL_FLOAT_MAT3 */
-   { 11268, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
-   { 11286, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
-   { 11302, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
-   { 11318, 0x00008B5C }, /* GL_FLOAT_MAT4 */
-   { 11332, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
-   { 11350, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
-   { 11366, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
-   { 11382, 0x00008B50 }, /* GL_FLOAT_VEC2 */
-   { 11396, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
-   { 11414, 0x00008B51 }, /* GL_FLOAT_VEC3 */
-   { 11428, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
-   { 11446, 0x00008B52 }, /* GL_FLOAT_VEC4 */
-   { 11460, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
-   { 11478, 0x00000B60 }, /* GL_FOG */
-   { 11485, 0x00000080 }, /* GL_FOG_BIT */
-   { 11496, 0x00000B66 }, /* GL_FOG_COLOR */
-   { 11509, 0x00008451 }, /* GL_FOG_COORD */
-   { 11522, 0x00008451 }, /* GL_FOG_COORDINATE */
-   { 11540, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
-   { 11564, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-   { 11603, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
-   { 11646, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-   { 11678, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-   { 11709, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-   { 11738, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
-   { 11763, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
-   { 11782, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
-   { 11816, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
-   { 11843, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
-   { 11869, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
-   { 11893, 0x00008450 }, /* GL_FOG_COORD_SRC */
-   { 11910, 0x00000B62 }, /* GL_FOG_DENSITY */
-   { 11925, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
-   { 11949, 0x00000B64 }, /* GL_FOG_END */
-   { 11960, 0x00000C54 }, /* GL_FOG_HINT */
-   { 11972, 0x00000B61 }, /* GL_FOG_INDEX */
-   { 11985, 0x00000B65 }, /* GL_FOG_MODE */
-   { 11997, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
-   { 12016, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
-   { 12041, 0x00000B63 }, /* GL_FOG_START */
-   { 12054, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
-   { 12072, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
-   { 12096, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
-   { 12115, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
-   { 12138, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-   { 12173, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES */
-   { 12212, 0x00008D40 }, /* GL_FRAMEBUFFER */
-   { 12227, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-   { 12264, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-   { 12300, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-   { 12341, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-   { 12382, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-   { 12419, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-   { 12456, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */
-   { 12490, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB */
-   { 12528, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-   { 12566, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
-   { 12608, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES */
-   { 12650, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-   { 12688, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
-   { 12730, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES */
-   { 12772, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-   { 12807, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-   { 12846, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
-   { 12895, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES */
-   { 12944, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-   { 12992, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
-   { 13044, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES */
-   { 13096, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-   { 13136, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
-   { 13180, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-   { 13220, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
-   { 13264, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES */
-   { 13308, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */
-   { 13331, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
-   { 13358, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_OES */
-   { 13385, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
-   { 13409, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
-   { 13437, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_OES */
-   { 13465, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
-   { 13488, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
-   { 13507, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-   { 13544, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
-   { 13585, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES */
-   { 13626, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS */
-   { 13663, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-   { 13704, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES */
-   { 13745, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
-   { 13783, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
-   { 13825, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES */
-   { 13867, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-   { 13918, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-   { 13956, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES */
-   { 13994, 0x00008DA9 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */
-   { 14036, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */
-   { 14076, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB */
-   { 14120, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-   { 14165, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
-   { 14214, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES */
-   { 14263, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-   { 14301, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */
-   { 14343, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
-   { 14381, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
-   { 14423, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES */
-   { 14465, 0x00008D40 }, /* GL_FRAMEBUFFER_OES */
-   { 14484, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-   { 14516, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
-   { 14541, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
-   { 14568, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
-   { 14599, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_OES */
-   { 14630, 0x00000404 }, /* GL_FRONT */
-   { 14639, 0x00000408 }, /* GL_FRONT_AND_BACK */
-   { 14657, 0x00000B46 }, /* GL_FRONT_FACE */
-   { 14671, 0x00000400 }, /* GL_FRONT_LEFT */
-   { 14685, 0x00000401 }, /* GL_FRONT_RIGHT */
-   { 14700, 0x00008006 }, /* GL_FUNC_ADD */
-   { 14712, 0x00008006 }, /* GL_FUNC_ADD_EXT */
-   { 14728, 0x00008006 }, /* GL_FUNC_ADD_OES */
-   { 14744, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
-   { 14769, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
-   { 14798, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_OES */
-   { 14827, 0x0000800A }, /* GL_FUNC_SUBTRACT */
-   { 14844, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
-   { 14865, 0x0000800A }, /* GL_FUNC_SUBTRACT_OES */
-   { 14886, 0x00008191 }, /* GL_GENERATE_MIPMAP */
-   { 14905, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
-   { 14929, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
-   { 14958, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
-   { 14982, 0x00008917 }, /* GL_GEOMETRY_INPUT_TYPE */
-   { 15005, 0x00008DDB }, /* GL_GEOMETRY_INPUT_TYPE_ARB */
-   { 15032, 0x00008918 }, /* GL_GEOMETRY_OUTPUT_TYPE */
-   { 15056, 0x00008DDC }, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */
-   { 15084, 0x00008DD9 }, /* GL_GEOMETRY_SHADER */
-   { 15103, 0x00008DD9 }, /* GL_GEOMETRY_SHADER_ARB */
-   { 15126, 0x00008916 }, /* GL_GEOMETRY_VERTICES_OUT */
-   { 15151, 0x00008DDA }, /* GL_GEOMETRY_VERTICES_OUT_ARB */
-   { 15180, 0x00000206 }, /* GL_GEQUAL */
-   { 15190, 0x00000204 }, /* GL_GREATER */
-   { 15201, 0x00001904 }, /* GL_GREEN */
-   { 15210, 0x00000D19 }, /* GL_GREEN_BIAS */
-   { 15224, 0x00000D53 }, /* GL_GREEN_BITS */
-   { 15238, 0x00008D95 }, /* GL_GREEN_INTEGER */
-   { 15255, 0x00008D95 }, /* GL_GREEN_INTEGER_EXT */
-   { 15276, 0x00000D18 }, /* GL_GREEN_SCALE */
-   { 15291, 0x0000140B }, /* GL_HALF_FLOAT */
-   { 15305, 0x00008D61 }, /* GL_HALF_FLOAT_OES */
-   { 15323, 0x00008DF2 }, /* GL_HIGH_FLOAT */
-   { 15337, 0x00008DF5 }, /* GL_HIGH_INT */
-   { 15349, 0x00008000 }, /* GL_HINT_BIT */
-   { 15361, 0x00008024 }, /* GL_HISTOGRAM */
-   { 15374, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
-   { 15398, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
-   { 15426, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
-   { 15449, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
-   { 15476, 0x00008024 }, /* GL_HISTOGRAM_EXT */
-   { 15493, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
-   { 15513, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
-   { 15537, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
-   { 15561, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
-   { 15589, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-   { 15617, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
-   { 15649, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
-   { 15671, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
-   { 15697, 0x0000802D }, /* GL_HISTOGRAM_SINK */
-   { 15715, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
-   { 15737, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
-   { 15756, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
-   { 15779, 0x0000862A }, /* GL_IDENTITY_NV */
-   { 15794, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
-   { 15814, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */
-   { 15850, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
-   { 15890, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */
-   { 15924, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-   { 15962, 0x00001E02 }, /* GL_INCR */
-   { 15970, 0x00008507 }, /* GL_INCR_WRAP */
-   { 15983, 0x00008507 }, /* GL_INCR_WRAP_EXT */
-   { 16000, 0x00008222 }, /* GL_INDEX */
-   { 16009, 0x00008077 }, /* GL_INDEX_ARRAY */
-   { 16024, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-   { 16054, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
-   { 16088, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
-   { 16111, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
-   { 16133, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
-   { 16153, 0x00000D51 }, /* GL_INDEX_BITS */
-   { 16167, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
-   { 16188, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
-   { 16206, 0x00000C30 }, /* GL_INDEX_MODE */
-   { 16220, 0x00000D13 }, /* GL_INDEX_OFFSET */
-   { 16236, 0x00000D12 }, /* GL_INDEX_SHIFT */
-   { 16251, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
-   { 16270, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
-   { 16289, 0x00001404 }, /* GL_INT */
-   { 16296, 0x00008049 }, /* GL_INTENSITY */
-   { 16309, 0x0000804C }, /* GL_INTENSITY12 */
-   { 16324, 0x0000804C }, /* GL_INTENSITY12_EXT */
-   { 16343, 0x0000804D }, /* GL_INTENSITY16 */
-   { 16358, 0x00008D8B }, /* GL_INTENSITY16I_EXT */
-   { 16378, 0x00008D79 }, /* GL_INTENSITY16UI_EXT */
-   { 16399, 0x0000804D }, /* GL_INTENSITY16_EXT */
-   { 16418, 0x00008D85 }, /* GL_INTENSITY32I_EXT */
-   { 16438, 0x00008D73 }, /* GL_INTENSITY32UI_EXT */
-   { 16459, 0x0000804A }, /* GL_INTENSITY4 */
-   { 16473, 0x0000804A }, /* GL_INTENSITY4_EXT */
-   { 16491, 0x0000804B }, /* GL_INTENSITY8 */
-   { 16505, 0x00008D91 }, /* GL_INTENSITY8I_EXT */
-   { 16524, 0x00008D7F }, /* GL_INTENSITY8UI_EXT */
-   { 16544, 0x0000804B }, /* GL_INTENSITY8_EXT */
-   { 16562, 0x00008049 }, /* GL_INTENSITY_EXT */
-   { 16579, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS */
-   { 16602, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS_EXT */
-   { 16629, 0x00008575 }, /* GL_INTERPOLATE */
-   { 16644, 0x00008575 }, /* GL_INTERPOLATE_ARB */
-   { 16663, 0x00008575 }, /* GL_INTERPOLATE_EXT */
-   { 16682, 0x00008DF7 }, /* GL_INT_10_10_10_2_OES */
-   { 16704, 0x00008DC9 }, /* GL_INT_SAMPLER_1D */
-   { 16722, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY */
-   { 16746, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY_EXT */
-   { 16774, 0x00008DC9 }, /* GL_INT_SAMPLER_1D_EXT */
-   { 16796, 0x00008DCA }, /* GL_INT_SAMPLER_2D */
-   { 16814, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY */
-   { 16838, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY_EXT */
-   { 16866, 0x00008DCA }, /* GL_INT_SAMPLER_2D_EXT */
-   { 16888, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT */
-   { 16911, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT_EXT */
-   { 16938, 0x00008DCB }, /* GL_INT_SAMPLER_3D */
-   { 16956, 0x00008DCB }, /* GL_INT_SAMPLER_3D_EXT */
-   { 16978, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER */
-   { 17000, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER_EXT */
-   { 17026, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE */
-   { 17046, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE_EXT */
-   { 17070, 0x00008B53 }, /* GL_INT_VEC2 */
-   { 17082, 0x00008B53 }, /* GL_INT_VEC2_ARB */
-   { 17098, 0x00008B54 }, /* GL_INT_VEC3 */
-   { 17110, 0x00008B54 }, /* GL_INT_VEC3_ARB */
-   { 17126, 0x00008B55 }, /* GL_INT_VEC4 */
-   { 17138, 0x00008B55 }, /* GL_INT_VEC4_ARB */
-   { 17154, 0x00000500 }, /* GL_INVALID_ENUM */
-   { 17170, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
-   { 17203, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
-   { 17240, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_OES */
-   { 17277, 0x00000502 }, /* GL_INVALID_OPERATION */
-   { 17298, 0x00000501 }, /* GL_INVALID_VALUE */
-   { 17315, 0x0000862B }, /* GL_INVERSE_NV */
-   { 17329, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
-   { 17353, 0x0000150A }, /* GL_INVERT */
-   { 17363, 0x00001E00 }, /* GL_KEEP */
-   { 17371, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
-   { 17397, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
-   { 17427, 0x00000406 }, /* GL_LEFT */
-   { 17435, 0x00000203 }, /* GL_LEQUAL */
-   { 17445, 0x00000201 }, /* GL_LESS */
-   { 17453, 0x00004000 }, /* GL_LIGHT0 */
-   { 17463, 0x00004001 }, /* GL_LIGHT1 */
-   { 17473, 0x00004002 }, /* GL_LIGHT2 */
-   { 17483, 0x00004003 }, /* GL_LIGHT3 */
-   { 17493, 0x00004004 }, /* GL_LIGHT4 */
-   { 17503, 0x00004005 }, /* GL_LIGHT5 */
-   { 17513, 0x00004006 }, /* GL_LIGHT6 */
-   { 17523, 0x00004007 }, /* GL_LIGHT7 */
-   { 17533, 0x00000B50 }, /* GL_LIGHTING */
-   { 17545, 0x00000040 }, /* GL_LIGHTING_BIT */
-   { 17561, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
-   { 17584, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-   { 17613, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
-   { 17646, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-   { 17674, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
-   { 17698, 0x00001B01 }, /* GL_LINE */
-   { 17706, 0x00002601 }, /* GL_LINEAR */
-   { 17716, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
-   { 17738, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-   { 17768, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-   { 17799, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
-   { 17823, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
-   { 17848, 0x00000001 }, /* GL_LINES */
-   { 17857, 0x0000000A }, /* GL_LINES_ADJACENCY */
-   { 17876, 0x0000000A }, /* GL_LINES_ADJACENCY_ARB */
-   { 17899, 0x00000004 }, /* GL_LINE_BIT */
-   { 17911, 0x00000002 }, /* GL_LINE_LOOP */
-   { 17924, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
-   { 17944, 0x00000B20 }, /* GL_LINE_SMOOTH */
-   { 17959, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
-   { 17979, 0x00000B24 }, /* GL_LINE_STIPPLE */
-   { 17995, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
-   { 18019, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
-   { 18042, 0x00000003 }, /* GL_LINE_STRIP */
-   { 18056, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY */
-   { 18080, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY_ARB */
-   { 18108, 0x00000702 }, /* GL_LINE_TOKEN */
-   { 18122, 0x00000B21 }, /* GL_LINE_WIDTH */
-   { 18136, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
-   { 18162, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
-   { 18182, 0x00008B82 }, /* GL_LINK_STATUS */
-   { 18197, 0x00000B32 }, /* GL_LIST_BASE */
-   { 18210, 0x00020000 }, /* GL_LIST_BIT */
-   { 18222, 0x00000B33 }, /* GL_LIST_INDEX */
-   { 18236, 0x00000B30 }, /* GL_LIST_MODE */
-   { 18249, 0x00000101 }, /* GL_LOAD */
-   { 18257, 0x00000BF1 }, /* GL_LOGIC_OP */
-   { 18269, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
-   { 18286, 0x00008CA1 }, /* GL_LOWER_LEFT */
-   { 18300, 0x00008DF0 }, /* GL_LOW_FLOAT */
-   { 18313, 0x00008DF3 }, /* GL_LOW_INT */
-   { 18324, 0x00001909 }, /* GL_LUMINANCE */
-   { 18337, 0x00008041 }, /* GL_LUMINANCE12 */
-   { 18352, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
-   { 18375, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
-   { 18402, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
-   { 18424, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
-   { 18450, 0x00008041 }, /* GL_LUMINANCE12_EXT */
-   { 18469, 0x00008042 }, /* GL_LUMINANCE16 */
-   { 18484, 0x00008D8C }, /* GL_LUMINANCE16I_EXT */
-   { 18504, 0x00008D7A }, /* GL_LUMINANCE16UI_EXT */
-   { 18525, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
-   { 18548, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
-   { 18575, 0x00008042 }, /* GL_LUMINANCE16_EXT */
-   { 18594, 0x00008D86 }, /* GL_LUMINANCE32I_EXT */
-   { 18614, 0x00008D74 }, /* GL_LUMINANCE32UI_EXT */
-   { 18635, 0x0000803F }, /* GL_LUMINANCE4 */
-   { 18649, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
-   { 18670, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
-   { 18695, 0x0000803F }, /* GL_LUMINANCE4_EXT */
-   { 18713, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
-   { 18734, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
-   { 18759, 0x00008040 }, /* GL_LUMINANCE8 */
-   { 18773, 0x00008D92 }, /* GL_LUMINANCE8I_EXT */
-   { 18792, 0x00008D80 }, /* GL_LUMINANCE8UI_EXT */
-   { 18812, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
-   { 18833, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
-   { 18858, 0x00008040 }, /* GL_LUMINANCE8_EXT */
-   { 18876, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
-   { 18895, 0x00008D8D }, /* GL_LUMINANCE_ALPHA16I_EXT */
-   { 18921, 0x00008D7B }, /* GL_LUMINANCE_ALPHA16UI_EXT */
-   { 18948, 0x00008D87 }, /* GL_LUMINANCE_ALPHA32I_EXT */
-   { 18974, 0x00008D75 }, /* GL_LUMINANCE_ALPHA32UI_EXT */
-   { 19001, 0x00008D93 }, /* GL_LUMINANCE_ALPHA8I_EXT */
-   { 19026, 0x00008D81 }, /* GL_LUMINANCE_ALPHA8UI_EXT */
-   { 19052, 0x00008D9D }, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */
-   { 19083, 0x00008D9C }, /* GL_LUMINANCE_INTEGER_EXT */
-   { 19108, 0x0000821B }, /* GL_MAJOR_VERSION */
-   { 19125, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
-   { 19141, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
-   { 19161, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
-   { 19183, 0x00000D91 }, /* GL_MAP1_INDEX */
-   { 19197, 0x00000D92 }, /* GL_MAP1_NORMAL */
-   { 19212, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
-   { 19236, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
-   { 19260, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
-   { 19284, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
-   { 19308, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
-   { 19325, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
-   { 19342, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-   { 19370, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-   { 19399, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-   { 19428, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-   { 19457, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-   { 19486, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-   { 19515, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-   { 19544, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-   { 19572, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-   { 19600, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-   { 19628, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-   { 19656, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-   { 19684, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-   { 19712, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-   { 19740, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-   { 19768, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-   { 19796, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
-   { 19812, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
-   { 19832, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
-   { 19854, 0x00000DB1 }, /* GL_MAP2_INDEX */
-   { 19868, 0x00000DB2 }, /* GL_MAP2_NORMAL */
-   { 19883, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
-   { 19907, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
-   { 19931, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
-   { 19955, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
-   { 19979, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
-   { 19996, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
-   { 20013, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-   { 20041, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-   { 20070, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-   { 20099, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-   { 20128, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-   { 20157, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-   { 20186, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-   { 20215, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-   { 20243, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-   { 20271, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-   { 20299, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-   { 20327, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-   { 20355, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-   { 20383, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
-   { 20411, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-   { 20439, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-   { 20467, 0x00000D10 }, /* GL_MAP_COLOR */
-   { 20480, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
-   { 20506, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
-   { 20535, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
-   { 20563, 0x00000001 }, /* GL_MAP_READ_BIT */
-   { 20579, 0x00000D11 }, /* GL_MAP_STENCIL */
-   { 20594, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
-   { 20620, 0x00000002 }, /* GL_MAP_WRITE_BIT */
-   { 20637, 0x000088C0 }, /* GL_MATRIX0_ARB */
-   { 20652, 0x00008630 }, /* GL_MATRIX0_NV */
-   { 20666, 0x000088CA }, /* GL_MATRIX10_ARB */
-   { 20682, 0x000088CB }, /* GL_MATRIX11_ARB */
-   { 20698, 0x000088CC }, /* GL_MATRIX12_ARB */
-   { 20714, 0x000088CD }, /* GL_MATRIX13_ARB */
-   { 20730, 0x000088CE }, /* GL_MATRIX14_ARB */
-   { 20746, 0x000088CF }, /* GL_MATRIX15_ARB */
-   { 20762, 0x000088D0 }, /* GL_MATRIX16_ARB */
-   { 20778, 0x000088D1 }, /* GL_MATRIX17_ARB */
-   { 20794, 0x000088D2 }, /* GL_MATRIX18_ARB */
-   { 20810, 0x000088D3 }, /* GL_MATRIX19_ARB */
-   { 20826, 0x000088C1 }, /* GL_MATRIX1_ARB */
-   { 20841, 0x00008631 }, /* GL_MATRIX1_NV */
-   { 20855, 0x000088D4 }, /* GL_MATRIX20_ARB */
-   { 20871, 0x000088D5 }, /* GL_MATRIX21_ARB */
-   { 20887, 0x000088D6 }, /* GL_MATRIX22_ARB */
-   { 20903, 0x000088D7 }, /* GL_MATRIX23_ARB */
-   { 20919, 0x000088D8 }, /* GL_MATRIX24_ARB */
-   { 20935, 0x000088D9 }, /* GL_MATRIX25_ARB */
-   { 20951, 0x000088DA }, /* GL_MATRIX26_ARB */
-   { 20967, 0x000088DB }, /* GL_MATRIX27_ARB */
-   { 20983, 0x000088DC }, /* GL_MATRIX28_ARB */
-   { 20999, 0x000088DD }, /* GL_MATRIX29_ARB */
-   { 21015, 0x000088C2 }, /* GL_MATRIX2_ARB */
-   { 21030, 0x00008632 }, /* GL_MATRIX2_NV */
-   { 21044, 0x000088DE }, /* GL_MATRIX30_ARB */
-   { 21060, 0x000088DF }, /* GL_MATRIX31_ARB */
-   { 21076, 0x000088C3 }, /* GL_MATRIX3_ARB */
-   { 21091, 0x00008633 }, /* GL_MATRIX3_NV */
-   { 21105, 0x000088C4 }, /* GL_MATRIX4_ARB */
-   { 21120, 0x00008634 }, /* GL_MATRIX4_NV */
-   { 21134, 0x000088C5 }, /* GL_MATRIX5_ARB */
-   { 21149, 0x00008635 }, /* GL_MATRIX5_NV */
-   { 21163, 0x000088C6 }, /* GL_MATRIX6_ARB */
-   { 21178, 0x00008636 }, /* GL_MATRIX6_NV */
-   { 21192, 0x000088C7 }, /* GL_MATRIX7_ARB */
-   { 21207, 0x00008637 }, /* GL_MATRIX7_NV */
-   { 21221, 0x000088C8 }, /* GL_MATRIX8_ARB */
-   { 21236, 0x000088C9 }, /* GL_MATRIX9_ARB */
-   { 21251, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
-   { 21277, 0x00008B9E }, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */
-   { 21318, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_OES */
-   { 21344, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-   { 21378, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_OES */
-   { 21412, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-   { 21443, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_OES */
-   { 21474, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-   { 21507, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_OES */
-   { 21540, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-   { 21571, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_OES */
-   { 21602, 0x00000BA0 }, /* GL_MATRIX_MODE */
-   { 21617, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
-   { 21639, 0x00008840 }, /* GL_MATRIX_PALETTE_OES */
-   { 21661, 0x00008008 }, /* GL_MAX */
-   { 21668, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
-   { 21691, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE_OES */
-   { 21718, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS */
-   { 21746, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
-   { 21778, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
-   { 21804, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-   { 21837, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-   { 21863, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 21897, 0x00000D32 }, /* GL_MAX_CLIP_DISTANCES */
-   { 21919, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
-   { 21938, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
-   { 21963, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
-   { 21992, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-   { 22024, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
-   { 22060, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-   { 22096, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
-   { 22136, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
-   { 22162, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
-   { 22192, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
-   { 22217, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
-   { 22246, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-   { 22275, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
-   { 22308, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES */
-   { 22341, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
-   { 22361, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
-   { 22385, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
-   { 22409, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
-   { 22433, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
-   { 22458, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
-   { 22476, 0x00008008 }, /* GL_MAX_EXT */
-   { 22487, 0x00009125 }, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */
-   { 22520, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-   { 22555, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
-   { 22594, 0x00008DFD }, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */
-   { 22626, 0x00009123 }, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */
-   { 22659, 0x00009124 }, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */
-   { 22693, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */
-   { 22725, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB */
-   { 22761, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */
-   { 22797, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB */
-   { 22837, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */
-   { 22877, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB */
-   { 22921, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */
-   { 22956, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB */
-   { 22995, 0x00008DDD }, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */
-   { 23034, 0x00000D31 }, /* GL_MAX_LIGHTS */
-   { 23048, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
-   { 23068, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-   { 23106, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-   { 23135, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
-   { 23159, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
-   { 23187, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_OES */
-   { 23215, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
-   { 23238, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 23275, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 23311, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-   { 23338, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-   { 23367, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-   { 23401, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
-   { 23437, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-   { 23464, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-   { 23496, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-   { 23532, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-   { 23561, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-   { 23590, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
-   { 23618, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-   { 23656, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 23700, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 23743, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 23777, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 23816, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 23853, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 23891, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 23934, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 23977, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-   { 24007, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-   { 24038, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET */
-   { 24066, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET_EXT */
-   { 24098, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 24134, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 24170, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
-   { 24200, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */
-   { 24230, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
-   { 24264, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
-   { 24297, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
-   { 24322, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
-   { 24351, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_OES */
-   { 24380, 0x00008D57 }, /* GL_MAX_SAMPLES */
-   { 24395, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
-   { 24414, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
-   { 24441, 0x00008504 }, /* GL_MAX_SHININESS_NV */
-   { 24461, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
-   { 24485, 0x00008C2B }, /* GL_MAX_TEXTURE_BUFFER_SIZE */
-   { 24512, 0x00008C2B }, /* GL_MAX_TEXTURE_BUFFER_SIZE_ARB */
-   { 24543, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
-   { 24565, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
-   { 24591, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-   { 24618, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
-   { 24649, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
-   { 24673, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS_EXT */
-   { 24701, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 24735, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
-   { 24755, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
-   { 24782, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
-   { 24803, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
-   { 24828, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
-   { 24853, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
-   { 24888, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */
-   { 24937, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */
-   { 24990, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */
-   { 25033, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */
-   { 25080, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */
-   { 25126, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */
-   { 25176, 0x00008B4B }, /* GL_MAX_VARYING_COMPONENTS */
-   { 25202, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
-   { 25224, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
-   { 25250, 0x00008DFC }, /* GL_MAX_VARYING_VECTORS */
-   { 25273, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
-   { 25295, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
-   { 25321, 0x00009122 }, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */
-   { 25353, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-   { 25387, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
-   { 25425, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-   { 25458, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
-   { 25495, 0x00008DFB }, /* GL_MAX_VERTEX_UNIFORM_VECTORS */
-   { 25525, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
-   { 25549, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_OES */
-   { 25573, 0x00008DDE }, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */
-   { 25610, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
-   { 25631, 0x00008DF1 }, /* GL_MEDIUM_FLOAT */
-   { 25647, 0x00008DF4 }, /* GL_MEDIUM_INT */
-   { 25661, 0x00008007 }, /* GL_MIN */
-   { 25668, 0x0000802E }, /* GL_MINMAX */
-   { 25678, 0x0000802E }, /* GL_MINMAX_EXT */
-   { 25692, 0x0000802F }, /* GL_MINMAX_FORMAT */
-   { 25709, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
-   { 25730, 0x00008030 }, /* GL_MINMAX_SINK */
-   { 25745, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
-   { 25764, 0x0000821C }, /* GL_MINOR_VERSION */
-   { 25781, 0x00008007 }, /* GL_MIN_EXT */
-   { 25792, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET */
-   { 25820, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET_EXT */
-   { 25852, 0x00008370 }, /* GL_MIRRORED_REPEAT */
-   { 25871, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
-   { 25894, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
-   { 25917, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
-   { 25937, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
-   { 25957, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-   { 25987, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
-   { 26015, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-   { 26043, 0x00001700 }, /* GL_MODELVIEW */
-   { 26056, 0x00001700 }, /* GL_MODELVIEW0_ARB */
-   { 26074, 0x0000872A }, /* GL_MODELVIEW10_ARB */
-   { 26093, 0x0000872B }, /* GL_MODELVIEW11_ARB */
-   { 26112, 0x0000872C }, /* GL_MODELVIEW12_ARB */
-   { 26131, 0x0000872D }, /* GL_MODELVIEW13_ARB */
-   { 26150, 0x0000872E }, /* GL_MODELVIEW14_ARB */
-   { 26169, 0x0000872F }, /* GL_MODELVIEW15_ARB */
-   { 26188, 0x00008730 }, /* GL_MODELVIEW16_ARB */
-   { 26207, 0x00008731 }, /* GL_MODELVIEW17_ARB */
-   { 26226, 0x00008732 }, /* GL_MODELVIEW18_ARB */
-   { 26245, 0x00008733 }, /* GL_MODELVIEW19_ARB */
-   { 26264, 0x0000850A }, /* GL_MODELVIEW1_ARB */
-   { 26282, 0x00008734 }, /* GL_MODELVIEW20_ARB */
-   { 26301, 0x00008735 }, /* GL_MODELVIEW21_ARB */
-   { 26320, 0x00008736 }, /* GL_MODELVIEW22_ARB */
-   { 26339, 0x00008737 }, /* GL_MODELVIEW23_ARB */
-   { 26358, 0x00008738 }, /* GL_MODELVIEW24_ARB */
-   { 26377, 0x00008739 }, /* GL_MODELVIEW25_ARB */
-   { 26396, 0x0000873A }, /* GL_MODELVIEW26_ARB */
-   { 26415, 0x0000873B }, /* GL_MODELVIEW27_ARB */
-   { 26434, 0x0000873C }, /* GL_MODELVIEW28_ARB */
-   { 26453, 0x0000873D }, /* GL_MODELVIEW29_ARB */
-   { 26472, 0x00008722 }, /* GL_MODELVIEW2_ARB */
-   { 26490, 0x0000873E }, /* GL_MODELVIEW30_ARB */
-   { 26509, 0x0000873F }, /* GL_MODELVIEW31_ARB */
-   { 26528, 0x00008723 }, /* GL_MODELVIEW3_ARB */
-   { 26546, 0x00008724 }, /* GL_MODELVIEW4_ARB */
-   { 26564, 0x00008725 }, /* GL_MODELVIEW5_ARB */
-   { 26582, 0x00008726 }, /* GL_MODELVIEW6_ARB */
-   { 26600, 0x00008727 }, /* GL_MODELVIEW7_ARB */
-   { 26618, 0x00008728 }, /* GL_MODELVIEW8_ARB */
-   { 26636, 0x00008729 }, /* GL_MODELVIEW9_ARB */
-   { 26654, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
-   { 26674, 0x0000898D }, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */
-   { 26716, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
-   { 26743, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
-   { 26768, 0x00002100 }, /* GL_MODULATE */
-   { 26780, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
-   { 26800, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
-   { 26827, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
-   { 26852, 0x00000103 }, /* GL_MULT */
-   { 26860, 0x0000809D }, /* GL_MULTISAMPLE */
-   { 26875, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
-   { 26895, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
-   { 26914, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
-   { 26933, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
-   { 26957, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
-   { 26980, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-   { 27010, 0x00002A25 }, /* GL_N3F_V3F */
-   { 27021, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
-   { 27041, 0x0000150E }, /* GL_NAND */
-   { 27049, 0x00002600 }, /* GL_NEAREST */
-   { 27060, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-   { 27091, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-   { 27123, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
-   { 27148, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
-   { 27174, 0x00000200 }, /* GL_NEVER */
-   { 27183, 0x00001102 }, /* GL_NICEST */
-   { 27193, 0x00000000 }, /* GL_NONE */
-   { 27201, 0x00000000 }, /* GL_NONE_OES */
-   { 27213, 0x00001505 }, /* GL_NOOP */
-   { 27221, 0x00001508 }, /* GL_NOR */
-   { 27228, 0x00000BA1 }, /* GL_NORMALIZE */
-   { 27241, 0x00008075 }, /* GL_NORMAL_ARRAY */
-   { 27257, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
-   { 27288, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
-   { 27323, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
-   { 27347, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
-   { 27370, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
-   { 27391, 0x00008511 }, /* GL_NORMAL_MAP */
-   { 27405, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
-   { 27423, 0x00008511 }, /* GL_NORMAL_MAP_NV */
-   { 27440, 0x00008511 }, /* GL_NORMAL_MAP_OES */
-   { 27458, 0x00000205 }, /* GL_NOTEQUAL */
-   { 27470, 0x00000000 }, /* GL_NO_ERROR */
-   { 27482, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
-   { 27516, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
-   { 27554, 0x0000821D }, /* GL_NUM_EXTENSIONS */
-   { 27572, 0x000087FE }, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */
-   { 27606, 0x00008DF9 }, /* GL_NUM_SHADER_BINARY_FORMATS */
-   { 27635, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
-   { 27667, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
-   { 27709, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
-   { 27739, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
-   { 27779, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
-   { 27810, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
-   { 27839, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
-   { 27867, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
-   { 27897, 0x00002401 }, /* GL_OBJECT_LINEAR */
-   { 27914, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
-   { 27940, 0x00002501 }, /* GL_OBJECT_PLANE */
-   { 27956, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
-   { 27991, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
-   { 28013, 0x00009112 }, /* GL_OBJECT_TYPE */
-   { 28028, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
-   { 28047, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
-   { 28077, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
-   { 28098, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
-   { 28126, 0x00000001 }, /* GL_ONE */
-   { 28133, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
-   { 28161, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
-   { 28193, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
-   { 28221, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
-   { 28253, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
-   { 28276, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
-   { 28299, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
-   { 28322, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
-   { 28345, 0x00008598 }, /* GL_OPERAND0_ALPHA */
-   { 28363, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
-   { 28385, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
-   { 28407, 0x00008590 }, /* GL_OPERAND0_RGB */
-   { 28423, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
-   { 28443, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
-   { 28463, 0x00008599 }, /* GL_OPERAND1_ALPHA */
-   { 28481, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
-   { 28503, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
-   { 28525, 0x00008591 }, /* GL_OPERAND1_RGB */
-   { 28541, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
-   { 28561, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
-   { 28581, 0x0000859A }, /* GL_OPERAND2_ALPHA */
-   { 28599, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
-   { 28621, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
-   { 28643, 0x00008592 }, /* GL_OPERAND2_RGB */
-   { 28659, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
-   { 28679, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
-   { 28699, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
-   { 28720, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
-   { 28739, 0x00001507 }, /* GL_OR */
-   { 28745, 0x00000A01 }, /* GL_ORDER */
-   { 28754, 0x0000150D }, /* GL_OR_INVERTED */
-   { 28769, 0x0000150B }, /* GL_OR_REVERSE */
-   { 28783, 0x00000505 }, /* GL_OUT_OF_MEMORY */
-   { 28800, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
-   { 28818, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
-   { 28839, 0x00008758 }, /* GL_PACK_INVERT_MESA */
-   { 28859, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
-   { 28877, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
-   { 28896, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
-   { 28916, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
-   { 28936, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
-   { 28954, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
-   { 28973, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
-   { 28998, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
-   { 29022, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
-   { 29043, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
-   { 29065, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
-   { 29087, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
-   { 29112, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
-   { 29136, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
-   { 29157, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
-   { 29179, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
-   { 29201, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
-   { 29223, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
-   { 29254, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
-   { 29274, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-   { 29299, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
-   { 29319, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-   { 29344, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
-   { 29364, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-   { 29389, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
-   { 29409, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-   { 29434, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
-   { 29454, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-   { 29479, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
-   { 29499, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-   { 29524, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
-   { 29544, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-   { 29569, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
-   { 29589, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-   { 29614, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
-   { 29634, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-   { 29659, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
-   { 29679, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-   { 29704, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
-   { 29722, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
-   { 29743, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
-   { 29772, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
-   { 29805, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
-   { 29830, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
-   { 29853, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
-   { 29884, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
-   { 29919, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
-   { 29946, 0x00001B00 }, /* GL_POINT */
-   { 29955, 0x00000000 }, /* GL_POINTS */
-   { 29965, 0x00000002 }, /* GL_POINT_BIT */
-   { 29978, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
-   { 30008, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
-   { 30042, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
-   { 30076, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
-   { 30111, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
-   { 30140, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
-   { 30173, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
-   { 30206, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
-   { 30240, 0x00000B11 }, /* GL_POINT_SIZE */
-   { 30254, 0x00008B9F }, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */
-   { 30293, 0x00008B9C }, /* GL_POINT_SIZE_ARRAY_OES */
-   { 30317, 0x0000898C }, /* GL_POINT_SIZE_ARRAY_POINTER_OES */
-   { 30349, 0x0000898B }, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */
-   { 30380, 0x0000898A }, /* GL_POINT_SIZE_ARRAY_TYPE_OES */
-   { 30409, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
-   { 30435, 0x00008127 }, /* GL_POINT_SIZE_MAX */
-   { 30453, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
-   { 30475, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
-   { 30497, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
-   { 30520, 0x00008126 }, /* GL_POINT_SIZE_MIN */
-   { 30538, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
-   { 30560, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
-   { 30582, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
-   { 30605, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
-   { 30625, 0x00000B10 }, /* GL_POINT_SMOOTH */
-   { 30641, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
-   { 30662, 0x00008861 }, /* GL_POINT_SPRITE */
-   { 30678, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
-   { 30698, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
-   { 30727, 0x00008861 }, /* GL_POINT_SPRITE_NV */
-   { 30746, 0x00008861 }, /* GL_POINT_SPRITE_OES */
-   { 30766, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
-   { 30792, 0x00000701 }, /* GL_POINT_TOKEN */
-   { 30807, 0x00000009 }, /* GL_POLYGON */
-   { 30818, 0x00000008 }, /* GL_POLYGON_BIT */
-   { 30833, 0x00000B40 }, /* GL_POLYGON_MODE */
-   { 30849, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
-   { 30872, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
-   { 30897, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
-   { 30920, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
-   { 30943, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
-   { 30967, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
-   { 30991, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
-   { 31009, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
-   { 31032, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
-   { 31051, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
-   { 31074, 0x00000703 }, /* GL_POLYGON_TOKEN */
-   { 31091, 0x00001203 }, /* GL_POSITION */
-   { 31103, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-   { 31135, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
-   { 31171, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-   { 31204, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
-   { 31241, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-   { 31272, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
-   { 31307, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-   { 31339, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
-   { 31375, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 31408, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-   { 31440, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
-   { 31476, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-   { 31509, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
-   { 31546, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-   { 31576, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
-   { 31610, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-   { 31641, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
-   { 31676, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-   { 31707, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
-   { 31742, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-   { 31774, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
-   { 31810, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-   { 31840, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
-   { 31874, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-   { 31905, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
-   { 31940, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-   { 31972, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-   { 32003, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
-   { 32038, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-   { 32070, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
-   { 32106, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
-   { 32135, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
-   { 32168, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
-   { 32198, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
-   { 32232, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-   { 32271, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-   { 32304, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-   { 32344, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-   { 32378, 0x00008578 }, /* GL_PREVIOUS */
-   { 32390, 0x00008578 }, /* GL_PREVIOUS_ARB */
-   { 32406, 0x00008578 }, /* GL_PREVIOUS_EXT */
-   { 32422, 0x00008577 }, /* GL_PRIMARY_COLOR */
-   { 32439, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
-   { 32460, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
-   { 32481, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED */
-   { 32505, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED_EXT */
-   { 32533, 0x00008F9D }, /* GL_PRIMITIVE_RESTART */
-   { 32554, 0x00008F9E }, /* GL_PRIMITIVE_RESTART_INDEX */
-   { 32581, 0x00008559 }, /* GL_PRIMITIVE_RESTART_INDEX_NV */
-   { 32611, 0x00008558 }, /* GL_PRIMITIVE_RESTART_NV */
-   { 32635, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 32668, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 32700, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
-   { 32723, 0x000087FF }, /* GL_PROGRAM_BINARY_FORMATS_OES */
-   { 32753, 0x00008741 }, /* GL_PROGRAM_BINARY_LENGTH_OES */
-   { 32782, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
-   { 32805, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
-   { 32835, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
-   { 32864, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
-   { 32892, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
-   { 32914, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-   { 32942, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-   { 32970, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
-   { 32992, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
-   { 33013, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 33053, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 33092, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 33122, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 33157, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 33190, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 33224, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 33263, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 33302, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
-   { 33324, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
-   { 33350, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
-   { 33374, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE */
-   { 33396, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE_ARB */
-   { 33422, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
-   { 33445, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
-   { 33467, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
-   { 33488, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
-   { 33509, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
-   { 33536, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 33568, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 33600, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-   { 33635, 0x00001701 }, /* GL_PROJECTION */
-   { 33649, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
-   { 33670, 0x0000898E }, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */
-   { 33713, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
-   { 33739, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
-   { 33759, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
-   { 33783, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
-   { 33804, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
-   { 33823, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
-   { 33846, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 33885, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-   { 33923, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
-   { 33943, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY */
-   { 33969, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
-   { 33999, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
-   { 34023, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
-   { 34043, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY */
-   { 34069, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
-   { 34099, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
-   { 34123, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
-   { 34143, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-   { 34176, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
-   { 34202, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
-   { 34232, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE */
-   { 34259, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
-   { 34290, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
-   { 34320, 0x00008A1D }, /* GL_PURGEABLE_APPLE */
-   { 34339, 0x00002003 }, /* GL_Q */
-   { 34344, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
-   { 34369, 0x00000007 }, /* GL_QUADS */
-   { 34378, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
-   { 34422, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
-   { 34470, 0x00008614 }, /* GL_QUAD_MESH_SUN */
-   { 34487, 0x00000008 }, /* GL_QUAD_STRIP */
-   { 34501, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT */
-   { 34528, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
-   { 34558, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT */
-   { 34582, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */
-   { 34609, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
-   { 34631, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
-   { 34657, 0x00008E14 }, /* GL_QUERY_NO_WAIT */
-   { 34674, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */
-   { 34694, 0x00008866 }, /* GL_QUERY_RESULT */
-   { 34710, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
-   { 34730, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
-   { 34756, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
-   { 34786, 0x00008E13 }, /* GL_QUERY_WAIT */
-   { 34800, 0x00008E13 }, /* GL_QUERY_WAIT_NV */
-   { 34817, 0x00002002 }, /* GL_R */
-   { 34822, 0x00008C3A }, /* GL_R11F_G11F_B10F */
-   { 34840, 0x00008F98 }, /* GL_R16_SNORM */
-   { 34853, 0x00002A10 }, /* GL_R3_G3_B2 */
-   { 34865, 0x00008F94 }, /* GL_R8_SNORM */
-   { 34877, 0x00008C89 }, /* GL_RASTERIZER_DISCARD */
-   { 34899, 0x00008C89 }, /* GL_RASTERIZER_DISCARD_EXT */
-   { 34925, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-   { 34958, 0x00000C02 }, /* GL_READ_BUFFER */
-   { 34973, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
-   { 34993, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
-   { 35021, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
-   { 35053, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
-   { 35077, 0x000088B8 }, /* GL_READ_ONLY */
-   { 35090, 0x000088B8 }, /* GL_READ_ONLY_ARB */
-   { 35107, 0x000088BA }, /* GL_READ_WRITE */
-   { 35121, 0x000088BA }, /* GL_READ_WRITE_ARB */
-   { 35139, 0x00001903 }, /* GL_RED */
-   { 35146, 0x00008016 }, /* GL_REDUCE */
-   { 35156, 0x00008016 }, /* GL_REDUCE_EXT */
-   { 35170, 0x00000D15 }, /* GL_RED_BIAS */
-   { 35182, 0x00000D52 }, /* GL_RED_BITS */
-   { 35194, 0x00008D94 }, /* GL_RED_INTEGER */
-   { 35209, 0x00008D94 }, /* GL_RED_INTEGER_EXT */
-   { 35228, 0x00000D14 }, /* GL_RED_SCALE */
-   { 35241, 0x00008F90 }, /* GL_RED_SNORM */
-   { 35254, 0x00008512 }, /* GL_REFLECTION_MAP */
-   { 35272, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
-   { 35294, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
-   { 35315, 0x00008512 }, /* GL_REFLECTION_MAP_OES */
-   { 35337, 0x00008A19 }, /* GL_RELEASED_APPLE */
-   { 35355, 0x00001C00 }, /* GL_RENDER */
-   { 35365, 0x00008D41 }, /* GL_RENDERBUFFER */
-   { 35381, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
-   { 35408, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE_OES */
-   { 35439, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
-   { 35463, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
-   { 35491, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_OES */
-   { 35519, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
-   { 35545, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE_OES */
-   { 35575, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
-   { 35602, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE_OES */
-   { 35633, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
-   { 35653, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
-   { 35680, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE_OES */
-   { 35711, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
-   { 35734, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
-   { 35761, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_OES */
-   { 35788, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-   { 35820, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
-   { 35856, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_OES */
-   { 35892, 0x00008D41 }, /* GL_RENDERBUFFER_OES */
-   { 35912, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
-   { 35937, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE_OES */
-   { 35966, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
-   { 35990, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
-   { 36018, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
-   { 36047, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE_OES */
-   { 36080, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
-   { 36102, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
-   { 36128, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_OES */
-   { 36154, 0x00001F01 }, /* GL_RENDERER */
-   { 36166, 0x00000C40 }, /* GL_RENDER_MODE */
-   { 36181, 0x00002901 }, /* GL_REPEAT */
-   { 36191, 0x00001E01 }, /* GL_REPLACE */
-   { 36202, 0x00008062 }, /* GL_REPLACE_EXT */
-   { 36217, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
-   { 36240, 0x0000803A }, /* GL_RESCALE_NORMAL */
-   { 36258, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
-   { 36280, 0x00008A1B }, /* GL_RETAINED_APPLE */
-   { 36298, 0x00000102 }, /* GL_RETURN */
-   { 36308, 0x00008F99 }, /* GL_RG16_SNORM */
-   { 36322, 0x00008F95 }, /* GL_RG8_SNORM */
-   { 36335, 0x00001907 }, /* GL_RGB */
-   { 36342, 0x00008052 }, /* GL_RGB10 */
-   { 36351, 0x00008059 }, /* GL_RGB10_A2 */
-   { 36363, 0x00008059 }, /* GL_RGB10_A2_EXT */
-   { 36379, 0x00008052 }, /* GL_RGB10_EXT */
-   { 36392, 0x00008053 }, /* GL_RGB12 */
-   { 36401, 0x00008053 }, /* GL_RGB12_EXT */
-   { 36414, 0x00008054 }, /* GL_RGB16 */
-   { 36423, 0x0000881B }, /* GL_RGB16F */
-   { 36433, 0x00008D89 }, /* GL_RGB16I */
-   { 36443, 0x00008D89 }, /* GL_RGB16I_EXT */
-   { 36457, 0x00008D77 }, /* GL_RGB16UI */
-   { 36468, 0x00008D77 }, /* GL_RGB16UI_EXT */
-   { 36483, 0x00008054 }, /* GL_RGB16_EXT */
-   { 36496, 0x00008F9A }, /* GL_RGB16_SNORM */
-   { 36511, 0x0000804E }, /* GL_RGB2_EXT */
-   { 36523, 0x00008815 }, /* GL_RGB32F */
-   { 36533, 0x00008D83 }, /* GL_RGB32I */
-   { 36543, 0x00008D83 }, /* GL_RGB32I_EXT */
-   { 36557, 0x00008D71 }, /* GL_RGB32UI */
-   { 36568, 0x00008D71 }, /* GL_RGB32UI_EXT */
-   { 36583, 0x0000804F }, /* GL_RGB4 */
-   { 36591, 0x0000804F }, /* GL_RGB4_EXT */
-   { 36603, 0x000083A1 }, /* GL_RGB4_S3TC */
-   { 36616, 0x00008050 }, /* GL_RGB5 */
-   { 36624, 0x00008D62 }, /* GL_RGB565 */
-   { 36634, 0x00008D62 }, /* GL_RGB565_OES */
-   { 36648, 0x00008057 }, /* GL_RGB5_A1 */
-   { 36659, 0x00008057 }, /* GL_RGB5_A1_EXT */
-   { 36674, 0x00008057 }, /* GL_RGB5_A1_OES */
-   { 36689, 0x00008050 }, /* GL_RGB5_EXT */
-   { 36701, 0x00008051 }, /* GL_RGB8 */
-   { 36709, 0x00008D8F }, /* GL_RGB8I */
-   { 36718, 0x00008D8F }, /* GL_RGB8I_EXT */
-   { 36731, 0x00008D7D }, /* GL_RGB8UI */
-   { 36741, 0x00008D7D }, /* GL_RGB8UI_EXT */
-   { 36755, 0x00008051 }, /* GL_RGB8_EXT */
-   { 36767, 0x00008051 }, /* GL_RGB8_OES */
-   { 36779, 0x00008F96 }, /* GL_RGB8_SNORM */
-   { 36793, 0x00008C3D }, /* GL_RGB9_E5 */
-   { 36804, 0x00001908 }, /* GL_RGBA */
-   { 36812, 0x0000805A }, /* GL_RGBA12 */
-   { 36822, 0x0000805A }, /* GL_RGBA12_EXT */
-   { 36836, 0x0000805B }, /* GL_RGBA16 */
-   { 36846, 0x0000881A }, /* GL_RGBA16F */
-   { 36857, 0x00008D88 }, /* GL_RGBA16I */
-   { 36868, 0x00008D88 }, /* GL_RGBA16I_EXT */
-   { 36883, 0x00008D76 }, /* GL_RGBA16UI */
-   { 36895, 0x00008D76 }, /* GL_RGBA16UI_EXT */
-   { 36911, 0x0000805B }, /* GL_RGBA16_EXT */
-   { 36925, 0x00008F9B }, /* GL_RGBA16_SNORM */
-   { 36941, 0x00008055 }, /* GL_RGBA2 */
-   { 36950, 0x00008055 }, /* GL_RGBA2_EXT */
-   { 36963, 0x00008814 }, /* GL_RGBA32F */
-   { 36974, 0x00008D82 }, /* GL_RGBA32I */
-   { 36985, 0x00008D82 }, /* GL_RGBA32I_EXT */
-   { 37000, 0x00008D70 }, /* GL_RGBA32UI */
-   { 37012, 0x00008D70 }, /* GL_RGBA32UI_EXT */
-   { 37028, 0x00008056 }, /* GL_RGBA4 */
-   { 37037, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
-   { 37056, 0x00008056 }, /* GL_RGBA4_EXT */
-   { 37069, 0x00008056 }, /* GL_RGBA4_OES */
-   { 37082, 0x000083A3 }, /* GL_RGBA4_S3TC */
-   { 37096, 0x00008058 }, /* GL_RGBA8 */
-   { 37105, 0x00008D8E }, /* GL_RGBA8I */
-   { 37115, 0x00008D8E }, /* GL_RGBA8I_EXT */
-   { 37129, 0x00008D7C }, /* GL_RGBA8UI */
-   { 37140, 0x00008D7C }, /* GL_RGBA8UI_EXT */
-   { 37155, 0x00008058 }, /* GL_RGBA8_EXT */
-   { 37168, 0x00008058 }, /* GL_RGBA8_OES */
-   { 37181, 0x00008F97 }, /* GL_RGBA8_SNORM */
-   { 37196, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
-   { 37214, 0x00008820 }, /* GL_RGBA_FLOAT_MODE_ARB */
-   { 37237, 0x00008D99 }, /* GL_RGBA_INTEGER */
-   { 37253, 0x00008D99 }, /* GL_RGBA_INTEGER_EXT */
-   { 37273, 0x00008D9E }, /* GL_RGBA_INTEGER_MODE_EXT */
-   { 37298, 0x00000C31 }, /* GL_RGBA_MODE */
-   { 37311, 0x000083A2 }, /* GL_RGBA_S3TC */
-   { 37324, 0x00008F93 }, /* GL_RGBA_SNORM */
-   { 37338, 0x00008D98 }, /* GL_RGB_INTEGER */
-   { 37353, 0x00008D98 }, /* GL_RGB_INTEGER_EXT */
-   { 37372, 0x000083A0 }, /* GL_RGB_S3TC */
-   { 37384, 0x00008573 }, /* GL_RGB_SCALE */
-   { 37397, 0x00008573 }, /* GL_RGB_SCALE_ARB */
-   { 37414, 0x00008573 }, /* GL_RGB_SCALE_EXT */
-   { 37431, 0x00008F92 }, /* GL_RGB_SNORM */
-   { 37444, 0x00008F91 }, /* GL_RG_SNORM */
-   { 37456, 0x00000407 }, /* GL_RIGHT */
-   { 37465, 0x00002000 }, /* GL_S */
-   { 37470, 0x00008B5D }, /* GL_SAMPLER_1D */
-   { 37484, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY */
-   { 37504, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY_EXT */
-   { 37528, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW */
-   { 37555, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW_EXT */
-   { 37586, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
-   { 37607, 0x00008B5E }, /* GL_SAMPLER_2D */
-   { 37621, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY */
-   { 37641, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY_EXT */
-   { 37665, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW */
-   { 37692, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW_EXT */
-   { 37723, 0x00008B63 }, /* GL_SAMPLER_2D_RECT */
-   { 37742, 0x00008B64 }, /* GL_SAMPLER_2D_RECT_SHADOW */
-   { 37768, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
-   { 37789, 0x00008B5F }, /* GL_SAMPLER_3D */
-   { 37803, 0x00008B5F }, /* GL_SAMPLER_3D_OES */
-   { 37821, 0x00008919 }, /* GL_SAMPLER_BINDING */
-   { 37840, 0x00008DC2 }, /* GL_SAMPLER_BUFFER */
-   { 37858, 0x00008DC2 }, /* GL_SAMPLER_BUFFER_EXT */
-   { 37880, 0x00008B60 }, /* GL_SAMPLER_CUBE */
-   { 37896, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW */
-   { 37919, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW_EXT */
-   { 37946, 0x000080A9 }, /* GL_SAMPLES */
-   { 37957, 0x000086B4 }, /* GL_SAMPLES_3DFX */
-   { 37973, 0x000080A9 }, /* GL_SAMPLES_ARB */
-   { 37988, 0x00008914 }, /* GL_SAMPLES_PASSED */
-   { 38006, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
-   { 38028, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-   { 38056, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
-   { 38088, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
-   { 38111, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
-   { 38138, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
-   { 38156, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
-   { 38179, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
-   { 38201, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
-   { 38220, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
-   { 38243, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
-   { 38269, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
-   { 38299, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
-   { 38324, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
-   { 38353, 0x00080000 }, /* GL_SCISSOR_BIT */
-   { 38368, 0x00000C10 }, /* GL_SCISSOR_BOX */
-   { 38383, 0x00000C11 }, /* GL_SCISSOR_TEST */
-   { 38399, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
-   { 38424, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-   { 38464, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
-   { 38508, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-   { 38541, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-   { 38571, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-   { 38603, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-   { 38633, 0x00001C02 }, /* GL_SELECT */
-   { 38643, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
-   { 38671, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
-   { 38696, 0x00008012 }, /* GL_SEPARABLE_2D */
-   { 38712, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS */
-   { 38732, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS_EXT */
-   { 38756, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
-   { 38783, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
-   { 38814, 0x0000150F }, /* GL_SET */
-   { 38821, 0x00008DF8 }, /* GL_SHADER_BINARY_FORMATS */
-   { 38846, 0x00008DFA }, /* GL_SHADER_COMPILER */
-   { 38865, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
-   { 38886, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
-   { 38910, 0x00008B4F }, /* GL_SHADER_TYPE */
-   { 38925, 0x00000B54 }, /* GL_SHADE_MODEL */
-   { 38940, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
-   { 38968, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
-   { 38991, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-   { 39021, 0x00001601 }, /* GL_SHININESS */
-   { 39034, 0x00001402 }, /* GL_SHORT */
-   { 39043, 0x00009119 }, /* GL_SIGNALED */
-   { 39055, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
-   { 39076, 0x000081F9 }, /* GL_SINGLE_COLOR */
-   { 39092, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
-   { 39112, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
-   { 39131, 0x00008C46 }, /* GL_SLUMINANCE */
-   { 39145, 0x00008C47 }, /* GL_SLUMINANCE8 */
-   { 39160, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
-   { 39182, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
-   { 39202, 0x00001D01 }, /* GL_SMOOTH */
-   { 39212, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
-   { 39245, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
-   { 39272, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
-   { 39305, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
-   { 39332, 0x00008588 }, /* GL_SOURCE0_ALPHA */
-   { 39349, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
-   { 39370, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
-   { 39391, 0x00008580 }, /* GL_SOURCE0_RGB */
-   { 39406, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
-   { 39425, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
-   { 39444, 0x00008589 }, /* GL_SOURCE1_ALPHA */
-   { 39461, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
-   { 39482, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
-   { 39503, 0x00008581 }, /* GL_SOURCE1_RGB */
-   { 39518, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
-   { 39537, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
-   { 39556, 0x0000858A }, /* GL_SOURCE2_ALPHA */
-   { 39573, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
-   { 39594, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
-   { 39615, 0x00008582 }, /* GL_SOURCE2_RGB */
-   { 39630, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
-   { 39649, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
-   { 39668, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
-   { 39688, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
-   { 39706, 0x00001202 }, /* GL_SPECULAR */
-   { 39718, 0x00002402 }, /* GL_SPHERE_MAP */
-   { 39732, 0x00001206 }, /* GL_SPOT_CUTOFF */
-   { 39747, 0x00001204 }, /* GL_SPOT_DIRECTION */
-   { 39765, 0x00001205 }, /* GL_SPOT_EXPONENT */
-   { 39782, 0x00008588 }, /* GL_SRC0_ALPHA */
-   { 39796, 0x00008580 }, /* GL_SRC0_RGB */
-   { 39808, 0x00008589 }, /* GL_SRC1_ALPHA */
-   { 39822, 0x00008581 }, /* GL_SRC1_RGB */
-   { 39834, 0x0000858A }, /* GL_SRC2_ALPHA */
-   { 39848, 0x00008582 }, /* GL_SRC2_RGB */
-   { 39860, 0x00000302 }, /* GL_SRC_ALPHA */
-   { 39873, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
-   { 39895, 0x00000300 }, /* GL_SRC_COLOR */
-   { 39908, 0x00008C40 }, /* GL_SRGB */
-   { 39916, 0x00008C41 }, /* GL_SRGB8 */
-   { 39925, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
-   { 39941, 0x00008C42 }, /* GL_SRGB_ALPHA */
-   { 39955, 0x00000503 }, /* GL_STACK_OVERFLOW */
-   { 39973, 0x00000504 }, /* GL_STACK_UNDERFLOW */
-   { 39992, 0x000088E6 }, /* GL_STATIC_COPY */
-   { 40007, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
-   { 40026, 0x000088E4 }, /* GL_STATIC_DRAW */
-   { 40041, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
-   { 40060, 0x000088E5 }, /* GL_STATIC_READ */
-   { 40075, 0x000088E5 }, /* GL_STATIC_READ_ARB */
-   { 40094, 0x00001802 }, /* GL_STENCIL */
-   { 40105, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
-   { 40127, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
-   { 40153, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_OES */
-   { 40179, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
-   { 40200, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
-   { 40225, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
-   { 40246, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
-   { 40271, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-   { 40303, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
-   { 40339, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-   { 40371, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
-   { 40407, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
-   { 40427, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
-   { 40454, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
-   { 40480, 0x00000D57 }, /* GL_STENCIL_BITS */
-   { 40496, 0x00008224 }, /* GL_STENCIL_BUFFER */
-   { 40514, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
-   { 40536, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
-   { 40559, 0x00000B94 }, /* GL_STENCIL_FAIL */
-   { 40575, 0x00000B92 }, /* GL_STENCIL_FUNC */
-   { 40591, 0x00001901 }, /* GL_STENCIL_INDEX */
-   { 40608, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
-   { 40626, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
-   { 40645, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
-   { 40668, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
-   { 40690, 0x00008D46 }, /* GL_STENCIL_INDEX1_OES */
-   { 40712, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
-   { 40730, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
-   { 40752, 0x00008D47 }, /* GL_STENCIL_INDEX4_OES */
-   { 40774, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
-   { 40792, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
-   { 40814, 0x00008D48 }, /* GL_STENCIL_INDEX8_OES */
-   { 40836, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
-   { 40857, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
-   { 40884, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
-   { 40911, 0x00000B97 }, /* GL_STENCIL_REF */
-   { 40926, 0x00000B90 }, /* GL_STENCIL_TEST */
-   { 40942, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
-   { 40971, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
-   { 40993, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
-   { 41014, 0x00000C33 }, /* GL_STEREO */
-   { 41024, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
-   { 41048, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
-   { 41073, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
-   { 41097, 0x000088E2 }, /* GL_STREAM_COPY */
-   { 41112, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
-   { 41131, 0x000088E0 }, /* GL_STREAM_DRAW */
-   { 41146, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
-   { 41165, 0x000088E1 }, /* GL_STREAM_READ */
-   { 41180, 0x000088E1 }, /* GL_STREAM_READ_ARB */
-   { 41199, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
-   { 41216, 0x000084E7 }, /* GL_SUBTRACT */
-   { 41228, 0x000084E7 }, /* GL_SUBTRACT_ARB */
-   { 41244, 0x00009113 }, /* GL_SYNC_CONDITION */
-   { 41262, 0x00009116 }, /* GL_SYNC_FENCE */
-   { 41276, 0x00009115 }, /* GL_SYNC_FLAGS */
-   { 41290, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
-   { 41317, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
-   { 41347, 0x00009114 }, /* GL_SYNC_STATUS */
-   { 41362, 0x00002001 }, /* GL_T */
-   { 41367, 0x00002A2A }, /* GL_T2F_C3F_V3F */
-   { 41382, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
-   { 41401, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
-   { 41417, 0x00002A2B }, /* GL_T2F_N3F_V3F */
-   { 41432, 0x00002A27 }, /* GL_T2F_V3F */
-   { 41443, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
-   { 41462, 0x00002A28 }, /* GL_T4F_V4F */
-   { 41473, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
-   { 41496, 0x00001702 }, /* GL_TEXTURE */
-   { 41507, 0x000084C0 }, /* GL_TEXTURE0 */
-   { 41519, 0x000084C0 }, /* GL_TEXTURE0_ARB */
-   { 41535, 0x000084C1 }, /* GL_TEXTURE1 */
-   { 41547, 0x000084CA }, /* GL_TEXTURE10 */
-   { 41560, 0x000084CA }, /* GL_TEXTURE10_ARB */
-   { 41577, 0x000084CB }, /* GL_TEXTURE11 */
-   { 41590, 0x000084CB }, /* GL_TEXTURE11_ARB */
-   { 41607, 0x000084CC }, /* GL_TEXTURE12 */
-   { 41620, 0x000084CC }, /* GL_TEXTURE12_ARB */
-   { 41637, 0x000084CD }, /* GL_TEXTURE13 */
-   { 41650, 0x000084CD }, /* GL_TEXTURE13_ARB */
-   { 41667, 0x000084CE }, /* GL_TEXTURE14 */
-   { 41680, 0x000084CE }, /* GL_TEXTURE14_ARB */
-   { 41697, 0x000084CF }, /* GL_TEXTURE15 */
-   { 41710, 0x000084CF }, /* GL_TEXTURE15_ARB */
-   { 41727, 0x000084D0 }, /* GL_TEXTURE16 */
-   { 41740, 0x000084D0 }, /* GL_TEXTURE16_ARB */
-   { 41757, 0x000084D1 }, /* GL_TEXTURE17 */
-   { 41770, 0x000084D1 }, /* GL_TEXTURE17_ARB */
-   { 41787, 0x000084D2 }, /* GL_TEXTURE18 */
-   { 41800, 0x000084D2 }, /* GL_TEXTURE18_ARB */
-   { 41817, 0x000084D3 }, /* GL_TEXTURE19 */
-   { 41830, 0x000084D3 }, /* GL_TEXTURE19_ARB */
-   { 41847, 0x000084C1 }, /* GL_TEXTURE1_ARB */
-   { 41863, 0x000084C2 }, /* GL_TEXTURE2 */
-   { 41875, 0x000084D4 }, /* GL_TEXTURE20 */
-   { 41888, 0x000084D4 }, /* GL_TEXTURE20_ARB */
-   { 41905, 0x000084D5 }, /* GL_TEXTURE21 */
-   { 41918, 0x000084D5 }, /* GL_TEXTURE21_ARB */
-   { 41935, 0x000084D6 }, /* GL_TEXTURE22 */
-   { 41948, 0x000084D6 }, /* GL_TEXTURE22_ARB */
-   { 41965, 0x000084D7 }, /* GL_TEXTURE23 */
-   { 41978, 0x000084D7 }, /* GL_TEXTURE23_ARB */
-   { 41995, 0x000084D8 }, /* GL_TEXTURE24 */
-   { 42008, 0x000084D8 }, /* GL_TEXTURE24_ARB */
-   { 42025, 0x000084D9 }, /* GL_TEXTURE25 */
-   { 42038, 0x000084D9 }, /* GL_TEXTURE25_ARB */
-   { 42055, 0x000084DA }, /* GL_TEXTURE26 */
-   { 42068, 0x000084DA }, /* GL_TEXTURE26_ARB */
-   { 42085, 0x000084DB }, /* GL_TEXTURE27 */
-   { 42098, 0x000084DB }, /* GL_TEXTURE27_ARB */
-   { 42115, 0x000084DC }, /* GL_TEXTURE28 */
-   { 42128, 0x000084DC }, /* GL_TEXTURE28_ARB */
-   { 42145, 0x000084DD }, /* GL_TEXTURE29 */
-   { 42158, 0x000084DD }, /* GL_TEXTURE29_ARB */
-   { 42175, 0x000084C2 }, /* GL_TEXTURE2_ARB */
-   { 42191, 0x000084C3 }, /* GL_TEXTURE3 */
-   { 42203, 0x000084DE }, /* GL_TEXTURE30 */
-   { 42216, 0x000084DE }, /* GL_TEXTURE30_ARB */
-   { 42233, 0x000084DF }, /* GL_TEXTURE31 */
-   { 42246, 0x000084DF }, /* GL_TEXTURE31_ARB */
-   { 42263, 0x000084C3 }, /* GL_TEXTURE3_ARB */
-   { 42279, 0x000084C4 }, /* GL_TEXTURE4 */
-   { 42291, 0x000084C4 }, /* GL_TEXTURE4_ARB */
-   { 42307, 0x000084C5 }, /* GL_TEXTURE5 */
-   { 42319, 0x000084C5 }, /* GL_TEXTURE5_ARB */
-   { 42335, 0x000084C6 }, /* GL_TEXTURE6 */
-   { 42347, 0x000084C6 }, /* GL_TEXTURE6_ARB */
-   { 42363, 0x000084C7 }, /* GL_TEXTURE7 */
-   { 42375, 0x000084C7 }, /* GL_TEXTURE7_ARB */
-   { 42391, 0x000084C8 }, /* GL_TEXTURE8 */
-   { 42403, 0x000084C8 }, /* GL_TEXTURE8_ARB */
-   { 42419, 0x000084C9 }, /* GL_TEXTURE9 */
-   { 42431, 0x000084C9 }, /* GL_TEXTURE9_ARB */
-   { 42447, 0x00000DE0 }, /* GL_TEXTURE_1D */
-   { 42461, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY */
-   { 42481, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
-   { 42505, 0x00000DE1 }, /* GL_TEXTURE_2D */
-   { 42519, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY */
-   { 42539, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
-   { 42563, 0x0000806F }, /* GL_TEXTURE_3D */
-   { 42577, 0x0000806F }, /* GL_TEXTURE_3D_OES */
-   { 42595, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
-   { 42617, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
-   { 42643, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
-   { 42665, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
-   { 42687, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY */
-   { 42715, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
-   { 42747, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
-   { 42769, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY */
-   { 42797, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
-   { 42829, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
-   { 42851, 0x0000806A }, /* GL_TEXTURE_BINDING_3D_OES */
-   { 42877, 0x00008C2C }, /* GL_TEXTURE_BINDING_BUFFER */
-   { 42903, 0x00008C2C }, /* GL_TEXTURE_BINDING_BUFFER_ARB */
-   { 42933, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
-   { 42961, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
-   { 42993, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_OES */
-   { 43025, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE */
-   { 43054, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
-   { 43087, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
-   { 43119, 0x00040000 }, /* GL_TEXTURE_BIT */
-   { 43134, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
-   { 43155, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
-   { 43180, 0x00001005 }, /* GL_TEXTURE_BORDER */
-   { 43198, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
-   { 43222, 0x00008C2A }, /* GL_TEXTURE_BUFFER */
-   { 43240, 0x00008C2A }, /* GL_TEXTURE_BUFFER_ARB */
-   { 43262, 0x00008C2D }, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */
-   { 43299, 0x00008C2D }, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB */
-   { 43340, 0x00008C2E }, /* GL_TEXTURE_BUFFER_FORMAT */
-   { 43365, 0x00008C2E }, /* GL_TEXTURE_BUFFER_FORMAT_ARB */
-   { 43394, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-   { 43425, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-   { 43455, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-   { 43485, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-   { 43520, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-   { 43551, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 43589, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
-   { 43616, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-   { 43648, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
-   { 43682, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
-   { 43706, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
-   { 43734, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
-   { 43758, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
-   { 43786, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-   { 43819, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
-   { 43843, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
-   { 43865, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
-   { 43887, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
-   { 43913, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
-   { 43947, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-   { 43980, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
-   { 44017, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
-   { 44045, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
-   { 44077, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
-   { 44100, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-   { 44138, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
-   { 44180, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-   { 44211, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-   { 44239, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-   { 44269, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-   { 44297, 0x00008B9D }, /* GL_TEXTURE_CROP_RECT_OES */
-   { 44322, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
-   { 44342, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
-   { 44366, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-   { 44397, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
-   { 44432, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES */
-   { 44467, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-   { 44498, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
-   { 44533, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES */
-   { 44568, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-   { 44599, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
-   { 44634, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES */
-   { 44669, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_OES */
-   { 44693, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-   { 44724, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
-   { 44759, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES */
-   { 44794, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-   { 44825, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
-   { 44860, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES */
-   { 44895, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-   { 44926, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
-   { 44961, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */
-   { 44996, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
-   { 45025, 0x00008071 }, /* GL_TEXTURE_DEPTH */
-   { 45042, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
-   { 45064, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
-   { 45090, 0x00002300 }, /* GL_TEXTURE_ENV */
-   { 45105, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
-   { 45126, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
-   { 45146, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
-   { 45172, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL_EXT */
-   { 45202, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
-   { 45222, 0x00002500 }, /* GL_TEXTURE_GEN_MODE_OES */
-   { 45246, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
-   { 45263, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
-   { 45280, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
-   { 45297, 0x00008D60 }, /* GL_TEXTURE_GEN_STR_OES */
-   { 45320, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
-   { 45337, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
-   { 45362, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
-   { 45384, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
-   { 45410, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
-   { 45428, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
-   { 45454, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
-   { 45480, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
-   { 45510, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
-   { 45537, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
-   { 45562, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
-   { 45582, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
-   { 45606, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-   { 45633, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-   { 45660, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-   { 45687, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
-   { 45713, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
-   { 45743, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
-   { 45765, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
-   { 45783, 0x0000898F }, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */
-   { 45823, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 45853, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-   { 45881, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-   { 45909, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-   { 45937, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
-   { 45958, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
-   { 45977, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
-   { 45999, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
-   { 46018, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
-   { 46038, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
-   { 46068, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
-   { 46099, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE */
-   { 46120, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
-   { 46145, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
-   { 46169, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
-   { 46189, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
-   { 46213, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
-   { 46233, 0x00008C3F }, /* GL_TEXTURE_SHARED_SIZE */
-   { 46256, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
-   { 46279, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
-   { 46303, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
-   { 46331, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
-   { 46361, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
-   { 46386, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-   { 46420, 0x00001000 }, /* GL_TEXTURE_WIDTH */
-   { 46437, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
-   { 46455, 0x00008072 }, /* GL_TEXTURE_WRAP_R_OES */
-   { 46477, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
-   { 46495, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
-   { 46513, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
-   { 46532, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
-   { 46552, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
-   { 46571, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-   { 46600, 0x00001000 }, /* GL_TRANSFORM_BIT */
-   { 46617, 0x00008E22 }, /* GL_TRANSFORM_FEEDBACK */
-   { 46639, 0x00008E25 }, /* GL_TRANSFORM_FEEDBACK_BINDING */
-   { 46669, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER */
-   { 46698, 0x00008E24 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
-   { 46734, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */
-   { 46771, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */
-   { 46812, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */
-   { 46845, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */
-   { 46879, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */
-   { 46917, 0x00008E23 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
-   { 46953, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */
-   { 46987, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */
-   { 47025, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */
-   { 47060, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */
-   { 47099, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */
-   { 47140, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */
-   { 47185, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS */
-   { 47216, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */
-   { 47251, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */
-   { 47292, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */
-   { 47337, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
-   { 47363, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
-   { 47393, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-   { 47425, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-   { 47455, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
-   { 47489, 0x0000862C }, /* GL_TRANSPOSE_NV */
-   { 47505, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-   { 47536, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
-   { 47571, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-   { 47599, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
-   { 47631, 0x00000004 }, /* GL_TRIANGLES */
-   { 47644, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY */
-   { 47667, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY_ARB */
-   { 47694, 0x00000006 }, /* GL_TRIANGLE_FAN */
-   { 47710, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
-   { 47731, 0x00000005 }, /* GL_TRIANGLE_STRIP */
-   { 47749, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY */
-   { 47777, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY_ARB */
-   { 47809, 0x00000001 }, /* GL_TRUE */
-   { 47817, 0x00008A1C }, /* GL_UNDEFINED_APPLE */
-   { 47836, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
-   { 47856, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
-   { 47879, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
-   { 47899, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
-   { 47920, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
-   { 47942, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
-   { 47964, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
-   { 47984, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
-   { 48005, 0x00009118 }, /* GL_UNSIGNALED */
-   { 48019, 0x00001401 }, /* GL_UNSIGNED_BYTE */
-   { 48036, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-   { 48063, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
-   { 48086, 0x00001405 }, /* GL_UNSIGNED_INT */
-   { 48102, 0x00008C3B }, /* GL_UNSIGNED_INT_10F_11F_11F_REV */
-   { 48134, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
-   { 48161, 0x00008DF6 }, /* GL_UNSIGNED_INT_10_10_10_2_OES */
-   { 48192, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
-   { 48213, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
-   { 48238, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
-   { 48262, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_OES */
-   { 48287, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-   { 48318, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV_EXT */
-   { 48353, 0x00008C3E }, /* GL_UNSIGNED_INT_5_9_9_9_REV */
-   { 48381, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
-   { 48405, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-   { 48433, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D */
-   { 48460, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */
-   { 48493, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT */
-   { 48530, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D_EXT */
-   { 48561, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D */
-   { 48588, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */
-   { 48621, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT */
-   { 48658, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D_EXT */
-   { 48689, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */
-   { 48721, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT */
-   { 48757, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D */
-   { 48784, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D_EXT */
-   { 48815, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */
-   { 48846, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT */
-   { 48881, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE */
-   { 48910, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE_EXT */
-   { 48943, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2 */
-   { 48964, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2_EXT */
-   { 48989, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3 */
-   { 49010, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3_EXT */
-   { 49035, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4 */
-   { 49056, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4_EXT */
-   { 49081, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
-   { 49104, 0x00001403 }, /* GL_UNSIGNED_SHORT */
-   { 49122, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-   { 49152, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT */
-   { 49186, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-   { 49212, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-   { 49242, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT */
-   { 49276, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-   { 49302, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
-   { 49326, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-   { 49354, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-   { 49382, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
-   { 49409, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-   { 49441, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
-   { 49472, 0x00008CA2 }, /* GL_UPPER_LEFT */
-   { 49486, 0x00002A20 }, /* GL_V2F */
-   { 49493, 0x00002A21 }, /* GL_V3F */
-   { 49500, 0x00008B83 }, /* GL_VALIDATE_STATUS */
-   { 49519, 0x00001F00 }, /* GL_VENDOR */
-   { 49529, 0x00001F02 }, /* GL_VERSION */
-   { 49540, 0x00008074 }, /* GL_VERTEX_ARRAY */
-   { 49556, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
-   { 49580, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
-   { 49610, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-   { 49641, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
-   { 49676, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
-   { 49700, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
-   { 49721, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
-   { 49744, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
-   { 49765, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-   { 49792, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-   { 49820, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-   { 49848, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-   { 49876, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-   { 49904, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-   { 49932, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-   { 49960, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-   { 49987, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-   { 50014, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-   { 50041, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-   { 50068, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-   { 50095, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-   { 50122, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-   { 50149, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-   { 50176, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-   { 50203, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-   { 50241, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
-   { 50283, 0x000088FE }, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */
-   { 50318, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-   { 50349, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
-   { 50384, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */
-   { 50415, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT */
-   { 50450, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-   { 50484, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
-   { 50522, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-   { 50553, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
-   { 50588, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-   { 50616, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
-   { 50648, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-   { 50678, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
-   { 50712, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
-   { 50740, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
-   { 50772, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
-   { 50792, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
-   { 50814, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
-   { 50843, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
-   { 50864, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
-   { 50893, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
-   { 50926, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
-   { 50958, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-   { 50985, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
-   { 51016, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
-   { 51046, 0x00008B31 }, /* GL_VERTEX_SHADER */
-   { 51063, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
-   { 51084, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
-   { 51111, 0x00000BA2 }, /* GL_VIEWPORT */
-   { 51123, 0x00000800 }, /* GL_VIEWPORT_BIT */
-   { 51139, 0x00008A1A }, /* GL_VOLATILE_APPLE */
-   { 51157, 0x0000911D }, /* GL_WAIT_FAILED */
-   { 51172, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
-   { 51192, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-   { 51223, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
-   { 51258, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_OES */
-   { 51293, 0x000086AD }, /* GL_WEIGHT_ARRAY_OES */
-   { 51313, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-   { 51341, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_OES */
-   { 51369, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-   { 51394, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_OES */
-   { 51419, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-   { 51446, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_OES */
-   { 51473, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-   { 51498, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_OES */
-   { 51523, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
-   { 51547, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
-   { 51566, 0x000088B9 }, /* GL_WRITE_ONLY */
-   { 51580, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
-   { 51598, 0x000088B9 }, /* GL_WRITE_ONLY_OES */
-   { 51616, 0x00001506 }, /* GL_XOR */
-   { 51623, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
-   { 51642, 0x00008757 }, /* GL_YCBCR_MESA */
-   { 51656, 0x00000000 }, /* GL_ZERO */
-   { 51664, 0x00000D16 }, /* GL_ZOOM_X */
-   { 51674, 0x00000D17 }, /* GL_ZOOM_Y */
+   {  6691, 0x00000004 }, /* GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB */
+   {  6729, 0x00009126 }, /* GL_CONTEXT_PROFILE_MASK */
+   {  6753, 0x00008010 }, /* GL_CONVOLUTION_1D */
+   {  6771, 0x00008011 }, /* GL_CONVOLUTION_2D */
+   {  6789, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */
+   {  6817, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */
+   {  6848, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */
+   {  6875, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */
+   {  6906, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */
+   {  6933, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */
+   {  6964, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */
+   {  6992, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */
+   {  7024, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */
+   {  7046, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */
+   {  7072, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */
+   {  7094, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */
+   {  7120, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */
+   {  7141, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */
+   {  7166, 0x00008862 }, /* GL_COORD_REPLACE */
+   {  7183, 0x00008862 }, /* GL_COORD_REPLACE_ARB */
+   {  7204, 0x00008862 }, /* GL_COORD_REPLACE_NV */
+   {  7224, 0x00008862 }, /* GL_COORD_REPLACE_OES */
+   {  7245, 0x00001503 }, /* GL_COPY */
+   {  7253, 0x0000150C }, /* GL_COPY_INVERTED */
+   {  7270, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */
+   {  7290, 0x00008F36 }, /* GL_COPY_READ_BUFFER */
+   {  7310, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */
+   {  7331, 0x00000B44 }, /* GL_CULL_FACE */
+   {  7344, 0x00000B45 }, /* GL_CULL_FACE_MODE */
+   {  7362, 0x000081AA }, /* GL_CULL_VERTEX_EXT */
+   {  7381, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
+   {  7413, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
+   {  7448, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */
+   {  7469, 0x00000001 }, /* GL_CURRENT_BIT */
+   {  7484, 0x00000B00 }, /* GL_CURRENT_COLOR */
+   {  7501, 0x00008453 }, /* GL_CURRENT_FOG_COORD */
+   {  7522, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */
+   {  7548, 0x00000B01 }, /* GL_CURRENT_INDEX */
+   {  7565, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */
+   {  7587, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */
+   {  7615, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */
+   {  7636, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
+   {  7670, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */
+   {  7703, 0x00000B02 }, /* GL_CURRENT_NORMAL */
+   {  7721, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */
+   {  7751, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_OES */
+   {  7781, 0x00008B8D }, /* GL_CURRENT_PROGRAM */
+   {  7800, 0x00008865 }, /* GL_CURRENT_QUERY */
+   {  7817, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */
+   {  7838, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */
+   {  7862, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */
+   {  7889, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */
+   {  7913, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */
+   {  7940, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */
+   {  7973, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
+   {  8007, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
+   {  8040, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */
+   {  8067, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */
+   {  8093, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */
+   {  8118, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */
+   {  8147, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */
+   {  8169, 0x00000900 }, /* GL_CW */
+   {  8175, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */
+   {  8196, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */
+   {  8217, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */
+   {  8237, 0x00002101 }, /* GL_DECAL */
+   {  8246, 0x00001E03 }, /* GL_DECR */
+   {  8254, 0x00008508 }, /* GL_DECR_WRAP */
+   {  8267, 0x00008508 }, /* GL_DECR_WRAP_EXT */
+   {  8284, 0x00008B80 }, /* GL_DELETE_STATUS */
+   {  8301, 0x00001801 }, /* GL_DEPTH */
+   {  8310, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
+   {  8330, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */
+   {  8354, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_OES */
+   {  8378, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
+   {  8398, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
+   {  8422, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_OES */
+   {  8446, 0x00000D1F }, /* GL_DEPTH_BIAS */
+   {  8460, 0x00000D56 }, /* GL_DEPTH_BITS */
+   {  8474, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
+   {  8494, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
+   {  8519, 0x00008223 }, /* GL_DEPTH_BUFFER */
+   {  8535, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
+   {  8555, 0x0000864F }, /* GL_DEPTH_CLAMP */
+   {  8570, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
+   {  8588, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
+   {  8609, 0x00001902 }, /* GL_DEPTH_COMPONENT */
+   {  8628, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
+   {  8649, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
+   {  8674, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_OES */
+   {  8699, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
+   {  8725, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
+   {  8746, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
+   {  8771, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_OES */
+   {  8796, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
+   {  8822, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
+   {  8843, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
+   {  8868, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_OES */
+   {  8893, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
+   {  8919, 0x00000B74 }, /* GL_DEPTH_FUNC */
+   {  8933, 0x00000B70 }, /* GL_DEPTH_RANGE */
+   {  8948, 0x00000D1E }, /* GL_DEPTH_SCALE */
+   {  8963, 0x000084F9 }, /* GL_DEPTH_STENCIL */
+   {  8980, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
+   {  9008, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */
+   {  9029, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
+   {  9049, 0x000084F9 }, /* GL_DEPTH_STENCIL_OES */
+   {  9070, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+   {  9098, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+   {  9126, 0x00000B71 }, /* GL_DEPTH_TEST */
+   {  9140, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
+   {  9162, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
+   {  9188, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
+   {  9207, 0x00001201 }, /* GL_DIFFUSE */
+   {  9218, 0x00000BD0 }, /* GL_DITHER */
+   {  9228, 0x00000A02 }, /* GL_DOMAIN */
+   {  9238, 0x00001100 }, /* GL_DONT_CARE */
+   {  9251, 0x000086AE }, /* GL_DOT3_RGB */
+   {  9263, 0x000086AF }, /* GL_DOT3_RGBA */
+   {  9276, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
+   {  9293, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
+   {  9310, 0x000086AE }, /* GL_DOT3_RGB_ARB */
+   {  9326, 0x00008740 }, /* GL_DOT3_RGB_EXT */
+   {  9342, 0x0000140A }, /* GL_DOUBLE */
+   {  9352, 0x00000C32 }, /* GL_DOUBLEBUFFER */
+   {  9368, 0x00000C01 }, /* GL_DRAW_BUFFER */
+   {  9383, 0x00008825 }, /* GL_DRAW_BUFFER0 */
+   {  9399, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
+   {  9419, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
+   {  9439, 0x00008826 }, /* GL_DRAW_BUFFER1 */
+   {  9455, 0x0000882F }, /* GL_DRAW_BUFFER10 */
+   {  9472, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
+   {  9493, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
+   {  9514, 0x00008830 }, /* GL_DRAW_BUFFER11 */
+   {  9531, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
+   {  9552, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
+   {  9573, 0x00008831 }, /* GL_DRAW_BUFFER12 */
+   {  9590, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
+   {  9611, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
+   {  9632, 0x00008832 }, /* GL_DRAW_BUFFER13 */
+   {  9649, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
+   {  9670, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
+   {  9691, 0x00008833 }, /* GL_DRAW_BUFFER14 */
+   {  9708, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
+   {  9729, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
+   {  9750, 0x00008834 }, /* GL_DRAW_BUFFER15 */
+   {  9767, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
+   {  9788, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
+   {  9809, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
+   {  9829, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
+   {  9849, 0x00008827 }, /* GL_DRAW_BUFFER2 */
+   {  9865, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
+   {  9885, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
+   {  9905, 0x00008828 }, /* GL_DRAW_BUFFER3 */
+   {  9921, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
+   {  9941, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
+   {  9961, 0x00008829 }, /* GL_DRAW_BUFFER4 */
+   {  9977, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
+   {  9997, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
+   { 10017, 0x0000882A }, /* GL_DRAW_BUFFER5 */
+   { 10033, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
+   { 10053, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
+   { 10073, 0x0000882B }, /* GL_DRAW_BUFFER6 */
+   { 10089, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
+   { 10109, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
+   { 10129, 0x0000882C }, /* GL_DRAW_BUFFER7 */
+   { 10145, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
+   { 10165, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
+   { 10185, 0x0000882D }, /* GL_DRAW_BUFFER8 */
+   { 10201, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
+   { 10221, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
+   { 10241, 0x0000882E }, /* GL_DRAW_BUFFER9 */
+   { 10257, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
+   { 10277, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
+   { 10297, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
+   { 10317, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */
+   { 10345, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
+   { 10377, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
+   { 10401, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
+   { 10421, 0x00000304 }, /* GL_DST_ALPHA */
+   { 10434, 0x00000306 }, /* GL_DST_COLOR */
+   { 10447, 0x0000877A }, /* GL_DU8DV8_ATI */
+   { 10461, 0x00008779 }, /* GL_DUDV_ATI */
+   { 10473, 0x000088EA }, /* GL_DYNAMIC_COPY */
+   { 10489, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
+   { 10509, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
+   { 10525, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
+   { 10545, 0x000088E9 }, /* GL_DYNAMIC_READ */
+   { 10561, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
+   { 10581, 0x00000B43 }, /* GL_EDGE_FLAG */
+   { 10594, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
+   { 10613, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+   { 10647, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
+   { 10685, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
+   { 10712, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+   { 10738, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
+   { 10762, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+   { 10794, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
+   { 10830, 0x00001600 }, /* GL_EMISSION */
+   { 10842, 0x00002000 }, /* GL_ENABLE_BIT */
+   { 10856, 0x00000202 }, /* GL_EQUAL */
+   { 10865, 0x00001509 }, /* GL_EQUIV */
+   { 10874, 0x00010000 }, /* GL_EVAL_BIT */
+   { 10886, 0x00000800 }, /* GL_EXP */
+   { 10893, 0x00000801 }, /* GL_EXP2 */
+   { 10901, 0x00001F03 }, /* GL_EXTENSIONS */
+   { 10915, 0x00002400 }, /* GL_EYE_LINEAR */
+   { 10929, 0x00002502 }, /* GL_EYE_PLANE */
+   { 10942, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
+   { 10967, 0x0000855B }, /* GL_EYE_RADIAL_NV */
+   { 10984, 0x00000000 }, /* GL_FALSE */
+   { 10993, 0x00001101 }, /* GL_FASTEST */
+   { 11004, 0x00001C01 }, /* GL_FEEDBACK */
+   { 11016, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
+   { 11043, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
+   { 11067, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
+   { 11091, 0x00001B02 }, /* GL_FILL */
+   { 11099, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */
+   { 11126, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */
+   { 11157, 0x0000140C }, /* GL_FIXED */
+   { 11166, 0x0000140C }, /* GL_FIXED_OES */
+   { 11179, 0x0000891D }, /* GL_FIXED_ONLY */
+   { 11193, 0x0000891D }, /* GL_FIXED_ONLY_ARB */
+   { 11211, 0x00001D00 }, /* GL_FLAT */
+   { 11219, 0x00001406 }, /* GL_FLOAT */
+   { 11228, 0x00008B5A }, /* GL_FLOAT_MAT2 */
+   { 11242, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
+   { 11260, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
+   { 11276, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
+   { 11292, 0x00008B5B }, /* GL_FLOAT_MAT3 */
+   { 11306, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
+   { 11324, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
+   { 11340, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
+   { 11356, 0x00008B5C }, /* GL_FLOAT_MAT4 */
+   { 11370, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
+   { 11388, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
+   { 11404, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
+   { 11420, 0x00008B50 }, /* GL_FLOAT_VEC2 */
+   { 11434, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
+   { 11452, 0x00008B51 }, /* GL_FLOAT_VEC3 */
+   { 11466, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
+   { 11484, 0x00008B52 }, /* GL_FLOAT_VEC4 */
+   { 11498, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
+   { 11516, 0x00000B60 }, /* GL_FOG */
+   { 11523, 0x00000080 }, /* GL_FOG_BIT */
+   { 11534, 0x00000B66 }, /* GL_FOG_COLOR */
+   { 11547, 0x00008451 }, /* GL_FOG_COORD */
+   { 11560, 0x00008451 }, /* GL_FOG_COORDINATE */
+   { 11578, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
+   { 11602, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+   { 11641, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
+   { 11684, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+   { 11716, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+   { 11747, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+   { 11776, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
+   { 11801, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
+   { 11820, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
+   { 11854, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
+   { 11881, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
+   { 11907, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
+   { 11931, 0x00008450 }, /* GL_FOG_COORD_SRC */
+   { 11948, 0x00000B62 }, /* GL_FOG_DENSITY */
+   { 11963, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
+   { 11987, 0x00000B64 }, /* GL_FOG_END */
+   { 11998, 0x00000C54 }, /* GL_FOG_HINT */
+   { 12010, 0x00000B61 }, /* GL_FOG_INDEX */
+   { 12023, 0x00000B65 }, /* GL_FOG_MODE */
+   { 12035, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
+   { 12054, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
+   { 12079, 0x00000B63 }, /* GL_FOG_START */
+   { 12092, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
+   { 12110, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
+   { 12134, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
+   { 12153, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
+   { 12176, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+   { 12211, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES */
+   { 12250, 0x00008D40 }, /* GL_FRAMEBUFFER */
+   { 12265, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+   { 12302, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+   { 12338, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+   { 12379, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+   { 12420, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+   { 12457, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+   { 12494, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */
+   { 12528, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB */
+   { 12566, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+   { 12604, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
+   { 12646, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES */
+   { 12688, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+   { 12726, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
+   { 12768, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES */
+   { 12810, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+   { 12845, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+   { 12884, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
+   { 12933, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES */
+   { 12982, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+   { 13030, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
+   { 13082, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES */
+   { 13134, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+   { 13174, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+   { 13218, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+   { 13258, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
+   { 13302, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES */
+   { 13346, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */
+   { 13369, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
+   { 13396, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_OES */
+   { 13423, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
+   { 13447, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
+   { 13475, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_OES */
+   { 13503, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
+   { 13526, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
+   { 13545, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+   { 13582, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
+   { 13623, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES */
+   { 13664, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS */
+   { 13701, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+   { 13742, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES */
+   { 13783, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+   { 13821, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
+   { 13863, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES */
+   { 13905, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+   { 13956, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+   { 13994, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES */
+   { 14032, 0x00008DA9 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */
+   { 14074, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */
+   { 14114, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB */
+   { 14158, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+   { 14203, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
+   { 14252, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES */
+   { 14301, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+   { 14339, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */
+   { 14381, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+   { 14419, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
+   { 14461, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES */
+   { 14503, 0x00008D40 }, /* GL_FRAMEBUFFER_OES */
+   { 14522, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+   { 14554, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
+   { 14579, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
+   { 14606, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
+   { 14637, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_OES */
+   { 14668, 0x00000404 }, /* GL_FRONT */
+   { 14677, 0x00000408 }, /* GL_FRONT_AND_BACK */
+   { 14695, 0x00000B46 }, /* GL_FRONT_FACE */
+   { 14709, 0x00000400 }, /* GL_FRONT_LEFT */
+   { 14723, 0x00000401 }, /* GL_FRONT_RIGHT */
+   { 14738, 0x00008006 }, /* GL_FUNC_ADD */
+   { 14750, 0x00008006 }, /* GL_FUNC_ADD_EXT */
+   { 14766, 0x00008006 }, /* GL_FUNC_ADD_OES */
+   { 14782, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
+   { 14807, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
+   { 14836, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_OES */
+   { 14865, 0x0000800A }, /* GL_FUNC_SUBTRACT */
+   { 14882, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
+   { 14903, 0x0000800A }, /* GL_FUNC_SUBTRACT_OES */
+   { 14924, 0x00008191 }, /* GL_GENERATE_MIPMAP */
+   { 14943, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
+   { 14967, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
+   { 14996, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
+   { 15020, 0x00008917 }, /* GL_GEOMETRY_INPUT_TYPE */
+   { 15043, 0x00008DDB }, /* GL_GEOMETRY_INPUT_TYPE_ARB */
+   { 15070, 0x00008918 }, /* GL_GEOMETRY_OUTPUT_TYPE */
+   { 15094, 0x00008DDC }, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */
+   { 15122, 0x00008DD9 }, /* GL_GEOMETRY_SHADER */
+   { 15141, 0x00008DD9 }, /* GL_GEOMETRY_SHADER_ARB */
+   { 15164, 0x00008916 }, /* GL_GEOMETRY_VERTICES_OUT */
+   { 15189, 0x00008DDA }, /* GL_GEOMETRY_VERTICES_OUT_ARB */
+   { 15218, 0x00000206 }, /* GL_GEQUAL */
+   { 15228, 0x00000204 }, /* GL_GREATER */
+   { 15239, 0x00001904 }, /* GL_GREEN */
+   { 15248, 0x00000D19 }, /* GL_GREEN_BIAS */
+   { 15262, 0x00000D53 }, /* GL_GREEN_BITS */
+   { 15276, 0x00008D95 }, /* GL_GREEN_INTEGER */
+   { 15293, 0x00008D95 }, /* GL_GREEN_INTEGER_EXT */
+   { 15314, 0x00000D18 }, /* GL_GREEN_SCALE */
+   { 15329, 0x00008253 }, /* GL_GUILTY_CONTEXT_RESET_ARB */
+   { 15357, 0x0000140B }, /* GL_HALF_FLOAT */
+   { 15371, 0x00008D61 }, /* GL_HALF_FLOAT_OES */
+   { 15389, 0x00008DF2 }, /* GL_HIGH_FLOAT */
+   { 15403, 0x00008DF5 }, /* GL_HIGH_INT */
+   { 15415, 0x00008000 }, /* GL_HINT_BIT */
+   { 15427, 0x00008024 }, /* GL_HISTOGRAM */
+   { 15440, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
+   { 15464, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
+   { 15492, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
+   { 15515, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
+   { 15542, 0x00008024 }, /* GL_HISTOGRAM_EXT */
+   { 15559, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
+   { 15579, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
+   { 15603, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
+   { 15627, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
+   { 15655, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+   { 15683, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
+   { 15715, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
+   { 15737, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
+   { 15763, 0x0000802D }, /* GL_HISTOGRAM_SINK */
+   { 15781, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
+   { 15803, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
+   { 15822, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
+   { 15845, 0x0000862A }, /* GL_IDENTITY_NV */
+   { 15860, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
+   { 15880, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */
+   { 15916, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+   { 15956, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */
+   { 15990, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+   { 16028, 0x00001E02 }, /* GL_INCR */
+   { 16036, 0x00008507 }, /* GL_INCR_WRAP */
+   { 16049, 0x00008507 }, /* GL_INCR_WRAP_EXT */
+   { 16066, 0x00008222 }, /* GL_INDEX */
+   { 16075, 0x00008077 }, /* GL_INDEX_ARRAY */
+   { 16090, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+   { 16120, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
+   { 16154, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
+   { 16177, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
+   { 16199, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
+   { 16219, 0x00000D51 }, /* GL_INDEX_BITS */
+   { 16233, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
+   { 16254, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
+   { 16272, 0x00000C30 }, /* GL_INDEX_MODE */
+   { 16286, 0x00000D13 }, /* GL_INDEX_OFFSET */
+   { 16302, 0x00000D12 }, /* GL_INDEX_SHIFT */
+   { 16317, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
+   { 16336, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
+   { 16355, 0x00008254 }, /* GL_INNOCENT_CONTEXT_RESET_ARB */
+   { 16385, 0x00001404 }, /* GL_INT */
+   { 16392, 0x00008049 }, /* GL_INTENSITY */
+   { 16405, 0x0000804C }, /* GL_INTENSITY12 */
+   { 16420, 0x0000804C }, /* GL_INTENSITY12_EXT */
+   { 16439, 0x0000804D }, /* GL_INTENSITY16 */
+   { 16454, 0x00008D8B }, /* GL_INTENSITY16I_EXT */
+   { 16474, 0x00008D79 }, /* GL_INTENSITY16UI_EXT */
+   { 16495, 0x0000804D }, /* GL_INTENSITY16_EXT */
+   { 16514, 0x00008D85 }, /* GL_INTENSITY32I_EXT */
+   { 16534, 0x00008D73 }, /* GL_INTENSITY32UI_EXT */
+   { 16555, 0x0000804A }, /* GL_INTENSITY4 */
+   { 16569, 0x0000804A }, /* GL_INTENSITY4_EXT */
+   { 16587, 0x0000804B }, /* GL_INTENSITY8 */
+   { 16601, 0x00008D91 }, /* GL_INTENSITY8I_EXT */
+   { 16620, 0x00008D7F }, /* GL_INTENSITY8UI_EXT */
+   { 16640, 0x0000804B }, /* GL_INTENSITY8_EXT */
+   { 16658, 0x00008049 }, /* GL_INTENSITY_EXT */
+   { 16675, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS */
+   { 16698, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS_EXT */
+   { 16725, 0x00008575 }, /* GL_INTERPOLATE */
+   { 16740, 0x00008575 }, /* GL_INTERPOLATE_ARB */
+   { 16759, 0x00008575 }, /* GL_INTERPOLATE_EXT */
+   { 16778, 0x00008DF7 }, /* GL_INT_10_10_10_2_OES */
+   { 16800, 0x00008DC9 }, /* GL_INT_SAMPLER_1D */
+   { 16818, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY */
+   { 16842, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY_EXT */
+   { 16870, 0x00008DC9 }, /* GL_INT_SAMPLER_1D_EXT */
+   { 16892, 0x00008DCA }, /* GL_INT_SAMPLER_2D */
+   { 16910, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY */
+   { 16934, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY_EXT */
+   { 16962, 0x00008DCA }, /* GL_INT_SAMPLER_2D_EXT */
+   { 16984, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT */
+   { 17007, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT_EXT */
+   { 17034, 0x00008DCB }, /* GL_INT_SAMPLER_3D */
+   { 17052, 0x00008DCB }, /* GL_INT_SAMPLER_3D_EXT */
+   { 17074, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER */
+   { 17096, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER_EXT */
+   { 17122, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE */
+   { 17142, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE_EXT */
+   { 17166, 0x00008B53 }, /* GL_INT_VEC2 */
+   { 17178, 0x00008B53 }, /* GL_INT_VEC2_ARB */
+   { 17194, 0x00008B54 }, /* GL_INT_VEC3 */
+   { 17206, 0x00008B54 }, /* GL_INT_VEC3_ARB */
+   { 17222, 0x00008B55 }, /* GL_INT_VEC4 */
+   { 17234, 0x00008B55 }, /* GL_INT_VEC4_ARB */
+   { 17250, 0x00000500 }, /* GL_INVALID_ENUM */
+   { 17266, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+   { 17299, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
+   { 17336, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_OES */
+   { 17373, 0x00000502 }, /* GL_INVALID_OPERATION */
+   { 17394, 0x00000501 }, /* GL_INVALID_VALUE */
+   { 17411, 0x0000862B }, /* GL_INVERSE_NV */
+   { 17425, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
+   { 17449, 0x0000150A }, /* GL_INVERT */
+   { 17459, 0x00001E00 }, /* GL_KEEP */
+   { 17467, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
+   { 17493, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
+   { 17523, 0x00000406 }, /* GL_LEFT */
+   { 17531, 0x00000203 }, /* GL_LEQUAL */
+   { 17541, 0x00000201 }, /* GL_LESS */
+   { 17549, 0x00004000 }, /* GL_LIGHT0 */
+   { 17559, 0x00004001 }, /* GL_LIGHT1 */
+   { 17569, 0x00004002 }, /* GL_LIGHT2 */
+   { 17579, 0x00004003 }, /* GL_LIGHT3 */
+   { 17589, 0x00004004 }, /* GL_LIGHT4 */
+   { 17599, 0x00004005 }, /* GL_LIGHT5 */
+   { 17609, 0x00004006 }, /* GL_LIGHT6 */
+   { 17619, 0x00004007 }, /* GL_LIGHT7 */
+   { 17629, 0x00000B50 }, /* GL_LIGHTING */
+   { 17641, 0x00000040 }, /* GL_LIGHTING_BIT */
+   { 17657, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
+   { 17680, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+   { 17709, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
+   { 17742, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+   { 17770, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
+   { 17794, 0x00001B01 }, /* GL_LINE */
+   { 17802, 0x00002601 }, /* GL_LINEAR */
+   { 17812, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
+   { 17834, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+   { 17864, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+   { 17895, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
+   { 17919, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
+   { 17944, 0x00000001 }, /* GL_LINES */
+   { 17953, 0x0000000A }, /* GL_LINES_ADJACENCY */
+   { 17972, 0x0000000A }, /* GL_LINES_ADJACENCY_ARB */
+   { 17995, 0x00000004 }, /* GL_LINE_BIT */
+   { 18007, 0x00000002 }, /* GL_LINE_LOOP */
+   { 18020, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
+   { 18040, 0x00000B20 }, /* GL_LINE_SMOOTH */
+   { 18055, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
+   { 18075, 0x00000B24 }, /* GL_LINE_STIPPLE */
+   { 18091, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
+   { 18115, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
+   { 18138, 0x00000003 }, /* GL_LINE_STRIP */
+   { 18152, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY */
+   { 18176, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY_ARB */
+   { 18204, 0x00000702 }, /* GL_LINE_TOKEN */
+   { 18218, 0x00000B21 }, /* GL_LINE_WIDTH */
+   { 18232, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
+   { 18258, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
+   { 18278, 0x00008B82 }, /* GL_LINK_STATUS */
+   { 18293, 0x00000B32 }, /* GL_LIST_BASE */
+   { 18306, 0x00020000 }, /* GL_LIST_BIT */
+   { 18318, 0x00000B33 }, /* GL_LIST_INDEX */
+   { 18332, 0x00000B30 }, /* GL_LIST_MODE */
+   { 18345, 0x00000101 }, /* GL_LOAD */
+   { 18353, 0x00000BF1 }, /* GL_LOGIC_OP */
+   { 18365, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
+   { 18382, 0x00008252 }, /* GL_LOSE_CONTEXT_ON_RESET_ARB */
+   { 18411, 0x00008CA1 }, /* GL_LOWER_LEFT */
+   { 18425, 0x00008DF0 }, /* GL_LOW_FLOAT */
+   { 18438, 0x00008DF3 }, /* GL_LOW_INT */
+   { 18449, 0x00001909 }, /* GL_LUMINANCE */
+   { 18462, 0x00008041 }, /* GL_LUMINANCE12 */
+   { 18477, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
+   { 18500, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
+   { 18527, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
+   { 18549, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
+   { 18575, 0x00008041 }, /* GL_LUMINANCE12_EXT */
+   { 18594, 0x00008042 }, /* GL_LUMINANCE16 */
+   { 18609, 0x00008D8C }, /* GL_LUMINANCE16I_EXT */
+   { 18629, 0x00008D7A }, /* GL_LUMINANCE16UI_EXT */
+   { 18650, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
+   { 18673, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
+   { 18700, 0x00008042 }, /* GL_LUMINANCE16_EXT */
+   { 18719, 0x00008D86 }, /* GL_LUMINANCE32I_EXT */
+   { 18739, 0x00008D74 }, /* GL_LUMINANCE32UI_EXT */
+   { 18760, 0x0000803F }, /* GL_LUMINANCE4 */
+   { 18774, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
+   { 18795, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
+   { 18820, 0x0000803F }, /* GL_LUMINANCE4_EXT */
+   { 18838, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
+   { 18859, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
+   { 18884, 0x00008040 }, /* GL_LUMINANCE8 */
+   { 18898, 0x00008D92 }, /* GL_LUMINANCE8I_EXT */
+   { 18917, 0x00008D80 }, /* GL_LUMINANCE8UI_EXT */
+   { 18937, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
+   { 18958, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
+   { 18983, 0x00008040 }, /* GL_LUMINANCE8_EXT */
+   { 19001, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
+   { 19020, 0x00008D8D }, /* GL_LUMINANCE_ALPHA16I_EXT */
+   { 19046, 0x00008D7B }, /* GL_LUMINANCE_ALPHA16UI_EXT */
+   { 19073, 0x00008D87 }, /* GL_LUMINANCE_ALPHA32I_EXT */
+   { 19099, 0x00008D75 }, /* GL_LUMINANCE_ALPHA32UI_EXT */
+   { 19126, 0x00008D93 }, /* GL_LUMINANCE_ALPHA8I_EXT */
+   { 19151, 0x00008D81 }, /* GL_LUMINANCE_ALPHA8UI_EXT */
+   { 19177, 0x00008D9D }, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */
+   { 19208, 0x00008D9C }, /* GL_LUMINANCE_INTEGER_EXT */
+   { 19233, 0x0000821B }, /* GL_MAJOR_VERSION */
+   { 19250, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
+   { 19266, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
+   { 19286, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
+   { 19308, 0x00000D91 }, /* GL_MAP1_INDEX */
+   { 19322, 0x00000D92 }, /* GL_MAP1_NORMAL */
+   { 19337, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
+   { 19361, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
+   { 19385, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
+   { 19409, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
+   { 19433, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
+   { 19450, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
+   { 19467, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+   { 19495, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+   { 19524, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+   { 19553, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+   { 19582, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+   { 19611, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+   { 19640, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+   { 19669, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+   { 19697, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+   { 19725, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+   { 19753, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+   { 19781, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+   { 19809, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+   { 19837, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+   { 19865, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+   { 19893, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+   { 19921, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
+   { 19937, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
+   { 19957, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
+   { 19979, 0x00000DB1 }, /* GL_MAP2_INDEX */
+   { 19993, 0x00000DB2 }, /* GL_MAP2_NORMAL */
+   { 20008, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
+   { 20032, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
+   { 20056, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
+   { 20080, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
+   { 20104, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
+   { 20121, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
+   { 20138, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+   { 20166, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+   { 20195, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+   { 20224, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+   { 20253, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+   { 20282, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+   { 20311, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+   { 20340, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+   { 20368, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+   { 20396, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+   { 20424, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+   { 20452, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+   { 20480, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+   { 20508, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
+   { 20536, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+   { 20564, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+   { 20592, 0x00000D10 }, /* GL_MAP_COLOR */
+   { 20605, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
+   { 20631, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
+   { 20660, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
+   { 20688, 0x00000001 }, /* GL_MAP_READ_BIT */
+   { 20704, 0x00000D11 }, /* GL_MAP_STENCIL */
+   { 20719, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
+   { 20745, 0x00000002 }, /* GL_MAP_WRITE_BIT */
+   { 20762, 0x000088C0 }, /* GL_MATRIX0_ARB */
+   { 20777, 0x00008630 }, /* GL_MATRIX0_NV */
+   { 20791, 0x000088CA }, /* GL_MATRIX10_ARB */
+   { 20807, 0x000088CB }, /* GL_MATRIX11_ARB */
+   { 20823, 0x000088CC }, /* GL_MATRIX12_ARB */
+   { 20839, 0x000088CD }, /* GL_MATRIX13_ARB */
+   { 20855, 0x000088CE }, /* GL_MATRIX14_ARB */
+   { 20871, 0x000088CF }, /* GL_MATRIX15_ARB */
+   { 20887, 0x000088D0 }, /* GL_MATRIX16_ARB */
+   { 20903, 0x000088D1 }, /* GL_MATRIX17_ARB */
+   { 20919, 0x000088D2 }, /* GL_MATRIX18_ARB */
+   { 20935, 0x000088D3 }, /* GL_MATRIX19_ARB */
+   { 20951, 0x000088C1 }, /* GL_MATRIX1_ARB */
+   { 20966, 0x00008631 }, /* GL_MATRIX1_NV */
+   { 20980, 0x000088D4 }, /* GL_MATRIX20_ARB */
+   { 20996, 0x000088D5 }, /* GL_MATRIX21_ARB */
+   { 21012, 0x000088D6 }, /* GL_MATRIX22_ARB */
+   { 21028, 0x000088D7 }, /* GL_MATRIX23_ARB */
+   { 21044, 0x000088D8 }, /* GL_MATRIX24_ARB */
+   { 21060, 0x000088D9 }, /* GL_MATRIX25_ARB */
+   { 21076, 0x000088DA }, /* GL_MATRIX26_ARB */
+   { 21092, 0x000088DB }, /* GL_MATRIX27_ARB */
+   { 21108, 0x000088DC }, /* GL_MATRIX28_ARB */
+   { 21124, 0x000088DD }, /* GL_MATRIX29_ARB */
+   { 21140, 0x000088C2 }, /* GL_MATRIX2_ARB */
+   { 21155, 0x00008632 }, /* GL_MATRIX2_NV */
+   { 21169, 0x000088DE }, /* GL_MATRIX30_ARB */
+   { 21185, 0x000088DF }, /* GL_MATRIX31_ARB */
+   { 21201, 0x000088C3 }, /* GL_MATRIX3_ARB */
+   { 21216, 0x00008633 }, /* GL_MATRIX3_NV */
+   { 21230, 0x000088C4 }, /* GL_MATRIX4_ARB */
+   { 21245, 0x00008634 }, /* GL_MATRIX4_NV */
+   { 21259, 0x000088C5 }, /* GL_MATRIX5_ARB */
+   { 21274, 0x00008635 }, /* GL_MATRIX5_NV */
+   { 21288, 0x000088C6 }, /* GL_MATRIX6_ARB */
+   { 21303, 0x00008636 }, /* GL_MATRIX6_NV */
+   { 21317, 0x000088C7 }, /* GL_MATRIX7_ARB */
+   { 21332, 0x00008637 }, /* GL_MATRIX7_NV */
+   { 21346, 0x000088C8 }, /* GL_MATRIX8_ARB */
+   { 21361, 0x000088C9 }, /* GL_MATRIX9_ARB */
+   { 21376, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
+   { 21402, 0x00008B9E }, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */
+   { 21443, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_OES */
+   { 21469, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+   { 21503, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_OES */
+   { 21537, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+   { 21568, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_OES */
+   { 21599, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+   { 21632, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_OES */
+   { 21665, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+   { 21696, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_OES */
+   { 21727, 0x00000BA0 }, /* GL_MATRIX_MODE */
+   { 21742, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
+   { 21764, 0x00008840 }, /* GL_MATRIX_PALETTE_OES */
+   { 21786, 0x00008008 }, /* GL_MAX */
+   { 21793, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
+   { 21816, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE_OES */
+   { 21843, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS */
+   { 21871, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+   { 21903, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
+   { 21929, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+   { 21962, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+   { 21988, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 22022, 0x00000D32 }, /* GL_MAX_CLIP_DISTANCES */
+   { 22044, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
+   { 22063, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
+   { 22088, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+   { 22117, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+   { 22149, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
+   { 22185, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+   { 22221, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
+   { 22261, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
+   { 22287, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
+   { 22317, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
+   { 22342, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
+   { 22371, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+   { 22400, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
+   { 22433, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES */
+   { 22466, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
+   { 22486, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
+   { 22510, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
+   { 22534, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
+   { 22558, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
+   { 22583, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
+   { 22601, 0x00008008 }, /* GL_MAX_EXT */
+   { 22612, 0x00009125 }, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */
+   { 22645, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+   { 22680, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
+   { 22719, 0x00008DFD }, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */
+   { 22751, 0x00009123 }, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */
+   { 22784, 0x00009124 }, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */
+   { 22818, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */
+   { 22850, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB */
+   { 22886, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */
+   { 22922, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB */
+   { 22962, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */
+   { 23002, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB */
+   { 23046, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */
+   { 23081, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB */
+   { 23120, 0x00008DDD }, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */
+   { 23159, 0x00000D31 }, /* GL_MAX_LIGHTS */
+   { 23173, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
+   { 23193, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+   { 23231, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+   { 23260, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
+   { 23284, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
+   { 23312, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_OES */
+   { 23340, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
+   { 23363, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 23400, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 23436, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+   { 23463, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+   { 23492, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+   { 23526, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+   { 23562, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+   { 23589, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+   { 23621, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+   { 23657, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+   { 23686, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+   { 23715, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
+   { 23743, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+   { 23781, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 23825, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 23868, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 23902, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 23941, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 23978, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 24016, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 24059, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 24102, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+   { 24132, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+   { 24163, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET */
+   { 24191, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET_EXT */
+   { 24223, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 24259, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 24295, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
+   { 24325, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */
+   { 24355, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+   { 24389, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
+   { 24422, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
+   { 24447, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+   { 24476, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_OES */
+   { 24505, 0x00008D57 }, /* GL_MAX_SAMPLES */
+   { 24520, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
+   { 24539, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+   { 24566, 0x00008504 }, /* GL_MAX_SHININESS_NV */
+   { 24586, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
+   { 24610, 0x00008C2B }, /* GL_MAX_TEXTURE_BUFFER_SIZE */
+   { 24637, 0x00008C2B }, /* GL_MAX_TEXTURE_BUFFER_SIZE_ARB */
+   { 24668, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
+   { 24690, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
+   { 24716, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+   { 24743, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
+   { 24774, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
+   { 24798, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS_EXT */
+   { 24826, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 24860, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
+   { 24880, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
+   { 24907, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
+   { 24928, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
+   { 24953, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
+   { 24978, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
+   { 25013, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */
+   { 25062, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */
+   { 25115, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */
+   { 25158, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */
+   { 25205, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */
+   { 25251, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */
+   { 25301, 0x00008B4B }, /* GL_MAX_VARYING_COMPONENTS */
+   { 25327, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
+   { 25349, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
+   { 25375, 0x00008DFC }, /* GL_MAX_VARYING_VECTORS */
+   { 25398, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
+   { 25420, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
+   { 25446, 0x00009122 }, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */
+   { 25478, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+   { 25512, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+   { 25550, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+   { 25583, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
+   { 25620, 0x00008DFB }, /* GL_MAX_VERTEX_UNIFORM_VECTORS */
+   { 25650, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
+   { 25674, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_OES */
+   { 25698, 0x00008DDE }, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */
+   { 25735, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
+   { 25756, 0x00008DF1 }, /* GL_MEDIUM_FLOAT */
+   { 25772, 0x00008DF4 }, /* GL_MEDIUM_INT */
+   { 25786, 0x00008007 }, /* GL_MIN */
+   { 25793, 0x0000802E }, /* GL_MINMAX */
+   { 25803, 0x0000802E }, /* GL_MINMAX_EXT */
+   { 25817, 0x0000802F }, /* GL_MINMAX_FORMAT */
+   { 25834, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
+   { 25855, 0x00008030 }, /* GL_MINMAX_SINK */
+   { 25870, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
+   { 25889, 0x0000821C }, /* GL_MINOR_VERSION */
+   { 25906, 0x00008007 }, /* GL_MIN_EXT */
+   { 25917, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET */
+   { 25945, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET_EXT */
+   { 25977, 0x00008370 }, /* GL_MIRRORED_REPEAT */
+   { 25996, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
+   { 26019, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
+   { 26042, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
+   { 26062, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
+   { 26082, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+   { 26112, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
+   { 26140, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+   { 26168, 0x00001700 }, /* GL_MODELVIEW */
+   { 26181, 0x00001700 }, /* GL_MODELVIEW0_ARB */
+   { 26199, 0x0000872A }, /* GL_MODELVIEW10_ARB */
+   { 26218, 0x0000872B }, /* GL_MODELVIEW11_ARB */
+   { 26237, 0x0000872C }, /* GL_MODELVIEW12_ARB */
+   { 26256, 0x0000872D }, /* GL_MODELVIEW13_ARB */
+   { 26275, 0x0000872E }, /* GL_MODELVIEW14_ARB */
+   { 26294, 0x0000872F }, /* GL_MODELVIEW15_ARB */
+   { 26313, 0x00008730 }, /* GL_MODELVIEW16_ARB */
+   { 26332, 0x00008731 }, /* GL_MODELVIEW17_ARB */
+   { 26351, 0x00008732 }, /* GL_MODELVIEW18_ARB */
+   { 26370, 0x00008733 }, /* GL_MODELVIEW19_ARB */
+   { 26389, 0x0000850A }, /* GL_MODELVIEW1_ARB */
+   { 26407, 0x00008734 }, /* GL_MODELVIEW20_ARB */
+   { 26426, 0x00008735 }, /* GL_MODELVIEW21_ARB */
+   { 26445, 0x00008736 }, /* GL_MODELVIEW22_ARB */
+   { 26464, 0x00008737 }, /* GL_MODELVIEW23_ARB */
+   { 26483, 0x00008738 }, /* GL_MODELVIEW24_ARB */
+   { 26502, 0x00008739 }, /* GL_MODELVIEW25_ARB */
+   { 26521, 0x0000873A }, /* GL_MODELVIEW26_ARB */
+   { 26540, 0x0000873B }, /* GL_MODELVIEW27_ARB */
+   { 26559, 0x0000873C }, /* GL_MODELVIEW28_ARB */
+   { 26578, 0x0000873D }, /* GL_MODELVIEW29_ARB */
+   { 26597, 0x00008722 }, /* GL_MODELVIEW2_ARB */
+   { 26615, 0x0000873E }, /* GL_MODELVIEW30_ARB */
+   { 26634, 0x0000873F }, /* GL_MODELVIEW31_ARB */
+   { 26653, 0x00008723 }, /* GL_MODELVIEW3_ARB */
+   { 26671, 0x00008724 }, /* GL_MODELVIEW4_ARB */
+   { 26689, 0x00008725 }, /* GL_MODELVIEW5_ARB */
+   { 26707, 0x00008726 }, /* GL_MODELVIEW6_ARB */
+   { 26725, 0x00008727 }, /* GL_MODELVIEW7_ARB */
+   { 26743, 0x00008728 }, /* GL_MODELVIEW8_ARB */
+   { 26761, 0x00008729 }, /* GL_MODELVIEW9_ARB */
+   { 26779, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
+   { 26799, 0x0000898D }, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */
+   { 26841, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
+   { 26868, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
+   { 26893, 0x00002100 }, /* GL_MODULATE */
+   { 26905, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
+   { 26925, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
+   { 26952, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
+   { 26977, 0x00000103 }, /* GL_MULT */
+   { 26985, 0x0000809D }, /* GL_MULTISAMPLE */
+   { 27000, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
+   { 27020, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
+   { 27039, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
+   { 27058, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
+   { 27082, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
+   { 27105, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+   { 27135, 0x00002A25 }, /* GL_N3F_V3F */
+   { 27146, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
+   { 27166, 0x0000150E }, /* GL_NAND */
+   { 27174, 0x00002600 }, /* GL_NEAREST */
+   { 27185, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+   { 27216, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+   { 27248, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
+   { 27273, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
+   { 27299, 0x00000200 }, /* GL_NEVER */
+   { 27308, 0x00001102 }, /* GL_NICEST */
+   { 27318, 0x00000000 }, /* GL_NONE */
+   { 27326, 0x00000000 }, /* GL_NONE_OES */
+   { 27338, 0x00001505 }, /* GL_NOOP */
+   { 27346, 0x00001508 }, /* GL_NOR */
+   { 27353, 0x00000BA1 }, /* GL_NORMALIZE */
+   { 27366, 0x00008075 }, /* GL_NORMAL_ARRAY */
+   { 27382, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+   { 27413, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
+   { 27448, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
+   { 27472, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
+   { 27495, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
+   { 27516, 0x00008511 }, /* GL_NORMAL_MAP */
+   { 27530, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
+   { 27548, 0x00008511 }, /* GL_NORMAL_MAP_NV */
+   { 27565, 0x00008511 }, /* GL_NORMAL_MAP_OES */
+   { 27583, 0x00000205 }, /* GL_NOTEQUAL */
+   { 27595, 0x00000000 }, /* GL_NO_ERROR */
+   { 27607, 0x00008261 }, /* GL_NO_RESET_NOTIFICATION_ARB */
+   { 27636, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+   { 27670, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
+   { 27708, 0x0000821D }, /* GL_NUM_EXTENSIONS */
+   { 27726, 0x000087FE }, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */
+   { 27760, 0x00008DF9 }, /* GL_NUM_SHADER_BINARY_FORMATS */
+   { 27789, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
+   { 27821, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
+   { 27863, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
+   { 27893, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
+   { 27933, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
+   { 27964, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
+   { 27993, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
+   { 28021, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
+   { 28051, 0x00002401 }, /* GL_OBJECT_LINEAR */
+   { 28068, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
+   { 28094, 0x00002501 }, /* GL_OBJECT_PLANE */
+   { 28110, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
+   { 28145, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
+   { 28167, 0x00009112 }, /* GL_OBJECT_TYPE */
+   { 28182, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
+   { 28201, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
+   { 28231, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
+   { 28252, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
+   { 28280, 0x00000001 }, /* GL_ONE */
+   { 28287, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+   { 28315, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
+   { 28347, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
+   { 28375, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
+   { 28407, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
+   { 28430, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
+   { 28453, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
+   { 28476, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
+   { 28499, 0x00008598 }, /* GL_OPERAND0_ALPHA */
+   { 28517, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
+   { 28539, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
+   { 28561, 0x00008590 }, /* GL_OPERAND0_RGB */
+   { 28577, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
+   { 28597, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
+   { 28617, 0x00008599 }, /* GL_OPERAND1_ALPHA */
+   { 28635, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
+   { 28657, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
+   { 28679, 0x00008591 }, /* GL_OPERAND1_RGB */
+   { 28695, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
+   { 28715, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
+   { 28735, 0x0000859A }, /* GL_OPERAND2_ALPHA */
+   { 28753, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
+   { 28775, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
+   { 28797, 0x00008592 }, /* GL_OPERAND2_RGB */
+   { 28813, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
+   { 28833, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
+   { 28853, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
+   { 28874, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
+   { 28893, 0x00001507 }, /* GL_OR */
+   { 28899, 0x00000A01 }, /* GL_ORDER */
+   { 28908, 0x0000150D }, /* GL_OR_INVERTED */
+   { 28923, 0x0000150B }, /* GL_OR_REVERSE */
+   { 28937, 0x00000505 }, /* GL_OUT_OF_MEMORY */
+   { 28954, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
+   { 28972, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
+   { 28993, 0x00008758 }, /* GL_PACK_INVERT_MESA */
+   { 29013, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
+   { 29031, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
+   { 29050, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
+   { 29070, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
+   { 29090, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
+   { 29108, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
+   { 29127, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
+   { 29152, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
+   { 29176, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
+   { 29197, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
+   { 29219, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
+   { 29241, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
+   { 29266, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
+   { 29290, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
+   { 29311, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
+   { 29333, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
+   { 29355, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
+   { 29377, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
+   { 29408, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
+   { 29428, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+   { 29453, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
+   { 29473, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+   { 29498, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
+   { 29518, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+   { 29543, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
+   { 29563, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+   { 29588, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
+   { 29608, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+   { 29633, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
+   { 29653, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+   { 29678, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
+   { 29698, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+   { 29723, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
+   { 29743, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+   { 29768, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
+   { 29788, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+   { 29813, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
+   { 29833, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+   { 29858, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
+   { 29876, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
+   { 29897, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
+   { 29926, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
+   { 29959, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
+   { 29984, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
+   { 30007, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+   { 30038, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
+   { 30073, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
+   { 30100, 0x00001B00 }, /* GL_POINT */
+   { 30109, 0x00000000 }, /* GL_POINTS */
+   { 30119, 0x00000002 }, /* GL_POINT_BIT */
+   { 30132, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
+   { 30162, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
+   { 30196, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
+   { 30230, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
+   { 30265, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
+   { 30294, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
+   { 30327, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
+   { 30360, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
+   { 30394, 0x00000B11 }, /* GL_POINT_SIZE */
+   { 30408, 0x00008B9F }, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */
+   { 30447, 0x00008B9C }, /* GL_POINT_SIZE_ARRAY_OES */
+   { 30471, 0x0000898C }, /* GL_POINT_SIZE_ARRAY_POINTER_OES */
+   { 30503, 0x0000898B }, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */
+   { 30534, 0x0000898A }, /* GL_POINT_SIZE_ARRAY_TYPE_OES */
+   { 30563, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
+   { 30589, 0x00008127 }, /* GL_POINT_SIZE_MAX */
+   { 30607, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
+   { 30629, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
+   { 30651, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
+   { 30674, 0x00008126 }, /* GL_POINT_SIZE_MIN */
+   { 30692, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
+   { 30714, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
+   { 30736, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
+   { 30759, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
+   { 30779, 0x00000B10 }, /* GL_POINT_SMOOTH */
+   { 30795, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
+   { 30816, 0x00008861 }, /* GL_POINT_SPRITE */
+   { 30832, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
+   { 30852, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
+   { 30881, 0x00008861 }, /* GL_POINT_SPRITE_NV */
+   { 30900, 0x00008861 }, /* GL_POINT_SPRITE_OES */
+   { 30920, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
+   { 30946, 0x00000701 }, /* GL_POINT_TOKEN */
+   { 30961, 0x00000009 }, /* GL_POLYGON */
+   { 30972, 0x00000008 }, /* GL_POLYGON_BIT */
+   { 30987, 0x00000B40 }, /* GL_POLYGON_MODE */
+   { 31003, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
+   { 31026, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
+   { 31051, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
+   { 31074, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
+   { 31097, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
+   { 31121, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
+   { 31145, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
+   { 31163, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
+   { 31186, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
+   { 31205, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
+   { 31228, 0x00000703 }, /* GL_POLYGON_TOKEN */
+   { 31245, 0x00001203 }, /* GL_POSITION */
+   { 31257, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+   { 31289, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
+   { 31325, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+   { 31358, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
+   { 31395, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+   { 31426, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
+   { 31461, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+   { 31493, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
+   { 31529, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 31562, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+   { 31594, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
+   { 31630, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+   { 31663, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
+   { 31700, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+   { 31730, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
+   { 31764, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+   { 31795, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
+   { 31830, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+   { 31861, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
+   { 31896, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+   { 31928, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
+   { 31964, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+   { 31994, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
+   { 32028, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+   { 32059, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
+   { 32094, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+   { 32126, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+   { 32157, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
+   { 32192, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+   { 32224, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
+   { 32260, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
+   { 32289, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
+   { 32322, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
+   { 32352, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
+   { 32386, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+   { 32425, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+   { 32458, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+   { 32498, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+   { 32532, 0x00008578 }, /* GL_PREVIOUS */
+   { 32544, 0x00008578 }, /* GL_PREVIOUS_ARB */
+   { 32560, 0x00008578 }, /* GL_PREVIOUS_EXT */
+   { 32576, 0x00008577 }, /* GL_PRIMARY_COLOR */
+   { 32593, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
+   { 32614, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
+   { 32635, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED */
+   { 32659, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED_EXT */
+   { 32687, 0x00008F9D }, /* GL_PRIMITIVE_RESTART */
+   { 32708, 0x00008F9E }, /* GL_PRIMITIVE_RESTART_INDEX */
+   { 32735, 0x00008559 }, /* GL_PRIMITIVE_RESTART_INDEX_NV */
+   { 32765, 0x00008558 }, /* GL_PRIMITIVE_RESTART_NV */
+   { 32789, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 32822, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 32854, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
+   { 32877, 0x000087FF }, /* GL_PROGRAM_BINARY_FORMATS_OES */
+   { 32907, 0x00008741 }, /* GL_PROGRAM_BINARY_LENGTH_OES */
+   { 32936, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
+   { 32959, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
+   { 32989, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
+   { 33018, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
+   { 33046, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
+   { 33068, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+   { 33096, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+   { 33124, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
+   { 33146, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
+   { 33167, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 33207, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 33246, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 33276, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 33311, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 33344, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 33378, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 33417, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 33456, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
+   { 33478, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
+   { 33504, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
+   { 33528, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE */
+   { 33550, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE_ARB */
+   { 33576, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
+   { 33599, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
+   { 33621, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
+   { 33642, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
+   { 33663, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
+   { 33690, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 33722, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 33754, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+   { 33789, 0x00001701 }, /* GL_PROJECTION */
+   { 33803, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
+   { 33824, 0x0000898E }, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */
+   { 33867, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
+   { 33893, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
+   { 33913, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
+   { 33937, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
+   { 33958, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
+   { 33977, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
+   { 34000, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 34039, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+   { 34077, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
+   { 34097, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY */
+   { 34123, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+   { 34153, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
+   { 34177, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
+   { 34197, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY */
+   { 34223, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+   { 34253, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
+   { 34277, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
+   { 34297, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+   { 34330, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
+   { 34356, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
+   { 34386, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE */
+   { 34413, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+   { 34444, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
+   { 34474, 0x00008A1D }, /* GL_PURGEABLE_APPLE */
+   { 34493, 0x00002003 }, /* GL_Q */
+   { 34498, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
+   { 34523, 0x00000007 }, /* GL_QUADS */
+   { 34532, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+   { 34576, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
+   { 34624, 0x00008614 }, /* GL_QUAD_MESH_SUN */
+   { 34641, 0x00000008 }, /* GL_QUAD_STRIP */
+   { 34655, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT */
+   { 34682, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
+   { 34712, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT */
+   { 34736, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */
+   { 34763, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
+   { 34785, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
+   { 34811, 0x00008E14 }, /* GL_QUERY_NO_WAIT */
+   { 34828, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */
+   { 34848, 0x00008866 }, /* GL_QUERY_RESULT */
+   { 34864, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
+   { 34884, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
+   { 34910, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
+   { 34940, 0x00008E13 }, /* GL_QUERY_WAIT */
+   { 34954, 0x00008E13 }, /* GL_QUERY_WAIT_NV */
+   { 34971, 0x00002002 }, /* GL_R */
+   { 34976, 0x00008C3A }, /* GL_R11F_G11F_B10F */
+   { 34994, 0x00008F98 }, /* GL_R16_SNORM */
+   { 35007, 0x00002A10 }, /* GL_R3_G3_B2 */
+   { 35019, 0x00008F94 }, /* GL_R8_SNORM */
+   { 35031, 0x00008C89 }, /* GL_RASTERIZER_DISCARD */
+   { 35053, 0x00008C89 }, /* GL_RASTERIZER_DISCARD_EXT */
+   { 35079, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+   { 35112, 0x00000C02 }, /* GL_READ_BUFFER */
+   { 35127, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
+   { 35147, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
+   { 35175, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+   { 35207, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
+   { 35231, 0x000088B8 }, /* GL_READ_ONLY */
+   { 35244, 0x000088B8 }, /* GL_READ_ONLY_ARB */
+   { 35261, 0x000088BA }, /* GL_READ_WRITE */
+   { 35275, 0x000088BA }, /* GL_READ_WRITE_ARB */
+   { 35293, 0x00001903 }, /* GL_RED */
+   { 35300, 0x00008016 }, /* GL_REDUCE */
+   { 35310, 0x00008016 }, /* GL_REDUCE_EXT */
+   { 35324, 0x00000D15 }, /* GL_RED_BIAS */
+   { 35336, 0x00000D52 }, /* GL_RED_BITS */
+   { 35348, 0x00008D94 }, /* GL_RED_INTEGER */
+   { 35363, 0x00008D94 }, /* GL_RED_INTEGER_EXT */
+   { 35382, 0x00000D14 }, /* GL_RED_SCALE */
+   { 35395, 0x00008F90 }, /* GL_RED_SNORM */
+   { 35408, 0x00008512 }, /* GL_REFLECTION_MAP */
+   { 35426, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
+   { 35448, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
+   { 35469, 0x00008512 }, /* GL_REFLECTION_MAP_OES */
+   { 35491, 0x00008A19 }, /* GL_RELEASED_APPLE */
+   { 35509, 0x00001C00 }, /* GL_RENDER */
+   { 35519, 0x00008D41 }, /* GL_RENDERBUFFER */
+   { 35535, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
+   { 35562, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE_OES */
+   { 35593, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
+   { 35617, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
+   { 35645, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_OES */
+   { 35673, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
+   { 35699, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE_OES */
+   { 35729, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
+   { 35756, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE_OES */
+   { 35787, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
+   { 35807, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
+   { 35834, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE_OES */
+   { 35865, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
+   { 35888, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
+   { 35915, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_OES */
+   { 35942, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+   { 35974, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
+   { 36010, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_OES */
+   { 36046, 0x00008D41 }, /* GL_RENDERBUFFER_OES */
+   { 36066, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
+   { 36091, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE_OES */
+   { 36120, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
+   { 36144, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
+   { 36172, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
+   { 36201, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE_OES */
+   { 36234, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
+   { 36256, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
+   { 36282, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_OES */
+   { 36308, 0x00001F01 }, /* GL_RENDERER */
+   { 36320, 0x00000C40 }, /* GL_RENDER_MODE */
+   { 36335, 0x00002901 }, /* GL_REPEAT */
+   { 36345, 0x00001E01 }, /* GL_REPLACE */
+   { 36356, 0x00008062 }, /* GL_REPLACE_EXT */
+   { 36371, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
+   { 36394, 0x0000803A }, /* GL_RESCALE_NORMAL */
+   { 36412, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
+   { 36434, 0x00008256 }, /* GL_RESET_NOTIFICATION_STRATEGY_ARB */
+   { 36469, 0x00008A1B }, /* GL_RETAINED_APPLE */
+   { 36487, 0x00000102 }, /* GL_RETURN */
+   { 36497, 0x00008F99 }, /* GL_RG16_SNORM */
+   { 36511, 0x00008F95 }, /* GL_RG8_SNORM */
+   { 36524, 0x00001907 }, /* GL_RGB */
+   { 36531, 0x00008052 }, /* GL_RGB10 */
+   { 36540, 0x00008059 }, /* GL_RGB10_A2 */
+   { 36552, 0x00008059 }, /* GL_RGB10_A2_EXT */
+   { 36568, 0x00008052 }, /* GL_RGB10_EXT */
+   { 36581, 0x00008053 }, /* GL_RGB12 */
+   { 36590, 0x00008053 }, /* GL_RGB12_EXT */
+   { 36603, 0x00008054 }, /* GL_RGB16 */
+   { 36612, 0x0000881B }, /* GL_RGB16F */
+   { 36622, 0x00008D89 }, /* GL_RGB16I */
+   { 36632, 0x00008D89 }, /* GL_RGB16I_EXT */
+   { 36646, 0x00008D77 }, /* GL_RGB16UI */
+   { 36657, 0x00008D77 }, /* GL_RGB16UI_EXT */
+   { 36672, 0x00008054 }, /* GL_RGB16_EXT */
+   { 36685, 0x00008F9A }, /* GL_RGB16_SNORM */
+   { 36700, 0x0000804E }, /* GL_RGB2_EXT */
+   { 36712, 0x00008815 }, /* GL_RGB32F */
+   { 36722, 0x00008D83 }, /* GL_RGB32I */
+   { 36732, 0x00008D83 }, /* GL_RGB32I_EXT */
+   { 36746, 0x00008D71 }, /* GL_RGB32UI */
+   { 36757, 0x00008D71 }, /* GL_RGB32UI_EXT */
+   { 36772, 0x0000804F }, /* GL_RGB4 */
+   { 36780, 0x0000804F }, /* GL_RGB4_EXT */
+   { 36792, 0x000083A1 }, /* GL_RGB4_S3TC */
+   { 36805, 0x00008050 }, /* GL_RGB5 */
+   { 36813, 0x00008D62 }, /* GL_RGB565 */
+   { 36823, 0x00008D62 }, /* GL_RGB565_OES */
+   { 36837, 0x00008057 }, /* GL_RGB5_A1 */
+   { 36848, 0x00008057 }, /* GL_RGB5_A1_EXT */
+   { 36863, 0x00008057 }, /* GL_RGB5_A1_OES */
+   { 36878, 0x00008050 }, /* GL_RGB5_EXT */
+   { 36890, 0x00008051 }, /* GL_RGB8 */
+   { 36898, 0x00008D8F }, /* GL_RGB8I */
+   { 36907, 0x00008D8F }, /* GL_RGB8I_EXT */
+   { 36920, 0x00008D7D }, /* GL_RGB8UI */
+   { 36930, 0x00008D7D }, /* GL_RGB8UI_EXT */
+   { 36944, 0x00008051 }, /* GL_RGB8_EXT */
+   { 36956, 0x00008051 }, /* GL_RGB8_OES */
+   { 36968, 0x00008F96 }, /* GL_RGB8_SNORM */
+   { 36982, 0x00008C3D }, /* GL_RGB9_E5 */
+   { 36993, 0x00001908 }, /* GL_RGBA */
+   { 37001, 0x0000805A }, /* GL_RGBA12 */
+   { 37011, 0x0000805A }, /* GL_RGBA12_EXT */
+   { 37025, 0x0000805B }, /* GL_RGBA16 */
+   { 37035, 0x0000881A }, /* GL_RGBA16F */
+   { 37046, 0x00008D88 }, /* GL_RGBA16I */
+   { 37057, 0x00008D88 }, /* GL_RGBA16I_EXT */
+   { 37072, 0x00008D76 }, /* GL_RGBA16UI */
+   { 37084, 0x00008D76 }, /* GL_RGBA16UI_EXT */
+   { 37100, 0x0000805B }, /* GL_RGBA16_EXT */
+   { 37114, 0x00008F9B }, /* GL_RGBA16_SNORM */
+   { 37130, 0x00008055 }, /* GL_RGBA2 */
+   { 37139, 0x00008055 }, /* GL_RGBA2_EXT */
+   { 37152, 0x00008814 }, /* GL_RGBA32F */
+   { 37163, 0x00008D82 }, /* GL_RGBA32I */
+   { 37174, 0x00008D82 }, /* GL_RGBA32I_EXT */
+   { 37189, 0x00008D70 }, /* GL_RGBA32UI */
+   { 37201, 0x00008D70 }, /* GL_RGBA32UI_EXT */
+   { 37217, 0x00008056 }, /* GL_RGBA4 */
+   { 37226, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
+   { 37245, 0x00008056 }, /* GL_RGBA4_EXT */
+   { 37258, 0x00008056 }, /* GL_RGBA4_OES */
+   { 37271, 0x000083A3 }, /* GL_RGBA4_S3TC */
+   { 37285, 0x00008058 }, /* GL_RGBA8 */
+   { 37294, 0x00008D8E }, /* GL_RGBA8I */
+   { 37304, 0x00008D8E }, /* GL_RGBA8I_EXT */
+   { 37318, 0x00008D7C }, /* GL_RGBA8UI */
+   { 37329, 0x00008D7C }, /* GL_RGBA8UI_EXT */
+   { 37344, 0x00008058 }, /* GL_RGBA8_EXT */
+   { 37357, 0x00008058 }, /* GL_RGBA8_OES */
+   { 37370, 0x00008F97 }, /* GL_RGBA8_SNORM */
+   { 37385, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
+   { 37403, 0x00008820 }, /* GL_RGBA_FLOAT_MODE_ARB */
+   { 37426, 0x00008D99 }, /* GL_RGBA_INTEGER */
+   { 37442, 0x00008D99 }, /* GL_RGBA_INTEGER_EXT */
+   { 37462, 0x00008D9E }, /* GL_RGBA_INTEGER_MODE_EXT */
+   { 37487, 0x00000C31 }, /* GL_RGBA_MODE */
+   { 37500, 0x000083A2 }, /* GL_RGBA_S3TC */
+   { 37513, 0x00008F93 }, /* GL_RGBA_SNORM */
+   { 37527, 0x00008D98 }, /* GL_RGB_INTEGER */
+   { 37542, 0x00008D98 }, /* GL_RGB_INTEGER_EXT */
+   { 37561, 0x000083A0 }, /* GL_RGB_S3TC */
+   { 37573, 0x00008573 }, /* GL_RGB_SCALE */
+   { 37586, 0x00008573 }, /* GL_RGB_SCALE_ARB */
+   { 37603, 0x00008573 }, /* GL_RGB_SCALE_EXT */
+   { 37620, 0x00008F92 }, /* GL_RGB_SNORM */
+   { 37633, 0x00008F91 }, /* GL_RG_SNORM */
+   { 37645, 0x00000407 }, /* GL_RIGHT */
+   { 37654, 0x00002000 }, /* GL_S */
+   { 37659, 0x00008B5D }, /* GL_SAMPLER_1D */
+   { 37673, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY */
+   { 37693, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY_EXT */
+   { 37717, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW */
+   { 37744, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW_EXT */
+   { 37775, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
+   { 37796, 0x00008B5E }, /* GL_SAMPLER_2D */
+   { 37810, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY */
+   { 37830, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY_EXT */
+   { 37854, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW */
+   { 37881, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW_EXT */
+   { 37912, 0x00008B63 }, /* GL_SAMPLER_2D_RECT */
+   { 37931, 0x00008B64 }, /* GL_SAMPLER_2D_RECT_SHADOW */
+   { 37957, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
+   { 37978, 0x00008B5F }, /* GL_SAMPLER_3D */
+   { 37992, 0x00008B5F }, /* GL_SAMPLER_3D_OES */
+   { 38010, 0x00008919 }, /* GL_SAMPLER_BINDING */
+   { 38029, 0x00008DC2 }, /* GL_SAMPLER_BUFFER */
+   { 38047, 0x00008DC2 }, /* GL_SAMPLER_BUFFER_EXT */
+   { 38069, 0x00008B60 }, /* GL_SAMPLER_CUBE */
+   { 38085, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW */
+   { 38108, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW_EXT */
+   { 38135, 0x000080A9 }, /* GL_SAMPLES */
+   { 38146, 0x000086B4 }, /* GL_SAMPLES_3DFX */
+   { 38162, 0x000080A9 }, /* GL_SAMPLES_ARB */
+   { 38177, 0x00008914 }, /* GL_SAMPLES_PASSED */
+   { 38195, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
+   { 38217, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+   { 38245, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
+   { 38277, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
+   { 38300, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
+   { 38327, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
+   { 38345, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
+   { 38368, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
+   { 38390, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
+   { 38409, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
+   { 38432, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
+   { 38458, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
+   { 38488, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
+   { 38513, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
+   { 38542, 0x00080000 }, /* GL_SCISSOR_BIT */
+   { 38557, 0x00000C10 }, /* GL_SCISSOR_BOX */
+   { 38572, 0x00000C11 }, /* GL_SCISSOR_TEST */
+   { 38588, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
+   { 38613, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+   { 38653, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
+   { 38697, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+   { 38730, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+   { 38760, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+   { 38792, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+   { 38822, 0x00001C02 }, /* GL_SELECT */
+   { 38832, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
+   { 38860, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
+   { 38885, 0x00008012 }, /* GL_SEPARABLE_2D */
+   { 38901, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS */
+   { 38921, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS_EXT */
+   { 38945, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
+   { 38972, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
+   { 39003, 0x0000150F }, /* GL_SET */
+   { 39010, 0x00008DF8 }, /* GL_SHADER_BINARY_FORMATS */
+   { 39035, 0x00008DFA }, /* GL_SHADER_COMPILER */
+   { 39054, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
+   { 39075, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
+   { 39099, 0x00008B4F }, /* GL_SHADER_TYPE */
+   { 39114, 0x00000B54 }, /* GL_SHADE_MODEL */
+   { 39129, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
+   { 39157, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
+   { 39180, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+   { 39210, 0x00001601 }, /* GL_SHININESS */
+   { 39223, 0x00001402 }, /* GL_SHORT */
+   { 39232, 0x00009119 }, /* GL_SIGNALED */
+   { 39244, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
+   { 39265, 0x000081F9 }, /* GL_SINGLE_COLOR */
+   { 39281, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
+   { 39301, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
+   { 39320, 0x00008C46 }, /* GL_SLUMINANCE */
+   { 39334, 0x00008C47 }, /* GL_SLUMINANCE8 */
+   { 39349, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
+   { 39371, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
+   { 39391, 0x00001D01 }, /* GL_SMOOTH */
+   { 39401, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
+   { 39434, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
+   { 39461, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
+   { 39494, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
+   { 39521, 0x00008588 }, /* GL_SOURCE0_ALPHA */
+   { 39538, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
+   { 39559, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
+   { 39580, 0x00008580 }, /* GL_SOURCE0_RGB */
+   { 39595, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
+   { 39614, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
+   { 39633, 0x00008589 }, /* GL_SOURCE1_ALPHA */
+   { 39650, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
+   { 39671, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
+   { 39692, 0x00008581 }, /* GL_SOURCE1_RGB */
+   { 39707, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
+   { 39726, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
+   { 39745, 0x0000858A }, /* GL_SOURCE2_ALPHA */
+   { 39762, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
+   { 39783, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
+   { 39804, 0x00008582 }, /* GL_SOURCE2_RGB */
+   { 39819, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
+   { 39838, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
+   { 39857, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
+   { 39877, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
+   { 39895, 0x00001202 }, /* GL_SPECULAR */
+   { 39907, 0x00002402 }, /* GL_SPHERE_MAP */
+   { 39921, 0x00001206 }, /* GL_SPOT_CUTOFF */
+   { 39936, 0x00001204 }, /* GL_SPOT_DIRECTION */
+   { 39954, 0x00001205 }, /* GL_SPOT_EXPONENT */
+   { 39971, 0x00008588 }, /* GL_SRC0_ALPHA */
+   { 39985, 0x00008580 }, /* GL_SRC0_RGB */
+   { 39997, 0x00008589 }, /* GL_SRC1_ALPHA */
+   { 40011, 0x00008581 }, /* GL_SRC1_RGB */
+   { 40023, 0x0000858A }, /* GL_SRC2_ALPHA */
+   { 40037, 0x00008582 }, /* GL_SRC2_RGB */
+   { 40049, 0x00000302 }, /* GL_SRC_ALPHA */
+   { 40062, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
+   { 40084, 0x00000300 }, /* GL_SRC_COLOR */
+   { 40097, 0x00008C40 }, /* GL_SRGB */
+   { 40105, 0x00008C41 }, /* GL_SRGB8 */
+   { 40114, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
+   { 40130, 0x00008C42 }, /* GL_SRGB_ALPHA */
+   { 40144, 0x00000503 }, /* GL_STACK_OVERFLOW */
+   { 40162, 0x00000504 }, /* GL_STACK_UNDERFLOW */
+   { 40181, 0x000088E6 }, /* GL_STATIC_COPY */
+   { 40196, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
+   { 40215, 0x000088E4 }, /* GL_STATIC_DRAW */
+   { 40230, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
+   { 40249, 0x000088E5 }, /* GL_STATIC_READ */
+   { 40264, 0x000088E5 }, /* GL_STATIC_READ_ARB */
+   { 40283, 0x00001802 }, /* GL_STENCIL */
+   { 40294, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
+   { 40316, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
+   { 40342, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_OES */
+   { 40368, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
+   { 40389, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
+   { 40414, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
+   { 40435, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
+   { 40460, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+   { 40492, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
+   { 40528, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+   { 40560, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
+   { 40596, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
+   { 40616, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
+   { 40643, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
+   { 40669, 0x00000D57 }, /* GL_STENCIL_BITS */
+   { 40685, 0x00008224 }, /* GL_STENCIL_BUFFER */
+   { 40703, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
+   { 40725, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
+   { 40748, 0x00000B94 }, /* GL_STENCIL_FAIL */
+   { 40764, 0x00000B92 }, /* GL_STENCIL_FUNC */
+   { 40780, 0x00001901 }, /* GL_STENCIL_INDEX */
+   { 40797, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
+   { 40815, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
+   { 40834, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
+   { 40857, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
+   { 40879, 0x00008D46 }, /* GL_STENCIL_INDEX1_OES */
+   { 40901, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
+   { 40919, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
+   { 40941, 0x00008D47 }, /* GL_STENCIL_INDEX4_OES */
+   { 40963, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
+   { 40981, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
+   { 41003, 0x00008D48 }, /* GL_STENCIL_INDEX8_OES */
+   { 41025, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
+   { 41046, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
+   { 41073, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
+   { 41100, 0x00000B97 }, /* GL_STENCIL_REF */
+   { 41115, 0x00000B90 }, /* GL_STENCIL_TEST */
+   { 41131, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+   { 41160, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
+   { 41182, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
+   { 41203, 0x00000C33 }, /* GL_STEREO */
+   { 41213, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
+   { 41237, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
+   { 41262, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
+   { 41286, 0x000088E2 }, /* GL_STREAM_COPY */
+   { 41301, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
+   { 41320, 0x000088E0 }, /* GL_STREAM_DRAW */
+   { 41335, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
+   { 41354, 0x000088E1 }, /* GL_STREAM_READ */
+   { 41369, 0x000088E1 }, /* GL_STREAM_READ_ARB */
+   { 41388, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
+   { 41405, 0x000084E7 }, /* GL_SUBTRACT */
+   { 41417, 0x000084E7 }, /* GL_SUBTRACT_ARB */
+   { 41433, 0x00009113 }, /* GL_SYNC_CONDITION */
+   { 41451, 0x00009116 }, /* GL_SYNC_FENCE */
+   { 41465, 0x00009115 }, /* GL_SYNC_FLAGS */
+   { 41479, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
+   { 41506, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+   { 41536, 0x00009114 }, /* GL_SYNC_STATUS */
+   { 41551, 0x00002001 }, /* GL_T */
+   { 41556, 0x00002A2A }, /* GL_T2F_C3F_V3F */
+   { 41571, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
+   { 41590, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
+   { 41606, 0x00002A2B }, /* GL_T2F_N3F_V3F */
+   { 41621, 0x00002A27 }, /* GL_T2F_V3F */
+   { 41632, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
+   { 41651, 0x00002A28 }, /* GL_T4F_V4F */
+   { 41662, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
+   { 41685, 0x00001702 }, /* GL_TEXTURE */
+   { 41696, 0x000084C0 }, /* GL_TEXTURE0 */
+   { 41708, 0x000084C0 }, /* GL_TEXTURE0_ARB */
+   { 41724, 0x000084C1 }, /* GL_TEXTURE1 */
+   { 41736, 0x000084CA }, /* GL_TEXTURE10 */
+   { 41749, 0x000084CA }, /* GL_TEXTURE10_ARB */
+   { 41766, 0x000084CB }, /* GL_TEXTURE11 */
+   { 41779, 0x000084CB }, /* GL_TEXTURE11_ARB */
+   { 41796, 0x000084CC }, /* GL_TEXTURE12 */
+   { 41809, 0x000084CC }, /* GL_TEXTURE12_ARB */
+   { 41826, 0x000084CD }, /* GL_TEXTURE13 */
+   { 41839, 0x000084CD }, /* GL_TEXTURE13_ARB */
+   { 41856, 0x000084CE }, /* GL_TEXTURE14 */
+   { 41869, 0x000084CE }, /* GL_TEXTURE14_ARB */
+   { 41886, 0x000084CF }, /* GL_TEXTURE15 */
+   { 41899, 0x000084CF }, /* GL_TEXTURE15_ARB */
+   { 41916, 0x000084D0 }, /* GL_TEXTURE16 */
+   { 41929, 0x000084D0 }, /* GL_TEXTURE16_ARB */
+   { 41946, 0x000084D1 }, /* GL_TEXTURE17 */
+   { 41959, 0x000084D1 }, /* GL_TEXTURE17_ARB */
+   { 41976, 0x000084D2 }, /* GL_TEXTURE18 */
+   { 41989, 0x000084D2 }, /* GL_TEXTURE18_ARB */
+   { 42006, 0x000084D3 }, /* GL_TEXTURE19 */
+   { 42019, 0x000084D3 }, /* GL_TEXTURE19_ARB */
+   { 42036, 0x000084C1 }, /* GL_TEXTURE1_ARB */
+   { 42052, 0x000084C2 }, /* GL_TEXTURE2 */
+   { 42064, 0x000084D4 }, /* GL_TEXTURE20 */
+   { 42077, 0x000084D4 }, /* GL_TEXTURE20_ARB */
+   { 42094, 0x000084D5 }, /* GL_TEXTURE21 */
+   { 42107, 0x000084D5 }, /* GL_TEXTURE21_ARB */
+   { 42124, 0x000084D6 }, /* GL_TEXTURE22 */
+   { 42137, 0x000084D6 }, /* GL_TEXTURE22_ARB */
+   { 42154, 0x000084D7 }, /* GL_TEXTURE23 */
+   { 42167, 0x000084D7 }, /* GL_TEXTURE23_ARB */
+   { 42184, 0x000084D8 }, /* GL_TEXTURE24 */
+   { 42197, 0x000084D8 }, /* GL_TEXTURE24_ARB */
+   { 42214, 0x000084D9 }, /* GL_TEXTURE25 */
+   { 42227, 0x000084D9 }, /* GL_TEXTURE25_ARB */
+   { 42244, 0x000084DA }, /* GL_TEXTURE26 */
+   { 42257, 0x000084DA }, /* GL_TEXTURE26_ARB */
+   { 42274, 0x000084DB }, /* GL_TEXTURE27 */
+   { 42287, 0x000084DB }, /* GL_TEXTURE27_ARB */
+   { 42304, 0x000084DC }, /* GL_TEXTURE28 */
+   { 42317, 0x000084DC }, /* GL_TEXTURE28_ARB */
+   { 42334, 0x000084DD }, /* GL_TEXTURE29 */
+   { 42347, 0x000084DD }, /* GL_TEXTURE29_ARB */
+   { 42364, 0x000084C2 }, /* GL_TEXTURE2_ARB */
+   { 42380, 0x000084C3 }, /* GL_TEXTURE3 */
+   { 42392, 0x000084DE }, /* GL_TEXTURE30 */
+   { 42405, 0x000084DE }, /* GL_TEXTURE30_ARB */
+   { 42422, 0x000084DF }, /* GL_TEXTURE31 */
+   { 42435, 0x000084DF }, /* GL_TEXTURE31_ARB */
+   { 42452, 0x000084C3 }, /* GL_TEXTURE3_ARB */
+   { 42468, 0x000084C4 }, /* GL_TEXTURE4 */
+   { 42480, 0x000084C4 }, /* GL_TEXTURE4_ARB */
+   { 42496, 0x000084C5 }, /* GL_TEXTURE5 */
+   { 42508, 0x000084C5 }, /* GL_TEXTURE5_ARB */
+   { 42524, 0x000084C6 }, /* GL_TEXTURE6 */
+   { 42536, 0x000084C6 }, /* GL_TEXTURE6_ARB */
+   { 42552, 0x000084C7 }, /* GL_TEXTURE7 */
+   { 42564, 0x000084C7 }, /* GL_TEXTURE7_ARB */
+   { 42580, 0x000084C8 }, /* GL_TEXTURE8 */
+   { 42592, 0x000084C8 }, /* GL_TEXTURE8_ARB */
+   { 42608, 0x000084C9 }, /* GL_TEXTURE9 */
+   { 42620, 0x000084C9 }, /* GL_TEXTURE9_ARB */
+   { 42636, 0x00000DE0 }, /* GL_TEXTURE_1D */
+   { 42650, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY */
+   { 42670, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
+   { 42694, 0x00000DE1 }, /* GL_TEXTURE_2D */
+   { 42708, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY */
+   { 42728, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
+   { 42752, 0x0000806F }, /* GL_TEXTURE_3D */
+   { 42766, 0x0000806F }, /* GL_TEXTURE_3D_OES */
+   { 42784, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
+   { 42806, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
+   { 42832, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
+   { 42854, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
+   { 42876, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY */
+   { 42904, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+   { 42936, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
+   { 42958, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY */
+   { 42986, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+   { 43018, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
+   { 43040, 0x0000806A }, /* GL_TEXTURE_BINDING_3D_OES */
+   { 43066, 0x00008C2C }, /* GL_TEXTURE_BINDING_BUFFER */
+   { 43092, 0x00008C2C }, /* GL_TEXTURE_BINDING_BUFFER_ARB */
+   { 43122, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
+   { 43150, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
+   { 43182, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_OES */
+   { 43214, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE */
+   { 43243, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+   { 43276, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
+   { 43308, 0x00040000 }, /* GL_TEXTURE_BIT */
+   { 43323, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
+   { 43344, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
+   { 43369, 0x00001005 }, /* GL_TEXTURE_BORDER */
+   { 43387, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
+   { 43411, 0x00008C2A }, /* GL_TEXTURE_BUFFER */
+   { 43429, 0x00008C2A }, /* GL_TEXTURE_BUFFER_ARB */
+   { 43451, 0x00008C2D }, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */
+   { 43488, 0x00008C2D }, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB */
+   { 43529, 0x00008C2E }, /* GL_TEXTURE_BUFFER_FORMAT */
+   { 43554, 0x00008C2E }, /* GL_TEXTURE_BUFFER_FORMAT_ARB */
+   { 43583, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+   { 43614, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+   { 43644, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+   { 43674, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+   { 43709, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+   { 43740, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 43778, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
+   { 43805, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+   { 43837, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+   { 43871, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
+   { 43895, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
+   { 43923, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
+   { 43947, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
+   { 43975, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+   { 44008, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
+   { 44032, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
+   { 44054, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
+   { 44076, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
+   { 44102, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
+   { 44136, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+   { 44169, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
+   { 44206, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
+   { 44234, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
+   { 44266, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
+   { 44289, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+   { 44327, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
+   { 44369, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+   { 44400, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+   { 44428, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+   { 44458, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+   { 44486, 0x00008B9D }, /* GL_TEXTURE_CROP_RECT_OES */
+   { 44511, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
+   { 44531, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
+   { 44555, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+   { 44586, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
+   { 44621, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES */
+   { 44656, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+   { 44687, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
+   { 44722, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES */
+   { 44757, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+   { 44788, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
+   { 44823, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES */
+   { 44858, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_OES */
+   { 44882, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+   { 44913, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
+   { 44948, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES */
+   { 44983, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+   { 45014, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
+   { 45049, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES */
+   { 45084, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+   { 45115, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
+   { 45150, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */
+   { 45185, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+   { 45214, 0x00008071 }, /* GL_TEXTURE_DEPTH */
+   { 45231, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
+   { 45253, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
+   { 45279, 0x00002300 }, /* GL_TEXTURE_ENV */
+   { 45294, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
+   { 45315, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
+   { 45335, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
+   { 45361, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL_EXT */
+   { 45391, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
+   { 45411, 0x00002500 }, /* GL_TEXTURE_GEN_MODE_OES */
+   { 45435, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
+   { 45452, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
+   { 45469, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
+   { 45486, 0x00008D60 }, /* GL_TEXTURE_GEN_STR_OES */
+   { 45509, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
+   { 45526, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
+   { 45551, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
+   { 45573, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
+   { 45599, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
+   { 45617, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
+   { 45643, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
+   { 45669, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
+   { 45699, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
+   { 45726, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
+   { 45751, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
+   { 45771, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
+   { 45795, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+   { 45822, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+   { 45849, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+   { 45876, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
+   { 45902, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
+   { 45932, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
+   { 45954, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
+   { 45972, 0x0000898F }, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */
+   { 46012, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 46042, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+   { 46070, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+   { 46098, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+   { 46126, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
+   { 46147, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
+   { 46166, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
+   { 46188, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
+   { 46207, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
+   { 46227, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+   { 46257, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+   { 46288, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE */
+   { 46309, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
+   { 46334, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
+   { 46358, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
+   { 46378, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
+   { 46402, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
+   { 46422, 0x00008C3F }, /* GL_TEXTURE_SHARED_SIZE */
+   { 46445, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
+   { 46468, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
+   { 46492, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
+   { 46520, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+   { 46550, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
+   { 46575, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+   { 46609, 0x00001000 }, /* GL_TEXTURE_WIDTH */
+   { 46626, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
+   { 46644, 0x00008072 }, /* GL_TEXTURE_WRAP_R_OES */
+   { 46666, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
+   { 46684, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
+   { 46702, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
+   { 46721, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
+   { 46741, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
+   { 46760, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+   { 46789, 0x00001000 }, /* GL_TRANSFORM_BIT */
+   { 46806, 0x00008E22 }, /* GL_TRANSFORM_FEEDBACK */
+   { 46828, 0x00008E25 }, /* GL_TRANSFORM_FEEDBACK_BINDING */
+   { 46858, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER */
+   { 46887, 0x00008E24 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
+   { 46923, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */
+   { 46960, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */
+   { 47001, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */
+   { 47034, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */
+   { 47068, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */
+   { 47106, 0x00008E23 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
+   { 47142, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */
+   { 47176, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */
+   { 47214, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */
+   { 47249, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */
+   { 47288, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */
+   { 47329, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */
+   { 47374, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS */
+   { 47405, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */
+   { 47440, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */
+   { 47481, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */
+   { 47526, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
+   { 47552, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
+   { 47582, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+   { 47614, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+   { 47644, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
+   { 47678, 0x0000862C }, /* GL_TRANSPOSE_NV */
+   { 47694, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+   { 47725, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
+   { 47760, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+   { 47788, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
+   { 47820, 0x00000004 }, /* GL_TRIANGLES */
+   { 47833, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY */
+   { 47856, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY_ARB */
+   { 47883, 0x00000006 }, /* GL_TRIANGLE_FAN */
+   { 47899, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
+   { 47920, 0x00000005 }, /* GL_TRIANGLE_STRIP */
+   { 47938, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY */
+   { 47966, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY_ARB */
+   { 47998, 0x00000001 }, /* GL_TRUE */
+   { 48006, 0x00008A1C }, /* GL_UNDEFINED_APPLE */
+   { 48025, 0x00008255 }, /* GL_UNKNOWN_CONTEXT_RESET_ARB */
+   { 48054, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
+   { 48074, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
+   { 48097, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
+   { 48117, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
+   { 48138, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
+   { 48160, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
+   { 48182, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
+   { 48202, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
+   { 48223, 0x00009118 }, /* GL_UNSIGNALED */
+   { 48237, 0x00001401 }, /* GL_UNSIGNED_BYTE */
+   { 48254, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+   { 48281, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
+   { 48304, 0x00001405 }, /* GL_UNSIGNED_INT */
+   { 48320, 0x00008C3B }, /* GL_UNSIGNED_INT_10F_11F_11F_REV */
+   { 48352, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
+   { 48379, 0x00008DF6 }, /* GL_UNSIGNED_INT_10_10_10_2_OES */
+   { 48410, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
+   { 48431, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
+   { 48456, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
+   { 48480, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_OES */
+   { 48505, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+   { 48536, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV_EXT */
+   { 48571, 0x00008C3E }, /* GL_UNSIGNED_INT_5_9_9_9_REV */
+   { 48599, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
+   { 48623, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+   { 48651, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D */
+   { 48678, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */
+   { 48711, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT */
+   { 48748, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D_EXT */
+   { 48779, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D */
+   { 48806, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */
+   { 48839, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT */
+   { 48876, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D_EXT */
+   { 48907, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */
+   { 48939, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT */
+   { 48975, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D */
+   { 49002, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D_EXT */
+   { 49033, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */
+   { 49064, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT */
+   { 49099, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE */
+   { 49128, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE_EXT */
+   { 49161, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2 */
+   { 49182, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2_EXT */
+   { 49207, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3 */
+   { 49228, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3_EXT */
+   { 49253, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4 */
+   { 49274, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4_EXT */
+   { 49299, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
+   { 49322, 0x00001403 }, /* GL_UNSIGNED_SHORT */
+   { 49340, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+   { 49370, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT */
+   { 49404, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+   { 49430, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+   { 49460, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT */
+   { 49494, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+   { 49520, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
+   { 49544, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+   { 49572, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+   { 49600, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
+   { 49627, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+   { 49659, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
+   { 49690, 0x00008CA2 }, /* GL_UPPER_LEFT */
+   { 49704, 0x00002A20 }, /* GL_V2F */
+   { 49711, 0x00002A21 }, /* GL_V3F */
+   { 49718, 0x00008B83 }, /* GL_VALIDATE_STATUS */
+   { 49737, 0x00001F00 }, /* GL_VENDOR */
+   { 49747, 0x00001F02 }, /* GL_VERSION */
+   { 49758, 0x00008074 }, /* GL_VERTEX_ARRAY */
+   { 49774, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
+   { 49798, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+   { 49828, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+   { 49859, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
+   { 49894, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
+   { 49918, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
+   { 49939, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
+   { 49962, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
+   { 49983, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+   { 50010, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+   { 50038, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+   { 50066, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+   { 50094, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+   { 50122, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+   { 50150, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+   { 50178, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+   { 50205, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+   { 50232, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+   { 50259, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+   { 50286, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+   { 50313, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+   { 50340, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+   { 50367, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+   { 50394, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+   { 50421, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+   { 50459, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
+   { 50501, 0x000088FE }, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */
+   { 50536, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+   { 50567, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
+   { 50602, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */
+   { 50633, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT */
+   { 50668, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+   { 50702, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
+   { 50740, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+   { 50771, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
+   { 50806, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+   { 50834, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
+   { 50866, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+   { 50896, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
+   { 50930, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+   { 50958, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
+   { 50990, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
+   { 51010, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
+   { 51032, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
+   { 51061, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
+   { 51082, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+   { 51111, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
+   { 51144, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+   { 51176, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+   { 51203, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
+   { 51234, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+   { 51264, 0x00008B31 }, /* GL_VERTEX_SHADER */
+   { 51281, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
+   { 51302, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
+   { 51329, 0x00000BA2 }, /* GL_VIEWPORT */
+   { 51341, 0x00000800 }, /* GL_VIEWPORT_BIT */
+   { 51357, 0x00008A1A }, /* GL_VOLATILE_APPLE */
+   { 51375, 0x0000911D }, /* GL_WAIT_FAILED */
+   { 51390, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
+   { 51410, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+   { 51441, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
+   { 51476, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_OES */
+   { 51511, 0x000086AD }, /* GL_WEIGHT_ARRAY_OES */
+   { 51531, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+   { 51559, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_OES */
+   { 51587, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+   { 51612, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_OES */
+   { 51637, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+   { 51664, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_OES */
+   { 51691, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+   { 51716, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_OES */
+   { 51741, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
+   { 51765, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
+   { 51784, 0x000088B9 }, /* GL_WRITE_ONLY */
+   { 51798, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
+   { 51816, 0x000088B9 }, /* GL_WRITE_ONLY_OES */
+   { 51834, 0x00001506 }, /* GL_XOR */
+   { 51841, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
+   { 51860, 0x00008757 }, /* GL_YCBCR_MESA */
+   { 51874, 0x00000000 }, /* GL_ZERO */
+   { 51882, 0x00000D16 }, /* GL_ZOOM_X */
+   { 51892, 0x00000D17 }, /* GL_ZOOM_Y */
 };
 
-static const unsigned reduced_enums[1556] =
+static const unsigned reduced_enums[1562] =
 {
-       538, /* GL_FALSE */
-       831, /* GL_LINES */
-       835, /* GL_LINE_LOOP */
-       842, /* GL_LINE_STRIP */
-      2146, /* GL_TRIANGLES */
-      2151, /* GL_TRIANGLE_STRIP */
-      2149, /* GL_TRIANGLE_FAN */
-      1512, /* GL_QUADS */
-      1516, /* GL_QUAD_STRIP */
-      1383, /* GL_POLYGON */
-       832, /* GL_LINES_ADJACENCY */
-       843, /* GL_LINE_STRIP_ADJACENCY */
-      2147, /* GL_TRIANGLES_ADJACENCY */
-      2152, /* GL_TRIANGLE_STRIP_ADJACENCY */
-      1395, /* GL_POLYGON_STIPPLE_BIT */
-      1338, /* GL_PIXEL_MODE_BIT */
-       818, /* GL_LIGHTING_BIT */
-       572, /* GL_FOG_BIT */
+       539, /* GL_FALSE */
+       834, /* GL_LINES */
+       838, /* GL_LINE_LOOP */
+       845, /* GL_LINE_STRIP */
+      2152, /* GL_TRIANGLES */
+      2157, /* GL_TRIANGLE_STRIP */
+      2155, /* GL_TRIANGLE_FAN */
+      1517, /* GL_QUADS */
+      1521, /* GL_QUAD_STRIP */
+      1388, /* GL_POLYGON */
+       835, /* GL_LINES_ADJACENCY */
+       846, /* GL_LINE_STRIP_ADJACENCY */
+      2153, /* GL_TRIANGLES_ADJACENCY */
+      2158, /* GL_TRIANGLE_STRIP_ADJACENCY */
+      1400, /* GL_POLYGON_STIPPLE_BIT */
+      1343, /* GL_PIXEL_MODE_BIT */
+       821, /* GL_LIGHTING_BIT */
+       573, /* GL_FOG_BIT */
          8, /* GL_ACCUM */
-       854, /* GL_LOAD */
-      1601, /* GL_RETURN */
-      1205, /* GL_MULT */
+       857, /* GL_LOAD */
+      1607, /* GL_RETURN */
+      1209, /* GL_MULT */
         24, /* GL_ADD */
-      1221, /* GL_NEVER */
-       808, /* GL_LESS */
-       528, /* GL_EQUAL */
-       807, /* GL_LEQUAL */
-       695, /* GL_GREATER */
-      1238, /* GL_NOTEQUAL */
-       694, /* GL_GEQUAL */
+      1225, /* GL_NEVER */
+       811, /* GL_LESS */
+       529, /* GL_EQUAL */
+       810, /* GL_LEQUAL */
+       696, /* GL_GREATER */
+      1242, /* GL_NOTEQUAL */
+       695, /* GL_GEQUAL */
         55, /* GL_ALWAYS */
-      1810, /* GL_SRC_COLOR */
-      1271, /* GL_ONE_MINUS_SRC_COLOR */
-      1808, /* GL_SRC_ALPHA */
-      1270, /* GL_ONE_MINUS_SRC_ALPHA */
-       507, /* GL_DST_ALPHA */
-      1268, /* GL_ONE_MINUS_DST_ALPHA */
-       508, /* GL_DST_COLOR */
-      1269, /* GL_ONE_MINUS_DST_COLOR */
-      1809, /* GL_SRC_ALPHA_SATURATE */
-       671, /* GL_FRONT_LEFT */
-       672, /* GL_FRONT_RIGHT */
+      1816, /* GL_SRC_COLOR */
+      1276, /* GL_ONE_MINUS_SRC_COLOR */
+      1814, /* GL_SRC_ALPHA */
+      1275, /* GL_ONE_MINUS_SRC_ALPHA */
+       508, /* GL_DST_ALPHA */
+      1273, /* GL_ONE_MINUS_DST_ALPHA */
+       509, /* GL_DST_COLOR */
+      1274, /* GL_ONE_MINUS_DST_COLOR */
+      1815, /* GL_SRC_ALPHA_SATURATE */
+       672, /* GL_FRONT_LEFT */
+       673, /* GL_FRONT_RIGHT */
         77, /* GL_BACK_LEFT */
         78, /* GL_BACK_RIGHT */
-       668, /* GL_FRONT */
+       669, /* GL_FRONT */
         76, /* GL_BACK */
-       806, /* GL_LEFT */
-      1691, /* GL_RIGHT */
-       669, /* GL_FRONT_AND_BACK */
+       809, /* GL_LEFT */
+      1697, /* GL_RIGHT */
+       670, /* GL_FRONT_AND_BACK */
         71, /* GL_AUX0 */
         72, /* GL_AUX1 */
         73, /* GL_AUX2 */
         74, /* GL_AUX3 */
-       794, /* GL_INVALID_ENUM */
-       799, /* GL_INVALID_VALUE */
-       798, /* GL_INVALID_OPERATION */
-      1815, /* GL_STACK_OVERFLOW */
-      1816, /* GL_STACK_UNDERFLOW */
-      1296, /* GL_OUT_OF_MEMORY */
-       795, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+       797, /* GL_INVALID_ENUM */
+       802, /* GL_INVALID_VALUE */
+       801, /* GL_INVALID_OPERATION */
+      1821, /* GL_STACK_OVERFLOW */
+      1822, /* GL_STACK_UNDERFLOW */
+      1301, /* GL_OUT_OF_MEMORY */
+       798, /* GL_INVALID_FRAMEBUFFER_OPERATION */
          0, /* GL_2D */
          2, /* GL_3D */
          3, /* GL_3D_COLOR */
          4, /* GL_3D_COLOR_TEXTURE */
          6, /* GL_4D_COLOR_TEXTURE */
-      1316, /* GL_PASS_THROUGH_TOKEN */
-      1382, /* GL_POINT_TOKEN */
-       845, /* GL_LINE_TOKEN */
-      1396, /* GL_POLYGON_TOKEN */
+      1321, /* GL_PASS_THROUGH_TOKEN */
+      1387, /* GL_POINT_TOKEN */
+       848, /* GL_LINE_TOKEN */
+      1401, /* GL_POLYGON_TOKEN */
         87, /* GL_BITMAP_TOKEN */
-       506, /* GL_DRAW_PIXEL_TOKEN */
-       352, /* GL_COPY_PIXEL_TOKEN */
-       836, /* GL_LINE_RESET_TOKEN */
-       531, /* GL_EXP */
-       532, /* GL_EXP2 */
-       389, /* GL_CW */
+       507, /* GL_DRAW_PIXEL_TOKEN */
+       353, /* GL_COPY_PIXEL_TOKEN */
+       839, /* GL_LINE_RESET_TOKEN */
+       532, /* GL_EXP */
+       533, /* GL_EXP2 */
+       390, /* GL_CW */
        154, /* GL_CCW */
        187, /* GL_COEFF */
-      1293, /* GL_ORDER */
-       443, /* GL_DOMAIN */
-       362, /* GL_CURRENT_COLOR */
-       365, /* GL_CURRENT_INDEX */
-       371, /* GL_CURRENT_NORMAL */
-       385, /* GL_CURRENT_TEXTURE_COORDS */
-       377, /* GL_CURRENT_RASTER_COLOR */
-       379, /* GL_CURRENT_RASTER_INDEX */
-       383, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
-       380, /* GL_CURRENT_RASTER_POSITION */
-       381, /* GL_CURRENT_RASTER_POSITION_VALID */
-       378, /* GL_CURRENT_RASTER_DISTANCE */
-      1374, /* GL_POINT_SMOOTH */
-      1358, /* GL_POINT_SIZE */
-      1373, /* GL_POINT_SIZE_RANGE */
-      1364, /* GL_POINT_SIZE_GRANULARITY */
-       837, /* GL_LINE_SMOOTH */
-       846, /* GL_LINE_WIDTH */
-       848, /* GL_LINE_WIDTH_RANGE */
-       847, /* GL_LINE_WIDTH_GRANULARITY */
-       839, /* GL_LINE_STIPPLE */
-       840, /* GL_LINE_STIPPLE_PATTERN */
-       841, /* GL_LINE_STIPPLE_REPEAT */
-       853, /* GL_LIST_MODE */
-      1060, /* GL_MAX_LIST_NESTING */
-       850, /* GL_LIST_BASE */
-       852, /* GL_LIST_INDEX */
-      1385, /* GL_POLYGON_MODE */
-      1392, /* GL_POLYGON_SMOOTH */
-      1394, /* GL_POLYGON_STIPPLE */
-       517, /* GL_EDGE_FLAG */
-       355, /* GL_CULL_FACE */
-       356, /* GL_CULL_FACE_MODE */
-       670, /* GL_FRONT_FACE */
-       817, /* GL_LIGHTING */
-       822, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-       823, /* GL_LIGHT_MODEL_TWO_SIDE */
-       819, /* GL_LIGHT_MODEL_AMBIENT */
-      1757, /* GL_SHADE_MODEL */
+      1298, /* GL_ORDER */
+       444, /* GL_DOMAIN */
+       363, /* GL_CURRENT_COLOR */
+       366, /* GL_CURRENT_INDEX */
+       372, /* GL_CURRENT_NORMAL */
+       386, /* GL_CURRENT_TEXTURE_COORDS */
+       378, /* GL_CURRENT_RASTER_COLOR */
+       380, /* GL_CURRENT_RASTER_INDEX */
+       384, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
+       381, /* GL_CURRENT_RASTER_POSITION */
+       382, /* GL_CURRENT_RASTER_POSITION_VALID */
+       379, /* GL_CURRENT_RASTER_DISTANCE */
+      1379, /* GL_POINT_SMOOTH */
+      1363, /* GL_POINT_SIZE */
+      1378, /* GL_POINT_SIZE_RANGE */
+      1369, /* GL_POINT_SIZE_GRANULARITY */
+       840, /* GL_LINE_SMOOTH */
+       849, /* GL_LINE_WIDTH */
+       851, /* GL_LINE_WIDTH_RANGE */
+       850, /* GL_LINE_WIDTH_GRANULARITY */
+       842, /* GL_LINE_STIPPLE */
+       843, /* GL_LINE_STIPPLE_PATTERN */
+       844, /* GL_LINE_STIPPLE_REPEAT */
+       856, /* GL_LIST_MODE */
+      1064, /* GL_MAX_LIST_NESTING */
+       853, /* GL_LIST_BASE */
+       855, /* GL_LIST_INDEX */
+      1390, /* GL_POLYGON_MODE */
+      1397, /* GL_POLYGON_SMOOTH */
+      1399, /* GL_POLYGON_STIPPLE */
+       518, /* GL_EDGE_FLAG */
+       356, /* GL_CULL_FACE */
+       357, /* GL_CULL_FACE_MODE */
+       671, /* GL_FRONT_FACE */
+       820, /* GL_LIGHTING */
+       825, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+       826, /* GL_LIGHT_MODEL_TWO_SIDE */
+       822, /* GL_LIGHT_MODEL_AMBIENT */
+      1763, /* GL_SHADE_MODEL */
        235, /* GL_COLOR_MATERIAL_FACE */
        236, /* GL_COLOR_MATERIAL_PARAMETER */
        234, /* GL_COLOR_MATERIAL */
-       571, /* GL_FOG */
-       593, /* GL_FOG_INDEX */
-       589, /* GL_FOG_DENSITY */
-       597, /* GL_FOG_START */
-       591, /* GL_FOG_END */
-       594, /* GL_FOG_MODE */
-       573, /* GL_FOG_COLOR */
-       428, /* GL_DEPTH_RANGE */
-       437, /* GL_DEPTH_TEST */
-       440, /* GL_DEPTH_WRITEMASK */
-       413, /* GL_DEPTH_CLEAR_VALUE */
-       427, /* GL_DEPTH_FUNC */
+       572, /* GL_FOG */
+       594, /* GL_FOG_INDEX */
+       590, /* GL_FOG_DENSITY */
+       598, /* GL_FOG_START */
+       592, /* GL_FOG_END */
+       595, /* GL_FOG_MODE */
+       574, /* GL_FOG_COLOR */
+       429, /* GL_DEPTH_RANGE */
+       438, /* GL_DEPTH_TEST */
+       441, /* GL_DEPTH_WRITEMASK */
+       414, /* GL_DEPTH_CLEAR_VALUE */
+       428, /* GL_DEPTH_FUNC */
         12, /* GL_ACCUM_CLEAR_VALUE */
-      1860, /* GL_STENCIL_TEST */
-      1841, /* GL_STENCIL_CLEAR_VALUE */
-      1843, /* GL_STENCIL_FUNC */
-      1862, /* GL_STENCIL_VALUE_MASK */
-      1842, /* GL_STENCIL_FAIL */
-      1857, /* GL_STENCIL_PASS_DEPTH_FAIL */
-      1858, /* GL_STENCIL_PASS_DEPTH_PASS */
-      1859, /* GL_STENCIL_REF */
-      1863, /* GL_STENCIL_WRITEMASK */
-      1010, /* GL_MATRIX_MODE */
-      1227, /* GL_NORMALIZE */
-      2278, /* GL_VIEWPORT */
-      1200, /* GL_MODELVIEW_STACK_DEPTH */
-      1486, /* GL_PROJECTION_STACK_DEPTH */
-      2100, /* GL_TEXTURE_STACK_DEPTH */
-      1197, /* GL_MODELVIEW_MATRIX */
-      1484, /* GL_PROJECTION_MATRIX */
-      2080, /* GL_TEXTURE_MATRIX */
+      1866, /* GL_STENCIL_TEST */
+      1847, /* GL_STENCIL_CLEAR_VALUE */
+      1849, /* GL_STENCIL_FUNC */
+      1868, /* GL_STENCIL_VALUE_MASK */
+      1848, /* GL_STENCIL_FAIL */
+      1863, /* GL_STENCIL_PASS_DEPTH_FAIL */
+      1864, /* GL_STENCIL_PASS_DEPTH_PASS */
+      1865, /* GL_STENCIL_REF */
+      1869, /* GL_STENCIL_WRITEMASK */
+      1014, /* GL_MATRIX_MODE */
+      1231, /* GL_NORMALIZE */
+      2285, /* GL_VIEWPORT */
+      1204, /* GL_MODELVIEW_STACK_DEPTH */
+      1491, /* GL_PROJECTION_STACK_DEPTH */
+      2106, /* GL_TEXTURE_STACK_DEPTH */
+      1201, /* GL_MODELVIEW_MATRIX */
+      1489, /* GL_PROJECTION_MATRIX */
+      2086, /* GL_TEXTURE_MATRIX */
         69, /* GL_ATTRIB_STACK_DEPTH */
        169, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
         51, /* GL_ALPHA_TEST */
         52, /* GL_ALPHA_TEST_FUNC */
         53, /* GL_ALPHA_TEST_REF */
-       442, /* GL_DITHER */
+       443, /* GL_DITHER */
         91, /* GL_BLEND_DST */
        105, /* GL_BLEND_SRC */
         88, /* GL_BLEND */
-       856, /* GL_LOGIC_OP_MODE */
-       743, /* GL_INDEX_LOGIC_OP */
+       859, /* GL_LOGIC_OP_MODE */
+       745, /* GL_INDEX_LOGIC_OP */
        233, /* GL_COLOR_LOGIC_OP */
         75, /* GL_AUX_BUFFERS */
-       453, /* GL_DRAW_BUFFER */
-      1539, /* GL_READ_BUFFER */
-      1734, /* GL_SCISSOR_BOX */
-      1735, /* GL_SCISSOR_TEST */
-       742, /* GL_INDEX_CLEAR_VALUE */
-       747, /* GL_INDEX_WRITEMASK */
+       454, /* GL_DRAW_BUFFER */
+      1544, /* GL_READ_BUFFER */
+      1740, /* GL_SCISSOR_BOX */
+      1741, /* GL_SCISSOR_TEST */
+       744, /* GL_INDEX_CLEAR_VALUE */
+       749, /* GL_INDEX_WRITEMASK */
        230, /* GL_COLOR_CLEAR_VALUE */
        272, /* GL_COLOR_WRITEMASK */
-       744, /* GL_INDEX_MODE */
-      1680, /* GL_RGBA_MODE */
-       452, /* GL_DOUBLEBUFFER */
-      1864, /* GL_STEREO */
-      1593, /* GL_RENDER_MODE */
-      1317, /* GL_PERSPECTIVE_CORRECTION_HINT */
-      1375, /* GL_POINT_SMOOTH_HINT */
-       838, /* GL_LINE_SMOOTH_HINT */
-      1393, /* GL_POLYGON_SMOOTH_HINT */
-       592, /* GL_FOG_HINT */
-      2060, /* GL_TEXTURE_GEN_S */
-      2062, /* GL_TEXTURE_GEN_T */
-      2059, /* GL_TEXTURE_GEN_R */
-      2058, /* GL_TEXTURE_GEN_Q */
-      1330, /* GL_PIXEL_MAP_I_TO_I */
-      1336, /* GL_PIXEL_MAP_S_TO_S */
-      1332, /* GL_PIXEL_MAP_I_TO_R */
-      1328, /* GL_PIXEL_MAP_I_TO_G */
-      1326, /* GL_PIXEL_MAP_I_TO_B */
-      1324, /* GL_PIXEL_MAP_I_TO_A */
-      1334, /* GL_PIXEL_MAP_R_TO_R */
-      1322, /* GL_PIXEL_MAP_G_TO_G */
-      1320, /* GL_PIXEL_MAP_B_TO_B */
-      1318, /* GL_PIXEL_MAP_A_TO_A */
-      1331, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-      1337, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-      1333, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-      1329, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-      1327, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-      1325, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-      1335, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-      1323, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-      1321, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-      1319, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-      2163, /* GL_UNPACK_SWAP_BYTES */
-      2158, /* GL_UNPACK_LSB_FIRST */
-      2159, /* GL_UNPACK_ROW_LENGTH */
-      2162, /* GL_UNPACK_SKIP_ROWS */
-      2161, /* GL_UNPACK_SKIP_PIXELS */
-      2156, /* GL_UNPACK_ALIGNMENT */
-      1305, /* GL_PACK_SWAP_BYTES */
-      1300, /* GL_PACK_LSB_FIRST */
-      1301, /* GL_PACK_ROW_LENGTH */
-      1304, /* GL_PACK_SKIP_ROWS */
-      1303, /* GL_PACK_SKIP_PIXELS */
-      1297, /* GL_PACK_ALIGNMENT */
-       951, /* GL_MAP_COLOR */
-       956, /* GL_MAP_STENCIL */
-       746, /* GL_INDEX_SHIFT */
-       745, /* GL_INDEX_OFFSET */
-      1555, /* GL_RED_SCALE */
-      1551, /* GL_RED_BIAS */
-      2304, /* GL_ZOOM_X */
-      2305, /* GL_ZOOM_Y */
-       701, /* GL_GREEN_SCALE */
-       697, /* GL_GREEN_BIAS */
+       746, /* GL_INDEX_MODE */
+      1686, /* GL_RGBA_MODE */
+       453, /* GL_DOUBLEBUFFER */
+      1870, /* GL_STEREO */
+      1598, /* GL_RENDER_MODE */
+      1322, /* GL_PERSPECTIVE_CORRECTION_HINT */
+      1380, /* GL_POINT_SMOOTH_HINT */
+       841, /* GL_LINE_SMOOTH_HINT */
+      1398, /* GL_POLYGON_SMOOTH_HINT */
+       593, /* GL_FOG_HINT */
+      2066, /* GL_TEXTURE_GEN_S */
+      2068, /* GL_TEXTURE_GEN_T */
+      2065, /* GL_TEXTURE_GEN_R */
+      2064, /* GL_TEXTURE_GEN_Q */
+      1335, /* GL_PIXEL_MAP_I_TO_I */
+      1341, /* GL_PIXEL_MAP_S_TO_S */
+      1337, /* GL_PIXEL_MAP_I_TO_R */
+      1333, /* GL_PIXEL_MAP_I_TO_G */
+      1331, /* GL_PIXEL_MAP_I_TO_B */
+      1329, /* GL_PIXEL_MAP_I_TO_A */
+      1339, /* GL_PIXEL_MAP_R_TO_R */
+      1327, /* GL_PIXEL_MAP_G_TO_G */
+      1325, /* GL_PIXEL_MAP_B_TO_B */
+      1323, /* GL_PIXEL_MAP_A_TO_A */
+      1336, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+      1342, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+      1338, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+      1334, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+      1332, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+      1330, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+      1340, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+      1328, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+      1326, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+      1324, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+      2170, /* GL_UNPACK_SWAP_BYTES */
+      2165, /* GL_UNPACK_LSB_FIRST */
+      2166, /* GL_UNPACK_ROW_LENGTH */
+      2169, /* GL_UNPACK_SKIP_ROWS */
+      2168, /* GL_UNPACK_SKIP_PIXELS */
+      2163, /* GL_UNPACK_ALIGNMENT */
+      1310, /* GL_PACK_SWAP_BYTES */
+      1305, /* GL_PACK_LSB_FIRST */
+      1306, /* GL_PACK_ROW_LENGTH */
+      1309, /* GL_PACK_SKIP_ROWS */
+      1308, /* GL_PACK_SKIP_PIXELS */
+      1302, /* GL_PACK_ALIGNMENT */
+       955, /* GL_MAP_COLOR */
+       960, /* GL_MAP_STENCIL */
+       748, /* GL_INDEX_SHIFT */
+       747, /* GL_INDEX_OFFSET */
+      1560, /* GL_RED_SCALE */
+      1556, /* GL_RED_BIAS */
+      2311, /* GL_ZOOM_X */
+      2312, /* GL_ZOOM_Y */
+       702, /* GL_GREEN_SCALE */
+       698, /* GL_GREEN_BIAS */
        115, /* GL_BLUE_SCALE */
        111, /* GL_BLUE_BIAS */
         50, /* GL_ALPHA_SCALE */
         47, /* GL_ALPHA_BIAS */
-       429, /* GL_DEPTH_SCALE */
-       405, /* GL_DEPTH_BIAS */
-      1042, /* GL_MAX_EVAL_ORDER */
-      1059, /* GL_MAX_LIGHTS */
-      1022, /* GL_MAX_CLIP_DISTANCES */
-      1115, /* GL_MAX_TEXTURE_SIZE */
-      1066, /* GL_MAX_PIXEL_MAP_TABLE */
-      1018, /* GL_MAX_ATTRIB_STACK_DEPTH */
-      1062, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-      1063, /* GL_MAX_NAME_STACK_DEPTH */
-      1094, /* GL_MAX_PROJECTION_STACK_DEPTH */
-      1116, /* GL_MAX_TEXTURE_STACK_DEPTH */
-      1142, /* GL_MAX_VIEWPORT_DIMS */
-      1019, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-      1874, /* GL_SUBPIXEL_BITS */
-       741, /* GL_INDEX_BITS */
-      1552, /* GL_RED_BITS */
-       698, /* GL_GREEN_BITS */
+       430, /* GL_DEPTH_SCALE */
+       406, /* GL_DEPTH_BIAS */
+      1046, /* GL_MAX_EVAL_ORDER */
+      1063, /* GL_MAX_LIGHTS */
+      1026, /* GL_MAX_CLIP_DISTANCES */
+      1119, /* GL_MAX_TEXTURE_SIZE */
+      1070, /* GL_MAX_PIXEL_MAP_TABLE */
+      1022, /* GL_MAX_ATTRIB_STACK_DEPTH */
+      1066, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+      1067, /* GL_MAX_NAME_STACK_DEPTH */
+      1098, /* GL_MAX_PROJECTION_STACK_DEPTH */
+      1120, /* GL_MAX_TEXTURE_STACK_DEPTH */
+      1146, /* GL_MAX_VIEWPORT_DIMS */
+      1023, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+      1880, /* GL_SUBPIXEL_BITS */
+       743, /* GL_INDEX_BITS */
+      1557, /* GL_RED_BITS */
+       699, /* GL_GREEN_BITS */
        112, /* GL_BLUE_BITS */
         48, /* GL_ALPHA_BITS */
-       406, /* GL_DEPTH_BITS */
-      1838, /* GL_STENCIL_BITS */
+       407, /* GL_DEPTH_BITS */
+      1844, /* GL_STENCIL_BITS */
         14, /* GL_ACCUM_RED_BITS */
         13, /* GL_ACCUM_GREEN_BITS */
         10, /* GL_ACCUM_BLUE_BITS */
          9, /* GL_ACCUM_ALPHA_BITS */
-      1214, /* GL_NAME_STACK_DEPTH */
+      1218, /* GL_NAME_STACK_DEPTH */
         70, /* GL_AUTO_NORMAL */
-       897, /* GL_MAP1_COLOR_4 */
-       900, /* GL_MAP1_INDEX */
-       901, /* GL_MAP1_NORMAL */
-       902, /* GL_MAP1_TEXTURE_COORD_1 */
-       903, /* GL_MAP1_TEXTURE_COORD_2 */
-       904, /* GL_MAP1_TEXTURE_COORD_3 */
-       905, /* GL_MAP1_TEXTURE_COORD_4 */
-       906, /* GL_MAP1_VERTEX_3 */
-       907, /* GL_MAP1_VERTEX_4 */
-       924, /* GL_MAP2_COLOR_4 */
-       927, /* GL_MAP2_INDEX */
-       928, /* GL_MAP2_NORMAL */
-       929, /* GL_MAP2_TEXTURE_COORD_1 */
-       930, /* GL_MAP2_TEXTURE_COORD_2 */
-       931, /* GL_MAP2_TEXTURE_COORD_3 */
-       932, /* GL_MAP2_TEXTURE_COORD_4 */
-       933, /* GL_MAP2_VERTEX_3 */
-       934, /* GL_MAP2_VERTEX_4 */
-       898, /* GL_MAP1_GRID_DOMAIN */
-       899, /* GL_MAP1_GRID_SEGMENTS */
-       925, /* GL_MAP2_GRID_DOMAIN */
-       926, /* GL_MAP2_GRID_SEGMENTS */
-      1957, /* GL_TEXTURE_1D */
-      1960, /* GL_TEXTURE_2D */
-       541, /* GL_FEEDBACK_BUFFER_POINTER */
-       542, /* GL_FEEDBACK_BUFFER_SIZE */
-       543, /* GL_FEEDBACK_BUFFER_TYPE */
-      1744, /* GL_SELECTION_BUFFER_POINTER */
-      1745, /* GL_SELECTION_BUFFER_SIZE */
-      2106, /* GL_TEXTURE_WIDTH */
-      2066, /* GL_TEXTURE_HEIGHT */
-      2010, /* GL_TEXTURE_COMPONENTS */
-      1988, /* GL_TEXTURE_BORDER_COLOR */
-      1987, /* GL_TEXTURE_BORDER */
-       444, /* GL_DONT_CARE */
-       539, /* GL_FASTEST */
-      1222, /* GL_NICEST */
+       901, /* GL_MAP1_COLOR_4 */
+       904, /* GL_MAP1_INDEX */
+       905, /* GL_MAP1_NORMAL */
+       906, /* GL_MAP1_TEXTURE_COORD_1 */
+       907, /* GL_MAP1_TEXTURE_COORD_2 */
+       908, /* GL_MAP1_TEXTURE_COORD_3 */
+       909, /* GL_MAP1_TEXTURE_COORD_4 */
+       910, /* GL_MAP1_VERTEX_3 */
+       911, /* GL_MAP1_VERTEX_4 */
+       928, /* GL_MAP2_COLOR_4 */
+       931, /* GL_MAP2_INDEX */
+       932, /* GL_MAP2_NORMAL */
+       933, /* GL_MAP2_TEXTURE_COORD_1 */
+       934, /* GL_MAP2_TEXTURE_COORD_2 */
+       935, /* GL_MAP2_TEXTURE_COORD_3 */
+       936, /* GL_MAP2_TEXTURE_COORD_4 */
+       937, /* GL_MAP2_VERTEX_3 */
+       938, /* GL_MAP2_VERTEX_4 */
+       902, /* GL_MAP1_GRID_DOMAIN */
+       903, /* GL_MAP1_GRID_SEGMENTS */
+       929, /* GL_MAP2_GRID_DOMAIN */
+       930, /* GL_MAP2_GRID_SEGMENTS */
+      1963, /* GL_TEXTURE_1D */
+      1966, /* GL_TEXTURE_2D */
+       542, /* GL_FEEDBACK_BUFFER_POINTER */
+       543, /* GL_FEEDBACK_BUFFER_SIZE */
+       544, /* GL_FEEDBACK_BUFFER_TYPE */
+      1750, /* GL_SELECTION_BUFFER_POINTER */
+      1751, /* GL_SELECTION_BUFFER_SIZE */
+      2112, /* GL_TEXTURE_WIDTH */
+      2072, /* GL_TEXTURE_HEIGHT */
+      2016, /* GL_TEXTURE_COMPONENTS */
+      1994, /* GL_TEXTURE_BORDER_COLOR */
+      1993, /* GL_TEXTURE_BORDER */
+       445, /* GL_DONT_CARE */
+       540, /* GL_FASTEST */
+      1226, /* GL_NICEST */
         56, /* GL_AMBIENT */
-       441, /* GL_DIFFUSE */
-      1797, /* GL_SPECULAR */
-      1397, /* GL_POSITION */
-      1800, /* GL_SPOT_DIRECTION */
-      1801, /* GL_SPOT_EXPONENT */
-      1799, /* GL_SPOT_CUTOFF */
+       442, /* GL_DIFFUSE */
+      1803, /* GL_SPECULAR */
+      1402, /* GL_POSITION */
+      1806, /* GL_SPOT_DIRECTION */
+      1807, /* GL_SPOT_EXPONENT */
+      1805, /* GL_SPOT_CUTOFF */
        320, /* GL_CONSTANT_ATTENUATION */
-       826, /* GL_LINEAR_ATTENUATION */
-      1511, /* GL_QUADRATIC_ATTENUATION */
+       829, /* GL_LINEAR_ATTENUATION */
+      1516, /* GL_QUADRATIC_ATTENUATION */
        287, /* GL_COMPILE */
        288, /* GL_COMPILE_AND_EXECUTE */
        149, /* GL_BYTE */
-      2165, /* GL_UNSIGNED_BYTE */
-      1762, /* GL_SHORT */
-      2204, /* GL_UNSIGNED_SHORT */
-       749, /* GL_INT */
-      2168, /* GL_UNSIGNED_INT */
-       552, /* GL_FLOAT */
+      2172, /* GL_UNSIGNED_BYTE */
+      1768, /* GL_SHORT */
+      2211, /* GL_UNSIGNED_SHORT */
+       752, /* GL_INT */
+      2175, /* GL_UNSIGNED_INT */
+       553, /* GL_FLOAT */
          1, /* GL_2_BYTES */
          5, /* GL_3_BYTES */
          7, /* GL_4_BYTES */
-       451, /* GL_DOUBLE */
-       702, /* GL_HALF_FLOAT */
-       547, /* GL_FIXED */
+       452, /* GL_DOUBLE */
+       704, /* GL_HALF_FLOAT */
+       548, /* GL_FIXED */
        165, /* GL_CLEAR */
         58, /* GL_AND */
         60, /* GL_AND_REVERSE */
-       350, /* GL_COPY */
+       351, /* GL_COPY */
         59, /* GL_AND_INVERTED */
-      1225, /* GL_NOOP */
-      2300, /* GL_XOR */
-      1292, /* GL_OR */
-      1226, /* GL_NOR */
-       529, /* GL_EQUIV */
-       802, /* GL_INVERT */
-      1295, /* GL_OR_REVERSE */
-       351, /* GL_COPY_INVERTED */
-      1294, /* GL_OR_INVERTED */
-      1215, /* GL_NAND */
-      1751, /* GL_SET */
-       526, /* GL_EMISSION */
-      1761, /* GL_SHININESS */
+      1229, /* GL_NOOP */
+      2307, /* GL_XOR */
+      1297, /* GL_OR */
+      1230, /* GL_NOR */
+       530, /* GL_EQUIV */
+       805, /* GL_INVERT */
+      1300, /* GL_OR_REVERSE */
+       352, /* GL_COPY_INVERTED */
+      1299, /* GL_OR_INVERTED */
+      1219, /* GL_NAND */
+      1757, /* GL_SET */
+       527, /* GL_EMISSION */
+      1767, /* GL_SHININESS */
         57, /* GL_AMBIENT_AND_DIFFUSE */
        232, /* GL_COLOR_INDEXES */
-      1164, /* GL_MODELVIEW */
-      1483, /* GL_PROJECTION */
-      1892, /* GL_TEXTURE */
+      1168, /* GL_MODELVIEW */
+      1488, /* GL_PROJECTION */
+      1898, /* GL_TEXTURE */
        188, /* GL_COLOR */
-       398, /* GL_DEPTH */
-      1823, /* GL_STENCIL */
+       399, /* GL_DEPTH */
+      1829, /* GL_STENCIL */
        231, /* GL_COLOR_INDEX */
-      1844, /* GL_STENCIL_INDEX */
-       414, /* GL_DEPTH_COMPONENT */
-      1548, /* GL_RED */
-       696, /* GL_GREEN */
+      1850, /* GL_STENCIL_INDEX */
+       415, /* GL_DEPTH_COMPONENT */
+      1553, /* GL_RED */
+       697, /* GL_GREEN */
        110, /* GL_BLUE */
         32, /* GL_ALPHA */
-      1604, /* GL_RGB */
-      1644, /* GL_RGBA */
-       860, /* GL_LUMINANCE */
-       887, /* GL_LUMINANCE_ALPHA */
+      1610, /* GL_RGB */
+      1650, /* GL_RGBA */
+       864, /* GL_LUMINANCE */
+       891, /* GL_LUMINANCE_ALPHA */
         86, /* GL_BITMAP */
-      1347, /* GL_POINT */
-       824, /* GL_LINE */
-       544, /* GL_FILL */
-      1562, /* GL_RENDER */
-       540, /* GL_FEEDBACK */
-      1743, /* GL_SELECT */
-       551, /* GL_FLAT */
-      1772, /* GL_SMOOTH */
-       803, /* GL_KEEP */
-      1595, /* GL_REPLACE */
-       731, /* GL_INCR */
-       394, /* GL_DECR */
-      2221, /* GL_VENDOR */
-      1592, /* GL_RENDERER */
-      2222, /* GL_VERSION */
-       533, /* GL_EXTENSIONS */
-      1692, /* GL_S */
-      1883, /* GL_T */
-      1531, /* GL_R */
-      1510, /* GL_Q */
-      1201, /* GL_MODULATE */
-       393, /* GL_DECAL */
-      2053, /* GL_TEXTURE_ENV_MODE */
-      2052, /* GL_TEXTURE_ENV_COLOR */
-      2051, /* GL_TEXTURE_ENV */
-       534, /* GL_EYE_LINEAR */
-      1253, /* GL_OBJECT_LINEAR */
-      1798, /* GL_SPHERE_MAP */
-      2056, /* GL_TEXTURE_GEN_MODE */
-      1255, /* GL_OBJECT_PLANE */
-       535, /* GL_EYE_PLANE */
-      1216, /* GL_NEAREST */
-       825, /* GL_LINEAR */
-      1220, /* GL_NEAREST_MIPMAP_NEAREST */
-       830, /* GL_LINEAR_MIPMAP_NEAREST */
-      1219, /* GL_NEAREST_MIPMAP_LINEAR */
-       829, /* GL_LINEAR_MIPMAP_LINEAR */
-      2079, /* GL_TEXTURE_MAG_FILTER */
-      2088, /* GL_TEXTURE_MIN_FILTER */
-      2109, /* GL_TEXTURE_WRAP_S */
-      2110, /* GL_TEXTURE_WRAP_T */
+      1352, /* GL_POINT */
+       827, /* GL_LINE */
+       545, /* GL_FILL */
+      1567, /* GL_RENDER */
+       541, /* GL_FEEDBACK */
+      1749, /* GL_SELECT */
+       552, /* GL_FLAT */
+      1778, /* GL_SMOOTH */
+       806, /* GL_KEEP */
+      1600, /* GL_REPLACE */
+       733, /* GL_INCR */
+       395, /* GL_DECR */
+      2228, /* GL_VENDOR */
+      1597, /* GL_RENDERER */
+      2229, /* GL_VERSION */
+       534, /* GL_EXTENSIONS */
+      1698, /* GL_S */
+      1889, /* GL_T */
+      1536, /* GL_R */
+      1515, /* GL_Q */
+      1205, /* GL_MODULATE */
+       394, /* GL_DECAL */
+      2059, /* GL_TEXTURE_ENV_MODE */
+      2058, /* GL_TEXTURE_ENV_COLOR */
+      2057, /* GL_TEXTURE_ENV */
+       535, /* GL_EYE_LINEAR */
+      1258, /* GL_OBJECT_LINEAR */
+      1804, /* GL_SPHERE_MAP */
+      2062, /* GL_TEXTURE_GEN_MODE */
+      1260, /* GL_OBJECT_PLANE */
+       536, /* GL_EYE_PLANE */
+      1220, /* GL_NEAREST */
+       828, /* GL_LINEAR */
+      1224, /* GL_NEAREST_MIPMAP_NEAREST */
+       833, /* GL_LINEAR_MIPMAP_NEAREST */
+      1223, /* GL_NEAREST_MIPMAP_LINEAR */
+       832, /* GL_LINEAR_MIPMAP_LINEAR */
+      2085, /* GL_TEXTURE_MAG_FILTER */
+      2094, /* GL_TEXTURE_MIN_FILTER */
+      2115, /* GL_TEXTURE_WRAP_S */
+      2116, /* GL_TEXTURE_WRAP_T */
        155, /* GL_CLAMP */
-      1594, /* GL_REPEAT */
-      1391, /* GL_POLYGON_OFFSET_UNITS */
-      1390, /* GL_POLYGON_OFFSET_POINT */
-      1389, /* GL_POLYGON_OFFSET_LINE */
-      1534, /* GL_R3_G3_B2 */
-      2218, /* GL_V2F */
-      2219, /* GL_V3F */
+      1599, /* GL_REPEAT */
+      1396, /* GL_POLYGON_OFFSET_UNITS */
+      1395, /* GL_POLYGON_OFFSET_POINT */
+      1394, /* GL_POLYGON_OFFSET_LINE */
+      1539, /* GL_R3_G3_B2 */
+      2225, /* GL_V2F */
+      2226, /* GL_V3F */
        152, /* GL_C4UB_V2F */
        153, /* GL_C4UB_V3F */
        150, /* GL_C3F_V3F */
-      1213, /* GL_N3F_V3F */
+      1217, /* GL_N3F_V3F */
        151, /* GL_C4F_N3F_V3F */
-      1888, /* GL_T2F_V3F */
-      1890, /* GL_T4F_V4F */
-      1886, /* GL_T2F_C4UB_V3F */
-      1884, /* GL_T2F_C3F_V3F */
-      1887, /* GL_T2F_N3F_V3F */
-      1885, /* GL_T2F_C4F_N3F_V3F */
-      1889, /* GL_T4F_C4F_N3F_V4F */
+      1894, /* GL_T2F_V3F */
+      1896, /* GL_T4F_V4F */
+      1892, /* GL_T2F_C4UB_V3F */
+      1890, /* GL_T2F_C3F_V3F */
+      1893, /* GL_T2F_N3F_V3F */
+      1891, /* GL_T2F_C4F_N3F_V3F */
+      1895, /* GL_T4F_C4F_N3F_V4F */
        172, /* GL_CLIP_DISTANCE0 */
        173, /* GL_CLIP_DISTANCE1 */
        174, /* GL_CLIP_DISTANCE2 */
@@ -5086,184 +5100,184 @@ static const unsigned reduced_enums[1556] =
        177, /* GL_CLIP_DISTANCE5 */
        178, /* GL_CLIP_DISTANCE6 */
        179, /* GL_CLIP_DISTANCE7 */
-       809, /* GL_LIGHT0 */
-       810, /* GL_LIGHT1 */
-       811, /* GL_LIGHT2 */
-       812, /* GL_LIGHT3 */
-       813, /* GL_LIGHT4 */
-       814, /* GL_LIGHT5 */
-       815, /* GL_LIGHT6 */
-       816, /* GL_LIGHT7 */
-       706, /* GL_HINT_BIT */
+       812, /* GL_LIGHT0 */
+       813, /* GL_LIGHT1 */
+       814, /* GL_LIGHT2 */
+       815, /* GL_LIGHT3 */
+       816, /* GL_LIGHT4 */
+       817, /* GL_LIGHT5 */
+       818, /* GL_LIGHT6 */
+       819, /* GL_LIGHT7 */
+       708, /* GL_HINT_BIT */
        322, /* GL_CONSTANT_COLOR */
-      1266, /* GL_ONE_MINUS_CONSTANT_COLOR */
+      1271, /* GL_ONE_MINUS_CONSTANT_COLOR */
        317, /* GL_CONSTANT_ALPHA */
-      1264, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+      1269, /* GL_ONE_MINUS_CONSTANT_ALPHA */
         89, /* GL_BLEND_COLOR */
-       673, /* GL_FUNC_ADD */
-      1145, /* GL_MIN */
-      1013, /* GL_MAX */
+       674, /* GL_FUNC_ADD */
+      1149, /* GL_MIN */
+      1017, /* GL_MAX */
         96, /* GL_BLEND_EQUATION */
-       679, /* GL_FUNC_SUBTRACT */
-       676, /* GL_FUNC_REVERSE_SUBTRACT */
-       330, /* GL_CONVOLUTION_1D */
-       331, /* GL_CONVOLUTION_2D */
-      1746, /* GL_SEPARABLE_2D */
-       334, /* GL_CONVOLUTION_BORDER_MODE */
-       338, /* GL_CONVOLUTION_FILTER_SCALE */
-       336, /* GL_CONVOLUTION_FILTER_BIAS */
-      1549, /* GL_REDUCE */
-       340, /* GL_CONVOLUTION_FORMAT */
-       344, /* GL_CONVOLUTION_WIDTH */
-       342, /* GL_CONVOLUTION_HEIGHT */
-      1032, /* GL_MAX_CONVOLUTION_WIDTH */
-      1030, /* GL_MAX_CONVOLUTION_HEIGHT */
-      1430, /* GL_POST_CONVOLUTION_RED_SCALE */
-      1426, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-      1421, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-      1417, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-      1428, /* GL_POST_CONVOLUTION_RED_BIAS */
-      1424, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-      1419, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-      1415, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-       707, /* GL_HISTOGRAM */
-      1490, /* GL_PROXY_HISTOGRAM */
-       723, /* GL_HISTOGRAM_WIDTH */
-       713, /* GL_HISTOGRAM_FORMAT */
-       719, /* GL_HISTOGRAM_RED_SIZE */
-       715, /* GL_HISTOGRAM_GREEN_SIZE */
-       710, /* GL_HISTOGRAM_BLUE_SIZE */
-       708, /* GL_HISTOGRAM_ALPHA_SIZE */
-       717, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-       721, /* GL_HISTOGRAM_SINK */
-      1146, /* GL_MINMAX */
-      1148, /* GL_MINMAX_FORMAT */
-      1150, /* GL_MINMAX_SINK */
-      1891, /* GL_TABLE_TOO_LARGE_EXT */
-      2167, /* GL_UNSIGNED_BYTE_3_3_2 */
-      2207, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-      2210, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-      2179, /* GL_UNSIGNED_INT_8_8_8_8 */
-      2170, /* GL_UNSIGNED_INT_10_10_10_2 */
-      1388, /* GL_POLYGON_OFFSET_FILL */
-      1387, /* GL_POLYGON_OFFSET_FACTOR */
-      1386, /* GL_POLYGON_OFFSET_BIAS */
-      1598, /* GL_RESCALE_NORMAL */
+       680, /* GL_FUNC_SUBTRACT */
+       677, /* GL_FUNC_REVERSE_SUBTRACT */
+       331, /* GL_CONVOLUTION_1D */
+       332, /* GL_CONVOLUTION_2D */
+      1752, /* GL_SEPARABLE_2D */
+       335, /* GL_CONVOLUTION_BORDER_MODE */
+       339, /* GL_CONVOLUTION_FILTER_SCALE */
+       337, /* GL_CONVOLUTION_FILTER_BIAS */
+      1554, /* GL_REDUCE */
+       341, /* GL_CONVOLUTION_FORMAT */
+       345, /* GL_CONVOLUTION_WIDTH */
+       343, /* GL_CONVOLUTION_HEIGHT */
+      1036, /* GL_MAX_CONVOLUTION_WIDTH */
+      1034, /* GL_MAX_CONVOLUTION_HEIGHT */
+      1435, /* GL_POST_CONVOLUTION_RED_SCALE */
+      1431, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+      1426, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+      1422, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+      1433, /* GL_POST_CONVOLUTION_RED_BIAS */
+      1429, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+      1424, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+      1420, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+       709, /* GL_HISTOGRAM */
+      1495, /* GL_PROXY_HISTOGRAM */
+       725, /* GL_HISTOGRAM_WIDTH */
+       715, /* GL_HISTOGRAM_FORMAT */
+       721, /* GL_HISTOGRAM_RED_SIZE */
+       717, /* GL_HISTOGRAM_GREEN_SIZE */
+       712, /* GL_HISTOGRAM_BLUE_SIZE */
+       710, /* GL_HISTOGRAM_ALPHA_SIZE */
+       719, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+       723, /* GL_HISTOGRAM_SINK */
+      1150, /* GL_MINMAX */
+      1152, /* GL_MINMAX_FORMAT */
+      1154, /* GL_MINMAX_SINK */
+      1897, /* GL_TABLE_TOO_LARGE_EXT */
+      2174, /* GL_UNSIGNED_BYTE_3_3_2 */
+      2214, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+      2217, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+      2186, /* GL_UNSIGNED_INT_8_8_8_8 */
+      2177, /* GL_UNSIGNED_INT_10_10_10_2 */
+      1393, /* GL_POLYGON_OFFSET_FILL */
+      1392, /* GL_POLYGON_OFFSET_FACTOR */
+      1391, /* GL_POLYGON_OFFSET_BIAS */
+      1603, /* GL_RESCALE_NORMAL */
         41, /* GL_ALPHA4 */
         43, /* GL_ALPHA8 */
         33, /* GL_ALPHA12 */
         35, /* GL_ALPHA16 */
-       875, /* GL_LUMINANCE4 */
-       881, /* GL_LUMINANCE8 */
-       861, /* GL_LUMINANCE12 */
-       867, /* GL_LUMINANCE16 */
-       876, /* GL_LUMINANCE4_ALPHA4 */
-       879, /* GL_LUMINANCE6_ALPHA2 */
-       884, /* GL_LUMINANCE8_ALPHA8 */
-       864, /* GL_LUMINANCE12_ALPHA4 */
-       862, /* GL_LUMINANCE12_ALPHA12 */
-       870, /* GL_LUMINANCE16_ALPHA16 */
-       750, /* GL_INTENSITY */
-       759, /* GL_INTENSITY4 */
-       761, /* GL_INTENSITY8 */
-       751, /* GL_INTENSITY12 */
-       753, /* GL_INTENSITY16 */
-      1619, /* GL_RGB2_EXT */
-      1625, /* GL_RGB4 */
-      1628, /* GL_RGB5 */
-      1635, /* GL_RGB8 */
-      1605, /* GL_RGB10 */
-      1609, /* GL_RGB12 */
-      1611, /* GL_RGB16 */
-      1655, /* GL_RGBA2 */
-      1662, /* GL_RGBA4 */
-      1631, /* GL_RGB5_A1 */
-      1667, /* GL_RGBA8 */
-      1606, /* GL_RGB10_A2 */
-      1645, /* GL_RGBA12 */
-      1647, /* GL_RGBA16 */
-      2096, /* GL_TEXTURE_RED_SIZE */
-      2064, /* GL_TEXTURE_GREEN_SIZE */
-      1985, /* GL_TEXTURE_BLUE_SIZE */
-      1965, /* GL_TEXTURE_ALPHA_SIZE */
-      2077, /* GL_TEXTURE_LUMINANCE_SIZE */
-      2068, /* GL_TEXTURE_INTENSITY_SIZE */
-      1596, /* GL_REPLACE_EXT */
-      1494, /* GL_PROXY_TEXTURE_1D */
-      1498, /* GL_PROXY_TEXTURE_2D */
-      2104, /* GL_TEXTURE_TOO_LARGE_EXT */
-      2090, /* GL_TEXTURE_PRIORITY */
-      2098, /* GL_TEXTURE_RESIDENT */
-      1968, /* GL_TEXTURE_BINDING_1D */
-      1971, /* GL_TEXTURE_BINDING_2D */
-      1974, /* GL_TEXTURE_BINDING_3D */
-      1302, /* GL_PACK_SKIP_IMAGES */
-      1298, /* GL_PACK_IMAGE_HEIGHT */
-      2160, /* GL_UNPACK_SKIP_IMAGES */
-      2157, /* GL_UNPACK_IMAGE_HEIGHT */
-      1963, /* GL_TEXTURE_3D */
-      1502, /* GL_PROXY_TEXTURE_3D */
-      2048, /* GL_TEXTURE_DEPTH */
-      2107, /* GL_TEXTURE_WRAP_R */
-      1014, /* GL_MAX_3D_TEXTURE_SIZE */
-      2223, /* GL_VERTEX_ARRAY */
-      1228, /* GL_NORMAL_ARRAY */
+       879, /* GL_LUMINANCE4 */
+       885, /* GL_LUMINANCE8 */
+       865, /* GL_LUMINANCE12 */
+       871, /* GL_LUMINANCE16 */
+       880, /* GL_LUMINANCE4_ALPHA4 */
+       883, /* GL_LUMINANCE6_ALPHA2 */
+       888, /* GL_LUMINANCE8_ALPHA8 */
+       868, /* GL_LUMINANCE12_ALPHA4 */
+       866, /* GL_LUMINANCE12_ALPHA12 */
+       874, /* GL_LUMINANCE16_ALPHA16 */
+       753, /* GL_INTENSITY */
+       762, /* GL_INTENSITY4 */
+       764, /* GL_INTENSITY8 */
+       754, /* GL_INTENSITY12 */
+       756, /* GL_INTENSITY16 */
+      1625, /* GL_RGB2_EXT */
+      1631, /* GL_RGB4 */
+      1634, /* GL_RGB5 */
+      1641, /* GL_RGB8 */
+      1611, /* GL_RGB10 */
+      1615, /* GL_RGB12 */
+      1617, /* GL_RGB16 */
+      1661, /* GL_RGBA2 */
+      1668, /* GL_RGBA4 */
+      1637, /* GL_RGB5_A1 */
+      1673, /* GL_RGBA8 */
+      1612, /* GL_RGB10_A2 */
+      1651, /* GL_RGBA12 */
+      1653, /* GL_RGBA16 */
+      2102, /* GL_TEXTURE_RED_SIZE */
+      2070, /* GL_TEXTURE_GREEN_SIZE */
+      1991, /* GL_TEXTURE_BLUE_SIZE */
+      1971, /* GL_TEXTURE_ALPHA_SIZE */
+      2083, /* GL_TEXTURE_LUMINANCE_SIZE */
+      2074, /* GL_TEXTURE_INTENSITY_SIZE */
+      1601, /* GL_REPLACE_EXT */
+      1499, /* GL_PROXY_TEXTURE_1D */
+      1503, /* GL_PROXY_TEXTURE_2D */
+      2110, /* GL_TEXTURE_TOO_LARGE_EXT */
+      2096, /* GL_TEXTURE_PRIORITY */
+      2104, /* GL_TEXTURE_RESIDENT */
+      1974, /* GL_TEXTURE_BINDING_1D */
+      1977, /* GL_TEXTURE_BINDING_2D */
+      1980, /* GL_TEXTURE_BINDING_3D */
+      1307, /* GL_PACK_SKIP_IMAGES */
+      1303, /* GL_PACK_IMAGE_HEIGHT */
+      2167, /* GL_UNPACK_SKIP_IMAGES */
+      2164, /* GL_UNPACK_IMAGE_HEIGHT */
+      1969, /* GL_TEXTURE_3D */
+      1507, /* GL_PROXY_TEXTURE_3D */
+      2054, /* GL_TEXTURE_DEPTH */
+      2113, /* GL_TEXTURE_WRAP_R */
+      1018, /* GL_MAX_3D_TEXTURE_SIZE */
+      2230, /* GL_VERTEX_ARRAY */
+      1232, /* GL_NORMAL_ARRAY */
        189, /* GL_COLOR_ARRAY */
-       735, /* GL_INDEX_ARRAY */
-      2018, /* GL_TEXTURE_COORD_ARRAY */
-       518, /* GL_EDGE_FLAG_ARRAY */
-      2229, /* GL_VERTEX_ARRAY_SIZE */
-      2231, /* GL_VERTEX_ARRAY_TYPE */
-      2230, /* GL_VERTEX_ARRAY_STRIDE */
-      1233, /* GL_NORMAL_ARRAY_TYPE */
-      1232, /* GL_NORMAL_ARRAY_STRIDE */
+       737, /* GL_INDEX_ARRAY */
+      2024, /* GL_TEXTURE_COORD_ARRAY */
+       519, /* GL_EDGE_FLAG_ARRAY */
+      2236, /* GL_VERTEX_ARRAY_SIZE */
+      2238, /* GL_VERTEX_ARRAY_TYPE */
+      2237, /* GL_VERTEX_ARRAY_STRIDE */
+      1237, /* GL_NORMAL_ARRAY_TYPE */
+      1236, /* GL_NORMAL_ARRAY_STRIDE */
        193, /* GL_COLOR_ARRAY_SIZE */
        195, /* GL_COLOR_ARRAY_TYPE */
        194, /* GL_COLOR_ARRAY_STRIDE */
-       740, /* GL_INDEX_ARRAY_TYPE */
-       739, /* GL_INDEX_ARRAY_STRIDE */
-      2022, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-      2024, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-      2023, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-       522, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-      2228, /* GL_VERTEX_ARRAY_POINTER */
-      1231, /* GL_NORMAL_ARRAY_POINTER */
+       742, /* GL_INDEX_ARRAY_TYPE */
+       741, /* GL_INDEX_ARRAY_STRIDE */
+      2028, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+      2030, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+      2029, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+       523, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+      2235, /* GL_VERTEX_ARRAY_POINTER */
+      1235, /* GL_NORMAL_ARRAY_POINTER */
        192, /* GL_COLOR_ARRAY_POINTER */
-       738, /* GL_INDEX_ARRAY_POINTER */
-      2021, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-       521, /* GL_EDGE_FLAG_ARRAY_POINTER */
-      1206, /* GL_MULTISAMPLE */
-      1720, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-      1722, /* GL_SAMPLE_ALPHA_TO_ONE */
-      1727, /* GL_SAMPLE_COVERAGE */
-      1724, /* GL_SAMPLE_BUFFERS */
-      1715, /* GL_SAMPLES */
-      1731, /* GL_SAMPLE_COVERAGE_VALUE */
-      1729, /* GL_SAMPLE_COVERAGE_INVERT */
+       740, /* GL_INDEX_ARRAY_POINTER */
+      2027, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+       522, /* GL_EDGE_FLAG_ARRAY_POINTER */
+      1210, /* GL_MULTISAMPLE */
+      1726, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+      1728, /* GL_SAMPLE_ALPHA_TO_ONE */
+      1733, /* GL_SAMPLE_COVERAGE */
+      1730, /* GL_SAMPLE_BUFFERS */
+      1721, /* GL_SAMPLES */
+      1737, /* GL_SAMPLE_COVERAGE_VALUE */
+      1735, /* GL_SAMPLE_COVERAGE_INVERT */
        237, /* GL_COLOR_MATRIX */
        239, /* GL_COLOR_MATRIX_STACK_DEPTH */
-      1026, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-      1413, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-      1409, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-      1404, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-      1400, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-      1411, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-      1407, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-      1402, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-      1398, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-      2001, /* GL_TEXTURE_COLOR_TABLE_SGI */
-      1503, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-      2003, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+      1030, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+      1418, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+      1414, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+      1409, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+      1405, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+      1416, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+      1412, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+      1407, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+      1403, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+      2007, /* GL_TEXTURE_COLOR_TABLE_SGI */
+      1508, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+      2009, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
         94, /* GL_BLEND_DST_RGB */
        108, /* GL_BLEND_SRC_RGB */
         92, /* GL_BLEND_DST_ALPHA */
        106, /* GL_BLEND_SRC_ALPHA */
        243, /* GL_COLOR_TABLE */
-      1423, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-      1406, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-      1489, /* GL_PROXY_COLOR_TABLE */
-      1493, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-      1492, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+      1428, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+      1411, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+      1494, /* GL_PROXY_COLOR_TABLE */
+      1498, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+      1497, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
        267, /* GL_COLOR_TABLE_SCALE */
        247, /* GL_COLOR_TABLE_BIAS */
        252, /* GL_COLOR_TABLE_FORMAT */
@@ -5276,748 +5290,754 @@ static const unsigned reduced_enums[1556] =
        258, /* GL_COLOR_TABLE_INTENSITY_SIZE */
         79, /* GL_BGR */
         80, /* GL_BGRA */
-      1041, /* GL_MAX_ELEMENTS_VERTICES */
-      1040, /* GL_MAX_ELEMENTS_INDICES */
-      2067, /* GL_TEXTURE_INDEX_SIZE_EXT */
+      1045, /* GL_MAX_ELEMENTS_VERTICES */
+      1044, /* GL_MAX_ELEMENTS_INDICES */
+      2073, /* GL_TEXTURE_INDEX_SIZE_EXT */
        186, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
-      1369, /* GL_POINT_SIZE_MIN */
-      1365, /* GL_POINT_SIZE_MAX */
-      1354, /* GL_POINT_FADE_THRESHOLD_SIZE */
-      1350, /* GL_POINT_DISTANCE_ATTENUATION */
+      1374, /* GL_POINT_SIZE_MIN */
+      1370, /* GL_POINT_SIZE_MAX */
+      1359, /* GL_POINT_FADE_THRESHOLD_SIZE */
+      1355, /* GL_POINT_DISTANCE_ATTENUATION */
        159, /* GL_CLAMP_TO_BORDER */
        162, /* GL_CLAMP_TO_EDGE */
-      2089, /* GL_TEXTURE_MIN_LOD */
-      2087, /* GL_TEXTURE_MAX_LOD */
-      1967, /* GL_TEXTURE_BASE_LEVEL */
-      2086, /* GL_TEXTURE_MAX_LEVEL */
-       726, /* GL_IGNORE_BORDER_HP */
+      2095, /* GL_TEXTURE_MIN_LOD */
+      2093, /* GL_TEXTURE_MAX_LOD */
+      1973, /* GL_TEXTURE_BASE_LEVEL */
+      2092, /* GL_TEXTURE_MAX_LEVEL */
+       728, /* GL_IGNORE_BORDER_HP */
        321, /* GL_CONSTANT_BORDER_HP */
-      1597, /* GL_REPLICATE_BORDER_HP */
-       332, /* GL_CONVOLUTION_BORDER_COLOR */
-      1261, /* GL_OCCLUSION_TEST_HP */
-      1262, /* GL_OCCLUSION_TEST_RESULT_HP */
-       827, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-      1995, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-      1997, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-      1999, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-      2000, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1998, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-      1996, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-      1020, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-      1021, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1433, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-      1435, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-      1432, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-      1434, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-      2075, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-      2076, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-      2074, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-       682, /* GL_GENERATE_MIPMAP */
-       683, /* GL_GENERATE_MIPMAP_HINT */
-       595, /* GL_FOG_OFFSET_SGIX */
-       596, /* GL_FOG_OFFSET_VALUE_SGIX */
-      2009, /* GL_TEXTURE_COMPARE_SGIX */
-      2008, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-      2071, /* GL_TEXTURE_LEQUAL_R_SGIX */
-      2063, /* GL_TEXTURE_GEQUAL_R_SGIX */
-       415, /* GL_DEPTH_COMPONENT16 */
-       419, /* GL_DEPTH_COMPONENT24 */
-       423, /* GL_DEPTH_COMPONENT32 */
-       357, /* GL_CULL_VERTEX_EXT */
-       359, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
-       358, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
-      2296, /* GL_WRAP_BORDER_SUN */
-      2002, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-       820, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-      1765, /* GL_SINGLE_COLOR */
-      1749, /* GL_SEPARATE_SPECULAR_COLOR */
-      1760, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-       607, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-       608, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-       619, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-       610, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-       606, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-       605, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-       609, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-       620, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-       637, /* GL_FRAMEBUFFER_DEFAULT */
-       664, /* GL_FRAMEBUFFER_UNDEFINED */
-       431, /* GL_DEPTH_STENCIL_ATTACHMENT */
-       896, /* GL_MAJOR_VERSION */
-      1152, /* GL_MINOR_VERSION */
-      1242, /* GL_NUM_EXTENSIONS */
+      1602, /* GL_REPLICATE_BORDER_HP */
+       333, /* GL_CONVOLUTION_BORDER_COLOR */
+      1266, /* GL_OCCLUSION_TEST_HP */
+      1267, /* GL_OCCLUSION_TEST_RESULT_HP */
+       830, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+      2001, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+      2003, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+      2005, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+      2006, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      2004, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+      2002, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+      1024, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+      1025, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      1438, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+      1440, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+      1437, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+      1439, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+      2081, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+      2082, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+      2080, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+       683, /* GL_GENERATE_MIPMAP */
+       684, /* GL_GENERATE_MIPMAP_HINT */
+       596, /* GL_FOG_OFFSET_SGIX */
+       597, /* GL_FOG_OFFSET_VALUE_SGIX */
+      2015, /* GL_TEXTURE_COMPARE_SGIX */
+      2014, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+      2077, /* GL_TEXTURE_LEQUAL_R_SGIX */
+      2069, /* GL_TEXTURE_GEQUAL_R_SGIX */
+       416, /* GL_DEPTH_COMPONENT16 */
+       420, /* GL_DEPTH_COMPONENT24 */
+       424, /* GL_DEPTH_COMPONENT32 */
+       358, /* GL_CULL_VERTEX_EXT */
+       360, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
+       359, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
+      2303, /* GL_WRAP_BORDER_SUN */
+      2008, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+       823, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+      1771, /* GL_SINGLE_COLOR */
+      1755, /* GL_SEPARATE_SPECULAR_COLOR */
+      1766, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+       608, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+       609, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+       620, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+       611, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+       607, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+       606, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+       610, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+       621, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+       638, /* GL_FRAMEBUFFER_DEFAULT */
+       665, /* GL_FRAMEBUFFER_UNDEFINED */
+       432, /* GL_DEPTH_STENCIL_ATTACHMENT */
+       900, /* GL_MAJOR_VERSION */
+      1156, /* GL_MINOR_VERSION */
+      1247, /* GL_NUM_EXTENSIONS */
        327, /* GL_CONTEXT_FLAGS */
-       734, /* GL_INDEX */
-       409, /* GL_DEPTH_BUFFER */
-      1839, /* GL_STENCIL_BUFFER */
+       736, /* GL_INDEX */
+       410, /* GL_DEPTH_BUFFER */
+      1845, /* GL_STENCIL_BUFFER */
        298, /* GL_COMPRESSED_RED */
        299, /* GL_COMPRESSED_RG */
-      2166, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-      2211, /* GL_UNSIGNED_SHORT_5_6_5 */
-      2212, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-      2208, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-      2205, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-      2180, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-      2176, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-      2084, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-      2085, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-      2083, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-      1156, /* GL_MIRRORED_REPEAT */
-      1685, /* GL_RGB_S3TC */
-      1627, /* GL_RGB4_S3TC */
-      1681, /* GL_RGBA_S3TC */
-      1666, /* GL_RGBA4_S3TC */
-      1675, /* GL_RGBA_DXT5_S3TC */
-      1663, /* GL_RGBA4_DXT5_S3TC */
+       860, /* GL_LOSE_CONTEXT_ON_RESET_ARB */
+       703, /* GL_GUILTY_CONTEXT_RESET_ARB */
+       751, /* GL_INNOCENT_CONTEXT_RESET_ARB */
+      2162, /* GL_UNKNOWN_CONTEXT_RESET_ARB */
+      1605, /* GL_RESET_NOTIFICATION_STRATEGY_ARB */
+      1244, /* GL_NO_RESET_NOTIFICATION_ARB */
+      2173, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+      2218, /* GL_UNSIGNED_SHORT_5_6_5 */
+      2219, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+      2215, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+      2212, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+      2187, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+      2183, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+      2090, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+      2091, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+      2089, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+      1160, /* GL_MIRRORED_REPEAT */
+      1691, /* GL_RGB_S3TC */
+      1633, /* GL_RGB4_S3TC */
+      1687, /* GL_RGBA_S3TC */
+      1672, /* GL_RGBA4_S3TC */
+      1681, /* GL_RGBA_DXT5_S3TC */
+      1669, /* GL_RGBA4_DXT5_S3TC */
        309, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
        304, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
        305, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
        306, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
-      1218, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-      1217, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-       828, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-       582, /* GL_FOG_COORDINATE_SOURCE */
-       574, /* GL_FOG_COORD */
-       598, /* GL_FRAGMENT_DEPTH */
-       363, /* GL_CURRENT_FOG_COORD */
-       581, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-       580, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-       579, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-       576, /* GL_FOG_COORDINATE_ARRAY */
+      1222, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+      1221, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+       831, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+       583, /* GL_FOG_COORDINATE_SOURCE */
+       575, /* GL_FOG_COORD */
+       599, /* GL_FRAGMENT_DEPTH */
+       364, /* GL_CURRENT_FOG_COORD */
+       582, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+       581, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+       580, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+       577, /* GL_FOG_COORDINATE_ARRAY */
        241, /* GL_COLOR_SUM */
-       384, /* GL_CURRENT_SECONDARY_COLOR */
-      1740, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-      1742, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-      1741, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-      1739, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-      1736, /* GL_SECONDARY_COLOR_ARRAY */
-       382, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
+       385, /* GL_CURRENT_SECONDARY_COLOR */
+      1746, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+      1748, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+      1747, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+      1745, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+      1742, /* GL_SECONDARY_COLOR_ARRAY */
+       383, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
         29, /* GL_ALIASED_POINT_SIZE_RANGE */
         28, /* GL_ALIASED_LINE_WIDTH_RANGE */
-      1893, /* GL_TEXTURE0 */
-      1895, /* GL_TEXTURE1 */
-      1917, /* GL_TEXTURE2 */
-      1939, /* GL_TEXTURE3 */
-      1945, /* GL_TEXTURE4 */
-      1947, /* GL_TEXTURE5 */
-      1949, /* GL_TEXTURE6 */
-      1951, /* GL_TEXTURE7 */
-      1953, /* GL_TEXTURE8 */
-      1955, /* GL_TEXTURE9 */
-      1896, /* GL_TEXTURE10 */
-      1898, /* GL_TEXTURE11 */
-      1900, /* GL_TEXTURE12 */
-      1902, /* GL_TEXTURE13 */
-      1904, /* GL_TEXTURE14 */
-      1906, /* GL_TEXTURE15 */
-      1908, /* GL_TEXTURE16 */
-      1910, /* GL_TEXTURE17 */
-      1912, /* GL_TEXTURE18 */
-      1914, /* GL_TEXTURE19 */
-      1918, /* GL_TEXTURE20 */
-      1920, /* GL_TEXTURE21 */
-      1922, /* GL_TEXTURE22 */
-      1924, /* GL_TEXTURE23 */
-      1926, /* GL_TEXTURE24 */
-      1928, /* GL_TEXTURE25 */
-      1930, /* GL_TEXTURE26 */
-      1932, /* GL_TEXTURE27 */
-      1934, /* GL_TEXTURE28 */
-      1936, /* GL_TEXTURE29 */
-      1940, /* GL_TEXTURE30 */
-      1942, /* GL_TEXTURE31 */
+      1899, /* GL_TEXTURE0 */
+      1901, /* GL_TEXTURE1 */
+      1923, /* GL_TEXTURE2 */
+      1945, /* GL_TEXTURE3 */
+      1951, /* GL_TEXTURE4 */
+      1953, /* GL_TEXTURE5 */
+      1955, /* GL_TEXTURE6 */
+      1957, /* GL_TEXTURE7 */
+      1959, /* GL_TEXTURE8 */
+      1961, /* GL_TEXTURE9 */
+      1902, /* GL_TEXTURE10 */
+      1904, /* GL_TEXTURE11 */
+      1906, /* GL_TEXTURE12 */
+      1908, /* GL_TEXTURE13 */
+      1910, /* GL_TEXTURE14 */
+      1912, /* GL_TEXTURE15 */
+      1914, /* GL_TEXTURE16 */
+      1916, /* GL_TEXTURE17 */
+      1918, /* GL_TEXTURE18 */
+      1920, /* GL_TEXTURE19 */
+      1924, /* GL_TEXTURE20 */
+      1926, /* GL_TEXTURE21 */
+      1928, /* GL_TEXTURE22 */
+      1930, /* GL_TEXTURE23 */
+      1932, /* GL_TEXTURE24 */
+      1934, /* GL_TEXTURE25 */
+      1936, /* GL_TEXTURE26 */
+      1938, /* GL_TEXTURE27 */
+      1940, /* GL_TEXTURE28 */
+      1942, /* GL_TEXTURE29 */
+      1946, /* GL_TEXTURE30 */
+      1948, /* GL_TEXTURE31 */
         19, /* GL_ACTIVE_TEXTURE */
        166, /* GL_CLIENT_ACTIVE_TEXTURE */
-      1117, /* GL_MAX_TEXTURE_UNITS */
-      2139, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-      2142, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-      2144, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-      2136, /* GL_TRANSPOSE_COLOR_MATRIX */
-      1875, /* GL_SUBTRACT */
-      1098, /* GL_MAX_RENDERBUFFER_SIZE */
+      1121, /* GL_MAX_TEXTURE_UNITS */
+      2145, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+      2148, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+      2150, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+      2142, /* GL_TRANSPOSE_COLOR_MATRIX */
+      1881, /* GL_SUBTRACT */
+      1102, /* GL_MAX_RENDERBUFFER_SIZE */
        290, /* GL_COMPRESSED_ALPHA */
        294, /* GL_COMPRESSED_LUMINANCE */
        295, /* GL_COMPRESSED_LUMINANCE_ALPHA */
        292, /* GL_COMPRESSED_INTENSITY */
        300, /* GL_COMPRESSED_RGB */
        301, /* GL_COMPRESSED_RGBA */
-      2016, /* GL_TEXTURE_COMPRESSION_HINT */
-      2093, /* GL_TEXTURE_RECTANGLE */
-      1981, /* GL_TEXTURE_BINDING_RECTANGLE */
-      1506, /* GL_PROXY_TEXTURE_RECTANGLE */
-      1095, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */
-       430, /* GL_DEPTH_STENCIL */
-      2172, /* GL_UNSIGNED_INT_24_8 */
-      1112, /* GL_MAX_TEXTURE_LOD_BIAS */
-      2082, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-      1114, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-      2054, /* GL_TEXTURE_FILTER_CONTROL */
-      2072, /* GL_TEXTURE_LOD_BIAS */
+      2022, /* GL_TEXTURE_COMPRESSION_HINT */
+      2099, /* GL_TEXTURE_RECTANGLE */
+      1987, /* GL_TEXTURE_BINDING_RECTANGLE */
+      1511, /* GL_PROXY_TEXTURE_RECTANGLE */
+      1099, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */
+       431, /* GL_DEPTH_STENCIL */
+      2179, /* GL_UNSIGNED_INT_24_8 */
+      1116, /* GL_MAX_TEXTURE_LOD_BIAS */
+      2088, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+      1118, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+      2060, /* GL_TEXTURE_FILTER_CONTROL */
+      2078, /* GL_TEXTURE_LOD_BIAS */
        274, /* GL_COMBINE4 */
-      1104, /* GL_MAX_SHININESS_NV */
-      1105, /* GL_MAX_SPOT_EXPONENT_NV */
-       732, /* GL_INCR_WRAP */
-       395, /* GL_DECR_WRAP */
-      1176, /* GL_MODELVIEW1_ARB */
-      1234, /* GL_NORMAL_MAP */
-      1557, /* GL_REFLECTION_MAP */
-      2026, /* GL_TEXTURE_CUBE_MAP */
-      1978, /* GL_TEXTURE_BINDING_CUBE_MAP */
-      2038, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-      2028, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-      2041, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-      2031, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-      2044, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-      2034, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-      1504, /* GL_PROXY_TEXTURE_CUBE_MAP */
-      1034, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-      1212, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-      1447, /* GL_PRIMITIVE_RESTART_NV */
-      1446, /* GL_PRIMITIVE_RESTART_INDEX_NV */
-       590, /* GL_FOG_DISTANCE_MODE_NV */
-       537, /* GL_EYE_RADIAL_NV */
-       536, /* GL_EYE_PLANE_ABSOLUTE_NV */
+      1108, /* GL_MAX_SHININESS_NV */
+      1109, /* GL_MAX_SPOT_EXPONENT_NV */
+       734, /* GL_INCR_WRAP */
+       396, /* GL_DECR_WRAP */
+      1180, /* GL_MODELVIEW1_ARB */
+      1238, /* GL_NORMAL_MAP */
+      1562, /* GL_REFLECTION_MAP */
+      2032, /* GL_TEXTURE_CUBE_MAP */
+      1984, /* GL_TEXTURE_BINDING_CUBE_MAP */
+      2044, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+      2034, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+      2047, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+      2037, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+      2050, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+      2040, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+      1509, /* GL_PROXY_TEXTURE_CUBE_MAP */
+      1038, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+      1216, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+      1452, /* GL_PRIMITIVE_RESTART_NV */
+      1451, /* GL_PRIMITIVE_RESTART_INDEX_NV */
+       591, /* GL_FOG_DISTANCE_MODE_NV */
+       538, /* GL_EYE_RADIAL_NV */
+       537, /* GL_EYE_PLANE_ABSOLUTE_NV */
        273, /* GL_COMBINE */
        280, /* GL_COMBINE_RGB */
        275, /* GL_COMBINE_ALPHA */
-      1686, /* GL_RGB_SCALE */
+      1692, /* GL_RGB_SCALE */
         25, /* GL_ADD_SIGNED */
-       768, /* GL_INTERPOLATE */
+       771, /* GL_INTERPOLATE */
        316, /* GL_CONSTANT */
-      1439, /* GL_PRIMARY_COLOR */
-      1436, /* GL_PREVIOUS */
-      1780, /* GL_SOURCE0_RGB */
-      1786, /* GL_SOURCE1_RGB */
-      1792, /* GL_SOURCE2_RGB */
-      1796, /* GL_SOURCE3_RGB_NV */
-      1777, /* GL_SOURCE0_ALPHA */
-      1783, /* GL_SOURCE1_ALPHA */
-      1789, /* GL_SOURCE2_ALPHA */
-      1795, /* GL_SOURCE3_ALPHA_NV */
-      1275, /* GL_OPERAND0_RGB */
-      1281, /* GL_OPERAND1_RGB */
-      1287, /* GL_OPERAND2_RGB */
-      1291, /* GL_OPERAND3_RGB_NV */
-      1272, /* GL_OPERAND0_ALPHA */
-      1278, /* GL_OPERAND1_ALPHA */
-      1284, /* GL_OPERAND2_ALPHA */
-      1290, /* GL_OPERAND3_ALPHA_NV */
+      1444, /* GL_PRIMARY_COLOR */
+      1441, /* GL_PREVIOUS */
+      1786, /* GL_SOURCE0_RGB */
+      1792, /* GL_SOURCE1_RGB */
+      1798, /* GL_SOURCE2_RGB */
+      1802, /* GL_SOURCE3_RGB_NV */
+      1783, /* GL_SOURCE0_ALPHA */
+      1789, /* GL_SOURCE1_ALPHA */
+      1795, /* GL_SOURCE2_ALPHA */
+      1801, /* GL_SOURCE3_ALPHA_NV */
+      1280, /* GL_OPERAND0_RGB */
+      1286, /* GL_OPERAND1_RGB */
+      1292, /* GL_OPERAND2_RGB */
+      1296, /* GL_OPERAND3_RGB_NV */
+      1277, /* GL_OPERAND0_ALPHA */
+      1283, /* GL_OPERAND1_ALPHA */
+      1289, /* GL_OPERAND2_ALPHA */
+      1295, /* GL_OPERAND3_ALPHA_NV */
        137, /* GL_BUFFER_OBJECT_APPLE */
-      2224, /* GL_VERTEX_ARRAY_BINDING */
-      2091, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
-      2092, /* GL_TEXTURE_RANGE_POINTER_APPLE */
-      2301, /* GL_YCBCR_422_APPLE */
-      2213, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-      2215, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-      2103, /* GL_TEXTURE_STORAGE_HINT_APPLE */
-      1866, /* GL_STORAGE_PRIVATE_APPLE */
-      1865, /* GL_STORAGE_CACHED_APPLE */
-      1867, /* GL_STORAGE_SHARED_APPLE */
-      1767, /* GL_SLICE_ACCUM_SUN */
-      1515, /* GL_QUAD_MESH_SUN */
-      2150, /* GL_TRIANGLE_MESH_SUN */
-      2266, /* GL_VERTEX_PROGRAM_ARB */
-      2277, /* GL_VERTEX_STATE_PROGRAM_NV */
-      2251, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-      2259, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-      2261, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-      2263, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
-       386, /* GL_CURRENT_VERTEX_ATTRIB */
-      1460, /* GL_PROGRAM_LENGTH_ARB */
-      1476, /* GL_PROGRAM_STRING_ARB */
-      1199, /* GL_MODELVIEW_PROJECTION_NV */
-       725, /* GL_IDENTITY_NV */
-       800, /* GL_INVERSE_NV */
-      2141, /* GL_TRANSPOSE_NV */
-       801, /* GL_INVERSE_TRANSPOSE_NV */
-      1079, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-      1078, /* GL_MAX_PROGRAM_MATRICES_ARB */
-       960, /* GL_MATRIX0_NV */
-       972, /* GL_MATRIX1_NV */
-       984, /* GL_MATRIX2_NV */
-       988, /* GL_MATRIX3_NV */
-       990, /* GL_MATRIX4_NV */
-       992, /* GL_MATRIX5_NV */
-       994, /* GL_MATRIX6_NV */
-       996, /* GL_MATRIX7_NV */
-       369, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
-       366, /* GL_CURRENT_MATRIX_ARB */
-      1473, /* GL_PROGRAM_POINT_SIZE */
-      2272, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-      1472, /* GL_PROGRAM_PARAMETER_NV */
-      2257, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-      1478, /* GL_PROGRAM_TARGET_NV */
-      1475, /* GL_PROGRAM_RESIDENT_NV */
-      2113, /* GL_TRACK_MATRIX_NV */
-      2114, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-      2267, /* GL_VERTEX_PROGRAM_BINDING_NV */
-      1454, /* GL_PROGRAM_ERROR_POSITION_ARB */
-       411, /* GL_DEPTH_CLAMP */
-      2232, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-      2239, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-      2240, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-      2241, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-      2242, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-      2243, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-      2244, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-      2245, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-      2246, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-      2247, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-      2233, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-      2234, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-      2235, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-      2236, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-      2237, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-      2238, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-       908, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-       915, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-       916, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-       917, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-       918, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-       919, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-       920, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-       921, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-       922, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-       923, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-       909, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-       910, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-       911, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-       912, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-       913, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-       914, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-       935, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-       942, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-       943, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-       944, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-       945, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-       946, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-       947, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-      1453, /* GL_PROGRAM_BINDING_ARB */
-       949, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-       950, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-       936, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-       937, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-       938, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-       939, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-       940, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-       941, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-      2014, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-      2011, /* GL_TEXTURE_COMPRESSED */
-      1240, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+      2231, /* GL_VERTEX_ARRAY_BINDING */
+      2097, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+      2098, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+      2308, /* GL_YCBCR_422_APPLE */
+      2220, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+      2222, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+      2109, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+      1872, /* GL_STORAGE_PRIVATE_APPLE */
+      1871, /* GL_STORAGE_CACHED_APPLE */
+      1873, /* GL_STORAGE_SHARED_APPLE */
+      1773, /* GL_SLICE_ACCUM_SUN */
+      1520, /* GL_QUAD_MESH_SUN */
+      2156, /* GL_TRIANGLE_MESH_SUN */
+      2273, /* GL_VERTEX_PROGRAM_ARB */
+      2284, /* GL_VERTEX_STATE_PROGRAM_NV */
+      2258, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+      2266, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+      2268, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+      2270, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+       387, /* GL_CURRENT_VERTEX_ATTRIB */
+      1465, /* GL_PROGRAM_LENGTH_ARB */
+      1481, /* GL_PROGRAM_STRING_ARB */
+      1203, /* GL_MODELVIEW_PROJECTION_NV */
+       727, /* GL_IDENTITY_NV */
+       803, /* GL_INVERSE_NV */
+      2147, /* GL_TRANSPOSE_NV */
+       804, /* GL_INVERSE_TRANSPOSE_NV */
+      1083, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+      1082, /* GL_MAX_PROGRAM_MATRICES_ARB */
+       964, /* GL_MATRIX0_NV */
+       976, /* GL_MATRIX1_NV */
+       988, /* GL_MATRIX2_NV */
+       992, /* GL_MATRIX3_NV */
+       994, /* GL_MATRIX4_NV */
+       996, /* GL_MATRIX5_NV */
+       998, /* GL_MATRIX6_NV */
+      1000, /* GL_MATRIX7_NV */
+       370, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
+       367, /* GL_CURRENT_MATRIX_ARB */
+      1478, /* GL_PROGRAM_POINT_SIZE */
+      2279, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+      1477, /* GL_PROGRAM_PARAMETER_NV */
+      2264, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+      1483, /* GL_PROGRAM_TARGET_NV */
+      1480, /* GL_PROGRAM_RESIDENT_NV */
+      2119, /* GL_TRACK_MATRIX_NV */
+      2120, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+      2274, /* GL_VERTEX_PROGRAM_BINDING_NV */
+      1459, /* GL_PROGRAM_ERROR_POSITION_ARB */
+       412, /* GL_DEPTH_CLAMP */
+      2239, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+      2246, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+      2247, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+      2248, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+      2249, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+      2250, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+      2251, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+      2252, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+      2253, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+      2254, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+      2240, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+      2241, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+      2242, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+      2243, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+      2244, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+      2245, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+       912, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+       919, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+       920, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+       921, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+       922, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+       923, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+       924, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+       925, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+       926, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+       927, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+       913, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+       914, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+       915, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+       916, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+       917, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+       918, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+       939, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+       946, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+       947, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+       948, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+       949, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+       950, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+       951, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+      1458, /* GL_PROGRAM_BINDING_ARB */
+       953, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+       954, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+       940, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+       941, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+       942, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+       943, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+       944, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+       945, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+      2020, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+      2017, /* GL_TEXTURE_COMPRESSED */
+      1245, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
        314, /* GL_COMPRESSED_TEXTURE_FORMATS */
-      1139, /* GL_MAX_VERTEX_UNITS_ARB */
+      1143, /* GL_MAX_VERTEX_UNITS_ARB */
         23, /* GL_ACTIVE_VERTEX_UNITS_ARB */
-      2295, /* GL_WEIGHT_SUM_UNITY_ARB */
-      2265, /* GL_VERTEX_BLEND_ARB */
-       388, /* GL_CURRENT_WEIGHT_ARB */
-      2293, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-      2291, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-      2289, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-      2287, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-      2282, /* GL_WEIGHT_ARRAY_ARB */
-       445, /* GL_DOT3_RGB */
-       446, /* GL_DOT3_RGBA */
+      2302, /* GL_WEIGHT_SUM_UNITY_ARB */
+      2272, /* GL_VERTEX_BLEND_ARB */
+       389, /* GL_CURRENT_WEIGHT_ARB */
+      2300, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+      2298, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+      2296, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+      2294, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+      2289, /* GL_WEIGHT_ARRAY_ARB */
+       446, /* GL_DOT3_RGB */
+       447, /* GL_DOT3_RGBA */
        308, /* GL_COMPRESSED_RGB_FXT1_3DFX */
        303, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
-      1207, /* GL_MULTISAMPLE_3DFX */
-      1725, /* GL_SAMPLE_BUFFERS_3DFX */
-      1716, /* GL_SAMPLES_3DFX */
-      1187, /* GL_MODELVIEW2_ARB */
-      1190, /* GL_MODELVIEW3_ARB */
-      1191, /* GL_MODELVIEW4_ARB */
-      1192, /* GL_MODELVIEW5_ARB */
-      1193, /* GL_MODELVIEW6_ARB */
-      1194, /* GL_MODELVIEW7_ARB */
-      1195, /* GL_MODELVIEW8_ARB */
-      1196, /* GL_MODELVIEW9_ARB */
-      1166, /* GL_MODELVIEW10_ARB */
-      1167, /* GL_MODELVIEW11_ARB */
-      1168, /* GL_MODELVIEW12_ARB */
-      1169, /* GL_MODELVIEW13_ARB */
-      1170, /* GL_MODELVIEW14_ARB */
-      1171, /* GL_MODELVIEW15_ARB */
-      1172, /* GL_MODELVIEW16_ARB */
-      1173, /* GL_MODELVIEW17_ARB */
-      1174, /* GL_MODELVIEW18_ARB */
-      1175, /* GL_MODELVIEW19_ARB */
-      1177, /* GL_MODELVIEW20_ARB */
-      1178, /* GL_MODELVIEW21_ARB */
-      1179, /* GL_MODELVIEW22_ARB */
-      1180, /* GL_MODELVIEW23_ARB */
-      1181, /* GL_MODELVIEW24_ARB */
-      1182, /* GL_MODELVIEW25_ARB */
-      1183, /* GL_MODELVIEW26_ARB */
-      1184, /* GL_MODELVIEW27_ARB */
-      1185, /* GL_MODELVIEW28_ARB */
-      1186, /* GL_MODELVIEW29_ARB */
-      1188, /* GL_MODELVIEW30_ARB */
-      1189, /* GL_MODELVIEW31_ARB */
-       450, /* GL_DOT3_RGB_EXT */
-       448, /* GL_DOT3_RGBA_EXT */
-      1160, /* GL_MIRROR_CLAMP_EXT */
-      1163, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-      1202, /* GL_MODULATE_ADD_ATI */
-      1203, /* GL_MODULATE_SIGNED_ADD_ATI */
-      1204, /* GL_MODULATE_SUBTRACT_ATI */
-      2302, /* GL_YCBCR_MESA */
-      1299, /* GL_PACK_INVERT_MESA */
-       391, /* GL_DEBUG_OBJECT_MESA */
-       392, /* GL_DEBUG_PRINT_MESA */
-       390, /* GL_DEBUG_ASSERT_MESA */
+      1211, /* GL_MULTISAMPLE_3DFX */
+      1731, /* GL_SAMPLE_BUFFERS_3DFX */
+      1722, /* GL_SAMPLES_3DFX */
+      1191, /* GL_MODELVIEW2_ARB */
+      1194, /* GL_MODELVIEW3_ARB */
+      1195, /* GL_MODELVIEW4_ARB */
+      1196, /* GL_MODELVIEW5_ARB */
+      1197, /* GL_MODELVIEW6_ARB */
+      1198, /* GL_MODELVIEW7_ARB */
+      1199, /* GL_MODELVIEW8_ARB */
+      1200, /* GL_MODELVIEW9_ARB */
+      1170, /* GL_MODELVIEW10_ARB */
+      1171, /* GL_MODELVIEW11_ARB */
+      1172, /* GL_MODELVIEW12_ARB */
+      1173, /* GL_MODELVIEW13_ARB */
+      1174, /* GL_MODELVIEW14_ARB */
+      1175, /* GL_MODELVIEW15_ARB */
+      1176, /* GL_MODELVIEW16_ARB */
+      1177, /* GL_MODELVIEW17_ARB */
+      1178, /* GL_MODELVIEW18_ARB */
+      1179, /* GL_MODELVIEW19_ARB */
+      1181, /* GL_MODELVIEW20_ARB */
+      1182, /* GL_MODELVIEW21_ARB */
+      1183, /* GL_MODELVIEW22_ARB */
+      1184, /* GL_MODELVIEW23_ARB */
+      1185, /* GL_MODELVIEW24_ARB */
+      1186, /* GL_MODELVIEW25_ARB */
+      1187, /* GL_MODELVIEW26_ARB */
+      1188, /* GL_MODELVIEW27_ARB */
+      1189, /* GL_MODELVIEW28_ARB */
+      1190, /* GL_MODELVIEW29_ARB */
+      1192, /* GL_MODELVIEW30_ARB */
+      1193, /* GL_MODELVIEW31_ARB */
+       451, /* GL_DOT3_RGB_EXT */
+       449, /* GL_DOT3_RGBA_EXT */
+      1164, /* GL_MIRROR_CLAMP_EXT */
+      1167, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+      1206, /* GL_MODULATE_ADD_ATI */
+      1207, /* GL_MODULATE_SIGNED_ADD_ATI */
+      1208, /* GL_MODULATE_SUBTRACT_ATI */
+      2309, /* GL_YCBCR_MESA */
+      1304, /* GL_PACK_INVERT_MESA */
+       392, /* GL_DEBUG_OBJECT_MESA */
+       393, /* GL_DEBUG_PRINT_MESA */
+       391, /* GL_DEBUG_ASSERT_MESA */
        139, /* GL_BUFFER_SIZE */
        141, /* GL_BUFFER_USAGE */
        145, /* GL_BUMP_ROT_MATRIX_ATI */
        146, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
        144, /* GL_BUMP_NUM_TEX_UNITS_ATI */
        148, /* GL_BUMP_TEX_UNITS_ATI */
-       510, /* GL_DUDV_ATI */
-       509, /* GL_DU8DV8_ATI */
+       511, /* GL_DUDV_ATI */
+       510, /* GL_DU8DV8_ATI */
        143, /* GL_BUMP_ENVMAP_ATI */
        147, /* GL_BUMP_TARGET_ATI */
-      1243, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */
-      1451, /* GL_PROGRAM_BINARY_FORMATS_OES */
-      1829, /* GL_STENCIL_BACK_FUNC */
-      1827, /* GL_STENCIL_BACK_FAIL */
-      1831, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-      1833, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-       599, /* GL_FRAGMENT_PROGRAM_ARB */
-      1449, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-      1481, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-      1480, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-      1463, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-      1469, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-      1468, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-      1068, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-      1093, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-      1092, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-      1081, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-      1087, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-      1086, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-      1657, /* GL_RGBA32F */
-      1620, /* GL_RGB32F */
-      1648, /* GL_RGBA16F */
-      1612, /* GL_RGB16F */
-      1676, /* GL_RGBA_FLOAT_MODE_ARB */
-      1037, /* GL_MAX_DRAW_BUFFERS */
-       454, /* GL_DRAW_BUFFER0 */
-       457, /* GL_DRAW_BUFFER1 */
-       478, /* GL_DRAW_BUFFER2 */
-       481, /* GL_DRAW_BUFFER3 */
-       484, /* GL_DRAW_BUFFER4 */
-       487, /* GL_DRAW_BUFFER5 */
-       490, /* GL_DRAW_BUFFER6 */
-       493, /* GL_DRAW_BUFFER7 */
-       496, /* GL_DRAW_BUFFER8 */
-       499, /* GL_DRAW_BUFFER9 */
-       458, /* GL_DRAW_BUFFER10 */
-       461, /* GL_DRAW_BUFFER11 */
-       464, /* GL_DRAW_BUFFER12 */
-       467, /* GL_DRAW_BUFFER13 */
-       470, /* GL_DRAW_BUFFER14 */
-       473, /* GL_DRAW_BUFFER15 */
+      1248, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */
+      1456, /* GL_PROGRAM_BINARY_FORMATS_OES */
+      1835, /* GL_STENCIL_BACK_FUNC */
+      1833, /* GL_STENCIL_BACK_FAIL */
+      1837, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+      1839, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+       600, /* GL_FRAGMENT_PROGRAM_ARB */
+      1454, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+      1486, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+      1485, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+      1468, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+      1474, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+      1473, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+      1072, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+      1097, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+      1096, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+      1085, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+      1091, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+      1090, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+      1663, /* GL_RGBA32F */
+      1626, /* GL_RGB32F */
+      1654, /* GL_RGBA16F */
+      1618, /* GL_RGB16F */
+      1682, /* GL_RGBA_FLOAT_MODE_ARB */
+      1041, /* GL_MAX_DRAW_BUFFERS */
+       455, /* GL_DRAW_BUFFER0 */
+       458, /* GL_DRAW_BUFFER1 */
+       479, /* GL_DRAW_BUFFER2 */
+       482, /* GL_DRAW_BUFFER3 */
+       485, /* GL_DRAW_BUFFER4 */
+       488, /* GL_DRAW_BUFFER5 */
+       491, /* GL_DRAW_BUFFER6 */
+       494, /* GL_DRAW_BUFFER7 */
+       497, /* GL_DRAW_BUFFER8 */
+       500, /* GL_DRAW_BUFFER9 */
+       459, /* GL_DRAW_BUFFER10 */
+       462, /* GL_DRAW_BUFFER11 */
+       465, /* GL_DRAW_BUFFER12 */
+       468, /* GL_DRAW_BUFFER13 */
+       471, /* GL_DRAW_BUFFER14 */
+       474, /* GL_DRAW_BUFFER15 */
         97, /* GL_BLEND_EQUATION_ALPHA */
-      1011, /* GL_MATRIX_PALETTE_ARB */
-      1061, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-      1064, /* GL_MAX_PALETTE_MATRICES_ARB */
-       372, /* GL_CURRENT_PALETTE_MATRIX_ARB */
-       999, /* GL_MATRIX_INDEX_ARRAY_ARB */
-       367, /* GL_CURRENT_MATRIX_INDEX_ARB */
-      1004, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-      1008, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-      1006, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-      1002, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-      2049, /* GL_TEXTURE_DEPTH_SIZE */
-       438, /* GL_DEPTH_TEXTURE_MODE */
-      2006, /* GL_TEXTURE_COMPARE_MODE */
-      2004, /* GL_TEXTURE_COMPARE_FUNC */
+      1015, /* GL_MATRIX_PALETTE_ARB */
+      1065, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+      1068, /* GL_MAX_PALETTE_MATRICES_ARB */
+       373, /* GL_CURRENT_PALETTE_MATRIX_ARB */
+      1003, /* GL_MATRIX_INDEX_ARRAY_ARB */
+       368, /* GL_CURRENT_MATRIX_INDEX_ARB */
+      1008, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+      1012, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+      1010, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+      1006, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+      2055, /* GL_TEXTURE_DEPTH_SIZE */
+       439, /* GL_DEPTH_TEXTURE_MODE */
+      2012, /* GL_TEXTURE_COMPARE_MODE */
+      2010, /* GL_TEXTURE_COMPARE_FUNC */
        284, /* GL_COMPARE_REF_TO_TEXTURE */
-      1376, /* GL_POINT_SPRITE */
-       346, /* GL_COORD_REPLACE */
-      1381, /* GL_POINT_SPRITE_R_MODE_NV */
-      1521, /* GL_QUERY_COUNTER_BITS */
-       375, /* GL_CURRENT_QUERY */
-      1525, /* GL_QUERY_RESULT */
-      1527, /* GL_QUERY_RESULT_AVAILABLE */
-      1131, /* GL_MAX_VERTEX_ATTRIBS */
-      2255, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-       436, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-       435, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-      1108, /* GL_MAX_TEXTURE_COORDS */
-      1110, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-      1456, /* GL_PROGRAM_ERROR_STRING_ARB */
-      1458, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-      1457, /* GL_PROGRAM_FORMAT_ARB */
-      2105, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-       408, /* GL_DEPTH_BOUNDS_TEST_EXT */
-       407, /* GL_DEPTH_BOUNDS_EXT */
+      1381, /* GL_POINT_SPRITE */
+       347, /* GL_COORD_REPLACE */
+      1386, /* GL_POINT_SPRITE_R_MODE_NV */
+      1526, /* GL_QUERY_COUNTER_BITS */
+       376, /* GL_CURRENT_QUERY */
+      1530, /* GL_QUERY_RESULT */
+      1532, /* GL_QUERY_RESULT_AVAILABLE */
+      1135, /* GL_MAX_VERTEX_ATTRIBS */
+      2262, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+       437, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+       436, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+      1112, /* GL_MAX_TEXTURE_COORDS */
+      1114, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+      1461, /* GL_PROGRAM_ERROR_STRING_ARB */
+      1463, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+      1462, /* GL_PROGRAM_FORMAT_ARB */
+      2111, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+       409, /* GL_DEPTH_BOUNDS_TEST_EXT */
+       408, /* GL_DEPTH_BOUNDS_EXT */
         61, /* GL_ARRAY_BUFFER */
-       523, /* GL_ELEMENT_ARRAY_BUFFER */
+       524, /* GL_ELEMENT_ARRAY_BUFFER */
         62, /* GL_ARRAY_BUFFER_BINDING */
-       524, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-      2226, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-      1229, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+       525, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+      2233, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+      1233, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
        190, /* GL_COLOR_ARRAY_BUFFER_BINDING */
-       736, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-      2019, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-       519, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-      1737, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-       577, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-      2283, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-      2248, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-      1459, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-      1074, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-      1465, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-      1083, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-      1479, /* GL_PROGRAM_TEMPORARIES_ARB */
-      1089, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-      1467, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-      1085, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-      1471, /* GL_PROGRAM_PARAMETERS_ARB */
-      1088, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-      1466, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-      1084, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-      1450, /* GL_PROGRAM_ATTRIBS_ARB */
-      1069, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-      1464, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-      1082, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-      1448, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-      1067, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-      1462, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-      1080, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-      1075, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-      1071, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-      1482, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-      2138, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-      1544, /* GL_READ_ONLY */
-      2297, /* GL_WRITE_ONLY */
-      1546, /* GL_READ_WRITE */
+       738, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+      2025, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+       520, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+      1743, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+       578, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+      2290, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+      2255, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+      1464, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+      1078, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+      1470, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+      1087, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+      1484, /* GL_PROGRAM_TEMPORARIES_ARB */
+      1093, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+      1472, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+      1089, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+      1476, /* GL_PROGRAM_PARAMETERS_ARB */
+      1092, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+      1471, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+      1088, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+      1455, /* GL_PROGRAM_ATTRIBS_ARB */
+      1073, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+      1469, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+      1086, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+      1453, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+      1071, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+      1467, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+      1084, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+      1079, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+      1075, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+      1487, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+      2144, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+      1549, /* GL_READ_ONLY */
+      2304, /* GL_WRITE_ONLY */
+      1551, /* GL_READ_WRITE */
        124, /* GL_BUFFER_ACCESS */
        129, /* GL_BUFFER_MAPPED */
        134, /* GL_BUFFER_MAP_POINTER */
-      2112, /* GL_TIME_ELAPSED_EXT */
-       959, /* GL_MATRIX0_ARB */
-       971, /* GL_MATRIX1_ARB */
-       983, /* GL_MATRIX2_ARB */
-       987, /* GL_MATRIX3_ARB */
-       989, /* GL_MATRIX4_ARB */
-       991, /* GL_MATRIX5_ARB */
-       993, /* GL_MATRIX6_ARB */
-       995, /* GL_MATRIX7_ARB */
-       997, /* GL_MATRIX8_ARB */
-       998, /* GL_MATRIX9_ARB */
-       961, /* GL_MATRIX10_ARB */
-       962, /* GL_MATRIX11_ARB */
-       963, /* GL_MATRIX12_ARB */
-       964, /* GL_MATRIX13_ARB */
-       965, /* GL_MATRIX14_ARB */
-       966, /* GL_MATRIX15_ARB */
-       967, /* GL_MATRIX16_ARB */
-       968, /* GL_MATRIX17_ARB */
-       969, /* GL_MATRIX18_ARB */
-       970, /* GL_MATRIX19_ARB */
-       973, /* GL_MATRIX20_ARB */
-       974, /* GL_MATRIX21_ARB */
-       975, /* GL_MATRIX22_ARB */
-       976, /* GL_MATRIX23_ARB */
-       977, /* GL_MATRIX24_ARB */
-       978, /* GL_MATRIX25_ARB */
-       979, /* GL_MATRIX26_ARB */
-       980, /* GL_MATRIX27_ARB */
-       981, /* GL_MATRIX28_ARB */
-       982, /* GL_MATRIX29_ARB */
-       985, /* GL_MATRIX30_ARB */
-       986, /* GL_MATRIX31_ARB */
-      1870, /* GL_STREAM_DRAW */
-      1872, /* GL_STREAM_READ */
-      1868, /* GL_STREAM_COPY */
-      1819, /* GL_STATIC_DRAW */
-      1821, /* GL_STATIC_READ */
-      1817, /* GL_STATIC_COPY */
-       513, /* GL_DYNAMIC_DRAW */
-       515, /* GL_DYNAMIC_READ */
-       511, /* GL_DYNAMIC_COPY */
-      1339, /* GL_PIXEL_PACK_BUFFER */
-      1343, /* GL_PIXEL_UNPACK_BUFFER */
-      1340, /* GL_PIXEL_PACK_BUFFER_BINDING */
-      1344, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
-       399, /* GL_DEPTH24_STENCIL8 */
-      2101, /* GL_TEXTURE_STENCIL_SIZE */
-      2047, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
-      1070, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-      1073, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-      1077, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-      1076, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-      2253, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */
-      2250, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */
-      1016, /* GL_MAX_ARRAY_TEXTURE_LAYERS */
-      1154, /* GL_MIN_PROGRAM_TEXEL_OFFSET */
-      1090, /* GL_MAX_PROGRAM_TEXEL_OFFSET */
-      1861, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+      2118, /* GL_TIME_ELAPSED_EXT */
+       963, /* GL_MATRIX0_ARB */
+       975, /* GL_MATRIX1_ARB */
+       987, /* GL_MATRIX2_ARB */
+       991, /* GL_MATRIX3_ARB */
+       993, /* GL_MATRIX4_ARB */
+       995, /* GL_MATRIX5_ARB */
+       997, /* GL_MATRIX6_ARB */
+       999, /* GL_MATRIX7_ARB */
+      1001, /* GL_MATRIX8_ARB */
+      1002, /* GL_MATRIX9_ARB */
+       965, /* GL_MATRIX10_ARB */
+       966, /* GL_MATRIX11_ARB */
+       967, /* GL_MATRIX12_ARB */
+       968, /* GL_MATRIX13_ARB */
+       969, /* GL_MATRIX14_ARB */
+       970, /* GL_MATRIX15_ARB */
+       971, /* GL_MATRIX16_ARB */
+       972, /* GL_MATRIX17_ARB */
+       973, /* GL_MATRIX18_ARB */
+       974, /* GL_MATRIX19_ARB */
+       977, /* GL_MATRIX20_ARB */
+       978, /* GL_MATRIX21_ARB */
+       979, /* GL_MATRIX22_ARB */
+       980, /* GL_MATRIX23_ARB */
+       981, /* GL_MATRIX24_ARB */
+       982, /* GL_MATRIX25_ARB */
+       983, /* GL_MATRIX26_ARB */
+       984, /* GL_MATRIX27_ARB */
+       985, /* GL_MATRIX28_ARB */
+       986, /* GL_MATRIX29_ARB */
+       989, /* GL_MATRIX30_ARB */
+       990, /* GL_MATRIX31_ARB */
+      1876, /* GL_STREAM_DRAW */
+      1878, /* GL_STREAM_READ */
+      1874, /* GL_STREAM_COPY */
+      1825, /* GL_STATIC_DRAW */
+      1827, /* GL_STATIC_READ */
+      1823, /* GL_STATIC_COPY */
+       514, /* GL_DYNAMIC_DRAW */
+       516, /* GL_DYNAMIC_READ */
+       512, /* GL_DYNAMIC_COPY */
+      1344, /* GL_PIXEL_PACK_BUFFER */
+      1348, /* GL_PIXEL_UNPACK_BUFFER */
+      1345, /* GL_PIXEL_PACK_BUFFER_BINDING */
+      1349, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+       400, /* GL_DEPTH24_STENCIL8 */
+      2107, /* GL_TEXTURE_STENCIL_SIZE */
+      2053, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+      1074, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+      1077, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+      1081, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+      1080, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+      2260, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */
+      2257, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */
+      1020, /* GL_MAX_ARRAY_TEXTURE_LAYERS */
+      1158, /* GL_MIN_PROGRAM_TEXEL_OFFSET */
+      1094, /* GL_MAX_PROGRAM_TEXEL_OFFSET */
+      1867, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
         18, /* GL_ACTIVE_STENCIL_FACE_EXT */
-      1161, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-      1718, /* GL_SAMPLES_PASSED */
-       692, /* GL_GEOMETRY_VERTICES_OUT */
-       686, /* GL_GEOMETRY_INPUT_TYPE */
-       688, /* GL_GEOMETRY_OUTPUT_TYPE */
-      1709, /* GL_SAMPLER_BINDING */
+      1165, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+      1724, /* GL_SAMPLES_PASSED */
+       693, /* GL_GEOMETRY_VERTICES_OUT */
+       687, /* GL_GEOMETRY_INPUT_TYPE */
+       689, /* GL_GEOMETRY_OUTPUT_TYPE */
+      1715, /* GL_SAMPLER_BINDING */
        164, /* GL_CLAMP_VERTEX_COLOR_ARB */
        156, /* GL_CLAMP_FRAGMENT_COLOR_ARB */
        157, /* GL_CLAMP_READ_COLOR */
-       549, /* GL_FIXED_ONLY */
-      1363, /* GL_POINT_SIZE_ARRAY_TYPE_OES */
-      1362, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */
-      1361, /* GL_POINT_SIZE_ARRAY_POINTER_OES */
-      1198, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */
-      1485, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */
-      2081, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */
+       550, /* GL_FIXED_ONLY */
+      1368, /* GL_POINT_SIZE_ARRAY_TYPE_OES */
+      1367, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */
+      1366, /* GL_POINT_SIZE_ARRAY_POINTER_OES */
+      1202, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */
+      1490, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */
+      2087, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */
        138, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */
        128, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */
-      1561, /* GL_RELEASED_APPLE */
-      2280, /* GL_VOLATILE_APPLE */
-      1600, /* GL_RETAINED_APPLE */
-      2155, /* GL_UNDEFINED_APPLE */
-      1509, /* GL_PURGEABLE_APPLE */
-       600, /* GL_FRAGMENT_SHADER */
-      2275, /* GL_VERTEX_SHADER */
-      1470, /* GL_PROGRAM_OBJECT_ARB */
-      1754, /* GL_SHADER_OBJECT_ARB */
-      1045, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-      1136, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-      1127, /* GL_MAX_VARYING_COMPONENTS */
-      1134, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-      1028, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-      1259, /* GL_OBJECT_TYPE_ARB */
-      1756, /* GL_SHADER_TYPE */
-       565, /* GL_FLOAT_VEC2 */
-       567, /* GL_FLOAT_VEC3 */
-       569, /* GL_FLOAT_VEC4 */
-       788, /* GL_INT_VEC2 */
-       790, /* GL_INT_VEC3 */
-       792, /* GL_INT_VEC4 */
+      1566, /* GL_RELEASED_APPLE */
+      2287, /* GL_VOLATILE_APPLE */
+      1606, /* GL_RETAINED_APPLE */
+      2161, /* GL_UNDEFINED_APPLE */
+      1514, /* GL_PURGEABLE_APPLE */
+       601, /* GL_FRAGMENT_SHADER */
+      2282, /* GL_VERTEX_SHADER */
+      1475, /* GL_PROGRAM_OBJECT_ARB */
+      1760, /* GL_SHADER_OBJECT_ARB */
+      1049, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+      1140, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+      1131, /* GL_MAX_VARYING_COMPONENTS */
+      1138, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+      1032, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+      1264, /* GL_OBJECT_TYPE_ARB */
+      1762, /* GL_SHADER_TYPE */
+       566, /* GL_FLOAT_VEC2 */
+       568, /* GL_FLOAT_VEC3 */
+       570, /* GL_FLOAT_VEC4 */
+       791, /* GL_INT_VEC2 */
+       793, /* GL_INT_VEC3 */
+       795, /* GL_INT_VEC4 */
        116, /* GL_BOOL */
        118, /* GL_BOOL_VEC2 */
        120, /* GL_BOOL_VEC3 */
        122, /* GL_BOOL_VEC4 */
-       553, /* GL_FLOAT_MAT2 */
-       557, /* GL_FLOAT_MAT3 */
-       561, /* GL_FLOAT_MAT4 */
-      1693, /* GL_SAMPLER_1D */
-      1699, /* GL_SAMPLER_2D */
-      1707, /* GL_SAMPLER_3D */
-      1712, /* GL_SAMPLER_CUBE */
-      1698, /* GL_SAMPLER_1D_SHADOW */
-      1706, /* GL_SAMPLER_2D_SHADOW */
-      1704, /* GL_SAMPLER_2D_RECT */
-      1705, /* GL_SAMPLER_2D_RECT_SHADOW */
-       555, /* GL_FLOAT_MAT2x3 */
-       556, /* GL_FLOAT_MAT2x4 */
-       559, /* GL_FLOAT_MAT3x2 */
-       560, /* GL_FLOAT_MAT3x4 */
-       563, /* GL_FLOAT_MAT4x2 */
-       564, /* GL_FLOAT_MAT4x3 */
-       397, /* GL_DELETE_STATUS */
+       554, /* GL_FLOAT_MAT2 */
+       558, /* GL_FLOAT_MAT3 */
+       562, /* GL_FLOAT_MAT4 */
+      1699, /* GL_SAMPLER_1D */
+      1705, /* GL_SAMPLER_2D */
+      1713, /* GL_SAMPLER_3D */
+      1718, /* GL_SAMPLER_CUBE */
+      1704, /* GL_SAMPLER_1D_SHADOW */
+      1712, /* GL_SAMPLER_2D_SHADOW */
+      1710, /* GL_SAMPLER_2D_RECT */
+      1711, /* GL_SAMPLER_2D_RECT_SHADOW */
+       556, /* GL_FLOAT_MAT2x3 */
+       557, /* GL_FLOAT_MAT2x4 */
+       560, /* GL_FLOAT_MAT3x2 */
+       561, /* GL_FLOAT_MAT3x4 */
+       564, /* GL_FLOAT_MAT4x2 */
+       565, /* GL_FLOAT_MAT4x3 */
+       398, /* GL_DELETE_STATUS */
        289, /* GL_COMPILE_STATUS */
-       849, /* GL_LINK_STATUS */
-      2220, /* GL_VALIDATE_STATUS */
-       748, /* GL_INFO_LOG_LENGTH */
+       852, /* GL_LINK_STATUS */
+      2227, /* GL_VALIDATE_STATUS */
+       750, /* GL_INFO_LOG_LENGTH */
         64, /* GL_ATTACHED_SHADERS */
         21, /* GL_ACTIVE_UNIFORMS */
         22, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
-      1755, /* GL_SHADER_SOURCE_LENGTH */
+      1761, /* GL_SHADER_SOURCE_LENGTH */
         15, /* GL_ACTIVE_ATTRIBUTES */
         16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
-       602, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-      1758, /* GL_SHADING_LANGUAGE_VERSION */
-       374, /* GL_CURRENT_PROGRAM */
-      1308, /* GL_PALETTE4_RGB8_OES */
-      1310, /* GL_PALETTE4_RGBA8_OES */
-      1306, /* GL_PALETTE4_R5_G6_B5_OES */
-      1309, /* GL_PALETTE4_RGBA4_OES */
-      1307, /* GL_PALETTE4_RGB5_A1_OES */
-      1313, /* GL_PALETTE8_RGB8_OES */
-      1315, /* GL_PALETTE8_RGBA8_OES */
-      1311, /* GL_PALETTE8_R5_G6_B5_OES */
-      1314, /* GL_PALETTE8_RGBA4_OES */
-      1312, /* GL_PALETTE8_RGB5_A1_OES */
-       729, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */
-       727, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */
-      1360, /* GL_POINT_SIZE_ARRAY_OES */
-      2025, /* GL_TEXTURE_CROP_RECT_OES */
-      1000, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */
-      1359, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */
-      2203, /* GL_UNSIGNED_NORMALIZED */
-      1958, /* GL_TEXTURE_1D_ARRAY */
-      1495, /* GL_PROXY_TEXTURE_1D_ARRAY */
-      1961, /* GL_TEXTURE_2D_ARRAY */
-      1499, /* GL_PROXY_TEXTURE_2D_ARRAY */
-      1969, /* GL_TEXTURE_BINDING_1D_ARRAY */
-      1972, /* GL_TEXTURE_BINDING_2D_ARRAY */
-      1052, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */
-      1989, /* GL_TEXTURE_BUFFER */
-      1106, /* GL_MAX_TEXTURE_BUFFER_SIZE */
-      1976, /* GL_TEXTURE_BINDING_BUFFER */
-      1991, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */
-      1993, /* GL_TEXTURE_BUFFER_FORMAT */
-      1532, /* GL_R11F_G11F_B10F */
-      2169, /* GL_UNSIGNED_INT_10F_11F_11F_REV */
-      1643, /* GL_RGB9_E5 */
-      2178, /* GL_UNSIGNED_INT_5_9_9_9_REV */
-      2099, /* GL_TEXTURE_SHARED_SIZE */
-      1811, /* GL_SRGB */
-      1812, /* GL_SRGB8 */
-      1814, /* GL_SRGB_ALPHA */
-      1813, /* GL_SRGB8_ALPHA8 */
-      1771, /* GL_SLUMINANCE_ALPHA */
-      1770, /* GL_SLUMINANCE8_ALPHA8 */
-      1768, /* GL_SLUMINANCE */
-      1769, /* GL_SLUMINANCE8 */
+       603, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+      1764, /* GL_SHADING_LANGUAGE_VERSION */
+       375, /* GL_CURRENT_PROGRAM */
+      1313, /* GL_PALETTE4_RGB8_OES */
+      1315, /* GL_PALETTE4_RGBA8_OES */
+      1311, /* GL_PALETTE4_R5_G6_B5_OES */
+      1314, /* GL_PALETTE4_RGBA4_OES */
+      1312, /* GL_PALETTE4_RGB5_A1_OES */
+      1318, /* GL_PALETTE8_RGB8_OES */
+      1320, /* GL_PALETTE8_RGBA8_OES */
+      1316, /* GL_PALETTE8_R5_G6_B5_OES */
+      1319, /* GL_PALETTE8_RGBA4_OES */
+      1317, /* GL_PALETTE8_RGB5_A1_OES */
+       731, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */
+       729, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */
+      1365, /* GL_POINT_SIZE_ARRAY_OES */
+      2031, /* GL_TEXTURE_CROP_RECT_OES */
+      1004, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */
+      1364, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */
+      2210, /* GL_UNSIGNED_NORMALIZED */
+      1964, /* GL_TEXTURE_1D_ARRAY */
+      1500, /* GL_PROXY_TEXTURE_1D_ARRAY */
+      1967, /* GL_TEXTURE_2D_ARRAY */
+      1504, /* GL_PROXY_TEXTURE_2D_ARRAY */
+      1975, /* GL_TEXTURE_BINDING_1D_ARRAY */
+      1978, /* GL_TEXTURE_BINDING_2D_ARRAY */
+      1056, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */
+      1995, /* GL_TEXTURE_BUFFER */
+      1110, /* GL_MAX_TEXTURE_BUFFER_SIZE */
+      1982, /* GL_TEXTURE_BINDING_BUFFER */
+      1997, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */
+      1999, /* GL_TEXTURE_BUFFER_FORMAT */
+      1537, /* GL_R11F_G11F_B10F */
+      2176, /* GL_UNSIGNED_INT_10F_11F_11F_REV */
+      1649, /* GL_RGB9_E5 */
+      2185, /* GL_UNSIGNED_INT_5_9_9_9_REV */
+      2105, /* GL_TEXTURE_SHARED_SIZE */
+      1817, /* GL_SRGB */
+      1818, /* GL_SRGB8 */
+      1820, /* GL_SRGB_ALPHA */
+      1819, /* GL_SRGB8_ALPHA8 */
+      1777, /* GL_SLUMINANCE_ALPHA */
+      1776, /* GL_SLUMINANCE8_ALPHA8 */
+      1774, /* GL_SLUMINANCE */
+      1775, /* GL_SLUMINANCE8 */
        312, /* GL_COMPRESSED_SRGB */
        313, /* GL_COMPRESSED_SRGB_ALPHA */
        310, /* GL_COMPRESSED_SLUMINANCE */
        311, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
-      2134, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */
-      2123, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */
-      1125, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */
-      2132, /* GL_TRANSFORM_FEEDBACK_VARYINGS */
-      2128, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */
-      2126, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */
-      1442, /* GL_PRIMITIVES_GENERATED */
-      2130, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */
-      1536, /* GL_RASTERIZER_DISCARD */
-      1121, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */
-      1123, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */
-       766, /* GL_INTERLEAVED_ATTRIBS */
-      1747, /* GL_SEPARATE_ATTRIBS */
-      2118, /* GL_TRANSFORM_FEEDBACK_BUFFER */
-      2120, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */
-      1378, /* GL_POINT_SPRITE_COORD_ORIGIN */
-       857, /* GL_LOWER_LEFT */
-      2217, /* GL_UPPER_LEFT */
-      1835, /* GL_STENCIL_BACK_REF */
-      1836, /* GL_STENCIL_BACK_VALUE_MASK */
-      1837, /* GL_STENCIL_BACK_WRITEMASK */
-       503, /* GL_DRAW_FRAMEBUFFER_BINDING */
-      1566, /* GL_RENDERBUFFER_BINDING */
-      1540, /* GL_READ_FRAMEBUFFER */
-       502, /* GL_DRAW_FRAMEBUFFER */
-      1541, /* GL_READ_FRAMEBUFFER_BINDING */
-      1585, /* GL_RENDERBUFFER_SAMPLES */
-       616, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-       613, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-       628, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-       623, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-       626, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-       634, /* GL_FRAMEBUFFER_COMPLETE */
-       639, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-       654, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-       648, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-       643, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-       649, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-       645, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
-       659, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
-       665, /* GL_FRAMEBUFFER_UNSUPPORTED */
-       663, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-      1024, /* GL_MAX_COLOR_ATTACHMENTS */
+      2140, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */
+      2129, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */
+      1129, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */
+      2138, /* GL_TRANSFORM_FEEDBACK_VARYINGS */
+      2134, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */
+      2132, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */
+      1447, /* GL_PRIMITIVES_GENERATED */
+      2136, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */
+      1541, /* GL_RASTERIZER_DISCARD */
+      1125, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */
+      1127, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */
+       769, /* GL_INTERLEAVED_ATTRIBS */
+      1753, /* GL_SEPARATE_ATTRIBS */
+      2124, /* GL_TRANSFORM_FEEDBACK_BUFFER */
+      2126, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */
+      1383, /* GL_POINT_SPRITE_COORD_ORIGIN */
+       861, /* GL_LOWER_LEFT */
+      2224, /* GL_UPPER_LEFT */
+      1841, /* GL_STENCIL_BACK_REF */
+      1842, /* GL_STENCIL_BACK_VALUE_MASK */
+      1843, /* GL_STENCIL_BACK_WRITEMASK */
+       504, /* GL_DRAW_FRAMEBUFFER_BINDING */
+      1571, /* GL_RENDERBUFFER_BINDING */
+      1545, /* GL_READ_FRAMEBUFFER */
+       503, /* GL_DRAW_FRAMEBUFFER */
+      1546, /* GL_READ_FRAMEBUFFER_BINDING */
+      1590, /* GL_RENDERBUFFER_SAMPLES */
+       617, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+       614, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+       629, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+       624, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+       627, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+       635, /* GL_FRAMEBUFFER_COMPLETE */
+       640, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+       655, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+       649, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+       644, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+       650, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+       646, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+       660, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+       666, /* GL_FRAMEBUFFER_UNSUPPORTED */
+       664, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+      1028, /* GL_MAX_COLOR_ATTACHMENTS */
        196, /* GL_COLOR_ATTACHMENT0 */
        199, /* GL_COLOR_ATTACHMENT1 */
        213, /* GL_COLOR_ATTACHMENT2 */
@@ -6034,184 +6054,184 @@ static const unsigned reduced_enums[1556] =
        206, /* GL_COLOR_ATTACHMENT13 */
        208, /* GL_COLOR_ATTACHMENT14 */
        210, /* GL_COLOR_ATTACHMENT15 */
-       402, /* GL_DEPTH_ATTACHMENT */
-      1824, /* GL_STENCIL_ATTACHMENT */
-       604, /* GL_FRAMEBUFFER */
-      1563, /* GL_RENDERBUFFER */
-      1589, /* GL_RENDERBUFFER_WIDTH */
-      1576, /* GL_RENDERBUFFER_HEIGHT */
-      1579, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-      1856, /* GL_STENCIL_INDEX_EXT */
-      1845, /* GL_STENCIL_INDEX1 */
-      1850, /* GL_STENCIL_INDEX4 */
-      1853, /* GL_STENCIL_INDEX8 */
-      1846, /* GL_STENCIL_INDEX16 */
-      1583, /* GL_RENDERBUFFER_RED_SIZE */
-      1574, /* GL_RENDERBUFFER_GREEN_SIZE */
-      1569, /* GL_RENDERBUFFER_BLUE_SIZE */
-      1564, /* GL_RENDERBUFFER_ALPHA_SIZE */
-      1571, /* GL_RENDERBUFFER_DEPTH_SIZE */
-      1587, /* GL_RENDERBUFFER_STENCIL_SIZE */
-       657, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-      1101, /* GL_MAX_SAMPLES */
-      2061, /* GL_TEXTURE_GEN_STR_OES */
-       703, /* GL_HALF_FLOAT_OES */
-      1630, /* GL_RGB565_OES */
-      1660, /* GL_RGBA32UI */
-      1623, /* GL_RGB32UI */
+       403, /* GL_DEPTH_ATTACHMENT */
+      1830, /* GL_STENCIL_ATTACHMENT */
+       605, /* GL_FRAMEBUFFER */
+      1568, /* GL_RENDERBUFFER */
+      1594, /* GL_RENDERBUFFER_WIDTH */
+      1581, /* GL_RENDERBUFFER_HEIGHT */
+      1584, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+      1862, /* GL_STENCIL_INDEX_EXT */
+      1851, /* GL_STENCIL_INDEX1 */
+      1856, /* GL_STENCIL_INDEX4 */
+      1859, /* GL_STENCIL_INDEX8 */
+      1852, /* GL_STENCIL_INDEX16 */
+      1588, /* GL_RENDERBUFFER_RED_SIZE */
+      1579, /* GL_RENDERBUFFER_GREEN_SIZE */
+      1574, /* GL_RENDERBUFFER_BLUE_SIZE */
+      1569, /* GL_RENDERBUFFER_ALPHA_SIZE */
+      1576, /* GL_RENDERBUFFER_DEPTH_SIZE */
+      1592, /* GL_RENDERBUFFER_STENCIL_SIZE */
+       658, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+      1105, /* GL_MAX_SAMPLES */
+      2067, /* GL_TEXTURE_GEN_STR_OES */
+       705, /* GL_HALF_FLOAT_OES */
+      1636, /* GL_RGB565_OES */
+      1666, /* GL_RGBA32UI */
+      1629, /* GL_RGB32UI */
         40, /* GL_ALPHA32UI_EXT */
-       758, /* GL_INTENSITY32UI_EXT */
-       874, /* GL_LUMINANCE32UI_EXT */
-       891, /* GL_LUMINANCE_ALPHA32UI_EXT */
-      1651, /* GL_RGBA16UI */
-      1615, /* GL_RGB16UI */
+       761, /* GL_INTENSITY32UI_EXT */
+       878, /* GL_LUMINANCE32UI_EXT */
+       895, /* GL_LUMINANCE_ALPHA32UI_EXT */
+      1657, /* GL_RGBA16UI */
+      1621, /* GL_RGB16UI */
         37, /* GL_ALPHA16UI_EXT */
-       755, /* GL_INTENSITY16UI_EXT */
-       869, /* GL_LUMINANCE16UI_EXT */
-       889, /* GL_LUMINANCE_ALPHA16UI_EXT */
-      1670, /* GL_RGBA8UI */
-      1638, /* GL_RGB8UI */
+       758, /* GL_INTENSITY16UI_EXT */
+       873, /* GL_LUMINANCE16UI_EXT */
+       893, /* GL_LUMINANCE_ALPHA16UI_EXT */
+      1676, /* GL_RGBA8UI */
+      1644, /* GL_RGB8UI */
         45, /* GL_ALPHA8UI_EXT */
-       763, /* GL_INTENSITY8UI_EXT */
-       883, /* GL_LUMINANCE8UI_EXT */
-       893, /* GL_LUMINANCE_ALPHA8UI_EXT */
-      1658, /* GL_RGBA32I */
-      1621, /* GL_RGB32I */
+       766, /* GL_INTENSITY8UI_EXT */
+       887, /* GL_LUMINANCE8UI_EXT */
+       897, /* GL_LUMINANCE_ALPHA8UI_EXT */
+      1664, /* GL_RGBA32I */
+      1627, /* GL_RGB32I */
         39, /* GL_ALPHA32I_EXT */
-       757, /* GL_INTENSITY32I_EXT */
-       873, /* GL_LUMINANCE32I_EXT */
-       890, /* GL_LUMINANCE_ALPHA32I_EXT */
-      1649, /* GL_RGBA16I */
-      1613, /* GL_RGB16I */
+       760, /* GL_INTENSITY32I_EXT */
+       877, /* GL_LUMINANCE32I_EXT */
+       894, /* GL_LUMINANCE_ALPHA32I_EXT */
+      1655, /* GL_RGBA16I */
+      1619, /* GL_RGB16I */
         36, /* GL_ALPHA16I_EXT */
-       754, /* GL_INTENSITY16I_EXT */
-       868, /* GL_LUMINANCE16I_EXT */
-       888, /* GL_LUMINANCE_ALPHA16I_EXT */
-      1668, /* GL_RGBA8I */
-      1636, /* GL_RGB8I */
+       757, /* GL_INTENSITY16I_EXT */
+       872, /* GL_LUMINANCE16I_EXT */
+       892, /* GL_LUMINANCE_ALPHA16I_EXT */
+      1674, /* GL_RGBA8I */
+      1642, /* GL_RGB8I */
         44, /* GL_ALPHA8I_EXT */
-       762, /* GL_INTENSITY8I_EXT */
-       882, /* GL_LUMINANCE8I_EXT */
-       892, /* GL_LUMINANCE_ALPHA8I_EXT */
-      1553, /* GL_RED_INTEGER */
-       699, /* GL_GREEN_INTEGER */
+       765, /* GL_INTENSITY8I_EXT */
+       886, /* GL_LUMINANCE8I_EXT */
+       896, /* GL_LUMINANCE_ALPHA8I_EXT */
+      1558, /* GL_RED_INTEGER */
+       700, /* GL_GREEN_INTEGER */
        113, /* GL_BLUE_INTEGER */
         49, /* GL_ALPHA_INTEGER_EXT */
-      1683, /* GL_RGB_INTEGER */
-      1677, /* GL_RGBA_INTEGER */
+      1689, /* GL_RGB_INTEGER */
+      1683, /* GL_RGBA_INTEGER */
         84, /* GL_BGR_INTEGER */
         82, /* GL_BGRA_INTEGER */
-       895, /* GL_LUMINANCE_INTEGER_EXT */
-       894, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */
-      1679, /* GL_RGBA_INTEGER_MODE_EXT */
-       611, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */
-       652, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */
-       651, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */
-      1694, /* GL_SAMPLER_1D_ARRAY */
-      1700, /* GL_SAMPLER_2D_ARRAY */
-      1710, /* GL_SAMPLER_BUFFER */
-      1696, /* GL_SAMPLER_1D_ARRAY_SHADOW */
-      1702, /* GL_SAMPLER_2D_ARRAY_SHADOW */
-      1713, /* GL_SAMPLER_CUBE_SHADOW */
-      2197, /* GL_UNSIGNED_INT_VEC2 */
-      2199, /* GL_UNSIGNED_INT_VEC3 */
-      2201, /* GL_UNSIGNED_INT_VEC4 */
-       772, /* GL_INT_SAMPLER_1D */
-       776, /* GL_INT_SAMPLER_2D */
-       782, /* GL_INT_SAMPLER_3D */
-       786, /* GL_INT_SAMPLER_CUBE */
-       780, /* GL_INT_SAMPLER_2D_RECT */
-       773, /* GL_INT_SAMPLER_1D_ARRAY */
-       777, /* GL_INT_SAMPLER_2D_ARRAY */
-       784, /* GL_INT_SAMPLER_BUFFER */
-      2181, /* GL_UNSIGNED_INT_SAMPLER_1D */
-      2185, /* GL_UNSIGNED_INT_SAMPLER_2D */
-      2191, /* GL_UNSIGNED_INT_SAMPLER_3D */
-      2195, /* GL_UNSIGNED_INT_SAMPLER_CUBE */
-      2189, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */
-      2182, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */
-      2186, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */
-      2193, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */
-       690, /* GL_GEOMETRY_SHADER */
-       693, /* GL_GEOMETRY_VERTICES_OUT_ARB */
-       687, /* GL_GEOMETRY_INPUT_TYPE_ARB */
-       689, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */
-      1058, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */
-      1141, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */
-      1056, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */
-      1050, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */
-      1054, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */
-       858, /* GL_LOW_FLOAT */
-      1143, /* GL_MEDIUM_FLOAT */
-       704, /* GL_HIGH_FLOAT */
-       859, /* GL_LOW_INT */
-      1144, /* GL_MEDIUM_INT */
-       705, /* GL_HIGH_INT */
-      2171, /* GL_UNSIGNED_INT_10_10_10_2_OES */
-       771, /* GL_INT_10_10_10_2_OES */
-      1752, /* GL_SHADER_BINARY_FORMATS */
-      1244, /* GL_NUM_SHADER_BINARY_FORMATS */
-      1753, /* GL_SHADER_COMPILER */
-      1138, /* GL_MAX_VERTEX_UNIFORM_VECTORS */
-      1130, /* GL_MAX_VARYING_VECTORS */
-      1047, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */
-      1529, /* GL_QUERY_WAIT */
-      1523, /* GL_QUERY_NO_WAIT */
-      1519, /* GL_QUERY_BY_REGION_WAIT */
-      1517, /* GL_QUERY_BY_REGION_NO_WAIT */
-      2116, /* GL_TRANSFORM_FEEDBACK */
-      2125, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
-      2119, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
-      2117, /* GL_TRANSFORM_FEEDBACK_BINDING */
-      1513, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
-       545, /* GL_FIRST_VERTEX_CONVENTION */
-       804, /* GL_LAST_VERTEX_CONVENTION */
-      1487, /* GL_PROVOKING_VERTEX */
-       353, /* GL_COPY_READ_BUFFER */
-       354, /* GL_COPY_WRITE_BUFFER */
-      1556, /* GL_RED_SNORM */
-      1690, /* GL_RG_SNORM */
-      1689, /* GL_RGB_SNORM */
-      1682, /* GL_RGBA_SNORM */
-      1535, /* GL_R8_SNORM */
-      1603, /* GL_RG8_SNORM */
-      1642, /* GL_RGB8_SNORM */
-      1674, /* GL_RGBA8_SNORM */
-      1533, /* GL_R16_SNORM */
-      1602, /* GL_RG16_SNORM */
-      1618, /* GL_RGB16_SNORM */
-      1654, /* GL_RGBA16_SNORM */
-      1764, /* GL_SIGNED_NORMALIZED */
-      1444, /* GL_PRIMITIVE_RESTART */
-      1445, /* GL_PRIMITIVE_RESTART_INDEX */
-      1103, /* GL_MAX_SERVER_WAIT_TIMEOUT */
-      1258, /* GL_OBJECT_TYPE */
-      1877, /* GL_SYNC_CONDITION */
-      1882, /* GL_SYNC_STATUS */
-      1879, /* GL_SYNC_FLAGS */
-      1878, /* GL_SYNC_FENCE */
-      1881, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
-      2164, /* GL_UNSIGNALED */
-      1763, /* GL_SIGNALED */
+       899, /* GL_LUMINANCE_INTEGER_EXT */
+       898, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */
+      1685, /* GL_RGBA_INTEGER_MODE_EXT */
+       612, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */
+       653, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */
+       652, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */
+      1700, /* GL_SAMPLER_1D_ARRAY */
+      1706, /* GL_SAMPLER_2D_ARRAY */
+      1716, /* GL_SAMPLER_BUFFER */
+      1702, /* GL_SAMPLER_1D_ARRAY_SHADOW */
+      1708, /* GL_SAMPLER_2D_ARRAY_SHADOW */
+      1719, /* GL_SAMPLER_CUBE_SHADOW */
+      2204, /* GL_UNSIGNED_INT_VEC2 */
+      2206, /* GL_UNSIGNED_INT_VEC3 */
+      2208, /* GL_UNSIGNED_INT_VEC4 */
+       775, /* GL_INT_SAMPLER_1D */
+       779, /* GL_INT_SAMPLER_2D */
+       785, /* GL_INT_SAMPLER_3D */
+       789, /* GL_INT_SAMPLER_CUBE */
+       783, /* GL_INT_SAMPLER_2D_RECT */
+       776, /* GL_INT_SAMPLER_1D_ARRAY */
+       780, /* GL_INT_SAMPLER_2D_ARRAY */
+       787, /* GL_INT_SAMPLER_BUFFER */
+      2188, /* GL_UNSIGNED_INT_SAMPLER_1D */
+      2192, /* GL_UNSIGNED_INT_SAMPLER_2D */
+      2198, /* GL_UNSIGNED_INT_SAMPLER_3D */
+      2202, /* GL_UNSIGNED_INT_SAMPLER_CUBE */
+      2196, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */
+      2189, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */
+      2193, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */
+      2200, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */
+       691, /* GL_GEOMETRY_SHADER */
+       694, /* GL_GEOMETRY_VERTICES_OUT_ARB */
+       688, /* GL_GEOMETRY_INPUT_TYPE_ARB */
+       690, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */
+      1062, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */
+      1145, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */
+      1060, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */
+      1054, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */
+      1058, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */
+       862, /* GL_LOW_FLOAT */
+      1147, /* GL_MEDIUM_FLOAT */
+       706, /* GL_HIGH_FLOAT */
+       863, /* GL_LOW_INT */
+      1148, /* GL_MEDIUM_INT */
+       707, /* GL_HIGH_INT */
+      2178, /* GL_UNSIGNED_INT_10_10_10_2_OES */
+       774, /* GL_INT_10_10_10_2_OES */
+      1758, /* GL_SHADER_BINARY_FORMATS */
+      1249, /* GL_NUM_SHADER_BINARY_FORMATS */
+      1759, /* GL_SHADER_COMPILER */
+      1142, /* GL_MAX_VERTEX_UNIFORM_VECTORS */
+      1134, /* GL_MAX_VARYING_VECTORS */
+      1051, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */
+      1534, /* GL_QUERY_WAIT */
+      1528, /* GL_QUERY_NO_WAIT */
+      1524, /* GL_QUERY_BY_REGION_WAIT */
+      1522, /* GL_QUERY_BY_REGION_NO_WAIT */
+      2122, /* GL_TRANSFORM_FEEDBACK */
+      2131, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
+      2125, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
+      2123, /* GL_TRANSFORM_FEEDBACK_BINDING */
+      1518, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+       546, /* GL_FIRST_VERTEX_CONVENTION */
+       807, /* GL_LAST_VERTEX_CONVENTION */
+      1492, /* GL_PROVOKING_VERTEX */
+       354, /* GL_COPY_READ_BUFFER */
+       355, /* GL_COPY_WRITE_BUFFER */
+      1561, /* GL_RED_SNORM */
+      1696, /* GL_RG_SNORM */
+      1695, /* GL_RGB_SNORM */
+      1688, /* GL_RGBA_SNORM */
+      1540, /* GL_R8_SNORM */
+      1609, /* GL_RG8_SNORM */
+      1648, /* GL_RGB8_SNORM */
+      1680, /* GL_RGBA8_SNORM */
+      1538, /* GL_R16_SNORM */
+      1608, /* GL_RG16_SNORM */
+      1624, /* GL_RGB16_SNORM */
+      1660, /* GL_RGBA16_SNORM */
+      1770, /* GL_SIGNED_NORMALIZED */
+      1449, /* GL_PRIMITIVE_RESTART */
+      1450, /* GL_PRIMITIVE_RESTART_INDEX */
+      1107, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+      1263, /* GL_OBJECT_TYPE */
+      1883, /* GL_SYNC_CONDITION */
+      1888, /* GL_SYNC_STATUS */
+      1885, /* GL_SYNC_FLAGS */
+      1884, /* GL_SYNC_FENCE */
+      1887, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+      2171, /* GL_UNSIGNALED */
+      1769, /* GL_SIGNALED */
         54, /* GL_ALREADY_SIGNALED */
-      2111, /* GL_TIMEOUT_EXPIRED */
+      2117, /* GL_TIMEOUT_EXPIRED */
        315, /* GL_CONDITION_SATISFIED */
-      2281, /* GL_WAIT_FAILED */
+      2288, /* GL_WAIT_FAILED */
        126, /* GL_BUFFER_ACCESS_FLAGS */
        132, /* GL_BUFFER_MAP_LENGTH */
        133, /* GL_BUFFER_MAP_OFFSET */
-      1133, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */
-      1048, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */
-      1049, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */
-      1044, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */
-       329, /* GL_CONTEXT_PROFILE_MASK */
-       530, /* GL_EVAL_BIT */
-      1538, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-       851, /* GL_LIST_BIT */
-      1984, /* GL_TEXTURE_BIT */
-      1733, /* GL_SCISSOR_BIT */
+      1137, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */
+      1052, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */
+      1053, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */
+      1048, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */
+       330, /* GL_CONTEXT_PROFILE_MASK */
+       531, /* GL_EVAL_BIT */
+      1543, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+       854, /* GL_LIST_BIT */
+      1990, /* GL_TEXTURE_BIT */
+      1739, /* GL_SCISSOR_BIT */
         30, /* GL_ALL_ATTRIB_BITS */
-      1209, /* GL_MULTISAMPLE_BIT */
+      1213, /* GL_MULTISAMPLE_BIT */
         31, /* GL_ALL_CLIENT_ATTRIB_BITS */
 };
 
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index 8eeeb2aea..e651715f7 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -1,1002 +1,1091 @@
-
-/*
- * Mesa 3-D graphics library
- * Version:  5.1
- *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/*
- * eval.c was written by
- * Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and
- * Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de).
- *
- * My original implementation of evaluators was simplistic and didn't
- * compute surface normal vectors properly.  Bernd and Volker applied
- * used more sophisticated methods to get better results.
- *
- * Thanks guys!
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "eval.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_evaluators
-
-
-/*
- * Return the number of components per control point for any type of
- * evaluator.  Return 0 if bad target.
- * See table 5.1 in the OpenGL 1.2 spec.
- */
-GLuint _mesa_evaluator_components( GLenum target )
-{
-   switch (target) {
-      case GL_MAP1_VERTEX_3:		return 3;
-      case GL_MAP1_VERTEX_4:		return 4;
-      case GL_MAP1_INDEX:		return 1;
-      case GL_MAP1_COLOR_4:		return 4;
-      case GL_MAP1_NORMAL:		return 3;
-      case GL_MAP1_TEXTURE_COORD_1:	return 1;
-      case GL_MAP1_TEXTURE_COORD_2:	return 2;
-      case GL_MAP1_TEXTURE_COORD_3:	return 3;
-      case GL_MAP1_TEXTURE_COORD_4:	return 4;
-      case GL_MAP2_VERTEX_3:		return 3;
-      case GL_MAP2_VERTEX_4:		return 4;
-      case GL_MAP2_INDEX:		return 1;
-      case GL_MAP2_COLOR_4:		return 4;
-      case GL_MAP2_NORMAL:		return 3;
-      case GL_MAP2_TEXTURE_COORD_1:	return 1;
-      case GL_MAP2_TEXTURE_COORD_2:	return 2;
-      case GL_MAP2_TEXTURE_COORD_3:	return 3;
-      case GL_MAP2_TEXTURE_COORD_4:	return 4;
-      default:				break;
-   }
-
-   /* XXX need to check for the vertex program extension
-   if (!ctx->Extensions.NV_vertex_program)
-      return 0;
-   */
-
-   if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV &&
-       target <= GL_MAP1_VERTEX_ATTRIB15_4_NV)
-      return 4;
-
-   if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV &&
-       target <= GL_MAP2_VERTEX_ATTRIB15_4_NV)
-      return 4;
-
-   return 0;
-}
-
-
-/*
- * Return pointer to the gl_1d_map struct for the named target.
- */
-static struct gl_1d_map *
-get_1d_map( struct gl_context *ctx, GLenum target )
-{
-   switch (target) {
-      case GL_MAP1_VERTEX_3:
-         return &ctx->EvalMap.Map1Vertex3;
-      case GL_MAP1_VERTEX_4:
-         return &ctx->EvalMap.Map1Vertex4;
-      case GL_MAP1_INDEX:
-         return &ctx->EvalMap.Map1Index;
-      case GL_MAP1_COLOR_4:
-         return &ctx->EvalMap.Map1Color4;
-      case GL_MAP1_NORMAL:
-         return &ctx->EvalMap.Map1Normal;
-      case GL_MAP1_TEXTURE_COORD_1:
-         return &ctx->EvalMap.Map1Texture1;
-      case GL_MAP1_TEXTURE_COORD_2:
-         return &ctx->EvalMap.Map1Texture2;
-      case GL_MAP1_TEXTURE_COORD_3:
-         return &ctx->EvalMap.Map1Texture3;
-      case GL_MAP1_TEXTURE_COORD_4:
-         return &ctx->EvalMap.Map1Texture4;
-      case GL_MAP1_VERTEX_ATTRIB0_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB1_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB2_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB3_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB4_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB5_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB6_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB7_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB8_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB9_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB10_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB11_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB12_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB13_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB14_4_NV:
-      case GL_MAP1_VERTEX_ATTRIB15_4_NV:
-         if (!ctx->Extensions.NV_vertex_program)
-            return NULL;
-         return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV];
-      default:
-         return NULL;
-   }
-}
-
-
-/*
- * Return pointer to the gl_2d_map struct for the named target.
- */
-static struct gl_2d_map *
-get_2d_map( struct gl_context *ctx, GLenum target )
-{
-   switch (target) {
-      case GL_MAP2_VERTEX_3:
-         return &ctx->EvalMap.Map2Vertex3;
-      case GL_MAP2_VERTEX_4:
-         return &ctx->EvalMap.Map2Vertex4;
-      case GL_MAP2_INDEX:
-         return &ctx->EvalMap.Map2Index;
-      case GL_MAP2_COLOR_4:
-         return &ctx->EvalMap.Map2Color4;
-      case GL_MAP2_NORMAL:
-         return &ctx->EvalMap.Map2Normal;
-      case GL_MAP2_TEXTURE_COORD_1:
-         return &ctx->EvalMap.Map2Texture1;
-      case GL_MAP2_TEXTURE_COORD_2:
-         return &ctx->EvalMap.Map2Texture2;
-      case GL_MAP2_TEXTURE_COORD_3:
-         return &ctx->EvalMap.Map2Texture3;
-      case GL_MAP2_TEXTURE_COORD_4:
-         return &ctx->EvalMap.Map2Texture4;
-      case GL_MAP2_VERTEX_ATTRIB0_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB1_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB2_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB3_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB4_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB5_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB6_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB7_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB8_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB9_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB10_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB11_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB12_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB13_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB14_4_NV:
-      case GL_MAP2_VERTEX_ATTRIB15_4_NV:
-         if (!ctx->Extensions.NV_vertex_program)
-            return NULL;
-         return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV];
-      default:
-         return NULL;
-   }
-}
-
-
-/**********************************************************************/
-/***            Copy and deallocate control points                  ***/
-/**********************************************************************/
-
-
-/*
- * Copy 1-parametric evaluator control points from user-specified
- * memory space to a buffer of contiguous control points.
- * \param see glMap1f for details
- * \return pointer to buffer of contiguous control points or NULL if out
- *          of memory.
- */
-GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
-                                  const GLfloat *points )
-{
-   GLfloat *buffer, *p;
-   GLint i, k, size = _mesa_evaluator_components(target);
-
-   if (!points || !size)
-      return NULL;
-
-   buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
-
-   if (buffer)
-      for (i = 0, p = buffer; i < uorder; i++, points += ustride)
-	for (k = 0; k < size; k++)
-	  *p++ = points[k];
-
-   return buffer;
-}
-
-
-
-/*
- * Same as above but convert doubles to floats.
- */
-GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
-                                  const GLdouble *points )
-{
-   GLfloat *buffer, *p;
-   GLint i, k, size = _mesa_evaluator_components(target);
-
-   if (!points || !size)
-      return NULL;
-
-   buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
-
-   if (buffer)
-      for (i = 0, p = buffer; i < uorder; i++, points += ustride)
-	for (k = 0; k < size; k++)
-	  *p++ = (GLfloat) points[k];
-
-   return buffer;
-}
-
-
-
-/*
- * Copy 2-parametric evaluator control points from user-specified
- * memory space to a buffer of contiguous control points.
- * Additional memory is allocated to be used by the horner and
- * de Casteljau evaluation schemes.
- *
- * \param see glMap2f for details
- * \return pointer to buffer of contiguous control points or NULL if out
- *          of memory.
- */
-GLfloat *_mesa_copy_map_points2f( GLenum target,
-                                  GLint ustride, GLint uorder,
-                                  GLint vstride, GLint vorder,
-                                  const GLfloat *points )
-{
-   GLfloat *buffer, *p;
-   GLint i, j, k, size, dsize, hsize;
-   GLint uinc;
-
-   size = _mesa_evaluator_components(target);
-
-   if (!points || size==0) {
-      return NULL;
-   }
-
-   /* max(uorder, vorder) additional points are used in      */
-   /* horner evaluation and uorder*vorder additional */
-   /* values are needed for de Casteljau                     */
-   dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder;
-   hsize = (uorder > vorder ? uorder : vorder)*size;
-
-   if(hsize>dsize)
-     buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
-   else
-     buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
-
-   /* compute the increment value for the u-loop */
-   uinc = ustride - vorder*vstride;
-
-   if (buffer)
-      for (i=0, p=buffer; i<uorder; i++, points += uinc)
-	 for (j=0; j<vorder; j++, points += vstride)
-	    for (k=0; k<size; k++)
-	       *p++ = points[k];
-
-   return buffer;
-}
-
-
-
-/*
- * Same as above but convert doubles to floats.
- */
-GLfloat *_mesa_copy_map_points2d(GLenum target,
-                                 GLint ustride, GLint uorder,
-                                 GLint vstride, GLint vorder,
-                                 const GLdouble *points )
-{
-   GLfloat *buffer, *p;
-   GLint i, j, k, size, hsize, dsize;
-   GLint uinc;
-
-   size = _mesa_evaluator_components(target);
-
-   if (!points || size==0) {
-      return NULL;
-   }
-
-   /* max(uorder, vorder) additional points are used in      */
-   /* horner evaluation and uorder*vorder additional */
-   /* values are needed for de Casteljau                     */
-   dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder;
-   hsize = (uorder > vorder ? uorder : vorder)*size;
-
-   if(hsize>dsize)
-     buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
-   else
-     buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
-
-   /* compute the increment value for the u-loop */
-   uinc = ustride - vorder*vstride;
-
-   if (buffer)
-      for (i=0, p=buffer; i<uorder; i++, points += uinc)
-	 for (j=0; j<vorder; j++, points += vstride)
-	    for (k=0; k<size; k++)
-	       *p++ = (GLfloat) points[k];
-
-   return buffer;
-}
-
-
-
-
-/**********************************************************************/
-/***                      API entry points                          ***/
-/**********************************************************************/
-
-
-/*
- * This does the work of glMap1[fd].
- */
-static void
-map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
-     GLint uorder, const GLvoid *points, GLenum type )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   GLint k;
-   GLfloat *pnts;
-   struct gl_1d_map *map = NULL;
-
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
-
-   if (u1 == u2) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
-      return;
-   }
-   if (uorder < 1 || uorder > MAX_EVAL_ORDER) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(order)" );
-      return;
-   }
-   if (!points) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(points)" );
-      return;
-   }
-
-   k = _mesa_evaluator_components( target );
-   if (k == 0) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
-   }
-
-   if (ustride < k) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" );
-      return;
-   }
-
-   if (ctx->Texture.CurrentUnit != 0) {
-      /* See OpenGL 1.2.1 spec, section F.2.13 */
-      _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
-      return;
-   }
-
-   map = get_1d_map(ctx, target);
-   if (!map) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
-      return;
-   }
-
-   /* make copy of the control points */
-   if (type == GL_FLOAT)
-      pnts = _mesa_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
-   else
-      pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
-
-
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
-   map->Order = uorder;
-   map->u1 = u1;
-   map->u2 = u2;
-   map->du = 1.0F / (u2 - u1);
-   if (map->Points)
-      FREE( map->Points );
-   map->Points = pnts;
-}
-
-
-
-static void GLAPIENTRY
-_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
-             GLint order, const GLfloat *points )
-{
-   map1(target, u1, u2, stride, order, points, GL_FLOAT);
-}
-
-
-static void GLAPIENTRY
-_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
-             GLint order, const GLdouble *points )
-{
-   map1(target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE);
-}
-
-
-static void
-map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
-      GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
-      const GLvoid *points, GLenum type )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   GLint k;
-   GLfloat *pnts;
-   struct gl_2d_map *map = NULL;
-
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
-
-   if (u1==u2) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
-      return;
-   }
-
-   if (v1==v2) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" );
-      return;
-   }
-
-   if (uorder<1 || uorder>MAX_EVAL_ORDER) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" );
-      return;
-   }
-
-   if (vorder<1 || vorder>MAX_EVAL_ORDER) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" );
-      return;
-   }
-
-   k = _mesa_evaluator_components( target );
-   if (k==0) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
-   }
-
-   if (ustride < k) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" );
-      return;
-   }
-   if (vstride < k) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" );
-      return;
-   }
-
-   if (ctx->Texture.CurrentUnit != 0) {
-      /* See OpenGL 1.2.1 spec, section F.2.13 */
-      _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
-      return;
-   }
-
-   map = get_2d_map(ctx, target);
-   if (!map) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
-      return;
-   }
-
-   /* make copy of the control points */
-   if (type == GL_FLOAT)
-      pnts = _mesa_copy_map_points2f(target, ustride, uorder,
-                                  vstride, vorder, (GLfloat*) points);
-   else
-      pnts = _mesa_copy_map_points2d(target, ustride, uorder,
-                                  vstride, vorder, (GLdouble*) points);
-
-
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
-   map->Uorder = uorder;
-   map->u1 = u1;
-   map->u2 = u2;
-   map->du = 1.0F / (u2 - u1);
-   map->Vorder = vorder;
-   map->v1 = v1;
-   map->v2 = v2;
-   map->dv = 1.0F / (v2 - v1);
-   if (map->Points)
-      FREE( map->Points );
-   map->Points = pnts;
-}
-
-
-static void GLAPIENTRY
-_mesa_Map2f( GLenum target,
-             GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
-             GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
-             const GLfloat *points)
-{
-   map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
-        points, GL_FLOAT);
-}
-
-
-static void GLAPIENTRY
-_mesa_Map2d( GLenum target,
-             GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
-             GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
-             const GLdouble *points )
-{
-   map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, 
-	(GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE);
-}
-
-
-
-static void GLAPIENTRY
-_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   struct gl_1d_map *map1d;
-   struct gl_2d_map *map2d;
-   GLint i, n;
-   GLfloat *data;
-   GLuint comps;
-
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   comps = _mesa_evaluator_components(target);
-   if (!comps) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
-      return;
-   }
-
-   map1d = get_1d_map(ctx, target);
-   map2d = get_2d_map(ctx, target);
-   ASSERT(map1d || map2d);
-
-   switch (query) {
-      case GL_COEFF:
-         if (map1d) {
-            data = map1d->Points;
-            n = map1d->Order * comps;
-         }
-         else {
-            data = map2d->Points;
-            n = map2d->Uorder * map2d->Vorder * comps;
-         }
-	 if (data) {
-	    for (i=0;i<n;i++) {
-	       v[i] = data[i];
-	    }
-	 }
-         break;
-      case GL_ORDER:
-         if (map1d) {
-            v[0] = (GLdouble) map1d->Order;
-         }
-         else {
-            v[0] = (GLdouble) map2d->Uorder;
-            v[1] = (GLdouble) map2d->Vorder;
-         }
-         break;
-      case GL_DOMAIN:
-         if (map1d) {
-            v[0] = (GLdouble) map1d->u1;
-            v[1] = (GLdouble) map1d->u2;
-         }
-         else {
-            v[0] = (GLdouble) map2d->u1;
-            v[1] = (GLdouble) map2d->u2;
-            v[2] = (GLdouble) map2d->v1;
-            v[3] = (GLdouble) map2d->v2;
-         }
-         break;
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" );
-   }
-}
-
-
-static void GLAPIENTRY
-_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   struct gl_1d_map *map1d;
-   struct gl_2d_map *map2d;
-   GLint i, n;
-   GLfloat *data;
-   GLuint comps;
-
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   comps = _mesa_evaluator_components(target);
-   if (!comps) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
-      return;
-   }
-
-   map1d = get_1d_map(ctx, target);
-   map2d = get_2d_map(ctx, target);
-   ASSERT(map1d || map2d);
-
-   switch (query) {
-      case GL_COEFF:
-         if (map1d) {
-            data = map1d->Points;
-            n = map1d->Order * comps;
-         }
-         else {
-            data = map2d->Points;
-            n = map2d->Uorder * map2d->Vorder * comps;
-         }
-	 if (data) {
-	    for (i=0;i<n;i++) {
-	       v[i] = data[i];
-	    }
-	 }
-         break;
-      case GL_ORDER:
-         if (map1d) {
-            v[0] = (GLfloat) map1d->Order;
-         }
-         else {
-            v[0] = (GLfloat) map2d->Uorder;
-            v[1] = (GLfloat) map2d->Vorder;
-         }
-         break;
-      case GL_DOMAIN:
-         if (map1d) {
-            v[0] = map1d->u1;
-            v[1] = map1d->u2;
-         }
-         else {
-            v[0] = map2d->u1;
-            v[1] = map2d->u2;
-            v[2] = map2d->v1;
-            v[3] = map2d->v2;
-         }
-         break;
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" );
-   }
-}
-
-
-static void GLAPIENTRY
-_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   struct gl_1d_map *map1d;
-   struct gl_2d_map *map2d;
-   GLuint i, n;
-   GLfloat *data;
-   GLuint comps;
-
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   comps = _mesa_evaluator_components(target);
-   if (!comps) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
-      return;
-   }
-
-   map1d = get_1d_map(ctx, target);
-   map2d = get_2d_map(ctx, target);
-   ASSERT(map1d || map2d);
-
-   switch (query) {
-      case GL_COEFF:
-         if (map1d) {
-            data = map1d->Points;
-            n = map1d->Order * comps;
-         }
-         else {
-            data = map2d->Points;
-            n = map2d->Uorder * map2d->Vorder * comps;
-         }
-	 if (data) {
-	    for (i=0;i<n;i++) {
-	       v[i] = IROUND(data[i]);
-	    }
-	 }
-         break;
-      case GL_ORDER:
-         if (map1d) {
-            v[0] = map1d->Order;
-         }
-         else {
-            v[0] = map2d->Uorder;
-            v[1] = map2d->Vorder;
-         }
-         break;
-      case GL_DOMAIN:
-         if (map1d) {
-            v[0] = IROUND(map1d->u1);
-            v[1] = IROUND(map1d->u2);
-         }
-         else {
-            v[0] = IROUND(map2d->u1);
-            v[1] = IROUND(map2d->u2);
-            v[2] = IROUND(map2d->v1);
-            v[3] = IROUND(map2d->v2);
-         }
-         break;
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" );
-   }
-}
-
-
-
-static void GLAPIENTRY
-_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   if (un<1) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
-      return;
-   }
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
-   ctx->Eval.MapGrid1un = un;
-   ctx->Eval.MapGrid1u1 = u1;
-   ctx->Eval.MapGrid1u2 = u2;
-   ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un;
-}
-
-
-static void GLAPIENTRY
-_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
-{
-   _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 );
-}
-
-
-static void GLAPIENTRY
-_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
-                 GLint vn, GLfloat v1, GLfloat v2 )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   if (un<1) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
-      return;
-   }
-   if (vn<1) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" );
-      return;
-   }
-
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
-   ctx->Eval.MapGrid2un = un;
-   ctx->Eval.MapGrid2u1 = u1;
-   ctx->Eval.MapGrid2u2 = u2;
-   ctx->Eval.MapGrid2du = (u2 - u1) / (GLfloat) un;
-   ctx->Eval.MapGrid2vn = vn;
-   ctx->Eval.MapGrid2v1 = v1;
-   ctx->Eval.MapGrid2v2 = v2;
-   ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn;
-}
-
-
-static void GLAPIENTRY
-_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
-                 GLint vn, GLdouble v1, GLdouble v2 )
-{
-   _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2, 
-		    vn, (GLfloat) v1, (GLfloat) v2 );
-}
-
-
-void
-_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
-                          const GLvertexformat *vfmt)
-{
-   SET_EvalCoord1f(disp, vfmt->EvalCoord1f);
-   SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv);
-   SET_EvalCoord2f(disp, vfmt->EvalCoord2f);
-   SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv);
-   SET_EvalPoint1(disp, vfmt->EvalPoint1);
-   SET_EvalPoint2(disp, vfmt->EvalPoint2);
-
-   SET_EvalMesh1(disp, vfmt->EvalMesh1);
-   SET_EvalMesh2(disp, vfmt->EvalMesh2);
-}
-
-
-void
-_mesa_init_eval_dispatch(struct _glapi_table *disp)
-{
-   SET_GetMapdv(disp, _mesa_GetMapdv);
-   SET_GetMapfv(disp, _mesa_GetMapfv);
-   SET_GetMapiv(disp, _mesa_GetMapiv);
-   SET_Map1d(disp, _mesa_Map1d);
-   SET_Map1f(disp, _mesa_Map1f);
-   SET_Map2d(disp, _mesa_Map2d);
-   SET_Map2f(disp, _mesa_Map2f);
-   SET_MapGrid1d(disp, _mesa_MapGrid1d);
-   SET_MapGrid1f(disp, _mesa_MapGrid1f);
-   SET_MapGrid2d(disp, _mesa_MapGrid2d);
-   SET_MapGrid2f(disp, _mesa_MapGrid2f);
-}
-
-
-#endif /* FEATURE_evaluators */
-
-
-/**********************************************************************/
-/*****                      Initialization                        *****/
-/**********************************************************************/
-
-/**
- * Initialize a 1-D evaluator map.
- */
-static void
-init_1d_map( struct gl_1d_map *map, int n, const float *initial )
-{
-   map->Order = 1;
-   map->u1 = 0.0;
-   map->u2 = 1.0;
-   map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
-   if (map->Points) {
-      GLint i;
-      for (i=0;i<n;i++)
-         map->Points[i] = initial[i];
-   }
-}
-
-
-/**
- * Initialize a 2-D evaluator map 
- */
-static void
-init_2d_map( struct gl_2d_map *map, int n, const float *initial )
-{
-   map->Uorder = 1;
-   map->Vorder = 1;
-   map->u1 = 0.0;
-   map->u2 = 1.0;
-   map->v1 = 0.0;
-   map->v2 = 1.0;
-   map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
-   if (map->Points) {
-      GLint i;
-      for (i=0;i<n;i++)
-         map->Points[i] = initial[i];
-   }
-}
-
-
-void _mesa_init_eval( struct gl_context *ctx )
-{
-   int i;
-
-   /* Evaluators group */
-   ctx->Eval.Map1Color4 = GL_FALSE;
-   ctx->Eval.Map1Index = GL_FALSE;
-   ctx->Eval.Map1Normal = GL_FALSE;
-   ctx->Eval.Map1TextureCoord1 = GL_FALSE;
-   ctx->Eval.Map1TextureCoord2 = GL_FALSE;
-   ctx->Eval.Map1TextureCoord3 = GL_FALSE;
-   ctx->Eval.Map1TextureCoord4 = GL_FALSE;
-   ctx->Eval.Map1Vertex3 = GL_FALSE;
-   ctx->Eval.Map1Vertex4 = GL_FALSE;
-   memset(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib));
-   ctx->Eval.Map2Color4 = GL_FALSE;
-   ctx->Eval.Map2Index = GL_FALSE;
-   ctx->Eval.Map2Normal = GL_FALSE;
-   ctx->Eval.Map2TextureCoord1 = GL_FALSE;
-   ctx->Eval.Map2TextureCoord2 = GL_FALSE;
-   ctx->Eval.Map2TextureCoord3 = GL_FALSE;
-   ctx->Eval.Map2TextureCoord4 = GL_FALSE;
-   ctx->Eval.Map2Vertex3 = GL_FALSE;
-   ctx->Eval.Map2Vertex4 = GL_FALSE;
-   memset(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib));
-   ctx->Eval.AutoNormal = GL_FALSE;
-   ctx->Eval.MapGrid1un = 1;
-   ctx->Eval.MapGrid1u1 = 0.0;
-   ctx->Eval.MapGrid1u2 = 1.0;
-   ctx->Eval.MapGrid2un = 1;
-   ctx->Eval.MapGrid2vn = 1;
-   ctx->Eval.MapGrid2u1 = 0.0;
-   ctx->Eval.MapGrid2u2 = 1.0;
-   ctx->Eval.MapGrid2v1 = 0.0;
-   ctx->Eval.MapGrid2v2 = 1.0;
-
-   /* Evaluator data */
-   {
-      static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 };
-      static GLfloat normal[3] = { 0.0, 0.0, 1.0 };
-      static GLfloat index[1] = { 1.0 };
-      static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
-      static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 };
-      static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 };
-
-      init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex );
-      init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex );
-      init_1d_map( &ctx->EvalMap.Map1Index, 1, index );
-      init_1d_map( &ctx->EvalMap.Map1Color4, 4, color );
-      init_1d_map( &ctx->EvalMap.Map1Normal, 3, normal );
-      init_1d_map( &ctx->EvalMap.Map1Texture1, 1, texcoord );
-      init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord );
-      init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord );
-      init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord );
-      for (i = 0; i < 16; i++)
-         init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib );
-
-      init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex );
-      init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex );
-      init_2d_map( &ctx->EvalMap.Map2Index, 1, index );
-      init_2d_map( &ctx->EvalMap.Map2Color4, 4, color );
-      init_2d_map( &ctx->EvalMap.Map2Normal, 3, normal );
-      init_2d_map( &ctx->EvalMap.Map2Texture1, 1, texcoord );
-      init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord );
-      init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord );
-      init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord );
-      for (i = 0; i < 16; i++)
-         init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib );
-   }
-}
-
-
-void _mesa_free_eval_data( struct gl_context *ctx )
-{
-   int i;
-
-   /* Free evaluator data */
-   if (ctx->EvalMap.Map1Vertex3.Points)
-      FREE( ctx->EvalMap.Map1Vertex3.Points );
-   if (ctx->EvalMap.Map1Vertex4.Points)
-      FREE( ctx->EvalMap.Map1Vertex4.Points );
-   if (ctx->EvalMap.Map1Index.Points)
-      FREE( ctx->EvalMap.Map1Index.Points );
-   if (ctx->EvalMap.Map1Color4.Points)
-      FREE( ctx->EvalMap.Map1Color4.Points );
-   if (ctx->EvalMap.Map1Normal.Points)
-      FREE( ctx->EvalMap.Map1Normal.Points );
-   if (ctx->EvalMap.Map1Texture1.Points)
-      FREE( ctx->EvalMap.Map1Texture1.Points );
-   if (ctx->EvalMap.Map1Texture2.Points)
-      FREE( ctx->EvalMap.Map1Texture2.Points );
-   if (ctx->EvalMap.Map1Texture3.Points)
-      FREE( ctx->EvalMap.Map1Texture3.Points );
-   if (ctx->EvalMap.Map1Texture4.Points)
-      FREE( ctx->EvalMap.Map1Texture4.Points );
-   for (i = 0; i < 16; i++)
-      FREE((ctx->EvalMap.Map1Attrib[i].Points));
-
-   if (ctx->EvalMap.Map2Vertex3.Points)
-      FREE( ctx->EvalMap.Map2Vertex3.Points );
-   if (ctx->EvalMap.Map2Vertex4.Points)
-      FREE( ctx->EvalMap.Map2Vertex4.Points );
-   if (ctx->EvalMap.Map2Index.Points)
-      FREE( ctx->EvalMap.Map2Index.Points );
-   if (ctx->EvalMap.Map2Color4.Points)
-      FREE( ctx->EvalMap.Map2Color4.Points );
-   if (ctx->EvalMap.Map2Normal.Points)
-      FREE( ctx->EvalMap.Map2Normal.Points );
-   if (ctx->EvalMap.Map2Texture1.Points)
-      FREE( ctx->EvalMap.Map2Texture1.Points );
-   if (ctx->EvalMap.Map2Texture2.Points)
-      FREE( ctx->EvalMap.Map2Texture2.Points );
-   if (ctx->EvalMap.Map2Texture3.Points)
-      FREE( ctx->EvalMap.Map2Texture3.Points );
-   if (ctx->EvalMap.Map2Texture4.Points)
-      FREE( ctx->EvalMap.Map2Texture4.Points );
-   for (i = 0; i < 16; i++)
-      FREE((ctx->EvalMap.Map2Attrib[i].Points));
-}
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  5.1
+ *
+ * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * eval.c was written by
+ * Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and
+ * Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de).
+ *
+ * My original implementation of evaluators was simplistic and didn't
+ * compute surface normal vectors properly.  Bernd and Volker applied
+ * used more sophisticated methods to get better results.
+ *
+ * Thanks guys!
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+#include "colormac.h"
+#include "context.h"
+#include "eval.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+#include "main/dispatch.h"
+
+
+#if FEATURE_evaluators
+
+
+/*
+ * Return the number of components per control point for any type of
+ * evaluator.  Return 0 if bad target.
+ * See table 5.1 in the OpenGL 1.2 spec.
+ */
+GLuint _mesa_evaluator_components( GLenum target )
+{
+   switch (target) {
+      case GL_MAP1_VERTEX_3:		return 3;
+      case GL_MAP1_VERTEX_4:		return 4;
+      case GL_MAP1_INDEX:		return 1;
+      case GL_MAP1_COLOR_4:		return 4;
+      case GL_MAP1_NORMAL:		return 3;
+      case GL_MAP1_TEXTURE_COORD_1:	return 1;
+      case GL_MAP1_TEXTURE_COORD_2:	return 2;
+      case GL_MAP1_TEXTURE_COORD_3:	return 3;
+      case GL_MAP1_TEXTURE_COORD_4:	return 4;
+      case GL_MAP2_VERTEX_3:		return 3;
+      case GL_MAP2_VERTEX_4:		return 4;
+      case GL_MAP2_INDEX:		return 1;
+      case GL_MAP2_COLOR_4:		return 4;
+      case GL_MAP2_NORMAL:		return 3;
+      case GL_MAP2_TEXTURE_COORD_1:	return 1;
+      case GL_MAP2_TEXTURE_COORD_2:	return 2;
+      case GL_MAP2_TEXTURE_COORD_3:	return 3;
+      case GL_MAP2_TEXTURE_COORD_4:	return 4;
+      default:				break;
+   }
+
+   /* XXX need to check for the vertex program extension
+   if (!ctx->Extensions.NV_vertex_program)
+      return 0;
+   */
+
+   if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV &&
+       target <= GL_MAP1_VERTEX_ATTRIB15_4_NV)
+      return 4;
+
+   if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV &&
+       target <= GL_MAP2_VERTEX_ATTRIB15_4_NV)
+      return 4;
+
+   return 0;
+}
+
+
+/*
+ * Return pointer to the gl_1d_map struct for the named target.
+ */
+static struct gl_1d_map *
+get_1d_map( struct gl_context *ctx, GLenum target )
+{
+   switch (target) {
+      case GL_MAP1_VERTEX_3:
+         return &ctx->EvalMap.Map1Vertex3;
+      case GL_MAP1_VERTEX_4:
+         return &ctx->EvalMap.Map1Vertex4;
+      case GL_MAP1_INDEX:
+         return &ctx->EvalMap.Map1Index;
+      case GL_MAP1_COLOR_4:
+         return &ctx->EvalMap.Map1Color4;
+      case GL_MAP1_NORMAL:
+         return &ctx->EvalMap.Map1Normal;
+      case GL_MAP1_TEXTURE_COORD_1:
+         return &ctx->EvalMap.Map1Texture1;
+      case GL_MAP1_TEXTURE_COORD_2:
+         return &ctx->EvalMap.Map1Texture2;
+      case GL_MAP1_TEXTURE_COORD_3:
+         return &ctx->EvalMap.Map1Texture3;
+      case GL_MAP1_TEXTURE_COORD_4:
+         return &ctx->EvalMap.Map1Texture4;
+      case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+      case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+         if (!ctx->Extensions.NV_vertex_program)
+            return NULL;
+         return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV];
+      default:
+         return NULL;
+   }
+}
+
+
+/*
+ * Return pointer to the gl_2d_map struct for the named target.
+ */
+static struct gl_2d_map *
+get_2d_map( struct gl_context *ctx, GLenum target )
+{
+   switch (target) {
+      case GL_MAP2_VERTEX_3:
+         return &ctx->EvalMap.Map2Vertex3;
+      case GL_MAP2_VERTEX_4:
+         return &ctx->EvalMap.Map2Vertex4;
+      case GL_MAP2_INDEX:
+         return &ctx->EvalMap.Map2Index;
+      case GL_MAP2_COLOR_4:
+         return &ctx->EvalMap.Map2Color4;
+      case GL_MAP2_NORMAL:
+         return &ctx->EvalMap.Map2Normal;
+      case GL_MAP2_TEXTURE_COORD_1:
+         return &ctx->EvalMap.Map2Texture1;
+      case GL_MAP2_TEXTURE_COORD_2:
+         return &ctx->EvalMap.Map2Texture2;
+      case GL_MAP2_TEXTURE_COORD_3:
+         return &ctx->EvalMap.Map2Texture3;
+      case GL_MAP2_TEXTURE_COORD_4:
+         return &ctx->EvalMap.Map2Texture4;
+      case GL_MAP2_VERTEX_ATTRIB0_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB1_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB2_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB3_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB4_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB5_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB6_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB7_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB8_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB9_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB10_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB11_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB12_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB13_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB14_4_NV:
+      case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+         if (!ctx->Extensions.NV_vertex_program)
+            return NULL;
+         return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV];
+      default:
+         return NULL;
+   }
+}
+
+
+/**********************************************************************/
+/***            Copy and deallocate control points                  ***/
+/**********************************************************************/
+
+
+/*
+ * Copy 1-parametric evaluator control points from user-specified
+ * memory space to a buffer of contiguous control points.
+ * \param see glMap1f for details
+ * \return pointer to buffer of contiguous control points or NULL if out
+ *          of memory.
+ */
+GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
+                                  const GLfloat *points )
+{
+   GLfloat *buffer, *p;
+   GLint i, k, size = _mesa_evaluator_components(target);
+
+   if (!points || !size)
+      return NULL;
+
+   buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
+
+   if (buffer)
+      for (i = 0, p = buffer; i < uorder; i++, points += ustride)
+	for (k = 0; k < size; k++)
+	  *p++ = points[k];
+
+   return buffer;
+}
+
+
+
+/*
+ * Same as above but convert doubles to floats.
+ */
+GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
+                                  const GLdouble *points )
+{
+   GLfloat *buffer, *p;
+   GLint i, k, size = _mesa_evaluator_components(target);
+
+   if (!points || !size)
+      return NULL;
+
+   buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
+
+   if (buffer)
+      for (i = 0, p = buffer; i < uorder; i++, points += ustride)
+	for (k = 0; k < size; k++)
+	  *p++ = (GLfloat) points[k];
+
+   return buffer;
+}
+
+
+
+/*
+ * Copy 2-parametric evaluator control points from user-specified
+ * memory space to a buffer of contiguous control points.
+ * Additional memory is allocated to be used by the horner and
+ * de Casteljau evaluation schemes.
+ *
+ * \param see glMap2f for details
+ * \return pointer to buffer of contiguous control points or NULL if out
+ *          of memory.
+ */
+GLfloat *_mesa_copy_map_points2f( GLenum target,
+                                  GLint ustride, GLint uorder,
+                                  GLint vstride, GLint vorder,
+                                  const GLfloat *points )
+{
+   GLfloat *buffer, *p;
+   GLint i, j, k, size, dsize, hsize;
+   GLint uinc;
+
+   size = _mesa_evaluator_components(target);
+
+   if (!points || size==0) {
+      return NULL;
+   }
+
+   /* max(uorder, vorder) additional points are used in      */
+   /* horner evaluation and uorder*vorder additional */
+   /* values are needed for de Casteljau                     */
+   dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder;
+   hsize = (uorder > vorder ? uorder : vorder)*size;
+
+   if(hsize>dsize)
+     buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
+   else
+     buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
+
+   /* compute the increment value for the u-loop */
+   uinc = ustride - vorder*vstride;
+
+   if (buffer)
+      for (i=0, p=buffer; i<uorder; i++, points += uinc)
+	 for (j=0; j<vorder; j++, points += vstride)
+	    for (k=0; k<size; k++)
+	       *p++ = points[k];
+
+   return buffer;
+}
+
+
+
+/*
+ * Same as above but convert doubles to floats.
+ */
+GLfloat *_mesa_copy_map_points2d(GLenum target,
+                                 GLint ustride, GLint uorder,
+                                 GLint vstride, GLint vorder,
+                                 const GLdouble *points )
+{
+   GLfloat *buffer, *p;
+   GLint i, j, k, size, hsize, dsize;
+   GLint uinc;
+
+   size = _mesa_evaluator_components(target);
+
+   if (!points || size==0) {
+      return NULL;
+   }
+
+   /* max(uorder, vorder) additional points are used in      */
+   /* horner evaluation and uorder*vorder additional */
+   /* values are needed for de Casteljau                     */
+   dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder;
+   hsize = (uorder > vorder ? uorder : vorder)*size;
+
+   if(hsize>dsize)
+     buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
+   else
+     buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
+
+   /* compute the increment value for the u-loop */
+   uinc = ustride - vorder*vstride;
+
+   if (buffer)
+      for (i=0, p=buffer; i<uorder; i++, points += uinc)
+	 for (j=0; j<vorder; j++, points += vstride)
+	    for (k=0; k<size; k++)
+	       *p++ = (GLfloat) points[k];
+
+   return buffer;
+}
+
+
+
+
+/**********************************************************************/
+/***                      API entry points                          ***/
+/**********************************************************************/
+
+
+/*
+ * This does the work of glMap1[fd].
+ */
+static void
+map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
+     GLint uorder, const GLvoid *points, GLenum type )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLint k;
+   GLfloat *pnts;
+   struct gl_1d_map *map = NULL;
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
+
+   if (u1 == u2) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
+      return;
+   }
+   if (uorder < 1 || uorder > MAX_EVAL_ORDER) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(order)" );
+      return;
+   }
+   if (!points) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(points)" );
+      return;
+   }
+
+   k = _mesa_evaluator_components( target );
+   if (k == 0) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
+   }
+
+   if (ustride < k) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" );
+      return;
+   }
+
+   if (ctx->Texture.CurrentUnit != 0) {
+      /* See OpenGL 1.2.1 spec, section F.2.13 */
+      _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
+      return;
+   }
+
+   map = get_1d_map(ctx, target);
+   if (!map) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
+      return;
+   }
+
+   /* make copy of the control points */
+   if (type == GL_FLOAT)
+      pnts = _mesa_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
+   else
+      pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
+
+
+   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   map->Order = uorder;
+   map->u1 = u1;
+   map->u2 = u2;
+   map->du = 1.0F / (u2 - u1);
+   if (map->Points)
+      FREE( map->Points );
+   map->Points = pnts;
+}
+
+
+
+static void GLAPIENTRY
+_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+             GLint order, const GLfloat *points )
+{
+   map1(target, u1, u2, stride, order, points, GL_FLOAT);
+}
+
+
+static void GLAPIENTRY
+_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+             GLint order, const GLdouble *points )
+{
+   map1(target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE);
+}
+
+
+static void
+map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+      GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+      const GLvoid *points, GLenum type )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLint k;
+   GLfloat *pnts;
+   struct gl_2d_map *map = NULL;
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
+
+   if (u1==u2) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
+      return;
+   }
+
+   if (v1==v2) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" );
+      return;
+   }
+
+   if (uorder<1 || uorder>MAX_EVAL_ORDER) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" );
+      return;
+   }
+
+   if (vorder<1 || vorder>MAX_EVAL_ORDER) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" );
+      return;
+   }
+
+   k = _mesa_evaluator_components( target );
+   if (k==0) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
+   }
+
+   if (ustride < k) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" );
+      return;
+   }
+   if (vstride < k) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" );
+      return;
+   }
+
+   if (ctx->Texture.CurrentUnit != 0) {
+      /* See OpenGL 1.2.1 spec, section F.2.13 */
+      _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" );
+      return;
+   }
+
+   map = get_2d_map(ctx, target);
+   if (!map) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
+      return;
+   }
+
+   /* make copy of the control points */
+   if (type == GL_FLOAT)
+      pnts = _mesa_copy_map_points2f(target, ustride, uorder,
+                                  vstride, vorder, (GLfloat*) points);
+   else
+      pnts = _mesa_copy_map_points2d(target, ustride, uorder,
+                                  vstride, vorder, (GLdouble*) points);
+
+
+   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   map->Uorder = uorder;
+   map->u1 = u1;
+   map->u2 = u2;
+   map->du = 1.0F / (u2 - u1);
+   map->Vorder = vorder;
+   map->v1 = v1;
+   map->v2 = v2;
+   map->dv = 1.0F / (v2 - v1);
+   if (map->Points)
+      FREE( map->Points );
+   map->Points = pnts;
+}
+
+
+static void GLAPIENTRY
+_mesa_Map2f( GLenum target,
+             GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+             GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+             const GLfloat *points)
+{
+   map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
+        points, GL_FLOAT);
+}
+
+
+static void GLAPIENTRY
+_mesa_Map2d( GLenum target,
+             GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+             GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+             const GLdouble *points )
+{
+   map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, 
+	(GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE);
+}
+
+
+
+static void GLAPIENTRY
+_mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_1d_map *map1d;
+   struct gl_2d_map *map2d;
+   GLint i, n;
+   GLfloat *data;
+   GLuint comps;
+   GLsizei numBytes;
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   comps = _mesa_evaluator_components(target);
+   if (!comps) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
+      return;
+   }
+
+   map1d = get_1d_map(ctx, target);
+   map2d = get_2d_map(ctx, target);
+   ASSERT(map1d || map2d);
+
+   switch (query) {
+      case GL_COEFF:
+         if (map1d) {
+            data = map1d->Points;
+            n = map1d->Order * comps;
+         }
+         else {
+            data = map2d->Points;
+            n = map2d->Uorder * map2d->Vorder * comps;
+         }
+	 if (data) {
+            numBytes = n * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+	    for (i=0;i<n;i++) {
+	       v[i] = data[i];
+	    }
+	 }
+         break;
+      case GL_ORDER:
+         if (map1d) {
+            numBytes = 1 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = (GLdouble) map1d->Order;
+         }
+         else {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = (GLdouble) map2d->Uorder;
+            v[1] = (GLdouble) map2d->Vorder;
+         }
+         break;
+      case GL_DOMAIN:
+         if (map1d) {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+              goto overflow;
+            v[0] = (GLdouble) map1d->u1;
+            v[1] = (GLdouble) map1d->u2;
+         }
+         else {
+            numBytes = 4 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = (GLdouble) map2d->u1;
+            v[1] = (GLdouble) map2d->u2;
+            v[2] = (GLdouble) map2d->v1;
+            v[3] = (GLdouble) map2d->v2;
+         }
+         break;
+      default:
+         _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" );
+   }
+   return;
+
+overflow:
+   _mesa_error( ctx, GL_INVALID_OPERATION,
+               "glGetnMapdvARB(out of bounds: bufSize is %d,"
+               " but %d bytes are required)", bufSize, numBytes );
+}
+
+static void GLAPIENTRY
+_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+{
+   _mesa_GetnMapdvARB(target, query, INT_MAX, v);
+}
+
+static void GLAPIENTRY
+_mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_1d_map *map1d;
+   struct gl_2d_map *map2d;
+   GLint i, n;
+   GLfloat *data;
+   GLuint comps;
+   GLsizei numBytes;
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   comps = _mesa_evaluator_components(target);
+   if (!comps) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
+      return;
+   }
+
+   map1d = get_1d_map(ctx, target);
+   map2d = get_2d_map(ctx, target);
+   ASSERT(map1d || map2d);
+
+   switch (query) {
+      case GL_COEFF:
+         if (map1d) {
+            data = map1d->Points;
+            n = map1d->Order * comps;
+         }
+         else {
+            data = map2d->Points;
+            n = map2d->Uorder * map2d->Vorder * comps;
+         }
+	 if (data) {
+            numBytes = n * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+	    for (i=0;i<n;i++) {
+	       v[i] = data[i];
+	    }
+	 }
+         break;
+      case GL_ORDER:
+         if (map1d) {
+            numBytes = 1 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = (GLfloat) map1d->Order;
+         }
+         else {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = (GLfloat) map2d->Uorder;
+            v[1] = (GLfloat) map2d->Vorder;
+         }
+         break;
+      case GL_DOMAIN:
+         if (map1d) {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = map1d->u1;
+            v[1] = map1d->u2;
+         }
+         else {
+            numBytes = 4 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = map2d->u1;
+            v[1] = map2d->u2;
+            v[2] = map2d->v1;
+            v[3] = map2d->v2;
+         }
+         break;
+      default:
+         _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" );
+   }
+   return;
+
+overflow:
+   _mesa_error( ctx, GL_INVALID_OPERATION,
+               "glGetnMapfvARB(out of bounds: bufSize is %d,"
+               " but %d bytes are required)", bufSize, numBytes );
+}
+
+
+static void GLAPIENTRY
+_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+{
+   _mesa_GetnMapfvARB(target, query, INT_MAX, v);
+}
+
+
+static void GLAPIENTRY
+_mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_1d_map *map1d;
+   struct gl_2d_map *map2d;
+   GLuint i, n;
+   GLfloat *data;
+   GLuint comps;
+   GLsizei numBytes;
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   comps = _mesa_evaluator_components(target);
+   if (!comps) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
+      return;
+   }
+
+   map1d = get_1d_map(ctx, target);
+   map2d = get_2d_map(ctx, target);
+   ASSERT(map1d || map2d);
+
+   switch (query) {
+      case GL_COEFF:
+         if (map1d) {
+            data = map1d->Points;
+            n = map1d->Order * comps;
+         }
+         else {
+            data = map2d->Points;
+            n = map2d->Uorder * map2d->Vorder * comps;
+         }
+	 if (data) {
+            numBytes = n * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+	    for (i=0;i<n;i++) {
+	       v[i] = IROUND(data[i]);
+	    }
+	 }
+         break;
+      case GL_ORDER:
+         if (map1d) {
+            numBytes = 1 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = map1d->Order;
+         }
+         else {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = map2d->Uorder;
+            v[1] = map2d->Vorder;
+         }
+         break;
+      case GL_DOMAIN:
+         if (map1d) {
+            numBytes = 2 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = IROUND(map1d->u1);
+            v[1] = IROUND(map1d->u2);
+         }
+         else {
+            numBytes = 4 * sizeof *v;
+            if (bufSize < numBytes)
+               goto overflow;
+            v[0] = IROUND(map2d->u1);
+            v[1] = IROUND(map2d->u2);
+            v[2] = IROUND(map2d->v1);
+            v[3] = IROUND(map2d->v2);
+         }
+         break;
+      default:
+         _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" );
+   }
+   return;
+
+overflow:
+   _mesa_error( ctx, GL_INVALID_OPERATION,
+               "glGetnMapivARB(out of bounds: bufSize is %d,"
+               " but %d bytes are required)", bufSize, numBytes );
+}
+
+
+static void GLAPIENTRY
+_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
+{
+   _mesa_GetnMapivARB(target, query, INT_MAX, v);
+}
+
+
+static void GLAPIENTRY
+_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (un<1) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
+      return;
+   }
+   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   ctx->Eval.MapGrid1un = un;
+   ctx->Eval.MapGrid1u1 = u1;
+   ctx->Eval.MapGrid1u2 = u2;
+   ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un;
+}
+
+
+static void GLAPIENTRY
+_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
+{
+   _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 );
+}
+
+
+static void GLAPIENTRY
+_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+                 GLint vn, GLfloat v1, GLfloat v2 )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (un<1) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
+      return;
+   }
+   if (vn<1) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" );
+      return;
+   }
+
+   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   ctx->Eval.MapGrid2un = un;
+   ctx->Eval.MapGrid2u1 = u1;
+   ctx->Eval.MapGrid2u2 = u2;
+   ctx->Eval.MapGrid2du = (u2 - u1) / (GLfloat) un;
+   ctx->Eval.MapGrid2vn = vn;
+   ctx->Eval.MapGrid2v1 = v1;
+   ctx->Eval.MapGrid2v2 = v2;
+   ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn;
+}
+
+
+static void GLAPIENTRY
+_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+                 GLint vn, GLdouble v1, GLdouble v2 )
+{
+   _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2, 
+		    vn, (GLfloat) v1, (GLfloat) v2 );
+}
+
+
+void
+_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
+                          const GLvertexformat *vfmt)
+{
+   SET_EvalCoord1f(disp, vfmt->EvalCoord1f);
+   SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv);
+   SET_EvalCoord2f(disp, vfmt->EvalCoord2f);
+   SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv);
+   SET_EvalPoint1(disp, vfmt->EvalPoint1);
+   SET_EvalPoint2(disp, vfmt->EvalPoint2);
+
+   SET_EvalMesh1(disp, vfmt->EvalMesh1);
+   SET_EvalMesh2(disp, vfmt->EvalMesh2);
+}
+
+
+void
+_mesa_init_eval_dispatch(struct _glapi_table *disp)
+{
+   SET_GetMapdv(disp, _mesa_GetMapdv);
+   SET_GetMapfv(disp, _mesa_GetMapfv);
+   SET_GetMapiv(disp, _mesa_GetMapiv);
+   SET_Map1d(disp, _mesa_Map1d);
+   SET_Map1f(disp, _mesa_Map1f);
+   SET_Map2d(disp, _mesa_Map2d);
+   SET_Map2f(disp, _mesa_Map2f);
+   SET_MapGrid1d(disp, _mesa_MapGrid1d);
+   SET_MapGrid1f(disp, _mesa_MapGrid1f);
+   SET_MapGrid2d(disp, _mesa_MapGrid2d);
+   SET_MapGrid2f(disp, _mesa_MapGrid2f);
+
+   /* GL_ARB_robustness */
+   SET_GetnMapdvARB(disp, _mesa_GetnMapdvARB);
+   SET_GetnMapfvARB(disp, _mesa_GetnMapfvARB);
+   SET_GetnMapivARB(disp, _mesa_GetnMapivARB);
+}
+
+
+#endif /* FEATURE_evaluators */
+
+
+/**********************************************************************/
+/*****                      Initialization                        *****/
+/**********************************************************************/
+
+/**
+ * Initialize a 1-D evaluator map.
+ */
+static void
+init_1d_map( struct gl_1d_map *map, int n, const float *initial )
+{
+   map->Order = 1;
+   map->u1 = 0.0;
+   map->u2 = 1.0;
+   map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+   if (map->Points) {
+      GLint i;
+      for (i=0;i<n;i++)
+         map->Points[i] = initial[i];
+   }
+}
+
+
+/**
+ * Initialize a 2-D evaluator map 
+ */
+static void
+init_2d_map( struct gl_2d_map *map, int n, const float *initial )
+{
+   map->Uorder = 1;
+   map->Vorder = 1;
+   map->u1 = 0.0;
+   map->u2 = 1.0;
+   map->v1 = 0.0;
+   map->v2 = 1.0;
+   map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+   if (map->Points) {
+      GLint i;
+      for (i=0;i<n;i++)
+         map->Points[i] = initial[i];
+   }
+}
+
+
+void _mesa_init_eval( struct gl_context *ctx )
+{
+   int i;
+
+   /* Evaluators group */
+   ctx->Eval.Map1Color4 = GL_FALSE;
+   ctx->Eval.Map1Index = GL_FALSE;
+   ctx->Eval.Map1Normal = GL_FALSE;
+   ctx->Eval.Map1TextureCoord1 = GL_FALSE;
+   ctx->Eval.Map1TextureCoord2 = GL_FALSE;
+   ctx->Eval.Map1TextureCoord3 = GL_FALSE;
+   ctx->Eval.Map1TextureCoord4 = GL_FALSE;
+   ctx->Eval.Map1Vertex3 = GL_FALSE;
+   ctx->Eval.Map1Vertex4 = GL_FALSE;
+   memset(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib));
+   ctx->Eval.Map2Color4 = GL_FALSE;
+   ctx->Eval.Map2Index = GL_FALSE;
+   ctx->Eval.Map2Normal = GL_FALSE;
+   ctx->Eval.Map2TextureCoord1 = GL_FALSE;
+   ctx->Eval.Map2TextureCoord2 = GL_FALSE;
+   ctx->Eval.Map2TextureCoord3 = GL_FALSE;
+   ctx->Eval.Map2TextureCoord4 = GL_FALSE;
+   ctx->Eval.Map2Vertex3 = GL_FALSE;
+   ctx->Eval.Map2Vertex4 = GL_FALSE;
+   memset(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib));
+   ctx->Eval.AutoNormal = GL_FALSE;
+   ctx->Eval.MapGrid1un = 1;
+   ctx->Eval.MapGrid1u1 = 0.0;
+   ctx->Eval.MapGrid1u2 = 1.0;
+   ctx->Eval.MapGrid2un = 1;
+   ctx->Eval.MapGrid2vn = 1;
+   ctx->Eval.MapGrid2u1 = 0.0;
+   ctx->Eval.MapGrid2u2 = 1.0;
+   ctx->Eval.MapGrid2v1 = 0.0;
+   ctx->Eval.MapGrid2v2 = 1.0;
+
+   /* Evaluator data */
+   {
+      static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 };
+      static GLfloat normal[3] = { 0.0, 0.0, 1.0 };
+      static GLfloat index[1] = { 1.0 };
+      static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
+      static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 };
+      static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 };
+
+      init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex );
+      init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex );
+      init_1d_map( &ctx->EvalMap.Map1Index, 1, index );
+      init_1d_map( &ctx->EvalMap.Map1Color4, 4, color );
+      init_1d_map( &ctx->EvalMap.Map1Normal, 3, normal );
+      init_1d_map( &ctx->EvalMap.Map1Texture1, 1, texcoord );
+      init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord );
+      init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord );
+      init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord );
+      for (i = 0; i < 16; i++)
+         init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib );
+
+      init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex );
+      init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex );
+      init_2d_map( &ctx->EvalMap.Map2Index, 1, index );
+      init_2d_map( &ctx->EvalMap.Map2Color4, 4, color );
+      init_2d_map( &ctx->EvalMap.Map2Normal, 3, normal );
+      init_2d_map( &ctx->EvalMap.Map2Texture1, 1, texcoord );
+      init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord );
+      init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord );
+      init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord );
+      for (i = 0; i < 16; i++)
+         init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib );
+   }
+}
+
+
+void _mesa_free_eval_data( struct gl_context *ctx )
+{
+   int i;
+
+   /* Free evaluator data */
+   if (ctx->EvalMap.Map1Vertex3.Points)
+      FREE( ctx->EvalMap.Map1Vertex3.Points );
+   if (ctx->EvalMap.Map1Vertex4.Points)
+      FREE( ctx->EvalMap.Map1Vertex4.Points );
+   if (ctx->EvalMap.Map1Index.Points)
+      FREE( ctx->EvalMap.Map1Index.Points );
+   if (ctx->EvalMap.Map1Color4.Points)
+      FREE( ctx->EvalMap.Map1Color4.Points );
+   if (ctx->EvalMap.Map1Normal.Points)
+      FREE( ctx->EvalMap.Map1Normal.Points );
+   if (ctx->EvalMap.Map1Texture1.Points)
+      FREE( ctx->EvalMap.Map1Texture1.Points );
+   if (ctx->EvalMap.Map1Texture2.Points)
+      FREE( ctx->EvalMap.Map1Texture2.Points );
+   if (ctx->EvalMap.Map1Texture3.Points)
+      FREE( ctx->EvalMap.Map1Texture3.Points );
+   if (ctx->EvalMap.Map1Texture4.Points)
+      FREE( ctx->EvalMap.Map1Texture4.Points );
+   for (i = 0; i < 16; i++)
+      FREE((ctx->EvalMap.Map1Attrib[i].Points));
+
+   if (ctx->EvalMap.Map2Vertex3.Points)
+      FREE( ctx->EvalMap.Map2Vertex3.Points );
+   if (ctx->EvalMap.Map2Vertex4.Points)
+      FREE( ctx->EvalMap.Map2Vertex4.Points );
+   if (ctx->EvalMap.Map2Index.Points)
+      FREE( ctx->EvalMap.Map2Index.Points );
+   if (ctx->EvalMap.Map2Color4.Points)
+      FREE( ctx->EvalMap.Map2Color4.Points );
+   if (ctx->EvalMap.Map2Normal.Points)
+      FREE( ctx->EvalMap.Map2Normal.Points );
+   if (ctx->EvalMap.Map2Texture1.Points)
+      FREE( ctx->EvalMap.Map2Texture1.Points );
+   if (ctx->EvalMap.Map2Texture2.Points)
+      FREE( ctx->EvalMap.Map2Texture2.Points );
+   if (ctx->EvalMap.Map2Texture3.Points)
+      FREE( ctx->EvalMap.Map2Texture3.Points );
+   if (ctx->EvalMap.Map2Texture4.Points)
+      FREE( ctx->EvalMap.Map2Texture4.Points );
+   for (i = 0; i < 16; i++)
+      FREE((ctx->EvalMap.Map2Attrib[i].Points));
+}
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 8a0ab9615..82474cf41 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -107,6 +107,7 @@ static const struct extension extension_table[] = {
    { "GL_ARB_point_parameters",                    o(EXT_point_parameters),                    GL,             1997 },
    { "GL_ARB_point_sprite",                        o(ARB_point_sprite),                        GL,             2003 },
    { "GL_ARB_provoking_vertex",                    o(EXT_provoking_vertex),                    GL,             2009 },
+   { "GL_ARB_robustness",                          o(dummy_true),                              GL,             2010 },
    { "GL_ARB_sampler_objects",                     o(ARB_sampler_objects),                     GL,             2009 },
    { "GL_ARB_seamless_cube_map",                   o(ARB_seamless_cube_map),                   GL,             2009 },
    { "GL_ARB_shader_objects",                      o(ARB_shader_objects),                      GL,             2002 },
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 43930a4b3..0b53c28f7 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -1530,15 +1530,26 @@ create_new_program(struct gl_context *ctx, struct state_key *key,
     */
    emit_arith( &p, OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef);
 
-   if (key->fog_enabled) {
-      /* Pull fog mode from struct gl_context, the value in the state key is
-       * a reduced value and not what is expected in FogOption
-       */
-      p.program->FogOption = ctx->Fog.Mode;
-      p.program->Base.InputsRead |= FRAG_BIT_FOGC;
+   /* Allocate final instruction array.  This has to be done before calling
+    * _mesa_append_fog_code because that function frees the Base.Instructions.
+    * At this point, Base.Instructions points to stack data, so it's a really
+    * bad idea to free it.
+    */
+   p.program->Base.Instructions
+      = _mesa_alloc_instructions(p.program->Base.NumInstructions);
+   if (!p.program->Base.Instructions) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                  "generating tex env program");
+      return;
    }
-   else {
-      p.program->FogOption = GL_NONE;
+   _mesa_copy_instructions(p.program->Base.Instructions, instBuffer,
+                           p.program->Base.NumInstructions);
+
+   /* Append fog code.  This must be done before checking the program against
+    * the limits becuase it will potentially add some instructions.
+    */
+   if (key->fog_enabled) {
+      _mesa_append_fog_code(ctx, p.program, ctx->Fog.Mode, GL_FALSE);
    }
 
    if (p.program->Base.NumTexIndirections > ctx->Const.FragmentProgram.MaxTexIndirections) 
@@ -1552,23 +1563,6 @@ create_new_program(struct gl_context *ctx, struct state_key *key,
 
    ASSERT(p.program->Base.NumInstructions <= MAX_INSTRUCTIONS);
 
-   /* Allocate final instruction array */
-   p.program->Base.Instructions
-      = _mesa_alloc_instructions(p.program->Base.NumInstructions);
-   if (!p.program->Base.Instructions) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY,
-                  "generating tex env program");
-      return;
-   }
-   _mesa_copy_instructions(p.program->Base.Instructions, instBuffer,
-                           p.program->Base.NumInstructions);
-
-   if (key->num_draw_buffers && p.program->FogOption) {
-      _mesa_append_fog_code(ctx, p.program, GL_FALSE);
-      p.program->FogOption = GL_NONE;
-   }
-
-
    /* Notify driver the fragment program has (actually) changed.
     */
    if (ctx->Driver.ProgramStringNotify) {
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index e18803280..e933bbe0f 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1281,6 +1281,9 @@ static const struct value_desc values[] = {
    /* GL 3.2 */
    { GL_CONTEXT_PROFILE_MASK, CONTEXT_INT(Const.ProfileMask),
      extra_version_32 },
+
+   /* GL_ARB_robustness */
+   { GL_RESET_NOTIFICATION_STRATEGY_ARB, CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA },
 #endif /* FEATURE_GL */
 };
 
diff --git a/mesalib/src/mesa/main/get.h b/mesalib/src/mesa/main/get.h
index 99a004b71..9422efec5 100644
--- a/mesalib/src/mesa/main/get.h
+++ b/mesalib/src/mesa/main/get.h
@@ -74,4 +74,8 @@ _mesa_GetStringi(GLenum name, GLuint index);
 extern GLenum GLAPIENTRY
 _mesa_GetError( void );
 
+/* GL_ARB_robustness */
+extern GLenum GLAPIENTRY
+_mesa_GetGraphicsResetStatusARB( void );
+
 #endif
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index e55584afc..c381fb2df 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -1,253 +1,270 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-
-#include "glheader.h"
-#include "context.h"
-#include "get.h"
-#include "enums.h"
-#include "extensions.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-
-
-/**
- * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query.
- */
-static const GLubyte *
-shading_language_version(struct gl_context *ctx)
-{
-   switch (ctx->API) {
-   case API_OPENGL:
-      if (!ctx->Extensions.ARB_shader_objects) {
-         _mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
-         return (const GLubyte *) 0;
-      }
-
-      switch (ctx->Const.GLSLVersion) {
-      case 110:
-         return (const GLubyte *) "1.10";
-      case 120:
-         return (const GLubyte *) "1.20";
-      case 130:
-         return (const GLubyte *) "1.30";
-      default:
-         _mesa_problem(ctx,
-                       "Invalid GLSL version in shading_language_version()");
-         return (const GLubyte *) 0;
-      }
-      break;
-
-   case API_OPENGLES2:
-      return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
-
-   case API_OPENGLES:
-      /* fall-through */
-
-   default:
-      _mesa_problem(ctx, "Unexpected API value in shading_language_version()");
-      return (const GLubyte *) 0;
-   }
-}
-
-
-/**
- * Query string-valued state.  The return value should _not_ be freed by
- * the caller.
- *
- * \param name  the state variable to query.
- *
- * \sa glGetString().
- *
- * Tries to get the string from dd_function_table::GetString, otherwise returns
- * the hardcoded strings.
- */
-const GLubyte * GLAPIENTRY
-_mesa_GetString( GLenum name )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   static const char *vendor = "Brian Paul";
-   static const char *renderer = "Mesa";
-
-   if (!ctx)
-      return NULL;
-
-   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
-
-   /* this is a required driver function */
-   assert(ctx->Driver.GetString);
-   {
-      /* Give the driver the chance to handle this query */
-      const GLubyte *str = (*ctx->Driver.GetString)(ctx, name);
-      if (str)
-         return str;
-   }
-
-   switch (name) {
-      case GL_VENDOR:
-         return (const GLubyte *) vendor;
-      case GL_RENDERER:
-         return (const GLubyte *) renderer;
-      case GL_VERSION:
-         return (const GLubyte *) ctx->VersionString;
-      case GL_EXTENSIONS:
-         return (const GLubyte *) ctx->Extensions.String;
-#if FEATURE_ARB_shading_language_100 || FEATURE_ES2
-      case GL_SHADING_LANGUAGE_VERSION:
-	 return shading_language_version(ctx);
-#endif
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
-    FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
-      case GL_PROGRAM_ERROR_STRING_NV:
-         if (ctx->Extensions.NV_fragment_program ||
-             ctx->Extensions.ARB_fragment_program ||
-             ctx->Extensions.NV_vertex_program ||
-             ctx->Extensions.ARB_vertex_program) {
-            return (const GLubyte *) ctx->Program.ErrorString;
-         }
-         /* FALL-THROUGH */
-#endif
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
-         return (const GLubyte *) 0;
-   }
-}
-
-
-/**
- * GL3
- */
-const GLubyte * GLAPIENTRY
-_mesa_GetStringi(GLenum name, GLuint index)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (!ctx)
-      return NULL;
-
-   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
-
-   switch (name) {
-   case GL_EXTENSIONS:
-      if (index >= _mesa_get_extension_count(ctx)) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glGetStringi(index=%u)", index);
-         return (const GLubyte *) 0;
-      }
-      return _mesa_get_enabled_extension(ctx, index);
-   default:
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
-      return (const GLubyte *) 0;
-   }
-}
-
-
-
-/**
- * Return pointer-valued state, such as a vertex array pointer.
- *
- * \param pname  names state to be queried
- * \param params  returns the pointer value
- *
- * \sa glGetPointerv().
- *
- * Tries to get the specified pointer via dd_function_table::GetPointerv,
- * otherwise gets the specified pointer from the current context.
- */
-void GLAPIENTRY
-_mesa_GetPointerv( GLenum pname, GLvoid **params )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   const GLuint clientUnit = ctx->Array.ActiveTexture;
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   if (!params)
-      return;
-
-   if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
-
-   switch (pname) {
-      case GL_VERTEX_ARRAY_POINTER:
-         *params = (GLvoid *) ctx->Array.ArrayObj->Vertex.Ptr;
-         break;
-      case GL_NORMAL_ARRAY_POINTER:
-         *params = (GLvoid *) ctx->Array.ArrayObj->Normal.Ptr;
-         break;
-      case GL_COLOR_ARRAY_POINTER:
-         *params = (GLvoid *) ctx->Array.ArrayObj->Color.Ptr;
-         break;
-      case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
-         *params = (GLvoid *) ctx->Array.ArrayObj->SecondaryColor.Ptr;
-         break;
-      case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
-         *params = (GLvoid *) ctx->Array.ArrayObj->FogCoord.Ptr;
-         break;
-      case GL_INDEX_ARRAY_POINTER:
-         *params = (GLvoid *) ctx->Array.ArrayObj->Index.Ptr;
-         break;
-      case GL_TEXTURE_COORD_ARRAY_POINTER:
-         *params = (GLvoid *) ctx->Array.ArrayObj->TexCoord[clientUnit].Ptr;
-         break;
-      case GL_EDGE_FLAG_ARRAY_POINTER:
-         *params = (GLvoid *) ctx->Array.ArrayObj->EdgeFlag.Ptr;
-         break;
-      case GL_FEEDBACK_BUFFER_POINTER:
-         *params = ctx->Feedback.Buffer;
-         break;
-      case GL_SELECTION_BUFFER_POINTER:
-         *params = ctx->Select.Buffer;
-         break;
-#if FEATURE_point_size_array
-      case GL_POINT_SIZE_ARRAY_POINTER_OES:
-         *params = (GLvoid *) ctx->Array.ArrayObj->PointSize.Ptr;
-         break;
-#endif
-      default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
-         return;
-   }
-}
-
-
-/**
- * Returns the current GL error code, or GL_NO_ERROR.
- * \return current error code
- *
- * Returns __struct gl_contextRec::ErrorValue.
- */
-GLenum GLAPIENTRY
-_mesa_GetError( void )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   GLenum e = ctx->ErrorValue;
-   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
-
-   if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
-
-   ctx->ErrorValue = (GLenum) GL_NO_ERROR;
-   ctx->ErrorDebugCount = 0;
-   return e;
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+#include "glheader.h"
+#include "context.h"
+#include "get.h"
+#include "enums.h"
+#include "extensions.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+
+
+/**
+ * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query.
+ */
+static const GLubyte *
+shading_language_version(struct gl_context *ctx)
+{
+   switch (ctx->API) {
+   case API_OPENGL:
+      if (!ctx->Extensions.ARB_shader_objects) {
+         _mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
+         return (const GLubyte *) 0;
+      }
+
+      switch (ctx->Const.GLSLVersion) {
+      case 110:
+         return (const GLubyte *) "1.10";
+      case 120:
+         return (const GLubyte *) "1.20";
+      case 130:
+         return (const GLubyte *) "1.30";
+      default:
+         _mesa_problem(ctx,
+                       "Invalid GLSL version in shading_language_version()");
+         return (const GLubyte *) 0;
+      }
+      break;
+
+   case API_OPENGLES2:
+      return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
+
+   case API_OPENGLES:
+      /* fall-through */
+
+   default:
+      _mesa_problem(ctx, "Unexpected API value in shading_language_version()");
+      return (const GLubyte *) 0;
+   }
+}
+
+
+/**
+ * Query string-valued state.  The return value should _not_ be freed by
+ * the caller.
+ *
+ * \param name  the state variable to query.
+ *
+ * \sa glGetString().
+ *
+ * Tries to get the string from dd_function_table::GetString, otherwise returns
+ * the hardcoded strings.
+ */
+const GLubyte * GLAPIENTRY
+_mesa_GetString( GLenum name )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   static const char *vendor = "Brian Paul";
+   static const char *renderer = "Mesa";
+
+   if (!ctx)
+      return NULL;
+
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
+
+   /* this is a required driver function */
+   assert(ctx->Driver.GetString);
+   {
+      /* Give the driver the chance to handle this query */
+      const GLubyte *str = (*ctx->Driver.GetString)(ctx, name);
+      if (str)
+         return str;
+   }
+
+   switch (name) {
+      case GL_VENDOR:
+         return (const GLubyte *) vendor;
+      case GL_RENDERER:
+         return (const GLubyte *) renderer;
+      case GL_VERSION:
+         return (const GLubyte *) ctx->VersionString;
+      case GL_EXTENSIONS:
+         return (const GLubyte *) ctx->Extensions.String;
+#if FEATURE_ARB_shading_language_100 || FEATURE_ES2
+      case GL_SHADING_LANGUAGE_VERSION:
+	 return shading_language_version(ctx);
+#endif
+#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
+    FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
+      case GL_PROGRAM_ERROR_STRING_NV:
+         if (ctx->Extensions.NV_fragment_program ||
+             ctx->Extensions.ARB_fragment_program ||
+             ctx->Extensions.NV_vertex_program ||
+             ctx->Extensions.ARB_vertex_program) {
+            return (const GLubyte *) ctx->Program.ErrorString;
+         }
+         /* FALL-THROUGH */
+#endif
+      default:
+         _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
+         return (const GLubyte *) 0;
+   }
+}
+
+
+/**
+ * GL3
+ */
+const GLubyte * GLAPIENTRY
+_mesa_GetStringi(GLenum name, GLuint index)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (!ctx)
+      return NULL;
+
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
+
+   switch (name) {
+   case GL_EXTENSIONS:
+      if (index >= _mesa_get_extension_count(ctx)) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glGetStringi(index=%u)", index);
+         return (const GLubyte *) 0;
+      }
+      return _mesa_get_enabled_extension(ctx, index);
+   default:
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
+      return (const GLubyte *) 0;
+   }
+}
+
+
+
+/**
+ * Return pointer-valued state, such as a vertex array pointer.
+ *
+ * \param pname  names state to be queried
+ * \param params  returns the pointer value
+ *
+ * \sa glGetPointerv().
+ *
+ * Tries to get the specified pointer via dd_function_table::GetPointerv,
+ * otherwise gets the specified pointer from the current context.
+ */
+void GLAPIENTRY
+_mesa_GetPointerv( GLenum pname, GLvoid **params )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   const GLuint clientUnit = ctx->Array.ActiveTexture;
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (!params)
+      return;
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
+
+   switch (pname) {
+      case GL_VERTEX_ARRAY_POINTER:
+         *params = (GLvoid *) ctx->Array.ArrayObj->Vertex.Ptr;
+         break;
+      case GL_NORMAL_ARRAY_POINTER:
+         *params = (GLvoid *) ctx->Array.ArrayObj->Normal.Ptr;
+         break;
+      case GL_COLOR_ARRAY_POINTER:
+         *params = (GLvoid *) ctx->Array.ArrayObj->Color.Ptr;
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
+         *params = (GLvoid *) ctx->Array.ArrayObj->SecondaryColor.Ptr;
+         break;
+      case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
+         *params = (GLvoid *) ctx->Array.ArrayObj->FogCoord.Ptr;
+         break;
+      case GL_INDEX_ARRAY_POINTER:
+         *params = (GLvoid *) ctx->Array.ArrayObj->Index.Ptr;
+         break;
+      case GL_TEXTURE_COORD_ARRAY_POINTER:
+         *params = (GLvoid *) ctx->Array.ArrayObj->TexCoord[clientUnit].Ptr;
+         break;
+      case GL_EDGE_FLAG_ARRAY_POINTER:
+         *params = (GLvoid *) ctx->Array.ArrayObj->EdgeFlag.Ptr;
+         break;
+      case GL_FEEDBACK_BUFFER_POINTER:
+         *params = ctx->Feedback.Buffer;
+         break;
+      case GL_SELECTION_BUFFER_POINTER:
+         *params = ctx->Select.Buffer;
+         break;
+#if FEATURE_point_size_array
+      case GL_POINT_SIZE_ARRAY_POINTER_OES:
+         *params = (GLvoid *) ctx->Array.ArrayObj->PointSize.Ptr;
+         break;
+#endif
+      default:
+         _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
+         return;
+   }
+}
+
+
+/**
+ * Returns the current GL error code, or GL_NO_ERROR.
+ * \return current error code
+ *
+ * Returns __struct gl_contextRec::ErrorValue.
+ */
+GLenum GLAPIENTRY
+_mesa_GetError( void )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLenum e = ctx->ErrorValue;
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
+
+   ctx->ErrorValue = (GLenum) GL_NO_ERROR;
+   ctx->ErrorDebugCount = 0;
+   return e;
+}
+
+/**
+ * Returns an error code specified by GL_ARB_robustness, or GL_NO_ERROR.
+ * \return current context status
+ */
+GLenum GLAPIENTRY
+_mesa_GetGraphicsResetStatusARB( void )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLenum status = ctx->ResetStatus;
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glGetGraphicsResetStatusARB"
+                       "(always returns GL_NO_ERROR)\n");
+
+   return status;
+}
diff --git a/mesalib/src/mesa/main/glapidispatch.h b/mesalib/src/mesa/main/glapidispatch.h
index c1cc6cb12..93cc0122d 100644
--- a/mesalib/src/mesa/main/glapidispatch.h
+++ b/mesalib/src/mesa/main/glapidispatch.h
@@ -59,7 +59,7 @@
     } while(0)
 
 /* total number of offsets below */
-#define _gloffset_COUNT 908
+#define _gloffset_COUNT 928
 
 #define _gloffset_NewList 0
 #define _gloffset_EndList 1
@@ -690,292 +690,312 @@
 #define _gloffset_GetShaderPrecisionFormat 623
 #define _gloffset_ReleaseShaderCompiler 624
 #define _gloffset_ShaderBinary 625
-#define _gloffset_PolygonOffsetEXT 626
-#define _gloffset_GetPixelTexGenParameterfvSGIS 627
-#define _gloffset_GetPixelTexGenParameterivSGIS 628
-#define _gloffset_PixelTexGenParameterfSGIS 629
-#define _gloffset_PixelTexGenParameterfvSGIS 630
-#define _gloffset_PixelTexGenParameteriSGIS 631
-#define _gloffset_PixelTexGenParameterivSGIS 632
-#define _gloffset_SampleMaskSGIS 633
-#define _gloffset_SamplePatternSGIS 634
-#define _gloffset_ColorPointerEXT 635
-#define _gloffset_EdgeFlagPointerEXT 636
-#define _gloffset_IndexPointerEXT 637
-#define _gloffset_NormalPointerEXT 638
-#define _gloffset_TexCoordPointerEXT 639
-#define _gloffset_VertexPointerEXT 640
-#define _gloffset_PointParameterfEXT 641
-#define _gloffset_PointParameterfvEXT 642
-#define _gloffset_LockArraysEXT 643
-#define _gloffset_UnlockArraysEXT 644
-#define _gloffset_SecondaryColor3bEXT 645
-#define _gloffset_SecondaryColor3bvEXT 646
-#define _gloffset_SecondaryColor3dEXT 647
-#define _gloffset_SecondaryColor3dvEXT 648
-#define _gloffset_SecondaryColor3fEXT 649
-#define _gloffset_SecondaryColor3fvEXT 650
-#define _gloffset_SecondaryColor3iEXT 651
-#define _gloffset_SecondaryColor3ivEXT 652
-#define _gloffset_SecondaryColor3sEXT 653
-#define _gloffset_SecondaryColor3svEXT 654
-#define _gloffset_SecondaryColor3ubEXT 655
-#define _gloffset_SecondaryColor3ubvEXT 656
-#define _gloffset_SecondaryColor3uiEXT 657
-#define _gloffset_SecondaryColor3uivEXT 658
-#define _gloffset_SecondaryColor3usEXT 659
-#define _gloffset_SecondaryColor3usvEXT 660
-#define _gloffset_SecondaryColorPointerEXT 661
-#define _gloffset_MultiDrawArraysEXT 662
-#define _gloffset_MultiDrawElementsEXT 663
-#define _gloffset_FogCoordPointerEXT 664
-#define _gloffset_FogCoorddEXT 665
-#define _gloffset_FogCoorddvEXT 666
-#define _gloffset_FogCoordfEXT 667
-#define _gloffset_FogCoordfvEXT 668
-#define _gloffset_PixelTexGenSGIX 669
-#define _gloffset_BlendFuncSeparateEXT 670
-#define _gloffset_FlushVertexArrayRangeNV 671
-#define _gloffset_VertexArrayRangeNV 672
-#define _gloffset_CombinerInputNV 673
-#define _gloffset_CombinerOutputNV 674
-#define _gloffset_CombinerParameterfNV 675
-#define _gloffset_CombinerParameterfvNV 676
-#define _gloffset_CombinerParameteriNV 677
-#define _gloffset_CombinerParameterivNV 678
-#define _gloffset_FinalCombinerInputNV 679
-#define _gloffset_GetCombinerInputParameterfvNV 680
-#define _gloffset_GetCombinerInputParameterivNV 681
-#define _gloffset_GetCombinerOutputParameterfvNV 682
-#define _gloffset_GetCombinerOutputParameterivNV 683
-#define _gloffset_GetFinalCombinerInputParameterfvNV 684
-#define _gloffset_GetFinalCombinerInputParameterivNV 685
-#define _gloffset_ResizeBuffersMESA 686
-#define _gloffset_WindowPos2dMESA 687
-#define _gloffset_WindowPos2dvMESA 688
-#define _gloffset_WindowPos2fMESA 689
-#define _gloffset_WindowPos2fvMESA 690
-#define _gloffset_WindowPos2iMESA 691
-#define _gloffset_WindowPos2ivMESA 692
-#define _gloffset_WindowPos2sMESA 693
-#define _gloffset_WindowPos2svMESA 694
-#define _gloffset_WindowPos3dMESA 695
-#define _gloffset_WindowPos3dvMESA 696
-#define _gloffset_WindowPos3fMESA 697
-#define _gloffset_WindowPos3fvMESA 698
-#define _gloffset_WindowPos3iMESA 699
-#define _gloffset_WindowPos3ivMESA 700
-#define _gloffset_WindowPos3sMESA 701
-#define _gloffset_WindowPos3svMESA 702
-#define _gloffset_WindowPos4dMESA 703
-#define _gloffset_WindowPos4dvMESA 704
-#define _gloffset_WindowPos4fMESA 705
-#define _gloffset_WindowPos4fvMESA 706
-#define _gloffset_WindowPos4iMESA 707
-#define _gloffset_WindowPos4ivMESA 708
-#define _gloffset_WindowPos4sMESA 709
-#define _gloffset_WindowPos4svMESA 710
-#define _gloffset_MultiModeDrawArraysIBM 711
-#define _gloffset_MultiModeDrawElementsIBM 712
-#define _gloffset_DeleteFencesNV 713
-#define _gloffset_FinishFenceNV 714
-#define _gloffset_GenFencesNV 715
-#define _gloffset_GetFenceivNV 716
-#define _gloffset_IsFenceNV 717
-#define _gloffset_SetFenceNV 718
-#define _gloffset_TestFenceNV 719
-#define _gloffset_AreProgramsResidentNV 720
-#define _gloffset_BindProgramNV 721
-#define _gloffset_DeleteProgramsNV 722
-#define _gloffset_ExecuteProgramNV 723
-#define _gloffset_GenProgramsNV 724
-#define _gloffset_GetProgramParameterdvNV 725
-#define _gloffset_GetProgramParameterfvNV 726
-#define _gloffset_GetProgramStringNV 727
-#define _gloffset_GetProgramivNV 728
-#define _gloffset_GetTrackMatrixivNV 729
-#define _gloffset_GetVertexAttribPointervNV 730
-#define _gloffset_GetVertexAttribdvNV 731
-#define _gloffset_GetVertexAttribfvNV 732
-#define _gloffset_GetVertexAttribivNV 733
-#define _gloffset_IsProgramNV 734
-#define _gloffset_LoadProgramNV 735
-#define _gloffset_ProgramParameters4dvNV 736
-#define _gloffset_ProgramParameters4fvNV 737
-#define _gloffset_RequestResidentProgramsNV 738
-#define _gloffset_TrackMatrixNV 739
-#define _gloffset_VertexAttrib1dNV 740
-#define _gloffset_VertexAttrib1dvNV 741
-#define _gloffset_VertexAttrib1fNV 742
-#define _gloffset_VertexAttrib1fvNV 743
-#define _gloffset_VertexAttrib1sNV 744
-#define _gloffset_VertexAttrib1svNV 745
-#define _gloffset_VertexAttrib2dNV 746
-#define _gloffset_VertexAttrib2dvNV 747
-#define _gloffset_VertexAttrib2fNV 748
-#define _gloffset_VertexAttrib2fvNV 749
-#define _gloffset_VertexAttrib2sNV 750
-#define _gloffset_VertexAttrib2svNV 751
-#define _gloffset_VertexAttrib3dNV 752
-#define _gloffset_VertexAttrib3dvNV 753
-#define _gloffset_VertexAttrib3fNV 754
-#define _gloffset_VertexAttrib3fvNV 755
-#define _gloffset_VertexAttrib3sNV 756
-#define _gloffset_VertexAttrib3svNV 757
-#define _gloffset_VertexAttrib4dNV 758
-#define _gloffset_VertexAttrib4dvNV 759
-#define _gloffset_VertexAttrib4fNV 760
-#define _gloffset_VertexAttrib4fvNV 761
-#define _gloffset_VertexAttrib4sNV 762
-#define _gloffset_VertexAttrib4svNV 763
-#define _gloffset_VertexAttrib4ubNV 764
-#define _gloffset_VertexAttrib4ubvNV 765
-#define _gloffset_VertexAttribPointerNV 766
-#define _gloffset_VertexAttribs1dvNV 767
-#define _gloffset_VertexAttribs1fvNV 768
-#define _gloffset_VertexAttribs1svNV 769
-#define _gloffset_VertexAttribs2dvNV 770
-#define _gloffset_VertexAttribs2fvNV 771
-#define _gloffset_VertexAttribs2svNV 772
-#define _gloffset_VertexAttribs3dvNV 773
-#define _gloffset_VertexAttribs3fvNV 774
-#define _gloffset_VertexAttribs3svNV 775
-#define _gloffset_VertexAttribs4dvNV 776
-#define _gloffset_VertexAttribs4fvNV 777
-#define _gloffset_VertexAttribs4svNV 778
-#define _gloffset_VertexAttribs4ubvNV 779
-#define _gloffset_GetTexBumpParameterfvATI 780
-#define _gloffset_GetTexBumpParameterivATI 781
-#define _gloffset_TexBumpParameterfvATI 782
-#define _gloffset_TexBumpParameterivATI 783
-#define _gloffset_AlphaFragmentOp1ATI 784
-#define _gloffset_AlphaFragmentOp2ATI 785
-#define _gloffset_AlphaFragmentOp3ATI 786
-#define _gloffset_BeginFragmentShaderATI 787
-#define _gloffset_BindFragmentShaderATI 788
-#define _gloffset_ColorFragmentOp1ATI 789
-#define _gloffset_ColorFragmentOp2ATI 790
-#define _gloffset_ColorFragmentOp3ATI 791
-#define _gloffset_DeleteFragmentShaderATI 792
-#define _gloffset_EndFragmentShaderATI 793
-#define _gloffset_GenFragmentShadersATI 794
-#define _gloffset_PassTexCoordATI 795
-#define _gloffset_SampleMapATI 796
-#define _gloffset_SetFragmentShaderConstantATI 797
-#define _gloffset_PointParameteriNV 798
-#define _gloffset_PointParameterivNV 799
-#define _gloffset_ActiveStencilFaceEXT 800
-#define _gloffset_BindVertexArrayAPPLE 801
-#define _gloffset_DeleteVertexArraysAPPLE 802
-#define _gloffset_GenVertexArraysAPPLE 803
-#define _gloffset_IsVertexArrayAPPLE 804
-#define _gloffset_GetProgramNamedParameterdvNV 805
-#define _gloffset_GetProgramNamedParameterfvNV 806
-#define _gloffset_ProgramNamedParameter4dNV 807
-#define _gloffset_ProgramNamedParameter4dvNV 808
-#define _gloffset_ProgramNamedParameter4fNV 809
-#define _gloffset_ProgramNamedParameter4fvNV 810
-#define _gloffset_PrimitiveRestartIndexNV 811
-#define _gloffset_PrimitiveRestartNV 812
-#define _gloffset_DepthBoundsEXT 813
-#define _gloffset_BlendEquationSeparateEXT 814
-#define _gloffset_BindFramebufferEXT 815
-#define _gloffset_BindRenderbufferEXT 816
-#define _gloffset_CheckFramebufferStatusEXT 817
-#define _gloffset_DeleteFramebuffersEXT 818
-#define _gloffset_DeleteRenderbuffersEXT 819
-#define _gloffset_FramebufferRenderbufferEXT 820
-#define _gloffset_FramebufferTexture1DEXT 821
-#define _gloffset_FramebufferTexture2DEXT 822
-#define _gloffset_FramebufferTexture3DEXT 823
-#define _gloffset_GenFramebuffersEXT 824
-#define _gloffset_GenRenderbuffersEXT 825
-#define _gloffset_GenerateMipmapEXT 826
-#define _gloffset_GetFramebufferAttachmentParameterivEXT 827
-#define _gloffset_GetRenderbufferParameterivEXT 828
-#define _gloffset_IsFramebufferEXT 829
-#define _gloffset_IsRenderbufferEXT 830
-#define _gloffset_RenderbufferStorageEXT 831
-#define _gloffset_BlitFramebufferEXT 832
-#define _gloffset_BufferParameteriAPPLE 833
-#define _gloffset_FlushMappedBufferRangeAPPLE 834
-#define _gloffset_BindFragDataLocationEXT 835
-#define _gloffset_GetFragDataLocationEXT 836
-#define _gloffset_GetUniformuivEXT 837
-#define _gloffset_GetVertexAttribIivEXT 838
-#define _gloffset_GetVertexAttribIuivEXT 839
-#define _gloffset_Uniform1uiEXT 840
-#define _gloffset_Uniform1uivEXT 841
-#define _gloffset_Uniform2uiEXT 842
-#define _gloffset_Uniform2uivEXT 843
-#define _gloffset_Uniform3uiEXT 844
-#define _gloffset_Uniform3uivEXT 845
-#define _gloffset_Uniform4uiEXT 846
-#define _gloffset_Uniform4uivEXT 847
-#define _gloffset_VertexAttribI1iEXT 848
-#define _gloffset_VertexAttribI1ivEXT 849
-#define _gloffset_VertexAttribI1uiEXT 850
-#define _gloffset_VertexAttribI1uivEXT 851
-#define _gloffset_VertexAttribI2iEXT 852
-#define _gloffset_VertexAttribI2ivEXT 853
-#define _gloffset_VertexAttribI2uiEXT 854
-#define _gloffset_VertexAttribI2uivEXT 855
-#define _gloffset_VertexAttribI3iEXT 856
-#define _gloffset_VertexAttribI3ivEXT 857
-#define _gloffset_VertexAttribI3uiEXT 858
-#define _gloffset_VertexAttribI3uivEXT 859
-#define _gloffset_VertexAttribI4bvEXT 860
-#define _gloffset_VertexAttribI4iEXT 861
-#define _gloffset_VertexAttribI4ivEXT 862
-#define _gloffset_VertexAttribI4svEXT 863
-#define _gloffset_VertexAttribI4ubvEXT 864
-#define _gloffset_VertexAttribI4uiEXT 865
-#define _gloffset_VertexAttribI4uivEXT 866
-#define _gloffset_VertexAttribI4usvEXT 867
-#define _gloffset_VertexAttribIPointerEXT 868
-#define _gloffset_FramebufferTextureLayerEXT 869
-#define _gloffset_ColorMaskIndexedEXT 870
-#define _gloffset_DisableIndexedEXT 871
-#define _gloffset_EnableIndexedEXT 872
-#define _gloffset_GetBooleanIndexedvEXT 873
-#define _gloffset_GetIntegerIndexedvEXT 874
-#define _gloffset_IsEnabledIndexedEXT 875
-#define _gloffset_ClearColorIiEXT 876
-#define _gloffset_ClearColorIuiEXT 877
-#define _gloffset_GetTexParameterIivEXT 878
-#define _gloffset_GetTexParameterIuivEXT 879
-#define _gloffset_TexParameterIivEXT 880
-#define _gloffset_TexParameterIuivEXT 881
-#define _gloffset_BeginConditionalRenderNV 882
-#define _gloffset_EndConditionalRenderNV 883
-#define _gloffset_BeginTransformFeedbackEXT 884
-#define _gloffset_BindBufferBaseEXT 885
-#define _gloffset_BindBufferOffsetEXT 886
-#define _gloffset_BindBufferRangeEXT 887
-#define _gloffset_EndTransformFeedbackEXT 888
-#define _gloffset_GetTransformFeedbackVaryingEXT 889
-#define _gloffset_TransformFeedbackVaryingsEXT 890
-#define _gloffset_ProvokingVertexEXT 891
-#define _gloffset_GetTexParameterPointervAPPLE 892
-#define _gloffset_TextureRangeAPPLE 893
-#define _gloffset_GetObjectParameterivAPPLE 894
-#define _gloffset_ObjectPurgeableAPPLE 895
-#define _gloffset_ObjectUnpurgeableAPPLE 896
-#define _gloffset_ActiveProgramEXT 897
-#define _gloffset_CreateShaderProgramEXT 898
-#define _gloffset_UseShaderProgramEXT 899
-#define _gloffset_TextureBarrierNV 900
-#define _gloffset_StencilFuncSeparateATI 901
-#define _gloffset_ProgramEnvParameters4fvEXT 902
-#define _gloffset_ProgramLocalParameters4fvEXT 903
-#define _gloffset_GetQueryObjecti64vEXT 904
-#define _gloffset_GetQueryObjectui64vEXT 905
-#define _gloffset_EGLImageTargetRenderbufferStorageOES 906
-#define _gloffset_EGLImageTargetTexture2DOES 907
+#define _gloffset_GetGraphicsResetStatusARB 626
+#define _gloffset_GetnColorTableARB 627
+#define _gloffset_GetnCompressedTexImageARB 628
+#define _gloffset_GetnConvolutionFilterARB 629
+#define _gloffset_GetnHistogramARB 630
+#define _gloffset_GetnMapdvARB 631
+#define _gloffset_GetnMapfvARB 632
+#define _gloffset_GetnMapivARB 633
+#define _gloffset_GetnMinmaxARB 634
+#define _gloffset_GetnPixelMapfvARB 635
+#define _gloffset_GetnPixelMapuivARB 636
+#define _gloffset_GetnPixelMapusvARB 637
+#define _gloffset_GetnPolygonStippleARB 638
+#define _gloffset_GetnSeparableFilterARB 639
+#define _gloffset_GetnTexImageARB 640
+#define _gloffset_GetnUniformdvARB 641
+#define _gloffset_GetnUniformfvARB 642
+#define _gloffset_GetnUniformivARB 643
+#define _gloffset_GetnUniformuivARB 644
+#define _gloffset_ReadnPixelsARB 645
+#define _gloffset_PolygonOffsetEXT 646
+#define _gloffset_GetPixelTexGenParameterfvSGIS 647
+#define _gloffset_GetPixelTexGenParameterivSGIS 648
+#define _gloffset_PixelTexGenParameterfSGIS 649
+#define _gloffset_PixelTexGenParameterfvSGIS 650
+#define _gloffset_PixelTexGenParameteriSGIS 651
+#define _gloffset_PixelTexGenParameterivSGIS 652
+#define _gloffset_SampleMaskSGIS 653
+#define _gloffset_SamplePatternSGIS 654
+#define _gloffset_ColorPointerEXT 655
+#define _gloffset_EdgeFlagPointerEXT 656
+#define _gloffset_IndexPointerEXT 657
+#define _gloffset_NormalPointerEXT 658
+#define _gloffset_TexCoordPointerEXT 659
+#define _gloffset_VertexPointerEXT 660
+#define _gloffset_PointParameterfEXT 661
+#define _gloffset_PointParameterfvEXT 662
+#define _gloffset_LockArraysEXT 663
+#define _gloffset_UnlockArraysEXT 664
+#define _gloffset_SecondaryColor3bEXT 665
+#define _gloffset_SecondaryColor3bvEXT 666
+#define _gloffset_SecondaryColor3dEXT 667
+#define _gloffset_SecondaryColor3dvEXT 668
+#define _gloffset_SecondaryColor3fEXT 669
+#define _gloffset_SecondaryColor3fvEXT 670
+#define _gloffset_SecondaryColor3iEXT 671
+#define _gloffset_SecondaryColor3ivEXT 672
+#define _gloffset_SecondaryColor3sEXT 673
+#define _gloffset_SecondaryColor3svEXT 674
+#define _gloffset_SecondaryColor3ubEXT 675
+#define _gloffset_SecondaryColor3ubvEXT 676
+#define _gloffset_SecondaryColor3uiEXT 677
+#define _gloffset_SecondaryColor3uivEXT 678
+#define _gloffset_SecondaryColor3usEXT 679
+#define _gloffset_SecondaryColor3usvEXT 680
+#define _gloffset_SecondaryColorPointerEXT 681
+#define _gloffset_MultiDrawArraysEXT 682
+#define _gloffset_MultiDrawElementsEXT 683
+#define _gloffset_FogCoordPointerEXT 684
+#define _gloffset_FogCoorddEXT 685
+#define _gloffset_FogCoorddvEXT 686
+#define _gloffset_FogCoordfEXT 687
+#define _gloffset_FogCoordfvEXT 688
+#define _gloffset_PixelTexGenSGIX 689
+#define _gloffset_BlendFuncSeparateEXT 690
+#define _gloffset_FlushVertexArrayRangeNV 691
+#define _gloffset_VertexArrayRangeNV 692
+#define _gloffset_CombinerInputNV 693
+#define _gloffset_CombinerOutputNV 694
+#define _gloffset_CombinerParameterfNV 695
+#define _gloffset_CombinerParameterfvNV 696
+#define _gloffset_CombinerParameteriNV 697
+#define _gloffset_CombinerParameterivNV 698
+#define _gloffset_FinalCombinerInputNV 699
+#define _gloffset_GetCombinerInputParameterfvNV 700
+#define _gloffset_GetCombinerInputParameterivNV 701
+#define _gloffset_GetCombinerOutputParameterfvNV 702
+#define _gloffset_GetCombinerOutputParameterivNV 703
+#define _gloffset_GetFinalCombinerInputParameterfvNV 704
+#define _gloffset_GetFinalCombinerInputParameterivNV 705
+#define _gloffset_ResizeBuffersMESA 706
+#define _gloffset_WindowPos2dMESA 707
+#define _gloffset_WindowPos2dvMESA 708
+#define _gloffset_WindowPos2fMESA 709
+#define _gloffset_WindowPos2fvMESA 710
+#define _gloffset_WindowPos2iMESA 711
+#define _gloffset_WindowPos2ivMESA 712
+#define _gloffset_WindowPos2sMESA 713
+#define _gloffset_WindowPos2svMESA 714
+#define _gloffset_WindowPos3dMESA 715
+#define _gloffset_WindowPos3dvMESA 716
+#define _gloffset_WindowPos3fMESA 717
+#define _gloffset_WindowPos3fvMESA 718
+#define _gloffset_WindowPos3iMESA 719
+#define _gloffset_WindowPos3ivMESA 720
+#define _gloffset_WindowPos3sMESA 721
+#define _gloffset_WindowPos3svMESA 722
+#define _gloffset_WindowPos4dMESA 723
+#define _gloffset_WindowPos4dvMESA 724
+#define _gloffset_WindowPos4fMESA 725
+#define _gloffset_WindowPos4fvMESA 726
+#define _gloffset_WindowPos4iMESA 727
+#define _gloffset_WindowPos4ivMESA 728
+#define _gloffset_WindowPos4sMESA 729
+#define _gloffset_WindowPos4svMESA 730
+#define _gloffset_MultiModeDrawArraysIBM 731
+#define _gloffset_MultiModeDrawElementsIBM 732
+#define _gloffset_DeleteFencesNV 733
+#define _gloffset_FinishFenceNV 734
+#define _gloffset_GenFencesNV 735
+#define _gloffset_GetFenceivNV 736
+#define _gloffset_IsFenceNV 737
+#define _gloffset_SetFenceNV 738
+#define _gloffset_TestFenceNV 739
+#define _gloffset_AreProgramsResidentNV 740
+#define _gloffset_BindProgramNV 741
+#define _gloffset_DeleteProgramsNV 742
+#define _gloffset_ExecuteProgramNV 743
+#define _gloffset_GenProgramsNV 744
+#define _gloffset_GetProgramParameterdvNV 745
+#define _gloffset_GetProgramParameterfvNV 746
+#define _gloffset_GetProgramStringNV 747
+#define _gloffset_GetProgramivNV 748
+#define _gloffset_GetTrackMatrixivNV 749
+#define _gloffset_GetVertexAttribPointervNV 750
+#define _gloffset_GetVertexAttribdvNV 751
+#define _gloffset_GetVertexAttribfvNV 752
+#define _gloffset_GetVertexAttribivNV 753
+#define _gloffset_IsProgramNV 754
+#define _gloffset_LoadProgramNV 755
+#define _gloffset_ProgramParameters4dvNV 756
+#define _gloffset_ProgramParameters4fvNV 757
+#define _gloffset_RequestResidentProgramsNV 758
+#define _gloffset_TrackMatrixNV 759
+#define _gloffset_VertexAttrib1dNV 760
+#define _gloffset_VertexAttrib1dvNV 761
+#define _gloffset_VertexAttrib1fNV 762
+#define _gloffset_VertexAttrib1fvNV 763
+#define _gloffset_VertexAttrib1sNV 764
+#define _gloffset_VertexAttrib1svNV 765
+#define _gloffset_VertexAttrib2dNV 766
+#define _gloffset_VertexAttrib2dvNV 767
+#define _gloffset_VertexAttrib2fNV 768
+#define _gloffset_VertexAttrib2fvNV 769
+#define _gloffset_VertexAttrib2sNV 770
+#define _gloffset_VertexAttrib2svNV 771
+#define _gloffset_VertexAttrib3dNV 772
+#define _gloffset_VertexAttrib3dvNV 773
+#define _gloffset_VertexAttrib3fNV 774
+#define _gloffset_VertexAttrib3fvNV 775
+#define _gloffset_VertexAttrib3sNV 776
+#define _gloffset_VertexAttrib3svNV 777
+#define _gloffset_VertexAttrib4dNV 778
+#define _gloffset_VertexAttrib4dvNV 779
+#define _gloffset_VertexAttrib4fNV 780
+#define _gloffset_VertexAttrib4fvNV 781
+#define _gloffset_VertexAttrib4sNV 782
+#define _gloffset_VertexAttrib4svNV 783
+#define _gloffset_VertexAttrib4ubNV 784
+#define _gloffset_VertexAttrib4ubvNV 785
+#define _gloffset_VertexAttribPointerNV 786
+#define _gloffset_VertexAttribs1dvNV 787
+#define _gloffset_VertexAttribs1fvNV 788
+#define _gloffset_VertexAttribs1svNV 789
+#define _gloffset_VertexAttribs2dvNV 790
+#define _gloffset_VertexAttribs2fvNV 791
+#define _gloffset_VertexAttribs2svNV 792
+#define _gloffset_VertexAttribs3dvNV 793
+#define _gloffset_VertexAttribs3fvNV 794
+#define _gloffset_VertexAttribs3svNV 795
+#define _gloffset_VertexAttribs4dvNV 796
+#define _gloffset_VertexAttribs4fvNV 797
+#define _gloffset_VertexAttribs4svNV 798
+#define _gloffset_VertexAttribs4ubvNV 799
+#define _gloffset_GetTexBumpParameterfvATI 800
+#define _gloffset_GetTexBumpParameterivATI 801
+#define _gloffset_TexBumpParameterfvATI 802
+#define _gloffset_TexBumpParameterivATI 803
+#define _gloffset_AlphaFragmentOp1ATI 804
+#define _gloffset_AlphaFragmentOp2ATI 805
+#define _gloffset_AlphaFragmentOp3ATI 806
+#define _gloffset_BeginFragmentShaderATI 807
+#define _gloffset_BindFragmentShaderATI 808
+#define _gloffset_ColorFragmentOp1ATI 809
+#define _gloffset_ColorFragmentOp2ATI 810
+#define _gloffset_ColorFragmentOp3ATI 811
+#define _gloffset_DeleteFragmentShaderATI 812
+#define _gloffset_EndFragmentShaderATI 813
+#define _gloffset_GenFragmentShadersATI 814
+#define _gloffset_PassTexCoordATI 815
+#define _gloffset_SampleMapATI 816
+#define _gloffset_SetFragmentShaderConstantATI 817
+#define _gloffset_PointParameteriNV 818
+#define _gloffset_PointParameterivNV 819
+#define _gloffset_ActiveStencilFaceEXT 820
+#define _gloffset_BindVertexArrayAPPLE 821
+#define _gloffset_DeleteVertexArraysAPPLE 822
+#define _gloffset_GenVertexArraysAPPLE 823
+#define _gloffset_IsVertexArrayAPPLE 824
+#define _gloffset_GetProgramNamedParameterdvNV 825
+#define _gloffset_GetProgramNamedParameterfvNV 826
+#define _gloffset_ProgramNamedParameter4dNV 827
+#define _gloffset_ProgramNamedParameter4dvNV 828
+#define _gloffset_ProgramNamedParameter4fNV 829
+#define _gloffset_ProgramNamedParameter4fvNV 830
+#define _gloffset_PrimitiveRestartIndexNV 831
+#define _gloffset_PrimitiveRestartNV 832
+#define _gloffset_DepthBoundsEXT 833
+#define _gloffset_BlendEquationSeparateEXT 834
+#define _gloffset_BindFramebufferEXT 835
+#define _gloffset_BindRenderbufferEXT 836
+#define _gloffset_CheckFramebufferStatusEXT 837
+#define _gloffset_DeleteFramebuffersEXT 838
+#define _gloffset_DeleteRenderbuffersEXT 839
+#define _gloffset_FramebufferRenderbufferEXT 840
+#define _gloffset_FramebufferTexture1DEXT 841
+#define _gloffset_FramebufferTexture2DEXT 842
+#define _gloffset_FramebufferTexture3DEXT 843
+#define _gloffset_GenFramebuffersEXT 844
+#define _gloffset_GenRenderbuffersEXT 845
+#define _gloffset_GenerateMipmapEXT 846
+#define _gloffset_GetFramebufferAttachmentParameterivEXT 847
+#define _gloffset_GetRenderbufferParameterivEXT 848
+#define _gloffset_IsFramebufferEXT 849
+#define _gloffset_IsRenderbufferEXT 850
+#define _gloffset_RenderbufferStorageEXT 851
+#define _gloffset_BlitFramebufferEXT 852
+#define _gloffset_BufferParameteriAPPLE 853
+#define _gloffset_FlushMappedBufferRangeAPPLE 854
+#define _gloffset_BindFragDataLocationEXT 855
+#define _gloffset_GetFragDataLocationEXT 856
+#define _gloffset_GetUniformuivEXT 857
+#define _gloffset_GetVertexAttribIivEXT 858
+#define _gloffset_GetVertexAttribIuivEXT 859
+#define _gloffset_Uniform1uiEXT 860
+#define _gloffset_Uniform1uivEXT 861
+#define _gloffset_Uniform2uiEXT 862
+#define _gloffset_Uniform2uivEXT 863
+#define _gloffset_Uniform3uiEXT 864
+#define _gloffset_Uniform3uivEXT 865
+#define _gloffset_Uniform4uiEXT 866
+#define _gloffset_Uniform4uivEXT 867
+#define _gloffset_VertexAttribI1iEXT 868
+#define _gloffset_VertexAttribI1ivEXT 869
+#define _gloffset_VertexAttribI1uiEXT 870
+#define _gloffset_VertexAttribI1uivEXT 871
+#define _gloffset_VertexAttribI2iEXT 872
+#define _gloffset_VertexAttribI2ivEXT 873
+#define _gloffset_VertexAttribI2uiEXT 874
+#define _gloffset_VertexAttribI2uivEXT 875
+#define _gloffset_VertexAttribI3iEXT 876
+#define _gloffset_VertexAttribI3ivEXT 877
+#define _gloffset_VertexAttribI3uiEXT 878
+#define _gloffset_VertexAttribI3uivEXT 879
+#define _gloffset_VertexAttribI4bvEXT 880
+#define _gloffset_VertexAttribI4iEXT 881
+#define _gloffset_VertexAttribI4ivEXT 882
+#define _gloffset_VertexAttribI4svEXT 883
+#define _gloffset_VertexAttribI4ubvEXT 884
+#define _gloffset_VertexAttribI4uiEXT 885
+#define _gloffset_VertexAttribI4uivEXT 886
+#define _gloffset_VertexAttribI4usvEXT 887
+#define _gloffset_VertexAttribIPointerEXT 888
+#define _gloffset_FramebufferTextureLayerEXT 889
+#define _gloffset_ColorMaskIndexedEXT 890
+#define _gloffset_DisableIndexedEXT 891
+#define _gloffset_EnableIndexedEXT 892
+#define _gloffset_GetBooleanIndexedvEXT 893
+#define _gloffset_GetIntegerIndexedvEXT 894
+#define _gloffset_IsEnabledIndexedEXT 895
+#define _gloffset_ClearColorIiEXT 896
+#define _gloffset_ClearColorIuiEXT 897
+#define _gloffset_GetTexParameterIivEXT 898
+#define _gloffset_GetTexParameterIuivEXT 899
+#define _gloffset_TexParameterIivEXT 900
+#define _gloffset_TexParameterIuivEXT 901
+#define _gloffset_BeginConditionalRenderNV 902
+#define _gloffset_EndConditionalRenderNV 903
+#define _gloffset_BeginTransformFeedbackEXT 904
+#define _gloffset_BindBufferBaseEXT 905
+#define _gloffset_BindBufferOffsetEXT 906
+#define _gloffset_BindBufferRangeEXT 907
+#define _gloffset_EndTransformFeedbackEXT 908
+#define _gloffset_GetTransformFeedbackVaryingEXT 909
+#define _gloffset_TransformFeedbackVaryingsEXT 910
+#define _gloffset_ProvokingVertexEXT 911
+#define _gloffset_GetTexParameterPointervAPPLE 912
+#define _gloffset_TextureRangeAPPLE 913
+#define _gloffset_GetObjectParameterivAPPLE 914
+#define _gloffset_ObjectPurgeableAPPLE 915
+#define _gloffset_ObjectUnpurgeableAPPLE 916
+#define _gloffset_ActiveProgramEXT 917
+#define _gloffset_CreateShaderProgramEXT 918
+#define _gloffset_UseShaderProgramEXT 919
+#define _gloffset_TextureBarrierNV 920
+#define _gloffset_StencilFuncSeparateATI 921
+#define _gloffset_ProgramEnvParameters4fvEXT 922
+#define _gloffset_ProgramLocalParameters4fvEXT 923
+#define _gloffset_GetQueryObjecti64vEXT 924
+#define _gloffset_GetQueryObjectui64vEXT 925
+#define _gloffset_EGLImageTargetRenderbufferStorageOES 926
+#define _gloffset_EGLImageTargetTexture2DOES 927
 
 #else /* !_GLAPI_USE_REMAP_TABLE */
 
-#define driDispatchRemapTable_size 500
+#define driDispatchRemapTable_size 520
 extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 
 #define AttachShader_remap_index 0
@@ -1196,288 +1216,308 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define GetShaderPrecisionFormat_remap_index 215
 #define ReleaseShaderCompiler_remap_index 216
 #define ShaderBinary_remap_index 217
-#define PolygonOffsetEXT_remap_index 218
-#define GetPixelTexGenParameterfvSGIS_remap_index 219
-#define GetPixelTexGenParameterivSGIS_remap_index 220
-#define PixelTexGenParameterfSGIS_remap_index 221
-#define PixelTexGenParameterfvSGIS_remap_index 222
-#define PixelTexGenParameteriSGIS_remap_index 223
-#define PixelTexGenParameterivSGIS_remap_index 224
-#define SampleMaskSGIS_remap_index 225
-#define SamplePatternSGIS_remap_index 226
-#define ColorPointerEXT_remap_index 227
-#define EdgeFlagPointerEXT_remap_index 228
-#define IndexPointerEXT_remap_index 229
-#define NormalPointerEXT_remap_index 230
-#define TexCoordPointerEXT_remap_index 231
-#define VertexPointerEXT_remap_index 232
-#define PointParameterfEXT_remap_index 233
-#define PointParameterfvEXT_remap_index 234
-#define LockArraysEXT_remap_index 235
-#define UnlockArraysEXT_remap_index 236
-#define SecondaryColor3bEXT_remap_index 237
-#define SecondaryColor3bvEXT_remap_index 238
-#define SecondaryColor3dEXT_remap_index 239
-#define SecondaryColor3dvEXT_remap_index 240
-#define SecondaryColor3fEXT_remap_index 241
-#define SecondaryColor3fvEXT_remap_index 242
-#define SecondaryColor3iEXT_remap_index 243
-#define SecondaryColor3ivEXT_remap_index 244
-#define SecondaryColor3sEXT_remap_index 245
-#define SecondaryColor3svEXT_remap_index 246
-#define SecondaryColor3ubEXT_remap_index 247
-#define SecondaryColor3ubvEXT_remap_index 248
-#define SecondaryColor3uiEXT_remap_index 249
-#define SecondaryColor3uivEXT_remap_index 250
-#define SecondaryColor3usEXT_remap_index 251
-#define SecondaryColor3usvEXT_remap_index 252
-#define SecondaryColorPointerEXT_remap_index 253
-#define MultiDrawArraysEXT_remap_index 254
-#define MultiDrawElementsEXT_remap_index 255
-#define FogCoordPointerEXT_remap_index 256
-#define FogCoorddEXT_remap_index 257
-#define FogCoorddvEXT_remap_index 258
-#define FogCoordfEXT_remap_index 259
-#define FogCoordfvEXT_remap_index 260
-#define PixelTexGenSGIX_remap_index 261
-#define BlendFuncSeparateEXT_remap_index 262
-#define FlushVertexArrayRangeNV_remap_index 263
-#define VertexArrayRangeNV_remap_index 264
-#define CombinerInputNV_remap_index 265
-#define CombinerOutputNV_remap_index 266
-#define CombinerParameterfNV_remap_index 267
-#define CombinerParameterfvNV_remap_index 268
-#define CombinerParameteriNV_remap_index 269
-#define CombinerParameterivNV_remap_index 270
-#define FinalCombinerInputNV_remap_index 271
-#define GetCombinerInputParameterfvNV_remap_index 272
-#define GetCombinerInputParameterivNV_remap_index 273
-#define GetCombinerOutputParameterfvNV_remap_index 274
-#define GetCombinerOutputParameterivNV_remap_index 275
-#define GetFinalCombinerInputParameterfvNV_remap_index 276
-#define GetFinalCombinerInputParameterivNV_remap_index 277
-#define ResizeBuffersMESA_remap_index 278
-#define WindowPos2dMESA_remap_index 279
-#define WindowPos2dvMESA_remap_index 280
-#define WindowPos2fMESA_remap_index 281
-#define WindowPos2fvMESA_remap_index 282
-#define WindowPos2iMESA_remap_index 283
-#define WindowPos2ivMESA_remap_index 284
-#define WindowPos2sMESA_remap_index 285
-#define WindowPos2svMESA_remap_index 286
-#define WindowPos3dMESA_remap_index 287
-#define WindowPos3dvMESA_remap_index 288
-#define WindowPos3fMESA_remap_index 289
-#define WindowPos3fvMESA_remap_index 290
-#define WindowPos3iMESA_remap_index 291
-#define WindowPos3ivMESA_remap_index 292
-#define WindowPos3sMESA_remap_index 293
-#define WindowPos3svMESA_remap_index 294
-#define WindowPos4dMESA_remap_index 295
-#define WindowPos4dvMESA_remap_index 296
-#define WindowPos4fMESA_remap_index 297
-#define WindowPos4fvMESA_remap_index 298
-#define WindowPos4iMESA_remap_index 299
-#define WindowPos4ivMESA_remap_index 300
-#define WindowPos4sMESA_remap_index 301
-#define WindowPos4svMESA_remap_index 302
-#define MultiModeDrawArraysIBM_remap_index 303
-#define MultiModeDrawElementsIBM_remap_index 304
-#define DeleteFencesNV_remap_index 305
-#define FinishFenceNV_remap_index 306
-#define GenFencesNV_remap_index 307
-#define GetFenceivNV_remap_index 308
-#define IsFenceNV_remap_index 309
-#define SetFenceNV_remap_index 310
-#define TestFenceNV_remap_index 311
-#define AreProgramsResidentNV_remap_index 312
-#define BindProgramNV_remap_index 313
-#define DeleteProgramsNV_remap_index 314
-#define ExecuteProgramNV_remap_index 315
-#define GenProgramsNV_remap_index 316
-#define GetProgramParameterdvNV_remap_index 317
-#define GetProgramParameterfvNV_remap_index 318
-#define GetProgramStringNV_remap_index 319
-#define GetProgramivNV_remap_index 320
-#define GetTrackMatrixivNV_remap_index 321
-#define GetVertexAttribPointervNV_remap_index 322
-#define GetVertexAttribdvNV_remap_index 323
-#define GetVertexAttribfvNV_remap_index 324
-#define GetVertexAttribivNV_remap_index 325
-#define IsProgramNV_remap_index 326
-#define LoadProgramNV_remap_index 327
-#define ProgramParameters4dvNV_remap_index 328
-#define ProgramParameters4fvNV_remap_index 329
-#define RequestResidentProgramsNV_remap_index 330
-#define TrackMatrixNV_remap_index 331
-#define VertexAttrib1dNV_remap_index 332
-#define VertexAttrib1dvNV_remap_index 333
-#define VertexAttrib1fNV_remap_index 334
-#define VertexAttrib1fvNV_remap_index 335
-#define VertexAttrib1sNV_remap_index 336
-#define VertexAttrib1svNV_remap_index 337
-#define VertexAttrib2dNV_remap_index 338
-#define VertexAttrib2dvNV_remap_index 339
-#define VertexAttrib2fNV_remap_index 340
-#define VertexAttrib2fvNV_remap_index 341
-#define VertexAttrib2sNV_remap_index 342
-#define VertexAttrib2svNV_remap_index 343
-#define VertexAttrib3dNV_remap_index 344
-#define VertexAttrib3dvNV_remap_index 345
-#define VertexAttrib3fNV_remap_index 346
-#define VertexAttrib3fvNV_remap_index 347
-#define VertexAttrib3sNV_remap_index 348
-#define VertexAttrib3svNV_remap_index 349
-#define VertexAttrib4dNV_remap_index 350
-#define VertexAttrib4dvNV_remap_index 351
-#define VertexAttrib4fNV_remap_index 352
-#define VertexAttrib4fvNV_remap_index 353
-#define VertexAttrib4sNV_remap_index 354
-#define VertexAttrib4svNV_remap_index 355
-#define VertexAttrib4ubNV_remap_index 356
-#define VertexAttrib4ubvNV_remap_index 357
-#define VertexAttribPointerNV_remap_index 358
-#define VertexAttribs1dvNV_remap_index 359
-#define VertexAttribs1fvNV_remap_index 360
-#define VertexAttribs1svNV_remap_index 361
-#define VertexAttribs2dvNV_remap_index 362
-#define VertexAttribs2fvNV_remap_index 363
-#define VertexAttribs2svNV_remap_index 364
-#define VertexAttribs3dvNV_remap_index 365
-#define VertexAttribs3fvNV_remap_index 366
-#define VertexAttribs3svNV_remap_index 367
-#define VertexAttribs4dvNV_remap_index 368
-#define VertexAttribs4fvNV_remap_index 369
-#define VertexAttribs4svNV_remap_index 370
-#define VertexAttribs4ubvNV_remap_index 371
-#define GetTexBumpParameterfvATI_remap_index 372
-#define GetTexBumpParameterivATI_remap_index 373
-#define TexBumpParameterfvATI_remap_index 374
-#define TexBumpParameterivATI_remap_index 375
-#define AlphaFragmentOp1ATI_remap_index 376
-#define AlphaFragmentOp2ATI_remap_index 377
-#define AlphaFragmentOp3ATI_remap_index 378
-#define BeginFragmentShaderATI_remap_index 379
-#define BindFragmentShaderATI_remap_index 380
-#define ColorFragmentOp1ATI_remap_index 381
-#define ColorFragmentOp2ATI_remap_index 382
-#define ColorFragmentOp3ATI_remap_index 383
-#define DeleteFragmentShaderATI_remap_index 384
-#define EndFragmentShaderATI_remap_index 385
-#define GenFragmentShadersATI_remap_index 386
-#define PassTexCoordATI_remap_index 387
-#define SampleMapATI_remap_index 388
-#define SetFragmentShaderConstantATI_remap_index 389
-#define PointParameteriNV_remap_index 390
-#define PointParameterivNV_remap_index 391
-#define ActiveStencilFaceEXT_remap_index 392
-#define BindVertexArrayAPPLE_remap_index 393
-#define DeleteVertexArraysAPPLE_remap_index 394
-#define GenVertexArraysAPPLE_remap_index 395
-#define IsVertexArrayAPPLE_remap_index 396
-#define GetProgramNamedParameterdvNV_remap_index 397
-#define GetProgramNamedParameterfvNV_remap_index 398
-#define ProgramNamedParameter4dNV_remap_index 399
-#define ProgramNamedParameter4dvNV_remap_index 400
-#define ProgramNamedParameter4fNV_remap_index 401
-#define ProgramNamedParameter4fvNV_remap_index 402
-#define PrimitiveRestartIndexNV_remap_index 403
-#define PrimitiveRestartNV_remap_index 404
-#define DepthBoundsEXT_remap_index 405
-#define BlendEquationSeparateEXT_remap_index 406
-#define BindFramebufferEXT_remap_index 407
-#define BindRenderbufferEXT_remap_index 408
-#define CheckFramebufferStatusEXT_remap_index 409
-#define DeleteFramebuffersEXT_remap_index 410
-#define DeleteRenderbuffersEXT_remap_index 411
-#define FramebufferRenderbufferEXT_remap_index 412
-#define FramebufferTexture1DEXT_remap_index 413
-#define FramebufferTexture2DEXT_remap_index 414
-#define FramebufferTexture3DEXT_remap_index 415
-#define GenFramebuffersEXT_remap_index 416
-#define GenRenderbuffersEXT_remap_index 417
-#define GenerateMipmapEXT_remap_index 418
-#define GetFramebufferAttachmentParameterivEXT_remap_index 419
-#define GetRenderbufferParameterivEXT_remap_index 420
-#define IsFramebufferEXT_remap_index 421
-#define IsRenderbufferEXT_remap_index 422
-#define RenderbufferStorageEXT_remap_index 423
-#define BlitFramebufferEXT_remap_index 424
-#define BufferParameteriAPPLE_remap_index 425
-#define FlushMappedBufferRangeAPPLE_remap_index 426
-#define BindFragDataLocationEXT_remap_index 427
-#define GetFragDataLocationEXT_remap_index 428
-#define GetUniformuivEXT_remap_index 429
-#define GetVertexAttribIivEXT_remap_index 430
-#define GetVertexAttribIuivEXT_remap_index 431
-#define Uniform1uiEXT_remap_index 432
-#define Uniform1uivEXT_remap_index 433
-#define Uniform2uiEXT_remap_index 434
-#define Uniform2uivEXT_remap_index 435
-#define Uniform3uiEXT_remap_index 436
-#define Uniform3uivEXT_remap_index 437
-#define Uniform4uiEXT_remap_index 438
-#define Uniform4uivEXT_remap_index 439
-#define VertexAttribI1iEXT_remap_index 440
-#define VertexAttribI1ivEXT_remap_index 441
-#define VertexAttribI1uiEXT_remap_index 442
-#define VertexAttribI1uivEXT_remap_index 443
-#define VertexAttribI2iEXT_remap_index 444
-#define VertexAttribI2ivEXT_remap_index 445
-#define VertexAttribI2uiEXT_remap_index 446
-#define VertexAttribI2uivEXT_remap_index 447
-#define VertexAttribI3iEXT_remap_index 448
-#define VertexAttribI3ivEXT_remap_index 449
-#define VertexAttribI3uiEXT_remap_index 450
-#define VertexAttribI3uivEXT_remap_index 451
-#define VertexAttribI4bvEXT_remap_index 452
-#define VertexAttribI4iEXT_remap_index 453
-#define VertexAttribI4ivEXT_remap_index 454
-#define VertexAttribI4svEXT_remap_index 455
-#define VertexAttribI4ubvEXT_remap_index 456
-#define VertexAttribI4uiEXT_remap_index 457
-#define VertexAttribI4uivEXT_remap_index 458
-#define VertexAttribI4usvEXT_remap_index 459
-#define VertexAttribIPointerEXT_remap_index 460
-#define FramebufferTextureLayerEXT_remap_index 461
-#define ColorMaskIndexedEXT_remap_index 462
-#define DisableIndexedEXT_remap_index 463
-#define EnableIndexedEXT_remap_index 464
-#define GetBooleanIndexedvEXT_remap_index 465
-#define GetIntegerIndexedvEXT_remap_index 466
-#define IsEnabledIndexedEXT_remap_index 467
-#define ClearColorIiEXT_remap_index 468
-#define ClearColorIuiEXT_remap_index 469
-#define GetTexParameterIivEXT_remap_index 470
-#define GetTexParameterIuivEXT_remap_index 471
-#define TexParameterIivEXT_remap_index 472
-#define TexParameterIuivEXT_remap_index 473
-#define BeginConditionalRenderNV_remap_index 474
-#define EndConditionalRenderNV_remap_index 475
-#define BeginTransformFeedbackEXT_remap_index 476
-#define BindBufferBaseEXT_remap_index 477
-#define BindBufferOffsetEXT_remap_index 478
-#define BindBufferRangeEXT_remap_index 479
-#define EndTransformFeedbackEXT_remap_index 480
-#define GetTransformFeedbackVaryingEXT_remap_index 481
-#define TransformFeedbackVaryingsEXT_remap_index 482
-#define ProvokingVertexEXT_remap_index 483
-#define GetTexParameterPointervAPPLE_remap_index 484
-#define TextureRangeAPPLE_remap_index 485
-#define GetObjectParameterivAPPLE_remap_index 486
-#define ObjectPurgeableAPPLE_remap_index 487
-#define ObjectUnpurgeableAPPLE_remap_index 488
-#define ActiveProgramEXT_remap_index 489
-#define CreateShaderProgramEXT_remap_index 490
-#define UseShaderProgramEXT_remap_index 491
-#define TextureBarrierNV_remap_index 492
-#define StencilFuncSeparateATI_remap_index 493
-#define ProgramEnvParameters4fvEXT_remap_index 494
-#define ProgramLocalParameters4fvEXT_remap_index 495
-#define GetQueryObjecti64vEXT_remap_index 496
-#define GetQueryObjectui64vEXT_remap_index 497
-#define EGLImageTargetRenderbufferStorageOES_remap_index 498
-#define EGLImageTargetTexture2DOES_remap_index 499
+#define GetGraphicsResetStatusARB_remap_index 218
+#define GetnColorTableARB_remap_index 219
+#define GetnCompressedTexImageARB_remap_index 220
+#define GetnConvolutionFilterARB_remap_index 221
+#define GetnHistogramARB_remap_index 222
+#define GetnMapdvARB_remap_index 223
+#define GetnMapfvARB_remap_index 224
+#define GetnMapivARB_remap_index 225
+#define GetnMinmaxARB_remap_index 226
+#define GetnPixelMapfvARB_remap_index 227
+#define GetnPixelMapuivARB_remap_index 228
+#define GetnPixelMapusvARB_remap_index 229
+#define GetnPolygonStippleARB_remap_index 230
+#define GetnSeparableFilterARB_remap_index 231
+#define GetnTexImageARB_remap_index 232
+#define GetnUniformdvARB_remap_index 233
+#define GetnUniformfvARB_remap_index 234
+#define GetnUniformivARB_remap_index 235
+#define GetnUniformuivARB_remap_index 236
+#define ReadnPixelsARB_remap_index 237
+#define PolygonOffsetEXT_remap_index 238
+#define GetPixelTexGenParameterfvSGIS_remap_index 239
+#define GetPixelTexGenParameterivSGIS_remap_index 240
+#define PixelTexGenParameterfSGIS_remap_index 241
+#define PixelTexGenParameterfvSGIS_remap_index 242
+#define PixelTexGenParameteriSGIS_remap_index 243
+#define PixelTexGenParameterivSGIS_remap_index 244
+#define SampleMaskSGIS_remap_index 245
+#define SamplePatternSGIS_remap_index 246
+#define ColorPointerEXT_remap_index 247
+#define EdgeFlagPointerEXT_remap_index 248
+#define IndexPointerEXT_remap_index 249
+#define NormalPointerEXT_remap_index 250
+#define TexCoordPointerEXT_remap_index 251
+#define VertexPointerEXT_remap_index 252
+#define PointParameterfEXT_remap_index 253
+#define PointParameterfvEXT_remap_index 254
+#define LockArraysEXT_remap_index 255
+#define UnlockArraysEXT_remap_index 256
+#define SecondaryColor3bEXT_remap_index 257
+#define SecondaryColor3bvEXT_remap_index 258
+#define SecondaryColor3dEXT_remap_index 259
+#define SecondaryColor3dvEXT_remap_index 260
+#define SecondaryColor3fEXT_remap_index 261
+#define SecondaryColor3fvEXT_remap_index 262
+#define SecondaryColor3iEXT_remap_index 263
+#define SecondaryColor3ivEXT_remap_index 264
+#define SecondaryColor3sEXT_remap_index 265
+#define SecondaryColor3svEXT_remap_index 266
+#define SecondaryColor3ubEXT_remap_index 267
+#define SecondaryColor3ubvEXT_remap_index 268
+#define SecondaryColor3uiEXT_remap_index 269
+#define SecondaryColor3uivEXT_remap_index 270
+#define SecondaryColor3usEXT_remap_index 271
+#define SecondaryColor3usvEXT_remap_index 272
+#define SecondaryColorPointerEXT_remap_index 273
+#define MultiDrawArraysEXT_remap_index 274
+#define MultiDrawElementsEXT_remap_index 275
+#define FogCoordPointerEXT_remap_index 276
+#define FogCoorddEXT_remap_index 277
+#define FogCoorddvEXT_remap_index 278
+#define FogCoordfEXT_remap_index 279
+#define FogCoordfvEXT_remap_index 280
+#define PixelTexGenSGIX_remap_index 281
+#define BlendFuncSeparateEXT_remap_index 282
+#define FlushVertexArrayRangeNV_remap_index 283
+#define VertexArrayRangeNV_remap_index 284
+#define CombinerInputNV_remap_index 285
+#define CombinerOutputNV_remap_index 286
+#define CombinerParameterfNV_remap_index 287
+#define CombinerParameterfvNV_remap_index 288
+#define CombinerParameteriNV_remap_index 289
+#define CombinerParameterivNV_remap_index 290
+#define FinalCombinerInputNV_remap_index 291
+#define GetCombinerInputParameterfvNV_remap_index 292
+#define GetCombinerInputParameterivNV_remap_index 293
+#define GetCombinerOutputParameterfvNV_remap_index 294
+#define GetCombinerOutputParameterivNV_remap_index 295
+#define GetFinalCombinerInputParameterfvNV_remap_index 296
+#define GetFinalCombinerInputParameterivNV_remap_index 297
+#define ResizeBuffersMESA_remap_index 298
+#define WindowPos2dMESA_remap_index 299
+#define WindowPos2dvMESA_remap_index 300
+#define WindowPos2fMESA_remap_index 301
+#define WindowPos2fvMESA_remap_index 302
+#define WindowPos2iMESA_remap_index 303
+#define WindowPos2ivMESA_remap_index 304
+#define WindowPos2sMESA_remap_index 305
+#define WindowPos2svMESA_remap_index 306
+#define WindowPos3dMESA_remap_index 307
+#define WindowPos3dvMESA_remap_index 308
+#define WindowPos3fMESA_remap_index 309
+#define WindowPos3fvMESA_remap_index 310
+#define WindowPos3iMESA_remap_index 311
+#define WindowPos3ivMESA_remap_index 312
+#define WindowPos3sMESA_remap_index 313
+#define WindowPos3svMESA_remap_index 314
+#define WindowPos4dMESA_remap_index 315
+#define WindowPos4dvMESA_remap_index 316
+#define WindowPos4fMESA_remap_index 317
+#define WindowPos4fvMESA_remap_index 318
+#define WindowPos4iMESA_remap_index 319
+#define WindowPos4ivMESA_remap_index 320
+#define WindowPos4sMESA_remap_index 321
+#define WindowPos4svMESA_remap_index 322
+#define MultiModeDrawArraysIBM_remap_index 323
+#define MultiModeDrawElementsIBM_remap_index 324
+#define DeleteFencesNV_remap_index 325
+#define FinishFenceNV_remap_index 326
+#define GenFencesNV_remap_index 327
+#define GetFenceivNV_remap_index 328
+#define IsFenceNV_remap_index 329
+#define SetFenceNV_remap_index 330
+#define TestFenceNV_remap_index 331
+#define AreProgramsResidentNV_remap_index 332
+#define BindProgramNV_remap_index 333
+#define DeleteProgramsNV_remap_index 334
+#define ExecuteProgramNV_remap_index 335
+#define GenProgramsNV_remap_index 336
+#define GetProgramParameterdvNV_remap_index 337
+#define GetProgramParameterfvNV_remap_index 338
+#define GetProgramStringNV_remap_index 339
+#define GetProgramivNV_remap_index 340
+#define GetTrackMatrixivNV_remap_index 341
+#define GetVertexAttribPointervNV_remap_index 342
+#define GetVertexAttribdvNV_remap_index 343
+#define GetVertexAttribfvNV_remap_index 344
+#define GetVertexAttribivNV_remap_index 345
+#define IsProgramNV_remap_index 346
+#define LoadProgramNV_remap_index 347
+#define ProgramParameters4dvNV_remap_index 348
+#define ProgramParameters4fvNV_remap_index 349
+#define RequestResidentProgramsNV_remap_index 350
+#define TrackMatrixNV_remap_index 351
+#define VertexAttrib1dNV_remap_index 352
+#define VertexAttrib1dvNV_remap_index 353
+#define VertexAttrib1fNV_remap_index 354
+#define VertexAttrib1fvNV_remap_index 355
+#define VertexAttrib1sNV_remap_index 356
+#define VertexAttrib1svNV_remap_index 357
+#define VertexAttrib2dNV_remap_index 358
+#define VertexAttrib2dvNV_remap_index 359
+#define VertexAttrib2fNV_remap_index 360
+#define VertexAttrib2fvNV_remap_index 361
+#define VertexAttrib2sNV_remap_index 362
+#define VertexAttrib2svNV_remap_index 363
+#define VertexAttrib3dNV_remap_index 364
+#define VertexAttrib3dvNV_remap_index 365
+#define VertexAttrib3fNV_remap_index 366
+#define VertexAttrib3fvNV_remap_index 367
+#define VertexAttrib3sNV_remap_index 368
+#define VertexAttrib3svNV_remap_index 369
+#define VertexAttrib4dNV_remap_index 370
+#define VertexAttrib4dvNV_remap_index 371
+#define VertexAttrib4fNV_remap_index 372
+#define VertexAttrib4fvNV_remap_index 373
+#define VertexAttrib4sNV_remap_index 374
+#define VertexAttrib4svNV_remap_index 375
+#define VertexAttrib4ubNV_remap_index 376
+#define VertexAttrib4ubvNV_remap_index 377
+#define VertexAttribPointerNV_remap_index 378
+#define VertexAttribs1dvNV_remap_index 379
+#define VertexAttribs1fvNV_remap_index 380
+#define VertexAttribs1svNV_remap_index 381
+#define VertexAttribs2dvNV_remap_index 382
+#define VertexAttribs2fvNV_remap_index 383
+#define VertexAttribs2svNV_remap_index 384
+#define VertexAttribs3dvNV_remap_index 385
+#define VertexAttribs3fvNV_remap_index 386
+#define VertexAttribs3svNV_remap_index 387
+#define VertexAttribs4dvNV_remap_index 388
+#define VertexAttribs4fvNV_remap_index 389
+#define VertexAttribs4svNV_remap_index 390
+#define VertexAttribs4ubvNV_remap_index 391
+#define GetTexBumpParameterfvATI_remap_index 392
+#define GetTexBumpParameterivATI_remap_index 393
+#define TexBumpParameterfvATI_remap_index 394
+#define TexBumpParameterivATI_remap_index 395
+#define AlphaFragmentOp1ATI_remap_index 396
+#define AlphaFragmentOp2ATI_remap_index 397
+#define AlphaFragmentOp3ATI_remap_index 398
+#define BeginFragmentShaderATI_remap_index 399
+#define BindFragmentShaderATI_remap_index 400
+#define ColorFragmentOp1ATI_remap_index 401
+#define ColorFragmentOp2ATI_remap_index 402
+#define ColorFragmentOp3ATI_remap_index 403
+#define DeleteFragmentShaderATI_remap_index 404
+#define EndFragmentShaderATI_remap_index 405
+#define GenFragmentShadersATI_remap_index 406
+#define PassTexCoordATI_remap_index 407
+#define SampleMapATI_remap_index 408
+#define SetFragmentShaderConstantATI_remap_index 409
+#define PointParameteriNV_remap_index 410
+#define PointParameterivNV_remap_index 411
+#define ActiveStencilFaceEXT_remap_index 412
+#define BindVertexArrayAPPLE_remap_index 413
+#define DeleteVertexArraysAPPLE_remap_index 414
+#define GenVertexArraysAPPLE_remap_index 415
+#define IsVertexArrayAPPLE_remap_index 416
+#define GetProgramNamedParameterdvNV_remap_index 417
+#define GetProgramNamedParameterfvNV_remap_index 418
+#define ProgramNamedParameter4dNV_remap_index 419
+#define ProgramNamedParameter4dvNV_remap_index 420
+#define ProgramNamedParameter4fNV_remap_index 421
+#define ProgramNamedParameter4fvNV_remap_index 422
+#define PrimitiveRestartIndexNV_remap_index 423
+#define PrimitiveRestartNV_remap_index 424
+#define DepthBoundsEXT_remap_index 425
+#define BlendEquationSeparateEXT_remap_index 426
+#define BindFramebufferEXT_remap_index 427
+#define BindRenderbufferEXT_remap_index 428
+#define CheckFramebufferStatusEXT_remap_index 429
+#define DeleteFramebuffersEXT_remap_index 430
+#define DeleteRenderbuffersEXT_remap_index 431
+#define FramebufferRenderbufferEXT_remap_index 432
+#define FramebufferTexture1DEXT_remap_index 433
+#define FramebufferTexture2DEXT_remap_index 434
+#define FramebufferTexture3DEXT_remap_index 435
+#define GenFramebuffersEXT_remap_index 436
+#define GenRenderbuffersEXT_remap_index 437
+#define GenerateMipmapEXT_remap_index 438
+#define GetFramebufferAttachmentParameterivEXT_remap_index 439
+#define GetRenderbufferParameterivEXT_remap_index 440
+#define IsFramebufferEXT_remap_index 441
+#define IsRenderbufferEXT_remap_index 442
+#define RenderbufferStorageEXT_remap_index 443
+#define BlitFramebufferEXT_remap_index 444
+#define BufferParameteriAPPLE_remap_index 445
+#define FlushMappedBufferRangeAPPLE_remap_index 446
+#define BindFragDataLocationEXT_remap_index 447
+#define GetFragDataLocationEXT_remap_index 448
+#define GetUniformuivEXT_remap_index 449
+#define GetVertexAttribIivEXT_remap_index 450
+#define GetVertexAttribIuivEXT_remap_index 451
+#define Uniform1uiEXT_remap_index 452
+#define Uniform1uivEXT_remap_index 453
+#define Uniform2uiEXT_remap_index 454
+#define Uniform2uivEXT_remap_index 455
+#define Uniform3uiEXT_remap_index 456
+#define Uniform3uivEXT_remap_index 457
+#define Uniform4uiEXT_remap_index 458
+#define Uniform4uivEXT_remap_index 459
+#define VertexAttribI1iEXT_remap_index 460
+#define VertexAttribI1ivEXT_remap_index 461
+#define VertexAttribI1uiEXT_remap_index 462
+#define VertexAttribI1uivEXT_remap_index 463
+#define VertexAttribI2iEXT_remap_index 464
+#define VertexAttribI2ivEXT_remap_index 465
+#define VertexAttribI2uiEXT_remap_index 466
+#define VertexAttribI2uivEXT_remap_index 467
+#define VertexAttribI3iEXT_remap_index 468
+#define VertexAttribI3ivEXT_remap_index 469
+#define VertexAttribI3uiEXT_remap_index 470
+#define VertexAttribI3uivEXT_remap_index 471
+#define VertexAttribI4bvEXT_remap_index 472
+#define VertexAttribI4iEXT_remap_index 473
+#define VertexAttribI4ivEXT_remap_index 474
+#define VertexAttribI4svEXT_remap_index 475
+#define VertexAttribI4ubvEXT_remap_index 476
+#define VertexAttribI4uiEXT_remap_index 477
+#define VertexAttribI4uivEXT_remap_index 478
+#define VertexAttribI4usvEXT_remap_index 479
+#define VertexAttribIPointerEXT_remap_index 480
+#define FramebufferTextureLayerEXT_remap_index 481
+#define ColorMaskIndexedEXT_remap_index 482
+#define DisableIndexedEXT_remap_index 483
+#define EnableIndexedEXT_remap_index 484
+#define GetBooleanIndexedvEXT_remap_index 485
+#define GetIntegerIndexedvEXT_remap_index 486
+#define IsEnabledIndexedEXT_remap_index 487
+#define ClearColorIiEXT_remap_index 488
+#define ClearColorIuiEXT_remap_index 489
+#define GetTexParameterIivEXT_remap_index 490
+#define GetTexParameterIuivEXT_remap_index 491
+#define TexParameterIivEXT_remap_index 492
+#define TexParameterIuivEXT_remap_index 493
+#define BeginConditionalRenderNV_remap_index 494
+#define EndConditionalRenderNV_remap_index 495
+#define BeginTransformFeedbackEXT_remap_index 496
+#define BindBufferBaseEXT_remap_index 497
+#define BindBufferOffsetEXT_remap_index 498
+#define BindBufferRangeEXT_remap_index 499
+#define EndTransformFeedbackEXT_remap_index 500
+#define GetTransformFeedbackVaryingEXT_remap_index 501
+#define TransformFeedbackVaryingsEXT_remap_index 502
+#define ProvokingVertexEXT_remap_index 503
+#define GetTexParameterPointervAPPLE_remap_index 504
+#define TextureRangeAPPLE_remap_index 505
+#define GetObjectParameterivAPPLE_remap_index 506
+#define ObjectPurgeableAPPLE_remap_index 507
+#define ObjectUnpurgeableAPPLE_remap_index 508
+#define ActiveProgramEXT_remap_index 509
+#define CreateShaderProgramEXT_remap_index 510
+#define UseShaderProgramEXT_remap_index 511
+#define TextureBarrierNV_remap_index 512
+#define StencilFuncSeparateATI_remap_index 513
+#define ProgramEnvParameters4fvEXT_remap_index 514
+#define ProgramLocalParameters4fvEXT_remap_index 515
+#define GetQueryObjecti64vEXT_remap_index 516
+#define GetQueryObjectui64vEXT_remap_index 517
+#define EGLImageTargetRenderbufferStorageOES_remap_index 518
+#define EGLImageTargetTexture2DOES_remap_index 519
 
 #define _gloffset_AttachShader driDispatchRemapTable[AttachShader_remap_index]
 #define _gloffset_CreateProgram driDispatchRemapTable[CreateProgram_remap_index]
@@ -1697,6 +1737,26 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define _gloffset_GetShaderPrecisionFormat driDispatchRemapTable[GetShaderPrecisionFormat_remap_index]
 #define _gloffset_ReleaseShaderCompiler driDispatchRemapTable[ReleaseShaderCompiler_remap_index]
 #define _gloffset_ShaderBinary driDispatchRemapTable[ShaderBinary_remap_index]
+#define _gloffset_GetGraphicsResetStatusARB driDispatchRemapTable[GetGraphicsResetStatusARB_remap_index]
+#define _gloffset_GetnColorTableARB driDispatchRemapTable[GetnColorTableARB_remap_index]
+#define _gloffset_GetnCompressedTexImageARB driDispatchRemapTable[GetnCompressedTexImageARB_remap_index]
+#define _gloffset_GetnConvolutionFilterARB driDispatchRemapTable[GetnConvolutionFilterARB_remap_index]
+#define _gloffset_GetnHistogramARB driDispatchRemapTable[GetnHistogramARB_remap_index]
+#define _gloffset_GetnMapdvARB driDispatchRemapTable[GetnMapdvARB_remap_index]
+#define _gloffset_GetnMapfvARB driDispatchRemapTable[GetnMapfvARB_remap_index]
+#define _gloffset_GetnMapivARB driDispatchRemapTable[GetnMapivARB_remap_index]
+#define _gloffset_GetnMinmaxARB driDispatchRemapTable[GetnMinmaxARB_remap_index]
+#define _gloffset_GetnPixelMapfvARB driDispatchRemapTable[GetnPixelMapfvARB_remap_index]
+#define _gloffset_GetnPixelMapuivARB driDispatchRemapTable[GetnPixelMapuivARB_remap_index]
+#define _gloffset_GetnPixelMapusvARB driDispatchRemapTable[GetnPixelMapusvARB_remap_index]
+#define _gloffset_GetnPolygonStippleARB driDispatchRemapTable[GetnPolygonStippleARB_remap_index]
+#define _gloffset_GetnSeparableFilterARB driDispatchRemapTable[GetnSeparableFilterARB_remap_index]
+#define _gloffset_GetnTexImageARB driDispatchRemapTable[GetnTexImageARB_remap_index]
+#define _gloffset_GetnUniformdvARB driDispatchRemapTable[GetnUniformdvARB_remap_index]
+#define _gloffset_GetnUniformfvARB driDispatchRemapTable[GetnUniformfvARB_remap_index]
+#define _gloffset_GetnUniformivARB driDispatchRemapTable[GetnUniformivARB_remap_index]
+#define _gloffset_GetnUniformuivARB driDispatchRemapTable[GetnUniformuivARB_remap_index]
+#define _gloffset_ReadnPixelsARB driDispatchRemapTable[ReadnPixelsARB_remap_index]
 #define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index]
 #define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]
 #define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]
@@ -3860,6 +3920,66 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define CALL_ShaderBinary(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei)), _gloffset_ShaderBinary, parameters)
 #define GET_ShaderBinary(disp) GET_by_offset(disp, _gloffset_ShaderBinary)
 #define SET_ShaderBinary(disp, fn) SET_by_offset(disp, _gloffset_ShaderBinary, fn)
+#define CALL_GetGraphicsResetStatusARB(disp, parameters) CALL_by_offset(disp, (GLenum (GLAPIENTRYP)(void)), _gloffset_GetGraphicsResetStatusARB, parameters)
+#define GET_GetGraphicsResetStatusARB(disp) GET_by_offset(disp, _gloffset_GetGraphicsResetStatusARB)
+#define SET_GetGraphicsResetStatusARB(disp, fn) SET_by_offset(disp, _gloffset_GetGraphicsResetStatusARB, fn)
+#define CALL_GetnColorTableARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLsizei, GLvoid *)), _gloffset_GetnColorTableARB, parameters)
+#define GET_GetnColorTableARB(disp) GET_by_offset(disp, _gloffset_GetnColorTableARB)
+#define SET_GetnColorTableARB(disp, fn) SET_by_offset(disp, _gloffset_GetnColorTableARB, fn)
+#define CALL_GetnCompressedTexImageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLsizei, GLvoid *)), _gloffset_GetnCompressedTexImageARB, parameters)
+#define GET_GetnCompressedTexImageARB(disp) GET_by_offset(disp, _gloffset_GetnCompressedTexImageARB)
+#define SET_GetnCompressedTexImageARB(disp, fn) SET_by_offset(disp, _gloffset_GetnCompressedTexImageARB, fn)
+#define CALL_GetnConvolutionFilterARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLsizei, GLvoid *)), _gloffset_GetnConvolutionFilterARB, parameters)
+#define GET_GetnConvolutionFilterARB(disp) GET_by_offset(disp, _gloffset_GetnConvolutionFilterARB)
+#define SET_GetnConvolutionFilterARB(disp, fn) SET_by_offset(disp, _gloffset_GetnConvolutionFilterARB, fn)
+#define CALL_GetnHistogramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *)), _gloffset_GetnHistogramARB, parameters)
+#define GET_GetnHistogramARB(disp) GET_by_offset(disp, _gloffset_GetnHistogramARB)
+#define SET_GetnHistogramARB(disp, fn) SET_by_offset(disp, _gloffset_GetnHistogramARB, fn)
+#define CALL_GetnMapdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, GLdouble *)), _gloffset_GetnMapdvARB, parameters)
+#define GET_GetnMapdvARB(disp) GET_by_offset(disp, _gloffset_GetnMapdvARB)
+#define SET_GetnMapdvARB(disp, fn) SET_by_offset(disp, _gloffset_GetnMapdvARB, fn)
+#define CALL_GetnMapfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, GLfloat *)), _gloffset_GetnMapfvARB, parameters)
+#define GET_GetnMapfvARB(disp) GET_by_offset(disp, _gloffset_GetnMapfvARB)
+#define SET_GetnMapfvARB(disp, fn) SET_by_offset(disp, _gloffset_GetnMapfvARB, fn)
+#define CALL_GetnMapivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, GLint *)), _gloffset_GetnMapivARB, parameters)
+#define GET_GetnMapivARB(disp) GET_by_offset(disp, _gloffset_GetnMapivARB)
+#define SET_GetnMapivARB(disp, fn) SET_by_offset(disp, _gloffset_GetnMapivARB, fn)
+#define CALL_GetnMinmaxARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *)), _gloffset_GetnMinmaxARB, parameters)
+#define GET_GetnMinmaxARB(disp) GET_by_offset(disp, _gloffset_GetnMinmaxARB)
+#define SET_GetnMinmaxARB(disp, fn) SET_by_offset(disp, _gloffset_GetnMinmaxARB, fn)
+#define CALL_GetnPixelMapfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLfloat *)), _gloffset_GetnPixelMapfvARB, parameters)
+#define GET_GetnPixelMapfvARB(disp) GET_by_offset(disp, _gloffset_GetnPixelMapfvARB)
+#define SET_GetnPixelMapfvARB(disp, fn) SET_by_offset(disp, _gloffset_GetnPixelMapfvARB, fn)
+#define CALL_GetnPixelMapuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLuint *)), _gloffset_GetnPixelMapuivARB, parameters)
+#define GET_GetnPixelMapuivARB(disp) GET_by_offset(disp, _gloffset_GetnPixelMapuivARB)
+#define SET_GetnPixelMapuivARB(disp, fn) SET_by_offset(disp, _gloffset_GetnPixelMapuivARB, fn)
+#define CALL_GetnPixelMapusvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLushort *)), _gloffset_GetnPixelMapusvARB, parameters)
+#define GET_GetnPixelMapusvARB(disp) GET_by_offset(disp, _gloffset_GetnPixelMapusvARB)
+#define SET_GetnPixelMapusvARB(disp, fn) SET_by_offset(disp, _gloffset_GetnPixelMapusvARB, fn)
+#define CALL_GetnPolygonStippleARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLubyte *)), _gloffset_GetnPolygonStippleARB, parameters)
+#define GET_GetnPolygonStippleARB(disp) GET_by_offset(disp, _gloffset_GetnPolygonStippleARB)
+#define SET_GetnPolygonStippleARB(disp, fn) SET_by_offset(disp, _gloffset_GetnPolygonStippleARB, fn)
+#define CALL_GetnSeparableFilterARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *)), _gloffset_GetnSeparableFilterARB, parameters)
+#define GET_GetnSeparableFilterARB(disp) GET_by_offset(disp, _gloffset_GetnSeparableFilterARB)
+#define SET_GetnSeparableFilterARB(disp, fn) SET_by_offset(disp, _gloffset_GetnSeparableFilterARB, fn)
+#define CALL_GetnTexImageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *)), _gloffset_GetnTexImageARB, parameters)
+#define GET_GetnTexImageARB(disp) GET_by_offset(disp, _gloffset_GetnTexImageARB)
+#define SET_GetnTexImageARB(disp, fn) SET_by_offset(disp, _gloffset_GetnTexImageARB, fn)
+#define CALL_GetnUniformdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLsizei, GLdouble *)), _gloffset_GetnUniformdvARB, parameters)
+#define GET_GetnUniformdvARB(disp) GET_by_offset(disp, _gloffset_GetnUniformdvARB)
+#define SET_GetnUniformdvARB(disp, fn) SET_by_offset(disp, _gloffset_GetnUniformdvARB, fn)
+#define CALL_GetnUniformfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLsizei, GLfloat *)), _gloffset_GetnUniformfvARB, parameters)
+#define GET_GetnUniformfvARB(disp) GET_by_offset(disp, _gloffset_GetnUniformfvARB)
+#define SET_GetnUniformfvARB(disp, fn) SET_by_offset(disp, _gloffset_GetnUniformfvARB, fn)
+#define CALL_GetnUniformivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLsizei, GLint *)), _gloffset_GetnUniformivARB, parameters)
+#define GET_GetnUniformivARB(disp) GET_by_offset(disp, _gloffset_GetnUniformivARB)
+#define SET_GetnUniformivARB(disp, fn) SET_by_offset(disp, _gloffset_GetnUniformivARB, fn)
+#define CALL_GetnUniformuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLsizei, GLuint *)), _gloffset_GetnUniformuivARB, parameters)
+#define GET_GetnUniformuivARB(disp) GET_by_offset(disp, _gloffset_GetnUniformuivARB)
+#define SET_GetnUniformuivARB(disp, fn) SET_by_offset(disp, _gloffset_GetnUniformuivARB, fn)
+#define CALL_ReadnPixelsARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *)), _gloffset_ReadnPixelsARB, parameters)
+#define GET_ReadnPixelsARB(disp) GET_by_offset(disp, _gloffset_ReadnPixelsARB)
+#define SET_ReadnPixelsARB(disp, fn) SET_by_offset(disp, _gloffset_ReadnPixelsARB, fn)
 #define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), _gloffset_PolygonOffsetEXT, parameters)
 #define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, _gloffset_PolygonOffsetEXT)
 #define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, _gloffset_PolygonOffsetEXT, fn)
diff --git a/mesalib/src/mesa/main/histogram.c b/mesalib/src/mesa/main/histogram.c
index fc79feb68..44fc1325c 100644
--- a/mesalib/src/mesa/main/histogram.c
+++ b/mesalib/src/mesa/main/histogram.c
@@ -1,151 +1,173 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.3
- *
- * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "colormac.h"
-#include "histogram.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_histogram
-
-/**********************************************************************
- * API functions
- */
-
-
-/* this is defined below */
-static void GLAPIENTRY _mesa_ResetMinmax(GLenum target);
-
-
-static void GLAPIENTRY
-_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv");
-}
-
-
-static void GLAPIENTRY
-_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv");
-}
-
-
-static void GLAPIENTRY
-_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram");
-}
-
-
-static void GLAPIENTRY
-_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax");
-}
-
-
-static void GLAPIENTRY
-_mesa_ResetHistogram(GLenum target)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram");
-}
-
-
-static void GLAPIENTRY
-_mesa_ResetMinmax(GLenum target)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax");
-}
-
-
-void
-_mesa_init_histogram_dispatch(struct _glapi_table *disp)
-{
-   SET_GetHistogram(disp, _mesa_GetHistogram);
-   SET_GetHistogramParameterfv(disp, _mesa_GetHistogramParameterfv);
-   SET_GetHistogramParameteriv(disp, _mesa_GetHistogramParameteriv);
-   SET_GetMinmax(disp, _mesa_GetMinmax);
-   SET_GetMinmaxParameterfv(disp, _mesa_GetMinmaxParameterfv);
-   SET_GetMinmaxParameteriv(disp, _mesa_GetMinmaxParameteriv);
-   SET_Histogram(disp, _mesa_Histogram);
-   SET_Minmax(disp, _mesa_Minmax);
-   SET_ResetHistogram(disp, _mesa_ResetHistogram);
-   SET_ResetMinmax(disp, _mesa_ResetMinmax);
-}
-
-#endif /* FEATURE_histogram */
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.3
+ *
+ * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "colormac.h"
+#include "histogram.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "main/dispatch.h"
+
+
+#if FEATURE_histogram
+
+/**********************************************************************
+ * API functions
+ */
+
+
+/* this is defined below */
+static void GLAPIENTRY _mesa_ResetMinmax(GLenum target);
+
+
+static void GLAPIENTRY
+_mesa_GetnMinmaxARB(GLenum target, GLboolean reset, GLenum format,
+                    GLenum type, GLsizei bufSize, GLvoid *values)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type,
+                GLvoid *values)
+{
+   _mesa_GetnMinmaxARB(target, reset, format, type, INT_MAX, values);
+}
+
+
+static void GLAPIENTRY
+_mesa_GetnHistogramARB(GLenum target, GLboolean reset, GLenum format,
+                       GLenum type, GLsizei bufSize, GLvoid *values)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type,
+                   GLvoid *values)
+{
+   _mesa_GetnHistogramARB(target, reset, format, type, INT_MAX, values);
+}
+
+
+static void GLAPIENTRY
+_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv");
+}
+
+
+static void GLAPIENTRY
+_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv");
+}
+
+
+static void GLAPIENTRY
+_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram");
+}
+
+
+static void GLAPIENTRY
+_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax");
+}
+
+
+static void GLAPIENTRY
+_mesa_ResetHistogram(GLenum target)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram");
+}
+
+
+static void GLAPIENTRY
+_mesa_ResetMinmax(GLenum target)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax");
+}
+
+
+void
+_mesa_init_histogram_dispatch(struct _glapi_table *disp)
+{
+   SET_GetHistogram(disp, _mesa_GetHistogram);
+   SET_GetHistogramParameterfv(disp, _mesa_GetHistogramParameterfv);
+   SET_GetHistogramParameteriv(disp, _mesa_GetHistogramParameteriv);
+   SET_GetMinmax(disp, _mesa_GetMinmax);
+   SET_GetMinmaxParameterfv(disp, _mesa_GetMinmaxParameterfv);
+   SET_GetMinmaxParameteriv(disp, _mesa_GetMinmaxParameteriv);
+   SET_Histogram(disp, _mesa_Histogram);
+   SET_Minmax(disp, _mesa_Minmax);
+   SET_ResetHistogram(disp, _mesa_ResetHistogram);
+   SET_ResetMinmax(disp, _mesa_ResetMinmax);
+
+   /* GL_ARB_robustness */
+   SET_GetnHistogramARB(disp, _mesa_GetnHistogramARB);
+   SET_GetnMinmaxARB(disp, _mesa_GetnMinmaxARB);
+}
+
+#endif /* FEATURE_histogram */
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index e594160ad..0578631ef 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -634,6 +634,37 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
       }
    }
 
+   else if (datatype == GL_UNSIGNED_INT_2_10_10_10_REV && comps == 4) {
+      GLuint i, j, k;
+      const GLuint *rowA = (const GLuint *) srcRowA;
+      const GLuint *rowB = (const GLuint *) srcRowB;
+      GLuint *dst = (GLuint *) dstRow;
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         const GLint rowAr0 = rowA[j] & 0x3ff;
+         const GLint rowAr1 = rowA[k] & 0x3ff;
+         const GLint rowBr0 = rowB[j] & 0x3ff;
+         const GLint rowBr1 = rowB[k] & 0x3ff;
+         const GLint rowAg0 = (rowA[j] >> 10) & 0x3ff;
+         const GLint rowAg1 = (rowA[k] >> 10) & 0x3ff;
+         const GLint rowBg0 = (rowB[j] >> 10) & 0x3ff;
+         const GLint rowBg1 = (rowB[k] >> 10) & 0x3ff;
+         const GLint rowAb0 = (rowA[j] >> 20) & 0x3ff;
+         const GLint rowAb1 = (rowA[k] >> 20) & 0x3ff;
+         const GLint rowBb0 = (rowB[j] >> 20) & 0x3ff;
+         const GLint rowBb1 = (rowB[k] >> 20) & 0x3ff;
+         const GLint rowAa0 = (rowA[j] >> 30) & 0x3;
+         const GLint rowAa1 = (rowA[k] >> 30) & 0x3;
+         const GLint rowBa0 = (rowB[j] >> 30) & 0x3;
+         const GLint rowBa1 = (rowB[k] >> 30) & 0x3;
+         const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
+         const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
+         const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
+         const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
+         dst[i] = (alpha << 30) | (blue << 20) | (green << 10) | red;
+      }
+   }
+
    else {
       _mesa_problem(NULL, "bad format in do_row()");
    }
@@ -1165,6 +1196,55 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
          dst[i] = (g << 4) | r;
       }
    }
+   else if ((datatype == GL_UNSIGNED_INT_2_10_10_10_REV) && (comps == 4)) {
+      DECLARE_ROW_POINTERS0(GLuint);
+
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         const GLint rowAr0 = rowA[j] & 0x3ff;
+         const GLint rowAr1 = rowA[k] & 0x3ff;
+         const GLint rowBr0 = rowB[j] & 0x3ff;
+         const GLint rowBr1 = rowB[k] & 0x3ff;
+         const GLint rowCr0 = rowC[j] & 0x3ff;
+         const GLint rowCr1 = rowC[k] & 0x3ff;
+         const GLint rowDr0 = rowD[j] & 0x3ff;
+         const GLint rowDr1 = rowD[k] & 0x3ff;
+         const GLint rowAg0 = (rowA[j] >> 10) & 0x3ff;
+         const GLint rowAg1 = (rowA[k] >> 10) & 0x3ff;
+         const GLint rowBg0 = (rowB[j] >> 10) & 0x3ff;
+         const GLint rowBg1 = (rowB[k] >> 10) & 0x3ff;
+         const GLint rowCg0 = (rowC[j] >> 10) & 0x3ff;
+         const GLint rowCg1 = (rowC[k] >> 10) & 0x3ff;
+         const GLint rowDg0 = (rowD[j] >> 10) & 0x3ff;
+         const GLint rowDg1 = (rowD[k] >> 10) & 0x3ff;
+         const GLint rowAb0 = (rowA[j] >> 20) & 0x3ff;
+         const GLint rowAb1 = (rowA[k] >> 20) & 0x3ff;
+         const GLint rowBb0 = (rowB[j] >> 20) & 0x3ff;
+         const GLint rowBb1 = (rowB[k] >> 20) & 0x3ff;
+         const GLint rowCb0 = (rowC[j] >> 20) & 0x3ff;
+         const GLint rowCb1 = (rowC[k] >> 20) & 0x3ff;
+         const GLint rowDb0 = (rowD[j] >> 20) & 0x3ff;
+         const GLint rowDb1 = (rowD[k] >> 20) & 0x3ff;
+         const GLint rowAa0 = (rowA[j] >> 30) & 0x3;
+         const GLint rowAa1 = (rowA[k] >> 30) & 0x3;
+         const GLint rowBa0 = (rowB[j] >> 30) & 0x3;
+         const GLint rowBa1 = (rowB[k] >> 30) & 0x3;
+         const GLint rowCa0 = (rowC[j] >> 30) & 0x3;
+         const GLint rowCa1 = (rowC[k] >> 30) & 0x3;
+         const GLint rowDa0 = (rowD[j] >> 30) & 0x3;
+         const GLint rowDa1 = (rowD[k] >> 30) & 0x3;
+         const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
+                                       rowCr0, rowCr1, rowDr0, rowDr1);
+         const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
+                                       rowCg0, rowCg1, rowDg0, rowDg1);
+         const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
+                                       rowCb0, rowCb1, rowDb0, rowDb1);
+         const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
+                                       rowCa0, rowCa1, rowDa0, rowDa1);
+
+         dst[i] = (a << 30) | (b << 20) | (g << 10) | r;
+      }
+   }
    else {
       _mesa_problem(NULL, "bad format in do_row()");
    }
@@ -1896,7 +1976,6 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
          const GLenum srcFormat = _mesa_get_format_base_format(convertFormat);
          GLint dstRowStride
             = _mesa_format_row_stride(dstImage->TexFormat, dstWidth);
-         ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
 
          _mesa_texstore(ctx, 2, dstImage->_BaseFormat,
                         dstImage->TexFormat,
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 9e2905ab2..fba65e890 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -376,7 +376,15 @@ typedef enum
 {
    FRAG_RESULT_DEPTH = 0,
    FRAG_RESULT_STENCIL = 1,
+   /* If a single color should be written to all render targets, this
+    * register is written.  No FRAG_RESULT_DATAn will be written.
+    */
    FRAG_RESULT_COLOR = 2,
+
+   /* FRAG_RESULT_DATAn are the per-render-target (GLSL gl_FragData[n]
+    * or ARB_fragment_program fragment.color[n]) color results.  If
+    * any are written, FRAG_RESULT_COLOR will not be written.
+    */
    FRAG_RESULT_DATA0 = 3,
    FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
 } gl_frag_result;
@@ -1923,7 +1931,6 @@ struct gl_geometry_program
 struct gl_fragment_program
 {
    struct gl_program Base;   /**< base class */
-   GLenum FogOption;
    GLboolean UsesKill;          /**< shader uses KIL instruction */
    GLboolean OriginUpperLeft;
    GLboolean PixelCenterInteger;
@@ -2406,27 +2413,26 @@ struct gl_shared_state
  */
 struct gl_renderbuffer
 {
-#define RB_MAGIC 0xaabbccdd
-   int Magic; /** XXX TEMPORARY DEBUG INFO */
    _glthread_Mutex Mutex;		   /**< for thread safety */
    GLuint ClassID;        /**< Useful for drivers */
    GLuint Name;
    GLint RefCount;
    GLuint Width, Height;
+   GLint RowStride;       /**< Padded width in units of pixels */
    GLboolean Purgeable;   /**< Is the buffer purgeable under memory pressure? */
 
+   GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */
+
+   GLubyte NumSamples;
+
    GLenum InternalFormat; /**< The user-specified format */
    GLenum _BaseFormat;    /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or
                                GL_STENCIL_INDEX. */
    gl_format Format;      /**< The actual renderbuffer memory format */
 
-   GLubyte NumSamples;
-
    GLenum DataType;      /**< Type of values passed to the Get/Put functions */
    GLvoid *Data;        /**< This may not be used by some kinds of RBs */
 
-   GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */
-
    /* Used to wrap one renderbuffer around another: */
    struct gl_renderbuffer *Wrapped;
 
@@ -2740,6 +2746,9 @@ struct gl_constants
 
    /* GL_EXT_framebuffer_sRGB */
    GLboolean sRGBCapable; /* can enable sRGB blend/update on FBOs */
+
+   /* GL_ARB_robustness */
+   GLenum ResetStrategy;
 };
 
 
@@ -3299,6 +3308,9 @@ struct gl_context
 
    GLenum ErrorValue;        /**< Last error code */
 
+   /* GL_ARB_robustness */
+   GLenum ResetStatus;
+
    /**
     * Recognize and silence repeated error debug messages in buggy apps.
     */
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index 02154585a..ad8ab9d00 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -37,7 +37,6 @@
 #include "mtypes.h"
 #include "pack.h"
 #include "pixeltransfer.h"
-#include "imports.h"
 
 
 /**
@@ -3973,7 +3972,8 @@ _mesa_unpack_dudv_span_byte( struct gl_context *ctx,
                              GLbitfield transferOps )
 {
    ASSERT(dstFormat == GL_DUDV_ATI);
-   ASSERT(srcFormat == GL_DUDV_ATI);
+   ASSERT(srcFormat == GL_DUDV_ATI ||
+	  srcFormat == GL_DU8DV8_ATI);
 
    ASSERT(srcType == GL_UNSIGNED_BYTE ||
           srcType == GL_BYTE ||
diff --git a/mesalib/src/mesa/main/pbo.c b/mesalib/src/mesa/main/pbo.c
index dc00d423b..15e0480e9 100644
--- a/mesalib/src/mesa/main/pbo.c
+++ b/mesalib/src/mesa/main/pbo.c
@@ -43,7 +43,7 @@
  * When we're about to read pixel data out of a PBO (via glDrawPixels,
  * glTexImage, etc) or write data into a PBO (via glReadPixels,
  * glGetTexImage, etc) we call this function to check that we're not
- * going to read out of bounds.
+ * going to read/write out of bounds.
  *
  * XXX This would also be a convenient time to check that the PBO isn't
  * currently mapped.  Whoever calls this function should check for that.
@@ -56,43 +56,52 @@
  * \param depth  depth of image to read/write
  * \param format  format of image to read/write
  * \param type  datatype of image to read/write
+ * \param clientMemSize  the maximum number of bytes to read/write
  * \param ptr  the user-provided pointer/offset
- * \return GL_TRUE if the PBO access is OK, GL_FALSE if the access would
+ * \return GL_TRUE if the buffer access is OK, GL_FALSE if the access would
  *         go out of bounds.
  */
 GLboolean
 _mesa_validate_pbo_access(GLuint dimensions,
                           const struct gl_pixelstore_attrib *pack,
                           GLsizei width, GLsizei height, GLsizei depth,
-                          GLenum format, GLenum type, const GLvoid *ptr)
+                          GLenum format, GLenum type, GLsizei clientMemSize,
+                          const GLvoid *ptr)
 {
-   GLvoid *start, *end;
+   const GLvoid *start, *end, *offset;
    const GLubyte *sizeAddr; /* buffer size, cast to a pointer */
 
-   if (!_mesa_is_bufferobj(pack->BufferObj))
-      return GL_TRUE;  /* no PBO, OK */
+   /* If no PBO is bound, 'ptr' is a pointer to client memory containing
+      'clientMemSize' bytes.
+      If a PBO is bound, 'ptr' is an offset into the bound PBO.
+      In that case 'clientMemSize' is ignored: we just use the PBO's size.
+    */
+   if (!_mesa_is_bufferobj(pack->BufferObj)) {
+      offset = 0;
+      sizeAddr = ((const GLubyte *) 0) + clientMemSize;
+   } else {
+      offset = ptr;
+      sizeAddr = ((const GLubyte *) 0) + pack->BufferObj->Size;
+   }
 
-   if (pack->BufferObj->Size == 0)
+   if (sizeAddr == 0)
       /* no buffer! */
       return GL_FALSE;
 
-   /* get address of first pixel we'll read */
-   start = _mesa_image_address(dimensions, pack, ptr, width, height,
+   /* get the offset to the first pixel we'll read/write */
+   start = _mesa_image_address(dimensions, pack, offset, width, height,
                                format, type, 0, 0, 0);
 
-   /* get address just past the last pixel we'll read */
-   end =  _mesa_image_address(dimensions, pack, ptr, width, height,
+   /* get the offset to just past the last pixel we'll read/write */
+   end =  _mesa_image_address(dimensions, pack, offset, width, height,
                               format, type, depth-1, height-1, width);
 
-
-   sizeAddr = ((const GLubyte *) 0) + pack->BufferObj->Size;
-
    if ((const GLubyte *) start > sizeAddr) {
       /* This will catch negative values / wrap-around */
       return GL_FALSE;
    }
    if ((const GLubyte *) end > sizeAddr) {
-      /* Image read goes beyond end of buffer */
+      /* Image read/write goes beyond end of buffer */
       return GL_FALSE;
    }
 
@@ -146,24 +155,30 @@ _mesa_map_pbo_source(struct gl_context *ctx,
  */
 const GLvoid *
 _mesa_map_validate_pbo_source(struct gl_context *ctx,
-                              GLuint dimensions,
-                              const struct gl_pixelstore_attrib *unpack,
-                              GLsizei width, GLsizei height, GLsizei depth,
-                              GLenum format, GLenum type, const GLvoid *ptr,
-                              const char *where)
+                                 GLuint dimensions,
+                                 const struct gl_pixelstore_attrib *unpack,
+                                 GLsizei width, GLsizei height, GLsizei depth,
+                                 GLenum format, GLenum type, GLsizei clientMemSize,
+                                 const GLvoid *ptr, const char *where)
 {
    ASSERT(dimensions == 1 || dimensions == 2 || dimensions == 3);
 
-   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
-      /* non-PBO access: no validation to be done */
-      return ptr;
+   if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
+                                  format, type, clientMemSize, ptr)) {
+      if (_mesa_is_bufferobj(unpack->BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "%s(out of bounds PBO access)", where);
+      } else {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "%s(out of bounds access: bufSize (%d) is too small)",
+                     where, clientMemSize);
+      }
+      return NULL;
    }
 
-   if (!_mesa_validate_pbo_access(dimensions, unpack,
-                                  width, height, depth, format, type, ptr)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "%s(out of bounds PBO access)", where);
-      return NULL;
+   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+      /* non-PBO access: no further validation to be done */
+      return ptr;
    }
 
    if (_mesa_bufferobj_mapped(unpack->BufferObj)) {
@@ -236,24 +251,30 @@ _mesa_map_pbo_dest(struct gl_context *ctx,
  */
 GLvoid *
 _mesa_map_validate_pbo_dest(struct gl_context *ctx,
-                            GLuint dimensions,
-                            const struct gl_pixelstore_attrib *unpack,
-                            GLsizei width, GLsizei height, GLsizei depth,
-                            GLenum format, GLenum type, GLvoid *ptr,
-                            const char *where)
+                               GLuint dimensions,
+                               const struct gl_pixelstore_attrib *unpack,
+                               GLsizei width, GLsizei height, GLsizei depth,
+                               GLenum format, GLenum type, GLsizei clientMemSize,
+                               GLvoid *ptr, const char *where)
 {
    ASSERT(dimensions == 1 || dimensions == 2 || dimensions == 3);
 
-   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
-      /* non-PBO access: no validation to be done */
-      return ptr;
+   if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
+                                  format, type, clientMemSize, ptr)) {
+      if (_mesa_is_bufferobj(unpack->BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "%s(out of bounds PBO access)", where);
+      } else {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "%s(out of bounds access: bufSize (%d) is too small)",
+                     where, clientMemSize);
+      }
+      return NULL;
    }
 
-   if (!_mesa_validate_pbo_access(dimensions, unpack,
-                                  width, height, depth, format, type, ptr)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "%s(out of bounds PBO access)", where);
-      return NULL;
+   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+      /* non-PBO access: no further validation to be done */
+      return ptr;
    }
 
    if (_mesa_bufferobj_mapped(unpack->BufferObj)) {
@@ -281,7 +302,6 @@ _mesa_unmap_pbo_dest(struct gl_context *ctx,
 }
 
 
-
 /**
  * Check if an unpack PBO is active prior to fetching a texture image.
  * If so, do bounds checking and map the buffer into main memory.
@@ -302,7 +322,7 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
       return pixels;
    }
    if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
-                                  format, type, pixels)) {
+                                     format, type, INT_MAX, pixels)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)");
       return NULL;
    }
diff --git a/mesalib/src/mesa/main/pbo.h b/mesalib/src/mesa/main/pbo.h
index 0cddd72ba..00a6e617f 100644
--- a/mesalib/src/mesa/main/pbo.h
+++ b/mesalib/src/mesa/main/pbo.h
@@ -34,7 +34,8 @@ extern GLboolean
 _mesa_validate_pbo_access(GLuint dimensions,
                           const struct gl_pixelstore_attrib *pack,
                           GLsizei width, GLsizei height, GLsizei depth,
-                          GLenum format, GLenum type, const GLvoid *ptr);
+                          GLenum format, GLenum type, GLsizei clientMemSize,
+                          const GLvoid *ptr);
 
 extern const GLvoid *
 _mesa_map_pbo_source(struct gl_context *ctx,
@@ -46,8 +47,8 @@ _mesa_map_validate_pbo_source(struct gl_context *ctx,
                               GLuint dimensions,
                               const struct gl_pixelstore_attrib *unpack,
                               GLsizei width, GLsizei height, GLsizei depth,
-                              GLenum format, GLenum type, const GLvoid *ptr,
-                              const char *where);
+                              GLenum format, GLenum type, GLsizei clientMemSize,
+                              const GLvoid *ptr, const char *where);
 
 extern void
 _mesa_unmap_pbo_source(struct gl_context *ctx,
@@ -63,8 +64,8 @@ _mesa_map_validate_pbo_dest(struct gl_context *ctx,
                             GLuint dimensions,
                             const struct gl_pixelstore_attrib *unpack,
                             GLsizei width, GLsizei height, GLsizei depth,
-                            GLenum format, GLenum type, GLvoid *ptr,
-                            const char *where);
+                            GLenum format, GLenum type, GLsizei clientMemSize,
+                            GLvoid *ptr, const char *where);
 
 extern void
 _mesa_unmap_pbo_dest(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/pixel.c b/mesalib/src/mesa/main/pixel.c
index da99c9b6f..775746270 100644
--- a/mesalib/src/mesa/main/pixel.c
+++ b/mesalib/src/mesa/main/pixel.c
@@ -145,8 +145,9 @@ store_pixelmap(struct gl_context *ctx, GLenum map, GLsizei mapsize,
  * Convenience wrapper for _mesa_validate_pbo_access() for gl[Get]PixelMap().
  */
 static GLboolean
-validate_pbo_access(struct gl_context *ctx, struct gl_pixelstore_attrib *pack,
-                    GLsizei mapsize, GLenum format, GLenum type,
+validate_pbo_access(struct gl_context *ctx,
+                    struct gl_pixelstore_attrib *pack, GLsizei mapsize,
+                    GLenum format, GLenum type, GLsizei clientMemSize,
                     const GLvoid *ptr)
 {
    GLboolean ok;
@@ -157,7 +158,7 @@ validate_pbo_access(struct gl_context *ctx, struct gl_pixelstore_attrib *pack,
                                  pack->BufferObj);
 
    ok = _mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1,
-                                  format, type, ptr);
+                                  format, type, clientMemSize, ptr);
 
    /* restore */
    _mesa_reference_buffer_object(ctx,
@@ -165,8 +166,14 @@ validate_pbo_access(struct gl_context *ctx, struct gl_pixelstore_attrib *pack,
                                  ctx->Shared->NullBufferObj);
 
    if (!ok) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glPixelMap(invalid PBO access)");
+      if (_mesa_is_bufferobj(pack->BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "gl[Get]PixelMap*v(out of bounds PBO access)");
+      } else {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetnPixelMap*vARB(out of bounds access:"
+                     " bufSize (%d) is too small)", clientMemSize);
+      }
    }
    return ok;
 }
@@ -194,8 +201,8 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
 
    FLUSH_VERTICES(ctx, _NEW_PIXEL);
 
-   if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize,
-                            GL_INTENSITY, GL_FLOAT, values)) {
+   if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize, GL_INTENSITY,
+                            GL_FLOAT, INT_MAX, values)) {
       return;
    }
 
@@ -236,8 +243,8 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
 
    FLUSH_VERTICES(ctx, _NEW_PIXEL);
 
-   if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize,
-                            GL_INTENSITY, GL_UNSIGNED_INT, values)) {
+   if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize, GL_INTENSITY,
+                            GL_UNSIGNED_INT, INT_MAX, values)) {
       return;
    }
 
@@ -292,8 +299,8 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
 
    FLUSH_VERTICES(ctx, _NEW_PIXEL);
 
-   if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize,
-                            GL_INTENSITY, GL_UNSIGNED_SHORT, values)) {
+   if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize, GL_INTENSITY,
+                            GL_UNSIGNED_SHORT, INT_MAX, values)) {
       return;
    }
 
@@ -327,10 +334,10 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
 
 
 static void GLAPIENTRY
-_mesa_GetPixelMapfv( GLenum map, GLfloat *values )
+_mesa_GetnPixelMapfvARB( GLenum map, GLsizei bufSize, GLfloat *values )
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLuint mapsize, i;
+   GLint mapsize, i;
    const struct gl_pixelmap *pm;
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -343,8 +350,8 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
 
    mapsize = pm->Size;
 
-   if (!validate_pbo_access(ctx, &ctx->Pack, mapsize,
-                            GL_INTENSITY, GL_FLOAT, values)) {
+   if (!validate_pbo_access(ctx, &ctx->Pack, mapsize, GL_INTENSITY,
+                            GL_FLOAT, bufSize, values)) {
       return;
    }
 
@@ -372,7 +379,13 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
 
 
 static void GLAPIENTRY
-_mesa_GetPixelMapuiv( GLenum map, GLuint *values )
+_mesa_GetPixelMapfv( GLenum map, GLfloat *values )
+{
+   _mesa_GetnPixelMapfvARB(map, INT_MAX, values);
+}
+
+static void GLAPIENTRY
+_mesa_GetnPixelMapuivARB( GLenum map, GLsizei bufSize, GLuint *values )
 {
    GET_CURRENT_CONTEXT(ctx);
    GLint mapsize, i;
@@ -385,10 +398,11 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
       _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapuiv(map)");
       return;
    }
+
    mapsize = pm->Size;
 
-   if (!validate_pbo_access(ctx, &ctx->Pack, mapsize,
-                            GL_INTENSITY, GL_UNSIGNED_INT, values)) {
+   if (!validate_pbo_access(ctx, &ctx->Pack, mapsize, GL_INTENSITY,
+                            GL_UNSIGNED_INT, bufSize, values)) {
       return;
    }
 
@@ -416,7 +430,13 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
 
 
 static void GLAPIENTRY
-_mesa_GetPixelMapusv( GLenum map, GLushort *values )
+_mesa_GetPixelMapuiv( GLenum map, GLuint *values )
+{
+   _mesa_GetnPixelMapuivARB(map, INT_MAX, values);
+}
+
+static void GLAPIENTRY
+_mesa_GetnPixelMapusvARB( GLenum map, GLsizei bufSize, GLushort *values )
 {
    GET_CURRENT_CONTEXT(ctx);
    GLint mapsize, i;
@@ -429,10 +449,11 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
       _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapusv(map)");
       return;
    }
+
    mapsize = pm->Size;
 
-   if (!validate_pbo_access(ctx, &ctx->Pack, mapsize,
-                            GL_INTENSITY, GL_UNSIGNED_SHORT, values)) {
+   if (!validate_pbo_access(ctx, &ctx->Pack, mapsize, GL_INTENSITY,
+                            GL_UNSIGNED_SHORT, bufSize, values)) {
       return;
    }
 
@@ -467,6 +488,12 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
 }
 
 
+static void GLAPIENTRY
+_mesa_GetPixelMapusv( GLenum map, GLushort *values )
+{
+   _mesa_GetnPixelMapusvARB(map, INT_MAX, values);
+}
+
 
 /**********************************************************************/
 /*****                       glPixelTransfer                      *****/
@@ -634,6 +661,11 @@ _mesa_init_pixel_dispatch(struct _glapi_table *disp)
    SET_PixelTransferf(disp, _mesa_PixelTransferf);
    SET_PixelTransferi(disp, _mesa_PixelTransferi);
    SET_PixelZoom(disp, _mesa_PixelZoom);
+
+   /* GL_ARB_robustness */
+   SET_GetnPixelMapfvARB(disp, _mesa_GetnPixelMapfvARB);
+   SET_GetnPixelMapuivARB(disp, _mesa_GetnPixelMapuivARB);
+   SET_GetnPixelMapusvARB(disp, _mesa_GetnPixelMapusvARB);
 }
 
 
diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c
index ff4232ecc..addca0228 100644
--- a/mesalib/src/mesa/main/polygon.c
+++ b/mesalib/src/mesa/main/polygon.c
@@ -195,7 +195,8 @@ _mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern)
 {
    pattern = _mesa_map_validate_pbo_source(ctx, 2,
                                            &ctx->Unpack, 32, 32, 1,
-                                           GL_COLOR_INDEX, GL_BITMAP, pattern,
+                                           GL_COLOR_INDEX, GL_BITMAP,
+                                           INT_MAX, pattern,
                                            "glPolygonStipple");
    if (!pattern)
       return;
@@ -231,7 +232,7 @@ _mesa_PolygonStipple( const GLubyte *pattern )
  * Called by glPolygonStipple.
  */
 void GLAPIENTRY
-_mesa_GetPolygonStipple( GLubyte *dest )
+_mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest )
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -241,8 +242,8 @@ _mesa_GetPolygonStipple( GLubyte *dest )
 
    dest = _mesa_map_validate_pbo_dest(ctx, 2,
                                       &ctx->Pack, 32, 32, 1,
-                                      GL_COLOR_INDEX, GL_BITMAP, dest,
-                                      "glGetPolygonStipple");
+                                      GL_COLOR_INDEX, GL_BITMAP,
+                                      bufSize, dest, "glGetPolygonStipple");
    if (!dest)
       return;
 
@@ -252,6 +253,13 @@ _mesa_GetPolygonStipple( GLubyte *dest )
 }
 
 
+void GLAPIENTRY
+_mesa_GetPolygonStipple( GLubyte *dest )
+{
+   _mesa_GetnPolygonStippleARB(INT_MAX, dest);
+}
+
+
 void GLAPIENTRY
 _mesa_PolygonOffset( GLfloat factor, GLfloat units )
 {
diff --git a/mesalib/src/mesa/main/polygon.h b/mesalib/src/mesa/main/polygon.h
index 1357d4b01..35f222f26 100644
--- a/mesalib/src/mesa/main/polygon.h
+++ b/mesalib/src/mesa/main/polygon.h
@@ -1,67 +1,70 @@
-/**
- * \file polygon.h
- * Polygon operations.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.1
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef POLYGON_H
-#define POLYGON_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern void
-_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern);
-
-
-extern void GLAPIENTRY
-_mesa_CullFace( GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_FrontFace( GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_PolygonMode( GLenum face, GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_PolygonOffset( GLfloat factor, GLfloat units );
-
-extern void GLAPIENTRY
-_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias );
-
-extern void GLAPIENTRY
-_mesa_PolygonStipple( const GLubyte *mask );
-
-extern void GLAPIENTRY
-_mesa_GetPolygonStipple( GLubyte *mask );
-
-extern void 
-_mesa_init_polygon( struct gl_context * ctx );
-
-#endif
+/**
+ * \file polygon.h
+ * Polygon operations.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5.1
+ *
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef POLYGON_H
+#define POLYGON_H
+
+
+#include "glheader.h"
+
+struct gl_context;
+
+extern void GLAPIENTRY
+_mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest );
+
+extern void
+_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern);
+
+
+extern void GLAPIENTRY
+_mesa_CullFace( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_FrontFace( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_PolygonMode( GLenum face, GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_PolygonOffset( GLfloat factor, GLfloat units );
+
+extern void GLAPIENTRY
+_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias );
+
+extern void GLAPIENTRY
+_mesa_PolygonStipple( const GLubyte *mask );
+
+extern void GLAPIENTRY
+_mesa_GetPolygonStipple( GLubyte *mask );
+
+extern void 
+_mesa_init_polygon( struct gl_context * ctx );
+
+#endif
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index 864e5b6dc..0331a8ca2 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -1,244 +1,257 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "enums.h"
-#include "readpix.h"
-#include "framebuffer.h"
-#include "formats.h"
-#include "image.h"
-#include "mtypes.h"
-#include "pbo.h"
-#include "state.h"
-
-
-/**
- * Do error checking of the format/type parameters to glReadPixels and
- * glDrawPixels.
- * \param drawing if GL_TRUE do checking for DrawPixels, else do checking
- *                for ReadPixels.
- * \return GL_TRUE if error detected, GL_FALSE if no errors
- */
-GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
-                              GLenum type, GLboolean drawing)
-{
-   const char *readDraw = drawing ? "Draw" : "Read";
-   const GLboolean reading = !drawing;
-
-   /* state validation should have already been done */
-   ASSERT(ctx->NewState == 0x0);
-
-   if (ctx->Extensions.EXT_packed_depth_stencil
-       && type == GL_UNSIGNED_INT_24_8_EXT
-       && format != GL_DEPTH_STENCIL_EXT) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw);
-      return GL_TRUE;
-   }
-
-   /* basic combinations test */
-   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
-      _mesa_error(ctx, GL_INVALID_ENUM,
-                  "gl%sPixels(format or type)", readDraw);
-      return GL_TRUE;
-   }
-
-   /* additional checks */
-   switch (format) {
-   case GL_RG:
-   case GL_RED:
-   case GL_GREEN:
-   case GL_BLUE:
-   case GL_ALPHA:
-   case GL_LUMINANCE:
-   case GL_LUMINANCE_ALPHA:
-   case GL_RGB:
-   case GL_BGR:
-   case GL_RGBA:
-   case GL_BGRA:
-   case GL_ABGR_EXT:
-   case GL_RED_INTEGER_EXT:
-   case GL_GREEN_INTEGER_EXT:
-   case GL_BLUE_INTEGER_EXT:
-   case GL_ALPHA_INTEGER_EXT:
-   case GL_RGB_INTEGER_EXT:
-   case GL_RGBA_INTEGER_EXT:
-   case GL_BGR_INTEGER_EXT:
-   case GL_BGRA_INTEGER_EXT:
-   case GL_LUMINANCE_INTEGER_EXT:
-   case GL_LUMINANCE_ALPHA_INTEGER_EXT:
-      if (!drawing) {
-         /* reading */
-         if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glReadPixels(no color buffer)");
-            return GL_TRUE;
-         }
-      }
-      break;
-   case GL_COLOR_INDEX:
-      if (drawing) {
-         if (ctx->PixelMaps.ItoR.Size == 0 ||
-	     ctx->PixelMaps.ItoG.Size == 0 ||
-	     ctx->PixelMaps.ItoB.Size == 0) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                   "glDrawPixels(drawing color index pixels into RGB buffer)");
-            return GL_TRUE;
-         }
-      }
-      else {
-         /* reading */
-         if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glReadPixels(no color buffer)");
-            return GL_TRUE;
-         }
-         /* We no longer support CI-mode color buffers so trying to read
-          * GL_COLOR_INDEX pixels is always an error.
-          */
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glReadPixels(color buffer is RGB)");
-         return GL_TRUE;
-      }
-      break;
-   case GL_STENCIL_INDEX:
-      if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
-          (reading && !_mesa_source_buffer_exists(ctx, format))) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "gl%sPixels(no stencil buffer)", readDraw);
-         return GL_TRUE;
-      }
-      break;
-   case GL_DEPTH_COMPONENT:
-      if ((drawing && !_mesa_dest_buffer_exists(ctx, format))) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "gl%sPixels(no depth buffer)", readDraw);
-         return GL_TRUE;
-      }
-      break;
-   case GL_DEPTH_STENCIL_EXT:
-      if (!ctx->Extensions.EXT_packed_depth_stencil ||
-          type != GL_UNSIGNED_INT_24_8_EXT) {
-         _mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw);
-         return GL_TRUE;
-      }
-      if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
-          (reading && !_mesa_source_buffer_exists(ctx, format))) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "gl%sPixels(no depth or stencil buffer)", readDraw);
-         return GL_TRUE;
-      }
-      break;
-   default:
-      /* this should have been caught in _mesa_is_legal_format_type() */
-      _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw);
-      return GL_TRUE;
-   }
-
-   /* no errors */
-   return GL_FALSE;
-}
-      
-
-
-void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
-		  GLenum format, GLenum type, GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   FLUSH_CURRENT(ctx, 0);
-
-   if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glReadPixels(%d, %d, %s, %s, %p)\n",
-                  width, height,
-                  _mesa_lookup_enum_by_nr(format),
-                  _mesa_lookup_enum_by_nr(type),
-                  pixels);
-
-   if (width < 0 || height < 0) {
-      _mesa_error( ctx, GL_INVALID_VALUE,
-                   "glReadPixels(width=%d height=%d)", width, height );
-      return;
-   }
-
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
-   if (_mesa_error_check_format_type(ctx, format, type, GL_FALSE)) {
-      /* found an error */
-      return;
-   }
-
-   /* Check that the destination format and source buffer are both
-    * integer-valued or both non-integer-valued.
-    */
-   if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {
-      const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
-      const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
-      const GLboolean dstInteger = _mesa_is_integer_format(format);
-      if (dstInteger != srcInteger) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glReadPixels(integer / non-integer format mismatch");
-         return;
-      }
-   }
-
-   if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-      _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
-                  "glReadPixels(incomplete framebuffer)" );
-      return;
-   }
-
-   if (!_mesa_source_buffer_exists(ctx, format)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");
-      return;
-   }
-
-   if (width == 0 || height == 0)
-      return; /* nothing to do */
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
-      if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
-                                     format, type, pixels)) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glReadPixels(invalid PBO access)");
-         return;
-      }
-
-      if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
-         /* buffer is mapped - that's an error */
-         _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
-         return;
-      }
-   }
-
-   ctx->Driver.ReadPixels(ctx, x, y, width, height,
-			  format, type, &ctx->Pack, pixels);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "bufferobj.h"
+#include "context.h"
+#include "enums.h"
+#include "readpix.h"
+#include "framebuffer.h"
+#include "formats.h"
+#include "image.h"
+#include "mtypes.h"
+#include "pbo.h"
+#include "state.h"
+
+
+/**
+ * Do error checking of the format/type parameters to glReadPixels and
+ * glDrawPixels.
+ * \param drawing if GL_TRUE do checking for DrawPixels, else do checking
+ *                for ReadPixels.
+ * \return GL_TRUE if error detected, GL_FALSE if no errors
+ */
+GLboolean
+_mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
+                              GLenum type, GLboolean drawing)
+{
+   const char *readDraw = drawing ? "Draw" : "Read";
+   const GLboolean reading = !drawing;
+
+   /* state validation should have already been done */
+   ASSERT(ctx->NewState == 0x0);
+
+   if (ctx->Extensions.EXT_packed_depth_stencil
+       && type == GL_UNSIGNED_INT_24_8_EXT
+       && format != GL_DEPTH_STENCIL_EXT) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw);
+      return GL_TRUE;
+   }
+
+   /* basic combinations test */
+   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+      _mesa_error(ctx, GL_INVALID_ENUM,
+                  "gl%sPixels(format or type)", readDraw);
+      return GL_TRUE;
+   }
+
+   /* additional checks */
+   switch (format) {
+   case GL_RG:
+   case GL_RED:
+   case GL_GREEN:
+   case GL_BLUE:
+   case GL_ALPHA:
+   case GL_LUMINANCE:
+   case GL_LUMINANCE_ALPHA:
+   case GL_RGB:
+   case GL_BGR:
+   case GL_RGBA:
+   case GL_BGRA:
+   case GL_ABGR_EXT:
+   case GL_RED_INTEGER_EXT:
+   case GL_GREEN_INTEGER_EXT:
+   case GL_BLUE_INTEGER_EXT:
+   case GL_ALPHA_INTEGER_EXT:
+   case GL_RGB_INTEGER_EXT:
+   case GL_RGBA_INTEGER_EXT:
+   case GL_BGR_INTEGER_EXT:
+   case GL_BGRA_INTEGER_EXT:
+   case GL_LUMINANCE_INTEGER_EXT:
+   case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+      if (!drawing) {
+         /* reading */
+         if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
+            _mesa_error(ctx, GL_INVALID_OPERATION,
+                        "glReadPixels(no color buffer)");
+            return GL_TRUE;
+         }
+      }
+      break;
+   case GL_COLOR_INDEX:
+      if (drawing) {
+         if (ctx->PixelMaps.ItoR.Size == 0 ||
+	     ctx->PixelMaps.ItoG.Size == 0 ||
+	     ctx->PixelMaps.ItoB.Size == 0) {
+            _mesa_error(ctx, GL_INVALID_OPERATION,
+                   "glDrawPixels(drawing color index pixels into RGB buffer)");
+            return GL_TRUE;
+         }
+      }
+      else {
+         /* reading */
+         if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
+            _mesa_error(ctx, GL_INVALID_OPERATION,
+                        "glReadPixels(no color buffer)");
+            return GL_TRUE;
+         }
+         /* We no longer support CI-mode color buffers so trying to read
+          * GL_COLOR_INDEX pixels is always an error.
+          */
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glReadPixels(color buffer is RGB)");
+         return GL_TRUE;
+      }
+      break;
+   case GL_STENCIL_INDEX:
+      if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
+          (reading && !_mesa_source_buffer_exists(ctx, format))) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "gl%sPixels(no stencil buffer)", readDraw);
+         return GL_TRUE;
+      }
+      break;
+   case GL_DEPTH_COMPONENT:
+      if ((drawing && !_mesa_dest_buffer_exists(ctx, format))) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "gl%sPixels(no depth buffer)", readDraw);
+         return GL_TRUE;
+      }
+      break;
+   case GL_DEPTH_STENCIL_EXT:
+      if (!ctx->Extensions.EXT_packed_depth_stencil ||
+          type != GL_UNSIGNED_INT_24_8_EXT) {
+         _mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw);
+         return GL_TRUE;
+      }
+      if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
+          (reading && !_mesa_source_buffer_exists(ctx, format))) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "gl%sPixels(no depth or stencil buffer)", readDraw);
+         return GL_TRUE;
+      }
+      break;
+   default:
+      /* this should have been caught in _mesa_is_legal_format_type() */
+      _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw);
+      return GL_TRUE;
+   }
+
+   /* no errors */
+   return GL_FALSE;
+}
+      
+
+
+void GLAPIENTRY
+_mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
+		      GLenum format, GLenum type, GLsizei bufSize,
+                      GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   FLUSH_CURRENT(ctx, 0);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glReadPixels(%d, %d, %s, %s, %p)\n",
+                  width, height,
+                  _mesa_lookup_enum_by_nr(format),
+                  _mesa_lookup_enum_by_nr(type),
+                  pixels);
+
+   if (width < 0 || height < 0) {
+      _mesa_error( ctx, GL_INVALID_VALUE,
+                   "glReadPixels(width=%d height=%d)", width, height );
+      return;
+   }
+
+   if (ctx->NewState)
+      _mesa_update_state(ctx);
+
+   if (_mesa_error_check_format_type(ctx, format, type, GL_FALSE)) {
+      /* found an error */
+      return;
+   }
+
+   /* Check that the destination format and source buffer are both
+    * integer-valued or both non-integer-valued.
+    */
+   if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {
+      const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
+      const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
+      const GLboolean dstInteger = _mesa_is_integer_format(format);
+      if (dstInteger != srcInteger) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glReadPixels(integer / non-integer format mismatch");
+         return;
+      }
+   }
+
+   if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+      _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+                  "glReadPixels(incomplete framebuffer)" );
+      return;
+   }
+
+   if (!_mesa_source_buffer_exists(ctx, format)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");
+      return;
+   }
+
+   if (width == 0 || height == 0)
+      return; /* nothing to do */
+
+   if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
+                                  format, type, bufSize, pixels)) {
+      if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glReadPixels(out of bounds PBO access)");
+      } else {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glReadnPixelsARB(out of bounds access:"
+                     " bufSize (%d) is too small)", bufSize);
+      }
+      return;
+   }
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj) &&
+       _mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
+      /* buffer is mapped - that's an error */
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
+      return;
+   }
+
+   ctx->Driver.ReadPixels(ctx, x, y, width, height,
+			  format, type, &ctx->Pack, pixels);
+}
+
+void GLAPIENTRY
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+		  GLenum format, GLenum type, GLvoid *pixels )
+{
+   _mesa_ReadnPixelsARB(x, y, width, height, format, type, INT_MAX, pixels);
+}
diff --git a/mesalib/src/mesa/main/readpix.h b/mesalib/src/mesa/main/readpix.h
index 4ed5eb5a4..f6bb3d6e2 100644
--- a/mesalib/src/mesa/main/readpix.h
+++ b/mesalib/src/mesa/main/readpix.h
@@ -1,43 +1,47 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef READPIXELS_H
-#define READPIXELS_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-extern GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type,
-                              GLboolean drawing);
-
-extern void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
-                  GLenum format, GLenum type, GLvoid *pixels );
-
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef READPIXELS_H
+#define READPIXELS_H
+
+
+#include "glheader.h"
+
+struct gl_context;
+
+extern GLboolean
+_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type,
+                              GLboolean drawing);
+
+extern void GLAPIENTRY
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+                  GLenum format, GLenum type, GLvoid *pixels );
+
+extern void GLAPIENTRY
+_mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
+		      GLenum format, GLenum type, GLsizei bufSize,
+                      GLvoid *pixels );
+
+#endif
diff --git a/mesalib/src/mesa/main/remap_helper.h b/mesalib/src/mesa/main/remap_helper.h
index 72a2f1e0b..f506efcef 100644
--- a/mesalib/src/mesa/main/remap_helper.h
+++ b/mesalib/src/mesa/main/remap_helper.h
@@ -181,4663 +181,4743 @@ static const char _mesa_function_pool[] =
    "iiii\0"
    "glFramebufferTexture\0"
    "\0"
-   /* _mesa_function_pool[965]: VertexAttribI1ivEXT (will be remapped) */
-   "ip\0"
-   "glVertexAttribI1ivEXT\0"
-   "glVertexAttribI1iv\0"
+   /* _mesa_function_pool[965]: GetGraphicsResetStatusARB (will be remapped) */
    "\0"
-   /* _mesa_function_pool[1010]: TexImage4DSGIS (dynamic) */
+   "glGetGraphicsResetStatusARB\0"
+   "\0"
+   /* _mesa_function_pool[995]: TexImage4DSGIS (dynamic) */
    "iiiiiiiiiip\0"
    "glTexImage4DSGIS\0"
    "\0"
-   /* _mesa_function_pool[1040]: PolygonStipple (offset 175) */
+   /* _mesa_function_pool[1025]: PolygonStipple (offset 175) */
    "p\0"
    "glPolygonStipple\0"
    "\0"
-   /* _mesa_function_pool[1060]: WindowPos2dvMESA (will be remapped) */
+   /* _mesa_function_pool[1045]: WindowPos2dvMESA (will be remapped) */
    "p\0"
    "glWindowPos2dv\0"
    "glWindowPos2dvARB\0"
    "glWindowPos2dvMESA\0"
    "\0"
-   /* _mesa_function_pool[1115]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[1100]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiColor3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1159]: BlendEquationSeparateEXT (will be remapped) */
+   /* _mesa_function_pool[1144]: BlendEquationSeparateEXT (will be remapped) */
    "ii\0"
    "glBlendEquationSeparate\0"
    "glBlendEquationSeparateEXT\0"
    "glBlendEquationSeparateATI\0"
    "\0"
-   /* _mesa_function_pool[1241]: ListParameterfSGIX (dynamic) */
+   /* _mesa_function_pool[1226]: ListParameterfSGIX (dynamic) */
    "iif\0"
    "glListParameterfSGIX\0"
    "\0"
-   /* _mesa_function_pool[1267]: SecondaryColor3bEXT (will be remapped) */
+   /* _mesa_function_pool[1252]: SecondaryColor3bEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3b\0"
    "glSecondaryColor3bEXT\0"
    "\0"
-   /* _mesa_function_pool[1313]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */
+   /* _mesa_function_pool[1298]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */
    "pppp\0"
    "glTexCoord4fColor4fNormal3fVertex4fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1359]: GetPixelMapfv (offset 271) */
+   /* _mesa_function_pool[1344]: GetnPolygonStippleARB (will be remapped) */
+   "ip\0"
+   "glGetnPolygonStippleARB\0"
+   "\0"
+   /* _mesa_function_pool[1372]: GetPixelMapfv (offset 271) */
    "ip\0"
    "glGetPixelMapfv\0"
    "\0"
-   /* _mesa_function_pool[1379]: Color3uiv (offset 22) */
+   /* _mesa_function_pool[1392]: Color3uiv (offset 22) */
    "p\0"
    "glColor3uiv\0"
    "\0"
-   /* _mesa_function_pool[1394]: IsEnabled (offset 286) */
+   /* _mesa_function_pool[1407]: IsEnabled (offset 286) */
    "i\0"
    "glIsEnabled\0"
    "\0"
-   /* _mesa_function_pool[1409]: VertexAttrib4svNV (will be remapped) */
+   /* _mesa_function_pool[1422]: VertexAttrib4svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib4svNV\0"
    "\0"
-   /* _mesa_function_pool[1433]: EvalCoord2fv (offset 235) */
+   /* _mesa_function_pool[1446]: EvalCoord2fv (offset 235) */
    "p\0"
    "glEvalCoord2fv\0"
    "\0"
-   /* _mesa_function_pool[1451]: GetBufferSubDataARB (will be remapped) */
+   /* _mesa_function_pool[1464]: GetBufferSubDataARB (will be remapped) */
    "iiip\0"
    "glGetBufferSubData\0"
    "glGetBufferSubDataARB\0"
    "\0"
-   /* _mesa_function_pool[1498]: BufferSubDataARB (will be remapped) */
+   /* _mesa_function_pool[1511]: BufferSubDataARB (will be remapped) */
    "iiip\0"
    "glBufferSubData\0"
    "glBufferSubDataARB\0"
    "\0"
-   /* _mesa_function_pool[1539]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[1552]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */
    "ppp\0"
    "glTexCoord2fColor4ubVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1577]: AttachShader (will be remapped) */
+   /* _mesa_function_pool[1590]: AttachShader (will be remapped) */
    "ii\0"
    "glAttachShader\0"
    "\0"
-   /* _mesa_function_pool[1596]: VertexAttrib2fARB (will be remapped) */
+   /* _mesa_function_pool[1609]: GetCombinerInputParameterfvNV (will be remapped) */
+   "iiiip\0"
+   "glGetCombinerInputParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[1648]: VertexAttrib2fARB (will be remapped) */
    "iff\0"
    "glVertexAttrib2f\0"
    "glVertexAttrib2fARB\0"
    "\0"
-   /* _mesa_function_pool[1638]: GetDebugLogLengthMESA (dynamic) */
+   /* _mesa_function_pool[1690]: GetDebugLogLengthMESA (dynamic) */
    "iii\0"
    "glGetDebugLogLengthMESA\0"
    "\0"
-   /* _mesa_function_pool[1667]: GetMapiv (offset 268) */
+   /* _mesa_function_pool[1719]: GetMapiv (offset 268) */
    "iip\0"
    "glGetMapiv\0"
    "\0"
-   /* _mesa_function_pool[1683]: VertexAttrib3fARB (will be remapped) */
+   /* _mesa_function_pool[1735]: VertexAttrib3fARB (will be remapped) */
    "ifff\0"
    "glVertexAttrib3f\0"
    "glVertexAttrib3fARB\0"
    "\0"
-   /* _mesa_function_pool[1726]: Indexubv (offset 316) */
+   /* _mesa_function_pool[1778]: Indexubv (offset 316) */
    "p\0"
    "glIndexubv\0"
    "\0"
-   /* _mesa_function_pool[1740]: GetQueryivARB (will be remapped) */
+   /* _mesa_function_pool[1792]: GetQueryivARB (will be remapped) */
    "iip\0"
    "glGetQueryiv\0"
    "glGetQueryivARB\0"
    "\0"
-   /* _mesa_function_pool[1774]: TexImage3D (offset 371) */
+   /* _mesa_function_pool[1826]: TexImage3D (offset 371) */
    "iiiiiiiiip\0"
    "glTexImage3D\0"
    "glTexImage3DEXT\0"
    "\0"
-   /* _mesa_function_pool[1815]: BindFragDataLocationEXT (will be remapped) */
+   /* _mesa_function_pool[1867]: BindFragDataLocationEXT (will be remapped) */
    "iip\0"
    "glBindFragDataLocationEXT\0"
    "glBindFragDataLocation\0"
    "\0"
-   /* _mesa_function_pool[1869]: ReplacementCodeuiVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[1921]: ReplacementCodeuiVertex3fvSUN (dynamic) */
    "pp\0"
    "glReplacementCodeuiVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1905]: EdgeFlagPointer (offset 312) */
+   /* _mesa_function_pool[1957]: EdgeFlagPointer (offset 312) */
    "ip\0"
    "glEdgeFlagPointer\0"
    "\0"
-   /* _mesa_function_pool[1927]: Color3ubv (offset 20) */
+   /* _mesa_function_pool[1979]: Color3ubv (offset 20) */
    "p\0"
    "glColor3ubv\0"
    "\0"
-   /* _mesa_function_pool[1942]: GetQueryObjectivARB (will be remapped) */
+   /* _mesa_function_pool[1994]: GetQueryObjectivARB (will be remapped) */
    "iip\0"
    "glGetQueryObjectiv\0"
    "glGetQueryObjectivARB\0"
    "\0"
-   /* _mesa_function_pool[1988]: Vertex3dv (offset 135) */
+   /* _mesa_function_pool[2040]: Vertex3dv (offset 135) */
    "p\0"
    "glVertex3dv\0"
    "\0"
-   /* _mesa_function_pool[2003]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[2055]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiTexCoord2fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[2050]: CompressedTexSubImage2DARB (will be remapped) */
+   /* _mesa_function_pool[2102]: CompressedTexSubImage2DARB (will be remapped) */
    "iiiiiiiip\0"
    "glCompressedTexSubImage2D\0"
    "glCompressedTexSubImage2DARB\0"
    "\0"
-   /* _mesa_function_pool[2116]: CombinerOutputNV (will be remapped) */
+   /* _mesa_function_pool[2168]: CombinerOutputNV (will be remapped) */
    "iiiiiiiiii\0"
    "glCombinerOutputNV\0"
    "\0"
-   /* _mesa_function_pool[2147]: VertexAttribs3fvNV (will be remapped) */
+   /* _mesa_function_pool[2199]: VertexAttribs3fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs3fvNV\0"
    "\0"
-   /* _mesa_function_pool[2173]: Uniform2fARB (will be remapped) */
+   /* _mesa_function_pool[2225]: GetnMapivARB (will be remapped) */
+   "iiip\0"
+   "glGetnMapivARB\0"
+   "\0"
+   /* _mesa_function_pool[2246]: Uniform2fARB (will be remapped) */
    "iff\0"
    "glUniform2f\0"
    "glUniform2fARB\0"
    "\0"
-   /* _mesa_function_pool[2205]: LightModeliv (offset 166) */
+   /* _mesa_function_pool[2278]: LightModeliv (offset 166) */
    "ip\0"
    "glLightModeliv\0"
    "\0"
-   /* _mesa_function_pool[2224]: VertexAttrib1svARB (will be remapped) */
+   /* _mesa_function_pool[2297]: VertexAttrib1svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib1sv\0"
    "glVertexAttrib1svARB\0"
    "\0"
-   /* _mesa_function_pool[2267]: VertexAttribs1dvNV (will be remapped) */
+   /* _mesa_function_pool[2340]: VertexAttribs1dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs1dvNV\0"
    "\0"
-   /* _mesa_function_pool[2293]: Uniform2ivARB (will be remapped) */
+   /* _mesa_function_pool[2366]: Uniform2ivARB (will be remapped) */
    "iip\0"
    "glUniform2iv\0"
    "glUniform2ivARB\0"
    "\0"
-   /* _mesa_function_pool[2327]: GetImageTransformParameterfvHP (dynamic) */
+   /* _mesa_function_pool[2400]: GetImageTransformParameterfvHP (dynamic) */
    "iip\0"
    "glGetImageTransformParameterfvHP\0"
    "\0"
-   /* _mesa_function_pool[2365]: Normal3bv (offset 53) */
+   /* _mesa_function_pool[2438]: Normal3bv (offset 53) */
    "p\0"
    "glNormal3bv\0"
    "\0"
-   /* _mesa_function_pool[2380]: TexGeniv (offset 193) */
+   /* _mesa_function_pool[2453]: TexGeniv (offset 193) */
    "iip\0"
    "glTexGeniv\0"
    "\0"
-   /* _mesa_function_pool[2396]: WeightubvARB (dynamic) */
+   /* _mesa_function_pool[2469]: WeightubvARB (dynamic) */
    "ip\0"
    "glWeightubvARB\0"
    "\0"
-   /* _mesa_function_pool[2415]: VertexAttrib1fvNV (will be remapped) */
+   /* _mesa_function_pool[2488]: VertexAttrib1fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib1fvNV\0"
    "\0"
-   /* _mesa_function_pool[2439]: Vertex3iv (offset 139) */
+   /* _mesa_function_pool[2512]: Vertex3iv (offset 139) */
    "p\0"
    "glVertex3iv\0"
    "\0"
-   /* _mesa_function_pool[2454]: CopyConvolutionFilter1D (offset 354) */
+   /* _mesa_function_pool[2527]: CopyConvolutionFilter1D (offset 354) */
    "iiiii\0"
    "glCopyConvolutionFilter1D\0"
    "glCopyConvolutionFilter1DEXT\0"
    "\0"
-   /* _mesa_function_pool[2516]: VertexAttribI1uiEXT (will be remapped) */
+   /* _mesa_function_pool[2589]: VertexAttribI1uiEXT (will be remapped) */
    "ii\0"
    "glVertexAttribI1uiEXT\0"
    "glVertexAttribI1ui\0"
    "\0"
-   /* _mesa_function_pool[2561]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[2634]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */
    "iffffff\0"
    "glReplacementCodeuiNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[2609]: DeleteSync (will be remapped) */
+   /* _mesa_function_pool[2682]: DeleteSync (will be remapped) */
    "i\0"
    "glDeleteSync\0"
    "\0"
-   /* _mesa_function_pool[2625]: FragmentMaterialfvSGIX (dynamic) */
+   /* _mesa_function_pool[2698]: FragmentMaterialfvSGIX (dynamic) */
    "iip\0"
    "glFragmentMaterialfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[2655]: BlendColor (offset 336) */
+   /* _mesa_function_pool[2728]: BlendColor (offset 336) */
    "ffff\0"
    "glBlendColor\0"
    "glBlendColorEXT\0"
    "\0"
-   /* _mesa_function_pool[2690]: UniformMatrix4fvARB (will be remapped) */
+   /* _mesa_function_pool[2763]: UniformMatrix4fvARB (will be remapped) */
    "iiip\0"
    "glUniformMatrix4fv\0"
    "glUniformMatrix4fvARB\0"
    "\0"
-   /* _mesa_function_pool[2737]: DeleteVertexArraysAPPLE (will be remapped) */
+   /* _mesa_function_pool[2810]: DeleteVertexArraysAPPLE (will be remapped) */
    "ip\0"
    "glDeleteVertexArrays\0"
    "glDeleteVertexArraysAPPLE\0"
    "\0"
-   /* _mesa_function_pool[2788]: TexBuffer (will be remapped) */
+   /* _mesa_function_pool[2861]: TexBuffer (will be remapped) */
    "iii\0"
    "glTexBuffer\0"
    "\0"
-   /* _mesa_function_pool[2805]: ReadInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[2878]: ReadInstrumentsSGIX (dynamic) */
    "i\0"
    "glReadInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[2830]: CallLists (offset 3) */
+   /* _mesa_function_pool[2903]: CallLists (offset 3) */
    "iip\0"
    "glCallLists\0"
    "\0"
-   /* _mesa_function_pool[2847]: UniformMatrix2x4fv (will be remapped) */
+   /* _mesa_function_pool[2920]: UniformMatrix2x4fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix2x4fv\0"
    "\0"
-   /* _mesa_function_pool[2874]: Color4ubVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[2947]: ReadnPixelsARB (will be remapped) */
+   "iiiiiiip\0"
+   "glReadnPixelsARB\0"
+   "\0"
+   /* _mesa_function_pool[2974]: Color4ubVertex3fvSUN (dynamic) */
    "pp\0"
    "glColor4ubVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[2901]: Normal3iv (offset 59) */
+   /* _mesa_function_pool[3001]: Normal3iv (offset 59) */
    "p\0"
    "glNormal3iv\0"
    "\0"
-   /* _mesa_function_pool[2916]: PassThrough (offset 199) */
+   /* _mesa_function_pool[3016]: PassThrough (offset 199) */
    "f\0"
    "glPassThrough\0"
    "\0"
-   /* _mesa_function_pool[2933]: GetVertexAttribIivEXT (will be remapped) */
+   /* _mesa_function_pool[3033]: GetnPixelMapusvARB (will be remapped) */
    "iip\0"
-   "glGetVertexAttribIivEXT\0"
-   "glGetVertexAttribIiv\0"
+   "glGetnPixelMapusvARB\0"
    "\0"
-   /* _mesa_function_pool[2983]: TexParameterIivEXT (will be remapped) */
+   /* _mesa_function_pool[3059]: TexParameterIivEXT (will be remapped) */
    "iip\0"
    "glTexParameterIivEXT\0"
    "glTexParameterIiv\0"
    "\0"
-   /* _mesa_function_pool[3027]: FramebufferTextureLayerEXT (will be remapped) */
+   /* _mesa_function_pool[3103]: FramebufferTextureLayerEXT (will be remapped) */
    "iiiii\0"
    "glFramebufferTextureLayer\0"
    "glFramebufferTextureLayerEXT\0"
    "\0"
-   /* _mesa_function_pool[3089]: GetListParameterfvSGIX (dynamic) */
+   /* _mesa_function_pool[3165]: GetListParameterfvSGIX (dynamic) */
    "iip\0"
    "glGetListParameterfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[3119]: Viewport (offset 305) */
+   /* _mesa_function_pool[3195]: Viewport (offset 305) */
    "iiii\0"
    "glViewport\0"
    "\0"
-   /* _mesa_function_pool[3136]: VertexAttrib4NusvARB (will be remapped) */
+   /* _mesa_function_pool[3212]: VertexAttrib4NusvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nusv\0"
    "glVertexAttrib4NusvARB\0"
    "\0"
-   /* _mesa_function_pool[3183]: WindowPos4svMESA (will be remapped) */
+   /* _mesa_function_pool[3259]: WindowPos4svMESA (will be remapped) */
    "p\0"
    "glWindowPos4svMESA\0"
    "\0"
-   /* _mesa_function_pool[3205]: CreateProgramObjectARB (will be remapped) */
+   /* _mesa_function_pool[3281]: CreateProgramObjectARB (will be remapped) */
    "\0"
    "glCreateProgramObjectARB\0"
    "\0"
-   /* _mesa_function_pool[3232]: DeleteTransformFeedbacks (will be remapped) */
+   /* _mesa_function_pool[3308]: DeleteTransformFeedbacks (will be remapped) */
    "ip\0"
    "glDeleteTransformFeedbacks\0"
    "\0"
-   /* _mesa_function_pool[3263]: UniformMatrix4x3fv (will be remapped) */
+   /* _mesa_function_pool[3339]: UniformMatrix4x3fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix4x3fv\0"
    "\0"
-   /* _mesa_function_pool[3290]: PrioritizeTextures (offset 331) */
+   /* _mesa_function_pool[3366]: PrioritizeTextures (offset 331) */
    "ipp\0"
    "glPrioritizeTextures\0"
    "glPrioritizeTexturesEXT\0"
    "\0"
-   /* _mesa_function_pool[3340]: VertexAttribI3uiEXT (will be remapped) */
+   /* _mesa_function_pool[3416]: VertexAttribI3uiEXT (will be remapped) */
    "iiii\0"
    "glVertexAttribI3uiEXT\0"
    "glVertexAttribI3ui\0"
    "\0"
-   /* _mesa_function_pool[3387]: AsyncMarkerSGIX (dynamic) */
+   /* _mesa_function_pool[3463]: AsyncMarkerSGIX (dynamic) */
    "i\0"
    "glAsyncMarkerSGIX\0"
    "\0"
-   /* _mesa_function_pool[3408]: GlobalAlphaFactorubSUN (dynamic) */
+   /* _mesa_function_pool[3484]: GlobalAlphaFactorubSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorubSUN\0"
    "\0"
-   /* _mesa_function_pool[3436]: ClearColorIuiEXT (will be remapped) */
+   /* _mesa_function_pool[3512]: ClearColorIuiEXT (will be remapped) */
    "iiii\0"
    "glClearColorIuiEXT\0"
    "\0"
-   /* _mesa_function_pool[3461]: ClearDebugLogMESA (dynamic) */
+   /* _mesa_function_pool[3537]: ClearDebugLogMESA (dynamic) */
    "iii\0"
    "glClearDebugLogMESA\0"
    "\0"
-   /* _mesa_function_pool[3486]: Uniform4uiEXT (will be remapped) */
+   /* _mesa_function_pool[3562]: Uniform4uiEXT (will be remapped) */
    "iiiii\0"
    "glUniform4uiEXT\0"
    "glUniform4ui\0"
    "\0"
-   /* _mesa_function_pool[3522]: ResetHistogram (offset 369) */
+   /* _mesa_function_pool[3598]: ResetHistogram (offset 369) */
    "i\0"
    "glResetHistogram\0"
    "glResetHistogramEXT\0"
    "\0"
-   /* _mesa_function_pool[3562]: GetProgramNamedParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[3638]: GetProgramNamedParameterfvNV (will be remapped) */
    "iipp\0"
    "glGetProgramNamedParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[3599]: PointParameterfEXT (will be remapped) */
+   /* _mesa_function_pool[3675]: PointParameterfEXT (will be remapped) */
    "if\0"
    "glPointParameterf\0"
    "glPointParameterfARB\0"
    "glPointParameterfEXT\0"
    "glPointParameterfSGIS\0"
    "\0"
-   /* _mesa_function_pool[3685]: LoadIdentityDeformationMapSGIX (dynamic) */
+   /* _mesa_function_pool[3761]: LoadIdentityDeformationMapSGIX (dynamic) */
    "i\0"
    "glLoadIdentityDeformationMapSGIX\0"
    "\0"
-   /* _mesa_function_pool[3721]: GenFencesNV (will be remapped) */
+   /* _mesa_function_pool[3797]: GenFencesNV (will be remapped) */
    "ip\0"
    "glGenFencesNV\0"
    "\0"
-   /* _mesa_function_pool[3739]: ImageTransformParameterfHP (dynamic) */
+   /* _mesa_function_pool[3815]: ImageTransformParameterfHP (dynamic) */
    "iif\0"
    "glImageTransformParameterfHP\0"
    "\0"
-   /* _mesa_function_pool[3773]: MatrixIndexusvARB (dynamic) */
+   /* _mesa_function_pool[3849]: MatrixIndexusvARB (dynamic) */
    "ip\0"
    "glMatrixIndexusvARB\0"
    "\0"
-   /* _mesa_function_pool[3797]: DrawElementsBaseVertex (will be remapped) */
+   /* _mesa_function_pool[3873]: DrawElementsBaseVertex (will be remapped) */
    "iiipi\0"
    "glDrawElementsBaseVertex\0"
    "\0"
-   /* _mesa_function_pool[3829]: DisableVertexAttribArrayARB (will be remapped) */
+   /* _mesa_function_pool[3905]: DisableVertexAttribArrayARB (will be remapped) */
    "i\0"
    "glDisableVertexAttribArray\0"
    "glDisableVertexAttribArrayARB\0"
    "\0"
-   /* _mesa_function_pool[3889]: TexCoord2sv (offset 109) */
+   /* _mesa_function_pool[3965]: GetnConvolutionFilterARB (will be remapped) */
+   "iiiip\0"
+   "glGetnConvolutionFilterARB\0"
+   "\0"
+   /* _mesa_function_pool[3999]: TexCoord2sv (offset 109) */
    "p\0"
    "glTexCoord2sv\0"
    "\0"
-   /* _mesa_function_pool[3906]: Vertex4dv (offset 143) */
+   /* _mesa_function_pool[4016]: Vertex4dv (offset 143) */
    "p\0"
    "glVertex4dv\0"
    "\0"
-   /* _mesa_function_pool[3921]: StencilMaskSeparate (will be remapped) */
+   /* _mesa_function_pool[4031]: StencilMaskSeparate (will be remapped) */
    "ii\0"
    "glStencilMaskSeparate\0"
    "\0"
-   /* _mesa_function_pool[3947]: ProgramLocalParameter4dARB (will be remapped) */
+   /* _mesa_function_pool[4057]: ProgramLocalParameter4dARB (will be remapped) */
    "iidddd\0"
    "glProgramLocalParameter4dARB\0"
    "\0"
-   /* _mesa_function_pool[3984]: CompressedTexImage3DARB (will be remapped) */
+   /* _mesa_function_pool[4094]: CompressedTexImage3DARB (will be remapped) */
    "iiiiiiiip\0"
    "glCompressedTexImage3D\0"
    "glCompressedTexImage3DARB\0"
    "\0"
-   /* _mesa_function_pool[4044]: Color3sv (offset 18) */
+   /* _mesa_function_pool[4154]: Color3sv (offset 18) */
    "p\0"
    "glColor3sv\0"
    "\0"
-   /* _mesa_function_pool[4058]: GetConvolutionParameteriv (offset 358) */
+   /* _mesa_function_pool[4168]: GetConvolutionParameteriv (offset 358) */
    "iip\0"
    "glGetConvolutionParameteriv\0"
    "glGetConvolutionParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[4122]: DeleteSamplers (will be remapped) */
+   /* _mesa_function_pool[4232]: DeleteSamplers (will be remapped) */
    "ip\0"
    "glDeleteSamplers\0"
    "\0"
-   /* _mesa_function_pool[4143]: VertexAttrib1fARB (will be remapped) */
+   /* _mesa_function_pool[4253]: VertexAttrib1fARB (will be remapped) */
    "if\0"
    "glVertexAttrib1f\0"
    "glVertexAttrib1fARB\0"
    "\0"
-   /* _mesa_function_pool[4184]: Vertex2dv (offset 127) */
+   /* _mesa_function_pool[4294]: Vertex2dv (offset 127) */
    "p\0"
    "glVertex2dv\0"
    "\0"
-   /* _mesa_function_pool[4199]: TestFenceNV (will be remapped) */
+   /* _mesa_function_pool[4309]: TestFenceNV (will be remapped) */
    "i\0"
    "glTestFenceNV\0"
    "\0"
-   /* _mesa_function_pool[4216]: GetVertexAttribIuivEXT (will be remapped) */
+   /* _mesa_function_pool[4326]: GetVertexAttribIuivEXT (will be remapped) */
    "iip\0"
    "glGetVertexAttribIuivEXT\0"
    "glGetVertexAttribIuiv\0"
    "\0"
-   /* _mesa_function_pool[4268]: MultiTexCoord1fvARB (offset 379) */
+   /* _mesa_function_pool[4378]: MultiTexCoord1fvARB (offset 379) */
    "ip\0"
    "glMultiTexCoord1fv\0"
    "glMultiTexCoord1fvARB\0"
    "\0"
-   /* _mesa_function_pool[4313]: TexCoord3iv (offset 115) */
+   /* _mesa_function_pool[4423]: TexCoord3iv (offset 115) */
    "p\0"
    "glTexCoord3iv\0"
    "\0"
-   /* _mesa_function_pool[4330]: Uniform2uivEXT (will be remapped) */
+   /* _mesa_function_pool[4440]: Uniform2uivEXT (will be remapped) */
    "iip\0"
    "glUniform2uivEXT\0"
    "glUniform2uiv\0"
    "\0"
-   /* _mesa_function_pool[4366]: ColorFragmentOp2ATI (will be remapped) */
+   /* _mesa_function_pool[4476]: ColorFragmentOp2ATI (will be remapped) */
    "iiiiiiiiii\0"
    "glColorFragmentOp2ATI\0"
    "\0"
-   /* _mesa_function_pool[4400]: SecondaryColorPointerListIBM (dynamic) */
+   /* _mesa_function_pool[4510]: SecondaryColorPointerListIBM (dynamic) */
    "iiipi\0"
    "glSecondaryColorPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[4438]: GetPixelTexGenParameterivSGIS (will be remapped) */
+   /* _mesa_function_pool[4548]: GetPixelTexGenParameterivSGIS (will be remapped) */
    "ip\0"
    "glGetPixelTexGenParameterivSGIS\0"
    "\0"
-   /* _mesa_function_pool[4474]: Color3fv (offset 14) */
+   /* _mesa_function_pool[4584]: Color3fv (offset 14) */
    "p\0"
    "glColor3fv\0"
    "\0"
-   /* _mesa_function_pool[4488]: VertexAttrib4fNV (will be remapped) */
-   "iffff\0"
-   "glVertexAttrib4fNV\0"
+   /* _mesa_function_pool[4598]: GetnPixelMapfvARB (will be remapped) */
+   "iip\0"
+   "glGetnPixelMapfvARB\0"
    "\0"
-   /* _mesa_function_pool[4514]: ReplacementCodeubSUN (dynamic) */
+   /* _mesa_function_pool[4623]: ReplacementCodeubSUN (dynamic) */
    "i\0"
    "glReplacementCodeubSUN\0"
    "\0"
-   /* _mesa_function_pool[4540]: FinishAsyncSGIX (dynamic) */
+   /* _mesa_function_pool[4649]: FinishAsyncSGIX (dynamic) */
    "p\0"
    "glFinishAsyncSGIX\0"
    "\0"
-   /* _mesa_function_pool[4561]: GetDebugLogMESA (dynamic) */
+   /* _mesa_function_pool[4670]: GetnUniformfvARB (will be remapped) */
+   "iiip\0"
+   "glGetnUniformfvARB\0"
+   "\0"
+   /* _mesa_function_pool[4695]: GetDebugLogMESA (dynamic) */
    "iiiipp\0"
    "glGetDebugLogMESA\0"
    "\0"
-   /* _mesa_function_pool[4587]: FogCoorddEXT (will be remapped) */
+   /* _mesa_function_pool[4721]: FogCoorddEXT (will be remapped) */
    "d\0"
    "glFogCoordd\0"
    "glFogCoorddEXT\0"
    "\0"
-   /* _mesa_function_pool[4617]: BeginConditionalRenderNV (will be remapped) */
+   /* _mesa_function_pool[4751]: BeginConditionalRenderNV (will be remapped) */
    "ii\0"
    "glBeginConditionalRenderNV\0"
    "glBeginConditionalRender\0"
    "\0"
-   /* _mesa_function_pool[4673]: Color4ubVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[4807]: Color4ubVertex3fSUN (dynamic) */
    "iiiifff\0"
    "glColor4ubVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[4704]: FogCoordfEXT (will be remapped) */
+   /* _mesa_function_pool[4838]: FogCoordfEXT (will be remapped) */
    "f\0"
    "glFogCoordf\0"
    "glFogCoordfEXT\0"
    "\0"
-   /* _mesa_function_pool[4734]: PointSize (offset 173) */
+   /* _mesa_function_pool[4868]: PointSize (offset 173) */
    "f\0"
    "glPointSize\0"
    "\0"
-   /* _mesa_function_pool[4749]: VertexAttribI2uivEXT (will be remapped) */
+   /* _mesa_function_pool[4883]: VertexAttribI2uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI2uivEXT\0"
    "glVertexAttribI2uiv\0"
    "\0"
-   /* _mesa_function_pool[4796]: TexCoord2fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[4930]: TexCoord2fVertex3fSUN (dynamic) */
    "fffff\0"
    "glTexCoord2fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[4827]: PopName (offset 200) */
+   /* _mesa_function_pool[4961]: PopName (offset 200) */
    "\0"
    "glPopName\0"
    "\0"
-   /* _mesa_function_pool[4839]: GetSamplerParameterfv (will be remapped) */
+   /* _mesa_function_pool[4973]: GetSamplerParameterfv (will be remapped) */
    "iip\0"
    "glGetSamplerParameterfv\0"
    "\0"
-   /* _mesa_function_pool[4868]: GlobalAlphaFactoriSUN (dynamic) */
+   /* _mesa_function_pool[5002]: GlobalAlphaFactoriSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactoriSUN\0"
    "\0"
-   /* _mesa_function_pool[4895]: VertexAttrib2dNV (will be remapped) */
+   /* _mesa_function_pool[5029]: VertexAttrib2dNV (will be remapped) */
    "idd\0"
    "glVertexAttrib2dNV\0"
    "\0"
-   /* _mesa_function_pool[4919]: GetProgramInfoLog (will be remapped) */
+   /* _mesa_function_pool[5053]: GetProgramInfoLog (will be remapped) */
    "iipp\0"
    "glGetProgramInfoLog\0"
    "\0"
-   /* _mesa_function_pool[4945]: VertexAttrib4NbvARB (will be remapped) */
+   /* _mesa_function_pool[5079]: VertexAttrib4NbvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nbv\0"
    "glVertexAttrib4NbvARB\0"
    "\0"
-   /* _mesa_function_pool[4990]: GetActiveAttribARB (will be remapped) */
+   /* _mesa_function_pool[5124]: GetActiveAttribARB (will be remapped) */
    "iiipppp\0"
    "glGetActiveAttrib\0"
    "glGetActiveAttribARB\0"
    "\0"
-   /* _mesa_function_pool[5038]: Vertex4sv (offset 149) */
+   /* _mesa_function_pool[5172]: Vertex4sv (offset 149) */
    "p\0"
    "glVertex4sv\0"
    "\0"
-   /* _mesa_function_pool[5053]: VertexAttrib4ubNV (will be remapped) */
+   /* _mesa_function_pool[5187]: VertexAttrib4ubNV (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4ubNV\0"
    "\0"
-   /* _mesa_function_pool[5080]: ClampColor (will be remapped) */
+   /* _mesa_function_pool[5214]: VertexAttribI1ivEXT (will be remapped) */
+   "ip\0"
+   "glVertexAttribI1ivEXT\0"
+   "glVertexAttribI1iv\0"
+   "\0"
+   /* _mesa_function_pool[5259]: ClampColor (will be remapped) */
    "ii\0"
    "glClampColor\0"
    "\0"
-   /* _mesa_function_pool[5097]: TextureRangeAPPLE (will be remapped) */
+   /* _mesa_function_pool[5276]: TextureRangeAPPLE (will be remapped) */
    "iip\0"
    "glTextureRangeAPPLE\0"
    "\0"
-   /* _mesa_function_pool[5122]: GetTexEnvfv (offset 276) */
+   /* _mesa_function_pool[5301]: GetTexEnvfv (offset 276) */
    "iip\0"
    "glGetTexEnvfv\0"
    "\0"
-   /* _mesa_function_pool[5141]: BindTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[5320]: BindTransformFeedback (will be remapped) */
    "ii\0"
    "glBindTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[5169]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[5348]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
    "ffffffffffff\0"
    "glTexCoord2fColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[5222]: Indexub (offset 315) */
+   /* _mesa_function_pool[5401]: Indexub (offset 315) */
    "i\0"
    "glIndexub\0"
    "\0"
-   /* _mesa_function_pool[5235]: TexEnvi (offset 186) */
+   /* _mesa_function_pool[5414]: VertexAttrib4fNV (will be remapped) */
+   "iffff\0"
+   "glVertexAttrib4fNV\0"
+   "\0"
+   /* _mesa_function_pool[5440]: TexEnvi (offset 186) */
    "iii\0"
    "glTexEnvi\0"
    "\0"
-   /* _mesa_function_pool[5250]: GetClipPlane (offset 259) */
+   /* _mesa_function_pool[5455]: GetClipPlane (offset 259) */
    "ip\0"
    "glGetClipPlane\0"
    "\0"
-   /* _mesa_function_pool[5269]: CombinerParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[5474]: CombinerParameterfvNV (will be remapped) */
    "ip\0"
    "glCombinerParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[5297]: VertexAttribs3dvNV (will be remapped) */
+   /* _mesa_function_pool[5502]: VertexAttribs3dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs3dvNV\0"
    "\0"
-   /* _mesa_function_pool[5323]: VertexAttribI2uiEXT (will be remapped) */
+   /* _mesa_function_pool[5528]: VertexAttribI2uiEXT (will be remapped) */
    "iii\0"
    "glVertexAttribI2uiEXT\0"
    "glVertexAttribI2ui\0"
    "\0"
-   /* _mesa_function_pool[5369]: VertexAttribs4fvNV (will be remapped) */
+   /* _mesa_function_pool[5574]: VertexAttribs4fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4fvNV\0"
    "\0"
-   /* _mesa_function_pool[5395]: VertexArrayRangeNV (will be remapped) */
+   /* _mesa_function_pool[5600]: VertexArrayRangeNV (will be remapped) */
    "ip\0"
    "glVertexArrayRangeNV\0"
    "\0"
-   /* _mesa_function_pool[5420]: FragmentLightiSGIX (dynamic) */
+   /* _mesa_function_pool[5625]: FragmentLightiSGIX (dynamic) */
    "iii\0"
    "glFragmentLightiSGIX\0"
    "\0"
-   /* _mesa_function_pool[5446]: PolygonOffsetEXT (will be remapped) */
+   /* _mesa_function_pool[5651]: PolygonOffsetEXT (will be remapped) */
    "ff\0"
    "glPolygonOffsetEXT\0"
    "\0"
-   /* _mesa_function_pool[5469]: VertexAttribI4uivEXT (will be remapped) */
+   /* _mesa_function_pool[5674]: VertexAttribI4uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4uivEXT\0"
    "glVertexAttribI4uiv\0"
    "\0"
-   /* _mesa_function_pool[5516]: PollAsyncSGIX (dynamic) */
+   /* _mesa_function_pool[5721]: PollAsyncSGIX (dynamic) */
    "p\0"
    "glPollAsyncSGIX\0"
    "\0"
-   /* _mesa_function_pool[5535]: DeleteFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[5740]: DeleteFragmentShaderATI (will be remapped) */
    "i\0"
    "glDeleteFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[5564]: Scaled (offset 301) */
+   /* _mesa_function_pool[5769]: Scaled (offset 301) */
    "ddd\0"
    "glScaled\0"
    "\0"
-   /* _mesa_function_pool[5578]: ResumeTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[5783]: ResumeTransformFeedback (will be remapped) */
    "\0"
    "glResumeTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[5606]: Scalef (offset 302) */
+   /* _mesa_function_pool[5811]: Scalef (offset 302) */
    "fff\0"
    "glScalef\0"
    "\0"
-   /* _mesa_function_pool[5620]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[5825]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glTexCoord2fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[5658]: ProgramEnvParameters4fvEXT (will be remapped) */
+   /* _mesa_function_pool[5863]: ProgramEnvParameters4fvEXT (will be remapped) */
    "iiip\0"
    "glProgramEnvParameters4fvEXT\0"
    "\0"
-   /* _mesa_function_pool[5693]: MultTransposeMatrixdARB (will be remapped) */
+   /* _mesa_function_pool[5898]: MultTransposeMatrixdARB (will be remapped) */
    "p\0"
    "glMultTransposeMatrixd\0"
    "glMultTransposeMatrixdARB\0"
    "\0"
-   /* _mesa_function_pool[5745]: ColorMaskIndexedEXT (will be remapped) */
+   /* _mesa_function_pool[5950]: ColorMaskIndexedEXT (will be remapped) */
    "iiiii\0"
    "glColorMaskIndexedEXT\0"
    "glColorMaski\0"
    "\0"
-   /* _mesa_function_pool[5787]: ObjectUnpurgeableAPPLE (will be remapped) */
+   /* _mesa_function_pool[5992]: ObjectUnpurgeableAPPLE (will be remapped) */
    "iii\0"
    "glObjectUnpurgeableAPPLE\0"
    "\0"
-   /* _mesa_function_pool[5817]: AlphaFunc (offset 240) */
+   /* _mesa_function_pool[6022]: AlphaFunc (offset 240) */
    "if\0"
    "glAlphaFunc\0"
    "\0"
-   /* _mesa_function_pool[5833]: WindowPos2svMESA (will be remapped) */
+   /* _mesa_function_pool[6038]: WindowPos2svMESA (will be remapped) */
    "p\0"
    "glWindowPos2sv\0"
    "glWindowPos2svARB\0"
    "glWindowPos2svMESA\0"
    "\0"
-   /* _mesa_function_pool[5888]: EdgeFlag (offset 41) */
+   /* _mesa_function_pool[6093]: EdgeFlag (offset 41) */
    "i\0"
    "glEdgeFlag\0"
    "\0"
-   /* _mesa_function_pool[5902]: TexCoord2iv (offset 107) */
+   /* _mesa_function_pool[6107]: TexCoord2iv (offset 107) */
    "p\0"
    "glTexCoord2iv\0"
    "\0"
-   /* _mesa_function_pool[5919]: CompressedTexImage1DARB (will be remapped) */
+   /* _mesa_function_pool[6124]: CompressedTexImage1DARB (will be remapped) */
    "iiiiiip\0"
    "glCompressedTexImage1D\0"
    "glCompressedTexImage1DARB\0"
    "\0"
-   /* _mesa_function_pool[5977]: Rotated (offset 299) */
+   /* _mesa_function_pool[6182]: Rotated (offset 299) */
    "dddd\0"
    "glRotated\0"
    "\0"
-   /* _mesa_function_pool[5993]: GetTexParameterIuivEXT (will be remapped) */
+   /* _mesa_function_pool[6198]: GetTexParameterIuivEXT (will be remapped) */
    "iip\0"
    "glGetTexParameterIuivEXT\0"
    "glGetTexParameterIuiv\0"
    "\0"
-   /* _mesa_function_pool[6045]: VertexAttrib2sNV (will be remapped) */
+   /* _mesa_function_pool[6250]: VertexAttrib2sNV (will be remapped) */
    "iii\0"
    "glVertexAttrib2sNV\0"
    "\0"
-   /* _mesa_function_pool[6069]: ReadPixels (offset 256) */
+   /* _mesa_function_pool[6274]: ReadPixels (offset 256) */
    "iiiiiip\0"
    "glReadPixels\0"
    "\0"
-   /* _mesa_function_pool[6091]: EdgeFlagv (offset 42) */
+   /* _mesa_function_pool[6296]: VertexAttribDivisorARB (will be remapped) */
+   "ii\0"
+   "glVertexAttribDivisorARB\0"
+   "\0"
+   /* _mesa_function_pool[6325]: EdgeFlagv (offset 42) */
    "p\0"
    "glEdgeFlagv\0"
    "\0"
-   /* _mesa_function_pool[6106]: NormalPointerListIBM (dynamic) */
+   /* _mesa_function_pool[6340]: NormalPointerListIBM (dynamic) */
    "iipi\0"
    "glNormalPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[6135]: IndexPointerEXT (will be remapped) */
+   /* _mesa_function_pool[6369]: IndexPointerEXT (will be remapped) */
    "iiip\0"
    "glIndexPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[6159]: Color4iv (offset 32) */
+   /* _mesa_function_pool[6393]: Color4iv (offset 32) */
    "p\0"
    "glColor4iv\0"
    "\0"
-   /* _mesa_function_pool[6173]: TexParameterf (offset 178) */
+   /* _mesa_function_pool[6407]: TexParameterf (offset 178) */
    "iif\0"
    "glTexParameterf\0"
    "\0"
-   /* _mesa_function_pool[6194]: TexParameteri (offset 180) */
+   /* _mesa_function_pool[6428]: TexParameteri (offset 180) */
    "iii\0"
    "glTexParameteri\0"
    "\0"
-   /* _mesa_function_pool[6215]: NormalPointerEXT (will be remapped) */
+   /* _mesa_function_pool[6449]: NormalPointerEXT (will be remapped) */
    "iiip\0"
    "glNormalPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[6240]: MultiTexCoord3dARB (offset 392) */
+   /* _mesa_function_pool[6474]: MultiTexCoord3dARB (offset 392) */
    "iddd\0"
    "glMultiTexCoord3d\0"
    "glMultiTexCoord3dARB\0"
    "\0"
-   /* _mesa_function_pool[6285]: MultiTexCoord2iARB (offset 388) */
+   /* _mesa_function_pool[6519]: MultiTexCoord2iARB (offset 388) */
    "iii\0"
    "glMultiTexCoord2i\0"
    "glMultiTexCoord2iARB\0"
    "\0"
-   /* _mesa_function_pool[6329]: DrawPixels (offset 257) */
+   /* _mesa_function_pool[6563]: DrawPixels (offset 257) */
    "iiiip\0"
    "glDrawPixels\0"
    "\0"
-   /* _mesa_function_pool[6349]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[6583]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */
    "iffffffff\0"
    "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[6409]: MultiTexCoord2svARB (offset 391) */
+   /* _mesa_function_pool[6643]: MultiTexCoord2svARB (offset 391) */
    "ip\0"
    "glMultiTexCoord2sv\0"
    "glMultiTexCoord2svARB\0"
    "\0"
-   /* _mesa_function_pool[6454]: ReplacementCodeubvSUN (dynamic) */
+   /* _mesa_function_pool[6688]: ReplacementCodeubvSUN (dynamic) */
    "p\0"
    "glReplacementCodeubvSUN\0"
    "\0"
-   /* _mesa_function_pool[6481]: Uniform3iARB (will be remapped) */
+   /* _mesa_function_pool[6715]: Uniform3iARB (will be remapped) */
    "iiii\0"
    "glUniform3i\0"
    "glUniform3iARB\0"
    "\0"
-   /* _mesa_function_pool[6514]: DrawTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[6748]: DrawTransformFeedback (will be remapped) */
    "ii\0"
    "glDrawTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[6542]: DrawElementsInstancedARB (will be remapped) */
+   /* _mesa_function_pool[6776]: DrawElementsInstancedARB (will be remapped) */
    "iiipi\0"
    "glDrawElementsInstancedARB\0"
    "glDrawElementsInstancedEXT\0"
    "glDrawElementsInstanced\0"
    "\0"
-   /* _mesa_function_pool[6627]: GetShaderInfoLog (will be remapped) */
+   /* _mesa_function_pool[6861]: GetShaderInfoLog (will be remapped) */
    "iipp\0"
    "glGetShaderInfoLog\0"
    "\0"
-   /* _mesa_function_pool[6652]: WeightivARB (dynamic) */
+   /* _mesa_function_pool[6886]: WeightivARB (dynamic) */
    "ip\0"
    "glWeightivARB\0"
    "\0"
-   /* _mesa_function_pool[6670]: PollInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[6904]: PollInstrumentsSGIX (dynamic) */
    "p\0"
    "glPollInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[6695]: GlobalAlphaFactordSUN (dynamic) */
+   /* _mesa_function_pool[6929]: GlobalAlphaFactordSUN (dynamic) */
    "d\0"
    "glGlobalAlphaFactordSUN\0"
    "\0"
-   /* _mesa_function_pool[6722]: GetFinalCombinerInputParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[6956]: GetFinalCombinerInputParameterfvNV (will be remapped) */
    "iip\0"
    "glGetFinalCombinerInputParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[6764]: GenerateMipmapEXT (will be remapped) */
+   /* _mesa_function_pool[6998]: GenerateMipmapEXT (will be remapped) */
    "i\0"
    "glGenerateMipmap\0"
    "glGenerateMipmapEXT\0"
    "\0"
-   /* _mesa_function_pool[6804]: GenLists (offset 5) */
+   /* _mesa_function_pool[7038]: GenLists (offset 5) */
    "i\0"
    "glGenLists\0"
    "\0"
-   /* _mesa_function_pool[6818]: DepthRangef (will be remapped) */
+   /* _mesa_function_pool[7052]: DepthRangef (will be remapped) */
    "ff\0"
    "glDepthRangef\0"
    "\0"
-   /* _mesa_function_pool[6836]: GetMapAttribParameterivNV (dynamic) */
+   /* _mesa_function_pool[7070]: GetMapAttribParameterivNV (dynamic) */
    "iiip\0"
    "glGetMapAttribParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[6870]: CreateShaderObjectARB (will be remapped) */
+   /* _mesa_function_pool[7104]: CreateShaderObjectARB (will be remapped) */
    "i\0"
    "glCreateShaderObjectARB\0"
    "\0"
-   /* _mesa_function_pool[6897]: GetSharpenTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[7131]: GetSharpenTexFuncSGIS (dynamic) */
    "ip\0"
    "glGetSharpenTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[6925]: BufferDataARB (will be remapped) */
+   /* _mesa_function_pool[7159]: BufferDataARB (will be remapped) */
    "iipi\0"
    "glBufferData\0"
    "glBufferDataARB\0"
    "\0"
-   /* _mesa_function_pool[6960]: FlushVertexArrayRangeNV (will be remapped) */
+   /* _mesa_function_pool[7194]: FlushVertexArrayRangeNV (will be remapped) */
    "\0"
    "glFlushVertexArrayRangeNV\0"
    "\0"
-   /* _mesa_function_pool[6988]: MapGrid2d (offset 226) */
+   /* _mesa_function_pool[7222]: MapGrid2d (offset 226) */
    "iddidd\0"
    "glMapGrid2d\0"
    "\0"
-   /* _mesa_function_pool[7008]: MapGrid2f (offset 227) */
+   /* _mesa_function_pool[7242]: MapGrid2f (offset 227) */
    "iffiff\0"
    "glMapGrid2f\0"
    "\0"
-   /* _mesa_function_pool[7028]: SampleMapATI (will be remapped) */
+   /* _mesa_function_pool[7262]: SampleMapATI (will be remapped) */
    "iii\0"
    "glSampleMapATI\0"
    "\0"
-   /* _mesa_function_pool[7048]: VertexPointerEXT (will be remapped) */
+   /* _mesa_function_pool[7282]: VertexPointerEXT (will be remapped) */
    "iiiip\0"
    "glVertexPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[7074]: GetTexFilterFuncSGIS (dynamic) */
+   /* _mesa_function_pool[7308]: GetTexFilterFuncSGIS (dynamic) */
    "iip\0"
    "glGetTexFilterFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[7102]: Scissor (offset 176) */
+   /* _mesa_function_pool[7336]: Scissor (offset 176) */
    "iiii\0"
    "glScissor\0"
    "\0"
-   /* _mesa_function_pool[7118]: Fogf (offset 153) */
+   /* _mesa_function_pool[7352]: Fogf (offset 153) */
    "if\0"
    "glFogf\0"
    "\0"
-   /* _mesa_function_pool[7129]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[7363]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiColor4ubVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[7174]: TexSubImage1D (offset 332) */
+   /* _mesa_function_pool[7408]: TexSubImage1D (offset 332) */
    "iiiiiip\0"
    "glTexSubImage1D\0"
    "glTexSubImage1DEXT\0"
    "\0"
-   /* _mesa_function_pool[7218]: VertexAttrib1sARB (will be remapped) */
+   /* _mesa_function_pool[7452]: VertexAttrib1sARB (will be remapped) */
    "ii\0"
    "glVertexAttrib1s\0"
    "glVertexAttrib1sARB\0"
    "\0"
-   /* _mesa_function_pool[7259]: FenceSync (will be remapped) */
+   /* _mesa_function_pool[7493]: FenceSync (will be remapped) */
    "ii\0"
    "glFenceSync\0"
    "\0"
-   /* _mesa_function_pool[7275]: Color4usv (offset 40) */
+   /* _mesa_function_pool[7509]: Color4usv (offset 40) */
    "p\0"
    "glColor4usv\0"
    "\0"
-   /* _mesa_function_pool[7290]: Fogi (offset 155) */
+   /* _mesa_function_pool[7524]: Fogi (offset 155) */
    "ii\0"
    "glFogi\0"
    "\0"
-   /* _mesa_function_pool[7301]: DepthRange (offset 288) */
+   /* _mesa_function_pool[7535]: DepthRange (offset 288) */
    "dd\0"
    "glDepthRange\0"
    "\0"
-   /* _mesa_function_pool[7318]: RasterPos3iv (offset 75) */
+   /* _mesa_function_pool[7552]: RasterPos3iv (offset 75) */
    "p\0"
    "glRasterPos3iv\0"
    "\0"
-   /* _mesa_function_pool[7336]: FinalCombinerInputNV (will be remapped) */
+   /* _mesa_function_pool[7570]: FinalCombinerInputNV (will be remapped) */
    "iiii\0"
    "glFinalCombinerInputNV\0"
    "\0"
-   /* _mesa_function_pool[7365]: TexCoord2i (offset 106) */
+   /* _mesa_function_pool[7599]: TexCoord2i (offset 106) */
    "ii\0"
    "glTexCoord2i\0"
    "\0"
-   /* _mesa_function_pool[7382]: PixelMapfv (offset 251) */
+   /* _mesa_function_pool[7616]: PixelMapfv (offset 251) */
    "iip\0"
    "glPixelMapfv\0"
    "\0"
-   /* _mesa_function_pool[7400]: Color4ui (offset 37) */
+   /* _mesa_function_pool[7634]: Color4ui (offset 37) */
    "iiii\0"
    "glColor4ui\0"
    "\0"
-   /* _mesa_function_pool[7417]: RasterPos3s (offset 76) */
+   /* _mesa_function_pool[7651]: RasterPos3s (offset 76) */
    "iii\0"
    "glRasterPos3s\0"
    "\0"
-   /* _mesa_function_pool[7436]: Color3usv (offset 24) */
+   /* _mesa_function_pool[7670]: Color3usv (offset 24) */
    "p\0"
    "glColor3usv\0"
    "\0"
-   /* _mesa_function_pool[7451]: FlushRasterSGIX (dynamic) */
+   /* _mesa_function_pool[7685]: FlushRasterSGIX (dynamic) */
    "\0"
    "glFlushRasterSGIX\0"
    "\0"
-   /* _mesa_function_pool[7471]: TexCoord2f (offset 104) */
+   /* _mesa_function_pool[7705]: TexCoord2f (offset 104) */
    "ff\0"
    "glTexCoord2f\0"
    "\0"
-   /* _mesa_function_pool[7488]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[7722]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */
    "ifffff\0"
    "glReplacementCodeuiTexCoord2fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[7537]: TexCoord2d (offset 102) */
+   /* _mesa_function_pool[7771]: TexCoord2d (offset 102) */
    "dd\0"
    "glTexCoord2d\0"
    "\0"
-   /* _mesa_function_pool[7554]: RasterPos3d (offset 70) */
+   /* _mesa_function_pool[7788]: RasterPos3d (offset 70) */
    "ddd\0"
    "glRasterPos3d\0"
    "\0"
-   /* _mesa_function_pool[7573]: RasterPos3f (offset 72) */
+   /* _mesa_function_pool[7807]: RasterPos3f (offset 72) */
    "fff\0"
    "glRasterPos3f\0"
    "\0"
-   /* _mesa_function_pool[7592]: Uniform1fARB (will be remapped) */
+   /* _mesa_function_pool[7826]: Uniform1fARB (will be remapped) */
    "if\0"
    "glUniform1f\0"
    "glUniform1fARB\0"
    "\0"
-   /* _mesa_function_pool[7623]: AreTexturesResident (offset 322) */
+   /* _mesa_function_pool[7857]: AreTexturesResident (offset 322) */
    "ipp\0"
    "glAreTexturesResident\0"
    "glAreTexturesResidentEXT\0"
    "\0"
-   /* _mesa_function_pool[7675]: TexCoord2s (offset 108) */
+   /* _mesa_function_pool[7909]: TexCoord2s (offset 108) */
    "ii\0"
    "glTexCoord2s\0"
    "\0"
-   /* _mesa_function_pool[7692]: StencilOpSeparate (will be remapped) */
+   /* _mesa_function_pool[7926]: StencilOpSeparate (will be remapped) */
    "iiii\0"
    "glStencilOpSeparate\0"
    "glStencilOpSeparateATI\0"
    "\0"
-   /* _mesa_function_pool[7741]: ColorTableParameteriv (offset 341) */
+   /* _mesa_function_pool[7975]: ColorTableParameteriv (offset 341) */
    "iip\0"
    "glColorTableParameteriv\0"
    "glColorTableParameterivSGI\0"
    "\0"
-   /* _mesa_function_pool[7797]: FogCoordPointerListIBM (dynamic) */
+   /* _mesa_function_pool[8031]: FogCoordPointerListIBM (dynamic) */
    "iipi\0"
    "glFogCoordPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[7828]: WindowPos3dMESA (will be remapped) */
+   /* _mesa_function_pool[8062]: WindowPos3dMESA (will be remapped) */
    "ddd\0"
    "glWindowPos3d\0"
    "glWindowPos3dARB\0"
    "glWindowPos3dMESA\0"
    "\0"
-   /* _mesa_function_pool[7882]: Color4us (offset 39) */
+   /* _mesa_function_pool[8116]: Color4us (offset 39) */
    "iiii\0"
    "glColor4us\0"
    "\0"
-   /* _mesa_function_pool[7899]: PointParameterfvEXT (will be remapped) */
+   /* _mesa_function_pool[8133]: PointParameterfvEXT (will be remapped) */
    "ip\0"
    "glPointParameterfv\0"
    "glPointParameterfvARB\0"
    "glPointParameterfvEXT\0"
    "glPointParameterfvSGIS\0"
    "\0"
-   /* _mesa_function_pool[7989]: Color3bv (offset 10) */
+   /* _mesa_function_pool[8223]: Color3bv (offset 10) */
    "p\0"
    "glColor3bv\0"
    "\0"
-   /* _mesa_function_pool[8003]: WindowPos2fvMESA (will be remapped) */
+   /* _mesa_function_pool[8237]: GetnCompressedTexImageARB (will be remapped) */
+   "iiip\0"
+   "glGetnCompressedTexImageARB\0"
+   "\0"
+   /* _mesa_function_pool[8271]: WindowPos2fvMESA (will be remapped) */
    "p\0"
    "glWindowPos2fv\0"
    "glWindowPos2fvARB\0"
    "glWindowPos2fvMESA\0"
    "\0"
-   /* _mesa_function_pool[8058]: SecondaryColor3bvEXT (will be remapped) */
+   /* _mesa_function_pool[8326]: SecondaryColor3bvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3bv\0"
    "glSecondaryColor3bvEXT\0"
    "\0"
-   /* _mesa_function_pool[8104]: VertexPointerListIBM (dynamic) */
+   /* _mesa_function_pool[8372]: VertexPointerListIBM (dynamic) */
    "iiipi\0"
    "glVertexPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[8134]: GetProgramLocalParameterfvARB (will be remapped) */
+   /* _mesa_function_pool[8402]: GetProgramLocalParameterfvARB (will be remapped) */
    "iip\0"
    "glGetProgramLocalParameterfvARB\0"
    "\0"
-   /* _mesa_function_pool[8171]: FragmentMaterialfSGIX (dynamic) */
+   /* _mesa_function_pool[8439]: FragmentMaterialfSGIX (dynamic) */
    "iif\0"
    "glFragmentMaterialfSGIX\0"
    "\0"
-   /* _mesa_function_pool[8200]: BindSampler (will be remapped) */
+   /* _mesa_function_pool[8468]: BindSampler (will be remapped) */
    "ii\0"
    "glBindSampler\0"
    "\0"
-   /* _mesa_function_pool[8218]: RenderbufferStorageEXT (will be remapped) */
+   /* _mesa_function_pool[8486]: RenderbufferStorageEXT (will be remapped) */
    "iiii\0"
    "glRenderbufferStorage\0"
    "glRenderbufferStorageEXT\0"
    "\0"
-   /* _mesa_function_pool[8271]: IsFenceNV (will be remapped) */
+   /* _mesa_function_pool[8539]: IsFenceNV (will be remapped) */
    "i\0"
    "glIsFenceNV\0"
    "\0"
-   /* _mesa_function_pool[8286]: AttachObjectARB (will be remapped) */
+   /* _mesa_function_pool[8554]: AttachObjectARB (will be remapped) */
    "ii\0"
    "glAttachObjectARB\0"
    "\0"
-   /* _mesa_function_pool[8308]: GetFragmentLightivSGIX (dynamic) */
+   /* _mesa_function_pool[8576]: GetFragmentLightivSGIX (dynamic) */
    "iip\0"
    "glGetFragmentLightivSGIX\0"
    "\0"
-   /* _mesa_function_pool[8338]: UniformMatrix2fvARB (will be remapped) */
+   /* _mesa_function_pool[8606]: UniformMatrix2fvARB (will be remapped) */
    "iiip\0"
    "glUniformMatrix2fv\0"
    "glUniformMatrix2fvARB\0"
    "\0"
-   /* _mesa_function_pool[8385]: MultiTexCoord2fARB (offset 386) */
+   /* _mesa_function_pool[8653]: MultiTexCoord2fARB (offset 386) */
    "iff\0"
    "glMultiTexCoord2f\0"
    "glMultiTexCoord2fARB\0"
    "\0"
-   /* _mesa_function_pool[8429]: ColorTable (offset 339) */
+   /* _mesa_function_pool[8697]: ColorTable (offset 339) */
    "iiiiip\0"
    "glColorTable\0"
    "glColorTableSGI\0"
    "glColorTableEXT\0"
    "\0"
-   /* _mesa_function_pool[8482]: IndexPointer (offset 314) */
+   /* _mesa_function_pool[8750]: IndexPointer (offset 314) */
    "iip\0"
    "glIndexPointer\0"
    "\0"
-   /* _mesa_function_pool[8502]: Accum (offset 213) */
+   /* _mesa_function_pool[8770]: Accum (offset 213) */
    "if\0"
    "glAccum\0"
    "\0"
-   /* _mesa_function_pool[8514]: GetTexImage (offset 281) */
+   /* _mesa_function_pool[8782]: GetTexImage (offset 281) */
    "iiiip\0"
    "glGetTexImage\0"
    "\0"
-   /* _mesa_function_pool[8535]: MapControlPointsNV (dynamic) */
+   /* _mesa_function_pool[8803]: MapControlPointsNV (dynamic) */
    "iiiiiiiip\0"
    "glMapControlPointsNV\0"
    "\0"
-   /* _mesa_function_pool[8567]: ConvolutionFilter2D (offset 349) */
+   /* _mesa_function_pool[8835]: ConvolutionFilter2D (offset 349) */
    "iiiiiip\0"
    "glConvolutionFilter2D\0"
    "glConvolutionFilter2DEXT\0"
    "\0"
-   /* _mesa_function_pool[8623]: Finish (offset 216) */
+   /* _mesa_function_pool[8891]: Finish (offset 216) */
    "\0"
    "glFinish\0"
    "\0"
-   /* _mesa_function_pool[8634]: MapParameterfvNV (dynamic) */
+   /* _mesa_function_pool[8902]: MapParameterfvNV (dynamic) */
    "iip\0"
    "glMapParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[8658]: ClearStencil (offset 207) */
+   /* _mesa_function_pool[8926]: ClearStencil (offset 207) */
    "i\0"
    "glClearStencil\0"
    "\0"
-   /* _mesa_function_pool[8676]: VertexAttrib3dvARB (will be remapped) */
+   /* _mesa_function_pool[8944]: VertexAttrib3dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib3dv\0"
    "glVertexAttrib3dvARB\0"
    "\0"
-   /* _mesa_function_pool[8719]: Uniform4uivEXT (will be remapped) */
+   /* _mesa_function_pool[8987]: Uniform4uivEXT (will be remapped) */
    "iip\0"
    "glUniform4uivEXT\0"
    "glUniform4uiv\0"
    "\0"
-   /* _mesa_function_pool[8755]: HintPGI (dynamic) */
+   /* _mesa_function_pool[9023]: HintPGI (dynamic) */
    "ii\0"
    "glHintPGI\0"
    "\0"
-   /* _mesa_function_pool[8769]: ConvolutionParameteriv (offset 353) */
+   /* _mesa_function_pool[9037]: ConvolutionParameteriv (offset 353) */
    "iip\0"
    "glConvolutionParameteriv\0"
    "glConvolutionParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[8827]: Color4s (offset 33) */
+   /* _mesa_function_pool[9095]: Color4s (offset 33) */
    "iiii\0"
    "glColor4s\0"
    "\0"
-   /* _mesa_function_pool[8843]: InterleavedArrays (offset 317) */
+   /* _mesa_function_pool[9111]: InterleavedArrays (offset 317) */
    "iip\0"
    "glInterleavedArrays\0"
    "\0"
-   /* _mesa_function_pool[8868]: RasterPos2fv (offset 65) */
+   /* _mesa_function_pool[9136]: RasterPos2fv (offset 65) */
    "p\0"
    "glRasterPos2fv\0"
    "\0"
-   /* _mesa_function_pool[8886]: TexCoord1fv (offset 97) */
+   /* _mesa_function_pool[9154]: TexCoord1fv (offset 97) */
    "p\0"
    "glTexCoord1fv\0"
    "\0"
-   /* _mesa_function_pool[8903]: Vertex2d (offset 126) */
+   /* _mesa_function_pool[9171]: Vertex2d (offset 126) */
    "dd\0"
    "glVertex2d\0"
    "\0"
-   /* _mesa_function_pool[8918]: CullParameterdvEXT (dynamic) */
+   /* _mesa_function_pool[9186]: CullParameterdvEXT (dynamic) */
    "ip\0"
    "glCullParameterdvEXT\0"
    "\0"
-   /* _mesa_function_pool[8943]: ProgramNamedParameter4fNV (will be remapped) */
+   /* _mesa_function_pool[9211]: ProgramNamedParameter4fNV (will be remapped) */
    "iipffff\0"
    "glProgramNamedParameter4fNV\0"
    "\0"
-   /* _mesa_function_pool[8980]: Color3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[9248]: Color3fVertex3fSUN (dynamic) */
    "ffffff\0"
    "glColor3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[9009]: ProgramEnvParameter4fvARB (will be remapped) */
+   /* _mesa_function_pool[9277]: ProgramEnvParameter4fvARB (will be remapped) */
    "iip\0"
    "glProgramEnvParameter4fvARB\0"
    "glProgramParameter4fvNV\0"
    "\0"
-   /* _mesa_function_pool[9066]: Color4i (offset 31) */
+   /* _mesa_function_pool[9334]: Color4i (offset 31) */
    "iiii\0"
    "glColor4i\0"
    "\0"
-   /* _mesa_function_pool[9082]: Color4f (offset 29) */
+   /* _mesa_function_pool[9350]: Color4f (offset 29) */
    "ffff\0"
    "glColor4f\0"
    "\0"
-   /* _mesa_function_pool[9098]: RasterPos4fv (offset 81) */
+   /* _mesa_function_pool[9366]: RasterPos4fv (offset 81) */
    "p\0"
    "glRasterPos4fv\0"
    "\0"
-   /* _mesa_function_pool[9116]: Color4d (offset 27) */
+   /* _mesa_function_pool[9384]: Color4d (offset 27) */
    "dddd\0"
    "glColor4d\0"
    "\0"
-   /* _mesa_function_pool[9132]: ClearIndex (offset 205) */
+   /* _mesa_function_pool[9400]: ClearIndex (offset 205) */
    "f\0"
    "glClearIndex\0"
    "\0"
-   /* _mesa_function_pool[9148]: Color4b (offset 25) */
+   /* _mesa_function_pool[9416]: Color4b (offset 25) */
    "iiii\0"
    "glColor4b\0"
    "\0"
-   /* _mesa_function_pool[9164]: LoadMatrixd (offset 292) */
+   /* _mesa_function_pool[9432]: LoadMatrixd (offset 292) */
    "p\0"
    "glLoadMatrixd\0"
    "\0"
-   /* _mesa_function_pool[9181]: FragmentLightModeliSGIX (dynamic) */
+   /* _mesa_function_pool[9449]: FragmentLightModeliSGIX (dynamic) */
    "ii\0"
    "glFragmentLightModeliSGIX\0"
    "\0"
-   /* _mesa_function_pool[9211]: RasterPos2dv (offset 63) */
+   /* _mesa_function_pool[9479]: RasterPos2dv (offset 63) */
    "p\0"
    "glRasterPos2dv\0"
    "\0"
-   /* _mesa_function_pool[9229]: ConvolutionParameterfv (offset 351) */
+   /* _mesa_function_pool[9497]: ConvolutionParameterfv (offset 351) */
    "iip\0"
    "glConvolutionParameterfv\0"
    "glConvolutionParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[9287]: TbufferMask3DFX (dynamic) */
+   /* _mesa_function_pool[9555]: TbufferMask3DFX (dynamic) */
    "i\0"
    "glTbufferMask3DFX\0"
    "\0"
-   /* _mesa_function_pool[9308]: GetTexGendv (offset 278) */
+   /* _mesa_function_pool[9576]: GetTexGendv (offset 278) */
    "iip\0"
    "glGetTexGendv\0"
    "\0"
-   /* _mesa_function_pool[9327]: GetVertexAttribfvNV (will be remapped) */
+   /* _mesa_function_pool[9595]: GetVertexAttribfvNV (will be remapped) */
    "iip\0"
    "glGetVertexAttribfvNV\0"
    "\0"
-   /* _mesa_function_pool[9354]: BeginTransformFeedbackEXT (will be remapped) */
+   /* _mesa_function_pool[9622]: BeginTransformFeedbackEXT (will be remapped) */
    "i\0"
    "glBeginTransformFeedbackEXT\0"
    "glBeginTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[9410]: LoadProgramNV (will be remapped) */
+   /* _mesa_function_pool[9678]: LoadProgramNV (will be remapped) */
    "iiip\0"
    "glLoadProgramNV\0"
    "\0"
-   /* _mesa_function_pool[9432]: WaitSync (will be remapped) */
+   /* _mesa_function_pool[9700]: WaitSync (will be remapped) */
    "iii\0"
    "glWaitSync\0"
    "\0"
-   /* _mesa_function_pool[9448]: EndList (offset 1) */
+   /* _mesa_function_pool[9716]: EndList (offset 1) */
    "\0"
    "glEndList\0"
    "\0"
-   /* _mesa_function_pool[9460]: VertexAttrib4fvNV (will be remapped) */
+   /* _mesa_function_pool[9728]: VertexAttrib4fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib4fvNV\0"
    "\0"
-   /* _mesa_function_pool[9484]: GetAttachedObjectsARB (will be remapped) */
+   /* _mesa_function_pool[9752]: GetAttachedObjectsARB (will be remapped) */
    "iipp\0"
    "glGetAttachedObjectsARB\0"
    "\0"
-   /* _mesa_function_pool[9514]: Uniform3fvARB (will be remapped) */
+   /* _mesa_function_pool[9782]: Uniform3fvARB (will be remapped) */
    "iip\0"
    "glUniform3fv\0"
    "glUniform3fvARB\0"
    "\0"
-   /* _mesa_function_pool[9548]: EvalCoord1fv (offset 231) */
+   /* _mesa_function_pool[9816]: EvalCoord1fv (offset 231) */
    "p\0"
    "glEvalCoord1fv\0"
    "\0"
-   /* _mesa_function_pool[9566]: DrawRangeElements (offset 338) */
+   /* _mesa_function_pool[9834]: DrawRangeElements (offset 338) */
    "iiiiip\0"
    "glDrawRangeElements\0"
    "glDrawRangeElementsEXT\0"
    "\0"
-   /* _mesa_function_pool[9617]: EvalMesh2 (offset 238) */
+   /* _mesa_function_pool[9885]: EvalMesh2 (offset 238) */
    "iiiii\0"
    "glEvalMesh2\0"
    "\0"
-   /* _mesa_function_pool[9636]: Vertex4fv (offset 145) */
+   /* _mesa_function_pool[9904]: Vertex4fv (offset 145) */
    "p\0"
    "glVertex4fv\0"
    "\0"
-   /* _mesa_function_pool[9651]: GenTransformFeedbacks (will be remapped) */
+   /* _mesa_function_pool[9919]: GenTransformFeedbacks (will be remapped) */
    "ip\0"
    "glGenTransformFeedbacks\0"
    "\0"
-   /* _mesa_function_pool[9679]: SpriteParameterfvSGIX (dynamic) */
+   /* _mesa_function_pool[9947]: SpriteParameterfvSGIX (dynamic) */
    "ip\0"
    "glSpriteParameterfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[9707]: CheckFramebufferStatusEXT (will be remapped) */
+   /* _mesa_function_pool[9975]: CheckFramebufferStatusEXT (will be remapped) */
    "i\0"
    "glCheckFramebufferStatus\0"
    "glCheckFramebufferStatusEXT\0"
    "\0"
-   /* _mesa_function_pool[9763]: GlobalAlphaFactoruiSUN (dynamic) */
+   /* _mesa_function_pool[10031]: GlobalAlphaFactoruiSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactoruiSUN\0"
    "\0"
-   /* _mesa_function_pool[9791]: GetHandleARB (will be remapped) */
+   /* _mesa_function_pool[10059]: GetHandleARB (will be remapped) */
    "i\0"
    "glGetHandleARB\0"
    "\0"
-   /* _mesa_function_pool[9809]: GetVertexAttribivARB (will be remapped) */
+   /* _mesa_function_pool[10077]: GetVertexAttribivARB (will be remapped) */
    "iip\0"
    "glGetVertexAttribiv\0"
    "glGetVertexAttribivARB\0"
    "\0"
-   /* _mesa_function_pool[9857]: BlendFunciARB (will be remapped) */
+   /* _mesa_function_pool[10125]: BlendFunciARB (will be remapped) */
    "iii\0"
    "glBlendFunciARB\0"
    "\0"
-   /* _mesa_function_pool[9878]: GetCombinerInputParameterfvNV (will be remapped) */
-   "iiiip\0"
-   "glGetCombinerInputParameterfvNV\0"
+   /* _mesa_function_pool[10146]: GetnUniformivARB (will be remapped) */
+   "iiip\0"
+   "glGetnUniformivARB\0"
    "\0"
-   /* _mesa_function_pool[9917]: GetTexParameterIivEXT (will be remapped) */
+   /* _mesa_function_pool[10171]: GetTexParameterIivEXT (will be remapped) */
    "iip\0"
    "glGetTexParameterIivEXT\0"
    "glGetTexParameterIiv\0"
    "\0"
-   /* _mesa_function_pool[9967]: CreateProgram (will be remapped) */
+   /* _mesa_function_pool[10221]: CreateProgram (will be remapped) */
    "\0"
    "glCreateProgram\0"
    "\0"
-   /* _mesa_function_pool[9985]: LoadTransposeMatrixdARB (will be remapped) */
+   /* _mesa_function_pool[10239]: LoadTransposeMatrixdARB (will be remapped) */
    "p\0"
    "glLoadTransposeMatrixd\0"
    "glLoadTransposeMatrixdARB\0"
    "\0"
-   /* _mesa_function_pool[10037]: ReleaseShaderCompiler (will be remapped) */
+   /* _mesa_function_pool[10291]: ReleaseShaderCompiler (will be remapped) */
    "\0"
    "glReleaseShaderCompiler\0"
    "\0"
-   /* _mesa_function_pool[10063]: GetMinmax (offset 364) */
+   /* _mesa_function_pool[10317]: GetMinmax (offset 364) */
    "iiiip\0"
    "glGetMinmax\0"
    "glGetMinmaxEXT\0"
    "\0"
-   /* _mesa_function_pool[10097]: StencilFuncSeparate (will be remapped) */
+   /* _mesa_function_pool[10351]: StencilFuncSeparate (will be remapped) */
    "iiii\0"
    "glStencilFuncSeparate\0"
    "\0"
-   /* _mesa_function_pool[10125]: SecondaryColor3sEXT (will be remapped) */
+   /* _mesa_function_pool[10379]: SecondaryColor3sEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3s\0"
    "glSecondaryColor3sEXT\0"
    "\0"
-   /* _mesa_function_pool[10171]: Color3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[10425]: Color3fVertex3fvSUN (dynamic) */
    "pp\0"
    "glColor3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[10197]: GetInteger64i_v (will be remapped) */
+   /* _mesa_function_pool[10451]: GetInteger64i_v (will be remapped) */
    "iip\0"
    "glGetInteger64i_v\0"
    "\0"
-   /* _mesa_function_pool[10220]: Normal3fv (offset 57) */
+   /* _mesa_function_pool[10474]: GetVertexAttribdvNV (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribdvNV\0"
+   "\0"
+   /* _mesa_function_pool[10501]: Normal3fv (offset 57) */
    "p\0"
    "glNormal3fv\0"
    "\0"
-   /* _mesa_function_pool[10235]: GlobalAlphaFactorbSUN (dynamic) */
+   /* _mesa_function_pool[10516]: GlobalAlphaFactorbSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorbSUN\0"
    "\0"
-   /* _mesa_function_pool[10262]: Color3us (offset 23) */
+   /* _mesa_function_pool[10543]: Color3us (offset 23) */
    "iii\0"
    "glColor3us\0"
    "\0"
-   /* _mesa_function_pool[10278]: ImageTransformParameterfvHP (dynamic) */
+   /* _mesa_function_pool[10559]: ImageTransformParameterfvHP (dynamic) */
    "iip\0"
    "glImageTransformParameterfvHP\0"
    "\0"
-   /* _mesa_function_pool[10313]: VertexAttrib4ivARB (will be remapped) */
+   /* _mesa_function_pool[10594]: VertexAttrib4ivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4iv\0"
    "glVertexAttrib4ivARB\0"
    "\0"
-   /* _mesa_function_pool[10356]: End (offset 43) */
+   /* _mesa_function_pool[10637]: End (offset 43) */
    "\0"
    "glEnd\0"
    "\0"
-   /* _mesa_function_pool[10364]: VertexAttrib3fNV (will be remapped) */
+   /* _mesa_function_pool[10645]: VertexAttrib3fNV (will be remapped) */
    "ifff\0"
    "glVertexAttrib3fNV\0"
    "\0"
-   /* _mesa_function_pool[10389]: VertexAttribs2dvNV (will be remapped) */
+   /* _mesa_function_pool[10670]: VertexAttribs2dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs2dvNV\0"
    "\0"
-   /* _mesa_function_pool[10415]: GetQueryObjectui64vEXT (will be remapped) */
+   /* _mesa_function_pool[10696]: GetQueryObjectui64vEXT (will be remapped) */
    "iip\0"
    "glGetQueryObjectui64vEXT\0"
    "\0"
-   /* _mesa_function_pool[10445]: MultiTexCoord3fvARB (offset 395) */
+   /* _mesa_function_pool[10726]: MultiTexCoord3fvARB (offset 395) */
    "ip\0"
    "glMultiTexCoord3fv\0"
    "glMultiTexCoord3fvARB\0"
    "\0"
-   /* _mesa_function_pool[10490]: SecondaryColor3dEXT (will be remapped) */
+   /* _mesa_function_pool[10771]: SecondaryColor3dEXT (will be remapped) */
    "ddd\0"
    "glSecondaryColor3d\0"
    "glSecondaryColor3dEXT\0"
    "\0"
-   /* _mesa_function_pool[10536]: Color3ub (offset 19) */
+   /* _mesa_function_pool[10817]: Color3ub (offset 19) */
    "iii\0"
    "glColor3ub\0"
    "\0"
-   /* _mesa_function_pool[10552]: GetProgramParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[10833]: GetProgramParameterfvNV (will be remapped) */
    "iiip\0"
    "glGetProgramParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[10584]: TangentPointerEXT (dynamic) */
+   /* _mesa_function_pool[10865]: TangentPointerEXT (dynamic) */
    "iip\0"
    "glTangentPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[10609]: Color4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[10890]: Color4fNormal3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[10644]: GetInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[10925]: GetInstrumentsSGIX (dynamic) */
    "\0"
    "glGetInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[10667]: GetUniformuivEXT (will be remapped) */
+   /* _mesa_function_pool[10948]: GetUniformuivEXT (will be remapped) */
    "iip\0"
    "glGetUniformuivEXT\0"
    "glGetUniformuiv\0"
    "\0"
-   /* _mesa_function_pool[10707]: Color3ui (offset 21) */
+   /* _mesa_function_pool[10988]: Color3ui (offset 21) */
    "iii\0"
    "glColor3ui\0"
    "\0"
-   /* _mesa_function_pool[10723]: EvalMapsNV (dynamic) */
+   /* _mesa_function_pool[11004]: EvalMapsNV (dynamic) */
    "ii\0"
    "glEvalMapsNV\0"
    "\0"
-   /* _mesa_function_pool[10740]: TexSubImage2D (offset 333) */
+   /* _mesa_function_pool[11021]: TexSubImage2D (offset 333) */
    "iiiiiiiip\0"
    "glTexSubImage2D\0"
    "glTexSubImage2DEXT\0"
    "\0"
-   /* _mesa_function_pool[10786]: FragmentLightivSGIX (dynamic) */
+   /* _mesa_function_pool[11067]: FragmentLightivSGIX (dynamic) */
    "iip\0"
    "glFragmentLightivSGIX\0"
    "\0"
-   /* _mesa_function_pool[10813]: GetTexParameterPointervAPPLE (will be remapped) */
+   /* _mesa_function_pool[11094]: GetTexParameterPointervAPPLE (will be remapped) */
    "iip\0"
    "glGetTexParameterPointervAPPLE\0"
    "\0"
-   /* _mesa_function_pool[10849]: TexGenfv (offset 191) */
+   /* _mesa_function_pool[11130]: TexGenfv (offset 191) */
    "iip\0"
    "glTexGenfv\0"
    "\0"
-   /* _mesa_function_pool[10865]: GetTransformFeedbackVaryingEXT (will be remapped) */
+   /* _mesa_function_pool[11146]: GetTransformFeedbackVaryingEXT (will be remapped) */
    "iiipppp\0"
    "glGetTransformFeedbackVaryingEXT\0"
    "glGetTransformFeedbackVarying\0"
    "\0"
-   /* _mesa_function_pool[10937]: VertexAttrib4bvARB (will be remapped) */
+   /* _mesa_function_pool[11218]: VertexAttrib4bvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4bv\0"
    "glVertexAttrib4bvARB\0"
    "\0"
-   /* _mesa_function_pool[10980]: ShaderBinary (will be remapped) */
+   /* _mesa_function_pool[11261]: ShaderBinary (will be remapped) */
    "ipipi\0"
    "glShaderBinary\0"
    "\0"
-   /* _mesa_function_pool[11002]: GetIntegerIndexedvEXT (will be remapped) */
+   /* _mesa_function_pool[11283]: GetIntegerIndexedvEXT (will be remapped) */
    "iip\0"
    "glGetIntegerIndexedvEXT\0"
    "glGetIntegeri_v\0"
    "\0"
-   /* _mesa_function_pool[11047]: MultiTexCoord4sARB (offset 406) */
+   /* _mesa_function_pool[11328]: MultiTexCoord4sARB (offset 406) */
    "iiiii\0"
    "glMultiTexCoord4s\0"
    "glMultiTexCoord4sARB\0"
    "\0"
-   /* _mesa_function_pool[11093]: GetFragmentMaterialivSGIX (dynamic) */
+   /* _mesa_function_pool[11374]: GetFragmentMaterialivSGIX (dynamic) */
    "iip\0"
    "glGetFragmentMaterialivSGIX\0"
    "\0"
-   /* _mesa_function_pool[11126]: WindowPos4dMESA (will be remapped) */
+   /* _mesa_function_pool[11407]: WindowPos4dMESA (will be remapped) */
    "dddd\0"
    "glWindowPos4dMESA\0"
    "\0"
-   /* _mesa_function_pool[11150]: WeightPointerARB (dynamic) */
+   /* _mesa_function_pool[11431]: WeightPointerARB (dynamic) */
    "iiip\0"
    "glWeightPointerARB\0"
    "\0"
-   /* _mesa_function_pool[11175]: WindowPos2dMESA (will be remapped) */
+   /* _mesa_function_pool[11456]: WindowPos2dMESA (will be remapped) */
    "dd\0"
    "glWindowPos2d\0"
    "glWindowPos2dARB\0"
    "glWindowPos2dMESA\0"
    "\0"
-   /* _mesa_function_pool[11228]: FramebufferTexture3DEXT (will be remapped) */
+   /* _mesa_function_pool[11509]: FramebufferTexture3DEXT (will be remapped) */
    "iiiiii\0"
    "glFramebufferTexture3D\0"
    "glFramebufferTexture3DEXT\0"
    "\0"
-   /* _mesa_function_pool[11285]: BlendEquation (offset 337) */
+   /* _mesa_function_pool[11566]: BlendEquation (offset 337) */
    "i\0"
    "glBlendEquation\0"
    "glBlendEquationEXT\0"
    "\0"
-   /* _mesa_function_pool[11323]: VertexAttrib3dNV (will be remapped) */
+   /* _mesa_function_pool[11604]: VertexAttrib3dNV (will be remapped) */
    "iddd\0"
    "glVertexAttrib3dNV\0"
    "\0"
-   /* _mesa_function_pool[11348]: VertexAttrib3dARB (will be remapped) */
+   /* _mesa_function_pool[11629]: VertexAttrib3dARB (will be remapped) */
    "iddd\0"
    "glVertexAttrib3d\0"
    "glVertexAttrib3dARB\0"
    "\0"
-   /* _mesa_function_pool[11391]: VertexAttribI4usvEXT (will be remapped) */
+   /* _mesa_function_pool[11672]: VertexAttribI4usvEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4usvEXT\0"
    "glVertexAttribI4usv\0"
    "\0"
-   /* _mesa_function_pool[11438]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[11719]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
    "ppppp\0"
    "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[11502]: VertexAttrib4fARB (will be remapped) */
+   /* _mesa_function_pool[11783]: VertexAttrib4fARB (will be remapped) */
    "iffff\0"
    "glVertexAttrib4f\0"
    "glVertexAttrib4fARB\0"
    "\0"
-   /* _mesa_function_pool[11546]: GetError (offset 261) */
+   /* _mesa_function_pool[11827]: GetError (offset 261) */
    "\0"
    "glGetError\0"
    "\0"
-   /* _mesa_function_pool[11559]: IndexFuncEXT (dynamic) */
+   /* _mesa_function_pool[11840]: IndexFuncEXT (dynamic) */
    "if\0"
    "glIndexFuncEXT\0"
    "\0"
-   /* _mesa_function_pool[11578]: TexCoord3dv (offset 111) */
+   /* _mesa_function_pool[11859]: TexCoord3dv (offset 111) */
    "p\0"
    "glTexCoord3dv\0"
    "\0"
-   /* _mesa_function_pool[11595]: Indexdv (offset 45) */
+   /* _mesa_function_pool[11876]: Indexdv (offset 45) */
    "p\0"
    "glIndexdv\0"
    "\0"
-   /* _mesa_function_pool[11608]: FramebufferTexture2DEXT (will be remapped) */
+   /* _mesa_function_pool[11889]: FramebufferTexture2DEXT (will be remapped) */
    "iiiii\0"
    "glFramebufferTexture2D\0"
    "glFramebufferTexture2DEXT\0"
    "\0"
-   /* _mesa_function_pool[11664]: Normal3s (offset 60) */
+   /* _mesa_function_pool[11945]: Normal3s (offset 60) */
    "iii\0"
    "glNormal3s\0"
    "\0"
-   /* _mesa_function_pool[11680]: GetObjectParameterivAPPLE (will be remapped) */
+   /* _mesa_function_pool[11961]: GetObjectParameterivAPPLE (will be remapped) */
    "iiip\0"
    "glGetObjectParameterivAPPLE\0"
    "\0"
-   /* _mesa_function_pool[11714]: PushName (offset 201) */
+   /* _mesa_function_pool[11995]: PushName (offset 201) */
    "i\0"
    "glPushName\0"
    "\0"
-   /* _mesa_function_pool[11728]: MultiTexCoord2dvARB (offset 385) */
+   /* _mesa_function_pool[12009]: MultiTexCoord2dvARB (offset 385) */
    "ip\0"
    "glMultiTexCoord2dv\0"
    "glMultiTexCoord2dvARB\0"
    "\0"
-   /* _mesa_function_pool[11773]: CullParameterfvEXT (dynamic) */
+   /* _mesa_function_pool[12054]: CullParameterfvEXT (dynamic) */
    "ip\0"
    "glCullParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[11798]: Normal3i (offset 58) */
+   /* _mesa_function_pool[12079]: Normal3i (offset 58) */
    "iii\0"
    "glNormal3i\0"
    "\0"
-   /* _mesa_function_pool[11814]: ProgramNamedParameter4fvNV (will be remapped) */
+   /* _mesa_function_pool[12095]: ProgramNamedParameter4fvNV (will be remapped) */
    "iipp\0"
    "glProgramNamedParameter4fvNV\0"
    "\0"
-   /* _mesa_function_pool[11849]: SecondaryColorPointerEXT (will be remapped) */
+   /* _mesa_function_pool[12130]: SecondaryColorPointerEXT (will be remapped) */
    "iiip\0"
    "glSecondaryColorPointer\0"
    "glSecondaryColorPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[11906]: VertexAttrib4fvARB (will be remapped) */
+   /* _mesa_function_pool[12187]: VertexAttrib4fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4fv\0"
    "glVertexAttrib4fvARB\0"
    "\0"
-   /* _mesa_function_pool[11949]: PixelTexGenSGIX (will be remapped) */
+   /* _mesa_function_pool[12230]: PixelTexGenSGIX (will be remapped) */
    "i\0"
    "glPixelTexGenSGIX\0"
    "\0"
-   /* _mesa_function_pool[11970]: GetActiveUniformARB (will be remapped) */
+   /* _mesa_function_pool[12251]: GetActiveUniformARB (will be remapped) */
    "iiipppp\0"
    "glGetActiveUniform\0"
    "glGetActiveUniformARB\0"
    "\0"
-   /* _mesa_function_pool[12020]: ImageTransformParameteriHP (dynamic) */
+   /* _mesa_function_pool[12301]: ImageTransformParameteriHP (dynamic) */
    "iii\0"
    "glImageTransformParameteriHP\0"
    "\0"
-   /* _mesa_function_pool[12054]: Normal3b (offset 52) */
+   /* _mesa_function_pool[12335]: Normal3b (offset 52) */
    "iii\0"
    "glNormal3b\0"
    "\0"
-   /* _mesa_function_pool[12070]: Normal3d (offset 54) */
+   /* _mesa_function_pool[12351]: Normal3d (offset 54) */
    "ddd\0"
    "glNormal3d\0"
    "\0"
-   /* _mesa_function_pool[12086]: Uniform1uiEXT (will be remapped) */
+   /* _mesa_function_pool[12367]: Uniform1uiEXT (will be remapped) */
    "ii\0"
    "glUniform1uiEXT\0"
    "glUniform1ui\0"
    "\0"
-   /* _mesa_function_pool[12119]: Normal3f (offset 56) */
+   /* _mesa_function_pool[12400]: Normal3f (offset 56) */
    "fff\0"
    "glNormal3f\0"
    "\0"
-   /* _mesa_function_pool[12135]: MultiTexCoord1svARB (offset 383) */
+   /* _mesa_function_pool[12416]: MultiTexCoord1svARB (offset 383) */
    "ip\0"
    "glMultiTexCoord1sv\0"
    "glMultiTexCoord1svARB\0"
    "\0"
-   /* _mesa_function_pool[12180]: Indexi (offset 48) */
+   /* _mesa_function_pool[12461]: Indexi (offset 48) */
    "i\0"
    "glIndexi\0"
    "\0"
-   /* _mesa_function_pool[12192]: EGLImageTargetTexture2DOES (will be remapped) */
+   /* _mesa_function_pool[12473]: EGLImageTargetTexture2DOES (will be remapped) */
    "ip\0"
    "glEGLImageTargetTexture2DOES\0"
    "\0"
-   /* _mesa_function_pool[12225]: EndQueryARB (will be remapped) */
+   /* _mesa_function_pool[12506]: EndQueryARB (will be remapped) */
    "i\0"
    "glEndQuery\0"
    "glEndQueryARB\0"
    "\0"
-   /* _mesa_function_pool[12253]: DeleteFencesNV (will be remapped) */
+   /* _mesa_function_pool[12534]: DeleteFencesNV (will be remapped) */
    "ip\0"
    "glDeleteFencesNV\0"
    "\0"
-   /* _mesa_function_pool[12274]: ColorPointerListIBM (dynamic) */
+   /* _mesa_function_pool[12555]: ColorPointerListIBM (dynamic) */
    "iiipi\0"
    "glColorPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[12303]: BindBufferRangeEXT (will be remapped) */
+   /* _mesa_function_pool[12584]: BindBufferRangeEXT (will be remapped) */
    "iiiii\0"
    "glBindBufferRangeEXT\0"
    "glBindBufferRange\0"
    "\0"
-   /* _mesa_function_pool[12349]: DepthMask (offset 211) */
+   /* _mesa_function_pool[12630]: DepthMask (offset 211) */
    "i\0"
    "glDepthMask\0"
    "\0"
-   /* _mesa_function_pool[12364]: IsShader (will be remapped) */
+   /* _mesa_function_pool[12645]: IsShader (will be remapped) */
    "i\0"
    "glIsShader\0"
    "\0"
-   /* _mesa_function_pool[12378]: Indexf (offset 46) */
+   /* _mesa_function_pool[12659]: Indexf (offset 46) */
    "f\0"
    "glIndexf\0"
    "\0"
-   /* _mesa_function_pool[12390]: GetImageTransformParameterivHP (dynamic) */
+   /* _mesa_function_pool[12671]: GetImageTransformParameterivHP (dynamic) */
    "iip\0"
    "glGetImageTransformParameterivHP\0"
    "\0"
-   /* _mesa_function_pool[12428]: Indexd (offset 44) */
+   /* _mesa_function_pool[12709]: Indexd (offset 44) */
    "d\0"
    "glIndexd\0"
    "\0"
-   /* _mesa_function_pool[12440]: GetMaterialiv (offset 270) */
+   /* _mesa_function_pool[12721]: GetMaterialiv (offset 270) */
    "iip\0"
    "glGetMaterialiv\0"
    "\0"
-   /* _mesa_function_pool[12461]: StencilOp (offset 244) */
+   /* _mesa_function_pool[12742]: StencilOp (offset 244) */
    "iii\0"
    "glStencilOp\0"
    "\0"
-   /* _mesa_function_pool[12478]: WindowPos4ivMESA (will be remapped) */
+   /* _mesa_function_pool[12759]: WindowPos4ivMESA (will be remapped) */
    "p\0"
    "glWindowPos4ivMESA\0"
    "\0"
-   /* _mesa_function_pool[12500]: FramebufferTextureLayer (dynamic) */
+   /* _mesa_function_pool[12781]: FramebufferTextureLayer (dynamic) */
    "iiiii\0"
    "glFramebufferTextureLayerARB\0"
    "\0"
-   /* _mesa_function_pool[12536]: MultiTexCoord3svARB (offset 399) */
+   /* _mesa_function_pool[12817]: MultiTexCoord3svARB (offset 399) */
    "ip\0"
    "glMultiTexCoord3sv\0"
    "glMultiTexCoord3svARB\0"
    "\0"
-   /* _mesa_function_pool[12581]: TexEnvfv (offset 185) */
+   /* _mesa_function_pool[12862]: TexEnvfv (offset 185) */
    "iip\0"
    "glTexEnvfv\0"
    "\0"
-   /* _mesa_function_pool[12597]: MultiTexCoord4iARB (offset 404) */
+   /* _mesa_function_pool[12878]: MultiTexCoord4iARB (offset 404) */
    "iiiii\0"
    "glMultiTexCoord4i\0"
    "glMultiTexCoord4iARB\0"
    "\0"
-   /* _mesa_function_pool[12643]: Indexs (offset 50) */
+   /* _mesa_function_pool[12924]: Indexs (offset 50) */
    "i\0"
    "glIndexs\0"
    "\0"
-   /* _mesa_function_pool[12655]: Binormal3ivEXT (dynamic) */
+   /* _mesa_function_pool[12936]: Binormal3ivEXT (dynamic) */
    "p\0"
    "glBinormal3ivEXT\0"
    "\0"
-   /* _mesa_function_pool[12675]: ResizeBuffersMESA (will be remapped) */
+   /* _mesa_function_pool[12956]: ResizeBuffersMESA (will be remapped) */
    "\0"
    "glResizeBuffersMESA\0"
    "\0"
-   /* _mesa_function_pool[12697]: BlendFuncSeparateiARB (will be remapped) */
+   /* _mesa_function_pool[12978]: BlendFuncSeparateiARB (will be remapped) */
    "iiiii\0"
    "glBlendFuncSeparateiARB\0"
    "\0"
-   /* _mesa_function_pool[12728]: GetUniformivARB (will be remapped) */
+   /* _mesa_function_pool[13009]: GetUniformivARB (will be remapped) */
    "iip\0"
    "glGetUniformiv\0"
    "glGetUniformivARB\0"
    "\0"
-   /* _mesa_function_pool[12766]: PixelTexGenParameteriSGIS (will be remapped) */
+   /* _mesa_function_pool[13047]: PixelTexGenParameteriSGIS (will be remapped) */
    "ii\0"
    "glPixelTexGenParameteriSGIS\0"
    "\0"
-   /* _mesa_function_pool[12798]: VertexPointervINTEL (dynamic) */
+   /* _mesa_function_pool[13079]: VertexPointervINTEL (dynamic) */
    "iip\0"
    "glVertexPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[12825]: Vertex2i (offset 130) */
+   /* _mesa_function_pool[13106]: Vertex2i (offset 130) */
    "ii\0"
    "glVertex2i\0"
    "\0"
-   /* _mesa_function_pool[12840]: LoadMatrixf (offset 291) */
+   /* _mesa_function_pool[13121]: LoadMatrixf (offset 291) */
    "p\0"
    "glLoadMatrixf\0"
    "\0"
-   /* _mesa_function_pool[12857]: VertexAttribI1uivEXT (will be remapped) */
+   /* _mesa_function_pool[13138]: VertexAttribI1uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI1uivEXT\0"
    "glVertexAttribI1uiv\0"
    "\0"
-   /* _mesa_function_pool[12904]: Vertex2f (offset 128) */
+   /* _mesa_function_pool[13185]: Vertex2f (offset 128) */
    "ff\0"
    "glVertex2f\0"
    "\0"
-   /* _mesa_function_pool[12919]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[13200]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
    "pppp\0"
    "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[12972]: Color4bv (offset 26) */
+   /* _mesa_function_pool[13253]: Color4bv (offset 26) */
    "p\0"
    "glColor4bv\0"
    "\0"
-   /* _mesa_function_pool[12986]: VertexPointer (offset 321) */
+   /* _mesa_function_pool[13267]: VertexPointer (offset 321) */
    "iiip\0"
    "glVertexPointer\0"
    "\0"
-   /* _mesa_function_pool[13008]: SecondaryColor3uiEXT (will be remapped) */
+   /* _mesa_function_pool[13289]: SecondaryColor3uiEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3ui\0"
    "glSecondaryColor3uiEXT\0"
    "\0"
-   /* _mesa_function_pool[13056]: StartInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[13337]: StartInstrumentsSGIX (dynamic) */
    "\0"
    "glStartInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[13081]: SecondaryColor3usvEXT (will be remapped) */
+   /* _mesa_function_pool[13362]: SecondaryColor3usvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3usv\0"
    "glSecondaryColor3usvEXT\0"
    "\0"
-   /* _mesa_function_pool[13129]: VertexAttrib2fvNV (will be remapped) */
+   /* _mesa_function_pool[13410]: VertexAttrib2fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib2fvNV\0"
    "\0"
-   /* _mesa_function_pool[13153]: ProgramLocalParameter4dvARB (will be remapped) */
+   /* _mesa_function_pool[13434]: ProgramLocalParameter4dvARB (will be remapped) */
    "iip\0"
    "glProgramLocalParameter4dvARB\0"
    "\0"
-   /* _mesa_function_pool[13188]: DeleteLists (offset 4) */
+   /* _mesa_function_pool[13469]: DeleteLists (offset 4) */
    "ii\0"
    "glDeleteLists\0"
    "\0"
-   /* _mesa_function_pool[13206]: LogicOp (offset 242) */
+   /* _mesa_function_pool[13487]: LogicOp (offset 242) */
    "i\0"
    "glLogicOp\0"
    "\0"
-   /* _mesa_function_pool[13219]: MatrixIndexuivARB (dynamic) */
+   /* _mesa_function_pool[13500]: MatrixIndexuivARB (dynamic) */
    "ip\0"
    "glMatrixIndexuivARB\0"
    "\0"
-   /* _mesa_function_pool[13243]: Vertex2s (offset 132) */
+   /* _mesa_function_pool[13524]: Vertex2s (offset 132) */
    "ii\0"
    "glVertex2s\0"
    "\0"
-   /* _mesa_function_pool[13258]: RenderbufferStorageMultisample (will be remapped) */
+   /* _mesa_function_pool[13539]: RenderbufferStorageMultisample (will be remapped) */
    "iiiii\0"
    "glRenderbufferStorageMultisample\0"
    "glRenderbufferStorageMultisampleEXT\0"
    "\0"
-   /* _mesa_function_pool[13334]: TexCoord4fv (offset 121) */
+   /* _mesa_function_pool[13615]: TexCoord4fv (offset 121) */
    "p\0"
    "glTexCoord4fv\0"
    "\0"
-   /* _mesa_function_pool[13351]: Tangent3sEXT (dynamic) */
+   /* _mesa_function_pool[13632]: Tangent3sEXT (dynamic) */
    "iii\0"
    "glTangent3sEXT\0"
    "\0"
-   /* _mesa_function_pool[13371]: GlobalAlphaFactorfSUN (dynamic) */
+   /* _mesa_function_pool[13652]: GlobalAlphaFactorfSUN (dynamic) */
    "f\0"
    "glGlobalAlphaFactorfSUN\0"
    "\0"
-   /* _mesa_function_pool[13398]: MultiTexCoord3iARB (offset 396) */
+   /* _mesa_function_pool[13679]: MultiTexCoord3iARB (offset 396) */
    "iiii\0"
    "glMultiTexCoord3i\0"
    "glMultiTexCoord3iARB\0"
    "\0"
-   /* _mesa_function_pool[13443]: IsProgram (will be remapped) */
+   /* _mesa_function_pool[13724]: IsProgram (will be remapped) */
    "i\0"
    "glIsProgram\0"
    "\0"
-   /* _mesa_function_pool[13458]: TexCoordPointerListIBM (dynamic) */
+   /* _mesa_function_pool[13739]: TexCoordPointerListIBM (dynamic) */
    "iiipi\0"
    "glTexCoordPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[13490]: VertexAttribI4svEXT (will be remapped) */
+   /* _mesa_function_pool[13771]: VertexAttribI4svEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4svEXT\0"
    "glVertexAttribI4sv\0"
    "\0"
-   /* _mesa_function_pool[13535]: GlobalAlphaFactorusSUN (dynamic) */
+   /* _mesa_function_pool[13816]: GlobalAlphaFactorusSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorusSUN\0"
    "\0"
-   /* _mesa_function_pool[13563]: VertexAttrib2dvNV (will be remapped) */
+   /* _mesa_function_pool[13844]: VertexAttrib2dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib2dvNV\0"
    "\0"
-   /* _mesa_function_pool[13587]: FramebufferRenderbufferEXT (will be remapped) */
+   /* _mesa_function_pool[13868]: FramebufferRenderbufferEXT (will be remapped) */
    "iiii\0"
    "glFramebufferRenderbuffer\0"
    "glFramebufferRenderbufferEXT\0"
    "\0"
-   /* _mesa_function_pool[13648]: ClearBufferuiv (will be remapped) */
+   /* _mesa_function_pool[13929]: ClearBufferuiv (will be remapped) */
    "iip\0"
    "glClearBufferuiv\0"
    "\0"
-   /* _mesa_function_pool[13670]: VertexAttrib1dvNV (will be remapped) */
+   /* _mesa_function_pool[13951]: VertexAttrib1dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib1dvNV\0"
    "\0"
-   /* _mesa_function_pool[13694]: GenTextures (offset 328) */
+   /* _mesa_function_pool[13975]: GenTextures (offset 328) */
    "ip\0"
    "glGenTextures\0"
    "glGenTexturesEXT\0"
    "\0"
-   /* _mesa_function_pool[13729]: FramebufferTextureARB (will be remapped) */
+   /* _mesa_function_pool[14010]: FramebufferTextureARB (will be remapped) */
    "iiii\0"
    "glFramebufferTextureARB\0"
    "\0"
-   /* _mesa_function_pool[13759]: SetFenceNV (will be remapped) */
+   /* _mesa_function_pool[14040]: SetFenceNV (will be remapped) */
    "ii\0"
    "glSetFenceNV\0"
    "\0"
-   /* _mesa_function_pool[13776]: FramebufferTexture1DEXT (will be remapped) */
+   /* _mesa_function_pool[14057]: FramebufferTexture1DEXT (will be remapped) */
    "iiiii\0"
    "glFramebufferTexture1D\0"
    "glFramebufferTexture1DEXT\0"
    "\0"
-   /* _mesa_function_pool[13832]: GetCombinerOutputParameterivNV (will be remapped) */
+   /* _mesa_function_pool[14113]: GetCombinerOutputParameterivNV (will be remapped) */
    "iiip\0"
    "glGetCombinerOutputParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[13871]: MultiModeDrawArraysIBM (will be remapped) */
+   /* _mesa_function_pool[14152]: MultiModeDrawArraysIBM (will be remapped) */
    "pppii\0"
    "glMultiModeDrawArraysIBM\0"
    "\0"
-   /* _mesa_function_pool[13903]: PixelTexGenParameterivSGIS (will be remapped) */
+   /* _mesa_function_pool[14184]: PixelTexGenParameterivSGIS (will be remapped) */
    "ip\0"
    "glPixelTexGenParameterivSGIS\0"
    "\0"
-   /* _mesa_function_pool[13936]: TextureNormalEXT (dynamic) */
+   /* _mesa_function_pool[14217]: TextureNormalEXT (dynamic) */
    "i\0"
    "glTextureNormalEXT\0"
    "\0"
-   /* _mesa_function_pool[13958]: IndexPointerListIBM (dynamic) */
+   /* _mesa_function_pool[14239]: IndexPointerListIBM (dynamic) */
    "iipi\0"
    "glIndexPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[13986]: WeightfvARB (dynamic) */
+   /* _mesa_function_pool[14267]: WeightfvARB (dynamic) */
    "ip\0"
    "glWeightfvARB\0"
    "\0"
-   /* _mesa_function_pool[14004]: GetCombinerOutputParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[14285]: GetCombinerOutputParameterfvNV (will be remapped) */
    "iiip\0"
    "glGetCombinerOutputParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[14043]: RasterPos2sv (offset 69) */
+   /* _mesa_function_pool[14324]: RasterPos2sv (offset 69) */
    "p\0"
    "glRasterPos2sv\0"
    "\0"
-   /* _mesa_function_pool[14061]: Color4ubv (offset 36) */
+   /* _mesa_function_pool[14342]: Color4ubv (offset 36) */
    "p\0"
    "glColor4ubv\0"
    "\0"
-   /* _mesa_function_pool[14076]: DrawBuffer (offset 202) */
+   /* _mesa_function_pool[14357]: DrawBuffer (offset 202) */
    "i\0"
    "glDrawBuffer\0"
    "\0"
-   /* _mesa_function_pool[14092]: TexCoord2fv (offset 105) */
+   /* _mesa_function_pool[14373]: TexCoord2fv (offset 105) */
    "p\0"
    "glTexCoord2fv\0"
    "\0"
-   /* _mesa_function_pool[14109]: WindowPos4fMESA (will be remapped) */
+   /* _mesa_function_pool[14390]: WindowPos4fMESA (will be remapped) */
    "ffff\0"
    "glWindowPos4fMESA\0"
    "\0"
-   /* _mesa_function_pool[14133]: TexCoord1sv (offset 101) */
+   /* _mesa_function_pool[14414]: TexCoord1sv (offset 101) */
    "p\0"
    "glTexCoord1sv\0"
    "\0"
-   /* _mesa_function_pool[14150]: WindowPos3dvMESA (will be remapped) */
+   /* _mesa_function_pool[14431]: WindowPos3dvMESA (will be remapped) */
    "p\0"
    "glWindowPos3dv\0"
    "glWindowPos3dvARB\0"
    "glWindowPos3dvMESA\0"
    "\0"
-   /* _mesa_function_pool[14205]: DepthFunc (offset 245) */
+   /* _mesa_function_pool[14486]: DepthFunc (offset 245) */
    "i\0"
    "glDepthFunc\0"
    "\0"
-   /* _mesa_function_pool[14220]: PixelMapusv (offset 253) */
+   /* _mesa_function_pool[14501]: PixelMapusv (offset 253) */
    "iip\0"
    "glPixelMapusv\0"
    "\0"
-   /* _mesa_function_pool[14239]: GetQueryObjecti64vEXT (will be remapped) */
+   /* _mesa_function_pool[14520]: GetQueryObjecti64vEXT (will be remapped) */
    "iip\0"
    "glGetQueryObjecti64vEXT\0"
    "\0"
-   /* _mesa_function_pool[14268]: MultiTexCoord1dARB (offset 376) */
+   /* _mesa_function_pool[14549]: MultiTexCoord1dARB (offset 376) */
    "id\0"
    "glMultiTexCoord1d\0"
    "glMultiTexCoord1dARB\0"
    "\0"
-   /* _mesa_function_pool[14311]: PointParameterivNV (will be remapped) */
+   /* _mesa_function_pool[14592]: PointParameterivNV (will be remapped) */
    "ip\0"
    "glPointParameteriv\0"
    "glPointParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[14355]: IsSampler (will be remapped) */
+   /* _mesa_function_pool[14636]: IsSampler (will be remapped) */
    "i\0"
    "glIsSampler\0"
    "\0"
-   /* _mesa_function_pool[14370]: BlendFunc (offset 241) */
+   /* _mesa_function_pool[14651]: BlendFunc (offset 241) */
    "ii\0"
    "glBlendFunc\0"
    "\0"
-   /* _mesa_function_pool[14386]: EndTransformFeedbackEXT (will be remapped) */
+   /* _mesa_function_pool[14667]: EndTransformFeedbackEXT (will be remapped) */
    "\0"
    "glEndTransformFeedbackEXT\0"
    "glEndTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[14437]: Uniform2fvARB (will be remapped) */
+   /* _mesa_function_pool[14718]: Uniform2fvARB (will be remapped) */
    "iip\0"
    "glUniform2fv\0"
    "glUniform2fvARB\0"
    "\0"
-   /* _mesa_function_pool[14471]: BufferParameteriAPPLE (will be remapped) */
+   /* _mesa_function_pool[14752]: BufferParameteriAPPLE (will be remapped) */
    "iii\0"
    "glBufferParameteriAPPLE\0"
    "\0"
-   /* _mesa_function_pool[14500]: MultiTexCoord3dvARB (offset 393) */
+   /* _mesa_function_pool[14781]: MultiTexCoord3dvARB (offset 393) */
    "ip\0"
    "glMultiTexCoord3dv\0"
    "glMultiTexCoord3dvARB\0"
    "\0"
-   /* _mesa_function_pool[14545]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[14826]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
    "pppp\0"
    "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[14601]: DeleteObjectARB (will be remapped) */
+   /* _mesa_function_pool[14882]: DeleteObjectARB (will be remapped) */
    "i\0"
    "glDeleteObjectARB\0"
    "\0"
-   /* _mesa_function_pool[14622]: GetShaderPrecisionFormat (will be remapped) */
+   /* _mesa_function_pool[14903]: GetShaderPrecisionFormat (will be remapped) */
    "iipp\0"
    "glGetShaderPrecisionFormat\0"
    "\0"
-   /* _mesa_function_pool[14655]: MatrixIndexPointerARB (dynamic) */
+   /* _mesa_function_pool[14936]: MatrixIndexPointerARB (dynamic) */
    "iiip\0"
    "glMatrixIndexPointerARB\0"
    "\0"
-   /* _mesa_function_pool[14685]: ProgramNamedParameter4dvNV (will be remapped) */
+   /* _mesa_function_pool[14966]: ProgramNamedParameter4dvNV (will be remapped) */
    "iipp\0"
    "glProgramNamedParameter4dvNV\0"
    "\0"
-   /* _mesa_function_pool[14720]: Tangent3fvEXT (dynamic) */
+   /* _mesa_function_pool[15001]: Tangent3fvEXT (dynamic) */
    "p\0"
    "glTangent3fvEXT\0"
    "\0"
-   /* _mesa_function_pool[14739]: Flush (offset 217) */
+   /* _mesa_function_pool[15020]: Flush (offset 217) */
    "\0"
    "glFlush\0"
    "\0"
-   /* _mesa_function_pool[14749]: Color4uiv (offset 38) */
+   /* _mesa_function_pool[15030]: Color4uiv (offset 38) */
    "p\0"
    "glColor4uiv\0"
    "\0"
-   /* _mesa_function_pool[14764]: VertexAttribI4iEXT (will be remapped) */
+   /* _mesa_function_pool[15045]: VertexAttribI4iEXT (will be remapped) */
    "iiiii\0"
    "glVertexAttribI4iEXT\0"
    "glVertexAttribI4i\0"
    "\0"
-   /* _mesa_function_pool[14810]: GenVertexArrays (will be remapped) */
+   /* _mesa_function_pool[15091]: GenVertexArrays (will be remapped) */
    "ip\0"
    "glGenVertexArrays\0"
    "\0"
-   /* _mesa_function_pool[14832]: Uniform3uivEXT (will be remapped) */
+   /* _mesa_function_pool[15113]: Uniform3uivEXT (will be remapped) */
    "iip\0"
    "glUniform3uivEXT\0"
    "glUniform3uiv\0"
    "\0"
-   /* _mesa_function_pool[14868]: RasterPos3sv (offset 77) */
+   /* _mesa_function_pool[15149]: RasterPos3sv (offset 77) */
    "p\0"
    "glRasterPos3sv\0"
    "\0"
-   /* _mesa_function_pool[14886]: BindFramebufferEXT (will be remapped) */
+   /* _mesa_function_pool[15167]: BindFramebufferEXT (will be remapped) */
    "ii\0"
    "glBindFramebuffer\0"
    "glBindFramebufferEXT\0"
    "\0"
-   /* _mesa_function_pool[14929]: ReferencePlaneSGIX (dynamic) */
+   /* _mesa_function_pool[15210]: ReferencePlaneSGIX (dynamic) */
    "p\0"
    "glReferencePlaneSGIX\0"
    "\0"
-   /* _mesa_function_pool[14953]: PushAttrib (offset 219) */
+   /* _mesa_function_pool[15234]: PushAttrib (offset 219) */
    "i\0"
    "glPushAttrib\0"
    "\0"
-   /* _mesa_function_pool[14969]: RasterPos2i (offset 66) */
+   /* _mesa_function_pool[15250]: RasterPos2i (offset 66) */
    "ii\0"
    "glRasterPos2i\0"
    "\0"
-   /* _mesa_function_pool[14987]: ValidateProgramARB (will be remapped) */
+   /* _mesa_function_pool[15268]: ValidateProgramARB (will be remapped) */
    "i\0"
    "glValidateProgram\0"
    "glValidateProgramARB\0"
    "\0"
-   /* _mesa_function_pool[15029]: TexParameteriv (offset 181) */
+   /* _mesa_function_pool[15310]: TexParameteriv (offset 181) */
    "iip\0"
    "glTexParameteriv\0"
    "\0"
-   /* _mesa_function_pool[15051]: UnlockArraysEXT (will be remapped) */
+   /* _mesa_function_pool[15332]: UnlockArraysEXT (will be remapped) */
    "\0"
    "glUnlockArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[15071]: TexCoord2fColor3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[15352]: TexCoord2fColor3fVertex3fSUN (dynamic) */
    "ffffffff\0"
    "glTexCoord2fColor3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[15112]: WindowPos3fvMESA (will be remapped) */
+   /* _mesa_function_pool[15393]: WindowPos3fvMESA (will be remapped) */
    "p\0"
    "glWindowPos3fv\0"
    "glWindowPos3fvARB\0"
    "glWindowPos3fvMESA\0"
    "\0"
-   /* _mesa_function_pool[15167]: RasterPos2f (offset 64) */
+   /* _mesa_function_pool[15448]: RasterPos2f (offset 64) */
    "ff\0"
    "glRasterPos2f\0"
    "\0"
-   /* _mesa_function_pool[15185]: VertexAttrib1svNV (will be remapped) */
+   /* _mesa_function_pool[15466]: VertexAttrib1svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib1svNV\0"
    "\0"
-   /* _mesa_function_pool[15209]: RasterPos2d (offset 62) */
+   /* _mesa_function_pool[15490]: RasterPos2d (offset 62) */
    "dd\0"
    "glRasterPos2d\0"
    "\0"
-   /* _mesa_function_pool[15227]: RasterPos3fv (offset 73) */
+   /* _mesa_function_pool[15508]: RasterPos3fv (offset 73) */
    "p\0"
    "glRasterPos3fv\0"
    "\0"
-   /* _mesa_function_pool[15245]: CopyTexSubImage3D (offset 373) */
+   /* _mesa_function_pool[15526]: CopyTexSubImage3D (offset 373) */
    "iiiiiiiii\0"
    "glCopyTexSubImage3D\0"
    "glCopyTexSubImage3DEXT\0"
    "\0"
-   /* _mesa_function_pool[15299]: VertexAttrib2dARB (will be remapped) */
+   /* _mesa_function_pool[15580]: VertexAttrib2dARB (will be remapped) */
    "idd\0"
    "glVertexAttrib2d\0"
    "glVertexAttrib2dARB\0"
    "\0"
-   /* _mesa_function_pool[15341]: Color4ub (offset 35) */
+   /* _mesa_function_pool[15622]: Color4ub (offset 35) */
    "iiii\0"
    "glColor4ub\0"
    "\0"
-   /* _mesa_function_pool[15358]: GetInteger64v (will be remapped) */
+   /* _mesa_function_pool[15639]: GetInteger64v (will be remapped) */
    "ip\0"
    "glGetInteger64v\0"
    "\0"
-   /* _mesa_function_pool[15378]: TextureColorMaskSGIS (dynamic) */
+   /* _mesa_function_pool[15659]: TextureColorMaskSGIS (dynamic) */
    "iiii\0"
    "glTextureColorMaskSGIS\0"
    "\0"
-   /* _mesa_function_pool[15407]: RasterPos2s (offset 68) */
+   /* _mesa_function_pool[15688]: RasterPos2s (offset 68) */
    "ii\0"
    "glRasterPos2s\0"
    "\0"
-   /* _mesa_function_pool[15425]: GetColorTable (offset 343) */
+   /* _mesa_function_pool[15706]: GetColorTable (offset 343) */
    "iiip\0"
    "glGetColorTable\0"
    "glGetColorTableSGI\0"
    "glGetColorTableEXT\0"
    "\0"
-   /* _mesa_function_pool[15485]: SelectBuffer (offset 195) */
+   /* _mesa_function_pool[15766]: SelectBuffer (offset 195) */
    "ip\0"
    "glSelectBuffer\0"
    "\0"
-   /* _mesa_function_pool[15504]: Indexiv (offset 49) */
+   /* _mesa_function_pool[15785]: Indexiv (offset 49) */
    "p\0"
    "glIndexiv\0"
    "\0"
-   /* _mesa_function_pool[15517]: TexCoord3i (offset 114) */
+   /* _mesa_function_pool[15798]: TexCoord3i (offset 114) */
    "iii\0"
    "glTexCoord3i\0"
    "\0"
-   /* _mesa_function_pool[15535]: CopyColorTable (offset 342) */
+   /* _mesa_function_pool[15816]: CopyColorTable (offset 342) */
    "iiiii\0"
    "glCopyColorTable\0"
    "glCopyColorTableSGI\0"
    "\0"
-   /* _mesa_function_pool[15579]: GetHistogramParameterfv (offset 362) */
+   /* _mesa_function_pool[15860]: GetHistogramParameterfv (offset 362) */
    "iip\0"
    "glGetHistogramParameterfv\0"
    "glGetHistogramParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[15639]: Frustum (offset 289) */
+   /* _mesa_function_pool[15920]: Frustum (offset 289) */
    "dddddd\0"
    "glFrustum\0"
    "\0"
-   /* _mesa_function_pool[15657]: GetString (offset 275) */
+   /* _mesa_function_pool[15938]: GetString (offset 275) */
    "i\0"
    "glGetString\0"
    "\0"
-   /* _mesa_function_pool[15672]: ColorPointervINTEL (dynamic) */
+   /* _mesa_function_pool[15953]: ColorPointervINTEL (dynamic) */
    "iip\0"
    "glColorPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[15698]: TexEnvf (offset 184) */
+   /* _mesa_function_pool[15979]: TexEnvf (offset 184) */
    "iif\0"
    "glTexEnvf\0"
    "\0"
-   /* _mesa_function_pool[15713]: TexCoord3d (offset 110) */
+   /* _mesa_function_pool[15994]: TexCoord3d (offset 110) */
    "ddd\0"
    "glTexCoord3d\0"
    "\0"
-   /* _mesa_function_pool[15731]: AlphaFragmentOp1ATI (will be remapped) */
+   /* _mesa_function_pool[16012]: AlphaFragmentOp1ATI (will be remapped) */
    "iiiiii\0"
    "glAlphaFragmentOp1ATI\0"
    "\0"
-   /* _mesa_function_pool[15761]: TexCoord3f (offset 112) */
+   /* _mesa_function_pool[16042]: TexCoord3f (offset 112) */
    "fff\0"
    "glTexCoord3f\0"
    "\0"
-   /* _mesa_function_pool[15779]: MultiTexCoord3ivARB (offset 397) */
+   /* _mesa_function_pool[16060]: MultiTexCoord3ivARB (offset 397) */
    "ip\0"
    "glMultiTexCoord3iv\0"
    "glMultiTexCoord3ivARB\0"
    "\0"
-   /* _mesa_function_pool[15824]: MultiTexCoord2sARB (offset 390) */
+   /* _mesa_function_pool[16105]: MultiTexCoord2sARB (offset 390) */
    "iii\0"
    "glMultiTexCoord2s\0"
    "glMultiTexCoord2sARB\0"
    "\0"
-   /* _mesa_function_pool[15868]: VertexAttrib1dvARB (will be remapped) */
+   /* _mesa_function_pool[16149]: VertexAttrib1dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib1dv\0"
    "glVertexAttrib1dvARB\0"
    "\0"
-   /* _mesa_function_pool[15911]: DeleteTextures (offset 327) */
+   /* _mesa_function_pool[16192]: GetnHistogramARB (will be remapped) */
+   "iiiiip\0"
+   "glGetnHistogramARB\0"
+   "\0"
+   /* _mesa_function_pool[16219]: DeleteTextures (offset 327) */
    "ip\0"
    "glDeleteTextures\0"
    "glDeleteTexturesEXT\0"
    "\0"
-   /* _mesa_function_pool[15952]: TexCoordPointerEXT (will be remapped) */
+   /* _mesa_function_pool[16260]: TexCoordPointerEXT (will be remapped) */
    "iiiip\0"
    "glTexCoordPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[15980]: TexSubImage4DSGIS (dynamic) */
+   /* _mesa_function_pool[16288]: TexSubImage4DSGIS (dynamic) */
    "iiiiiiiiiiiip\0"
    "glTexSubImage4DSGIS\0"
    "\0"
-   /* _mesa_function_pool[16015]: TexCoord3s (offset 116) */
+   /* _mesa_function_pool[16323]: TexCoord3s (offset 116) */
    "iii\0"
    "glTexCoord3s\0"
    "\0"
-   /* _mesa_function_pool[16033]: GetTexLevelParameteriv (offset 285) */
+   /* _mesa_function_pool[16341]: GetTexLevelParameteriv (offset 285) */
    "iiip\0"
    "glGetTexLevelParameteriv\0"
    "\0"
-   /* _mesa_function_pool[16064]: CombinerStageParameterfvNV (dynamic) */
+   /* _mesa_function_pool[16372]: CombinerStageParameterfvNV (dynamic) */
    "iip\0"
    "glCombinerStageParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[16098]: StopInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[16406]: StopInstrumentsSGIX (dynamic) */
    "i\0"
    "glStopInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[16123]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
+   /* _mesa_function_pool[16431]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
    "fffffffffffffff\0"
    "glTexCoord4fColor4fNormal3fVertex4fSUN\0"
    "\0"
-   /* _mesa_function_pool[16179]: ClearAccum (offset 204) */
+   /* _mesa_function_pool[16487]: ClearAccum (offset 204) */
    "ffff\0"
    "glClearAccum\0"
    "\0"
-   /* _mesa_function_pool[16198]: DeformSGIX (dynamic) */
+   /* _mesa_function_pool[16506]: DeformSGIX (dynamic) */
    "i\0"
    "glDeformSGIX\0"
    "\0"
-   /* _mesa_function_pool[16214]: GetVertexAttribfvARB (will be remapped) */
+   /* _mesa_function_pool[16522]: GetVertexAttribfvARB (will be remapped) */
    "iip\0"
    "glGetVertexAttribfv\0"
    "glGetVertexAttribfvARB\0"
    "\0"
-   /* _mesa_function_pool[16262]: SecondaryColor3ivEXT (will be remapped) */
+   /* _mesa_function_pool[16570]: SecondaryColor3ivEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3iv\0"
    "glSecondaryColor3ivEXT\0"
    "\0"
-   /* _mesa_function_pool[16308]: TexCoord4iv (offset 123) */
+   /* _mesa_function_pool[16616]: TexCoord4iv (offset 123) */
    "p\0"
    "glTexCoord4iv\0"
    "\0"
-   /* _mesa_function_pool[16325]: VertexAttribI4uiEXT (will be remapped) */
+   /* _mesa_function_pool[16633]: VertexAttribI4uiEXT (will be remapped) */
    "iiiii\0"
    "glVertexAttribI4uiEXT\0"
    "glVertexAttribI4ui\0"
    "\0"
-   /* _mesa_function_pool[16373]: GetFragmentMaterialfvSGIX (dynamic) */
+   /* _mesa_function_pool[16681]: GetFragmentMaterialfvSGIX (dynamic) */
    "iip\0"
    "glGetFragmentMaterialfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[16406]: UniformMatrix4x2fv (will be remapped) */
+   /* _mesa_function_pool[16714]: UniformMatrix4x2fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix4x2fv\0"
    "\0"
-   /* _mesa_function_pool[16433]: GetDetailTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[16741]: GetDetailTexFuncSGIS (dynamic) */
    "ip\0"
    "glGetDetailTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[16460]: GetCombinerStageParameterfvNV (dynamic) */
+   /* _mesa_function_pool[16768]: GetCombinerStageParameterfvNV (dynamic) */
    "iip\0"
    "glGetCombinerStageParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[16497]: SamplerParameterIiv (will be remapped) */
+   /* _mesa_function_pool[16805]: SamplerParameterIiv (will be remapped) */
    "iip\0"
    "glSamplerParameterIiv\0"
    "\0"
-   /* _mesa_function_pool[16524]: PolygonOffset (offset 319) */
+   /* _mesa_function_pool[16832]: PolygonOffset (offset 319) */
    "ff\0"
    "glPolygonOffset\0"
    "\0"
-   /* _mesa_function_pool[16544]: BindVertexArray (will be remapped) */
+   /* _mesa_function_pool[16852]: BindVertexArray (will be remapped) */
    "i\0"
    "glBindVertexArray\0"
    "\0"
-   /* _mesa_function_pool[16565]: Color4ubVertex2fvSUN (dynamic) */
+   /* _mesa_function_pool[16873]: Color4ubVertex2fvSUN (dynamic) */
    "pp\0"
    "glColor4ubVertex2fvSUN\0"
    "\0"
-   /* _mesa_function_pool[16592]: Rectd (offset 86) */
+   /* _mesa_function_pool[16900]: Rectd (offset 86) */
    "dddd\0"
    "glRectd\0"
    "\0"
-   /* _mesa_function_pool[16606]: TexFilterFuncSGIS (dynamic) */
+   /* _mesa_function_pool[16914]: TexFilterFuncSGIS (dynamic) */
    "iiip\0"
    "glTexFilterFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[16632]: TextureBarrierNV (will be remapped) */
+   /* _mesa_function_pool[16940]: TextureBarrierNV (will be remapped) */
    "\0"
    "glTextureBarrierNV\0"
    "\0"
-   /* _mesa_function_pool[16653]: SamplerParameterfv (will be remapped) */
+   /* _mesa_function_pool[16961]: SamplerParameterfv (will be remapped) */
    "iip\0"
    "glSamplerParameterfv\0"
    "\0"
-   /* _mesa_function_pool[16679]: VertexAttribI4ubvEXT (will be remapped) */
+   /* _mesa_function_pool[16987]: VertexAttribI4ubvEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4ubvEXT\0"
    "glVertexAttribI4ubv\0"
    "\0"
-   /* _mesa_function_pool[16726]: GetAttribLocationARB (will be remapped) */
+   /* _mesa_function_pool[17034]: GetAttribLocationARB (will be remapped) */
    "ip\0"
    "glGetAttribLocation\0"
    "glGetAttribLocationARB\0"
    "\0"
-   /* _mesa_function_pool[16773]: RasterPos3i (offset 74) */
+   /* _mesa_function_pool[17081]: RasterPos3i (offset 74) */
    "iii\0"
    "glRasterPos3i\0"
    "\0"
-   /* _mesa_function_pool[16792]: BlendEquationSeparateiARB (will be remapped) */
+   /* _mesa_function_pool[17100]: BlendEquationSeparateiARB (will be remapped) */
    "iii\0"
    "glBlendEquationSeparateiARB\0"
    "\0"
-   /* _mesa_function_pool[16825]: VertexAttrib4ubvARB (will be remapped) */
+   /* _mesa_function_pool[17133]: VertexAttrib4ubvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4ubv\0"
    "glVertexAttrib4ubvARB\0"
    "\0"
-   /* _mesa_function_pool[16870]: DetailTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[17178]: DetailTexFuncSGIS (dynamic) */
    "iip\0"
    "glDetailTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[16895]: Normal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[17203]: Normal3fVertex3fSUN (dynamic) */
    "ffffff\0"
    "glNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[16925]: CopyTexImage2D (offset 324) */
+   /* _mesa_function_pool[17233]: CopyTexImage2D (offset 324) */
    "iiiiiiii\0"
    "glCopyTexImage2D\0"
    "glCopyTexImage2DEXT\0"
    "\0"
-   /* _mesa_function_pool[16972]: GetBufferPointervARB (will be remapped) */
+   /* _mesa_function_pool[17280]: GetBufferPointervARB (will be remapped) */
    "iip\0"
    "glGetBufferPointerv\0"
    "glGetBufferPointervARB\0"
    "\0"
-   /* _mesa_function_pool[17020]: ProgramEnvParameter4fARB (will be remapped) */
+   /* _mesa_function_pool[17328]: ProgramEnvParameter4fARB (will be remapped) */
    "iiffff\0"
    "glProgramEnvParameter4fARB\0"
    "glProgramParameter4fNV\0"
    "\0"
-   /* _mesa_function_pool[17078]: Uniform3ivARB (will be remapped) */
+   /* _mesa_function_pool[17386]: Uniform3ivARB (will be remapped) */
    "iip\0"
    "glUniform3iv\0"
    "glUniform3ivARB\0"
    "\0"
-   /* _mesa_function_pool[17112]: Lightfv (offset 160) */
+   /* _mesa_function_pool[17420]: Lightfv (offset 160) */
    "iip\0"
    "glLightfv\0"
    "\0"
-   /* _mesa_function_pool[17127]: PrimitiveRestartIndexNV (will be remapped) */
+   /* _mesa_function_pool[17435]: PrimitiveRestartIndexNV (will be remapped) */
    "i\0"
    "glPrimitiveRestartIndexNV\0"
    "glPrimitiveRestartIndex\0"
    "\0"
-   /* _mesa_function_pool[17180]: ClearDepth (offset 208) */
+   /* _mesa_function_pool[17488]: ClearDepth (offset 208) */
    "d\0"
    "glClearDepth\0"
    "\0"
-   /* _mesa_function_pool[17196]: GetFenceivNV (will be remapped) */
+   /* _mesa_function_pool[17504]: GetFenceivNV (will be remapped) */
    "iip\0"
    "glGetFenceivNV\0"
    "\0"
-   /* _mesa_function_pool[17216]: WindowPos4dvMESA (will be remapped) */
+   /* _mesa_function_pool[17524]: WindowPos4dvMESA (will be remapped) */
    "p\0"
    "glWindowPos4dvMESA\0"
    "\0"
-   /* _mesa_function_pool[17238]: ColorSubTable (offset 346) */
+   /* _mesa_function_pool[17546]: ColorSubTable (offset 346) */
    "iiiiip\0"
    "glColorSubTable\0"
    "glColorSubTableEXT\0"
    "\0"
-   /* _mesa_function_pool[17281]: Color4fv (offset 30) */
+   /* _mesa_function_pool[17589]: Color4fv (offset 30) */
    "p\0"
    "glColor4fv\0"
    "\0"
-   /* _mesa_function_pool[17295]: MultiTexCoord4ivARB (offset 405) */
+   /* _mesa_function_pool[17603]: MultiTexCoord4ivARB (offset 405) */
    "ip\0"
    "glMultiTexCoord4iv\0"
    "glMultiTexCoord4ivARB\0"
    "\0"
-   /* _mesa_function_pool[17340]: ProgramLocalParameters4fvEXT (will be remapped) */
+   /* _mesa_function_pool[17648]: GetnMinmaxARB (will be remapped) */
+   "iiiiip\0"
+   "glGetnMinmaxARB\0"
+   "\0"
+   /* _mesa_function_pool[17672]: ProgramLocalParameters4fvEXT (will be remapped) */
    "iiip\0"
    "glProgramLocalParameters4fvEXT\0"
    "\0"
-   /* _mesa_function_pool[17377]: ColorPointer (offset 308) */
+   /* _mesa_function_pool[17709]: ColorPointer (offset 308) */
    "iiip\0"
    "glColorPointer\0"
    "\0"
-   /* _mesa_function_pool[17398]: Rects (offset 92) */
+   /* _mesa_function_pool[17730]: Rects (offset 92) */
    "iiii\0"
    "glRects\0"
    "\0"
-   /* _mesa_function_pool[17412]: GetMapAttribParameterfvNV (dynamic) */
+   /* _mesa_function_pool[17744]: GetMapAttribParameterfvNV (dynamic) */
    "iiip\0"
    "glGetMapAttribParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[17446]: CreateShaderProgramEXT (will be remapped) */
+   /* _mesa_function_pool[17778]: CreateShaderProgramEXT (will be remapped) */
    "ip\0"
    "glCreateShaderProgramEXT\0"
    "\0"
-   /* _mesa_function_pool[17475]: ActiveProgramEXT (will be remapped) */
+   /* _mesa_function_pool[17807]: ActiveProgramEXT (will be remapped) */
    "i\0"
    "glActiveProgramEXT\0"
    "\0"
-   /* _mesa_function_pool[17497]: Lightiv (offset 162) */
+   /* _mesa_function_pool[17829]: Lightiv (offset 162) */
    "iip\0"
    "glLightiv\0"
    "\0"
-   /* _mesa_function_pool[17512]: VertexAttrib4sARB (will be remapped) */
+   /* _mesa_function_pool[17844]: VertexAttrib4sARB (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4s\0"
    "glVertexAttrib4sARB\0"
    "\0"
-   /* _mesa_function_pool[17556]: GetQueryObjectuivARB (will be remapped) */
+   /* _mesa_function_pool[17888]: GetQueryObjectuivARB (will be remapped) */
    "iip\0"
    "glGetQueryObjectuiv\0"
    "glGetQueryObjectuivARB\0"
    "\0"
-   /* _mesa_function_pool[17604]: GetTexParameteriv (offset 283) */
+   /* _mesa_function_pool[17936]: GetTexParameteriv (offset 283) */
    "iip\0"
    "glGetTexParameteriv\0"
    "\0"
-   /* _mesa_function_pool[17629]: MapParameterivNV (dynamic) */
+   /* _mesa_function_pool[17961]: MapParameterivNV (dynamic) */
    "iip\0"
    "glMapParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[17653]: GenRenderbuffersEXT (will be remapped) */
+   /* _mesa_function_pool[17985]: GenRenderbuffersEXT (will be remapped) */
    "ip\0"
    "glGenRenderbuffers\0"
    "glGenRenderbuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[17698]: ClearBufferfv (will be remapped) */
+   /* _mesa_function_pool[18030]: ClearBufferfv (will be remapped) */
    "iip\0"
    "glClearBufferfv\0"
    "\0"
-   /* _mesa_function_pool[17719]: VertexAttrib2dvARB (will be remapped) */
+   /* _mesa_function_pool[18051]: VertexAttrib2dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib2dv\0"
    "glVertexAttrib2dvARB\0"
    "\0"
-   /* _mesa_function_pool[17762]: EdgeFlagPointerEXT (will be remapped) */
+   /* _mesa_function_pool[18094]: EdgeFlagPointerEXT (will be remapped) */
    "iip\0"
    "glEdgeFlagPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[17788]: VertexAttribs2svNV (will be remapped) */
+   /* _mesa_function_pool[18120]: VertexAttribs2svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs2svNV\0"
    "\0"
-   /* _mesa_function_pool[17814]: WeightbvARB (dynamic) */
+   /* _mesa_function_pool[18146]: WeightbvARB (dynamic) */
    "ip\0"
    "glWeightbvARB\0"
    "\0"
-   /* _mesa_function_pool[17832]: VertexAttrib2fvARB (will be remapped) */
+   /* _mesa_function_pool[18164]: VertexAttrib2fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib2fv\0"
    "glVertexAttrib2fvARB\0"
    "\0"
-   /* _mesa_function_pool[17875]: GetBufferParameterivARB (will be remapped) */
+   /* _mesa_function_pool[18207]: GetBufferParameterivARB (will be remapped) */
    "iip\0"
    "glGetBufferParameteriv\0"
    "glGetBufferParameterivARB\0"
    "\0"
-   /* _mesa_function_pool[17929]: Rectdv (offset 87) */
+   /* _mesa_function_pool[18261]: Rectdv (offset 87) */
    "pp\0"
    "glRectdv\0"
    "\0"
-   /* _mesa_function_pool[17942]: ListParameteriSGIX (dynamic) */
+   /* _mesa_function_pool[18274]: ListParameteriSGIX (dynamic) */
    "iii\0"
    "glListParameteriSGIX\0"
    "\0"
-   /* _mesa_function_pool[17968]: BlendEquationiARB (will be remapped) */
+   /* _mesa_function_pool[18300]: BlendEquationiARB (will be remapped) */
    "ii\0"
    "glBlendEquationiARB\0"
    "\0"
-   /* _mesa_function_pool[17992]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[18324]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
    "iffffffffff\0"
    "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[18051]: InstrumentsBufferSGIX (dynamic) */
+   /* _mesa_function_pool[18383]: InstrumentsBufferSGIX (dynamic) */
    "ip\0"
    "glInstrumentsBufferSGIX\0"
    "\0"
-   /* _mesa_function_pool[18079]: VertexAttrib4NivARB (will be remapped) */
+   /* _mesa_function_pool[18411]: VertexAttrib4NivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Niv\0"
    "glVertexAttrib4NivARB\0"
    "\0"
-   /* _mesa_function_pool[18124]: DrawArraysInstancedARB (will be remapped) */
+   /* _mesa_function_pool[18456]: DrawArraysInstancedARB (will be remapped) */
    "iiii\0"
    "glDrawArraysInstancedARB\0"
    "glDrawArraysInstancedEXT\0"
    "glDrawArraysInstanced\0"
    "\0"
-   /* _mesa_function_pool[18202]: GetAttachedShaders (will be remapped) */
+   /* _mesa_function_pool[18534]: GetAttachedShaders (will be remapped) */
    "iipp\0"
    "glGetAttachedShaders\0"
    "\0"
-   /* _mesa_function_pool[18229]: GenVertexArraysAPPLE (will be remapped) */
+   /* _mesa_function_pool[18561]: GenVertexArraysAPPLE (will be remapped) */
    "ip\0"
    "glGenVertexArraysAPPLE\0"
    "\0"
-   /* _mesa_function_pool[18256]: ClearBufferfi (will be remapped) */
+   /* _mesa_function_pool[18588]: ClearBufferfi (will be remapped) */
    "iifi\0"
    "glClearBufferfi\0"
    "\0"
-   /* _mesa_function_pool[18278]: Materialiv (offset 172) */
+   /* _mesa_function_pool[18610]: Materialiv (offset 172) */
    "iip\0"
    "glMaterialiv\0"
    "\0"
-   /* _mesa_function_pool[18296]: PushClientAttrib (offset 335) */
+   /* _mesa_function_pool[18628]: PushClientAttrib (offset 335) */
    "i\0"
    "glPushClientAttrib\0"
    "\0"
-   /* _mesa_function_pool[18318]: SamplerParameteriv (will be remapped) */
+   /* _mesa_function_pool[18650]: SamplerParameteriv (will be remapped) */
    "iip\0"
    "glSamplerParameteriv\0"
    "\0"
-   /* _mesa_function_pool[18344]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[18676]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
    "pppp\0"
    "glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[18390]: WindowPos2iMESA (will be remapped) */
+   /* _mesa_function_pool[18722]: WindowPos2iMESA (will be remapped) */
    "ii\0"
    "glWindowPos2i\0"
    "glWindowPos2iARB\0"
    "glWindowPos2iMESA\0"
    "\0"
-   /* _mesa_function_pool[18443]: SampleMaskSGIS (will be remapped) */
+   /* _mesa_function_pool[18775]: SampleMaskSGIS (will be remapped) */
    "fi\0"
    "glSampleMaskSGIS\0"
    "glSampleMaskEXT\0"
    "\0"
-   /* _mesa_function_pool[18480]: SecondaryColor3fvEXT (will be remapped) */
+   /* _mesa_function_pool[18812]: SecondaryColor3fvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3fv\0"
    "glSecondaryColor3fvEXT\0"
    "\0"
-   /* _mesa_function_pool[18526]: PolygonMode (offset 174) */
+   /* _mesa_function_pool[18858]: PolygonMode (offset 174) */
    "ii\0"
    "glPolygonMode\0"
    "\0"
-   /* _mesa_function_pool[18544]: CompressedTexSubImage1DARB (will be remapped) */
+   /* _mesa_function_pool[18876]: CompressedTexSubImage1DARB (will be remapped) */
    "iiiiiip\0"
    "glCompressedTexSubImage1D\0"
    "glCompressedTexSubImage1DARB\0"
    "\0"
-   /* _mesa_function_pool[18608]: VertexAttribI1iEXT (will be remapped) */
+   /* _mesa_function_pool[18940]: VertexAttribI1iEXT (will be remapped) */
    "ii\0"
    "glVertexAttribI1iEXT\0"
    "glVertexAttribI1i\0"
    "\0"
-   /* _mesa_function_pool[18651]: TexCoord2fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[18983]: TexCoord2fNormal3fVertex3fSUN (dynamic) */
    "ffffffff\0"
    "glTexCoord2fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[18693]: GetVertexAttribivNV (will be remapped) */
+   /* _mesa_function_pool[19025]: GetVertexAttribivNV (will be remapped) */
    "iip\0"
    "glGetVertexAttribivNV\0"
    "\0"
-   /* _mesa_function_pool[18720]: GetProgramStringARB (will be remapped) */
+   /* _mesa_function_pool[19052]: GetProgramStringARB (will be remapped) */
    "iip\0"
    "glGetProgramStringARB\0"
    "\0"
-   /* _mesa_function_pool[18747]: VertexAttribIPointerEXT (will be remapped) */
+   /* _mesa_function_pool[19079]: GetnUniformdvARB (will be remapped) */
+   "iiip\0"
+   "glGetnUniformdvARB\0"
+   "\0"
+   /* _mesa_function_pool[19104]: VertexAttribIPointerEXT (will be remapped) */
    "iiiip\0"
    "glVertexAttribIPointerEXT\0"
    "glVertexAttribIPointer\0"
    "\0"
-   /* _mesa_function_pool[18803]: TexBumpParameterfvATI (will be remapped) */
+   /* _mesa_function_pool[19160]: TexBumpParameterfvATI (will be remapped) */
    "ip\0"
    "glTexBumpParameterfvATI\0"
    "\0"
-   /* _mesa_function_pool[18831]: Tangent3ivEXT (dynamic) */
+   /* _mesa_function_pool[19188]: Tangent3ivEXT (dynamic) */
    "p\0"
    "glTangent3ivEXT\0"
    "\0"
-   /* _mesa_function_pool[18850]: CompileShaderARB (will be remapped) */
+   /* _mesa_function_pool[19207]: CompileShaderARB (will be remapped) */
    "i\0"
    "glCompileShader\0"
    "glCompileShaderARB\0"
    "\0"
-   /* _mesa_function_pool[18888]: DeleteShader (will be remapped) */
+   /* _mesa_function_pool[19245]: DeleteShader (will be remapped) */
    "i\0"
    "glDeleteShader\0"
    "\0"
-   /* _mesa_function_pool[18906]: DisableClientState (offset 309) */
+   /* _mesa_function_pool[19263]: DisableClientState (offset 309) */
    "i\0"
    "glDisableClientState\0"
    "\0"
-   /* _mesa_function_pool[18930]: TexGeni (offset 192) */
+   /* _mesa_function_pool[19287]: TexGeni (offset 192) */
    "iii\0"
    "glTexGeni\0"
    "\0"
-   /* _mesa_function_pool[18945]: TexGenf (offset 190) */
+   /* _mesa_function_pool[19302]: TexGenf (offset 190) */
    "iif\0"
    "glTexGenf\0"
    "\0"
-   /* _mesa_function_pool[18960]: Uniform3fARB (will be remapped) */
+   /* _mesa_function_pool[19317]: Uniform3fARB (will be remapped) */
    "ifff\0"
    "glUniform3f\0"
    "glUniform3fARB\0"
    "\0"
-   /* _mesa_function_pool[18993]: TexGend (offset 188) */
+   /* _mesa_function_pool[19350]: TexGend (offset 188) */
    "iid\0"
    "glTexGend\0"
    "\0"
-   /* _mesa_function_pool[19008]: ListParameterfvSGIX (dynamic) */
+   /* _mesa_function_pool[19365]: ListParameterfvSGIX (dynamic) */
    "iip\0"
    "glListParameterfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[19035]: GetPolygonStipple (offset 274) */
+   /* _mesa_function_pool[19392]: GetPolygonStipple (offset 274) */
    "p\0"
    "glGetPolygonStipple\0"
    "\0"
-   /* _mesa_function_pool[19058]: Tangent3dvEXT (dynamic) */
+   /* _mesa_function_pool[19415]: Tangent3dvEXT (dynamic) */
    "p\0"
    "glTangent3dvEXT\0"
    "\0"
-   /* _mesa_function_pool[19077]: BindBufferOffsetEXT (will be remapped) */
+   /* _mesa_function_pool[19434]: BindBufferOffsetEXT (will be remapped) */
    "iiii\0"
    "glBindBufferOffsetEXT\0"
    "\0"
-   /* _mesa_function_pool[19105]: WindowPos3sMESA (will be remapped) */
+   /* _mesa_function_pool[19462]: WindowPos3sMESA (will be remapped) */
    "iii\0"
    "glWindowPos3s\0"
    "glWindowPos3sARB\0"
    "glWindowPos3sMESA\0"
    "\0"
-   /* _mesa_function_pool[19159]: VertexAttrib2svNV (will be remapped) */
+   /* _mesa_function_pool[19516]: VertexAttrib2svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib2svNV\0"
    "\0"
-   /* _mesa_function_pool[19183]: DisableIndexedEXT (will be remapped) */
+   /* _mesa_function_pool[19540]: DisableIndexedEXT (will be remapped) */
    "ii\0"
    "glDisableIndexedEXT\0"
    "glDisablei\0"
    "\0"
-   /* _mesa_function_pool[19218]: BindBufferBaseEXT (will be remapped) */
+   /* _mesa_function_pool[19575]: BindBufferBaseEXT (will be remapped) */
    "iii\0"
    "glBindBufferBaseEXT\0"
    "glBindBufferBase\0"
    "\0"
-   /* _mesa_function_pool[19260]: TexCoord2fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[19617]: TexCoord2fVertex3fvSUN (dynamic) */
    "pp\0"
    "glTexCoord2fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[19289]: WindowPos4sMESA (will be remapped) */
+   /* _mesa_function_pool[19646]: WindowPos4sMESA (will be remapped) */
    "iiii\0"
    "glWindowPos4sMESA\0"
    "\0"
-   /* _mesa_function_pool[19313]: VertexAttrib4NuivARB (will be remapped) */
+   /* _mesa_function_pool[19670]: GetnPixelMapuivARB (will be remapped) */
+   "iip\0"
+   "glGetnPixelMapuivARB\0"
+   "\0"
+   /* _mesa_function_pool[19696]: VertexAttrib4NuivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nuiv\0"
    "glVertexAttrib4NuivARB\0"
    "\0"
-   /* _mesa_function_pool[19360]: ClientActiveTextureARB (offset 375) */
+   /* _mesa_function_pool[19743]: ClientActiveTextureARB (offset 375) */
    "i\0"
    "glClientActiveTexture\0"
    "glClientActiveTextureARB\0"
    "\0"
-   /* _mesa_function_pool[19410]: GetSamplerParameterIuiv (will be remapped) */
+   /* _mesa_function_pool[19793]: GetSamplerParameterIuiv (will be remapped) */
    "iip\0"
    "glGetSamplerParameterIuiv\0"
    "\0"
-   /* _mesa_function_pool[19441]: ReplacementCodeusvSUN (dynamic) */
+   /* _mesa_function_pool[19824]: ReplacementCodeusvSUN (dynamic) */
    "p\0"
    "glReplacementCodeusvSUN\0"
    "\0"
-   /* _mesa_function_pool[19468]: Uniform4fARB (will be remapped) */
+   /* _mesa_function_pool[19851]: Uniform4fARB (will be remapped) */
    "iffff\0"
    "glUniform4f\0"
    "glUniform4fARB\0"
    "\0"
-   /* _mesa_function_pool[19502]: Color4sv (offset 34) */
+   /* _mesa_function_pool[19885]: Color4sv (offset 34) */
    "p\0"
    "glColor4sv\0"
    "\0"
-   /* _mesa_function_pool[19516]: FlushMappedBufferRange (will be remapped) */
+   /* _mesa_function_pool[19899]: FlushMappedBufferRange (will be remapped) */
    "iii\0"
    "glFlushMappedBufferRange\0"
    "\0"
-   /* _mesa_function_pool[19546]: IsProgramNV (will be remapped) */
+   /* _mesa_function_pool[19929]: IsProgramNV (will be remapped) */
    "i\0"
    "glIsProgramARB\0"
    "glIsProgramNV\0"
    "\0"
-   /* _mesa_function_pool[19578]: FlushMappedBufferRangeAPPLE (will be remapped) */
+   /* _mesa_function_pool[19961]: FlushMappedBufferRangeAPPLE (will be remapped) */
    "iii\0"
    "glFlushMappedBufferRangeAPPLE\0"
    "\0"
-   /* _mesa_function_pool[19613]: PixelZoom (offset 246) */
+   /* _mesa_function_pool[19996]: PixelZoom (offset 246) */
    "ff\0"
    "glPixelZoom\0"
    "\0"
-   /* _mesa_function_pool[19629]: ReplacementCodePointerSUN (dynamic) */
+   /* _mesa_function_pool[20012]: ReplacementCodePointerSUN (dynamic) */
    "iip\0"
    "glReplacementCodePointerSUN\0"
    "\0"
-   /* _mesa_function_pool[19662]: ProgramEnvParameter4dARB (will be remapped) */
+   /* _mesa_function_pool[20045]: ProgramEnvParameter4dARB (will be remapped) */
    "iidddd\0"
    "glProgramEnvParameter4dARB\0"
    "glProgramParameter4dNV\0"
    "\0"
-   /* _mesa_function_pool[19720]: ColorTableParameterfv (offset 340) */
+   /* _mesa_function_pool[20103]: ColorTableParameterfv (offset 340) */
    "iip\0"
    "glColorTableParameterfv\0"
    "glColorTableParameterfvSGI\0"
    "\0"
-   /* _mesa_function_pool[19776]: FragmentLightModelfSGIX (dynamic) */
+   /* _mesa_function_pool[20159]: FragmentLightModelfSGIX (dynamic) */
    "if\0"
    "glFragmentLightModelfSGIX\0"
    "\0"
-   /* _mesa_function_pool[19806]: Binormal3bvEXT (dynamic) */
+   /* _mesa_function_pool[20189]: Binormal3bvEXT (dynamic) */
    "p\0"
    "glBinormal3bvEXT\0"
    "\0"
-   /* _mesa_function_pool[19826]: PixelMapuiv (offset 252) */
+   /* _mesa_function_pool[20209]: PixelMapuiv (offset 252) */
    "iip\0"
    "glPixelMapuiv\0"
    "\0"
-   /* _mesa_function_pool[19845]: Color3dv (offset 12) */
+   /* _mesa_function_pool[20228]: Color3dv (offset 12) */
    "p\0"
    "glColor3dv\0"
    "\0"
-   /* _mesa_function_pool[19859]: IsTexture (offset 330) */
+   /* _mesa_function_pool[20242]: IsTexture (offset 330) */
    "i\0"
    "glIsTexture\0"
    "glIsTextureEXT\0"
    "\0"
-   /* _mesa_function_pool[19889]: GenSamplers (will be remapped) */
+   /* _mesa_function_pool[20272]: GenSamplers (will be remapped) */
    "ip\0"
    "glGenSamplers\0"
    "\0"
-   /* _mesa_function_pool[19907]: VertexWeightfvEXT (dynamic) */
+   /* _mesa_function_pool[20290]: VertexWeightfvEXT (dynamic) */
    "p\0"
    "glVertexWeightfvEXT\0"
    "\0"
-   /* _mesa_function_pool[19930]: VertexAttrib1dARB (will be remapped) */
+   /* _mesa_function_pool[20313]: VertexAttrib1dARB (will be remapped) */
    "id\0"
    "glVertexAttrib1d\0"
    "glVertexAttrib1dARB\0"
    "\0"
-   /* _mesa_function_pool[19971]: ImageTransformParameterivHP (dynamic) */
+   /* _mesa_function_pool[20354]: ImageTransformParameterivHP (dynamic) */
    "iip\0"
    "glImageTransformParameterivHP\0"
    "\0"
-   /* _mesa_function_pool[20006]: TexCoord4i (offset 122) */
+   /* _mesa_function_pool[20389]: TexCoord4i (offset 122) */
    "iiii\0"
    "glTexCoord4i\0"
    "\0"
-   /* _mesa_function_pool[20025]: DeleteQueriesARB (will be remapped) */
+   /* _mesa_function_pool[20408]: DeleteQueriesARB (will be remapped) */
    "ip\0"
    "glDeleteQueries\0"
    "glDeleteQueriesARB\0"
    "\0"
-   /* _mesa_function_pool[20064]: Color4ubVertex2fSUN (dynamic) */
+   /* _mesa_function_pool[20447]: Color4ubVertex2fSUN (dynamic) */
    "iiiiff\0"
    "glColor4ubVertex2fSUN\0"
    "\0"
-   /* _mesa_function_pool[20094]: FragmentColorMaterialSGIX (dynamic) */
+   /* _mesa_function_pool[20477]: FragmentColorMaterialSGIX (dynamic) */
    "ii\0"
    "glFragmentColorMaterialSGIX\0"
    "\0"
-   /* _mesa_function_pool[20126]: CurrentPaletteMatrixARB (dynamic) */
+   /* _mesa_function_pool[20509]: CurrentPaletteMatrixARB (dynamic) */
    "i\0"
    "glCurrentPaletteMatrixARB\0"
    "\0"
-   /* _mesa_function_pool[20155]: GetMapdv (offset 266) */
+   /* _mesa_function_pool[20538]: GetMapdv (offset 266) */
    "iip\0"
    "glGetMapdv\0"
    "\0"
-   /* _mesa_function_pool[20171]: ObjectPurgeableAPPLE (will be remapped) */
+   /* _mesa_function_pool[20554]: ObjectPurgeableAPPLE (will be remapped) */
    "iii\0"
    "glObjectPurgeableAPPLE\0"
    "\0"
-   /* _mesa_function_pool[20199]: GetStringi (will be remapped) */
+   /* _mesa_function_pool[20582]: GetStringi (will be remapped) */
    "ii\0"
    "glGetStringi\0"
    "\0"
-   /* _mesa_function_pool[20216]: SamplePatternSGIS (will be remapped) */
+   /* _mesa_function_pool[20599]: SamplePatternSGIS (will be remapped) */
    "i\0"
    "glSamplePatternSGIS\0"
    "glSamplePatternEXT\0"
    "\0"
-   /* _mesa_function_pool[20258]: PixelStoref (offset 249) */
+   /* _mesa_function_pool[20641]: PixelStoref (offset 249) */
    "if\0"
    "glPixelStoref\0"
    "\0"
-   /* _mesa_function_pool[20276]: IsQueryARB (will be remapped) */
+   /* _mesa_function_pool[20659]: IsQueryARB (will be remapped) */
    "i\0"
    "glIsQuery\0"
    "glIsQueryARB\0"
    "\0"
-   /* _mesa_function_pool[20302]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[20685]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
    "iiiiifff\0"
    "glReplacementCodeuiColor4ubVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[20351]: PixelStorei (offset 250) */
+   /* _mesa_function_pool[20734]: PixelStorei (offset 250) */
    "ii\0"
    "glPixelStorei\0"
    "\0"
-   /* _mesa_function_pool[20369]: VertexAttrib4usvARB (will be remapped) */
+   /* _mesa_function_pool[20752]: VertexAttrib4usvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4usv\0"
    "glVertexAttrib4usvARB\0"
    "\0"
-   /* _mesa_function_pool[20414]: LinkProgramARB (will be remapped) */
+   /* _mesa_function_pool[20797]: LinkProgramARB (will be remapped) */
    "i\0"
    "glLinkProgram\0"
    "glLinkProgramARB\0"
    "\0"
-   /* _mesa_function_pool[20448]: VertexAttrib2fNV (will be remapped) */
+   /* _mesa_function_pool[20831]: VertexAttrib2fNV (will be remapped) */
    "iff\0"
    "glVertexAttrib2fNV\0"
    "\0"
-   /* _mesa_function_pool[20472]: ShaderSourceARB (will be remapped) */
+   /* _mesa_function_pool[20855]: ShaderSourceARB (will be remapped) */
    "iipp\0"
    "glShaderSource\0"
    "glShaderSourceARB\0"
    "\0"
-   /* _mesa_function_pool[20511]: FragmentMaterialiSGIX (dynamic) */
+   /* _mesa_function_pool[20894]: FragmentMaterialiSGIX (dynamic) */
    "iii\0"
    "glFragmentMaterialiSGIX\0"
    "\0"
-   /* _mesa_function_pool[20540]: EvalCoord2dv (offset 233) */
+   /* _mesa_function_pool[20923]: EvalCoord2dv (offset 233) */
    "p\0"
    "glEvalCoord2dv\0"
    "\0"
-   /* _mesa_function_pool[20558]: VertexAttrib3svARB (will be remapped) */
+   /* _mesa_function_pool[20941]: VertexAttrib3svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib3sv\0"
    "glVertexAttrib3svARB\0"
    "\0"
-   /* _mesa_function_pool[20601]: ColorMaterial (offset 151) */
+   /* _mesa_function_pool[20984]: ColorMaterial (offset 151) */
    "ii\0"
    "glColorMaterial\0"
    "\0"
-   /* _mesa_function_pool[20621]: CompressedTexSubImage3DARB (will be remapped) */
+   /* _mesa_function_pool[21004]: CompressedTexSubImage3DARB (will be remapped) */
    "iiiiiiiiiip\0"
    "glCompressedTexSubImage3D\0"
    "glCompressedTexSubImage3DARB\0"
    "\0"
-   /* _mesa_function_pool[20689]: WindowPos2ivMESA (will be remapped) */
+   /* _mesa_function_pool[21072]: WindowPos2ivMESA (will be remapped) */
    "p\0"
    "glWindowPos2iv\0"
    "glWindowPos2ivARB\0"
    "glWindowPos2ivMESA\0"
    "\0"
-   /* _mesa_function_pool[20744]: IsFramebufferEXT (will be remapped) */
+   /* _mesa_function_pool[21127]: IsFramebufferEXT (will be remapped) */
    "i\0"
    "glIsFramebuffer\0"
    "glIsFramebufferEXT\0"
    "\0"
-   /* _mesa_function_pool[20782]: Uniform4ivARB (will be remapped) */
+   /* _mesa_function_pool[21165]: Uniform4ivARB (will be remapped) */
    "iip\0"
    "glUniform4iv\0"
    "glUniform4ivARB\0"
    "\0"
-   /* _mesa_function_pool[20816]: GetVertexAttribdvARB (will be remapped) */
+   /* _mesa_function_pool[21199]: GetVertexAttribdvARB (will be remapped) */
    "iip\0"
    "glGetVertexAttribdv\0"
    "glGetVertexAttribdvARB\0"
    "\0"
-   /* _mesa_function_pool[20864]: TexBumpParameterivATI (will be remapped) */
+   /* _mesa_function_pool[21247]: TexBumpParameterivATI (will be remapped) */
    "ip\0"
    "glTexBumpParameterivATI\0"
    "\0"
-   /* _mesa_function_pool[20892]: GetSeparableFilter (offset 359) */
+   /* _mesa_function_pool[21275]: GetSeparableFilter (offset 359) */
    "iiippp\0"
    "glGetSeparableFilter\0"
    "glGetSeparableFilterEXT\0"
    "\0"
-   /* _mesa_function_pool[20945]: Binormal3dEXT (dynamic) */
+   /* _mesa_function_pool[21328]: Binormal3dEXT (dynamic) */
    "ddd\0"
    "glBinormal3dEXT\0"
    "\0"
-   /* _mesa_function_pool[20966]: SpriteParameteriSGIX (dynamic) */
+   /* _mesa_function_pool[21349]: SpriteParameteriSGIX (dynamic) */
    "ii\0"
    "glSpriteParameteriSGIX\0"
    "\0"
-   /* _mesa_function_pool[20993]: RequestResidentProgramsNV (will be remapped) */
+   /* _mesa_function_pool[21376]: RequestResidentProgramsNV (will be remapped) */
    "ip\0"
    "glRequestResidentProgramsNV\0"
    "\0"
-   /* _mesa_function_pool[21025]: TagSampleBufferSGIX (dynamic) */
+   /* _mesa_function_pool[21408]: TagSampleBufferSGIX (dynamic) */
    "\0"
    "glTagSampleBufferSGIX\0"
    "\0"
-   /* _mesa_function_pool[21049]: TransformFeedbackVaryingsEXT (will be remapped) */
+   /* _mesa_function_pool[21432]: TransformFeedbackVaryingsEXT (will be remapped) */
    "iipi\0"
    "glTransformFeedbackVaryingsEXT\0"
    "glTransformFeedbackVaryings\0"
    "\0"
-   /* _mesa_function_pool[21114]: FeedbackBuffer (offset 194) */
+   /* _mesa_function_pool[21497]: FeedbackBuffer (offset 194) */
    "iip\0"
    "glFeedbackBuffer\0"
    "\0"
-   /* _mesa_function_pool[21136]: RasterPos2iv (offset 67) */
+   /* _mesa_function_pool[21519]: RasterPos2iv (offset 67) */
    "p\0"
    "glRasterPos2iv\0"
    "\0"
-   /* _mesa_function_pool[21154]: TexImage1D (offset 182) */
+   /* _mesa_function_pool[21537]: TexImage1D (offset 182) */
    "iiiiiiip\0"
    "glTexImage1D\0"
    "\0"
-   /* _mesa_function_pool[21177]: ListParameterivSGIX (dynamic) */
+   /* _mesa_function_pool[21560]: ListParameterivSGIX (dynamic) */
    "iip\0"
    "glListParameterivSGIX\0"
    "\0"
-   /* _mesa_function_pool[21204]: MultiDrawElementsEXT (will be remapped) */
+   /* _mesa_function_pool[21587]: MultiDrawElementsEXT (will be remapped) */
    "ipipi\0"
    "glMultiDrawElements\0"
    "glMultiDrawElementsEXT\0"
    "\0"
-   /* _mesa_function_pool[21254]: Color3s (offset 17) */
+   /* _mesa_function_pool[21637]: Color3s (offset 17) */
    "iii\0"
    "glColor3s\0"
    "\0"
-   /* _mesa_function_pool[21269]: Uniform1ivARB (will be remapped) */
+   /* _mesa_function_pool[21652]: Uniform1ivARB (will be remapped) */
    "iip\0"
    "glUniform1iv\0"
    "glUniform1ivARB\0"
    "\0"
-   /* _mesa_function_pool[21303]: WindowPos2sMESA (will be remapped) */
+   /* _mesa_function_pool[21686]: WindowPos2sMESA (will be remapped) */
    "ii\0"
    "glWindowPos2s\0"
    "glWindowPos2sARB\0"
    "glWindowPos2sMESA\0"
    "\0"
-   /* _mesa_function_pool[21356]: WeightusvARB (dynamic) */
+   /* _mesa_function_pool[21739]: WeightusvARB (dynamic) */
    "ip\0"
    "glWeightusvARB\0"
    "\0"
-   /* _mesa_function_pool[21375]: TexCoordPointer (offset 320) */
+   /* _mesa_function_pool[21758]: TexCoordPointer (offset 320) */
    "iiip\0"
    "glTexCoordPointer\0"
    "\0"
-   /* _mesa_function_pool[21399]: FogCoordPointerEXT (will be remapped) */
+   /* _mesa_function_pool[21782]: FogCoordPointerEXT (will be remapped) */
    "iip\0"
    "glFogCoordPointer\0"
    "glFogCoordPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[21443]: IndexMaterialEXT (dynamic) */
+   /* _mesa_function_pool[21826]: GetnSeparableFilterARB (will be remapped) */
+   "iiiipipp\0"
+   "glGetnSeparableFilterARB\0"
+   "\0"
+   /* _mesa_function_pool[21861]: IndexMaterialEXT (dynamic) */
    "ii\0"
    "glIndexMaterialEXT\0"
    "\0"
-   /* _mesa_function_pool[21466]: Color3i (offset 15) */
+   /* _mesa_function_pool[21884]: Color3i (offset 15) */
    "iii\0"
    "glColor3i\0"
    "\0"
-   /* _mesa_function_pool[21481]: FrontFace (offset 157) */
+   /* _mesa_function_pool[21899]: FrontFace (offset 157) */
    "i\0"
    "glFrontFace\0"
    "\0"
-   /* _mesa_function_pool[21496]: EvalCoord2d (offset 232) */
+   /* _mesa_function_pool[21914]: EvalCoord2d (offset 232) */
    "dd\0"
    "glEvalCoord2d\0"
    "\0"
-   /* _mesa_function_pool[21514]: SecondaryColor3ubvEXT (will be remapped) */
+   /* _mesa_function_pool[21932]: SecondaryColor3ubvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3ubv\0"
    "glSecondaryColor3ubvEXT\0"
    "\0"
-   /* _mesa_function_pool[21562]: EvalCoord2f (offset 234) */
+   /* _mesa_function_pool[21980]: EvalCoord2f (offset 234) */
    "ff\0"
    "glEvalCoord2f\0"
    "\0"
-   /* _mesa_function_pool[21580]: VertexAttrib4dvARB (will be remapped) */
+   /* _mesa_function_pool[21998]: VertexAttrib4dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4dv\0"
    "glVertexAttrib4dvARB\0"
    "\0"
-   /* _mesa_function_pool[21623]: BindAttribLocationARB (will be remapped) */
+   /* _mesa_function_pool[22041]: BindAttribLocationARB (will be remapped) */
    "iip\0"
    "glBindAttribLocation\0"
    "glBindAttribLocationARB\0"
    "\0"
-   /* _mesa_function_pool[21673]: Color3b (offset 9) */
+   /* _mesa_function_pool[22091]: Color3b (offset 9) */
    "iii\0"
    "glColor3b\0"
    "\0"
-   /* _mesa_function_pool[21688]: MultiTexCoord2dARB (offset 384) */
+   /* _mesa_function_pool[22106]: MultiTexCoord2dARB (offset 384) */
    "idd\0"
    "glMultiTexCoord2d\0"
    "glMultiTexCoord2dARB\0"
    "\0"
-   /* _mesa_function_pool[21732]: ExecuteProgramNV (will be remapped) */
+   /* _mesa_function_pool[22150]: ExecuteProgramNV (will be remapped) */
    "iip\0"
    "glExecuteProgramNV\0"
    "\0"
-   /* _mesa_function_pool[21756]: Color3f (offset 13) */
+   /* _mesa_function_pool[22174]: Color3f (offset 13) */
    "fff\0"
    "glColor3f\0"
    "\0"
-   /* _mesa_function_pool[21771]: LightEnviSGIX (dynamic) */
+   /* _mesa_function_pool[22189]: LightEnviSGIX (dynamic) */
    "ii\0"
    "glLightEnviSGIX\0"
    "\0"
-   /* _mesa_function_pool[21791]: Color3d (offset 11) */
+   /* _mesa_function_pool[22209]: Color3d (offset 11) */
    "ddd\0"
    "glColor3d\0"
    "\0"
-   /* _mesa_function_pool[21806]: Normal3dv (offset 55) */
+   /* _mesa_function_pool[22224]: Normal3dv (offset 55) */
    "p\0"
    "glNormal3dv\0"
    "\0"
-   /* _mesa_function_pool[21821]: Lightf (offset 159) */
+   /* _mesa_function_pool[22239]: Lightf (offset 159) */
    "iif\0"
    "glLightf\0"
    "\0"
-   /* _mesa_function_pool[21835]: ReplacementCodeuiSUN (dynamic) */
+   /* _mesa_function_pool[22253]: ReplacementCodeuiSUN (dynamic) */
    "i\0"
    "glReplacementCodeuiSUN\0"
    "\0"
-   /* _mesa_function_pool[21861]: MatrixMode (offset 293) */
+   /* _mesa_function_pool[22279]: MatrixMode (offset 293) */
    "i\0"
    "glMatrixMode\0"
    "\0"
-   /* _mesa_function_pool[21877]: GetPixelMapusv (offset 273) */
+   /* _mesa_function_pool[22295]: GetPixelMapusv (offset 273) */
    "ip\0"
    "glGetPixelMapusv\0"
    "\0"
-   /* _mesa_function_pool[21898]: Lighti (offset 161) */
+   /* _mesa_function_pool[22316]: Lighti (offset 161) */
    "iii\0"
    "glLighti\0"
    "\0"
-   /* _mesa_function_pool[21912]: VertexAttribPointerNV (will be remapped) */
+   /* _mesa_function_pool[22330]: VertexAttribPointerNV (will be remapped) */
    "iiiip\0"
    "glVertexAttribPointerNV\0"
    "\0"
-   /* _mesa_function_pool[21943]: ClearDepthf (will be remapped) */
+   /* _mesa_function_pool[22361]: ClearDepthf (will be remapped) */
    "f\0"
    "glClearDepthf\0"
    "\0"
-   /* _mesa_function_pool[21960]: GetBooleanIndexedvEXT (will be remapped) */
+   /* _mesa_function_pool[22378]: GetBooleanIndexedvEXT (will be remapped) */
    "iip\0"
    "glGetBooleanIndexedvEXT\0"
    "glGetBooleani_v\0"
    "\0"
-   /* _mesa_function_pool[22005]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
+   /* _mesa_function_pool[22423]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
    "iiip\0"
    "glGetFramebufferAttachmentParameteriv\0"
    "glGetFramebufferAttachmentParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[22090]: PixelTransformParameterfEXT (dynamic) */
+   /* _mesa_function_pool[22508]: PixelTransformParameterfEXT (dynamic) */
    "iif\0"
    "glPixelTransformParameterfEXT\0"
    "\0"
-   /* _mesa_function_pool[22125]: MultiTexCoord4dvARB (offset 401) */
+   /* _mesa_function_pool[22543]: MultiTexCoord4dvARB (offset 401) */
    "ip\0"
    "glMultiTexCoord4dv\0"
    "glMultiTexCoord4dvARB\0"
    "\0"
-   /* _mesa_function_pool[22170]: PixelTransformParameteriEXT (dynamic) */
+   /* _mesa_function_pool[22588]: PixelTransformParameteriEXT (dynamic) */
    "iii\0"
    "glPixelTransformParameteriEXT\0"
    "\0"
-   /* _mesa_function_pool[22205]: GetDoublev (offset 260) */
+   /* _mesa_function_pool[22623]: GetDoublev (offset 260) */
    "ip\0"
    "glGetDoublev\0"
    "\0"
-   /* _mesa_function_pool[22222]: MultMatrixd (offset 295) */
+   /* _mesa_function_pool[22640]: MultMatrixd (offset 295) */
    "p\0"
    "glMultMatrixd\0"
    "\0"
-   /* _mesa_function_pool[22239]: MultMatrixf (offset 294) */
+   /* _mesa_function_pool[22657]: MultMatrixf (offset 294) */
    "p\0"
    "glMultMatrixf\0"
    "\0"
-   /* _mesa_function_pool[22256]: VertexAttribI4bvEXT (will be remapped) */
+   /* _mesa_function_pool[22674]: VertexAttribI4bvEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4bvEXT\0"
    "glVertexAttribI4bv\0"
    "\0"
-   /* _mesa_function_pool[22301]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[22719]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
    "ffiiiifff\0"
    "glTexCoord2fColor4ubVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[22344]: Uniform1iARB (will be remapped) */
+   /* _mesa_function_pool[22762]: Uniform1iARB (will be remapped) */
    "ii\0"
    "glUniform1i\0"
    "glUniform1iARB\0"
    "\0"
-   /* _mesa_function_pool[22375]: VertexAttribPointerARB (will be remapped) */
+   /* _mesa_function_pool[22793]: GetnMapfvARB (will be remapped) */
+   "iiip\0"
+   "glGetnMapfvARB\0"
+   "\0"
+   /* _mesa_function_pool[22814]: VertexAttribPointerARB (will be remapped) */
    "iiiiip\0"
    "glVertexAttribPointer\0"
    "glVertexAttribPointerARB\0"
    "\0"
-   /* _mesa_function_pool[22430]: VertexAttrib3sNV (will be remapped) */
+   /* _mesa_function_pool[22869]: VertexAttrib3sNV (will be remapped) */
    "iiii\0"
    "glVertexAttrib3sNV\0"
    "\0"
-   /* _mesa_function_pool[22455]: SharpenTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[22894]: SharpenTexFuncSGIS (dynamic) */
    "iip\0"
    "glSharpenTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[22481]: MultiTexCoord4fvARB (offset 403) */
+   /* _mesa_function_pool[22920]: MultiTexCoord4fvARB (offset 403) */
    "ip\0"
    "glMultiTexCoord4fv\0"
    "glMultiTexCoord4fvARB\0"
    "\0"
-   /* _mesa_function_pool[22526]: Uniform2uiEXT (will be remapped) */
+   /* _mesa_function_pool[22965]: Uniform2uiEXT (will be remapped) */
    "iii\0"
    "glUniform2uiEXT\0"
    "glUniform2ui\0"
    "\0"
-   /* _mesa_function_pool[22560]: UniformMatrix2x3fv (will be remapped) */
+   /* _mesa_function_pool[22999]: UniformMatrix2x3fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix2x3fv\0"
    "\0"
-   /* _mesa_function_pool[22587]: SamplerParameteri (will be remapped) */
+   /* _mesa_function_pool[23026]: SamplerParameteri (will be remapped) */
    "iii\0"
    "glSamplerParameteri\0"
    "\0"
-   /* _mesa_function_pool[22612]: SamplerParameterf (will be remapped) */
+   /* _mesa_function_pool[23051]: SamplerParameterf (will be remapped) */
    "iif\0"
    "glSamplerParameterf\0"
    "\0"
-   /* _mesa_function_pool[22637]: CombinerParameteriNV (will be remapped) */
+   /* _mesa_function_pool[23076]: CombinerParameteriNV (will be remapped) */
    "ii\0"
    "glCombinerParameteriNV\0"
    "\0"
-   /* _mesa_function_pool[22664]: DeleteAsyncMarkersSGIX (dynamic) */
+   /* _mesa_function_pool[23103]: DeleteAsyncMarkersSGIX (dynamic) */
    "ii\0"
    "glDeleteAsyncMarkersSGIX\0"
    "\0"
-   /* _mesa_function_pool[22693]: ReplacementCodeusSUN (dynamic) */
+   /* _mesa_function_pool[23132]: ReplacementCodeusSUN (dynamic) */
    "i\0"
    "glReplacementCodeusSUN\0"
    "\0"
-   /* _mesa_function_pool[22719]: IsAsyncMarkerSGIX (dynamic) */
+   /* _mesa_function_pool[23158]: IsAsyncMarkerSGIX (dynamic) */
    "i\0"
    "glIsAsyncMarkerSGIX\0"
    "\0"
-   /* _mesa_function_pool[22742]: FrameZoomSGIX (dynamic) */
+   /* _mesa_function_pool[23181]: FrameZoomSGIX (dynamic) */
    "i\0"
    "glFrameZoomSGIX\0"
    "\0"
-   /* _mesa_function_pool[22761]: Normal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[23200]: Normal3fVertex3fvSUN (dynamic) */
    "pp\0"
    "glNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[22788]: RasterPos4sv (offset 85) */
+   /* _mesa_function_pool[23227]: GetnUniformuivARB (will be remapped) */
+   "iiip\0"
+   "glGetnUniformuivARB\0"
+   "\0"
+   /* _mesa_function_pool[23253]: RasterPos4sv (offset 85) */
    "p\0"
    "glRasterPos4sv\0"
    "\0"
-   /* _mesa_function_pool[22806]: VertexAttrib4NsvARB (will be remapped) */
+   /* _mesa_function_pool[23271]: VertexAttrib4NsvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nsv\0"
    "glVertexAttrib4NsvARB\0"
    "\0"
-   /* _mesa_function_pool[22851]: VertexAttrib3fvARB (will be remapped) */
+   /* _mesa_function_pool[23316]: VertexAttrib3fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib3fv\0"
    "glVertexAttrib3fvARB\0"
    "\0"
-   /* _mesa_function_pool[22894]: ClearColor (offset 206) */
+   /* _mesa_function_pool[23359]: ClearColor (offset 206) */
    "ffff\0"
    "glClearColor\0"
    "\0"
-   /* _mesa_function_pool[22913]: GetSynciv (will be remapped) */
+   /* _mesa_function_pool[23378]: GetSynciv (will be remapped) */
    "iiipp\0"
    "glGetSynciv\0"
    "\0"
-   /* _mesa_function_pool[22932]: ClearColorIiEXT (will be remapped) */
+   /* _mesa_function_pool[23397]: ClearColorIiEXT (will be remapped) */
    "iiii\0"
    "glClearColorIiEXT\0"
    "\0"
-   /* _mesa_function_pool[22956]: DeleteFramebuffersEXT (will be remapped) */
+   /* _mesa_function_pool[23421]: DeleteFramebuffersEXT (will be remapped) */
    "ip\0"
    "glDeleteFramebuffers\0"
    "glDeleteFramebuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[23005]: GlobalAlphaFactorsSUN (dynamic) */
+   /* _mesa_function_pool[23470]: GlobalAlphaFactorsSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorsSUN\0"
    "\0"
-   /* _mesa_function_pool[23032]: IsEnabledIndexedEXT (will be remapped) */
+   /* _mesa_function_pool[23497]: IsEnabledIndexedEXT (will be remapped) */
    "ii\0"
    "glIsEnabledIndexedEXT\0"
    "glIsEnabledi\0"
    "\0"
-   /* _mesa_function_pool[23071]: TexEnviv (offset 187) */
+   /* _mesa_function_pool[23536]: TexEnviv (offset 187) */
    "iip\0"
    "glTexEnviv\0"
    "\0"
-   /* _mesa_function_pool[23087]: TexSubImage3D (offset 372) */
+   /* _mesa_function_pool[23552]: TexSubImage3D (offset 372) */
    "iiiiiiiiiip\0"
    "glTexSubImage3D\0"
    "glTexSubImage3DEXT\0"
    "\0"
-   /* _mesa_function_pool[23135]: Tangent3fEXT (dynamic) */
+   /* _mesa_function_pool[23600]: Tangent3fEXT (dynamic) */
    "fff\0"
    "glTangent3fEXT\0"
    "\0"
-   /* _mesa_function_pool[23155]: SecondaryColor3uivEXT (will be remapped) */
+   /* _mesa_function_pool[23620]: SecondaryColor3uivEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3uiv\0"
    "glSecondaryColor3uivEXT\0"
    "\0"
-   /* _mesa_function_pool[23203]: MatrixIndexubvARB (dynamic) */
+   /* _mesa_function_pool[23668]: MatrixIndexubvARB (dynamic) */
    "ip\0"
    "glMatrixIndexubvARB\0"
    "\0"
-   /* _mesa_function_pool[23227]: Color4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[23692]: Color4fNormal3fVertex3fSUN (dynamic) */
    "ffffffffff\0"
    "glColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[23268]: PixelTexGenParameterfSGIS (will be remapped) */
+   /* _mesa_function_pool[23733]: PixelTexGenParameterfSGIS (will be remapped) */
    "if\0"
    "glPixelTexGenParameterfSGIS\0"
    "\0"
-   /* _mesa_function_pool[23300]: CreateShader (will be remapped) */
+   /* _mesa_function_pool[23765]: CreateShader (will be remapped) */
    "i\0"
    "glCreateShader\0"
    "\0"
-   /* _mesa_function_pool[23318]: GetColorTableParameterfv (offset 344) */
+   /* _mesa_function_pool[23783]: GetColorTableParameterfv (offset 344) */
    "iip\0"
    "glGetColorTableParameterfv\0"
    "glGetColorTableParameterfvSGI\0"
    "glGetColorTableParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[23410]: FragmentLightModelfvSGIX (dynamic) */
+   /* _mesa_function_pool[23875]: FragmentLightModelfvSGIX (dynamic) */
    "ip\0"
    "glFragmentLightModelfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[23441]: Bitmap (offset 8) */
+   /* _mesa_function_pool[23906]: Bitmap (offset 8) */
    "iiffffp\0"
    "glBitmap\0"
    "\0"
-   /* _mesa_function_pool[23459]: MultiTexCoord3fARB (offset 394) */
+   /* _mesa_function_pool[23924]: MultiTexCoord3fARB (offset 394) */
    "ifff\0"
    "glMultiTexCoord3f\0"
    "glMultiTexCoord3fARB\0"
    "\0"
-   /* _mesa_function_pool[23504]: GetTexLevelParameterfv (offset 284) */
+   /* _mesa_function_pool[23969]: GetTexLevelParameterfv (offset 284) */
    "iiip\0"
    "glGetTexLevelParameterfv\0"
    "\0"
-   /* _mesa_function_pool[23535]: GetPixelTexGenParameterfvSGIS (will be remapped) */
+   /* _mesa_function_pool[24000]: GetPixelTexGenParameterfvSGIS (will be remapped) */
    "ip\0"
    "glGetPixelTexGenParameterfvSGIS\0"
    "\0"
-   /* _mesa_function_pool[23571]: GenFramebuffersEXT (will be remapped) */
+   /* _mesa_function_pool[24036]: GenFramebuffersEXT (will be remapped) */
    "ip\0"
    "glGenFramebuffers\0"
    "glGenFramebuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[23614]: VertexAttribDivisor (will be remapped) */
+   /* _mesa_function_pool[24079]: VertexAttribDivisor (will be remapped) */
    "ii\0"
    "glVertexAttribDivisor\0"
    "\0"
-   /* _mesa_function_pool[23640]: GetProgramParameterdvNV (will be remapped) */
+   /* _mesa_function_pool[24105]: GetProgramParameterdvNV (will be remapped) */
    "iiip\0"
    "glGetProgramParameterdvNV\0"
    "\0"
-   /* _mesa_function_pool[23672]: Vertex2sv (offset 133) */
+   /* _mesa_function_pool[24137]: Vertex2sv (offset 133) */
    "p\0"
    "glVertex2sv\0"
    "\0"
-   /* _mesa_function_pool[23687]: GetIntegerv (offset 263) */
+   /* _mesa_function_pool[24152]: GetIntegerv (offset 263) */
    "ip\0"
    "glGetIntegerv\0"
    "\0"
-   /* _mesa_function_pool[23705]: IsVertexArrayAPPLE (will be remapped) */
+   /* _mesa_function_pool[24170]: IsVertexArrayAPPLE (will be remapped) */
    "i\0"
    "glIsVertexArray\0"
    "glIsVertexArrayAPPLE\0"
    "\0"
-   /* _mesa_function_pool[23745]: FragmentLightfvSGIX (dynamic) */
+   /* _mesa_function_pool[24210]: FragmentLightfvSGIX (dynamic) */
    "iip\0"
    "glFragmentLightfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[23772]: VertexAttribDivisorARB (will be remapped) */
-   "ii\0"
-   "glVertexAttribDivisorARB\0"
+   /* _mesa_function_pool[24237]: GetnMapdvARB (will be remapped) */
+   "iiip\0"
+   "glGetnMapdvARB\0"
    "\0"
-   /* _mesa_function_pool[23801]: DetachShader (will be remapped) */
+   /* _mesa_function_pool[24258]: DetachShader (will be remapped) */
    "ii\0"
    "glDetachShader\0"
    "\0"
-   /* _mesa_function_pool[23820]: VertexAttrib4NubARB (will be remapped) */
+   /* _mesa_function_pool[24277]: VertexAttrib4NubARB (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4Nub\0"
    "glVertexAttrib4NubARB\0"
    "\0"
-   /* _mesa_function_pool[23868]: GetProgramEnvParameterfvARB (will be remapped) */
+   /* _mesa_function_pool[24325]: GetProgramEnvParameterfvARB (will be remapped) */
    "iip\0"
    "glGetProgramEnvParameterfvARB\0"
    "\0"
-   /* _mesa_function_pool[23903]: GetTrackMatrixivNV (will be remapped) */
+   /* _mesa_function_pool[24360]: GetTrackMatrixivNV (will be remapped) */
    "iiip\0"
    "glGetTrackMatrixivNV\0"
    "\0"
-   /* _mesa_function_pool[23930]: VertexAttrib3svNV (will be remapped) */
+   /* _mesa_function_pool[24387]: VertexAttrib3svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib3svNV\0"
    "\0"
-   /* _mesa_function_pool[23954]: Uniform4fvARB (will be remapped) */
+   /* _mesa_function_pool[24411]: Uniform4fvARB (will be remapped) */
    "iip\0"
    "glUniform4fv\0"
    "glUniform4fvARB\0"
    "\0"
-   /* _mesa_function_pool[23988]: MultTransposeMatrixfARB (will be remapped) */
+   /* _mesa_function_pool[24445]: MultTransposeMatrixfARB (will be remapped) */
    "p\0"
    "glMultTransposeMatrixf\0"
    "glMultTransposeMatrixfARB\0"
    "\0"
-   /* _mesa_function_pool[24040]: GetTexEnviv (offset 277) */
+   /* _mesa_function_pool[24497]: GetTexEnviv (offset 277) */
    "iip\0"
    "glGetTexEnviv\0"
    "\0"
-   /* _mesa_function_pool[24059]: ColorFragmentOp1ATI (will be remapped) */
+   /* _mesa_function_pool[24516]: ColorFragmentOp1ATI (will be remapped) */
    "iiiiiii\0"
    "glColorFragmentOp1ATI\0"
    "\0"
-   /* _mesa_function_pool[24090]: GetUniformfvARB (will be remapped) */
+   /* _mesa_function_pool[24547]: GetUniformfvARB (will be remapped) */
    "iip\0"
    "glGetUniformfv\0"
    "glGetUniformfvARB\0"
    "\0"
-   /* _mesa_function_pool[24128]: EGLImageTargetRenderbufferStorageOES (will be remapped) */
+   /* _mesa_function_pool[24585]: EGLImageTargetRenderbufferStorageOES (will be remapped) */
    "ip\0"
    "glEGLImageTargetRenderbufferStorageOES\0"
    "\0"
-   /* _mesa_function_pool[24171]: VertexAttribI2ivEXT (will be remapped) */
+   /* _mesa_function_pool[24628]: VertexAttribI2ivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI2ivEXT\0"
    "glVertexAttribI2iv\0"
    "\0"
-   /* _mesa_function_pool[24216]: PopClientAttrib (offset 334) */
+   /* _mesa_function_pool[24673]: PopClientAttrib (offset 334) */
    "\0"
    "glPopClientAttrib\0"
    "\0"
-   /* _mesa_function_pool[24236]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[24693]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
    "iffffffffffff\0"
    "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[24307]: DetachObjectARB (will be remapped) */
+   /* _mesa_function_pool[24764]: DetachObjectARB (will be remapped) */
    "ii\0"
    "glDetachObjectARB\0"
    "\0"
-   /* _mesa_function_pool[24329]: VertexBlendARB (dynamic) */
+   /* _mesa_function_pool[24786]: VertexBlendARB (dynamic) */
    "i\0"
    "glVertexBlendARB\0"
    "\0"
-   /* _mesa_function_pool[24349]: WindowPos3iMESA (will be remapped) */
+   /* _mesa_function_pool[24806]: WindowPos3iMESA (will be remapped) */
    "iii\0"
    "glWindowPos3i\0"
    "glWindowPos3iARB\0"
    "glWindowPos3iMESA\0"
    "\0"
-   /* _mesa_function_pool[24403]: SeparableFilter2D (offset 360) */
+   /* _mesa_function_pool[24860]: SeparableFilter2D (offset 360) */
    "iiiiiipp\0"
    "glSeparableFilter2D\0"
    "glSeparableFilter2DEXT\0"
    "\0"
-   /* _mesa_function_pool[24456]: ProgramParameteriARB (will be remapped) */
+   /* _mesa_function_pool[24913]: ProgramParameteriARB (will be remapped) */
    "iii\0"
    "glProgramParameteriARB\0"
    "\0"
-   /* _mesa_function_pool[24484]: Map1d (offset 220) */
+   /* _mesa_function_pool[24941]: Map1d (offset 220) */
    "iddiip\0"
    "glMap1d\0"
    "\0"
-   /* _mesa_function_pool[24500]: Map1f (offset 221) */
+   /* _mesa_function_pool[24957]: Map1f (offset 221) */
    "iffiip\0"
    "glMap1f\0"
    "\0"
-   /* _mesa_function_pool[24516]: CompressedTexImage2DARB (will be remapped) */
+   /* _mesa_function_pool[24973]: CompressedTexImage2DARB (will be remapped) */
    "iiiiiiip\0"
    "glCompressedTexImage2D\0"
    "glCompressedTexImage2DARB\0"
    "\0"
-   /* _mesa_function_pool[24575]: ArrayElement (offset 306) */
+   /* _mesa_function_pool[25032]: ArrayElement (offset 306) */
    "i\0"
    "glArrayElement\0"
    "glArrayElementEXT\0"
    "\0"
-   /* _mesa_function_pool[24611]: TexImage2D (offset 183) */
+   /* _mesa_function_pool[25068]: TexImage2D (offset 183) */
    "iiiiiiiip\0"
    "glTexImage2D\0"
    "\0"
-   /* _mesa_function_pool[24635]: DepthBoundsEXT (will be remapped) */
+   /* _mesa_function_pool[25092]: DepthBoundsEXT (will be remapped) */
    "dd\0"
    "glDepthBoundsEXT\0"
    "\0"
-   /* _mesa_function_pool[24656]: ProgramParameters4fvNV (will be remapped) */
+   /* _mesa_function_pool[25113]: ProgramParameters4fvNV (will be remapped) */
    "iiip\0"
    "glProgramParameters4fvNV\0"
    "\0"
-   /* _mesa_function_pool[24687]: DeformationMap3fSGIX (dynamic) */
+   /* _mesa_function_pool[25144]: DeformationMap3fSGIX (dynamic) */
    "iffiiffiiffiip\0"
    "glDeformationMap3fSGIX\0"
    "\0"
-   /* _mesa_function_pool[24726]: GetProgramivNV (will be remapped) */
+   /* _mesa_function_pool[25183]: GetProgramivNV (will be remapped) */
    "iip\0"
    "glGetProgramivNV\0"
    "\0"
-   /* _mesa_function_pool[24748]: GetFragDataLocationEXT (will be remapped) */
+   /* _mesa_function_pool[25205]: GetFragDataLocationEXT (will be remapped) */
    "ip\0"
    "glGetFragDataLocationEXT\0"
    "glGetFragDataLocation\0"
    "\0"
-   /* _mesa_function_pool[24799]: GetMinmaxParameteriv (offset 366) */
+   /* _mesa_function_pool[25256]: GetMinmaxParameteriv (offset 366) */
    "iip\0"
    "glGetMinmaxParameteriv\0"
    "glGetMinmaxParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[24853]: PixelTransferf (offset 247) */
+   /* _mesa_function_pool[25310]: PixelTransferf (offset 247) */
    "if\0"
    "glPixelTransferf\0"
    "\0"
-   /* _mesa_function_pool[24874]: CopyTexImage1D (offset 323) */
+   /* _mesa_function_pool[25331]: CopyTexImage1D (offset 323) */
    "iiiiiii\0"
    "glCopyTexImage1D\0"
    "glCopyTexImage1DEXT\0"
    "\0"
-   /* _mesa_function_pool[24920]: PushMatrix (offset 298) */
+   /* _mesa_function_pool[25377]: PushMatrix (offset 298) */
    "\0"
    "glPushMatrix\0"
    "\0"
-   /* _mesa_function_pool[24935]: Fogiv (offset 156) */
+   /* _mesa_function_pool[25392]: Fogiv (offset 156) */
    "ip\0"
    "glFogiv\0"
    "\0"
-   /* _mesa_function_pool[24947]: TexCoord1dv (offset 95) */
+   /* _mesa_function_pool[25404]: TexCoord1dv (offset 95) */
    "p\0"
    "glTexCoord1dv\0"
    "\0"
-   /* _mesa_function_pool[24964]: AlphaFragmentOp3ATI (will be remapped) */
+   /* _mesa_function_pool[25421]: AlphaFragmentOp3ATI (will be remapped) */
    "iiiiiiiiiiii\0"
    "glAlphaFragmentOp3ATI\0"
    "\0"
-   /* _mesa_function_pool[25000]: PixelTransferi (offset 248) */
+   /* _mesa_function_pool[25457]: PixelTransferi (offset 248) */
    "ii\0"
    "glPixelTransferi\0"
    "\0"
-   /* _mesa_function_pool[25021]: GetVertexAttribdvNV (will be remapped) */
-   "iip\0"
-   "glGetVertexAttribdvNV\0"
+   /* _mesa_function_pool[25478]: GetnColorTableARB (will be remapped) */
+   "iiiip\0"
+   "glGetnColorTableARB\0"
    "\0"
-   /* _mesa_function_pool[25048]: VertexAttrib3fvNV (will be remapped) */
+   /* _mesa_function_pool[25505]: VertexAttrib3fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib3fvNV\0"
    "\0"
-   /* _mesa_function_pool[25072]: Rotatef (offset 300) */
+   /* _mesa_function_pool[25529]: Rotatef (offset 300) */
    "ffff\0"
    "glRotatef\0"
    "\0"
-   /* _mesa_function_pool[25088]: GetFinalCombinerInputParameterivNV (will be remapped) */
+   /* _mesa_function_pool[25545]: GetFinalCombinerInputParameterivNV (will be remapped) */
    "iip\0"
    "glGetFinalCombinerInputParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[25130]: Vertex3i (offset 138) */
+   /* _mesa_function_pool[25587]: Vertex3i (offset 138) */
    "iii\0"
    "glVertex3i\0"
    "\0"
-   /* _mesa_function_pool[25146]: Vertex3f (offset 136) */
+   /* _mesa_function_pool[25603]: Vertex3f (offset 136) */
    "fff\0"
    "glVertex3f\0"
    "\0"
-   /* _mesa_function_pool[25162]: Clear (offset 203) */
+   /* _mesa_function_pool[25619]: Clear (offset 203) */
    "i\0"
    "glClear\0"
    "\0"
-   /* _mesa_function_pool[25173]: Vertex3d (offset 134) */
+   /* _mesa_function_pool[25630]: Vertex3d (offset 134) */
    "ddd\0"
    "glVertex3d\0"
    "\0"
-   /* _mesa_function_pool[25189]: GetMapParameterivNV (dynamic) */
+   /* _mesa_function_pool[25646]: GetMapParameterivNV (dynamic) */
    "iip\0"
    "glGetMapParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[25216]: Uniform4iARB (will be remapped) */
+   /* _mesa_function_pool[25673]: Uniform4iARB (will be remapped) */
    "iiiii\0"
    "glUniform4i\0"
    "glUniform4iARB\0"
    "\0"
-   /* _mesa_function_pool[25250]: ReadBuffer (offset 254) */
+   /* _mesa_function_pool[25707]: ReadBuffer (offset 254) */
    "i\0"
    "glReadBuffer\0"
    "\0"
-   /* _mesa_function_pool[25266]: ConvolutionParameteri (offset 352) */
+   /* _mesa_function_pool[25723]: ConvolutionParameteri (offset 352) */
    "iii\0"
    "glConvolutionParameteri\0"
    "glConvolutionParameteriEXT\0"
    "\0"
-   /* _mesa_function_pool[25322]: Ortho (offset 296) */
+   /* _mesa_function_pool[25779]: Ortho (offset 296) */
    "dddddd\0"
    "glOrtho\0"
    "\0"
-   /* _mesa_function_pool[25338]: Binormal3sEXT (dynamic) */
+   /* _mesa_function_pool[25795]: Binormal3sEXT (dynamic) */
    "iii\0"
    "glBinormal3sEXT\0"
    "\0"
-   /* _mesa_function_pool[25359]: ListBase (offset 6) */
+   /* _mesa_function_pool[25816]: ListBase (offset 6) */
    "i\0"
    "glListBase\0"
    "\0"
-   /* _mesa_function_pool[25373]: VertexAttribI3ivEXT (will be remapped) */
+   /* _mesa_function_pool[25830]: VertexAttribI3ivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI3ivEXT\0"
    "glVertexAttribI3iv\0"
    "\0"
-   /* _mesa_function_pool[25418]: Vertex3s (offset 140) */
+   /* _mesa_function_pool[25875]: Vertex3s (offset 140) */
    "iii\0"
    "glVertex3s\0"
    "\0"
-   /* _mesa_function_pool[25434]: ConvolutionParameterf (offset 350) */
+   /* _mesa_function_pool[25891]: ConvolutionParameterf (offset 350) */
    "iif\0"
    "glConvolutionParameterf\0"
    "glConvolutionParameterfEXT\0"
    "\0"
-   /* _mesa_function_pool[25490]: GetColorTableParameteriv (offset 345) */
+   /* _mesa_function_pool[25947]: GetColorTableParameteriv (offset 345) */
    "iip\0"
    "glGetColorTableParameteriv\0"
    "glGetColorTableParameterivSGI\0"
    "glGetColorTableParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[25582]: ProgramEnvParameter4dvARB (will be remapped) */
+   /* _mesa_function_pool[26039]: ProgramEnvParameter4dvARB (will be remapped) */
    "iip\0"
    "glProgramEnvParameter4dvARB\0"
    "glProgramParameter4dvNV\0"
    "\0"
-   /* _mesa_function_pool[25639]: ShadeModel (offset 177) */
+   /* _mesa_function_pool[26096]: ShadeModel (offset 177) */
    "i\0"
    "glShadeModel\0"
    "\0"
-   /* _mesa_function_pool[25655]: VertexAttribs2fvNV (will be remapped) */
+   /* _mesa_function_pool[26112]: VertexAttribs2fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs2fvNV\0"
    "\0"
-   /* _mesa_function_pool[25681]: Rectiv (offset 91) */
+   /* _mesa_function_pool[26138]: Rectiv (offset 91) */
    "pp\0"
    "glRectiv\0"
    "\0"
-   /* _mesa_function_pool[25694]: UseProgramObjectARB (will be remapped) */
+   /* _mesa_function_pool[26151]: UseProgramObjectARB (will be remapped) */
    "i\0"
    "glUseProgram\0"
    "glUseProgramObjectARB\0"
    "\0"
-   /* _mesa_function_pool[25732]: GetMapParameterfvNV (dynamic) */
+   /* _mesa_function_pool[26189]: GetMapParameterfvNV (dynamic) */
    "iip\0"
    "glGetMapParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[25759]: EndConditionalRenderNV (will be remapped) */
+   /* _mesa_function_pool[26216]: EndConditionalRenderNV (will be remapped) */
    "\0"
    "glEndConditionalRenderNV\0"
    "glEndConditionalRender\0"
    "\0"
-   /* _mesa_function_pool[25809]: PassTexCoordATI (will be remapped) */
+   /* _mesa_function_pool[26266]: PassTexCoordATI (will be remapped) */
    "iii\0"
    "glPassTexCoordATI\0"
    "\0"
-   /* _mesa_function_pool[25832]: DeleteProgram (will be remapped) */
+   /* _mesa_function_pool[26289]: DeleteProgram (will be remapped) */
    "i\0"
    "glDeleteProgram\0"
    "\0"
-   /* _mesa_function_pool[25851]: GetSamplerParameteriv (will be remapped) */
+   /* _mesa_function_pool[26308]: GetSamplerParameteriv (will be remapped) */
    "iip\0"
    "glGetSamplerParameteriv\0"
    "\0"
-   /* _mesa_function_pool[25880]: Tangent3dEXT (dynamic) */
+   /* _mesa_function_pool[26337]: Tangent3dEXT (dynamic) */
    "ddd\0"
    "glTangent3dEXT\0"
    "\0"
-   /* _mesa_function_pool[25900]: SecondaryColor3dvEXT (will be remapped) */
+   /* _mesa_function_pool[26357]: SecondaryColor3dvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3dv\0"
    "glSecondaryColor3dvEXT\0"
    "\0"
-   /* _mesa_function_pool[25946]: AlphaFragmentOp2ATI (will be remapped) */
+   /* _mesa_function_pool[26403]: AlphaFragmentOp2ATI (will be remapped) */
    "iiiiiiiii\0"
    "glAlphaFragmentOp2ATI\0"
    "\0"
-   /* _mesa_function_pool[25979]: Vertex2fv (offset 129) */
+   /* _mesa_function_pool[26436]: Vertex2fv (offset 129) */
    "p\0"
    "glVertex2fv\0"
    "\0"
-   /* _mesa_function_pool[25994]: MultiDrawArraysEXT (will be remapped) */
+   /* _mesa_function_pool[26451]: MultiDrawArraysEXT (will be remapped) */
    "ippi\0"
    "glMultiDrawArrays\0"
    "glMultiDrawArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[26039]: BindRenderbufferEXT (will be remapped) */
+   /* _mesa_function_pool[26496]: BindRenderbufferEXT (will be remapped) */
    "ii\0"
    "glBindRenderbuffer\0"
    "glBindRenderbufferEXT\0"
    "\0"
-   /* _mesa_function_pool[26084]: MultiTexCoord4dARB (offset 400) */
+   /* _mesa_function_pool[26541]: MultiTexCoord4dARB (offset 400) */
    "idddd\0"
    "glMultiTexCoord4d\0"
    "glMultiTexCoord4dARB\0"
    "\0"
-   /* _mesa_function_pool[26130]: FramebufferTextureFaceARB (will be remapped) */
+   /* _mesa_function_pool[26587]: FramebufferTextureFaceARB (will be remapped) */
    "iiiii\0"
    "glFramebufferTextureFaceARB\0"
    "\0"
-   /* _mesa_function_pool[26165]: Vertex3sv (offset 141) */
+   /* _mesa_function_pool[26622]: Vertex3sv (offset 141) */
    "p\0"
    "glVertex3sv\0"
    "\0"
-   /* _mesa_function_pool[26180]: SecondaryColor3usEXT (will be remapped) */
+   /* _mesa_function_pool[26637]: SecondaryColor3usEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3us\0"
    "glSecondaryColor3usEXT\0"
    "\0"
-   /* _mesa_function_pool[26228]: ProgramLocalParameter4fvARB (will be remapped) */
+   /* _mesa_function_pool[26685]: ProgramLocalParameter4fvARB (will be remapped) */
    "iip\0"
    "glProgramLocalParameter4fvARB\0"
    "\0"
-   /* _mesa_function_pool[26263]: DeleteProgramsNV (will be remapped) */
+   /* _mesa_function_pool[26720]: DeleteProgramsNV (will be remapped) */
    "ip\0"
    "glDeleteProgramsARB\0"
    "glDeleteProgramsNV\0"
    "\0"
-   /* _mesa_function_pool[26306]: EvalMesh1 (offset 236) */
+   /* _mesa_function_pool[26763]: EvalMesh1 (offset 236) */
    "iii\0"
    "glEvalMesh1\0"
    "\0"
-   /* _mesa_function_pool[26323]: PauseTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[26780]: PauseTransformFeedback (will be remapped) */
    "\0"
    "glPauseTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[26350]: MultiTexCoord1sARB (offset 382) */
+   /* _mesa_function_pool[26807]: MultiTexCoord1sARB (offset 382) */
    "ii\0"
    "glMultiTexCoord1s\0"
    "glMultiTexCoord1sARB\0"
    "\0"
-   /* _mesa_function_pool[26393]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[26850]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
    "iffffff\0"
    "glReplacementCodeuiColor3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[26440]: GetVertexAttribPointervNV (will be remapped) */
+   /* _mesa_function_pool[26897]: GetVertexAttribPointervNV (will be remapped) */
    "iip\0"
    "glGetVertexAttribPointerv\0"
    "glGetVertexAttribPointervARB\0"
    "glGetVertexAttribPointervNV\0"
    "\0"
-   /* _mesa_function_pool[26528]: VertexAttribs1fvNV (will be remapped) */
+   /* _mesa_function_pool[26985]: VertexAttribs1fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs1fvNV\0"
    "\0"
-   /* _mesa_function_pool[26554]: MultiTexCoord1dvARB (offset 377) */
+   /* _mesa_function_pool[27011]: MultiTexCoord1dvARB (offset 377) */
    "ip\0"
    "glMultiTexCoord1dv\0"
    "glMultiTexCoord1dvARB\0"
    "\0"
-   /* _mesa_function_pool[26599]: Uniform2iARB (will be remapped) */
+   /* _mesa_function_pool[27056]: Uniform2iARB (will be remapped) */
    "iii\0"
    "glUniform2i\0"
    "glUniform2iARB\0"
    "\0"
-   /* _mesa_function_pool[26631]: Vertex2iv (offset 131) */
+   /* _mesa_function_pool[27088]: Vertex2iv (offset 131) */
    "p\0"
    "glVertex2iv\0"
    "\0"
-   /* _mesa_function_pool[26646]: GetProgramStringNV (will be remapped) */
+   /* _mesa_function_pool[27103]: GetProgramStringNV (will be remapped) */
    "iip\0"
    "glGetProgramStringNV\0"
    "\0"
-   /* _mesa_function_pool[26672]: ColorPointerEXT (will be remapped) */
+   /* _mesa_function_pool[27129]: ColorPointerEXT (will be remapped) */
    "iiiip\0"
    "glColorPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[26697]: LineWidth (offset 168) */
+   /* _mesa_function_pool[27154]: LineWidth (offset 168) */
    "f\0"
    "glLineWidth\0"
    "\0"
-   /* _mesa_function_pool[26712]: MapBufferARB (will be remapped) */
+   /* _mesa_function_pool[27169]: MapBufferARB (will be remapped) */
    "ii\0"
    "glMapBuffer\0"
    "glMapBufferARB\0"
    "\0"
-   /* _mesa_function_pool[26743]: MultiDrawElementsBaseVertex (will be remapped) */
+   /* _mesa_function_pool[27200]: MultiDrawElementsBaseVertex (will be remapped) */
    "ipipip\0"
    "glMultiDrawElementsBaseVertex\0"
    "\0"
-   /* _mesa_function_pool[26781]: TexParameterIuivEXT (will be remapped) */
+   /* _mesa_function_pool[27238]: TexParameterIuivEXT (will be remapped) */
    "iip\0"
    "glTexParameterIuivEXT\0"
    "glTexParameterIuiv\0"
    "\0"
-   /* _mesa_function_pool[26827]: Binormal3svEXT (dynamic) */
+   /* _mesa_function_pool[27284]: Binormal3svEXT (dynamic) */
    "p\0"
    "glBinormal3svEXT\0"
    "\0"
-   /* _mesa_function_pool[26847]: ApplyTextureEXT (dynamic) */
+   /* _mesa_function_pool[27304]: ApplyTextureEXT (dynamic) */
    "i\0"
    "glApplyTextureEXT\0"
    "\0"
-   /* _mesa_function_pool[26868]: GetBufferParameteri64v (will be remapped) */
+   /* _mesa_function_pool[27325]: GetBufferParameteri64v (will be remapped) */
    "iip\0"
    "glGetBufferParameteri64v\0"
    "\0"
-   /* _mesa_function_pool[26898]: TexGendv (offset 189) */
+   /* _mesa_function_pool[27355]: TexGendv (offset 189) */
    "iip\0"
    "glTexGendv\0"
    "\0"
-   /* _mesa_function_pool[26914]: VertexAttribI3iEXT (will be remapped) */
+   /* _mesa_function_pool[27371]: VertexAttribI3iEXT (will be remapped) */
    "iiii\0"
    "glVertexAttribI3iEXT\0"
    "glVertexAttribI3i\0"
    "\0"
-   /* _mesa_function_pool[26959]: EnableIndexedEXT (will be remapped) */
+   /* _mesa_function_pool[27416]: EnableIndexedEXT (will be remapped) */
    "ii\0"
    "glEnableIndexedEXT\0"
    "glEnablei\0"
    "\0"
-   /* _mesa_function_pool[26992]: TextureMaterialEXT (dynamic) */
+   /* _mesa_function_pool[27449]: TextureMaterialEXT (dynamic) */
    "ii\0"
    "glTextureMaterialEXT\0"
    "\0"
-   /* _mesa_function_pool[27017]: TextureLightEXT (dynamic) */
+   /* _mesa_function_pool[27474]: TextureLightEXT (dynamic) */
    "i\0"
    "glTextureLightEXT\0"
    "\0"
-   /* _mesa_function_pool[27038]: ResetMinmax (offset 370) */
+   /* _mesa_function_pool[27495]: ResetMinmax (offset 370) */
    "i\0"
    "glResetMinmax\0"
    "glResetMinmaxEXT\0"
    "\0"
-   /* _mesa_function_pool[27072]: SpriteParameterfSGIX (dynamic) */
+   /* _mesa_function_pool[27529]: SpriteParameterfSGIX (dynamic) */
    "if\0"
    "glSpriteParameterfSGIX\0"
    "\0"
-   /* _mesa_function_pool[27099]: EnableClientState (offset 313) */
+   /* _mesa_function_pool[27556]: EnableClientState (offset 313) */
    "i\0"
    "glEnableClientState\0"
    "\0"
-   /* _mesa_function_pool[27122]: VertexAttrib4sNV (will be remapped) */
+   /* _mesa_function_pool[27579]: VertexAttrib4sNV (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4sNV\0"
    "\0"
-   /* _mesa_function_pool[27148]: GetConvolutionParameterfv (offset 357) */
+   /* _mesa_function_pool[27605]: GetConvolutionParameterfv (offset 357) */
    "iip\0"
    "glGetConvolutionParameterfv\0"
    "glGetConvolutionParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[27212]: VertexAttribs4dvNV (will be remapped) */
+   /* _mesa_function_pool[27669]: VertexAttribs4dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4dvNV\0"
    "\0"
-   /* _mesa_function_pool[27238]: VertexAttrib4dARB (will be remapped) */
+   /* _mesa_function_pool[27695]: VertexAttrib4dARB (will be remapped) */
    "idddd\0"
    "glVertexAttrib4d\0"
    "glVertexAttrib4dARB\0"
    "\0"
-   /* _mesa_function_pool[27282]: GetTexBumpParameterfvATI (will be remapped) */
+   /* _mesa_function_pool[27739]: GetTexBumpParameterfvATI (will be remapped) */
    "ip\0"
    "glGetTexBumpParameterfvATI\0"
    "\0"
-   /* _mesa_function_pool[27313]: ProgramNamedParameter4dNV (will be remapped) */
+   /* _mesa_function_pool[27770]: ProgramNamedParameter4dNV (will be remapped) */
    "iipdddd\0"
    "glProgramNamedParameter4dNV\0"
    "\0"
-   /* _mesa_function_pool[27350]: GetMaterialfv (offset 269) */
+   /* _mesa_function_pool[27807]: GetMaterialfv (offset 269) */
    "iip\0"
    "glGetMaterialfv\0"
    "\0"
-   /* _mesa_function_pool[27371]: VertexWeightfEXT (dynamic) */
+   /* _mesa_function_pool[27828]: VertexWeightfEXT (dynamic) */
    "f\0"
    "glVertexWeightfEXT\0"
    "\0"
-   /* _mesa_function_pool[27393]: SetFragmentShaderConstantATI (will be remapped) */
+   /* _mesa_function_pool[27850]: SetFragmentShaderConstantATI (will be remapped) */
    "ip\0"
    "glSetFragmentShaderConstantATI\0"
    "\0"
-   /* _mesa_function_pool[27428]: Binormal3fEXT (dynamic) */
+   /* _mesa_function_pool[27885]: Binormal3fEXT (dynamic) */
    "fff\0"
    "glBinormal3fEXT\0"
    "\0"
-   /* _mesa_function_pool[27449]: CallList (offset 2) */
+   /* _mesa_function_pool[27906]: CallList (offset 2) */
    "i\0"
    "glCallList\0"
    "\0"
-   /* _mesa_function_pool[27463]: Materialfv (offset 170) */
+   /* _mesa_function_pool[27920]: Materialfv (offset 170) */
    "iip\0"
    "glMaterialfv\0"
    "\0"
-   /* _mesa_function_pool[27481]: TexCoord3fv (offset 113) */
+   /* _mesa_function_pool[27938]: TexCoord3fv (offset 113) */
    "p\0"
    "glTexCoord3fv\0"
    "\0"
-   /* _mesa_function_pool[27498]: FogCoordfvEXT (will be remapped) */
+   /* _mesa_function_pool[27955]: FogCoordfvEXT (will be remapped) */
    "p\0"
    "glFogCoordfv\0"
    "glFogCoordfvEXT\0"
    "\0"
-   /* _mesa_function_pool[27530]: MultiTexCoord1ivARB (offset 381) */
+   /* _mesa_function_pool[27987]: MultiTexCoord1ivARB (offset 381) */
    "ip\0"
    "glMultiTexCoord1iv\0"
    "glMultiTexCoord1ivARB\0"
    "\0"
-   /* _mesa_function_pool[27575]: SecondaryColor3ubEXT (will be remapped) */
+   /* _mesa_function_pool[28032]: SecondaryColor3ubEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3ub\0"
    "glSecondaryColor3ubEXT\0"
    "\0"
-   /* _mesa_function_pool[27623]: MultiTexCoord2ivARB (offset 389) */
+   /* _mesa_function_pool[28080]: MultiTexCoord2ivARB (offset 389) */
    "ip\0"
    "glMultiTexCoord2iv\0"
    "glMultiTexCoord2ivARB\0"
    "\0"
-   /* _mesa_function_pool[27668]: FogFuncSGIS (dynamic) */
+   /* _mesa_function_pool[28125]: FogFuncSGIS (dynamic) */
    "ip\0"
    "glFogFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[27686]: CopyTexSubImage2D (offset 326) */
+   /* _mesa_function_pool[28143]: CopyTexSubImage2D (offset 326) */
    "iiiiiiii\0"
    "glCopyTexSubImage2D\0"
    "glCopyTexSubImage2DEXT\0"
    "\0"
-   /* _mesa_function_pool[27739]: GetObjectParameterivARB (will be remapped) */
+   /* _mesa_function_pool[28196]: GetObjectParameterivARB (will be remapped) */
    "iip\0"
    "glGetObjectParameterivARB\0"
    "\0"
-   /* _mesa_function_pool[27770]: Color3iv (offset 16) */
+   /* _mesa_function_pool[28227]: Color3iv (offset 16) */
    "p\0"
    "glColor3iv\0"
    "\0"
-   /* _mesa_function_pool[27784]: TexCoord4fVertex4fSUN (dynamic) */
+   /* _mesa_function_pool[28241]: TexCoord4fVertex4fSUN (dynamic) */
    "ffffffff\0"
    "glTexCoord4fVertex4fSUN\0"
    "\0"
-   /* _mesa_function_pool[27818]: DrawElements (offset 311) */
+   /* _mesa_function_pool[28275]: DrawElements (offset 311) */
    "iiip\0"
    "glDrawElements\0"
    "\0"
-   /* _mesa_function_pool[27839]: BindVertexArrayAPPLE (will be remapped) */
+   /* _mesa_function_pool[28296]: BindVertexArrayAPPLE (will be remapped) */
    "i\0"
    "glBindVertexArrayAPPLE\0"
    "\0"
-   /* _mesa_function_pool[27865]: GetProgramLocalParameterdvARB (will be remapped) */
+   /* _mesa_function_pool[28322]: GetProgramLocalParameterdvARB (will be remapped) */
    "iip\0"
    "glGetProgramLocalParameterdvARB\0"
    "\0"
-   /* _mesa_function_pool[27902]: GetHistogramParameteriv (offset 363) */
+   /* _mesa_function_pool[28359]: GetHistogramParameteriv (offset 363) */
    "iip\0"
    "glGetHistogramParameteriv\0"
    "glGetHistogramParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[27962]: MultiTexCoord1iARB (offset 380) */
+   /* _mesa_function_pool[28419]: MultiTexCoord1iARB (offset 380) */
    "ii\0"
    "glMultiTexCoord1i\0"
    "glMultiTexCoord1iARB\0"
    "\0"
-   /* _mesa_function_pool[28005]: GetConvolutionFilter (offset 356) */
+   /* _mesa_function_pool[28462]: GetConvolutionFilter (offset 356) */
    "iiip\0"
    "glGetConvolutionFilter\0"
    "glGetConvolutionFilterEXT\0"
    "\0"
-   /* _mesa_function_pool[28060]: GetProgramivARB (will be remapped) */
+   /* _mesa_function_pool[28517]: GetProgramivARB (will be remapped) */
    "iip\0"
    "glGetProgramivARB\0"
    "\0"
-   /* _mesa_function_pool[28083]: TexBufferARB (will be remapped) */
+   /* _mesa_function_pool[28540]: TexBufferARB (will be remapped) */
    "iii\0"
    "glTexBufferARB\0"
    "\0"
-   /* _mesa_function_pool[28103]: BlendFuncSeparateEXT (will be remapped) */
+   /* _mesa_function_pool[28560]: BlendFuncSeparateEXT (will be remapped) */
    "iiii\0"
    "glBlendFuncSeparate\0"
    "glBlendFuncSeparateEXT\0"
    "glBlendFuncSeparateINGR\0"
    "\0"
-   /* _mesa_function_pool[28176]: MapBufferRange (will be remapped) */
+   /* _mesa_function_pool[28633]: MapBufferRange (will be remapped) */
    "iiii\0"
    "glMapBufferRange\0"
    "\0"
-   /* _mesa_function_pool[28199]: ProgramParameters4dvNV (will be remapped) */
+   /* _mesa_function_pool[28656]: ProgramParameters4dvNV (will be remapped) */
    "iiip\0"
    "glProgramParameters4dvNV\0"
    "\0"
-   /* _mesa_function_pool[28230]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[28687]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glTexCoord2fColor3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[28267]: EvalPoint2 (offset 239) */
+   /* _mesa_function_pool[28724]: EvalPoint2 (offset 239) */
    "ii\0"
    "glEvalPoint2\0"
    "\0"
-   /* _mesa_function_pool[28284]: Uniform1uivEXT (will be remapped) */
+   /* _mesa_function_pool[28741]: Uniform1uivEXT (will be remapped) */
    "iip\0"
    "glUniform1uivEXT\0"
    "glUniform1uiv\0"
    "\0"
-   /* _mesa_function_pool[28320]: EvalPoint1 (offset 237) */
+   /* _mesa_function_pool[28777]: EvalPoint1 (offset 237) */
    "i\0"
    "glEvalPoint1\0"
    "\0"
-   /* _mesa_function_pool[28336]: Binormal3dvEXT (dynamic) */
+   /* _mesa_function_pool[28793]: Binormal3dvEXT (dynamic) */
    "p\0"
    "glBinormal3dvEXT\0"
    "\0"
-   /* _mesa_function_pool[28356]: PopMatrix (offset 297) */
+   /* _mesa_function_pool[28813]: PopMatrix (offset 297) */
    "\0"
    "glPopMatrix\0"
    "\0"
-   /* _mesa_function_pool[28370]: FinishFenceNV (will be remapped) */
+   /* _mesa_function_pool[28827]: FinishFenceNV (will be remapped) */
    "i\0"
    "glFinishFenceNV\0"
    "\0"
-   /* _mesa_function_pool[28389]: GetFogFuncSGIS (dynamic) */
+   /* _mesa_function_pool[28846]: GetFogFuncSGIS (dynamic) */
    "p\0"
    "glGetFogFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[28409]: GetUniformLocationARB (will be remapped) */
+   /* _mesa_function_pool[28866]: GetUniformLocationARB (will be remapped) */
    "ip\0"
    "glGetUniformLocation\0"
    "glGetUniformLocationARB\0"
    "\0"
-   /* _mesa_function_pool[28458]: SecondaryColor3fEXT (will be remapped) */
+   /* _mesa_function_pool[28915]: SecondaryColor3fEXT (will be remapped) */
    "fff\0"
    "glSecondaryColor3f\0"
    "glSecondaryColor3fEXT\0"
    "\0"
-   /* _mesa_function_pool[28504]: GetTexGeniv (offset 280) */
+   /* _mesa_function_pool[28961]: GetTexGeniv (offset 280) */
    "iip\0"
    "glGetTexGeniv\0"
    "\0"
-   /* _mesa_function_pool[28523]: CombinerInputNV (will be remapped) */
+   /* _mesa_function_pool[28980]: CombinerInputNV (will be remapped) */
    "iiiiii\0"
    "glCombinerInputNV\0"
    "\0"
-   /* _mesa_function_pool[28549]: VertexAttrib3sARB (will be remapped) */
+   /* _mesa_function_pool[29006]: VertexAttrib3sARB (will be remapped) */
    "iiii\0"
    "glVertexAttrib3s\0"
    "glVertexAttrib3sARB\0"
    "\0"
-   /* _mesa_function_pool[28592]: IsTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[29049]: IsTransformFeedback (will be remapped) */
    "i\0"
    "glIsTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[28617]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[29074]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[28662]: Map2d (offset 222) */
+   /* _mesa_function_pool[29119]: Map2d (offset 222) */
    "iddiiddiip\0"
    "glMap2d\0"
    "\0"
-   /* _mesa_function_pool[28682]: Map2f (offset 223) */
+   /* _mesa_function_pool[29139]: Map2f (offset 223) */
    "iffiiffiip\0"
    "glMap2f\0"
    "\0"
-   /* _mesa_function_pool[28702]: ProgramStringARB (will be remapped) */
+   /* _mesa_function_pool[29159]: ProgramStringARB (will be remapped) */
    "iiip\0"
    "glProgramStringARB\0"
    "\0"
-   /* _mesa_function_pool[28727]: Vertex4s (offset 148) */
+   /* _mesa_function_pool[29184]: Vertex4s (offset 148) */
    "iiii\0"
    "glVertex4s\0"
    "\0"
-   /* _mesa_function_pool[28744]: TexCoord4fVertex4fvSUN (dynamic) */
+   /* _mesa_function_pool[29201]: TexCoord4fVertex4fvSUN (dynamic) */
    "pp\0"
    "glTexCoord4fVertex4fvSUN\0"
    "\0"
-   /* _mesa_function_pool[28773]: FragmentLightModelivSGIX (dynamic) */
+   /* _mesa_function_pool[29230]: FragmentLightModelivSGIX (dynamic) */
    "ip\0"
    "glFragmentLightModelivSGIX\0"
    "\0"
-   /* _mesa_function_pool[28804]: VertexAttrib1fNV (will be remapped) */
+   /* _mesa_function_pool[29261]: VertexAttrib1fNV (will be remapped) */
    "if\0"
    "glVertexAttrib1fNV\0"
    "\0"
-   /* _mesa_function_pool[28827]: Vertex4f (offset 144) */
+   /* _mesa_function_pool[29284]: Vertex4f (offset 144) */
    "ffff\0"
    "glVertex4f\0"
    "\0"
-   /* _mesa_function_pool[28844]: EvalCoord1d (offset 228) */
+   /* _mesa_function_pool[29301]: EvalCoord1d (offset 228) */
    "d\0"
    "glEvalCoord1d\0"
    "\0"
-   /* _mesa_function_pool[28861]: Vertex4d (offset 142) */
+   /* _mesa_function_pool[29318]: Vertex4d (offset 142) */
    "dddd\0"
    "glVertex4d\0"
    "\0"
-   /* _mesa_function_pool[28878]: RasterPos4dv (offset 79) */
+   /* _mesa_function_pool[29335]: RasterPos4dv (offset 79) */
    "p\0"
    "glRasterPos4dv\0"
    "\0"
-   /* _mesa_function_pool[28896]: UseShaderProgramEXT (will be remapped) */
+   /* _mesa_function_pool[29353]: UseShaderProgramEXT (will be remapped) */
    "ii\0"
    "glUseShaderProgramEXT\0"
    "\0"
-   /* _mesa_function_pool[28922]: FragmentLightfSGIX (dynamic) */
+   /* _mesa_function_pool[29379]: FragmentLightfSGIX (dynamic) */
    "iif\0"
    "glFragmentLightfSGIX\0"
    "\0"
-   /* _mesa_function_pool[28948]: GetCompressedTexImageARB (will be remapped) */
+   /* _mesa_function_pool[29405]: GetCompressedTexImageARB (will be remapped) */
    "iip\0"
    "glGetCompressedTexImage\0"
    "glGetCompressedTexImageARB\0"
    "\0"
-   /* _mesa_function_pool[29004]: GetTexGenfv (offset 279) */
+   /* _mesa_function_pool[29461]: GetTexGenfv (offset 279) */
    "iip\0"
    "glGetTexGenfv\0"
    "\0"
-   /* _mesa_function_pool[29023]: Vertex4i (offset 146) */
+   /* _mesa_function_pool[29480]: Vertex4i (offset 146) */
    "iiii\0"
    "glVertex4i\0"
    "\0"
-   /* _mesa_function_pool[29040]: VertexWeightPointerEXT (dynamic) */
+   /* _mesa_function_pool[29497]: VertexWeightPointerEXT (dynamic) */
    "iiip\0"
    "glVertexWeightPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[29071]: GetHistogram (offset 361) */
+   /* _mesa_function_pool[29528]: GetHistogram (offset 361) */
    "iiiip\0"
    "glGetHistogram\0"
    "glGetHistogramEXT\0"
    "\0"
-   /* _mesa_function_pool[29111]: ActiveStencilFaceEXT (will be remapped) */
+   /* _mesa_function_pool[29568]: ActiveStencilFaceEXT (will be remapped) */
    "i\0"
    "glActiveStencilFaceEXT\0"
    "\0"
-   /* _mesa_function_pool[29137]: StencilFuncSeparateATI (will be remapped) */
+   /* _mesa_function_pool[29594]: StencilFuncSeparateATI (will be remapped) */
    "iiii\0"
    "glStencilFuncSeparateATI\0"
    "\0"
-   /* _mesa_function_pool[29168]: Materialf (offset 169) */
+   /* _mesa_function_pool[29625]: Materialf (offset 169) */
    "iif\0"
    "glMaterialf\0"
    "\0"
-   /* _mesa_function_pool[29185]: GetShaderSourceARB (will be remapped) */
+   /* _mesa_function_pool[29642]: GetShaderSourceARB (will be remapped) */
    "iipp\0"
    "glGetShaderSource\0"
    "glGetShaderSourceARB\0"
    "\0"
-   /* _mesa_function_pool[29230]: IglooInterfaceSGIX (dynamic) */
+   /* _mesa_function_pool[29687]: IglooInterfaceSGIX (dynamic) */
    "ip\0"
    "glIglooInterfaceSGIX\0"
    "\0"
-   /* _mesa_function_pool[29255]: Materiali (offset 171) */
+   /* _mesa_function_pool[29712]: Materiali (offset 171) */
    "iii\0"
    "glMateriali\0"
    "\0"
-   /* _mesa_function_pool[29272]: VertexAttrib4dNV (will be remapped) */
+   /* _mesa_function_pool[29729]: VertexAttrib4dNV (will be remapped) */
    "idddd\0"
    "glVertexAttrib4dNV\0"
    "\0"
-   /* _mesa_function_pool[29298]: MultiModeDrawElementsIBM (will be remapped) */
+   /* _mesa_function_pool[29755]: MultiModeDrawElementsIBM (will be remapped) */
    "ppipii\0"
    "glMultiModeDrawElementsIBM\0"
    "\0"
-   /* _mesa_function_pool[29333]: Indexsv (offset 51) */
+   /* _mesa_function_pool[29790]: Indexsv (offset 51) */
    "p\0"
    "glIndexsv\0"
    "\0"
-   /* _mesa_function_pool[29346]: MultiTexCoord4svARB (offset 407) */
+   /* _mesa_function_pool[29803]: MultiTexCoord4svARB (offset 407) */
    "ip\0"
    "glMultiTexCoord4sv\0"
    "glMultiTexCoord4svARB\0"
    "\0"
-   /* _mesa_function_pool[29391]: LightModelfv (offset 164) */
+   /* _mesa_function_pool[29848]: LightModelfv (offset 164) */
    "ip\0"
    "glLightModelfv\0"
    "\0"
-   /* _mesa_function_pool[29410]: TexCoord2dv (offset 103) */
+   /* _mesa_function_pool[29867]: TexCoord2dv (offset 103) */
    "p\0"
    "glTexCoord2dv\0"
    "\0"
-   /* _mesa_function_pool[29427]: GenQueriesARB (will be remapped) */
+   /* _mesa_function_pool[29884]: GenQueriesARB (will be remapped) */
    "ip\0"
    "glGenQueries\0"
    "glGenQueriesARB\0"
    "\0"
-   /* _mesa_function_pool[29460]: EvalCoord1dv (offset 229) */
+   /* _mesa_function_pool[29917]: EvalCoord1dv (offset 229) */
    "p\0"
    "glEvalCoord1dv\0"
    "\0"
-   /* _mesa_function_pool[29478]: ReplacementCodeuiVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[29935]: ReplacementCodeuiVertex3fSUN (dynamic) */
    "ifff\0"
    "glReplacementCodeuiVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[29515]: Translated (offset 303) */
+   /* _mesa_function_pool[29972]: Translated (offset 303) */
    "ddd\0"
    "glTranslated\0"
    "\0"
-   /* _mesa_function_pool[29533]: Translatef (offset 304) */
+   /* _mesa_function_pool[29990]: Translatef (offset 304) */
    "fff\0"
    "glTranslatef\0"
    "\0"
-   /* _mesa_function_pool[29551]: Uniform3uiEXT (will be remapped) */
+   /* _mesa_function_pool[30008]: Uniform3uiEXT (will be remapped) */
    "iiii\0"
    "glUniform3uiEXT\0"
    "glUniform3ui\0"
    "\0"
-   /* _mesa_function_pool[29586]: StencilMask (offset 209) */
+   /* _mesa_function_pool[30043]: StencilMask (offset 209) */
    "i\0"
    "glStencilMask\0"
    "\0"
-   /* _mesa_function_pool[29603]: Tangent3iEXT (dynamic) */
+   /* _mesa_function_pool[30060]: Tangent3iEXT (dynamic) */
    "iii\0"
    "glTangent3iEXT\0"
    "\0"
-   /* _mesa_function_pool[29623]: ClampColorARB (will be remapped) */
+   /* _mesa_function_pool[30080]: ClampColorARB (will be remapped) */
    "ii\0"
    "glClampColorARB\0"
    "\0"
-   /* _mesa_function_pool[29643]: GetLightiv (offset 265) */
+   /* _mesa_function_pool[30100]: GetLightiv (offset 265) */
    "iip\0"
    "glGetLightiv\0"
    "\0"
-   /* _mesa_function_pool[29661]: GetSamplerParameterIiv (will be remapped) */
+   /* _mesa_function_pool[30118]: GetSamplerParameterIiv (will be remapped) */
    "iip\0"
    "glGetSamplerParameterIiv\0"
    "\0"
-   /* _mesa_function_pool[29691]: DrawMeshArraysSUN (dynamic) */
+   /* _mesa_function_pool[30148]: DrawMeshArraysSUN (dynamic) */
    "iiii\0"
    "glDrawMeshArraysSUN\0"
    "\0"
-   /* _mesa_function_pool[29717]: IsList (offset 287) */
+   /* _mesa_function_pool[30174]: IsList (offset 287) */
    "i\0"
    "glIsList\0"
    "\0"
-   /* _mesa_function_pool[29729]: IsSync (will be remapped) */
+   /* _mesa_function_pool[30186]: IsSync (will be remapped) */
    "i\0"
    "glIsSync\0"
    "\0"
-   /* _mesa_function_pool[29741]: RenderMode (offset 196) */
+   /* _mesa_function_pool[30198]: RenderMode (offset 196) */
    "i\0"
    "glRenderMode\0"
    "\0"
-   /* _mesa_function_pool[29757]: GetMapControlPointsNV (dynamic) */
+   /* _mesa_function_pool[30214]: GetMapControlPointsNV (dynamic) */
    "iiiiiip\0"
    "glGetMapControlPointsNV\0"
    "\0"
-   /* _mesa_function_pool[29790]: DrawBuffersARB (will be remapped) */
+   /* _mesa_function_pool[30247]: DrawBuffersARB (will be remapped) */
    "ip\0"
    "glDrawBuffers\0"
    "glDrawBuffersARB\0"
    "glDrawBuffersATI\0"
    "\0"
-   /* _mesa_function_pool[29842]: ClearBufferiv (will be remapped) */
+   /* _mesa_function_pool[30299]: ClearBufferiv (will be remapped) */
    "iip\0"
    "glClearBufferiv\0"
    "\0"
-   /* _mesa_function_pool[29863]: ProgramLocalParameter4fARB (will be remapped) */
+   /* _mesa_function_pool[30320]: ProgramLocalParameter4fARB (will be remapped) */
    "iiffff\0"
    "glProgramLocalParameter4fARB\0"
    "\0"
-   /* _mesa_function_pool[29900]: SpriteParameterivSGIX (dynamic) */
+   /* _mesa_function_pool[30357]: SpriteParameterivSGIX (dynamic) */
    "ip\0"
    "glSpriteParameterivSGIX\0"
    "\0"
-   /* _mesa_function_pool[29928]: ProvokingVertexEXT (will be remapped) */
+   /* _mesa_function_pool[30385]: ProvokingVertexEXT (will be remapped) */
    "i\0"
    "glProvokingVertexEXT\0"
    "glProvokingVertex\0"
    "\0"
-   /* _mesa_function_pool[29970]: MultiTexCoord1fARB (offset 378) */
+   /* _mesa_function_pool[30427]: MultiTexCoord1fARB (offset 378) */
    "if\0"
    "glMultiTexCoord1f\0"
    "glMultiTexCoord1fARB\0"
    "\0"
-   /* _mesa_function_pool[30013]: LoadName (offset 198) */
+   /* _mesa_function_pool[30470]: LoadName (offset 198) */
    "i\0"
    "glLoadName\0"
    "\0"
-   /* _mesa_function_pool[30027]: VertexAttribs4ubvNV (will be remapped) */
+   /* _mesa_function_pool[30484]: VertexAttribs4ubvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4ubvNV\0"
    "\0"
-   /* _mesa_function_pool[30054]: WeightsvARB (dynamic) */
+   /* _mesa_function_pool[30511]: WeightsvARB (dynamic) */
    "ip\0"
    "glWeightsvARB\0"
    "\0"
-   /* _mesa_function_pool[30072]: Uniform1fvARB (will be remapped) */
+   /* _mesa_function_pool[30529]: Uniform1fvARB (will be remapped) */
    "iip\0"
    "glUniform1fv\0"
    "glUniform1fvARB\0"
    "\0"
-   /* _mesa_function_pool[30106]: CopyTexSubImage1D (offset 325) */
+   /* _mesa_function_pool[30563]: CopyTexSubImage1D (offset 325) */
    "iiiiii\0"
    "glCopyTexSubImage1D\0"
    "glCopyTexSubImage1DEXT\0"
    "\0"
-   /* _mesa_function_pool[30157]: CullFace (offset 152) */
+   /* _mesa_function_pool[30614]: CullFace (offset 152) */
    "i\0"
    "glCullFace\0"
    "\0"
-   /* _mesa_function_pool[30171]: BindTexture (offset 307) */
+   /* _mesa_function_pool[30628]: BindTexture (offset 307) */
    "ii\0"
    "glBindTexture\0"
    "glBindTextureEXT\0"
    "\0"
-   /* _mesa_function_pool[30206]: BeginFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[30663]: BeginFragmentShaderATI (will be remapped) */
    "\0"
    "glBeginFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[30233]: MultiTexCoord4fARB (offset 402) */
+   /* _mesa_function_pool[30690]: MultiTexCoord4fARB (offset 402) */
    "iffff\0"
    "glMultiTexCoord4f\0"
    "glMultiTexCoord4fARB\0"
    "\0"
-   /* _mesa_function_pool[30279]: VertexAttribs3svNV (will be remapped) */
+   /* _mesa_function_pool[30736]: VertexAttribs3svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs3svNV\0"
    "\0"
-   /* _mesa_function_pool[30305]: StencilFunc (offset 243) */
+   /* _mesa_function_pool[30762]: StencilFunc (offset 243) */
    "iii\0"
    "glStencilFunc\0"
    "\0"
-   /* _mesa_function_pool[30324]: CopyPixels (offset 255) */
+   /* _mesa_function_pool[30781]: CopyPixels (offset 255) */
    "iiiii\0"
    "glCopyPixels\0"
    "\0"
-   /* _mesa_function_pool[30344]: Rectsv (offset 93) */
+   /* _mesa_function_pool[30801]: Rectsv (offset 93) */
    "pp\0"
    "glRectsv\0"
    "\0"
-   /* _mesa_function_pool[30357]: ReplacementCodeuivSUN (dynamic) */
+   /* _mesa_function_pool[30814]: ReplacementCodeuivSUN (dynamic) */
    "p\0"
    "glReplacementCodeuivSUN\0"
    "\0"
-   /* _mesa_function_pool[30384]: EnableVertexAttribArrayARB (will be remapped) */
+   /* _mesa_function_pool[30841]: EnableVertexAttribArrayARB (will be remapped) */
    "i\0"
    "glEnableVertexAttribArray\0"
    "glEnableVertexAttribArrayARB\0"
    "\0"
-   /* _mesa_function_pool[30442]: NormalPointervINTEL (dynamic) */
+   /* _mesa_function_pool[30899]: NormalPointervINTEL (dynamic) */
    "ip\0"
    "glNormalPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[30468]: CopyConvolutionFilter2D (offset 355) */
+   /* _mesa_function_pool[30925]: CopyConvolutionFilter2D (offset 355) */
    "iiiiii\0"
    "glCopyConvolutionFilter2D\0"
    "glCopyConvolutionFilter2DEXT\0"
    "\0"
-   /* _mesa_function_pool[30531]: WindowPos3ivMESA (will be remapped) */
+   /* _mesa_function_pool[30988]: WindowPos3ivMESA (will be remapped) */
    "p\0"
    "glWindowPos3iv\0"
    "glWindowPos3ivARB\0"
    "glWindowPos3ivMESA\0"
    "\0"
-   /* _mesa_function_pool[30586]: CopyBufferSubData (will be remapped) */
+   /* _mesa_function_pool[31043]: CopyBufferSubData (will be remapped) */
    "iiiii\0"
    "glCopyBufferSubData\0"
    "\0"
-   /* _mesa_function_pool[30613]: NormalPointer (offset 318) */
+   /* _mesa_function_pool[31070]: NormalPointer (offset 318) */
    "iip\0"
    "glNormalPointer\0"
    "\0"
-   /* _mesa_function_pool[30634]: TexParameterfv (offset 179) */
+   /* _mesa_function_pool[31091]: TexParameterfv (offset 179) */
    "iip\0"
    "glTexParameterfv\0"
    "\0"
-   /* _mesa_function_pool[30656]: IsBufferARB (will be remapped) */
+   /* _mesa_function_pool[31113]: IsBufferARB (will be remapped) */
    "i\0"
    "glIsBuffer\0"
    "glIsBufferARB\0"
    "\0"
-   /* _mesa_function_pool[30684]: WindowPos4iMESA (will be remapped) */
+   /* _mesa_function_pool[31141]: WindowPos4iMESA (will be remapped) */
    "iiii\0"
    "glWindowPos4iMESA\0"
    "\0"
-   /* _mesa_function_pool[30708]: VertexAttrib4uivARB (will be remapped) */
+   /* _mesa_function_pool[31165]: VertexAttrib4uivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4uiv\0"
    "glVertexAttrib4uivARB\0"
    "\0"
-   /* _mesa_function_pool[30753]: Tangent3bvEXT (dynamic) */
+   /* _mesa_function_pool[31210]: Tangent3bvEXT (dynamic) */
    "p\0"
    "glTangent3bvEXT\0"
    "\0"
-   /* _mesa_function_pool[30772]: VertexAttribI3uivEXT (will be remapped) */
+   /* _mesa_function_pool[31229]: VertexAttribI3uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI3uivEXT\0"
    "glVertexAttribI3uiv\0"
    "\0"
-   /* _mesa_function_pool[30819]: UniformMatrix3x4fv (will be remapped) */
+   /* _mesa_function_pool[31276]: UniformMatrix3x4fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix3x4fv\0"
    "\0"
-   /* _mesa_function_pool[30846]: ClipPlane (offset 150) */
+   /* _mesa_function_pool[31303]: ClipPlane (offset 150) */
    "ip\0"
    "glClipPlane\0"
    "\0"
-   /* _mesa_function_pool[30862]: Recti (offset 90) */
+   /* _mesa_function_pool[31319]: Recti (offset 90) */
    "iiii\0"
    "glRecti\0"
    "\0"
-   /* _mesa_function_pool[30876]: TrackMatrixNV (will be remapped) */
+   /* _mesa_function_pool[31333]: TrackMatrixNV (will be remapped) */
    "iiii\0"
    "glTrackMatrixNV\0"
    "\0"
-   /* _mesa_function_pool[30898]: DrawRangeElementsBaseVertex (will be remapped) */
+   /* _mesa_function_pool[31355]: DrawRangeElementsBaseVertex (will be remapped) */
    "iiiiipi\0"
    "glDrawRangeElementsBaseVertex\0"
    "\0"
-   /* _mesa_function_pool[30937]: SamplerParameterIuiv (will be remapped) */
+   /* _mesa_function_pool[31394]: SamplerParameterIuiv (will be remapped) */
    "iip\0"
    "glSamplerParameterIuiv\0"
    "\0"
-   /* _mesa_function_pool[30965]: TexCoordPointervINTEL (dynamic) */
+   /* _mesa_function_pool[31422]: TexCoordPointervINTEL (dynamic) */
    "iip\0"
    "glTexCoordPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[30994]: DeleteBuffersARB (will be remapped) */
+   /* _mesa_function_pool[31451]: DeleteBuffersARB (will be remapped) */
    "ip\0"
    "glDeleteBuffers\0"
    "glDeleteBuffersARB\0"
    "\0"
-   /* _mesa_function_pool[31033]: PixelTransformParameterfvEXT (dynamic) */
+   /* _mesa_function_pool[31490]: PixelTransformParameterfvEXT (dynamic) */
    "iip\0"
    "glPixelTransformParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[31069]: PrimitiveRestartNV (will be remapped) */
+   /* _mesa_function_pool[31526]: PrimitiveRestartNV (will be remapped) */
    "\0"
    "glPrimitiveRestartNV\0"
    "\0"
-   /* _mesa_function_pool[31092]: WindowPos4fvMESA (will be remapped) */
+   /* _mesa_function_pool[31549]: WindowPos4fvMESA (will be remapped) */
    "p\0"
    "glWindowPos4fvMESA\0"
    "\0"
-   /* _mesa_function_pool[31114]: GetPixelMapuiv (offset 272) */
+   /* _mesa_function_pool[31571]: GetPixelMapuiv (offset 272) */
    "ip\0"
    "glGetPixelMapuiv\0"
    "\0"
-   /* _mesa_function_pool[31135]: Rectf (offset 88) */
+   /* _mesa_function_pool[31592]: Rectf (offset 88) */
    "ffff\0"
    "glRectf\0"
    "\0"
-   /* _mesa_function_pool[31149]: VertexAttrib1sNV (will be remapped) */
+   /* _mesa_function_pool[31606]: VertexAttrib1sNV (will be remapped) */
    "ii\0"
    "glVertexAttrib1sNV\0"
    "\0"
-   /* _mesa_function_pool[31172]: Indexfv (offset 47) */
+   /* _mesa_function_pool[31629]: Indexfv (offset 47) */
    "p\0"
    "glIndexfv\0"
    "\0"
-   /* _mesa_function_pool[31185]: SecondaryColor3svEXT (will be remapped) */
+   /* _mesa_function_pool[31642]: SecondaryColor3svEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3sv\0"
    "glSecondaryColor3svEXT\0"
    "\0"
-   /* _mesa_function_pool[31231]: LoadTransposeMatrixfARB (will be remapped) */
+   /* _mesa_function_pool[31688]: LoadTransposeMatrixfARB (will be remapped) */
    "p\0"
    "glLoadTransposeMatrixf\0"
    "glLoadTransposeMatrixfARB\0"
    "\0"
-   /* _mesa_function_pool[31283]: GetPointerv (offset 329) */
+   /* _mesa_function_pool[31740]: GetPointerv (offset 329) */
    "ip\0"
    "glGetPointerv\0"
    "glGetPointervEXT\0"
    "\0"
-   /* _mesa_function_pool[31318]: Tangent3bEXT (dynamic) */
+   /* _mesa_function_pool[31775]: Tangent3bEXT (dynamic) */
    "iii\0"
    "glTangent3bEXT\0"
    "\0"
-   /* _mesa_function_pool[31338]: CombinerParameterfNV (will be remapped) */
+   /* _mesa_function_pool[31795]: CombinerParameterfNV (will be remapped) */
    "if\0"
    "glCombinerParameterfNV\0"
    "\0"
-   /* _mesa_function_pool[31365]: IndexMask (offset 212) */
+   /* _mesa_function_pool[31822]: IndexMask (offset 212) */
    "i\0"
    "glIndexMask\0"
    "\0"
-   /* _mesa_function_pool[31380]: BindProgramNV (will be remapped) */
+   /* _mesa_function_pool[31837]: BindProgramNV (will be remapped) */
    "ii\0"
    "glBindProgramARB\0"
    "glBindProgramNV\0"
    "\0"
-   /* _mesa_function_pool[31417]: VertexAttrib4svARB (will be remapped) */
+   /* _mesa_function_pool[31874]: VertexAttrib4svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4sv\0"
    "glVertexAttrib4svARB\0"
    "\0"
-   /* _mesa_function_pool[31460]: GetFloatv (offset 262) */
+   /* _mesa_function_pool[31917]: GetFloatv (offset 262) */
    "ip\0"
    "glGetFloatv\0"
    "\0"
-   /* _mesa_function_pool[31476]: CreateDebugObjectMESA (dynamic) */
+   /* _mesa_function_pool[31933]: CreateDebugObjectMESA (dynamic) */
    "\0"
    "glCreateDebugObjectMESA\0"
    "\0"
-   /* _mesa_function_pool[31502]: GetShaderiv (will be remapped) */
+   /* _mesa_function_pool[31959]: GetShaderiv (will be remapped) */
    "iip\0"
    "glGetShaderiv\0"
    "\0"
-   /* _mesa_function_pool[31521]: ClientWaitSync (will be remapped) */
+   /* _mesa_function_pool[31978]: ClientWaitSync (will be remapped) */
    "iii\0"
    "glClientWaitSync\0"
    "\0"
-   /* _mesa_function_pool[31543]: TexCoord4s (offset 124) */
+   /* _mesa_function_pool[32000]: TexCoord4s (offset 124) */
    "iiii\0"
    "glTexCoord4s\0"
    "\0"
-   /* _mesa_function_pool[31562]: TexCoord3sv (offset 117) */
+   /* _mesa_function_pool[32019]: TexCoord3sv (offset 117) */
    "p\0"
    "glTexCoord3sv\0"
    "\0"
-   /* _mesa_function_pool[31579]: BindFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[32036]: BindFragmentShaderATI (will be remapped) */
    "i\0"
    "glBindFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[31606]: PopAttrib (offset 218) */
+   /* _mesa_function_pool[32063]: PopAttrib (offset 218) */
    "\0"
    "glPopAttrib\0"
    "\0"
-   /* _mesa_function_pool[31620]: Fogfv (offset 154) */
+   /* _mesa_function_pool[32077]: Fogfv (offset 154) */
    "ip\0"
    "glFogfv\0"
    "\0"
-   /* _mesa_function_pool[31632]: UnmapBufferARB (will be remapped) */
+   /* _mesa_function_pool[32089]: UnmapBufferARB (will be remapped) */
    "i\0"
    "glUnmapBuffer\0"
    "glUnmapBufferARB\0"
    "\0"
-   /* _mesa_function_pool[31666]: InitNames (offset 197) */
+   /* _mesa_function_pool[32123]: InitNames (offset 197) */
    "\0"
    "glInitNames\0"
    "\0"
-   /* _mesa_function_pool[31680]: Normal3sv (offset 61) */
+   /* _mesa_function_pool[32137]: Normal3sv (offset 61) */
    "p\0"
    "glNormal3sv\0"
    "\0"
-   /* _mesa_function_pool[31695]: Minmax (offset 368) */
+   /* _mesa_function_pool[32152]: Minmax (offset 368) */
    "iii\0"
    "glMinmax\0"
    "glMinmaxEXT\0"
    "\0"
-   /* _mesa_function_pool[31721]: TexCoord4d (offset 118) */
+   /* _mesa_function_pool[32178]: TexCoord4d (offset 118) */
    "dddd\0"
    "glTexCoord4d\0"
    "\0"
-   /* _mesa_function_pool[31740]: DeformationMap3dSGIX (dynamic) */
+   /* _mesa_function_pool[32197]: DeformationMap3dSGIX (dynamic) */
    "iddiiddiiddiip\0"
    "glDeformationMap3dSGIX\0"
    "\0"
-   /* _mesa_function_pool[31779]: TexCoord4f (offset 120) */
+   /* _mesa_function_pool[32236]: TexCoord4f (offset 120) */
    "ffff\0"
    "glTexCoord4f\0"
    "\0"
-   /* _mesa_function_pool[31798]: FogCoorddvEXT (will be remapped) */
+   /* _mesa_function_pool[32255]: FogCoorddvEXT (will be remapped) */
    "p\0"
    "glFogCoorddv\0"
    "glFogCoorddvEXT\0"
    "\0"
-   /* _mesa_function_pool[31830]: FinishTextureSUNX (dynamic) */
+   /* _mesa_function_pool[32287]: FinishTextureSUNX (dynamic) */
    "\0"
    "glFinishTextureSUNX\0"
    "\0"
-   /* _mesa_function_pool[31852]: GetFragmentLightfvSGIX (dynamic) */
+   /* _mesa_function_pool[32309]: GetFragmentLightfvSGIX (dynamic) */
    "iip\0"
    "glGetFragmentLightfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[31882]: Binormal3fvEXT (dynamic) */
+   /* _mesa_function_pool[32339]: Binormal3fvEXT (dynamic) */
    "p\0"
    "glBinormal3fvEXT\0"
    "\0"
-   /* _mesa_function_pool[31902]: GetBooleanv (offset 258) */
+   /* _mesa_function_pool[32359]: GetBooleanv (offset 258) */
    "ip\0"
    "glGetBooleanv\0"
    "\0"
-   /* _mesa_function_pool[31920]: ColorFragmentOp3ATI (will be remapped) */
+   /* _mesa_function_pool[32377]: ColorFragmentOp3ATI (will be remapped) */
    "iiiiiiiiiiiii\0"
    "glColorFragmentOp3ATI\0"
    "\0"
-   /* _mesa_function_pool[31957]: Hint (offset 158) */
+   /* _mesa_function_pool[32414]: Hint (offset 158) */
    "ii\0"
    "glHint\0"
    "\0"
-   /* _mesa_function_pool[31968]: Color4dv (offset 28) */
+   /* _mesa_function_pool[32425]: Color4dv (offset 28) */
    "p\0"
    "glColor4dv\0"
    "\0"
-   /* _mesa_function_pool[31982]: VertexAttrib2svARB (will be remapped) */
+   /* _mesa_function_pool[32439]: VertexAttrib2svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib2sv\0"
    "glVertexAttrib2svARB\0"
    "\0"
-   /* _mesa_function_pool[32025]: AreProgramsResidentNV (will be remapped) */
+   /* _mesa_function_pool[32482]: AreProgramsResidentNV (will be remapped) */
    "ipp\0"
    "glAreProgramsResidentNV\0"
    "\0"
-   /* _mesa_function_pool[32054]: WindowPos3svMESA (will be remapped) */
+   /* _mesa_function_pool[32511]: WindowPos3svMESA (will be remapped) */
    "p\0"
    "glWindowPos3sv\0"
    "glWindowPos3svARB\0"
    "glWindowPos3svMESA\0"
    "\0"
-   /* _mesa_function_pool[32109]: CopyColorSubTable (offset 347) */
+   /* _mesa_function_pool[32566]: CopyColorSubTable (offset 347) */
    "iiiii\0"
    "glCopyColorSubTable\0"
    "glCopyColorSubTableEXT\0"
    "\0"
-   /* _mesa_function_pool[32159]: WeightdvARB (dynamic) */
+   /* _mesa_function_pool[32616]: WeightdvARB (dynamic) */
    "ip\0"
    "glWeightdvARB\0"
    "\0"
-   /* _mesa_function_pool[32177]: DeleteRenderbuffersEXT (will be remapped) */
+   /* _mesa_function_pool[32634]: DeleteRenderbuffersEXT (will be remapped) */
    "ip\0"
    "glDeleteRenderbuffers\0"
    "glDeleteRenderbuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[32228]: VertexAttrib4NubvARB (will be remapped) */
+   /* _mesa_function_pool[32685]: VertexAttrib4NubvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nubv\0"
    "glVertexAttrib4NubvARB\0"
    "\0"
-   /* _mesa_function_pool[32275]: VertexAttrib3dvNV (will be remapped) */
+   /* _mesa_function_pool[32732]: VertexAttrib3dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib3dvNV\0"
    "\0"
-   /* _mesa_function_pool[32299]: GetObjectParameterfvARB (will be remapped) */
+   /* _mesa_function_pool[32756]: GetObjectParameterfvARB (will be remapped) */
    "iip\0"
    "glGetObjectParameterfvARB\0"
    "\0"
-   /* _mesa_function_pool[32330]: Vertex4iv (offset 147) */
+   /* _mesa_function_pool[32787]: Vertex4iv (offset 147) */
    "p\0"
    "glVertex4iv\0"
    "\0"
-   /* _mesa_function_pool[32345]: GetProgramEnvParameterdvARB (will be remapped) */
+   /* _mesa_function_pool[32802]: GetProgramEnvParameterdvARB (will be remapped) */
    "iip\0"
    "glGetProgramEnvParameterdvARB\0"
    "\0"
-   /* _mesa_function_pool[32380]: TexCoord4dv (offset 119) */
+   /* _mesa_function_pool[32837]: TexCoord4dv (offset 119) */
    "p\0"
    "glTexCoord4dv\0"
    "\0"
-   /* _mesa_function_pool[32397]: LockArraysEXT (will be remapped) */
+   /* _mesa_function_pool[32854]: LockArraysEXT (will be remapped) */
    "ii\0"
    "glLockArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[32417]: Begin (offset 7) */
+   /* _mesa_function_pool[32874]: Begin (offset 7) */
    "i\0"
    "glBegin\0"
    "\0"
-   /* _mesa_function_pool[32428]: LightModeli (offset 165) */
+   /* _mesa_function_pool[32885]: LightModeli (offset 165) */
    "ii\0"
    "glLightModeli\0"
    "\0"
-   /* _mesa_function_pool[32446]: VertexAttribI4ivEXT (will be remapped) */
+   /* _mesa_function_pool[32903]: VertexAttribI4ivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4ivEXT\0"
    "glVertexAttribI4iv\0"
    "\0"
-   /* _mesa_function_pool[32491]: Rectfv (offset 89) */
+   /* _mesa_function_pool[32948]: Rectfv (offset 89) */
    "pp\0"
    "glRectfv\0"
    "\0"
-   /* _mesa_function_pool[32504]: LightModelf (offset 163) */
+   /* _mesa_function_pool[32961]: LightModelf (offset 163) */
    "if\0"
    "glLightModelf\0"
    "\0"
-   /* _mesa_function_pool[32522]: GetTexParameterfv (offset 282) */
+   /* _mesa_function_pool[32979]: GetTexParameterfv (offset 282) */
    "iip\0"
    "glGetTexParameterfv\0"
    "\0"
-   /* _mesa_function_pool[32547]: GetLightfv (offset 264) */
+   /* _mesa_function_pool[33004]: GetLightfv (offset 264) */
    "iip\0"
    "glGetLightfv\0"
    "\0"
-   /* _mesa_function_pool[32565]: PixelTransformParameterivEXT (dynamic) */
+   /* _mesa_function_pool[33022]: PixelTransformParameterivEXT (dynamic) */
    "iip\0"
    "glPixelTransformParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[32601]: BinormalPointerEXT (dynamic) */
+   /* _mesa_function_pool[33058]: BinormalPointerEXT (dynamic) */
    "iip\0"
    "glBinormalPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[32627]: VertexAttrib1dNV (will be remapped) */
+   /* _mesa_function_pool[33084]: VertexAttrib1dNV (will be remapped) */
    "id\0"
    "glVertexAttrib1dNV\0"
    "\0"
-   /* _mesa_function_pool[32650]: GetCombinerInputParameterivNV (will be remapped) */
+   /* _mesa_function_pool[33107]: GetCombinerInputParameterivNV (will be remapped) */
    "iiiip\0"
    "glGetCombinerInputParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[32689]: Disable (offset 214) */
+   /* _mesa_function_pool[33146]: Disable (offset 214) */
    "i\0"
    "glDisable\0"
    "\0"
-   /* _mesa_function_pool[32702]: MultiTexCoord2fvARB (offset 387) */
+   /* _mesa_function_pool[33159]: MultiTexCoord2fvARB (offset 387) */
    "ip\0"
    "glMultiTexCoord2fv\0"
    "glMultiTexCoord2fvARB\0"
    "\0"
-   /* _mesa_function_pool[32747]: GetRenderbufferParameterivEXT (will be remapped) */
+   /* _mesa_function_pool[33204]: GetRenderbufferParameterivEXT (will be remapped) */
    "iip\0"
    "glGetRenderbufferParameteriv\0"
    "glGetRenderbufferParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[32813]: CombinerParameterivNV (will be remapped) */
+   /* _mesa_function_pool[33270]: CombinerParameterivNV (will be remapped) */
    "ip\0"
    "glCombinerParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[32841]: GenFragmentShadersATI (will be remapped) */
+   /* _mesa_function_pool[33298]: GenFragmentShadersATI (will be remapped) */
    "i\0"
    "glGenFragmentShadersATI\0"
    "\0"
-   /* _mesa_function_pool[32868]: DrawArrays (offset 310) */
+   /* _mesa_function_pool[33325]: DrawArrays (offset 310) */
    "iii\0"
    "glDrawArrays\0"
    "glDrawArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[32902]: WeightuivARB (dynamic) */
+   /* _mesa_function_pool[33359]: WeightuivARB (dynamic) */
    "ip\0"
    "glWeightuivARB\0"
    "\0"
-   /* _mesa_function_pool[32921]: VertexAttrib2sARB (will be remapped) */
+   /* _mesa_function_pool[33378]: GetVertexAttribIivEXT (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribIivEXT\0"
+   "glGetVertexAttribIiv\0"
+   "\0"
+   /* _mesa_function_pool[33428]: VertexAttrib2sARB (will be remapped) */
    "iii\0"
    "glVertexAttrib2s\0"
    "glVertexAttrib2sARB\0"
    "\0"
-   /* _mesa_function_pool[32963]: ColorMask (offset 210) */
+   /* _mesa_function_pool[33470]: GetnTexImageARB (will be remapped) */
+   "iiiiip\0"
+   "glGetnTexImageARB\0"
+   "\0"
+   /* _mesa_function_pool[33496]: ColorMask (offset 210) */
    "iiii\0"
    "glColorMask\0"
    "\0"
-   /* _mesa_function_pool[32981]: GenAsyncMarkersSGIX (dynamic) */
+   /* _mesa_function_pool[33514]: GenAsyncMarkersSGIX (dynamic) */
    "i\0"
    "glGenAsyncMarkersSGIX\0"
    "\0"
-   /* _mesa_function_pool[33006]: Tangent3svEXT (dynamic) */
+   /* _mesa_function_pool[33539]: Tangent3svEXT (dynamic) */
    "p\0"
    "glTangent3svEXT\0"
    "\0"
-   /* _mesa_function_pool[33025]: GetListParameterivSGIX (dynamic) */
+   /* _mesa_function_pool[33558]: GetListParameterivSGIX (dynamic) */
    "iip\0"
    "glGetListParameterivSGIX\0"
    "\0"
-   /* _mesa_function_pool[33055]: BindBufferARB (will be remapped) */
+   /* _mesa_function_pool[33588]: BindBufferARB (will be remapped) */
    "ii\0"
    "glBindBuffer\0"
    "glBindBufferARB\0"
    "\0"
-   /* _mesa_function_pool[33088]: GetInfoLogARB (will be remapped) */
+   /* _mesa_function_pool[33621]: GetInfoLogARB (will be remapped) */
    "iipp\0"
    "glGetInfoLogARB\0"
    "\0"
-   /* _mesa_function_pool[33110]: RasterPos4iv (offset 83) */
+   /* _mesa_function_pool[33643]: RasterPos4iv (offset 83) */
    "p\0"
    "glRasterPos4iv\0"
    "\0"
-   /* _mesa_function_pool[33128]: Enable (offset 215) */
+   /* _mesa_function_pool[33661]: Enable (offset 215) */
    "i\0"
    "glEnable\0"
    "\0"
-   /* _mesa_function_pool[33140]: LineStipple (offset 167) */
+   /* _mesa_function_pool[33673]: LineStipple (offset 167) */
    "ii\0"
    "glLineStipple\0"
    "\0"
-   /* _mesa_function_pool[33158]: VertexAttribs4svNV (will be remapped) */
+   /* _mesa_function_pool[33691]: VertexAttribs4svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4svNV\0"
    "\0"
-   /* _mesa_function_pool[33184]: EdgeFlagPointerListIBM (dynamic) */
+   /* _mesa_function_pool[33717]: EdgeFlagPointerListIBM (dynamic) */
    "ipi\0"
    "glEdgeFlagPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[33214]: UniformMatrix3x2fv (will be remapped) */
+   /* _mesa_function_pool[33747]: UniformMatrix3x2fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix3x2fv\0"
    "\0"
-   /* _mesa_function_pool[33241]: GetMinmaxParameterfv (offset 365) */
+   /* _mesa_function_pool[33774]: GetMinmaxParameterfv (offset 365) */
    "iip\0"
    "glGetMinmaxParameterfv\0"
    "glGetMinmaxParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[33295]: VertexAttrib1fvARB (will be remapped) */
+   /* _mesa_function_pool[33828]: VertexAttrib1fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib1fv\0"
    "glVertexAttrib1fvARB\0"
    "\0"
-   /* _mesa_function_pool[33338]: GenBuffersARB (will be remapped) */
+   /* _mesa_function_pool[33871]: GenBuffersARB (will be remapped) */
    "ip\0"
    "glGenBuffers\0"
    "glGenBuffersARB\0"
    "\0"
-   /* _mesa_function_pool[33371]: VertexAttribs1svNV (will be remapped) */
+   /* _mesa_function_pool[33904]: VertexAttribs1svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs1svNV\0"
    "\0"
-   /* _mesa_function_pool[33397]: Vertex3fv (offset 137) */
+   /* _mesa_function_pool[33930]: Vertex3fv (offset 137) */
    "p\0"
    "glVertex3fv\0"
    "\0"
-   /* _mesa_function_pool[33412]: GetTexBumpParameterivATI (will be remapped) */
+   /* _mesa_function_pool[33945]: GetTexBumpParameterivATI (will be remapped) */
    "ip\0"
    "glGetTexBumpParameterivATI\0"
    "\0"
-   /* _mesa_function_pool[33443]: Binormal3bEXT (dynamic) */
+   /* _mesa_function_pool[33976]: Binormal3bEXT (dynamic) */
    "iii\0"
    "glBinormal3bEXT\0"
    "\0"
-   /* _mesa_function_pool[33464]: FragmentMaterialivSGIX (dynamic) */
+   /* _mesa_function_pool[33997]: FragmentMaterialivSGIX (dynamic) */
    "iip\0"
    "glFragmentMaterialivSGIX\0"
    "\0"
-   /* _mesa_function_pool[33494]: IsRenderbufferEXT (will be remapped) */
+   /* _mesa_function_pool[34027]: IsRenderbufferEXT (will be remapped) */
    "i\0"
    "glIsRenderbuffer\0"
    "glIsRenderbufferEXT\0"
    "\0"
-   /* _mesa_function_pool[33534]: GenProgramsNV (will be remapped) */
+   /* _mesa_function_pool[34067]: GenProgramsNV (will be remapped) */
    "ip\0"
    "glGenProgramsARB\0"
    "glGenProgramsNV\0"
    "\0"
-   /* _mesa_function_pool[33571]: VertexAttrib4dvNV (will be remapped) */
+   /* _mesa_function_pool[34104]: VertexAttrib4dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib4dvNV\0"
    "\0"
-   /* _mesa_function_pool[33595]: EndFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[34128]: EndFragmentShaderATI (will be remapped) */
    "\0"
    "glEndFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[33620]: Binormal3iEXT (dynamic) */
+   /* _mesa_function_pool[34153]: Binormal3iEXT (dynamic) */
    "iii\0"
    "glBinormal3iEXT\0"
    "\0"
-   /* _mesa_function_pool[33641]: WindowPos2fMESA (will be remapped) */
+   /* _mesa_function_pool[34174]: WindowPos2fMESA (will be remapped) */
    "ff\0"
    "glWindowPos2f\0"
    "glWindowPos2fARB\0"
@@ -4847,616 +4927,636 @@ static const char _mesa_function_pool[] =
 
 /* these functions need to be remapped */
 static const struct gl_function_pool_remap MESA_remap_table_functions[] = {
-   {  1577, AttachShader_remap_index },
-   {  9967, CreateProgram_remap_index },
-   { 23300, CreateShader_remap_index },
-   { 25832, DeleteProgram_remap_index },
-   { 18888, DeleteShader_remap_index },
-   { 23801, DetachShader_remap_index },
-   { 18202, GetAttachedShaders_remap_index },
-   {  4919, GetProgramInfoLog_remap_index },
+   {  1590, AttachShader_remap_index },
+   { 10221, CreateProgram_remap_index },
+   { 23765, CreateShader_remap_index },
+   { 26289, DeleteProgram_remap_index },
+   { 19245, DeleteShader_remap_index },
+   { 24258, DetachShader_remap_index },
+   { 18534, GetAttachedShaders_remap_index },
+   {  5053, GetProgramInfoLog_remap_index },
    {   405, GetProgramiv_remap_index },
-   {  6627, GetShaderInfoLog_remap_index },
-   { 31502, GetShaderiv_remap_index },
-   { 13443, IsProgram_remap_index },
-   { 12364, IsShader_remap_index },
-   { 10097, StencilFuncSeparate_remap_index },
-   {  3921, StencilMaskSeparate_remap_index },
-   {  7692, StencilOpSeparate_remap_index },
-   { 22560, UniformMatrix2x3fv_remap_index },
-   {  2847, UniformMatrix2x4fv_remap_index },
-   { 33214, UniformMatrix3x2fv_remap_index },
-   { 30819, UniformMatrix3x4fv_remap_index },
-   { 16406, UniformMatrix4x2fv_remap_index },
-   {  3263, UniformMatrix4x3fv_remap_index },
-   {  5080, ClampColor_remap_index },
-   { 18256, ClearBufferfi_remap_index },
-   { 17698, ClearBufferfv_remap_index },
-   { 29842, ClearBufferiv_remap_index },
-   { 13648, ClearBufferuiv_remap_index },
-   { 20199, GetStringi_remap_index },
-   {  2788, TexBuffer_remap_index },
+   {  6861, GetShaderInfoLog_remap_index },
+   { 31959, GetShaderiv_remap_index },
+   { 13724, IsProgram_remap_index },
+   { 12645, IsShader_remap_index },
+   { 10351, StencilFuncSeparate_remap_index },
+   {  4031, StencilMaskSeparate_remap_index },
+   {  7926, StencilOpSeparate_remap_index },
+   { 22999, UniformMatrix2x3fv_remap_index },
+   {  2920, UniformMatrix2x4fv_remap_index },
+   { 33747, UniformMatrix3x2fv_remap_index },
+   { 31276, UniformMatrix3x4fv_remap_index },
+   { 16714, UniformMatrix4x2fv_remap_index },
+   {  3339, UniformMatrix4x3fv_remap_index },
+   {  5259, ClampColor_remap_index },
+   { 18588, ClearBufferfi_remap_index },
+   { 18030, ClearBufferfv_remap_index },
+   { 30299, ClearBufferiv_remap_index },
+   { 13929, ClearBufferuiv_remap_index },
+   { 20582, GetStringi_remap_index },
+   {  2861, TexBuffer_remap_index },
    {   938, FramebufferTexture_remap_index },
-   { 26868, GetBufferParameteri64v_remap_index },
-   { 10197, GetInteger64i_v_remap_index },
-   { 23614, VertexAttribDivisor_remap_index },
-   {  9985, LoadTransposeMatrixdARB_remap_index },
-   { 31231, LoadTransposeMatrixfARB_remap_index },
-   {  5693, MultTransposeMatrixdARB_remap_index },
-   { 23988, MultTransposeMatrixfARB_remap_index },
+   { 27325, GetBufferParameteri64v_remap_index },
+   { 10451, GetInteger64i_v_remap_index },
+   { 24079, VertexAttribDivisor_remap_index },
+   { 10239, LoadTransposeMatrixdARB_remap_index },
+   { 31688, LoadTransposeMatrixfARB_remap_index },
+   {  5898, MultTransposeMatrixdARB_remap_index },
+   { 24445, MultTransposeMatrixfARB_remap_index },
    {   216, SampleCoverageARB_remap_index },
-   {  5919, CompressedTexImage1DARB_remap_index },
-   { 24516, CompressedTexImage2DARB_remap_index },
-   {  3984, CompressedTexImage3DARB_remap_index },
-   { 18544, CompressedTexSubImage1DARB_remap_index },
-   {  2050, CompressedTexSubImage2DARB_remap_index },
-   { 20621, CompressedTexSubImage3DARB_remap_index },
-   { 28948, GetCompressedTexImageARB_remap_index },
-   {  3829, DisableVertexAttribArrayARB_remap_index },
-   { 30384, EnableVertexAttribArrayARB_remap_index },
-   { 32345, GetProgramEnvParameterdvARB_remap_index },
-   { 23868, GetProgramEnvParameterfvARB_remap_index },
-   { 27865, GetProgramLocalParameterdvARB_remap_index },
-   {  8134, GetProgramLocalParameterfvARB_remap_index },
-   { 18720, GetProgramStringARB_remap_index },
-   { 28060, GetProgramivARB_remap_index },
-   { 20816, GetVertexAttribdvARB_remap_index },
-   { 16214, GetVertexAttribfvARB_remap_index },
-   {  9809, GetVertexAttribivARB_remap_index },
-   { 19662, ProgramEnvParameter4dARB_remap_index },
-   { 25582, ProgramEnvParameter4dvARB_remap_index },
-   { 17020, ProgramEnvParameter4fARB_remap_index },
-   {  9009, ProgramEnvParameter4fvARB_remap_index },
-   {  3947, ProgramLocalParameter4dARB_remap_index },
-   { 13153, ProgramLocalParameter4dvARB_remap_index },
-   { 29863, ProgramLocalParameter4fARB_remap_index },
-   { 26228, ProgramLocalParameter4fvARB_remap_index },
-   { 28702, ProgramStringARB_remap_index },
-   { 19930, VertexAttrib1dARB_remap_index },
-   { 15868, VertexAttrib1dvARB_remap_index },
-   {  4143, VertexAttrib1fARB_remap_index },
-   { 33295, VertexAttrib1fvARB_remap_index },
-   {  7218, VertexAttrib1sARB_remap_index },
-   {  2224, VertexAttrib1svARB_remap_index },
-   { 15299, VertexAttrib2dARB_remap_index },
-   { 17719, VertexAttrib2dvARB_remap_index },
-   {  1596, VertexAttrib2fARB_remap_index },
-   { 17832, VertexAttrib2fvARB_remap_index },
-   { 32921, VertexAttrib2sARB_remap_index },
-   { 31982, VertexAttrib2svARB_remap_index },
-   { 11348, VertexAttrib3dARB_remap_index },
-   {  8676, VertexAttrib3dvARB_remap_index },
-   {  1683, VertexAttrib3fARB_remap_index },
-   { 22851, VertexAttrib3fvARB_remap_index },
-   { 28549, VertexAttrib3sARB_remap_index },
-   { 20558, VertexAttrib3svARB_remap_index },
-   {  4945, VertexAttrib4NbvARB_remap_index },
-   { 18079, VertexAttrib4NivARB_remap_index },
-   { 22806, VertexAttrib4NsvARB_remap_index },
-   { 23820, VertexAttrib4NubARB_remap_index },
-   { 32228, VertexAttrib4NubvARB_remap_index },
-   { 19313, VertexAttrib4NuivARB_remap_index },
-   {  3136, VertexAttrib4NusvARB_remap_index },
-   { 10937, VertexAttrib4bvARB_remap_index },
-   { 27238, VertexAttrib4dARB_remap_index },
-   { 21580, VertexAttrib4dvARB_remap_index },
-   { 11502, VertexAttrib4fARB_remap_index },
-   { 11906, VertexAttrib4fvARB_remap_index },
-   { 10313, VertexAttrib4ivARB_remap_index },
-   { 17512, VertexAttrib4sARB_remap_index },
-   { 31417, VertexAttrib4svARB_remap_index },
-   { 16825, VertexAttrib4ubvARB_remap_index },
-   { 30708, VertexAttrib4uivARB_remap_index },
-   { 20369, VertexAttrib4usvARB_remap_index },
-   { 22375, VertexAttribPointerARB_remap_index },
-   { 33055, BindBufferARB_remap_index },
-   {  6925, BufferDataARB_remap_index },
-   {  1498, BufferSubDataARB_remap_index },
-   { 30994, DeleteBuffersARB_remap_index },
-   { 33338, GenBuffersARB_remap_index },
-   { 17875, GetBufferParameterivARB_remap_index },
-   { 16972, GetBufferPointervARB_remap_index },
-   {  1451, GetBufferSubDataARB_remap_index },
-   { 30656, IsBufferARB_remap_index },
-   { 26712, MapBufferARB_remap_index },
-   { 31632, UnmapBufferARB_remap_index },
+   {  6124, CompressedTexImage1DARB_remap_index },
+   { 24973, CompressedTexImage2DARB_remap_index },
+   {  4094, CompressedTexImage3DARB_remap_index },
+   { 18876, CompressedTexSubImage1DARB_remap_index },
+   {  2102, CompressedTexSubImage2DARB_remap_index },
+   { 21004, CompressedTexSubImage3DARB_remap_index },
+   { 29405, GetCompressedTexImageARB_remap_index },
+   {  3905, DisableVertexAttribArrayARB_remap_index },
+   { 30841, EnableVertexAttribArrayARB_remap_index },
+   { 32802, GetProgramEnvParameterdvARB_remap_index },
+   { 24325, GetProgramEnvParameterfvARB_remap_index },
+   { 28322, GetProgramLocalParameterdvARB_remap_index },
+   {  8402, GetProgramLocalParameterfvARB_remap_index },
+   { 19052, GetProgramStringARB_remap_index },
+   { 28517, GetProgramivARB_remap_index },
+   { 21199, GetVertexAttribdvARB_remap_index },
+   { 16522, GetVertexAttribfvARB_remap_index },
+   { 10077, GetVertexAttribivARB_remap_index },
+   { 20045, ProgramEnvParameter4dARB_remap_index },
+   { 26039, ProgramEnvParameter4dvARB_remap_index },
+   { 17328, ProgramEnvParameter4fARB_remap_index },
+   {  9277, ProgramEnvParameter4fvARB_remap_index },
+   {  4057, ProgramLocalParameter4dARB_remap_index },
+   { 13434, ProgramLocalParameter4dvARB_remap_index },
+   { 30320, ProgramLocalParameter4fARB_remap_index },
+   { 26685, ProgramLocalParameter4fvARB_remap_index },
+   { 29159, ProgramStringARB_remap_index },
+   { 20313, VertexAttrib1dARB_remap_index },
+   { 16149, VertexAttrib1dvARB_remap_index },
+   {  4253, VertexAttrib1fARB_remap_index },
+   { 33828, VertexAttrib1fvARB_remap_index },
+   {  7452, VertexAttrib1sARB_remap_index },
+   {  2297, VertexAttrib1svARB_remap_index },
+   { 15580, VertexAttrib2dARB_remap_index },
+   { 18051, VertexAttrib2dvARB_remap_index },
+   {  1648, VertexAttrib2fARB_remap_index },
+   { 18164, VertexAttrib2fvARB_remap_index },
+   { 33428, VertexAttrib2sARB_remap_index },
+   { 32439, VertexAttrib2svARB_remap_index },
+   { 11629, VertexAttrib3dARB_remap_index },
+   {  8944, VertexAttrib3dvARB_remap_index },
+   {  1735, VertexAttrib3fARB_remap_index },
+   { 23316, VertexAttrib3fvARB_remap_index },
+   { 29006, VertexAttrib3sARB_remap_index },
+   { 20941, VertexAttrib3svARB_remap_index },
+   {  5079, VertexAttrib4NbvARB_remap_index },
+   { 18411, VertexAttrib4NivARB_remap_index },
+   { 23271, VertexAttrib4NsvARB_remap_index },
+   { 24277, VertexAttrib4NubARB_remap_index },
+   { 32685, VertexAttrib4NubvARB_remap_index },
+   { 19696, VertexAttrib4NuivARB_remap_index },
+   {  3212, VertexAttrib4NusvARB_remap_index },
+   { 11218, VertexAttrib4bvARB_remap_index },
+   { 27695, VertexAttrib4dARB_remap_index },
+   { 21998, VertexAttrib4dvARB_remap_index },
+   { 11783, VertexAttrib4fARB_remap_index },
+   { 12187, VertexAttrib4fvARB_remap_index },
+   { 10594, VertexAttrib4ivARB_remap_index },
+   { 17844, VertexAttrib4sARB_remap_index },
+   { 31874, VertexAttrib4svARB_remap_index },
+   { 17133, VertexAttrib4ubvARB_remap_index },
+   { 31165, VertexAttrib4uivARB_remap_index },
+   { 20752, VertexAttrib4usvARB_remap_index },
+   { 22814, VertexAttribPointerARB_remap_index },
+   { 33588, BindBufferARB_remap_index },
+   {  7159, BufferDataARB_remap_index },
+   {  1511, BufferSubDataARB_remap_index },
+   { 31451, DeleteBuffersARB_remap_index },
+   { 33871, GenBuffersARB_remap_index },
+   { 18207, GetBufferParameterivARB_remap_index },
+   { 17280, GetBufferPointervARB_remap_index },
+   {  1464, GetBufferSubDataARB_remap_index },
+   { 31113, IsBufferARB_remap_index },
+   { 27169, MapBufferARB_remap_index },
+   { 32089, UnmapBufferARB_remap_index },
    {   312, BeginQueryARB_remap_index },
-   { 20025, DeleteQueriesARB_remap_index },
-   { 12225, EndQueryARB_remap_index },
-   { 29427, GenQueriesARB_remap_index },
-   {  1942, GetQueryObjectivARB_remap_index },
-   { 17556, GetQueryObjectuivARB_remap_index },
-   {  1740, GetQueryivARB_remap_index },
-   { 20276, IsQueryARB_remap_index },
-   {  8286, AttachObjectARB_remap_index },
-   { 18850, CompileShaderARB_remap_index },
-   {  3205, CreateProgramObjectARB_remap_index },
-   {  6870, CreateShaderObjectARB_remap_index },
-   { 14601, DeleteObjectARB_remap_index },
-   { 24307, DetachObjectARB_remap_index },
-   { 11970, GetActiveUniformARB_remap_index },
-   {  9484, GetAttachedObjectsARB_remap_index },
-   {  9791, GetHandleARB_remap_index },
-   { 33088, GetInfoLogARB_remap_index },
-   { 32299, GetObjectParameterfvARB_remap_index },
-   { 27739, GetObjectParameterivARB_remap_index },
-   { 29185, GetShaderSourceARB_remap_index },
-   { 28409, GetUniformLocationARB_remap_index },
-   { 24090, GetUniformfvARB_remap_index },
-   { 12728, GetUniformivARB_remap_index },
-   { 20414, LinkProgramARB_remap_index },
-   { 20472, ShaderSourceARB_remap_index },
-   {  7592, Uniform1fARB_remap_index },
-   { 30072, Uniform1fvARB_remap_index },
-   { 22344, Uniform1iARB_remap_index },
-   { 21269, Uniform1ivARB_remap_index },
-   {  2173, Uniform2fARB_remap_index },
-   { 14437, Uniform2fvARB_remap_index },
-   { 26599, Uniform2iARB_remap_index },
-   {  2293, Uniform2ivARB_remap_index },
-   { 18960, Uniform3fARB_remap_index },
-   {  9514, Uniform3fvARB_remap_index },
-   {  6481, Uniform3iARB_remap_index },
-   { 17078, Uniform3ivARB_remap_index },
-   { 19468, Uniform4fARB_remap_index },
-   { 23954, Uniform4fvARB_remap_index },
-   { 25216, Uniform4iARB_remap_index },
-   { 20782, Uniform4ivARB_remap_index },
-   {  8338, UniformMatrix2fvARB_remap_index },
+   { 20408, DeleteQueriesARB_remap_index },
+   { 12506, EndQueryARB_remap_index },
+   { 29884, GenQueriesARB_remap_index },
+   {  1994, GetQueryObjectivARB_remap_index },
+   { 17888, GetQueryObjectuivARB_remap_index },
+   {  1792, GetQueryivARB_remap_index },
+   { 20659, IsQueryARB_remap_index },
+   {  8554, AttachObjectARB_remap_index },
+   { 19207, CompileShaderARB_remap_index },
+   {  3281, CreateProgramObjectARB_remap_index },
+   {  7104, CreateShaderObjectARB_remap_index },
+   { 14882, DeleteObjectARB_remap_index },
+   { 24764, DetachObjectARB_remap_index },
+   { 12251, GetActiveUniformARB_remap_index },
+   {  9752, GetAttachedObjectsARB_remap_index },
+   { 10059, GetHandleARB_remap_index },
+   { 33621, GetInfoLogARB_remap_index },
+   { 32756, GetObjectParameterfvARB_remap_index },
+   { 28196, GetObjectParameterivARB_remap_index },
+   { 29642, GetShaderSourceARB_remap_index },
+   { 28866, GetUniformLocationARB_remap_index },
+   { 24547, GetUniformfvARB_remap_index },
+   { 13009, GetUniformivARB_remap_index },
+   { 20797, LinkProgramARB_remap_index },
+   { 20855, ShaderSourceARB_remap_index },
+   {  7826, Uniform1fARB_remap_index },
+   { 30529, Uniform1fvARB_remap_index },
+   { 22762, Uniform1iARB_remap_index },
+   { 21652, Uniform1ivARB_remap_index },
+   {  2246, Uniform2fARB_remap_index },
+   { 14718, Uniform2fvARB_remap_index },
+   { 27056, Uniform2iARB_remap_index },
+   {  2366, Uniform2ivARB_remap_index },
+   { 19317, Uniform3fARB_remap_index },
+   {  9782, Uniform3fvARB_remap_index },
+   {  6715, Uniform3iARB_remap_index },
+   { 17386, Uniform3ivARB_remap_index },
+   { 19851, Uniform4fARB_remap_index },
+   { 24411, Uniform4fvARB_remap_index },
+   { 25673, Uniform4iARB_remap_index },
+   { 21165, Uniform4ivARB_remap_index },
+   {  8606, UniformMatrix2fvARB_remap_index },
    {    17, UniformMatrix3fvARB_remap_index },
-   {  2690, UniformMatrix4fvARB_remap_index },
-   { 25694, UseProgramObjectARB_remap_index },
-   { 14987, ValidateProgramARB_remap_index },
-   { 21623, BindAttribLocationARB_remap_index },
-   {  4990, GetActiveAttribARB_remap_index },
-   { 16726, GetAttribLocationARB_remap_index },
-   { 29790, DrawBuffersARB_remap_index },
-   { 29623, ClampColorARB_remap_index },
-   { 18124, DrawArraysInstancedARB_remap_index },
-   {  6542, DrawElementsInstancedARB_remap_index },
-   { 13258, RenderbufferStorageMultisample_remap_index },
-   { 13729, FramebufferTextureARB_remap_index },
-   { 26130, FramebufferTextureFaceARB_remap_index },
-   { 24456, ProgramParameteriARB_remap_index },
-   { 23772, VertexAttribDivisorARB_remap_index },
-   { 19516, FlushMappedBufferRange_remap_index },
-   { 28176, MapBufferRange_remap_index },
-   { 28083, TexBufferARB_remap_index },
-   { 16544, BindVertexArray_remap_index },
-   { 14810, GenVertexArrays_remap_index },
-   { 30586, CopyBufferSubData_remap_index },
-   { 31521, ClientWaitSync_remap_index },
-   {  2609, DeleteSync_remap_index },
-   {  7259, FenceSync_remap_index },
-   { 15358, GetInteger64v_remap_index },
-   { 22913, GetSynciv_remap_index },
-   { 29729, IsSync_remap_index },
-   {  9432, WaitSync_remap_index },
-   {  3797, DrawElementsBaseVertex_remap_index },
-   { 30898, DrawRangeElementsBaseVertex_remap_index },
-   { 26743, MultiDrawElementsBaseVertex_remap_index },
-   { 16792, BlendEquationSeparateiARB_remap_index },
-   { 17968, BlendEquationiARB_remap_index },
-   { 12697, BlendFuncSeparateiARB_remap_index },
-   {  9857, BlendFunciARB_remap_index },
-   {  8200, BindSampler_remap_index },
-   {  4122, DeleteSamplers_remap_index },
-   { 19889, GenSamplers_remap_index },
-   { 29661, GetSamplerParameterIiv_remap_index },
-   { 19410, GetSamplerParameterIuiv_remap_index },
-   {  4839, GetSamplerParameterfv_remap_index },
-   { 25851, GetSamplerParameteriv_remap_index },
-   { 14355, IsSampler_remap_index },
-   { 16497, SamplerParameterIiv_remap_index },
-   { 30937, SamplerParameterIuiv_remap_index },
-   { 22612, SamplerParameterf_remap_index },
-   { 16653, SamplerParameterfv_remap_index },
-   { 22587, SamplerParameteri_remap_index },
-   { 18318, SamplerParameteriv_remap_index },
-   {  5141, BindTransformFeedback_remap_index },
-   {  3232, DeleteTransformFeedbacks_remap_index },
-   {  6514, DrawTransformFeedback_remap_index },
-   {  9651, GenTransformFeedbacks_remap_index },
-   { 28592, IsTransformFeedback_remap_index },
-   { 26323, PauseTransformFeedback_remap_index },
-   {  5578, ResumeTransformFeedback_remap_index },
-   { 21943, ClearDepthf_remap_index },
-   {  6818, DepthRangef_remap_index },
-   { 14622, GetShaderPrecisionFormat_remap_index },
-   { 10037, ReleaseShaderCompiler_remap_index },
-   { 10980, ShaderBinary_remap_index },
-   {  5446, PolygonOffsetEXT_remap_index },
-   { 23535, GetPixelTexGenParameterfvSGIS_remap_index },
-   {  4438, GetPixelTexGenParameterivSGIS_remap_index },
-   { 23268, PixelTexGenParameterfSGIS_remap_index },
+   {  2763, UniformMatrix4fvARB_remap_index },
+   { 26151, UseProgramObjectARB_remap_index },
+   { 15268, ValidateProgramARB_remap_index },
+   { 22041, BindAttribLocationARB_remap_index },
+   {  5124, GetActiveAttribARB_remap_index },
+   { 17034, GetAttribLocationARB_remap_index },
+   { 30247, DrawBuffersARB_remap_index },
+   { 30080, ClampColorARB_remap_index },
+   { 18456, DrawArraysInstancedARB_remap_index },
+   {  6776, DrawElementsInstancedARB_remap_index },
+   { 13539, RenderbufferStorageMultisample_remap_index },
+   { 14010, FramebufferTextureARB_remap_index },
+   { 26587, FramebufferTextureFaceARB_remap_index },
+   { 24913, ProgramParameteriARB_remap_index },
+   {  6296, VertexAttribDivisorARB_remap_index },
+   { 19899, FlushMappedBufferRange_remap_index },
+   { 28633, MapBufferRange_remap_index },
+   { 28540, TexBufferARB_remap_index },
+   { 16852, BindVertexArray_remap_index },
+   { 15091, GenVertexArrays_remap_index },
+   { 31043, CopyBufferSubData_remap_index },
+   { 31978, ClientWaitSync_remap_index },
+   {  2682, DeleteSync_remap_index },
+   {  7493, FenceSync_remap_index },
+   { 15639, GetInteger64v_remap_index },
+   { 23378, GetSynciv_remap_index },
+   { 30186, IsSync_remap_index },
+   {  9700, WaitSync_remap_index },
+   {  3873, DrawElementsBaseVertex_remap_index },
+   { 31355, DrawRangeElementsBaseVertex_remap_index },
+   { 27200, MultiDrawElementsBaseVertex_remap_index },
+   { 17100, BlendEquationSeparateiARB_remap_index },
+   { 18300, BlendEquationiARB_remap_index },
+   { 12978, BlendFuncSeparateiARB_remap_index },
+   { 10125, BlendFunciARB_remap_index },
+   {  8468, BindSampler_remap_index },
+   {  4232, DeleteSamplers_remap_index },
+   { 20272, GenSamplers_remap_index },
+   { 30118, GetSamplerParameterIiv_remap_index },
+   { 19793, GetSamplerParameterIuiv_remap_index },
+   {  4973, GetSamplerParameterfv_remap_index },
+   { 26308, GetSamplerParameteriv_remap_index },
+   { 14636, IsSampler_remap_index },
+   { 16805, SamplerParameterIiv_remap_index },
+   { 31394, SamplerParameterIuiv_remap_index },
+   { 23051, SamplerParameterf_remap_index },
+   { 16961, SamplerParameterfv_remap_index },
+   { 23026, SamplerParameteri_remap_index },
+   { 18650, SamplerParameteriv_remap_index },
+   {  5320, BindTransformFeedback_remap_index },
+   {  3308, DeleteTransformFeedbacks_remap_index },
+   {  6748, DrawTransformFeedback_remap_index },
+   {  9919, GenTransformFeedbacks_remap_index },
+   { 29049, IsTransformFeedback_remap_index },
+   { 26780, PauseTransformFeedback_remap_index },
+   {  5783, ResumeTransformFeedback_remap_index },
+   { 22361, ClearDepthf_remap_index },
+   {  7052, DepthRangef_remap_index },
+   { 14903, GetShaderPrecisionFormat_remap_index },
+   { 10291, ReleaseShaderCompiler_remap_index },
+   { 11261, ShaderBinary_remap_index },
+   {   965, GetGraphicsResetStatusARB_remap_index },
+   { 25478, GetnColorTableARB_remap_index },
+   {  8237, GetnCompressedTexImageARB_remap_index },
+   {  3965, GetnConvolutionFilterARB_remap_index },
+   { 16192, GetnHistogramARB_remap_index },
+   { 24237, GetnMapdvARB_remap_index },
+   { 22793, GetnMapfvARB_remap_index },
+   {  2225, GetnMapivARB_remap_index },
+   { 17648, GetnMinmaxARB_remap_index },
+   {  4598, GetnPixelMapfvARB_remap_index },
+   { 19670, GetnPixelMapuivARB_remap_index },
+   {  3033, GetnPixelMapusvARB_remap_index },
+   {  1344, GetnPolygonStippleARB_remap_index },
+   { 21826, GetnSeparableFilterARB_remap_index },
+   { 33470, GetnTexImageARB_remap_index },
+   { 19079, GetnUniformdvARB_remap_index },
+   {  4670, GetnUniformfvARB_remap_index },
+   { 10146, GetnUniformivARB_remap_index },
+   { 23227, GetnUniformuivARB_remap_index },
+   {  2947, ReadnPixelsARB_remap_index },
+   {  5651, PolygonOffsetEXT_remap_index },
+   { 24000, GetPixelTexGenParameterfvSGIS_remap_index },
+   {  4548, GetPixelTexGenParameterivSGIS_remap_index },
+   { 23733, PixelTexGenParameterfSGIS_remap_index },
    {   624, PixelTexGenParameterfvSGIS_remap_index },
-   { 12766, PixelTexGenParameteriSGIS_remap_index },
-   { 13903, PixelTexGenParameterivSGIS_remap_index },
-   { 18443, SampleMaskSGIS_remap_index },
-   { 20216, SamplePatternSGIS_remap_index },
-   { 26672, ColorPointerEXT_remap_index },
-   { 17762, EdgeFlagPointerEXT_remap_index },
-   {  6135, IndexPointerEXT_remap_index },
-   {  6215, NormalPointerEXT_remap_index },
-   { 15952, TexCoordPointerEXT_remap_index },
-   {  7048, VertexPointerEXT_remap_index },
-   {  3599, PointParameterfEXT_remap_index },
-   {  7899, PointParameterfvEXT_remap_index },
-   { 32397, LockArraysEXT_remap_index },
-   { 15051, UnlockArraysEXT_remap_index },
-   {  1267, SecondaryColor3bEXT_remap_index },
-   {  8058, SecondaryColor3bvEXT_remap_index },
-   { 10490, SecondaryColor3dEXT_remap_index },
-   { 25900, SecondaryColor3dvEXT_remap_index },
-   { 28458, SecondaryColor3fEXT_remap_index },
-   { 18480, SecondaryColor3fvEXT_remap_index },
+   { 13047, PixelTexGenParameteriSGIS_remap_index },
+   { 14184, PixelTexGenParameterivSGIS_remap_index },
+   { 18775, SampleMaskSGIS_remap_index },
+   { 20599, SamplePatternSGIS_remap_index },
+   { 27129, ColorPointerEXT_remap_index },
+   { 18094, EdgeFlagPointerEXT_remap_index },
+   {  6369, IndexPointerEXT_remap_index },
+   {  6449, NormalPointerEXT_remap_index },
+   { 16260, TexCoordPointerEXT_remap_index },
+   {  7282, VertexPointerEXT_remap_index },
+   {  3675, PointParameterfEXT_remap_index },
+   {  8133, PointParameterfvEXT_remap_index },
+   { 32854, LockArraysEXT_remap_index },
+   { 15332, UnlockArraysEXT_remap_index },
+   {  1252, SecondaryColor3bEXT_remap_index },
+   {  8326, SecondaryColor3bvEXT_remap_index },
+   { 10771, SecondaryColor3dEXT_remap_index },
+   { 26357, SecondaryColor3dvEXT_remap_index },
+   { 28915, SecondaryColor3fEXT_remap_index },
+   { 18812, SecondaryColor3fvEXT_remap_index },
    {   470, SecondaryColor3iEXT_remap_index },
-   { 16262, SecondaryColor3ivEXT_remap_index },
-   { 10125, SecondaryColor3sEXT_remap_index },
-   { 31185, SecondaryColor3svEXT_remap_index },
-   { 27575, SecondaryColor3ubEXT_remap_index },
-   { 21514, SecondaryColor3ubvEXT_remap_index },
-   { 13008, SecondaryColor3uiEXT_remap_index },
-   { 23155, SecondaryColor3uivEXT_remap_index },
-   { 26180, SecondaryColor3usEXT_remap_index },
-   { 13081, SecondaryColor3usvEXT_remap_index },
-   { 11849, SecondaryColorPointerEXT_remap_index },
-   { 25994, MultiDrawArraysEXT_remap_index },
-   { 21204, MultiDrawElementsEXT_remap_index },
-   { 21399, FogCoordPointerEXT_remap_index },
-   {  4587, FogCoorddEXT_remap_index },
-   { 31798, FogCoorddvEXT_remap_index },
-   {  4704, FogCoordfEXT_remap_index },
-   { 27498, FogCoordfvEXT_remap_index },
-   { 11949, PixelTexGenSGIX_remap_index },
-   { 28103, BlendFuncSeparateEXT_remap_index },
-   {  6960, FlushVertexArrayRangeNV_remap_index },
-   {  5395, VertexArrayRangeNV_remap_index },
-   { 28523, CombinerInputNV_remap_index },
-   {  2116, CombinerOutputNV_remap_index },
-   { 31338, CombinerParameterfNV_remap_index },
-   {  5269, CombinerParameterfvNV_remap_index },
-   { 22637, CombinerParameteriNV_remap_index },
-   { 32813, CombinerParameterivNV_remap_index },
-   {  7336, FinalCombinerInputNV_remap_index },
-   {  9878, GetCombinerInputParameterfvNV_remap_index },
-   { 32650, GetCombinerInputParameterivNV_remap_index },
-   { 14004, GetCombinerOutputParameterfvNV_remap_index },
-   { 13832, GetCombinerOutputParameterivNV_remap_index },
-   {  6722, GetFinalCombinerInputParameterfvNV_remap_index },
-   { 25088, GetFinalCombinerInputParameterivNV_remap_index },
-   { 12675, ResizeBuffersMESA_remap_index },
-   { 11175, WindowPos2dMESA_remap_index },
-   {  1060, WindowPos2dvMESA_remap_index },
-   { 33641, WindowPos2fMESA_remap_index },
-   {  8003, WindowPos2fvMESA_remap_index },
-   { 18390, WindowPos2iMESA_remap_index },
-   { 20689, WindowPos2ivMESA_remap_index },
-   { 21303, WindowPos2sMESA_remap_index },
-   {  5833, WindowPos2svMESA_remap_index },
-   {  7828, WindowPos3dMESA_remap_index },
-   { 14150, WindowPos3dvMESA_remap_index },
+   { 16570, SecondaryColor3ivEXT_remap_index },
+   { 10379, SecondaryColor3sEXT_remap_index },
+   { 31642, SecondaryColor3svEXT_remap_index },
+   { 28032, SecondaryColor3ubEXT_remap_index },
+   { 21932, SecondaryColor3ubvEXT_remap_index },
+   { 13289, SecondaryColor3uiEXT_remap_index },
+   { 23620, SecondaryColor3uivEXT_remap_index },
+   { 26637, SecondaryColor3usEXT_remap_index },
+   { 13362, SecondaryColor3usvEXT_remap_index },
+   { 12130, SecondaryColorPointerEXT_remap_index },
+   { 26451, MultiDrawArraysEXT_remap_index },
+   { 21587, MultiDrawElementsEXT_remap_index },
+   { 21782, FogCoordPointerEXT_remap_index },
+   {  4721, FogCoorddEXT_remap_index },
+   { 32255, FogCoorddvEXT_remap_index },
+   {  4838, FogCoordfEXT_remap_index },
+   { 27955, FogCoordfvEXT_remap_index },
+   { 12230, PixelTexGenSGIX_remap_index },
+   { 28560, BlendFuncSeparateEXT_remap_index },
+   {  7194, FlushVertexArrayRangeNV_remap_index },
+   {  5600, VertexArrayRangeNV_remap_index },
+   { 28980, CombinerInputNV_remap_index },
+   {  2168, CombinerOutputNV_remap_index },
+   { 31795, CombinerParameterfNV_remap_index },
+   {  5474, CombinerParameterfvNV_remap_index },
+   { 23076, CombinerParameteriNV_remap_index },
+   { 33270, CombinerParameterivNV_remap_index },
+   {  7570, FinalCombinerInputNV_remap_index },
+   {  1609, GetCombinerInputParameterfvNV_remap_index },
+   { 33107, GetCombinerInputParameterivNV_remap_index },
+   { 14285, GetCombinerOutputParameterfvNV_remap_index },
+   { 14113, GetCombinerOutputParameterivNV_remap_index },
+   {  6956, GetFinalCombinerInputParameterfvNV_remap_index },
+   { 25545, GetFinalCombinerInputParameterivNV_remap_index },
+   { 12956, ResizeBuffersMESA_remap_index },
+   { 11456, WindowPos2dMESA_remap_index },
+   {  1045, WindowPos2dvMESA_remap_index },
+   { 34174, WindowPos2fMESA_remap_index },
+   {  8271, WindowPos2fvMESA_remap_index },
+   { 18722, WindowPos2iMESA_remap_index },
+   { 21072, WindowPos2ivMESA_remap_index },
+   { 21686, WindowPos2sMESA_remap_index },
+   {  6038, WindowPos2svMESA_remap_index },
+   {  8062, WindowPos3dMESA_remap_index },
+   { 14431, WindowPos3dvMESA_remap_index },
    {   516, WindowPos3fMESA_remap_index },
-   { 15112, WindowPos3fvMESA_remap_index },
-   { 24349, WindowPos3iMESA_remap_index },
-   { 30531, WindowPos3ivMESA_remap_index },
-   { 19105, WindowPos3sMESA_remap_index },
-   { 32054, WindowPos3svMESA_remap_index },
-   { 11126, WindowPos4dMESA_remap_index },
-   { 17216, WindowPos4dvMESA_remap_index },
-   { 14109, WindowPos4fMESA_remap_index },
-   { 31092, WindowPos4fvMESA_remap_index },
-   { 30684, WindowPos4iMESA_remap_index },
-   { 12478, WindowPos4ivMESA_remap_index },
-   { 19289, WindowPos4sMESA_remap_index },
-   {  3183, WindowPos4svMESA_remap_index },
-   { 13871, MultiModeDrawArraysIBM_remap_index },
-   { 29298, MultiModeDrawElementsIBM_remap_index },
-   { 12253, DeleteFencesNV_remap_index },
-   { 28370, FinishFenceNV_remap_index },
-   {  3721, GenFencesNV_remap_index },
-   { 17196, GetFenceivNV_remap_index },
-   {  8271, IsFenceNV_remap_index },
-   { 13759, SetFenceNV_remap_index },
-   {  4199, TestFenceNV_remap_index },
-   { 32025, AreProgramsResidentNV_remap_index },
-   { 31380, BindProgramNV_remap_index },
-   { 26263, DeleteProgramsNV_remap_index },
-   { 21732, ExecuteProgramNV_remap_index },
-   { 33534, GenProgramsNV_remap_index },
-   { 23640, GetProgramParameterdvNV_remap_index },
-   { 10552, GetProgramParameterfvNV_remap_index },
-   { 26646, GetProgramStringNV_remap_index },
-   { 24726, GetProgramivNV_remap_index },
-   { 23903, GetTrackMatrixivNV_remap_index },
-   { 26440, GetVertexAttribPointervNV_remap_index },
-   { 25021, GetVertexAttribdvNV_remap_index },
-   {  9327, GetVertexAttribfvNV_remap_index },
-   { 18693, GetVertexAttribivNV_remap_index },
-   { 19546, IsProgramNV_remap_index },
-   {  9410, LoadProgramNV_remap_index },
-   { 28199, ProgramParameters4dvNV_remap_index },
-   { 24656, ProgramParameters4fvNV_remap_index },
-   { 20993, RequestResidentProgramsNV_remap_index },
-   { 30876, TrackMatrixNV_remap_index },
-   { 32627, VertexAttrib1dNV_remap_index },
-   { 13670, VertexAttrib1dvNV_remap_index },
-   { 28804, VertexAttrib1fNV_remap_index },
-   {  2415, VertexAttrib1fvNV_remap_index },
-   { 31149, VertexAttrib1sNV_remap_index },
-   { 15185, VertexAttrib1svNV_remap_index },
-   {  4895, VertexAttrib2dNV_remap_index },
-   { 13563, VertexAttrib2dvNV_remap_index },
-   { 20448, VertexAttrib2fNV_remap_index },
-   { 13129, VertexAttrib2fvNV_remap_index },
-   {  6045, VertexAttrib2sNV_remap_index },
-   { 19159, VertexAttrib2svNV_remap_index },
-   { 11323, VertexAttrib3dNV_remap_index },
-   { 32275, VertexAttrib3dvNV_remap_index },
-   { 10364, VertexAttrib3fNV_remap_index },
-   { 25048, VertexAttrib3fvNV_remap_index },
-   { 22430, VertexAttrib3sNV_remap_index },
-   { 23930, VertexAttrib3svNV_remap_index },
-   { 29272, VertexAttrib4dNV_remap_index },
-   { 33571, VertexAttrib4dvNV_remap_index },
-   {  4488, VertexAttrib4fNV_remap_index },
-   {  9460, VertexAttrib4fvNV_remap_index },
-   { 27122, VertexAttrib4sNV_remap_index },
-   {  1409, VertexAttrib4svNV_remap_index },
-   {  5053, VertexAttrib4ubNV_remap_index },
+   { 15393, WindowPos3fvMESA_remap_index },
+   { 24806, WindowPos3iMESA_remap_index },
+   { 30988, WindowPos3ivMESA_remap_index },
+   { 19462, WindowPos3sMESA_remap_index },
+   { 32511, WindowPos3svMESA_remap_index },
+   { 11407, WindowPos4dMESA_remap_index },
+   { 17524, WindowPos4dvMESA_remap_index },
+   { 14390, WindowPos4fMESA_remap_index },
+   { 31549, WindowPos4fvMESA_remap_index },
+   { 31141, WindowPos4iMESA_remap_index },
+   { 12759, WindowPos4ivMESA_remap_index },
+   { 19646, WindowPos4sMESA_remap_index },
+   {  3259, WindowPos4svMESA_remap_index },
+   { 14152, MultiModeDrawArraysIBM_remap_index },
+   { 29755, MultiModeDrawElementsIBM_remap_index },
+   { 12534, DeleteFencesNV_remap_index },
+   { 28827, FinishFenceNV_remap_index },
+   {  3797, GenFencesNV_remap_index },
+   { 17504, GetFenceivNV_remap_index },
+   {  8539, IsFenceNV_remap_index },
+   { 14040, SetFenceNV_remap_index },
+   {  4309, TestFenceNV_remap_index },
+   { 32482, AreProgramsResidentNV_remap_index },
+   { 31837, BindProgramNV_remap_index },
+   { 26720, DeleteProgramsNV_remap_index },
+   { 22150, ExecuteProgramNV_remap_index },
+   { 34067, GenProgramsNV_remap_index },
+   { 24105, GetProgramParameterdvNV_remap_index },
+   { 10833, GetProgramParameterfvNV_remap_index },
+   { 27103, GetProgramStringNV_remap_index },
+   { 25183, GetProgramivNV_remap_index },
+   { 24360, GetTrackMatrixivNV_remap_index },
+   { 26897, GetVertexAttribPointervNV_remap_index },
+   { 10474, GetVertexAttribdvNV_remap_index },
+   {  9595, GetVertexAttribfvNV_remap_index },
+   { 19025, GetVertexAttribivNV_remap_index },
+   { 19929, IsProgramNV_remap_index },
+   {  9678, LoadProgramNV_remap_index },
+   { 28656, ProgramParameters4dvNV_remap_index },
+   { 25113, ProgramParameters4fvNV_remap_index },
+   { 21376, RequestResidentProgramsNV_remap_index },
+   { 31333, TrackMatrixNV_remap_index },
+   { 33084, VertexAttrib1dNV_remap_index },
+   { 13951, VertexAttrib1dvNV_remap_index },
+   { 29261, VertexAttrib1fNV_remap_index },
+   {  2488, VertexAttrib1fvNV_remap_index },
+   { 31606, VertexAttrib1sNV_remap_index },
+   { 15466, VertexAttrib1svNV_remap_index },
+   {  5029, VertexAttrib2dNV_remap_index },
+   { 13844, VertexAttrib2dvNV_remap_index },
+   { 20831, VertexAttrib2fNV_remap_index },
+   { 13410, VertexAttrib2fvNV_remap_index },
+   {  6250, VertexAttrib2sNV_remap_index },
+   { 19516, VertexAttrib2svNV_remap_index },
+   { 11604, VertexAttrib3dNV_remap_index },
+   { 32732, VertexAttrib3dvNV_remap_index },
+   { 10645, VertexAttrib3fNV_remap_index },
+   { 25505, VertexAttrib3fvNV_remap_index },
+   { 22869, VertexAttrib3sNV_remap_index },
+   { 24387, VertexAttrib3svNV_remap_index },
+   { 29729, VertexAttrib4dNV_remap_index },
+   { 34104, VertexAttrib4dvNV_remap_index },
+   {  5414, VertexAttrib4fNV_remap_index },
+   {  9728, VertexAttrib4fvNV_remap_index },
+   { 27579, VertexAttrib4sNV_remap_index },
+   {  1422, VertexAttrib4svNV_remap_index },
+   {  5187, VertexAttrib4ubNV_remap_index },
    {   778, VertexAttrib4ubvNV_remap_index },
-   { 21912, VertexAttribPointerNV_remap_index },
-   {  2267, VertexAttribs1dvNV_remap_index },
-   { 26528, VertexAttribs1fvNV_remap_index },
-   { 33371, VertexAttribs1svNV_remap_index },
-   { 10389, VertexAttribs2dvNV_remap_index },
-   { 25655, VertexAttribs2fvNV_remap_index },
-   { 17788, VertexAttribs2svNV_remap_index },
-   {  5297, VertexAttribs3dvNV_remap_index },
-   {  2147, VertexAttribs3fvNV_remap_index },
-   { 30279, VertexAttribs3svNV_remap_index },
-   { 27212, VertexAttribs4dvNV_remap_index },
-   {  5369, VertexAttribs4fvNV_remap_index },
-   { 33158, VertexAttribs4svNV_remap_index },
-   { 30027, VertexAttribs4ubvNV_remap_index },
-   { 27282, GetTexBumpParameterfvATI_remap_index },
-   { 33412, GetTexBumpParameterivATI_remap_index },
-   { 18803, TexBumpParameterfvATI_remap_index },
-   { 20864, TexBumpParameterivATI_remap_index },
-   { 15731, AlphaFragmentOp1ATI_remap_index },
-   { 25946, AlphaFragmentOp2ATI_remap_index },
-   { 24964, AlphaFragmentOp3ATI_remap_index },
-   { 30206, BeginFragmentShaderATI_remap_index },
-   { 31579, BindFragmentShaderATI_remap_index },
-   { 24059, ColorFragmentOp1ATI_remap_index },
-   {  4366, ColorFragmentOp2ATI_remap_index },
-   { 31920, ColorFragmentOp3ATI_remap_index },
-   {  5535, DeleteFragmentShaderATI_remap_index },
-   { 33595, EndFragmentShaderATI_remap_index },
-   { 32841, GenFragmentShadersATI_remap_index },
-   { 25809, PassTexCoordATI_remap_index },
-   {  7028, SampleMapATI_remap_index },
-   { 27393, SetFragmentShaderConstantATI_remap_index },
+   { 22330, VertexAttribPointerNV_remap_index },
+   {  2340, VertexAttribs1dvNV_remap_index },
+   { 26985, VertexAttribs1fvNV_remap_index },
+   { 33904, VertexAttribs1svNV_remap_index },
+   { 10670, VertexAttribs2dvNV_remap_index },
+   { 26112, VertexAttribs2fvNV_remap_index },
+   { 18120, VertexAttribs2svNV_remap_index },
+   {  5502, VertexAttribs3dvNV_remap_index },
+   {  2199, VertexAttribs3fvNV_remap_index },
+   { 30736, VertexAttribs3svNV_remap_index },
+   { 27669, VertexAttribs4dvNV_remap_index },
+   {  5574, VertexAttribs4fvNV_remap_index },
+   { 33691, VertexAttribs4svNV_remap_index },
+   { 30484, VertexAttribs4ubvNV_remap_index },
+   { 27739, GetTexBumpParameterfvATI_remap_index },
+   { 33945, GetTexBumpParameterivATI_remap_index },
+   { 19160, TexBumpParameterfvATI_remap_index },
+   { 21247, TexBumpParameterivATI_remap_index },
+   { 16012, AlphaFragmentOp1ATI_remap_index },
+   { 26403, AlphaFragmentOp2ATI_remap_index },
+   { 25421, AlphaFragmentOp3ATI_remap_index },
+   { 30663, BeginFragmentShaderATI_remap_index },
+   { 32036, BindFragmentShaderATI_remap_index },
+   { 24516, ColorFragmentOp1ATI_remap_index },
+   {  4476, ColorFragmentOp2ATI_remap_index },
+   { 32377, ColorFragmentOp3ATI_remap_index },
+   {  5740, DeleteFragmentShaderATI_remap_index },
+   { 34128, EndFragmentShaderATI_remap_index },
+   { 33298, GenFragmentShadersATI_remap_index },
+   { 26266, PassTexCoordATI_remap_index },
+   {  7262, SampleMapATI_remap_index },
+   { 27850, SetFragmentShaderConstantATI_remap_index },
    {   363, PointParameteriNV_remap_index },
-   { 14311, PointParameterivNV_remap_index },
-   { 29111, ActiveStencilFaceEXT_remap_index },
-   { 27839, BindVertexArrayAPPLE_remap_index },
-   {  2737, DeleteVertexArraysAPPLE_remap_index },
-   { 18229, GenVertexArraysAPPLE_remap_index },
-   { 23705, IsVertexArrayAPPLE_remap_index },
+   { 14592, PointParameterivNV_remap_index },
+   { 29568, ActiveStencilFaceEXT_remap_index },
+   { 28296, BindVertexArrayAPPLE_remap_index },
+   {  2810, DeleteVertexArraysAPPLE_remap_index },
+   { 18561, GenVertexArraysAPPLE_remap_index },
+   { 24170, IsVertexArrayAPPLE_remap_index },
    {   819, GetProgramNamedParameterdvNV_remap_index },
-   {  3562, GetProgramNamedParameterfvNV_remap_index },
-   { 27313, ProgramNamedParameter4dNV_remap_index },
-   { 14685, ProgramNamedParameter4dvNV_remap_index },
-   {  8943, ProgramNamedParameter4fNV_remap_index },
-   { 11814, ProgramNamedParameter4fvNV_remap_index },
-   { 17127, PrimitiveRestartIndexNV_remap_index },
-   { 31069, PrimitiveRestartNV_remap_index },
-   { 24635, DepthBoundsEXT_remap_index },
-   {  1159, BlendEquationSeparateEXT_remap_index },
-   { 14886, BindFramebufferEXT_remap_index },
-   { 26039, BindRenderbufferEXT_remap_index },
-   {  9707, CheckFramebufferStatusEXT_remap_index },
-   { 22956, DeleteFramebuffersEXT_remap_index },
-   { 32177, DeleteRenderbuffersEXT_remap_index },
-   { 13587, FramebufferRenderbufferEXT_remap_index },
-   { 13776, FramebufferTexture1DEXT_remap_index },
-   { 11608, FramebufferTexture2DEXT_remap_index },
-   { 11228, FramebufferTexture3DEXT_remap_index },
-   { 23571, GenFramebuffersEXT_remap_index },
-   { 17653, GenRenderbuffersEXT_remap_index },
-   {  6764, GenerateMipmapEXT_remap_index },
-   { 22005, GetFramebufferAttachmentParameterivEXT_remap_index },
-   { 32747, GetRenderbufferParameterivEXT_remap_index },
-   { 20744, IsFramebufferEXT_remap_index },
-   { 33494, IsRenderbufferEXT_remap_index },
-   {  8218, RenderbufferStorageEXT_remap_index },
+   {  3638, GetProgramNamedParameterfvNV_remap_index },
+   { 27770, ProgramNamedParameter4dNV_remap_index },
+   { 14966, ProgramNamedParameter4dvNV_remap_index },
+   {  9211, ProgramNamedParameter4fNV_remap_index },
+   { 12095, ProgramNamedParameter4fvNV_remap_index },
+   { 17435, PrimitiveRestartIndexNV_remap_index },
+   { 31526, PrimitiveRestartNV_remap_index },
+   { 25092, DepthBoundsEXT_remap_index },
+   {  1144, BlendEquationSeparateEXT_remap_index },
+   { 15167, BindFramebufferEXT_remap_index },
+   { 26496, BindRenderbufferEXT_remap_index },
+   {  9975, CheckFramebufferStatusEXT_remap_index },
+   { 23421, DeleteFramebuffersEXT_remap_index },
+   { 32634, DeleteRenderbuffersEXT_remap_index },
+   { 13868, FramebufferRenderbufferEXT_remap_index },
+   { 14057, FramebufferTexture1DEXT_remap_index },
+   { 11889, FramebufferTexture2DEXT_remap_index },
+   { 11509, FramebufferTexture3DEXT_remap_index },
+   { 24036, GenFramebuffersEXT_remap_index },
+   { 17985, GenRenderbuffersEXT_remap_index },
+   {  6998, GenerateMipmapEXT_remap_index },
+   { 22423, GetFramebufferAttachmentParameterivEXT_remap_index },
+   { 33204, GetRenderbufferParameterivEXT_remap_index },
+   { 21127, IsFramebufferEXT_remap_index },
+   { 34027, IsRenderbufferEXT_remap_index },
+   {  8486, RenderbufferStorageEXT_remap_index },
    {   695, BlitFramebufferEXT_remap_index },
-   { 14471, BufferParameteriAPPLE_remap_index },
-   { 19578, FlushMappedBufferRangeAPPLE_remap_index },
-   {  1815, BindFragDataLocationEXT_remap_index },
-   { 24748, GetFragDataLocationEXT_remap_index },
-   { 10667, GetUniformuivEXT_remap_index },
-   {  2933, GetVertexAttribIivEXT_remap_index },
-   {  4216, GetVertexAttribIuivEXT_remap_index },
-   { 12086, Uniform1uiEXT_remap_index },
-   { 28284, Uniform1uivEXT_remap_index },
-   { 22526, Uniform2uiEXT_remap_index },
-   {  4330, Uniform2uivEXT_remap_index },
-   { 29551, Uniform3uiEXT_remap_index },
-   { 14832, Uniform3uivEXT_remap_index },
-   {  3486, Uniform4uiEXT_remap_index },
-   {  8719, Uniform4uivEXT_remap_index },
-   { 18608, VertexAttribI1iEXT_remap_index },
-   {   965, VertexAttribI1ivEXT_remap_index },
-   {  2516, VertexAttribI1uiEXT_remap_index },
-   { 12857, VertexAttribI1uivEXT_remap_index },
+   { 14752, BufferParameteriAPPLE_remap_index },
+   { 19961, FlushMappedBufferRangeAPPLE_remap_index },
+   {  1867, BindFragDataLocationEXT_remap_index },
+   { 25205, GetFragDataLocationEXT_remap_index },
+   { 10948, GetUniformuivEXT_remap_index },
+   { 33378, GetVertexAttribIivEXT_remap_index },
+   {  4326, GetVertexAttribIuivEXT_remap_index },
+   { 12367, Uniform1uiEXT_remap_index },
+   { 28741, Uniform1uivEXT_remap_index },
+   { 22965, Uniform2uiEXT_remap_index },
+   {  4440, Uniform2uivEXT_remap_index },
+   { 30008, Uniform3uiEXT_remap_index },
+   { 15113, Uniform3uivEXT_remap_index },
+   {  3562, Uniform4uiEXT_remap_index },
+   {  8987, Uniform4uivEXT_remap_index },
+   { 18940, VertexAttribI1iEXT_remap_index },
+   {  5214, VertexAttribI1ivEXT_remap_index },
+   {  2589, VertexAttribI1uiEXT_remap_index },
+   { 13138, VertexAttribI1uivEXT_remap_index },
    {    81, VertexAttribI2iEXT_remap_index },
-   { 24171, VertexAttribI2ivEXT_remap_index },
-   {  5323, VertexAttribI2uiEXT_remap_index },
-   {  4749, VertexAttribI2uivEXT_remap_index },
-   { 26914, VertexAttribI3iEXT_remap_index },
-   { 25373, VertexAttribI3ivEXT_remap_index },
-   {  3340, VertexAttribI3uiEXT_remap_index },
-   { 30772, VertexAttribI3uivEXT_remap_index },
-   { 22256, VertexAttribI4bvEXT_remap_index },
-   { 14764, VertexAttribI4iEXT_remap_index },
-   { 32446, VertexAttribI4ivEXT_remap_index },
-   { 13490, VertexAttribI4svEXT_remap_index },
-   { 16679, VertexAttribI4ubvEXT_remap_index },
-   { 16325, VertexAttribI4uiEXT_remap_index },
-   {  5469, VertexAttribI4uivEXT_remap_index },
-   { 11391, VertexAttribI4usvEXT_remap_index },
-   { 18747, VertexAttribIPointerEXT_remap_index },
-   {  3027, FramebufferTextureLayerEXT_remap_index },
-   {  5745, ColorMaskIndexedEXT_remap_index },
-   { 19183, DisableIndexedEXT_remap_index },
-   { 26959, EnableIndexedEXT_remap_index },
-   { 21960, GetBooleanIndexedvEXT_remap_index },
-   { 11002, GetIntegerIndexedvEXT_remap_index },
-   { 23032, IsEnabledIndexedEXT_remap_index },
-   { 22932, ClearColorIiEXT_remap_index },
-   {  3436, ClearColorIuiEXT_remap_index },
-   {  9917, GetTexParameterIivEXT_remap_index },
-   {  5993, GetTexParameterIuivEXT_remap_index },
-   {  2983, TexParameterIivEXT_remap_index },
-   { 26781, TexParameterIuivEXT_remap_index },
-   {  4617, BeginConditionalRenderNV_remap_index },
-   { 25759, EndConditionalRenderNV_remap_index },
-   {  9354, BeginTransformFeedbackEXT_remap_index },
-   { 19218, BindBufferBaseEXT_remap_index },
-   { 19077, BindBufferOffsetEXT_remap_index },
-   { 12303, BindBufferRangeEXT_remap_index },
-   { 14386, EndTransformFeedbackEXT_remap_index },
-   { 10865, GetTransformFeedbackVaryingEXT_remap_index },
-   { 21049, TransformFeedbackVaryingsEXT_remap_index },
-   { 29928, ProvokingVertexEXT_remap_index },
-   { 10813, GetTexParameterPointervAPPLE_remap_index },
-   {  5097, TextureRangeAPPLE_remap_index },
-   { 11680, GetObjectParameterivAPPLE_remap_index },
-   { 20171, ObjectPurgeableAPPLE_remap_index },
-   {  5787, ObjectUnpurgeableAPPLE_remap_index },
-   { 17475, ActiveProgramEXT_remap_index },
-   { 17446, CreateShaderProgramEXT_remap_index },
-   { 28896, UseShaderProgramEXT_remap_index },
-   { 16632, TextureBarrierNV_remap_index },
-   { 29137, StencilFuncSeparateATI_remap_index },
-   {  5658, ProgramEnvParameters4fvEXT_remap_index },
-   { 17340, ProgramLocalParameters4fvEXT_remap_index },
-   { 14239, GetQueryObjecti64vEXT_remap_index },
-   { 10415, GetQueryObjectui64vEXT_remap_index },
-   { 24128, EGLImageTargetRenderbufferStorageOES_remap_index },
-   { 12192, EGLImageTargetTexture2DOES_remap_index },
+   { 24628, VertexAttribI2ivEXT_remap_index },
+   {  5528, VertexAttribI2uiEXT_remap_index },
+   {  4883, VertexAttribI2uivEXT_remap_index },
+   { 27371, VertexAttribI3iEXT_remap_index },
+   { 25830, VertexAttribI3ivEXT_remap_index },
+   {  3416, VertexAttribI3uiEXT_remap_index },
+   { 31229, VertexAttribI3uivEXT_remap_index },
+   { 22674, VertexAttribI4bvEXT_remap_index },
+   { 15045, VertexAttribI4iEXT_remap_index },
+   { 32903, VertexAttribI4ivEXT_remap_index },
+   { 13771, VertexAttribI4svEXT_remap_index },
+   { 16987, VertexAttribI4ubvEXT_remap_index },
+   { 16633, VertexAttribI4uiEXT_remap_index },
+   {  5674, VertexAttribI4uivEXT_remap_index },
+   { 11672, VertexAttribI4usvEXT_remap_index },
+   { 19104, VertexAttribIPointerEXT_remap_index },
+   {  3103, FramebufferTextureLayerEXT_remap_index },
+   {  5950, ColorMaskIndexedEXT_remap_index },
+   { 19540, DisableIndexedEXT_remap_index },
+   { 27416, EnableIndexedEXT_remap_index },
+   { 22378, GetBooleanIndexedvEXT_remap_index },
+   { 11283, GetIntegerIndexedvEXT_remap_index },
+   { 23497, IsEnabledIndexedEXT_remap_index },
+   { 23397, ClearColorIiEXT_remap_index },
+   {  3512, ClearColorIuiEXT_remap_index },
+   { 10171, GetTexParameterIivEXT_remap_index },
+   {  6198, GetTexParameterIuivEXT_remap_index },
+   {  3059, TexParameterIivEXT_remap_index },
+   { 27238, TexParameterIuivEXT_remap_index },
+   {  4751, BeginConditionalRenderNV_remap_index },
+   { 26216, EndConditionalRenderNV_remap_index },
+   {  9622, BeginTransformFeedbackEXT_remap_index },
+   { 19575, BindBufferBaseEXT_remap_index },
+   { 19434, BindBufferOffsetEXT_remap_index },
+   { 12584, BindBufferRangeEXT_remap_index },
+   { 14667, EndTransformFeedbackEXT_remap_index },
+   { 11146, GetTransformFeedbackVaryingEXT_remap_index },
+   { 21432, TransformFeedbackVaryingsEXT_remap_index },
+   { 30385, ProvokingVertexEXT_remap_index },
+   { 11094, GetTexParameterPointervAPPLE_remap_index },
+   {  5276, TextureRangeAPPLE_remap_index },
+   { 11961, GetObjectParameterivAPPLE_remap_index },
+   { 20554, ObjectPurgeableAPPLE_remap_index },
+   {  5992, ObjectUnpurgeableAPPLE_remap_index },
+   { 17807, ActiveProgramEXT_remap_index },
+   { 17778, CreateShaderProgramEXT_remap_index },
+   { 29353, UseShaderProgramEXT_remap_index },
+   { 16940, TextureBarrierNV_remap_index },
+   { 29594, StencilFuncSeparateATI_remap_index },
+   {  5863, ProgramEnvParameters4fvEXT_remap_index },
+   { 17672, ProgramLocalParameters4fvEXT_remap_index },
+   { 14520, GetQueryObjecti64vEXT_remap_index },
+   { 10696, GetQueryObjectui64vEXT_remap_index },
+   { 24585, EGLImageTargetRenderbufferStorageOES_remap_index },
+   { 12473, EGLImageTargetTexture2DOES_remap_index },
    {    -1, -1 }
 };
 
 /* these functions are in the ABI, but have alternative names */
 static const struct gl_function_remap MESA_alt_functions[] = {
    /* from GL_EXT_blend_color */
-   {  2655, _gloffset_BlendColor },
+   {  2728, _gloffset_BlendColor },
    /* from GL_EXT_blend_minmax */
-   { 11285, _gloffset_BlendEquation },
+   { 11566, _gloffset_BlendEquation },
    /* from GL_EXT_color_subtable */
-   { 17238, _gloffset_ColorSubTable },
-   { 32109, _gloffset_CopyColorSubTable },
+   { 17546, _gloffset_ColorSubTable },
+   { 32566, _gloffset_CopyColorSubTable },
    /* from GL_EXT_convolution */
    {   257, _gloffset_ConvolutionFilter1D },
-   {  2454, _gloffset_CopyConvolutionFilter1D },
-   {  4058, _gloffset_GetConvolutionParameteriv },
-   {  8567, _gloffset_ConvolutionFilter2D },
-   {  8769, _gloffset_ConvolutionParameteriv },
-   {  9229, _gloffset_ConvolutionParameterfv },
-   { 20892, _gloffset_GetSeparableFilter },
-   { 24403, _gloffset_SeparableFilter2D },
-   { 25266, _gloffset_ConvolutionParameteri },
-   { 25434, _gloffset_ConvolutionParameterf },
-   { 27148, _gloffset_GetConvolutionParameterfv },
-   { 28005, _gloffset_GetConvolutionFilter },
-   { 30468, _gloffset_CopyConvolutionFilter2D },
+   {  2527, _gloffset_CopyConvolutionFilter1D },
+   {  4168, _gloffset_GetConvolutionParameteriv },
+   {  8835, _gloffset_ConvolutionFilter2D },
+   {  9037, _gloffset_ConvolutionParameteriv },
+   {  9497, _gloffset_ConvolutionParameterfv },
+   { 21275, _gloffset_GetSeparableFilter },
+   { 24860, _gloffset_SeparableFilter2D },
+   { 25723, _gloffset_ConvolutionParameteri },
+   { 25891, _gloffset_ConvolutionParameterf },
+   { 27605, _gloffset_GetConvolutionParameterfv },
+   { 28462, _gloffset_GetConvolutionFilter },
+   { 30925, _gloffset_CopyConvolutionFilter2D },
    /* from GL_EXT_copy_texture */
-   { 15245, _gloffset_CopyTexSubImage3D },
-   { 16925, _gloffset_CopyTexImage2D },
-   { 24874, _gloffset_CopyTexImage1D },
-   { 27686, _gloffset_CopyTexSubImage2D },
-   { 30106, _gloffset_CopyTexSubImage1D },
+   { 15526, _gloffset_CopyTexSubImage3D },
+   { 17233, _gloffset_CopyTexImage2D },
+   { 25331, _gloffset_CopyTexImage1D },
+   { 28143, _gloffset_CopyTexSubImage2D },
+   { 30563, _gloffset_CopyTexSubImage1D },
    /* from GL_EXT_draw_range_elements */
-   {  9566, _gloffset_DrawRangeElements },
+   {  9834, _gloffset_DrawRangeElements },
    /* from GL_EXT_histogram */
    {   856, _gloffset_Histogram },
-   {  3522, _gloffset_ResetHistogram },
-   { 10063, _gloffset_GetMinmax },
-   { 15579, _gloffset_GetHistogramParameterfv },
-   { 24799, _gloffset_GetMinmaxParameteriv },
-   { 27038, _gloffset_ResetMinmax },
-   { 27902, _gloffset_GetHistogramParameteriv },
-   { 29071, _gloffset_GetHistogram },
-   { 31695, _gloffset_Minmax },
-   { 33241, _gloffset_GetMinmaxParameterfv },
+   {  3598, _gloffset_ResetHistogram },
+   { 10317, _gloffset_GetMinmax },
+   { 15860, _gloffset_GetHistogramParameterfv },
+   { 25256, _gloffset_GetMinmaxParameteriv },
+   { 27495, _gloffset_ResetMinmax },
+   { 28359, _gloffset_GetHistogramParameteriv },
+   { 29528, _gloffset_GetHistogram },
+   { 32152, _gloffset_Minmax },
+   { 33774, _gloffset_GetMinmaxParameterfv },
    /* from GL_EXT_paletted_texture */
-   {  8429, _gloffset_ColorTable },
-   { 15425, _gloffset_GetColorTable },
-   { 23318, _gloffset_GetColorTableParameterfv },
-   { 25490, _gloffset_GetColorTableParameteriv },
+   {  8697, _gloffset_ColorTable },
+   { 15706, _gloffset_GetColorTable },
+   { 23783, _gloffset_GetColorTableParameterfv },
+   { 25947, _gloffset_GetColorTableParameteriv },
    /* from GL_EXT_subtexture */
-   {  7174, _gloffset_TexSubImage1D },
-   { 10740, _gloffset_TexSubImage2D },
+   {  7408, _gloffset_TexSubImage1D },
+   { 11021, _gloffset_TexSubImage2D },
    /* from GL_EXT_texture3D */
-   {  1774, _gloffset_TexImage3D },
-   { 23087, _gloffset_TexSubImage3D },
+   {  1826, _gloffset_TexImage3D },
+   { 23552, _gloffset_TexSubImage3D },
    /* from GL_EXT_texture_object */
-   {  3290, _gloffset_PrioritizeTextures },
-   {  7623, _gloffset_AreTexturesResident },
-   { 13694, _gloffset_GenTextures },
-   { 15911, _gloffset_DeleteTextures },
-   { 19859, _gloffset_IsTexture },
-   { 30171, _gloffset_BindTexture },
+   {  3366, _gloffset_PrioritizeTextures },
+   {  7857, _gloffset_AreTexturesResident },
+   { 13975, _gloffset_GenTextures },
+   { 16219, _gloffset_DeleteTextures },
+   { 20242, _gloffset_IsTexture },
+   { 30628, _gloffset_BindTexture },
    /* from GL_EXT_vertex_array */
-   { 24575, _gloffset_ArrayElement },
-   { 31283, _gloffset_GetPointerv },
-   { 32868, _gloffset_DrawArrays },
+   { 25032, _gloffset_ArrayElement },
+   { 31740, _gloffset_GetPointerv },
+   { 33325, _gloffset_DrawArrays },
    /* from GL_SGI_color_table */
-   {  7741, _gloffset_ColorTableParameteriv },
-   {  8429, _gloffset_ColorTable },
-   { 15425, _gloffset_GetColorTable },
-   { 15535, _gloffset_CopyColorTable },
-   { 19720, _gloffset_ColorTableParameterfv },
-   { 23318, _gloffset_GetColorTableParameterfv },
-   { 25490, _gloffset_GetColorTableParameteriv },
+   {  7975, _gloffset_ColorTableParameteriv },
+   {  8697, _gloffset_ColorTable },
+   { 15706, _gloffset_GetColorTable },
+   { 15816, _gloffset_CopyColorTable },
+   { 20103, _gloffset_ColorTableParameterfv },
+   { 23783, _gloffset_GetColorTableParameterfv },
+   { 25947, _gloffset_GetColorTableParameteriv },
    /* from GL_VERSION_1_3 */
    {   425, _gloffset_MultiTexCoord3sARB },
    {   657, _gloffset_ActiveTextureARB },
-   {  4268, _gloffset_MultiTexCoord1fvARB },
-   {  6240, _gloffset_MultiTexCoord3dARB },
-   {  6285, _gloffset_MultiTexCoord2iARB },
-   {  6409, _gloffset_MultiTexCoord2svARB },
-   {  8385, _gloffset_MultiTexCoord2fARB },
-   { 10445, _gloffset_MultiTexCoord3fvARB },
-   { 11047, _gloffset_MultiTexCoord4sARB },
-   { 11728, _gloffset_MultiTexCoord2dvARB },
-   { 12135, _gloffset_MultiTexCoord1svARB },
-   { 12536, _gloffset_MultiTexCoord3svARB },
-   { 12597, _gloffset_MultiTexCoord4iARB },
-   { 13398, _gloffset_MultiTexCoord3iARB },
-   { 14268, _gloffset_MultiTexCoord1dARB },
-   { 14500, _gloffset_MultiTexCoord3dvARB },
-   { 15779, _gloffset_MultiTexCoord3ivARB },
-   { 15824, _gloffset_MultiTexCoord2sARB },
-   { 17295, _gloffset_MultiTexCoord4ivARB },
-   { 19360, _gloffset_ClientActiveTextureARB },
-   { 21688, _gloffset_MultiTexCoord2dARB },
-   { 22125, _gloffset_MultiTexCoord4dvARB },
-   { 22481, _gloffset_MultiTexCoord4fvARB },
-   { 23459, _gloffset_MultiTexCoord3fARB },
-   { 26084, _gloffset_MultiTexCoord4dARB },
-   { 26350, _gloffset_MultiTexCoord1sARB },
-   { 26554, _gloffset_MultiTexCoord1dvARB },
-   { 27530, _gloffset_MultiTexCoord1ivARB },
-   { 27623, _gloffset_MultiTexCoord2ivARB },
-   { 27962, _gloffset_MultiTexCoord1iARB },
-   { 29346, _gloffset_MultiTexCoord4svARB },
-   { 29970, _gloffset_MultiTexCoord1fARB },
-   { 30233, _gloffset_MultiTexCoord4fARB },
-   { 32702, _gloffset_MultiTexCoord2fvARB },
+   {  4378, _gloffset_MultiTexCoord1fvARB },
+   {  6474, _gloffset_MultiTexCoord3dARB },
+   {  6519, _gloffset_MultiTexCoord2iARB },
+   {  6643, _gloffset_MultiTexCoord2svARB },
+   {  8653, _gloffset_MultiTexCoord2fARB },
+   { 10726, _gloffset_MultiTexCoord3fvARB },
+   { 11328, _gloffset_MultiTexCoord4sARB },
+   { 12009, _gloffset_MultiTexCoord2dvARB },
+   { 12416, _gloffset_MultiTexCoord1svARB },
+   { 12817, _gloffset_MultiTexCoord3svARB },
+   { 12878, _gloffset_MultiTexCoord4iARB },
+   { 13679, _gloffset_MultiTexCoord3iARB },
+   { 14549, _gloffset_MultiTexCoord1dARB },
+   { 14781, _gloffset_MultiTexCoord3dvARB },
+   { 16060, _gloffset_MultiTexCoord3ivARB },
+   { 16105, _gloffset_MultiTexCoord2sARB },
+   { 17603, _gloffset_MultiTexCoord4ivARB },
+   { 19743, _gloffset_ClientActiveTextureARB },
+   { 22106, _gloffset_MultiTexCoord2dARB },
+   { 22543, _gloffset_MultiTexCoord4dvARB },
+   { 22920, _gloffset_MultiTexCoord4fvARB },
+   { 23924, _gloffset_MultiTexCoord3fARB },
+   { 26541, _gloffset_MultiTexCoord4dARB },
+   { 26807, _gloffset_MultiTexCoord1sARB },
+   { 27011, _gloffset_MultiTexCoord1dvARB },
+   { 27987, _gloffset_MultiTexCoord1ivARB },
+   { 28080, _gloffset_MultiTexCoord2ivARB },
+   { 28419, _gloffset_MultiTexCoord1iARB },
+   { 29803, _gloffset_MultiTexCoord4svARB },
+   { 30427, _gloffset_MultiTexCoord1fARB },
+   { 30690, _gloffset_MultiTexCoord4fARB },
+   { 33159, _gloffset_MultiTexCoord2fvARB },
    {    -1, -1 }
 };
 
@@ -5464,7 +5564,7 @@ static const struct gl_function_remap MESA_alt_functions[] = {
 
 #if defined(need_GL_3DFX_tbuffer)
 static const struct gl_function_remap GL_3DFX_tbuffer_functions[] = {
-   {  9287, -1 }, /* TbufferMask3DFX */
+   {  9555, -1 }, /* TbufferMask3DFX */
    {    -1, -1 }
 };
 #endif
@@ -5556,7 +5656,7 @@ static const struct gl_function_remap GL_ARB_framebuffer_object_functions[] = {
 #if defined(need_GL_ARB_geometry_shader4)
 /* functions defined in MESA_remap_table_functions are excluded */
 static const struct gl_function_remap GL_ARB_geometry_shader4_functions[] = {
-   { 12500, -1 }, /* FramebufferTextureLayer */
+   { 12781, -1 }, /* FramebufferTextureLayer */
    {    -1, -1 }
 };
 #endif
@@ -5577,11 +5677,11 @@ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = {
 
 #if defined(need_GL_ARB_matrix_palette)
 static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = {
-   {  3773, -1 }, /* MatrixIndexusvARB */
-   { 13219, -1 }, /* MatrixIndexuivARB */
-   { 14655, -1 }, /* MatrixIndexPointerARB */
-   { 20126, -1 }, /* CurrentPaletteMatrixARB */
-   { 23203, -1 }, /* MatrixIndexubvARB */
+   {  3849, -1 }, /* MatrixIndexusvARB */
+   { 13500, -1 }, /* MatrixIndexuivARB */
+   { 14936, -1 }, /* MatrixIndexPointerARB */
+   { 20509, -1 }, /* CurrentPaletteMatrixARB */
+   { 23668, -1 }, /* MatrixIndexubvARB */
    {    -1, -1 }
 };
 #endif
@@ -5614,6 +5714,13 @@ static const struct gl_function_remap GL_ARB_provoking_vertex_functions[] = {
 };
 #endif
 
+#if defined(need_GL_ARB_robustness)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_robustness_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
 #if defined(need_GL_ARB_sampler_objects)
 /* functions defined in MESA_remap_table_functions are excluded */
 static const struct gl_function_remap GL_ARB_sampler_objects_functions[] = {
@@ -5672,16 +5779,16 @@ static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = {
 
 #if defined(need_GL_ARB_vertex_blend)
 static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = {
-   {  2396, -1 }, /* WeightubvARB */
-   {  6652, -1 }, /* WeightivARB */
-   { 11150, -1 }, /* WeightPointerARB */
-   { 13986, -1 }, /* WeightfvARB */
-   { 17814, -1 }, /* WeightbvARB */
-   { 21356, -1 }, /* WeightusvARB */
-   { 24329, -1 }, /* VertexBlendARB */
-   { 30054, -1 }, /* WeightsvARB */
-   { 32159, -1 }, /* WeightdvARB */
-   { 32902, -1 }, /* WeightuivARB */
+   {  2469, -1 }, /* WeightubvARB */
+   {  6886, -1 }, /* WeightivARB */
+   { 11431, -1 }, /* WeightPointerARB */
+   { 14267, -1 }, /* WeightfvARB */
+   { 18146, -1 }, /* WeightbvARB */
+   { 21739, -1 }, /* WeightusvARB */
+   { 24786, -1 }, /* VertexBlendARB */
+   { 30511, -1 }, /* WeightsvARB */
+   { 32616, -1 }, /* WeightdvARB */
+   { 33359, -1 }, /* WeightuivARB */
    {    -1, -1 }
 };
 #endif
@@ -5751,7 +5858,7 @@ static const struct gl_function_remap GL_ATI_separate_stencil_functions[] = {
 
 #if defined(need_GL_EXT_blend_color)
 static const struct gl_function_remap GL_EXT_blend_color_functions[] = {
-   {  2655, _gloffset_BlendColor },
+   {  2728, _gloffset_BlendColor },
    {    -1, -1 }
 };
 #endif
@@ -5772,15 +5879,15 @@ static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = {
 
 #if defined(need_GL_EXT_blend_minmax)
 static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = {
-   { 11285, _gloffset_BlendEquation },
+   { 11566, _gloffset_BlendEquation },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_color_subtable)
 static const struct gl_function_remap GL_EXT_color_subtable_functions[] = {
-   { 17238, _gloffset_ColorSubTable },
-   { 32109, _gloffset_CopyColorSubTable },
+   { 17546, _gloffset_ColorSubTable },
+   { 32566, _gloffset_CopyColorSubTable },
    {    -1, -1 }
 };
 #endif
@@ -5795,65 +5902,65 @@ static const struct gl_function_remap GL_EXT_compiled_vertex_array_functions[] =
 #if defined(need_GL_EXT_convolution)
 static const struct gl_function_remap GL_EXT_convolution_functions[] = {
    {   257, _gloffset_ConvolutionFilter1D },
-   {  2454, _gloffset_CopyConvolutionFilter1D },
-   {  4058, _gloffset_GetConvolutionParameteriv },
-   {  8567, _gloffset_ConvolutionFilter2D },
-   {  8769, _gloffset_ConvolutionParameteriv },
-   {  9229, _gloffset_ConvolutionParameterfv },
-   { 20892, _gloffset_GetSeparableFilter },
-   { 24403, _gloffset_SeparableFilter2D },
-   { 25266, _gloffset_ConvolutionParameteri },
-   { 25434, _gloffset_ConvolutionParameterf },
-   { 27148, _gloffset_GetConvolutionParameterfv },
-   { 28005, _gloffset_GetConvolutionFilter },
-   { 30468, _gloffset_CopyConvolutionFilter2D },
+   {  2527, _gloffset_CopyConvolutionFilter1D },
+   {  4168, _gloffset_GetConvolutionParameteriv },
+   {  8835, _gloffset_ConvolutionFilter2D },
+   {  9037, _gloffset_ConvolutionParameteriv },
+   {  9497, _gloffset_ConvolutionParameterfv },
+   { 21275, _gloffset_GetSeparableFilter },
+   { 24860, _gloffset_SeparableFilter2D },
+   { 25723, _gloffset_ConvolutionParameteri },
+   { 25891, _gloffset_ConvolutionParameterf },
+   { 27605, _gloffset_GetConvolutionParameterfv },
+   { 28462, _gloffset_GetConvolutionFilter },
+   { 30925, _gloffset_CopyConvolutionFilter2D },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_coordinate_frame)
 static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = {
-   { 10584, -1 }, /* TangentPointerEXT */
-   { 12655, -1 }, /* Binormal3ivEXT */
-   { 13351, -1 }, /* Tangent3sEXT */
-   { 14720, -1 }, /* Tangent3fvEXT */
-   { 18831, -1 }, /* Tangent3ivEXT */
-   { 19058, -1 }, /* Tangent3dvEXT */
-   { 19806, -1 }, /* Binormal3bvEXT */
-   { 20945, -1 }, /* Binormal3dEXT */
-   { 23135, -1 }, /* Tangent3fEXT */
-   { 25338, -1 }, /* Binormal3sEXT */
-   { 25880, -1 }, /* Tangent3dEXT */
-   { 26827, -1 }, /* Binormal3svEXT */
-   { 27428, -1 }, /* Binormal3fEXT */
-   { 28336, -1 }, /* Binormal3dvEXT */
-   { 29603, -1 }, /* Tangent3iEXT */
-   { 30753, -1 }, /* Tangent3bvEXT */
-   { 31318, -1 }, /* Tangent3bEXT */
-   { 31882, -1 }, /* Binormal3fvEXT */
-   { 32601, -1 }, /* BinormalPointerEXT */
-   { 33006, -1 }, /* Tangent3svEXT */
-   { 33443, -1 }, /* Binormal3bEXT */
-   { 33620, -1 }, /* Binormal3iEXT */
+   { 10865, -1 }, /* TangentPointerEXT */
+   { 12936, -1 }, /* Binormal3ivEXT */
+   { 13632, -1 }, /* Tangent3sEXT */
+   { 15001, -1 }, /* Tangent3fvEXT */
+   { 19188, -1 }, /* Tangent3ivEXT */
+   { 19415, -1 }, /* Tangent3dvEXT */
+   { 20189, -1 }, /* Binormal3bvEXT */
+   { 21328, -1 }, /* Binormal3dEXT */
+   { 23600, -1 }, /* Tangent3fEXT */
+   { 25795, -1 }, /* Binormal3sEXT */
+   { 26337, -1 }, /* Tangent3dEXT */
+   { 27284, -1 }, /* Binormal3svEXT */
+   { 27885, -1 }, /* Binormal3fEXT */
+   { 28793, -1 }, /* Binormal3dvEXT */
+   { 30060, -1 }, /* Tangent3iEXT */
+   { 31210, -1 }, /* Tangent3bvEXT */
+   { 31775, -1 }, /* Tangent3bEXT */
+   { 32339, -1 }, /* Binormal3fvEXT */
+   { 33058, -1 }, /* BinormalPointerEXT */
+   { 33539, -1 }, /* Tangent3svEXT */
+   { 33976, -1 }, /* Binormal3bEXT */
+   { 34153, -1 }, /* Binormal3iEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_copy_texture)
 static const struct gl_function_remap GL_EXT_copy_texture_functions[] = {
-   { 15245, _gloffset_CopyTexSubImage3D },
-   { 16925, _gloffset_CopyTexImage2D },
-   { 24874, _gloffset_CopyTexImage1D },
-   { 27686, _gloffset_CopyTexSubImage2D },
-   { 30106, _gloffset_CopyTexSubImage1D },
+   { 15526, _gloffset_CopyTexSubImage3D },
+   { 17233, _gloffset_CopyTexImage2D },
+   { 25331, _gloffset_CopyTexImage1D },
+   { 28143, _gloffset_CopyTexSubImage2D },
+   { 30563, _gloffset_CopyTexSubImage1D },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_cull_vertex)
 static const struct gl_function_remap GL_EXT_cull_vertex_functions[] = {
-   {  8918, -1 }, /* CullParameterdvEXT */
-   { 11773, -1 }, /* CullParameterfvEXT */
+   {  9186, -1 }, /* CullParameterdvEXT */
+   { 12054, -1 }, /* CullParameterfvEXT */
    {    -1, -1 }
 };
 #endif
@@ -5881,7 +5988,7 @@ static const struct gl_function_remap GL_EXT_draw_instanced_functions[] = {
 
 #if defined(need_GL_EXT_draw_range_elements)
 static const struct gl_function_remap GL_EXT_draw_range_elements_functions[] = {
-   {  9566, _gloffset_DrawRangeElements },
+   {  9834, _gloffset_DrawRangeElements },
    {    -1, -1 }
 };
 #endif
@@ -5931,38 +6038,38 @@ static const struct gl_function_remap GL_EXT_gpu_shader4_functions[] = {
 #if defined(need_GL_EXT_histogram)
 static const struct gl_function_remap GL_EXT_histogram_functions[] = {
    {   856, _gloffset_Histogram },
-   {  3522, _gloffset_ResetHistogram },
-   { 10063, _gloffset_GetMinmax },
-   { 15579, _gloffset_GetHistogramParameterfv },
-   { 24799, _gloffset_GetMinmaxParameteriv },
-   { 27038, _gloffset_ResetMinmax },
-   { 27902, _gloffset_GetHistogramParameteriv },
-   { 29071, _gloffset_GetHistogram },
-   { 31695, _gloffset_Minmax },
-   { 33241, _gloffset_GetMinmaxParameterfv },
+   {  3598, _gloffset_ResetHistogram },
+   { 10317, _gloffset_GetMinmax },
+   { 15860, _gloffset_GetHistogramParameterfv },
+   { 25256, _gloffset_GetMinmaxParameteriv },
+   { 27495, _gloffset_ResetMinmax },
+   { 28359, _gloffset_GetHistogramParameteriv },
+   { 29528, _gloffset_GetHistogram },
+   { 32152, _gloffset_Minmax },
+   { 33774, _gloffset_GetMinmaxParameterfv },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_index_func)
 static const struct gl_function_remap GL_EXT_index_func_functions[] = {
-   { 11559, -1 }, /* IndexFuncEXT */
+   { 11840, -1 }, /* IndexFuncEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_index_material)
 static const struct gl_function_remap GL_EXT_index_material_functions[] = {
-   { 21443, -1 }, /* IndexMaterialEXT */
+   { 21861, -1 }, /* IndexMaterialEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_light_texture)
 static const struct gl_function_remap GL_EXT_light_texture_functions[] = {
-   { 26847, -1 }, /* ApplyTextureEXT */
-   { 26992, -1 }, /* TextureMaterialEXT */
-   { 27017, -1 }, /* TextureLightEXT */
+   { 27304, -1 }, /* ApplyTextureEXT */
+   { 27449, -1 }, /* TextureMaterialEXT */
+   { 27474, -1 }, /* TextureLightEXT */
    {    -1, -1 }
 };
 #endif
@@ -5983,20 +6090,20 @@ static const struct gl_function_remap GL_EXT_multisample_functions[] = {
 
 #if defined(need_GL_EXT_paletted_texture)
 static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = {
-   {  8429, _gloffset_ColorTable },
-   { 15425, _gloffset_GetColorTable },
-   { 23318, _gloffset_GetColorTableParameterfv },
-   { 25490, _gloffset_GetColorTableParameteriv },
+   {  8697, _gloffset_ColorTable },
+   { 15706, _gloffset_GetColorTable },
+   { 23783, _gloffset_GetColorTableParameterfv },
+   { 25947, _gloffset_GetColorTableParameteriv },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_pixel_transform)
 static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = {
-   { 22090, -1 }, /* PixelTransformParameterfEXT */
-   { 22170, -1 }, /* PixelTransformParameteriEXT */
-   { 31033, -1 }, /* PixelTransformParameterfvEXT */
-   { 32565, -1 }, /* PixelTransformParameterivEXT */
+   { 22508, -1 }, /* PixelTransformParameterfEXT */
+   { 22588, -1 }, /* PixelTransformParameteriEXT */
+   { 31490, -1 }, /* PixelTransformParameterfvEXT */
+   { 33022, -1 }, /* PixelTransformParameterivEXT */
    {    -1, -1 }
 };
 #endif
@@ -6045,16 +6152,16 @@ static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = {
 
 #if defined(need_GL_EXT_subtexture)
 static const struct gl_function_remap GL_EXT_subtexture_functions[] = {
-   {  7174, _gloffset_TexSubImage1D },
-   { 10740, _gloffset_TexSubImage2D },
+   {  7408, _gloffset_TexSubImage1D },
+   { 11021, _gloffset_TexSubImage2D },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_texture3D)
 static const struct gl_function_remap GL_EXT_texture3D_functions[] = {
-   {  1774, _gloffset_TexImage3D },
-   { 23087, _gloffset_TexSubImage3D },
+   {  1826, _gloffset_TexImage3D },
+   { 23552, _gloffset_TexSubImage3D },
    {    -1, -1 }
 };
 #endif
@@ -6075,19 +6182,19 @@ static const struct gl_function_remap GL_EXT_texture_integer_functions[] = {
 
 #if defined(need_GL_EXT_texture_object)
 static const struct gl_function_remap GL_EXT_texture_object_functions[] = {
-   {  3290, _gloffset_PrioritizeTextures },
-   {  7623, _gloffset_AreTexturesResident },
-   { 13694, _gloffset_GenTextures },
-   { 15911, _gloffset_DeleteTextures },
-   { 19859, _gloffset_IsTexture },
-   { 30171, _gloffset_BindTexture },
+   {  3366, _gloffset_PrioritizeTextures },
+   {  7857, _gloffset_AreTexturesResident },
+   { 13975, _gloffset_GenTextures },
+   { 16219, _gloffset_DeleteTextures },
+   { 20242, _gloffset_IsTexture },
+   { 30628, _gloffset_BindTexture },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_texture_perturb_normal)
 static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = {
-   { 13936, -1 }, /* TextureNormalEXT */
+   { 14217, -1 }, /* TextureNormalEXT */
    {    -1, -1 }
 };
 #endif
@@ -6109,30 +6216,30 @@ static const struct gl_function_remap GL_EXT_transform_feedback_functions[] = {
 #if defined(need_GL_EXT_vertex_array)
 /* functions defined in MESA_remap_table_functions are excluded */
 static const struct gl_function_remap GL_EXT_vertex_array_functions[] = {
-   { 24575, _gloffset_ArrayElement },
-   { 31283, _gloffset_GetPointerv },
-   { 32868, _gloffset_DrawArrays },
+   { 25032, _gloffset_ArrayElement },
+   { 31740, _gloffset_GetPointerv },
+   { 33325, _gloffset_DrawArrays },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_vertex_weighting)
 static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = {
-   { 19907, -1 }, /* VertexWeightfvEXT */
-   { 27371, -1 }, /* VertexWeightfEXT */
-   { 29040, -1 }, /* VertexWeightPointerEXT */
+   { 20290, -1 }, /* VertexWeightfvEXT */
+   { 27828, -1 }, /* VertexWeightfEXT */
+   { 29497, -1 }, /* VertexWeightPointerEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_HP_image_transform)
 static const struct gl_function_remap GL_HP_image_transform_functions[] = {
-   {  2327, -1 }, /* GetImageTransformParameterfvHP */
-   {  3739, -1 }, /* ImageTransformParameterfHP */
-   { 10278, -1 }, /* ImageTransformParameterfvHP */
-   { 12020, -1 }, /* ImageTransformParameteriHP */
-   { 12390, -1 }, /* GetImageTransformParameterivHP */
-   { 19971, -1 }, /* ImageTransformParameterivHP */
+   {  2400, -1 }, /* GetImageTransformParameterfvHP */
+   {  3815, -1 }, /* ImageTransformParameterfHP */
+   { 10559, -1 }, /* ImageTransformParameterfvHP */
+   { 12301, -1 }, /* ImageTransformParameteriHP */
+   { 12671, -1 }, /* GetImageTransformParameterivHP */
+   { 20354, -1 }, /* ImageTransformParameterivHP */
    {    -1, -1 }
 };
 #endif
@@ -6146,14 +6253,14 @@ static const struct gl_function_remap GL_IBM_multimode_draw_arrays_functions[] =
 
 #if defined(need_GL_IBM_vertex_array_lists)
 static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = {
-   {  4400, -1 }, /* SecondaryColorPointerListIBM */
-   {  6106, -1 }, /* NormalPointerListIBM */
-   {  7797, -1 }, /* FogCoordPointerListIBM */
-   {  8104, -1 }, /* VertexPointerListIBM */
-   { 12274, -1 }, /* ColorPointerListIBM */
-   { 13458, -1 }, /* TexCoordPointerListIBM */
-   { 13958, -1 }, /* IndexPointerListIBM */
-   { 33184, -1 }, /* EdgeFlagPointerListIBM */
+   {  4510, -1 }, /* SecondaryColorPointerListIBM */
+   {  6340, -1 }, /* NormalPointerListIBM */
+   {  8031, -1 }, /* FogCoordPointerListIBM */
+   {  8372, -1 }, /* VertexPointerListIBM */
+   { 12555, -1 }, /* ColorPointerListIBM */
+   { 13739, -1 }, /* TexCoordPointerListIBM */
+   { 14239, -1 }, /* IndexPointerListIBM */
+   { 33717, -1 }, /* EdgeFlagPointerListIBM */
    {    -1, -1 }
 };
 #endif
@@ -6167,10 +6274,10 @@ static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] =
 
 #if defined(need_GL_INTEL_parallel_arrays)
 static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = {
-   { 12798, -1 }, /* VertexPointervINTEL */
-   { 15672, -1 }, /* ColorPointervINTEL */
-   { 30442, -1 }, /* NormalPointervINTEL */
-   { 30965, -1 }, /* TexCoordPointervINTEL */
+   { 13079, -1 }, /* VertexPointervINTEL */
+   { 15953, -1 }, /* ColorPointervINTEL */
+   { 30899, -1 }, /* NormalPointervINTEL */
+   { 31422, -1 }, /* TexCoordPointervINTEL */
    {    -1, -1 }
 };
 #endif
@@ -6184,10 +6291,10 @@ static const struct gl_function_remap GL_MESA_resize_buffers_functions[] = {
 
 #if defined(need_GL_MESA_shader_debug)
 static const struct gl_function_remap GL_MESA_shader_debug_functions[] = {
-   {  1638, -1 }, /* GetDebugLogLengthMESA */
-   {  3461, -1 }, /* ClearDebugLogMESA */
-   {  4561, -1 }, /* GetDebugLogMESA */
-   { 31476, -1 }, /* CreateDebugObjectMESA */
+   {  1690, -1 }, /* GetDebugLogLengthMESA */
+   {  3537, -1 }, /* ClearDebugLogMESA */
+   {  4695, -1 }, /* GetDebugLogMESA */
+   { 31933, -1 }, /* CreateDebugObjectMESA */
    {    -1, -1 }
 };
 #endif
@@ -6208,15 +6315,15 @@ static const struct gl_function_remap GL_NV_condtitional_render_functions[] = {
 
 #if defined(need_GL_NV_evaluators)
 static const struct gl_function_remap GL_NV_evaluators_functions[] = {
-   {  6836, -1 }, /* GetMapAttribParameterivNV */
-   {  8535, -1 }, /* MapControlPointsNV */
-   {  8634, -1 }, /* MapParameterfvNV */
-   { 10723, -1 }, /* EvalMapsNV */
-   { 17412, -1 }, /* GetMapAttribParameterfvNV */
-   { 17629, -1 }, /* MapParameterivNV */
-   { 25189, -1 }, /* GetMapParameterivNV */
-   { 25732, -1 }, /* GetMapParameterfvNV */
-   { 29757, -1 }, /* GetMapControlPointsNV */
+   {  7070, -1 }, /* GetMapAttribParameterivNV */
+   {  8803, -1 }, /* MapControlPointsNV */
+   {  8902, -1 }, /* MapParameterfvNV */
+   { 11004, -1 }, /* EvalMapsNV */
+   { 17744, -1 }, /* GetMapAttribParameterfvNV */
+   { 17961, -1 }, /* MapParameterivNV */
+   { 25646, -1 }, /* GetMapParameterivNV */
+   { 26189, -1 }, /* GetMapParameterfvNV */
+   { 30214, -1 }, /* GetMapControlPointsNV */
    {    -1, -1 }
 };
 #endif
@@ -6258,8 +6365,8 @@ static const struct gl_function_remap GL_NV_register_combiners_functions[] = {
 
 #if defined(need_GL_NV_register_combiners2)
 static const struct gl_function_remap GL_NV_register_combiners2_functions[] = {
-   { 16064, -1 }, /* CombinerStageParameterfvNV */
-   { 16460, -1 }, /* GetCombinerStageParameterfvNV */
+   { 16372, -1 }, /* CombinerStageParameterfvNV */
+   { 16768, -1 }, /* GetCombinerStageParameterfvNV */
    {    -1, -1 }
 };
 #endif
@@ -6294,23 +6401,23 @@ static const struct gl_function_remap GL_OES_EGL_image_functions[] = {
 
 #if defined(need_GL_PGI_misc_hints)
 static const struct gl_function_remap GL_PGI_misc_hints_functions[] = {
-   {  8755, -1 }, /* HintPGI */
+   {  9023, -1 }, /* HintPGI */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_detail_texture)
 static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = {
-   { 16433, -1 }, /* GetDetailTexFuncSGIS */
-   { 16870, -1 }, /* DetailTexFuncSGIS */
+   { 16741, -1 }, /* GetDetailTexFuncSGIS */
+   { 17178, -1 }, /* DetailTexFuncSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_fog_function)
 static const struct gl_function_remap GL_SGIS_fog_function_functions[] = {
-   { 27668, -1 }, /* FogFuncSGIS */
-   { 28389, -1 }, /* GetFogFuncSGIS */
+   { 28125, -1 }, /* FogFuncSGIS */
+   { 28846, -1 }, /* GetFogFuncSGIS */
    {    -1, -1 }
 };
 #endif
@@ -6338,112 +6445,112 @@ static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = {
 
 #if defined(need_GL_SGIS_sharpen_texture)
 static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
-   {  6897, -1 }, /* GetSharpenTexFuncSGIS */
-   { 22455, -1 }, /* SharpenTexFuncSGIS */
+   {  7131, -1 }, /* GetSharpenTexFuncSGIS */
+   { 22894, -1 }, /* SharpenTexFuncSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_texture4D)
 static const struct gl_function_remap GL_SGIS_texture4D_functions[] = {
-   {  1010, -1 }, /* TexImage4DSGIS */
-   { 15980, -1 }, /* TexSubImage4DSGIS */
+   {   995, -1 }, /* TexImage4DSGIS */
+   { 16288, -1 }, /* TexSubImage4DSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_texture_color_mask)
 static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = {
-   { 15378, -1 }, /* TextureColorMaskSGIS */
+   { 15659, -1 }, /* TextureColorMaskSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_texture_filter4)
 static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = {
-   {  7074, -1 }, /* GetTexFilterFuncSGIS */
-   { 16606, -1 }, /* TexFilterFuncSGIS */
+   {  7308, -1 }, /* GetTexFilterFuncSGIS */
+   { 16914, -1 }, /* TexFilterFuncSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_async)
 static const struct gl_function_remap GL_SGIX_async_functions[] = {
-   {  3387, -1 }, /* AsyncMarkerSGIX */
-   {  4540, -1 }, /* FinishAsyncSGIX */
-   {  5516, -1 }, /* PollAsyncSGIX */
-   { 22664, -1 }, /* DeleteAsyncMarkersSGIX */
-   { 22719, -1 }, /* IsAsyncMarkerSGIX */
-   { 32981, -1 }, /* GenAsyncMarkersSGIX */
+   {  3463, -1 }, /* AsyncMarkerSGIX */
+   {  4649, -1 }, /* FinishAsyncSGIX */
+   {  5721, -1 }, /* PollAsyncSGIX */
+   { 23103, -1 }, /* DeleteAsyncMarkersSGIX */
+   { 23158, -1 }, /* IsAsyncMarkerSGIX */
+   { 33514, -1 }, /* GenAsyncMarkersSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_flush_raster)
 static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = {
-   {  7451, -1 }, /* FlushRasterSGIX */
+   {  7685, -1 }, /* FlushRasterSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_fragment_lighting)
 static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = {
-   {  2625, -1 }, /* FragmentMaterialfvSGIX */
-   {  5420, -1 }, /* FragmentLightiSGIX */
-   {  8171, -1 }, /* FragmentMaterialfSGIX */
-   {  8308, -1 }, /* GetFragmentLightivSGIX */
-   {  9181, -1 }, /* FragmentLightModeliSGIX */
-   { 10786, -1 }, /* FragmentLightivSGIX */
-   { 11093, -1 }, /* GetFragmentMaterialivSGIX */
-   { 16373, -1 }, /* GetFragmentMaterialfvSGIX */
-   { 19776, -1 }, /* FragmentLightModelfSGIX */
-   { 20094, -1 }, /* FragmentColorMaterialSGIX */
-   { 20511, -1 }, /* FragmentMaterialiSGIX */
-   { 21771, -1 }, /* LightEnviSGIX */
-   { 23410, -1 }, /* FragmentLightModelfvSGIX */
-   { 23745, -1 }, /* FragmentLightfvSGIX */
-   { 28773, -1 }, /* FragmentLightModelivSGIX */
-   { 28922, -1 }, /* FragmentLightfSGIX */
-   { 31852, -1 }, /* GetFragmentLightfvSGIX */
-   { 33464, -1 }, /* FragmentMaterialivSGIX */
+   {  2698, -1 }, /* FragmentMaterialfvSGIX */
+   {  5625, -1 }, /* FragmentLightiSGIX */
+   {  8439, -1 }, /* FragmentMaterialfSGIX */
+   {  8576, -1 }, /* GetFragmentLightivSGIX */
+   {  9449, -1 }, /* FragmentLightModeliSGIX */
+   { 11067, -1 }, /* FragmentLightivSGIX */
+   { 11374, -1 }, /* GetFragmentMaterialivSGIX */
+   { 16681, -1 }, /* GetFragmentMaterialfvSGIX */
+   { 20159, -1 }, /* FragmentLightModelfSGIX */
+   { 20477, -1 }, /* FragmentColorMaterialSGIX */
+   { 20894, -1 }, /* FragmentMaterialiSGIX */
+   { 22189, -1 }, /* LightEnviSGIX */
+   { 23875, -1 }, /* FragmentLightModelfvSGIX */
+   { 24210, -1 }, /* FragmentLightfvSGIX */
+   { 29230, -1 }, /* FragmentLightModelivSGIX */
+   { 29379, -1 }, /* FragmentLightfSGIX */
+   { 32309, -1 }, /* GetFragmentLightfvSGIX */
+   { 33997, -1 }, /* FragmentMaterialivSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_framezoom)
 static const struct gl_function_remap GL_SGIX_framezoom_functions[] = {
-   { 22742, -1 }, /* FrameZoomSGIX */
+   { 23181, -1 }, /* FrameZoomSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_igloo_interface)
 static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = {
-   { 29230, -1 }, /* IglooInterfaceSGIX */
+   { 29687, -1 }, /* IglooInterfaceSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_instruments)
 static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
-   {  2805, -1 }, /* ReadInstrumentsSGIX */
-   {  6670, -1 }, /* PollInstrumentsSGIX */
-   { 10644, -1 }, /* GetInstrumentsSGIX */
-   { 13056, -1 }, /* StartInstrumentsSGIX */
-   { 16098, -1 }, /* StopInstrumentsSGIX */
-   { 18051, -1 }, /* InstrumentsBufferSGIX */
+   {  2878, -1 }, /* ReadInstrumentsSGIX */
+   {  6904, -1 }, /* PollInstrumentsSGIX */
+   { 10925, -1 }, /* GetInstrumentsSGIX */
+   { 13337, -1 }, /* StartInstrumentsSGIX */
+   { 16406, -1 }, /* StopInstrumentsSGIX */
+   { 18383, -1 }, /* InstrumentsBufferSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_list_priority)
 static const struct gl_function_remap GL_SGIX_list_priority_functions[] = {
-   {  1241, -1 }, /* ListParameterfSGIX */
-   {  3089, -1 }, /* GetListParameterfvSGIX */
-   { 17942, -1 }, /* ListParameteriSGIX */
-   { 19008, -1 }, /* ListParameterfvSGIX */
-   { 21177, -1 }, /* ListParameterivSGIX */
-   { 33025, -1 }, /* GetListParameterivSGIX */
+   {  1226, -1 }, /* ListParameterfSGIX */
+   {  3165, -1 }, /* GetListParameterfvSGIX */
+   { 18274, -1 }, /* ListParameteriSGIX */
+   { 19365, -1 }, /* ListParameterfvSGIX */
+   { 21560, -1 }, /* ListParameterivSGIX */
+   { 33558, -1 }, /* GetListParameterivSGIX */
    {    -1, -1 }
 };
 #endif
@@ -6457,134 +6564,134 @@ static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = {
 
 #if defined(need_GL_SGIX_polynomial_ffd)
 static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = {
-   {  3685, -1 }, /* LoadIdentityDeformationMapSGIX */
-   { 16198, -1 }, /* DeformSGIX */
-   { 24687, -1 }, /* DeformationMap3fSGIX */
-   { 31740, -1 }, /* DeformationMap3dSGIX */
+   {  3761, -1 }, /* LoadIdentityDeformationMapSGIX */
+   { 16506, -1 }, /* DeformSGIX */
+   { 25144, -1 }, /* DeformationMap3fSGIX */
+   { 32197, -1 }, /* DeformationMap3dSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_reference_plane)
 static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = {
-   { 14929, -1 }, /* ReferencePlaneSGIX */
+   { 15210, -1 }, /* ReferencePlaneSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_sprite)
 static const struct gl_function_remap GL_SGIX_sprite_functions[] = {
-   {  9679, -1 }, /* SpriteParameterfvSGIX */
-   { 20966, -1 }, /* SpriteParameteriSGIX */
-   { 27072, -1 }, /* SpriteParameterfSGIX */
-   { 29900, -1 }, /* SpriteParameterivSGIX */
+   {  9947, -1 }, /* SpriteParameterfvSGIX */
+   { 21349, -1 }, /* SpriteParameteriSGIX */
+   { 27529, -1 }, /* SpriteParameterfSGIX */
+   { 30357, -1 }, /* SpriteParameterivSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_tag_sample_buffer)
 static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = {
-   { 21025, -1 }, /* TagSampleBufferSGIX */
+   { 21408, -1 }, /* TagSampleBufferSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGI_color_table)
 static const struct gl_function_remap GL_SGI_color_table_functions[] = {
-   {  7741, _gloffset_ColorTableParameteriv },
-   {  8429, _gloffset_ColorTable },
-   { 15425, _gloffset_GetColorTable },
-   { 15535, _gloffset_CopyColorTable },
-   { 19720, _gloffset_ColorTableParameterfv },
-   { 23318, _gloffset_GetColorTableParameterfv },
-   { 25490, _gloffset_GetColorTableParameteriv },
+   {  7975, _gloffset_ColorTableParameteriv },
+   {  8697, _gloffset_ColorTable },
+   { 15706, _gloffset_GetColorTable },
+   { 15816, _gloffset_CopyColorTable },
+   { 20103, _gloffset_ColorTableParameterfv },
+   { 23783, _gloffset_GetColorTableParameterfv },
+   { 25947, _gloffset_GetColorTableParameteriv },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUNX_constant_data)
 static const struct gl_function_remap GL_SUNX_constant_data_functions[] = {
-   { 31830, -1 }, /* FinishTextureSUNX */
+   { 32287, -1 }, /* FinishTextureSUNX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_global_alpha)
 static const struct gl_function_remap GL_SUN_global_alpha_functions[] = {
-   {  3408, -1 }, /* GlobalAlphaFactorubSUN */
-   {  4868, -1 }, /* GlobalAlphaFactoriSUN */
-   {  6695, -1 }, /* GlobalAlphaFactordSUN */
-   {  9763, -1 }, /* GlobalAlphaFactoruiSUN */
-   { 10235, -1 }, /* GlobalAlphaFactorbSUN */
-   { 13371, -1 }, /* GlobalAlphaFactorfSUN */
-   { 13535, -1 }, /* GlobalAlphaFactorusSUN */
-   { 23005, -1 }, /* GlobalAlphaFactorsSUN */
+   {  3484, -1 }, /* GlobalAlphaFactorubSUN */
+   {  5002, -1 }, /* GlobalAlphaFactoriSUN */
+   {  6929, -1 }, /* GlobalAlphaFactordSUN */
+   { 10031, -1 }, /* GlobalAlphaFactoruiSUN */
+   { 10516, -1 }, /* GlobalAlphaFactorbSUN */
+   { 13652, -1 }, /* GlobalAlphaFactorfSUN */
+   { 13816, -1 }, /* GlobalAlphaFactorusSUN */
+   { 23470, -1 }, /* GlobalAlphaFactorsSUN */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_mesh_array)
 static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
-   { 29691, -1 }, /* DrawMeshArraysSUN */
+   { 30148, -1 }, /* DrawMeshArraysSUN */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_triangle_list)
 static const struct gl_function_remap GL_SUN_triangle_list_functions[] = {
-   {  4514, -1 }, /* ReplacementCodeubSUN */
-   {  6454, -1 }, /* ReplacementCodeubvSUN */
-   { 19441, -1 }, /* ReplacementCodeusvSUN */
-   { 19629, -1 }, /* ReplacementCodePointerSUN */
-   { 21835, -1 }, /* ReplacementCodeuiSUN */
-   { 22693, -1 }, /* ReplacementCodeusSUN */
-   { 30357, -1 }, /* ReplacementCodeuivSUN */
+   {  4623, -1 }, /* ReplacementCodeubSUN */
+   {  6688, -1 }, /* ReplacementCodeubvSUN */
+   { 19824, -1 }, /* ReplacementCodeusvSUN */
+   { 20012, -1 }, /* ReplacementCodePointerSUN */
+   { 22253, -1 }, /* ReplacementCodeuiSUN */
+   { 23132, -1 }, /* ReplacementCodeusSUN */
+   { 30814, -1 }, /* ReplacementCodeuivSUN */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_vertex)
 static const struct gl_function_remap GL_SUN_vertex_functions[] = {
-   {  1115, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */
-   {  1313, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */
-   {  1539, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */
-   {  1869, -1 }, /* ReplacementCodeuiVertex3fvSUN */
-   {  2003, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */
-   {  2561, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */
-   {  2874, -1 }, /* Color4ubVertex3fvSUN */
-   {  4673, -1 }, /* Color4ubVertex3fSUN */
-   {  4796, -1 }, /* TexCoord2fVertex3fSUN */
-   {  5169, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */
-   {  5620, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */
-   {  6349, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */
-   {  7129, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
-   {  7488, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */
-   {  8980, -1 }, /* Color3fVertex3fSUN */
-   { 10171, -1 }, /* Color3fVertex3fvSUN */
-   { 10609, -1 }, /* Color4fNormal3fVertex3fvSUN */
-   { 11438, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
-   { 12919, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
-   { 14545, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
-   { 15071, -1 }, /* TexCoord2fColor3fVertex3fSUN */
-   { 16123, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
-   { 16565, -1 }, /* Color4ubVertex2fvSUN */
-   { 16895, -1 }, /* Normal3fVertex3fSUN */
-   { 17992, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
-   { 18344, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
-   { 18651, -1 }, /* TexCoord2fNormal3fVertex3fSUN */
-   { 19260, -1 }, /* TexCoord2fVertex3fvSUN */
-   { 20064, -1 }, /* Color4ubVertex2fSUN */
-   { 20302, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
-   { 22301, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
-   { 22761, -1 }, /* Normal3fVertex3fvSUN */
-   { 23227, -1 }, /* Color4fNormal3fVertex3fSUN */
-   { 24236, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
-   { 26393, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
-   { 27784, -1 }, /* TexCoord4fVertex4fSUN */
-   { 28230, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
-   { 28617, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
-   { 28744, -1 }, /* TexCoord4fVertex4fvSUN */
-   { 29478, -1 }, /* ReplacementCodeuiVertex3fSUN */
+   {  1100, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */
+   {  1298, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */
+   {  1552, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */
+   {  1921, -1 }, /* ReplacementCodeuiVertex3fvSUN */
+   {  2055, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */
+   {  2634, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */
+   {  2974, -1 }, /* Color4ubVertex3fvSUN */
+   {  4807, -1 }, /* Color4ubVertex3fSUN */
+   {  4930, -1 }, /* TexCoord2fVertex3fSUN */
+   {  5348, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */
+   {  5825, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */
+   {  6583, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */
+   {  7363, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
+   {  7722, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */
+   {  9248, -1 }, /* Color3fVertex3fSUN */
+   { 10425, -1 }, /* Color3fVertex3fvSUN */
+   { 10890, -1 }, /* Color4fNormal3fVertex3fvSUN */
+   { 11719, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
+   { 13200, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
+   { 14826, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
+   { 15352, -1 }, /* TexCoord2fColor3fVertex3fSUN */
+   { 16431, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
+   { 16873, -1 }, /* Color4ubVertex2fvSUN */
+   { 17203, -1 }, /* Normal3fVertex3fSUN */
+   { 18324, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
+   { 18676, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
+   { 18983, -1 }, /* TexCoord2fNormal3fVertex3fSUN */
+   { 19617, -1 }, /* TexCoord2fVertex3fvSUN */
+   { 20447, -1 }, /* Color4ubVertex2fSUN */
+   { 20685, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
+   { 22719, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
+   { 23200, -1 }, /* Normal3fVertex3fvSUN */
+   { 23692, -1 }, /* Color4fNormal3fVertex3fSUN */
+   { 24693, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
+   { 26850, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
+   { 28241, -1 }, /* TexCoord4fVertex4fSUN */
+   { 28687, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
+   { 29074, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
+   { 29201, -1 }, /* TexCoord4fVertex4fvSUN */
+   { 29935, -1 }, /* ReplacementCodeuiVertex3fSUN */
    {    -1, -1 }
 };
 #endif
@@ -6594,38 +6701,38 @@ static const struct gl_function_remap GL_SUN_vertex_functions[] = {
 static const struct gl_function_remap GL_VERSION_1_3_functions[] = {
    {   425, _gloffset_MultiTexCoord3sARB },
    {   657, _gloffset_ActiveTextureARB },
-   {  4268, _gloffset_MultiTexCoord1fvARB },
-   {  6240, _gloffset_MultiTexCoord3dARB },
-   {  6285, _gloffset_MultiTexCoord2iARB },
-   {  6409, _gloffset_MultiTexCoord2svARB },
-   {  8385, _gloffset_MultiTexCoord2fARB },
-   { 10445, _gloffset_MultiTexCoord3fvARB },
-   { 11047, _gloffset_MultiTexCoord4sARB },
-   { 11728, _gloffset_MultiTexCoord2dvARB },
-   { 12135, _gloffset_MultiTexCoord1svARB },
-   { 12536, _gloffset_MultiTexCoord3svARB },
-   { 12597, _gloffset_MultiTexCoord4iARB },
-   { 13398, _gloffset_MultiTexCoord3iARB },
-   { 14268, _gloffset_MultiTexCoord1dARB },
-   { 14500, _gloffset_MultiTexCoord3dvARB },
-   { 15779, _gloffset_MultiTexCoord3ivARB },
-   { 15824, _gloffset_MultiTexCoord2sARB },
-   { 17295, _gloffset_MultiTexCoord4ivARB },
-   { 19360, _gloffset_ClientActiveTextureARB },
-   { 21688, _gloffset_MultiTexCoord2dARB },
-   { 22125, _gloffset_MultiTexCoord4dvARB },
-   { 22481, _gloffset_MultiTexCoord4fvARB },
-   { 23459, _gloffset_MultiTexCoord3fARB },
-   { 26084, _gloffset_MultiTexCoord4dARB },
-   { 26350, _gloffset_MultiTexCoord1sARB },
-   { 26554, _gloffset_MultiTexCoord1dvARB },
-   { 27530, _gloffset_MultiTexCoord1ivARB },
-   { 27623, _gloffset_MultiTexCoord2ivARB },
-   { 27962, _gloffset_MultiTexCoord1iARB },
-   { 29346, _gloffset_MultiTexCoord4svARB },
-   { 29970, _gloffset_MultiTexCoord1fARB },
-   { 30233, _gloffset_MultiTexCoord4fARB },
-   { 32702, _gloffset_MultiTexCoord2fvARB },
+   {  4378, _gloffset_MultiTexCoord1fvARB },
+   {  6474, _gloffset_MultiTexCoord3dARB },
+   {  6519, _gloffset_MultiTexCoord2iARB },
+   {  6643, _gloffset_MultiTexCoord2svARB },
+   {  8653, _gloffset_MultiTexCoord2fARB },
+   { 10726, _gloffset_MultiTexCoord3fvARB },
+   { 11328, _gloffset_MultiTexCoord4sARB },
+   { 12009, _gloffset_MultiTexCoord2dvARB },
+   { 12416, _gloffset_MultiTexCoord1svARB },
+   { 12817, _gloffset_MultiTexCoord3svARB },
+   { 12878, _gloffset_MultiTexCoord4iARB },
+   { 13679, _gloffset_MultiTexCoord3iARB },
+   { 14549, _gloffset_MultiTexCoord1dARB },
+   { 14781, _gloffset_MultiTexCoord3dvARB },
+   { 16060, _gloffset_MultiTexCoord3ivARB },
+   { 16105, _gloffset_MultiTexCoord2sARB },
+   { 17603, _gloffset_MultiTexCoord4ivARB },
+   { 19743, _gloffset_ClientActiveTextureARB },
+   { 22106, _gloffset_MultiTexCoord2dARB },
+   { 22543, _gloffset_MultiTexCoord4dvARB },
+   { 22920, _gloffset_MultiTexCoord4fvARB },
+   { 23924, _gloffset_MultiTexCoord3fARB },
+   { 26541, _gloffset_MultiTexCoord4dARB },
+   { 26807, _gloffset_MultiTexCoord1sARB },
+   { 27011, _gloffset_MultiTexCoord1dvARB },
+   { 27987, _gloffset_MultiTexCoord1ivARB },
+   { 28080, _gloffset_MultiTexCoord2ivARB },
+   { 28419, _gloffset_MultiTexCoord1iARB },
+   { 29803, _gloffset_MultiTexCoord4svARB },
+   { 30427, _gloffset_MultiTexCoord1fARB },
+   { 30690, _gloffset_MultiTexCoord4fARB },
+   { 33159, _gloffset_MultiTexCoord2fvARB },
    {    -1, -1 }
 };
 #endif
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index e6d5fe4bf..fa884c0de 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -51,38 +51,185 @@
 
 /*
  * Routines for get/put values in common buffer formats follow.
- * Someday add support for arbitrary row stride to make them more
- * flexible.
  */
 
-/**********************************************************************
- * Functions for buffers of 1 X GLubyte values.
- * Typically stencil.
+/* Returns a bytes per pixel of the DataType in the get/put span
+ * functions for at least a subset of the available combinations a
+ * renderbuffer can have.
+ *
+ * It would be nice to see gl_renderbuffer start talking about a
+ * gl_format instead of a GLenum DataType.
  */
+static int
+get_datatype_bytes(struct gl_renderbuffer *rb)
+{
+   int component_size;
+
+   switch (rb->DataType) {
+   case GL_FLOAT:
+   case GL_UNSIGNED_INT:
+   case GL_UNSIGNED_INT_24_8_EXT:
+      component_size = 4;
+      break;
+   case GL_UNSIGNED_SHORT:
+      component_size = 2;
+      break;
+   case GL_UNSIGNED_BYTE:
+      component_size = 1;
+      break;
+   default:
+      component_size = 1;
+      assert(0);
+   }
+
+   switch (rb->_BaseFormat) {
+   case GL_DEPTH_COMPONENT:
+   case GL_DEPTH_STENCIL:
+      return component_size;
+   default:
+      return 4 * component_size;
+   }
+}
 
+/* This is commonly used by most of the accessors. */
 static void *
-get_pointer_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                  GLint x, GLint y)
+get_pointer_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		    GLint x, GLint y)
 {
    if (!rb->Data)
       return NULL;
-   ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   /* Can't assert rb->Format since these funcs may be used for serveral
-    * different formats (GL_ALPHA8, GL_STENCIL_INDEX8, etc).
-    */
-   return (GLubyte *) rb->Data + y * rb->Width + x;
+
+   return ((char *) rb->Data +
+	   (y * rb->RowStride + x) * _mesa_get_format_bytes(rb->Format));
 }
 
+/* GetRow() implementation for formats where DataType matches the rb->Format.
+ */
+static void
+get_row_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		GLuint count, GLint x, GLint y, void *values)
+{
+   void *src = rb->GetPointer(ctx, rb, x, y);
+   memcpy(values, src, count * _mesa_get_format_bytes(rb->Format));
+}
 
+/* Only used for float textures currently, but might also be used for
+ * RGBA8888, RGBA16, etc.
+ */
 static void
-get_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
-              GLint x, GLint y, void *values)
+get_values_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		   GLuint count, const GLint x[], const GLint y[], void *values)
 {
-   const GLubyte *src = (const GLubyte *) rb->Data + y * rb->Width + x;
-   ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   memcpy(values, src, count * sizeof(GLubyte));
+   int format_bytes = _mesa_get_format_bytes(rb->Format) / sizeof(GLfloat);
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const void *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      char *dst = (char *) values + i * format_bytes;
+      memcpy(dst, src, format_bytes);
+   }
+}
+
+/* For the GL_RED/GL_RG/GL_RGB format/DataType combinations (and
+ * GL_LUMINANCE/GL_INTENSITY?), the Put functions are a matter of
+ * storing those initial components of the value per pixel into the
+ * destination.
+ */
+static void
+put_row_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		GLuint count, GLint x, GLint y,
+		const void *values, const GLubyte *mask)
+{
+   void *row = rb->GetPointer(ctx, rb, x, y);
+   int format_bytes = _mesa_get_format_bytes(rb->Format) / sizeof(GLfloat);
+   int datatype_bytes = get_datatype_bytes(rb);
+   unsigned int i;
+
+   if (mask) {
+      for (i = 0; i < count; i++) {
+	 char *dst = (char *) row + i * format_bytes;
+	 const char *src = (const char *) values + i * datatype_bytes;
+
+         if (mask[i]) {
+	    memcpy(dst, src, format_bytes);
+         }
+      }
+   }
+   else {
+      for (i = 0; i < count; i++) {
+	 char *dst = (char *) row + i * format_bytes;
+	 const char *src = (const char *) values + i * datatype_bytes;
+	 memcpy(dst, src, format_bytes);
+      }
+   }
+}
+
+static void
+put_mono_row_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		     GLuint count, GLint x, GLint y,
+		     const void *value, const GLubyte *mask)
+{
+   void *row = rb->GetPointer(ctx, rb, x, y);
+   int format_bytes = _mesa_get_format_bytes(rb->Format) / sizeof(GLfloat);
+   unsigned int i;
+
+   if (mask) {
+      for (i = 0; i < count; i++) {
+	 char *dst = (char *) row + i * format_bytes;
+         if (mask[i]) {
+	    memcpy(dst, value, format_bytes);
+         }
+      }
+   }
+   else {
+      for (i = 0; i < count; i++) {
+	 char *dst = (char *) row + i * format_bytes;
+	 memcpy(dst, value, format_bytes);
+      }
+   }
+}
+
+
+static void
+put_values_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		   GLuint count, const GLint x[], const GLint y[],
+		   const void *values, const GLubyte *mask)
+{
+   int format_bytes = _mesa_get_format_bytes(rb->Format) / sizeof(GLfloat);
+   int datatype_bytes = get_datatype_bytes(rb);
+   unsigned int i;
+
+   for (i = 0; i < count; i++) {
+      if (!mask || mask[i]) {
+	 void *dst = rb->GetPointer(ctx, rb, x[i], y[i]);
+	 const char *src = (const char *) values + i * datatype_bytes;
+	 memcpy(dst, src, format_bytes);
+      }
+   }
+}
+
+
+static void
+put_mono_values_generic(struct gl_context *ctx,
+			struct gl_renderbuffer *rb,
+			GLuint count, const GLint x[], const GLint y[],
+			const void *value, const GLubyte *mask)
+{
+   int format_bytes = _mesa_get_format_bytes(rb->Format) / sizeof(GLfloat);
+   unsigned int i;
+
+   for (i = 0; i < count; i++) {
+      if (!mask || mask[i]) {
+	 void *dst = rb->GetPointer(ctx, rb, x[i], y[i]);
+	 memcpy(dst, value, format_bytes);
+      }
+   }
 }
 
+/**********************************************************************
+ * Functions for buffers of 1 X GLubyte values.
+ * Typically stencil.
+ */
 
 static void
 get_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
@@ -92,7 +239,7 @@ get_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint coun
    GLuint i;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
-      const GLubyte *src = (GLubyte *) rb->Data + y[i] * rb->Width + x[i];
+      const GLubyte *src = (GLubyte *) rb->Data + y[i] * rb->RowStride + x[i];
       dst[i] = *src;
    }
 }
@@ -103,7 +250,7 @@ put_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
               GLint x, GLint y, const void *values, const GLubyte *mask)
 {
    const GLubyte *src = (const GLubyte *) values;
-   GLubyte *dst = (GLubyte *) rb->Data + y * rb->Width + x;
+   GLubyte *dst = (GLubyte *) rb->Data + y * rb->RowStride + x;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    if (mask) {
       GLuint i;
@@ -124,7 +271,7 @@ put_mono_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
                    GLint x, GLint y, const void *value, const GLubyte *mask)
 {
    const GLubyte val = *((const GLubyte *) value);
-   GLubyte *dst = (GLubyte *) rb->Data + y * rb->Width + x;
+   GLubyte *dst = (GLubyte *) rb->Data + y * rb->RowStride + x;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    if (mask) {
       GLuint i;
@@ -153,7 +300,7 @@ put_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint coun
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->Width + x[i];
+         GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->RowStride + x[i];
          *dst = src[i];
       }
    }
@@ -170,7 +317,7 @@ put_mono_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->Width + x[i];
+         GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->RowStride + x[i];
          *dst = val;
       }
    }
@@ -182,28 +329,6 @@ put_mono_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint
  * Typically depth/Z.
  */
 
-static void *
-get_pointer_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                   GLint x, GLint y)
-{
-   if (!rb->Data)
-      return NULL;
-   ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
-   ASSERT(rb->Width > 0);
-   return (GLushort *) rb->Data + y * rb->Width + x;
-}
-
-
-static void
-get_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
-               GLint x, GLint y, void *values)
-{
-   const void *src = rb->GetPointer(ctx, rb, x, y);
-   ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
-   memcpy(values, src, count * sizeof(GLushort));
-}
-
-
 static void
 get_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
                   const GLint x[], const GLint y[], void *values)
@@ -212,7 +337,7 @@ get_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint cou
    GLuint i;
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
    for (i = 0; i < count; i++) {
-      const GLushort *src = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
+      const GLushort *src = (GLushort *) rb->Data + y[i] * rb->RowStride + x[i];
       dst[i] = *src;
    }
 }
@@ -223,7 +348,7 @@ put_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
                GLint x, GLint y, const void *values, const GLubyte *mask)
 {
    const GLushort *src = (const GLushort *) values;
-   GLushort *dst = (GLushort *) rb->Data + y * rb->Width + x;
+   GLushort *dst = (GLushort *) rb->Data + y * rb->RowStride + x;
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
    if (mask) {
       GLuint i;
@@ -244,7 +369,7 @@ put_mono_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint c
                     GLint x, GLint y, const void *value, const GLubyte *mask)
 {
    const GLushort val = *((const GLushort *) value);
-   GLushort *dst = (GLushort *) rb->Data + y * rb->Width + x;
+   GLushort *dst = (GLushort *) rb->Data + y * rb->RowStride + x;
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
    if (mask) {
       GLuint i;
@@ -273,7 +398,7 @@ put_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint cou
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
+         GLushort *dst = (GLushort *) rb->Data + y[i] * rb->RowStride + x[i];
          *dst = src[i];
       }
    }
@@ -291,7 +416,7 @@ put_mono_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
       GLuint i;
       for (i = 0; i < count; i++) {
          if (mask[i]) {
-            GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
+            GLushort *dst = (GLushort *) rb->Data + y[i] * rb->RowStride + x[i];
             *dst = val;
          }
       }
@@ -299,7 +424,7 @@ put_mono_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
    else {
       GLuint i;
       for (i = 0; i < count; i++) {
-         GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i];
+         GLushort *dst = (GLushort *) rb->Data + y[i] * rb->RowStride + x[i];
          *dst = val;
       }
    }
@@ -311,29 +436,6 @@ put_mono_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
  * Typically depth/Z or color index.
  */
 
-static void *
-get_pointer_uint(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                 GLint x, GLint y)
-{
-   if (!rb->Data)
-      return NULL;
-   ASSERT(rb->DataType == GL_UNSIGNED_INT ||
-          rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   return (GLuint *) rb->Data + y * rb->Width + x;
-}
-
-
-static void
-get_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
-             GLint x, GLint y, void *values)
-{
-   const void *src = rb->GetPointer(ctx, rb, x, y);
-   ASSERT(rb->DataType == GL_UNSIGNED_INT ||
-          rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   memcpy(values, src, count * sizeof(GLuint));
-}
-
-
 static void
 get_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
                 const GLint x[], const GLint y[], void *values)
@@ -343,7 +445,7 @@ get_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
    ASSERT(rb->DataType == GL_UNSIGNED_INT ||
           rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    for (i = 0; i < count; i++) {
-      const GLuint *src = (GLuint *) rb->Data + y[i] * rb->Width + x[i];
+      const GLuint *src = (GLuint *) rb->Data + y[i] * rb->RowStride + x[i];
       dst[i] = *src;
    }
 }
@@ -354,7 +456,7 @@ put_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
              GLint x, GLint y, const void *values, const GLubyte *mask)
 {
    const GLuint *src = (const GLuint *) values;
-   GLuint *dst = (GLuint *) rb->Data + y * rb->Width + x;
+   GLuint *dst = (GLuint *) rb->Data + y * rb->RowStride + x;
    ASSERT(rb->DataType == GL_UNSIGNED_INT ||
           rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (mask) {
@@ -376,7 +478,7 @@ put_mono_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint cou
                   GLint x, GLint y, const void *value, const GLubyte *mask)
 {
    const GLuint val = *((const GLuint *) value);
-   GLuint *dst = (GLuint *) rb->Data + y * rb->Width + x;
+   GLuint *dst = (GLuint *) rb->Data + y * rb->RowStride + x;
    ASSERT(rb->DataType == GL_UNSIGNED_INT ||
           rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (mask) {
@@ -407,7 +509,7 @@ put_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
           rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLuint *dst = (GLuint *) rb->Data + y[i] * rb->Width + x[i];
+         GLuint *dst = (GLuint *) rb->Data + y[i] * rb->RowStride + x[i];
          *dst = src[i];
       }
    }
@@ -425,7 +527,7 @@ put_mono_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint
           rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLuint *dst = (GLuint *) rb->Data + y[i] * rb->Width + x[i];
+         GLuint *dst = (GLuint *) rb->Data + y[i] * rb->RowStride + x[i];
          *dst = val;
       }
    }
@@ -455,7 +557,8 @@ static void
 get_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
                GLint x, GLint y, void *values)
 {
-   const GLubyte *src = (const GLubyte *) rb->Data + 3 * (y * rb->Width + x);
+   const GLubyte *src = ((const GLubyte *) rb->Data) +
+					   3 * (y * rb->RowStride + x);
    GLubyte *dst = (GLubyte *) values;
    GLuint i;
    ASSERT(rb->Format == MESA_FORMAT_RGB888);
@@ -479,7 +582,7 @@ get_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint cou
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       const GLubyte *src
-         = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]);
+         = (GLubyte *) rb->Data + 3 * (y[i] * rb->RowStride + x[i]);
       dst[i * 4 + 0] = src[0];
       dst[i * 4 + 1] = src[1];
       dst[i * 4 + 2] = src[2];
@@ -494,7 +597,7 @@ put_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
 {
    /* note: incoming values are RGB+A! */
    const GLubyte *src = (const GLubyte *) values;
-   GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
+   GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->RowStride + x);
    GLuint i;
    ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
@@ -514,7 +617,7 @@ put_row_rgb_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
 {
    /* note: incoming values are RGB+A! */
    const GLubyte *src = (const GLubyte *) values;
-   GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
+   GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->RowStride + x);
    GLuint i;
    ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
@@ -536,7 +639,7 @@ put_mono_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint c
    const GLubyte val0 = ((const GLubyte *) value)[0];
    const GLubyte val1 = ((const GLubyte *) value)[1];
    const GLubyte val2 = ((const GLubyte *) value)[2];
-   GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
+   GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->RowStride + x);
    ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    if (!mask && val0 == val1 && val1 == val2) {
@@ -568,7 +671,7 @@ put_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint cou
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLubyte *dst = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]);
+         GLubyte *dst = (GLubyte *) rb->Data + 3 * (y[i] * rb->RowStride + x[i]);
          dst[0] = src[i * 4 + 0];
          dst[1] = src[i * 4 + 1];
          dst[2] = src[i * 4 + 2];
@@ -591,7 +694,8 @@ put_mono_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb,
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLubyte *dst = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]);
+         GLubyte *dst = ((GLubyte *) rb->Data) +
+				     3 * (y[i] * rb->RowStride + x[i]);
          dst[0] = val0;
          dst[1] = val1;
          dst[2] = val2;
@@ -605,29 +709,6 @@ put_mono_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb,
  * Typically color buffers.
  */
 
-static void *
-get_pointer_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                   GLint x, GLint y)
-{
-   if (!rb->Data)
-      return NULL;
-   ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
-   return (GLubyte *) rb->Data + 4 * (y * rb->Width + x);
-}
-
-
-static void
-get_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
-               GLint x, GLint y, void *values)
-{
-   const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x);
-   ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
-   memcpy(values, src, 4 * count * sizeof(GLubyte));
-}
-
-
 static void
 get_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
                   const GLint x[], const GLint y[], void *values)
@@ -638,7 +719,7 @@ get_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint cou
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    for (i = 0; i < count; i++) {
-      const GLuint *src = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
+      const GLuint *src = (GLuint *) rb->Data + (y[i] * rb->RowStride + x[i]);
       dst[i] = *src;
    }
 }
@@ -650,7 +731,7 @@ put_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
 {
    /* treat 4*GLubyte as 1*GLuint */
    const GLuint *src = (const GLuint *) values;
-   GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x);
+   GLuint *dst = (GLuint *) rb->Data + (y * rb->RowStride + x);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    if (mask) {
@@ -673,7 +754,7 @@ put_row_rgb_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
 {
    /* Store RGB values in RGBA buffer */
    const GLubyte *src = (const GLubyte *) values;
-   GLubyte *dst = (GLubyte *) rb->Data + 4 * (y * rb->Width + x);
+   GLubyte *dst = (GLubyte *) rb->Data + 4 * (y * rb->RowStride + x);
    GLuint i;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
@@ -694,7 +775,7 @@ put_mono_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint c
 {
    /* treat 4*GLubyte as 1*GLuint */
    const GLuint val = *((const GLuint *) value);
-   GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x);
+   GLuint *dst = (GLuint *) rb->Data + (y * rb->RowStride + x);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    if (!mask && val == 0) {
@@ -733,7 +814,7 @@ put_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint cou
    ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
+         GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->RowStride + x[i]);
          *dst = src[i];
       }
    }
@@ -752,7 +833,7 @@ put_mono_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb,
    ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
+         GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->RowStride + x[i]);
          *dst = val;
       }
    }
@@ -764,27 +845,6 @@ put_mono_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb,
  * Typically accum buffer.
  */
 
-static void *
-get_pointer_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                    GLint x, GLint y)
-{
-   if (!rb->Data)
-      return NULL;
-   ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
-   return (GLushort *) rb->Data + 4 * (y * rb->Width + x);
-}
-
-
-static void
-get_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
-                GLint x, GLint y, void *values)
-{
-   const GLshort *src = (const GLshort *) rb->Data + 4 * (y * rb->Width + x);
-   ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
-   memcpy(values, src, 4 * count * sizeof(GLshort));
-}
-
-
 static void
 get_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
                    const GLint x[], const GLint y[], void *values)
@@ -794,7 +854,7 @@ get_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
    for (i = 0; i < count; i++) {
       const GLushort *src
-         = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]);
+         = (GLushort *) rb->Data + 4 * (y[i] * rb->RowStride + x[i]);
       dst[i] = *src;
    }
 }
@@ -805,7 +865,7 @@ put_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
                 GLint x, GLint y, const void *values, const GLubyte *mask)
 {
    const GLushort *src = (const GLushort *) values;
-   GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x);
+   GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->RowStride + x);
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
    if (mask) {
       GLuint i;
@@ -830,7 +890,7 @@ put_row_rgb_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint c
 {
    /* Put RGB values in RGBA buffer */
    const GLushort *src = (const GLushort *) values;
-   GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x);
+   GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->RowStride + x);
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
    if (mask) {
       GLuint i;
@@ -857,7 +917,7 @@ put_mono_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint
    const GLushort val1 = ((const GLushort *) value)[1];
    const GLushort val2 = ((const GLushort *) value)[2];
    const GLushort val3 = ((const GLushort *) value)[3];
-   GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x);
+   GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->RowStride + x);
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
    if (!mask && val0 == 0 && val1 == 0 && val2 == 0 && val3 == 0) {
       /* common case for clearing accum buffer */
@@ -887,7 +947,8 @@ put_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLushort *dst = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]);
+         GLushort *dst =
+            ((GLushort *) rb->Data) + 4 * (y[i] * rb->RowStride + x[i]);
          dst[0] = src[i * 4 + 0];
          dst[1] = src[i * 4 + 1];
          dst[2] = src[i * 4 + 2];
@@ -910,7 +971,8 @@ put_mono_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb,
    ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLushort *dst = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]);
+         GLushort *dst = ((GLushort *) rb->Data) +
+				       4 * (y[i] * rb->RowStride + x[i]);
          dst[0] = val0;
          dst[1] = val1;
          dst[2] = val2;
@@ -919,177 +981,684 @@ put_mono_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb,
    }
 }
 
+/**********************************************************************
+ * Functions for MESA_FORMAT_R8.
+ */
+static void
+get_row_r8(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
+	   GLint x, GLint y, void *values)
+{
+   const GLubyte *src = rb->GetPointer(ctx, rb, x, y);
+   GLuint *dst = values;
+   GLuint i;
 
+   for (i = 0; i < count; i++) {
+      dst[i] = 0xff000000 | src[i];
+   }
+}
 
-/**
- * This is a software fallback for the gl_renderbuffer->AllocStorage
- * function.
- * Device drivers will typically override this function for the buffers
- * which it manages (typically color buffers, Z and stencil).
- * Other buffers (like software accumulation and aux buffers) which the driver
- * doesn't manage can be handled with this function.
- *
- * This one multi-purpose function can allocate stencil, depth, accum, color
- * or color-index buffers!
- *
- * This function also plugs in the appropriate GetPointer, Get/PutRow and
- * Get/PutValues functions.
+static void
+get_values_r8(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
+	      const GLint x[], const GLint y[], void *values)
+{
+   GLuint *dst = (GLuint *) values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLubyte *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i] = 0xff000000 | *src;
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_RG88.
  */
-GLboolean
-_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                                GLenum internalFormat,
-                                GLuint width, GLuint height)
+static void
+get_row_rg88(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
+	     GLint x, GLint y, void *values)
 {
-   GLuint pixelSize;
+   const GLushort *src = rb->GetPointer(ctx, rb, x, y);
+   GLuint *dst = values;
+   GLuint i;
 
-   switch (internalFormat) {
-   case GL_RGB:
-   case GL_R3_G3_B2:
-   case GL_RGB4:
-   case GL_RGB5:
-   case GL_RGB8:
-   case GL_RGB10:
-   case GL_RGB12:
-   case GL_RGB16:
-      rb->Format = MESA_FORMAT_RGB888;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      rb->GetPointer = get_pointer_ubyte3;
-      rb->GetRow = get_row_ubyte3;
-      rb->GetValues = get_values_ubyte3;
-      rb->PutRow = put_row_ubyte3;
-      rb->PutRowRGB = put_row_rgb_ubyte3;
-      rb->PutMonoRow = put_mono_row_ubyte3;
-      rb->PutValues = put_values_ubyte3;
-      rb->PutMonoValues = put_mono_values_ubyte3;
-      pixelSize = 3 * sizeof(GLubyte);
-      break;
-   case GL_RGBA:
-   case GL_RGBA2:
-   case GL_RGBA4:
-   case GL_RGB5_A1:
-   case GL_RGBA8:
-#if 1
-   case GL_RGB10_A2:
-   case GL_RGBA12:
-#endif
-      rb->Format = MESA_FORMAT_RGBA8888;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      rb->GetPointer = get_pointer_ubyte4;
-      rb->GetRow = get_row_ubyte4;
-      rb->GetValues = get_values_ubyte4;
-      rb->PutRow = put_row_ubyte4;
-      rb->PutRowRGB = put_row_rgb_ubyte4;
-      rb->PutMonoRow = put_mono_row_ubyte4;
-      rb->PutValues = put_values_ubyte4;
-      rb->PutMonoValues = put_mono_values_ubyte4;
-      pixelSize = 4 * sizeof(GLubyte);
-      break;
-   case GL_RGBA16:
-   case GL_RGBA16_SNORM:
-      /* for accum buffer */
-      rb->Format = MESA_FORMAT_SIGNED_RGBA_16;
-      rb->DataType = GL_SHORT;
-      rb->GetPointer = get_pointer_ushort4;
-      rb->GetRow = get_row_ushort4;
-      rb->GetValues = get_values_ushort4;
-      rb->PutRow = put_row_ushort4;
-      rb->PutRowRGB = put_row_rgb_ushort4;
-      rb->PutMonoRow = put_mono_row_ushort4;
-      rb->PutValues = put_values_ushort4;
-      rb->PutMonoValues = put_mono_values_ushort4;
-      pixelSize = 4 * sizeof(GLushort);
-      break;
-#if 0
-   case GL_ALPHA8:
-      rb->Format = MESA_FORMAT_A8;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      rb->GetPointer = get_pointer_alpha8;
-      rb->GetRow = get_row_alpha8;
-      rb->GetValues = get_values_alpha8;
-      rb->PutRow = put_row_alpha8;
-      rb->PutRowRGB = NULL;
-      rb->PutMonoRow = put_mono_row_alpha8;
-      rb->PutValues = put_values_alpha8;
-      rb->PutMonoValues = put_mono_values_alpha8;
-      pixelSize = sizeof(GLubyte);
-      break;
-#endif
-   case GL_STENCIL_INDEX:
-   case GL_STENCIL_INDEX1_EXT:
-   case GL_STENCIL_INDEX4_EXT:
-   case GL_STENCIL_INDEX8_EXT:
-   case GL_STENCIL_INDEX16_EXT:
-      rb->Format = MESA_FORMAT_S8;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      rb->GetPointer = get_pointer_ubyte;
-      rb->GetRow = get_row_ubyte;
-      rb->GetValues = get_values_ubyte;
+   for (i = 0; i < count; i++) {
+      dst[i] = 0xff000000 | src[i];
+   }
+}
+
+static void
+get_values_rg88(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		GLuint count, const GLint x[], const GLint y[], void *values)
+{
+   GLuint *dst = (GLuint *) values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLshort *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i] = 0xff000000 | *src;
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_R16.
+ */
+static void
+get_row_r16(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
+	    GLint x, GLint y, void *values)
+{
+   const GLushort *src = rb->GetPointer(ctx, rb, x, y);
+   GLushort *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      dst[i * 4 + RCOMP] = src[i];
+      dst[i * 4 + GCOMP] = 0;
+      dst[i * 4 + BCOMP] = 0;
+      dst[i * 4 + ACOMP] = 0xffff;
+   }
+}
+
+static void
+get_values_r16(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
+	       const GLint x[], const GLint y[], void *values)
+{
+   GLushort *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLushort *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i * 4 + RCOMP] = *src;
+      dst[i * 4 + GCOMP] = 0;
+      dst[i * 4 + BCOMP] = 0;
+      dst[i * 4 + ACOMP] = 0xffff;
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_RG1616.
+ */
+static void
+get_row_rg1616(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
+	       GLint x, GLint y, void *values)
+{
+   const GLushort *src = rb->GetPointer(ctx, rb, x, y);
+   GLushort *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      dst[i * 4 + RCOMP] = src[i * 2];
+      dst[i * 4 + GCOMP] = src[i * 2 + 1];
+      dst[i * 4 + BCOMP] = 0;
+      dst[i * 4 + ACOMP] = 0xffff;
+   }
+}
+
+static void
+get_values_rg1616(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		  GLuint count, const GLint x[], const GLint y[], void *values)
+{
+   GLushort *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLshort *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i * 4 + RCOMP] = src[0];
+      dst[i * 4 + GCOMP] = src[1];
+      dst[i * 4 + BCOMP] = 0;
+      dst[i * 4 + ACOMP] = 0xffff;
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_INTENSITY_FLOAT32.
+ */
+static void
+get_row_i_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		  GLuint count, GLint x, GLint y, void *values)
+{
+   const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      dst[i * 4 + RCOMP] =
+      dst[i * 4 + GCOMP] =
+      dst[i * 4 + BCOMP] =
+      dst[i * 4 + ACOMP] = src[i];
+   }
+}
+
+static void
+get_values_i_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		     GLuint count, const GLint x[], const GLint y[],
+		     void *values)
+{
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLfloat *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i * 4 + RCOMP] =
+      dst[i * 4 + GCOMP] =
+      dst[i * 4 + BCOMP] =
+      dst[i * 4 + ACOMP] = src[0];
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_LUMINANCE_FLOAT32.
+ */
+static void
+get_row_l_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		  GLuint count, GLint x, GLint y, void *values)
+{
+   const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      dst[i * 4 + RCOMP] =
+      dst[i * 4 + GCOMP] =
+      dst[i * 4 + BCOMP] = src[i];
+      dst[i * 4 + ACOMP] = 1.0;
+   }
+}
+
+static void
+get_values_l_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		     GLuint count, const GLint x[], const GLint y[],
+		     void *values)
+{
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLfloat *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i * 4 + RCOMP] =
+      dst[i * 4 + GCOMP] =
+      dst[i * 4 + BCOMP] = src[0];
+      dst[i * 4 + ACOMP] = 1.0;
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_ALPHA_FLOAT32.
+ */
+static void
+get_row_a_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		  GLuint count, GLint x, GLint y, void *values)
+{
+   const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      dst[i * 4 + RCOMP] = 0.0;
+      dst[i * 4 + GCOMP] = 0.0;
+      dst[i * 4 + BCOMP] = 0.0;
+      dst[i * 4 + ACOMP] = src[i];
+   }
+}
+
+static void
+get_values_a_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		     GLuint count, const GLint x[], const GLint y[],
+		     void *values)
+{
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLfloat *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i * 4 + RCOMP] = 0.0;
+      dst[i * 4 + GCOMP] = 0.0;
+      dst[i * 4 + BCOMP] = 0.0;
+      dst[i * 4 + ACOMP] = src[0];
+   }
+}
+
+static void
+put_row_a_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		  GLuint count, GLint x, GLint y,
+		  const void *values, const GLubyte *mask)
+{
+   float *dst = rb->GetPointer(ctx, rb, x, y);
+   const float *src = values;
+   unsigned int i;
+
+   if (mask) {
+      for (i = 0; i < count; i++) {
+         if (mask[i]) {
+	    dst[i] = src[i * 4 + ACOMP];
+         }
+      }
+   }
+   else {
+      for (i = 0; i < count; i++) {
+	 dst[i] = src[i * 4 + ACOMP];
+      }
+   }
+}
+
+static void
+put_mono_row_a_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		       GLuint count, GLint x, GLint y,
+		       const void *value, const GLubyte *mask)
+{
+   float *dst = rb->GetPointer(ctx, rb, x, y);
+   const float *src = value;
+   unsigned int i;
+
+   if (mask) {
+      for (i = 0; i < count; i++) {
+         if (mask[i]) {
+	    dst[i] = src[ACOMP];
+         }
+      }
+   }
+   else {
+      for (i = 0; i < count; i++) {
+	 dst[i] = src[ACOMP];
+      }
+   }
+}
+
+static void
+put_values_a_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		     GLuint count, const GLint x[], const GLint y[],
+		     const void *values, const GLubyte *mask)
+{
+   const float *src = values;
+   unsigned int i;
+
+   for (i = 0; i < count; i++) {
+      if (!mask || mask[i]) {
+	 float *dst = rb->GetPointer(ctx, rb, x[i], y[i]);
+
+	 *dst = src[i * 4 + ACOMP];
+      }
+   }
+}
+
+static void
+put_mono_values_a_float32(struct gl_context *ctx,
+			  struct gl_renderbuffer *rb,
+			  GLuint count, const GLint x[], const GLint y[],
+			  const void *value, const GLubyte *mask)
+{
+   const float *src = value;
+   unsigned int i;
+
+   for (i = 0; i < count; i++) {
+      if (!mask || mask[i]) {
+	 float *dst = rb->GetPointer(ctx, rb, x[i], y[i]);
+	 *dst = src[ACOMP];
+      }
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_R_FLOAT32.
+ */
+static void
+get_row_r_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		  GLuint count, GLint x, GLint y, void *values)
+{
+   const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      dst[i * 4 + RCOMP] = src[i];
+      dst[i * 4 + GCOMP] = 0.0;
+      dst[i * 4 + BCOMP] = 0.0;
+      dst[i * 4 + ACOMP] = 1.0;
+   }
+}
+
+static void
+get_values_r_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		     GLuint count, const GLint x[], const GLint y[],
+		     void *values)
+{
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLfloat *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i * 4 + RCOMP] = src[0];
+      dst[i * 4 + GCOMP] = 0.0;
+      dst[i * 4 + BCOMP] = 0.0;
+      dst[i * 4 + ACOMP] = 1.0;
+   }
+}
+
+/**********************************************************************
+ * Functions for MESA_FORMAT_RG_FLOAT32.
+ */
+static void
+get_row_rg_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		   GLuint count, GLint x, GLint y, void *values)
+{
+   const GLfloat *src = rb->GetPointer(ctx, rb, x, y);
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      dst[i * 4 + RCOMP] = src[i * 2 + 0];
+      dst[i * 4 + GCOMP] = src[i * 2 + 1];
+      dst[i * 4 + BCOMP] = 0.0;
+      dst[i * 4 + ACOMP] = 1.0;
+   }
+}
+
+static void
+get_values_rg_float32(struct gl_context *ctx, struct gl_renderbuffer *rb,
+		      GLuint count, const GLint x[], const GLint y[],
+		      void *values)
+{
+   GLfloat *dst = values;
+   GLuint i;
+
+   for (i = 0; i < count; i++) {
+      const GLfloat *src = rb->GetPointer(ctx, rb, x[i], y[i]);
+      dst[i * 4 + RCOMP] = src[0];
+      dst[i * 4 + GCOMP] = src[1];
+      dst[i * 4 + BCOMP] = 0.0;
+      dst[i * 4 + ACOMP] = 1.0;
+   }
+}
+
+/**
+ * This is the default software fallback for gl_renderbuffer's span
+ * access functions.
+ *
+ * The assumptions are that rb->Data will be a pointer to (0,0), that pixels
+ * are packed in the type of rb->Format, and that subsequent rows appear
+ * rb->RowStride pixels later.
+ */
+void
+_mesa_set_renderbuffer_accessors(struct gl_renderbuffer *rb)
+{
+   rb->GetPointer = get_pointer_generic;
+   rb->GetRow = get_row_generic;
+
+   switch (rb->Format) {
+   case MESA_FORMAT_RGB888:
+      rb->DataType = GL_UNSIGNED_BYTE;
+      rb->GetPointer = get_pointer_ubyte3;
+      rb->GetRow = get_row_ubyte3;
+      rb->GetValues = get_values_ubyte3;
+      rb->PutRow = put_row_ubyte3;
+      rb->PutRowRGB = put_row_rgb_ubyte3;
+      rb->PutMonoRow = put_mono_row_ubyte3;
+      rb->PutValues = put_values_ubyte3;
+      rb->PutMonoValues = put_mono_values_ubyte3;
+      break;
+
+   case MESA_FORMAT_RGBA8888:
+      rb->DataType = GL_UNSIGNED_BYTE;
+      rb->GetValues = get_values_ubyte4;
+      rb->PutRow = put_row_ubyte4;
+      rb->PutRowRGB = put_row_rgb_ubyte4;
+      rb->PutMonoRow = put_mono_row_ubyte4;
+      rb->PutValues = put_values_ubyte4;
+      rb->PutMonoValues = put_mono_values_ubyte4;
+      break;
+
+   case MESA_FORMAT_R8:
+      rb->DataType = GL_UNSIGNED_BYTE;
+      rb->GetValues = get_values_r8;
+      rb->GetRow = get_row_r8;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = put_row_generic;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_RG88:
+      rb->DataType = GL_UNSIGNED_BYTE;
+      rb->GetValues = get_values_rg88;
+      rb->GetRow = get_row_rg88;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = put_row_generic;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_R16:
+      rb->DataType = GL_UNSIGNED_SHORT;
+      rb->GetValues = get_values_r16;
+      rb->GetRow = get_row_r16;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = put_row_generic;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_RG1616:
+      rb->DataType = GL_UNSIGNED_SHORT;
+      rb->GetValues = get_values_rg1616;
+      rb->GetRow = get_row_rg1616;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = put_row_generic;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_SIGNED_RGBA_16:
+      rb->DataType = GL_SHORT;
+      rb->GetValues = get_values_ushort4;
+      rb->PutRow = put_row_ushort4;
+      rb->PutRowRGB = put_row_rgb_ushort4;
+      rb->PutMonoRow = put_mono_row_ushort4;
+      rb->PutValues = put_values_ushort4;
+      rb->PutMonoValues = put_mono_values_ushort4;
+      break;
+
+#if 0
+   case MESA_FORMAT_A8:
+      rb->DataType = GL_UNSIGNED_BYTE;
+      rb->GetValues = get_values_alpha8;
+      rb->PutRow = put_row_alpha8;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_alpha8;
+      rb->PutValues = put_values_alpha8;
+      rb->PutMonoValues = put_mono_values_alpha8;
+      break;
+#endif
+
+   case MESA_FORMAT_S8:
+      rb->DataType = GL_UNSIGNED_BYTE;
+      rb->GetValues = get_values_ubyte;
       rb->PutRow = put_row_ubyte;
       rb->PutRowRGB = NULL;
       rb->PutMonoRow = put_mono_row_ubyte;
       rb->PutValues = put_values_ubyte;
       rb->PutMonoValues = put_mono_values_ubyte;
-      pixelSize = sizeof(GLubyte);
       break;
-   case GL_DEPTH_COMPONENT:
-   case GL_DEPTH_COMPONENT16:
-      rb->Format = MESA_FORMAT_Z16;
+
+   case MESA_FORMAT_Z16:
       rb->DataType = GL_UNSIGNED_SHORT;
-      rb->GetPointer = get_pointer_ushort;
-      rb->GetRow = get_row_ushort;
       rb->GetValues = get_values_ushort;
       rb->PutRow = put_row_ushort;
       rb->PutRowRGB = NULL;
       rb->PutMonoRow = put_mono_row_ushort;
       rb->PutValues = put_values_ushort;
       rb->PutMonoValues = put_mono_values_ushort;
-      pixelSize = sizeof(GLushort);
       break;
-   case GL_DEPTH_COMPONENT24:
+
+   case MESA_FORMAT_Z32:
+   case MESA_FORMAT_X8_Z24:
+   case MESA_FORMAT_Z24_X8:
       rb->DataType = GL_UNSIGNED_INT;
-      rb->GetPointer = get_pointer_uint;
-      rb->GetRow = get_row_uint;
       rb->GetValues = get_values_uint;
       rb->PutRow = put_row_uint;
       rb->PutRowRGB = NULL;
       rb->PutMonoRow = put_mono_row_uint;
       rb->PutValues = put_values_uint;
       rb->PutMonoValues = put_mono_values_uint;
-      rb->Format = MESA_FORMAT_X8_Z24;
-      pixelSize = sizeof(GLuint);
       break;
-   case GL_DEPTH_COMPONENT32:
-      rb->DataType = GL_UNSIGNED_INT;
-      rb->GetPointer = get_pointer_uint;
-      rb->GetRow = get_row_uint;
+
+   case MESA_FORMAT_Z24_S8:
+   case MESA_FORMAT_S8_Z24:
+      rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
       rb->GetValues = get_values_uint;
       rb->PutRow = put_row_uint;
       rb->PutRowRGB = NULL;
       rb->PutMonoRow = put_mono_row_uint;
       rb->PutValues = put_values_uint;
       rb->PutMonoValues = put_mono_values_uint;
+      break;
+
+   case MESA_FORMAT_RGBA_FLOAT32:
+      rb->GetRow = get_row_generic;
+      rb->GetValues = get_values_generic;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_INTENSITY_FLOAT32:
+      rb->GetRow = get_row_i_float32;
+      rb->GetValues = get_values_i_float32;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_LUMINANCE_FLOAT32:
+      rb->GetRow = get_row_l_float32;
+      rb->GetValues = get_values_l_float32;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_ALPHA_FLOAT32:
+      rb->GetRow = get_row_a_float32;
+      rb->GetValues = get_values_a_float32;
+      rb->PutRow = put_row_a_float32;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_a_float32;
+      rb->PutValues = put_values_a_float32;
+      rb->PutMonoValues = put_mono_values_a_float32;
+      break;
+
+   case MESA_FORMAT_RG_FLOAT32:
+      rb->GetRow = get_row_rg_float32;
+      rb->GetValues = get_values_rg_float32;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   case MESA_FORMAT_R_FLOAT32:
+      rb->GetRow = get_row_r_float32;
+      rb->GetValues = get_values_r_float32;
+      rb->PutRow = put_row_generic;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_generic;
+      rb->PutValues = put_values_generic;
+      rb->PutMonoValues = put_mono_values_generic;
+      break;
+
+   default:
+      break;
+   }
+}
+
+/**
+ * This is a software fallback for the gl_renderbuffer->AllocStorage
+ * function.
+ * Device drivers will typically override this function for the buffers
+ * which it manages (typically color buffers, Z and stencil).
+ * Other buffers (like software accumulation and aux buffers) which the driver
+ * doesn't manage can be handled with this function.
+ *
+ * This one multi-purpose function can allocate stencil, depth, accum, color
+ * or color-index buffers!
+ *
+ * This function also plugs in the appropriate GetPointer, Get/PutRow and
+ * Get/PutValues functions.
+ */
+GLboolean
+_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
+                                GLenum internalFormat,
+                                GLuint width, GLuint height)
+{
+   switch (internalFormat) {
+   case GL_RGB:
+   case GL_R3_G3_B2:
+   case GL_RGB4:
+   case GL_RGB5:
+   case GL_RGB8:
+   case GL_RGB10:
+   case GL_RGB12:
+   case GL_RGB16:
+      rb->Format = MESA_FORMAT_RGB888;
+      break;
+   case GL_RGBA:
+   case GL_RGBA2:
+   case GL_RGBA4:
+   case GL_RGB5_A1:
+   case GL_RGBA8:
+#if 1
+   case GL_RGB10_A2:
+   case GL_RGBA12:
+#endif
+      rb->Format = MESA_FORMAT_RGBA8888;
+      break;
+   case GL_RGBA16:
+   case GL_RGBA16_SNORM:
+      /* for accum buffer */
+      rb->Format = MESA_FORMAT_SIGNED_RGBA_16;
+      break;
+#if 0
+   case GL_ALPHA8:
+      rb->Format = MESA_FORMAT_A8;
+      break;
+#endif
+   case GL_STENCIL_INDEX:
+   case GL_STENCIL_INDEX1_EXT:
+   case GL_STENCIL_INDEX4_EXT:
+   case GL_STENCIL_INDEX8_EXT:
+   case GL_STENCIL_INDEX16_EXT:
+      rb->Format = MESA_FORMAT_S8;
+      break;
+   case GL_DEPTH_COMPONENT:
+   case GL_DEPTH_COMPONENT16:
+      rb->Format = MESA_FORMAT_Z16;
+      break;
+   case GL_DEPTH_COMPONENT24:
+      rb->Format = MESA_FORMAT_X8_Z24;
+      break;
+   case GL_DEPTH_COMPONENT32:
       rb->Format = MESA_FORMAT_Z32;
-      pixelSize = sizeof(GLuint);
       break;
    case GL_DEPTH_STENCIL_EXT:
    case GL_DEPTH24_STENCIL8_EXT:
       rb->Format = MESA_FORMAT_Z24_S8;
-      rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
-      rb->GetPointer = get_pointer_uint;
-      rb->GetRow = get_row_uint;
-      rb->GetValues = get_values_uint;
-      rb->PutRow = put_row_uint;
-      rb->PutRowRGB = NULL;
-      rb->PutMonoRow = put_mono_row_uint;
-      rb->PutValues = put_values_uint;
-      rb->PutMonoValues = put_mono_values_uint;
-      pixelSize = sizeof(GLuint);
       break;
    default:
       /* unsupported format */
       return GL_FALSE;
    }
 
+   _mesa_set_renderbuffer_accessors(rb);
+
    ASSERT(rb->DataType);
    ASSERT(rb->GetPointer);
    ASSERT(rb->GetRow);
@@ -1105,16 +1674,19 @@ _mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *
       rb->Data = NULL;
    }
 
+   rb->RowStride = width;
+
    if (width > 0 && height > 0) {
       /* allocate new buffer storage */
-      rb->Data = malloc(width * height * pixelSize);
+      rb->Data = malloc(width * height * _mesa_get_format_bytes(rb->Format));
 
       if (rb->Data == NULL) {
          rb->Width = 0;
          rb->Height = 0;
+	 rb->RowStride = 0;
          _mesa_error(ctx, GL_OUT_OF_MEMORY,
                      "software renderbuffer allocation (%d x %d x %d)",
-                     width, height, pixelSize);
+                     width, height, _mesa_get_format_bytes(rb->Format));
          return GL_FALSE;
       }
    }
@@ -1185,6 +1757,7 @@ alloc_storage_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
 
    arb->Width = width;
    arb->Height = height;
+   arb->RowStride = width;
 
    return GL_TRUE;
 }
@@ -1220,7 +1793,7 @@ get_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count
                GLint x, GLint y, void *values)
 {
    /* NOTE: 'values' is RGBA format! */
-   const GLubyte *src = (const GLubyte *) arb->Data + y * arb->Width + x;
+   const GLubyte *src = (const GLubyte *) arb->Data + y * arb->RowStride + x;
    GLubyte *dst = (GLubyte *) values;
    GLuint i;
    ASSERT(arb != arb->Wrapped);
@@ -1246,7 +1819,7 @@ get_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint co
    arb->Wrapped->GetValues(ctx, arb->Wrapped, count, x, y, values);
    /* second, fill in alpha values from this buffer! */
    for (i = 0; i < count; i++) {
-      const GLubyte *src = (GLubyte *) arb->Data + y[i] * arb->Width + x[i];
+      const GLubyte *src = (GLubyte *) arb->Data + y[i] * arb->RowStride + x[i];
       dst[i * 4 + 3] = *src;
    }
 }
@@ -1257,7 +1830,7 @@ put_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count
                GLint x, GLint y, const void *values, const GLubyte *mask)
 {
    const GLubyte *src = (const GLubyte *) values;
-   GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x;
+   GLubyte *dst = (GLubyte *) arb->Data + y * arb->RowStride + x;
    GLuint i;
    ASSERT(arb != arb->Wrapped);
    ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
@@ -1277,7 +1850,7 @@ put_row_rgb_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint c
                    GLint x, GLint y, const void *values, const GLubyte *mask)
 {
    const GLubyte *src = (const GLubyte *) values;
-   GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x;
+   GLubyte *dst = (GLubyte *) arb->Data + y * arb->RowStride + x;
    GLuint i;
    ASSERT(arb != arb->Wrapped);
    ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
@@ -1297,7 +1870,7 @@ put_mono_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint
                     GLint x, GLint y, const void *value, const GLubyte *mask)
 {
    const GLubyte val = ((const GLubyte *) value)[3];
-   GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x;
+   GLubyte *dst = (GLubyte *) arb->Data + y * arb->RowStride + x;
    ASSERT(arb != arb->Wrapped);
    ASSERT(arb->DataType == GL_UNSIGNED_BYTE);
    /* first, pass the call to the wrapped RGB buffer */
@@ -1331,7 +1904,7 @@ put_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint co
    /* second, store alpha in our buffer */
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->Width + x[i];
+         GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->RowStride + x[i];
          *dst = src[i * 4 + 3];
       }
    }
@@ -1352,7 +1925,7 @@ put_mono_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
    /* second, store alpha in our buffer */
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
-         GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->Width + x[i];
+         GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->RowStride + x[i];
          *dst = val;
       }
    }
@@ -1366,8 +1939,9 @@ copy_buffer_alpha8(struct gl_renderbuffer* dst, struct gl_renderbuffer* src)
    ASSERT(src->Format == MESA_FORMAT_A8);
    ASSERT(dst->Width == src->Width);
    ASSERT(dst->Height == src->Height);
+   ASSERT(dst->RowStride == src->RowStride);
 
-   memcpy(dst->Data, src->Data, dst->Width * dst->Height * sizeof(GLubyte));
+   memcpy(dst->Data, src->Data, dst->RowStride * dst->Height * sizeof(GLubyte));
 }
 
 
@@ -1395,7 +1969,6 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
 {
    _glthread_INIT_MUTEX(rb->Mutex);
 
-   rb->Magic = RB_MAGIC;
    rb->ClassID = 0;
    rb->Name = name;
    rb->RefCount = 0;
@@ -1970,9 +2543,7 @@ _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
       GLboolean deleteFlag = GL_FALSE;
       struct gl_renderbuffer *oldRb = *ptr;
 
-      assert(oldRb->Magic == RB_MAGIC);
       _glthread_LOCK_MUTEX(oldRb->Mutex);
-      assert(oldRb->Magic == RB_MAGIC);
       ASSERT(oldRb->RefCount > 0);
       oldRb->RefCount--;
       /*printf("RB DECR %p (%d) to %d\n", (void*) oldRb, oldRb->Name, oldRb->RefCount);*/
@@ -1980,7 +2551,6 @@ _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
       _glthread_UNLOCK_MUTEX(oldRb->Mutex);
 
       if (deleteFlag) {
-         oldRb->Magic = 0; /* now invalid memory! */
          oldRb->Delete(oldRb);
       }
 
@@ -1989,7 +2559,6 @@ _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
    assert(!*ptr);
 
    if (rb) {
-      assert(rb->Magic == RB_MAGIC);
       /* reference new renderbuffer */
       _glthread_LOCK_MUTEX(rb->Mutex);
       rb->RefCount++;
diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h
index 12a06a58a..39d9b3035 100644
--- a/mesalib/src/mesa/main/renderbuffer.h
+++ b/mesalib/src/mesa/main/renderbuffer.h
@@ -1,113 +1,115 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5
- *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef RENDERBUFFER_H
-#define RENDERBUFFER_H
-
-#include "glheader.h"
-#include "mtypes.h"
-
-struct gl_context;
-struct gl_framebuffer;
-struct gl_renderbuffer;
-
-extern void
-_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name);
-
-extern struct gl_renderbuffer *
-_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name);
-
-extern void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
-
-
-extern struct gl_renderbuffer *
-_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name);
-
-
-extern GLboolean
-_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                                GLenum internalFormat,
-                                GLuint width, GLuint height);
-
-extern GLboolean
-_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
-                              GLuint rgbBits, GLuint alphaBits,
-                              GLboolean frontLeft, GLboolean backLeft,
-                              GLboolean frontRight, GLboolean backRight);
-
-extern GLboolean
-_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
-                              GLuint alphaBits,
-                              GLboolean frontLeft, GLboolean backLeft,
-                              GLboolean frontRight, GLboolean backRight);
-
-extern void
-_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb);
-
-extern GLboolean
-_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
-                             GLuint depthBits);
-
-extern GLboolean
-_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
-                               GLuint stencilBits);
-
-
-extern GLboolean
-_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
-                             GLuint redBits, GLuint greenBits,
-                             GLuint blueBits, GLuint alphaBits);
-
-extern GLboolean
-_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
-                            GLuint bits, GLuint numBuffers);
-
-extern void
-_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
-                             GLboolean color,
-                             GLboolean depth,
-                             GLboolean stencil,
-                             GLboolean accum,
-                             GLboolean alpha,
-                             GLboolean aux);
-
-extern void
-_mesa_add_renderbuffer(struct gl_framebuffer *fb,
-                       gl_buffer_index bufferName, struct gl_renderbuffer *rb);
-
-extern void
-_mesa_remove_renderbuffer(struct gl_framebuffer *fb,
-                          gl_buffer_index bufferName);
-
-extern void
-_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
-                             struct gl_renderbuffer *rb);
-
-extern struct gl_renderbuffer *
-_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name);
-
-
-#endif /* RENDERBUFFER_H */
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5
+ *
+ * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef RENDERBUFFER_H
+#define RENDERBUFFER_H
+
+#include "glheader.h"
+#include "mtypes.h"
+
+struct gl_context;
+struct gl_framebuffer;
+struct gl_renderbuffer;
+
+extern void
+_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name);
+
+extern struct gl_renderbuffer *
+_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name);
+
+extern void
+_mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
+
+
+extern struct gl_renderbuffer *
+_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name);
+
+extern void
+_mesa_set_renderbuffer_accessors(struct gl_renderbuffer *rb);
+
+extern GLboolean
+_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
+                                GLenum internalFormat,
+                                GLuint width, GLuint height);
+
+extern GLboolean
+_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
+                              GLuint rgbBits, GLuint alphaBits,
+                              GLboolean frontLeft, GLboolean backLeft,
+                              GLboolean frontRight, GLboolean backRight);
+
+extern GLboolean
+_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
+                              GLuint alphaBits,
+                              GLboolean frontLeft, GLboolean backLeft,
+                              GLboolean frontRight, GLboolean backRight);
+
+extern void
+_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb);
+
+extern GLboolean
+_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+                             GLuint depthBits);
+
+extern GLboolean
+_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+                               GLuint stencilBits);
+
+
+extern GLboolean
+_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+                             GLuint redBits, GLuint greenBits,
+                             GLuint blueBits, GLuint alphaBits);
+
+extern GLboolean
+_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
+                            GLuint bits, GLuint numBuffers);
+
+extern void
+_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
+                             GLboolean color,
+                             GLboolean depth,
+                             GLboolean stencil,
+                             GLboolean accum,
+                             GLboolean alpha,
+                             GLboolean aux);
+
+extern void
+_mesa_add_renderbuffer(struct gl_framebuffer *fb,
+                       gl_buffer_index bufferName, struct gl_renderbuffer *rb);
+
+extern void
+_mesa_remove_renderbuffer(struct gl_framebuffer *fb,
+                          gl_buffer_index bufferName);
+
+extern void
+_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
+                             struct gl_renderbuffer *rb);
+
+extern struct gl_renderbuffer *
+_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name);
+
+
+#endif /* RENDERBUFFER_H */
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index 2d3879c06..4a28c917c 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/src/mesa/main/samplerobj.c
@@ -481,7 +481,7 @@ set_sampler_min_lod(struct gl_context *ctx, struct gl_sampler_object *samp,
 
 static GLuint
 set_sampler_max_lod(struct gl_context *ctx, struct gl_sampler_object *samp,
-                    GLint param)
+                    GLfloat param)
 {
    if (samp->MaxLod == param)
       return GL_FALSE;
diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h
index ed495c376..a839010b7 100644
--- a/mesalib/src/mesa/main/samplerobj.h
+++ b/mesalib/src/mesa/main/samplerobj.h
@@ -28,6 +28,14 @@
 
 struct dd_function_table;
 
+static INLINE struct gl_sampler_object *
+_mesa_get_samplerobj(struct gl_context *ctx, GLuint unit)
+{
+   if (ctx->Texture.Unit[unit].Sampler)
+      return ctx->Texture.Unit[unit].Sampler;
+   else
+      return &ctx->Texture.Unit[unit]._Current->Sampler;
+}
 
 extern void
 _mesa_reference_sampler_object(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 97b905fd3..cbebec9aa 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -327,36 +327,52 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_ALPHA16F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_ALPHA32F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_LUMINANCE16F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_LUMINANCE32F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_LUMINANCE_ALPHA16F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_LUMINANCE_ALPHA32F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_INTENSITY16F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_INTENSITY32F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_RGB16F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_RGB32F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_RGBA16F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
+	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
 	    break;
          case GL_RGBA32F_ARB:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
@@ -605,7 +621,11 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
       case GL_R8:
       case GL_RED:
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
+	 break;
+
       case GL_COMPRESSED_RED:
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
 	 RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
 	 break;
 
@@ -615,7 +635,11 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
 
       case GL_RG:
       case GL_RG8:
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
+	 break;
+
       case GL_COMPRESSED_RG:
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
 	 RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
 	 break;
 
@@ -631,13 +655,23 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
    if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.ARB_texture_float) {
       switch (internalFormat) {
       case GL_R16F:
-	 return MESA_FORMAT_R_FLOAT16;
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16);
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+	 break;
       case GL_R32F:
-         return MESA_FORMAT_R_FLOAT32;
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+	 break;
       case GL_RG16F:
-	 return MESA_FORMAT_RG_FLOAT16;
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+	 break;
       case GL_RG32F:
-         return MESA_FORMAT_RG_FLOAT32;
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
+	 RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+	 break;
 
       default:
          ; /* fallthrough */
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 0436f09e1..467baa20a 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -1,920 +1,948 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.7
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- * Copyright (c) 2009 VMware, 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * Code for glGetTexImage() and glGetCompressedTexImage().
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "enums.h"
-#include "context.h"
-#include "formats.h"
-#include "image.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-#include "pack.h"
-#include "pbo.h"
-#include "texgetimage.h"
-#include "teximage.h"
-
-
-
-/**
- * Can the given type represent negative values?
- */
-static INLINE GLboolean
-type_with_negative_values(GLenum type)
-{
-   switch (type) {
-   case GL_BYTE:
-   case GL_SHORT:
-   case GL_INT:
-   case GL_FLOAT:
-   case GL_HALF_FLOAT_ARB:
-      return GL_TRUE;
-   default:
-      return GL_FALSE;
-   }
-}
-
-
-/**
- * glGetTexImage for color index pixels.
- */
-static void
-get_tex_color_index(struct gl_context *ctx, GLuint dimensions,
-                    GLenum format, GLenum type, GLvoid *pixels,
-                    const struct gl_texture_image *texImage)
-{
-   const GLint width = texImage->Width;
-   const GLint height = texImage->Height;
-   const GLint depth = texImage->Depth;
-   const GLint rowstride = texImage->RowStride;
-   const GLuint indexBits =
-      _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT);
-   const GLbitfield transferOps = 0x0;
-   GLint img, row, col;
-
-   for (img = 0; img < depth; img++) {
-      for (row = 0; row < height; row++) {
-         GLuint indexRow[MAX_WIDTH] = { 0 };
-         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
-                                          width, height, format, type,
-                                          img, row, 0);
-         assert(dest);
-
-         if (indexBits == 8) {
-            const GLubyte *src = (const GLubyte *) texImage->Data;
-            src += rowstride * (img * height + row);
-            for (col = 0; col < width; col++) {
-               indexRow[col] = src[col];
-            }
-         }
-         else if (indexBits == 16) {
-            const GLushort *src = (const GLushort *) texImage->Data;
-            src += rowstride * (img * height + row);
-            for (col = 0; col < width; col++) {
-               indexRow[col] = src[col];
-            }
-         }
-         else {
-            _mesa_problem(ctx, "Color index problem in _mesa_GetTexImage");
-         }
-         _mesa_pack_index_span(ctx, width, type, dest,
-                               indexRow, &ctx->Pack, transferOps);
-      }
-   }
-}
-
-
-/**
- * glGetTexImage for depth/Z pixels.
- */
-static void
-get_tex_depth(struct gl_context *ctx, GLuint dimensions,
-              GLenum format, GLenum type, GLvoid *pixels,
-              const struct gl_texture_image *texImage)
-{
-   const GLint width = texImage->Width;
-   const GLint height = texImage->Height;
-   const GLint depth = texImage->Depth;
-   GLint img, row, col;
-   GLfloat *depthRow = (GLfloat *) malloc(width * sizeof(GLfloat));
-
-   if (!depthRow) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
-      return;
-   }
-
-   for (img = 0; img < depth; img++) {
-      for (row = 0; row < height; row++) {
-         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
-                                          width, height, format, type,
-                                          img, row, 0);
-         assert(dest);
-
-         for (col = 0; col < width; col++) {
-            texImage->FetchTexelf(texImage, col, row, img, depthRow + col);
-         }
-         _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack);
-      }
-   }
-
-   free(depthRow);
-}
-
-
-/**
- * glGetTexImage for depth/stencil pixels.
- */
-static void
-get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
-                      GLenum format, GLenum type, GLvoid *pixels,
-                      const struct gl_texture_image *texImage)
-{
-   const GLint width = texImage->Width;
-   const GLint height = texImage->Height;
-   const GLint depth = texImage->Depth;
-   const GLint rowstride = texImage->RowStride;
-   const GLuint *src = (const GLuint *) texImage->Data;
-   GLint img, row;
-
-   for (img = 0; img < depth; img++) {
-      for (row = 0; row < height; row++) {
-         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
-                                          width, height, format, type,
-                                          img, row, 0);
-         memcpy(dest, src, width * sizeof(GLuint));
-         if (ctx->Pack.SwapBytes) {
-            _mesa_swap4((GLuint *) dest, width);
-         }
-
-         src += rowstride;
-      }
-   }
-}
-
-
-/**
- * glGetTexImage for YCbCr pixels.
- */
-static void
-get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
-              GLenum format, GLenum type, GLvoid *pixels,
-              const struct gl_texture_image *texImage)
-{
-   const GLint width = texImage->Width;
-   const GLint height = texImage->Height;
-   const GLint depth = texImage->Depth;
-   const GLint rowstride = texImage->RowStride;
-   const GLushort *src = (const GLushort *) texImage->Data;
-   GLint img, row;
-
-   for (img = 0; img < depth; img++) {
-      for (row = 0; row < height; row++) {
-         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
-                                          width, height, format, type,
-                                          img, row, 0);
-         memcpy(dest, src, width * sizeof(GLushort));
-
-         /* check for byte swapping */
-         if ((texImage->TexFormat == MESA_FORMAT_YCBCR
-              && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
-             (texImage->TexFormat == MESA_FORMAT_YCBCR_REV
-              && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
-            if (!ctx->Pack.SwapBytes)
-               _mesa_swap2((GLushort *) dest, width);
-         }
-         else if (ctx->Pack.SwapBytes) {
-            _mesa_swap2((GLushort *) dest, width);
-         }
-
-         src += rowstride;
-      }
-   }
-}
-
-
-#if FEATURE_EXT_texture_sRGB
-
-
-/**
- * Convert a float value from linear space to a
- * non-linear sRGB value in [0, 255].
- * Not terribly efficient.
- */
-static INLINE GLfloat
-linear_to_nonlinear(GLfloat cl)
-{
-   /* can't have values outside [0, 1] */
-   GLfloat cs;
-   if (cl < 0.0031308f) {
-      cs = 12.92f * cl;
-   }
-   else {
-      cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
-   }
-   return cs;
-}
-
-
-/**
- * glGetTexImagefor sRGB pixels;
- */
-static void
-get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
-             GLenum format, GLenum type, GLvoid *pixels,
-             const struct gl_texture_image *texImage)
-{
-   const GLint width = texImage->Width;
-   const GLint height = texImage->Height;
-   const GLint depth = texImage->Depth;
-   const GLbitfield transferOps = 0x0;
-   GLint img, row;
-   GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
-
-   if (!rgba) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
-      return;
-   }
-
-   for (img = 0; img < depth; img++) {
-      for (row = 0; row < height; row++) {
-         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
-                                          width, height, format, type,
-                                          img, row, 0);
-
-         GLint col;
-
-         /* convert row to RGBA format */
-         for (col = 0; col < width; col++) {
-            texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
-            if (texImage->_BaseFormat == GL_LUMINANCE) {
-               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-               rgba[col][GCOMP] = 0.0;
-               rgba[col][BCOMP] = 0.0;
-            }
-            else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
-               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-               rgba[col][GCOMP] = 0.0;
-               rgba[col][BCOMP] = 0.0;
-            }
-            else if (texImage->_BaseFormat == GL_RGB ||
-                     texImage->_BaseFormat == GL_RGBA) {
-               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-               rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
-               rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
-            }
-         }
-         _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
-                                    format, type, dest,
-                                    &ctx->Pack, transferOps);
-      }
-   }
-
-   free(rgba);
-}
-
-
-#else /* FEATURE_EXT_texture_sRGB */
-
-
-static INLINE void
-get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
-             GLenum format, GLenum type, GLvoid *pixels,
-             const struct gl_texture_image *texImage)
-{
-   ASSERT_NO_FEATURE();
-}
-
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
-/**
- * glGetTexImagefor RGBA, Luminance, etc. pixels.
- * This is the slow way since we use texture sampling.
- */
-static void
-get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
-             GLenum format, GLenum type, GLvoid *pixels,
-             const struct gl_texture_image *texImage)
-{
-   const GLint width = texImage->Width;
-   const GLint height = texImage->Height;
-   const GLint depth = texImage->Depth;
-   /* Normally, no pixel transfer ops are performed during glGetTexImage.
-    * The only possible exception is component clamping to [0,1].
-    */
-   GLbitfield transferOps = 0x0;
-   GLint img, row;
-   GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
-
-   if (!rgba) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
-      return;
-   }
-
-   for (img = 0; img < depth; img++) {
-      for (row = 0; row < height; row++) {
-         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
-                                          width, height, format, type,
-                                          img, row, 0);
-         GLint col;
-         GLenum dataType = _mesa_get_format_datatype(texImage->TexFormat);
-
-         /* clamp does not apply to GetTexImage (final conversion)?
-          * Looks like we need clamp though when going from format
-          * containing negative values to unsigned format.
-          */
-         if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) {
-            transferOps |= IMAGE_CLAMP_BIT;
-         }
-         else if (!type_with_negative_values(type) &&
-                  (dataType == GL_FLOAT ||
-                   dataType == GL_SIGNED_NORMALIZED)) {
-            transferOps |= IMAGE_CLAMP_BIT;
-         }
-
-         for (col = 0; col < width; col++) {
-            texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
-            if (texImage->_BaseFormat == GL_ALPHA) {
-               rgba[col][RCOMP] = 0.0F;
-               rgba[col][GCOMP] = 0.0F;
-               rgba[col][BCOMP] = 0.0F;
-            }
-            else if (texImage->_BaseFormat == GL_LUMINANCE) {
-               rgba[col][GCOMP] = 0.0F;
-               rgba[col][BCOMP] = 0.0F;
-               rgba[col][ACOMP] = 1.0F;
-            }
-            else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
-               rgba[col][GCOMP] = 0.0F;
-               rgba[col][BCOMP] = 0.0F;
-            }
-            else if (texImage->_BaseFormat == GL_INTENSITY) {
-               rgba[col][GCOMP] = 0.0F;
-               rgba[col][BCOMP] = 0.0F;
-               rgba[col][ACOMP] = 1.0F;
-            }
-         }
-         _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
-                                    format, type, dest,
-                                    &ctx->Pack, transferOps);
-      }
-   }
-
-   free(rgba);
-}
-
-
-/**
- * Try to do glGetTexImage() with simple memcpy().
- * \return GL_TRUE if done, GL_FALSE otherwise
- */
-static GLboolean
-get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixels,
-               const struct gl_texture_object *texObj,
-               const struct gl_texture_image *texImage)
-{
-   GLboolean memCopy = GL_FALSE;
-
-   /* Texture image should have been mapped already */
-   assert(texImage->Data);
-
-   /*
-    * Check if the src/dst formats are compatible.
-    * Also note that GL's pixel transfer ops don't apply to glGetTexImage()
-    * so we don't have to worry about those.
-    * XXX more format combinations could be supported here.
-    */
-   if ((texObj->Target == GL_TEXTURE_1D ||
-        texObj->Target == GL_TEXTURE_2D ||
-        texObj->Target == GL_TEXTURE_RECTANGLE ||
-        (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
-         texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
-      if (texImage->TexFormat == MESA_FORMAT_ARGB8888 &&
-          format == GL_BGRA &&
-          type == GL_UNSIGNED_BYTE &&
-          !ctx->Pack.SwapBytes &&
-          _mesa_little_endian()) {
-         memCopy = GL_TRUE;
-      }
-      else if (texImage->TexFormat == MESA_FORMAT_AL88 &&
-               format == GL_LUMINANCE_ALPHA &&
-               type == GL_UNSIGNED_BYTE &&
-               !ctx->Pack.SwapBytes &&
-               _mesa_little_endian()) {
-         memCopy = GL_TRUE;
-      }
-      else if (texImage->TexFormat == MESA_FORMAT_L8 &&
-               format == GL_LUMINANCE &&
-               type == GL_UNSIGNED_BYTE) {
-         memCopy = GL_TRUE;
-      }
-      else if (texImage->TexFormat == MESA_FORMAT_L16 &&
-               format == GL_LUMINANCE &&
-               type == GL_UNSIGNED_SHORT) {
-         memCopy = GL_TRUE;
-      }
-      else if (texImage->TexFormat == MESA_FORMAT_A8 &&
-               format == GL_ALPHA &&
-               type == GL_UNSIGNED_BYTE) {
-         memCopy = GL_TRUE;
-      }
-      else if (texImage->TexFormat == MESA_FORMAT_A16 &&
-               format == GL_ALPHA &&
-               type == GL_UNSIGNED_SHORT) {
-         memCopy = GL_TRUE;
-      }
-   }
-
-   if (memCopy) {
-      const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat);
-      const GLuint bytesPerRow = texImage->Width * bpp;
-      GLubyte *dst =
-         _mesa_image_address2d(&ctx->Pack, pixels, texImage->Width,
-                               texImage->Height, format, type, 0, 0);
-      const GLint dstRowStride =
-         _mesa_image_row_stride(&ctx->Pack, texImage->Width, format, type);
-      const GLubyte *src = texImage->Data;
-      const GLint srcRowStride = texImage->RowStride * bpp;
-      GLuint row;
-
-      if (bytesPerRow == dstRowStride && bytesPerRow == srcRowStride) {
-         memcpy(dst, src, bytesPerRow * texImage->Height);
-      }
-      else {
-         for (row = 0; row < texImage->Height; row++) {
-            memcpy(dst, src, bytesPerRow);
-            dst += dstRowStride;
-            src += srcRowStride;
-         }
-      }
-   }
-
-   return memCopy;
-}
-
-
-/**
- * This is the software fallback for Driver.GetTexImage().
- * All error checking will have been done before this routine is called.
- * The texture image must be mapped.
- */
-void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
-                   GLenum format, GLenum type, GLvoid *pixels,
-                   struct gl_texture_object *texObj,
-                   struct gl_texture_image *texImage)
-{
-   GLuint dimensions;
-
-   /* If we get here, the texture image should be mapped */
-   assert(texImage->Data);
-
-   switch (target) {
-   case GL_TEXTURE_1D:
-      dimensions = 1;
-      break;
-   case GL_TEXTURE_3D:
-      dimensions = 3;
-      break;
-   default:
-      dimensions = 2;
-   }
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
-      /* Packing texture image into a PBO.
-       * Map the (potentially) VRAM-based buffer into our process space so
-       * we can write into it with the code below.
-       * A hardware driver might use a sophisticated blit to move the
-       * texture data to the PBO if the PBO is in VRAM along with the texture.
-       */
-      GLubyte *buf = (GLubyte *)
-         ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                               GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
-      if (!buf) {
-         /* out of memory or other unexpected error */
-         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)");
-         return;
-      }
-      /* <pixels> was an offset into the PBO.
-       * Now make it a real, client-side pointer inside the mapped region.
-       */
-      pixels = ADD_POINTERS(buf, pixels);
-   }
-
-   if (get_tex_memcpy(ctx, format, type, pixels, texObj, texImage)) {
-      /* all done */
-   }
-   else if (format == GL_COLOR_INDEX) {
-      get_tex_color_index(ctx, dimensions, format, type, pixels, texImage);
-   }
-   else if (format == GL_DEPTH_COMPONENT) {
-      get_tex_depth(ctx, dimensions, format, type, pixels, texImage);
-   }
-   else if (format == GL_DEPTH_STENCIL_EXT) {
-      get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage);
-   }
-   else if (format == GL_YCBCR_MESA) {
-      get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage);
-   }
-   else if (_mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB) {
-      get_tex_srgb(ctx, dimensions, format, type, pixels, texImage);
-   }
-   else {
-      get_tex_rgba(ctx, dimensions, format, type, pixels, texImage);
-   }
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
-      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                              ctx->Pack.BufferObj);
-   }
-}
-
-
-
-/**
- * This is the software fallback for Driver.GetCompressedTexImage().
- * All error checking will have been done before this routine is called.
- */
-void
-_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
-                              GLvoid *img,
-                              struct gl_texture_object *texObj,
-                              struct gl_texture_image *texImage)
-{
-   const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat,
-                                                     texImage->Width);
-   const GLuint row_stride_stored = _mesa_format_row_stride(texImage->TexFormat,
-                                                            texImage->RowStride);
-   GLuint i;
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
-      /* pack texture image into a PBO */
-      GLubyte *buf = (GLubyte *)
-         ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                               GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
-      if (!buf) {
-         /* out of memory or other unexpected error */
-         _mesa_error(ctx, GL_OUT_OF_MEMORY,
-                     "glGetCompresssedTexImage(map PBO failed)");
-         return;
-      }
-      img = ADD_POINTERS(buf, img);
-   }
-
-   /* no pixelstore or pixel transfer, but respect stride */
-
-   if (row_stride == row_stride_stored) {
-      const GLuint size = _mesa_format_image_size(texImage->TexFormat,
-                                                  texImage->Width,
-                                                  texImage->Height,
-                                                  texImage->Depth);
-      memcpy(img, texImage->Data, size);
-   }
-   else {
-      GLuint bw, bh;
-      _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
-      for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) {
-         memcpy((GLubyte *)img + i * row_stride,
-                (GLubyte *)texImage->Data + i * row_stride_stored,
-                row_stride);
-      }
-   }
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
-      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                              ctx->Pack.BufferObj);
-   }
-}
-
-
-
-/**
- * Do error checking for a glGetTexImage() call.
- * \return GL_TRUE if any error, GL_FALSE if no errors.
- */
-static GLboolean
-getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
-                        GLenum format, GLenum type, GLvoid *pixels )
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
-   GLenum baseFormat;
-
-   if (maxLevels == 0) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target);
-      return GL_TRUE;
-   }
-
-   if (level < 0 || level >= maxLevels) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );
-      return GL_TRUE;
-   }
-
-   if (_mesa_sizeof_packed_type(type) <= 0) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" );
-      return GL_TRUE;
-   }
-
-   if (_mesa_components_in_format(format) <= 0 ||
-       format == GL_STENCIL_INDEX) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" );
-      return GL_TRUE;
-   }
-
-   if (!ctx->Extensions.EXT_paletted_texture && _mesa_is_index_format(format)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
-      return GL_TRUE;
-   }
-
-   if (!ctx->Extensions.ARB_depth_texture && _mesa_is_depth_format(format)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
-      return GL_TRUE;
-   }
-
-   if (!ctx->Extensions.MESA_ycbcr_texture && _mesa_is_ycbcr_format(format)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
-      return GL_TRUE;
-   }
-
-   if (!ctx->Extensions.EXT_packed_depth_stencil
-       && _mesa_is_depthstencil_format(format)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
-      return GL_TRUE;
-   }
-
-   if (!ctx->Extensions.ATI_envmap_bumpmap
-       && _mesa_is_dudv_format(format)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
-      return GL_TRUE;
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   if (!texObj || _mesa_is_proxy_texture(target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");
-      return GL_TRUE;
-   }
-
-   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-   if (!texImage) {
-      /* out of memory */
-      return GL_TRUE;
-   }
-
-   baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
-      
-   /* Make sure the requested image format is compatible with the
-    * texture's format.  Note that a color index texture can be converted
-    * to RGBA so that combo is allowed.
-    */
-   if (_mesa_is_color_format(format)
-       && !_mesa_is_color_format(baseFormat)
-       && !_mesa_is_index_format(baseFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
-      return GL_TRUE;
-   }
-   else if (_mesa_is_index_format(format)
-            && !_mesa_is_index_format(baseFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
-      return GL_TRUE;
-   }
-   else if (_mesa_is_depth_format(format)
-            && !_mesa_is_depth_format(baseFormat)
-            && !_mesa_is_depthstencil_format(baseFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
-      return GL_TRUE;
-   }
-   else if (_mesa_is_ycbcr_format(format)
-            && !_mesa_is_ycbcr_format(baseFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
-      return GL_TRUE;
-   }
-   else if (_mesa_is_depthstencil_format(format)
-            && !_mesa_is_depthstencil_format(baseFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
-      return GL_TRUE;
-   }
-   else if (_mesa_is_dudv_format(format)
-            && !_mesa_is_dudv_format(baseFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
-      return GL_TRUE;
-   }
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
-      /* packing texture image into a PBO */
-      const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;
-      if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width,
-                                     texImage->Height, texImage->Depth,
-                                     format, type, pixels)) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetTexImage(out of bounds PBO write)");
-         return GL_TRUE;
-      }
-
-      /* PBO should not be mapped */
-      if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetTexImage(PBO is mapped)");
-         return GL_TRUE;
-      }
-   }
-
-   return GL_FALSE;
-}
-
-
-
-/**
- * Get texture image.  Called by glGetTexImage.
- *
- * \param target texture target.
- * \param level image level.
- * \param format pixel data format for returned image.
- * \param type pixel data type for returned image.
- * \param pixels returned pixel data.
- */
-void GLAPIENTRY
-_mesa_GetTexImage( GLenum target, GLint level, GLenum format,
-                   GLenum type, GLvoid *pixels )
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (getteximage_error_check(ctx, target, level, format, type, pixels)) {
-      return;
-   }
-
-   if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) {
-      /* not an error, do nothing */
-      return;
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
-      _mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d,"
-                  " dstFmt=0x%x, dstType=0x%x\n",
-                  texObj->Name,
-                  _mesa_get_format_name(texImage->TexFormat),
-                  texImage->Width, texImage->Height,
-                  format, type);
-   }
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels,
-                              texObj, texImage);
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
-
-
-
-/**
- * Do error checking for a glGetCompressedTexImage() call.
- * \return GL_TRUE if any error, GL_FALSE if no errors.
- */
-static GLboolean
-getcompressedteximage_error_check(struct gl_context *ctx, GLenum target,
-                                  GLint level, GLvoid *img)
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
-
-   if (maxLevels == 0) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",
-                  target);
-      return GL_TRUE;
-   }
-
-   if (level < 0 || level >= maxLevels) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glGetCompressedTexImageARB(bad level = %d)", level);
-      return GL_TRUE;
-   }
-
-   if (_mesa_is_proxy_texture(target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM,
-                  "glGetCompressedTexImageARB(bad target = %s)",
-                  _mesa_lookup_enum_by_nr(target));
-      return GL_TRUE;
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-   if (!texObj) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)");
-      return GL_TRUE;
-   }
-
-   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-   if (!texImage) {
-      /* probably invalid mipmap level */
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glGetCompressedTexImageARB(level)");
-      return GL_TRUE;
-   }
-
-   if (!_mesa_is_format_compressed(texImage->TexFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGetCompressedTexImageARB(texture is not compressed)");
-      return GL_TRUE;
-   }
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
-      GLuint compressedSize;
-
-      /* make sure PBO is not mapped */
-      if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetCompressedTexImage(PBO is mapped)");
-         return GL_TRUE;
-      }
-
-      compressedSize = _mesa_format_image_size(texImage->TexFormat,
-                                               texImage->Width,
-                                               texImage->Height,
-                                               texImage->Depth);
-
-      /* do bounds checking on PBO write */
-      if ((const GLubyte *) img + compressedSize >
-          (const GLubyte *) ctx->Pack.BufferObj->Size) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetCompressedTexImage(out of bounds PBO write)");
-         return GL_TRUE;
-      }
-   }
-
-   return GL_FALSE;
-}
-
-
-void GLAPIENTRY
-_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (getcompressedteximage_error_check(ctx, target, level, img)) {
-      return;
-   }
-
-   if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && !img) {
-      /* not an error, do nothing */
-      return;
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
-      _mesa_debug(ctx,
-                  "glGetCompressedTexImage(tex %u) format = %s, w=%d, h=%d\n",
-                  texObj->Name,
-                  _mesa_get_format_name(texImage->TexFormat),
-                  texImage->Width, texImage->Height);
-   }
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      ctx->Driver.GetCompressedTexImage(ctx, target, level, img,
-                                        texObj, texImage);
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2009 VMware, 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * Code for glGetTexImage() and glGetCompressedTexImage().
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "enums.h"
+#include "context.h"
+#include "formats.h"
+#include "image.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+#include "pack.h"
+#include "pbo.h"
+#include "texgetimage.h"
+#include "teximage.h"
+
+
+
+/**
+ * Can the given type represent negative values?
+ */
+static INLINE GLboolean
+type_with_negative_values(GLenum type)
+{
+   switch (type) {
+   case GL_BYTE:
+   case GL_SHORT:
+   case GL_INT:
+   case GL_FLOAT:
+   case GL_HALF_FLOAT_ARB:
+      return GL_TRUE;
+   default:
+      return GL_FALSE;
+   }
+}
+
+
+/**
+ * glGetTexImage for color index pixels.
+ */
+static void
+get_tex_color_index(struct gl_context *ctx, GLuint dimensions,
+                    GLenum format, GLenum type, GLvoid *pixels,
+                    const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLint rowstride = texImage->RowStride;
+   const GLuint indexBits =
+      _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT);
+   const GLbitfield transferOps = 0x0;
+   GLint img, row, col;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         GLuint indexRow[MAX_WIDTH] = { 0 };
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         assert(dest);
+
+         if (indexBits == 8) {
+            const GLubyte *src = (const GLubyte *) texImage->Data;
+            src += rowstride * (img * height + row);
+            for (col = 0; col < width; col++) {
+               indexRow[col] = src[col];
+            }
+         }
+         else if (indexBits == 16) {
+            const GLushort *src = (const GLushort *) texImage->Data;
+            src += rowstride * (img * height + row);
+            for (col = 0; col < width; col++) {
+               indexRow[col] = src[col];
+            }
+         }
+         else {
+            _mesa_problem(ctx, "Color index problem in _mesa_GetTexImage");
+         }
+         _mesa_pack_index_span(ctx, width, type, dest,
+                               indexRow, &ctx->Pack, transferOps);
+      }
+   }
+}
+
+
+/**
+ * glGetTexImage for depth/Z pixels.
+ */
+static void
+get_tex_depth(struct gl_context *ctx, GLuint dimensions,
+              GLenum format, GLenum type, GLvoid *pixels,
+              const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   GLint img, row, col;
+   GLfloat *depthRow = (GLfloat *) malloc(width * sizeof(GLfloat));
+
+   if (!depthRow) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+      return;
+   }
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         assert(dest);
+
+         for (col = 0; col < width; col++) {
+            texImage->FetchTexelf(texImage, col, row, img, depthRow + col);
+         }
+         _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack);
+      }
+   }
+
+   free(depthRow);
+}
+
+
+/**
+ * glGetTexImage for depth/stencil pixels.
+ */
+static void
+get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
+                      GLenum format, GLenum type, GLvoid *pixels,
+                      const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLint rowstride = texImage->RowStride;
+   const GLuint *src = (const GLuint *) texImage->Data;
+   GLint img, row;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         memcpy(dest, src, width * sizeof(GLuint));
+         if (ctx->Pack.SwapBytes) {
+            _mesa_swap4((GLuint *) dest, width);
+         }
+
+         src += rowstride;
+      }
+   }
+}
+
+
+/**
+ * glGetTexImage for YCbCr pixels.
+ */
+static void
+get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
+              GLenum format, GLenum type, GLvoid *pixels,
+              const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLint rowstride = texImage->RowStride;
+   const GLushort *src = (const GLushort *) texImage->Data;
+   GLint img, row;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         memcpy(dest, src, width * sizeof(GLushort));
+
+         /* check for byte swapping */
+         if ((texImage->TexFormat == MESA_FORMAT_YCBCR
+              && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
+             (texImage->TexFormat == MESA_FORMAT_YCBCR_REV
+              && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
+            if (!ctx->Pack.SwapBytes)
+               _mesa_swap2((GLushort *) dest, width);
+         }
+         else if (ctx->Pack.SwapBytes) {
+            _mesa_swap2((GLushort *) dest, width);
+         }
+
+         src += rowstride;
+      }
+   }
+}
+
+
+#if FEATURE_EXT_texture_sRGB
+
+
+/**
+ * Convert a float value from linear space to a
+ * non-linear sRGB value in [0, 255].
+ * Not terribly efficient.
+ */
+static INLINE GLfloat
+linear_to_nonlinear(GLfloat cl)
+{
+   /* can't have values outside [0, 1] */
+   GLfloat cs;
+   if (cl < 0.0031308f) {
+      cs = 12.92f * cl;
+   }
+   else {
+      cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
+   }
+   return cs;
+}
+
+
+/**
+ * glGetTexImagefor sRGB pixels;
+ */
+static void
+get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
+             GLenum format, GLenum type, GLvoid *pixels,
+             const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLbitfield transferOps = 0x0;
+   GLint img, row;
+   GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+
+   if (!rgba) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+      return;
+   }
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+
+         GLint col;
+
+         /* convert row to RGBA format */
+         for (col = 0; col < width; col++) {
+            texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
+            if (texImage->_BaseFormat == GL_LUMINANCE) {
+               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+               rgba[col][GCOMP] = 0.0;
+               rgba[col][BCOMP] = 0.0;
+            }
+            else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+               rgba[col][GCOMP] = 0.0;
+               rgba[col][BCOMP] = 0.0;
+            }
+            else if (texImage->_BaseFormat == GL_RGB ||
+                     texImage->_BaseFormat == GL_RGBA) {
+               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+               rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
+               rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
+            }
+         }
+         _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
+                                    format, type, dest,
+                                    &ctx->Pack, transferOps);
+      }
+   }
+
+   free(rgba);
+}
+
+
+#else /* FEATURE_EXT_texture_sRGB */
+
+
+static INLINE void
+get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
+             GLenum format, GLenum type, GLvoid *pixels,
+             const struct gl_texture_image *texImage)
+{
+   ASSERT_NO_FEATURE();
+}
+
+
+#endif /* FEATURE_EXT_texture_sRGB */
+
+
+/**
+ * glGetTexImagefor RGBA, Luminance, etc. pixels.
+ * This is the slow way since we use texture sampling.
+ */
+static void
+get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
+             GLenum format, GLenum type, GLvoid *pixels,
+             const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   /* Normally, no pixel transfer ops are performed during glGetTexImage.
+    * The only possible exception is component clamping to [0,1].
+    */
+   GLbitfield transferOps = 0x0;
+   GLint img, row;
+   GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+
+   if (!rgba) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+      return;
+   }
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         GLint col;
+         GLenum dataType = _mesa_get_format_datatype(texImage->TexFormat);
+
+         /* clamp does not apply to GetTexImage (final conversion)?
+          * Looks like we need clamp though when going from format
+          * containing negative values to unsigned format.
+          */
+         if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) {
+            transferOps |= IMAGE_CLAMP_BIT;
+         }
+         else if (!type_with_negative_values(type) &&
+                  (dataType == GL_FLOAT ||
+                   dataType == GL_SIGNED_NORMALIZED)) {
+            transferOps |= IMAGE_CLAMP_BIT;
+         }
+
+         for (col = 0; col < width; col++) {
+            texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
+            if (texImage->_BaseFormat == GL_ALPHA) {
+               rgba[col][RCOMP] = 0.0F;
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+            }
+            else if (texImage->_BaseFormat == GL_LUMINANCE) {
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+               rgba[col][ACOMP] = 1.0F;
+            }
+            else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+            }
+            else if (texImage->_BaseFormat == GL_INTENSITY) {
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+               rgba[col][ACOMP] = 1.0F;
+            }
+         }
+         _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
+                                    format, type, dest,
+                                    &ctx->Pack, transferOps);
+      }
+   }
+
+   free(rgba);
+}
+
+
+/**
+ * Try to do glGetTexImage() with simple memcpy().
+ * \return GL_TRUE if done, GL_FALSE otherwise
+ */
+static GLboolean
+get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixels,
+               const struct gl_texture_object *texObj,
+               const struct gl_texture_image *texImage)
+{
+   GLboolean memCopy = GL_FALSE;
+
+   /* Texture image should have been mapped already */
+   assert(texImage->Data);
+
+   /*
+    * Check if the src/dst formats are compatible.
+    * Also note that GL's pixel transfer ops don't apply to glGetTexImage()
+    * so we don't have to worry about those.
+    * XXX more format combinations could be supported here.
+    */
+   if ((texObj->Target == GL_TEXTURE_1D ||
+        texObj->Target == GL_TEXTURE_2D ||
+        texObj->Target == GL_TEXTURE_RECTANGLE ||
+        (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+         texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
+      if (texImage->TexFormat == MESA_FORMAT_ARGB8888 &&
+          format == GL_BGRA &&
+          type == GL_UNSIGNED_BYTE &&
+          !ctx->Pack.SwapBytes &&
+          _mesa_little_endian()) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_AL88 &&
+               format == GL_LUMINANCE_ALPHA &&
+               type == GL_UNSIGNED_BYTE &&
+               !ctx->Pack.SwapBytes &&
+               _mesa_little_endian()) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_L8 &&
+               format == GL_LUMINANCE &&
+               type == GL_UNSIGNED_BYTE) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_L16 &&
+               format == GL_LUMINANCE &&
+               type == GL_UNSIGNED_SHORT) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_A8 &&
+               format == GL_ALPHA &&
+               type == GL_UNSIGNED_BYTE) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_A16 &&
+               format == GL_ALPHA &&
+               type == GL_UNSIGNED_SHORT) {
+         memCopy = GL_TRUE;
+      }
+   }
+
+   if (memCopy) {
+      const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat);
+      const GLuint bytesPerRow = texImage->Width * bpp;
+      GLubyte *dst =
+         _mesa_image_address2d(&ctx->Pack, pixels, texImage->Width,
+                               texImage->Height, format, type, 0, 0);
+      const GLint dstRowStride =
+         _mesa_image_row_stride(&ctx->Pack, texImage->Width, format, type);
+      const GLubyte *src = texImage->Data;
+      const GLint srcRowStride = texImage->RowStride * bpp;
+      GLuint row;
+
+      if (bytesPerRow == dstRowStride && bytesPerRow == srcRowStride) {
+         memcpy(dst, src, bytesPerRow * texImage->Height);
+      }
+      else {
+         for (row = 0; row < texImage->Height; row++) {
+            memcpy(dst, src, bytesPerRow);
+            dst += dstRowStride;
+            src += srcRowStride;
+         }
+      }
+   }
+
+   return memCopy;
+}
+
+
+/**
+ * This is the software fallback for Driver.GetTexImage().
+ * All error checking will have been done before this routine is called.
+ * The texture image must be mapped.
+ */
+void
+_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
+                   GLenum format, GLenum type, GLvoid *pixels,
+                   struct gl_texture_object *texObj,
+                   struct gl_texture_image *texImage)
+{
+   GLuint dimensions;
+
+   /* If we get here, the texture image should be mapped */
+   assert(texImage->Data);
+
+   switch (target) {
+   case GL_TEXTURE_1D:
+      dimensions = 1;
+      break;
+   case GL_TEXTURE_3D:
+      dimensions = 3;
+      break;
+   default:
+      dimensions = 2;
+   }
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+      /* Packing texture image into a PBO.
+       * Map the (potentially) VRAM-based buffer into our process space so
+       * we can write into it with the code below.
+       * A hardware driver might use a sophisticated blit to move the
+       * texture data to the PBO if the PBO is in VRAM along with the texture.
+       */
+      GLubyte *buf = (GLubyte *)
+         ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                               GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
+      if (!buf) {
+         /* out of memory or other unexpected error */
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)");
+         return;
+      }
+      /* <pixels> was an offset into the PBO.
+       * Now make it a real, client-side pointer inside the mapped region.
+       */
+      pixels = ADD_POINTERS(buf, pixels);
+   }
+
+   if (get_tex_memcpy(ctx, format, type, pixels, texObj, texImage)) {
+      /* all done */
+   }
+   else if (format == GL_COLOR_INDEX) {
+      get_tex_color_index(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (format == GL_DEPTH_COMPONENT) {
+      get_tex_depth(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (format == GL_DEPTH_STENCIL_EXT) {
+      get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (format == GL_YCBCR_MESA) {
+      get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (_mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB) {
+      get_tex_srgb(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else {
+      get_tex_rgba(ctx, dimensions, format, type, pixels, texImage);
+   }
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                              ctx->Pack.BufferObj);
+   }
+}
+
+
+
+/**
+ * This is the software fallback for Driver.GetCompressedTexImage().
+ * All error checking will have been done before this routine is called.
+ */
+void
+_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
+                              GLvoid *img,
+                              struct gl_texture_object *texObj,
+                              struct gl_texture_image *texImage)
+{
+   const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat,
+                                                     texImage->Width);
+   const GLuint row_stride_stored = _mesa_format_row_stride(texImage->TexFormat,
+                                                            texImage->RowStride);
+   GLuint i;
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+      /* pack texture image into a PBO */
+      GLubyte *buf = (GLubyte *)
+         ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                               GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
+      if (!buf) {
+         /* out of memory or other unexpected error */
+         _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                     "glGetCompresssedTexImage(map PBO failed)");
+         return;
+      }
+      img = ADD_POINTERS(buf, img);
+   }
+
+   /* no pixelstore or pixel transfer, but respect stride */
+
+   if (row_stride == row_stride_stored) {
+      const GLuint size = _mesa_format_image_size(texImage->TexFormat,
+                                                  texImage->Width,
+                                                  texImage->Height,
+                                                  texImage->Depth);
+      memcpy(img, texImage->Data, size);
+   }
+   else {
+      GLuint bw, bh;
+      _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
+      for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) {
+         memcpy((GLubyte *)img + i * row_stride,
+                (GLubyte *)texImage->Data + i * row_stride_stored,
+                row_stride);
+      }
+   }
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                              ctx->Pack.BufferObj);
+   }
+}
+
+
+
+/**
+ * Do error checking for a glGetTexImage() call.
+ * \return GL_TRUE if any error, GL_FALSE if no errors.
+ */
+static GLboolean
+getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
+                        GLenum format, GLenum type, GLsizei clientMemSize,
+                        GLvoid *pixels )
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
+   const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;
+   GLenum baseFormat;
+
+   if (maxLevels == 0) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target);
+      return GL_TRUE;
+   }
+
+   if (level < 0 || level >= maxLevels) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );
+      return GL_TRUE;
+   }
+
+   if (_mesa_sizeof_packed_type(type) <= 0) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" );
+      return GL_TRUE;
+   }
+
+   if (_mesa_components_in_format(format) <= 0 ||
+       format == GL_STENCIL_INDEX) {
+      _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" );
+      return GL_TRUE;
+   }
+
+   if (!ctx->Extensions.EXT_paletted_texture && _mesa_is_index_format(format)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+      return GL_TRUE;
+   }
+
+   if (!ctx->Extensions.ARB_depth_texture && _mesa_is_depth_format(format)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+      return GL_TRUE;
+   }
+
+   if (!ctx->Extensions.MESA_ycbcr_texture && _mesa_is_ycbcr_format(format)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+      return GL_TRUE;
+   }
+
+   if (!ctx->Extensions.EXT_packed_depth_stencil
+       && _mesa_is_depthstencil_format(format)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+      return GL_TRUE;
+   }
+
+   if (!ctx->Extensions.ATI_envmap_bumpmap
+       && _mesa_is_dudv_format(format)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
+      return GL_TRUE;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
+   if (!texObj || _mesa_is_proxy_texture(target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");
+      return GL_TRUE;
+   }
+
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+   if (!texImage) {
+      /* out of memory */
+      return GL_TRUE;
+   }
+
+   baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
+      
+   /* Make sure the requested image format is compatible with the
+    * texture's format.  Note that a color index texture can be converted
+    * to RGBA so that combo is allowed.
+    */
+   if (_mesa_is_color_format(format)
+       && !_mesa_is_color_format(baseFormat)
+       && !_mesa_is_index_format(baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+      return GL_TRUE;
+   }
+   else if (_mesa_is_index_format(format)
+            && !_mesa_is_index_format(baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+      return GL_TRUE;
+   }
+   else if (_mesa_is_depth_format(format)
+            && !_mesa_is_depth_format(baseFormat)
+            && !_mesa_is_depthstencil_format(baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+      return GL_TRUE;
+   }
+   else if (_mesa_is_ycbcr_format(format)
+            && !_mesa_is_ycbcr_format(baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+      return GL_TRUE;
+   }
+   else if (_mesa_is_depthstencil_format(format)
+            && !_mesa_is_depthstencil_format(baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+      return GL_TRUE;
+   }
+   else if (_mesa_is_dudv_format(format)
+            && !_mesa_is_dudv_format(baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+      return GL_TRUE;
+   }
+
+   if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width,
+                                  texImage->Height, texImage->Depth,
+                                  format, type, clientMemSize, pixels)) {
+      if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetTexImage(out of bounds PBO access)");
+      } else {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetnTexImageARB(out of bounds access:"
+                     " bufSize (%d) is too small)", clientMemSize);
+      }
+      return GL_TRUE;
+   }
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+      /* PBO should not be mapped */
+      if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetTexImage(PBO is mapped)");
+         return GL_TRUE;
+      }
+   }
+
+   return GL_FALSE;
+}
+
+
+
+/**
+ * Get texture image.  Called by glGetTexImage.
+ *
+ * \param target texture target.
+ * \param level image level.
+ * \param format pixel data format for returned image.
+ * \param type pixel data type for returned image.
+ * \param bufSize size of the pixels data buffer.
+ * \param pixels returned pixel data.
+ */
+void GLAPIENTRY
+_mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,
+                       GLenum type, GLsizei bufSize, GLvoid *pixels )
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (getteximage_error_check(ctx, target, level, format, type,
+                               bufSize, pixels)) {
+      return;
+   }
+
+   if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) {
+      /* not an error, do nothing */
+      return;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
+      _mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d,"
+                  " dstFmt=0x%x, dstType=0x%x\n",
+                  texObj->Name,
+                  _mesa_get_format_name(texImage->TexFormat),
+                  texImage->Width, texImage->Height,
+                  format, type);
+   }
+
+   _mesa_lock_texture(ctx, texObj);
+   {
+      ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels,
+                              texObj, texImage);
+   }
+   _mesa_unlock_texture(ctx, texObj);
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexImage( GLenum target, GLint level, GLenum format,
+                   GLenum type, GLvoid *pixels )
+{
+   _mesa_GetnTexImageARB(target, level, format, type, INT_MAX, pixels);
+}
+
+
+/**
+ * Do error checking for a glGetCompressedTexImage() call.
+ * \return GL_TRUE if any error, GL_FALSE if no errors.
+ */
+static GLboolean
+getcompressedteximage_error_check(struct gl_context *ctx, GLenum target,
+                                  GLint level, GLsizei clientMemSize, GLvoid *img)
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
+   GLuint compressedSize;
+
+   if (maxLevels == 0) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",
+                  target);
+      return GL_TRUE;
+   }
+
+   if (level < 0 || level >= maxLevels) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glGetCompressedTexImageARB(bad level = %d)", level);
+      return GL_TRUE;
+   }
+
+   if (_mesa_is_proxy_texture(target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM,
+                  "glGetCompressedTexImageARB(bad target = %s)",
+                  _mesa_lookup_enum_by_nr(target));
+      return GL_TRUE;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   if (!texObj) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)");
+      return GL_TRUE;
+   }
+
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+   if (!texImage) {
+      /* probably invalid mipmap level */
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glGetCompressedTexImageARB(level)");
+      return GL_TRUE;
+   }
+
+   if (!_mesa_is_format_compressed(texImage->TexFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glGetCompressedTexImageARB(texture is not compressed)");
+      return GL_TRUE;
+   }
+
+   compressedSize = _mesa_format_image_size(texImage->TexFormat,
+                                            texImage->Width,
+                                            texImage->Height,
+                                            texImage->Depth);
+
+   if (!_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+      /* do bounds checking on writing to client memory */
+      if (clientMemSize < compressedSize) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetnCompressedTexImageARB(out of bounds access:"
+                     " bufSize (%d) is too small)", clientMemSize);
+      }
+   } else {
+      /* do bounds checking on PBO write */
+      if ((const GLubyte *) img + compressedSize >
+          (const GLubyte *) ctx->Pack.BufferObj->Size) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetCompressedTexImage(out of bounds PBO access)");
+         return GL_TRUE;
+      }
+
+      /* make sure PBO is not mapped */
+      if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetCompressedTexImage(PBO is mapped)");
+         return GL_TRUE;
+      }
+   }
+
+   return GL_FALSE;
+}
+
+
+void GLAPIENTRY
+_mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize,
+                                GLvoid *img)
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (getcompressedteximage_error_check(ctx, target, level, bufSize, img)) {
+      return;
+   }
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && !img) {
+      /* not an error, do nothing */
+      return;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
+      _mesa_debug(ctx,
+                  "glGetCompressedTexImage(tex %u) format = %s, w=%d, h=%d\n",
+                  texObj->Name,
+                  _mesa_get_format_name(texImage->TexFormat),
+                  texImage->Width, texImage->Height);
+   }
+
+   _mesa_lock_texture(ctx, texObj);
+   {
+      ctx->Driver.GetCompressedTexImage(ctx, target, level, img,
+                                        texObj, texImage);
+   }
+   _mesa_unlock_texture(ctx, texObj);
+}
+
+void GLAPIENTRY
+_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
+{
+   _mesa_GetnCompressedTexImageARB(target, level, INT_MAX, img);
+}
diff --git a/mesalib/src/mesa/main/texgetimage.h b/mesalib/src/mesa/main/texgetimage.h
index d5a1ffcf5..8612705ca 100644
--- a/mesalib/src/mesa/main/texgetimage.h
+++ b/mesalib/src/mesa/main/texgetimage.h
@@ -1,60 +1,65 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.5
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- * Copyright (c) 2009 VMware, 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef TEXGETIMAGE_H
-#define TEXGETIMAGE_H
-
-#include "glheader.h"
-
-struct gl_context;
-struct gl_texture_image;
-struct gl_texture_object;
-
-extern void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
-                   GLenum format, GLenum type, GLvoid *pixels,
-                   struct gl_texture_object *texObj,
-                   struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
-                              GLvoid *img,
-                              struct gl_texture_object *texObj,
-                              struct gl_texture_image *texImage);
-
-
-
-extern void GLAPIENTRY
-_mesa_GetTexImage( GLenum target, GLint level,
-                   GLenum format, GLenum type, GLvoid *pixels );
-
-
-extern void GLAPIENTRY
-_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img);
-
-
-#endif /* TEXGETIMAGE_H */
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2009 VMware, 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXGETIMAGE_H
+#define TEXGETIMAGE_H
+
+#include "glheader.h"
+
+struct gl_context;
+struct gl_texture_image;
+struct gl_texture_object;
+
+extern void
+_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
+                   GLenum format, GLenum type, GLvoid *pixels,
+                   struct gl_texture_object *texObj,
+                   struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
+                              GLvoid *img,
+                              struct gl_texture_object *texObj,
+                              struct gl_texture_image *texImage);
+
+
+
+extern void GLAPIENTRY
+_mesa_GetTexImage( GLenum target, GLint level,
+                   GLenum format, GLenum type, GLvoid *pixels );
+extern void GLAPIENTRY
+_mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,
+                       GLenum type, GLsizei bufSize, GLvoid *pixels );
+
+extern void GLAPIENTRY
+_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img);
+
+extern void GLAPIENTRY
+_mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize,
+                                GLvoid *img);
+
+#endif /* TEXGETIMAGE_H */
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index a2df4e36e..8fb54c693 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1,3831 +1,3849 @@
-/*
- * mesa 3-D graphics library
- * Version:  7.6
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file teximage.c
- * Texture image-related functions.
- */
-
-
-#include "glheader.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "enums.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "hash.h"
-#include "image.h"
-#include "imports.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "state.h"
-#include "texcompress.h"
-#include "texfetch.h"
-#include "teximage.h"
-#include "texstate.h"
-#include "texpal.h"
-#include "mtypes.h"
-
-
-/**
- * State changes which we care about for glCopyTex[Sub]Image() calls.
- * In particular, we care about pixel transfer state and buffer state
- * (such as glReadBuffer to make sure we read from the right renderbuffer).
- */
-#define NEW_COPY_TEX_STATE (_NEW_BUFFERS | _NEW_PIXEL)
-
-
-
-/**
- * We allocate texture memory on 512-byte boundaries so we can use MMX/SSE
- * elsewhere.
- */
-void *
-_mesa_alloc_texmemory(GLsizei bytes)
-{
-   return _mesa_align_malloc(bytes, 512);
-}
-
-
-/**
- * Free texture memory allocated with _mesa_alloc_texmemory()
- */
-void
-_mesa_free_texmemory(void *m)
-{
-   _mesa_align_free(m);
-}
-
-
-/*
- * Compute floor(log_base_2(n)).
- * If n < 0 return -1.
- */
-static int
-logbase2( int n )
-{
-   GLint i = 1;
-   GLint log2 = 0;
-
-   if (n < 0)
-      return -1;
-
-   if (n == 0)
-      return 0;
-
-   while ( n > i ) {
-      i *= 2;
-      log2++;
-   }
-   if (i != n) {
-      return log2 - 1;
-   }
-   else {
-      return log2;
-   }
-}
-
-
-
-/**
- * Return the simple base format for a given internal texture format.
- * For example, given GL_LUMINANCE12_ALPHA4, return GL_LUMINANCE_ALPHA.
- *
- * \param ctx GL context.
- * \param internalFormat the internal texture format token or 1, 2, 3, or 4.
- *
- * \return the corresponding \u base internal format (GL_ALPHA, GL_LUMINANCE,
- * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA), or -1 if invalid enum.
- *
- * This is the format which is used during texture application (i.e. the
- * texture format and env mode determine the arithmetic used.
- *
- * XXX this could be static
- */
-GLint
-_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
-{
-   switch (internalFormat) {
-      case GL_ALPHA:
-      case GL_ALPHA4:
-      case GL_ALPHA8:
-      case GL_ALPHA12:
-      case GL_ALPHA16:
-         return GL_ALPHA;
-      case 1:
-      case GL_LUMINANCE:
-      case GL_LUMINANCE4:
-      case GL_LUMINANCE8:
-      case GL_LUMINANCE12:
-      case GL_LUMINANCE16:
-         return GL_LUMINANCE;
-      case 2:
-      case GL_LUMINANCE_ALPHA:
-      case GL_LUMINANCE4_ALPHA4:
-      case GL_LUMINANCE6_ALPHA2:
-      case GL_LUMINANCE8_ALPHA8:
-      case GL_LUMINANCE12_ALPHA4:
-      case GL_LUMINANCE12_ALPHA12:
-      case GL_LUMINANCE16_ALPHA16:
-         return GL_LUMINANCE_ALPHA;
-      case GL_INTENSITY:
-      case GL_INTENSITY4:
-      case GL_INTENSITY8:
-      case GL_INTENSITY12:
-      case GL_INTENSITY16:
-         return GL_INTENSITY;
-      case 3:
-      case GL_RGB:
-      case GL_R3_G3_B2:
-      case GL_RGB4:
-      case GL_RGB5:
-      case GL_RGB8:
-      case GL_RGB10:
-      case GL_RGB12:
-      case GL_RGB16:
-         return GL_RGB;
-      case 4:
-      case GL_RGBA:
-      case GL_RGBA2:
-      case GL_RGBA4:
-      case GL_RGB5_A1:
-      case GL_RGBA8:
-      case GL_RGB10_A2:
-      case GL_RGBA12:
-      case GL_RGBA16:
-         return GL_RGBA;
-      default:
-         ; /* fallthrough */
-   }
-
-   if (ctx->Extensions.EXT_texture_format_BGRA8888) {
-      switch (internalFormat) {
-         case GL_BGRA_EXT:
-            return GL_RGBA;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.EXT_paletted_texture) {
-      switch (internalFormat) {
-         case GL_COLOR_INDEX:
-         case GL_COLOR_INDEX1_EXT:
-         case GL_COLOR_INDEX2_EXT:
-         case GL_COLOR_INDEX4_EXT:
-         case GL_COLOR_INDEX8_EXT:
-         case GL_COLOR_INDEX12_EXT:
-         case GL_COLOR_INDEX16_EXT:
-            return GL_COLOR_INDEX;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.ARB_depth_texture) {
-      switch (internalFormat) {
-         case GL_DEPTH_COMPONENT:
-         case GL_DEPTH_COMPONENT16:
-         case GL_DEPTH_COMPONENT24:
-         case GL_DEPTH_COMPONENT32:
-            return GL_DEPTH_COMPONENT;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   switch (internalFormat) {
-   case GL_COMPRESSED_ALPHA:
-      return GL_ALPHA;
-   case GL_COMPRESSED_LUMINANCE:
-      return GL_LUMINANCE;
-   case GL_COMPRESSED_LUMINANCE_ALPHA:
-      return GL_LUMINANCE_ALPHA;
-   case GL_COMPRESSED_INTENSITY:
-      return GL_INTENSITY;
-   case GL_COMPRESSED_RGB:
-      return GL_RGB;
-   case GL_COMPRESSED_RGBA:
-      return GL_RGBA;
-   default:
-      ; /* fallthrough */
-   }
-         
-   if (ctx->Extensions.TDFX_texture_compression_FXT1) {
-      switch (internalFormat) {
-         case GL_COMPRESSED_RGB_FXT1_3DFX:
-            return GL_RGB;
-         case GL_COMPRESSED_RGBA_FXT1_3DFX:
-            return GL_RGBA;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.EXT_texture_compression_s3tc) {
-      switch (internalFormat) {
-         case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-            return GL_RGB;
-         case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-         case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-         case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-            return GL_RGBA;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.S3_s3tc) {
-      switch (internalFormat) {
-         case GL_RGB_S3TC:
-         case GL_RGB4_S3TC:
-            return GL_RGB;
-         case GL_RGBA_S3TC:
-         case GL_RGBA4_S3TC:
-            return GL_RGBA;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.MESA_ycbcr_texture) {
-      if (internalFormat == GL_YCBCR_MESA)
-         return GL_YCBCR_MESA;
-   }
-
-   if (ctx->Extensions.ARB_texture_float) {
-      switch (internalFormat) {
-         case GL_ALPHA16F_ARB:
-         case GL_ALPHA32F_ARB:
-            return GL_ALPHA;
-         case GL_RGBA16F_ARB:
-         case GL_RGBA32F_ARB:
-            return GL_RGBA;
-         case GL_RGB16F_ARB:
-         case GL_RGB32F_ARB:
-            return GL_RGB;
-         case GL_INTENSITY16F_ARB:
-         case GL_INTENSITY32F_ARB:
-            return GL_INTENSITY;
-         case GL_LUMINANCE16F_ARB:
-         case GL_LUMINANCE32F_ARB:
-            return GL_LUMINANCE;
-         case GL_LUMINANCE_ALPHA16F_ARB:
-         case GL_LUMINANCE_ALPHA32F_ARB:
-            return GL_LUMINANCE_ALPHA;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.ATI_envmap_bumpmap) {
-      switch (internalFormat) {
-         case GL_DUDV_ATI:
-         case GL_DU8DV8_ATI:
-            return GL_DUDV_ATI;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.EXT_texture_snorm) {
-      switch (internalFormat) {
-         case GL_RED_SNORM:
-         case GL_R8_SNORM:
-         case GL_R16_SNORM:
-            return GL_RED;
-         case GL_RG_SNORM:
-         case GL_RG8_SNORM:
-         case GL_RG16_SNORM:
-            return GL_RG;
-         case GL_RGB_SNORM:
-         case GL_RGB8_SNORM:
-         case GL_RGB16_SNORM:
-            return GL_RGB;
-         case GL_RGBA_SNORM:
-         case GL_RGBA8_SNORM:
-         case GL_RGBA16_SNORM:
-            return GL_RGBA;
-         case GL_ALPHA_SNORM:
-         case GL_ALPHA8_SNORM:
-         case GL_ALPHA16_SNORM:
-            return GL_ALPHA;
-         case GL_LUMINANCE_SNORM:
-         case GL_LUMINANCE8_SNORM:
-         case GL_LUMINANCE16_SNORM:
-            return GL_LUMINANCE;
-         case GL_LUMINANCE_ALPHA_SNORM:
-         case GL_LUMINANCE8_ALPHA8_SNORM:
-         case GL_LUMINANCE16_ALPHA16_SNORM:
-            return GL_LUMINANCE_ALPHA;
-         case GL_INTENSITY_SNORM:
-         case GL_INTENSITY8_SNORM:
-         case GL_INTENSITY16_SNORM:
-            return GL_INTENSITY;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.EXT_packed_depth_stencil) {
-      switch (internalFormat) {
-         case GL_DEPTH_STENCIL_EXT:
-         case GL_DEPTH24_STENCIL8_EXT:
-            return GL_DEPTH_STENCIL_EXT;
-         default:
-            ; /* fallthrough */
-      }
-   }
-
-#if FEATURE_EXT_texture_sRGB
-   if (ctx->Extensions.EXT_texture_sRGB) {
-      switch (internalFormat) {
-      case GL_SRGB_EXT:
-      case GL_SRGB8_EXT:
-      case GL_COMPRESSED_SRGB_EXT:
-      case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
-         return GL_RGB;
-      case GL_SRGB_ALPHA_EXT:
-      case GL_SRGB8_ALPHA8_EXT:
-      case GL_COMPRESSED_SRGB_ALPHA_EXT:
-      case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-      case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-      case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-         return GL_RGBA;
-      case GL_SLUMINANCE_ALPHA_EXT:
-      case GL_SLUMINANCE8_ALPHA8_EXT:
-      case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
-         return GL_LUMINANCE_ALPHA;
-      case GL_SLUMINANCE_EXT:
-      case GL_SLUMINANCE8_EXT:
-      case GL_COMPRESSED_SLUMINANCE_EXT:
-         return GL_LUMINANCE;
-      default:
-         ; /* fallthrough */
-      }
-   }
-#endif /* FEATURE_EXT_texture_sRGB */
-
-   if (ctx->Extensions.EXT_texture_integer) {
-      switch (internalFormat) {
-      case GL_RGBA8UI_EXT:
-      case GL_RGBA16UI_EXT:
-      case GL_RGBA32UI_EXT:
-      case GL_RGBA8I_EXT:
-      case GL_RGBA16I_EXT:
-      case GL_RGBA32I_EXT:
-         return GL_RGBA;
-      case GL_RGB8UI_EXT:
-      case GL_RGB16UI_EXT:
-      case GL_RGB32UI_EXT:
-      case GL_RGB8I_EXT:
-      case GL_RGB16I_EXT:
-      case GL_RGB32I_EXT:
-         return GL_RGB;
-      case GL_ALPHA8UI_EXT:
-      case GL_ALPHA16UI_EXT:
-      case GL_ALPHA32UI_EXT:
-      case GL_ALPHA8I_EXT:
-      case GL_ALPHA16I_EXT:
-      case GL_ALPHA32I_EXT:
-         return GL_ALPHA;
-      case GL_INTENSITY8UI_EXT:
-      case GL_INTENSITY16UI_EXT:
-      case GL_INTENSITY32UI_EXT:
-      case GL_INTENSITY8I_EXT:
-      case GL_INTENSITY16I_EXT:
-      case GL_INTENSITY32I_EXT:
-         return GL_INTENSITY;
-      case GL_LUMINANCE8UI_EXT:
-      case GL_LUMINANCE16UI_EXT:
-      case GL_LUMINANCE32UI_EXT:
-      case GL_LUMINANCE8I_EXT:
-      case GL_LUMINANCE16I_EXT:
-      case GL_LUMINANCE32I_EXT:
-         return GL_LUMINANCE;
-      case GL_LUMINANCE_ALPHA8UI_EXT:
-      case GL_LUMINANCE_ALPHA16UI_EXT:
-      case GL_LUMINANCE_ALPHA32UI_EXT:
-      case GL_LUMINANCE_ALPHA8I_EXT:
-      case GL_LUMINANCE_ALPHA16I_EXT:
-      case GL_LUMINANCE_ALPHA32I_EXT:
-         return GL_LUMINANCE_ALPHA;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.ARB_texture_rg) {
-      switch (internalFormat) {
-      case GL_R16F:
-	 /* R16F depends on both ARB_half_float_pixel and ARB_texture_float.
-	  */
-	 if (!ctx->Extensions.ARB_half_float_pixel)
-	    break;
-	 /* FALLTHROUGH */
-      case GL_R32F:
-	 if (!ctx->Extensions.ARB_texture_float)
-	    break;
-         return GL_RED;
-      case GL_R8I:
-      case GL_R8UI:
-      case GL_R16I:
-      case GL_R16UI:
-      case GL_R32I:
-      case GL_R32UI:
-	 if (!ctx->Extensions.EXT_texture_integer)
-	    break;
-	 /* FALLTHROUGH */
-      case GL_R8:
-      case GL_R16:
-      case GL_RED:
-      case GL_COMPRESSED_RED:
-         return GL_RED;
-
-      case GL_RG16F:
-	 /* RG16F depends on both ARB_half_float_pixel and ARB_texture_float.
-	  */
-	 if (!ctx->Extensions.ARB_half_float_pixel)
-	    break;
-	 /* FALLTHROUGH */
-      case GL_RG32F:
-	 if (!ctx->Extensions.ARB_texture_float)
-	    break;
-         return GL_RG;
-      case GL_RG8I:
-      case GL_RG8UI:
-      case GL_RG16I:
-      case GL_RG16UI:
-      case GL_RG32I:
-      case GL_RG32UI:
-	 if (!ctx->Extensions.EXT_texture_integer)
-	    break;
-	 /* FALLTHROUGH */
-      case GL_RG:
-      case GL_RG8:
-      case GL_RG16:
-      case GL_COMPRESSED_RG:
-         return GL_RG;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.EXT_texture_shared_exponent) {
-      switch (internalFormat) {
-      case GL_RGB9_E5_EXT:
-         return GL_RGB;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.EXT_packed_float) {
-      switch (internalFormat) {
-      case GL_R11F_G11F_B10F_EXT:
-         return GL_RGB;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.ARB_depth_buffer_float) {
-      switch (internalFormat) {
-      case GL_DEPTH_COMPONENT32F:
-         return GL_DEPTH_COMPONENT;
-      case GL_DEPTH32F_STENCIL8:
-         return GL_DEPTH_STENCIL;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.ARB_texture_compression_rgtc) {
-      switch (internalFormat) {
-      case GL_COMPRESSED_RED_RGTC1:
-      case GL_COMPRESSED_SIGNED_RED_RGTC1:
-         return GL_RED;
-      case GL_COMPRESSED_RG_RGTC2:
-      case GL_COMPRESSED_SIGNED_RG_RGTC2:
-         return GL_RG;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.EXT_texture_compression_latc) {
-      switch (internalFormat) {
-      case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
-      case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
-         return GL_LUMINANCE;
-      case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
-      case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
-         return GL_LUMINANCE_ALPHA;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   if (ctx->Extensions.ATI_texture_compression_3dc) {
-      switch (internalFormat) {
-      case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
-         return GL_LUMINANCE_ALPHA;
-      default:
-         ; /* fallthrough */
-      }
-   }
-
-   return -1; /* error */
-}
-
-
-/**
- * For cube map faces, return a face index in [0,5].
- * For other targets return 0;
- */
-GLuint
-_mesa_tex_target_to_face(GLenum target)
-{
-   if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-       target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)
-      return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-   else
-      return 0;
-}
-
-
-
-/**
- * Store a gl_texture_image pointer in a gl_texture_object structure
- * according to the target and level parameters.
- * 
- * \param tObj texture object.
- * \param target texture target.
- * \param level image level.
- * \param texImage texture image.
- * 
- * This was basically prompted by the introduction of cube maps.
- */
-void
-_mesa_set_tex_image(struct gl_texture_object *tObj,
-                    GLenum target, GLint level,
-                    struct gl_texture_image *texImage)
-{
-   const GLuint face = _mesa_tex_target_to_face(target);
-
-   ASSERT(tObj);
-   ASSERT(texImage);
-   ASSERT(target != GL_TEXTURE_RECTANGLE_NV || level == 0);
-
-   tObj->Image[face][level] = texImage;
-
-   /* Set the 'back' pointer */
-   texImage->TexObject = tObj;
-}
-
-
-/**
- * Allocate a texture image structure.
- * 
- * Called via ctx->Driver.NewTextureImage() unless overriden by a device
- * driver.
- *
- * \return a pointer to gl_texture_image struct with all fields initialized to
- * zero.
- */
-struct gl_texture_image *
-_mesa_new_texture_image( struct gl_context *ctx )
-{
-   (void) ctx;
-   return CALLOC_STRUCT(gl_texture_image);
-}
-
-
-/**
- * Free texture image data.
- * This function is a fallback called via ctx->Driver.FreeTexImageData().
- *
- * \param texImage texture image.
- *
- * Free the texture image data if it's not marked as client data.
- */
-void
-_mesa_free_texture_image_data(struct gl_context *ctx,
-                              struct gl_texture_image *texImage)
-{
-   (void) ctx;
-
-   if (texImage->Data && !texImage->IsClientData) {
-      /* free the old texture data */
-      _mesa_free_texmemory(texImage->Data);
-   }
-
-   texImage->Data = NULL;
-}
-
-
-/**
- * Free texture image.
- *
- * \param texImage texture image.
- *
- * Free the texture image structure and the associated image data.
- */
-void
-_mesa_delete_texture_image(struct gl_context *ctx,
-                           struct gl_texture_image *texImage)
-{
-   /* Free texImage->Data and/or any other driver-specific texture
-    * image storage.
-    */
-   ASSERT(ctx->Driver.FreeTexImageData);
-   ctx->Driver.FreeTexImageData( ctx, texImage );
-
-   ASSERT(texImage->Data == NULL);
-   if (texImage->ImageOffsets)
-      free(texImage->ImageOffsets);
-   free(texImage);
-}
-
-
-/**
- * Test if a target is a proxy target.
- *
- * \param target texture target.
- *
- * \return GL_TRUE if the target is a proxy target, GL_FALSE otherwise.
- */
-GLboolean
-_mesa_is_proxy_texture(GLenum target)
-{
-   /* NUM_TEXTURE_TARGETS should match number of terms below,
-    * except there's no proxy for GL_TEXTURE_BUFFER.
-    */
-   assert(NUM_TEXTURE_TARGETS == 8);
-
-   return (target == GL_PROXY_TEXTURE_1D ||
-           target == GL_PROXY_TEXTURE_2D ||
-           target == GL_PROXY_TEXTURE_3D ||
-           target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
-           target == GL_PROXY_TEXTURE_RECTANGLE_NV ||
-           target == GL_PROXY_TEXTURE_1D_ARRAY_EXT ||
-           target == GL_PROXY_TEXTURE_2D_ARRAY_EXT);
-}
-
-
-/**
- * Return the proxy target which corresponds to the given texture target
- */
-static GLenum
-get_proxy_target(GLenum target)
-{
-   switch (target) {
-   case GL_TEXTURE_1D:
-   case GL_PROXY_TEXTURE_1D:
-      return GL_PROXY_TEXTURE_1D;
-   case GL_TEXTURE_2D:
-   case GL_PROXY_TEXTURE_2D:
-      return GL_PROXY_TEXTURE_2D;
-   case GL_TEXTURE_3D:
-   case GL_PROXY_TEXTURE_3D:
-      return GL_PROXY_TEXTURE_3D;
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
-   case GL_TEXTURE_CUBE_MAP_ARB:
-   case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
-      return GL_PROXY_TEXTURE_CUBE_MAP_ARB;
-   case GL_TEXTURE_RECTANGLE_NV:
-   case GL_PROXY_TEXTURE_RECTANGLE_NV:
-      return GL_PROXY_TEXTURE_RECTANGLE_NV;
-   case GL_TEXTURE_1D_ARRAY_EXT:
-   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-      return GL_PROXY_TEXTURE_1D_ARRAY_EXT;
-   case GL_TEXTURE_2D_ARRAY_EXT:
-   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-      return GL_PROXY_TEXTURE_2D_ARRAY_EXT;
-   default:
-      _mesa_problem(NULL, "unexpected target in get_proxy_target()");
-      return 0;
-   }
-}
-
-
-/**
- * Get the texture object that corresponds to the target of the given
- * texture unit.
- *
- * \param ctx GL context.
- * \param texUnit texture unit.
- * \param target texture target.
- *
- * \return pointer to the texture object on success, or NULL on failure.
- * 
- * \sa gl_texture_unit.
- */
-struct gl_texture_object *
-_mesa_select_tex_object(struct gl_context *ctx,
-                        const struct gl_texture_unit *texUnit,
-                        GLenum target)
-{
-   const GLboolean arrayTex = (ctx->Extensions.MESA_texture_array ||
-                               ctx->Extensions.EXT_texture_array);
-
-   switch (target) {
-      case GL_TEXTURE_1D:
-         return texUnit->CurrentTex[TEXTURE_1D_INDEX];
-      case GL_PROXY_TEXTURE_1D:
-         return ctx->Texture.ProxyTex[TEXTURE_1D_INDEX];
-      case GL_TEXTURE_2D:
-         return texUnit->CurrentTex[TEXTURE_2D_INDEX];
-      case GL_PROXY_TEXTURE_2D:
-         return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX];
-      case GL_TEXTURE_3D:
-         return texUnit->CurrentTex[TEXTURE_3D_INDEX];
-      case GL_PROXY_TEXTURE_3D:
-         return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX];
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
-      case GL_TEXTURE_CUBE_MAP_ARB:
-         return ctx->Extensions.ARB_texture_cube_map
-                ? texUnit->CurrentTex[TEXTURE_CUBE_INDEX] : NULL;
-      case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
-         return ctx->Extensions.ARB_texture_cube_map
-                ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL;
-      case GL_TEXTURE_RECTANGLE_NV:
-         return ctx->Extensions.NV_texture_rectangle
-                ? texUnit->CurrentTex[TEXTURE_RECT_INDEX] : NULL;
-      case GL_PROXY_TEXTURE_RECTANGLE_NV:
-         return ctx->Extensions.NV_texture_rectangle
-                ? ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX] : NULL;
-      case GL_TEXTURE_1D_ARRAY_EXT:
-         return arrayTex ? texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
-      case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-         return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
-      case GL_TEXTURE_2D_ARRAY_EXT:
-         return arrayTex ? texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
-      case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-         return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
-      case GL_TEXTURE_BUFFER:
-         return ctx->Extensions.ARB_texture_buffer_object
-            ? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
-      default:
-         _mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
-         return NULL;
-   }
-}
-
-
-/**
- * Return pointer to texture object for given target on current texture unit.
- */
-struct gl_texture_object *
-_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
-{
-   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
-   return _mesa_select_tex_object(ctx, texUnit, target);
-}
-
-
-/**
- * Get a texture image pointer from a texture object, given a texture
- * target and mipmap level.  The target and level parameters should
- * have already been error-checked.
- *
- * \param ctx GL context.
- * \param texObj texture unit.
- * \param target texture target.
- * \param level image level.
- *
- * \return pointer to the texture image structure, or NULL on failure.
- */
-struct gl_texture_image *
-_mesa_select_tex_image(struct gl_context *ctx,
-                       const struct gl_texture_object *texObj,
-		       GLenum target, GLint level)
-{
-   const GLuint face = _mesa_tex_target_to_face(target);
-
-   ASSERT(texObj);
-   ASSERT(level >= 0);
-   ASSERT(level < MAX_TEXTURE_LEVELS);
-
-   return texObj->Image[face][level];
-}
-
-
-/**
- * Like _mesa_select_tex_image() but if the image doesn't exist, allocate
- * it and install it.  Only return NULL if passed a bad parameter or run
- * out of memory.
- */
-struct gl_texture_image *
-_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
-                    GLenum target, GLint level)
-{
-   struct gl_texture_image *texImage;
-
-   if (!texObj)
-      return NULL;
-   
-   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-   if (!texImage) {
-      texImage = ctx->Driver.NewTextureImage(ctx);
-      if (!texImage) {
-         _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation");
-         return NULL;
-      }
-
-      _mesa_set_tex_image(texObj, target, level, texImage);
-   }
-
-   return texImage;
-}
-
-
-/**
- * Return pointer to the specified proxy texture image.
- * Note that proxy textures are per-context, not per-texture unit.
- * \return pointer to texture image or NULL if invalid target, invalid
- *         level, or out of memory.
- */
-struct gl_texture_image *
-_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
-{
-   struct gl_texture_image *texImage;
-   GLuint texIndex;
-
-   if (level < 0 )
-      return NULL;
-
-   switch (target) {
-   case GL_PROXY_TEXTURE_1D:
-      if (level >= ctx->Const.MaxTextureLevels)
-         return NULL;
-      texIndex = TEXTURE_1D_INDEX;
-      break;
-   case GL_PROXY_TEXTURE_2D:
-      if (level >= ctx->Const.MaxTextureLevels)
-         return NULL;
-      texIndex = TEXTURE_2D_INDEX;
-      break;
-   case GL_PROXY_TEXTURE_3D:
-      if (level >= ctx->Const.Max3DTextureLevels)
-         return NULL;
-      texIndex = TEXTURE_3D_INDEX;
-      break;
-   case GL_PROXY_TEXTURE_CUBE_MAP:
-      if (level >= ctx->Const.MaxCubeTextureLevels)
-         return NULL;
-      texIndex = TEXTURE_CUBE_INDEX;
-      break;
-   case GL_PROXY_TEXTURE_RECTANGLE_NV:
-      if (level > 0)
-         return NULL;
-      texIndex = TEXTURE_RECT_INDEX;
-      break;
-   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-      if (level >= ctx->Const.MaxTextureLevels)
-         return NULL;
-      texIndex = TEXTURE_1D_ARRAY_INDEX;
-      break;
-   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-      if (level >= ctx->Const.MaxTextureLevels)
-         return NULL;
-      texIndex = TEXTURE_2D_ARRAY_INDEX;
-      break;
-   default:
-      return NULL;
-   }
-
-   texImage = ctx->Texture.ProxyTex[texIndex]->Image[0][level];
-   if (!texImage) {
-      texImage = ctx->Driver.NewTextureImage(ctx);
-      if (!texImage) {
-         _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
-         return NULL;
-      }
-      ctx->Texture.ProxyTex[texIndex]->Image[0][level] = texImage;
-      /* Set the 'back' pointer */
-      texImage->TexObject = ctx->Texture.ProxyTex[texIndex];
-   }
-   return texImage;
-}
-
-
-/**
- * Get the maximum number of allowed mipmap levels.
- *
- * \param ctx GL context.
- * \param target texture target.
- * 
- * \return the maximum number of allowed mipmap levels for the given
- * texture target, or zero if passed a bad target.
- *
- * \sa gl_constants.
- */
-GLint
-_mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
-{
-   switch (target) {
-   case GL_TEXTURE_1D:
-   case GL_PROXY_TEXTURE_1D:
-   case GL_TEXTURE_2D:
-   case GL_PROXY_TEXTURE_2D:
-      return ctx->Const.MaxTextureLevels;
-   case GL_TEXTURE_3D:
-   case GL_PROXY_TEXTURE_3D:
-      return ctx->Const.Max3DTextureLevels;
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
-   case GL_TEXTURE_CUBE_MAP_ARB:
-   case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
-      return ctx->Extensions.ARB_texture_cube_map
-         ? ctx->Const.MaxCubeTextureLevels : 0;
-   case GL_TEXTURE_RECTANGLE_NV:
-   case GL_PROXY_TEXTURE_RECTANGLE_NV:
-      return ctx->Extensions.NV_texture_rectangle ? 1 : 0;
-   case GL_TEXTURE_1D_ARRAY_EXT:
-   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-   case GL_TEXTURE_2D_ARRAY_EXT:
-   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-      return (ctx->Extensions.MESA_texture_array ||
-              ctx->Extensions.EXT_texture_array)
-         ? ctx->Const.MaxTextureLevels : 0;
-   case GL_TEXTURE_BUFFER:
-      /* fall-through */
-   default:
-      return 0; /* bad target */
-   }
-}
-
-
-/**
- * Return number of dimensions per mipmap level for the given texture target.
- */
-GLint
-_mesa_get_texture_dimensions(GLenum target)
-{
-   switch (target) {
-   case GL_TEXTURE_1D:
-   case GL_PROXY_TEXTURE_1D:
-      return 1;
-   case GL_TEXTURE_2D:
-   case GL_TEXTURE_RECTANGLE:
-   case GL_TEXTURE_CUBE_MAP:
-   case GL_PROXY_TEXTURE_2D:
-   case GL_PROXY_TEXTURE_RECTANGLE:
-   case GL_PROXY_TEXTURE_CUBE_MAP:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-   case GL_TEXTURE_1D_ARRAY:
-   case GL_PROXY_TEXTURE_1D_ARRAY:
-      return 2;
-   case GL_TEXTURE_3D:
-   case GL_PROXY_TEXTURE_3D:
-   case GL_TEXTURE_2D_ARRAY:
-   case GL_PROXY_TEXTURE_2D_ARRAY:
-      return 3;
-   case GL_TEXTURE_BUFFER:
-      /* fall-through */
-   default:
-      _mesa_problem(NULL, "invalid target 0x%x in get_texture_dimensions()",
-                    target);
-      return 2;
-   }
-}
-
-
-
-
-#if 000 /* not used anymore */
-/*
- * glTexImage[123]D can accept a NULL image pointer.  In this case we
- * create a texture image with unspecified image contents per the OpenGL
- * spec.
- */
-static GLubyte *
-make_null_texture(GLint width, GLint height, GLint depth, GLenum format)
-{
-   const GLint components = _mesa_components_in_format(format);
-   const GLint numPixels = width * height * depth;
-   GLubyte *data = (GLubyte *) MALLOC(numPixels * components * sizeof(GLubyte));
-
-#ifdef DEBUG
-   /*
-    * Let's see if anyone finds this.  If glTexImage2D() is called with
-    * a NULL image pointer then load the texture image with something
-    * interesting instead of leaving it indeterminate.
-    */
-   if (data) {
-      static const char message[8][32] = {
-         "   X   X  XXXXX   XXX     X    ",
-         "   XX XX  X      X   X   X X   ",
-         "   X X X  X      X      X   X  ",
-         "   X   X  XXXX    XXX   XXXXX  ",
-         "   X   X  X          X  X   X  ",
-         "   X   X  X      X   X  X   X  ",
-         "   X   X  XXXXX   XXX   X   X  ",
-         "                               "
-      };
-
-      GLubyte *imgPtr = data;
-      GLint h, i, j, k;
-      for (h = 0; h < depth; h++) {
-         for (i = 0; i < height; i++) {
-            GLint srcRow = 7 - (i % 8);
-            for (j = 0; j < width; j++) {
-               GLint srcCol = j % 32;
-               GLubyte texel = (message[srcRow][srcCol]=='X') ? 255 : 70;
-               for (k = 0; k < components; k++) {
-                  *imgPtr++ = texel;
-               }
-            }
-         }
-      }
-   }
-#endif
-
-   return data;
-}
-#endif
-
-
-
-/**
- * Reset the fields of a gl_texture_image struct to zero.
- * 
- * \param img texture image structure.
- *
- * This is called when a proxy texture test fails, we set all the
- * image members (except DriverData) to zero.
- * It's also used in glTexImage[123]D as a safeguard to be sure all
- * required fields get initialized properly by the Driver.TexImage[123]D
- * functions.
- */
-static void
-clear_teximage_fields(struct gl_texture_image *img)
-{
-   ASSERT(img);
-   img->_BaseFormat = 0;
-   img->InternalFormat = 0;
-   img->Border = 0;
-   img->Width = 0;
-   img->Height = 0;
-   img->Depth = 0;
-   img->RowStride = 0;
-   if (img->ImageOffsets) {
-      free(img->ImageOffsets);
-      img->ImageOffsets = NULL;
-   }
-   img->Width2 = 0;
-   img->Height2 = 0;
-   img->Depth2 = 0;
-   img->WidthLog2 = 0;
-   img->HeightLog2 = 0;
-   img->DepthLog2 = 0;
-   img->Data = NULL;
-   img->TexFormat = MESA_FORMAT_NONE;
-   img->FetchTexelc = NULL;
-   img->FetchTexelf = NULL;
-}
-
-
-/**
- * Initialize basic fields of the gl_texture_image struct.
- *
- * \param ctx GL context.
- * \param target texture target (GL_TEXTURE_1D, GL_TEXTURE_RECTANGLE, etc).
- * \param img texture image structure to be initialized.
- * \param width image width.
- * \param height image height.
- * \param depth image depth.
- * \param border image border.
- * \param internalFormat internal format.
- * \param format  the actual hardware format (one of MESA_FORMAT_*)
- *
- * Fills in the fields of \p img with the given information.
- * Note: width, height and depth include the border.
- */
-void
-_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
-                           struct gl_texture_image *img,
-                           GLsizei width, GLsizei height, GLsizei depth,
-                           GLint border, GLenum internalFormat,
-                           gl_format format)
-{
-   GLint i, dims;
-
-   ASSERT(img);
-   ASSERT(width >= 0);
-   ASSERT(height >= 0);
-   ASSERT(depth >= 0);
-
-   img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
-   ASSERT(img->_BaseFormat > 0);
-   img->InternalFormat = internalFormat;
-   img->Border = border;
-   img->Width = width;
-   img->Height = height;
-   img->Depth = depth;
-
-   img->Width2 = width - 2 * border;   /* == 1 << img->WidthLog2; */
-   img->WidthLog2 = logbase2(img->Width2);
-
-   if (height == 1) { /* 1-D texture */
-      img->Height2 = 1;
-      img->HeightLog2 = 0;
-   }
-   else {
-      img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
-      img->HeightLog2 = logbase2(img->Height2);
-   }
-
-   if (depth == 1) {  /* 2-D texture */
-      img->Depth2 = 1;
-      img->DepthLog2 = 0;
-   }
-   else {
-      img->Depth2 = depth - 2 * border;   /* == 1 << img->DepthLog2; */
-      img->DepthLog2 = logbase2(img->Depth2);
-   }
-
-   img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
-
-   if ((width == 1 || _mesa_is_pow_two(img->Width2)) &&
-       (height == 1 || _mesa_is_pow_two(img->Height2)) &&
-       (depth == 1 || _mesa_is_pow_two(img->Depth2)))
-      img->_IsPowerOfTwo = GL_TRUE;
-   else
-      img->_IsPowerOfTwo = GL_FALSE;
-
-   /* RowStride and ImageOffsets[] describe how to address texels in 'Data' */
-   img->RowStride = width;
-   /* Allocate the ImageOffsets array and initialize to typical values.
-    * We allocate the array for 1D/2D textures too in order to avoid special-
-    * case code in the texstore routines.
-    */
-   if (img->ImageOffsets)
-      free(img->ImageOffsets);
-   img->ImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint));
-   for (i = 0; i < depth; i++) {
-      img->ImageOffsets[i] = i * width * height;
-   }
-
-   /* Compute Width/Height/DepthScale for mipmap lod computation */
-   if (target == GL_TEXTURE_RECTANGLE_NV) {
-      /* scale = 1.0 since texture coords directly map to texels */
-      img->WidthScale = 1.0;
-      img->HeightScale = 1.0;
-      img->DepthScale = 1.0;
-   }
-   else {
-      img->WidthScale = (GLfloat) img->Width;
-      img->HeightScale = (GLfloat) img->Height;
-      img->DepthScale = (GLfloat) img->Depth;
-   }
-
-   img->TexFormat = format;
-
-   dims = _mesa_get_texture_dimensions(target);
-
-   _mesa_set_fetch_functions(img, dims);
-}
-
-
-/**
- * Free and clear fields of the gl_texture_image struct.
- *
- * \param ctx GL context.
- * \param texImage texture image structure to be cleared.
- *
- * After the call, \p texImage will have no data associated with it.  Its
- * fields are cleared so that its parent object will test incomplete.
- */
-void
-_mesa_clear_texture_image(struct gl_context *ctx,
-                          struct gl_texture_image *texImage)
-{
-   ctx->Driver.FreeTexImageData(ctx, texImage);
-   clear_teximage_fields(texImage);
-}
-
-
-/**
- * This is the fallback for Driver.TestProxyTexImage().  Test the texture
- * level, width, height and depth against the ctx->Const limits for textures.
- *
- * A hardware driver might override this function if, for example, the
- * max 3D texture size is 512x512x64 (i.e. not a cube).
- *
- * Note that width, height, depth == 0 is not an error.  However, a
- * texture with zero width/height/depth will be considered "incomplete"
- * and texturing will effectively be disabled.
- *
- * \param target  one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D,
- *                GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV,
- *                GL_PROXY_TEXTURE_CUBE_MAP_ARB.
- * \param level  as passed to glTexImage
- * \param internalFormat  as passed to glTexImage
- * \param format  as passed to glTexImage
- * \param type  as passed to glTexImage
- * \param width  as passed to glTexImage
- * \param height  as passed to glTexImage
- * \param depth  as passed to glTexImage
- * \param border  as passed to glTexImage
- * \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.
- */
-GLboolean
-_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-                          GLint internalFormat, GLenum format, GLenum type,
-                          GLint width, GLint height, GLint depth, GLint border)
-{
-   GLint maxSize;
-
-   (void) internalFormat;
-   (void) format;
-   (void) type;
-
-   switch (target) {
-   case GL_PROXY_TEXTURE_1D:
-      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize)
-         return GL_FALSE;
-      if (level >= ctx->Const.MaxTextureLevels)
-         return GL_FALSE;
-      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-            return GL_FALSE;
-      }
-      return GL_TRUE;
-
-   case GL_PROXY_TEXTURE_2D:
-      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize)
-         return GL_FALSE;
-      if (height < 2 * border || height > 2 + maxSize)
-         return GL_FALSE;
-      if (level >= ctx->Const.MaxTextureLevels)
-         return GL_FALSE;
-      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-            return GL_FALSE;
-         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
-            return GL_FALSE;
-      }
-      return GL_TRUE;
-
-   case GL_PROXY_TEXTURE_3D:
-      maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize)
-         return GL_FALSE;
-      if (height < 2 * border || height > 2 + maxSize)
-         return GL_FALSE;
-      if (depth < 2 * border || depth > 2 + maxSize)
-         return GL_FALSE;
-      if (level >= ctx->Const.Max3DTextureLevels)
-         return GL_FALSE;
-      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-            return GL_FALSE;
-         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
-            return GL_FALSE;
-         if (depth > 0 && !_mesa_is_pow_two(depth - 2 * border))
-            return GL_FALSE;
-      }
-      return GL_TRUE;
-
-   case GL_PROXY_TEXTURE_RECTANGLE_NV:
-      maxSize = ctx->Const.MaxTextureRectSize;
-      if (width < 0 || width > maxSize)
-         return GL_FALSE;
-      if (height < 0 || height > maxSize)
-         return GL_FALSE;
-      if (level != 0)
-         return GL_FALSE;
-      return GL_TRUE;
-
-   case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
-      maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize)
-         return GL_FALSE;
-      if (height < 2 * border || height > 2 + maxSize)
-         return GL_FALSE;
-      if (level >= ctx->Const.MaxCubeTextureLevels)
-         return GL_FALSE;
-      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-            return GL_FALSE;
-         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
-            return GL_FALSE;
-      }
-      return GL_TRUE;
-
-   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize)
-         return GL_FALSE;
-      if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
-         return GL_FALSE;
-      if (level >= ctx->Const.MaxTextureLevels)
-         return GL_FALSE;
-      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-            return GL_FALSE;
-      }
-      return GL_TRUE;
-
-   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize)
-         return GL_FALSE;
-      if (height < 2 * border || height > 2 + maxSize)
-         return GL_FALSE;
-      if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
-         return GL_FALSE;
-      if (level >= ctx->Const.MaxTextureLevels)
-         return GL_FALSE;
-      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-            return GL_FALSE;
-         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
-            return GL_FALSE;
-      }
-      return GL_TRUE;
-
-   default:
-      _mesa_problem(ctx, "Invalid target in _mesa_test_proxy_teximage");
-      return GL_FALSE;
-   }
-}
-
-
-/**
- * Check if the memory used by the texture would exceed the driver's limit.
- * This lets us support a max 3D texture size of 8K (for example) but
- * prevents allocating a full 8K x 8K x 8K texture.
- * XXX this could be rolled into the proxy texture size test (above) but
- * we don't have the actual texture internal format at that point.
- */
-static GLboolean
-legal_texture_size(struct gl_context *ctx, gl_format format,
-                   GLint width, GLint height, GLint depth)
-{
-   uint64_t bytes = _mesa_format_image_size64(format, width, height, depth);
-   uint64_t mbytes = bytes / (1024 * 1024); /* convert to MB */
-   return mbytes <= (uint64_t) ctx->Const.MaxTextureMbytes;
-}
-
-
-
-/**
- * Helper function to determine whether a target and specific compression
- * format are supported.
- */
-static GLboolean
-target_can_be_compressed(const struct gl_context *ctx, GLenum target,
-                         GLenum intFormat)
-{
-   (void) intFormat;  /* not used yet */
-
-   switch (target) {
-   case GL_TEXTURE_2D:
-   case GL_PROXY_TEXTURE_2D:
-      return GL_TRUE; /* true for any compressed format so far */
-   case GL_PROXY_TEXTURE_CUBE_MAP:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-      return ctx->Extensions.ARB_texture_cube_map;
-   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-   case GL_TEXTURE_2D_ARRAY_EXT:
-      return (ctx->Extensions.MESA_texture_array ||
-              ctx->Extensions.EXT_texture_array);
-   default:
-      return GL_FALSE;
-   }      
-}
-
-
-/**
- * Check if the given texture target value is legal for a
- * glTexImage1/2/3D call.
- */
-static GLboolean
-legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
-{
-   switch (dims) {
-   case 1:
-      switch (target) {
-      case GL_TEXTURE_1D:
-      case GL_PROXY_TEXTURE_1D:
-         return GL_TRUE;
-      default:
-         return GL_FALSE;
-      }
-   case 2:
-      switch (target) {
-      case GL_TEXTURE_2D:
-      case GL_PROXY_TEXTURE_2D:
-         return GL_TRUE;
-      case GL_PROXY_TEXTURE_CUBE_MAP:
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-         return ctx->Extensions.ARB_texture_cube_map;
-      case GL_TEXTURE_RECTANGLE_NV:
-      case GL_PROXY_TEXTURE_RECTANGLE_NV:
-         return ctx->Extensions.NV_texture_rectangle;
-      case GL_TEXTURE_1D_ARRAY_EXT:
-      case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-         return (ctx->Extensions.MESA_texture_array ||
-                 ctx->Extensions.EXT_texture_array);
-      default:
-         return GL_FALSE;
-      }
-   case 3:
-      switch (target) {
-      case GL_TEXTURE_3D:
-      case GL_PROXY_TEXTURE_3D:
-         return GL_TRUE;
-      case GL_TEXTURE_2D_ARRAY_EXT:
-      case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-         return (ctx->Extensions.MESA_texture_array ||
-                 ctx->Extensions.EXT_texture_array);
-      default:
-         return GL_FALSE;
-      }
-   default:
-      _mesa_problem(ctx, "invalid dims=%u in legal_teximage_target()", dims);
-      return GL_FALSE;
-   }
-}
-
-
-/**
- * Check if the given texture target value is legal for a
- * glTexSubImage, glCopyTexSubImage or glCopyTexImage call.
- * The difference compared to legal_teximage_target() above is that
- * proxy targets are not supported.
- */
-static GLboolean
-legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
-{
-   switch (dims) {
-   case 1:
-      return target == GL_TEXTURE_1D;
-   case 2:
-      switch (target) {
-      case GL_TEXTURE_2D:
-         return GL_TRUE;
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-         return ctx->Extensions.ARB_texture_cube_map;
-      case GL_TEXTURE_RECTANGLE_NV:
-         return ctx->Extensions.NV_texture_rectangle;
-      case GL_TEXTURE_1D_ARRAY_EXT:
-         return (ctx->Extensions.MESA_texture_array ||
-                 ctx->Extensions.EXT_texture_array);
-      default:
-         return GL_FALSE;
-      }
-   case 3:
-      switch (target) {
-      case GL_TEXTURE_3D:
-         return GL_TRUE;
-      case GL_TEXTURE_2D_ARRAY_EXT:
-         return (ctx->Extensions.MESA_texture_array ||
-                 ctx->Extensions.EXT_texture_array);
-      default:
-         return GL_FALSE;
-      }
-   default:
-      _mesa_problem(ctx, "invalid dims=%u in legal_texsubimage_target()",
-                    dims);
-      return GL_FALSE;
-   }
-}
-
-
-/**
- * Test the glTexImage[123]D() parameters for errors.
- * 
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- * \param internalFormat internal format given by the user.
- * \param format pixel data format given by the user.
- * \param type pixel data type given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- * \param depth image depth given by the user.
- * \param border image border given by the user.
- * 
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- *
- * Verifies each of the parameters against the constants specified in
- * __struct gl_contextRec::Const and the supported extensions, and according
- * to the OpenGL specification.
- */
-static GLboolean
-texture_error_check( struct gl_context *ctx,
-                     GLuint dimensions, GLenum target,
-                     GLint level, GLint internalFormat,
-                     GLenum format, GLenum type,
-                     GLint width, GLint height,
-                     GLint depth, GLint border )
-{
-   const GLenum proxyTarget = get_proxy_target(target);
-   const GLboolean isProxy = target == proxyTarget;
-   GLboolean sizeOK = GL_TRUE;
-   GLboolean colorFormat, indexFormat;
-
-   /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
-   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glTexImage%dD(level=%d)", dimensions, level);
-      }
-      return GL_TRUE;
-   }
-
-   /* Check border */
-   if (border < 0 || border > 1 ||
-       ((target == GL_TEXTURE_RECTANGLE_NV ||
-         target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glTexImage%dD(border=%d)", dimensions, border);
-      }
-      return GL_TRUE;
-   }
-
-   if (width < 0 || height < 0 || depth < 0) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glTexImage%dD(width, height or depth < 0)", dimensions);
-      }
-      return GL_TRUE;
-   }
-
-   /* Do this simple check before calling the TestProxyTexImage() function */
-   if (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
-      sizeOK = (width == height);
-   }
-
-   /*
-    * Use the proxy texture driver hook to see if the size/level/etc are
-    * legal.
-    */
-   sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
-                                                    internalFormat, format,
-                                                    type, width, height,
-                                                    depth, border);
-   if (!sizeOK) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glTexImage%dD(level=%d, width=%d, height=%d, depth=%d)",
-                     dimensions, level, width, height, depth);
-      }
-      return GL_TRUE;
-   }
-
-   /* Check internalFormat */
-   if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glTexImage%dD(internalFormat=%s)",
-                     dimensions, _mesa_lookup_enum_by_nr(internalFormat));
-      }
-      return GL_TRUE;
-   }
-
-   /* Check incoming image format and type */
-   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
-      /* Normally, GL_INVALID_OPERATION is generated by a format/type
-       * mismatch (see the 1.2 spec page 94, sec 3.6.4.).  But with the
-       * GL_EXT_texture_integer extension, some combinations should generate
-       * GL_INVALID_ENUM instead (grr!).
-       */
-      if (!isProxy) {
-         GLenum error = _mesa_is_integer_format(format)
-            ? GL_INVALID_ENUM : GL_INVALID_OPERATION;
-         _mesa_error(ctx, error,
-                     "glTexImage%dD(incompatible format 0x%x, type 0x%x)",
-                     dimensions, format, type);
-      }
-      return GL_TRUE;
-   }
-
-   /* make sure internal format and format basically agree */
-   colorFormat = _mesa_is_color_format(format);
-   indexFormat = _mesa_is_index_format(format);
-   if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) ||
-       (_mesa_is_index_format(internalFormat) && !indexFormat) ||
-       (_mesa_is_depth_format(internalFormat) != _mesa_is_depth_format(format)) ||
-       (_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format)) ||
-       (_mesa_is_depthstencil_format(internalFormat) != _mesa_is_depthstencil_format(format)) ||
-       (_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) {
-      if (!isProxy)
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)",
-                     dimensions, internalFormat, format);
-      return GL_TRUE;
-   }
-
-   /* additional checks for ycbcr textures */
-   if (internalFormat == GL_YCBCR_MESA) {
-      ASSERT(ctx->Extensions.MESA_ycbcr_texture);
-      if (type != GL_UNSIGNED_SHORT_8_8_MESA &&
-          type != GL_UNSIGNED_SHORT_8_8_REV_MESA) {
-         char message[100];
-         _mesa_snprintf(message, sizeof(message),
-                        "glTexImage%dD(format/type YCBCR mismatch", dimensions);
-         _mesa_error(ctx, GL_INVALID_ENUM, "%s", message);
-         return GL_TRUE; /* error */
-      }
-      if (target != GL_TEXTURE_2D &&
-          target != GL_PROXY_TEXTURE_2D &&
-          target != GL_TEXTURE_RECTANGLE_NV &&
-          target != GL_PROXY_TEXTURE_RECTANGLE_NV) {
-         if (!isProxy)
-            _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)");
-         return GL_TRUE;
-      }
-      if (border != 0) {
-         if (!isProxy) {
-            char message[100];
-            _mesa_snprintf(message, sizeof(message),
-                           "glTexImage%dD(format=GL_YCBCR_MESA and border=%d)",
-                           dimensions, border);
-            _mesa_error(ctx, GL_INVALID_VALUE, "%s", message);
-         }
-         return GL_TRUE;
-      }
-   }
-
-   /* additional checks for depth textures */
-   if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
-      /* Only 1D, 2D and rectangular textures supported, not 3D or cubes */
-      if (target != GL_TEXTURE_1D &&
-          target != GL_PROXY_TEXTURE_1D &&
-          target != GL_TEXTURE_2D &&
-          target != GL_PROXY_TEXTURE_2D &&
-          target != GL_TEXTURE_RECTANGLE_ARB &&
-          target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
-         if (!isProxy)
-            _mesa_error(ctx, GL_INVALID_ENUM,
-                        "glTexImage(target/internalFormat)");
-         return GL_TRUE;
-      }
-   }
-
-   /* additional checks for compressed textures */
-   if (_mesa_is_compressed_format(ctx, internalFormat)) {
-      if (!target_can_be_compressed(ctx, target, internalFormat)) {
-         if (!isProxy)
-            _mesa_error(ctx, GL_INVALID_ENUM,
-                        "glTexImage%dD(target)", dimensions);
-         return GL_TRUE;
-      }
-      if (border != 0) {
-         if (!isProxy) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glTexImage%dD(border!=0)", dimensions);
-         }
-         return GL_TRUE;
-      }
-   }
-
-   /* additional checks for integer textures */
-   if (ctx->Extensions.EXT_texture_integer &&
-       (_mesa_is_integer_format(format) !=
-        _mesa_is_integer_format(internalFormat))) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexImage%dD(integer/non-integer format mismatch)",
-                     dimensions);
-      }
-      return GL_TRUE;
-   }
-
-   /* if we get here, the parameters are OK */
-   return GL_FALSE;
-}
-
-
-/**
- * Test glTexSubImage[123]D() parameters for errors.
- * 
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- * \param xoffset sub-image x offset given by the user.
- * \param yoffset sub-image y offset given by the user.
- * \param zoffset sub-image z offset given by the user.
- * \param format pixel data format given by the user.
- * \param type pixel data type given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- * \param depth image depth given by the user.
- * 
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- *
- * Verifies each of the parameters against the constants specified in
- * __struct gl_contextRec::Const and the supported extensions, and according
- * to the OpenGL specification.
- */
-static GLboolean
-subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
-                        GLenum target, GLint level,
-                        GLint xoffset, GLint yoffset, GLint zoffset,
-                        GLint width, GLint height, GLint depth,
-                        GLenum format, GLenum type )
-{
-   /* Basic level check */
-   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level);
-      return GL_TRUE;
-   }
-
-   /* Check for negative sizes */
-   if (width < 0) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glTexSubImage%dD(width=%d)", dimensions, width);
-      return GL_TRUE;
-   }
-   if (height < 0 && dimensions > 1) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glTexSubImage%dD(height=%d)", dimensions, height);
-      return GL_TRUE;
-   }
-   if (depth < 0 && dimensions > 2) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glTexSubImage%dD(depth=%d)", dimensions, depth);
-      return GL_TRUE;
-   }
-
-   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
-      /* As with the glTexImage2D check above, the error code here
-       * depends on texture integer.
-       */
-      GLenum error = _mesa_is_integer_format(format)
-         ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
-      _mesa_error(ctx, error,
-                  "glTexSubImage%dD(incompatible format 0x%x, type 0x%x)",
-                  dimensions, format, type);
-      return GL_TRUE;
-   }
-
-   return GL_FALSE;
-}
-
-
-/**
- * Do second part of glTexSubImage which depends on the destination texture.
- * \return GL_TRUE if error recorded, GL_FALSE otherwise
- */
-static GLboolean
-subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
-			 GLenum target, GLint level,
-			 GLint xoffset, GLint yoffset, GLint zoffset,
-			 GLint width, GLint height, GLint depth,
-			 GLenum format, GLenum type,
-			 const struct gl_texture_image *destTex )
-{
-   if (!destTex) {
-      /* undefined image level */
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD", dimensions);
-      return GL_TRUE;
-   }
-
-   if (xoffset < -((GLint)destTex->Border)) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset)",
-                  dimensions);
-      return GL_TRUE;
-   }
-   if (xoffset + width > (GLint) (destTex->Width + destTex->Border)) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset+width)",
-                  dimensions);
-      return GL_TRUE;
-   }
-   if (dimensions > 1) {
-      if (yoffset < -((GLint)destTex->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset)",
-                     dimensions);
-         return GL_TRUE;
-      }
-      if (yoffset + height > (GLint) (destTex->Height + destTex->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset+height)",
-                     dimensions);
-         return GL_TRUE;
-      }
-   }
-   if (dimensions > 2) {
-      if (zoffset < -((GLint)destTex->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
-         return GL_TRUE;
-      }
-      if (zoffset + depth  > (GLint) (destTex->Depth + destTex->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
-         return GL_TRUE;
-      }
-   }
-
-   if (_mesa_is_format_compressed(destTex->TexFormat)) {
-      GLuint bw, bh;
-
-      /* do tests which depend on compression block size */
-      _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh);
-
-      /* offset must be multiple of block size */
-      if ((xoffset % bw != 0) || (yoffset % bh != 0)) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexSubImage%dD(xoffset = %d, yoffset = %d)",
-                     dimensions, xoffset, yoffset);
-         return GL_TRUE;
-      }
-      /* size must be multiple of bw by bh or equal to whole texture size */
-      if ((width % bw != 0) && (GLuint) width != destTex->Width) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexSubImage%dD(width = %d)", dimensions, width);
-         return GL_TRUE;
-      }         
-      if ((height % bh != 0) && (GLuint) height != destTex->Height) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexSubImage%dD(height = %d)", dimensions, height);
-         return GL_TRUE;
-      }         
-   }
-
-   return GL_FALSE;
-}
-
-
-/**
- * Test glCopyTexImage[12]D() parameters for errors.
- * 
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- * \param internalFormat internal format given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- * \param border texture border.
- * 
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- * 
- * Verifies each of the parameters against the constants specified in
- * __struct gl_contextRec::Const and the supported extensions, and according
- * to the OpenGL specification.
- */
-static GLboolean
-copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
-                         GLenum target, GLint level, GLint internalFormat,
-                         GLint width, GLint height, GLint border )
-{
-   const GLenum proxyTarget = get_proxy_target(target);
-   const GLenum type = GL_FLOAT;
-   GLboolean sizeOK;
-   GLint format;
-
-   /* check target */
-   if (!legal_texsubimage_target(ctx, dimensions, target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%uD(target=%s)",
-                  dimensions, _mesa_lookup_enum_by_nr(target));
-      return GL_TRUE;
-   }       
-
-   /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
-   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCopyTexImage%dD(level=%d)", dimensions, level);
-      return GL_TRUE;
-   }
-
-   /* Check that the source buffer is complete */
-   if (ctx->ReadBuffer->Name) {
-      if (ctx->ReadBuffer->_Status == 0) {
-         _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
-      }
-      if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-         _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
-                     "glCopyTexImage%dD(invalid readbuffer)", dimensions);
-         return GL_TRUE;
-      }
-   }
-
-   /* Check border */
-   if (border < 0 || border > 1 ||
-       ((target == GL_TEXTURE_RECTANGLE_NV ||
-         target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
-      return GL_TRUE;
-   }
-
-   format = _mesa_base_tex_format(ctx, internalFormat);
-   if (format < 0) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCopyTexImage%dD(internalFormat)", dimensions);
-      return GL_TRUE;
-   }
-
-   if (!_mesa_source_buffer_exists(ctx, format)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glCopyTexImage%dD(missing readbuffer)", dimensions);
-      return GL_TRUE;
-   }
-
-   /* Do size, level checking */
-   sizeOK = (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB)
-      ? (width == height) : 1;
-
-   sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
-                                                    internalFormat, format,
-                                                    type, width, height,
-                                                    1, border);
-
-   if (!sizeOK) {
-      if (dimensions == 1) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexImage1D(width=%d)", width);
-      }
-      else {
-         ASSERT(dimensions == 2);
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexImage2D(width=%d, height=%d)", width, height);
-      }
-      return GL_TRUE;
-   }
-
-   if (_mesa_is_compressed_format(ctx, internalFormat)) {
-      if (!target_can_be_compressed(ctx, target, internalFormat)) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glCopyTexImage%dD(target)", dimensions);
-         return GL_TRUE;
-      }
-      if (border != 0) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glCopyTexImage%dD(border!=0)", dimensions);
-         return GL_TRUE;
-      }
-   }
-   else if (_mesa_is_depth_format(internalFormat)) {
-      /* make sure we have depth/stencil buffers */
-      if (!ctx->ReadBuffer->_DepthBuffer) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glCopyTexImage%dD(no depth)", dimensions);
-         return GL_TRUE;
-      }
-   }
-   else if (_mesa_is_depthstencil_format(internalFormat)) {
-      /* make sure we have depth/stencil buffers */
-      if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glCopyTexImage%dD(no depth/stencil buffer)", dimensions);
-         return GL_TRUE;
-      }
-   }
-
-   /* if we get here, the parameters are OK */
-   return GL_FALSE;
-}
-
-
-/**
- * Test glCopyTexSubImage[12]D() parameters for errors.
- * Note that this is the first part of error checking.
- * See also copytexsubimage_error_check2() below for the second part.
- * 
- * \param ctx GL context.
- * \param dimensions texture image dimensions (must be 1, 2 or 3).
- * \param target texture target given by the user.
- * \param level image level given by the user.
- * 
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
- */
-static GLboolean
-copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions,
-                              GLenum target, GLint level)
-{
-   /* Check that the source buffer is complete */
-   if (ctx->ReadBuffer->Name) {
-      if (ctx->ReadBuffer->_Status == 0) {
-         _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
-      }
-      if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-         _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
-                     "glCopyTexImage%dD(invalid readbuffer)", dimensions);
-         return GL_TRUE;
-      }
-   }
-
-   /* check target (proxies not allowed) */
-   if (!legal_texsubimage_target(ctx, dimensions, target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%uD(target=%s)",
-                  dimensions, _mesa_lookup_enum_by_nr(target));
-      return GL_TRUE;
-   }
-
-   /* Check level */
-   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCopyTexSubImage%dD(level=%d)", dimensions, level);
-      return GL_TRUE;
-   }
-
-   return GL_FALSE;
-}
-
-
-/**
- * Second part of error checking for glCopyTexSubImage[12]D().
- * \param xoffset sub-image x offset given by the user.
- * \param yoffset sub-image y offset given by the user.
- * \param zoffset sub-image z offset given by the user.
- * \param width image width given by the user.
- * \param height image height given by the user.
- */
-static GLboolean
-copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
-			      GLenum target, GLint level,
-			      GLint xoffset, GLint yoffset, GLint zoffset,
-			      GLsizei width, GLsizei height,
-			      const struct gl_texture_image *teximage )
-{
-   /* check that dest tex image exists */
-   if (!teximage) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glCopyTexSubImage%dD(undefined texture level: %d)",
-                  dimensions, level);
-      return GL_TRUE;
-   }
-
-   /* Check size */
-   if (width < 0) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCopyTexSubImage%dD(width=%d)", dimensions, width);
-      return GL_TRUE;
-   }
-   if (dimensions > 1 && height < 0) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCopyTexSubImage%dD(height=%d)", dimensions, height);
-      return GL_TRUE;
-   }
-
-   /* check x/y offsets */
-   if (xoffset < -((GLint)teximage->Border)) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset);
-      return GL_TRUE;
-   }
-   if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCopyTexSubImage%dD(xoffset+width)", dimensions);
-      return GL_TRUE;
-   }
-   if (dimensions > 1) {
-      if (yoffset < -((GLint)teximage->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset);
-         return GL_TRUE;
-      }
-      /* NOTE: we're adding the border here, not subtracting! */
-      if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexSubImage%dD(yoffset+height)", dimensions);
-         return GL_TRUE;
-      }
-   }
-
-   /* check z offset */
-   if (dimensions > 2) {
-      if (zoffset < -((GLint)teximage->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexSubImage%dD(zoffset)", dimensions);
-         return GL_TRUE;
-      }
-      if (zoffset > (GLint) (teximage->Depth + teximage->Border)) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexSubImage%dD(zoffset+depth)", dimensions);
-         return GL_TRUE;
-      }
-   }
-
-   if (_mesa_is_format_compressed(teximage->TexFormat)) {
-      /* offset must be multiple of 4 */
-      if ((xoffset & 3) || (yoffset & 3)) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexSubImage%dD(xoffset or yoffset)", dimensions);
-         return GL_TRUE;
-      }
-      /* size must be multiple of 4 */
-      if ((width & 3) != 0 && (GLuint) width != teximage->Width) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexSubImage%dD(width)", dimensions);
-         return GL_TRUE;
-      }         
-      if ((height & 3) != 0 && (GLuint) height != teximage->Height) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCopyTexSubImage%dD(height)", dimensions);
-         return GL_TRUE;
-      }         
-   }
-
-   if (teximage->InternalFormat == GL_YCBCR_MESA) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D");
-      return GL_TRUE;
-   }
-
-   if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glCopyTexSubImage%dD(missing readbuffer, format=0x%x)",
-                  dimensions, teximage->_BaseFormat);
-      return GL_TRUE;
-   }
-
-   if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) {
-      if (!ctx->ReadBuffer->_DepthBuffer) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glCopyTexSubImage%dD(no depth buffer)",
-                     dimensions);
-         return GL_TRUE;
-      }
-   }
-   else if (teximage->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
-      if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glCopyTexSubImage%dD(no depth/stencil buffer)",
-                     dimensions);
-         return GL_TRUE;
-      }
-   }
-
-   /* If copying into an integer texture, the source buffer must also be
-    * integer-valued.
-    */
-   if (_mesa_is_format_integer_color(teximage->TexFormat)) {
-      struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
-      if (!_mesa_is_format_integer_color(rb->Format)) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glCopyTexSubImage%dD(source buffer is not integer format)",
-                  dimensions);
-         return GL_TRUE;
-      }
-   }
-
-   /* if we get here, the parameters are OK */
-   return GL_FALSE;
-}
-
-
-/** Callback info for walking over FBO hash table */
-struct cb_info
-{
-   struct gl_context *ctx;
-   struct gl_texture_object *texObj;
-   GLuint level, face;
-};
-
-
-/**
- * Check render to texture callback.  Called from _mesa_HashWalk().
- */
-static void
-check_rtt_cb(GLuint key, void *data, void *userData)
-{
-   struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
-   const struct cb_info *info = (struct cb_info *) userData;
-   struct gl_context *ctx = info->ctx;
-   const struct gl_texture_object *texObj = info->texObj;
-   const GLuint level = info->level, face = info->face;
-
-   /* If this is a user-created FBO */
-   if (fb->Name) {
-      GLuint i;
-      /* check if any of the FBO's attachments point to 'texObj' */
-      for (i = 0; i < BUFFER_COUNT; i++) {
-         struct gl_renderbuffer_attachment *att = fb->Attachment + i;
-         if (att->Type == GL_TEXTURE &&
-             att->Texture == texObj &&
-             att->TextureLevel == level &&
-             att->CubeMapFace == face) {
-            ASSERT(_mesa_get_attachment_teximage(att));
-            /* Tell driver about the new renderbuffer texture */
-            ctx->Driver.RenderTexture(ctx, ctx->DrawBuffer, att);
-            /* Mark fb status as indeterminate to force re-validation */
-            fb->_Status = 0;
-         }
-      }
-   }
-}
-
-
-/**
- * When a texture image is specified we have to check if it's bound to
- * any framebuffer objects (render to texture) in order to detect changes
- * in size or format since that effects FBO completeness.
- * Any FBOs rendering into the texture must be re-validated.
- */
-static void
-update_fbo_texture(struct gl_context *ctx, struct gl_texture_object *texObj,
-                   GLuint face, GLuint level)
-{
-   /* Only check this texture if it's been marked as RenderToTexture */
-   if (texObj->_RenderToTexture) {
-      struct cb_info info;
-      info.ctx = ctx;
-      info.texObj = texObj;
-      info.level = level;
-      info.face = face;
-      _mesa_HashWalk(ctx->Shared->FrameBuffers, check_rtt_cb, &info);
-   }
-}
-
-
-/**
- * If the texture object's GenerateMipmap flag is set and we've
- * changed the texture base level image, regenerate the rest of the
- * mipmap levels now.
- */
-static INLINE void
-check_gen_mipmap(struct gl_context *ctx, GLenum target,
-                 struct gl_texture_object *texObj, GLint level)
-{
-   ASSERT(target != GL_TEXTURE_CUBE_MAP);
-   if (texObj->GenerateMipmap &&
-       level == texObj->BaseLevel &&
-       level < texObj->MaxLevel) {
-      ASSERT(ctx->Driver.GenerateMipmap);
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-}
-
-
-/** Debug helper: override the user-requested internal format */
-static GLenum
-override_internal_format(GLenum internalFormat, GLint width, GLint height)
-{
-#if 0
-   if (internalFormat == GL_RGBA16F_ARB ||
-       internalFormat == GL_RGBA32F_ARB) {
-      printf("Convert rgba float tex to int %d x %d\n", width, height);
-      return GL_RGBA;
-   }
-   else if (internalFormat == GL_RGB16F_ARB ||
-            internalFormat == GL_RGB32F_ARB) {
-      printf("Convert rgb float tex to int %d x %d\n", width, height);
-      return GL_RGB;
-   }
-   else if (internalFormat == GL_LUMINANCE_ALPHA16F_ARB ||
-            internalFormat == GL_LUMINANCE_ALPHA32F_ARB) {
-      printf("Convert luminance float tex to int %d x %d\n", width, height);
-      return GL_LUMINANCE_ALPHA;
-   }
-   else if (internalFormat == GL_LUMINANCE16F_ARB ||
-            internalFormat == GL_LUMINANCE32F_ARB) {
-      printf("Convert luminance float tex to int %d x %d\n", width, height);
-      return GL_LUMINANCE;
-   }
-   else if (internalFormat == GL_ALPHA16F_ARB ||
-            internalFormat == GL_ALPHA32F_ARB) {
-      printf("Convert luminance float tex to int %d x %d\n", width, height);
-      return GL_ALPHA;
-   }
-   /*
-   else if (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) {
-      internalFormat = GL_RGBA;
-   }
-   */
-   else {
-      return internalFormat;
-   }
-#else
-   return internalFormat;
-#endif
-}
-
-
-/**
- * Choose the actual hardware format for a texture image.
- * Try to use the same format as the previous image level when possible.
- * Otherwise, ask the driver for the best format.
- * It's important to try to choose a consistant format for all levels
- * for efficient texture memory layout/allocation.  In particular, this
- * comes up during automatic mipmap generation.
- */
-gl_format
-_mesa_choose_texture_format(struct gl_context *ctx,
-                            struct gl_texture_object *texObj,
-                            GLenum target, GLint level,
-                            GLenum internalFormat, GLenum format, GLenum type)
-{
-   gl_format f;
-
-   /* see if we've already chosen a format for the previous level */
-   if (level > 0) {
-      struct gl_texture_image *prevImage =
-	 _mesa_select_tex_image(ctx, texObj, target, level - 1);
-      /* See if the prev level is defined and has an internal format which
-       * matches the new internal format.
-       */
-      if (prevImage &&
-          prevImage->Width > 0 &&
-          prevImage->InternalFormat == internalFormat) {
-         /* use the same format */
-         ASSERT(prevImage->TexFormat != MESA_FORMAT_NONE);
-         return prevImage->TexFormat;
-      }
-   }
-
-   /* choose format from scratch */
-   f = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
-   ASSERT(f != MESA_FORMAT_NONE);
-   return f;
-}
-
-
-/**
- * Common code to implement all the glTexImage1D/2D/3D functions.
- */
-static void
-teximage(struct gl_context *ctx, GLuint dims,
-         GLenum target, GLint level, GLint internalFormat,
-         GLsizei width, GLsizei height, GLsizei depth,
-         GLint border, GLenum format, GLenum type,
-         const GLvoid *pixels)
-{
-   GLboolean error;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n",
-                  dims,
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat),
-                  width, height, depth, border,
-                  _mesa_lookup_enum_by_nr(format),
-                  _mesa_lookup_enum_by_nr(type), pixels);
-
-   internalFormat = override_internal_format(internalFormat, width, height);
-
-   /* target error checking */
-   if (!legal_teximage_target(ctx, dims, target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%uD(target=%s)",
-                  dims, _mesa_lookup_enum_by_nr(target));
-      return;
-   }
-
-   /* general error checking */
-   error = texture_error_check(ctx, dims, target, level, internalFormat,
-                               format, type, width, height, depth, border);
-
-   if (_mesa_is_proxy_texture(target)) {
-      /* Proxy texture: just clear or set state depending on error checking */
-      struct gl_texture_image *texImage =
-         _mesa_get_proxy_tex_image(ctx, target, level);
-
-      if (error) {
-         /* when error, clear all proxy texture image parameters */
-         if (texImage)
-            clear_teximage_fields(texImage);
-      }
-      else {
-         /* no error, set the tex image parameters */
-         struct gl_texture_object *texObj =
-            _mesa_get_current_tex_object(ctx, target);
-         gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
-                                                           target, level,
-                                                           internalFormat,
-                                                           format, type);
-
-         if (legal_texture_size(ctx, texFormat, width, height, depth)) {
-            _mesa_init_teximage_fields(ctx, target, texImage, width, height,
-                                       depth, border, internalFormat,
-                                       texFormat);
-         }
-         else if (texImage) {
-            clear_teximage_fields(texImage);
-         }
-      }
-   }
-   else {
-      /* non-proxy target */
-      const GLuint face = _mesa_tex_target_to_face(target);
-      struct gl_texture_object *texObj;
-      struct gl_texture_image *texImage;
-
-      if (error) {
-         return;   /* error was recorded */
-      }
-
-      if (ctx->NewState & _NEW_PIXEL)
-	 _mesa_update_state(ctx);
-
-      texObj = _mesa_get_current_tex_object(ctx, target);
-
-      _mesa_lock_texture(ctx, texObj);
-      {
-	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-
-	 if (!texImage) {
-	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
-	 }
-         else {
-            gl_format texFormat;
-
-            if (texImage->Data) {
-               ctx->Driver.FreeTexImageData( ctx, texImage );
-            }
-
-            ASSERT(texImage->Data == NULL);
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, format,
-                                                    type);
-
-            if (legal_texture_size(ctx, texFormat, width, height, depth)) {
-               _mesa_init_teximage_fields(ctx, target, texImage,
-                                          width, height, depth,
-                                          border, internalFormat, texFormat);
-
-               /* Give the texture to the driver.  <pixels> may be null. */
-               ASSERT(ctx->Driver.TexImage3D);
-               switch (dims) {
-               case 1:
-                  ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
-                                         width, border, format,
-                                         type, pixels, &ctx->Unpack, texObj,
-                                         texImage);
-                  break;
-               case 2:
-                  ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
-                                         width, height, border, format,
-                                         type, pixels, &ctx->Unpack, texObj,
-                                         texImage);
-                  break;
-               case 3:
-                  ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
-                                         width, height, depth, border, format,
-                                         type, pixels, &ctx->Unpack, texObj,
-                                         texImage);
-                  break;
-               default:
-                  _mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
-               }
-
-               check_gen_mipmap(ctx, target, texObj, level);
-
-               update_fbo_texture(ctx, texObj, face, level);
-
-               /* state update */
-               texObj->_Complete = GL_FALSE;
-               ctx->NewState |= _NEW_TEXTURE;
-            }
-            else {
-               _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
-            }
-         }
-      }
-      _mesa_unlock_texture(ctx, texObj);
-   }
-}
-
-
-/*
- * Called from the API.  Note that width includes the border.
- */
-void GLAPIENTRY
-_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
-                  GLsizei width, GLint border, GLenum format,
-                  GLenum type, const GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   teximage(ctx, 1, target, level, internalFormat, width, 1, 1,
-            border, format, type, pixels);
-}
-
-
-void GLAPIENTRY
-_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
-                  GLsizei width, GLsizei height, GLint border,
-                  GLenum format, GLenum type,
-                  const GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   teximage(ctx, 2, target, level, internalFormat, width, height, 1,
-            border, format, type, pixels);
-}
-
-
-/*
- * Called by the API or display list executor.
- * Note that width and height include the border.
- */
-void GLAPIENTRY
-_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
-                  GLsizei width, GLsizei height, GLsizei depth,
-                  GLint border, GLenum format, GLenum type,
-                  const GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   teximage(ctx, 3, target, level, internalFormat, width, height, depth,
-            border, format, type, pixels);
-}
-
-
-void GLAPIENTRY
-_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat,
-                     GLsizei width, GLsizei height, GLsizei depth,
-                     GLint border, GLenum format, GLenum type,
-                     const GLvoid *pixels )
-{
-   _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height,
-                    depth, border, format, type, pixels);
-}
-
-
-#if FEATURE_OES_EGL_image
-void GLAPIENTRY
-_mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (!ctx->Extensions.OES_EGL_image) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glEGLImageTargetTexture2DOES(unsupported)");
-      return;
-   }
-
-   if (target != GL_TEXTURE_2D) {
-      _mesa_error(ctx, GL_INVALID_ENUM,
-		  "glEGLImageTargetTexture2D(target=%d)", target);
-      return;
-   }
-
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_state(ctx);
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-   _mesa_lock_texture(ctx, texObj);
-
-   texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
-   if (!texImage) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEGLImageTargetTexture2D");
-   } else {
-      if (texImage->Data)
-	 ctx->Driver.FreeTexImageData( ctx, texImage );
-
-      ASSERT(texImage->Data == NULL);
-      ctx->Driver.EGLImageTargetTexture2D(ctx, target,
-					  texObj, texImage, image);
-
-      /* state update */
-      texObj->_Complete = GL_FALSE;
-      ctx->NewState |= _NEW_TEXTURE;
-   }
-   _mesa_unlock_texture(ctx, texObj);
-
-}
-#endif
-
-
-
-/**
- * Implement all the glTexSubImage1/2/3D() functions.
- */
-static void
-texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
-            GLint xoffset, GLint yoffset, GLint zoffset,
-            GLsizei width, GLsizei height, GLsizei depth,
-            GLenum format, GLenum type, const GLvoid *pixels )
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexSubImage%uD %s %d %d %d %d %d %d %d %s %s %p\n",
-                  dims,
-                  _mesa_lookup_enum_by_nr(target), level,
-                  xoffset, yoffset, zoffset, width, height, depth,
-                  _mesa_lookup_enum_by_nr(format),
-                  _mesa_lookup_enum_by_nr(type), pixels);
-
-   /* check target (proxies not allowed) */
-   if (!legal_texsubimage_target(ctx, dims, target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(target=%s)",
-                  dims, _mesa_lookup_enum_by_nr(target));
-      return;
-   }       
-
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_state(ctx);
-
-   if (subtexture_error_check(ctx, dims, target, level, xoffset, yoffset, zoffset,
-                              width, height, depth, format, type)) {
-      return;   /* error was detected */
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-      if (subtexture_error_check2(ctx, dims, target, level,
-                                  xoffset, yoffset, zoffset,
-				  width, height, depth,
-                                  format, type, texImage)) {
-         /* error was recorded */
-      }
-      else if (width > 0 && height > 0 && height > 0) {
-         /* If we have a border, offset=-1 is legal.  Bias by border width. */
-         switch (dims) {
-         case 3:
-            zoffset += texImage->Border;
-            /* fall-through */
-         case 2:
-            yoffset += texImage->Border;
-            /* fall-through */
-         case 1:
-            xoffset += texImage->Border;
-         }
-
-         switch (dims) {
-         case 1:
-            ctx->Driver.TexSubImage1D(ctx, target, level,
-                                      xoffset, width,
-                                      format, type, pixels,
-                                      &ctx->Unpack, texObj, texImage );
-            break;
-         case 2:
-            ctx->Driver.TexSubImage2D(ctx, target, level,
-                                      xoffset, yoffset, width, height,
-                                      format, type, pixels,
-                                      &ctx->Unpack, texObj, texImage );
-            break;
-         case 3:
-            ctx->Driver.TexSubImage3D(ctx, target, level,
-                                      xoffset, yoffset, zoffset,
-                                      width, height, depth,
-                                      format, type, pixels,
-                                      &ctx->Unpack, texObj, texImage );
-            break;
-         default:
-            _mesa_problem(ctx, "unexpected dims in subteximage()");
-         }
-
-         check_gen_mipmap(ctx, target, texObj, level);
-
-         ctx->NewState |= _NEW_TEXTURE;
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
-
-
-void GLAPIENTRY
-_mesa_TexSubImage1D( GLenum target, GLint level,
-                     GLint xoffset, GLsizei width,
-                     GLenum format, GLenum type,
-                     const GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   texsubimage(ctx, 1, target, level,
-               xoffset, 0, 0,
-               width, 1, 1,
-               format, type, pixels);
-}
-
-
-void GLAPIENTRY
-_mesa_TexSubImage2D( GLenum target, GLint level,
-                     GLint xoffset, GLint yoffset,
-                     GLsizei width, GLsizei height,
-                     GLenum format, GLenum type,
-                     const GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   texsubimage(ctx, 2, target, level,
-               xoffset, yoffset, 0,
-               width, height, 1,
-               format, type, pixels);
-}
-
-
-
-void GLAPIENTRY
-_mesa_TexSubImage3D( GLenum target, GLint level,
-                     GLint xoffset, GLint yoffset, GLint zoffset,
-                     GLsizei width, GLsizei height, GLsizei depth,
-                     GLenum format, GLenum type,
-                     const GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   texsubimage(ctx, 3, target, level,
-               xoffset, yoffset, zoffset,
-               width, height, depth,
-               format, type, pixels);
-}
-
-
-
-/**
- * Implement the glCopyTexImage1/2D() functions.
- */
-static void
-copyteximage(struct gl_context *ctx, GLuint dims,
-             GLenum target, GLint level, GLenum internalFormat,
-             GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   const GLuint face = _mesa_tex_target_to_face(target);
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n",
-                  dims,
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat),
-                  x, y, width, height, border);
-
-   if (ctx->NewState & NEW_COPY_TEX_STATE)
-      _mesa_update_state(ctx);
-
-   if (copytexture_error_check(ctx, dims, target, level, internalFormat,
-                               width, height, border))
-      return;
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-
-      if (!texImage) {
-	 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
-      }
-      else {
-         gl_format texFormat;
-
-         if (texImage->Data) {
-            ctx->Driver.FreeTexImageData( ctx, texImage );
-         }
-
-         ASSERT(texImage->Data == NULL);
-
-         texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                 internalFormat, GL_NONE,
-                                                 GL_NONE);
-
-         if (legal_texture_size(ctx, texFormat, width, height, 1)) {
-            _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
-                                       border, internalFormat, texFormat);
-
-            ASSERT(ctx->Driver.CopyTexImage2D);
-            if (dims == 1)
-               ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
-                                          x, y, width, border);
-            else
-               ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
-                                          x, y, width, height, border);
-
-            check_gen_mipmap(ctx, target, texObj, level);
-
-            update_fbo_texture(ctx, texObj, face, level);
-
-            /* state update */
-            texObj->_Complete = GL_FALSE;
-            ctx->NewState |= _NEW_TEXTURE;
-         }
-         else {
-            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
-         }
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexImage1D( GLenum target, GLint level,
-                      GLenum internalFormat,
-                      GLint x, GLint y,
-                      GLsizei width, GLint border )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   copyteximage(ctx, 1, target, level, internalFormat, x, y, width, 1, border);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
-                      GLint x, GLint y, GLsizei width, GLsizei height,
-                      GLint border )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   copyteximage(ctx, 2, target, level, internalFormat,
-                x, y, width, height, border);
-}
-
-
-
-/**
- * Implementation for glCopyTexSubImage1/2/3D() functions.
- */
-static void
-copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
-                GLint xoffset, GLint yoffset, GLint zoffset,
-                GLint x, GLint y, GLsizei width, GLsizei height)
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCopyTexSubImage%uD %s %d %d %d %d %d %d %d %d\n",
-                  dims,
-                  _mesa_lookup_enum_by_nr(target),
-                  level, xoffset, yoffset, zoffset, x, y, width, height);
-
-   if (ctx->NewState & NEW_COPY_TEX_STATE)
-      _mesa_update_state(ctx);
-
-   if (copytexsubimage_error_check1(ctx, dims, target, level))
-      return;
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-      if (copytexsubimage_error_check2(ctx, dims, target, level, xoffset, yoffset,
-				       zoffset, width, height, texImage)) {
-         /* error was recored */
-      }
-      else {
-         /* If we have a border, offset=-1 is legal.  Bias by border width. */
-         switch (dims) {
-         case 3:
-            zoffset += texImage->Border;
-            /* fall-through */
-         case 2:
-            yoffset += texImage->Border;
-            /* fall-through */
-         case 1:
-            xoffset += texImage->Border;
-         }
-
-         if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
-                                        &width, &height)) {
-            switch (dims) {
-            case 1:
-               ctx->Driver.CopyTexSubImage1D(ctx, target, level,
-                                             xoffset, x, y, width);
-               break;
-            case 2:
-               ctx->Driver.CopyTexSubImage2D(ctx, target, level,
-                                             xoffset, yoffset,
-                                             x, y, width, height);
-               break;
-            case 3:
-               ctx->Driver.CopyTexSubImage3D(ctx, target, level,
-                                             xoffset, yoffset, zoffset,
-                                             x, y, width, height);
-               break;
-            default:
-               _mesa_problem(ctx, "bad dims in copytexsubimage()");
-            }
-
-            check_gen_mipmap(ctx, target, texObj, level);
-
-            ctx->NewState |= _NEW_TEXTURE;
-         }
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
-
-
-void GLAPIENTRY
-_mesa_CopyTexSubImage1D( GLenum target, GLint level,
-                         GLint xoffset, GLint x, GLint y, GLsizei width )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   copytexsubimage(ctx, 1, target, level, xoffset, 0, 0, x, y, width, 1);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexSubImage2D( GLenum target, GLint level,
-                         GLint xoffset, GLint yoffset,
-                         GLint x, GLint y, GLsizei width, GLsizei height )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   copytexsubimage(ctx, 2, target, level, xoffset, yoffset, 0, x, y,
-                   width, height);
-}
-
-
-
-void GLAPIENTRY
-_mesa_CopyTexSubImage3D( GLenum target, GLint level,
-                         GLint xoffset, GLint yoffset, GLint zoffset,
-                         GLint x, GLint y, GLsizei width, GLsizei height )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   copytexsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
-                   x, y, width, height);
-}
-
-
-
-
-/**********************************************************************/
-/******                   Compressed Textures                    ******/
-/**********************************************************************/
-
-
-/**
- * Return expected size of a compressed texture.
- */
-static GLuint
-compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth,
-                    GLenum glformat)
-{
-   gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
-   return _mesa_format_image_size(mesaFormat, width, height, depth);
-}
-
-
-/*
- * Return compressed texture block size, in pixels.
- */
-static void
-get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
-{
-   gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
-   _mesa_get_format_block_size(mesaFormat, bw, bh);
-}
-
-
-/**
- * Error checking for glCompressedTexImage[123]D().
- * \return error code or GL_NO_ERROR.
- */
-static GLenum
-compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
-                               GLenum target, GLint level,
-                               GLenum internalFormat, GLsizei width,
-                               GLsizei height, GLsizei depth, GLint border,
-                               GLsizei imageSize)
-{
-   const GLenum proxyTarget = get_proxy_target(target);
-   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
-   GLint expectedSize;
-
-   /* check level */
-   if (level < 0 || level >= maxLevels)
-      return GL_INVALID_VALUE;
-
-   if (!target_can_be_compressed(ctx, target, internalFormat)) {
-      return GL_INVALID_ENUM;
-   }
-
-   /* This will detect any invalid internalFormat value */
-   if (!_mesa_is_compressed_format(ctx, internalFormat))
-      return GL_INVALID_ENUM;
-
-   /* This should really never fail */
-   if (_mesa_base_tex_format(ctx, internalFormat) < 0)
-      return GL_INVALID_ENUM;
-
-   /* No compressed formats support borders at this time */
-   if (border != 0)
-      return GL_INVALID_VALUE;
-
-   /* For cube map, width must equal height */
-   if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-       target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height)
-      return GL_INVALID_VALUE;
-
-   /* check image size against compression block size */
-   {
-      gl_format texFormat =
-         ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
-                                         GL_NONE, GL_NONE);
-      GLuint bw, bh;
-
-      _mesa_get_format_block_size(texFormat, &bw, &bh);
-      if ((width > bw && width % bw > 0) ||
-          (height > bh && height % bh > 0)) {
-         /*
-          * Per GL_ARB_texture_compression:  GL_INVALID_OPERATION is
-          * generated [...] if any parameter combinations are not
-          * supported by the specific compressed internal format. 
-          */
-         return GL_INVALID_OPERATION;
-      }
-   }
-
-   /* check image sizes */
-   if (!ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
-                                      internalFormat, GL_NONE, GL_NONE,
-                                      width, height, depth, border)) {
-      /* See error comment above */
-      return GL_INVALID_OPERATION;
-   }
-
-   /* check image size in bytes */
-   expectedSize = compressed_tex_size(width, height, depth, internalFormat);
-   if (expectedSize != imageSize) {
-      /* Per GL_ARB_texture_compression:  GL_INVALID_VALUE is generated [...]
-       * if <imageSize> is not consistent with the format, dimensions, and
-       * contents of the specified image.
-       */
-      return GL_INVALID_VALUE;
-   }
-
-   return GL_NO_ERROR;
-}
-
-
-/**
- * Error checking for glCompressedTexSubImage[123]D().
- * \warning  There are some bad assumptions here about the size of compressed
- *           texture tiles (multiple of 4) used to test the validity of the
- *           offset and size parameters.
- * \return error code or GL_NO_ERROR.
- */
-static GLenum
-compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
-                                  GLenum target, GLint level,
-                                  GLint xoffset, GLint yoffset, GLint zoffset,
-                                  GLsizei width, GLsizei height, GLsizei depth,
-                                  GLenum format, GLsizei imageSize)
-{
-   GLint expectedSize, maxLevels = 0, maxTextureSize;
-   GLuint bw, bh;
-   (void) zoffset;
-
-   if (dimensions == 1) {
-      /* 1D compressed textures not allowed */
-      return GL_INVALID_ENUM;
-   }
-   else if (dimensions == 2) {
-      if (target == GL_PROXY_TEXTURE_2D) {
-         maxLevels = ctx->Const.MaxTextureLevels;
-      }
-      else if (target == GL_TEXTURE_2D) {
-         maxLevels = ctx->Const.MaxTextureLevels;
-      }
-      else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map)
-            return GL_INVALID_ENUM; /*target*/
-         maxLevels = ctx->Const.MaxCubeTextureLevels;
-      }
-      else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-               target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map)
-            return GL_INVALID_ENUM; /*target*/
-         maxLevels = ctx->Const.MaxCubeTextureLevels;
-      }
-      else {
-         return GL_INVALID_ENUM; /*target*/
-      }
-   }
-   else if (dimensions == 3) {
-      /* 3D compressed textures not allowed */
-      return GL_INVALID_ENUM;
-   }
-
-   maxTextureSize = 1 << (maxLevels - 1);
-
-   /* this will catch any invalid compressed format token */
-   if (!_mesa_is_compressed_format(ctx, format))
-      return GL_INVALID_ENUM;
-
-   if (width < 1 || width > maxTextureSize)
-      return GL_INVALID_VALUE;
-
-   if ((height < 1 || height > maxTextureSize)
-       && dimensions > 1)
-      return GL_INVALID_VALUE;
-
-   if (level < 0 || level >= maxLevels)
-      return GL_INVALID_VALUE;
-
-   /*
-    * do checks which depend on compression block size
-    */
-   get_compressed_block_size(format, &bw, &bh);
-
-   if ((xoffset % bw != 0) || (yoffset % bh != 0))
-      return GL_INVALID_VALUE;
-
-   if ((width % bw != 0) && width != 2 && width != 1)
-      return GL_INVALID_VALUE;
-
-   if ((height % bh != 0) && height != 2 && height != 1)
-      return GL_INVALID_VALUE;
-
-   expectedSize = compressed_tex_size(width, height, depth, format);
-   if (expectedSize != imageSize)
-      return GL_INVALID_VALUE;
-
-   return GL_NO_ERROR;
-}
-
-
-/**
- * Do second part of glCompressedTexSubImage error checking.
- * \return GL_TRUE if error found, GL_FALSE otherwise.
- */
-static GLboolean
-compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
-                                   GLsizei width, GLsizei height,
-                                   GLsizei depth, GLenum format,
-                                   struct gl_texture_image *texImage)
-{
-
-   if ((GLint) format != texImage->InternalFormat) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glCompressedTexSubImage%uD(format=0x%x)", dims, format);
-      return GL_TRUE;
-   }
-
-   if (((width == 1 || width == 2) &&
-        width != (GLsizei) texImage->Width) ||
-       (width > (GLsizei) texImage->Width)) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glCompressedTexSubImage%uD(width=%d)", dims, width);
-      return GL_TRUE;
-   }
-
-   if (dims >= 2) {
-      if (((height == 1 || height == 2) &&
-           height != (GLsizei) texImage->Height) ||
-          (height > (GLsizei) texImage->Height)) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCompressedTexSubImage%uD(height=%d)", dims, height);
-         return GL_TRUE;
-      }
-   }
-
-   if (dims >= 3) {
-      if (((depth == 1 || depth == 2) &&
-           depth != (GLsizei) texImage->Depth) ||
-          (depth > (GLsizei) texImage->Depth)) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glCompressedTexSubImage%uD(depth=%d)", dims, depth);
-         return GL_TRUE;
-      }
-   }
-
-   return GL_FALSE;
-}
-
-
-/**
- * Implementation of the glCompressedTexImage1/2/3D() functions.
- */
-static void
-compressedteximage(struct gl_context *ctx, GLuint dims,
-                   GLenum target, GLint level,
-                   GLenum internalFormat, GLsizei width,
-                   GLsizei height, GLsizei depth, GLint border,
-                   GLsizei imageSize, const GLvoid *data)
-{
-   GLenum error;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx,
-                  "glCompressedTexImage%uDARB %s %d %s %d %d %d %d %d %p\n",
-                  dims,
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat),
-                  width, height, depth, border, imageSize, data);
-
-   /* check target */
-   if (!legal_teximage_target(ctx, dims, target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target=%s)",
-                  dims, _mesa_lookup_enum_by_nr(target));
-      return;
-   }
-
-   error = compressed_texture_error_check(ctx, dims, target, level,
-                                          internalFormat, width, height, depth,
-                                          border, imageSize);
-
-#if FEATURE_ES
-   /* XXX this is kind of a hack */
-   if (error) {
-      _mesa_error(ctx, error, "glTexImage2D");
-      return;
-   }
-
-   if (dims == 2) {
-      switch (internalFormat) {
-      case GL_PALETTE4_RGB8_OES:
-      case GL_PALETTE4_RGBA8_OES:
-      case GL_PALETTE4_R5_G6_B5_OES:
-      case GL_PALETTE4_RGBA4_OES:
-      case GL_PALETTE4_RGB5_A1_OES:
-      case GL_PALETTE8_RGB8_OES:
-      case GL_PALETTE8_RGBA8_OES:
-      case GL_PALETTE8_R5_G6_B5_OES:
-      case GL_PALETTE8_RGBA4_OES:
-      case GL_PALETTE8_RGB5_A1_OES:
-         _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
-                                          width, height, imageSize, data);
-         return;
-      }
-   }
-#endif
-
-   if (_mesa_is_proxy_texture(target)) {
-      /* Proxy texture: just check for errors and update proxy state */
-      struct gl_texture_image *texImage;
-
-      if (!error) {
-         struct gl_texture_object *texObj =
-            _mesa_get_current_tex_object(ctx, target);
-         gl_format texFormat =
-            _mesa_choose_texture_format(ctx, texObj, target, level,
-                                        internalFormat, GL_NONE, GL_NONE);
-         if (!legal_texture_size(ctx, texFormat, width, height, depth)) {
-            error = GL_OUT_OF_MEMORY;
-         }
-      }
-
-      texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-      if (texImage) {
-         if (error) {
-            /* if error, clear all proxy texture image parameters */
-            clear_teximage_fields(texImage);
-         }
-         else {
-            /* no error: store the teximage parameters */
-            _mesa_init_teximage_fields(ctx, target, texImage, width, height,
-                                       depth, border, internalFormat,
-                                       MESA_FORMAT_NONE);
-         }
-      }
-   }
-   else {
-      /* non-proxy target */
-      struct gl_texture_object *texObj;
-      struct gl_texture_image *texImage;
-
-      if (error) {
-         _mesa_error(ctx, error, "glCompressedTexImage%uD", dims);
-         return;
-      }
-
-      texObj = _mesa_get_current_tex_object(ctx, target);
-
-      _mesa_lock_texture(ctx, texObj);
-      {
-	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-	 if (!texImage) {
-	    _mesa_error(ctx, GL_OUT_OF_MEMORY,
-                        "glCompressedTexImage%uD", dims);
-	 }
-         else {
-            gl_format texFormat;
-
-            if (texImage->Data) {
-               ctx->Driver.FreeTexImageData( ctx, texImage );
-            }
-            ASSERT(texImage->Data == NULL);
-
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, GL_NONE,
-                                                    GL_NONE);
-
-            if (legal_texture_size(ctx, texFormat, width, height, depth)) {
-               _mesa_init_teximage_fields(ctx, target, texImage,
-                                          width, height, depth,
-                                          border, internalFormat, texFormat);
-
-               switch (dims) {
-               case 1:
-                  ASSERT(ctx->Driver.CompressedTexImage1D);
-                  ctx->Driver.CompressedTexImage1D(ctx, target, level,
-                                                   internalFormat,
-                                                   width,
-                                                   border, imageSize, data,
-                                                   texObj, texImage);
-                  break;
-               case 2:
-                  ASSERT(ctx->Driver.CompressedTexImage2D);
-                  ctx->Driver.CompressedTexImage2D(ctx, target, level,
-                                                   internalFormat,
-                                                   width, height,
-                                                   border, imageSize, data,
-                                                   texObj, texImage);
-                  break;
-               case 3:
-                  ASSERT(ctx->Driver.CompressedTexImage3D);
-                  ctx->Driver.CompressedTexImage3D(ctx, target, level,
-                                                   internalFormat,
-                                                   width, height, depth,
-                                                   border, imageSize, data,
-                                                   texObj, texImage);
-                  break;
-               default:
-                  _mesa_problem(ctx, "bad dims in compressedteximage");
-               }
-
-               check_gen_mipmap(ctx, target, texObj, level);
-
-               /* state update */
-               texObj->_Complete = GL_FALSE;
-               ctx->NewState |= _NEW_TEXTURE;
-            }
-            else {
-               _mesa_error(ctx, GL_OUT_OF_MEMORY,
-                           "glCompressedTexImage%uD", dims);
-            }
-         }
-      }
-      _mesa_unlock_texture(ctx, texObj);
-   }
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
-                              GLenum internalFormat, GLsizei width,
-                              GLint border, GLsizei imageSize,
-                              const GLvoid *data)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   compressedteximage(ctx, 1, target, level, internalFormat,
-                      width, 1, 1, border, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
-                              GLenum internalFormat, GLsizei width,
-                              GLsizei height, GLint border, GLsizei imageSize,
-                              const GLvoid *data)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   compressedteximage(ctx, 2, target, level, internalFormat,
-                      width, height, 1, border, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexImage3DARB(GLenum target, GLint level,
-                              GLenum internalFormat, GLsizei width,
-                              GLsizei height, GLsizei depth, GLint border,
-                              GLsizei imageSize, const GLvoid *data)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   compressedteximage(ctx, 3, target, level, internalFormat,
-                      width, height, depth, border, imageSize, data);
-}
-
-
-/**
- * Common helper for glCompressedTexSubImage1/2/3D().
- */
-static void
-compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
-                         GLint xoffset, GLint yoffset, GLint zoffset,
-                         GLsizei width, GLsizei height, GLsizei depth,
-                         GLenum format, GLsizei imageSize, const GLvoid *data)
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GLenum error;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   error = compressed_subtexture_error_check(ctx, dims, target, level,
-                                             xoffset, 0, 0, /* pos */
-                                             width, height, depth,   /* size */
-                                             format, imageSize);
-   if (error) {
-      _mesa_error(ctx, error, "glCompressedTexSubImage%uD", dims);
-      return;
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-      assert(texImage);
-
-      if (compressed_subtexture_error_check2(ctx, dims, width, height, depth,
-                                             format, texImage)) {
-         /* error was recorded */
-      }
-      else if (width > 0 && height > 0 && depth > 0) {
-         switch (dims) {
-         case 1:
-            if (ctx->Driver.CompressedTexSubImage1D) {
-               ctx->Driver.CompressedTexSubImage1D(ctx, target, level,
-                                                   xoffset, width,
-                                                   format, imageSize, data,
-                                                   texObj, texImage);
-            }
-            break;
-         case 2:
-            if (ctx->Driver.CompressedTexSubImage2D) {
-               ctx->Driver.CompressedTexSubImage2D(ctx, target, level,
-                                                   xoffset, yoffset,
-                                                   width, height,
-                                                   format, imageSize, data,
-                                                   texObj, texImage);
-            }
-            break;
-         case 3:
-            if (ctx->Driver.CompressedTexSubImage3D) {
-               ctx->Driver.CompressedTexSubImage3D(ctx, target, level,
-                                                   xoffset, yoffset, zoffset,
-                                                   width, height, depth,
-                                                   format, imageSize, data,
-                                                   texObj, texImage);
-            }
-            break;
-         default:
-            ;
-         }
-
-         check_gen_mipmap(ctx, target, texObj, level);
-
-         ctx->NewState |= _NEW_TEXTURE;
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
-                                 GLsizei width, GLenum format,
-                                 GLsizei imageSize, const GLvoid *data)
-{
-   compressed_tex_sub_image(1, target, level, xoffset, 0, 0, width, 1, 1,
-                            format, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
-                                 GLint yoffset, GLsizei width, GLsizei height,
-                                 GLenum format, GLsizei imageSize,
-                                 const GLvoid *data)
-{
-   compressed_tex_sub_image(2, target, level, xoffset, yoffset, 0,
-                            width, height, 1, format, imageSize, data);
-}
-
-
-void GLAPIENTRY
-_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
-                                 GLint yoffset, GLint zoffset, GLsizei width,
-                                 GLsizei height, GLsizei depth, GLenum format,
-                                 GLsizei imageSize, const GLvoid *data)
-{
-   compressed_tex_sub_image(3, target, level, xoffset, yoffset, zoffset,
-                            width, height, depth, format, imageSize, data);
-}
-
-
-/**
- * Helper for glTexBuffer().  Check if internalFormat is legal.  If so,
- * return the basic data type and number of components for the format.
- * \param return  GL_TRUE if internalFormat is legal, GL_FALSE otherwise
- */
-static GLboolean
-get_sized_format_info(const struct gl_context *ctx, GLenum internalFormat,
-                      GLenum *datatype, GLuint *components)
-{
-   switch (internalFormat) {
-   case GL_ALPHA8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 1;
-      break;
-   case GL_ALPHA16:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 1;
-      break;
-   case GL_ALPHA16F_ARB:
-      *datatype = GL_HALF_FLOAT;
-      *components = 1;
-      break;
-   case GL_ALPHA32F_ARB:
-      *datatype = GL_FLOAT;
-      *components = 1;
-      break;
-   case GL_ALPHA8I_EXT:
-      *datatype = GL_BYTE;
-      *components = 1;
-      break;
-   case GL_ALPHA16I_EXT:
-      *datatype = GL_SHORT;
-      *components = 1;
-      break;
-   case GL_ALPHA32I_EXT:
-      *datatype = GL_INT;
-      *components = 1;
-      break;
-   case GL_ALPHA8UI_EXT:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 1;
-      break;
-   case GL_ALPHA16UI_EXT:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 1;
-      break;
-   case GL_ALPHA32UI_EXT:
-      *datatype = GL_UNSIGNED_INT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 1;
-      break;
-   case GL_LUMINANCE16:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE16F_ARB:
-      *datatype = GL_HALF_FLOAT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE32F_ARB:
-      *datatype = GL_FLOAT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE8I_EXT:
-      *datatype = GL_BYTE;
-      *components = 1;
-      break;
-   case GL_LUMINANCE16I_EXT:
-      *datatype = GL_SHORT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE32I_EXT:
-      *datatype = GL_INT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE8UI_EXT:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 1;
-      break;
-   case GL_LUMINANCE16UI_EXT:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE32UI_EXT:
-      *datatype = GL_UNSIGNED_INT;
-      *components = 1;
-      break;
-   case GL_LUMINANCE8_ALPHA8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 2;
-      break;
-   case GL_LUMINANCE16_ALPHA16:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA16F_ARB:
-      *datatype = GL_HALF_FLOAT;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA32F_ARB:
-      *datatype = GL_FLOAT;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA8I_EXT:
-      *datatype = GL_BYTE;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA16I_EXT:
-      *datatype = GL_SHORT;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA32I_EXT:
-      *datatype = GL_INT;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA8UI_EXT:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA16UI_EXT:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 2;
-      break;
-   case GL_LUMINANCE_ALPHA32UI_EXT:
-      *datatype = GL_UNSIGNED_INT;
-      *components = 2;
-      break;
-   case GL_INTENSITY8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 1;
-      break;
-   case GL_INTENSITY16:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 1;
-      break;
-   case GL_INTENSITY16F_ARB:
-      *datatype = GL_HALF_FLOAT;
-      *components = 1;
-      break;
-   case GL_INTENSITY32F_ARB:
-      *datatype = GL_FLOAT;
-      *components = 1;
-      break;
-   case GL_INTENSITY8I_EXT:
-      *datatype = GL_BYTE;
-      *components = 1;
-      break;
-   case GL_INTENSITY16I_EXT:
-      *datatype = GL_SHORT;
-      *components = 1;
-      break;
-   case GL_INTENSITY32I_EXT:
-      *datatype = GL_INT;
-      *components = 1;
-      break;
-   case GL_INTENSITY8UI_EXT:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 1;
-      break;
-   case GL_INTENSITY16UI_EXT:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 1;
-      break;
-   case GL_INTENSITY32UI_EXT:
-      *datatype = GL_UNSIGNED_INT;
-      *components = 1;
-      break;
-   case GL_RGBA8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 4;
-      break;
-   case GL_RGBA16:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 4;
-      break;
-   case GL_RGBA16F_ARB:
-      *datatype = GL_HALF_FLOAT;
-      *components = 4;
-      break;
-   case GL_RGBA32F_ARB:
-      *datatype = GL_FLOAT;
-      *components = 4;
-      break;
-   case GL_RGBA8I_EXT:
-      *datatype = GL_BYTE;
-      *components = 4;
-      break;
-   case GL_RGBA16I_EXT:
-      *datatype = GL_SHORT;
-      *components = 4;
-      break;
-   case GL_RGBA32I_EXT:
-      *datatype = GL_INT;
-      *components = 4;
-      break;
-   case GL_RGBA8UI_EXT:
-      *datatype = GL_UNSIGNED_BYTE;
-      *components = 4;
-      break;
-   case GL_RGBA16UI_EXT:
-      *datatype = GL_UNSIGNED_SHORT;
-      *components = 4;
-      break;
-   case GL_RGBA32UI_EXT:
-      *datatype = GL_UNSIGNED_INT;
-      *components = 4;
-      break;
-   default:
-      return GL_FALSE;
-   }
-
-   if (*datatype == GL_FLOAT && !ctx->Extensions.ARB_texture_float)
-      return GL_FALSE;
-
-   if (*datatype == GL_HALF_FLOAT && !ctx->Extensions.ARB_half_float_pixel)
-      return GL_FALSE;
-
-   return GL_TRUE;
-}
-
-
-/** GL_ARB_texture_buffer_object */
-void GLAPIENTRY
-_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
-{
-   struct gl_texture_object *texObj;
-   struct gl_buffer_object *bufObj;
-   GLenum dataType;
-   GLuint comps;
-
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (!ctx->Extensions.ARB_texture_buffer_object) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer");
-      return;
-   }
-
-   if (target != GL_TEXTURE_BUFFER_ARB) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(target)");
-      return;
-   }
-
-   if (!get_sized_format_info(ctx, internalFormat, &dataType, &comps)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(internalFormat 0x%x)",
-                  internalFormat);
-      return;
-   }
-
-   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
-   if (buffer && !bufObj) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer(buffer %u)", buffer);
-      return;
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      _mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
-      texObj->BufferObjectFormat = internalFormat;
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
+/*
+ * mesa 3-D graphics library
+ * Version:  7.6
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file teximage.c
+ * Texture image-related functions.
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "context.h"
+#include "enums.h"
+#include "fbobject.h"
+#include "framebuffer.h"
+#include "hash.h"
+#include "image.h"
+#include "imports.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "state.h"
+#include "texcompress.h"
+#include "texfetch.h"
+#include "teximage.h"
+#include "texstate.h"
+#include "texpal.h"
+#include "mtypes.h"
+
+
+/**
+ * State changes which we care about for glCopyTex[Sub]Image() calls.
+ * In particular, we care about pixel transfer state and buffer state
+ * (such as glReadBuffer to make sure we read from the right renderbuffer).
+ */
+#define NEW_COPY_TEX_STATE (_NEW_BUFFERS | _NEW_PIXEL)
+
+
+
+/**
+ * We allocate texture memory on 512-byte boundaries so we can use MMX/SSE
+ * elsewhere.
+ */
+void *
+_mesa_alloc_texmemory(GLsizei bytes)
+{
+   return _mesa_align_malloc(bytes, 512);
+}
+
+
+/**
+ * Free texture memory allocated with _mesa_alloc_texmemory()
+ */
+void
+_mesa_free_texmemory(void *m)
+{
+   _mesa_align_free(m);
+}
+
+
+/*
+ * Compute floor(log_base_2(n)).
+ * If n < 0 return -1.
+ */
+static int
+logbase2( int n )
+{
+   GLint i = 1;
+   GLint log2 = 0;
+
+   if (n < 0)
+      return -1;
+
+   if (n == 0)
+      return 0;
+
+   while ( n > i ) {
+      i *= 2;
+      log2++;
+   }
+   if (i != n) {
+      return log2 - 1;
+   }
+   else {
+      return log2;
+   }
+}
+
+
+
+/**
+ * Return the simple base format for a given internal texture format.
+ * For example, given GL_LUMINANCE12_ALPHA4, return GL_LUMINANCE_ALPHA.
+ *
+ * \param ctx GL context.
+ * \param internalFormat the internal texture format token or 1, 2, 3, or 4.
+ *
+ * \return the corresponding \u base internal format (GL_ALPHA, GL_LUMINANCE,
+ * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA), or -1 if invalid enum.
+ *
+ * This is the format which is used during texture application (i.e. the
+ * texture format and env mode determine the arithmetic used.
+ *
+ * XXX this could be static
+ */
+GLint
+_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
+{
+   switch (internalFormat) {
+      case GL_ALPHA:
+      case GL_ALPHA4:
+      case GL_ALPHA8:
+      case GL_ALPHA12:
+      case GL_ALPHA16:
+         return GL_ALPHA;
+      case 1:
+      case GL_LUMINANCE:
+      case GL_LUMINANCE4:
+      case GL_LUMINANCE8:
+      case GL_LUMINANCE12:
+      case GL_LUMINANCE16:
+         return GL_LUMINANCE;
+      case 2:
+      case GL_LUMINANCE_ALPHA:
+      case GL_LUMINANCE4_ALPHA4:
+      case GL_LUMINANCE6_ALPHA2:
+      case GL_LUMINANCE8_ALPHA8:
+      case GL_LUMINANCE12_ALPHA4:
+      case GL_LUMINANCE12_ALPHA12:
+      case GL_LUMINANCE16_ALPHA16:
+         return GL_LUMINANCE_ALPHA;
+      case GL_INTENSITY:
+      case GL_INTENSITY4:
+      case GL_INTENSITY8:
+      case GL_INTENSITY12:
+      case GL_INTENSITY16:
+         return GL_INTENSITY;
+      case 3:
+      case GL_RGB:
+      case GL_R3_G3_B2:
+      case GL_RGB4:
+      case GL_RGB5:
+      case GL_RGB8:
+      case GL_RGB10:
+      case GL_RGB12:
+      case GL_RGB16:
+         return GL_RGB;
+      case 4:
+      case GL_RGBA:
+      case GL_RGBA2:
+      case GL_RGBA4:
+      case GL_RGB5_A1:
+      case GL_RGBA8:
+      case GL_RGB10_A2:
+      case GL_RGBA12:
+      case GL_RGBA16:
+         return GL_RGBA;
+      default:
+         ; /* fallthrough */
+   }
+
+   if (ctx->Extensions.EXT_texture_format_BGRA8888) {
+      switch (internalFormat) {
+         case GL_BGRA_EXT:
+            return GL_RGBA;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.EXT_paletted_texture) {
+      switch (internalFormat) {
+         case GL_COLOR_INDEX:
+         case GL_COLOR_INDEX1_EXT:
+         case GL_COLOR_INDEX2_EXT:
+         case GL_COLOR_INDEX4_EXT:
+         case GL_COLOR_INDEX8_EXT:
+         case GL_COLOR_INDEX12_EXT:
+         case GL_COLOR_INDEX16_EXT:
+            return GL_COLOR_INDEX;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.ARB_depth_texture) {
+      switch (internalFormat) {
+         case GL_DEPTH_COMPONENT:
+         case GL_DEPTH_COMPONENT16:
+         case GL_DEPTH_COMPONENT24:
+         case GL_DEPTH_COMPONENT32:
+            return GL_DEPTH_COMPONENT;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   switch (internalFormat) {
+   case GL_COMPRESSED_ALPHA:
+      return GL_ALPHA;
+   case GL_COMPRESSED_LUMINANCE:
+      return GL_LUMINANCE;
+   case GL_COMPRESSED_LUMINANCE_ALPHA:
+      return GL_LUMINANCE_ALPHA;
+   case GL_COMPRESSED_INTENSITY:
+      return GL_INTENSITY;
+   case GL_COMPRESSED_RGB:
+      return GL_RGB;
+   case GL_COMPRESSED_RGBA:
+      return GL_RGBA;
+   default:
+      ; /* fallthrough */
+   }
+         
+   if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+      switch (internalFormat) {
+         case GL_COMPRESSED_RGB_FXT1_3DFX:
+            return GL_RGB;
+         case GL_COMPRESSED_RGBA_FXT1_3DFX:
+            return GL_RGBA;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.EXT_texture_compression_s3tc) {
+      switch (internalFormat) {
+         case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+            return GL_RGB;
+         case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+         case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+         case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+            return GL_RGBA;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.S3_s3tc) {
+      switch (internalFormat) {
+         case GL_RGB_S3TC:
+         case GL_RGB4_S3TC:
+            return GL_RGB;
+         case GL_RGBA_S3TC:
+         case GL_RGBA4_S3TC:
+            return GL_RGBA;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.MESA_ycbcr_texture) {
+      if (internalFormat == GL_YCBCR_MESA)
+         return GL_YCBCR_MESA;
+   }
+
+   if (ctx->Extensions.ARB_texture_float) {
+      switch (internalFormat) {
+         case GL_ALPHA16F_ARB:
+         case GL_ALPHA32F_ARB:
+            return GL_ALPHA;
+         case GL_RGBA16F_ARB:
+         case GL_RGBA32F_ARB:
+            return GL_RGBA;
+         case GL_RGB16F_ARB:
+         case GL_RGB32F_ARB:
+            return GL_RGB;
+         case GL_INTENSITY16F_ARB:
+         case GL_INTENSITY32F_ARB:
+            return GL_INTENSITY;
+         case GL_LUMINANCE16F_ARB:
+         case GL_LUMINANCE32F_ARB:
+            return GL_LUMINANCE;
+         case GL_LUMINANCE_ALPHA16F_ARB:
+         case GL_LUMINANCE_ALPHA32F_ARB:
+            return GL_LUMINANCE_ALPHA;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.ATI_envmap_bumpmap) {
+      switch (internalFormat) {
+         case GL_DUDV_ATI:
+         case GL_DU8DV8_ATI:
+            return GL_DUDV_ATI;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.EXT_texture_snorm) {
+      switch (internalFormat) {
+         case GL_RED_SNORM:
+         case GL_R8_SNORM:
+         case GL_R16_SNORM:
+            return GL_RED;
+         case GL_RG_SNORM:
+         case GL_RG8_SNORM:
+         case GL_RG16_SNORM:
+            return GL_RG;
+         case GL_RGB_SNORM:
+         case GL_RGB8_SNORM:
+         case GL_RGB16_SNORM:
+            return GL_RGB;
+         case GL_RGBA_SNORM:
+         case GL_RGBA8_SNORM:
+         case GL_RGBA16_SNORM:
+            return GL_RGBA;
+         case GL_ALPHA_SNORM:
+         case GL_ALPHA8_SNORM:
+         case GL_ALPHA16_SNORM:
+            return GL_ALPHA;
+         case GL_LUMINANCE_SNORM:
+         case GL_LUMINANCE8_SNORM:
+         case GL_LUMINANCE16_SNORM:
+            return GL_LUMINANCE;
+         case GL_LUMINANCE_ALPHA_SNORM:
+         case GL_LUMINANCE8_ALPHA8_SNORM:
+         case GL_LUMINANCE16_ALPHA16_SNORM:
+            return GL_LUMINANCE_ALPHA;
+         case GL_INTENSITY_SNORM:
+         case GL_INTENSITY8_SNORM:
+         case GL_INTENSITY16_SNORM:
+            return GL_INTENSITY;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.EXT_packed_depth_stencil) {
+      switch (internalFormat) {
+         case GL_DEPTH_STENCIL_EXT:
+         case GL_DEPTH24_STENCIL8_EXT:
+            return GL_DEPTH_STENCIL_EXT;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+#if FEATURE_EXT_texture_sRGB
+   if (ctx->Extensions.EXT_texture_sRGB) {
+      switch (internalFormat) {
+      case GL_SRGB_EXT:
+      case GL_SRGB8_EXT:
+      case GL_COMPRESSED_SRGB_EXT:
+      case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+         return GL_RGB;
+      case GL_SRGB_ALPHA_EXT:
+      case GL_SRGB8_ALPHA8_EXT:
+      case GL_COMPRESSED_SRGB_ALPHA_EXT:
+      case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+      case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+      case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+         return GL_RGBA;
+      case GL_SLUMINANCE_ALPHA_EXT:
+      case GL_SLUMINANCE8_ALPHA8_EXT:
+      case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
+         return GL_LUMINANCE_ALPHA;
+      case GL_SLUMINANCE_EXT:
+      case GL_SLUMINANCE8_EXT:
+      case GL_COMPRESSED_SLUMINANCE_EXT:
+         return GL_LUMINANCE;
+      default:
+         ; /* fallthrough */
+      }
+   }
+#endif /* FEATURE_EXT_texture_sRGB */
+
+   if (ctx->Extensions.EXT_texture_integer) {
+      switch (internalFormat) {
+      case GL_RGBA8UI_EXT:
+      case GL_RGBA16UI_EXT:
+      case GL_RGBA32UI_EXT:
+      case GL_RGBA8I_EXT:
+      case GL_RGBA16I_EXT:
+      case GL_RGBA32I_EXT:
+         return GL_RGBA;
+      case GL_RGB8UI_EXT:
+      case GL_RGB16UI_EXT:
+      case GL_RGB32UI_EXT:
+      case GL_RGB8I_EXT:
+      case GL_RGB16I_EXT:
+      case GL_RGB32I_EXT:
+         return GL_RGB;
+      case GL_ALPHA8UI_EXT:
+      case GL_ALPHA16UI_EXT:
+      case GL_ALPHA32UI_EXT:
+      case GL_ALPHA8I_EXT:
+      case GL_ALPHA16I_EXT:
+      case GL_ALPHA32I_EXT:
+         return GL_ALPHA;
+      case GL_INTENSITY8UI_EXT:
+      case GL_INTENSITY16UI_EXT:
+      case GL_INTENSITY32UI_EXT:
+      case GL_INTENSITY8I_EXT:
+      case GL_INTENSITY16I_EXT:
+      case GL_INTENSITY32I_EXT:
+         return GL_INTENSITY;
+      case GL_LUMINANCE8UI_EXT:
+      case GL_LUMINANCE16UI_EXT:
+      case GL_LUMINANCE32UI_EXT:
+      case GL_LUMINANCE8I_EXT:
+      case GL_LUMINANCE16I_EXT:
+      case GL_LUMINANCE32I_EXT:
+         return GL_LUMINANCE;
+      case GL_LUMINANCE_ALPHA8UI_EXT:
+      case GL_LUMINANCE_ALPHA16UI_EXT:
+      case GL_LUMINANCE_ALPHA32UI_EXT:
+      case GL_LUMINANCE_ALPHA8I_EXT:
+      case GL_LUMINANCE_ALPHA16I_EXT:
+      case GL_LUMINANCE_ALPHA32I_EXT:
+         return GL_LUMINANCE_ALPHA;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.ARB_texture_rg) {
+      switch (internalFormat) {
+      case GL_R16F:
+	 /* R16F depends on both ARB_half_float_pixel and ARB_texture_float.
+	  */
+	 if (!ctx->Extensions.ARB_half_float_pixel)
+	    break;
+	 /* FALLTHROUGH */
+      case GL_R32F:
+	 if (!ctx->Extensions.ARB_texture_float)
+	    break;
+         return GL_RED;
+      case GL_R8I:
+      case GL_R8UI:
+      case GL_R16I:
+      case GL_R16UI:
+      case GL_R32I:
+      case GL_R32UI:
+	 if (!ctx->Extensions.EXT_texture_integer)
+	    break;
+	 /* FALLTHROUGH */
+      case GL_R8:
+      case GL_R16:
+      case GL_RED:
+      case GL_COMPRESSED_RED:
+         return GL_RED;
+
+      case GL_RG16F:
+	 /* RG16F depends on both ARB_half_float_pixel and ARB_texture_float.
+	  */
+	 if (!ctx->Extensions.ARB_half_float_pixel)
+	    break;
+	 /* FALLTHROUGH */
+      case GL_RG32F:
+	 if (!ctx->Extensions.ARB_texture_float)
+	    break;
+         return GL_RG;
+      case GL_RG8I:
+      case GL_RG8UI:
+      case GL_RG16I:
+      case GL_RG16UI:
+      case GL_RG32I:
+      case GL_RG32UI:
+	 if (!ctx->Extensions.EXT_texture_integer)
+	    break;
+	 /* FALLTHROUGH */
+      case GL_RG:
+      case GL_RG8:
+      case GL_RG16:
+      case GL_COMPRESSED_RG:
+         return GL_RG;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.EXT_texture_shared_exponent) {
+      switch (internalFormat) {
+      case GL_RGB9_E5_EXT:
+         return GL_RGB;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.EXT_packed_float) {
+      switch (internalFormat) {
+      case GL_R11F_G11F_B10F_EXT:
+         return GL_RGB;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.ARB_depth_buffer_float) {
+      switch (internalFormat) {
+      case GL_DEPTH_COMPONENT32F:
+         return GL_DEPTH_COMPONENT;
+      case GL_DEPTH32F_STENCIL8:
+         return GL_DEPTH_STENCIL;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.ARB_texture_compression_rgtc) {
+      switch (internalFormat) {
+      case GL_COMPRESSED_RED_RGTC1:
+      case GL_COMPRESSED_SIGNED_RED_RGTC1:
+         return GL_RED;
+      case GL_COMPRESSED_RG_RGTC2:
+      case GL_COMPRESSED_SIGNED_RG_RGTC2:
+         return GL_RG;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.EXT_texture_compression_latc) {
+      switch (internalFormat) {
+      case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+      case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+         return GL_LUMINANCE;
+      case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+      case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+         return GL_LUMINANCE_ALPHA;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.ATI_texture_compression_3dc) {
+      switch (internalFormat) {
+      case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
+         return GL_LUMINANCE_ALPHA;
+      default:
+         ; /* fallthrough */
+      }
+   }
+
+   return -1; /* error */
+}
+
+
+/**
+ * For cube map faces, return a face index in [0,5].
+ * For other targets return 0;
+ */
+GLuint
+_mesa_tex_target_to_face(GLenum target)
+{
+   if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+       target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)
+      return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+   else
+      return 0;
+}
+
+
+
+/**
+ * Store a gl_texture_image pointer in a gl_texture_object structure
+ * according to the target and level parameters.
+ * 
+ * \param tObj texture object.
+ * \param target texture target.
+ * \param level image level.
+ * \param texImage texture image.
+ * 
+ * This was basically prompted by the introduction of cube maps.
+ */
+void
+_mesa_set_tex_image(struct gl_texture_object *tObj,
+                    GLenum target, GLint level,
+                    struct gl_texture_image *texImage)
+{
+   const GLuint face = _mesa_tex_target_to_face(target);
+
+   ASSERT(tObj);
+   ASSERT(texImage);
+   ASSERT(target != GL_TEXTURE_RECTANGLE_NV || level == 0);
+
+   tObj->Image[face][level] = texImage;
+
+   /* Set the 'back' pointer */
+   texImage->TexObject = tObj;
+}
+
+
+/**
+ * Allocate a texture image structure.
+ * 
+ * Called via ctx->Driver.NewTextureImage() unless overriden by a device
+ * driver.
+ *
+ * \return a pointer to gl_texture_image struct with all fields initialized to
+ * zero.
+ */
+struct gl_texture_image *
+_mesa_new_texture_image( struct gl_context *ctx )
+{
+   (void) ctx;
+   return CALLOC_STRUCT(gl_texture_image);
+}
+
+
+/**
+ * Free texture image data.
+ * This function is a fallback called via ctx->Driver.FreeTexImageData().
+ *
+ * \param texImage texture image.
+ *
+ * Free the texture image data if it's not marked as client data.
+ */
+void
+_mesa_free_texture_image_data(struct gl_context *ctx,
+                              struct gl_texture_image *texImage)
+{
+   (void) ctx;
+
+   if (texImage->Data && !texImage->IsClientData) {
+      /* free the old texture data */
+      _mesa_free_texmemory(texImage->Data);
+   }
+
+   texImage->Data = NULL;
+}
+
+
+/**
+ * Free texture image.
+ *
+ * \param texImage texture image.
+ *
+ * Free the texture image structure and the associated image data.
+ */
+void
+_mesa_delete_texture_image(struct gl_context *ctx,
+                           struct gl_texture_image *texImage)
+{
+   /* Free texImage->Data and/or any other driver-specific texture
+    * image storage.
+    */
+   ASSERT(ctx->Driver.FreeTexImageData);
+   ctx->Driver.FreeTexImageData( ctx, texImage );
+
+   ASSERT(texImage->Data == NULL);
+   if (texImage->ImageOffsets)
+      free(texImage->ImageOffsets);
+   free(texImage);
+}
+
+
+/**
+ * Test if a target is a proxy target.
+ *
+ * \param target texture target.
+ *
+ * \return GL_TRUE if the target is a proxy target, GL_FALSE otherwise.
+ */
+GLboolean
+_mesa_is_proxy_texture(GLenum target)
+{
+   /* NUM_TEXTURE_TARGETS should match number of terms below,
+    * except there's no proxy for GL_TEXTURE_BUFFER.
+    */
+   assert(NUM_TEXTURE_TARGETS == 8);
+
+   return (target == GL_PROXY_TEXTURE_1D ||
+           target == GL_PROXY_TEXTURE_2D ||
+           target == GL_PROXY_TEXTURE_3D ||
+           target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
+           target == GL_PROXY_TEXTURE_RECTANGLE_NV ||
+           target == GL_PROXY_TEXTURE_1D_ARRAY_EXT ||
+           target == GL_PROXY_TEXTURE_2D_ARRAY_EXT);
+}
+
+
+/**
+ * Return the proxy target which corresponds to the given texture target
+ */
+static GLenum
+get_proxy_target(GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_1D:
+   case GL_PROXY_TEXTURE_1D:
+      return GL_PROXY_TEXTURE_1D;
+   case GL_TEXTURE_2D:
+   case GL_PROXY_TEXTURE_2D:
+      return GL_PROXY_TEXTURE_2D;
+   case GL_TEXTURE_3D:
+   case GL_PROXY_TEXTURE_3D:
+      return GL_PROXY_TEXTURE_3D;
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+   case GL_TEXTURE_CUBE_MAP_ARB:
+   case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+      return GL_PROXY_TEXTURE_CUBE_MAP_ARB;
+   case GL_TEXTURE_RECTANGLE_NV:
+   case GL_PROXY_TEXTURE_RECTANGLE_NV:
+      return GL_PROXY_TEXTURE_RECTANGLE_NV;
+   case GL_TEXTURE_1D_ARRAY_EXT:
+   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+      return GL_PROXY_TEXTURE_1D_ARRAY_EXT;
+   case GL_TEXTURE_2D_ARRAY_EXT:
+   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+      return GL_PROXY_TEXTURE_2D_ARRAY_EXT;
+   default:
+      _mesa_problem(NULL, "unexpected target in get_proxy_target()");
+      return 0;
+   }
+}
+
+
+/**
+ * Get the texture object that corresponds to the target of the given
+ * texture unit.
+ *
+ * \param ctx GL context.
+ * \param texUnit texture unit.
+ * \param target texture target.
+ *
+ * \return pointer to the texture object on success, or NULL on failure.
+ * 
+ * \sa gl_texture_unit.
+ */
+struct gl_texture_object *
+_mesa_select_tex_object(struct gl_context *ctx,
+                        const struct gl_texture_unit *texUnit,
+                        GLenum target)
+{
+   const GLboolean arrayTex = (ctx->Extensions.MESA_texture_array ||
+                               ctx->Extensions.EXT_texture_array);
+
+   switch (target) {
+      case GL_TEXTURE_1D:
+         return texUnit->CurrentTex[TEXTURE_1D_INDEX];
+      case GL_PROXY_TEXTURE_1D:
+         return ctx->Texture.ProxyTex[TEXTURE_1D_INDEX];
+      case GL_TEXTURE_2D:
+         return texUnit->CurrentTex[TEXTURE_2D_INDEX];
+      case GL_PROXY_TEXTURE_2D:
+         return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX];
+      case GL_TEXTURE_3D:
+         return texUnit->CurrentTex[TEXTURE_3D_INDEX];
+      case GL_PROXY_TEXTURE_3D:
+         return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX];
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+      case GL_TEXTURE_CUBE_MAP_ARB:
+         return ctx->Extensions.ARB_texture_cube_map
+                ? texUnit->CurrentTex[TEXTURE_CUBE_INDEX] : NULL;
+      case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+         return ctx->Extensions.ARB_texture_cube_map
+                ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL;
+      case GL_TEXTURE_RECTANGLE_NV:
+         return ctx->Extensions.NV_texture_rectangle
+                ? texUnit->CurrentTex[TEXTURE_RECT_INDEX] : NULL;
+      case GL_PROXY_TEXTURE_RECTANGLE_NV:
+         return ctx->Extensions.NV_texture_rectangle
+                ? ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX] : NULL;
+      case GL_TEXTURE_1D_ARRAY_EXT:
+         return arrayTex ? texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
+      case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+         return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL;
+      case GL_TEXTURE_2D_ARRAY_EXT:
+         return arrayTex ? texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
+      case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+         return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
+      case GL_TEXTURE_BUFFER:
+         return ctx->Extensions.ARB_texture_buffer_object
+            ? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
+      default:
+         _mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
+         return NULL;
+   }
+}
+
+
+/**
+ * Return pointer to texture object for given target on current texture unit.
+ */
+struct gl_texture_object *
+_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
+{
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+   return _mesa_select_tex_object(ctx, texUnit, target);
+}
+
+
+/**
+ * Get a texture image pointer from a texture object, given a texture
+ * target and mipmap level.  The target and level parameters should
+ * have already been error-checked.
+ *
+ * \param ctx GL context.
+ * \param texObj texture unit.
+ * \param target texture target.
+ * \param level image level.
+ *
+ * \return pointer to the texture image structure, or NULL on failure.
+ */
+struct gl_texture_image *
+_mesa_select_tex_image(struct gl_context *ctx,
+                       const struct gl_texture_object *texObj,
+		       GLenum target, GLint level)
+{
+   const GLuint face = _mesa_tex_target_to_face(target);
+
+   ASSERT(texObj);
+   ASSERT(level >= 0);
+   ASSERT(level < MAX_TEXTURE_LEVELS);
+
+   return texObj->Image[face][level];
+}
+
+
+/**
+ * Like _mesa_select_tex_image() but if the image doesn't exist, allocate
+ * it and install it.  Only return NULL if passed a bad parameter or run
+ * out of memory.
+ */
+struct gl_texture_image *
+_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
+                    GLenum target, GLint level)
+{
+   struct gl_texture_image *texImage;
+
+   if (!texObj)
+      return NULL;
+   
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+   if (!texImage) {
+      texImage = ctx->Driver.NewTextureImage(ctx);
+      if (!texImage) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation");
+         return NULL;
+      }
+
+      _mesa_set_tex_image(texObj, target, level, texImage);
+   }
+
+   return texImage;
+}
+
+
+/**
+ * Return pointer to the specified proxy texture image.
+ * Note that proxy textures are per-context, not per-texture unit.
+ * \return pointer to texture image or NULL if invalid target, invalid
+ *         level, or out of memory.
+ */
+struct gl_texture_image *
+_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
+{
+   struct gl_texture_image *texImage;
+   GLuint texIndex;
+
+   if (level < 0 )
+      return NULL;
+
+   switch (target) {
+   case GL_PROXY_TEXTURE_1D:
+      if (level >= ctx->Const.MaxTextureLevels)
+         return NULL;
+      texIndex = TEXTURE_1D_INDEX;
+      break;
+   case GL_PROXY_TEXTURE_2D:
+      if (level >= ctx->Const.MaxTextureLevels)
+         return NULL;
+      texIndex = TEXTURE_2D_INDEX;
+      break;
+   case GL_PROXY_TEXTURE_3D:
+      if (level >= ctx->Const.Max3DTextureLevels)
+         return NULL;
+      texIndex = TEXTURE_3D_INDEX;
+      break;
+   case GL_PROXY_TEXTURE_CUBE_MAP:
+      if (level >= ctx->Const.MaxCubeTextureLevels)
+         return NULL;
+      texIndex = TEXTURE_CUBE_INDEX;
+      break;
+   case GL_PROXY_TEXTURE_RECTANGLE_NV:
+      if (level > 0)
+         return NULL;
+      texIndex = TEXTURE_RECT_INDEX;
+      break;
+   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+      if (level >= ctx->Const.MaxTextureLevels)
+         return NULL;
+      texIndex = TEXTURE_1D_ARRAY_INDEX;
+      break;
+   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+      if (level >= ctx->Const.MaxTextureLevels)
+         return NULL;
+      texIndex = TEXTURE_2D_ARRAY_INDEX;
+      break;
+   default:
+      return NULL;
+   }
+
+   texImage = ctx->Texture.ProxyTex[texIndex]->Image[0][level];
+   if (!texImage) {
+      texImage = ctx->Driver.NewTextureImage(ctx);
+      if (!texImage) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation");
+         return NULL;
+      }
+      ctx->Texture.ProxyTex[texIndex]->Image[0][level] = texImage;
+      /* Set the 'back' pointer */
+      texImage->TexObject = ctx->Texture.ProxyTex[texIndex];
+   }
+   return texImage;
+}
+
+
+/**
+ * Get the maximum number of allowed mipmap levels.
+ *
+ * \param ctx GL context.
+ * \param target texture target.
+ * 
+ * \return the maximum number of allowed mipmap levels for the given
+ * texture target, or zero if passed a bad target.
+ *
+ * \sa gl_constants.
+ */
+GLint
+_mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_1D:
+   case GL_PROXY_TEXTURE_1D:
+   case GL_TEXTURE_2D:
+   case GL_PROXY_TEXTURE_2D:
+      return ctx->Const.MaxTextureLevels;
+   case GL_TEXTURE_3D:
+   case GL_PROXY_TEXTURE_3D:
+      return ctx->Const.Max3DTextureLevels;
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+   case GL_TEXTURE_CUBE_MAP_ARB:
+   case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+      return ctx->Extensions.ARB_texture_cube_map
+         ? ctx->Const.MaxCubeTextureLevels : 0;
+   case GL_TEXTURE_RECTANGLE_NV:
+   case GL_PROXY_TEXTURE_RECTANGLE_NV:
+      return ctx->Extensions.NV_texture_rectangle ? 1 : 0;
+   case GL_TEXTURE_1D_ARRAY_EXT:
+   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+   case GL_TEXTURE_2D_ARRAY_EXT:
+   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+      return (ctx->Extensions.MESA_texture_array ||
+              ctx->Extensions.EXT_texture_array)
+         ? ctx->Const.MaxTextureLevels : 0;
+   case GL_TEXTURE_BUFFER:
+      /* fall-through */
+   default:
+      return 0; /* bad target */
+   }
+}
+
+
+/**
+ * Return number of dimensions per mipmap level for the given texture target.
+ */
+GLint
+_mesa_get_texture_dimensions(GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_1D:
+   case GL_PROXY_TEXTURE_1D:
+      return 1;
+   case GL_TEXTURE_2D:
+   case GL_TEXTURE_RECTANGLE:
+   case GL_TEXTURE_CUBE_MAP:
+   case GL_PROXY_TEXTURE_2D:
+   case GL_PROXY_TEXTURE_RECTANGLE:
+   case GL_PROXY_TEXTURE_CUBE_MAP:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+   case GL_TEXTURE_1D_ARRAY:
+   case GL_PROXY_TEXTURE_1D_ARRAY:
+      return 2;
+   case GL_TEXTURE_3D:
+   case GL_PROXY_TEXTURE_3D:
+   case GL_TEXTURE_2D_ARRAY:
+   case GL_PROXY_TEXTURE_2D_ARRAY:
+      return 3;
+   case GL_TEXTURE_BUFFER:
+      /* fall-through */
+   default:
+      _mesa_problem(NULL, "invalid target 0x%x in get_texture_dimensions()",
+                    target);
+      return 2;
+   }
+}
+
+
+
+
+#if 000 /* not used anymore */
+/*
+ * glTexImage[123]D can accept a NULL image pointer.  In this case we
+ * create a texture image with unspecified image contents per the OpenGL
+ * spec.
+ */
+static GLubyte *
+make_null_texture(GLint width, GLint height, GLint depth, GLenum format)
+{
+   const GLint components = _mesa_components_in_format(format);
+   const GLint numPixels = width * height * depth;
+   GLubyte *data = (GLubyte *) MALLOC(numPixels * components * sizeof(GLubyte));
+
+#ifdef DEBUG
+   /*
+    * Let's see if anyone finds this.  If glTexImage2D() is called with
+    * a NULL image pointer then load the texture image with something
+    * interesting instead of leaving it indeterminate.
+    */
+   if (data) {
+      static const char message[8][32] = {
+         "   X   X  XXXXX   XXX     X    ",
+         "   XX XX  X      X   X   X X   ",
+         "   X X X  X      X      X   X  ",
+         "   X   X  XXXX    XXX   XXXXX  ",
+         "   X   X  X          X  X   X  ",
+         "   X   X  X      X   X  X   X  ",
+         "   X   X  XXXXX   XXX   X   X  ",
+         "                               "
+      };
+
+      GLubyte *imgPtr = data;
+      GLint h, i, j, k;
+      for (h = 0; h < depth; h++) {
+         for (i = 0; i < height; i++) {
+            GLint srcRow = 7 - (i % 8);
+            for (j = 0; j < width; j++) {
+               GLint srcCol = j % 32;
+               GLubyte texel = (message[srcRow][srcCol]=='X') ? 255 : 70;
+               for (k = 0; k < components; k++) {
+                  *imgPtr++ = texel;
+               }
+            }
+         }
+      }
+   }
+#endif
+
+   return data;
+}
+#endif
+
+
+
+/**
+ * Reset the fields of a gl_texture_image struct to zero.
+ * 
+ * \param img texture image structure.
+ *
+ * This is called when a proxy texture test fails, we set all the
+ * image members (except DriverData) to zero.
+ * It's also used in glTexImage[123]D as a safeguard to be sure all
+ * required fields get initialized properly by the Driver.TexImage[123]D
+ * functions.
+ */
+static void
+clear_teximage_fields(struct gl_texture_image *img)
+{
+   ASSERT(img);
+   img->_BaseFormat = 0;
+   img->InternalFormat = 0;
+   img->Border = 0;
+   img->Width = 0;
+   img->Height = 0;
+   img->Depth = 0;
+   img->RowStride = 0;
+   if (img->ImageOffsets) {
+      free(img->ImageOffsets);
+      img->ImageOffsets = NULL;
+   }
+   img->Width2 = 0;
+   img->Height2 = 0;
+   img->Depth2 = 0;
+   img->WidthLog2 = 0;
+   img->HeightLog2 = 0;
+   img->DepthLog2 = 0;
+   img->Data = NULL;
+   img->TexFormat = MESA_FORMAT_NONE;
+   img->FetchTexelc = NULL;
+   img->FetchTexelf = NULL;
+}
+
+
+/**
+ * Initialize basic fields of the gl_texture_image struct.
+ *
+ * \param ctx GL context.
+ * \param target texture target (GL_TEXTURE_1D, GL_TEXTURE_RECTANGLE, etc).
+ * \param img texture image structure to be initialized.
+ * \param width image width.
+ * \param height image height.
+ * \param depth image depth.
+ * \param border image border.
+ * \param internalFormat internal format.
+ * \param format  the actual hardware format (one of MESA_FORMAT_*)
+ *
+ * Fills in the fields of \p img with the given information.
+ * Note: width, height and depth include the border.
+ */
+void
+_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
+                           struct gl_texture_image *img,
+                           GLsizei width, GLsizei height, GLsizei depth,
+                           GLint border, GLenum internalFormat,
+                           gl_format format)
+{
+   GLint i, dims;
+
+   ASSERT(img);
+   ASSERT(width >= 0);
+   ASSERT(height >= 0);
+   ASSERT(depth >= 0);
+
+   img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
+   ASSERT(img->_BaseFormat > 0);
+   img->InternalFormat = internalFormat;
+   img->Border = border;
+   img->Width = width;
+   img->Height = height;
+   img->Depth = depth;
+
+   img->Width2 = width - 2 * border;   /* == 1 << img->WidthLog2; */
+   img->WidthLog2 = logbase2(img->Width2);
+
+   if (height == 1) { /* 1-D texture */
+      img->Height2 = 1;
+      img->HeightLog2 = 0;
+   }
+   else {
+      img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
+      img->HeightLog2 = logbase2(img->Height2);
+   }
+
+   if (depth == 1) {  /* 2-D texture */
+      img->Depth2 = 1;
+      img->DepthLog2 = 0;
+   }
+   else {
+      img->Depth2 = depth - 2 * border;   /* == 1 << img->DepthLog2; */
+      img->DepthLog2 = logbase2(img->Depth2);
+   }
+
+   img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
+
+   if ((width == 1 || _mesa_is_pow_two(img->Width2)) &&
+       (height == 1 || _mesa_is_pow_two(img->Height2)) &&
+       (depth == 1 || _mesa_is_pow_two(img->Depth2)))
+      img->_IsPowerOfTwo = GL_TRUE;
+   else
+      img->_IsPowerOfTwo = GL_FALSE;
+
+   /* RowStride and ImageOffsets[] describe how to address texels in 'Data' */
+   img->RowStride = width;
+   /* Allocate the ImageOffsets array and initialize to typical values.
+    * We allocate the array for 1D/2D textures too in order to avoid special-
+    * case code in the texstore routines.
+    */
+   if (img->ImageOffsets)
+      free(img->ImageOffsets);
+   img->ImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint));
+   for (i = 0; i < depth; i++) {
+      img->ImageOffsets[i] = i * width * height;
+   }
+
+   /* Compute Width/Height/DepthScale for mipmap lod computation */
+   if (target == GL_TEXTURE_RECTANGLE_NV) {
+      /* scale = 1.0 since texture coords directly map to texels */
+      img->WidthScale = 1.0;
+      img->HeightScale = 1.0;
+      img->DepthScale = 1.0;
+   }
+   else {
+      img->WidthScale = (GLfloat) img->Width;
+      img->HeightScale = (GLfloat) img->Height;
+      img->DepthScale = (GLfloat) img->Depth;
+   }
+
+   img->TexFormat = format;
+
+   dims = _mesa_get_texture_dimensions(target);
+
+   _mesa_set_fetch_functions(img, dims);
+}
+
+
+/**
+ * Free and clear fields of the gl_texture_image struct.
+ *
+ * \param ctx GL context.
+ * \param texImage texture image structure to be cleared.
+ *
+ * After the call, \p texImage will have no data associated with it.  Its
+ * fields are cleared so that its parent object will test incomplete.
+ */
+void
+_mesa_clear_texture_image(struct gl_context *ctx,
+                          struct gl_texture_image *texImage)
+{
+   ctx->Driver.FreeTexImageData(ctx, texImage);
+   clear_teximage_fields(texImage);
+}
+
+
+/**
+ * This is the fallback for Driver.TestProxyTexImage().  Test the texture
+ * level, width, height and depth against the ctx->Const limits for textures.
+ *
+ * A hardware driver might override this function if, for example, the
+ * max 3D texture size is 512x512x64 (i.e. not a cube).
+ *
+ * Note that width, height, depth == 0 is not an error.  However, a
+ * texture with zero width/height/depth will be considered "incomplete"
+ * and texturing will effectively be disabled.
+ *
+ * \param target  one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D,
+ *                GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV,
+ *                GL_PROXY_TEXTURE_CUBE_MAP_ARB.
+ * \param level  as passed to glTexImage
+ * \param internalFormat  as passed to glTexImage
+ * \param format  as passed to glTexImage
+ * \param type  as passed to glTexImage
+ * \param width  as passed to glTexImage
+ * \param height  as passed to glTexImage
+ * \param depth  as passed to glTexImage
+ * \param border  as passed to glTexImage
+ * \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.
+ */
+GLboolean
+_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
+                          GLint internalFormat, GLenum format, GLenum type,
+                          GLint width, GLint height, GLint depth, GLint border)
+{
+   GLint maxSize;
+
+   (void) internalFormat;
+   (void) format;
+   (void) type;
+
+   switch (target) {
+   case GL_PROXY_TEXTURE_1D:
+      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+      }
+      return GL_TRUE;
+
+   case GL_PROXY_TEXTURE_2D:
+      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 2 * border || height > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
+      }
+      return GL_TRUE;
+
+   case GL_PROXY_TEXTURE_3D:
+      maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 2 * border || height > 2 + maxSize)
+         return GL_FALSE;
+      if (depth < 2 * border || depth > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.Max3DTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
+         if (depth > 0 && !_mesa_is_pow_two(depth - 2 * border))
+            return GL_FALSE;
+      }
+      return GL_TRUE;
+
+   case GL_PROXY_TEXTURE_RECTANGLE_NV:
+      maxSize = ctx->Const.MaxTextureRectSize;
+      if (width < 0 || width > maxSize)
+         return GL_FALSE;
+      if (height < 0 || height > maxSize)
+         return GL_FALSE;
+      if (level != 0)
+         return GL_FALSE;
+      return GL_TRUE;
+
+   case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+      maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 2 * border || height > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxCubeTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
+      }
+      return GL_TRUE;
+
+   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+      }
+      return GL_TRUE;
+
+   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 2 * border || height > 2 + maxSize)
+         return GL_FALSE;
+      if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
+      }
+      return GL_TRUE;
+
+   default:
+      _mesa_problem(ctx, "Invalid target in _mesa_test_proxy_teximage");
+      return GL_FALSE;
+   }
+}
+
+
+/**
+ * Check if the memory used by the texture would exceed the driver's limit.
+ * This lets us support a max 3D texture size of 8K (for example) but
+ * prevents allocating a full 8K x 8K x 8K texture.
+ * XXX this could be rolled into the proxy texture size test (above) but
+ * we don't have the actual texture internal format at that point.
+ */
+static GLboolean
+legal_texture_size(struct gl_context *ctx, gl_format format,
+                   GLint width, GLint height, GLint depth)
+{
+   uint64_t bytes = _mesa_format_image_size64(format, width, height, depth);
+   uint64_t mbytes = bytes / (1024 * 1024); /* convert to MB */
+   return mbytes <= (uint64_t) ctx->Const.MaxTextureMbytes;
+}
+
+
+
+/**
+ * Helper function to determine whether a target and specific compression
+ * format are supported.
+ */
+static GLboolean
+target_can_be_compressed(const struct gl_context *ctx, GLenum target,
+                         GLenum intFormat)
+{
+   (void) intFormat;  /* not used yet */
+
+   switch (target) {
+   case GL_TEXTURE_2D:
+   case GL_PROXY_TEXTURE_2D:
+      return GL_TRUE; /* true for any compressed format so far */
+   case GL_PROXY_TEXTURE_CUBE_MAP:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+      return ctx->Extensions.ARB_texture_cube_map;
+   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+   case GL_TEXTURE_2D_ARRAY_EXT:
+      return (ctx->Extensions.MESA_texture_array ||
+              ctx->Extensions.EXT_texture_array);
+   default:
+      return GL_FALSE;
+   }      
+}
+
+
+/**
+ * Check if the given texture target value is legal for a
+ * glTexImage1/2/3D call.
+ */
+static GLboolean
+legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
+{
+   switch (dims) {
+   case 1:
+      switch (target) {
+      case GL_TEXTURE_1D:
+      case GL_PROXY_TEXTURE_1D:
+         return GL_TRUE;
+      default:
+         return GL_FALSE;
+      }
+   case 2:
+      switch (target) {
+      case GL_TEXTURE_2D:
+      case GL_PROXY_TEXTURE_2D:
+         return GL_TRUE;
+      case GL_PROXY_TEXTURE_CUBE_MAP:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+         return ctx->Extensions.ARB_texture_cube_map;
+      case GL_TEXTURE_RECTANGLE_NV:
+      case GL_PROXY_TEXTURE_RECTANGLE_NV:
+         return ctx->Extensions.NV_texture_rectangle;
+      case GL_TEXTURE_1D_ARRAY_EXT:
+      case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+         return (ctx->Extensions.MESA_texture_array ||
+                 ctx->Extensions.EXT_texture_array);
+      default:
+         return GL_FALSE;
+      }
+   case 3:
+      switch (target) {
+      case GL_TEXTURE_3D:
+      case GL_PROXY_TEXTURE_3D:
+         return GL_TRUE;
+      case GL_TEXTURE_2D_ARRAY_EXT:
+      case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+         return (ctx->Extensions.MESA_texture_array ||
+                 ctx->Extensions.EXT_texture_array);
+      default:
+         return GL_FALSE;
+      }
+   default:
+      _mesa_problem(ctx, "invalid dims=%u in legal_teximage_target()", dims);
+      return GL_FALSE;
+   }
+}
+
+
+/**
+ * Check if the given texture target value is legal for a
+ * glTexSubImage, glCopyTexSubImage or glCopyTexImage call.
+ * The difference compared to legal_teximage_target() above is that
+ * proxy targets are not supported.
+ */
+static GLboolean
+legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
+{
+   switch (dims) {
+   case 1:
+      return target == GL_TEXTURE_1D;
+   case 2:
+      switch (target) {
+      case GL_TEXTURE_2D:
+         return GL_TRUE;
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+         return ctx->Extensions.ARB_texture_cube_map;
+      case GL_TEXTURE_RECTANGLE_NV:
+         return ctx->Extensions.NV_texture_rectangle;
+      case GL_TEXTURE_1D_ARRAY_EXT:
+         return (ctx->Extensions.MESA_texture_array ||
+                 ctx->Extensions.EXT_texture_array);
+      default:
+         return GL_FALSE;
+      }
+   case 3:
+      switch (target) {
+      case GL_TEXTURE_3D:
+         return GL_TRUE;
+      case GL_TEXTURE_2D_ARRAY_EXT:
+         return (ctx->Extensions.MESA_texture_array ||
+                 ctx->Extensions.EXT_texture_array);
+      default:
+         return GL_FALSE;
+      }
+   default:
+      _mesa_problem(ctx, "invalid dims=%u in legal_texsubimage_target()",
+                    dims);
+      return GL_FALSE;
+   }
+}
+
+
+/**
+ * Test the glTexImage[123]D() parameters for errors.
+ * 
+ * \param ctx GL context.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * \param internalFormat internal format given by the user.
+ * \param format pixel data format given by the user.
+ * \param type pixel data type given by the user.
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ * \param depth image depth given by the user.
+ * \param border image border given by the user.
+ * 
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ *
+ * Verifies each of the parameters against the constants specified in
+ * __struct gl_contextRec::Const and the supported extensions, and according
+ * to the OpenGL specification.
+ */
+static GLboolean
+texture_error_check( struct gl_context *ctx,
+                     GLuint dimensions, GLenum target,
+                     GLint level, GLint internalFormat,
+                     GLenum format, GLenum type,
+                     GLint width, GLint height,
+                     GLint depth, GLint border )
+{
+   const GLenum proxyTarget = get_proxy_target(target);
+   const GLboolean isProxy = target == proxyTarget;
+   GLboolean sizeOK = GL_TRUE;
+   GLboolean colorFormat, indexFormat;
+
+   /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
+   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+      if (!isProxy) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glTexImage%dD(level=%d)", dimensions, level);
+      }
+      return GL_TRUE;
+   }
+
+   /* Check border */
+   if (border < 0 || border > 1 ||
+       ((target == GL_TEXTURE_RECTANGLE_NV ||
+         target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
+      if (!isProxy) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glTexImage%dD(border=%d)", dimensions, border);
+      }
+      return GL_TRUE;
+   }
+
+   if (width < 0 || height < 0 || depth < 0) {
+      if (!isProxy) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glTexImage%dD(width, height or depth < 0)", dimensions);
+      }
+      return GL_TRUE;
+   }
+
+   /* Do this simple check before calling the TestProxyTexImage() function */
+   if (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+      sizeOK = (width == height);
+   }
+
+   /*
+    * Use the proxy texture driver hook to see if the size/level/etc are
+    * legal.
+    */
+   sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
+                                                    internalFormat, format,
+                                                    type, width, height,
+                                                    depth, border);
+   if (!sizeOK) {
+      if (!isProxy) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glTexImage%dD(level=%d, width=%d, height=%d, depth=%d)",
+                     dimensions, level, width, height, depth);
+      }
+      return GL_TRUE;
+   }
+
+   /* Check internalFormat */
+   if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
+      if (!isProxy) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glTexImage%dD(internalFormat=%s)",
+                     dimensions, _mesa_lookup_enum_by_nr(internalFormat));
+      }
+      return GL_TRUE;
+   }
+
+   /* Check incoming image format and type */
+   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+      /* Normally, GL_INVALID_OPERATION is generated by a format/type
+       * mismatch (see the 1.2 spec page 94, sec 3.6.4.).  But with the
+       * GL_EXT_texture_integer extension, some combinations should generate
+       * GL_INVALID_ENUM instead (grr!).
+       */
+      if (!isProxy) {
+         GLenum error = _mesa_is_integer_format(format)
+            ? GL_INVALID_ENUM : GL_INVALID_OPERATION;
+         _mesa_error(ctx, error,
+                     "glTexImage%dD(incompatible format 0x%x, type 0x%x)",
+                     dimensions, format, type);
+      }
+      return GL_TRUE;
+   }
+
+   /* make sure internal format and format basically agree */
+   colorFormat = _mesa_is_color_format(format);
+   indexFormat = _mesa_is_index_format(format);
+   if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) ||
+       (_mesa_is_index_format(internalFormat) && !indexFormat) ||
+       (_mesa_is_depth_format(internalFormat) != _mesa_is_depth_format(format)) ||
+       (_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format)) ||
+       (_mesa_is_depthstencil_format(internalFormat) != _mesa_is_depthstencil_format(format)) ||
+       (_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) {
+      if (!isProxy)
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)",
+                     dimensions, internalFormat, format);
+      return GL_TRUE;
+   }
+
+   /* additional checks for ycbcr textures */
+   if (internalFormat == GL_YCBCR_MESA) {
+      ASSERT(ctx->Extensions.MESA_ycbcr_texture);
+      if (type != GL_UNSIGNED_SHORT_8_8_MESA &&
+          type != GL_UNSIGNED_SHORT_8_8_REV_MESA) {
+         char message[100];
+         _mesa_snprintf(message, sizeof(message),
+                        "glTexImage%dD(format/type YCBCR mismatch", dimensions);
+         _mesa_error(ctx, GL_INVALID_ENUM, "%s", message);
+         return GL_TRUE; /* error */
+      }
+      if (target != GL_TEXTURE_2D &&
+          target != GL_PROXY_TEXTURE_2D &&
+          target != GL_TEXTURE_RECTANGLE_NV &&
+          target != GL_PROXY_TEXTURE_RECTANGLE_NV) {
+         if (!isProxy)
+            _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)");
+         return GL_TRUE;
+      }
+      if (border != 0) {
+         if (!isProxy) {
+            char message[100];
+            _mesa_snprintf(message, sizeof(message),
+                           "glTexImage%dD(format=GL_YCBCR_MESA and border=%d)",
+                           dimensions, border);
+            _mesa_error(ctx, GL_INVALID_VALUE, "%s", message);
+         }
+         return GL_TRUE;
+      }
+   }
+
+   /* additional checks for depth textures */
+   if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
+      /* Only 1D, 2D and rectangular textures supported, not 3D or cubes */
+      if (target != GL_TEXTURE_1D &&
+          target != GL_PROXY_TEXTURE_1D &&
+          target != GL_TEXTURE_2D &&
+          target != GL_PROXY_TEXTURE_2D &&
+          target != GL_TEXTURE_RECTANGLE_ARB &&
+          target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
+         if (!isProxy)
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glTexImage(target/internalFormat)");
+         return GL_TRUE;
+      }
+   }
+
+   /* additional checks for compressed textures */
+   if (_mesa_is_compressed_format(ctx, internalFormat)) {
+      if (!target_can_be_compressed(ctx, target, internalFormat)) {
+         if (!isProxy)
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glTexImage%dD(target)", dimensions);
+         return GL_TRUE;
+      }
+      if (border != 0) {
+         if (!isProxy) {
+            _mesa_error(ctx, GL_INVALID_OPERATION,
+                        "glTexImage%dD(border!=0)", dimensions);
+         }
+         return GL_TRUE;
+      }
+   }
+
+   /* additional checks for integer textures */
+   if (ctx->Extensions.EXT_texture_integer &&
+       (_mesa_is_integer_format(format) !=
+        _mesa_is_integer_format(internalFormat))) {
+      if (!isProxy) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glTexImage%dD(integer/non-integer format mismatch)",
+                     dimensions);
+      }
+      return GL_TRUE;
+   }
+
+   /* if we get here, the parameters are OK */
+   return GL_FALSE;
+}
+
+
+/**
+ * Test glTexSubImage[123]D() parameters for errors.
+ * 
+ * \param ctx GL context.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * \param xoffset sub-image x offset given by the user.
+ * \param yoffset sub-image y offset given by the user.
+ * \param zoffset sub-image z offset given by the user.
+ * \param format pixel data format given by the user.
+ * \param type pixel data type given by the user.
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ * \param depth image depth given by the user.
+ * 
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ *
+ * Verifies each of the parameters against the constants specified in
+ * __struct gl_contextRec::Const and the supported extensions, and according
+ * to the OpenGL specification.
+ */
+static GLboolean
+subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
+                        GLenum target, GLint level,
+                        GLint xoffset, GLint yoffset, GLint zoffset,
+                        GLint width, GLint height, GLint depth,
+                        GLenum format, GLenum type )
+{
+   /* Basic level check */
+   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level);
+      return GL_TRUE;
+   }
+
+   /* Check for negative sizes */
+   if (width < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glTexSubImage%dD(width=%d)", dimensions, width);
+      return GL_TRUE;
+   }
+   if (height < 0 && dimensions > 1) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glTexSubImage%dD(height=%d)", dimensions, height);
+      return GL_TRUE;
+   }
+   if (depth < 0 && dimensions > 2) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glTexSubImage%dD(depth=%d)", dimensions, depth);
+      return GL_TRUE;
+   }
+
+   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+      /* As with the glTexImage2D check above, the error code here
+       * depends on texture integer.
+       */
+      GLenum error = _mesa_is_integer_format(format)
+         ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
+      _mesa_error(ctx, error,
+                  "glTexSubImage%dD(incompatible format 0x%x, type 0x%x)",
+                  dimensions, format, type);
+      return GL_TRUE;
+   }
+
+   return GL_FALSE;
+}
+
+
+/**
+ * Do second part of glTexSubImage which depends on the destination texture.
+ * \return GL_TRUE if error recorded, GL_FALSE otherwise
+ */
+static GLboolean
+subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
+			 GLenum target, GLint level,
+			 GLint xoffset, GLint yoffset, GLint zoffset,
+			 GLint width, GLint height, GLint depth,
+			 GLenum format, GLenum type,
+			 const struct gl_texture_image *destTex )
+{
+   if (!destTex) {
+      /* undefined image level */
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD", dimensions);
+      return GL_TRUE;
+   }
+
+   if (xoffset < -((GLint)destTex->Border)) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset)",
+                  dimensions);
+      return GL_TRUE;
+   }
+   if (xoffset + width > (GLint) (destTex->Width + destTex->Border)) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset+width)",
+                  dimensions);
+      return GL_TRUE;
+   }
+   if (dimensions > 1) {
+      if (yoffset < -((GLint)destTex->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset)",
+                     dimensions);
+         return GL_TRUE;
+      }
+      if (yoffset + height > (GLint) (destTex->Height + destTex->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset+height)",
+                     dimensions);
+         return GL_TRUE;
+      }
+   }
+   if (dimensions > 2) {
+      if (zoffset < -((GLint)destTex->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
+         return GL_TRUE;
+      }
+      if (zoffset + depth  > (GLint) (destTex->Depth + destTex->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
+         return GL_TRUE;
+      }
+   }
+
+   if (_mesa_is_format_compressed(destTex->TexFormat)) {
+      GLuint bw, bh;
+
+      /* do tests which depend on compression block size */
+      _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh);
+
+      /* offset must be multiple of block size */
+      if ((xoffset % bw != 0) || (yoffset % bh != 0)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glTexSubImage%dD(xoffset = %d, yoffset = %d)",
+                     dimensions, xoffset, yoffset);
+         return GL_TRUE;
+      }
+      /* size must be multiple of bw by bh or equal to whole texture size */
+      if ((width % bw != 0) && (GLuint) width != destTex->Width) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glTexSubImage%dD(width = %d)", dimensions, width);
+         return GL_TRUE;
+      }         
+      if ((height % bh != 0) && (GLuint) height != destTex->Height) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glTexSubImage%dD(height = %d)", dimensions, height);
+         return GL_TRUE;
+      }         
+   }
+
+   return GL_FALSE;
+}
+
+
+/**
+ * Test glCopyTexImage[12]D() parameters for errors.
+ * 
+ * \param ctx GL context.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * \param internalFormat internal format given by the user.
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ * \param border texture border.
+ * 
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ * 
+ * Verifies each of the parameters against the constants specified in
+ * __struct gl_contextRec::Const and the supported extensions, and according
+ * to the OpenGL specification.
+ */
+static GLboolean
+copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
+                         GLenum target, GLint level, GLint internalFormat,
+                         GLint width, GLint height, GLint border )
+{
+   const GLenum proxyTarget = get_proxy_target(target);
+   const GLenum type = GL_FLOAT;
+   GLboolean sizeOK;
+   GLint format;
+
+   /* check target */
+   if (!legal_texsubimage_target(ctx, dimensions, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%uD(target=%s)",
+                  dimensions, _mesa_lookup_enum_by_nr(target));
+      return GL_TRUE;
+   }       
+
+   /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
+   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCopyTexImage%dD(level=%d)", dimensions, level);
+      return GL_TRUE;
+   }
+
+   /* Check that the source buffer is complete */
+   if (ctx->ReadBuffer->Name) {
+      if (ctx->ReadBuffer->_Status == 0) {
+         _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
+      }
+      if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+         _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+                     "glCopyTexImage%dD(invalid readbuffer)", dimensions);
+         return GL_TRUE;
+      }
+   }
+
+   /* Check border */
+   if (border < 0 || border > 1 ||
+       ((target == GL_TEXTURE_RECTANGLE_NV ||
+         target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
+      return GL_TRUE;
+   }
+
+   format = _mesa_base_tex_format(ctx, internalFormat);
+   if (format < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCopyTexImage%dD(internalFormat)", dimensions);
+      return GL_TRUE;
+   }
+
+   if (!_mesa_source_buffer_exists(ctx, format)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCopyTexImage%dD(missing readbuffer)", dimensions);
+      return GL_TRUE;
+   }
+
+   /* Do size, level checking */
+   sizeOK = (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB)
+      ? (width == height) : 1;
+
+   sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
+                                                    internalFormat, format,
+                                                    type, width, height,
+                                                    1, border);
+
+   if (!sizeOK) {
+      if (dimensions == 1) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexImage1D(width=%d)", width);
+      }
+      else {
+         ASSERT(dimensions == 2);
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexImage2D(width=%d, height=%d)", width, height);
+      }
+      return GL_TRUE;
+   }
+
+   if (_mesa_is_compressed_format(ctx, internalFormat)) {
+      if (!target_can_be_compressed(ctx, target, internalFormat)) {
+         _mesa_error(ctx, GL_INVALID_ENUM,
+                     "glCopyTexImage%dD(target)", dimensions);
+         return GL_TRUE;
+      }
+      if (border != 0) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glCopyTexImage%dD(border!=0)", dimensions);
+         return GL_TRUE;
+      }
+   }
+   else if (_mesa_is_depth_format(internalFormat)) {
+      /* make sure we have depth/stencil buffers */
+      if (!ctx->ReadBuffer->_DepthBuffer) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glCopyTexImage%dD(no depth)", dimensions);
+         return GL_TRUE;
+      }
+   }
+   else if (_mesa_is_depthstencil_format(internalFormat)) {
+      /* make sure we have depth/stencil buffers */
+      if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glCopyTexImage%dD(no depth/stencil buffer)", dimensions);
+         return GL_TRUE;
+      }
+   }
+
+   /* if we get here, the parameters are OK */
+   return GL_FALSE;
+}
+
+
+/**
+ * Test glCopyTexSubImage[12]D() parameters for errors.
+ * Note that this is the first part of error checking.
+ * See also copytexsubimage_error_check2() below for the second part.
+ * 
+ * \param ctx GL context.
+ * \param dimensions texture image dimensions (must be 1, 2 or 3).
+ * \param target texture target given by the user.
+ * \param level image level given by the user.
+ * 
+ * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ */
+static GLboolean
+copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions,
+                              GLenum target, GLint level)
+{
+   /* Check that the source buffer is complete */
+   if (ctx->ReadBuffer->Name) {
+      if (ctx->ReadBuffer->_Status == 0) {
+         _mesa_test_framebuffer_completeness(ctx, ctx->ReadBuffer);
+      }
+      if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+         _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+                     "glCopyTexImage%dD(invalid readbuffer)", dimensions);
+         return GL_TRUE;
+      }
+   }
+
+   /* check target (proxies not allowed) */
+   if (!legal_texsubimage_target(ctx, dimensions, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%uD(target=%s)",
+                  dimensions, _mesa_lookup_enum_by_nr(target));
+      return GL_TRUE;
+   }
+
+   /* Check level */
+   if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCopyTexSubImage%dD(level=%d)", dimensions, level);
+      return GL_TRUE;
+   }
+
+   return GL_FALSE;
+}
+
+
+/**
+ * Second part of error checking for glCopyTexSubImage[12]D().
+ * \param xoffset sub-image x offset given by the user.
+ * \param yoffset sub-image y offset given by the user.
+ * \param zoffset sub-image z offset given by the user.
+ * \param width image width given by the user.
+ * \param height image height given by the user.
+ */
+static GLboolean
+copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
+			      GLenum target, GLint level,
+			      GLint xoffset, GLint yoffset, GLint zoffset,
+			      GLsizei width, GLsizei height,
+			      const struct gl_texture_image *teximage )
+{
+   /* check that dest tex image exists */
+   if (!teximage) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCopyTexSubImage%dD(undefined texture level: %d)",
+                  dimensions, level);
+      return GL_TRUE;
+   }
+
+   /* Check size */
+   if (width < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCopyTexSubImage%dD(width=%d)", dimensions, width);
+      return GL_TRUE;
+   }
+   if (dimensions > 1 && height < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCopyTexSubImage%dD(height=%d)", dimensions, height);
+      return GL_TRUE;
+   }
+
+   /* check x/y offsets */
+   if (xoffset < -((GLint)teximage->Border)) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset);
+      return GL_TRUE;
+   }
+   if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCopyTexSubImage%dD(xoffset+width)", dimensions);
+      return GL_TRUE;
+   }
+   if (dimensions > 1) {
+      if (yoffset < -((GLint)teximage->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset);
+         return GL_TRUE;
+      }
+      /* NOTE: we're adding the border here, not subtracting! */
+      if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexSubImage%dD(yoffset+height)", dimensions);
+         return GL_TRUE;
+      }
+   }
+
+   /* check z offset */
+   if (dimensions > 2) {
+      if (zoffset < -((GLint)teximage->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexSubImage%dD(zoffset)", dimensions);
+         return GL_TRUE;
+      }
+      if (zoffset > (GLint) (teximage->Depth + teximage->Border)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexSubImage%dD(zoffset+depth)", dimensions);
+         return GL_TRUE;
+      }
+   }
+
+   if (_mesa_is_format_compressed(teximage->TexFormat)) {
+      /* offset must be multiple of 4 */
+      if ((xoffset & 3) || (yoffset & 3)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexSubImage%dD(xoffset or yoffset)", dimensions);
+         return GL_TRUE;
+      }
+      /* size must be multiple of 4 */
+      if ((width & 3) != 0 && (GLuint) width != teximage->Width) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexSubImage%dD(width)", dimensions);
+         return GL_TRUE;
+      }         
+      if ((height & 3) != 0 && (GLuint) height != teximage->Height) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCopyTexSubImage%dD(height)", dimensions);
+         return GL_TRUE;
+      }         
+   }
+
+   if (teximage->InternalFormat == GL_YCBCR_MESA) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D");
+      return GL_TRUE;
+   }
+
+   if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCopyTexSubImage%dD(missing readbuffer, format=0x%x)",
+                  dimensions, teximage->_BaseFormat);
+      return GL_TRUE;
+   }
+
+   if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) {
+      if (!ctx->ReadBuffer->_DepthBuffer) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glCopyTexSubImage%dD(no depth buffer)",
+                     dimensions);
+         return GL_TRUE;
+      }
+   }
+   else if (teximage->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+      if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glCopyTexSubImage%dD(no depth/stencil buffer)",
+                     dimensions);
+         return GL_TRUE;
+      }
+   }
+
+   /* If copying into an integer texture, the source buffer must also be
+    * integer-valued.
+    */
+   if (_mesa_is_format_integer_color(teximage->TexFormat)) {
+      struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
+      if (!_mesa_is_format_integer_color(rb->Format)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCopyTexSubImage%dD(source buffer is not integer format)",
+                  dimensions);
+         return GL_TRUE;
+      }
+   }
+
+   /* if we get here, the parameters are OK */
+   return GL_FALSE;
+}
+
+
+/** Callback info for walking over FBO hash table */
+struct cb_info
+{
+   struct gl_context *ctx;
+   struct gl_texture_object *texObj;
+   GLuint level, face;
+};
+
+
+/**
+ * Check render to texture callback.  Called from _mesa_HashWalk().
+ */
+static void
+check_rtt_cb(GLuint key, void *data, void *userData)
+{
+   struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
+   const struct cb_info *info = (struct cb_info *) userData;
+   struct gl_context *ctx = info->ctx;
+   const struct gl_texture_object *texObj = info->texObj;
+   const GLuint level = info->level, face = info->face;
+
+   /* If this is a user-created FBO */
+   if (fb->Name) {
+      GLuint i;
+      /* check if any of the FBO's attachments point to 'texObj' */
+      for (i = 0; i < BUFFER_COUNT; i++) {
+         struct gl_renderbuffer_attachment *att = fb->Attachment + i;
+         if (att->Type == GL_TEXTURE &&
+             att->Texture == texObj &&
+             att->TextureLevel == level &&
+             att->CubeMapFace == face) {
+            ASSERT(_mesa_get_attachment_teximage(att));
+            /* Tell driver about the new renderbuffer texture */
+            ctx->Driver.RenderTexture(ctx, ctx->DrawBuffer, att);
+            /* Mark fb status as indeterminate to force re-validation */
+            fb->_Status = 0;
+         }
+      }
+   }
+}
+
+
+/**
+ * When a texture image is specified we have to check if it's bound to
+ * any framebuffer objects (render to texture) in order to detect changes
+ * in size or format since that effects FBO completeness.
+ * Any FBOs rendering into the texture must be re-validated.
+ */
+static void
+update_fbo_texture(struct gl_context *ctx, struct gl_texture_object *texObj,
+                   GLuint face, GLuint level)
+{
+   /* Only check this texture if it's been marked as RenderToTexture */
+   if (texObj->_RenderToTexture) {
+      struct cb_info info;
+      info.ctx = ctx;
+      info.texObj = texObj;
+      info.level = level;
+      info.face = face;
+      _mesa_HashWalk(ctx->Shared->FrameBuffers, check_rtt_cb, &info);
+   }
+}
+
+
+/**
+ * If the texture object's GenerateMipmap flag is set and we've
+ * changed the texture base level image, regenerate the rest of the
+ * mipmap levels now.
+ */
+static INLINE void
+check_gen_mipmap(struct gl_context *ctx, GLenum target,
+                 struct gl_texture_object *texObj, GLint level)
+{
+   ASSERT(target != GL_TEXTURE_CUBE_MAP);
+   if (texObj->GenerateMipmap &&
+       level == texObj->BaseLevel &&
+       level < texObj->MaxLevel) {
+      ASSERT(ctx->Driver.GenerateMipmap);
+      ctx->Driver.GenerateMipmap(ctx, target, texObj);
+   }
+}
+
+
+/** Debug helper: override the user-requested internal format */
+static GLenum
+override_internal_format(GLenum internalFormat, GLint width, GLint height)
+{
+#if 0
+   if (internalFormat == GL_RGBA16F_ARB ||
+       internalFormat == GL_RGBA32F_ARB) {
+      printf("Convert rgba float tex to int %d x %d\n", width, height);
+      return GL_RGBA;
+   }
+   else if (internalFormat == GL_RGB16F_ARB ||
+            internalFormat == GL_RGB32F_ARB) {
+      printf("Convert rgb float tex to int %d x %d\n", width, height);
+      return GL_RGB;
+   }
+   else if (internalFormat == GL_LUMINANCE_ALPHA16F_ARB ||
+            internalFormat == GL_LUMINANCE_ALPHA32F_ARB) {
+      printf("Convert luminance float tex to int %d x %d\n", width, height);
+      return GL_LUMINANCE_ALPHA;
+   }
+   else if (internalFormat == GL_LUMINANCE16F_ARB ||
+            internalFormat == GL_LUMINANCE32F_ARB) {
+      printf("Convert luminance float tex to int %d x %d\n", width, height);
+      return GL_LUMINANCE;
+   }
+   else if (internalFormat == GL_ALPHA16F_ARB ||
+            internalFormat == GL_ALPHA32F_ARB) {
+      printf("Convert luminance float tex to int %d x %d\n", width, height);
+      return GL_ALPHA;
+   }
+   /*
+   else if (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) {
+      internalFormat = GL_RGBA;
+   }
+   */
+   else {
+      return internalFormat;
+   }
+#else
+   return internalFormat;
+#endif
+}
+
+
+/**
+ * Choose the actual hardware format for a texture image.
+ * Try to use the same format as the previous image level when possible.
+ * Otherwise, ask the driver for the best format.
+ * It's important to try to choose a consistant format for all levels
+ * for efficient texture memory layout/allocation.  In particular, this
+ * comes up during automatic mipmap generation.
+ */
+gl_format
+_mesa_choose_texture_format(struct gl_context *ctx,
+                            struct gl_texture_object *texObj,
+                            GLenum target, GLint level,
+                            GLenum internalFormat, GLenum format, GLenum type)
+{
+   gl_format f;
+
+   /* see if we've already chosen a format for the previous level */
+   if (level > 0) {
+      struct gl_texture_image *prevImage =
+	 _mesa_select_tex_image(ctx, texObj, target, level - 1);
+      /* See if the prev level is defined and has an internal format which
+       * matches the new internal format.
+       */
+      if (prevImage &&
+          prevImage->Width > 0 &&
+          prevImage->InternalFormat == internalFormat) {
+         /* use the same format */
+         ASSERT(prevImage->TexFormat != MESA_FORMAT_NONE);
+         return prevImage->TexFormat;
+      }
+   }
+
+   /* choose format from scratch */
+   f = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
+   ASSERT(f != MESA_FORMAT_NONE);
+   return f;
+}
+
+
+/**
+ * Common code to implement all the glTexImage1D/2D/3D functions.
+ */
+static void
+teximage(struct gl_context *ctx, GLuint dims,
+         GLenum target, GLint level, GLint internalFormat,
+         GLsizei width, GLsizei height, GLsizei depth,
+         GLint border, GLenum format, GLenum type,
+         const GLvoid *pixels)
+{
+   GLboolean error;
+
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+      _mesa_debug(ctx, "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n",
+                  dims,
+                  _mesa_lookup_enum_by_nr(target), level,
+                  _mesa_lookup_enum_by_nr(internalFormat),
+                  width, height, depth, border,
+                  _mesa_lookup_enum_by_nr(format),
+                  _mesa_lookup_enum_by_nr(type), pixels);
+
+   internalFormat = override_internal_format(internalFormat, width, height);
+
+   /* target error checking */
+   if (!legal_teximage_target(ctx, dims, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%uD(target=%s)",
+                  dims, _mesa_lookup_enum_by_nr(target));
+      return;
+   }
+
+   /* general error checking */
+   error = texture_error_check(ctx, dims, target, level, internalFormat,
+                               format, type, width, height, depth, border);
+
+   if (_mesa_is_proxy_texture(target)) {
+      /* Proxy texture: just clear or set state depending on error checking */
+      struct gl_texture_image *texImage =
+         _mesa_get_proxy_tex_image(ctx, target, level);
+
+      if (error) {
+         /* when error, clear all proxy texture image parameters */
+         if (texImage)
+            clear_teximage_fields(texImage);
+      }
+      else {
+         /* no error, set the tex image parameters */
+         struct gl_texture_object *texObj =
+            _mesa_get_current_tex_object(ctx, target);
+         gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
+                                                           target, level,
+                                                           internalFormat,
+                                                           format, type);
+
+         if (legal_texture_size(ctx, texFormat, width, height, depth)) {
+            _mesa_init_teximage_fields(ctx, target, texImage, width, height,
+                                       depth, border, internalFormat,
+                                       texFormat);
+         }
+         else if (texImage) {
+            clear_teximage_fields(texImage);
+         }
+      }
+   }
+   else {
+      /* non-proxy target */
+      const GLuint face = _mesa_tex_target_to_face(target);
+      struct gl_texture_object *texObj;
+      struct gl_texture_image *texImage;
+
+      if (error) {
+         return;   /* error was recorded */
+      }
+
+      if (ctx->NewState & _NEW_PIXEL)
+	 _mesa_update_state(ctx);
+
+      texObj = _mesa_get_current_tex_object(ctx, target);
+
+      _mesa_lock_texture(ctx, texObj);
+      {
+	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
+
+	 if (!texImage) {
+	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
+	 }
+         else {
+            gl_format texFormat;
+
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+
+            ASSERT(texImage->Data == NULL);
+            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
+                                                    internalFormat, format,
+                                                    type);
+
+            if (legal_texture_size(ctx, texFormat, width, height, depth)) {
+               _mesa_init_teximage_fields(ctx, target, texImage,
+                                          width, height, depth,
+                                          border, internalFormat, texFormat);
+
+               /* Give the texture to the driver.  <pixels> may be null. */
+               ASSERT(ctx->Driver.TexImage3D);
+               switch (dims) {
+               case 1:
+                  ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+                                         width, border, format,
+                                         type, pixels, &ctx->Unpack, texObj,
+                                         texImage);
+                  break;
+               case 2:
+                  ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+                                         width, height, border, format,
+                                         type, pixels, &ctx->Unpack, texObj,
+                                         texImage);
+                  break;
+               case 3:
+                  ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
+                                         width, height, depth, border, format,
+                                         type, pixels, &ctx->Unpack, texObj,
+                                         texImage);
+                  break;
+               default:
+                  _mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
+               }
+
+               check_gen_mipmap(ctx, target, texObj, level);
+
+               update_fbo_texture(ctx, texObj, face, level);
+
+               /* state update */
+               texObj->_Complete = GL_FALSE;
+               ctx->NewState |= _NEW_TEXTURE;
+            }
+            else {
+               _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
+            }
+         }
+      }
+      _mesa_unlock_texture(ctx, texObj);
+   }
+}
+
+
+/*
+ * Called from the API.  Note that width includes the border.
+ */
+void GLAPIENTRY
+_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
+                  GLsizei width, GLint border, GLenum format,
+                  GLenum type, const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   teximage(ctx, 1, target, level, internalFormat, width, 1, 1,
+            border, format, type, pixels);
+}
+
+
+void GLAPIENTRY
+_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
+                  GLsizei width, GLsizei height, GLint border,
+                  GLenum format, GLenum type,
+                  const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   teximage(ctx, 2, target, level, internalFormat, width, height, 1,
+            border, format, type, pixels);
+}
+
+
+/*
+ * Called by the API or display list executor.
+ * Note that width and height include the border.
+ */
+void GLAPIENTRY
+_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
+                  GLsizei width, GLsizei height, GLsizei depth,
+                  GLint border, GLenum format, GLenum type,
+                  const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   teximage(ctx, 3, target, level, internalFormat, width, height, depth,
+            border, format, type, pixels);
+}
+
+
+void GLAPIENTRY
+_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat,
+                     GLsizei width, GLsizei height, GLsizei depth,
+                     GLint border, GLenum format, GLenum type,
+                     const GLvoid *pixels )
+{
+   _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height,
+                    depth, border, format, type, pixels);
+}
+
+
+#if FEATURE_OES_EGL_image
+void GLAPIENTRY
+_mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (!ctx->Extensions.OES_EGL_image) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glEGLImageTargetTexture2DOES(unsupported)");
+      return;
+   }
+
+   if (target != GL_TEXTURE_2D) {
+      _mesa_error(ctx, GL_INVALID_ENUM,
+		  "glEGLImageTargetTexture2D(target=%d)", target);
+      return;
+   }
+
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_state(ctx);
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   _mesa_lock_texture(ctx, texObj);
+
+   texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
+   if (!texImage) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEGLImageTargetTexture2D");
+   } else {
+      if (texImage->Data)
+	 ctx->Driver.FreeTexImageData( ctx, texImage );
+
+      ASSERT(texImage->Data == NULL);
+      ctx->Driver.EGLImageTargetTexture2D(ctx, target,
+					  texObj, texImage, image);
+
+      /* state update */
+      texObj->_Complete = GL_FALSE;
+      ctx->NewState |= _NEW_TEXTURE;
+   }
+   _mesa_unlock_texture(ctx, texObj);
+
+}
+#endif
+
+
+
+/**
+ * Implement all the glTexSubImage1/2/3D() functions.
+ */
+static void
+texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
+            GLint xoffset, GLint yoffset, GLint zoffset,
+            GLsizei width, GLsizei height, GLsizei depth,
+            GLenum format, GLenum type, const GLvoid *pixels )
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+      _mesa_debug(ctx, "glTexSubImage%uD %s %d %d %d %d %d %d %d %s %s %p\n",
+                  dims,
+                  _mesa_lookup_enum_by_nr(target), level,
+                  xoffset, yoffset, zoffset, width, height, depth,
+                  _mesa_lookup_enum_by_nr(format),
+                  _mesa_lookup_enum_by_nr(type), pixels);
+
+   /* check target (proxies not allowed) */
+   if (!legal_texsubimage_target(ctx, dims, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(target=%s)",
+                  dims, _mesa_lookup_enum_by_nr(target));
+      return;
+   }       
+
+   if (ctx->NewState & _NEW_PIXEL)
+      _mesa_update_state(ctx);
+
+   if (subtexture_error_check(ctx, dims, target, level, xoffset, yoffset, zoffset,
+                              width, height, depth, format, type)) {
+      return;   /* error was detected */
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
+   _mesa_lock_texture(ctx, texObj);
+   {
+      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+      if (subtexture_error_check2(ctx, dims, target, level,
+                                  xoffset, yoffset, zoffset,
+				  width, height, depth,
+                                  format, type, texImage)) {
+         /* error was recorded */
+      }
+      else if (width > 0 && height > 0 && height > 0) {
+         /* If we have a border, offset=-1 is legal.  Bias by border width. */
+         switch (dims) {
+         case 3:
+            zoffset += texImage->Border;
+            /* fall-through */
+         case 2:
+            yoffset += texImage->Border;
+            /* fall-through */
+         case 1:
+            xoffset += texImage->Border;
+         }
+
+         switch (dims) {
+         case 1:
+            ctx->Driver.TexSubImage1D(ctx, target, level,
+                                      xoffset, width,
+                                      format, type, pixels,
+                                      &ctx->Unpack, texObj, texImage );
+            break;
+         case 2:
+            ctx->Driver.TexSubImage2D(ctx, target, level,
+                                      xoffset, yoffset, width, height,
+                                      format, type, pixels,
+                                      &ctx->Unpack, texObj, texImage );
+            break;
+         case 3:
+            ctx->Driver.TexSubImage3D(ctx, target, level,
+                                      xoffset, yoffset, zoffset,
+                                      width, height, depth,
+                                      format, type, pixels,
+                                      &ctx->Unpack, texObj, texImage );
+            break;
+         default:
+            _mesa_problem(ctx, "unexpected dims in subteximage()");
+         }
+
+         check_gen_mipmap(ctx, target, texObj, level);
+
+         ctx->NewState |= _NEW_TEXTURE;
+      }
+   }
+   _mesa_unlock_texture(ctx, texObj);
+}
+
+
+void GLAPIENTRY
+_mesa_TexSubImage1D( GLenum target, GLint level,
+                     GLint xoffset, GLsizei width,
+                     GLenum format, GLenum type,
+                     const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   texsubimage(ctx, 1, target, level,
+               xoffset, 0, 0,
+               width, 1, 1,
+               format, type, pixels);
+}
+
+
+void GLAPIENTRY
+_mesa_TexSubImage2D( GLenum target, GLint level,
+                     GLint xoffset, GLint yoffset,
+                     GLsizei width, GLsizei height,
+                     GLenum format, GLenum type,
+                     const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   texsubimage(ctx, 2, target, level,
+               xoffset, yoffset, 0,
+               width, height, 1,
+               format, type, pixels);
+}
+
+
+
+void GLAPIENTRY
+_mesa_TexSubImage3D( GLenum target, GLint level,
+                     GLint xoffset, GLint yoffset, GLint zoffset,
+                     GLsizei width, GLsizei height, GLsizei depth,
+                     GLenum format, GLenum type,
+                     const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   texsubimage(ctx, 3, target, level,
+               xoffset, yoffset, zoffset,
+               width, height, depth,
+               format, type, pixels);
+}
+
+
+
+/**
+ * Implement the glCopyTexImage1/2D() functions.
+ */
+static void
+copyteximage(struct gl_context *ctx, GLuint dims,
+             GLenum target, GLint level, GLenum internalFormat,
+             GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   const GLuint face = _mesa_tex_target_to_face(target);
+
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+      _mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n",
+                  dims,
+                  _mesa_lookup_enum_by_nr(target), level,
+                  _mesa_lookup_enum_by_nr(internalFormat),
+                  x, y, width, height, border);
+
+   if (ctx->NewState & NEW_COPY_TEX_STATE)
+      _mesa_update_state(ctx);
+
+   if (copytexture_error_check(ctx, dims, target, level, internalFormat,
+                               width, height, border))
+      return;
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
+   _mesa_lock_texture(ctx, texObj);
+   {
+      texImage = _mesa_get_tex_image(ctx, texObj, target, level);
+
+      if (!texImage) {
+	 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
+      }
+      else {
+         gl_format texFormat;
+
+         if (texImage->Data) {
+            ctx->Driver.FreeTexImageData( ctx, texImage );
+         }
+
+         ASSERT(texImage->Data == NULL);
+
+         texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
+                                                 internalFormat, GL_NONE,
+                                                 GL_NONE);
+
+         if (legal_texture_size(ctx, texFormat, width, height, 1)) {
+            _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
+                                       border, internalFormat, texFormat);
+
+            ASSERT(ctx->Driver.CopyTexImage2D);
+            if (dims == 1)
+               ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
+                                          x, y, width, border);
+            else
+               ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
+                                          x, y, width, height, border);
+
+            check_gen_mipmap(ctx, target, texObj, level);
+
+            update_fbo_texture(ctx, texObj, face, level);
+
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+         else {
+            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
+         }
+      }
+   }
+   _mesa_unlock_texture(ctx, texObj);
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexImage1D( GLenum target, GLint level,
+                      GLenum internalFormat,
+                      GLint x, GLint y,
+                      GLsizei width, GLint border )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copyteximage(ctx, 1, target, level, internalFormat, x, y, width, 1, border);
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
+                      GLint x, GLint y, GLsizei width, GLsizei height,
+                      GLint border )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copyteximage(ctx, 2, target, level, internalFormat,
+                x, y, width, height, border);
+}
+
+
+
+/**
+ * Implementation for glCopyTexSubImage1/2/3D() functions.
+ */
+static void
+copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
+                GLint xoffset, GLint yoffset, GLint zoffset,
+                GLint x, GLint y, GLsizei width, GLsizei height)
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+      _mesa_debug(ctx, "glCopyTexSubImage%uD %s %d %d %d %d %d %d %d %d\n",
+                  dims,
+                  _mesa_lookup_enum_by_nr(target),
+                  level, xoffset, yoffset, zoffset, x, y, width, height);
+
+   if (ctx->NewState & NEW_COPY_TEX_STATE)
+      _mesa_update_state(ctx);
+
+   if (copytexsubimage_error_check1(ctx, dims, target, level))
+      return;
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
+   _mesa_lock_texture(ctx, texObj);
+   {
+      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+      if (copytexsubimage_error_check2(ctx, dims, target, level, xoffset, yoffset,
+				       zoffset, width, height, texImage)) {
+         /* error was recored */
+      }
+      else {
+         /* If we have a border, offset=-1 is legal.  Bias by border width. */
+         switch (dims) {
+         case 3:
+            zoffset += texImage->Border;
+            /* fall-through */
+         case 2:
+            yoffset += texImage->Border;
+            /* fall-through */
+         case 1:
+            xoffset += texImage->Border;
+         }
+
+         if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
+                                        &width, &height)) {
+            switch (dims) {
+            case 1:
+               ctx->Driver.CopyTexSubImage1D(ctx, target, level,
+                                             xoffset, x, y, width);
+               break;
+            case 2:
+               ctx->Driver.CopyTexSubImage2D(ctx, target, level,
+                                             xoffset, yoffset,
+                                             x, y, width, height);
+               break;
+            case 3:
+               ctx->Driver.CopyTexSubImage3D(ctx, target, level,
+                                             xoffset, yoffset, zoffset,
+                                             x, y, width, height);
+               break;
+            default:
+               _mesa_problem(ctx, "bad dims in copytexsubimage()");
+            }
+
+            check_gen_mipmap(ctx, target, texObj, level);
+
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
+   }
+   _mesa_unlock_texture(ctx, texObj);
+}
+
+
+void GLAPIENTRY
+_mesa_CopyTexSubImage1D( GLenum target, GLint level,
+                         GLint xoffset, GLint x, GLint y, GLsizei width )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copytexsubimage(ctx, 1, target, level, xoffset, 0, 0, x, y, width, 1);
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexSubImage2D( GLenum target, GLint level,
+                         GLint xoffset, GLint yoffset,
+                         GLint x, GLint y, GLsizei width, GLsizei height )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copytexsubimage(ctx, 2, target, level, xoffset, yoffset, 0, x, y,
+                   width, height);
+}
+
+
+
+void GLAPIENTRY
+_mesa_CopyTexSubImage3D( GLenum target, GLint level,
+                         GLint xoffset, GLint yoffset, GLint zoffset,
+                         GLint x, GLint y, GLsizei width, GLsizei height )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copytexsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
+                   x, y, width, height);
+}
+
+
+
+
+/**********************************************************************/
+/******                   Compressed Textures                    ******/
+/**********************************************************************/
+
+
+/**
+ * Return expected size of a compressed texture.
+ */
+static GLuint
+compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth,
+                    GLenum glformat)
+{
+   gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
+   return _mesa_format_image_size(mesaFormat, width, height, depth);
+}
+
+
+/*
+ * Return compressed texture block size, in pixels.
+ */
+static void
+get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
+{
+   gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
+   _mesa_get_format_block_size(mesaFormat, bw, bh);
+}
+
+
+/**
+ * Error checking for glCompressedTexImage[123]D().
+ * \param reason  returns reason for error, if any
+ * \return error code or GL_NO_ERROR.
+ */
+static GLenum
+compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
+                               GLenum target, GLint level,
+                               GLenum internalFormat, GLsizei width,
+                               GLsizei height, GLsizei depth, GLint border,
+                               GLsizei imageSize, char **reason)
+{
+   const GLenum proxyTarget = get_proxy_target(target);
+   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
+   GLint expectedSize;
+
+   *reason = ""; /* no error */
+
+   /* check level */
+   if (level < 0 || level >= maxLevels) {
+      *reason = "level";
+      return GL_INVALID_VALUE;
+   }
+
+   if (!target_can_be_compressed(ctx, target, internalFormat)) {
+      *reason = "target";
+      return GL_INVALID_ENUM;
+   }
+
+   /* This will detect any invalid internalFormat value */
+   if (!_mesa_is_compressed_format(ctx, internalFormat)) {
+      *reason = "internalFormat";
+      return GL_INVALID_ENUM;
+   }
+
+   /* This should really never fail */
+   if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
+      *reason = "internalFormat";
+      return GL_INVALID_ENUM;
+   }
+
+   /* No compressed formats support borders at this time */
+   if (border != 0) {
+      *reason = "border != 0";
+      return GL_INVALID_VALUE;
+   }
+
+   /* For cube map, width must equal height */
+   if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+       target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height) {
+      *reason = "width != height";
+      return GL_INVALID_VALUE;
+   }
+
+   /* check image size against compression block size */
+   {
+      gl_format texFormat =
+         ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                         GL_NONE, GL_NONE);
+      GLuint bw, bh;
+
+      _mesa_get_format_block_size(texFormat, &bw, &bh);
+      if ((width > bw && width % bw > 0) ||
+          (height > bh && height % bh > 0)) {
+         /*
+          * Per GL_ARB_texture_compression:  GL_INVALID_OPERATION is
+          * generated [...] if any parameter combinations are not
+          * supported by the specific compressed internal format. 
+          */
+         *reason = "invalid width or height for compression format";
+         return GL_INVALID_OPERATION;
+      }
+   }
+
+   /* check image sizes */
+   if (!ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
+                                      internalFormat, GL_NONE, GL_NONE,
+                                      width, height, depth, border)) {
+      /* See error comment above */
+      *reason = "invalid width, height or format";
+      return GL_INVALID_OPERATION;
+   }
+
+   /* check image size in bytes */
+   expectedSize = compressed_tex_size(width, height, depth, internalFormat);
+   if (expectedSize != imageSize) {
+      /* Per GL_ARB_texture_compression:  GL_INVALID_VALUE is generated [...]
+       * if <imageSize> is not consistent with the format, dimensions, and
+       * contents of the specified image.
+       */
+      *reason = "imageSize inconsistant with width/height/format";
+      return GL_INVALID_VALUE;
+   }
+
+   return GL_NO_ERROR;
+}
+
+
+/**
+ * Error checking for glCompressedTexSubImage[123]D().
+ * \warning  There are some bad assumptions here about the size of compressed
+ *           texture tiles (multiple of 4) used to test the validity of the
+ *           offset and size parameters.
+ * \return error code or GL_NO_ERROR.
+ */
+static GLenum
+compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
+                                  GLenum target, GLint level,
+                                  GLint xoffset, GLint yoffset, GLint zoffset,
+                                  GLsizei width, GLsizei height, GLsizei depth,
+                                  GLenum format, GLsizei imageSize)
+{
+   GLint expectedSize, maxLevels = 0, maxTextureSize;
+   GLuint bw, bh;
+   (void) zoffset;
+
+   if (dimensions == 1) {
+      /* 1D compressed textures not allowed */
+      return GL_INVALID_ENUM;
+   }
+   else if (dimensions == 2) {
+      if (target == GL_PROXY_TEXTURE_2D) {
+         maxLevels = ctx->Const.MaxTextureLevels;
+      }
+      else if (target == GL_TEXTURE_2D) {
+         maxLevels = ctx->Const.MaxTextureLevels;
+      }
+      else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+         if (!ctx->Extensions.ARB_texture_cube_map)
+            return GL_INVALID_ENUM; /*target*/
+         maxLevels = ctx->Const.MaxCubeTextureLevels;
+      }
+      else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+               target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+         if (!ctx->Extensions.ARB_texture_cube_map)
+            return GL_INVALID_ENUM; /*target*/
+         maxLevels = ctx->Const.MaxCubeTextureLevels;
+      }
+      else {
+         return GL_INVALID_ENUM; /*target*/
+      }
+   }
+   else if (dimensions == 3) {
+      /* 3D compressed textures not allowed */
+      return GL_INVALID_ENUM;
+   }
+
+   maxTextureSize = 1 << (maxLevels - 1);
+
+   /* this will catch any invalid compressed format token */
+   if (!_mesa_is_compressed_format(ctx, format))
+      return GL_INVALID_ENUM;
+
+   if (width < 1 || width > maxTextureSize)
+      return GL_INVALID_VALUE;
+
+   if ((height < 1 || height > maxTextureSize)
+       && dimensions > 1)
+      return GL_INVALID_VALUE;
+
+   if (level < 0 || level >= maxLevels)
+      return GL_INVALID_VALUE;
+
+   /*
+    * do checks which depend on compression block size
+    */
+   get_compressed_block_size(format, &bw, &bh);
+
+   if ((xoffset % bw != 0) || (yoffset % bh != 0))
+      return GL_INVALID_VALUE;
+
+   if ((width % bw != 0) && width != 2 && width != 1)
+      return GL_INVALID_VALUE;
+
+   if ((height % bh != 0) && height != 2 && height != 1)
+      return GL_INVALID_VALUE;
+
+   expectedSize = compressed_tex_size(width, height, depth, format);
+   if (expectedSize != imageSize)
+      return GL_INVALID_VALUE;
+
+   return GL_NO_ERROR;
+}
+
+
+/**
+ * Do second part of glCompressedTexSubImage error checking.
+ * \return GL_TRUE if error found, GL_FALSE otherwise.
+ */
+static GLboolean
+compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
+                                   GLsizei width, GLsizei height,
+                                   GLsizei depth, GLenum format,
+                                   struct gl_texture_image *texImage)
+{
+
+   if ((GLint) format != texImage->InternalFormat) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCompressedTexSubImage%uD(format=0x%x)", dims, format);
+      return GL_TRUE;
+   }
+
+   if (((width == 1 || width == 2) &&
+        width != (GLsizei) texImage->Width) ||
+       (width > (GLsizei) texImage->Width)) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCompressedTexSubImage%uD(width=%d)", dims, width);
+      return GL_TRUE;
+   }
+
+   if (dims >= 2) {
+      if (((height == 1 || height == 2) &&
+           height != (GLsizei) texImage->Height) ||
+          (height > (GLsizei) texImage->Height)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCompressedTexSubImage%uD(height=%d)", dims, height);
+         return GL_TRUE;
+      }
+   }
+
+   if (dims >= 3) {
+      if (((depth == 1 || depth == 2) &&
+           depth != (GLsizei) texImage->Depth) ||
+          (depth > (GLsizei) texImage->Depth)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCompressedTexSubImage%uD(depth=%d)", dims, depth);
+         return GL_TRUE;
+      }
+   }
+
+   return GL_FALSE;
+}
+
+
+/**
+ * Implementation of the glCompressedTexImage1/2/3D() functions.
+ */
+static void
+compressedteximage(struct gl_context *ctx, GLuint dims,
+                   GLenum target, GLint level,
+                   GLenum internalFormat, GLsizei width,
+                   GLsizei height, GLsizei depth, GLint border,
+                   GLsizei imageSize, const GLvoid *data)
+{
+   GLenum error;
+   char *reason = "";
+
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+      _mesa_debug(ctx,
+                  "glCompressedTexImage%uDARB %s %d %s %d %d %d %d %d %p\n",
+                  dims,
+                  _mesa_lookup_enum_by_nr(target), level,
+                  _mesa_lookup_enum_by_nr(internalFormat),
+                  width, height, depth, border, imageSize, data);
+
+   /* check target */
+   if (!legal_teximage_target(ctx, dims, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target=%s)",
+                  dims, _mesa_lookup_enum_by_nr(target));
+      return;
+   }
+
+   error = compressed_texture_error_check(ctx, dims, target, level,
+                                          internalFormat, width, height, depth,
+                                          border, imageSize, &reason);
+
+   if (error) {
+      _mesa_error(ctx, error, "glTexImage2D(%s)", reason);
+      return;
+   }
+
+#if FEATURE_ES
+   /* XXX this is kind of a hack */
+   if (dims == 2) {
+      switch (internalFormat) {
+      case GL_PALETTE4_RGB8_OES:
+      case GL_PALETTE4_RGBA8_OES:
+      case GL_PALETTE4_R5_G6_B5_OES:
+      case GL_PALETTE4_RGBA4_OES:
+      case GL_PALETTE4_RGB5_A1_OES:
+      case GL_PALETTE8_RGB8_OES:
+      case GL_PALETTE8_RGBA8_OES:
+      case GL_PALETTE8_R5_G6_B5_OES:
+      case GL_PALETTE8_RGBA4_OES:
+      case GL_PALETTE8_RGB5_A1_OES:
+         _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
+                                          width, height, imageSize, data);
+         return;
+      }
+   }
+#endif
+
+   if (_mesa_is_proxy_texture(target)) {
+      /* Proxy texture: just check for errors and update proxy state */
+      struct gl_texture_image *texImage;
+
+      if (!error) {
+         struct gl_texture_object *texObj =
+            _mesa_get_current_tex_object(ctx, target);
+         gl_format texFormat =
+            _mesa_choose_texture_format(ctx, texObj, target, level,
+                                        internalFormat, GL_NONE, GL_NONE);
+         if (!legal_texture_size(ctx, texFormat, width, height, depth)) {
+            error = GL_OUT_OF_MEMORY;
+         }
+      }
+
+      texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+      if (texImage) {
+         if (error) {
+            /* if error, clear all proxy texture image parameters */
+            clear_teximage_fields(texImage);
+         }
+         else {
+            /* no error: store the teximage parameters */
+            _mesa_init_teximage_fields(ctx, target, texImage, width, height,
+                                       depth, border, internalFormat,
+                                       MESA_FORMAT_NONE);
+         }
+      }
+   }
+   else {
+      /* non-proxy target */
+      struct gl_texture_object *texObj;
+      struct gl_texture_image *texImage;
+
+      if (error) {
+         _mesa_error(ctx, error, "glCompressedTexImage%uD", dims);
+         return;
+      }
+
+      texObj = _mesa_get_current_tex_object(ctx, target);
+
+      _mesa_lock_texture(ctx, texObj);
+      {
+	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
+	 if (!texImage) {
+	    _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                        "glCompressedTexImage%uD", dims);
+	 }
+         else {
+            gl_format texFormat;
+
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+            ASSERT(texImage->Data == NULL);
+
+            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
+                                                    internalFormat, GL_NONE,
+                                                    GL_NONE);
+
+            if (legal_texture_size(ctx, texFormat, width, height, depth)) {
+               _mesa_init_teximage_fields(ctx, target, texImage,
+                                          width, height, depth,
+                                          border, internalFormat, texFormat);
+
+               switch (dims) {
+               case 1:
+                  ASSERT(ctx->Driver.CompressedTexImage1D);
+                  ctx->Driver.CompressedTexImage1D(ctx, target, level,
+                                                   internalFormat,
+                                                   width,
+                                                   border, imageSize, data,
+                                                   texObj, texImage);
+                  break;
+               case 2:
+                  ASSERT(ctx->Driver.CompressedTexImage2D);
+                  ctx->Driver.CompressedTexImage2D(ctx, target, level,
+                                                   internalFormat,
+                                                   width, height,
+                                                   border, imageSize, data,
+                                                   texObj, texImage);
+                  break;
+               case 3:
+                  ASSERT(ctx->Driver.CompressedTexImage3D);
+                  ctx->Driver.CompressedTexImage3D(ctx, target, level,
+                                                   internalFormat,
+                                                   width, height, depth,
+                                                   border, imageSize, data,
+                                                   texObj, texImage);
+                  break;
+               default:
+                  _mesa_problem(ctx, "bad dims in compressedteximage");
+               }
+
+               check_gen_mipmap(ctx, target, texObj, level);
+
+               /* state update */
+               texObj->_Complete = GL_FALSE;
+               ctx->NewState |= _NEW_TEXTURE;
+            }
+            else {
+               _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                           "glCompressedTexImage%uD", dims);
+            }
+         }
+      }
+      _mesa_unlock_texture(ctx, texObj);
+   }
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
+                              GLenum internalFormat, GLsizei width,
+                              GLint border, GLsizei imageSize,
+                              const GLvoid *data)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   compressedteximage(ctx, 1, target, level, internalFormat,
+                      width, 1, 1, border, imageSize, data);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
+                              GLenum internalFormat, GLsizei width,
+                              GLsizei height, GLint border, GLsizei imageSize,
+                              const GLvoid *data)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   compressedteximage(ctx, 2, target, level, internalFormat,
+                      width, height, 1, border, imageSize, data);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexImage3DARB(GLenum target, GLint level,
+                              GLenum internalFormat, GLsizei width,
+                              GLsizei height, GLsizei depth, GLint border,
+                              GLsizei imageSize, const GLvoid *data)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   compressedteximage(ctx, 3, target, level, internalFormat,
+                      width, height, depth, border, imageSize, data);
+}
+
+
+/**
+ * Common helper for glCompressedTexSubImage1/2/3D().
+ */
+static void
+compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
+                         GLint xoffset, GLint yoffset, GLint zoffset,
+                         GLsizei width, GLsizei height, GLsizei depth,
+                         GLenum format, GLsizei imageSize, const GLvoid *data)
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   GLenum error;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   error = compressed_subtexture_error_check(ctx, dims, target, level,
+                                             xoffset, 0, 0, /* pos */
+                                             width, height, depth,   /* size */
+                                             format, imageSize);
+   if (error) {
+      _mesa_error(ctx, error, "glCompressedTexSubImage%uD", dims);
+      return;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
+   _mesa_lock_texture(ctx, texObj);
+   {
+      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+      assert(texImage);
+
+      if (compressed_subtexture_error_check2(ctx, dims, width, height, depth,
+                                             format, texImage)) {
+         /* error was recorded */
+      }
+      else if (width > 0 && height > 0 && depth > 0) {
+         switch (dims) {
+         case 1:
+            if (ctx->Driver.CompressedTexSubImage1D) {
+               ctx->Driver.CompressedTexSubImage1D(ctx, target, level,
+                                                   xoffset, width,
+                                                   format, imageSize, data,
+                                                   texObj, texImage);
+            }
+            break;
+         case 2:
+            if (ctx->Driver.CompressedTexSubImage2D) {
+               ctx->Driver.CompressedTexSubImage2D(ctx, target, level,
+                                                   xoffset, yoffset,
+                                                   width, height,
+                                                   format, imageSize, data,
+                                                   texObj, texImage);
+            }
+            break;
+         case 3:
+            if (ctx->Driver.CompressedTexSubImage3D) {
+               ctx->Driver.CompressedTexSubImage3D(ctx, target, level,
+                                                   xoffset, yoffset, zoffset,
+                                                   width, height, depth,
+                                                   format, imageSize, data,
+                                                   texObj, texImage);
+            }
+            break;
+         default:
+            ;
+         }
+
+         check_gen_mipmap(ctx, target, texObj, level);
+
+         ctx->NewState |= _NEW_TEXTURE;
+      }
+   }
+   _mesa_unlock_texture(ctx, texObj);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
+                                 GLsizei width, GLenum format,
+                                 GLsizei imageSize, const GLvoid *data)
+{
+   compressed_tex_sub_image(1, target, level, xoffset, 0, 0, width, 1, 1,
+                            format, imageSize, data);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
+                                 GLint yoffset, GLsizei width, GLsizei height,
+                                 GLenum format, GLsizei imageSize,
+                                 const GLvoid *data)
+{
+   compressed_tex_sub_image(2, target, level, xoffset, yoffset, 0,
+                            width, height, 1, format, imageSize, data);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
+                                 GLint yoffset, GLint zoffset, GLsizei width,
+                                 GLsizei height, GLsizei depth, GLenum format,
+                                 GLsizei imageSize, const GLvoid *data)
+{
+   compressed_tex_sub_image(3, target, level, xoffset, yoffset, zoffset,
+                            width, height, depth, format, imageSize, data);
+}
+
+
+/**
+ * Helper for glTexBuffer().  Check if internalFormat is legal.  If so,
+ * return the basic data type and number of components for the format.
+ * \param return  GL_TRUE if internalFormat is legal, GL_FALSE otherwise
+ */
+static GLboolean
+get_sized_format_info(const struct gl_context *ctx, GLenum internalFormat,
+                      GLenum *datatype, GLuint *components)
+{
+   switch (internalFormat) {
+   case GL_ALPHA8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 1;
+      break;
+   case GL_ALPHA16:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 1;
+      break;
+   case GL_ALPHA16F_ARB:
+      *datatype = GL_HALF_FLOAT;
+      *components = 1;
+      break;
+   case GL_ALPHA32F_ARB:
+      *datatype = GL_FLOAT;
+      *components = 1;
+      break;
+   case GL_ALPHA8I_EXT:
+      *datatype = GL_BYTE;
+      *components = 1;
+      break;
+   case GL_ALPHA16I_EXT:
+      *datatype = GL_SHORT;
+      *components = 1;
+      break;
+   case GL_ALPHA32I_EXT:
+      *datatype = GL_INT;
+      *components = 1;
+      break;
+   case GL_ALPHA8UI_EXT:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 1;
+      break;
+   case GL_ALPHA16UI_EXT:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 1;
+      break;
+   case GL_ALPHA32UI_EXT:
+      *datatype = GL_UNSIGNED_INT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 1;
+      break;
+   case GL_LUMINANCE16:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE16F_ARB:
+      *datatype = GL_HALF_FLOAT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE32F_ARB:
+      *datatype = GL_FLOAT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE8I_EXT:
+      *datatype = GL_BYTE;
+      *components = 1;
+      break;
+   case GL_LUMINANCE16I_EXT:
+      *datatype = GL_SHORT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE32I_EXT:
+      *datatype = GL_INT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE8UI_EXT:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 1;
+      break;
+   case GL_LUMINANCE16UI_EXT:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE32UI_EXT:
+      *datatype = GL_UNSIGNED_INT;
+      *components = 1;
+      break;
+   case GL_LUMINANCE8_ALPHA8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 2;
+      break;
+   case GL_LUMINANCE16_ALPHA16:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA16F_ARB:
+      *datatype = GL_HALF_FLOAT;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA32F_ARB:
+      *datatype = GL_FLOAT;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA8I_EXT:
+      *datatype = GL_BYTE;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA16I_EXT:
+      *datatype = GL_SHORT;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA32I_EXT:
+      *datatype = GL_INT;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA8UI_EXT:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA16UI_EXT:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 2;
+      break;
+   case GL_LUMINANCE_ALPHA32UI_EXT:
+      *datatype = GL_UNSIGNED_INT;
+      *components = 2;
+      break;
+   case GL_INTENSITY8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 1;
+      break;
+   case GL_INTENSITY16:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 1;
+      break;
+   case GL_INTENSITY16F_ARB:
+      *datatype = GL_HALF_FLOAT;
+      *components = 1;
+      break;
+   case GL_INTENSITY32F_ARB:
+      *datatype = GL_FLOAT;
+      *components = 1;
+      break;
+   case GL_INTENSITY8I_EXT:
+      *datatype = GL_BYTE;
+      *components = 1;
+      break;
+   case GL_INTENSITY16I_EXT:
+      *datatype = GL_SHORT;
+      *components = 1;
+      break;
+   case GL_INTENSITY32I_EXT:
+      *datatype = GL_INT;
+      *components = 1;
+      break;
+   case GL_INTENSITY8UI_EXT:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 1;
+      break;
+   case GL_INTENSITY16UI_EXT:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 1;
+      break;
+   case GL_INTENSITY32UI_EXT:
+      *datatype = GL_UNSIGNED_INT;
+      *components = 1;
+      break;
+   case GL_RGBA8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 4;
+      break;
+   case GL_RGBA16:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 4;
+      break;
+   case GL_RGBA16F_ARB:
+      *datatype = GL_HALF_FLOAT;
+      *components = 4;
+      break;
+   case GL_RGBA32F_ARB:
+      *datatype = GL_FLOAT;
+      *components = 4;
+      break;
+   case GL_RGBA8I_EXT:
+      *datatype = GL_BYTE;
+      *components = 4;
+      break;
+   case GL_RGBA16I_EXT:
+      *datatype = GL_SHORT;
+      *components = 4;
+      break;
+   case GL_RGBA32I_EXT:
+      *datatype = GL_INT;
+      *components = 4;
+      break;
+   case GL_RGBA8UI_EXT:
+      *datatype = GL_UNSIGNED_BYTE;
+      *components = 4;
+      break;
+   case GL_RGBA16UI_EXT:
+      *datatype = GL_UNSIGNED_SHORT;
+      *components = 4;
+      break;
+   case GL_RGBA32UI_EXT:
+      *datatype = GL_UNSIGNED_INT;
+      *components = 4;
+      break;
+   default:
+      return GL_FALSE;
+   }
+
+   if (*datatype == GL_FLOAT && !ctx->Extensions.ARB_texture_float)
+      return GL_FALSE;
+
+   if (*datatype == GL_HALF_FLOAT && !ctx->Extensions.ARB_half_float_pixel)
+      return GL_FALSE;
+
+   return GL_TRUE;
+}
+
+
+/** GL_ARB_texture_buffer_object */
+void GLAPIENTRY
+_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
+{
+   struct gl_texture_object *texObj;
+   struct gl_buffer_object *bufObj;
+   GLenum dataType;
+   GLuint comps;
+
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (!ctx->Extensions.ARB_texture_buffer_object) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer");
+      return;
+   }
+
+   if (target != GL_TEXTURE_BUFFER_ARB) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(target)");
+      return;
+   }
+
+   if (!get_sized_format_info(ctx, internalFormat, &dataType, &comps)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(internalFormat 0x%x)",
+                  internalFormat);
+      return;
+   }
+
+   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+   if (buffer && !bufObj) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer(buffer %u)", buffer);
+      return;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
+   _mesa_lock_texture(ctx, texObj);
+   {
+      _mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
+      texObj->BufferObjectFormat = internalFormat;
+   }
+   _mesa_unlock_texture(ctx, texObj);
+}
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 9a690529a..c4fe82a0b 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -63,7 +63,6 @@
 #include "pack.h"
 #include "pbo.h"
 #include "imports.h"
-#include "pack.h"
 #include "texcompress.h"
 #include "texcompress_fxt1.h"
 #include "texcompress_rgtc.h"
@@ -3551,6 +3550,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
        baseInternalFormat == srcFormat &&
+       baseInternalFormat == baseFormat &&
        srcType == GL_FLOAT) {
       /* simple memcpy path */
       memcpy_texture(ctx, dims,
@@ -3625,6 +3625,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
        baseInternalFormat == srcFormat &&
+       baseInternalFormat == baseFormat &&
        srcType == GL_HALF_FLOAT_ARB) {
       /* simple memcpy path */
       memcpy_texture(ctx, dims,
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index f984ce3bc..12fe7b5e2 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -412,11 +412,10 @@ split_location_offset(GLint *location, GLint *offset)
  */
 static void
 _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location,
-                    GLfloat *params)
+                    GLsizei bufSize, GLfloat *params)
 {
    struct gl_program *prog;
-   GLint paramPos;
-   GLint offset;
+   GLint paramPos, offset;
 
    split_location_offset(&location, &offset);
 
@@ -426,9 +425,18 @@ _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location,
       const struct gl_program_parameter *p =
          &prog->Parameters->Parameters[paramPos];
       GLint rows, cols, i, j, k;
+      GLsizei numBytes;
 
       get_uniform_rows_cols(p, &rows, &cols);
 
+      numBytes = rows * cols * sizeof *params;
+      if (bufSize < numBytes) {
+         _mesa_error( ctx, GL_INVALID_OPERATION,
+                     "glGetnUniformfvARB(out of bounds: bufSize is %d,"
+                     " but %d bytes are required)", bufSize, numBytes );
+         return;
+      }
+
       k = 0;
       for (i = 0; i < rows; i++) {
 	 const int base = paramPos + offset + i;
@@ -447,11 +455,10 @@ _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location,
  */
 static void
 _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location,
-                    GLint *params)
+                    GLsizei bufSize, GLint *params)
 {
    struct gl_program *prog;
-   GLint paramPos;
-   GLint offset;
+   GLint paramPos, offset;
 
    split_location_offset(&location, &offset);
 
@@ -461,9 +468,18 @@ _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location,
       const struct gl_program_parameter *p =
          &prog->Parameters->Parameters[paramPos];
       GLint rows, cols, i, j, k;
+      GLsizei numBytes;
 
       get_uniform_rows_cols(p, &rows, &cols);
 
+      numBytes = rows * cols * sizeof *params;
+      if (bufSize < numBytes) {
+         _mesa_error( ctx, GL_INVALID_OPERATION,
+                     "glGetnUniformivARB(out of bounds: bufSize is %d,"
+                     " but %d bytes are required)", bufSize, numBytes );
+         return;
+      }
+
       k = 0;
       for (i = 0; i < rows; i++) {
 	 const int base = paramPos + offset + i;
@@ -483,11 +499,10 @@ _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location,
  */
 static void
 _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location,
-                     GLuint *params)
+                     GLsizei bufSize, GLuint *params)
 {
    struct gl_program *prog;
-   GLint paramPos;
-   GLint offset;
+   GLint paramPos, offset;
 
    split_location_offset(&location, &offset);
 
@@ -497,9 +512,18 @@ _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location,
       const struct gl_program_parameter *p =
          &prog->Parameters->Parameters[paramPos];
       GLint rows, cols, i, j, k;
+      GLsizei numBytes;
 
       get_uniform_rows_cols(p, &rows, &cols);
 
+      numBytes = rows * cols * sizeof *params;
+      if (bufSize < numBytes) {
+         _mesa_error( ctx, GL_INVALID_OPERATION,
+                     "glGetnUniformuivARB(out of bounds: bufSize is %d,"
+                     " but %d bytes are required)", bufSize, numBytes );
+         return;
+      }
+
       k = 0;
       for (i = 0; i < rows; i++) {
 	 const int base = paramPos + offset + i;
@@ -512,6 +536,19 @@ _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location,
 }
 
 
+/**
+ * Called via glGetUniformdv().
+ * New in GL_ARB_gpu_shader_fp64, OpenGL 4.0
+ */
+static void
+_mesa_get_uniformdv(struct gl_context *ctx, GLuint program, GLint location,
+                    GLsizei bufSize, GLdouble *params)
+{
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformdvARB"
+               "(GL_ARB_gpu_shader_fp64 not implemented)");
+}
+
+
 /**
  * Called via glGetUniformLocation().
  *
@@ -1350,29 +1387,65 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
 
 
 void GLAPIENTRY
-_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params)
+_mesa_GetnUniformfvARB(GLhandleARB program, GLint location,
+                       GLsizei bufSize, GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_get_uniformfv(ctx, program, location, params);
+   _mesa_get_uniformfv(ctx, program, location, bufSize, params);
+}
+
+void GLAPIENTRY
+_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params)
+{
+   _mesa_GetnUniformfvARB(program, location, INT_MAX, params);
 }
 
 
 void GLAPIENTRY
-_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params)
+_mesa_GetnUniformivARB(GLhandleARB program, GLint location,
+                       GLsizei bufSize, GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_get_uniformiv(ctx, program, location, params);
+   _mesa_get_uniformiv(ctx, program, location, bufSize, params);
+}
+
+void GLAPIENTRY
+_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params)
+{
+   _mesa_GetnUniformivARB(program, location, INT_MAX, params);
 }
 
 
 /* GL3 */
+void GLAPIENTRY
+_mesa_GetnUniformuivARB(GLhandleARB program, GLint location,
+                        GLsizei bufSize, GLuint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_get_uniformuiv(ctx, program, location, bufSize, params);
+}
+
 void GLAPIENTRY
 _mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params)
+{
+   _mesa_GetnUniformuivARB(program, location, INT_MAX, params);
+}
+
+
+/* GL4 */
+void GLAPIENTRY
+_mesa_GetnUniformdvARB(GLhandleARB program, GLint location,
+                        GLsizei bufSize, GLdouble *params)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_get_uniformuiv(ctx, program, location, params);
+   _mesa_get_uniformdv(ctx, program, location, bufSize, params);
 }
 
+void GLAPIENTRY
+_mesa_GetUniformdv(GLhandleARB program, GLint location, GLdouble *params)
+{
+   _mesa_GetnUniformdvARB(program, location, INT_MAX, params);
+}
 
 
 GLint GLAPIENTRY
@@ -1454,6 +1527,11 @@ _mesa_init_shader_uniform_dispatch(struct _glapi_table *exec)
    SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
    SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
 
+   /* GL_ARB_robustness */
+   SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
+   SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
+   SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
+   SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */
 
 #endif /* FEATURE_GL */
 }
diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h
index 3a85144fa..b024cb30b 100644
--- a/mesalib/src/mesa/main/uniforms.h
+++ b/mesalib/src/mesa/main/uniforms.h
@@ -1,193 +1,208 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2010  VMware, Inc.  All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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 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.
- */
-
-
-#ifndef UNIFORMS_H
-#define UNIFORMS_H
-
-#include "glheader.h"
-#include "program/prog_parameter.h"
-
-struct gl_program;
-struct _glapi_table;
-
-extern void GLAPIENTRY
-_mesa_Uniform1fARB(GLint, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform2fARB(GLint, GLfloat, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform3fARB(GLint, GLfloat, GLfloat, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform4fARB(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform1iARB(GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform2iARB(GLint, GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform3iARB(GLint, GLint, GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform4iARB(GLint, GLint, GLint, GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform1fvARB(GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform2fvARB(GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform3fvARB(GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform4fvARB(GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform1ivARB(GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform2ivARB(GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform3ivARB(GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform4ivARB(GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform1ui(GLint location, GLuint v0);
-
-extern void GLAPIENTRY
-_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1);
-
-extern void GLAPIENTRY
-_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
-
-extern void GLAPIENTRY
-_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-extern void GLAPIENTRY
-_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value);
-
-extern void GLAPIENTRY
-_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value);
-
-extern void GLAPIENTRY
-_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value);
-
-extern void GLAPIENTRY
-_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value);
-
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix2fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix3fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix4fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
-                         const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
-                         const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
-                         const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
-                         const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
-                         const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
-                         const GLfloat *value);
-
-
-extern void GLAPIENTRY
-_mesa_GetActiveUniformARB(GLhandleARB, GLuint, GLsizei, GLsizei *,
-                          GLint *, GLenum *, GLcharARB *);
-
-extern void GLAPIENTRY
-_mesa_GetUniformfvARB(GLhandleARB, GLint, GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_GetUniformivARB(GLhandleARB, GLint, GLint *);
-
-extern void GLAPIENTRY
-_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params);
-
-extern GLint GLAPIENTRY
-_mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *);
-
-GLint
-_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
-			   const GLchar *name);
-
-void
-_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program,
-	      GLint location, GLsizei count,
-              const GLvoid *values, GLenum type);
-
-void
-_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
-		     GLint cols, GLint rows,
-                     GLint location, GLsizei count,
-                     GLboolean transpose, const GLfloat *values);
-
-extern void
-_mesa_update_shader_textures_used(struct gl_program *prog);
-
-
-extern void
-_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec);
-
-struct gl_builtin_uniform_element {
-   const char *field;
-   int tokens[STATE_LENGTH];
-   int swizzle;
-};
-
-struct gl_builtin_uniform_desc {
-   const char *name;
-   struct gl_builtin_uniform_element *elements;
-   unsigned int num_elements;
-};
-
-extern const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[];
-
-#endif /* UNIFORMS_H */
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2010  VMware, Inc.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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 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.
+ */
+
+
+#ifndef UNIFORMS_H
+#define UNIFORMS_H
+
+#include "glheader.h"
+#include "program/prog_parameter.h"
+
+struct gl_program;
+struct _glapi_table;
+
+extern void GLAPIENTRY
+_mesa_Uniform1fARB(GLint, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform2fARB(GLint, GLfloat, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform3fARB(GLint, GLfloat, GLfloat, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform4fARB(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform1iARB(GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform2iARB(GLint, GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform3iARB(GLint, GLint, GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform4iARB(GLint, GLint, GLint, GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform1fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform2fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform3fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform4fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform1ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform2ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform3ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform4ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform1ui(GLint location, GLuint v0);
+
+extern void GLAPIENTRY
+_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1);
+
+extern void GLAPIENTRY
+_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
+
+extern void GLAPIENTRY
+_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+
+extern void GLAPIENTRY
+_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value);
+
+extern void GLAPIENTRY
+_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value);
+
+extern void GLAPIENTRY
+_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value);
+
+extern void GLAPIENTRY
+_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value);
+
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix2fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix3fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix4fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
+                         const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
+                         const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
+                         const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
+                         const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
+                         const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
+                         const GLfloat *value);
+
+
+extern void GLAPIENTRY
+_mesa_GetActiveUniformARB(GLhandleARB, GLuint, GLsizei, GLsizei *,
+                          GLint *, GLenum *, GLcharARB *);
+
+extern void GLAPIENTRY
+_mesa_GetUniformfvARB(GLhandleARB, GLint, GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_GetnUniformfvARB(GLhandleARB, GLint, GLsizei, GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_GetUniformivARB(GLhandleARB, GLint, GLint *);
+
+extern void GLAPIENTRY
+_mesa_GetnUniformivARB(GLhandleARB, GLint, GLsizei, GLint *);
+
+extern void GLAPIENTRY
+_mesa_GetUniformuiv(GLhandleARB, GLint, GLuint *);
+
+extern void GLAPIENTRY
+_mesa_GetnUniformuivARB(GLhandleARB, GLint, GLsizei, GLuint *);
+
+extern void GLAPIENTRY
+_mesa_GetUniformdv(GLhandleARB, GLint, GLdouble *);
+
+extern void GLAPIENTRY
+_mesa_GetnUniformdvARB(GLhandleARB, GLint, GLsizei, GLdouble *);
+
+extern GLint GLAPIENTRY
+_mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *);
+
+GLint
+_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
+			   const GLchar *name);
+
+void
+_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program,
+	      GLint location, GLsizei count,
+              const GLvoid *values, GLenum type);
+
+void
+_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
+		     GLint cols, GLint rows,
+                     GLint location, GLsizei count,
+                     GLboolean transpose, const GLfloat *values);
+
+extern void
+_mesa_update_shader_textures_used(struct gl_program *prog);
+
+
+extern void
+_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec);
+
+struct gl_builtin_uniform_element {
+   const char *field;
+   int tokens[STATE_LENGTH];
+   int swizzle;
+};
+
+struct gl_builtin_uniform_desc {
+   const char *name;
+   struct gl_builtin_uniform_element *elements;
+   unsigned int num_elements;
+};
+
+extern const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[];
+
+#endif /* UNIFORMS_H */
diff --git a/mesalib/src/mesa/program/arbprogparse.c b/mesalib/src/mesa/program/arbprogparse.c
index 7f778c3c3..dffc8abf7 100644
--- a/mesalib/src/mesa/program/arbprogparse.c
+++ b/mesalib/src/mesa/program/arbprogparse.c
@@ -116,20 +116,11 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
          program->Base.SamplersUsed |= (1 << i);
    }
    program->Base.ShadowSamplers = prog.ShadowSamplers;
-   switch (state.option.Fog) {
-   case OPTION_FOG_EXP:    program->FogOption = GL_EXP;    break;
-   case OPTION_FOG_EXP2:   program->FogOption = GL_EXP2;   break;
-   case OPTION_FOG_LINEAR: program->FogOption = GL_LINEAR; break;
-   default:                program->FogOption = GL_NONE;   break;
-   }
    program->OriginUpperLeft = state.option.OriginUpperLeft;
    program->PixelCenterInteger = state.option.PixelCenterInteger;
 
    program->UsesKill            = state.fragment.UsesKill;
 
-   if (program->FogOption)
-      program->Base.InputsRead |= FRAG_BIT_FOGC;
-
    if (program->Base.Instructions)
       free(program->Base.Instructions);
    program->Base.Instructions = prog.Instructions;
@@ -143,12 +134,15 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
     * there's no hardware that wants to do fog in a discrete stage separate
     * from the fragment shader.
     */
-   if (program->FogOption != GL_NONE) {
+   if (state.option.Fog != OPTION_NONE) {
+      static const GLenum fog_modes[4] = {
+	 GL_NONE, GL_EXP, GL_EXP2, GL_LINEAR
+      };
+
       /* XXX: we should somehow recompile this to remove clamping if disabled
        * On the ATI driver, this is unclampled if fragment clamping is disabled
        */
-      _mesa_append_fog_code(ctx, program, GL_TRUE);
-      program->FogOption = GL_NONE;
+      _mesa_append_fog_code(ctx, program, fog_modes[state.option.Fog], GL_TRUE);
    }
 
 #if DEBUG_FP
diff --git a/mesalib/src/mesa/program/hash_table.c b/mesalib/src/mesa/program/hash_table.c
index f7ef366c1..877a9e2ff 100644
--- a/mesalib/src/mesa/program/hash_table.c
+++ b/mesalib/src/mesa/program/hash_table.c
@@ -160,6 +160,25 @@ hash_table_remove(struct hash_table *ht, const void *key)
     }
 }
 
+void
+hash_table_call_foreach(struct hash_table *ht,
+			void (*callback)(const void *key,
+					 void *data,
+					 void *closure),
+			void *closure)
+{
+   int bucket;
+
+   for (bucket = 0; bucket < ht->num_buckets; bucket++) {
+      struct node *node, *temp;
+      foreach_s(node, temp, &ht->buckets[bucket]) {
+	 struct hash_node *hn = (struct hash_node *) node;
+
+	 callback(hn->key, hn->data, closure);
+      }
+   }
+}
+
 unsigned
 hash_table_string_hash(const void *key)
 {
diff --git a/mesalib/src/mesa/program/hash_table.h b/mesalib/src/mesa/program/hash_table.h
index f1c4fdcd1..e715bb1cc 100644
--- a/mesalib/src/mesa/program/hash_table.h
+++ b/mesalib/src/mesa/program/hash_table.h
@@ -144,6 +144,13 @@ hash_table_pointer_hash(const void *key);
 int
 hash_table_pointer_compare(const void *key1, const void *key2);
 
+void
+hash_table_call_foreach(struct hash_table *ht,
+			void (*callback)(const void *key,
+					 void *data,
+					 void *closure),
+			void *closure);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/mesalib/src/mesa/program/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c
index 164297a34..11debc485 100644
--- a/mesalib/src/mesa/program/prog_optimize.c
+++ b/mesalib/src/mesa/program/prog_optimize.c
@@ -74,6 +74,17 @@ get_src_arg_mask(const struct prog_instruction *inst,
       case OPCODE_MAD:
       case OPCODE_MUL:
       case OPCODE_SUB:
+      case OPCODE_CMP:
+      case OPCODE_FLR:
+      case OPCODE_FRC:
+      case OPCODE_LRP:
+      case OPCODE_SEQ:
+      case OPCODE_SGE:
+      case OPCODE_SGT:
+      case OPCODE_SLE:
+      case OPCODE_SLT:
+      case OPCODE_SNE:
+      case OPCODE_SSG:
          channel_mask = inst->DstReg.WriteMask & dst_mask;
          break;
       case OPCODE_RCP:
@@ -1235,6 +1246,83 @@ print_it(struct gl_context *ctx, struct gl_program *program, const char *txt) {
 }
 #endif
 
+/**
+ * This pass replaces CMP T0, T1 T2 T0 with MOV T0, T2 when the CMP
+ * instruction is the first instruction to write to register T0.  The are
+ * several lowering passes done in GLSL IR (e.g. branches and
+ * relative addressing) that create a large number of conditional assignments
+ * that ir_to_mesa converts to CMP instructions like the one mentioned above.
+ *
+ * Here is why this conversion is safe:
+ * CMP T0, T1 T2 T0 can be expanded to:
+ * if (T1 < 0.0)
+ * 	MOV T0, T2;
+ * else
+ * 	MOV T0, T0;
+ *
+ * If (T1 < 0.0) evaluates to true then our replacement MOV T0, T2 is the same
+ * as the original program.  If (T1 < 0.0) evaluates to false, executing
+ * MOV T0, T0 will store a garbage value in T0 since T0 is uninitialized.
+ * Therefore, it doesn't matter that we are replacing MOV T0, T0 with MOV T0, T2
+ * because any instruction that was going to read from T0 after this was going
+ * to read a garbage value anyway.
+ */
+static void
+_mesa_simplify_cmp(struct gl_program * program)
+{
+   GLuint tempWrites[REG_ALLOCATE_MAX_PROGRAM_TEMPS];
+   GLuint outputWrites[MAX_PROGRAM_OUTPUTS];
+   GLuint i;
+
+   if (dbg) {
+      printf("Optimize: Begin reads without writes\n");
+      _mesa_print_program(program);
+   }
+
+   for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++) {
+      tempWrites[i] = 0;
+   }
+
+   for (i = 0; i < MAX_PROGRAM_OUTPUTS; i++) {
+      outputWrites[i] = 0;
+   }
+
+   for (i = 0; i < program->NumInstructions; i++) {
+      struct prog_instruction *inst = program->Instructions + i;
+      GLuint prevWriteMask;
+
+      /* Give up if we encounter relative addressing or flow control. */
+      if (_mesa_is_flow_control_opcode(inst->Opcode) || inst->DstReg.RelAddr) {
+         return;
+      }
+
+      if (inst->DstReg.File == PROGRAM_OUTPUT) {
+         assert(inst->DstReg.Index < MAX_PROGRAM_OUTPUTS);
+         prevWriteMask = outputWrites[inst->DstReg.Index];
+         outputWrites[inst->DstReg.Index] |= inst->DstReg.WriteMask;
+      } else if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+         assert(inst->DstReg.Index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
+         prevWriteMask = tempWrites[inst->DstReg.Index];
+         tempWrites[inst->DstReg.Index] |= inst->DstReg.WriteMask;
+      }
+
+      /* For a CMP to be considered a conditional write, the destination
+       * register and source register two must be the same. */
+      if (inst->Opcode == OPCODE_CMP
+          && !(inst->DstReg.WriteMask & prevWriteMask)
+          && inst->SrcReg[2].File == inst->DstReg.File
+          && inst->SrcReg[2].Index == inst->DstReg.Index
+          && inst->DstReg.WriteMask == get_src_arg_mask(inst, 2, NO_MASK)) {
+
+         inst->Opcode = OPCODE_MOV;
+         inst->SrcReg[0] = inst->SrcReg[1];
+      }
+   }
+   if (dbg) {
+      printf("Optimize: End reads without writes\n");
+      _mesa_print_program(program);
+   }
+}
 
 /**
  * Apply optimizations to the given program to eliminate unnecessary
@@ -1245,6 +1333,7 @@ _mesa_optimize_program(struct gl_context *ctx, struct gl_program *program)
 {
    GLboolean any_change;
 
+   _mesa_simplify_cmp(program);
    /* Stop when no modifications were output */
    do {
       any_change = GL_FALSE;
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index 812c0dc50..78efca9f1 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -1,1077 +1,1076 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.3
- *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file program.c
- * Vertex and fragment program support functions.
- * \author Brian Paul
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/hash.h"
-#include "main/mfeatures.h"
-#include "program.h"
-#include "prog_cache.h"
-#include "prog_parameter.h"
-#include "prog_instruction.h"
-
-
-/**
- * A pointer to this dummy program is put into the hash table when
- * glGenPrograms is called.
- */
-struct gl_program _mesa_DummyProgram;
-
-
-/**
- * Init context's vertex/fragment program state
- */
-void
-_mesa_init_program(struct gl_context *ctx)
-{
-   GLuint i;
-
-   /*
-    * If this assertion fails, we need to increase the field
-    * size for register indexes (see INST_INDEX_BITS).
-    */
-   ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4
-          <= (1 << INST_INDEX_BITS));
-   ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4
-          <= (1 << INST_INDEX_BITS));
-
-   ASSERT(ctx->Const.VertexProgram.MaxTemps <= (1 << INST_INDEX_BITS));
-   ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
-   ASSERT(ctx->Const.FragmentProgram.MaxTemps <= (1 << INST_INDEX_BITS));
-   ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
-
-   ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
-   ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
-
-   ASSERT(ctx->Const.VertexProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
-   ASSERT(ctx->Const.FragmentProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
-
-   /* If this fails, increase prog_instruction::TexSrcUnit size */
-   ASSERT(MAX_TEXTURE_UNITS <= (1 << 5));
-
-   /* If this fails, increase prog_instruction::TexSrcTarget size */
-   ASSERT(NUM_TEXTURE_TARGETS <= (1 << 3));
-
-   ctx->Program.ErrorPos = -1;
-   ctx->Program.ErrorString = _mesa_strdup("");
-
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
-   ctx->VertexProgram.Enabled = GL_FALSE;
-#if FEATURE_es2_glsl
-   ctx->VertexProgram.PointSizeEnabled =
-      (ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
-#else
-   ctx->VertexProgram.PointSizeEnabled = GL_FALSE;
-#endif
-   ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
-   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
-                            ctx->Shared->DefaultVertexProgram);
-   assert(ctx->VertexProgram.Current);
-   for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
-      ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
-      ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
-   }
-   ctx->VertexProgram.Cache = _mesa_new_program_cache();
-#endif
-
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
-   ctx->FragmentProgram.Enabled = GL_FALSE;
-   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
-                            ctx->Shared->DefaultFragmentProgram);
-   assert(ctx->FragmentProgram.Current);
-   ctx->FragmentProgram.Cache = _mesa_new_program_cache();
-#endif
-
-#if FEATURE_ARB_geometry_shader4
-   ctx->GeometryProgram.Enabled = GL_FALSE;
-   /* right now by default we don't have a geometry program */
-   _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current,
-                            NULL);
-   ctx->GeometryProgram.Cache = _mesa_new_program_cache();
-#endif
-
-   /* XXX probably move this stuff */
-#if FEATURE_ATI_fragment_shader
-   ctx->ATIFragmentShader.Enabled = GL_FALSE;
-   ctx->ATIFragmentShader.Current = ctx->Shared->DefaultFragmentShader;
-   assert(ctx->ATIFragmentShader.Current);
-   ctx->ATIFragmentShader.Current->RefCount++;
-#endif
-}
-
-
-/**
- * Free a context's vertex/fragment program state
- */
-void
-_mesa_free_program_data(struct gl_context *ctx)
-{
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
-   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
-   _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
-#endif
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
-   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
-   _mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache);
-#endif
-#if FEATURE_ARB_geometry_shader4
-   _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL);
-   _mesa_delete_program_cache(ctx, ctx->GeometryProgram.Cache);
-#endif
-   /* XXX probably move this stuff */
-#if FEATURE_ATI_fragment_shader
-   if (ctx->ATIFragmentShader.Current) {
-      ctx->ATIFragmentShader.Current->RefCount--;
-      if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
-         free(ctx->ATIFragmentShader.Current);
-      }
-   }
-#endif
-   free((void *) ctx->Program.ErrorString);
-}
-
-
-/**
- * Update the default program objects in the given context to reference those
- * specified in the shared state and release those referencing the old
- * shared state.
- */
-void
-_mesa_update_default_objects_program(struct gl_context *ctx)
-{
-#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
-   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
-                            (struct gl_vertex_program *)
-                            ctx->Shared->DefaultVertexProgram);
-   assert(ctx->VertexProgram.Current);
-#endif
-
-#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
-   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
-                            (struct gl_fragment_program *)
-                            ctx->Shared->DefaultFragmentProgram);
-   assert(ctx->FragmentProgram.Current);
-#endif
-
-#if FEATURE_ARB_geometry_shader4
-   _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current,
-                            (struct gl_geometry_program *)
-                            ctx->Shared->DefaultGeometryProgram);
-#endif
-
-   /* XXX probably move this stuff */
-#if FEATURE_ATI_fragment_shader
-   if (ctx->ATIFragmentShader.Current) {
-      ctx->ATIFragmentShader.Current->RefCount--;
-      if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
-         free(ctx->ATIFragmentShader.Current);
-      }
-   }
-   ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
-   assert(ctx->ATIFragmentShader.Current);
-   ctx->ATIFragmentShader.Current->RefCount++;
-#endif
-}
-
-
-/**
- * Set the vertex/fragment program error state (position and error string).
- * This is generally called from within the parsers.
- */
-void
-_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string)
-{
-   ctx->Program.ErrorPos = pos;
-   free((void *) ctx->Program.ErrorString);
-   if (!string)
-      string = "";
-   ctx->Program.ErrorString = _mesa_strdup(string);
-}
-
-
-/**
- * Find the line number and column for 'pos' within 'string'.
- * Return a copy of the line which contains 'pos'.  Free the line with
- * free().
- * \param string  the program string
- * \param pos     the position within the string
- * \param line    returns the line number corresponding to 'pos'.
- * \param col     returns the column number corresponding to 'pos'.
- * \return copy of the line containing 'pos'.
- */
-const GLubyte *
-_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
-                       GLint *line, GLint *col)
-{
-   const GLubyte *lineStart = string;
-   const GLubyte *p = string;
-   GLubyte *s;
-   int len;
-
-   *line = 1;
-
-   while (p != pos) {
-      if (*p == (GLubyte) '\n') {
-         (*line)++;
-         lineStart = p + 1;
-      }
-      p++;
-   }
-
-   *col = (pos - lineStart) + 1;
-
-   /* return copy of this line */
-   while (*p != 0 && *p != '\n')
-      p++;
-   len = p - lineStart;
-   s = (GLubyte *) malloc(len + 1);
-   memcpy(s, lineStart, len);
-   s[len] = 0;
-
-   return s;
-}
-
-
-/**
- * Initialize a new vertex/fragment program object.
- */
-static struct gl_program *
-_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
-                           GLenum target, GLuint id)
-{
-   (void) ctx;
-   if (prog) {
-      GLuint i;
-      memset(prog, 0, sizeof(*prog));
-      prog->Id = id;
-      prog->Target = target;
-      prog->Resident = GL_TRUE;
-      prog->RefCount = 1;
-      prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
-
-      /* default mapping from samplers to texture units */
-      for (i = 0; i < MAX_SAMPLERS; i++)
-         prog->SamplerUnits[i] = i;
-   }
-
-   return prog;
-}
-
-
-/**
- * Initialize a new fragment program object.
- */
-struct gl_program *
-_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog,
-                             GLenum target, GLuint id)
-{
-   if (prog)
-      return _mesa_init_program_struct( ctx, &prog->Base, target, id );
-   else
-      return NULL;
-}
-
-
-/**
- * Initialize a new vertex program object.
- */
-struct gl_program *
-_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog,
-                           GLenum target, GLuint id)
-{
-   if (prog)
-      return _mesa_init_program_struct( ctx, &prog->Base, target, id );
-   else
-      return NULL;
-}
-
-
-/**
- * Initialize a new geometry program object.
- */
-struct gl_program *
-_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog,
-                             GLenum target, GLuint id)
-{
-   if (prog)
-      return _mesa_init_program_struct( ctx, &prog->Base, target, id );
-   else
-      return NULL;
-}
-
-
-/**
- * Allocate and initialize a new fragment/vertex program object but
- * don't put it into the program hash table.  Called via
- * ctx->Driver.NewProgram.  May be overridden (ie. replaced) by a
- * device driver function to implement OO deriviation with additional
- * types not understood by this function.
- *
- * \param ctx  context
- * \param id   program id/number
- * \param target  program target/type
- * \return  pointer to new program object
- */
-struct gl_program *
-_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
-{
-   struct gl_program *prog;
-   switch (target) {
-   case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
-   case GL_VERTEX_STATE_PROGRAM_NV:
-      prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program),
-                                       target, id );
-      break;
-   case GL_FRAGMENT_PROGRAM_NV:
-   case GL_FRAGMENT_PROGRAM_ARB:
-      prog =_mesa_init_fragment_program(ctx,
-                                         CALLOC_STRUCT(gl_fragment_program),
-                                         target, id );
-      break;
-   case MESA_GEOMETRY_PROGRAM:
-      prog = _mesa_init_geometry_program(ctx,
-                                         CALLOC_STRUCT(gl_geometry_program),
-                                         target, id);
-      break;
-   default:
-      _mesa_problem(ctx, "bad target in _mesa_new_program");
-      prog = NULL;
-   }
-   return prog;
-}
-
-
-/**
- * Delete a program and remove it from the hash table, ignoring the
- * reference count.
- * Called via ctx->Driver.DeleteProgram.  May be wrapped (OO deriviation)
- * by a device driver function.
- */
-void
-_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
-{
-   (void) ctx;
-   ASSERT(prog);
-   ASSERT(prog->RefCount==0);
-
-   if (prog == &_mesa_DummyProgram)
-      return;
-
-   if (prog->String)
-      free(prog->String);
-
-   _mesa_free_instructions(prog->Instructions, prog->NumInstructions);
-
-   if (prog->Parameters) {
-      _mesa_free_parameter_list(prog->Parameters);
-   }
-   if (prog->Varying) {
-      _mesa_free_parameter_list(prog->Varying);
-   }
-   if (prog->Attributes) {
-      _mesa_free_parameter_list(prog->Attributes);
-   }
-
-   free(prog);
-}
-
-
-/**
- * Return the gl_program object for a given ID.
- * Basically just a wrapper for _mesa_HashLookup() to avoid a lot of
- * casts elsewhere.
- */
-struct gl_program *
-_mesa_lookup_program(struct gl_context *ctx, GLuint id)
-{
-   if (id)
-      return (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
-   else
-      return NULL;
-}
-
-
-/**
- * Reference counting for vertex/fragment programs
- */
-void
-_mesa_reference_program(struct gl_context *ctx,
-                        struct gl_program **ptr,
-                        struct gl_program *prog)
-{
-   assert(ptr);
-   if (*ptr && prog) {
-      /* sanity check */
-      if ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB)
-         ASSERT(prog->Target == GL_VERTEX_PROGRAM_ARB);
-      else if ((*ptr)->Target == GL_FRAGMENT_PROGRAM_ARB)
-         ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB ||
-                prog->Target == GL_FRAGMENT_PROGRAM_NV);
-      else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM)
-         ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM);
-   }
-   if (*ptr == prog) {
-      return;  /* no change */
-   }
-   if (*ptr) {
-      GLboolean deleteFlag;
-
-      /*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/
-#if 0
-      printf("Program %p ID=%u Target=%s  Refcount-- to %d\n",
-             *ptr, (*ptr)->Id,
-             ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
-              ((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
-             (*ptr)->RefCount - 1);
-#endif
-      ASSERT((*ptr)->RefCount > 0);
-      (*ptr)->RefCount--;
-
-      deleteFlag = ((*ptr)->RefCount == 0);
-      /*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/
-
-      if (deleteFlag) {
-         ASSERT(ctx);
-         ctx->Driver.DeleteProgram(ctx, *ptr);
-      }
-
-      *ptr = NULL;
-   }
-
-   assert(!*ptr);
-   if (prog) {
-      /*_glthread_LOCK_MUTEX(prog->Mutex);*/
-      prog->RefCount++;
-#if 0
-      printf("Program %p ID=%u Target=%s  Refcount++ to %d\n",
-             prog, prog->Id,
-             (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
-              (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
-             prog->RefCount);
-#endif
-      /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/
-   }
-
-   *ptr = prog;
-}
-
-
-/**
- * Return a copy of a program.
- * XXX Problem here if the program object is actually OO-derivation
- * made by a device driver.
- */
-struct gl_program *
-_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
-{
-   struct gl_program *clone;
-
-   clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id);
-   if (!clone)
-      return NULL;
-
-   assert(clone->Target == prog->Target);
-   assert(clone->RefCount == 1);
-
-   clone->String = (GLubyte *) _mesa_strdup((char *) prog->String);
-   clone->Format = prog->Format;
-   clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions);
-   if (!clone->Instructions) {
-      _mesa_reference_program(ctx, &clone, NULL);
-      return NULL;
-   }
-   _mesa_copy_instructions(clone->Instructions, prog->Instructions,
-                           prog->NumInstructions);
-   clone->InputsRead = prog->InputsRead;
-   clone->OutputsWritten = prog->OutputsWritten;
-   clone->SamplersUsed = prog->SamplersUsed;
-   clone->ShadowSamplers = prog->ShadowSamplers;
-   memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed));
-
-   if (prog->Parameters)
-      clone->Parameters = _mesa_clone_parameter_list(prog->Parameters);
-   memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
-   if (prog->Varying)
-      clone->Varying = _mesa_clone_parameter_list(prog->Varying);
-   if (prog->Attributes)
-      clone->Attributes = _mesa_clone_parameter_list(prog->Attributes);
-   memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
-   clone->IndirectRegisterFiles = prog->IndirectRegisterFiles;
-   clone->NumInstructions = prog->NumInstructions;
-   clone->NumTemporaries = prog->NumTemporaries;
-   clone->NumParameters = prog->NumParameters;
-   clone->NumAttributes = prog->NumAttributes;
-   clone->NumAddressRegs = prog->NumAddressRegs;
-   clone->NumNativeInstructions = prog->NumNativeInstructions;
-   clone->NumNativeTemporaries = prog->NumNativeTemporaries;
-   clone->NumNativeParameters = prog->NumNativeParameters;
-   clone->NumNativeAttributes = prog->NumNativeAttributes;
-   clone->NumNativeAddressRegs = prog->NumNativeAddressRegs;
-   clone->NumAluInstructions = prog->NumAluInstructions;
-   clone->NumTexInstructions = prog->NumTexInstructions;
-   clone->NumTexIndirections = prog->NumTexIndirections;
-   clone->NumNativeAluInstructions = prog->NumNativeAluInstructions;
-   clone->NumNativeTexInstructions = prog->NumNativeTexInstructions;
-   clone->NumNativeTexIndirections = prog->NumNativeTexIndirections;
-
-   switch (prog->Target) {
-   case GL_VERTEX_PROGRAM_ARB:
-      {
-         const struct gl_vertex_program *vp
-            = (const struct gl_vertex_program *) prog;
-         struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone;
-         vpc->IsPositionInvariant = vp->IsPositionInvariant;
-         vpc->IsNVProgram = vp->IsNVProgram;
-      }
-      break;
-   case GL_FRAGMENT_PROGRAM_ARB:
-      {
-         const struct gl_fragment_program *fp
-            = (const struct gl_fragment_program *) prog;
-         struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone;
-         fpc->FogOption = fp->FogOption;
-         fpc->UsesKill = fp->UsesKill;
-         fpc->OriginUpperLeft = fp->OriginUpperLeft;
-         fpc->PixelCenterInteger = fp->PixelCenterInteger;
-      }
-      break;
-   case MESA_GEOMETRY_PROGRAM:
-      {
-         const struct gl_geometry_program *gp
-            = (const struct gl_geometry_program *) prog;
-         struct gl_geometry_program *gpc = (struct gl_geometry_program *) clone;
-         gpc->VerticesOut = gp->VerticesOut;
-         gpc->InputType = gp->InputType;
-         gpc->OutputType = gp->OutputType;
-      }
-      break;
-   default:
-      _mesa_problem(NULL, "Unexpected target in _mesa_clone_program");
-   }
-
-   return clone;
-}
-
-
-/**
- * Insert 'count' NOP instructions at 'start' in the given program.
- * Adjust branch targets accordingly.
- */
-GLboolean
-_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
-{
-   const GLuint origLen = prog->NumInstructions;
-   const GLuint newLen = origLen + count;
-   struct prog_instruction *newInst;
-   GLuint i;
-
-   /* adjust branches */
-   for (i = 0; i < prog->NumInstructions; i++) {
-      struct prog_instruction *inst = prog->Instructions + i;
-      if (inst->BranchTarget > 0) {
-         if ((GLuint)inst->BranchTarget >= start) {
-            inst->BranchTarget += count;
-         }
-      }
-   }
-
-   /* Alloc storage for new instructions */
-   newInst = _mesa_alloc_instructions(newLen);
-   if (!newInst) {
-      return GL_FALSE;
-   }
-
-   /* Copy 'start' instructions into new instruction buffer */
-   _mesa_copy_instructions(newInst, prog->Instructions, start);
-
-   /* init the new instructions */
-   _mesa_init_instructions(newInst + start, count);
-
-   /* Copy the remaining/tail instructions to new inst buffer */
-   _mesa_copy_instructions(newInst + start + count,
-                           prog->Instructions + start,
-                           origLen - start);
-
-   /* free old instructions */
-   _mesa_free_instructions(prog->Instructions, origLen);
-
-   /* install new instructions */
-   prog->Instructions = newInst;
-   prog->NumInstructions = newLen;
-
-   return GL_TRUE;
-}
-
-/**
- * Delete 'count' instructions at 'start' in the given program.
- * Adjust branch targets accordingly.
- */
-GLboolean
-_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count)
-{
-   const GLuint origLen = prog->NumInstructions;
-   const GLuint newLen = origLen - count;
-   struct prog_instruction *newInst;
-   GLuint i;
-
-   /* adjust branches */
-   for (i = 0; i < prog->NumInstructions; i++) {
-      struct prog_instruction *inst = prog->Instructions + i;
-      if (inst->BranchTarget > 0) {
-         if (inst->BranchTarget > (GLint) start) {
-            inst->BranchTarget -= count;
-         }
-      }
-   }
-
-   /* Alloc storage for new instructions */
-   newInst = _mesa_alloc_instructions(newLen);
-   if (!newInst) {
-      return GL_FALSE;
-   }
-
-   /* Copy 'start' instructions into new instruction buffer */
-   _mesa_copy_instructions(newInst, prog->Instructions, start);
-
-   /* Copy the remaining/tail instructions to new inst buffer */
-   _mesa_copy_instructions(newInst + start,
-                           prog->Instructions + start + count,
-                           newLen - start);
-
-   /* free old instructions */
-   _mesa_free_instructions(prog->Instructions, origLen);
-
-   /* install new instructions */
-   prog->Instructions = newInst;
-   prog->NumInstructions = newLen;
-
-   return GL_TRUE;
-}
-
-
-/**
- * Search instructions for registers that match (oldFile, oldIndex),
- * replacing them with (newFile, newIndex).
- */
-static void
-replace_registers(struct prog_instruction *inst, GLuint numInst,
-                  GLuint oldFile, GLuint oldIndex,
-                  GLuint newFile, GLuint newIndex)
-{
-   GLuint i, j;
-   for (i = 0; i < numInst; i++) {
-      /* src regs */
-      for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
-         if (inst[i].SrcReg[j].File == oldFile &&
-             inst[i].SrcReg[j].Index == oldIndex) {
-            inst[i].SrcReg[j].File = newFile;
-            inst[i].SrcReg[j].Index = newIndex;
-         }
-      }
-      /* dst reg */
-      if (inst[i].DstReg.File == oldFile && inst[i].DstReg.Index == oldIndex) {
-         inst[i].DstReg.File = newFile;
-         inst[i].DstReg.Index = newIndex;
-      }
-   }
-}
-
-
-/**
- * Search instructions for references to program parameters.  When found,
- * increment the parameter index by 'offset'.
- * Used when combining programs.
- */
-static void
-adjust_param_indexes(struct prog_instruction *inst, GLuint numInst,
-                     GLuint offset)
-{
-   GLuint i, j;
-   for (i = 0; i < numInst; i++) {
-      for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
-         GLuint f = inst[i].SrcReg[j].File;
-         if (f == PROGRAM_CONSTANT ||
-             f == PROGRAM_UNIFORM ||
-             f == PROGRAM_STATE_VAR) {
-            inst[i].SrcReg[j].Index += offset;
-         }
-      }
-   }
-}
-
-
-/**
- * Combine two programs into one.  Fix instructions so the outputs of
- * the first program go to the inputs of the second program.
- */
-struct gl_program *
-_mesa_combine_programs(struct gl_context *ctx,
-                       const struct gl_program *progA,
-                       const struct gl_program *progB)
-{
-   struct prog_instruction *newInst;
-   struct gl_program *newProg;
-   const GLuint lenA = progA->NumInstructions - 1; /* omit END instr */
-   const GLuint lenB = progB->NumInstructions;
-   const GLuint numParamsA = _mesa_num_parameters(progA->Parameters);
-   const GLuint newLength = lenA + lenB;
-   GLboolean usedTemps[MAX_PROGRAM_TEMPS];
-   GLuint firstTemp = 0;
-   GLbitfield inputsB;
-   GLuint i;
-
-   ASSERT(progA->Target == progB->Target);
-
-   newInst = _mesa_alloc_instructions(newLength);
-   if (!newInst)
-      return GL_FALSE;
-
-   _mesa_copy_instructions(newInst, progA->Instructions, lenA);
-   _mesa_copy_instructions(newInst + lenA, progB->Instructions, lenB);
-
-   /* adjust branch / instruction addresses for B's instructions */
-   for (i = 0; i < lenB; i++) {
-      newInst[lenA + i].BranchTarget += lenA;
-   }
-
-   newProg = ctx->Driver.NewProgram(ctx, progA->Target, 0);
-   newProg->Instructions = newInst;
-   newProg->NumInstructions = newLength;
-
-   /* find used temp regs (we may need new temps below) */
-   _mesa_find_used_registers(newProg, PROGRAM_TEMPORARY,
-                             usedTemps, MAX_PROGRAM_TEMPS);
-
-   if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) {
-      struct gl_fragment_program *fprogA, *fprogB, *newFprog;
-      GLbitfield progB_inputsRead = progB->InputsRead;
-      GLint progB_colorFile, progB_colorIndex;
-
-      fprogA = (struct gl_fragment_program *) progA;
-      fprogB = (struct gl_fragment_program *) progB;
-      newFprog = (struct gl_fragment_program *) newProg;
-
-      newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill;
-
-      /* We'll do a search and replace for instances
-       * of progB_colorFile/progB_colorIndex below...
-       */
-      progB_colorFile = PROGRAM_INPUT;
-      progB_colorIndex = FRAG_ATTRIB_COL0;
-
-      /*
-       * The fragment program may get color from a state var rather than
-       * a fragment input (vertex output) if it's constant.
-       * See the texenvprogram.c code.
-       * So, search the program's parameter list now to see if the program
-       * gets color from a state var instead of a conventional fragment
-       * input register.
-       */
-      for (i = 0; i < progB->Parameters->NumParameters; i++) {
-         struct gl_program_parameter *p = &progB->Parameters->Parameters[i];
-         if (p->Type == PROGRAM_STATE_VAR &&
-             p->StateIndexes[0] == STATE_INTERNAL &&
-             p->StateIndexes[1] == STATE_CURRENT_ATTRIB &&
-             (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) {
-            progB_inputsRead |= FRAG_BIT_COL0;
-            progB_colorFile = PROGRAM_STATE_VAR;
-            progB_colorIndex = i;
-            break;
-         }
-      }
-
-      /* Connect color outputs of fprogA to color inputs of fprogB, via a
-       * new temporary register.
-       */
-      if ((progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) &&
-          (progB_inputsRead & FRAG_BIT_COL0)) {
-         GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS,
-                                                  firstTemp);
-         if (tempReg < 0) {
-            _mesa_problem(ctx, "No free temp regs found in "
-                          "_mesa_combine_programs(), using 31");
-            tempReg = 31;
-         }
-         firstTemp = tempReg + 1;
-
-         /* replace writes to result.color[0] with tempReg */
-         replace_registers(newInst, lenA,
-                           PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
-                           PROGRAM_TEMPORARY, tempReg);
-         /* replace reads from the input color with tempReg */
-         replace_registers(newInst + lenA, lenB,
-                           progB_colorFile, progB_colorIndex, /* search for */
-                           PROGRAM_TEMPORARY, tempReg  /* replace with */ );
-      }
-
-      /* compute combined program's InputsRead */
-      inputsB = progB_inputsRead;
-      if (progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
-         inputsB &= ~(1 << FRAG_ATTRIB_COL0);
-      }
-      newProg->InputsRead = progA->InputsRead | inputsB;
-      newProg->OutputsWritten = progB->OutputsWritten;
-      newProg->SamplersUsed = progA->SamplersUsed | progB->SamplersUsed;
-   }
-   else {
-      /* vertex program */
-      assert(0);      /* XXX todo */
-   }
-
-   /*
-    * Merge parameters (uniforms, constants, etc)
-    */
-   newProg->Parameters = _mesa_combine_parameter_lists(progA->Parameters,
-                                                       progB->Parameters);
-
-   adjust_param_indexes(newInst + lenA, lenB, numParamsA);
-
-
-   return newProg;
-}
-
-
-/**
- * Populate the 'used' array with flags indicating which registers (TEMPs,
- * INPUTs, OUTPUTs, etc, are used by the given program.
- * \param file  type of register to scan for
- * \param used  returns true/false flags for in use / free
- * \param usedSize  size of the 'used' array
- */
-void
-_mesa_find_used_registers(const struct gl_program *prog,
-                          gl_register_file file,
-                          GLboolean used[], GLuint usedSize)
-{
-   GLuint i, j;
-
-   memset(used, 0, usedSize);
-
-   for (i = 0; i < prog->NumInstructions; i++) {
-      const struct prog_instruction *inst = prog->Instructions + i;
-      const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
-
-      if (inst->DstReg.File == file) {
-         ASSERT(inst->DstReg.Index < usedSize);
-         if(inst->DstReg.Index < usedSize)
-            used[inst->DstReg.Index] = GL_TRUE;
-      }
-
-      for (j = 0; j < n; j++) {
-         if (inst->SrcReg[j].File == file) {
-            ASSERT(inst->SrcReg[j].Index < usedSize);
-            if(inst->SrcReg[j].Index < usedSize)
-               used[inst->SrcReg[j].Index] = GL_TRUE;
-         }
-      }
-   }
-}
-
-
-/**
- * Scan the given 'used' register flag array for the first entry
- * that's >= firstReg.
- * \param used  vector of flags indicating registers in use (as returned
- *              by _mesa_find_used_registers())
- * \param usedSize  size of the 'used' array
- * \param firstReg  first register to start searching at
- * \return index of unused register, or -1 if none.
- */
-GLint
-_mesa_find_free_register(const GLboolean used[],
-                         GLuint usedSize, GLuint firstReg)
-{
-   GLuint i;
-
-   assert(firstReg < usedSize);
-
-   for (i = firstReg; i < usedSize; i++)
-      if (!used[i])
-         return i;
-
-   return -1;
-}
-
-
-
-/**
- * Check if the given register index is valid (doesn't exceed implementation-
- * dependent limits).
- * \return GL_TRUE if OK, GL_FALSE if bad index
- */
-GLboolean
-_mesa_valid_register_index(const struct gl_context *ctx,
-                           gl_shader_type shaderType,
-                           gl_register_file file, GLint index)
-{
-   const struct gl_program_constants *c;
-
-   switch (shaderType) {
-   case MESA_SHADER_VERTEX:
-      c = &ctx->Const.VertexProgram;
-      break;
-   case MESA_SHADER_FRAGMENT:
-      c = &ctx->Const.FragmentProgram;
-      break;
-   case MESA_SHADER_GEOMETRY:
-      c = &ctx->Const.GeometryProgram;
-      break;
-   default:
-      _mesa_problem(ctx,
-                    "unexpected shader type in _mesa_valid_register_index()");
-      return GL_FALSE;
-   }
-
-   switch (file) {
-   case PROGRAM_UNDEFINED:
-      return GL_TRUE;  /* XXX or maybe false? */
-
-   case PROGRAM_TEMPORARY:
-      return index >= 0 && index < c->MaxTemps;
-
-   case PROGRAM_ENV_PARAM:
-      return index >= 0 && index < c->MaxEnvParams;
-
-   case PROGRAM_LOCAL_PARAM:
-      return index >= 0 && index < c->MaxLocalParams;
-
-   case PROGRAM_NAMED_PARAM:
-      return index >= 0 && index < c->MaxParameters;
-
-   case PROGRAM_UNIFORM:
-   case PROGRAM_STATE_VAR:
-      /* aka constant buffer */
-      return index >= 0 && index < c->MaxUniformComponents / 4;
-
-   case PROGRAM_CONSTANT:
-      /* constant buffer w/ possible relative negative addressing */
-      return (index > (int) c->MaxUniformComponents / -4 &&
-              index < c->MaxUniformComponents / 4);
-
-   case PROGRAM_INPUT:
-      if (index < 0)
-         return GL_FALSE;
-
-      switch (shaderType) {
-      case MESA_SHADER_VERTEX:
-         return index < VERT_ATTRIB_GENERIC0 + c->MaxAttribs;
-      case MESA_SHADER_FRAGMENT:
-         return index < FRAG_ATTRIB_VAR0 + ctx->Const.MaxVarying;
-      case MESA_SHADER_GEOMETRY:
-         return index < GEOM_ATTRIB_VAR0 + ctx->Const.MaxVarying;
-      default:
-         return GL_FALSE;
-      }
-
-   case PROGRAM_OUTPUT:
-      if (index < 0)
-         return GL_FALSE;
-
-      switch (shaderType) {
-      case MESA_SHADER_VERTEX:
-         return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying;
-      case MESA_SHADER_FRAGMENT:
-         return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers;
-      case MESA_SHADER_GEOMETRY:
-         return index < GEOM_RESULT_VAR0 + ctx->Const.MaxVarying;
-      default:
-         return GL_FALSE;
-      }
-
-   case PROGRAM_ADDRESS:
-      return index >= 0 && index < c->MaxAddressRegs;
-
-   default:
-      _mesa_problem(ctx,
-                    "unexpected register file in _mesa_valid_register_index()");
-      return GL_FALSE;
-   }
-}
-
-
-
-/**
- * "Post-process" a GPU program.  This is intended to be used for debugging.
- * Example actions include no-op'ing instructions or changing instruction
- * behaviour.
- */
-void
-_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog)
-{
-   static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 };
-   GLuint i;
-   GLuint whiteSwizzle;
-   GLint whiteIndex = _mesa_add_unnamed_constant(prog->Parameters,
-                                                 white, 4, &whiteSwizzle);
-
-   (void) whiteIndex;
-
-   for (i = 0; i < prog->NumInstructions; i++) {
-      struct prog_instruction *inst = prog->Instructions + i;
-      const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
-
-      (void) n;
-
-      if (_mesa_is_tex_instruction(inst->Opcode)) {
-#if 0
-         /* replace TEX/TXP/TXB with MOV */
-         inst->Opcode = OPCODE_MOV;
-         inst->DstReg.WriteMask = WRITEMASK_XYZW;
-         inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
-         inst->SrcReg[0].Negate = NEGATE_NONE;
-#endif
-
-#if 0
-         /* disable shadow texture mode */
-         inst->TexShadow = 0;
-#endif
-      }
-
-      if (inst->Opcode == OPCODE_TXP) {
-#if 0
-         inst->Opcode = OPCODE_MOV;
-         inst->DstReg.WriteMask = WRITEMASK_XYZW;
-         inst->SrcReg[0].File = PROGRAM_CONSTANT;
-         inst->SrcReg[0].Index = whiteIndex;
-         inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
-         inst->SrcReg[0].Negate = NEGATE_NONE;
-#endif
-#if 0
-         inst->TexShadow = 0;
-#endif
-#if 0
-         inst->Opcode = OPCODE_TEX;
-         inst->TexShadow = 0;
-#endif
-      }
-
-   }
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5.3
+ *
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file program.c
+ * Vertex and fragment program support functions.
+ * \author Brian Paul
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/hash.h"
+#include "main/mfeatures.h"
+#include "program.h"
+#include "prog_cache.h"
+#include "prog_parameter.h"
+#include "prog_instruction.h"
+
+
+/**
+ * A pointer to this dummy program is put into the hash table when
+ * glGenPrograms is called.
+ */
+struct gl_program _mesa_DummyProgram;
+
+
+/**
+ * Init context's vertex/fragment program state
+ */
+void
+_mesa_init_program(struct gl_context *ctx)
+{
+   GLuint i;
+
+   /*
+    * If this assertion fails, we need to increase the field
+    * size for register indexes (see INST_INDEX_BITS).
+    */
+   ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4
+          <= (1 << INST_INDEX_BITS));
+   ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4
+          <= (1 << INST_INDEX_BITS));
+
+   ASSERT(ctx->Const.VertexProgram.MaxTemps <= (1 << INST_INDEX_BITS));
+   ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
+   ASSERT(ctx->Const.FragmentProgram.MaxTemps <= (1 << INST_INDEX_BITS));
+   ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= (1 << INST_INDEX_BITS));
+
+   ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
+   ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS);
+
+   ASSERT(ctx->Const.VertexProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
+   ASSERT(ctx->Const.FragmentProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS));
+
+   /* If this fails, increase prog_instruction::TexSrcUnit size */
+   ASSERT(MAX_TEXTURE_UNITS <= (1 << 5));
+
+   /* If this fails, increase prog_instruction::TexSrcTarget size */
+   ASSERT(NUM_TEXTURE_TARGETS <= (1 << 3));
+
+   ctx->Program.ErrorPos = -1;
+   ctx->Program.ErrorString = _mesa_strdup("");
+
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
+   ctx->VertexProgram.Enabled = GL_FALSE;
+#if FEATURE_es2_glsl
+   ctx->VertexProgram.PointSizeEnabled =
+      (ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
+#else
+   ctx->VertexProgram.PointSizeEnabled = GL_FALSE;
+#endif
+   ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
+   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
+                            ctx->Shared->DefaultVertexProgram);
+   assert(ctx->VertexProgram.Current);
+   for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
+      ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
+      ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
+   }
+   ctx->VertexProgram.Cache = _mesa_new_program_cache();
+#endif
+
+#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
+   ctx->FragmentProgram.Enabled = GL_FALSE;
+   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
+                            ctx->Shared->DefaultFragmentProgram);
+   assert(ctx->FragmentProgram.Current);
+   ctx->FragmentProgram.Cache = _mesa_new_program_cache();
+#endif
+
+#if FEATURE_ARB_geometry_shader4
+   ctx->GeometryProgram.Enabled = GL_FALSE;
+   /* right now by default we don't have a geometry program */
+   _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current,
+                            NULL);
+   ctx->GeometryProgram.Cache = _mesa_new_program_cache();
+#endif
+
+   /* XXX probably move this stuff */
+#if FEATURE_ATI_fragment_shader
+   ctx->ATIFragmentShader.Enabled = GL_FALSE;
+   ctx->ATIFragmentShader.Current = ctx->Shared->DefaultFragmentShader;
+   assert(ctx->ATIFragmentShader.Current);
+   ctx->ATIFragmentShader.Current->RefCount++;
+#endif
+}
+
+
+/**
+ * Free a context's vertex/fragment program state
+ */
+void
+_mesa_free_program_data(struct gl_context *ctx)
+{
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
+   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
+   _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
+#endif
+#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
+   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
+   _mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache);
+#endif
+#if FEATURE_ARB_geometry_shader4
+   _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL);
+   _mesa_delete_program_cache(ctx, ctx->GeometryProgram.Cache);
+#endif
+   /* XXX probably move this stuff */
+#if FEATURE_ATI_fragment_shader
+   if (ctx->ATIFragmentShader.Current) {
+      ctx->ATIFragmentShader.Current->RefCount--;
+      if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
+         free(ctx->ATIFragmentShader.Current);
+      }
+   }
+#endif
+   free((void *) ctx->Program.ErrorString);
+}
+
+
+/**
+ * Update the default program objects in the given context to reference those
+ * specified in the shared state and release those referencing the old
+ * shared state.
+ */
+void
+_mesa_update_default_objects_program(struct gl_context *ctx)
+{
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
+   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
+                            (struct gl_vertex_program *)
+                            ctx->Shared->DefaultVertexProgram);
+   assert(ctx->VertexProgram.Current);
+#endif
+
+#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
+   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
+                            (struct gl_fragment_program *)
+                            ctx->Shared->DefaultFragmentProgram);
+   assert(ctx->FragmentProgram.Current);
+#endif
+
+#if FEATURE_ARB_geometry_shader4
+   _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current,
+                            (struct gl_geometry_program *)
+                            ctx->Shared->DefaultGeometryProgram);
+#endif
+
+   /* XXX probably move this stuff */
+#if FEATURE_ATI_fragment_shader
+   if (ctx->ATIFragmentShader.Current) {
+      ctx->ATIFragmentShader.Current->RefCount--;
+      if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
+         free(ctx->ATIFragmentShader.Current);
+      }
+   }
+   ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
+   assert(ctx->ATIFragmentShader.Current);
+   ctx->ATIFragmentShader.Current->RefCount++;
+#endif
+}
+
+
+/**
+ * Set the vertex/fragment program error state (position and error string).
+ * This is generally called from within the parsers.
+ */
+void
+_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string)
+{
+   ctx->Program.ErrorPos = pos;
+   free((void *) ctx->Program.ErrorString);
+   if (!string)
+      string = "";
+   ctx->Program.ErrorString = _mesa_strdup(string);
+}
+
+
+/**
+ * Find the line number and column for 'pos' within 'string'.
+ * Return a copy of the line which contains 'pos'.  Free the line with
+ * free().
+ * \param string  the program string
+ * \param pos     the position within the string
+ * \param line    returns the line number corresponding to 'pos'.
+ * \param col     returns the column number corresponding to 'pos'.
+ * \return copy of the line containing 'pos'.
+ */
+const GLubyte *
+_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
+                       GLint *line, GLint *col)
+{
+   const GLubyte *lineStart = string;
+   const GLubyte *p = string;
+   GLubyte *s;
+   int len;
+
+   *line = 1;
+
+   while (p != pos) {
+      if (*p == (GLubyte) '\n') {
+         (*line)++;
+         lineStart = p + 1;
+      }
+      p++;
+   }
+
+   *col = (pos - lineStart) + 1;
+
+   /* return copy of this line */
+   while (*p != 0 && *p != '\n')
+      p++;
+   len = p - lineStart;
+   s = (GLubyte *) malloc(len + 1);
+   memcpy(s, lineStart, len);
+   s[len] = 0;
+
+   return s;
+}
+
+
+/**
+ * Initialize a new vertex/fragment program object.
+ */
+static struct gl_program *
+_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
+                           GLenum target, GLuint id)
+{
+   (void) ctx;
+   if (prog) {
+      GLuint i;
+      memset(prog, 0, sizeof(*prog));
+      prog->Id = id;
+      prog->Target = target;
+      prog->Resident = GL_TRUE;
+      prog->RefCount = 1;
+      prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
+
+      /* default mapping from samplers to texture units */
+      for (i = 0; i < MAX_SAMPLERS; i++)
+         prog->SamplerUnits[i] = i;
+   }
+
+   return prog;
+}
+
+
+/**
+ * Initialize a new fragment program object.
+ */
+struct gl_program *
+_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog,
+                             GLenum target, GLuint id)
+{
+   if (prog)
+      return _mesa_init_program_struct( ctx, &prog->Base, target, id );
+   else
+      return NULL;
+}
+
+
+/**
+ * Initialize a new vertex program object.
+ */
+struct gl_program *
+_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog,
+                           GLenum target, GLuint id)
+{
+   if (prog)
+      return _mesa_init_program_struct( ctx, &prog->Base, target, id );
+   else
+      return NULL;
+}
+
+
+/**
+ * Initialize a new geometry program object.
+ */
+struct gl_program *
+_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog,
+                             GLenum target, GLuint id)
+{
+   if (prog)
+      return _mesa_init_program_struct( ctx, &prog->Base, target, id );
+   else
+      return NULL;
+}
+
+
+/**
+ * Allocate and initialize a new fragment/vertex program object but
+ * don't put it into the program hash table.  Called via
+ * ctx->Driver.NewProgram.  May be overridden (ie. replaced) by a
+ * device driver function to implement OO deriviation with additional
+ * types not understood by this function.
+ *
+ * \param ctx  context
+ * \param id   program id/number
+ * \param target  program target/type
+ * \return  pointer to new program object
+ */
+struct gl_program *
+_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
+{
+   struct gl_program *prog;
+   switch (target) {
+   case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
+   case GL_VERTEX_STATE_PROGRAM_NV:
+      prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program),
+                                       target, id );
+      break;
+   case GL_FRAGMENT_PROGRAM_NV:
+   case GL_FRAGMENT_PROGRAM_ARB:
+      prog =_mesa_init_fragment_program(ctx,
+                                         CALLOC_STRUCT(gl_fragment_program),
+                                         target, id );
+      break;
+   case MESA_GEOMETRY_PROGRAM:
+      prog = _mesa_init_geometry_program(ctx,
+                                         CALLOC_STRUCT(gl_geometry_program),
+                                         target, id);
+      break;
+   default:
+      _mesa_problem(ctx, "bad target in _mesa_new_program");
+      prog = NULL;
+   }
+   return prog;
+}
+
+
+/**
+ * Delete a program and remove it from the hash table, ignoring the
+ * reference count.
+ * Called via ctx->Driver.DeleteProgram.  May be wrapped (OO deriviation)
+ * by a device driver function.
+ */
+void
+_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
+{
+   (void) ctx;
+   ASSERT(prog);
+   ASSERT(prog->RefCount==0);
+
+   if (prog == &_mesa_DummyProgram)
+      return;
+
+   if (prog->String)
+      free(prog->String);
+
+   _mesa_free_instructions(prog->Instructions, prog->NumInstructions);
+
+   if (prog->Parameters) {
+      _mesa_free_parameter_list(prog->Parameters);
+   }
+   if (prog->Varying) {
+      _mesa_free_parameter_list(prog->Varying);
+   }
+   if (prog->Attributes) {
+      _mesa_free_parameter_list(prog->Attributes);
+   }
+
+   free(prog);
+}
+
+
+/**
+ * Return the gl_program object for a given ID.
+ * Basically just a wrapper for _mesa_HashLookup() to avoid a lot of
+ * casts elsewhere.
+ */
+struct gl_program *
+_mesa_lookup_program(struct gl_context *ctx, GLuint id)
+{
+   if (id)
+      return (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
+   else
+      return NULL;
+}
+
+
+/**
+ * Reference counting for vertex/fragment programs
+ */
+void
+_mesa_reference_program(struct gl_context *ctx,
+                        struct gl_program **ptr,
+                        struct gl_program *prog)
+{
+   assert(ptr);
+   if (*ptr && prog) {
+      /* sanity check */
+      if ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB)
+         ASSERT(prog->Target == GL_VERTEX_PROGRAM_ARB);
+      else if ((*ptr)->Target == GL_FRAGMENT_PROGRAM_ARB)
+         ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB ||
+                prog->Target == GL_FRAGMENT_PROGRAM_NV);
+      else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM)
+         ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM);
+   }
+   if (*ptr == prog) {
+      return;  /* no change */
+   }
+   if (*ptr) {
+      GLboolean deleteFlag;
+
+      /*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/
+#if 0
+      printf("Program %p ID=%u Target=%s  Refcount-- to %d\n",
+             *ptr, (*ptr)->Id,
+             ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
+              ((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
+             (*ptr)->RefCount - 1);
+#endif
+      ASSERT((*ptr)->RefCount > 0);
+      (*ptr)->RefCount--;
+
+      deleteFlag = ((*ptr)->RefCount == 0);
+      /*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/
+
+      if (deleteFlag) {
+         ASSERT(ctx);
+         ctx->Driver.DeleteProgram(ctx, *ptr);
+      }
+
+      *ptr = NULL;
+   }
+
+   assert(!*ptr);
+   if (prog) {
+      /*_glthread_LOCK_MUTEX(prog->Mutex);*/
+      prog->RefCount++;
+#if 0
+      printf("Program %p ID=%u Target=%s  Refcount++ to %d\n",
+             prog, prog->Id,
+             (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
+              (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
+             prog->RefCount);
+#endif
+      /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/
+   }
+
+   *ptr = prog;
+}
+
+
+/**
+ * Return a copy of a program.
+ * XXX Problem here if the program object is actually OO-derivation
+ * made by a device driver.
+ */
+struct gl_program *
+_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
+{
+   struct gl_program *clone;
+
+   clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id);
+   if (!clone)
+      return NULL;
+
+   assert(clone->Target == prog->Target);
+   assert(clone->RefCount == 1);
+
+   clone->String = (GLubyte *) _mesa_strdup((char *) prog->String);
+   clone->Format = prog->Format;
+   clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions);
+   if (!clone->Instructions) {
+      _mesa_reference_program(ctx, &clone, NULL);
+      return NULL;
+   }
+   _mesa_copy_instructions(clone->Instructions, prog->Instructions,
+                           prog->NumInstructions);
+   clone->InputsRead = prog->InputsRead;
+   clone->OutputsWritten = prog->OutputsWritten;
+   clone->SamplersUsed = prog->SamplersUsed;
+   clone->ShadowSamplers = prog->ShadowSamplers;
+   memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed));
+
+   if (prog->Parameters)
+      clone->Parameters = _mesa_clone_parameter_list(prog->Parameters);
+   memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
+   if (prog->Varying)
+      clone->Varying = _mesa_clone_parameter_list(prog->Varying);
+   if (prog->Attributes)
+      clone->Attributes = _mesa_clone_parameter_list(prog->Attributes);
+   memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams));
+   clone->IndirectRegisterFiles = prog->IndirectRegisterFiles;
+   clone->NumInstructions = prog->NumInstructions;
+   clone->NumTemporaries = prog->NumTemporaries;
+   clone->NumParameters = prog->NumParameters;
+   clone->NumAttributes = prog->NumAttributes;
+   clone->NumAddressRegs = prog->NumAddressRegs;
+   clone->NumNativeInstructions = prog->NumNativeInstructions;
+   clone->NumNativeTemporaries = prog->NumNativeTemporaries;
+   clone->NumNativeParameters = prog->NumNativeParameters;
+   clone->NumNativeAttributes = prog->NumNativeAttributes;
+   clone->NumNativeAddressRegs = prog->NumNativeAddressRegs;
+   clone->NumAluInstructions = prog->NumAluInstructions;
+   clone->NumTexInstructions = prog->NumTexInstructions;
+   clone->NumTexIndirections = prog->NumTexIndirections;
+   clone->NumNativeAluInstructions = prog->NumNativeAluInstructions;
+   clone->NumNativeTexInstructions = prog->NumNativeTexInstructions;
+   clone->NumNativeTexIndirections = prog->NumNativeTexIndirections;
+
+   switch (prog->Target) {
+   case GL_VERTEX_PROGRAM_ARB:
+      {
+         const struct gl_vertex_program *vp
+            = (const struct gl_vertex_program *) prog;
+         struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone;
+         vpc->IsPositionInvariant = vp->IsPositionInvariant;
+         vpc->IsNVProgram = vp->IsNVProgram;
+      }
+      break;
+   case GL_FRAGMENT_PROGRAM_ARB:
+      {
+         const struct gl_fragment_program *fp
+            = (const struct gl_fragment_program *) prog;
+         struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone;
+         fpc->UsesKill = fp->UsesKill;
+         fpc->OriginUpperLeft = fp->OriginUpperLeft;
+         fpc->PixelCenterInteger = fp->PixelCenterInteger;
+      }
+      break;
+   case MESA_GEOMETRY_PROGRAM:
+      {
+         const struct gl_geometry_program *gp
+            = (const struct gl_geometry_program *) prog;
+         struct gl_geometry_program *gpc = (struct gl_geometry_program *) clone;
+         gpc->VerticesOut = gp->VerticesOut;
+         gpc->InputType = gp->InputType;
+         gpc->OutputType = gp->OutputType;
+      }
+      break;
+   default:
+      _mesa_problem(NULL, "Unexpected target in _mesa_clone_program");
+   }
+
+   return clone;
+}
+
+
+/**
+ * Insert 'count' NOP instructions at 'start' in the given program.
+ * Adjust branch targets accordingly.
+ */
+GLboolean
+_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
+{
+   const GLuint origLen = prog->NumInstructions;
+   const GLuint newLen = origLen + count;
+   struct prog_instruction *newInst;
+   GLuint i;
+
+   /* adjust branches */
+   for (i = 0; i < prog->NumInstructions; i++) {
+      struct prog_instruction *inst = prog->Instructions + i;
+      if (inst->BranchTarget > 0) {
+         if ((GLuint)inst->BranchTarget >= start) {
+            inst->BranchTarget += count;
+         }
+      }
+   }
+
+   /* Alloc storage for new instructions */
+   newInst = _mesa_alloc_instructions(newLen);
+   if (!newInst) {
+      return GL_FALSE;
+   }
+
+   /* Copy 'start' instructions into new instruction buffer */
+   _mesa_copy_instructions(newInst, prog->Instructions, start);
+
+   /* init the new instructions */
+   _mesa_init_instructions(newInst + start, count);
+
+   /* Copy the remaining/tail instructions to new inst buffer */
+   _mesa_copy_instructions(newInst + start + count,
+                           prog->Instructions + start,
+                           origLen - start);
+
+   /* free old instructions */
+   _mesa_free_instructions(prog->Instructions, origLen);
+
+   /* install new instructions */
+   prog->Instructions = newInst;
+   prog->NumInstructions = newLen;
+
+   return GL_TRUE;
+}
+
+/**
+ * Delete 'count' instructions at 'start' in the given program.
+ * Adjust branch targets accordingly.
+ */
+GLboolean
+_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count)
+{
+   const GLuint origLen = prog->NumInstructions;
+   const GLuint newLen = origLen - count;
+   struct prog_instruction *newInst;
+   GLuint i;
+
+   /* adjust branches */
+   for (i = 0; i < prog->NumInstructions; i++) {
+      struct prog_instruction *inst = prog->Instructions + i;
+      if (inst->BranchTarget > 0) {
+         if (inst->BranchTarget > (GLint) start) {
+            inst->BranchTarget -= count;
+         }
+      }
+   }
+
+   /* Alloc storage for new instructions */
+   newInst = _mesa_alloc_instructions(newLen);
+   if (!newInst) {
+      return GL_FALSE;
+   }
+
+   /* Copy 'start' instructions into new instruction buffer */
+   _mesa_copy_instructions(newInst, prog->Instructions, start);
+
+   /* Copy the remaining/tail instructions to new inst buffer */
+   _mesa_copy_instructions(newInst + start,
+                           prog->Instructions + start + count,
+                           newLen - start);
+
+   /* free old instructions */
+   _mesa_free_instructions(prog->Instructions, origLen);
+
+   /* install new instructions */
+   prog->Instructions = newInst;
+   prog->NumInstructions = newLen;
+
+   return GL_TRUE;
+}
+
+
+/**
+ * Search instructions for registers that match (oldFile, oldIndex),
+ * replacing them with (newFile, newIndex).
+ */
+static void
+replace_registers(struct prog_instruction *inst, GLuint numInst,
+                  GLuint oldFile, GLuint oldIndex,
+                  GLuint newFile, GLuint newIndex)
+{
+   GLuint i, j;
+   for (i = 0; i < numInst; i++) {
+      /* src regs */
+      for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
+         if (inst[i].SrcReg[j].File == oldFile &&
+             inst[i].SrcReg[j].Index == oldIndex) {
+            inst[i].SrcReg[j].File = newFile;
+            inst[i].SrcReg[j].Index = newIndex;
+         }
+      }
+      /* dst reg */
+      if (inst[i].DstReg.File == oldFile && inst[i].DstReg.Index == oldIndex) {
+         inst[i].DstReg.File = newFile;
+         inst[i].DstReg.Index = newIndex;
+      }
+   }
+}
+
+
+/**
+ * Search instructions for references to program parameters.  When found,
+ * increment the parameter index by 'offset'.
+ * Used when combining programs.
+ */
+static void
+adjust_param_indexes(struct prog_instruction *inst, GLuint numInst,
+                     GLuint offset)
+{
+   GLuint i, j;
+   for (i = 0; i < numInst; i++) {
+      for (j = 0; j < _mesa_num_inst_src_regs(inst[i].Opcode); j++) {
+         GLuint f = inst[i].SrcReg[j].File;
+         if (f == PROGRAM_CONSTANT ||
+             f == PROGRAM_UNIFORM ||
+             f == PROGRAM_STATE_VAR) {
+            inst[i].SrcReg[j].Index += offset;
+         }
+      }
+   }
+}
+
+
+/**
+ * Combine two programs into one.  Fix instructions so the outputs of
+ * the first program go to the inputs of the second program.
+ */
+struct gl_program *
+_mesa_combine_programs(struct gl_context *ctx,
+                       const struct gl_program *progA,
+                       const struct gl_program *progB)
+{
+   struct prog_instruction *newInst;
+   struct gl_program *newProg;
+   const GLuint lenA = progA->NumInstructions - 1; /* omit END instr */
+   const GLuint lenB = progB->NumInstructions;
+   const GLuint numParamsA = _mesa_num_parameters(progA->Parameters);
+   const GLuint newLength = lenA + lenB;
+   GLboolean usedTemps[MAX_PROGRAM_TEMPS];
+   GLuint firstTemp = 0;
+   GLbitfield inputsB;
+   GLuint i;
+
+   ASSERT(progA->Target == progB->Target);
+
+   newInst = _mesa_alloc_instructions(newLength);
+   if (!newInst)
+      return GL_FALSE;
+
+   _mesa_copy_instructions(newInst, progA->Instructions, lenA);
+   _mesa_copy_instructions(newInst + lenA, progB->Instructions, lenB);
+
+   /* adjust branch / instruction addresses for B's instructions */
+   for (i = 0; i < lenB; i++) {
+      newInst[lenA + i].BranchTarget += lenA;
+   }
+
+   newProg = ctx->Driver.NewProgram(ctx, progA->Target, 0);
+   newProg->Instructions = newInst;
+   newProg->NumInstructions = newLength;
+
+   /* find used temp regs (we may need new temps below) */
+   _mesa_find_used_registers(newProg, PROGRAM_TEMPORARY,
+                             usedTemps, MAX_PROGRAM_TEMPS);
+
+   if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) {
+      struct gl_fragment_program *fprogA, *fprogB, *newFprog;
+      GLbitfield progB_inputsRead = progB->InputsRead;
+      GLint progB_colorFile, progB_colorIndex;
+
+      fprogA = (struct gl_fragment_program *) progA;
+      fprogB = (struct gl_fragment_program *) progB;
+      newFprog = (struct gl_fragment_program *) newProg;
+
+      newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill;
+
+      /* We'll do a search and replace for instances
+       * of progB_colorFile/progB_colorIndex below...
+       */
+      progB_colorFile = PROGRAM_INPUT;
+      progB_colorIndex = FRAG_ATTRIB_COL0;
+
+      /*
+       * The fragment program may get color from a state var rather than
+       * a fragment input (vertex output) if it's constant.
+       * See the texenvprogram.c code.
+       * So, search the program's parameter list now to see if the program
+       * gets color from a state var instead of a conventional fragment
+       * input register.
+       */
+      for (i = 0; i < progB->Parameters->NumParameters; i++) {
+         struct gl_program_parameter *p = &progB->Parameters->Parameters[i];
+         if (p->Type == PROGRAM_STATE_VAR &&
+             p->StateIndexes[0] == STATE_INTERNAL &&
+             p->StateIndexes[1] == STATE_CURRENT_ATTRIB &&
+             (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) {
+            progB_inputsRead |= FRAG_BIT_COL0;
+            progB_colorFile = PROGRAM_STATE_VAR;
+            progB_colorIndex = i;
+            break;
+         }
+      }
+
+      /* Connect color outputs of fprogA to color inputs of fprogB, via a
+       * new temporary register.
+       */
+      if ((progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) &&
+          (progB_inputsRead & FRAG_BIT_COL0)) {
+         GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS,
+                                                  firstTemp);
+         if (tempReg < 0) {
+            _mesa_problem(ctx, "No free temp regs found in "
+                          "_mesa_combine_programs(), using 31");
+            tempReg = 31;
+         }
+         firstTemp = tempReg + 1;
+
+         /* replace writes to result.color[0] with tempReg */
+         replace_registers(newInst, lenA,
+                           PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
+                           PROGRAM_TEMPORARY, tempReg);
+         /* replace reads from the input color with tempReg */
+         replace_registers(newInst + lenA, lenB,
+                           progB_colorFile, progB_colorIndex, /* search for */
+                           PROGRAM_TEMPORARY, tempReg  /* replace with */ );
+      }
+
+      /* compute combined program's InputsRead */
+      inputsB = progB_inputsRead;
+      if (progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
+         inputsB &= ~(1 << FRAG_ATTRIB_COL0);
+      }
+      newProg->InputsRead = progA->InputsRead | inputsB;
+      newProg->OutputsWritten = progB->OutputsWritten;
+      newProg->SamplersUsed = progA->SamplersUsed | progB->SamplersUsed;
+   }
+   else {
+      /* vertex program */
+      assert(0);      /* XXX todo */
+   }
+
+   /*
+    * Merge parameters (uniforms, constants, etc)
+    */
+   newProg->Parameters = _mesa_combine_parameter_lists(progA->Parameters,
+                                                       progB->Parameters);
+
+   adjust_param_indexes(newInst + lenA, lenB, numParamsA);
+
+
+   return newProg;
+}
+
+
+/**
+ * Populate the 'used' array with flags indicating which registers (TEMPs,
+ * INPUTs, OUTPUTs, etc, are used by the given program.
+ * \param file  type of register to scan for
+ * \param used  returns true/false flags for in use / free
+ * \param usedSize  size of the 'used' array
+ */
+void
+_mesa_find_used_registers(const struct gl_program *prog,
+                          gl_register_file file,
+                          GLboolean used[], GLuint usedSize)
+{
+   GLuint i, j;
+
+   memset(used, 0, usedSize);
+
+   for (i = 0; i < prog->NumInstructions; i++) {
+      const struct prog_instruction *inst = prog->Instructions + i;
+      const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
+
+      if (inst->DstReg.File == file) {
+         ASSERT(inst->DstReg.Index < usedSize);
+         if(inst->DstReg.Index < usedSize)
+            used[inst->DstReg.Index] = GL_TRUE;
+      }
+
+      for (j = 0; j < n; j++) {
+         if (inst->SrcReg[j].File == file) {
+            ASSERT(inst->SrcReg[j].Index < usedSize);
+            if(inst->SrcReg[j].Index < usedSize)
+               used[inst->SrcReg[j].Index] = GL_TRUE;
+         }
+      }
+   }
+}
+
+
+/**
+ * Scan the given 'used' register flag array for the first entry
+ * that's >= firstReg.
+ * \param used  vector of flags indicating registers in use (as returned
+ *              by _mesa_find_used_registers())
+ * \param usedSize  size of the 'used' array
+ * \param firstReg  first register to start searching at
+ * \return index of unused register, or -1 if none.
+ */
+GLint
+_mesa_find_free_register(const GLboolean used[],
+                         GLuint usedSize, GLuint firstReg)
+{
+   GLuint i;
+
+   assert(firstReg < usedSize);
+
+   for (i = firstReg; i < usedSize; i++)
+      if (!used[i])
+         return i;
+
+   return -1;
+}
+
+
+
+/**
+ * Check if the given register index is valid (doesn't exceed implementation-
+ * dependent limits).
+ * \return GL_TRUE if OK, GL_FALSE if bad index
+ */
+GLboolean
+_mesa_valid_register_index(const struct gl_context *ctx,
+                           gl_shader_type shaderType,
+                           gl_register_file file, GLint index)
+{
+   const struct gl_program_constants *c;
+
+   switch (shaderType) {
+   case MESA_SHADER_VERTEX:
+      c = &ctx->Const.VertexProgram;
+      break;
+   case MESA_SHADER_FRAGMENT:
+      c = &ctx->Const.FragmentProgram;
+      break;
+   case MESA_SHADER_GEOMETRY:
+      c = &ctx->Const.GeometryProgram;
+      break;
+   default:
+      _mesa_problem(ctx,
+                    "unexpected shader type in _mesa_valid_register_index()");
+      return GL_FALSE;
+   }
+
+   switch (file) {
+   case PROGRAM_UNDEFINED:
+      return GL_TRUE;  /* XXX or maybe false? */
+
+   case PROGRAM_TEMPORARY:
+      return index >= 0 && index < c->MaxTemps;
+
+   case PROGRAM_ENV_PARAM:
+      return index >= 0 && index < c->MaxEnvParams;
+
+   case PROGRAM_LOCAL_PARAM:
+      return index >= 0 && index < c->MaxLocalParams;
+
+   case PROGRAM_NAMED_PARAM:
+      return index >= 0 && index < c->MaxParameters;
+
+   case PROGRAM_UNIFORM:
+   case PROGRAM_STATE_VAR:
+      /* aka constant buffer */
+      return index >= 0 && index < c->MaxUniformComponents / 4;
+
+   case PROGRAM_CONSTANT:
+      /* constant buffer w/ possible relative negative addressing */
+      return (index > (int) c->MaxUniformComponents / -4 &&
+              index < c->MaxUniformComponents / 4);
+
+   case PROGRAM_INPUT:
+      if (index < 0)
+         return GL_FALSE;
+
+      switch (shaderType) {
+      case MESA_SHADER_VERTEX:
+         return index < VERT_ATTRIB_GENERIC0 + c->MaxAttribs;
+      case MESA_SHADER_FRAGMENT:
+         return index < FRAG_ATTRIB_VAR0 + ctx->Const.MaxVarying;
+      case MESA_SHADER_GEOMETRY:
+         return index < GEOM_ATTRIB_VAR0 + ctx->Const.MaxVarying;
+      default:
+         return GL_FALSE;
+      }
+
+   case PROGRAM_OUTPUT:
+      if (index < 0)
+         return GL_FALSE;
+
+      switch (shaderType) {
+      case MESA_SHADER_VERTEX:
+         return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying;
+      case MESA_SHADER_FRAGMENT:
+         return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers;
+      case MESA_SHADER_GEOMETRY:
+         return index < GEOM_RESULT_VAR0 + ctx->Const.MaxVarying;
+      default:
+         return GL_FALSE;
+      }
+
+   case PROGRAM_ADDRESS:
+      return index >= 0 && index < c->MaxAddressRegs;
+
+   default:
+      _mesa_problem(ctx,
+                    "unexpected register file in _mesa_valid_register_index()");
+      return GL_FALSE;
+   }
+}
+
+
+
+/**
+ * "Post-process" a GPU program.  This is intended to be used for debugging.
+ * Example actions include no-op'ing instructions or changing instruction
+ * behaviour.
+ */
+void
+_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog)
+{
+   static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 };
+   GLuint i;
+   GLuint whiteSwizzle;
+   GLint whiteIndex = _mesa_add_unnamed_constant(prog->Parameters,
+                                                 white, 4, &whiteSwizzle);
+
+   (void) whiteIndex;
+
+   for (i = 0; i < prog->NumInstructions; i++) {
+      struct prog_instruction *inst = prog->Instructions + i;
+      const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
+
+      (void) n;
+
+      if (_mesa_is_tex_instruction(inst->Opcode)) {
+#if 0
+         /* replace TEX/TXP/TXB with MOV */
+         inst->Opcode = OPCODE_MOV;
+         inst->DstReg.WriteMask = WRITEMASK_XYZW;
+         inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
+         inst->SrcReg[0].Negate = NEGATE_NONE;
+#endif
+
+#if 0
+         /* disable shadow texture mode */
+         inst->TexShadow = 0;
+#endif
+      }
+
+      if (inst->Opcode == OPCODE_TXP) {
+#if 0
+         inst->Opcode = OPCODE_MOV;
+         inst->DstReg.WriteMask = WRITEMASK_XYZW;
+         inst->SrcReg[0].File = PROGRAM_CONSTANT;
+         inst->SrcReg[0].Index = whiteIndex;
+         inst->SrcReg[0].Swizzle = SWIZZLE_XYZW;
+         inst->SrcReg[0].Negate = NEGATE_NONE;
+#endif
+#if 0
+         inst->TexShadow = 0;
+#endif
+#if 0
+         inst->Opcode = OPCODE_TEX;
+         inst->TexShadow = 0;
+#endif
+      }
+
+   }
+}
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index b35bc5a7c..85c783dd6 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -2060,9 +2060,14 @@ resultColBinding: COLOR optResultFaceType optResultColorType
 
 optResultFaceType:
 	{
-	   $$ = (state->mode == ARB_vertex)
-	      ? VERT_RESULT_COL0
-	      : FRAG_RESULT_COLOR;
+	   if (state->mode == ARB_vertex) {
+	      $$ = VERT_RESULT_COL0;
+	   } else {
+	      if (state->option.DrawBuffers)
+		 $$ = FRAG_RESULT_DATA0;
+	      else
+		 $$ = FRAG_RESULT_COLOR;
+	   }
 	}
 	| '[' INTEGER ']'
 	{
diff --git a/mesalib/src/mesa/program/programopt.c b/mesalib/src/mesa/program/programopt.c
index 5ad9571f7..a239da2c6 100644
--- a/mesalib/src/mesa/program/programopt.c
+++ b/mesalib/src/mesa/program/programopt.c
@@ -230,15 +230,25 @@ _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
 
 
 /**
- * Append extra instructions onto the given fragment program to implement
- * the fog mode specified by fprog->FogOption.
- * The fragment.fogcoord input is used to compute the fog blend factor.
+ * Append instructions to implement fog
  *
- * XXX with a little work, this function could be adapted to add fog code
+ * The \c fragment.fogcoord input is used to compute the fog blend factor.
+ *
+ * \param ctx      The GL context
+ * \param fprog    Fragment program that fog instructions will be appended to.
+ * \param fog_mode Fog mode.  One of \c GL_EXP, \c GL_EXP2, or \c GL_LINEAR.
+ * \param saturate True if writes to color outputs should be clamped to [0, 1]
+ *
+ * \note
+ * This function sets \c FRAG_BIT_FOGC in \c fprog->Base.InputsRead.
+ *
+ * \todo With a little work, this function could be adapted to add fog code
  * to vertex programs too.
  */
 void
-_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog, GLboolean saturate)
+_mesa_append_fog_code(struct gl_context *ctx,
+		      struct gl_fragment_program *fprog, GLenum fog_mode,
+		      GLboolean saturate)
 {
    static const gl_state_index fogPStateOpt[STATE_LENGTH]
       = { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
@@ -251,9 +261,9 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog,
    GLint fogPRefOpt, fogColorRef; /* state references */
    GLuint colorTemp, fogFactorTemp; /* temporary registerss */
 
-   if (fprog->FogOption == GL_NONE) {
+   if (fog_mode == GL_NONE) {
       _mesa_problem(ctx, "_mesa_append_fog_code() called for fragment program"
-                    " with FogOption == GL_NONE");
+                    " with fog_mode == GL_NONE");
       return;
    }
 
@@ -301,7 +311,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog,
 
    /* emit instructions to compute fog blending factor */
    /* this is always clamped to [0, 1] regardless of fragment clamping */
-   if (fprog->FogOption == GL_LINEAR) {
+   if (fog_mode == GL_LINEAR) {
       /* MAD fogFactorTemp.x, fragment.fogcoord.x, fogPRefOpt.x, fogPRefOpt.y; */
       inst->Opcode = OPCODE_MAD;
       inst->DstReg.File = PROGRAM_TEMPORARY;
@@ -320,7 +330,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog,
       inst++;
    }
    else {
-      ASSERT(fprog->FogOption == GL_EXP || fprog->FogOption == GL_EXP2);
+      ASSERT(fog_mode == GL_EXP || fog_mode == GL_EXP2);
       /* fogPRefOpt.z = d/ln(2), fogPRefOpt.w = d/sqrt(ln(2) */
       /* EXP: MUL fogFactorTemp.x, fogPRefOpt.z, fragment.fogcoord.x; */
       /* EXP2: MUL fogFactorTemp.x, fogPRefOpt.w, fragment.fogcoord.x; */
@@ -331,12 +341,12 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog,
       inst->SrcReg[0].File = PROGRAM_STATE_VAR;
       inst->SrcReg[0].Index = fogPRefOpt;
       inst->SrcReg[0].Swizzle
-         = (fprog->FogOption == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW;
+         = (fog_mode == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW;
       inst->SrcReg[1].File = PROGRAM_INPUT;
       inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC;
       inst->SrcReg[1].Swizzle = SWIZZLE_XXXX;
       inst++;
-      if (fprog->FogOption == GL_EXP2) {
+      if (fog_mode == GL_EXP2) {
          /* MUL fogFactorTemp.x, fogFactorTemp.x, fogFactorTemp.x; */
          inst->Opcode = OPCODE_MUL;
          inst->DstReg.File = PROGRAM_TEMPORARY;
@@ -397,7 +407,6 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog,
    fprog->Base.Instructions = newInst;
    fprog->Base.NumInstructions = inst - newInst;
    fprog->Base.InputsRead |= FRAG_BIT_FOGC;
-   /* XXX do this?  fprog->FogOption = GL_NONE; */
 }
 
 
diff --git a/mesalib/src/mesa/program/programopt.h b/mesalib/src/mesa/program/programopt.h
index 79631aa58..b9205823c 100644
--- a/mesalib/src/mesa/program/programopt.h
+++ b/mesalib/src/mesa/program/programopt.h
@@ -32,7 +32,9 @@ extern void
 _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog);
 
 extern void
-_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog, GLboolean saturate);
+_mesa_append_fog_code(struct gl_context *ctx,
+		      struct gl_fragment_program *fprog, GLenum fog_mode,
+		      GLboolean saturate);
 
 extern void
 _mesa_count_texture_indirections(struct gl_program *prog);
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index 808aa73a0..56da010b3 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -33,6 +33,8 @@
  
 
 #include "main/macros.h"
+#include "main/mtypes.h"
+#include "main/samplerobj.h"
 
 #include "st_context.h"
 #include "st_cb_texture.h"
@@ -154,7 +156,7 @@ update_samplers(struct st_context *st)
 
          teximg = texobj->Image[0][texobj->BaseLevel];
 
-         msamp = st_get_mesa_sampler(st->ctx, texUnit);
+         msamp = _mesa_get_samplerobj(st->ctx, texUnit);
 
          sampler->wrap_s = gl_wrap_xlate(msamp->WrapS);
          sampler->wrap_t = gl_wrap_xlate(msamp->WrapT);
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index 19ad2e8cc..9d437ad08 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -33,6 +33,8 @@
  
 
 #include "main/macros.h"
+#include "main/mtypes.h"
+#include "main/samplerobj.h"
 #include "program/prog_instruction.h"
 
 #include "st_context.h"
@@ -209,7 +211,7 @@ update_textures(struct st_context *st)
          else
             texUnit = vprog->Base.SamplerUnits[su];
 
-         samp = st_get_mesa_sampler(st->ctx, texUnit);
+         samp = _mesa_get_samplerobj(st->ctx, texUnit);
 
          texObj = st->ctx->Texture.Unit[texUnit]._Current;
 
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 953cb446e..1e489b29d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -1,472 +1,457 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
- * 
- **************************************************************************/
-
-
-/**
- * Functions for pixel buffer objects and vertex/element buffer objects.
- */
-
-
-#include "main/imports.h"
-#include "main/mtypes.h"
-#include "main/arrayobj.h"
-#include "main/bufferobj.h"
-
-#include "st_context.h"
-#include "st_cb_bufferobjects.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-
-
-/**
- * There is some duplication between mesa's bufferobjects and our
- * bufmgr buffers.  Both have an integer handle and a hashtable to
- * lookup an opaque structure.  It would be nice if the handles and
- * internal structure where somehow shared.
- */
-static struct gl_buffer_object *
-st_bufferobj_alloc(struct gl_context *ctx, GLuint name, GLenum target)
-{
-   struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
-
-   if (!st_obj)
-      return NULL;
-
-   _mesa_initialize_buffer_object(&st_obj->Base, name, target);
-
-   return &st_obj->Base;
-}
-
-
-
-/**
- * Deallocate/free a vertex/pixel buffer object.
- * Called via glDeleteBuffersARB().
- */
-static void
-st_bufferobj_free(struct gl_context *ctx, struct gl_buffer_object *obj)
-{
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-
-   assert(obj->RefCount == 0);
-   assert(st_obj->transfer == NULL);
-
-   if (st_obj->buffer) 
-      pipe_resource_reference(&st_obj->buffer, NULL);
-
-   free(st_obj);
-}
-
-
-
-/**
- * Replace data in a subrange of buffer object.  If the data range
- * specified by size + offset extends beyond the end of the buffer or
- * if data is NULL, no copy is performed.
- * Called via glBufferSubDataARB().
- */
-static void
-st_bufferobj_subdata(struct gl_context *ctx,
-		     GLenum target,
-		     GLintptrARB offset,
-		     GLsizeiptrARB size,
-		     const GLvoid * data, struct gl_buffer_object *obj)
-{
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-
-   /* we may be called from VBO code, so double-check params here */
-   ASSERT(offset >= 0);
-   ASSERT(size >= 0);
-   ASSERT(offset + size <= obj->Size);
-
-   if (!size)
-      return;
-
-   /*
-    * According to ARB_vertex_buffer_object specification, if data is null,
-    * then the contents of the buffer object's data store is undefined. We just
-    * ignore, and leave it unchanged.
-    */
-   if (!data)
-      return;
-
-   /* Now that transfers are per-context, we don't have to figure out
-    * flushing here.  Usually drivers won't need to flush in this case
-    * even if the buffer is currently referenced by hardware - they
-    * just queue the upload as dma rather than mapping the underlying
-    * buffer directly.
-    */
-   pipe_buffer_write(st_context(ctx)->pipe,
-		     st_obj->buffer,
-		     offset, size, data);
-}
-
-
-/**
- * Called via glGetBufferSubDataARB().
- */
-static void
-st_bufferobj_get_subdata(struct gl_context *ctx,
-                         GLenum target,
-                         GLintptrARB offset,
-                         GLsizeiptrARB size,
-                         GLvoid * data, struct gl_buffer_object *obj)
-{
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-
-   /* we may be called from VBO code, so double-check params here */
-   ASSERT(offset >= 0);
-   ASSERT(size >= 0);
-   ASSERT(offset + size <= obj->Size);
-
-   if (!size)
-      return;
-
-   pipe_buffer_read(st_context(ctx)->pipe, st_obj->buffer,
-                    offset, size, data);
-}
-
-
-/**
- * Allocate space for and store data in a buffer object.  Any data that was
- * previously stored in the buffer object is lost.  If data is NULL,
- * memory will be allocated, but no copy will occur.
- * Called via ctx->Driver.BufferData().
- * \return GL_TRUE for success, GL_FALSE if out of memory
- */
-static GLboolean
-st_bufferobj_data(struct gl_context *ctx,
-		  GLenum target,
-		  GLsizeiptrARB size,
-		  const GLvoid * data,
-		  GLenum usage, 
-		  struct gl_buffer_object *obj)
-{
-   struct st_context *st = st_context(ctx);
-   struct pipe_context *pipe = st->pipe;
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-   unsigned bind, pipe_usage;
-
-   st_obj->Base.Size = size;
-   st_obj->Base.Usage = usage;
-   
-   switch(target) {
-   case GL_PIXEL_PACK_BUFFER_ARB:
-   case GL_PIXEL_UNPACK_BUFFER_ARB:
-      bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
-      break;
-   case GL_ARRAY_BUFFER_ARB:
-      bind = PIPE_BIND_VERTEX_BUFFER;
-      break;
-   case GL_ELEMENT_ARRAY_BUFFER_ARB:
-      bind = PIPE_BIND_INDEX_BUFFER;
-      break;
-   default:
-      bind = 0;
-   }
-
-   switch (usage) {
-   case GL_STATIC_DRAW:
-   case GL_STATIC_READ:
-   case GL_STATIC_COPY:
-      pipe_usage = PIPE_USAGE_STATIC;
-      break;
-   case GL_DYNAMIC_DRAW:
-   case GL_DYNAMIC_READ:
-   case GL_DYNAMIC_COPY:
-      pipe_usage = PIPE_USAGE_DYNAMIC;
-      break;
-   case GL_STREAM_DRAW:
-   case GL_STREAM_READ:
-   case GL_STREAM_COPY:
-      pipe_usage = PIPE_USAGE_STREAM;
-      break;
-   default:
-      pipe_usage = PIPE_USAGE_DEFAULT;
-   }
-
-   pipe_resource_reference( &st_obj->buffer, NULL );
-
-   if (size != 0) {
-      st_obj->buffer = pipe_buffer_create(pipe->screen, bind,
-                                          pipe_usage, size);
-
-      if (!st_obj->buffer) {
-         return GL_FALSE;
-      }
-
-      if (data)
-         pipe_buffer_write(st_context(ctx)->pipe, st_obj->buffer, 0,
-				       size, data);
-      return GL_TRUE;
-   }
-
-   return GL_TRUE;
-}
-
-
-/**
- * Dummy data whose's pointer is used for zero size buffers or ranges.
- */
-static long st_bufferobj_zero_length = 0;
-
-
-
-/**
- * Called via glMapBufferARB().
- */
-static void *
-st_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access,
-                 struct gl_buffer_object *obj)
-{
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-   uint flags;
-
-   switch (access) {
-   case GL_WRITE_ONLY:
-      flags = PIPE_TRANSFER_WRITE;
-      break;
-   case GL_READ_ONLY:
-      flags = PIPE_TRANSFER_READ;
-      break;
-   case GL_READ_WRITE:
-   default:
-      flags = PIPE_TRANSFER_READ_WRITE;
-      break;      
-   }
-
-   /* Handle zero-size buffers here rather than in drivers */
-   if (obj->Size == 0) {
-      obj->Pointer = &st_bufferobj_zero_length;
-   }
-   else {
-      obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
-                                     st_obj->buffer,
-                                     flags,
-                                     &st_obj->transfer);
-   }
-
-   if (obj->Pointer) {
-      obj->Offset = 0;
-      obj->Length = obj->Size;
-   }
-   return obj->Pointer;
-}
-
-
-/**
- * Called via glMapBufferRange().
- */
-static void *
-st_bufferobj_map_range(struct gl_context *ctx, GLenum target, 
-                       GLintptr offset, GLsizeiptr length, GLbitfield access,
-                       struct gl_buffer_object *obj)
-{
-   struct pipe_context *pipe = st_context(ctx)->pipe;
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-   enum pipe_transfer_usage flags = 0x0;
-
-   if (access & GL_MAP_WRITE_BIT)
-      flags |= PIPE_TRANSFER_WRITE;
-
-   if (access & GL_MAP_READ_BIT)
-      flags |= PIPE_TRANSFER_READ;
-
-   if (access & GL_MAP_FLUSH_EXPLICIT_BIT)
-      flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;
-
-   if (access & GL_MAP_INVALIDATE_BUFFER_BIT) {
-      flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
-   }
-   else if (access & GL_MAP_INVALIDATE_RANGE_BIT) {
-      if (offset == 0 && length == obj->Size)
-         flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
-      else
-         flags |= PIPE_TRANSFER_DISCARD_RANGE;
-   }
-   
-   if (access & GL_MAP_UNSYNCHRONIZED_BIT)
-      flags |= PIPE_TRANSFER_UNSYNCHRONIZED;
-
-   /* ... other flags ...
-    */
-
-   if (access & MESA_MAP_NOWAIT_BIT)
-      flags |= PIPE_TRANSFER_DONTBLOCK;
-
-   assert(offset >= 0);
-   assert(length >= 0);
-   assert(offset < obj->Size);
-   assert(offset + length <= obj->Size);
-
-   /*
-    * We go out of way here to hide the degenerate yet valid case of zero
-    * length range from the pipe driver.
-    */
-   if (!length) {
-      obj->Pointer = &st_bufferobj_zero_length;
-   }
-   else {
-      obj->Pointer = pipe_buffer_map_range(pipe, 
-                                           st_obj->buffer,
-                                           offset, length,
-                                           flags,
-                                           &st_obj->transfer);
-      if (obj->Pointer) {
-         obj->Pointer = (ubyte *) obj->Pointer + offset;
-      }
-   }
-   
-   if (obj->Pointer) {
-      obj->Offset = offset;
-      obj->Length = length;
-      obj->AccessFlags = access;
-   }
-
-   return obj->Pointer;
-}
-
-
-static void
-st_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target, 
-                                GLintptr offset, GLsizeiptr length,
-                                struct gl_buffer_object *obj)
-{
-   struct pipe_context *pipe = st_context(ctx)->pipe;
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-
-   /* Subrange is relative to mapped range */
-   assert(offset >= 0);
-   assert(length >= 0);
-   assert(offset + length <= obj->Length);
-   assert(obj->Pointer);
-   
-   if (!length)
-      return;
-
-   pipe_buffer_flush_mapped_range(pipe, st_obj->transfer, 
-                                  obj->Offset + offset, length);
-}
-
-
-/**
- * Called via glUnmapBufferARB().
- */
-static GLboolean
-st_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj)
-{
-   struct pipe_context *pipe = st_context(ctx)->pipe;
-   struct st_buffer_object *st_obj = st_buffer_object(obj);
-
-   if (obj->Length)
-      pipe_buffer_unmap(pipe, st_obj->transfer);
-
-   st_obj->transfer = NULL;
-   obj->Pointer = NULL;
-   obj->Offset = 0;
-   obj->Length = 0;
-   return GL_TRUE;
-}
-
-
-/**
- * Called via glCopyBufferSubData().
- */
-static void
-st_copy_buffer_subdata(struct gl_context *ctx,
-                       struct gl_buffer_object *src,
-                       struct gl_buffer_object *dst,
-                       GLintptr readOffset, GLintptr writeOffset,
-                       GLsizeiptr size)
-{
-   struct pipe_context *pipe = st_context(ctx)->pipe;
-   struct st_buffer_object *srcObj = st_buffer_object(src);
-   struct st_buffer_object *dstObj = st_buffer_object(dst);
-   struct pipe_transfer *src_transfer;
-   struct pipe_transfer *dst_transfer;
-   ubyte *srcPtr, *dstPtr;
-
-   if(!size)
-      return;
-
-   /* buffer should not already be mapped */
-   assert(!src->Pointer);
-   assert(!dst->Pointer);
-
-   srcPtr = (ubyte *) pipe_buffer_map_range(pipe,
-                                            srcObj->buffer,
-                                            readOffset, size,
-                                            PIPE_TRANSFER_READ,
-					    &src_transfer);
-
-   dstPtr = (ubyte *) pipe_buffer_map_range(pipe,
-                                            dstObj->buffer,
-                                            writeOffset, size,
-                                            PIPE_TRANSFER_WRITE,
-					    &dst_transfer);
-
-   if (srcPtr && dstPtr)
-      memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
-
-   pipe_buffer_unmap(pipe, src_transfer);
-   pipe_buffer_unmap(pipe, dst_transfer);
-}
-
-
-/* TODO: if buffer wasn't created with appropriate usage flags, need
- * to recreate it now and copy contents -- or possibly create a
- * gallium entrypoint to extend the usage flags and let the driver
- * decide if a copy is necessary.
- */
-void
-st_bufferobj_validate_usage(struct st_context *st,
-			    struct st_buffer_object *obj,
-			    unsigned usage)
-{
-}
-
-
-void
-st_init_bufferobject_functions(struct dd_function_table *functions)
-{
-   functions->NewBufferObject = st_bufferobj_alloc;
-   functions->DeleteBuffer = st_bufferobj_free;
-   functions->BufferData = st_bufferobj_data;
-   functions->BufferSubData = st_bufferobj_subdata;
-   functions->GetBufferSubData = st_bufferobj_get_subdata;
-   functions->MapBuffer = st_bufferobj_map;
-   functions->MapBufferRange = st_bufferobj_map_range;
-   functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
-   functions->UnmapBuffer = st_bufferobj_unmap;
-   functions->CopyBufferSubData = st_copy_buffer_subdata;
-
-   /* For GL_APPLE_vertex_array_object */
-   functions->NewArrayObject = _mesa_new_array_object;
-   functions->DeleteArrayObject = _mesa_delete_array_object;
-}
+/**************************************************************************
+ * 
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ * 
+ **************************************************************************/
+
+
+/**
+ * Functions for pixel buffer objects and vertex/element buffer objects.
+ */
+
+
+#include "main/imports.h"
+#include "main/mtypes.h"
+#include "main/arrayobj.h"
+#include "main/bufferobj.h"
+
+#include "st_context.h"
+#include "st_cb_bufferobjects.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
+
+
+/**
+ * There is some duplication between mesa's bufferobjects and our
+ * bufmgr buffers.  Both have an integer handle and a hashtable to
+ * lookup an opaque structure.  It would be nice if the handles and
+ * internal structure where somehow shared.
+ */
+static struct gl_buffer_object *
+st_bufferobj_alloc(struct gl_context *ctx, GLuint name, GLenum target)
+{
+   struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
+
+   if (!st_obj)
+      return NULL;
+
+   _mesa_initialize_buffer_object(&st_obj->Base, name, target);
+
+   return &st_obj->Base;
+}
+
+
+
+/**
+ * Deallocate/free a vertex/pixel buffer object.
+ * Called via glDeleteBuffersARB().
+ */
+static void
+st_bufferobj_free(struct gl_context *ctx, struct gl_buffer_object *obj)
+{
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+
+   assert(obj->RefCount == 0);
+   assert(st_obj->transfer == NULL);
+
+   if (st_obj->buffer) 
+      pipe_resource_reference(&st_obj->buffer, NULL);
+
+   free(st_obj);
+}
+
+
+
+/**
+ * Replace data in a subrange of buffer object.  If the data range
+ * specified by size + offset extends beyond the end of the buffer or
+ * if data is NULL, no copy is performed.
+ * Called via glBufferSubDataARB().
+ */
+static void
+st_bufferobj_subdata(struct gl_context *ctx,
+		     GLenum target,
+		     GLintptrARB offset,
+		     GLsizeiptrARB size,
+		     const GLvoid * data, struct gl_buffer_object *obj)
+{
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+
+   /* we may be called from VBO code, so double-check params here */
+   ASSERT(offset >= 0);
+   ASSERT(size >= 0);
+   ASSERT(offset + size <= obj->Size);
+
+   if (!size)
+      return;
+
+   /*
+    * According to ARB_vertex_buffer_object specification, if data is null,
+    * then the contents of the buffer object's data store is undefined. We just
+    * ignore, and leave it unchanged.
+    */
+   if (!data)
+      return;
+
+   /* Now that transfers are per-context, we don't have to figure out
+    * flushing here.  Usually drivers won't need to flush in this case
+    * even if the buffer is currently referenced by hardware - they
+    * just queue the upload as dma rather than mapping the underlying
+    * buffer directly.
+    */
+   pipe_buffer_write(st_context(ctx)->pipe,
+		     st_obj->buffer,
+		     offset, size, data);
+}
+
+
+/**
+ * Called via glGetBufferSubDataARB().
+ */
+static void
+st_bufferobj_get_subdata(struct gl_context *ctx,
+                         GLenum target,
+                         GLintptrARB offset,
+                         GLsizeiptrARB size,
+                         GLvoid * data, struct gl_buffer_object *obj)
+{
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+
+   /* we may be called from VBO code, so double-check params here */
+   ASSERT(offset >= 0);
+   ASSERT(size >= 0);
+   ASSERT(offset + size <= obj->Size);
+
+   if (!size)
+      return;
+
+   pipe_buffer_read(st_context(ctx)->pipe, st_obj->buffer,
+                    offset, size, data);
+}
+
+
+/**
+ * Allocate space for and store data in a buffer object.  Any data that was
+ * previously stored in the buffer object is lost.  If data is NULL,
+ * memory will be allocated, but no copy will occur.
+ * Called via ctx->Driver.BufferData().
+ * \return GL_TRUE for success, GL_FALSE if out of memory
+ */
+static GLboolean
+st_bufferobj_data(struct gl_context *ctx,
+		  GLenum target,
+		  GLsizeiptrARB size,
+		  const GLvoid * data,
+		  GLenum usage, 
+		  struct gl_buffer_object *obj)
+{
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+   unsigned bind, pipe_usage;
+
+   st_obj->Base.Size = size;
+   st_obj->Base.Usage = usage;
+   
+   switch(target) {
+   case GL_PIXEL_PACK_BUFFER_ARB:
+   case GL_PIXEL_UNPACK_BUFFER_ARB:
+      bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+      break;
+   case GL_ARRAY_BUFFER_ARB:
+      bind = PIPE_BIND_VERTEX_BUFFER;
+      break;
+   case GL_ELEMENT_ARRAY_BUFFER_ARB:
+      bind = PIPE_BIND_INDEX_BUFFER;
+      break;
+   default:
+      bind = 0;
+   }
+
+   switch (usage) {
+   case GL_STATIC_DRAW:
+   case GL_STATIC_READ:
+   case GL_STATIC_COPY:
+      pipe_usage = PIPE_USAGE_STATIC;
+      break;
+   case GL_DYNAMIC_DRAW:
+   case GL_DYNAMIC_READ:
+   case GL_DYNAMIC_COPY:
+      pipe_usage = PIPE_USAGE_DYNAMIC;
+      break;
+   case GL_STREAM_DRAW:
+   case GL_STREAM_READ:
+   case GL_STREAM_COPY:
+      pipe_usage = PIPE_USAGE_STREAM;
+      break;
+   default:
+      pipe_usage = PIPE_USAGE_DEFAULT;
+   }
+
+   pipe_resource_reference( &st_obj->buffer, NULL );
+
+   if (size != 0) {
+      st_obj->buffer = pipe_buffer_create(pipe->screen, bind,
+                                          pipe_usage, size);
+
+      if (!st_obj->buffer) {
+         return GL_FALSE;
+      }
+
+      if (data)
+         pipe_buffer_write(st_context(ctx)->pipe, st_obj->buffer, 0,
+				       size, data);
+      return GL_TRUE;
+   }
+
+   return GL_TRUE;
+}
+
+
+/**
+ * Dummy data whose's pointer is used for zero size buffers or ranges.
+ */
+static long st_bufferobj_zero_length = 0;
+
+
+
+/**
+ * Called via glMapBufferARB().
+ */
+static void *
+st_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access,
+                 struct gl_buffer_object *obj)
+{
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+   uint flags;
+
+   switch (access) {
+   case GL_WRITE_ONLY:
+      flags = PIPE_TRANSFER_WRITE;
+      break;
+   case GL_READ_ONLY:
+      flags = PIPE_TRANSFER_READ;
+      break;
+   case GL_READ_WRITE:
+   default:
+      flags = PIPE_TRANSFER_READ_WRITE;
+      break;      
+   }
+
+   /* Handle zero-size buffers here rather than in drivers */
+   if (obj->Size == 0) {
+      obj->Pointer = &st_bufferobj_zero_length;
+   }
+   else {
+      obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
+                                     st_obj->buffer,
+                                     flags,
+                                     &st_obj->transfer);
+   }
+
+   if (obj->Pointer) {
+      obj->Offset = 0;
+      obj->Length = obj->Size;
+   }
+   return obj->Pointer;
+}
+
+
+/**
+ * Called via glMapBufferRange().
+ */
+static void *
+st_bufferobj_map_range(struct gl_context *ctx, GLenum target, 
+                       GLintptr offset, GLsizeiptr length, GLbitfield access,
+                       struct gl_buffer_object *obj)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+   enum pipe_transfer_usage flags = 0x0;
+
+   if (access & GL_MAP_WRITE_BIT)
+      flags |= PIPE_TRANSFER_WRITE;
+
+   if (access & GL_MAP_READ_BIT)
+      flags |= PIPE_TRANSFER_READ;
+
+   if (access & GL_MAP_FLUSH_EXPLICIT_BIT)
+      flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;
+
+   if (access & GL_MAP_INVALIDATE_BUFFER_BIT) {
+      flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+   }
+   else if (access & GL_MAP_INVALIDATE_RANGE_BIT) {
+      if (offset == 0 && length == obj->Size)
+         flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+      else
+         flags |= PIPE_TRANSFER_DISCARD_RANGE;
+   }
+   
+   if (access & GL_MAP_UNSYNCHRONIZED_BIT)
+      flags |= PIPE_TRANSFER_UNSYNCHRONIZED;
+
+   /* ... other flags ...
+    */
+
+   if (access & MESA_MAP_NOWAIT_BIT)
+      flags |= PIPE_TRANSFER_DONTBLOCK;
+
+   assert(offset >= 0);
+   assert(length >= 0);
+   assert(offset < obj->Size);
+   assert(offset + length <= obj->Size);
+
+   /*
+    * We go out of way here to hide the degenerate yet valid case of zero
+    * length range from the pipe driver.
+    */
+   if (!length) {
+      obj->Pointer = &st_bufferobj_zero_length;
+   }
+   else {
+      obj->Pointer = pipe_buffer_map_range(pipe, 
+                                           st_obj->buffer,
+                                           offset, length,
+                                           flags,
+                                           &st_obj->transfer);
+      if (obj->Pointer) {
+         obj->Pointer = (ubyte *) obj->Pointer + offset;
+      }
+   }
+   
+   if (obj->Pointer) {
+      obj->Offset = offset;
+      obj->Length = length;
+      obj->AccessFlags = access;
+   }
+
+   return obj->Pointer;
+}
+
+
+static void
+st_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target, 
+                                GLintptr offset, GLsizeiptr length,
+                                struct gl_buffer_object *obj)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+
+   /* Subrange is relative to mapped range */
+   assert(offset >= 0);
+   assert(length >= 0);
+   assert(offset + length <= obj->Length);
+   assert(obj->Pointer);
+   
+   if (!length)
+      return;
+
+   pipe_buffer_flush_mapped_range(pipe, st_obj->transfer, 
+                                  obj->Offset + offset, length);
+}
+
+
+/**
+ * Called via glUnmapBufferARB().
+ */
+static GLboolean
+st_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_buffer_object *st_obj = st_buffer_object(obj);
+
+   if (obj->Length)
+      pipe_buffer_unmap(pipe, st_obj->transfer);
+
+   st_obj->transfer = NULL;
+   obj->Pointer = NULL;
+   obj->Offset = 0;
+   obj->Length = 0;
+   return GL_TRUE;
+}
+
+
+/**
+ * Called via glCopyBufferSubData().
+ */
+static void
+st_copy_buffer_subdata(struct gl_context *ctx,
+                       struct gl_buffer_object *src,
+                       struct gl_buffer_object *dst,
+                       GLintptr readOffset, GLintptr writeOffset,
+                       GLsizeiptr size)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_buffer_object *srcObj = st_buffer_object(src);
+   struct st_buffer_object *dstObj = st_buffer_object(dst);
+   struct pipe_box box;
+
+   if(!size)
+      return;
+
+   /* buffer should not already be mapped */
+   assert(!src->Pointer);
+   assert(!dst->Pointer);
+
+   u_box_1d(readOffset, size, &box);
+
+   pipe->resource_copy_region(pipe, dstObj->buffer, 0, writeOffset, 0, 0,
+                              srcObj->buffer, 0, &box);
+}
+
+
+/* TODO: if buffer wasn't created with appropriate usage flags, need
+ * to recreate it now and copy contents -- or possibly create a
+ * gallium entrypoint to extend the usage flags and let the driver
+ * decide if a copy is necessary.
+ */
+void
+st_bufferobj_validate_usage(struct st_context *st,
+			    struct st_buffer_object *obj,
+			    unsigned usage)
+{
+}
+
+
+void
+st_init_bufferobject_functions(struct dd_function_table *functions)
+{
+   functions->NewBufferObject = st_bufferobj_alloc;
+   functions->DeleteBuffer = st_bufferobj_free;
+   functions->BufferData = st_bufferobj_data;
+   functions->BufferSubData = st_bufferobj_subdata;
+   functions->GetBufferSubData = st_bufferobj_get_subdata;
+   functions->MapBuffer = st_bufferobj_map;
+   functions->MapBufferRange = st_bufferobj_map_range;
+   functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
+   functions->UnmapBuffer = st_bufferobj_unmap;
+   functions->CopyBufferSubData = st_copy_buffer_subdata;
+
+   /* For GL_APPLE_vertex_array_object */
+   functions->NewArrayObject = _mesa_new_array_object;
+   functions->DeleteArrayObject = _mesa_delete_array_object;
+}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
index fdb7770e4..2a63799bd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
@@ -198,6 +198,7 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
                    const struct gl_pixelstore_attrib *pack,
                    GLvoid *dest)
 {
+   GLubyte alphaORoperand;
    enum combination {
       A8R8G8B8_UNORM_TO_RGBA_UBYTE,
       A8R8G8B8_UNORM_TO_RGB_UBYTE,
@@ -208,20 +209,26 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
    if (ctx->_ImageTransferState)
       return GL_FALSE;
 
-   if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM &&
-       format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
+   if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM) {
+      alphaORoperand = 0;
+   }
+   else if (strb->format == PIPE_FORMAT_B8G8R8X8_UNORM ) {
+      alphaORoperand = 0xff;
+   }
+   else {
+      return GL_FALSE;
+   }
+
+   if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
       combo = A8R8G8B8_UNORM_TO_RGBA_UBYTE;
    }
-   else if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM &&
-            format == GL_RGB && type == GL_UNSIGNED_BYTE) {
+   else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
       combo = A8R8G8B8_UNORM_TO_RGB_UBYTE;
    }
-   else if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM &&
-            format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV) {
+   else if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV) {
       combo = A8R8G8B8_UNORM_TO_BGRA_UINT;
    }
-   else if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM &&
-            format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8) {
+   else if (format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8) {
       combo = A8R8G8B8_UNORM_TO_RGBA_UINT;
    }
    else {
@@ -283,7 +290,7 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
                dst[col*4+0] = (pixel >> 16) & 0xff;
                dst[col*4+1] = (pixel >>  8) & 0xff;
                dst[col*4+2] = (pixel >>  0) & 0xff;
-               dst[col*4+3] = (pixel >> 24) & 0xff;
+               dst[col*4+3] = ((pixel >> 24) & 0xff) | alphaORoperand;
             }
             dst += dstStride;
             y += dy;
@@ -306,6 +313,12 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
          for (row = 0; row < height; row++) {
             const GLubyte *src = map + y * trans->stride;
             memcpy(dst, src, 4 * width);
+            if (alphaORoperand) {
+               assert(alphaORoperand == 0xff);
+               for (col = 0; col < width; col++) {
+                  dst[col*4+3] = 0xff;
+               }
+            }
             dst += dstStride;
             y += dy;
          }
@@ -315,7 +328,7 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
             const GLubyte *src = map + y * trans->stride;
             for (col = 0; col < width; col++) {
                GLuint pixel = ((GLuint *) src)[col];
-               dst[col*4+0] = (pixel >> 24) & 0xff;
+               dst[col*4+0] = ((pixel >> 24) & 0xff) | alphaORoperand;
                dst[col*4+1] = (pixel >> 0) & 0xff;
                dst[col*4+2] = (pixel >> 8) & 0xff;
                dst[col*4+3] = (pixel >> 16) & 0xff;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 43c24ae95..a27c30e51 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -1686,7 +1686,7 @@ copy_image_data_to_texture(struct st_context *st,
    /* debug checks */
    {
       const struct gl_texture_image *dstImage =
-         stObj->base.Image[stImage->face][stImage->level];
+         stObj->base.Image[stImage->face][dstLevel];
       assert(dstImage);
       assert(dstImage->Width == stImage->base.Width);
       assert(dstImage->Height == stImage->base.Height);
@@ -1843,7 +1843,12 @@ st_finalize_texture(struct gl_context *ctx,
          /* Need to import images in main memory or held in other textures.
           */
          if (stImage && stObj->pt != stImage->pt) {
-            copy_image_data_to_texture(st, stObj, level, stImage);
+            if (level == 0 || (stImage->base.Width == u_minify(stObj->width0, level) &&
+                stImage->base.Height == u_minify(stObj->height0, level) &&
+                stImage->base.Depth == u_minify(stObj->depth0, level))) {
+               /* src image fits expected dest mipmap level size */
+               copy_image_data_to_texture(st, stObj, level, stImage);
+            }
          }
       }
    }
diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h
index 903e30df5..d50c3c9af 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.h
+++ b/mesalib/src/mesa/state_tracker/st_texture.h
@@ -163,21 +163,6 @@ st_get_texture_sampler_view(struct st_texture_object *stObj,
 }
 
 
-/**
- * Get pointer to the active sampler object for the given texture unit.
- * This will either be a user-defined sampler object or the texture
- * object's own sampler state.
- */
-static INLINE struct gl_sampler_object *
-st_get_mesa_sampler(const struct gl_context *ctx, GLuint unit)
-{
-   if (ctx->Texture.Unit[unit].Sampler)
-      return ctx->Texture.Unit[unit].Sampler;
-   else
-      return &ctx->Texture.Unit[unit]._Current->Sampler;
-}
-
-
 extern struct pipe_resource *
 st_texture_create(struct st_context *st,
                   enum pipe_texture_target target,
diff --git a/mesalib/src/mesa/swrast/s_accum.c b/mesalib/src/mesa/swrast/s_accum.c
index 560a1d143..0ec907d79 100644
--- a/mesalib/src/mesa/swrast/s_accum.c
+++ b/mesalib/src/mesa/swrast/s_accum.c
@@ -1,594 +1,598 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.2
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/macros.h"
-#include "main/imports.h"
-
-#include "s_accum.h"
-#include "s_context.h"
-#include "s_masking.h"
-#include "s_span.h"
-
-
-/* XXX this would have to change for accum buffers with more or less
- * than 16 bits per color channel.
- */
-#define ACCUM_SCALE16 32767.0F
-
-
-/*
- * Accumulation buffer notes
- *
- * Normally, accumulation buffer values are GLshorts with values in
- * [-32767, 32767] which represent floating point colors in [-1, 1],
- * as defined by the OpenGL specification.
- *
- * We optimize for the common case used for full-scene antialiasing:
- *    // start with accum buffer cleared to zero
- *    glAccum(GL_LOAD, w);   // or GL_ACCUM the first image
- *    glAccum(GL_ACCUM, w);
- *    ...
- *    glAccum(GL_ACCUM, w);
- *    glAccum(GL_RETURN, 1.0);
- * That is, we start with an empty accumulation buffer and accumulate
- * n images, each with weight w = 1/n.
- * In this scenario, we can simply store unscaled integer values in
- * the accum buffer instead of scaled integers.  We'll also keep track
- * of the w value so when we do GL_RETURN we simply divide the accumulated
- * values by n (n=1/w).
- * This lets us avoid _many_ int->float->int conversions.
- */
-
-
-#if CHAN_BITS == 8
-/* enable the optimization */
-#define USE_OPTIMIZED_ACCUM  1
-#else
-#define USE_OPTIMIZED_ACCUM  0
-#endif
-
-
-/**
- * This is called when we fall out of optimized/unscaled accum buffer mode.
- * That is, we convert each unscaled accum buffer value into a scaled value
- * representing the range[-1, 1].
- */
-static void
-rescale_accum( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   struct gl_renderbuffer *rb
-      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
-   const GLfloat s = swrast->_IntegerAccumScaler * (32767.0F / CHAN_MAXF);
-
-   assert(rb);
-   assert(rb->_BaseFormat == GL_RGBA);
-   /* add other types in future? */
-   assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT);
-   assert(swrast->_IntegerAccumMode);
-
-   if (rb->GetPointer(ctx, rb, 0, 0)) {
-      /* directly-addressable memory */
-      GLuint y;
-      for (y = 0; y < rb->Height; y++) {
-         GLuint i;
-         GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, 0, y);
-         for (i = 0; i < 4 * rb->Width; i++) {
-            acc[i] = (GLshort) (acc[i] * s);
-         }
-      }
-   }
-   else {
-      /* use get/put row funcs */
-      GLuint y;
-      for (y = 0; y < rb->Height; y++) {
-         GLshort accRow[MAX_WIDTH * 4];
-         GLuint i;
-         rb->GetRow(ctx, rb, rb->Width, 0, y, accRow);
-         for (i = 0; i < 4 * rb->Width; i++) {
-            accRow[i] = (GLshort) (accRow[i] * s);
-         }
-         rb->PutRow(ctx, rb, rb->Width, 0, y, accRow, NULL);
-      }
-   }
-
-   swrast->_IntegerAccumMode = GL_FALSE;
-}
-
-
-
-/**
- * Clear the accumulation Buffer.
- */
-void
-_swrast_clear_accum_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLuint x, y, width, height;
-
-   /* No accumulation buffer! Not an error. */
-   if (!rb || !rb->Data)
-      return;
-
-   assert(rb->_BaseFormat == GL_RGBA);
-   /* add other types in future? */
-   assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT);
-
-   /* bounds, with scissor */
-   x = ctx->DrawBuffer->_Xmin;
-   y = ctx->DrawBuffer->_Ymin;
-   width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
-   height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
-
-   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
-      const GLfloat accScale = 32767.0;
-      GLshort clearVal[4];
-      GLuint i;
-
-      clearVal[0] = (GLshort) (ctx->Accum.ClearColor[0] * accScale);
-      clearVal[1] = (GLshort) (ctx->Accum.ClearColor[1] * accScale);
-      clearVal[2] = (GLshort) (ctx->Accum.ClearColor[2] * accScale);
-      clearVal[3] = (GLshort) (ctx->Accum.ClearColor[3] * accScale);
-
-      for (i = 0; i < height; i++) {
-         rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
-      }
-   }
-   else {
-      /* someday support other sizes */
-   }
-
-   /* update optimized accum state vars */
-   if (ctx->Accum.ClearColor[0] == 0.0 && ctx->Accum.ClearColor[1] == 0.0 &&
-       ctx->Accum.ClearColor[2] == 0.0 && ctx->Accum.ClearColor[3] == 0.0) {
-#if USE_OPTIMIZED_ACCUM
-      swrast->_IntegerAccumMode = GL_TRUE;
-#else
-      swrast->_IntegerAccumMode = GL_FALSE;
-#endif
-      swrast->_IntegerAccumScaler = 0.0;  /* denotes empty accum buffer */
-   }
-   else {
-      swrast->_IntegerAccumMode = GL_FALSE;
-   }
-}
-
-
-static void
-accum_add(struct gl_context *ctx, GLfloat value,
-          GLint xpos, GLint ypos, GLint width, GLint height )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   struct gl_renderbuffer *rb
-      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
-
-   assert(rb);
-
-   /* Leave optimized accum buffer mode */
-   if (swrast->_IntegerAccumMode)
-      rescale_accum(ctx);
-
-   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
-      const GLshort incr = (GLshort) (value * ACCUM_SCALE16);
-      if (rb->GetPointer(ctx, rb, 0, 0)) {
-         GLint i, j;
-         for (i = 0; i < height; i++) {
-            GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
-            for (j = 0; j < 4 * width; j++) {
-               acc[j] += incr;
-            }
-         }
-      }
-      else {
-         GLint i, j;
-         for (i = 0; i < height; i++) {
-            GLshort accRow[4 * MAX_WIDTH];
-            rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow);
-            for (j = 0; j < 4 * width; j++) {
-               accRow[j] += incr;
-            }
-            rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL);
-         }
-      }
-   }
-   else {
-      /* other types someday */
-   }
-}
-
-
-static void
-accum_mult(struct gl_context *ctx, GLfloat mult,
-           GLint xpos, GLint ypos, GLint width, GLint height )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   struct gl_renderbuffer *rb
-      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
-
-   assert(rb);
-
-   /* Leave optimized accum buffer mode */
-   if (swrast->_IntegerAccumMode)
-      rescale_accum(ctx);
-
-   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
-      if (rb->GetPointer(ctx, rb, 0, 0)) {
-         GLint i, j;
-         for (i = 0; i < height; i++) {
-            GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
-            for (j = 0; j < 4 * width; j++) {
-               acc[j] = (GLshort) (acc[j] * mult);
-            }
-         }
-      }
-      else {
-         GLint i, j;
-         for (i = 0; i < height; i++) {
-            GLshort accRow[4 * MAX_WIDTH];
-            rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow);
-            for (j = 0; j < 4 * width; j++) {
-               accRow[j] = (GLshort) (accRow[j] * mult);
-            }
-            rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL);
-         }
-      }
-   }
-   else {
-      /* other types someday */
-   }
-}
-
-
-
-static void
-accum_accum(struct gl_context *ctx, GLfloat value,
-            GLint xpos, GLint ypos, GLint width, GLint height )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   struct gl_renderbuffer *rb
-      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
-   const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL);
-
-   assert(rb);
-
-   if (!ctx->ReadBuffer->_ColorReadBuffer) {
-      /* no read buffer - OK */
-      return;
-   }
-
-   /* May have to leave optimized accum buffer mode */
-   if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0)
-      swrast->_IntegerAccumScaler = value;
-   if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler)
-      rescale_accum(ctx);
-
-   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
-      const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF;
-      GLshort accumRow[4 * MAX_WIDTH];
-      GLchan rgba[MAX_WIDTH][4];
-      GLint i;
-
-      for (i = 0; i < height; i++) {
-         GLshort *acc;
-         if (directAccess) {
-            acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
-         }
-         else {
-            rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow);
-            acc = accumRow;
-         }
-
-         /* read colors from color buffer */
-         _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width,
-                                xpos, ypos + i, CHAN_TYPE, rgba);
-
-         /* do accumulation */
-         if (swrast->_IntegerAccumMode) {
-            /* simply add integer color values into accum buffer */
-            GLint j;
-            for (j = 0; j < width; j++) {
-               acc[j * 4 + 0] += rgba[j][RCOMP];
-               acc[j * 4 + 1] += rgba[j][GCOMP];
-               acc[j * 4 + 2] += rgba[j][BCOMP];
-               acc[j * 4 + 3] += rgba[j][ACOMP];
-            }
-         }
-         else {
-            /* scaled integer (or float) accum buffer */
-            GLint j;
-            for (j = 0; j < width; j++) {
-               acc[j * 4 + 0] += (GLshort) ((GLfloat) rgba[j][RCOMP] * scale);
-               acc[j * 4 + 1] += (GLshort) ((GLfloat) rgba[j][GCOMP] * scale);
-               acc[j * 4 + 2] += (GLshort) ((GLfloat) rgba[j][BCOMP] * scale);
-               acc[j * 4 + 3] += (GLshort) ((GLfloat) rgba[j][ACOMP] * scale);
-            }
-         }
-
-         if (!directAccess) {
-            rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL);
-         }
-      }
-   }
-   else {
-      /* other types someday */
-   }
-}
-
-
-
-static void
-accum_load(struct gl_context *ctx, GLfloat value,
-           GLint xpos, GLint ypos, GLint width, GLint height )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   struct gl_renderbuffer *rb
-      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
-   const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL);
-
-   assert(rb);
-
-   if (!ctx->ReadBuffer->_ColorReadBuffer) {
-      /* no read buffer - OK */
-      return;
-   }
-
-   /* This is a change to go into optimized accum buffer mode */
-   if (value > 0.0 && value <= 1.0) {
-#if USE_OPTIMIZED_ACCUM
-      swrast->_IntegerAccumMode = GL_TRUE;
-#else
-      swrast->_IntegerAccumMode = GL_FALSE;
-#endif
-      swrast->_IntegerAccumScaler = value;
-   }
-   else {
-      swrast->_IntegerAccumMode = GL_FALSE;
-      swrast->_IntegerAccumScaler = 0.0;
-   }
-
-   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
-      const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF;
-      GLshort accumRow[4 * MAX_WIDTH];
-      GLchan rgba[MAX_WIDTH][4];
-      GLint i;
-
-      for (i = 0; i < height; i++) {
-         GLshort *acc;
-         if (directAccess) {
-            acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
-         }
-         else {
-            rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow);
-            acc = accumRow;
-         }
-
-         /* read colors from color buffer */
-         _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width,
-                                xpos, ypos + i, CHAN_TYPE, rgba);
-
-         /* do load */
-         if (swrast->_IntegerAccumMode) {
-            /* just copy values in */
-            GLint j;
-            assert(swrast->_IntegerAccumScaler > 0.0);
-            assert(swrast->_IntegerAccumScaler <= 1.0);
-            for (j = 0; j < width; j++) {
-               acc[j * 4 + 0] = rgba[j][RCOMP];
-               acc[j * 4 + 1] = rgba[j][GCOMP];
-               acc[j * 4 + 2] = rgba[j][BCOMP];
-               acc[j * 4 + 3] = rgba[j][ACOMP];
-            }
-         }
-         else {
-            /* scaled integer (or float) accum buffer */
-            GLint j;
-            for (j = 0; j < width; j++) {
-               acc[j * 4 + 0] = (GLshort) ((GLfloat) rgba[j][RCOMP] * scale);
-               acc[j * 4 + 1] = (GLshort) ((GLfloat) rgba[j][GCOMP] * scale);
-               acc[j * 4 + 2] = (GLshort) ((GLfloat) rgba[j][BCOMP] * scale);
-               acc[j * 4 + 3] = (GLshort) ((GLfloat) rgba[j][ACOMP] * scale);
-            }
-         }
-
-         if (!directAccess) {
-            rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL);
-         }
-      }
-   }
-}
-
-
-static void
-accum_return(struct gl_context *ctx, GLfloat value,
-             GLint xpos, GLint ypos, GLint width, GLint height )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   struct gl_framebuffer *fb = ctx->DrawBuffer;
-   struct gl_renderbuffer *accumRb = fb->Attachment[BUFFER_ACCUM].Renderbuffer;
-   const GLboolean directAccess
-      = (accumRb->GetPointer(ctx, accumRb, 0, 0) != NULL);
-
-   static GLchan multTable[32768];
-   static GLfloat prevMult = 0.0;
-   const GLfloat mult = swrast->_IntegerAccumScaler;
-   const GLint max = MIN2((GLint) (256 / mult), 32767);
-
-   /* May have to leave optimized accum buffer mode */
-   if (swrast->_IntegerAccumMode && value != 1.0)
-      rescale_accum(ctx);
-
-   if (swrast->_IntegerAccumMode && swrast->_IntegerAccumScaler > 0) {
-      /* build lookup table to avoid many floating point multiplies */
-      GLint j;
-      assert(swrast->_IntegerAccumScaler <= 1.0);
-      if (mult != prevMult) {
-         for (j = 0; j < max; j++)
-            multTable[j] = IROUND((GLfloat) j * mult);
-         prevMult = mult;
-      }
-   }
-
-   if (accumRb->DataType == GL_SHORT ||
-       accumRb->DataType == GL_UNSIGNED_SHORT) {
-      const GLfloat scale = value * CHAN_MAXF / ACCUM_SCALE16;
-      GLuint buffer;
-      GLint i;
-
-      /* XXX maybe transpose the 'i' and 'buffer' loops??? */
-      for (i = 0; i < height; i++) {
-         GLshort accumRow[4 * MAX_WIDTH];
-         GLshort *acc;
-         SWspan span;
-
-         /* init color span */
-         INIT_SPAN(span, GL_BITMAP);
-         span.end = width;
-         span.arrayMask = SPAN_RGBA;
-         span.x = xpos;
-         span.y = ypos + i;
-
-         if (directAccess) {
-            acc = (GLshort *) accumRb->GetPointer(ctx, accumRb, xpos, ypos +i);
-         }
-         else {
-            accumRb->GetRow(ctx, accumRb, width, xpos, ypos + i, accumRow);
-            acc = accumRow;
-         }
-
-         /* get the colors to return */
-         if (swrast->_IntegerAccumMode) {
-            GLint j;
-            for (j = 0; j < width; j++) {
-               ASSERT(acc[j * 4 + 0] < max);
-               ASSERT(acc[j * 4 + 1] < max);
-               ASSERT(acc[j * 4 + 2] < max);
-               ASSERT(acc[j * 4 + 3] < max);
-               span.array->rgba[j][RCOMP] = multTable[acc[j * 4 + 0]];
-               span.array->rgba[j][GCOMP] = multTable[acc[j * 4 + 1]];
-               span.array->rgba[j][BCOMP] = multTable[acc[j * 4 + 2]];
-               span.array->rgba[j][ACOMP] = multTable[acc[j * 4 + 3]];
-            }
-         }
-         else {
-            /* scaled integer (or float) accum buffer */
-            GLint j;
-            for (j = 0; j < width; j++) {
-#if CHAN_BITS==32
-               GLchan r = acc[j * 4 + 0] * scale;
-               GLchan g = acc[j * 4 + 1] * scale;
-               GLchan b = acc[j * 4 + 2] * scale;
-               GLchan a = acc[j * 4 + 3] * scale;
-#else
-               GLint r = IROUND( (GLfloat) (acc[j * 4 + 0]) * scale );
-               GLint g = IROUND( (GLfloat) (acc[j * 4 + 1]) * scale );
-               GLint b = IROUND( (GLfloat) (acc[j * 4 + 2]) * scale );
-               GLint a = IROUND( (GLfloat) (acc[j * 4 + 3]) * scale );
-#endif
-               span.array->rgba[j][RCOMP] = CLAMP( r, 0, CHAN_MAX );
-               span.array->rgba[j][GCOMP] = CLAMP( g, 0, CHAN_MAX );
-               span.array->rgba[j][BCOMP] = CLAMP( b, 0, CHAN_MAX );
-               span.array->rgba[j][ACOMP] = CLAMP( a, 0, CHAN_MAX );
-            }
-         }
-
-         /* store colors */
-         for (buffer = 0; buffer < fb->_NumColorDrawBuffers; buffer++) {
-            struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buffer];
-            const GLboolean masking = (!ctx->Color.ColorMask[buffer][RCOMP] ||
-                                       !ctx->Color.ColorMask[buffer][GCOMP] ||
-                                       !ctx->Color.ColorMask[buffer][BCOMP] ||
-                                       !ctx->Color.ColorMask[buffer][ACOMP]);
-            if (masking) {
-               _swrast_mask_rgba_span(ctx, rb, &span, buffer);
-            }
-            rb->PutRow(ctx, rb, width, xpos, ypos + i, span.array->rgba, NULL);
-         }
-      }
-   }
-   else {
-      /* other types someday */
-   }
-}
-
-
-
-/**
- * Software fallback for glAccum.
- */
-void
-_swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLint xpos, ypos, width, height;
-
-   if (swrast->NewState)
-      _swrast_validate_derived( ctx );
-
-   if (!ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer) {
-      _mesa_warning(ctx, "Calling glAccum() without an accumulation buffer");
-      return;
-   }
-
-   swrast_render_start(ctx);
-
-   /* Compute region after calling swrast_render_start() so that we know the
-    * drawbuffer's size/bounds are up to date.
-    */
-   xpos = ctx->DrawBuffer->_Xmin;
-   ypos = ctx->DrawBuffer->_Ymin;
-   width =  ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
-   height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
-
-   switch (op) {
-      case GL_ADD:
-         if (value != 0.0F) {
-            accum_add(ctx, value, xpos, ypos, width, height);
-	 }
-	 break;
-      case GL_MULT:
-         if (value != 1.0F) {
-            accum_mult(ctx, value, xpos, ypos, width, height);
-	 }
-	 break;
-      case GL_ACCUM:
-         if (value != 0.0F) {
-            accum_accum(ctx, value, xpos, ypos, width, height);
-         }
-	 break;
-      case GL_LOAD:
-         accum_load(ctx, value, xpos, ypos, width, height);
-	 break;
-      case GL_RETURN:
-         accum_return(ctx, value, xpos, ypos, width, height);
-	 break;
-      default:
-         _mesa_problem(ctx, "invalid mode in _swrast_Accum()");
-         break;
-   }
-
-   swrast_render_finish(ctx);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5.2
+ *
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "main/glheader.h"
+#include "main/condrender.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+
+#include "s_accum.h"
+#include "s_context.h"
+#include "s_masking.h"
+#include "s_span.h"
+
+
+/* XXX this would have to change for accum buffers with more or less
+ * than 16 bits per color channel.
+ */
+#define ACCUM_SCALE16 32767.0F
+
+
+/*
+ * Accumulation buffer notes
+ *
+ * Normally, accumulation buffer values are GLshorts with values in
+ * [-32767, 32767] which represent floating point colors in [-1, 1],
+ * as defined by the OpenGL specification.
+ *
+ * We optimize for the common case used for full-scene antialiasing:
+ *    // start with accum buffer cleared to zero
+ *    glAccum(GL_LOAD, w);   // or GL_ACCUM the first image
+ *    glAccum(GL_ACCUM, w);
+ *    ...
+ *    glAccum(GL_ACCUM, w);
+ *    glAccum(GL_RETURN, 1.0);
+ * That is, we start with an empty accumulation buffer and accumulate
+ * n images, each with weight w = 1/n.
+ * In this scenario, we can simply store unscaled integer values in
+ * the accum buffer instead of scaled integers.  We'll also keep track
+ * of the w value so when we do GL_RETURN we simply divide the accumulated
+ * values by n (n=1/w).
+ * This lets us avoid _many_ int->float->int conversions.
+ */
+
+
+#if CHAN_BITS == 8
+/* enable the optimization */
+#define USE_OPTIMIZED_ACCUM  1
+#else
+#define USE_OPTIMIZED_ACCUM  0
+#endif
+
+
+/**
+ * This is called when we fall out of optimized/unscaled accum buffer mode.
+ * That is, we convert each unscaled accum buffer value into a scaled value
+ * representing the range[-1, 1].
+ */
+static void
+rescale_accum( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   struct gl_renderbuffer *rb
+      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
+   const GLfloat s = swrast->_IntegerAccumScaler * (32767.0F / CHAN_MAXF);
+
+   assert(rb);
+   assert(rb->_BaseFormat == GL_RGBA);
+   /* add other types in future? */
+   assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT);
+   assert(swrast->_IntegerAccumMode);
+
+   if (rb->GetPointer(ctx, rb, 0, 0)) {
+      /* directly-addressable memory */
+      GLuint y;
+      for (y = 0; y < rb->Height; y++) {
+         GLuint i;
+         GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, 0, y);
+         for (i = 0; i < 4 * rb->Width; i++) {
+            acc[i] = (GLshort) (acc[i] * s);
+         }
+      }
+   }
+   else {
+      /* use get/put row funcs */
+      GLuint y;
+      for (y = 0; y < rb->Height; y++) {
+         GLshort accRow[MAX_WIDTH * 4];
+         GLuint i;
+         rb->GetRow(ctx, rb, rb->Width, 0, y, accRow);
+         for (i = 0; i < 4 * rb->Width; i++) {
+            accRow[i] = (GLshort) (accRow[i] * s);
+         }
+         rb->PutRow(ctx, rb, rb->Width, 0, y, accRow, NULL);
+      }
+   }
+
+   swrast->_IntegerAccumMode = GL_FALSE;
+}
+
+
+
+/**
+ * Clear the accumulation Buffer.
+ */
+void
+_swrast_clear_accum_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLuint x, y, width, height;
+
+   /* No accumulation buffer! Not an error. */
+   if (!rb || !rb->Data)
+      return;
+
+   assert(rb->_BaseFormat == GL_RGBA);
+   /* add other types in future? */
+   assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT);
+
+   /* bounds, with scissor */
+   x = ctx->DrawBuffer->_Xmin;
+   y = ctx->DrawBuffer->_Ymin;
+   width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+   height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+
+   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLfloat accScale = 32767.0;
+      GLshort clearVal[4];
+      GLuint i;
+
+      clearVal[0] = (GLshort) (ctx->Accum.ClearColor[0] * accScale);
+      clearVal[1] = (GLshort) (ctx->Accum.ClearColor[1] * accScale);
+      clearVal[2] = (GLshort) (ctx->Accum.ClearColor[2] * accScale);
+      clearVal[3] = (GLshort) (ctx->Accum.ClearColor[3] * accScale);
+
+      for (i = 0; i < height; i++) {
+         rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
+      }
+   }
+   else {
+      /* someday support other sizes */
+   }
+
+   /* update optimized accum state vars */
+   if (ctx->Accum.ClearColor[0] == 0.0 && ctx->Accum.ClearColor[1] == 0.0 &&
+       ctx->Accum.ClearColor[2] == 0.0 && ctx->Accum.ClearColor[3] == 0.0) {
+#if USE_OPTIMIZED_ACCUM
+      swrast->_IntegerAccumMode = GL_TRUE;
+#else
+      swrast->_IntegerAccumMode = GL_FALSE;
+#endif
+      swrast->_IntegerAccumScaler = 0.0;  /* denotes empty accum buffer */
+   }
+   else {
+      swrast->_IntegerAccumMode = GL_FALSE;
+   }
+}
+
+
+static void
+accum_add(struct gl_context *ctx, GLfloat value,
+          GLint xpos, GLint ypos, GLint width, GLint height )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   struct gl_renderbuffer *rb
+      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
+
+   assert(rb);
+
+   /* Leave optimized accum buffer mode */
+   if (swrast->_IntegerAccumMode)
+      rescale_accum(ctx);
+
+   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLshort incr = (GLshort) (value * ACCUM_SCALE16);
+      if (rb->GetPointer(ctx, rb, 0, 0)) {
+         GLint i, j;
+         for (i = 0; i < height; i++) {
+            GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
+            for (j = 0; j < 4 * width; j++) {
+               acc[j] += incr;
+            }
+         }
+      }
+      else {
+         GLint i, j;
+         for (i = 0; i < height; i++) {
+            GLshort accRow[4 * MAX_WIDTH];
+            rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow);
+            for (j = 0; j < 4 * width; j++) {
+               accRow[j] += incr;
+            }
+            rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL);
+         }
+      }
+   }
+   else {
+      /* other types someday */
+   }
+}
+
+
+static void
+accum_mult(struct gl_context *ctx, GLfloat mult,
+           GLint xpos, GLint ypos, GLint width, GLint height )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   struct gl_renderbuffer *rb
+      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
+
+   assert(rb);
+
+   /* Leave optimized accum buffer mode */
+   if (swrast->_IntegerAccumMode)
+      rescale_accum(ctx);
+
+   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
+      if (rb->GetPointer(ctx, rb, 0, 0)) {
+         GLint i, j;
+         for (i = 0; i < height; i++) {
+            GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
+            for (j = 0; j < 4 * width; j++) {
+               acc[j] = (GLshort) (acc[j] * mult);
+            }
+         }
+      }
+      else {
+         GLint i, j;
+         for (i = 0; i < height; i++) {
+            GLshort accRow[4 * MAX_WIDTH];
+            rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow);
+            for (j = 0; j < 4 * width; j++) {
+               accRow[j] = (GLshort) (accRow[j] * mult);
+            }
+            rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL);
+         }
+      }
+   }
+   else {
+      /* other types someday */
+   }
+}
+
+
+
+static void
+accum_accum(struct gl_context *ctx, GLfloat value,
+            GLint xpos, GLint ypos, GLint width, GLint height )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   struct gl_renderbuffer *rb
+      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
+   const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL);
+
+   assert(rb);
+
+   if (!ctx->ReadBuffer->_ColorReadBuffer) {
+      /* no read buffer - OK */
+      return;
+   }
+
+   /* May have to leave optimized accum buffer mode */
+   if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0)
+      swrast->_IntegerAccumScaler = value;
+   if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler)
+      rescale_accum(ctx);
+
+   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF;
+      GLshort accumRow[4 * MAX_WIDTH];
+      GLchan rgba[MAX_WIDTH][4];
+      GLint i;
+
+      for (i = 0; i < height; i++) {
+         GLshort *acc;
+         if (directAccess) {
+            acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
+         }
+         else {
+            rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow);
+            acc = accumRow;
+         }
+
+         /* read colors from color buffer */
+         _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width,
+                                xpos, ypos + i, CHAN_TYPE, rgba);
+
+         /* do accumulation */
+         if (swrast->_IntegerAccumMode) {
+            /* simply add integer color values into accum buffer */
+            GLint j;
+            for (j = 0; j < width; j++) {
+               acc[j * 4 + 0] += rgba[j][RCOMP];
+               acc[j * 4 + 1] += rgba[j][GCOMP];
+               acc[j * 4 + 2] += rgba[j][BCOMP];
+               acc[j * 4 + 3] += rgba[j][ACOMP];
+            }
+         }
+         else {
+            /* scaled integer (or float) accum buffer */
+            GLint j;
+            for (j = 0; j < width; j++) {
+               acc[j * 4 + 0] += (GLshort) ((GLfloat) rgba[j][RCOMP] * scale);
+               acc[j * 4 + 1] += (GLshort) ((GLfloat) rgba[j][GCOMP] * scale);
+               acc[j * 4 + 2] += (GLshort) ((GLfloat) rgba[j][BCOMP] * scale);
+               acc[j * 4 + 3] += (GLshort) ((GLfloat) rgba[j][ACOMP] * scale);
+            }
+         }
+
+         if (!directAccess) {
+            rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL);
+         }
+      }
+   }
+   else {
+      /* other types someday */
+   }
+}
+
+
+
+static void
+accum_load(struct gl_context *ctx, GLfloat value,
+           GLint xpos, GLint ypos, GLint width, GLint height )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   struct gl_renderbuffer *rb
+      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
+   const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL);
+
+   assert(rb);
+
+   if (!ctx->ReadBuffer->_ColorReadBuffer) {
+      /* no read buffer - OK */
+      return;
+   }
+
+   /* This is a change to go into optimized accum buffer mode */
+   if (value > 0.0 && value <= 1.0) {
+#if USE_OPTIMIZED_ACCUM
+      swrast->_IntegerAccumMode = GL_TRUE;
+#else
+      swrast->_IntegerAccumMode = GL_FALSE;
+#endif
+      swrast->_IntegerAccumScaler = value;
+   }
+   else {
+      swrast->_IntegerAccumMode = GL_FALSE;
+      swrast->_IntegerAccumScaler = 0.0;
+   }
+
+   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF;
+      GLshort accumRow[4 * MAX_WIDTH];
+      GLchan rgba[MAX_WIDTH][4];
+      GLint i;
+
+      for (i = 0; i < height; i++) {
+         GLshort *acc;
+         if (directAccess) {
+            acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
+         }
+         else {
+            rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow);
+            acc = accumRow;
+         }
+
+         /* read colors from color buffer */
+         _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width,
+                                xpos, ypos + i, CHAN_TYPE, rgba);
+
+         /* do load */
+         if (swrast->_IntegerAccumMode) {
+            /* just copy values in */
+            GLint j;
+            assert(swrast->_IntegerAccumScaler > 0.0);
+            assert(swrast->_IntegerAccumScaler <= 1.0);
+            for (j = 0; j < width; j++) {
+               acc[j * 4 + 0] = rgba[j][RCOMP];
+               acc[j * 4 + 1] = rgba[j][GCOMP];
+               acc[j * 4 + 2] = rgba[j][BCOMP];
+               acc[j * 4 + 3] = rgba[j][ACOMP];
+            }
+         }
+         else {
+            /* scaled integer (or float) accum buffer */
+            GLint j;
+            for (j = 0; j < width; j++) {
+               acc[j * 4 + 0] = (GLshort) ((GLfloat) rgba[j][RCOMP] * scale);
+               acc[j * 4 + 1] = (GLshort) ((GLfloat) rgba[j][GCOMP] * scale);
+               acc[j * 4 + 2] = (GLshort) ((GLfloat) rgba[j][BCOMP] * scale);
+               acc[j * 4 + 3] = (GLshort) ((GLfloat) rgba[j][ACOMP] * scale);
+            }
+         }
+
+         if (!directAccess) {
+            rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL);
+         }
+      }
+   }
+}
+
+
+static void
+accum_return(struct gl_context *ctx, GLfloat value,
+             GLint xpos, GLint ypos, GLint width, GLint height )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   struct gl_framebuffer *fb = ctx->DrawBuffer;
+   struct gl_renderbuffer *accumRb = fb->Attachment[BUFFER_ACCUM].Renderbuffer;
+   const GLboolean directAccess
+      = (accumRb->GetPointer(ctx, accumRb, 0, 0) != NULL);
+
+   static GLchan multTable[32768];
+   static GLfloat prevMult = 0.0;
+   const GLfloat mult = swrast->_IntegerAccumScaler;
+   const GLint max = MIN2((GLint) (256 / mult), 32767);
+
+   /* May have to leave optimized accum buffer mode */
+   if (swrast->_IntegerAccumMode && value != 1.0)
+      rescale_accum(ctx);
+
+   if (swrast->_IntegerAccumMode && swrast->_IntegerAccumScaler > 0) {
+      /* build lookup table to avoid many floating point multiplies */
+      GLint j;
+      assert(swrast->_IntegerAccumScaler <= 1.0);
+      if (mult != prevMult) {
+         for (j = 0; j < max; j++)
+            multTable[j] = IROUND((GLfloat) j * mult);
+         prevMult = mult;
+      }
+   }
+
+   if (accumRb->DataType == GL_SHORT ||
+       accumRb->DataType == GL_UNSIGNED_SHORT) {
+      const GLfloat scale = value * CHAN_MAXF / ACCUM_SCALE16;
+      GLuint buffer;
+      GLint i;
+
+      /* XXX maybe transpose the 'i' and 'buffer' loops??? */
+      for (i = 0; i < height; i++) {
+         GLshort accumRow[4 * MAX_WIDTH];
+         GLshort *acc;
+         SWspan span;
+
+         /* init color span */
+         INIT_SPAN(span, GL_BITMAP);
+         span.end = width;
+         span.arrayMask = SPAN_RGBA;
+         span.x = xpos;
+         span.y = ypos + i;
+
+         if (directAccess) {
+            acc = (GLshort *) accumRb->GetPointer(ctx, accumRb, xpos, ypos +i);
+         }
+         else {
+            accumRb->GetRow(ctx, accumRb, width, xpos, ypos + i, accumRow);
+            acc = accumRow;
+         }
+
+         /* get the colors to return */
+         if (swrast->_IntegerAccumMode) {
+            GLint j;
+            for (j = 0; j < width; j++) {
+               ASSERT(acc[j * 4 + 0] < max);
+               ASSERT(acc[j * 4 + 1] < max);
+               ASSERT(acc[j * 4 + 2] < max);
+               ASSERT(acc[j * 4 + 3] < max);
+               span.array->rgba[j][RCOMP] = multTable[acc[j * 4 + 0]];
+               span.array->rgba[j][GCOMP] = multTable[acc[j * 4 + 1]];
+               span.array->rgba[j][BCOMP] = multTable[acc[j * 4 + 2]];
+               span.array->rgba[j][ACOMP] = multTable[acc[j * 4 + 3]];
+            }
+         }
+         else {
+            /* scaled integer (or float) accum buffer */
+            GLint j;
+            for (j = 0; j < width; j++) {
+#if CHAN_BITS==32
+               GLchan r = acc[j * 4 + 0] * scale;
+               GLchan g = acc[j * 4 + 1] * scale;
+               GLchan b = acc[j * 4 + 2] * scale;
+               GLchan a = acc[j * 4 + 3] * scale;
+#else
+               GLint r = IROUND( (GLfloat) (acc[j * 4 + 0]) * scale );
+               GLint g = IROUND( (GLfloat) (acc[j * 4 + 1]) * scale );
+               GLint b = IROUND( (GLfloat) (acc[j * 4 + 2]) * scale );
+               GLint a = IROUND( (GLfloat) (acc[j * 4 + 3]) * scale );
+#endif
+               span.array->rgba[j][RCOMP] = CLAMP( r, 0, CHAN_MAX );
+               span.array->rgba[j][GCOMP] = CLAMP( g, 0, CHAN_MAX );
+               span.array->rgba[j][BCOMP] = CLAMP( b, 0, CHAN_MAX );
+               span.array->rgba[j][ACOMP] = CLAMP( a, 0, CHAN_MAX );
+            }
+         }
+
+         /* store colors */
+         for (buffer = 0; buffer < fb->_NumColorDrawBuffers; buffer++) {
+            struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buffer];
+            const GLboolean masking = (!ctx->Color.ColorMask[buffer][RCOMP] ||
+                                       !ctx->Color.ColorMask[buffer][GCOMP] ||
+                                       !ctx->Color.ColorMask[buffer][BCOMP] ||
+                                       !ctx->Color.ColorMask[buffer][ACOMP]);
+            if (masking) {
+               _swrast_mask_rgba_span(ctx, rb, &span, buffer);
+            }
+            rb->PutRow(ctx, rb, width, xpos, ypos + i, span.array->rgba, NULL);
+         }
+      }
+   }
+   else {
+      /* other types someday */
+   }
+}
+
+
+
+/**
+ * Software fallback for glAccum.
+ */
+void
+_swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLint xpos, ypos, width, height;
+
+   if (swrast->NewState)
+      _swrast_validate_derived( ctx );
+
+   if (!ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer) {
+      _mesa_warning(ctx, "Calling glAccum() without an accumulation buffer");
+      return;
+   }
+
+   if (!_mesa_check_conditional_render(ctx))
+      return;
+
+   swrast_render_start(ctx);
+
+   /* Compute region after calling swrast_render_start() so that we know the
+    * drawbuffer's size/bounds are up to date.
+    */
+   xpos = ctx->DrawBuffer->_Xmin;
+   ypos = ctx->DrawBuffer->_Ymin;
+   width =  ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+   height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+
+   switch (op) {
+      case GL_ADD:
+         if (value != 0.0F) {
+            accum_add(ctx, value, xpos, ypos, width, height);
+	 }
+	 break;
+      case GL_MULT:
+         if (value != 1.0F) {
+            accum_mult(ctx, value, xpos, ypos, width, height);
+	 }
+	 break;
+      case GL_ACCUM:
+         if (value != 0.0F) {
+            accum_accum(ctx, value, xpos, ypos, width, height);
+         }
+	 break;
+      case GL_LOAD:
+         accum_load(ctx, value, xpos, ypos, width, height);
+	 break;
+      case GL_RETURN:
+         accum_return(ctx, value, xpos, ypos, width, height);
+	 break;
+      default:
+         _mesa_problem(ctx, "invalid mode in _swrast_Accum()");
+         break;
+   }
+
+   swrast_render_finish(ctx);
+}
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index b0c9880b1..def1531d7 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -1,957 +1,949 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *    Keith Whitwell <keith@tungstengraphics.com>
- *    Brian Paul
- */
-
-#include "main/imports.h"
-#include "main/bufferobj.h"
-#include "main/colormac.h"
-#include "main/mtypes.h"
-#include "main/teximage.h"
-#include "program/prog_parameter.h"
-#include "program/prog_statevars.h"
-#include "swrast.h"
-#include "s_blend.h"
-#include "s_context.h"
-#include "s_lines.h"
-#include "s_points.h"
-#include "s_span.h"
-#include "s_triangle.h"
-#include "s_texfilter.h"
-
-
-/**
- * Recompute the value of swrast->_RasterMask, etc. according to
- * the current context.  The _RasterMask field can be easily tested by
- * drivers to determine certain basic GL state (does the primitive need
- * stenciling, logic-op, fog, etc?).
- */
-static void
-_swrast_update_rasterflags( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLbitfield rasterMask = 0;
-   GLuint i;
-
-   if (ctx->Color.AlphaEnabled)           rasterMask |= ALPHATEST_BIT;
-   if (ctx->Color.BlendEnabled)           rasterMask |= BLEND_BIT;
-   if (ctx->Depth.Test)                   rasterMask |= DEPTH_BIT;
-   if (swrast->_FogEnabled)               rasterMask |= FOG_BIT;
-   if (ctx->Scissor.Enabled)              rasterMask |= CLIP_BIT;
-   if (ctx->Stencil._Enabled)             rasterMask |= STENCIL_BIT;
-   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-      if (!ctx->Color.ColorMask[i][0] ||
-          !ctx->Color.ColorMask[i][1] ||
-          !ctx->Color.ColorMask[i][2] ||
-          !ctx->Color.ColorMask[i][3]) {
-         rasterMask |= MASKING_BIT;
-         break;
-      }
-   }
-   if (ctx->Color._LogicOpEnabled)     rasterMask |= LOGIC_OP_BIT;
-   if (ctx->Texture._EnabledUnits)     rasterMask |= TEXTURE_BIT;
-   if (   ctx->Viewport.X < 0
-       || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
-       || ctx->Viewport.Y < 0
-       || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) {
-      rasterMask |= CLIP_BIT;
-   }
-
-   if (ctx->Query.CurrentOcclusionObject)
-      rasterMask |= OCCLUSION_BIT;
-
-
-   /* If we're not drawing to exactly one color buffer set the
-    * MULTI_DRAW_BIT flag.  Also set it if we're drawing to no
-    * buffers or the RGBA or CI mask disables all writes.
-    */
-   if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
-      /* more than one color buffer designated for writing (or zero buffers) */
-      rasterMask |= MULTI_DRAW_BIT;
-   }
-
-   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-      if (ctx->Color.ColorMask[i][0] +
-          ctx->Color.ColorMask[i][1] +
-          ctx->Color.ColorMask[i][2] +
-          ctx->Color.ColorMask[i][3] == 0) {
-         rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
-         break;
-      }
-   }
-
-
-   if (ctx->FragmentProgram._Current) {
-      rasterMask |= FRAGPROG_BIT;
-   }
-
-   if (ctx->ATIFragmentShader._Enabled) {
-      rasterMask |= ATIFRAGSHADER_BIT;
-   }
-
-#if CHAN_TYPE == GL_FLOAT
-   if (ctx->Color.ClampFragmentColor == GL_TRUE) {
-      rasterMask |= CLAMPING_BIT;
-   }
-#endif
-
-   SWRAST_CONTEXT(ctx)->_RasterMask = rasterMask;
-}
-
-
-/**
- * Examine polygon cull state to compute the _BackfaceCullSign field.
- * _BackfaceCullSign will be 0 if no culling, -1 if culling back-faces,
- * and 1 if culling front-faces.  The Polygon FrontFace state also
- * factors in.
- */
-static void
-_swrast_update_polygon( struct gl_context *ctx )
-{
-   GLfloat backface_sign;
-
-   if (ctx->Polygon.CullFlag) {
-      switch (ctx->Polygon.CullFaceMode) {
-      case GL_BACK:
-         backface_sign = -1.0F;
-	 break;
-      case GL_FRONT:
-         backface_sign = 1.0F;
-	 break;
-      case GL_FRONT_AND_BACK:
-         /* fallthrough */
-      default:
-	 backface_sign = 0.0F;
-      }
-   }
-   else {
-      backface_sign = 0.0F;
-   }
-
-   SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
-
-   /* This is for front/back-face determination, but not for culling */
-   SWRAST_CONTEXT(ctx)->_BackfaceSign
-      = (ctx->Polygon.FrontFace == GL_CW) ? -1.0F : 1.0F;
-}
-
-
-
-/**
- * Update the _PreferPixelFog field to indicate if we need to compute
- * fog blend factors (from the fog coords) per-fragment.
- */
-static void
-_swrast_update_fog_hint( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   swrast->_PreferPixelFog = (!swrast->AllowVertexFog ||
-                              ctx->FragmentProgram._Current ||
-			      (ctx->Hint.Fog == GL_NICEST &&
-			       swrast->AllowPixelFog));
-}
-
-
-
-/**
- * Update the swrast->_TextureCombinePrimary flag.
- */
-static void
-_swrast_update_texture_env( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLuint i;
-
-   swrast->_TextureCombinePrimary = GL_FALSE;
-
-   for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-      const struct gl_tex_env_combine_state *combine =
-         ctx->Texture.Unit[i]._CurrentCombine;
-      GLuint term;
-      for (term = 0; term < combine->_NumArgsRGB; term++) {
-         if (combine->SourceRGB[term] == GL_PRIMARY_COLOR) {
-            swrast->_TextureCombinePrimary = GL_TRUE;
-            return;
-         }
-         if (combine->SourceA[term] == GL_PRIMARY_COLOR) {
-            swrast->_TextureCombinePrimary = GL_TRUE;
-            return;
-         }
-      }
-   }
-}
-
-
-/**
- * Determine if we can defer texturing/shading until after Z/stencil
- * testing.  This potentially allows us to skip texturing/shading for
- * lots of fragments.
- */
-static void
-_swrast_update_deferred_texture(struct gl_context *ctx)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   if (ctx->Color.AlphaEnabled) {
-      /* alpha test depends on post-texture/shader colors */
-      swrast->_DeferredTexture = GL_FALSE;
-   }
-   else {
-      const struct gl_fragment_program *fprog
-         = ctx->FragmentProgram._Current;
-      if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) {
-         /* Z comes from fragment program/shader */
-         swrast->_DeferredTexture = GL_FALSE;
-      }
-      else if (fprog && fprog->UsesKill) {
-         swrast->_DeferredTexture = GL_FALSE;
-      }
-      else if (ctx->Query.CurrentOcclusionObject) {
-         /* occlusion query depends on shader discard/kill results */
-         swrast->_DeferredTexture = GL_FALSE;
-      }
-      else {
-         swrast->_DeferredTexture = GL_TRUE;
-      }
-   }
-}
-
-
-/**
- * Update swrast->_FogColor and swrast->_FogEnable values.
- */
-static void
-_swrast_update_fog_state( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
-
-   /* determine if fog is needed, and if so, which fog mode */
-   swrast->_FogEnabled = GL_FALSE;
-   if (fp && fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
-      if (fp->FogOption != GL_NONE) {
-         swrast->_FogEnabled = GL_TRUE;
-         swrast->_FogMode = fp->FogOption;
-      }
-   }
-   else if (ctx->Fog.Enabled) {
-      swrast->_FogEnabled = GL_TRUE;
-      swrast->_FogMode = ctx->Fog.Mode;
-   }
-}
-
-
-/**
- * Update state for running fragment programs.  Basically, load the
- * program parameters with current state values.
- */
-static void
-_swrast_update_fragment_program(struct gl_context *ctx, GLbitfield newState)
-{
-   const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
-   if (fp) {
-      _mesa_load_state_parameters(ctx, fp->Base.Parameters);
-   }
-}
-
-
-/**
- * See if we can do early diffuse+specular (primary+secondary) color
- * add per vertex instead of per-fragment.
- */
-static void
-_swrast_update_specular_vertex_add(struct gl_context *ctx)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLboolean separateSpecular = ctx->Fog.ColorSumEnabled ||
-      (ctx->Light.Enabled &&
-       ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
-
-   swrast->SpecularVertexAdd = (separateSpecular
-                                && ctx->Texture._EnabledUnits == 0x0
-                                && !ctx->FragmentProgram._Current
-                                && !ctx->ATIFragmentShader._Enabled);
-}
-
-
-#define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK |	\
-                             _NEW_PROGRAM_CONSTANTS |   \
-			     _NEW_TEXTURE |		\
-			     _NEW_HINT |		\
-			     _NEW_POLYGON )
-
-/* State referenced by _swrast_choose_triangle, _swrast_choose_line.
- */
-#define _SWRAST_NEW_TRIANGLE (_SWRAST_NEW_DERIVED |		\
-			      _NEW_RENDERMODE|			\
-                              _NEW_POLYGON|			\
-                              _NEW_DEPTH|			\
-                              _NEW_STENCIL|			\
-                              _NEW_COLOR|			\
-                              _NEW_TEXTURE|			\
-                              _SWRAST_NEW_RASTERMASK|		\
-                              _NEW_LIGHT|			\
-                              _NEW_FOG |			\
-			      _DD_NEW_SEPARATE_SPECULAR)
-
-#define _SWRAST_NEW_LINE (_SWRAST_NEW_DERIVED |		\
-			  _NEW_RENDERMODE|		\
-                          _NEW_LINE|			\
-                          _NEW_TEXTURE|			\
-                          _NEW_LIGHT|			\
-                          _NEW_FOG|			\
-                          _NEW_DEPTH |			\
-                          _DD_NEW_SEPARATE_SPECULAR)
-
-#define _SWRAST_NEW_POINT (_SWRAST_NEW_DERIVED |	\
-			   _NEW_RENDERMODE |		\
-			   _NEW_POINT |			\
-			   _NEW_TEXTURE |		\
-			   _NEW_LIGHT |			\
-			   _NEW_FOG |			\
-                           _DD_NEW_SEPARATE_SPECULAR)
-
-#define _SWRAST_NEW_TEXTURE_SAMPLE_FUNC _NEW_TEXTURE
-
-#define _SWRAST_NEW_TEXTURE_ENV_MODE _NEW_TEXTURE
-
-#define _SWRAST_NEW_BLEND_FUNC _NEW_COLOR
-
-
-
-/**
- * Stub for swrast->Triangle to select a true triangle function
- * after a state change.
- */
-static void
-_swrast_validate_triangle( struct gl_context *ctx,
-			   const SWvertex *v0,
-                           const SWvertex *v1,
-                           const SWvertex *v2 )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
-   _swrast_validate_derived( ctx );
-   swrast->choose_triangle( ctx );
-   ASSERT(swrast->Triangle);
-
-   if (swrast->SpecularVertexAdd) {
-      /* separate specular color, but no texture */
-      swrast->SpecTriangle = swrast->Triangle;
-      swrast->Triangle = _swrast_add_spec_terms_triangle;
-   }
-
-   swrast->Triangle( ctx, v0, v1, v2 );
-}
-
-/**
- * Called via swrast->Line.  Examine current GL state and choose a software
- * line routine.  Then call it.
- */
-static void
-_swrast_validate_line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
-   _swrast_validate_derived( ctx );
-   swrast->choose_line( ctx );
-   ASSERT(swrast->Line);
-
-   if (swrast->SpecularVertexAdd) {
-      swrast->SpecLine = swrast->Line;
-      swrast->Line = _swrast_add_spec_terms_line;
-   }
-
-   swrast->Line( ctx, v0, v1 );
-}
-
-/**
- * Called via swrast->Point.  Examine current GL state and choose a software
- * point routine.  Then call it.
- */
-static void
-_swrast_validate_point( struct gl_context *ctx, const SWvertex *v0 )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
-   _swrast_validate_derived( ctx );
-   swrast->choose_point( ctx );
-
-   if (swrast->SpecularVertexAdd) {
-      swrast->SpecPoint = swrast->Point;
-      swrast->Point = _swrast_add_spec_terms_point;
-   }
-
-   swrast->Point( ctx, v0 );
-}
-
-
-/**
- * Called via swrast->BlendFunc.  Examine GL state to choose a blending
- * function, then call it.
- */
-static void _ASMAPI
-_swrast_validate_blend_func(struct gl_context *ctx, GLuint n, const GLubyte mask[],
-                            GLvoid *src, const GLvoid *dst,
-                            GLenum chanType )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
-   _swrast_validate_derived( ctx ); /* why is this needed? */
-   _swrast_choose_blend_func( ctx, chanType );
-
-   swrast->BlendFunc( ctx, n, mask, src, dst, chanType );
-}
-
-
-/**
- * Make sure we have texture image data for all the textures we may need
- * for subsequent rendering.
- */
-static void
-_swrast_validate_texture_images(struct gl_context *ctx)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLuint u;
-
-   if (!swrast->ValidateTextureImage || !ctx->Texture._EnabledUnits) {
-      /* no textures enabled, or no way to validate images! */
-      return;
-   }
-
-   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
-      if (ctx->Texture.Unit[u]._ReallyEnabled) {
-         struct gl_texture_object *texObj = ctx->Texture.Unit[u]._Current;
-         ASSERT(texObj);
-         if (texObj) {
-            GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
-            GLuint face;
-            for (face = 0; face < numFaces; face++) {
-               GLint lvl;
-               for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
-                  struct gl_texture_image *texImg = texObj->Image[face][lvl];
-                  if (texImg && !texImg->Data) {
-                     swrast->ValidateTextureImage(ctx, texObj, face, lvl);
-                     ASSERT(texObj->Image[face][lvl]->Data);
-                  }
-               }
-            }
-         }
-      }
-   }
-}
-
-
-/**
- * Free the texture image data attached to all currently enabled
- * textures.  Meant to be called by device drivers when transitioning
- * from software to hardware rendering.
- */
-void
-_swrast_eject_texture_images(struct gl_context *ctx)
-{
-   GLuint u;
-
-   if (!ctx->Texture._EnabledUnits) {
-      /* no textures enabled */
-      return;
-   }
-
-   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
-      if (ctx->Texture.Unit[u]._ReallyEnabled) {
-         struct gl_texture_object *texObj = ctx->Texture.Unit[u]._Current;
-         ASSERT(texObj);
-         if (texObj) {
-            GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
-            GLuint face;
-            for (face = 0; face < numFaces; face++) {
-               GLint lvl;
-               for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
-                  struct gl_texture_image *texImg = texObj->Image[face][lvl];
-                  if (texImg && texImg->Data) {
-                     _mesa_free_texmemory(texImg->Data);
-                     texImg->Data = NULL;
-                  }
-               }
-            }
-         }
-      }
-   }
-}
-
-
-
-static void
-_swrast_sleep( struct gl_context *ctx, GLbitfield new_state )
-{
-   (void) ctx; (void) new_state;
-}
-
-
-static void
-_swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLuint i;
-
-   swrast->NewState |= new_state;
-
-   /* After 10 statechanges without any swrast functions being called,
-    * put the module to sleep.
-    */
-   if (++swrast->StateChanges > 10) {
-      swrast->InvalidateState = _swrast_sleep;
-      swrast->NewState = ~0;
-      new_state = ~0;
-   }
-
-   if (new_state & swrast->InvalidateTriangleMask)
-      swrast->Triangle = _swrast_validate_triangle;
-
-   if (new_state & swrast->InvalidateLineMask)
-      swrast->Line = _swrast_validate_line;
-
-   if (new_state & swrast->InvalidatePointMask)
-      swrast->Point = _swrast_validate_point;
-
-   if (new_state & _SWRAST_NEW_BLEND_FUNC)
-      swrast->BlendFunc = _swrast_validate_blend_func;
-
-   if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
-      for (i = 0 ; i < ctx->Const.MaxTextureImageUnits ; i++)
-	 swrast->TextureSample[i] = NULL;
-}
-
-
-void
-_swrast_update_texture_samplers(struct gl_context *ctx)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLuint u;
-
-   if (!swrast)
-      return; /* pipe hack */
-
-   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
-      const struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
-      /* Note: If tObj is NULL, the sample function will be a simple
-       * function that just returns opaque black (0,0,0,1).
-       */
-      swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
-   }
-}
-
-
-/**
- * Update swrast->_ActiveAttribs, swrast->_NumActiveAttribs,
- * swrast->_ActiveAtttribMask.
- */
-static void
-_swrast_update_active_attribs(struct gl_context *ctx)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLuint attribsMask;
-
-   /*
-    * Compute _ActiveAttribsMask = which fragment attributes are needed.
-    */
-   if (ctx->FragmentProgram._Current) {
-      /* fragment program/shader */
-      attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
-      attribsMask &= ~FRAG_BIT_WPOS; /* WPOS is always handled specially */
-   }
-   else if (ctx->ATIFragmentShader._Enabled) {
-      attribsMask = ~0;  /* XXX fix me */
-   }
-   else {
-      /* fixed function */
-      attribsMask = 0x0;
-
-#if CHAN_TYPE == GL_FLOAT
-      attribsMask |= FRAG_BIT_COL0;
-#endif
-
-      if (ctx->Fog.ColorSumEnabled ||
-          (ctx->Light.Enabled &&
-           ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
-         attribsMask |= FRAG_BIT_COL1;
-      }
-
-      if (swrast->_FogEnabled)
-         attribsMask |= FRAG_BIT_FOGC;
-
-      attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0);
-   }
-
-   swrast->_ActiveAttribMask = attribsMask;
-
-   /* Update _ActiveAttribs[] list */
-   {
-      GLuint i, num = 0;
-      for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
-         if (attribsMask & (1 << i)) {
-            swrast->_ActiveAttribs[num++] = i;
-            /* how should this attribute be interpolated? */
-            if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)
-               swrast->_InterpMode[i] = ctx->Light.ShadeModel;
-            else
-               swrast->_InterpMode[i] = GL_SMOOTH;
-         }
-      }
-      swrast->_NumActiveAttribs = num;
-   }
-}
-
-
-void
-_swrast_validate_derived( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
-   if (swrast->NewState) {
-      if (swrast->NewState & _NEW_POLYGON)
-	 _swrast_update_polygon( ctx );
-
-      if (swrast->NewState & (_NEW_HINT | _NEW_PROGRAM))
-	 _swrast_update_fog_hint( ctx );
-
-      if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE)
-	 _swrast_update_texture_env( ctx );
-
-      if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM))
-         _swrast_update_fog_state( ctx );
-
-      if (swrast->NewState & (_NEW_PROGRAM_CONSTANTS | _NEW_PROGRAM))
-	 _swrast_update_fragment_program( ctx, swrast->NewState );
-
-      if (swrast->NewState & (_NEW_TEXTURE | _NEW_PROGRAM)) {
-         _swrast_update_texture_samplers( ctx );
-         _swrast_validate_texture_images(ctx);
-      }
-
-      if (swrast->NewState & (_NEW_COLOR | _NEW_PROGRAM))
-         _swrast_update_deferred_texture(ctx);
-
-      if (swrast->NewState & _SWRAST_NEW_RASTERMASK)
- 	 _swrast_update_rasterflags( ctx );
-
-      if (swrast->NewState & (_NEW_DEPTH |
-                              _NEW_FOG |
-                              _NEW_LIGHT |
-                              _NEW_PROGRAM |
-                              _NEW_TEXTURE))
-         _swrast_update_active_attribs(ctx);
-
-      if (swrast->NewState & (_NEW_FOG | 
-                              _NEW_PROGRAM |
-                              _NEW_LIGHT |
-                              _NEW_TEXTURE))
-         _swrast_update_specular_vertex_add(ctx);
-
-      swrast->NewState = 0;
-      swrast->StateChanges = 0;
-      swrast->InvalidateState = _swrast_invalidate_state;
-   }
-}
-
-#define SWRAST_DEBUG 0
-
-/* Public entrypoints:  See also s_accum.c, s_bitmap.c, etc.
- */
-void
-_swrast_Quad( struct gl_context *ctx,
-	      const SWvertex *v0, const SWvertex *v1,
-              const SWvertex *v2, const SWvertex *v3 )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_Quad\n");
-      _swrast_print_vertex( ctx, v0 );
-      _swrast_print_vertex( ctx, v1 );
-      _swrast_print_vertex( ctx, v2 );
-      _swrast_print_vertex( ctx, v3 );
-   }
-   SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v3 );
-   SWRAST_CONTEXT(ctx)->Triangle( ctx, v1, v2, v3 );
-}
-
-void
-_swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
-                  const SWvertex *v1, const SWvertex *v2 )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_Triangle\n");
-      _swrast_print_vertex( ctx, v0 );
-      _swrast_print_vertex( ctx, v1 );
-      _swrast_print_vertex( ctx, v2 );
-   }
-   SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
-}
-
-void
-_swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_Line\n");
-      _swrast_print_vertex( ctx, v0 );
-      _swrast_print_vertex( ctx, v1 );
-   }
-   SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 );
-}
-
-void
-_swrast_Point( struct gl_context *ctx, const SWvertex *v0 )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_Point\n");
-      _swrast_print_vertex( ctx, v0 );
-   }
-   SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
-}
-
-void
-_swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_InvalidateState\n");
-   }
-   SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state );
-}
-
-void
-_swrast_ResetLineStipple( struct gl_context *ctx )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_ResetLineStipple\n");
-   }
-   SWRAST_CONTEXT(ctx)->StippleCounter = 0;
-}
-
-void
-_swrast_SetFacing(struct gl_context *ctx, GLuint facing)
-{
-   SWRAST_CONTEXT(ctx)->PointLineFacing = facing;
-}
-
-void
-_swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value);
-   }
-   SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
-   SWRAST_CONTEXT(ctx)->AllowVertexFog = value;
-}
-
-void
-_swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
-{
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value);
-   }
-   SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
-   SWRAST_CONTEXT(ctx)->AllowPixelFog = value;
-}
-
-
-GLboolean
-_swrast_CreateContext( struct gl_context *ctx )
-{
-   GLuint i;
-   SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
-
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_CreateContext\n");
-   }
-
-   if (!swrast)
-      return GL_FALSE;
-
-   swrast->NewState = ~0;
-
-   swrast->choose_point = _swrast_choose_point;
-   swrast->choose_line = _swrast_choose_line;
-   swrast->choose_triangle = _swrast_choose_triangle;
-
-   swrast->InvalidatePointMask = _SWRAST_NEW_POINT;
-   swrast->InvalidateLineMask = _SWRAST_NEW_LINE;
-   swrast->InvalidateTriangleMask = _SWRAST_NEW_TRIANGLE;
-
-   swrast->Point = _swrast_validate_point;
-   swrast->Line = _swrast_validate_line;
-   swrast->Triangle = _swrast_validate_triangle;
-   swrast->InvalidateState = _swrast_sleep;
-   swrast->BlendFunc = _swrast_validate_blend_func;
-
-   swrast->AllowVertexFog = GL_TRUE;
-   swrast->AllowPixelFog = GL_TRUE;
-
-   /* Optimized Accum buffer */
-   swrast->_IntegerAccumMode = GL_FALSE;
-   swrast->_IntegerAccumScaler = 0.0;
-
-   for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
-      swrast->TextureSample[i] = NULL;
-
-   swrast->SpanArrays = MALLOC_STRUCT(sw_span_arrays);
-   if (!swrast->SpanArrays) {
-      FREE(swrast);
-      return GL_FALSE;
-   }
-   swrast->SpanArrays->ChanType = CHAN_TYPE;
-#if CHAN_TYPE == GL_UNSIGNED_BYTE
-   swrast->SpanArrays->rgba = swrast->SpanArrays->rgba8;
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
-   swrast->SpanArrays->rgba = swrast->SpanArrays->rgba16;
-#else
-   swrast->SpanArrays->rgba = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL0];
-#endif
-
-   /* init point span buffer */
-   swrast->PointSpan.primitive = GL_POINT;
-   swrast->PointSpan.end = 0;
-   swrast->PointSpan.facing = 0;
-   swrast->PointSpan.array = swrast->SpanArrays;
-
-   swrast->TexelBuffer = (GLfloat *) MALLOC(ctx->Const.MaxTextureImageUnits *
-                                           MAX_WIDTH * 4 * sizeof(GLfloat));
-   if (!swrast->TexelBuffer) {
-      FREE(swrast->SpanArrays);
-      FREE(swrast);
-      return GL_FALSE;
-   }
-
-   ctx->swrast_context = swrast;
-
-   return GL_TRUE;
-}
-
-void
-_swrast_DestroyContext( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
-   if (SWRAST_DEBUG) {
-      _mesa_debug(ctx, "_swrast_DestroyContext\n");
-   }
-
-   FREE( swrast->SpanArrays );
-   if (swrast->ZoomedArrays)
-      FREE( swrast->ZoomedArrays );
-   FREE( swrast->TexelBuffer );
-   FREE( swrast );
-
-   ctx->swrast_context = 0;
-}
-
-
-struct swrast_device_driver *
-_swrast_GetDeviceDriverReference( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   return &swrast->Driver;
-}
-
-void
-_swrast_flush( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   /* flush any pending fragments from rendering points */
-   if (swrast->PointSpan.end > 0) {
-      _swrast_write_rgba_span(ctx, &(swrast->PointSpan));
-      swrast->PointSpan.end = 0;
-   }
-}
-
-void
-_swrast_render_primitive( struct gl_context *ctx, GLenum prim )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) {
-      _swrast_flush(ctx);
-   }
-   swrast->Primitive = prim;
-}
-
-
-void
-_swrast_render_start( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   if (swrast->Driver.SpanRenderStart)
-      swrast->Driver.SpanRenderStart( ctx );
-   swrast->PointSpan.end = 0;
-}
- 
-void
-_swrast_render_finish( struct gl_context *ctx )
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   if (swrast->Driver.SpanRenderFinish)
-      swrast->Driver.SpanRenderFinish( ctx );
-
-   _swrast_flush(ctx);
-}
-
-
-#define SWRAST_DEBUG_VERTICES 0
-
-void
-_swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
-{
-   GLuint i;
-
-   if (SWRAST_DEBUG_VERTICES) {
-      _mesa_debug(ctx, "win %f %f %f %f\n",
-                  v->attrib[FRAG_ATTRIB_WPOS][0],
-                  v->attrib[FRAG_ATTRIB_WPOS][1],
-                  v->attrib[FRAG_ATTRIB_WPOS][2],
-                  v->attrib[FRAG_ATTRIB_WPOS][3]);
-
-      for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
-	 if (ctx->Texture.Unit[i]._ReallyEnabled)
-	    _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][0],
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][1],
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][2],
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][3]);
-
-#if CHAN_TYPE == GL_FLOAT
-      _mesa_debug(ctx, "color %f %f %f %f\n",
-                  v->color[0], v->color[1], v->color[2], v->color[3]);
-#else
-      _mesa_debug(ctx, "color %d %d %d %d\n",
-                  v->color[0], v->color[1], v->color[2], v->color[3]);
-#endif
-      _mesa_debug(ctx, "spec %g %g %g %g\n",
-                  v->attrib[FRAG_ATTRIB_COL1][0],
-                  v->attrib[FRAG_ATTRIB_COL1][1],
-                  v->attrib[FRAG_ATTRIB_COL1][2],
-                  v->attrib[FRAG_ATTRIB_COL1][3]);
-      _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
-      _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]);
-      _mesa_debug(ctx, "pointsize %f\n", v->pointSize);
-      _mesa_debug(ctx, "\n");
-   }
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Keith Whitwell <keith@tungstengraphics.com>
+ *    Brian Paul
+ */
+
+#include "main/imports.h"
+#include "main/bufferobj.h"
+#include "main/colormac.h"
+#include "main/mtypes.h"
+#include "main/teximage.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
+#include "swrast.h"
+#include "s_blend.h"
+#include "s_context.h"
+#include "s_lines.h"
+#include "s_points.h"
+#include "s_span.h"
+#include "s_triangle.h"
+#include "s_texfilter.h"
+
+
+/**
+ * Recompute the value of swrast->_RasterMask, etc. according to
+ * the current context.  The _RasterMask field can be easily tested by
+ * drivers to determine certain basic GL state (does the primitive need
+ * stenciling, logic-op, fog, etc?).
+ */
+static void
+_swrast_update_rasterflags( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLbitfield rasterMask = 0;
+   GLuint i;
+
+   if (ctx->Color.AlphaEnabled)           rasterMask |= ALPHATEST_BIT;
+   if (ctx->Color.BlendEnabled)           rasterMask |= BLEND_BIT;
+   if (ctx->Depth.Test)                   rasterMask |= DEPTH_BIT;
+   if (swrast->_FogEnabled)               rasterMask |= FOG_BIT;
+   if (ctx->Scissor.Enabled)              rasterMask |= CLIP_BIT;
+   if (ctx->Stencil._Enabled)             rasterMask |= STENCIL_BIT;
+   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+      if (!ctx->Color.ColorMask[i][0] ||
+          !ctx->Color.ColorMask[i][1] ||
+          !ctx->Color.ColorMask[i][2] ||
+          !ctx->Color.ColorMask[i][3]) {
+         rasterMask |= MASKING_BIT;
+         break;
+      }
+   }
+   if (ctx->Color._LogicOpEnabled)     rasterMask |= LOGIC_OP_BIT;
+   if (ctx->Texture._EnabledUnits)     rasterMask |= TEXTURE_BIT;
+   if (   ctx->Viewport.X < 0
+       || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
+       || ctx->Viewport.Y < 0
+       || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) {
+      rasterMask |= CLIP_BIT;
+   }
+
+   if (ctx->Query.CurrentOcclusionObject)
+      rasterMask |= OCCLUSION_BIT;
+
+
+   /* If we're not drawing to exactly one color buffer set the
+    * MULTI_DRAW_BIT flag.  Also set it if we're drawing to no
+    * buffers or the RGBA or CI mask disables all writes.
+    */
+   if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
+      /* more than one color buffer designated for writing (or zero buffers) */
+      rasterMask |= MULTI_DRAW_BIT;
+   }
+
+   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+      if (ctx->Color.ColorMask[i][0] +
+          ctx->Color.ColorMask[i][1] +
+          ctx->Color.ColorMask[i][2] +
+          ctx->Color.ColorMask[i][3] == 0) {
+         rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
+         break;
+      }
+   }
+
+
+   if (ctx->FragmentProgram._Current) {
+      rasterMask |= FRAGPROG_BIT;
+   }
+
+   if (ctx->ATIFragmentShader._Enabled) {
+      rasterMask |= ATIFRAGSHADER_BIT;
+   }
+
+#if CHAN_TYPE == GL_FLOAT
+   if (ctx->Color.ClampFragmentColor == GL_TRUE) {
+      rasterMask |= CLAMPING_BIT;
+   }
+#endif
+
+   SWRAST_CONTEXT(ctx)->_RasterMask = rasterMask;
+}
+
+
+/**
+ * Examine polygon cull state to compute the _BackfaceCullSign field.
+ * _BackfaceCullSign will be 0 if no culling, -1 if culling back-faces,
+ * and 1 if culling front-faces.  The Polygon FrontFace state also
+ * factors in.
+ */
+static void
+_swrast_update_polygon( struct gl_context *ctx )
+{
+   GLfloat backface_sign;
+
+   if (ctx->Polygon.CullFlag) {
+      switch (ctx->Polygon.CullFaceMode) {
+      case GL_BACK:
+         backface_sign = -1.0F;
+	 break;
+      case GL_FRONT:
+         backface_sign = 1.0F;
+	 break;
+      case GL_FRONT_AND_BACK:
+         /* fallthrough */
+      default:
+	 backface_sign = 0.0F;
+      }
+   }
+   else {
+      backface_sign = 0.0F;
+   }
+
+   SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
+
+   /* This is for front/back-face determination, but not for culling */
+   SWRAST_CONTEXT(ctx)->_BackfaceSign
+      = (ctx->Polygon.FrontFace == GL_CW) ? -1.0F : 1.0F;
+}
+
+
+
+/**
+ * Update the _PreferPixelFog field to indicate if we need to compute
+ * fog blend factors (from the fog coords) per-fragment.
+ */
+static void
+_swrast_update_fog_hint( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   swrast->_PreferPixelFog = (!swrast->AllowVertexFog ||
+                              ctx->FragmentProgram._Current ||
+			      (ctx->Hint.Fog == GL_NICEST &&
+			       swrast->AllowPixelFog));
+}
+
+
+
+/**
+ * Update the swrast->_TextureCombinePrimary flag.
+ */
+static void
+_swrast_update_texture_env( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLuint i;
+
+   swrast->_TextureCombinePrimary = GL_FALSE;
+
+   for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+      const struct gl_tex_env_combine_state *combine =
+         ctx->Texture.Unit[i]._CurrentCombine;
+      GLuint term;
+      for (term = 0; term < combine->_NumArgsRGB; term++) {
+         if (combine->SourceRGB[term] == GL_PRIMARY_COLOR) {
+            swrast->_TextureCombinePrimary = GL_TRUE;
+            return;
+         }
+         if (combine->SourceA[term] == GL_PRIMARY_COLOR) {
+            swrast->_TextureCombinePrimary = GL_TRUE;
+            return;
+         }
+      }
+   }
+}
+
+
+/**
+ * Determine if we can defer texturing/shading until after Z/stencil
+ * testing.  This potentially allows us to skip texturing/shading for
+ * lots of fragments.
+ */
+static void
+_swrast_update_deferred_texture(struct gl_context *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (ctx->Color.AlphaEnabled) {
+      /* alpha test depends on post-texture/shader colors */
+      swrast->_DeferredTexture = GL_FALSE;
+   }
+   else {
+      const struct gl_fragment_program *fprog
+         = ctx->FragmentProgram._Current;
+      if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) {
+         /* Z comes from fragment program/shader */
+         swrast->_DeferredTexture = GL_FALSE;
+      }
+      else if (fprog && fprog->UsesKill) {
+         swrast->_DeferredTexture = GL_FALSE;
+      }
+      else if (ctx->Query.CurrentOcclusionObject) {
+         /* occlusion query depends on shader discard/kill results */
+         swrast->_DeferredTexture = GL_FALSE;
+      }
+      else {
+         swrast->_DeferredTexture = GL_TRUE;
+      }
+   }
+}
+
+
+/**
+ * Update swrast->_FogColor and swrast->_FogEnable values.
+ */
+static void
+_swrast_update_fog_state( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+
+   assert((fp == NULL) || (fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB));
+
+   /* determine if fog is needed, and if so, which fog mode */
+   swrast->_FogEnabled = (fp == NULL && ctx->Fog.Enabled);
+}
+
+
+/**
+ * Update state for running fragment programs.  Basically, load the
+ * program parameters with current state values.
+ */
+static void
+_swrast_update_fragment_program(struct gl_context *ctx, GLbitfield newState)
+{
+   const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+   if (fp) {
+      _mesa_load_state_parameters(ctx, fp->Base.Parameters);
+   }
+}
+
+
+/**
+ * See if we can do early diffuse+specular (primary+secondary) color
+ * add per vertex instead of per-fragment.
+ */
+static void
+_swrast_update_specular_vertex_add(struct gl_context *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLboolean separateSpecular = ctx->Fog.ColorSumEnabled ||
+      (ctx->Light.Enabled &&
+       ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
+
+   swrast->SpecularVertexAdd = (separateSpecular
+                                && ctx->Texture._EnabledUnits == 0x0
+                                && !ctx->FragmentProgram._Current
+                                && !ctx->ATIFragmentShader._Enabled);
+}
+
+
+#define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK |	\
+                             _NEW_PROGRAM_CONSTANTS |   \
+			     _NEW_TEXTURE |		\
+			     _NEW_HINT |		\
+			     _NEW_POLYGON )
+
+/* State referenced by _swrast_choose_triangle, _swrast_choose_line.
+ */
+#define _SWRAST_NEW_TRIANGLE (_SWRAST_NEW_DERIVED |		\
+			      _NEW_RENDERMODE|			\
+                              _NEW_POLYGON|			\
+                              _NEW_DEPTH|			\
+                              _NEW_STENCIL|			\
+                              _NEW_COLOR|			\
+                              _NEW_TEXTURE|			\
+                              _SWRAST_NEW_RASTERMASK|		\
+                              _NEW_LIGHT|			\
+                              _NEW_FOG |			\
+			      _DD_NEW_SEPARATE_SPECULAR)
+
+#define _SWRAST_NEW_LINE (_SWRAST_NEW_DERIVED |		\
+			  _NEW_RENDERMODE|		\
+                          _NEW_LINE|			\
+                          _NEW_TEXTURE|			\
+                          _NEW_LIGHT|			\
+                          _NEW_FOG|			\
+                          _NEW_DEPTH |			\
+                          _DD_NEW_SEPARATE_SPECULAR)
+
+#define _SWRAST_NEW_POINT (_SWRAST_NEW_DERIVED |	\
+			   _NEW_RENDERMODE |		\
+			   _NEW_POINT |			\
+			   _NEW_TEXTURE |		\
+			   _NEW_LIGHT |			\
+			   _NEW_FOG |			\
+                           _DD_NEW_SEPARATE_SPECULAR)
+
+#define _SWRAST_NEW_TEXTURE_SAMPLE_FUNC _NEW_TEXTURE
+
+#define _SWRAST_NEW_TEXTURE_ENV_MODE _NEW_TEXTURE
+
+#define _SWRAST_NEW_BLEND_FUNC _NEW_COLOR
+
+
+
+/**
+ * Stub for swrast->Triangle to select a true triangle function
+ * after a state change.
+ */
+static void
+_swrast_validate_triangle( struct gl_context *ctx,
+			   const SWvertex *v0,
+                           const SWvertex *v1,
+                           const SWvertex *v2 )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+   _swrast_validate_derived( ctx );
+   swrast->choose_triangle( ctx );
+   ASSERT(swrast->Triangle);
+
+   if (swrast->SpecularVertexAdd) {
+      /* separate specular color, but no texture */
+      swrast->SpecTriangle = swrast->Triangle;
+      swrast->Triangle = _swrast_add_spec_terms_triangle;
+   }
+
+   swrast->Triangle( ctx, v0, v1, v2 );
+}
+
+/**
+ * Called via swrast->Line.  Examine current GL state and choose a software
+ * line routine.  Then call it.
+ */
+static void
+_swrast_validate_line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+   _swrast_validate_derived( ctx );
+   swrast->choose_line( ctx );
+   ASSERT(swrast->Line);
+
+   if (swrast->SpecularVertexAdd) {
+      swrast->SpecLine = swrast->Line;
+      swrast->Line = _swrast_add_spec_terms_line;
+   }
+
+   swrast->Line( ctx, v0, v1 );
+}
+
+/**
+ * Called via swrast->Point.  Examine current GL state and choose a software
+ * point routine.  Then call it.
+ */
+static void
+_swrast_validate_point( struct gl_context *ctx, const SWvertex *v0 )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+   _swrast_validate_derived( ctx );
+   swrast->choose_point( ctx );
+
+   if (swrast->SpecularVertexAdd) {
+      swrast->SpecPoint = swrast->Point;
+      swrast->Point = _swrast_add_spec_terms_point;
+   }
+
+   swrast->Point( ctx, v0 );
+}
+
+
+/**
+ * Called via swrast->BlendFunc.  Examine GL state to choose a blending
+ * function, then call it.
+ */
+static void _ASMAPI
+_swrast_validate_blend_func(struct gl_context *ctx, GLuint n, const GLubyte mask[],
+                            GLvoid *src, const GLvoid *dst,
+                            GLenum chanType )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+   _swrast_validate_derived( ctx ); /* why is this needed? */
+   _swrast_choose_blend_func( ctx, chanType );
+
+   swrast->BlendFunc( ctx, n, mask, src, dst, chanType );
+}
+
+
+/**
+ * Make sure we have texture image data for all the textures we may need
+ * for subsequent rendering.
+ */
+static void
+_swrast_validate_texture_images(struct gl_context *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLuint u;
+
+   if (!swrast->ValidateTextureImage || !ctx->Texture._EnabledUnits) {
+      /* no textures enabled, or no way to validate images! */
+      return;
+   }
+
+   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
+      if (ctx->Texture.Unit[u]._ReallyEnabled) {
+         struct gl_texture_object *texObj = ctx->Texture.Unit[u]._Current;
+         ASSERT(texObj);
+         if (texObj) {
+            GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+            GLuint face;
+            for (face = 0; face < numFaces; face++) {
+               GLint lvl;
+               for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
+                  struct gl_texture_image *texImg = texObj->Image[face][lvl];
+                  if (texImg && !texImg->Data) {
+                     swrast->ValidateTextureImage(ctx, texObj, face, lvl);
+                     ASSERT(texObj->Image[face][lvl]->Data);
+                  }
+               }
+            }
+         }
+      }
+   }
+}
+
+
+/**
+ * Free the texture image data attached to all currently enabled
+ * textures.  Meant to be called by device drivers when transitioning
+ * from software to hardware rendering.
+ */
+void
+_swrast_eject_texture_images(struct gl_context *ctx)
+{
+   GLuint u;
+
+   if (!ctx->Texture._EnabledUnits) {
+      /* no textures enabled */
+      return;
+   }
+
+   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
+      if (ctx->Texture.Unit[u]._ReallyEnabled) {
+         struct gl_texture_object *texObj = ctx->Texture.Unit[u]._Current;
+         ASSERT(texObj);
+         if (texObj) {
+            GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+            GLuint face;
+            for (face = 0; face < numFaces; face++) {
+               GLint lvl;
+               for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
+                  struct gl_texture_image *texImg = texObj->Image[face][lvl];
+                  if (texImg && texImg->Data) {
+                     _mesa_free_texmemory(texImg->Data);
+                     texImg->Data = NULL;
+                  }
+               }
+            }
+         }
+      }
+   }
+}
+
+
+
+static void
+_swrast_sleep( struct gl_context *ctx, GLbitfield new_state )
+{
+   (void) ctx; (void) new_state;
+}
+
+
+static void
+_swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLuint i;
+
+   swrast->NewState |= new_state;
+
+   /* After 10 statechanges without any swrast functions being called,
+    * put the module to sleep.
+    */
+   if (++swrast->StateChanges > 10) {
+      swrast->InvalidateState = _swrast_sleep;
+      swrast->NewState = ~0;
+      new_state = ~0;
+   }
+
+   if (new_state & swrast->InvalidateTriangleMask)
+      swrast->Triangle = _swrast_validate_triangle;
+
+   if (new_state & swrast->InvalidateLineMask)
+      swrast->Line = _swrast_validate_line;
+
+   if (new_state & swrast->InvalidatePointMask)
+      swrast->Point = _swrast_validate_point;
+
+   if (new_state & _SWRAST_NEW_BLEND_FUNC)
+      swrast->BlendFunc = _swrast_validate_blend_func;
+
+   if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
+      for (i = 0 ; i < ctx->Const.MaxTextureImageUnits ; i++)
+	 swrast->TextureSample[i] = NULL;
+}
+
+
+void
+_swrast_update_texture_samplers(struct gl_context *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLuint u;
+
+   if (!swrast)
+      return; /* pipe hack */
+
+   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
+      const struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
+      /* Note: If tObj is NULL, the sample function will be a simple
+       * function that just returns opaque black (0,0,0,1).
+       */
+      swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
+   }
+}
+
+
+/**
+ * Update swrast->_ActiveAttribs, swrast->_NumActiveAttribs,
+ * swrast->_ActiveAtttribMask.
+ */
+static void
+_swrast_update_active_attribs(struct gl_context *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLuint attribsMask;
+
+   /*
+    * Compute _ActiveAttribsMask = which fragment attributes are needed.
+    */
+   if (ctx->FragmentProgram._Current) {
+      /* fragment program/shader */
+      attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
+      attribsMask &= ~FRAG_BIT_WPOS; /* WPOS is always handled specially */
+   }
+   else if (ctx->ATIFragmentShader._Enabled) {
+      attribsMask = ~0;  /* XXX fix me */
+   }
+   else {
+      /* fixed function */
+      attribsMask = 0x0;
+
+#if CHAN_TYPE == GL_FLOAT
+      attribsMask |= FRAG_BIT_COL0;
+#endif
+
+      if (ctx->Fog.ColorSumEnabled ||
+          (ctx->Light.Enabled &&
+           ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
+         attribsMask |= FRAG_BIT_COL1;
+      }
+
+      if (swrast->_FogEnabled)
+         attribsMask |= FRAG_BIT_FOGC;
+
+      attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0);
+   }
+
+   swrast->_ActiveAttribMask = attribsMask;
+
+   /* Update _ActiveAttribs[] list */
+   {
+      GLuint i, num = 0;
+      for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+         if (attribsMask & (1 << i)) {
+            swrast->_ActiveAttribs[num++] = i;
+            /* how should this attribute be interpolated? */
+            if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)
+               swrast->_InterpMode[i] = ctx->Light.ShadeModel;
+            else
+               swrast->_InterpMode[i] = GL_SMOOTH;
+         }
+      }
+      swrast->_NumActiveAttribs = num;
+   }
+}
+
+
+void
+_swrast_validate_derived( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+   if (swrast->NewState) {
+      if (swrast->NewState & _NEW_POLYGON)
+	 _swrast_update_polygon( ctx );
+
+      if (swrast->NewState & (_NEW_HINT | _NEW_PROGRAM))
+	 _swrast_update_fog_hint( ctx );
+
+      if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE)
+	 _swrast_update_texture_env( ctx );
+
+      if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM))
+         _swrast_update_fog_state( ctx );
+
+      if (swrast->NewState & (_NEW_PROGRAM_CONSTANTS | _NEW_PROGRAM))
+	 _swrast_update_fragment_program( ctx, swrast->NewState );
+
+      if (swrast->NewState & (_NEW_TEXTURE | _NEW_PROGRAM)) {
+         _swrast_update_texture_samplers( ctx );
+         _swrast_validate_texture_images(ctx);
+      }
+
+      if (swrast->NewState & (_NEW_COLOR | _NEW_PROGRAM))
+         _swrast_update_deferred_texture(ctx);
+
+      if (swrast->NewState & _SWRAST_NEW_RASTERMASK)
+ 	 _swrast_update_rasterflags( ctx );
+
+      if (swrast->NewState & (_NEW_DEPTH |
+                              _NEW_FOG |
+                              _NEW_LIGHT |
+                              _NEW_PROGRAM |
+                              _NEW_TEXTURE))
+         _swrast_update_active_attribs(ctx);
+
+      if (swrast->NewState & (_NEW_FOG | 
+                              _NEW_PROGRAM |
+                              _NEW_LIGHT |
+                              _NEW_TEXTURE))
+         _swrast_update_specular_vertex_add(ctx);
+
+      swrast->NewState = 0;
+      swrast->StateChanges = 0;
+      swrast->InvalidateState = _swrast_invalidate_state;
+   }
+}
+
+#define SWRAST_DEBUG 0
+
+/* Public entrypoints:  See also s_accum.c, s_bitmap.c, etc.
+ */
+void
+_swrast_Quad( struct gl_context *ctx,
+	      const SWvertex *v0, const SWvertex *v1,
+              const SWvertex *v2, const SWvertex *v3 )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_Quad\n");
+      _swrast_print_vertex( ctx, v0 );
+      _swrast_print_vertex( ctx, v1 );
+      _swrast_print_vertex( ctx, v2 );
+      _swrast_print_vertex( ctx, v3 );
+   }
+   SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v3 );
+   SWRAST_CONTEXT(ctx)->Triangle( ctx, v1, v2, v3 );
+}
+
+void
+_swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
+                  const SWvertex *v1, const SWvertex *v2 )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_Triangle\n");
+      _swrast_print_vertex( ctx, v0 );
+      _swrast_print_vertex( ctx, v1 );
+      _swrast_print_vertex( ctx, v2 );
+   }
+   SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
+}
+
+void
+_swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_Line\n");
+      _swrast_print_vertex( ctx, v0 );
+      _swrast_print_vertex( ctx, v1 );
+   }
+   SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 );
+}
+
+void
+_swrast_Point( struct gl_context *ctx, const SWvertex *v0 )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_Point\n");
+      _swrast_print_vertex( ctx, v0 );
+   }
+   SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
+}
+
+void
+_swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_InvalidateState\n");
+   }
+   SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state );
+}
+
+void
+_swrast_ResetLineStipple( struct gl_context *ctx )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_ResetLineStipple\n");
+   }
+   SWRAST_CONTEXT(ctx)->StippleCounter = 0;
+}
+
+void
+_swrast_SetFacing(struct gl_context *ctx, GLuint facing)
+{
+   SWRAST_CONTEXT(ctx)->PointLineFacing = facing;
+}
+
+void
+_swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value);
+   }
+   SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
+   SWRAST_CONTEXT(ctx)->AllowVertexFog = value;
+}
+
+void
+_swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
+{
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value);
+   }
+   SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
+   SWRAST_CONTEXT(ctx)->AllowPixelFog = value;
+}
+
+
+GLboolean
+_swrast_CreateContext( struct gl_context *ctx )
+{
+   GLuint i;
+   SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
+
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_CreateContext\n");
+   }
+
+   if (!swrast)
+      return GL_FALSE;
+
+   swrast->NewState = ~0;
+
+   swrast->choose_point = _swrast_choose_point;
+   swrast->choose_line = _swrast_choose_line;
+   swrast->choose_triangle = _swrast_choose_triangle;
+
+   swrast->InvalidatePointMask = _SWRAST_NEW_POINT;
+   swrast->InvalidateLineMask = _SWRAST_NEW_LINE;
+   swrast->InvalidateTriangleMask = _SWRAST_NEW_TRIANGLE;
+
+   swrast->Point = _swrast_validate_point;
+   swrast->Line = _swrast_validate_line;
+   swrast->Triangle = _swrast_validate_triangle;
+   swrast->InvalidateState = _swrast_sleep;
+   swrast->BlendFunc = _swrast_validate_blend_func;
+
+   swrast->AllowVertexFog = GL_TRUE;
+   swrast->AllowPixelFog = GL_TRUE;
+
+   /* Optimized Accum buffer */
+   swrast->_IntegerAccumMode = GL_FALSE;
+   swrast->_IntegerAccumScaler = 0.0;
+
+   for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
+      swrast->TextureSample[i] = NULL;
+
+   swrast->SpanArrays = MALLOC_STRUCT(sw_span_arrays);
+   if (!swrast->SpanArrays) {
+      FREE(swrast);
+      return GL_FALSE;
+   }
+   swrast->SpanArrays->ChanType = CHAN_TYPE;
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+   swrast->SpanArrays->rgba = swrast->SpanArrays->rgba8;
+#elif CHAN_TYPE == GL_UNSIGNED_SHORT
+   swrast->SpanArrays->rgba = swrast->SpanArrays->rgba16;
+#else
+   swrast->SpanArrays->rgba = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL0];
+#endif
+
+   /* init point span buffer */
+   swrast->PointSpan.primitive = GL_POINT;
+   swrast->PointSpan.end = 0;
+   swrast->PointSpan.facing = 0;
+   swrast->PointSpan.array = swrast->SpanArrays;
+
+   swrast->TexelBuffer = (GLfloat *) MALLOC(ctx->Const.MaxTextureImageUnits *
+                                           MAX_WIDTH * 4 * sizeof(GLfloat));
+   if (!swrast->TexelBuffer) {
+      FREE(swrast->SpanArrays);
+      FREE(swrast);
+      return GL_FALSE;
+   }
+
+   ctx->swrast_context = swrast;
+
+   return GL_TRUE;
+}
+
+void
+_swrast_DestroyContext( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+   if (SWRAST_DEBUG) {
+      _mesa_debug(ctx, "_swrast_DestroyContext\n");
+   }
+
+   FREE( swrast->SpanArrays );
+   if (swrast->ZoomedArrays)
+      FREE( swrast->ZoomedArrays );
+   FREE( swrast->TexelBuffer );
+   FREE( swrast );
+
+   ctx->swrast_context = 0;
+}
+
+
+struct swrast_device_driver *
+_swrast_GetDeviceDriverReference( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   return &swrast->Driver;
+}
+
+void
+_swrast_flush( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   /* flush any pending fragments from rendering points */
+   if (swrast->PointSpan.end > 0) {
+      _swrast_write_rgba_span(ctx, &(swrast->PointSpan));
+      swrast->PointSpan.end = 0;
+   }
+}
+
+void
+_swrast_render_primitive( struct gl_context *ctx, GLenum prim )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) {
+      _swrast_flush(ctx);
+   }
+   swrast->Primitive = prim;
+}
+
+
+void
+_swrast_render_start( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (swrast->Driver.SpanRenderStart)
+      swrast->Driver.SpanRenderStart( ctx );
+   swrast->PointSpan.end = 0;
+}
+ 
+void
+_swrast_render_finish( struct gl_context *ctx )
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (swrast->Driver.SpanRenderFinish)
+      swrast->Driver.SpanRenderFinish( ctx );
+
+   _swrast_flush(ctx);
+}
+
+
+#define SWRAST_DEBUG_VERTICES 0
+
+void
+_swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
+{
+   GLuint i;
+
+   if (SWRAST_DEBUG_VERTICES) {
+      _mesa_debug(ctx, "win %f %f %f %f\n",
+                  v->attrib[FRAG_ATTRIB_WPOS][0],
+                  v->attrib[FRAG_ATTRIB_WPOS][1],
+                  v->attrib[FRAG_ATTRIB_WPOS][2],
+                  v->attrib[FRAG_ATTRIB_WPOS][3]);
+
+      for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
+	 if (ctx->Texture.Unit[i]._ReallyEnabled)
+	    _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
+                        v->attrib[FRAG_ATTRIB_TEX0 + i][0],
+                        v->attrib[FRAG_ATTRIB_TEX0 + i][1],
+                        v->attrib[FRAG_ATTRIB_TEX0 + i][2],
+                        v->attrib[FRAG_ATTRIB_TEX0 + i][3]);
+
+#if CHAN_TYPE == GL_FLOAT
+      _mesa_debug(ctx, "color %f %f %f %f\n",
+                  v->color[0], v->color[1], v->color[2], v->color[3]);
+#else
+      _mesa_debug(ctx, "color %d %d %d %d\n",
+                  v->color[0], v->color[1], v->color[2], v->color[3]);
+#endif
+      _mesa_debug(ctx, "spec %g %g %g %g\n",
+                  v->attrib[FRAG_ATTRIB_COL1][0],
+                  v->attrib[FRAG_ATTRIB_COL1][1],
+                  v->attrib[FRAG_ATTRIB_COL1][2],
+                  v->attrib[FRAG_ATTRIB_COL1][3]);
+      _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
+      _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]);
+      _mesa_debug(ctx, "pointsize %f\n", v->pointSize);
+      _mesa_debug(ctx, "\n");
+   }
+}
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 7535832ab..8d7458c2d 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -1,349 +1,348 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.3
- *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file swrast/s_context.h
- * \brief Software rasterization context and private types.
- * \author Keith Whitwell <keith@tungstengraphics.com>
- */
-
-/**
- * \mainpage swrast module
- *
- * This module, software rasterization, contains the software fallback
- * routines for drawing points, lines, triangles, bitmaps and images.
- * All rendering boils down to writing spans (arrays) of pixels with
- * particular colors.  The span-writing routines must be implemented
- * by the device driver.
- */
-
-
-#ifndef S_CONTEXT_H
-#define S_CONTEXT_H
-
-#include "main/compiler.h"
-#include "main/mtypes.h"
-#include "program/prog_execute.h"
-#include "swrast.h"
-#include "s_span.h"
-
-
-typedef void (*texture_sample_func)(struct gl_context *ctx,
-                                    const struct gl_texture_object *tObj,
-                                    GLuint n, const GLfloat texcoords[][4],
-                                    const GLfloat lambda[], GLfloat rgba[][4]);
-
-typedef void (_ASMAPIP blend_func)( struct gl_context *ctx, GLuint n,
-                                    const GLubyte mask[],
-                                    GLvoid *src, const GLvoid *dst,
-                                    GLenum chanType);
-
-typedef void (*swrast_point_func)( struct gl_context *ctx, const SWvertex *);
-
-typedef void (*swrast_line_func)( struct gl_context *ctx,
-                                  const SWvertex *, const SWvertex *);
-
-typedef void (*swrast_tri_func)( struct gl_context *ctx, const SWvertex *,
-                                 const SWvertex *, const SWvertex *);
-
-
-typedef void (*validate_texture_image_func)(struct gl_context *ctx,
-                                            struct gl_texture_object *texObj,
-                                            GLuint face, GLuint level);
-
-
-/**
- * \defgroup Bitmasks
- * Bitmasks to indicate which rasterization options are enabled
- * (RasterMask)
- */
-/*@{*/
-#define ALPHATEST_BIT		0x001	/**< Alpha-test pixels */
-#define BLEND_BIT		0x002	/**< Blend pixels */
-#define DEPTH_BIT		0x004	/**< Depth-test pixels */
-#define FOG_BIT			0x008	/**< Fog pixels */
-#define LOGIC_OP_BIT		0x010	/**< Apply logic op in software */
-#define CLIP_BIT		0x020	/**< Scissor or window clip pixels */
-#define STENCIL_BIT		0x040	/**< Stencil pixels */
-#define MASKING_BIT		0x080	/**< Do glColorMask or glIndexMask */
-#define MULTI_DRAW_BIT		0x400	/**< Write to more than one color- */
-                                        /**< buffer or no buffers. */
-#define OCCLUSION_BIT           0x800   /**< GL_HP_occlusion_test enabled */
-#define TEXTURE_BIT		0x1000	/**< Texturing really enabled */
-#define FRAGPROG_BIT            0x2000  /**< Fragment program enabled */
-#define ATIFRAGSHADER_BIT       0x4000  /**< ATI Fragment shader enabled */
-#define CLAMPING_BIT            0x8000  /**< Clamp colors to [0,1] */
-/*@}*/
-
-#define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS|	\
-			        _NEW_SCISSOR|	\
-			        _NEW_COLOR|	\
-			        _NEW_DEPTH|	\
-			        _NEW_FOG|	\
-                                _NEW_PROGRAM|   \
-			        _NEW_STENCIL|	\
-			        _NEW_TEXTURE|	\
-			        _NEW_VIEWPORT|	\
-			        _NEW_DEPTH)
-
-
-/**
- * \struct SWcontext
- * \brief  Per-context state that's private to the software rasterizer module.
- */
-typedef struct
-{
-   /** Driver interface:
-    */
-   struct swrast_device_driver Driver;
-
-   /** Configuration mechanisms to make software rasterizer match
-    * characteristics of the hardware rasterizer (if present):
-    */
-   GLboolean AllowVertexFog;
-   GLboolean AllowPixelFog;
-
-   /** Derived values, invalidated on statechanges, updated from
-    * _swrast_validate_derived():
-    */
-   GLbitfield _RasterMask;
-   GLfloat _BackfaceSign;      /** +1 or -1 */
-   GLfloat _BackfaceCullSign;  /** +1, 0, or -1 */
-   GLboolean _PreferPixelFog;    /* Compute fog blend factor per fragment? */
-   GLboolean _TextureCombinePrimary;
-   GLboolean _FogEnabled;
-   GLboolean _DeferredTexture;
-   GLenum _FogMode;  /* either GL_FOG_MODE or fragment program's fog mode */
-
-   /** List/array of the fragment attributes to interpolate */
-   GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
-   /** Same info, but as a bitmask */
-   GLbitfield _ActiveAttribMask;
-   /** Number of fragment attributes to interpolate */
-   GLuint _NumActiveAttribs;
-   /** Indicates how each attrib is to be interpolated (lines/tris) */
-   GLenum _InterpMode[FRAG_ATTRIB_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */
-
-   /* Accum buffer temporaries.
-    */
-   GLboolean _IntegerAccumMode;	/**< Storing unscaled integers? */
-   GLfloat _IntegerAccumScaler;	/**< Implicit scale factor */
-
-   /* Working values:
-    */
-   GLuint StippleCounter;    /**< Line stipple counter */
-   GLuint PointLineFacing;
-   GLbitfield NewState;
-   GLuint StateChanges;
-   GLenum Primitive;    /* current primitive being drawn (ala glBegin) */
-   GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */
-
-   void (*InvalidateState)( struct gl_context *ctx, GLbitfield new_state );
-
-   /**
-    * When the NewState mask intersects these masks, we invalidate the
-    * Point/Line/Triangle function pointers below.
-    */
-   /*@{*/
-   GLbitfield InvalidatePointMask;
-   GLbitfield InvalidateLineMask;
-   GLbitfield InvalidateTriangleMask;
-   /*@}*/
-
-   /**
-    * Device drivers plug in functions for these callbacks.
-    * Will be called when the GL state change mask intersects the above masks.
-    */
-   /*@{*/
-   void (*choose_point)( struct gl_context * );
-   void (*choose_line)( struct gl_context * );
-   void (*choose_triangle)( struct gl_context * );
-   /*@}*/
-
-   /**
-    * Current point, line and triangle drawing functions.
-    */
-   /*@{*/
-   swrast_point_func Point;
-   swrast_line_func Line;
-   swrast_tri_func Triangle;
-   /*@}*/
-
-   /**
-    * Placeholders for when separate specular (or secondary color) is
-    * enabled but texturing is not.
-    */
-   /*@{*/
-   swrast_point_func SpecPoint;
-   swrast_line_func SpecLine;
-   swrast_tri_func SpecTriangle;
-   /*@}*/
-
-   /**
-    * Typically, we'll allocate a sw_span structure as a local variable
-    * and set its 'array' pointer to point to this object.  The reason is
-    * this object is big and causes problems when allocated on the stack
-    * on some systems.
-    */
-   SWspanarrays *SpanArrays;
-   SWspanarrays *ZoomedArrays;  /**< For pixel zooming */
-
-   /**
-    * Used to buffer N GL_POINTS, instead of rendering one by one.
-    */
-   SWspan PointSpan;
-
-   /** Internal hooks, kept up to date by the same mechanism as above.
-    */
-   blend_func BlendFunc;
-   texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS];
-
-   /** Buffer for saving the sampled texture colors.
-    * Needed for GL_ARB_texture_env_crossbar implementation.
-    */
-   GLfloat *TexelBuffer;
-
-   validate_texture_image_func ValidateTextureImage;
-
-   /** State used during execution of fragment programs */
-   struct gl_program_machine FragProgMachine;
-
-} SWcontext;
-
-
-extern void
-_swrast_validate_derived( struct gl_context *ctx );
-
-extern void
-_swrast_update_texture_samplers(struct gl_context *ctx);
-
-
-/** Return SWcontext for the given struct gl_context */
-static INLINE SWcontext *
-SWRAST_CONTEXT(struct gl_context *ctx)
-{
-   return (SWcontext *) ctx->swrast_context;
-}
-
-/** const version of above */
-static INLINE const SWcontext *
-CONST_SWRAST_CONTEXT(const struct gl_context *ctx)
-{
-   return (const SWcontext *) ctx->swrast_context;
-}
-
-
-/**
- * Called prior to framebuffer reading/writing.
- * For drivers that rely on swrast for fallback rendering, this is the
- * driver's opportunity to map renderbuffers and textures.
- */
-static INLINE void
-swrast_render_start(struct gl_context *ctx)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   if (swrast->Driver.SpanRenderStart)
-      swrast->Driver.SpanRenderStart(ctx);
-}
-
-
-/** Called after framebuffer reading/writing */
-static INLINE void
-swrast_render_finish(struct gl_context *ctx)
-{
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   if (swrast->Driver.SpanRenderFinish)
-      swrast->Driver.SpanRenderFinish(ctx);
-}
-
-
-
-/**
- * Size of an RGBA pixel, in bytes, for given datatype.
- */
-#define RGBA_PIXEL_SIZE(TYPE)                                     \
-         ((TYPE == GL_UNSIGNED_BYTE) ? 4 * sizeof(GLubyte) :      \
-          ((TYPE == GL_UNSIGNED_SHORT) ? 4 * sizeof(GLushort)     \
-           : 4 * sizeof(GLfloat)))
-
-
-
-/*
- * Fixed point arithmetic macros
- */
-#ifndef FIXED_FRAC_BITS
-#define FIXED_FRAC_BITS 11
-#endif
-
-#define FIXED_SHIFT     FIXED_FRAC_BITS
-#define FIXED_ONE       (1 << FIXED_SHIFT)
-#define FIXED_HALF      (1 << (FIXED_SHIFT-1))
-#define FIXED_FRAC_MASK (FIXED_ONE - 1)
-#define FIXED_INT_MASK  (~FIXED_FRAC_MASK)
-#define FIXED_EPSILON   1
-#define FIXED_SCALE     ((float) FIXED_ONE)
-#define FIXED_DBL_SCALE ((double) FIXED_ONE)
-#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
-#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
-#define IntToFixed(I)   ((I) << FIXED_SHIFT)
-#define FixedToInt(X)   ((X) >> FIXED_SHIFT)
-#define FixedToUns(X)   (((unsigned int)(X)) >> FIXED_SHIFT)
-#define FixedCeil(X)    (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
-#define FixedFloor(X)   ((X) & FIXED_INT_MASK)
-#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
-#define PosFloatToFixed(X)      FloatToFixed(X)
-#define SignedFloatToFixed(X)   FloatToFixed(X)
-
-
-
-/*
- * XXX these macros are just bandages for now in order to make
- * CHAN_BITS==32 compile cleanly.
- * These should probably go elsewhere at some point.
- */
-#if CHAN_TYPE == GL_FLOAT
-#define ChanToFixed(X)  (X)
-#define FixedToChan(X)  (X)
-#else
-#define ChanToFixed(X)  IntToFixed(X)
-#define FixedToChan(X)  FixedToInt(X)
-#endif
-
-
-/**
- * For looping over fragment attributes in the pointe, line
- * triangle rasterizers.
- */
-#define ATTRIB_LOOP_BEGIN                                \
-   {                                                     \
-      GLuint a;                                          \
-      for (a = 0; a < swrast->_NumActiveAttribs; a++) {  \
-         const GLuint attr = swrast->_ActiveAttribs[a];
-
-#define ATTRIB_LOOP_END } }
-
-
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5.3
+ *
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file swrast/s_context.h
+ * \brief Software rasterization context and private types.
+ * \author Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+/**
+ * \mainpage swrast module
+ *
+ * This module, software rasterization, contains the software fallback
+ * routines for drawing points, lines, triangles, bitmaps and images.
+ * All rendering boils down to writing spans (arrays) of pixels with
+ * particular colors.  The span-writing routines must be implemented
+ * by the device driver.
+ */
+
+
+#ifndef S_CONTEXT_H
+#define S_CONTEXT_H
+
+#include "main/compiler.h"
+#include "main/mtypes.h"
+#include "program/prog_execute.h"
+#include "swrast.h"
+#include "s_span.h"
+
+
+typedef void (*texture_sample_func)(struct gl_context *ctx,
+                                    const struct gl_texture_object *tObj,
+                                    GLuint n, const GLfloat texcoords[][4],
+                                    const GLfloat lambda[], GLfloat rgba[][4]);
+
+typedef void (_ASMAPIP blend_func)( struct gl_context *ctx, GLuint n,
+                                    const GLubyte mask[],
+                                    GLvoid *src, const GLvoid *dst,
+                                    GLenum chanType);
+
+typedef void (*swrast_point_func)( struct gl_context *ctx, const SWvertex *);
+
+typedef void (*swrast_line_func)( struct gl_context *ctx,
+                                  const SWvertex *, const SWvertex *);
+
+typedef void (*swrast_tri_func)( struct gl_context *ctx, const SWvertex *,
+                                 const SWvertex *, const SWvertex *);
+
+
+typedef void (*validate_texture_image_func)(struct gl_context *ctx,
+                                            struct gl_texture_object *texObj,
+                                            GLuint face, GLuint level);
+
+
+/**
+ * \defgroup Bitmasks
+ * Bitmasks to indicate which rasterization options are enabled
+ * (RasterMask)
+ */
+/*@{*/
+#define ALPHATEST_BIT		0x001	/**< Alpha-test pixels */
+#define BLEND_BIT		0x002	/**< Blend pixels */
+#define DEPTH_BIT		0x004	/**< Depth-test pixels */
+#define FOG_BIT			0x008	/**< Fog pixels */
+#define LOGIC_OP_BIT		0x010	/**< Apply logic op in software */
+#define CLIP_BIT		0x020	/**< Scissor or window clip pixels */
+#define STENCIL_BIT		0x040	/**< Stencil pixels */
+#define MASKING_BIT		0x080	/**< Do glColorMask or glIndexMask */
+#define MULTI_DRAW_BIT		0x400	/**< Write to more than one color- */
+                                        /**< buffer or no buffers. */
+#define OCCLUSION_BIT           0x800   /**< GL_HP_occlusion_test enabled */
+#define TEXTURE_BIT		0x1000	/**< Texturing really enabled */
+#define FRAGPROG_BIT            0x2000  /**< Fragment program enabled */
+#define ATIFRAGSHADER_BIT       0x4000  /**< ATI Fragment shader enabled */
+#define CLAMPING_BIT            0x8000  /**< Clamp colors to [0,1] */
+/*@}*/
+
+#define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS|	\
+			        _NEW_SCISSOR|	\
+			        _NEW_COLOR|	\
+			        _NEW_DEPTH|	\
+			        _NEW_FOG|	\
+                                _NEW_PROGRAM|   \
+			        _NEW_STENCIL|	\
+			        _NEW_TEXTURE|	\
+			        _NEW_VIEWPORT|	\
+			        _NEW_DEPTH)
+
+
+/**
+ * \struct SWcontext
+ * \brief  Per-context state that's private to the software rasterizer module.
+ */
+typedef struct
+{
+   /** Driver interface:
+    */
+   struct swrast_device_driver Driver;
+
+   /** Configuration mechanisms to make software rasterizer match
+    * characteristics of the hardware rasterizer (if present):
+    */
+   GLboolean AllowVertexFog;
+   GLboolean AllowPixelFog;
+
+   /** Derived values, invalidated on statechanges, updated from
+    * _swrast_validate_derived():
+    */
+   GLbitfield _RasterMask;
+   GLfloat _BackfaceSign;      /** +1 or -1 */
+   GLfloat _BackfaceCullSign;  /** +1, 0, or -1 */
+   GLboolean _PreferPixelFog;    /* Compute fog blend factor per fragment? */
+   GLboolean _TextureCombinePrimary;
+   GLboolean _FogEnabled;
+   GLboolean _DeferredTexture;
+
+   /** List/array of the fragment attributes to interpolate */
+   GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
+   /** Same info, but as a bitmask */
+   GLbitfield _ActiveAttribMask;
+   /** Number of fragment attributes to interpolate */
+   GLuint _NumActiveAttribs;
+   /** Indicates how each attrib is to be interpolated (lines/tris) */
+   GLenum _InterpMode[FRAG_ATTRIB_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */
+
+   /* Accum buffer temporaries.
+    */
+   GLboolean _IntegerAccumMode;	/**< Storing unscaled integers? */
+   GLfloat _IntegerAccumScaler;	/**< Implicit scale factor */
+
+   /* Working values:
+    */
+   GLuint StippleCounter;    /**< Line stipple counter */
+   GLuint PointLineFacing;
+   GLbitfield NewState;
+   GLuint StateChanges;
+   GLenum Primitive;    /* current primitive being drawn (ala glBegin) */
+   GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */
+
+   void (*InvalidateState)( struct gl_context *ctx, GLbitfield new_state );
+
+   /**
+    * When the NewState mask intersects these masks, we invalidate the
+    * Point/Line/Triangle function pointers below.
+    */
+   /*@{*/
+   GLbitfield InvalidatePointMask;
+   GLbitfield InvalidateLineMask;
+   GLbitfield InvalidateTriangleMask;
+   /*@}*/
+
+   /**
+    * Device drivers plug in functions for these callbacks.
+    * Will be called when the GL state change mask intersects the above masks.
+    */
+   /*@{*/
+   void (*choose_point)( struct gl_context * );
+   void (*choose_line)( struct gl_context * );
+   void (*choose_triangle)( struct gl_context * );
+   /*@}*/
+
+   /**
+    * Current point, line and triangle drawing functions.
+    */
+   /*@{*/
+   swrast_point_func Point;
+   swrast_line_func Line;
+   swrast_tri_func Triangle;
+   /*@}*/
+
+   /**
+    * Placeholders for when separate specular (or secondary color) is
+    * enabled but texturing is not.
+    */
+   /*@{*/
+   swrast_point_func SpecPoint;
+   swrast_line_func SpecLine;
+   swrast_tri_func SpecTriangle;
+   /*@}*/
+
+   /**
+    * Typically, we'll allocate a sw_span structure as a local variable
+    * and set its 'array' pointer to point to this object.  The reason is
+    * this object is big and causes problems when allocated on the stack
+    * on some systems.
+    */
+   SWspanarrays *SpanArrays;
+   SWspanarrays *ZoomedArrays;  /**< For pixel zooming */
+
+   /**
+    * Used to buffer N GL_POINTS, instead of rendering one by one.
+    */
+   SWspan PointSpan;
+
+   /** Internal hooks, kept up to date by the same mechanism as above.
+    */
+   blend_func BlendFunc;
+   texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS];
+
+   /** Buffer for saving the sampled texture colors.
+    * Needed for GL_ARB_texture_env_crossbar implementation.
+    */
+   GLfloat *TexelBuffer;
+
+   validate_texture_image_func ValidateTextureImage;
+
+   /** State used during execution of fragment programs */
+   struct gl_program_machine FragProgMachine;
+
+} SWcontext;
+
+
+extern void
+_swrast_validate_derived( struct gl_context *ctx );
+
+extern void
+_swrast_update_texture_samplers(struct gl_context *ctx);
+
+
+/** Return SWcontext for the given struct gl_context */
+static INLINE SWcontext *
+SWRAST_CONTEXT(struct gl_context *ctx)
+{
+   return (SWcontext *) ctx->swrast_context;
+}
+
+/** const version of above */
+static INLINE const SWcontext *
+CONST_SWRAST_CONTEXT(const struct gl_context *ctx)
+{
+   return (const SWcontext *) ctx->swrast_context;
+}
+
+
+/**
+ * Called prior to framebuffer reading/writing.
+ * For drivers that rely on swrast for fallback rendering, this is the
+ * driver's opportunity to map renderbuffers and textures.
+ */
+static INLINE void
+swrast_render_start(struct gl_context *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (swrast->Driver.SpanRenderStart)
+      swrast->Driver.SpanRenderStart(ctx);
+}
+
+
+/** Called after framebuffer reading/writing */
+static INLINE void
+swrast_render_finish(struct gl_context *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (swrast->Driver.SpanRenderFinish)
+      swrast->Driver.SpanRenderFinish(ctx);
+}
+
+
+
+/**
+ * Size of an RGBA pixel, in bytes, for given datatype.
+ */
+#define RGBA_PIXEL_SIZE(TYPE)                                     \
+         ((TYPE == GL_UNSIGNED_BYTE) ? 4 * sizeof(GLubyte) :      \
+          ((TYPE == GL_UNSIGNED_SHORT) ? 4 * sizeof(GLushort)     \
+           : 4 * sizeof(GLfloat)))
+
+
+
+/*
+ * Fixed point arithmetic macros
+ */
+#ifndef FIXED_FRAC_BITS
+#define FIXED_FRAC_BITS 11
+#endif
+
+#define FIXED_SHIFT     FIXED_FRAC_BITS
+#define FIXED_ONE       (1 << FIXED_SHIFT)
+#define FIXED_HALF      (1 << (FIXED_SHIFT-1))
+#define FIXED_FRAC_MASK (FIXED_ONE - 1)
+#define FIXED_INT_MASK  (~FIXED_FRAC_MASK)
+#define FIXED_EPSILON   1
+#define FIXED_SCALE     ((float) FIXED_ONE)
+#define FIXED_DBL_SCALE ((double) FIXED_ONE)
+#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
+#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
+#define IntToFixed(I)   ((I) << FIXED_SHIFT)
+#define FixedToInt(X)   ((X) >> FIXED_SHIFT)
+#define FixedToUns(X)   (((unsigned int)(X)) >> FIXED_SHIFT)
+#define FixedCeil(X)    (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
+#define FixedFloor(X)   ((X) & FIXED_INT_MASK)
+#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
+#define PosFloatToFixed(X)      FloatToFixed(X)
+#define SignedFloatToFixed(X)   FloatToFixed(X)
+
+
+
+/*
+ * XXX these macros are just bandages for now in order to make
+ * CHAN_BITS==32 compile cleanly.
+ * These should probably go elsewhere at some point.
+ */
+#if CHAN_TYPE == GL_FLOAT
+#define ChanToFixed(X)  (X)
+#define FixedToChan(X)  (X)
+#else
+#define ChanToFixed(X)  IntToFixed(X)
+#define FixedToChan(X)  FixedToInt(X)
+#endif
+
+
+/**
+ * For looping over fragment attributes in the pointe, line
+ * triangle rasterizers.
+ */
+#define ATTRIB_LOOP_BEGIN                                \
+   {                                                     \
+      GLuint a;                                          \
+      for (a = 0; a < swrast->_NumActiveAttribs; a++) {  \
+         const GLuint attr = swrast->_ActiveAttribs[a];
+
+#define ATTRIB_LOOP_END } }
+
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c
index 5acb5f4d1..ea59de160 100644
--- a/mesalib/src/mesa/swrast/s_fog.c
+++ b/mesalib/src/mesa/swrast/s_fog.c
@@ -1,244 +1,244 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.2
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "main/glheader.h"
-#include "main/colormac.h"
-#include "main/macros.h"
-
-#include "s_context.h"
-#include "s_fog.h"
-
-
-/**
- * Used to convert current raster distance to a fog factor in [0,1].
- */
-GLfloat
-_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z)
-{
-   GLfloat d, f;
-
-   switch (ctx->Fog.Mode) {
-   case GL_LINEAR:
-      if (ctx->Fog.Start == ctx->Fog.End)
-         d = 1.0F;
-      else
-         d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
-      f = (ctx->Fog.End - z) * d;
-      return CLAMP(f, 0.0F, 1.0F);
-   case GL_EXP:
-      d = ctx->Fog.Density;
-      f = EXPF(-d * z);
-      f = CLAMP(f, 0.0F, 1.0F);
-      return f;
-   case GL_EXP2:
-      d = ctx->Fog.Density;
-      f = EXPF(-(d * d * z * z));
-      f = CLAMP(f, 0.0F, 1.0F);
-      return f;
-   default:
-      _mesa_problem(ctx, "Bad fog mode in _swrast_z_to_fogfactor");
-      return 0.0; 
-   }
-}
-
-
-#define LINEAR_FOG(f, coord)  f = (fogEnd - coord) * fogScale
-
-#define EXP_FOG(f, coord)  f = EXPF(density * coord)
-
-#define EXP2_FOG(f, coord)				\
-do {							\
-   GLfloat tmp = negDensitySquared * coord * coord;	\
-   if (tmp < FLT_MIN_10_EXP)				\
-      tmp = FLT_MIN_10_EXP;				\
-   f = EXPF(tmp);					\
- } while(0)
-
-
-#define BLEND_FOG(f, coord)  f = coord
-
-
-
-/**
- * Template code for computing fog blend factor and applying it to colors.
- * \param TYPE  either GLubyte, GLushort or GLfloat.
- * \param COMPUTE_F  code to compute the fog blend factor, f.
- */
-#define FOG_LOOP(TYPE, FOG_FUNC)						\
-if (span->arrayAttribs & FRAG_BIT_FOGC) {					\
-   GLuint i;									\
-   for (i = 0; i < span->end; i++) {						\
-      const GLfloat fogCoord = span->array->attribs[FRAG_ATTRIB_FOGC][i][0];	\
-      const GLfloat c = FABSF(fogCoord);					\
-      GLfloat f, oneMinusF;							\
-      FOG_FUNC(f, c);								\
-      f = CLAMP(f, 0.0F, 1.0F);							\
-      oneMinusF = 1.0F - f;							\
-      rgba[i][RCOMP] = (TYPE) (f * rgba[i][RCOMP] + oneMinusF * rFog);		\
-      rgba[i][GCOMP] = (TYPE) (f * rgba[i][GCOMP] + oneMinusF * gFog);		\
-      rgba[i][BCOMP] = (TYPE) (f * rgba[i][BCOMP] + oneMinusF * bFog);		\
-   }										\
-}										\
-else {										\
-   const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];		\
-   GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];			\
-   const GLfloat wStep = span->attrStepX[FRAG_ATTRIB_WPOS][3];			\
-   GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3];				\
-   GLuint i;									\
-   for (i = 0; i < span->end; i++) {						\
-      const GLfloat c = FABSF(fogCoord) / w;					\
-      GLfloat f, oneMinusF;							\
-      FOG_FUNC(f, c);								\
-      f = CLAMP(f, 0.0F, 1.0F);							\
-      oneMinusF = 1.0F - f;							\
-      rgba[i][RCOMP] = (TYPE) (f * rgba[i][RCOMP] + oneMinusF * rFog);		\
-      rgba[i][GCOMP] = (TYPE) (f * rgba[i][GCOMP] + oneMinusF * gFog);		\
-      rgba[i][BCOMP] = (TYPE) (f * rgba[i][BCOMP] + oneMinusF * bFog);		\
-      fogCoord += fogStep;							\
-      w += wStep;								\
-   }										\
-}
-
-/**
- * Apply fog to a span of RGBA pixels.
- * The fog value are either in the span->array->fog array or interpolated from
- * the fog/fogStep values.
- * They fog values are either fog coordinates (Z) or fog blend factors.
- * _PreferPixelFog should be in sync with that state!
- */
-void
-_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
-{
-   const SWcontext *swrast = CONST_SWRAST_CONTEXT(ctx);
-   GLfloat rFog, gFog, bFog;
-
-   ASSERT(swrast->_FogEnabled);
-   ASSERT(span->arrayMask & SPAN_RGBA);
-
-   /* compute (scaled) fog color */
-   if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-      rFog = ctx->Fog.Color[RCOMP] * 255.0F;
-      gFog = ctx->Fog.Color[GCOMP] * 255.0F;
-      bFog = ctx->Fog.Color[BCOMP] * 255.0F;
-   }
-   else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
-      rFog = ctx->Fog.Color[RCOMP] * 65535.0F;
-      gFog = ctx->Fog.Color[GCOMP] * 65535.0F;
-      bFog = ctx->Fog.Color[BCOMP] * 65535.0F;
-   }
-   else {
-      rFog = ctx->Fog.Color[RCOMP];
-      gFog = ctx->Fog.Color[GCOMP];
-      bFog = ctx->Fog.Color[BCOMP];
-   }
-
-   if (swrast->_PreferPixelFog) {
-      /* The span's fog values are fog coordinates, now compute blend factors
-       * and blend the fragment colors with the fog color.
-       */
-      switch (swrast->_FogMode) {
-      case GL_LINEAR:
-         {
-            const GLfloat fogEnd = ctx->Fog.End;
-            const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End)
-               ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start);
-            if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-               GLubyte (*rgba)[4] = span->array->rgba8;
-               FOG_LOOP(GLubyte, LINEAR_FOG);
-            }
-            else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
-               GLushort (*rgba)[4] = span->array->rgba16;
-               FOG_LOOP(GLushort, LINEAR_FOG);
-            }
-            else {
-               GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
-               ASSERT(span->array->ChanType == GL_FLOAT);
-               FOG_LOOP(GLfloat, LINEAR_FOG);
-            }
-         }
-         break;
-
-      case GL_EXP:
-         {
-            const GLfloat density = -ctx->Fog.Density;
-            if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-               GLubyte (*rgba)[4] = span->array->rgba8;
-               FOG_LOOP(GLubyte, EXP_FOG);
-            }
-            else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
-               GLushort (*rgba)[4] = span->array->rgba16;
-               FOG_LOOP(GLushort, EXP_FOG);
-            }
-            else {
-               GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
-               ASSERT(span->array->ChanType == GL_FLOAT);
-               FOG_LOOP(GLfloat, EXP_FOG);
-            }
-         }
-         break;
-
-      case GL_EXP2:
-         {
-            const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density;
-            if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-               GLubyte (*rgba)[4] = span->array->rgba8;
-               FOG_LOOP(GLubyte, EXP2_FOG);
-            }
-            else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
-               GLushort (*rgba)[4] = span->array->rgba16;
-               FOG_LOOP(GLushort, EXP2_FOG);
-            }
-            else {
-               GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
-               ASSERT(span->array->ChanType == GL_FLOAT);
-               FOG_LOOP(GLfloat, EXP2_FOG);
-            }
-         }
-         break;
-
-      default:
-         _mesa_problem(ctx, "Bad fog mode in _swrast_fog_rgba_span");
-         return;
-      }
-   }
-   else {
-      /* The span's fog start/step/array values are blend factors in [0,1].
-       * They were previously computed per-vertex.
-       */
-      if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-         GLubyte (*rgba)[4] = span->array->rgba8;
-         FOG_LOOP(GLubyte, BLEND_FOG);
-      }
-      else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
-         GLushort (*rgba)[4] = span->array->rgba16;
-         FOG_LOOP(GLushort, BLEND_FOG);
-      }
-      else {
-         GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
-         ASSERT(span->array->ChanType == GL_FLOAT);
-         FOG_LOOP(GLfloat, BLEND_FOG);
-      }
-   }
-}
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.5.2
+ *
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+
+#include "s_context.h"
+#include "s_fog.h"
+
+
+/**
+ * Used to convert current raster distance to a fog factor in [0,1].
+ */
+GLfloat
+_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z)
+{
+   GLfloat d, f;
+
+   switch (ctx->Fog.Mode) {
+   case GL_LINEAR:
+      if (ctx->Fog.Start == ctx->Fog.End)
+         d = 1.0F;
+      else
+         d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
+      f = (ctx->Fog.End - z) * d;
+      return CLAMP(f, 0.0F, 1.0F);
+   case GL_EXP:
+      d = ctx->Fog.Density;
+      f = EXPF(-d * z);
+      f = CLAMP(f, 0.0F, 1.0F);
+      return f;
+   case GL_EXP2:
+      d = ctx->Fog.Density;
+      f = EXPF(-(d * d * z * z));
+      f = CLAMP(f, 0.0F, 1.0F);
+      return f;
+   default:
+      _mesa_problem(ctx, "Bad fog mode in _swrast_z_to_fogfactor");
+      return 0.0; 
+   }
+}
+
+
+#define LINEAR_FOG(f, coord)  f = (fogEnd - coord) * fogScale
+
+#define EXP_FOG(f, coord)  f = EXPF(density * coord)
+
+#define EXP2_FOG(f, coord)				\
+do {							\
+   GLfloat tmp = negDensitySquared * coord * coord;	\
+   if (tmp < FLT_MIN_10_EXP)				\
+      tmp = FLT_MIN_10_EXP;				\
+   f = EXPF(tmp);					\
+ } while(0)
+
+
+#define BLEND_FOG(f, coord)  f = coord
+
+
+
+/**
+ * Template code for computing fog blend factor and applying it to colors.
+ * \param TYPE  either GLubyte, GLushort or GLfloat.
+ * \param COMPUTE_F  code to compute the fog blend factor, f.
+ */
+#define FOG_LOOP(TYPE, FOG_FUNC)						\
+if (span->arrayAttribs & FRAG_BIT_FOGC) {					\
+   GLuint i;									\
+   for (i = 0; i < span->end; i++) {						\
+      const GLfloat fogCoord = span->array->attribs[FRAG_ATTRIB_FOGC][i][0];	\
+      const GLfloat c = FABSF(fogCoord);					\
+      GLfloat f, oneMinusF;							\
+      FOG_FUNC(f, c);								\
+      f = CLAMP(f, 0.0F, 1.0F);							\
+      oneMinusF = 1.0F - f;							\
+      rgba[i][RCOMP] = (TYPE) (f * rgba[i][RCOMP] + oneMinusF * rFog);		\
+      rgba[i][GCOMP] = (TYPE) (f * rgba[i][GCOMP] + oneMinusF * gFog);		\
+      rgba[i][BCOMP] = (TYPE) (f * rgba[i][BCOMP] + oneMinusF * bFog);		\
+   }										\
+}										\
+else {										\
+   const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0];		\
+   GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0];			\
+   const GLfloat wStep = span->attrStepX[FRAG_ATTRIB_WPOS][3];			\
+   GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3];				\
+   GLuint i;									\
+   for (i = 0; i < span->end; i++) {						\
+      const GLfloat c = FABSF(fogCoord) / w;					\
+      GLfloat f, oneMinusF;							\
+      FOG_FUNC(f, c);								\
+      f = CLAMP(f, 0.0F, 1.0F);							\
+      oneMinusF = 1.0F - f;							\
+      rgba[i][RCOMP] = (TYPE) (f * rgba[i][RCOMP] + oneMinusF * rFog);		\
+      rgba[i][GCOMP] = (TYPE) (f * rgba[i][GCOMP] + oneMinusF * gFog);		\
+      rgba[i][BCOMP] = (TYPE) (f * rgba[i][BCOMP] + oneMinusF * bFog);		\
+      fogCoord += fogStep;							\
+      w += wStep;								\
+   }										\
+}
+
+/**
+ * Apply fog to a span of RGBA pixels.
+ * The fog value are either in the span->array->fog array or interpolated from
+ * the fog/fogStep values.
+ * They fog values are either fog coordinates (Z) or fog blend factors.
+ * _PreferPixelFog should be in sync with that state!
+ */
+void
+_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
+{
+   const SWcontext *swrast = CONST_SWRAST_CONTEXT(ctx);
+   GLfloat rFog, gFog, bFog;
+
+   ASSERT(swrast->_FogEnabled);
+   ASSERT(span->arrayMask & SPAN_RGBA);
+
+   /* compute (scaled) fog color */
+   if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+      rFog = ctx->Fog.Color[RCOMP] * 255.0F;
+      gFog = ctx->Fog.Color[GCOMP] * 255.0F;
+      bFog = ctx->Fog.Color[BCOMP] * 255.0F;
+   }
+   else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
+      rFog = ctx->Fog.Color[RCOMP] * 65535.0F;
+      gFog = ctx->Fog.Color[GCOMP] * 65535.0F;
+      bFog = ctx->Fog.Color[BCOMP] * 65535.0F;
+   }
+   else {
+      rFog = ctx->Fog.Color[RCOMP];
+      gFog = ctx->Fog.Color[GCOMP];
+      bFog = ctx->Fog.Color[BCOMP];
+   }
+
+   if (swrast->_PreferPixelFog) {
+      /* The span's fog values are fog coordinates, now compute blend factors
+       * and blend the fragment colors with the fog color.
+       */
+      switch (ctx->Fog.Mode) {
+      case GL_LINEAR:
+         {
+            const GLfloat fogEnd = ctx->Fog.End;
+            const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End)
+               ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start);
+            if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+               GLubyte (*rgba)[4] = span->array->rgba8;
+               FOG_LOOP(GLubyte, LINEAR_FOG);
+            }
+            else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
+               GLushort (*rgba)[4] = span->array->rgba16;
+               FOG_LOOP(GLushort, LINEAR_FOG);
+            }
+            else {
+               GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+               ASSERT(span->array->ChanType == GL_FLOAT);
+               FOG_LOOP(GLfloat, LINEAR_FOG);
+            }
+         }
+         break;
+
+      case GL_EXP:
+         {
+            const GLfloat density = -ctx->Fog.Density;
+            if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+               GLubyte (*rgba)[4] = span->array->rgba8;
+               FOG_LOOP(GLubyte, EXP_FOG);
+            }
+            else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
+               GLushort (*rgba)[4] = span->array->rgba16;
+               FOG_LOOP(GLushort, EXP_FOG);
+            }
+            else {
+               GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+               ASSERT(span->array->ChanType == GL_FLOAT);
+               FOG_LOOP(GLfloat, EXP_FOG);
+            }
+         }
+         break;
+
+      case GL_EXP2:
+         {
+            const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density;
+            if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+               GLubyte (*rgba)[4] = span->array->rgba8;
+               FOG_LOOP(GLubyte, EXP2_FOG);
+            }
+            else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
+               GLushort (*rgba)[4] = span->array->rgba16;
+               FOG_LOOP(GLushort, EXP2_FOG);
+            }
+            else {
+               GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+               ASSERT(span->array->ChanType == GL_FLOAT);
+               FOG_LOOP(GLfloat, EXP2_FOG);
+            }
+         }
+         break;
+
+      default:
+         _mesa_problem(ctx, "Bad fog mode in _swrast_fog_rgba_span");
+         return;
+      }
+   }
+   else {
+      /* The span's fog start/step/array values are blend factors in [0,1].
+       * They were previously computed per-vertex.
+       */
+      if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+         GLubyte (*rgba)[4] = span->array->rgba8;
+         FOG_LOOP(GLubyte, BLEND_FOG);
+      }
+      else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
+         GLushort (*rgba)[4] = span->array->rgba16;
+         FOG_LOOP(GLushort, BLEND_FOG);
+      }
+      else {
+         GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+         ASSERT(span->array->ChanType == GL_FLOAT);
+         FOG_LOOP(GLfloat, BLEND_FOG);
+      }
+   }
+}
diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c
index 5c8d7e9c5..214f2ea1a 100644
--- a/mesalib/src/mesa/swrast/s_readpix.c
+++ b/mesalib/src/mesa/swrast/s_readpix.c
@@ -191,7 +191,13 @@ fast_read_rgba_pixels( struct gl_context *ctx,
    if (!rb)
       return GL_FALSE;
 
-   ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB ||
+   ASSERT(rb->_BaseFormat == GL_RGBA ||
+	  rb->_BaseFormat == GL_RGB ||
+	  rb->_BaseFormat == GL_RG ||
+	  rb->_BaseFormat == GL_RED ||
+	  rb->_BaseFormat == GL_LUMINANCE ||
+	  rb->_BaseFormat == GL_INTENSITY ||
+	  rb->_BaseFormat == GL_LUMINANCE_ALPHA ||
 	  rb->_BaseFormat == GL_ALPHA);
 
    /* clipping should have already been done */
@@ -312,12 +318,12 @@ read_rgba_pixels( struct gl_context *ctx,
    if (!rb)
       return;
 
-   if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) ||
-                            (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
-                             rb->DataType != GL_FLOAT)))
+   if ((ctx->Color._ClampReadColor == GL_TRUE || type != GL_FLOAT) &&
+       !_mesa_is_integer_format(format)) {
       transferOps |= IMAGE_CLAMP_BIT;
+   }
 
-   /* Try optimized path first */
+   /* Try the optimized path first. */
    if (fast_read_rgba_pixels(ctx, x, y, width, height,
                              format, type, pixels, packing, transferOps)) {
       return; /* done! */
@@ -341,9 +347,9 @@ read_rgba_pixels( struct gl_context *ctx,
          _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, rgba);
 
          /* apply fudge factor for shallow color buffers */
-         if (fb->Visual.redBits < 8 ||
-             fb->Visual.greenBits < 8 ||
-             fb->Visual.blueBits < 8) {
+         if ((fb->Visual.redBits < 8 && fb->Visual.redBits != 0) ||
+             (fb->Visual.greenBits < 8 && fb->Visual.greenBits != 0) ||
+	     (fb->Visual.blueBits < 8 && fb->Visual.blueBits != 0)) {
             adjust_colors(fb, width, rgba);
          }
 
diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c
index 9cfecc9e3..f0524e061 100644
--- a/mesalib/src/mesa/swrast/s_span.c
+++ b/mesalib/src/mesa/swrast/s_span.c
@@ -1348,7 +1348,13 @@ _swrast_read_rgba_span( struct gl_context *ctx, struct gl_renderbuffer *rb,
 
       ASSERT(rb);
       ASSERT(rb->GetRow);
-      ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA ||
+      ASSERT(rb->_BaseFormat == GL_RGBA ||
+	     rb->_BaseFormat == GL_RGB ||
+	     rb->_BaseFormat == GL_RG ||
+	     rb->_BaseFormat == GL_RED ||
+	     rb->_BaseFormat == GL_LUMINANCE ||
+	     rb->_BaseFormat == GL_INTENSITY ||
+	     rb->_BaseFormat == GL_LUMINANCE_ALPHA ||
 	     rb->_BaseFormat == GL_ALPHA);
 
       if (rb->DataType == dstType) {
diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c
index 9faa54fdf..a6da8cafe 100644
--- a/mesalib/src/mesa/tnl/t_context.c
+++ b/mesalib/src/mesa/tnl/t_context.c
@@ -1,224 +1,220 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.2
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 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
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *    Keith Whitwell <keith@tungstengraphics.com>
- */
-
-
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/context.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "main/light.h"
-#include "math/m_translate.h"
-#include "math/m_xform.h"
-#include "main/state.h"
-
-#include "tnl.h"
-#include "t_context.h"
-#include "t_pipeline.h"
-
-#include "vbo/vbo.h"
-
-GLboolean
-_tnl_CreateContext( struct gl_context *ctx )
-{
-   TNLcontext *tnl;
-
-   /* Create the TNLcontext structure
-    */
-   ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) );
-
-   if (!tnl) {
-      return GL_FALSE;
-   }
-
-   /* Initialize the VB.
-    */
-   tnl->vb.Size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES;
-
-
-   /* Initialize tnl state.
-    */
-   if (ctx->VertexProgram._MaintainTnlProgram) {
-      _tnl_install_pipeline( ctx, _tnl_vp_pipeline );
-   } else {
-      _tnl_install_pipeline( ctx, _tnl_default_pipeline );
-   }
-
-   tnl->NeedNdcCoords = GL_TRUE;
-   tnl->AllowVertexFog = GL_TRUE;
-   tnl->AllowPixelFog = GL_TRUE;
-
-   /* Set a few default values in the driver struct.
-    */
-   tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
-   tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
-   tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables;
-
-   tnl->nr_blocks = 0;
-
-   /* plug in the VBO drawing function */
-   vbo_set_draw_func(ctx, _tnl_vbo_draw_prims);
-
-   _math_init_transformation();
-   _math_init_translate();
-
-   return GL_TRUE;
-}
-
-
-void
-_tnl_DestroyContext( struct gl_context *ctx )
-{
-   TNLcontext *tnl = TNL_CONTEXT(ctx);
-
-   _tnl_destroy_pipeline( ctx );
-
-   FREE(tnl);
-   ctx->swtnl_context = NULL;
-}
-
-
-void
-_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
-{
-   TNLcontext *tnl = TNL_CONTEXT(ctx);
-   const struct gl_vertex_program *vp = ctx->VertexProgram._Current;
-   const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
-   GLuint i;
-
-   if (new_state & (_NEW_HINT | _NEW_PROGRAM)) {
-      ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog);
-      tnl->_DoVertexFog = ((tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
-         || !tnl->AllowPixelFog) && !fp;
-   }
-
-   tnl->pipeline.new_state |= new_state;
-
-   /* Calculate tnl->render_inputs.  This bitmask indicates which vertex
-    * attributes need to be emitted to the rasterizer.
-    */
-   RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
-   RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
-
-   if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) {
-     RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
-   }
-
-   if (_mesa_need_secondary_color(ctx))
-     RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
-
-   for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
-     if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
-	 (fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) {
-       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
-     }
-   }
-
-   if (ctx->Fog.Enabled) {
-      /* fixed-function fog */
-      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
-   }
-   else if (fp) {
-      if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
-         /* fragment program needs fog coord */
-         RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
-      }
-   }
-
-   if (ctx->Polygon.FrontMode != GL_FILL || 
-       ctx->Polygon.BackMode != GL_FILL)
-      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_EDGEFLAG );
-
-   if (ctx->RenderMode == GL_FEEDBACK)
-      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 );
-
-   if (ctx->Point._Attenuated ||
-       (ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
-      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE );
-
-   /* check for varying vars which are written by the vertex program */
-   if (vp) {
-      GLuint i;
-      for (i = 0; i < MAX_VARYING; i++) {
-	 if (vp->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) {
-            RENDERINPUTS_SET(tnl->render_inputs_bitset,
-                             _TNL_ATTRIB_GENERIC(i));
-         }
-      }
-   }
-}
-
-
-void
-_tnl_wakeup( struct gl_context *ctx )
-{
-   /* Assume we haven't been getting state updates either:
-    */
-   _tnl_InvalidateState( ctx, ~0 );
-
-#if 0
-   if (ctx->Light.ColorMaterialEnabled) {
-      _mesa_update_color_material( ctx, 
-				   ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
-   }
-#endif
-}
-
-
-
-
-/**
- * Drivers call this function to tell the TCL module whether or not
- * it wants Normalized Device Coords (NDC) computed.  I.e. whether
- * we should "Divide-by-W".  Software renders will want that.
- */
-void
-_tnl_need_projected_coords( struct gl_context *ctx, GLboolean mode )
-{
-   TNLcontext *tnl = TNL_CONTEXT(ctx);
-   tnl->NeedNdcCoords = mode;
-}
-
-void
-_tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
-{
-   TNLcontext *tnl = TNL_CONTEXT(ctx);
-   tnl->AllowVertexFog = value;
-   tnl->_DoVertexFog = ((tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
-      || !tnl->AllowPixelFog) && !ctx->FragmentProgram._Current;
-
-}
-
-void
-_tnl_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
-{
-   TNLcontext *tnl = TNL_CONTEXT(ctx);
-   tnl->AllowPixelFog = value;
-   tnl->_DoVertexFog = ((tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
-      || !tnl->AllowPixelFog) && !ctx->FragmentProgram._Current;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.2
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 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
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
+#include "main/light.h"
+#include "math/m_translate.h"
+#include "math/m_xform.h"
+#include "main/state.h"
+
+#include "tnl.h"
+#include "t_context.h"
+#include "t_pipeline.h"
+
+#include "vbo/vbo.h"
+
+GLboolean
+_tnl_CreateContext( struct gl_context *ctx )
+{
+   TNLcontext *tnl;
+
+   /* Create the TNLcontext structure
+    */
+   ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) );
+
+   if (!tnl) {
+      return GL_FALSE;
+   }
+
+   /* Initialize the VB.
+    */
+   tnl->vb.Size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES;
+
+
+   /* Initialize tnl state.
+    */
+   if (ctx->VertexProgram._MaintainTnlProgram) {
+      _tnl_install_pipeline( ctx, _tnl_vp_pipeline );
+   } else {
+      _tnl_install_pipeline( ctx, _tnl_default_pipeline );
+   }
+
+   tnl->NeedNdcCoords = GL_TRUE;
+   tnl->AllowVertexFog = GL_TRUE;
+   tnl->AllowPixelFog = GL_TRUE;
+
+   /* Set a few default values in the driver struct.
+    */
+   tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
+   tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
+   tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables;
+
+   tnl->nr_blocks = 0;
+
+   /* plug in the VBO drawing function */
+   vbo_set_draw_func(ctx, _tnl_vbo_draw_prims);
+
+   _math_init_transformation();
+   _math_init_translate();
+
+   return GL_TRUE;
+}
+
+
+void
+_tnl_DestroyContext( struct gl_context *ctx )
+{
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+
+   _tnl_destroy_pipeline( ctx );
+
+   FREE(tnl);
+   ctx->swtnl_context = NULL;
+}
+
+
+void
+_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
+{
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+   const struct gl_vertex_program *vp = ctx->VertexProgram._Current;
+   const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+   GLuint i;
+
+   if (new_state & (_NEW_HINT | _NEW_PROGRAM)) {
+      ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog);
+      tnl->_DoVertexFog = ((tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
+         || !tnl->AllowPixelFog) && !fp;
+   }
+
+   tnl->pipeline.new_state |= new_state;
+
+   /* Calculate tnl->render_inputs.  This bitmask indicates which vertex
+    * attributes need to be emitted to the rasterizer.
+    */
+   RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
+   RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+
+   if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) {
+     RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
+   }
+
+   if (_mesa_need_secondary_color(ctx))
+     RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
+
+   for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+     if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
+	 (fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) {
+       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
+     }
+   }
+
+   if (ctx->Fog.Enabled
+       || (fp != NULL && (fp->Base.InputsRead & FRAG_BIT_FOGC) != 0)) {
+      /* Either fixed-function fog or a fragment program needs fog coord.
+       */
+      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
+   }
+
+   if (ctx->Polygon.FrontMode != GL_FILL || 
+       ctx->Polygon.BackMode != GL_FILL)
+      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_EDGEFLAG );
+
+   if (ctx->RenderMode == GL_FEEDBACK)
+      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 );
+
+   if (ctx->Point._Attenuated ||
+       (ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
+      RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE );
+
+   /* check for varying vars which are written by the vertex program */
+   if (vp) {
+      GLuint i;
+      for (i = 0; i < MAX_VARYING; i++) {
+	 if (vp->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) {
+            RENDERINPUTS_SET(tnl->render_inputs_bitset,
+                             _TNL_ATTRIB_GENERIC(i));
+         }
+      }
+   }
+}
+
+
+void
+_tnl_wakeup( struct gl_context *ctx )
+{
+   /* Assume we haven't been getting state updates either:
+    */
+   _tnl_InvalidateState( ctx, ~0 );
+
+#if 0
+   if (ctx->Light.ColorMaterialEnabled) {
+      _mesa_update_color_material( ctx, 
+				   ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
+   }
+#endif
+}
+
+
+
+
+/**
+ * Drivers call this function to tell the TCL module whether or not
+ * it wants Normalized Device Coords (NDC) computed.  I.e. whether
+ * we should "Divide-by-W".  Software renders will want that.
+ */
+void
+_tnl_need_projected_coords( struct gl_context *ctx, GLboolean mode )
+{
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+   tnl->NeedNdcCoords = mode;
+}
+
+void
+_tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
+{
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+   tnl->AllowVertexFog = value;
+   tnl->_DoVertexFog = ((tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
+      || !tnl->AllowPixelFog) && !ctx->FragmentProgram._Current;
+
+}
+
+void
+_tnl_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
+{
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+   tnl->AllowPixelFog = value;
+   tnl->_DoVertexFog = ((tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
+      || !tnl->AllowPixelFog) && !ctx->FragmentProgram._Current;
+}
+
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index a189ab76b..a49cd5017 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -1,1341 +1,1337 @@
-/**************************************************************************
- * 
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
- * 
- **************************************************************************/
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/state.h"
-#include "main/api_validate.h"
-#include "main/varray.h"
-#include "main/bufferobj.h"
-#include "main/enums.h"
-#include "main/macros.h"
-
-#include "vbo_context.h"
-
-
-/**
- * All vertex buffers should be in an unmapped state when we're about
- * to draw.  This debug function checks that.
- */
-static void
-check_buffers_are_unmapped(const struct gl_client_array **inputs)
-{
-#ifdef DEBUG
-   GLuint i;
-
-   for (i = 0; i < VERT_ATTRIB_MAX; i++) {
-      if (inputs[i]) {
-         struct gl_buffer_object *obj = inputs[i]->BufferObj;
-         assert(!_mesa_bufferobj_mapped(obj));
-         (void) obj;
-      }
-   }
-#endif
-}
-
-
-/**
- * A debug function that may be called from other parts of Mesa as
- * needed during debugging.
- */
-void
-vbo_check_buffers_are_unmapped(struct gl_context *ctx)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   /* check the current vertex arrays */
-   check_buffers_are_unmapped(exec->array.inputs);
-   /* check the current glBegin/glVertex/glEnd-style VBO */
-   assert(!_mesa_bufferobj_mapped(exec->vtx.bufferobj));
-}
-
-
-
-/**
- * Compute min and max elements by scanning the index buffer for
- * glDraw[Range]Elements() calls.
- * If primitive restart is enabled, we need to ignore restart
- * indexes when computing min/max.
- */
-void
-vbo_get_minmax_index(struct gl_context *ctx,
-		     const struct _mesa_prim *prim,
-		     const struct _mesa_index_buffer *ib,
-		     GLuint *min_index, GLuint *max_index)
-{
-   const GLboolean restart = ctx->Array.PrimitiveRestart;
-   const GLuint restartIndex = ctx->Array.RestartIndex;
-   const GLuint count = prim->count;
-   const void *indices;
-   GLuint i;
-
-   if (_mesa_is_bufferobj(ib->obj)) {
-      const GLvoid *map =
-         ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
-                               GL_READ_ONLY, ib->obj);
-      indices = ADD_POINTERS(map, ib->ptr);
-   } else {
-      indices = ib->ptr;
-   }
-
-   switch (ib->type) {
-   case GL_UNSIGNED_INT: {
-      const GLuint *ui_indices = (const GLuint *)indices;
-      GLuint max_ui = 0;
-      GLuint min_ui = ~0U;
-      if (restart) {
-         for (i = 0; i < count; i++) {
-            if (ui_indices[i] != restartIndex) {
-               if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
-               if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
-            }
-         }
-      }
-      else {
-         for (i = 0; i < count; i++) {
-            if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
-            if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
-         }
-      }
-      *min_index = min_ui;
-      *max_index = max_ui;
-      break;
-   }
-   case GL_UNSIGNED_SHORT: {
-      const GLushort *us_indices = (const GLushort *)indices;
-      GLuint max_us = 0;
-      GLuint min_us = ~0U;
-      if (restart) {
-         for (i = 0; i < count; i++) {
-            if (us_indices[i] != restartIndex) {
-               if (us_indices[i] > max_us) max_us = us_indices[i];
-               if (us_indices[i] < min_us) min_us = us_indices[i];
-            }
-         }
-      }
-      else {
-         for (i = 0; i < count; i++) {
-            if (us_indices[i] > max_us) max_us = us_indices[i];
-            if (us_indices[i] < min_us) min_us = us_indices[i];
-         }
-      }
-      *min_index = min_us;
-      *max_index = max_us;
-      break;
-   }
-   case GL_UNSIGNED_BYTE: {
-      const GLubyte *ub_indices = (const GLubyte *)indices;
-      GLuint max_ub = 0;
-      GLuint min_ub = ~0U;
-      if (restart) {
-         for (i = 0; i < count; i++) {
-            if (ub_indices[i] != restartIndex) {
-               if (ub_indices[i] > max_ub) max_ub = ub_indices[i];
-               if (ub_indices[i] < min_ub) min_ub = ub_indices[i];
-            }
-         }
-      }
-      else {
-         for (i = 0; i < count; i++) {
-            if (ub_indices[i] > max_ub) max_ub = ub_indices[i];
-            if (ub_indices[i] < min_ub) min_ub = ub_indices[i];
-         }
-      }
-      *min_index = min_ub;
-      *max_index = max_ub;
-      break;
-   }
-   default:
-      assert(0);
-      break;
-   }
-
-   if (_mesa_is_bufferobj(ib->obj)) {
-      ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, ib->obj);
-   }
-}
-
-
-/**
- * Check that element 'j' of the array has reasonable data.
- * Map VBO if needed.
- * For debugging purposes; not normally used.
- */
-static void
-check_array_data(struct gl_context *ctx, struct gl_client_array *array,
-                 GLuint attrib, GLuint j)
-{
-   if (array->Enabled) {
-      const void *data = array->Ptr;
-      if (_mesa_is_bufferobj(array->BufferObj)) {
-         if (!array->BufferObj->Pointer) {
-            /* need to map now */
-            array->BufferObj->Pointer =
-               ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
-                                     GL_READ_ONLY, array->BufferObj);
-         }
-         data = ADD_POINTERS(data, array->BufferObj->Pointer);
-      }
-      switch (array->Type) {
-      case GL_FLOAT:
-         {
-            GLfloat *f = (GLfloat *) ((GLubyte *) data + array->StrideB * j);
-            GLint k;
-            for (k = 0; k < array->Size; k++) {
-               if (IS_INF_OR_NAN(f[k]) ||
-                   f[k] >= 1.0e20 || f[k] <= -1.0e10) {
-                  printf("Bad array data:\n");
-                  printf("  Element[%u].%u = %f\n", j, k, f[k]);
-                  printf("  Array %u at %p\n", attrib, (void* ) array);
-                  printf("  Type 0x%x, Size %d, Stride %d\n",
-			 array->Type, array->Size, array->Stride);
-                  printf("  Address/offset %p in Buffer Object %u\n",
-			 array->Ptr, array->BufferObj->Name);
-                  f[k] = 1.0; /* XXX replace the bad value! */
-               }
-               /*assert(!IS_INF_OR_NAN(f[k]));*/
-            }
-         }
-         break;
-      default:
-         ;
-      }
-   }
-}
-
-
-/**
- * Unmap the buffer object referenced by given array, if mapped.
- */
-static void
-unmap_array_buffer(struct gl_context *ctx, struct gl_client_array *array)
-{
-   if (array->Enabled &&
-       _mesa_is_bufferobj(array->BufferObj) &&
-       _mesa_bufferobj_mapped(array->BufferObj)) {
-      ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, array->BufferObj);
-   }
-}
-
-
-/**
- * Examine the array's data for NaNs, etc.
- * For debug purposes; not normally used.
- */
-static void
-check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
-                         const void *elements, GLint basevertex)
-{
-   struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
-   const void *elemMap;
-   GLint i, k;
-
-   if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
-      elemMap = ctx->Driver.MapBuffer(ctx,
-                                      GL_ELEMENT_ARRAY_BUFFER_ARB,
-                                      GL_READ_ONLY,
-                                      ctx->Array.ElementArrayBufferObj);
-      elements = ADD_POINTERS(elements, elemMap);
-   }
-
-   for (i = 0; i < count; i++) {
-      GLuint j;
-
-      /* j = element[i] */
-      switch (elemType) {
-      case GL_UNSIGNED_BYTE:
-         j = ((const GLubyte *) elements)[i];
-         break;
-      case GL_UNSIGNED_SHORT:
-         j = ((const GLushort *) elements)[i];
-         break;
-      case GL_UNSIGNED_INT:
-         j = ((const GLuint *) elements)[i];
-         break;
-      default:
-         assert(0);
-      }
-
-      /* check element j of each enabled array */
-      check_array_data(ctx, &arrayObj->Vertex, VERT_ATTRIB_POS, j);
-      check_array_data(ctx, &arrayObj->Normal, VERT_ATTRIB_NORMAL, j);
-      check_array_data(ctx, &arrayObj->Color, VERT_ATTRIB_COLOR0, j);
-      check_array_data(ctx, &arrayObj->SecondaryColor, VERT_ATTRIB_COLOR1, j);
-      for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
-         check_array_data(ctx, &arrayObj->TexCoord[k], VERT_ATTRIB_TEX0 + k, j);
-      }
-      for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
-         check_array_data(ctx, &arrayObj->VertexAttrib[k],
-                          VERT_ATTRIB_GENERIC0 + k, j);
-      }
-   }
-
-   if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
-      ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
-			      ctx->Array.ElementArrayBufferObj);
-   }
-
-   unmap_array_buffer(ctx, &arrayObj->Vertex);
-   unmap_array_buffer(ctx, &arrayObj->Normal);
-   unmap_array_buffer(ctx, &arrayObj->Color);
-   for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
-      unmap_array_buffer(ctx, &arrayObj->TexCoord[k]);
-   }
-   for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
-      unmap_array_buffer(ctx, &arrayObj->VertexAttrib[k]);
-   }
-}
-
-
-/**
- * Check array data, looking for NaNs, etc.
- */
-static void
-check_draw_arrays_data(struct gl_context *ctx, GLint start, GLsizei count)
-{
-   /* TO DO */
-}
-
-
-/**
- * Print info/data for glDrawArrays(), for debugging.
- */
-static void
-print_draw_arrays(struct gl_context *ctx,
-                  GLenum mode, GLint start, GLsizei count)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   int i;
-
-   printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
-	  mode, start, count);
-
-   for (i = 0; i < 32; i++) {
-      GLuint bufName = exec->array.inputs[i]->BufferObj->Name;
-      GLint stride = exec->array.inputs[i]->Stride;
-      printf("attr %2d: size %d stride %d  enabled %d  "
-	     "ptr %p  Bufobj %u\n",
-	     i,
-	     exec->array.inputs[i]->Size,
-	     stride,
-	     /*exec->array.inputs[i]->Enabled,*/
-	     exec->array.legacy_array[i]->Enabled,
-	     exec->array.inputs[i]->Ptr,
-	     bufName);
-
-      if (bufName) {
-         struct gl_buffer_object *buf = _mesa_lookup_bufferobj(ctx, bufName);
-         GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
-                                            GL_READ_ONLY_ARB, buf);
-         int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr;
-         float *f = (float *) (p + offset);
-         int *k = (int *) f;
-         int i;
-         int n = (count * stride) / 4;
-         if (n > 32)
-            n = 32;
-         printf("  Data at offset %d:\n", offset);
-         for (i = 0; i < n; i++) {
-            printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
-         }
-         ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, buf);
-      }
-   }
-}
-
-
-/**
- * Bind the VBO executor to the current vertex array object prior
- * to drawing.
- *
- * Just translate the arrayobj into a sane layout.
- */
-static void
-bind_array_obj(struct gl_context *ctx)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
-   GLuint i;
-
-   /* TODO: Fix the ArrayObj struct to keep legacy arrays in an array
-    * rather than as individual named arrays.  Then this function can
-    * go away.
-    */
-   exec->array.legacy_array[VERT_ATTRIB_POS] = &arrayObj->Vertex;
-   exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &arrayObj->Weight;
-   exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &arrayObj->Normal;
-   exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &arrayObj->Color;
-   exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &arrayObj->SecondaryColor;
-   exec->array.legacy_array[VERT_ATTRIB_FOG] = &arrayObj->FogCoord;
-   exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &arrayObj->Index;
-   if (arrayObj->PointSize.Enabled) {
-      /* this aliases COLOR_INDEX */
-      exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &arrayObj->PointSize;
-   }
-   exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag;
-
-   for (i = 0; i < Elements(arrayObj->TexCoord); i++)
-      exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i];
-
-   for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) {
-      assert(i < Elements(exec->array.generic_array));
-      exec->array.generic_array[i] = &arrayObj->VertexAttrib[i];
-   }
-   
-   exec->array.array_obj = arrayObj->Name;
-}
-
-
-/**
- * Set the vbo->exec->inputs[] pointers to point to the enabled
- * vertex arrays.  This depends on the current vertex program/shader
- * being executed because of whether or not generic vertex arrays
- * alias the conventional vertex arrays.
- * For arrays that aren't enabled, we set the input[attrib] pointer
- * to point at a zero-stride current value "array".
- */
-static void
-recalculate_input_bindings(struct gl_context *ctx)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   const struct gl_client_array **inputs = &exec->array.inputs[0];
-   GLbitfield const_inputs = 0x0;
-   GLuint i;
-
-   exec->array.program_mode = get_program_mode(ctx);
-   exec->array.enabled_flags = ctx->Array.ArrayObj->_Enabled;
-
-   switch (exec->array.program_mode) {
-   case VP_NONE:
-      /* When no vertex program is active (or the vertex program is generated
-       * from fixed-function state).  We put the material values into the
-       * generic slots.  This is the only situation where material values
-       * are available as per-vertex attributes.
-       */
-      for (i = 0; i <= VERT_ATTRIB_TEX7; i++) {
-	 if (exec->array.legacy_array[i]->Enabled)
-	    inputs[i] = exec->array.legacy_array[i];
-	 else {
-	    inputs[i] = &vbo->legacy_currval[i];
-            const_inputs |= 1 << i;
-         }
-      }
-
-      for (i = 0; i < MAT_ATTRIB_MAX; i++) {
-	 inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->mat_currval[i];
-         const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
-      }
-
-      /* Could use just about anything, just to fill in the empty
-       * slots:
-       */
-      for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_MAX - VERT_ATTRIB_GENERIC0; i++) {
-	 inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
-         const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
-      }
-
-      /* There is no need to make _NEW_ARRAY dirty here for the TnL program,
-       * because it already takes care of invalidating the state necessary
-       * to revalidate vertex arrays. Not marking the state as dirty also
-       * improves performance (quite significantly in some apps).
-       */
-      if (!ctx->VertexProgram._MaintainTnlProgram)
-         ctx->NewState |= _NEW_ARRAY;
-      break;
-
-   case VP_NV:
-      /* NV_vertex_program - attribute arrays alias and override
-       * conventional, legacy arrays.  No materials, and the generic
-       * slots are vacant.
-       */
-      for (i = 0; i <= VERT_ATTRIB_TEX7; i++) {
-	 if (exec->array.generic_array[i]->Enabled)
-	    inputs[i] = exec->array.generic_array[i];
-	 else if (exec->array.legacy_array[i]->Enabled)
-	    inputs[i] = exec->array.legacy_array[i];
-	 else {
-	    inputs[i] = &vbo->legacy_currval[i];
-            const_inputs |= 1 << i;
-         }
-      }
-
-      /* Could use just about anything, just to fill in the empty
-       * slots:
-       */
-      for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
-	 inputs[i] = &vbo->generic_currval[i - VERT_ATTRIB_GENERIC0];
-         const_inputs |= 1 << i;
-      }
-
-      ctx->NewState |= _NEW_ARRAY;
-      break;
-
-   case VP_ARB:
-      /* GL_ARB_vertex_program or GLSL vertex shader - Only the generic[0]
-       * attribute array aliases and overrides the legacy position array.  
-       *
-       * Otherwise, legacy attributes available in the legacy slots,
-       * generic attributes in the generic slots and materials are not
-       * available as per-vertex attributes.
-       */
-      if (exec->array.generic_array[0]->Enabled)
-	 inputs[0] = exec->array.generic_array[0];
-      else if (exec->array.legacy_array[0]->Enabled)
-	 inputs[0] = exec->array.legacy_array[0];
-      else {
-	 inputs[0] = &vbo->legacy_currval[0];
-         const_inputs |= 1 << 0;
-      }
-
-      for (i = 1; i <= VERT_ATTRIB_TEX7; i++) {
-	 if (exec->array.legacy_array[i]->Enabled)
-	    inputs[i] = exec->array.legacy_array[i];
-	 else {
-	    inputs[i] = &vbo->legacy_currval[i];
-            const_inputs |= 1 << i;
-         }
-      }
-
-      for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) {
-	 if (exec->array.generic_array[i]->Enabled)
-	    inputs[VERT_ATTRIB_GENERIC0 + i] = exec->array.generic_array[i];
-	 else {
-	    inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
-            const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
-         }
-      }
-
-      ctx->NewState |= _NEW_ARRAY;
-      break;
-   }
-
-   _mesa_set_varying_vp_inputs( ctx, ~const_inputs );
-}
-
-
-/**
- * Examine the enabled vertex arrays to set the exec->array.inputs[] values.
- * These will point to the arrays to actually use for drawing.  Some will
- * be user-provided arrays, other will be zero-stride const-valued arrays.
- * Note that this might set the _NEW_ARRAY dirty flag so state validation
- * must be done after this call.
- */
-static void
-bind_arrays(struct gl_context *ctx)
-{
-   if (!ctx->Array.RebindArrays) {
-      return;
-   }
-
-   bind_array_obj(ctx);
-   recalculate_input_bindings(ctx);
-   ctx->Array.RebindArrays = GL_FALSE;
-}
-
-
-/**
- * Helper function called by the other DrawArrays() functions below.
- * This is where we handle primitive restart for drawing non-indexed
- * arrays.  If primitive restart is enabled, it typically means
- * splitting one DrawArrays() into two.
- */
-static void
-vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
-                GLsizei count, GLuint numInstances)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   struct _mesa_prim prim[2];
-
-   bind_arrays(ctx);
-
-   /* Again... because we may have changed the bitmask of per-vertex varying
-    * attributes.  If we regenerate the fixed-function vertex program now
-    * we may be able to prune down the number of vertex attributes which we
-    * need in the shader.
-    */
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
-
-   prim[0].begin = 1;
-   prim[0].end = 1;
-   prim[0].weak = 0;
-   prim[0].pad = 0;
-   prim[0].mode = mode;
-   prim[0].start = 0; /* filled in below */
-   prim[0].count = 0; /* filled in below */
-   prim[0].indexed = 0;
-   prim[0].basevertex = 0;
-   prim[0].num_instances = numInstances;
-
-   /* Implement the primitive restart index */
-   if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
-      GLuint primCount = 0;
-
-      if (ctx->Array.RestartIndex == start) {
-         /* special case: RestartIndex at beginning */
-         if (count > 1) {
-            prim[0].start = start + 1;
-            prim[0].count = count - 1;
-            primCount = 1;
-         }
-      }
-      else if (ctx->Array.RestartIndex == start + count - 1) {
-         /* special case: RestartIndex at end */
-         if (count > 1) {
-            prim[0].start = start;
-            prim[0].count = count - 1;
-            primCount = 1;
-         }
-      }
-      else {
-         /* general case: RestartIndex in middle, split into two prims */
-         prim[0].start = start;
-         prim[0].count = ctx->Array.RestartIndex - start;
-
-         prim[1] = prim[0];
-         prim[1].start = ctx->Array.RestartIndex + 1;
-         prim[1].count = count - prim[1].start;
-
-         primCount = 2;
-      }
-
-      if (primCount > 0) {
-         /* draw one or two prims */
-         check_buffers_are_unmapped(exec->array.inputs);
-         vbo->draw_prims(ctx, exec->array.inputs, prim, primCount, NULL,
-                         GL_TRUE, start, start + count - 1);
-      }
-   }
-   else {
-      /* no prim restart */
-      prim[0].start = start;
-      prim[0].count = count;
-
-      check_buffers_are_unmapped(exec->array.inputs);
-      vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL,
-                      GL_TRUE, start, start + count - 1);
-   }
-}
-
-
-
-/**
- * Called from glDrawArrays when in immediate mode (not display list mode).
- */
-static void GLAPIENTRY
-vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE & VERBOSE_DRAW)
-      _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
-                  _mesa_lookup_enum_by_nr(mode), start, count);
-
-   if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
-      return;
-
-   FLUSH_CURRENT( ctx, 0 );
-
-   if (!_mesa_valid_to_render(ctx, "glDrawArrays")) {
-      return;
-   }
-
-   if (0)
-      check_draw_arrays_data(ctx, start, count);
-
-   vbo_draw_arrays(ctx, mode, start, count, 1);
-
-   if (0)
-      print_draw_arrays(ctx, mode, start, count);
-}
-
-
-/**
- * Called from glDrawArraysInstanced when in immediate mode (not
- * display list mode).
- */
-static void GLAPIENTRY
-vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
-                             GLsizei numInstances)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE & VERBOSE_DRAW)
-      _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
-                  _mesa_lookup_enum_by_nr(mode), start, count, numInstances);
-
-   if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, numInstances))
-      return;
-
-   FLUSH_CURRENT( ctx, 0 );
-
-   if (!_mesa_valid_to_render(ctx, "glDrawArraysInstanced")) {
-      return;
-   }
-
-   if (0)
-      check_draw_arrays_data(ctx, start, count);
-
-   vbo_draw_arrays(ctx, mode, start, count, numInstances);
-
-   if (0)
-      print_draw_arrays(ctx, mode, start, count);
-}
-
-
-/**
- * Map GL_ELEMENT_ARRAY_BUFFER and print contents.
- * For debugging.
- */
-static void
-dump_element_buffer(struct gl_context *ctx, GLenum type)
-{
-   const GLvoid *map = ctx->Driver.MapBuffer(ctx,
-                                             GL_ELEMENT_ARRAY_BUFFER_ARB,
-                                             GL_READ_ONLY,
-                                             ctx->Array.ElementArrayBufferObj);
-   switch (type) {
-   case GL_UNSIGNED_BYTE:
-      {
-         const GLubyte *us = (const GLubyte *) map;
-         GLint i;
-         for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size; i++) {
-            printf("%02x ", us[i]);
-            if (i % 32 == 31)
-               printf("\n");
-         }
-         printf("\n");
-      }
-      break;
-   case GL_UNSIGNED_SHORT:
-      {
-         const GLushort *us = (const GLushort *) map;
-         GLint i;
-         for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 2; i++) {
-            printf("%04x ", us[i]);
-            if (i % 16 == 15)
-               printf("\n");
-         }
-         printf("\n");
-      }
-      break;
-   case GL_UNSIGNED_INT:
-      {
-         const GLuint *us = (const GLuint *) map;
-         GLint i;
-         for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 4; i++) {
-            printf("%08x ", us[i]);
-            if (i % 8 == 7)
-               printf("\n");
-         }
-         printf("\n");
-      }
-      break;
-   default:
-      ;
-   }
-
-   ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
-                           ctx->Array.ElementArrayBufferObj);
-}
-
-
-/**
- * Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements.
- * Do the rendering for a glDrawElements or glDrawRangeElements call after
- * we've validated buffer bounds, etc.
- */
-static void
-vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
-				GLboolean index_bounds_valid,
-				GLuint start, GLuint end,
-				GLsizei count, GLenum type,
-				const GLvoid *indices,
-				GLint basevertex, GLint numInstances)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   struct _mesa_index_buffer ib;
-   struct _mesa_prim prim[1];
-
-   FLUSH_CURRENT( ctx, 0 );
-
-   if (!_mesa_valid_to_render(ctx, "glDraw[Range]Elements")) {
-      return;
-   }
-
-   bind_arrays( ctx );
-
-   /* check for dirty state again */
-   if (ctx->NewState)
-      _mesa_update_state( ctx );
-
-   ib.count = count;
-   ib.type = type;
-   ib.obj = ctx->Array.ElementArrayBufferObj;
-   ib.ptr = indices;
-
-   prim[0].begin = 1;
-   prim[0].end = 1;
-   prim[0].weak = 0;
-   prim[0].pad = 0;
-   prim[0].mode = mode;
-   prim[0].start = 0;
-   prim[0].count = count;
-   prim[0].indexed = 1;
-   prim[0].basevertex = basevertex;
-   prim[0].num_instances = numInstances;
-
-   /* Need to give special consideration to rendering a range of
-    * indices starting somewhere above zero.  Typically the
-    * application is issuing multiple DrawRangeElements() to draw
-    * successive primitives layed out linearly in the vertex arrays.
-    * Unless the vertex arrays are all in a VBO (or locked as with
-    * CVA), the OpenGL semantics imply that we need to re-read or
-    * re-upload the vertex data on each draw call.  
-    *
-    * In the case of hardware tnl, we want to avoid starting the
-    * upload at zero, as it will mean every draw call uploads an
-    * increasing amount of not-used vertex data.  Worse - in the
-    * software tnl module, all those vertices might be transformed and
-    * lit but never rendered.
-    *
-    * If we just upload or transform the vertices in start..end,
-    * however, the indices will be incorrect.
-    *
-    * At this level, we don't know exactly what the requirements of
-    * the backend are going to be, though it will likely boil down to
-    * either:
-    *
-    * 1) Do nothing, everything is in a VBO and is processed once
-    *       only.
-    *
-    * 2) Adjust the indices and vertex arrays so that start becomes
-    *    zero.
-    *
-    * Rather than doing anything here, I'll provide a helper function
-    * for the latter case elsewhere.
-    */
-
-   check_buffers_are_unmapped(exec->array.inputs);
-   vbo->draw_prims( ctx, exec->array.inputs, prim, 1, &ib,
-		    index_bounds_valid, start, end );
-}
-
-
-/**
- * Called by glDrawRangeElementsBaseVertex() in immediate mode.
- */
-static void GLAPIENTRY
-vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
-				     GLuint start, GLuint end,
-				     GLsizei count, GLenum type,
-				     const GLvoid *indices,
-				     GLint basevertex)
-{
-   static GLuint warnCount = 0;
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE & VERBOSE_DRAW)
-      _mesa_debug(ctx,
-                "glDrawRangeElementsBaseVertex(%s, %u, %u, %d, %s, %p, %d)\n",
-                _mesa_lookup_enum_by_nr(mode), start, end, count,
-                _mesa_lookup_enum_by_nr(type), indices, basevertex);
-
-   if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
-                                          type, indices, basevertex ))
-      return;
-
-   /* NOTE: It's important that 'end' is a reasonable value.
-    * in _tnl_draw_prims(), we use end to determine how many vertices
-    * to transform.  If it's too large, we can unnecessarily split prims
-    * or we can read/write out of memory in several different places!
-    */
-
-   /* Catch/fix some potential user errors */
-   if (type == GL_UNSIGNED_BYTE) {
-      start = MIN2(start, 0xff);
-      end = MIN2(end, 0xff);
-   }
-   else if (type == GL_UNSIGNED_SHORT) {
-      start = MIN2(start, 0xffff);
-      end = MIN2(end, 0xffff);
-   }
-
-   if (end >= ctx->Array.ArrayObj->_MaxElement) {
-      /* the max element is out of bounds of one or more enabled arrays */
-      warnCount++;
-
-      if (warnCount < 10) {
-         _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, "
-                       "type 0x%x, indices=%p)\n"
-                       "\tend is out of bounds (max=%u)  "
-                       "Element Buffer %u (size %d)\n"
-                       "\tThis should probably be fixed in the application.",
-                       start, end, count, type, indices,
-                       ctx->Array.ArrayObj->_MaxElement - 1,
-                       ctx->Array.ElementArrayBufferObj->Name,
-                       (int) ctx->Array.ElementArrayBufferObj->Size);
-      }
-
-      if (0)
-         dump_element_buffer(ctx, type);
-
-      if (0)
-         _mesa_print_arrays(ctx);
-
-#ifdef DEBUG
-      /* 'end' was out of bounds, but now let's check the actual array
-       * indexes to see if any of them are out of bounds.
-       */
-      {
-         GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
-                                             ctx->Array.ElementArrayBufferObj);
-         if (max >= ctx->Array.ArrayObj->_MaxElement) {
-            if (warnCount < 10) {
-               _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, "
-                             "count %d, type 0x%x, indices=%p)\n"
-                             "\tindex=%u is out of bounds (max=%u)  "
-                             "Element Buffer %u (size %d)\n"
-                             "\tSkipping the glDrawRangeElements() call",
-                             start, end, count, type, indices, max,
-                             ctx->Array.ArrayObj->_MaxElement - 1,
-                             ctx->Array.ElementArrayBufferObj->Name,
-                             (int) ctx->Array.ElementArrayBufferObj->Size);
-            }
-         }
-         /* XXX we could also find the min index and compare to 'start'
-          * to see if start is correct.  But it's more likely to get the
-          * upper bound wrong.
-          */
-      }
-#endif
-
-      /* Set 'end' to the max possible legal value */
-      assert(ctx->Array.ArrayObj->_MaxElement >= 1);
-      end = ctx->Array.ArrayObj->_MaxElement - 1;
-
-      if (end < start) {
-         return;
-      }
-   }
-
-   if (0) {
-      printf("glDraw[Range]Elements{,BaseVertex}"
-	     "(start %u, end %u, type 0x%x, count %d) ElemBuf %u, "
-	     "base %d\n",
-	     start, end, type, count,
-	     ctx->Array.ElementArrayBufferObj->Name,
-	     basevertex);
-   }
-
-#if 0
-   check_draw_elements_data(ctx, count, type, indices);
-#else
-   (void) check_draw_elements_data;
-#endif
-
-   vbo_validated_drawrangeelements(ctx, mode, GL_TRUE, start, end,
-				   count, type, indices, basevertex, 1);
-}
-
-
-/**
- * Called by glDrawRangeElements() in immediate mode.
- */
-static void GLAPIENTRY
-vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
-                           GLsizei count, GLenum type, const GLvoid *indices)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE & VERBOSE_DRAW)
-      _mesa_debug(ctx,
-                  "glDrawRangeElements(%s, %u, %u, %d, %s, %p)\n",
-                  _mesa_lookup_enum_by_nr(mode), start, end, count,
-                  _mesa_lookup_enum_by_nr(type), indices);
-
-   vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type,
-					indices, 0);
-}
-
-
-/**
- * Called by glDrawElements() in immediate mode.
- */
-static void GLAPIENTRY
-vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
-                      const GLvoid *indices)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE & VERBOSE_DRAW)
-      _mesa_debug(ctx, "glDrawElements(%s, %u, %s, %p)\n",
-                  _mesa_lookup_enum_by_nr(mode), count,
-                  _mesa_lookup_enum_by_nr(type), indices);
-
-   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
-      return;
-
-   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
-				   count, type, indices, 0, 1);
-}
-
-
-/**
- * Called by glDrawElementsBaseVertex() in immediate mode.
- */
-static void GLAPIENTRY
-vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
-				const GLvoid *indices, GLint basevertex)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE & VERBOSE_DRAW)
-      _mesa_debug(ctx, "glDrawElementsBaseVertex(%s, %d, %s, %p, %d)\n",
-                  _mesa_lookup_enum_by_nr(mode), count,
-                  _mesa_lookup_enum_by_nr(type), indices, basevertex);
-
-   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
-				     basevertex ))
-      return;
-
-   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
-				   count, type, indices, basevertex, 1);
-}
-
-
-/**
- * Called by glDrawElementsInstanced() in immediate mode.
- */
-static void GLAPIENTRY
-vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
-                               const GLvoid *indices, GLsizei numInstances)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE & VERBOSE_DRAW)
-      _mesa_debug(ctx, "glDrawElementsInstanced(%s, %d, %s, %p, %d)\n",
-                  _mesa_lookup_enum_by_nr(mode), count,
-                  _mesa_lookup_enum_by_nr(type), indices, numInstances);
-
-   if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
-                                             numInstances))
-      return;
-
-   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
-				   count, type, indices, 0, numInstances);
-}
-
-
-/**
- * Inner support for both _mesa_MultiDrawElements() and
- * _mesa_MultiDrawRangeElements().
- * This does the actual rendering after we've checked array indexes, etc.
- */
-static void
-vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
-				const GLsizei *count, GLenum type,
-				const GLvoid **indices, GLsizei primcount,
-				const GLint *basevertex)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   struct _mesa_index_buffer ib;
-   struct _mesa_prim *prim;
-   unsigned int index_type_size = 0;
-   uintptr_t min_index_ptr, max_index_ptr;
-   GLboolean fallback = GL_FALSE;
-   int i;
-
-   if (primcount == 0)
-      return;
-
-   FLUSH_CURRENT( ctx, 0 );
-
-   if (!_mesa_valid_to_render(ctx, "glMultiDrawElements")) {
-      return;
-   }
-
-   prim = calloc(1, primcount * sizeof(*prim));
-   if (prim == NULL) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
-      return;
-   }
-
-   /* Decide if we can do this all as one set of primitives sharing the
-    * same index buffer, or if we have to reset the index pointer per
-    * primitive.
-    */
-   bind_arrays( ctx );
-
-   /* check for dirty state again */
-   if (ctx->NewState)
-      _mesa_update_state( ctx );
-
-   switch (type) {
-   case GL_UNSIGNED_INT:
-      index_type_size = 4;
-      break;
-   case GL_UNSIGNED_SHORT:
-      index_type_size = 2;
-      break;
-   case GL_UNSIGNED_BYTE:
-      index_type_size = 1;
-      break;
-   default:
-      assert(0);
-   }
-
-   min_index_ptr = (uintptr_t)indices[0];
-   max_index_ptr = 0;
-   for (i = 0; i < primcount; i++) {
-      min_index_ptr = MIN2(min_index_ptr, (uintptr_t)indices[i]);
-      max_index_ptr = MAX2(max_index_ptr, (uintptr_t)indices[i] +
-			   index_type_size * count[i]);
-   }
-
-   /* Check if we can handle this thing as a bunch of index offsets from the
-    * same index pointer.  If we can't, then we have to fall back to doing
-    * a draw_prims per primitive.
-    * Check that the difference between each prim's indexes is a multiple of
-    * the index/element size.
-    */
-   if (index_type_size != 1) {
-      for (i = 0; i < primcount; i++) {
-	 if ((((uintptr_t)indices[i] - min_index_ptr) % index_type_size) != 0) {
-	    fallback = GL_TRUE;
-	    break;
-	 }
-      }
-   }
-
-   /* If the index buffer isn't in a VBO, then treating the application's
-    * subranges of the index buffer as one large index buffer may lead to
-    * us reading unmapped memory.
-    */
-   if (!_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
-      fallback = GL_TRUE;
-
-   if (!fallback) {
-      ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
-      ib.type = type;
-      ib.obj = ctx->Array.ElementArrayBufferObj;
-      ib.ptr = (void *)min_index_ptr;
-
-      for (i = 0; i < primcount; i++) {
-	 prim[i].begin = (i == 0);
-	 prim[i].end = (i == primcount - 1);
-	 prim[i].weak = 0;
-	 prim[i].pad = 0;
-	 prim[i].mode = mode;
-	 prim[i].start = ((uintptr_t)indices[i] - min_index_ptr) / index_type_size;
-	 prim[i].count = count[i];
-	 prim[i].indexed = 1;
-         prim[i].num_instances = 1;
-	 if (basevertex != NULL)
-	    prim[i].basevertex = basevertex[i];
-	 else
-	    prim[i].basevertex = 0;
-      }
-
-      check_buffers_are_unmapped(exec->array.inputs);
-      vbo->draw_prims(ctx, exec->array.inputs, prim, primcount, &ib,
-		      GL_FALSE, ~0, ~0);
-   } else {
-      /* render one prim at a time */
-      for (i = 0; i < primcount; i++) {
-	 ib.count = count[i];
-	 ib.type = type;
-	 ib.obj = ctx->Array.ElementArrayBufferObj;
-	 ib.ptr = indices[i];
-
-	 prim[0].begin = 1;
-	 prim[0].end = 1;
-	 prim[0].weak = 0;
-	 prim[0].pad = 0;
-	 prim[0].mode = mode;
-	 prim[0].start = 0;
-	 prim[0].count = count[i];
-	 prim[0].indexed = 1;
-         prim[0].num_instances = 1;
-	 if (basevertex != NULL)
-	    prim[0].basevertex = basevertex[i];
-	 else
-	    prim[0].basevertex = 0;
-
-         check_buffers_are_unmapped(exec->array.inputs);
-         vbo->draw_prims(ctx, exec->array.inputs, prim, 1, &ib,
-                         GL_FALSE, ~0, ~0);
-      }
-   }
-
-   free(prim);
-}
-
-
-static void GLAPIENTRY
-vbo_exec_MultiDrawElements(GLenum mode,
-			   const GLsizei *count, GLenum type,
-			   const GLvoid **indices,
-			   GLsizei primcount)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   GLint i;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   for (i = 0; i < primcount; i++) {
-      if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
-				       0))
-	 return;
-   }
-
-   vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
-				   NULL);
-}
-
-
-static void GLAPIENTRY
-vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
-				     const GLsizei *count, GLenum type,
-				     const GLvoid **indices,
-				     GLsizei primcount,
-				     const GLsizei *basevertex)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   GLint i;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   for (i = 0; i < primcount; i++) {
-      if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
-				       basevertex[i]))
-	 return;
-   }
-
-   vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
-				   basevertex);
-}
-
-
-/**
- * Plug in the immediate-mode vertex array drawing commands into the
- * givven vbo_exec_context object.
- */
-void
-vbo_exec_array_init( struct vbo_exec_context *exec )
-{
-   exec->vtxfmt.DrawArrays = vbo_exec_DrawArrays;
-   exec->vtxfmt.DrawElements = vbo_exec_DrawElements;
-   exec->vtxfmt.DrawRangeElements = vbo_exec_DrawRangeElements;
-   exec->vtxfmt.MultiDrawElementsEXT = vbo_exec_MultiDrawElements;
-   exec->vtxfmt.DrawElementsBaseVertex = vbo_exec_DrawElementsBaseVertex;
-   exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex;
-   exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex;
-   exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced;
-   exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced;
-}
-
-
-void
-vbo_exec_array_destroy( struct vbo_exec_context *exec )
-{
-   /* nothing to do */
-}
-
-
-
-/**
- * The following functions are only used for OpenGL ES 1/2 support.
- * And some aren't even supported (yet) in ES 1/2.
- */
-
-
-void GLAPIENTRY
-_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count)
-{
-   vbo_exec_DrawArrays(mode, first, count);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
-                   const GLvoid *indices)
-{
-   vbo_exec_DrawElements(mode, count, type, indices);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
-			     const GLvoid *indices, GLint basevertex)
-{
-   vbo_exec_DrawElementsBaseVertex(mode, count, type, indices, basevertex);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
-                        GLenum type, const GLvoid *indices)
-{
-   vbo_exec_DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-
-void GLAPIENTRY
-_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
-				  GLsizei count, GLenum type,
-				  const GLvoid *indices, GLint basevertex)
-{
-   vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type,
-					indices, basevertex);
-}
-
-
-void GLAPIENTRY
-_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
-			   const GLvoid **indices, GLsizei primcount)
-{
-   vbo_exec_MultiDrawElements(mode, count, type, indices, primcount);
-}
-
-
-void GLAPIENTRY
-_mesa_MultiDrawElementsBaseVertex(GLenum mode,
-				  const GLsizei *count, GLenum type,
-				  const GLvoid **indices, GLsizei primcount,
-				  const GLint *basevertex)
-{
-   vbo_exec_MultiDrawElementsBaseVertex(mode, count, type, indices,
-					primcount, basevertex);
-}
+/**************************************************************************
+ * 
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ * 
+ **************************************************************************/
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/state.h"
+#include "main/api_validate.h"
+#include "main/varray.h"
+#include "main/bufferobj.h"
+#include "main/enums.h"
+#include "main/macros.h"
+
+#include "vbo_context.h"
+
+
+/**
+ * All vertex buffers should be in an unmapped state when we're about
+ * to draw.  This debug function checks that.
+ */
+static void
+check_buffers_are_unmapped(const struct gl_client_array **inputs)
+{
+#ifdef DEBUG
+   GLuint i;
+
+   for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+      if (inputs[i]) {
+         struct gl_buffer_object *obj = inputs[i]->BufferObj;
+         assert(!_mesa_bufferobj_mapped(obj));
+         (void) obj;
+      }
+   }
+#endif
+}
+
+
+/**
+ * A debug function that may be called from other parts of Mesa as
+ * needed during debugging.
+ */
+void
+vbo_check_buffers_are_unmapped(struct gl_context *ctx)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+   /* check the current vertex arrays */
+   check_buffers_are_unmapped(exec->array.inputs);
+   /* check the current glBegin/glVertex/glEnd-style VBO */
+   assert(!_mesa_bufferobj_mapped(exec->vtx.bufferobj));
+}
+
+
+
+/**
+ * Compute min and max elements by scanning the index buffer for
+ * glDraw[Range]Elements() calls.
+ * If primitive restart is enabled, we need to ignore restart
+ * indexes when computing min/max.
+ */
+void
+vbo_get_minmax_index(struct gl_context *ctx,
+		     const struct _mesa_prim *prim,
+		     const struct _mesa_index_buffer *ib,
+		     GLuint *min_index, GLuint *max_index)
+{
+   const GLboolean restart = ctx->Array.PrimitiveRestart;
+   const GLuint restartIndex = ctx->Array.RestartIndex;
+   const GLuint count = prim->count;
+   const void *indices;
+   GLuint i;
+
+   if (_mesa_is_bufferobj(ib->obj)) {
+      const GLvoid *map =
+         ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
+                               GL_READ_ONLY, ib->obj);
+      indices = ADD_POINTERS(map, ib->ptr);
+   } else {
+      indices = ib->ptr;
+   }
+
+   switch (ib->type) {
+   case GL_UNSIGNED_INT: {
+      const GLuint *ui_indices = (const GLuint *)indices;
+      GLuint max_ui = 0;
+      GLuint min_ui = ~0U;
+      if (restart) {
+         for (i = 0; i < count; i++) {
+            if (ui_indices[i] != restartIndex) {
+               if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
+               if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
+            }
+         }
+      }
+      else {
+         for (i = 0; i < count; i++) {
+            if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
+            if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
+         }
+      }
+      *min_index = min_ui;
+      *max_index = max_ui;
+      break;
+   }
+   case GL_UNSIGNED_SHORT: {
+      const GLushort *us_indices = (const GLushort *)indices;
+      GLuint max_us = 0;
+      GLuint min_us = ~0U;
+      if (restart) {
+         for (i = 0; i < count; i++) {
+            if (us_indices[i] != restartIndex) {
+               if (us_indices[i] > max_us) max_us = us_indices[i];
+               if (us_indices[i] < min_us) min_us = us_indices[i];
+            }
+         }
+      }
+      else {
+         for (i = 0; i < count; i++) {
+            if (us_indices[i] > max_us) max_us = us_indices[i];
+            if (us_indices[i] < min_us) min_us = us_indices[i];
+         }
+      }
+      *min_index = min_us;
+      *max_index = max_us;
+      break;
+   }
+   case GL_UNSIGNED_BYTE: {
+      const GLubyte *ub_indices = (const GLubyte *)indices;
+      GLuint max_ub = 0;
+      GLuint min_ub = ~0U;
+      if (restart) {
+         for (i = 0; i < count; i++) {
+            if (ub_indices[i] != restartIndex) {
+               if (ub_indices[i] > max_ub) max_ub = ub_indices[i];
+               if (ub_indices[i] < min_ub) min_ub = ub_indices[i];
+            }
+         }
+      }
+      else {
+         for (i = 0; i < count; i++) {
+            if (ub_indices[i] > max_ub) max_ub = ub_indices[i];
+            if (ub_indices[i] < min_ub) min_ub = ub_indices[i];
+         }
+      }
+      *min_index = min_ub;
+      *max_index = max_ub;
+      break;
+   }
+   default:
+      assert(0);
+      break;
+   }
+
+   if (_mesa_is_bufferobj(ib->obj)) {
+      ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, ib->obj);
+   }
+}
+
+
+/**
+ * Check that element 'j' of the array has reasonable data.
+ * Map VBO if needed.
+ * For debugging purposes; not normally used.
+ */
+static void
+check_array_data(struct gl_context *ctx, struct gl_client_array *array,
+                 GLuint attrib, GLuint j)
+{
+   if (array->Enabled) {
+      const void *data = array->Ptr;
+      if (_mesa_is_bufferobj(array->BufferObj)) {
+         if (!array->BufferObj->Pointer) {
+            /* need to map now */
+            array->BufferObj->Pointer =
+               ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
+                                     GL_READ_ONLY, array->BufferObj);
+         }
+         data = ADD_POINTERS(data, array->BufferObj->Pointer);
+      }
+      switch (array->Type) {
+      case GL_FLOAT:
+         {
+            GLfloat *f = (GLfloat *) ((GLubyte *) data + array->StrideB * j);
+            GLint k;
+            for (k = 0; k < array->Size; k++) {
+               if (IS_INF_OR_NAN(f[k]) ||
+                   f[k] >= 1.0e20 || f[k] <= -1.0e10) {
+                  printf("Bad array data:\n");
+                  printf("  Element[%u].%u = %f\n", j, k, f[k]);
+                  printf("  Array %u at %p\n", attrib, (void* ) array);
+                  printf("  Type 0x%x, Size %d, Stride %d\n",
+			 array->Type, array->Size, array->Stride);
+                  printf("  Address/offset %p in Buffer Object %u\n",
+			 array->Ptr, array->BufferObj->Name);
+                  f[k] = 1.0; /* XXX replace the bad value! */
+               }
+               /*assert(!IS_INF_OR_NAN(f[k]));*/
+            }
+         }
+         break;
+      default:
+         ;
+      }
+   }
+}
+
+
+/**
+ * Unmap the buffer object referenced by given array, if mapped.
+ */
+static void
+unmap_array_buffer(struct gl_context *ctx, struct gl_client_array *array)
+{
+   if (array->Enabled &&
+       _mesa_is_bufferobj(array->BufferObj) &&
+       _mesa_bufferobj_mapped(array->BufferObj)) {
+      ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, array->BufferObj);
+   }
+}
+
+
+/**
+ * Examine the array's data for NaNs, etc.
+ * For debug purposes; not normally used.
+ */
+static void
+check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
+                         const void *elements, GLint basevertex)
+{
+   struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
+   const void *elemMap;
+   GLint i, k;
+
+   if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
+      elemMap = ctx->Driver.MapBuffer(ctx,
+                                      GL_ELEMENT_ARRAY_BUFFER_ARB,
+                                      GL_READ_ONLY,
+                                      ctx->Array.ElementArrayBufferObj);
+      elements = ADD_POINTERS(elements, elemMap);
+   }
+
+   for (i = 0; i < count; i++) {
+      GLuint j;
+
+      /* j = element[i] */
+      switch (elemType) {
+      case GL_UNSIGNED_BYTE:
+         j = ((const GLubyte *) elements)[i];
+         break;
+      case GL_UNSIGNED_SHORT:
+         j = ((const GLushort *) elements)[i];
+         break;
+      case GL_UNSIGNED_INT:
+         j = ((const GLuint *) elements)[i];
+         break;
+      default:
+         assert(0);
+      }
+
+      /* check element j of each enabled array */
+      check_array_data(ctx, &arrayObj->Vertex, VERT_ATTRIB_POS, j);
+      check_array_data(ctx, &arrayObj->Normal, VERT_ATTRIB_NORMAL, j);
+      check_array_data(ctx, &arrayObj->Color, VERT_ATTRIB_COLOR0, j);
+      check_array_data(ctx, &arrayObj->SecondaryColor, VERT_ATTRIB_COLOR1, j);
+      for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
+         check_array_data(ctx, &arrayObj->TexCoord[k], VERT_ATTRIB_TEX0 + k, j);
+      }
+      for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
+         check_array_data(ctx, &arrayObj->VertexAttrib[k],
+                          VERT_ATTRIB_GENERIC0 + k, j);
+      }
+   }
+
+   if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
+      ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
+			      ctx->Array.ElementArrayBufferObj);
+   }
+
+   unmap_array_buffer(ctx, &arrayObj->Vertex);
+   unmap_array_buffer(ctx, &arrayObj->Normal);
+   unmap_array_buffer(ctx, &arrayObj->Color);
+   for (k = 0; k < Elements(arrayObj->TexCoord); k++) {
+      unmap_array_buffer(ctx, &arrayObj->TexCoord[k]);
+   }
+   for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) {
+      unmap_array_buffer(ctx, &arrayObj->VertexAttrib[k]);
+   }
+}
+
+
+/**
+ * Check array data, looking for NaNs, etc.
+ */
+static void
+check_draw_arrays_data(struct gl_context *ctx, GLint start, GLsizei count)
+{
+   /* TO DO */
+}
+
+
+/**
+ * Print info/data for glDrawArrays(), for debugging.
+ */
+static void
+print_draw_arrays(struct gl_context *ctx,
+                  GLenum mode, GLint start, GLsizei count)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+   int i;
+
+   printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
+	  mode, start, count);
+
+   for (i = 0; i < 32; i++) {
+      GLuint bufName = exec->array.inputs[i]->BufferObj->Name;
+      GLint stride = exec->array.inputs[i]->Stride;
+      printf("attr %2d: size %d stride %d  enabled %d  "
+	     "ptr %p  Bufobj %u\n",
+	     i,
+	     exec->array.inputs[i]->Size,
+	     stride,
+	     /*exec->array.inputs[i]->Enabled,*/
+	     exec->array.legacy_array[i]->Enabled,
+	     exec->array.inputs[i]->Ptr,
+	     bufName);
+
+      if (bufName) {
+         struct gl_buffer_object *buf = _mesa_lookup_bufferobj(ctx, bufName);
+         GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
+                                            GL_READ_ONLY_ARB, buf);
+         int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr;
+         float *f = (float *) (p + offset);
+         int *k = (int *) f;
+         int i;
+         int n = (count * stride) / 4;
+         if (n > 32)
+            n = 32;
+         printf("  Data at offset %d:\n", offset);
+         for (i = 0; i < n; i++) {
+            printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
+         }
+         ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, buf);
+      }
+   }
+}
+
+
+/**
+ * Bind the VBO executor to the current vertex array object prior
+ * to drawing.
+ *
+ * Just translate the arrayobj into a sane layout.
+ */
+static void
+bind_array_obj(struct gl_context *ctx)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+   struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
+   GLuint i;
+
+   /* TODO: Fix the ArrayObj struct to keep legacy arrays in an array
+    * rather than as individual named arrays.  Then this function can
+    * go away.
+    */
+   exec->array.legacy_array[VERT_ATTRIB_POS] = &arrayObj->Vertex;
+   exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &arrayObj->Weight;
+   exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &arrayObj->Normal;
+   exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &arrayObj->Color;
+   exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &arrayObj->SecondaryColor;
+   exec->array.legacy_array[VERT_ATTRIB_FOG] = &arrayObj->FogCoord;
+   exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &arrayObj->Index;
+   if (arrayObj->PointSize.Enabled) {
+      /* this aliases COLOR_INDEX */
+      exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &arrayObj->PointSize;
+   }
+   exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag;
+
+   for (i = 0; i < Elements(arrayObj->TexCoord); i++)
+      exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i];
+
+   for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) {
+      assert(i < Elements(exec->array.generic_array));
+      exec->array.generic_array[i] = &arrayObj->VertexAttrib[i];
+   }
+   
+   exec->array.array_obj = arrayObj->Name;
+}
+
+
+/**
+ * Set the vbo->exec->inputs[] pointers to point to the enabled
+ * vertex arrays.  This depends on the current vertex program/shader
+ * being executed because of whether or not generic vertex arrays
+ * alias the conventional vertex arrays.
+ * For arrays that aren't enabled, we set the input[attrib] pointer
+ * to point at a zero-stride current value "array".
+ */
+static void
+recalculate_input_bindings(struct gl_context *ctx)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+   const struct gl_client_array **inputs = &exec->array.inputs[0];
+   GLbitfield const_inputs = 0x0;
+   GLuint i;
+
+   exec->array.program_mode = get_program_mode(ctx);
+   exec->array.enabled_flags = ctx->Array.ArrayObj->_Enabled;
+
+   switch (exec->array.program_mode) {
+   case VP_NONE:
+      /* When no vertex program is active (or the vertex program is generated
+       * from fixed-function state).  We put the material values into the
+       * generic slots.  This is the only situation where material values
+       * are available as per-vertex attributes.
+       */
+      for (i = 0; i <= VERT_ATTRIB_TEX7; i++) {
+	 if (exec->array.legacy_array[i]->Enabled)
+	    inputs[i] = exec->array.legacy_array[i];
+	 else {
+	    inputs[i] = &vbo->legacy_currval[i];
+            const_inputs |= 1 << i;
+         }
+      }
+
+      for (i = 0; i < MAT_ATTRIB_MAX; i++) {
+	 inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->mat_currval[i];
+         const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
+      }
+
+      /* Could use just about anything, just to fill in the empty
+       * slots:
+       */
+      for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_MAX - VERT_ATTRIB_GENERIC0; i++) {
+	 inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
+         const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
+      }
+
+      /* There is no need to make _NEW_ARRAY dirty here for the TnL program,
+       * because it already takes care of invalidating the state necessary
+       * to revalidate vertex arrays. Not marking the state as dirty also
+       * improves performance (quite significantly in some apps).
+       */
+      if (!ctx->VertexProgram._MaintainTnlProgram)
+         ctx->NewState |= _NEW_ARRAY;
+      break;
+
+   case VP_NV:
+      /* NV_vertex_program - attribute arrays alias and override
+       * conventional, legacy arrays.  No materials, and the generic
+       * slots are vacant.
+       */
+      for (i = 0; i <= VERT_ATTRIB_TEX7; i++) {
+	 if (exec->array.generic_array[i]->Enabled)
+	    inputs[i] = exec->array.generic_array[i];
+	 else if (exec->array.legacy_array[i]->Enabled)
+	    inputs[i] = exec->array.legacy_array[i];
+	 else {
+	    inputs[i] = &vbo->legacy_currval[i];
+            const_inputs |= 1 << i;
+         }
+      }
+
+      /* Could use just about anything, just to fill in the empty
+       * slots:
+       */
+      for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
+	 inputs[i] = &vbo->generic_currval[i - VERT_ATTRIB_GENERIC0];
+         const_inputs |= 1 << i;
+      }
+
+      ctx->NewState |= _NEW_ARRAY;
+      break;
+
+   case VP_ARB:
+      /* GL_ARB_vertex_program or GLSL vertex shader - Only the generic[0]
+       * attribute array aliases and overrides the legacy position array.  
+       *
+       * Otherwise, legacy attributes available in the legacy slots,
+       * generic attributes in the generic slots and materials are not
+       * available as per-vertex attributes.
+       */
+      if (exec->array.generic_array[0]->Enabled)
+	 inputs[0] = exec->array.generic_array[0];
+      else if (exec->array.legacy_array[0]->Enabled)
+	 inputs[0] = exec->array.legacy_array[0];
+      else {
+	 inputs[0] = &vbo->legacy_currval[0];
+         const_inputs |= 1 << 0;
+      }
+
+      for (i = 1; i <= VERT_ATTRIB_TEX7; i++) {
+	 if (exec->array.legacy_array[i]->Enabled)
+	    inputs[i] = exec->array.legacy_array[i];
+	 else {
+	    inputs[i] = &vbo->legacy_currval[i];
+            const_inputs |= 1 << i;
+         }
+      }
+
+      for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) {
+	 if (exec->array.generic_array[i]->Enabled)
+	    inputs[VERT_ATTRIB_GENERIC0 + i] = exec->array.generic_array[i];
+	 else {
+	    inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
+            const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i);
+         }
+      }
+
+      ctx->NewState |= _NEW_ARRAY;
+      break;
+   }
+
+   _mesa_set_varying_vp_inputs( ctx, ~const_inputs );
+}
+
+
+/**
+ * Examine the enabled vertex arrays to set the exec->array.inputs[] values.
+ * These will point to the arrays to actually use for drawing.  Some will
+ * be user-provided arrays, other will be zero-stride const-valued arrays.
+ * Note that this might set the _NEW_ARRAY dirty flag so state validation
+ * must be done after this call.
+ */
+static void
+bind_arrays(struct gl_context *ctx)
+{
+   if (!ctx->Array.RebindArrays) {
+      return;
+   }
+
+   bind_array_obj(ctx);
+   recalculate_input_bindings(ctx);
+   ctx->Array.RebindArrays = GL_FALSE;
+}
+
+
+/**
+ * Helper function called by the other DrawArrays() functions below.
+ * This is where we handle primitive restart for drawing non-indexed
+ * arrays.  If primitive restart is enabled, it typically means
+ * splitting one DrawArrays() into two.
+ */
+static void
+vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
+                GLsizei count, GLuint numInstances)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+   struct _mesa_prim prim[2];
+
+   bind_arrays(ctx);
+
+   /* Again... because we may have changed the bitmask of per-vertex varying
+    * attributes.  If we regenerate the fixed-function vertex program now
+    * we may be able to prune down the number of vertex attributes which we
+    * need in the shader.
+    */
+   if (ctx->NewState)
+      _mesa_update_state(ctx);
+
+   /* init most fields to zero */
+   memset(prim, 0, sizeof(prim));
+   prim[0].begin = 1;
+   prim[0].end = 1;
+   prim[0].mode = mode;
+   prim[0].num_instances = numInstances;
+
+   /* Implement the primitive restart index */
+   if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
+      GLuint primCount = 0;
+
+      if (ctx->Array.RestartIndex == start) {
+         /* special case: RestartIndex at beginning */
+         if (count > 1) {
+            prim[0].start = start + 1;
+            prim[0].count = count - 1;
+            primCount = 1;
+         }
+      }
+      else if (ctx->Array.RestartIndex == start + count - 1) {
+         /* special case: RestartIndex at end */
+         if (count > 1) {
+            prim[0].start = start;
+            prim[0].count = count - 1;
+            primCount = 1;
+         }
+      }
+      else {
+         /* general case: RestartIndex in middle, split into two prims */
+         prim[0].start = start;
+         prim[0].count = ctx->Array.RestartIndex - start;
+
+         prim[1] = prim[0];
+         prim[1].start = ctx->Array.RestartIndex + 1;
+         prim[1].count = count - prim[1].start;
+
+         primCount = 2;
+      }
+
+      if (primCount > 0) {
+         /* draw one or two prims */
+         check_buffers_are_unmapped(exec->array.inputs);
+         vbo->draw_prims(ctx, exec->array.inputs, prim, primCount, NULL,
+                         GL_TRUE, start, start + count - 1);
+      }
+   }
+   else {
+      /* no prim restart */
+      prim[0].start = start;
+      prim[0].count = count;
+
+      check_buffers_are_unmapped(exec->array.inputs);
+      vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL,
+                      GL_TRUE, start, start + count - 1);
+   }
+}
+
+
+
+/**
+ * Called from glDrawArrays when in immediate mode (not display list mode).
+ */
+static void GLAPIENTRY
+vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), start, count);
+
+   if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
+      return;
+
+   FLUSH_CURRENT( ctx, 0 );
+
+   if (!_mesa_valid_to_render(ctx, "glDrawArrays")) {
+      return;
+   }
+
+   if (0)
+      check_draw_arrays_data(ctx, start, count);
+
+   vbo_draw_arrays(ctx, mode, start, count, 1);
+
+   if (0)
+      print_draw_arrays(ctx, mode, start, count);
+}
+
+
+/**
+ * Called from glDrawArraysInstanced when in immediate mode (not
+ * display list mode).
+ */
+static void GLAPIENTRY
+vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
+                             GLsizei numInstances)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), start, count, numInstances);
+
+   if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, numInstances))
+      return;
+
+   FLUSH_CURRENT( ctx, 0 );
+
+   if (!_mesa_valid_to_render(ctx, "glDrawArraysInstanced")) {
+      return;
+   }
+
+   if (0)
+      check_draw_arrays_data(ctx, start, count);
+
+   vbo_draw_arrays(ctx, mode, start, count, numInstances);
+
+   if (0)
+      print_draw_arrays(ctx, mode, start, count);
+}
+
+
+/**
+ * Map GL_ELEMENT_ARRAY_BUFFER and print contents.
+ * For debugging.
+ */
+static void
+dump_element_buffer(struct gl_context *ctx, GLenum type)
+{
+   const GLvoid *map = ctx->Driver.MapBuffer(ctx,
+                                             GL_ELEMENT_ARRAY_BUFFER_ARB,
+                                             GL_READ_ONLY,
+                                             ctx->Array.ElementArrayBufferObj);
+   switch (type) {
+   case GL_UNSIGNED_BYTE:
+      {
+         const GLubyte *us = (const GLubyte *) map;
+         GLint i;
+         for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size; i++) {
+            printf("%02x ", us[i]);
+            if (i % 32 == 31)
+               printf("\n");
+         }
+         printf("\n");
+      }
+      break;
+   case GL_UNSIGNED_SHORT:
+      {
+         const GLushort *us = (const GLushort *) map;
+         GLint i;
+         for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 2; i++) {
+            printf("%04x ", us[i]);
+            if (i % 16 == 15)
+               printf("\n");
+         }
+         printf("\n");
+      }
+      break;
+   case GL_UNSIGNED_INT:
+      {
+         const GLuint *us = (const GLuint *) map;
+         GLint i;
+         for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 4; i++) {
+            printf("%08x ", us[i]);
+            if (i % 8 == 7)
+               printf("\n");
+         }
+         printf("\n");
+      }
+      break;
+   default:
+      ;
+   }
+
+   ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB,
+                           ctx->Array.ElementArrayBufferObj);
+}
+
+
+/**
+ * Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements.
+ * Do the rendering for a glDrawElements or glDrawRangeElements call after
+ * we've validated buffer bounds, etc.
+ */
+static void
+vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
+				GLboolean index_bounds_valid,
+				GLuint start, GLuint end,
+				GLsizei count, GLenum type,
+				const GLvoid *indices,
+				GLint basevertex, GLint numInstances)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+   struct _mesa_index_buffer ib;
+   struct _mesa_prim prim[1];
+
+   FLUSH_CURRENT( ctx, 0 );
+
+   if (!_mesa_valid_to_render(ctx, "glDraw[Range]Elements")) {
+      return;
+   }
+
+   bind_arrays( ctx );
+
+   /* check for dirty state again */
+   if (ctx->NewState)
+      _mesa_update_state( ctx );
+
+   ib.count = count;
+   ib.type = type;
+   ib.obj = ctx->Array.ElementArrayBufferObj;
+   ib.ptr = indices;
+
+   prim[0].begin = 1;
+   prim[0].end = 1;
+   prim[0].weak = 0;
+   prim[0].pad = 0;
+   prim[0].mode = mode;
+   prim[0].start = 0;
+   prim[0].count = count;
+   prim[0].indexed = 1;
+   prim[0].basevertex = basevertex;
+   prim[0].num_instances = numInstances;
+
+   /* Need to give special consideration to rendering a range of
+    * indices starting somewhere above zero.  Typically the
+    * application is issuing multiple DrawRangeElements() to draw
+    * successive primitives layed out linearly in the vertex arrays.
+    * Unless the vertex arrays are all in a VBO (or locked as with
+    * CVA), the OpenGL semantics imply that we need to re-read or
+    * re-upload the vertex data on each draw call.  
+    *
+    * In the case of hardware tnl, we want to avoid starting the
+    * upload at zero, as it will mean every draw call uploads an
+    * increasing amount of not-used vertex data.  Worse - in the
+    * software tnl module, all those vertices might be transformed and
+    * lit but never rendered.
+    *
+    * If we just upload or transform the vertices in start..end,
+    * however, the indices will be incorrect.
+    *
+    * At this level, we don't know exactly what the requirements of
+    * the backend are going to be, though it will likely boil down to
+    * either:
+    *
+    * 1) Do nothing, everything is in a VBO and is processed once
+    *       only.
+    *
+    * 2) Adjust the indices and vertex arrays so that start becomes
+    *    zero.
+    *
+    * Rather than doing anything here, I'll provide a helper function
+    * for the latter case elsewhere.
+    */
+
+   check_buffers_are_unmapped(exec->array.inputs);
+   vbo->draw_prims( ctx, exec->array.inputs, prim, 1, &ib,
+		    index_bounds_valid, start, end );
+}
+
+
+/**
+ * Called by glDrawRangeElementsBaseVertex() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
+				     GLuint start, GLuint end,
+				     GLsizei count, GLenum type,
+				     const GLvoid *indices,
+				     GLint basevertex)
+{
+   static GLuint warnCount = 0;
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx,
+                "glDrawRangeElementsBaseVertex(%s, %u, %u, %d, %s, %p, %d)\n",
+                _mesa_lookup_enum_by_nr(mode), start, end, count,
+                _mesa_lookup_enum_by_nr(type), indices, basevertex);
+
+   if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
+                                          type, indices, basevertex ))
+      return;
+
+   /* NOTE: It's important that 'end' is a reasonable value.
+    * in _tnl_draw_prims(), we use end to determine how many vertices
+    * to transform.  If it's too large, we can unnecessarily split prims
+    * or we can read/write out of memory in several different places!
+    */
+
+   /* Catch/fix some potential user errors */
+   if (type == GL_UNSIGNED_BYTE) {
+      start = MIN2(start, 0xff);
+      end = MIN2(end, 0xff);
+   }
+   else if (type == GL_UNSIGNED_SHORT) {
+      start = MIN2(start, 0xffff);
+      end = MIN2(end, 0xffff);
+   }
+
+   if (end >= ctx->Array.ArrayObj->_MaxElement) {
+      /* the max element is out of bounds of one or more enabled arrays */
+      warnCount++;
+
+      if (warnCount < 10) {
+         _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, "
+                       "type 0x%x, indices=%p)\n"
+                       "\tend is out of bounds (max=%u)  "
+                       "Element Buffer %u (size %d)\n"
+                       "\tThis should probably be fixed in the application.",
+                       start, end, count, type, indices,
+                       ctx->Array.ArrayObj->_MaxElement - 1,
+                       ctx->Array.ElementArrayBufferObj->Name,
+                       (int) ctx->Array.ElementArrayBufferObj->Size);
+      }
+
+      if (0)
+         dump_element_buffer(ctx, type);
+
+      if (0)
+         _mesa_print_arrays(ctx);
+
+#ifdef DEBUG
+      /* 'end' was out of bounds, but now let's check the actual array
+       * indexes to see if any of them are out of bounds.
+       */
+      {
+         GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
+                                             ctx->Array.ElementArrayBufferObj);
+         if (max >= ctx->Array.ArrayObj->_MaxElement) {
+            if (warnCount < 10) {
+               _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, "
+                             "count %d, type 0x%x, indices=%p)\n"
+                             "\tindex=%u is out of bounds (max=%u)  "
+                             "Element Buffer %u (size %d)\n"
+                             "\tSkipping the glDrawRangeElements() call",
+                             start, end, count, type, indices, max,
+                             ctx->Array.ArrayObj->_MaxElement - 1,
+                             ctx->Array.ElementArrayBufferObj->Name,
+                             (int) ctx->Array.ElementArrayBufferObj->Size);
+            }
+         }
+         /* XXX we could also find the min index and compare to 'start'
+          * to see if start is correct.  But it's more likely to get the
+          * upper bound wrong.
+          */
+      }
+#endif
+
+      /* Set 'end' to the max possible legal value */
+      assert(ctx->Array.ArrayObj->_MaxElement >= 1);
+      end = ctx->Array.ArrayObj->_MaxElement - 1;
+
+      if (end < start) {
+         return;
+      }
+   }
+
+   if (0) {
+      printf("glDraw[Range]Elements{,BaseVertex}"
+	     "(start %u, end %u, type 0x%x, count %d) ElemBuf %u, "
+	     "base %d\n",
+	     start, end, type, count,
+	     ctx->Array.ElementArrayBufferObj->Name,
+	     basevertex);
+   }
+
+#if 0
+   check_draw_elements_data(ctx, count, type, indices);
+#else
+   (void) check_draw_elements_data;
+#endif
+
+   vbo_validated_drawrangeelements(ctx, mode, GL_TRUE, start, end,
+				   count, type, indices, basevertex, 1);
+}
+
+
+/**
+ * Called by glDrawRangeElements() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
+                           GLsizei count, GLenum type, const GLvoid *indices)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx,
+                  "glDrawRangeElements(%s, %u, %u, %d, %s, %p)\n",
+                  _mesa_lookup_enum_by_nr(mode), start, end, count,
+                  _mesa_lookup_enum_by_nr(type), indices);
+
+   vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type,
+					indices, 0);
+}
+
+
+/**
+ * Called by glDrawElements() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
+                      const GLvoid *indices)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawElements(%s, %u, %s, %p)\n",
+                  _mesa_lookup_enum_by_nr(mode), count,
+                  _mesa_lookup_enum_by_nr(type), indices);
+
+   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
+      return;
+
+   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+				   count, type, indices, 0, 1);
+}
+
+
+/**
+ * Called by glDrawElementsBaseVertex() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
+				const GLvoid *indices, GLint basevertex)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawElementsBaseVertex(%s, %d, %s, %p, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), count,
+                  _mesa_lookup_enum_by_nr(type), indices, basevertex);
+
+   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
+				     basevertex ))
+      return;
+
+   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+				   count, type, indices, basevertex, 1);
+}
+
+
+/**
+ * Called by glDrawElementsInstanced() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
+                               const GLvoid *indices, GLsizei numInstances)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawElementsInstanced(%s, %d, %s, %p, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), count,
+                  _mesa_lookup_enum_by_nr(type), indices, numInstances);
+
+   if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
+                                             numInstances))
+      return;
+
+   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+				   count, type, indices, 0, numInstances);
+}
+
+
+/**
+ * Inner support for both _mesa_MultiDrawElements() and
+ * _mesa_MultiDrawRangeElements().
+ * This does the actual rendering after we've checked array indexes, etc.
+ */
+static void
+vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
+				const GLsizei *count, GLenum type,
+				const GLvoid **indices, GLsizei primcount,
+				const GLint *basevertex)
+{
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
+   struct _mesa_index_buffer ib;
+   struct _mesa_prim *prim;
+   unsigned int index_type_size = 0;
+   uintptr_t min_index_ptr, max_index_ptr;
+   GLboolean fallback = GL_FALSE;
+   int i;
+
+   if (primcount == 0)
+      return;
+
+   FLUSH_CURRENT( ctx, 0 );
+
+   if (!_mesa_valid_to_render(ctx, "glMultiDrawElements")) {
+      return;
+   }
+
+   prim = calloc(1, primcount * sizeof(*prim));
+   if (prim == NULL) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
+      return;
+   }
+
+   /* Decide if we can do this all as one set of primitives sharing the
+    * same index buffer, or if we have to reset the index pointer per
+    * primitive.
+    */
+   bind_arrays( ctx );
+
+   /* check for dirty state again */
+   if (ctx->NewState)
+      _mesa_update_state( ctx );
+
+   switch (type) {
+   case GL_UNSIGNED_INT:
+      index_type_size = 4;
+      break;
+   case GL_UNSIGNED_SHORT:
+      index_type_size = 2;
+      break;
+   case GL_UNSIGNED_BYTE:
+      index_type_size = 1;
+      break;
+   default:
+      assert(0);
+   }
+
+   min_index_ptr = (uintptr_t)indices[0];
+   max_index_ptr = 0;
+   for (i = 0; i < primcount; i++) {
+      min_index_ptr = MIN2(min_index_ptr, (uintptr_t)indices[i]);
+      max_index_ptr = MAX2(max_index_ptr, (uintptr_t)indices[i] +
+			   index_type_size * count[i]);
+   }
+
+   /* Check if we can handle this thing as a bunch of index offsets from the
+    * same index pointer.  If we can't, then we have to fall back to doing
+    * a draw_prims per primitive.
+    * Check that the difference between each prim's indexes is a multiple of
+    * the index/element size.
+    */
+   if (index_type_size != 1) {
+      for (i = 0; i < primcount; i++) {
+	 if ((((uintptr_t)indices[i] - min_index_ptr) % index_type_size) != 0) {
+	    fallback = GL_TRUE;
+	    break;
+	 }
+      }
+   }
+
+   /* If the index buffer isn't in a VBO, then treating the application's
+    * subranges of the index buffer as one large index buffer may lead to
+    * us reading unmapped memory.
+    */
+   if (!_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
+      fallback = GL_TRUE;
+
+   if (!fallback) {
+      ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
+      ib.type = type;
+      ib.obj = ctx->Array.ElementArrayBufferObj;
+      ib.ptr = (void *)min_index_ptr;
+
+      for (i = 0; i < primcount; i++) {
+	 prim[i].begin = (i == 0);
+	 prim[i].end = (i == primcount - 1);
+	 prim[i].weak = 0;
+	 prim[i].pad = 0;
+	 prim[i].mode = mode;
+	 prim[i].start = ((uintptr_t)indices[i] - min_index_ptr) / index_type_size;
+	 prim[i].count = count[i];
+	 prim[i].indexed = 1;
+         prim[i].num_instances = 1;
+	 if (basevertex != NULL)
+	    prim[i].basevertex = basevertex[i];
+	 else
+	    prim[i].basevertex = 0;
+      }
+
+      check_buffers_are_unmapped(exec->array.inputs);
+      vbo->draw_prims(ctx, exec->array.inputs, prim, primcount, &ib,
+		      GL_FALSE, ~0, ~0);
+   } else {
+      /* render one prim at a time */
+      for (i = 0; i < primcount; i++) {
+	 ib.count = count[i];
+	 ib.type = type;
+	 ib.obj = ctx->Array.ElementArrayBufferObj;
+	 ib.ptr = indices[i];
+
+	 prim[0].begin = 1;
+	 prim[0].end = 1;
+	 prim[0].weak = 0;
+	 prim[0].pad = 0;
+	 prim[0].mode = mode;
+	 prim[0].start = 0;
+	 prim[0].count = count[i];
+	 prim[0].indexed = 1;
+         prim[0].num_instances = 1;
+	 if (basevertex != NULL)
+	    prim[0].basevertex = basevertex[i];
+	 else
+	    prim[0].basevertex = 0;
+
+         check_buffers_are_unmapped(exec->array.inputs);
+         vbo->draw_prims(ctx, exec->array.inputs, prim, 1, &ib,
+                         GL_FALSE, ~0, ~0);
+      }
+   }
+
+   free(prim);
+}
+
+
+static void GLAPIENTRY
+vbo_exec_MultiDrawElements(GLenum mode,
+			   const GLsizei *count, GLenum type,
+			   const GLvoid **indices,
+			   GLsizei primcount)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLint i;
+
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   for (i = 0; i < primcount; i++) {
+      if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
+				       0))
+	 return;
+   }
+
+   vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
+				   NULL);
+}
+
+
+static void GLAPIENTRY
+vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
+				     const GLsizei *count, GLenum type,
+				     const GLvoid **indices,
+				     GLsizei primcount,
+				     const GLsizei *basevertex)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLint i;
+
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   for (i = 0; i < primcount; i++) {
+      if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
+				       basevertex[i]))
+	 return;
+   }
+
+   vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
+				   basevertex);
+}
+
+
+/**
+ * Plug in the immediate-mode vertex array drawing commands into the
+ * givven vbo_exec_context object.
+ */
+void
+vbo_exec_array_init( struct vbo_exec_context *exec )
+{
+   exec->vtxfmt.DrawArrays = vbo_exec_DrawArrays;
+   exec->vtxfmt.DrawElements = vbo_exec_DrawElements;
+   exec->vtxfmt.DrawRangeElements = vbo_exec_DrawRangeElements;
+   exec->vtxfmt.MultiDrawElementsEXT = vbo_exec_MultiDrawElements;
+   exec->vtxfmt.DrawElementsBaseVertex = vbo_exec_DrawElementsBaseVertex;
+   exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex;
+   exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex;
+   exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced;
+   exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced;
+}
+
+
+void
+vbo_exec_array_destroy( struct vbo_exec_context *exec )
+{
+   /* nothing to do */
+}
+
+
+
+/**
+ * The following functions are only used for OpenGL ES 1/2 support.
+ * And some aren't even supported (yet) in ES 1/2.
+ */
+
+
+void GLAPIENTRY
+_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+   vbo_exec_DrawArrays(mode, first, count);
+}
+
+
+void GLAPIENTRY
+_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
+                   const GLvoid *indices)
+{
+   vbo_exec_DrawElements(mode, count, type, indices);
+}
+
+
+void GLAPIENTRY
+_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
+			     const GLvoid *indices, GLint basevertex)
+{
+   vbo_exec_DrawElementsBaseVertex(mode, count, type, indices, basevertex);
+}
+
+
+void GLAPIENTRY
+_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
+                        GLenum type, const GLvoid *indices)
+{
+   vbo_exec_DrawRangeElements(mode, start, end, count, type, indices);
+}
+
+
+void GLAPIENTRY
+_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
+				  GLsizei count, GLenum type,
+				  const GLvoid *indices, GLint basevertex)
+{
+   vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type,
+					indices, basevertex);
+}
+
+
+void GLAPIENTRY
+_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
+			   const GLvoid **indices, GLsizei primcount)
+{
+   vbo_exec_MultiDrawElements(mode, count, type, indices, primcount);
+}
+
+
+void GLAPIENTRY
+_mesa_MultiDrawElementsBaseVertex(GLenum mode,
+				  const GLsizei *count, GLenum type,
+				  const GLvoid **indices, GLsizei primcount,
+				  const GLint *basevertex)
+{
+   vbo_exec_MultiDrawElementsBaseVertex(mode, count, type, indices,
+					primcount, basevertex);
+}
diff --git a/mesalib/windows/VC8/mesa/gdi/gdi.vcproj b/mesalib/windows/VC8/mesa/gdi/gdi.vcproj
deleted file mode 100644
index 220923f90..000000000
--- a/mesalib/windows/VC8/mesa/gdi/gdi.vcproj
+++ /dev/null
@@ -1,445 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="gdi"
-	ProjectGUID="{A1B24907-E196-4826-B6AF-26723629B633}"
-	RootNamespace="gdi"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/gdi.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;GDI_EXPORTS;_DLL;BUILD_GL32;MESA_MINWARN"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="0"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OPENGL32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\windows\gdi\mesa.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(TargetDir)OPENGL32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/gdi.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../main,../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;GDI_EXPORTS;_DLL;BUILD_GL32;MESA_MINWARN"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\Release/gdi.pch"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				CompileAs="0"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OPENGL32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\windows\gdi\mesa.def"
-				ProgramDatabaseFile="$(TargetDir)OPENGL32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/gdi.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;GDI_EXPORTS;BUILD_GL32;MESA_MINWARN"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="0"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OPENGL32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\windows\gdi\mesa.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(TargetDir)OPENGL32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/gdi.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../main,../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;GDI_EXPORTS;BUILD_GL32;MESA_MINWARN"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\Release/gdi.pch"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				CompileAs="0"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OPENGL32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\windows\gdi\mesa.def"
-				ProgramDatabaseFile="$(TargetDir)OPENGL32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OPENGL32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-			>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\common\driverfuncs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\windows\gdi\mesa.def"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\common\meta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\windows\gdi\wgl.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\windows\gdi\wmesa.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\windows\gdi\colors.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\common\driverfuncs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\common\meta.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\include\GL\wmesa.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\windows\gdi\wmesadef.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcproj b/mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcproj
deleted file mode 100644
index 6e9aef2e1..000000000
--- a/mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcproj
+++ /dev/null
@@ -1,305 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="glsl_apps_compile"
-	ProjectGUID="{98AB3D51-1820-4D14-9195-75FCA6997784}"
-	RootNamespace="glsl_apps_compile"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile="$(OutDir)\compile.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy &quot;$(OutDir)\compile.exe&quot; ..\..\..\..\src\glsl\apps"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile="$(OutDir)\compile.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy &quot;$(OutDir)\compile.exe&quot; ..\..\..\..\src\glsl\apps"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\..\..\..\src\glsl\apps\compile.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\cl\sl_cl_parse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_context.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_define.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_dict.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_error.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_expression.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_extension.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_if.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_line.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_macro.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_pragma.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_process.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_purify.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token_util.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_version.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\..\..\src\glsl\cl\sl_cl_parse.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_context.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_dict.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_expression.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_macro.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_process.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_public.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_purify.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token_util.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/mesalib/windows/VC8/mesa/glu/glu.vcproj b/mesalib/windows/VC8/mesa/glu/glu.vcproj
deleted file mode 100644
index b3b4b10d7..000000000
--- a/mesalib/windows/VC8/mesa/glu/glu.vcproj
+++ /dev/null
@@ -1,1202 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="glu"
-	ProjectGUID="{2E50FDAF-430B-475B-AE6B-60B68F2875BA}"
-	RootNamespace="glu"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/glu.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../../../include;../../../../src/glu/sgi/include;../../../../src/glu/sgi/libnurbs/interface;../../../../src/glu/sgi/libnurbs/internals;../../../../src/glu/sgi/libnurbs/nurbtess"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GLU32;LIBRARYBUILD;_CRT_SECURE_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				OutputFile="$(OutDir)\GLU32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\glu\sgi\glu.def"
-				ProgramDatabaseFile="$(TargetDir)GLU32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/glu.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include;../../../../src/glu/sgi/include;../../../../src/glu/sgi/libnurbs/interface;../../../../src/glu/sgi/libnurbs/internals;../../../../src/glu/sgi/libnurbs/nurbtess"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GLU32;LIBRARYBUILD;_CRT_SECURE_NO_DEPRECATE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				OutputFile="$(OutDir)\GLU32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\glu\sgi\glu.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(TargetDir)GLU32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/glu.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include;../../../../src/glu/sgi/include;../../../../src/glu/sgi/libnurbs/interface;../../../../src/glu/sgi/libnurbs/internals;../../../../src/glu/sgi/libnurbs/nurbtess"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GLU32;LIBRARYBUILD;_CRT_SECURE_NO_DEPRECATE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				OutputFile="$(OutDir)\GLU32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\glu\sgi\glu.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(TargetDir)GLU32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/glu.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../../../include;../../../../src/glu/sgi/include;../../../../src/glu/sgi/libnurbs/interface;../../../../src/glu/sgi/libnurbs/internals;../../../../src/glu/sgi/libnurbs/nurbtess"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GLU_EXPORTS;BUILD_GLU32;LIBRARYBUILD;_CRT_SECURE_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				OutputFile="$(OutDir)\GLU32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\glu\sgi\glu.def"
-				ProgramDatabaseFile="$(TargetDir)GLU32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)GLU32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-			>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\dict.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libutil\error.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\geom.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\glu.def"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libutil\glue.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\memalloc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\mesh.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libutil\mipmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\normal.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\priorityq-heap.c"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\priorityq.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libutil\project.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libutil\quad.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libutil\registry.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\render.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\sweep.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\tess.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\tessmono.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\arc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\arcsorter.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\arctess.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\backend.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\basiccrveval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\basicsurfeval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\bezierarc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\bezierEval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatchMesh.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\bin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\bufpool.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\cachingeval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\coveandtiler.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\curve.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\curvelist.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\dataTransform.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\defines.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\definitions.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\dict-list.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\dict.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\directedLine.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\displaylist.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\displaymode.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\flist.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\flistsorter.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\geom.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glcurveval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\glimports.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glimports.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glrenderer.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glsurfeval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libutil\gluint.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\include\gluos.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\gridline.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\gridtrimvertex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\gridvertex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\gridWrap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\hull.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\jarcloc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\knotvector.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mapdesc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\maplist.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\memalloc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\mesh.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mesher.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoChain.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoPolyPart.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\monotonizer.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoTriangulation.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\myassert.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mymath.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mysetjmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdio.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\mystdio.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdlib.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\mystdlib.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mystring.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\normal.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\nurbsconsts.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\nurbstess.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionX.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionY.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\patch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\patchlist.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyDBG.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyUtil.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\primitiveStream.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\priorityq-heap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\priorityq-sort.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\priorityq.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\pwlarc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\quicksort.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\quilt.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\reader.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\rectBlock.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\render.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\renderhints.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleComp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompBot.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompRight.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompTop.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampledLine.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleMonoPoly.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\searchTree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\simplemath.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\slicer.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\sorter.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\subdivider.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\sweep.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\tess.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\tessmono.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\trimline.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\trimregion.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertpool.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\types.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\uarray.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\varray.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\zlassert.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="C++ files"
-			Filter=".cc"
-			>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\arc.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\arcsorter.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\arctess.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\backend.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\basiccrveval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\basicsurfeval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\bezierEval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatch.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatchMesh.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\bin.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\bufpool.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\cachingeval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\ccw.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\coveandtiler.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\curve.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\curvelist.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\curvesub.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\dataTransform.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\directedLine.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\displaylist.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\flist.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\flistsorter.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glcurveval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glinterface.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glrenderer.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\glsurfeval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\gridWrap.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\hull.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\incurveeval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\interface\insurfeval.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\intersect.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\knotvector.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mapdesc.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mapdescv.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\maplist.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mesher.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoChain.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoPolyPart.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\monotonizer.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoTriangulation.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\monoTriangulationBackend.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\mycode.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\nurbsinterfac.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\nurbstess.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionX.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionY.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\patch.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\patchlist.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyDBG.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyUtil.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\primitiveStream.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\quicksort.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\quilt.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\reader.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libtess\README"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\rectBlock.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\renderhints.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleComp.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompBot.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompRight.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompTop.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampledLine.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleMonoPoly.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\nurbtess\searchTree.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\slicer.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\sorter.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\splitarcs.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\subdivider.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\tobezier.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\trimline.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\trimregion.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertpool.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\uarray.cc"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glu\sgi\libnurbs\internals\varray.cc"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-			>
-		</Filter>
-		<File
-			RelativePath="..\..\..\..\src\glu\sgi\libtess\alg-outline"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/mesalib/windows/VC8/mesa/mesa.sln b/mesalib/windows/VC8/mesa/mesa.sln
deleted file mode 100644
index 915e00026..000000000
--- a/mesalib/windows/VC8/mesa/mesa.sln
+++ /dev/null
@@ -1,77 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdi", "gdi\gdi.vcproj", "{A1B24907-E196-4826-B6AF-26723629B633}"
-	ProjectSection(ProjectDependencies) = postProject
-		{2120C974-2717-4709-B44F-D6E6D0A56448} = {2120C974-2717-4709-B44F-D6E6D0A56448}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glu", "glu\glu.vcproj", "{2E50FDAF-430B-475B-AE6B-60B68F2875BA}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A1B24907-E196-4826-B6AF-26723629B633} = {A1B24907-E196-4826-B6AF-26723629B633}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mesa", "mesa\mesa.vcproj", "{2120C974-2717-4709-B44F-D6E6D0A56448}"
-	ProjectSection(ProjectDependencies) = postProject
-		{98AB3D51-1820-4D14-9195-75FCA6997784} = {98AB3D51-1820-4D14-9195-75FCA6997784}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osmesa", "osmesa\osmesa.vcproj", "{8D6CD423-383B-49E7-81BC-D20C70B07DF5}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A1B24907-E196-4826-B6AF-26723629B633} = {A1B24907-E196-4826-B6AF-26723629B633}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glsl_apps_compile", "glsl_apps_compile\glsl_apps_compile.vcproj", "{98AB3D51-1820-4D14-9195-75FCA6997784}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug Static CRT|Win32 = Debug Static CRT|Win32
-		Debug|Win32 = Debug|Win32
-		Release Static CRT|Win32 = Release Static CRT|Win32
-		Release|Win32 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{A1B24907-E196-4826-B6AF-26723629B633}.Debug Static CRT|Win32.ActiveCfg = Debug Static CRT|Win32
-		{A1B24907-E196-4826-B6AF-26723629B633}.Debug Static CRT|Win32.Build.0 = Debug Static CRT|Win32
-		{A1B24907-E196-4826-B6AF-26723629B633}.Debug|Win32.ActiveCfg = Debug|Win32
-		{A1B24907-E196-4826-B6AF-26723629B633}.Debug|Win32.Build.0 = Debug|Win32
-		{A1B24907-E196-4826-B6AF-26723629B633}.Release Static CRT|Win32.ActiveCfg = Release Static CRT|Win32
-		{A1B24907-E196-4826-B6AF-26723629B633}.Release Static CRT|Win32.Build.0 = Release Static CRT|Win32
-		{A1B24907-E196-4826-B6AF-26723629B633}.Release|Win32.ActiveCfg = Release|Win32
-		{A1B24907-E196-4826-B6AF-26723629B633}.Release|Win32.Build.0 = Release|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug Static CRT|Win32.ActiveCfg = Debug Static CRT|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug Static CRT|Win32.Build.0 = Debug Static CRT|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug|Win32.ActiveCfg = Debug|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug|Win32.Build.0 = Debug|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release Static CRT|Win32.ActiveCfg = Release Static CRT|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release Static CRT|Win32.Build.0 = Release Static CRT|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release|Win32.ActiveCfg = Release|Win32
-		{2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release|Win32.Build.0 = Release|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Debug Static CRT|Win32.ActiveCfg = Debug Static CRT|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Debug Static CRT|Win32.Build.0 = Debug Static CRT|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Debug|Win32.ActiveCfg = Debug|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Debug|Win32.Build.0 = Debug|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Release Static CRT|Win32.ActiveCfg = Release Static CRT|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Release Static CRT|Win32.Build.0 = Release Static CRT|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Release|Win32.ActiveCfg = Release|Win32
-		{2120C974-2717-4709-B44F-D6E6D0A56448}.Release|Win32.Build.0 = Release|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug Static CRT|Win32.ActiveCfg = Debug Static CRT|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug Static CRT|Win32.Build.0 = Debug Static CRT|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug|Win32.ActiveCfg = Debug|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug|Win32.Build.0 = Debug|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release Static CRT|Win32.ActiveCfg = Release Static CRT|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release Static CRT|Win32.Build.0 = Release Static CRT|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release|Win32.ActiveCfg = Release|Win32
-		{8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release|Win32.Build.0 = Release|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Debug Static CRT|Win32.ActiveCfg = Debug|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Debug Static CRT|Win32.Build.0 = Debug|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Debug|Win32.ActiveCfg = Debug|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Debug|Win32.Build.0 = Debug|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Release Static CRT|Win32.ActiveCfg = Release|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Release Static CRT|Win32.Build.0 = Release|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Release|Win32.ActiveCfg = Release|Win32
-		{98AB3D51-1820-4D14-9195-75FCA6997784}.Release|Win32.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
diff --git a/mesalib/windows/VC8/mesa/mesa/mesa.vcproj b/mesalib/windows/VC8/mesa/mesa/mesa.vcproj
deleted file mode 100644
index 5a5b93a77..000000000
--- a/mesalib/windows/VC8/mesa/mesa/mesa.vcproj
+++ /dev/null
@@ -1,2434 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="mesa"
-	ProjectGUID="{2120C974-2717-4709-B44F-D6E6D0A56448}"
-	RootNamespace="mesa"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				CommandLine=""
-				ExcludedFromBuild="false"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-				CommandLine=""
-				Outputs=""
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalOptions="/Zm1000 "
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/glapi,../../../../src/mesa/main,../../../../src/mesa/shader,../../../../src/mesa/shader/slang"
-				PreprocessorDefinitions="NDEBUG;WIN32;_LIB;_DLL;BUILD_GL32;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				CompileAs="0"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				CommandLine=""
-				ExcludedFromBuild="false"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-				CommandLine=""
-				Outputs=""
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalOptions="/Zm1000 "
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/glapi,../../../../src/mesa/main,../../../../src/mesa/shader,../../../../src/mesa/shader/slang"
-				PreprocessorDefinitions="_DEBUG;WIN32;_LIB;_DLL;BUILD_GL32;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="1"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				CommandLine=""
-				ExcludedFromBuild="false"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-				CommandLine=""
-				Outputs=""
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalOptions="/Zm1000 "
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/glapi,../../../../src/mesa/main,../../../../src/mesa/shader,../../../../src/mesa/shader/slang"
-				PreprocessorDefinitions="_DEBUG;WIN32;_LIB;BUILD_GL32;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="0"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				CommandLine=""
-				ExcludedFromBuild="false"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-				CommandLine=""
-				Outputs=""
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalOptions="/Zm1000 "
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/glapi,../../../../src/mesa/main,../../../../src/mesa/shader,../../../../src/mesa/shader/slang"
-				PreprocessorDefinitions="NDEBUG;WIN32;_LIB;BUILD_GL32;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				CompileAs="0"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-		<ProjectReference
-			ReferencedProjectIdentifier="{98AB3D51-1820-4D14-9195-75FCA6997784}"
-			RelativePathToProject=".\glsl_apps_compile\glsl_apps_compile.vcproj"
-		/>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-			>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\accum.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_arrayelt.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_exec.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_loopback.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_noop.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_validate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\arbprogparse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\arbprogram.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\arrayobj.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\atifragshader.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\attrib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\blend.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\bufferobj.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\buffers.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\clear.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\clip.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\colortab.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\condrender.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\context.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\convolve.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\cpuinfo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\debug.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\depth.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\depthstencil.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\dlist.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\dlopen.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\drawpix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\enable.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\enums.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\eval.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\execmem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\extensions.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\fbobject.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\feedback.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\ffvertex_prog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\fog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\formats.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\framebuffer.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\get.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\getstring.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapi.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapi_dispatch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapi_entrypoint.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapi_getproc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapi_nop.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glthread.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\hash_table.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\hint.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\histogram.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\image.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\imports.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\lex.yy.c"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YY_USE_CONST;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YY_USE_CONST;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YY_USE_CONST;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YY_USE_CONST;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\light.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\lines.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_debug_clip.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_debug_norm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_debug_xform.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_eval.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_matrix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_translate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_vector.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_xform.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\matrix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\mipmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\mm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\multisample.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\nvfragparse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\nvprogram.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\nvvertparse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\pixel.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\pixelstore.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\points.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\polygon.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_cache.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_execute.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_instruction.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_noise.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_optimize.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_parameter.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_parameter_layout.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_print.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_statevars.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_uniform.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\program.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\program_parse.tab.c"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YYMALLOC=malloc;YYFREE=free"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YYMALLOC=malloc;YYFREE=free"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YYMALLOC=malloc;YYFREE=free"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions="YYMALLOC=malloc;YYFREE=free"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\program_parse_extra.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\programopt.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\queryobj.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\rastpos.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\rbadaptors.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\readpix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\remap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\renderbuffer.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_aaline.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_aatriangle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_accum.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_alpha.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_atifragshader.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_bitmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_blend.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_blit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_clear.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_context.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_copypix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_depth.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_drawpix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_feedback.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_fog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_fragprog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_lines.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_logic.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_masking.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_points.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_readpix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_span.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_stencil.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_texcombine.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_texfilter.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_triangle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_zoom.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\scissor.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\shader_api.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\shaders.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\shared.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\cl\sl_cl_parse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_context.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_define.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_dict.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_error.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_expression.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_extension.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_if.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_line.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_macro.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_pragma.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_process.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_purify.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token_util.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_version.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_builtin.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_codegen.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_function.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_operation.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_struct.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_variable.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_emit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_ir.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_label.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_link.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_log.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_mem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_print.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_simplify.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_storage.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_typeinfo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_utility.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_vartable.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast_setup\ss_context.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast_setup\ss_triangle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\state.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\stencil.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\symbol_table.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\syncobj.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_context.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_draw.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_pipeline.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_rasterpos.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_cull.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_fog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_light.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_normals.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_points.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_program.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_render.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_texgen.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_texmat.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_vertex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vertex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vertex_generic.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vp_build.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texcompress.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texcompress_fxt1.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texcompress_s3tc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texenvprogram.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texfetch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texformat.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texgen.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texgetimage.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\teximage.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texobj.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texparam.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texrender.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texstate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texstore.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\varray.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_context.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_exec.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_exec_api.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_exec_array.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_exec_draw.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_exec_eval.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_rebase.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_save.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_save_api.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_save_draw.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_save_loopback.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_split.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_split_copy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_split_inplace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\version.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\viewport.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\vtxfmt.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\accum.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_arrayelt.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_exec.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_loopback.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_noop.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\api_validate.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\arbprogparse.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\arbprogram.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\arrayobj.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\atifragshader.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\attrib.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\bitset.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\blend.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\bufferobj.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\buffers.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\clear.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\clip.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\colormac.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\colortab.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\condrender.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\config.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\context.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\convolve.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\cpuinfo.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\dd.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\debug.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\depth.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\depthstencil.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\dlist.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\dlopen.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\drawpix.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\enable.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\enums.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\eval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\extensions.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\fbobject.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\feedback.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\ffvertex_prog.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\fog.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\formats.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\framebuffer.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\get.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapi.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapioffsets.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapitable.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glapitemp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\glheader.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glprocs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\glapi\glthread.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\hash.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\hash_table.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\hint.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\histogram.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\image.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\imports.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\light.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\lines.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_clip_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_copy_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_debug.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_debug_util.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_dotprod_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_eval.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_matrix.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_norm_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_trans_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_translate.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_vector.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_xform.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\math\m_xform_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\macros.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\matrix.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\mfeatures.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\mipmap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\mm.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\mtypes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\multisample.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\nvfragparse.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\nvprogram.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\nvvertparse.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\pixel.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\pixelstore.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\points.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\polygon.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_execute.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_instruction.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_noise.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_optimize.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_parameter.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_parameter_layout.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_print.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_statevars.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\prog_uniform.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\program.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\program_parse.tab.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\programopt.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\queryobj.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\rastpos.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\rbadaptors.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\readpix.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\remap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\renderbuffer.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_aaline.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_aalinetemp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_aatriangle.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_aatritemp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_accum.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_alpha.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_atifragshader.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_blend.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_context.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_depth.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_drawpix.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_feedback.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_fog.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_fragprog.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_lines.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_linetemp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_logic.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_masking.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_points.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_span.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_spantemp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_stencil.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_texcombine.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_texfilter.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_triangle.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_trispan.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_tritemp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\s_zoom.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\scissor.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\shader_api.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\shaders.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\shared.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\simple_list.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\cl\sl_cl_parse.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_context.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_dict.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_expression.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_macro.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_process.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_public.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_purify.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\glsl\pp\sl_pp_token_util.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_120_core.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_120_core_gc.h"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_builtin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_common_gc.h"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc ..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_builtin_120_fragment_gc.h"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_codegen.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_common_builtin_gc.h"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_function.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_operation.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_struct.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_compile_variable.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_core.gc ..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_core_gc.h"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_emit.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe fragment ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_fragment_builtin_gc.h"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_ir.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_label.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_link.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_log.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_mem.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_print.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_simplify.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_storage.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_typeinfo.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_utility.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\slang_vartable.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe vertex ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe vertex ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe vertex ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release Static CRT|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Building predefined shaders"
-						CommandLine="..\..\..\..\src\glsl\apps\compile.exe vertex ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc ..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h&#x0D;&#x0A;"
-						AdditionalDependencies="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin.gc"
-						Outputs="..\..\..\..\src\mesa\shader\slang\library\slang_vertex_builtin_gc.h"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast_setup\ss_context.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast_setup\ss_triangle.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast_setup\ss_tritmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast_setup\ss_vb.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\state.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\stencil.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast\swrast.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\swrast_setup\swrast_setup.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\shader\symbol_table.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\syncobj.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_context.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_pipeline.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_cliptmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_lighttmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vb_rendertmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vertex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\t_vp_build.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texcompress.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texenv.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texenvprogram.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texfetch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texfetch_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texformat.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texgen.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texgetimage.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\teximage.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texobj.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texparam.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texrender.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texstate.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\texstore.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\tnl\tnl.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\varray.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_attrib.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_attrib_tmp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_context.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_exec.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_save.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\vbo\vbo_split.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\version.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\viewport.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\vtxfmt.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\main\vtxfmt_tmp.h"
-				>
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/mesalib/windows/VC8/mesa/osmesa/osmesa.vcproj b/mesalib/windows/VC8/mesa/osmesa/osmesa.vcproj
deleted file mode 100644
index 10f2dc971..000000000
--- a/mesalib/windows/VC8/mesa/osmesa/osmesa.vcproj
+++ /dev/null
@@ -1,413 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="osmesa"
-	ProjectGUID="{8D6CD423-383B-49E7-81BC-D20C70B07DF5}"
-	RootNamespace="osmesa"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/osmesa.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OSMESA_EXPORTS;BUILD_GL32"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				CompileAs="0"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OSMESA32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\osmesa\osmesa.def"
-				ProgramDatabaseFile="$(TargetDir)OSMESA32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/osmesa.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OSMESA_EXPORTS;BUILD_GL32"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="0"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OSMESA32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\osmesa\osmesa.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(TargetDir)OSMESA32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/osmesa.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OSMESA_EXPORTS;BUILD_GL32"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="0"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OSMESA32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\osmesa\osmesa.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(TargetDir)OSMESA32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release Static CRT|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/osmesa.tlb"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../../../include,../../../../src/mesa,../../../../src/mesa/main,../../../../src/mesa/glapi,../../../../src/mesa/swrast,../../../../src/mesa/shader"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OSMESA_EXPORTS;BUILD_GL32"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				CompileAs="0"
-				ForcedIncludeFiles="../../../../src/mesa/main/compiler.h"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="gdi32.lib user32.lib"
-				OutputFile="$(OutDir)\OSMESA32.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(TargetDir)"
-				ModuleDefinitionFile="..\..\..\..\src\mesa\drivers\osmesa\osmesa.def"
-				ProgramDatabaseFile="$(TargetDir)OSMESA32.pdb"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="if not exist ..\..\..\..\lib md ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.LIB&quot; ..\..\..\..\lib&#x0D;&#x0A;copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\lib&#x0D;&#x0A;if exist ..\..\..\..\progs\demos copy &quot;$(TargetDir)OSMESA32.DLL&quot; ..\..\..\..\progs\demos&#x0D;&#x0A;"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-			>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\osmesa\osmesa.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\mesa\drivers\osmesa\osmesa.def"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/pixman/configure.ac b/pixman/configure.ac
index db9a883b6..ef8162fc3 100644
--- a/pixman/configure.ac
+++ b/pixman/configure.ac
@@ -54,7 +54,7 @@ AC_PREREQ([2.57])
 
 m4_define([pixman_major], 0)
 m4_define([pixman_minor], 21)
-m4_define([pixman_micro], 7)
+m4_define([pixman_micro], 9)
 
 m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro])
 
@@ -119,7 +119,7 @@ for w in -Werror -errwarn; do
 		[CFLAGS=$w],
 		[int main(int c, char **v) { (void)c; (void)v; return 0; }],
 		[WERROR=$w; yesno=yes], [yesno=no])
-	AC_MSG_RESULT($_yesno)
+	AC_MSG_RESULT($yesno)
     fi
 done
 
@@ -192,35 +192,43 @@ dnl =========================================================================
 dnl OpenMP for the test suite?
 dnl
 
-# Check for OpenMP support (only supported by autoconf >=2.62)
+# Check for OpenMP support only when autoconf support that (require autoconf >=2.62)
 OPENMP_CFLAGS=
 m4_ifdef([AC_OPENMP], [AC_OPENMP])
 
-m4_define([openmp_test_program],[dnl
-#include <stdio.h>
+if test "x$enable_openmp" = "xyes" && test "x$ac_cv_prog_c_openmp" = "xunsupported" ; then
+  AC_MSG_WARN([OpenMP support requested but found unsupported])
+fi
 
-extern unsigned int lcg_seed;
-#pragma omp threadprivate(lcg_seed)
-unsigned int lcg_seed;
+dnl May not fail to link without -Wall -Werror added
+dnl So try to link only when openmp is supported
+dnl ac_cv_prog_c_openmp is not defined when --disable-openmp is used
+if test "x$ac_cv_prog_c_openmp" != "xunsupported" && test "x$ac_cv_prog_c_openmp" != "x"; then
+  m4_define([openmp_test_program],[dnl
+  #include <stdio.h>
 
-unsigned function(unsigned a, unsigned b)
-{
+  extern unsigned int lcg_seed;
+  #pragma omp threadprivate(lcg_seed)
+  unsigned int lcg_seed;
+
+  unsigned function(unsigned a, unsigned b)
+  {
 	lcg_seed ^= b;
 	return ((a + b) ^ a ) + lcg_seed;
-}
+  }
 
-int main(int argc, char **argv)
-{
+  int main(int argc, char **argv)
+  {
 	int i;
 	int n1 = 0, n2 = argc;
 	unsigned checksum = 0;
 	int verbose = argv != NULL;
 	unsigned (*test_function)(unsigned, unsigned);
 	test_function = function;
-    #pragma omp parallel for reduction(+:checksum) default(none) \
+	#pragma omp parallel for reduction(+:checksum) default(none) \
 					shared(n1, n2, test_function, verbose)
 	for (i = n1; i < n2; i++)
-    	{
+	{
 		unsigned crc = test_function (i, 0);
 		if (verbose)
 			printf ("%d: %08X\n", i, crc);
@@ -228,18 +236,17 @@ int main(int argc, char **argv)
 	}
 	printf("%u\n", checksum);
 	return 0;
-}
-])
+  }
+  ])
 
-PIXMAN_LINK_WITH_ENV(
+  PIXMAN_LINK_WITH_ENV(
 	[CFLAGS="$OPENMP_CFLAGS" LDFLAGS="$OPENMP_CFLAGS"],
 	[openmp_test_program],
 	[have_openmp=yes],
 	[have_openmp=no])
-if test "x$have_openmp" = "xyes"; then
-   AC_DEFINE(USE_OPENMP, 1, [use OpenMP in the test suite])
-else
-   OPENMP_CFLAGS=""
+  if test "x$have_openmp" = "xyes" ; then
+    AC_DEFINE(USE_OPENMP, 1, [use OpenMP in the test suite])
+  fi
 fi
 AC_SUBST(OPENMP_CFLAGS)
 
diff --git a/pixman/demos/tri-test.c b/pixman/demos/tri-test.c
index 23ea18cb3..a71869a6a 100644
--- a/pixman/demos/tri-test.c
+++ b/pixman/demos/tri-test.c
@@ -1,48 +1,48 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "../test/utils.h"
-#include "gtk-utils.h"
-
-int
-main (int argc, char **argv)
-{
-#define WIDTH 200
-#define HEIGHT 200
-
-#define POINT(x,y)							\
-    { pixman_double_to_fixed ((x)), pixman_double_to_fixed ((y)) }
-    
-    pixman_image_t *src_img, *dest_img;
-    pixman_triangle_t tris[4] =
-    {
-	{ POINT (100, 100), POINT (10, 50), POINT (110, 10) },
-	{ POINT (100, 100), POINT (150, 10), POINT (200, 50) },
-	{ POINT (100, 100), POINT (10, 170), POINT (90, 175) },
-	{ POINT (100, 100), POINT (170, 150), POINT (120, 190) },
-    };
-    pixman_color_t color = { 0x4444, 0x4444, 0xffff, 0xffff };
-    uint32_t *bits = malloc (WIDTH * HEIGHT * 4);
-    int i;
-
-    for (i = 0; i < WIDTH * HEIGHT; ++i)
-	bits[i] = (i / HEIGHT) * 0x01010000;
-    
-    src_img = pixman_image_create_solid_fill (&color);
-    dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, WIDTH * 4);
-    
-    pixman_composite_triangles (PIXMAN_OP_ATOP_REVERSE,
-				src_img,
-				dest_img,
-				PIXMAN_a8,
-				200, 200,
-				35, 5,
-				ARRAY_LENGTH (tris), tris);
-    show_image (dest_img);
-    
-    pixman_image_unref (src_img);
-    pixman_image_unref (dest_img);
-    free (bits);
-    
-    return 0;
-}
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "../test/utils.h"
+#include "gtk-utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 200
+#define HEIGHT 200
+
+#define POINT(x,y)							\
+    { pixman_double_to_fixed ((x)), pixman_double_to_fixed ((y)) }
+    
+    pixman_image_t *src_img, *dest_img;
+    pixman_triangle_t tris[4] =
+    {
+	{ POINT (100, 100), POINT (10, 50), POINT (110, 10) },
+	{ POINT (100, 100), POINT (150, 10), POINT (200, 50) },
+	{ POINT (100, 100), POINT (10, 170), POINT (90, 175) },
+	{ POINT (100, 100), POINT (170, 150), POINT (120, 190) },
+    };
+    pixman_color_t color = { 0x4444, 0x4444, 0xffff, 0xffff };
+    uint32_t *bits = malloc (WIDTH * HEIGHT * 4);
+    int i;
+
+    for (i = 0; i < WIDTH * HEIGHT; ++i)
+	bits[i] = (i / HEIGHT) * 0x01010000;
+    
+    src_img = pixman_image_create_solid_fill (&color);
+    dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, WIDTH * 4);
+    
+    pixman_composite_triangles (PIXMAN_OP_ATOP_REVERSE,
+				src_img,
+				dest_img,
+				PIXMAN_a8,
+				200, 200,
+				-5, 5,
+				ARRAY_LENGTH (tris), tris);
+    show_image (dest_img);
+    
+    pixman_image_unref (src_img);
+    pixman_image_unref (dest_img);
+    free (bits);
+    
+    return 0;
+}
diff --git a/pixman/pixman/Makefile.am b/pixman/pixman/Makefile.am
index d016e9f25..be0826680 100644
--- a/pixman/pixman/Makefile.am
+++ b/pixman/pixman/Makefile.am
@@ -115,6 +115,7 @@ libpixman_arm_neon_la_SOURCES = \
         pixman-arm-neon.c	\
         pixman-arm-common.h	\
         pixman-arm-neon-asm.S	\
+		pixman-arm-neon-asm-bilinear.S \
         pixman-arm-neon-asm.h
 libpixman_arm_neon_la_CFLAGS = $(DEP_CFLAGS)
 libpixman_arm_neon_la_LIBADD = $(DEP_LIBS)
diff --git a/pixman/pixman/pixman-arm-common.h b/pixman/pixman/pixman-arm-common.h
index 2c435041a..6cd8be506 100644
--- a/pixman/pixman/pixman-arm-common.h
+++ b/pixman/pixman/pixman-arm-common.h
@@ -1,409 +1,454 @@
-/*
- * Copyright © 2010 Nokia Corporation
- *
- * 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.
- *
- * Author:  Siarhei Siamashka (siarhei.siamashka@nokia.com)
- */
-
-#ifndef PIXMAN_ARM_COMMON_H
-#define PIXMAN_ARM_COMMON_H
-
-#include "pixman-fast-path.h"
-
-/* Define some macros which can expand into proxy functions between
- * ARM assembly optimized functions and the rest of pixman fast path API.
- *
- * All the low level ARM assembly functions have to use ARM EABI
- * calling convention and take up to 8 arguments:
- *    width, height, dst, dst_stride, src, src_stride, mask, mask_stride
- *
- * The arguments are ordered with the most important coming first (the
- * first 4 arguments are passed to function in registers, the rest are
- * on stack). The last arguments are optional, for example if the
- * function is not using mask, then 'mask' and 'mask_stride' can be
- * omitted when doing a function call.
- *
- * Arguments 'src' and 'mask' contain either a pointer to the top left
- * pixel of the composited rectangle or a pixel color value depending
- * on the function type. In the case of just a color value (solid source
- * or mask), the corresponding stride argument is unused.
- */
-
-#define SKIP_ZERO_SRC  1
-#define SKIP_ZERO_MASK 2
-
-#define PIXMAN_ARM_BIND_FAST_PATH_SRC_DST(cputype, name,                \
-                                          src_type, src_cnt,            \
-                                          dst_type, dst_cnt)            \
-void                                                                    \
-pixman_composite_##name##_asm_##cputype (int32_t   w,                   \
-                                         int32_t   h,                   \
-                                         dst_type *dst,                 \
-                                         int32_t   dst_stride,          \
-                                         src_type *src,                 \
-                                         int32_t   src_stride);         \
-                                                                        \
-static void                                                             \
-cputype##_composite_##name (pixman_implementation_t *imp,               \
-                            pixman_op_t              op,                \
-                            pixman_image_t *         src_image,         \
-                            pixman_image_t *         mask_image,        \
-                            pixman_image_t *         dst_image,         \
-                            int32_t                  src_x,             \
-                            int32_t                  src_y,             \
-                            int32_t                  mask_x,            \
-                            int32_t                  mask_y,            \
-                            int32_t                  dest_x,            \
-                            int32_t                  dest_y,            \
-                            int32_t                  width,             \
-                            int32_t                  height)            \
-{                                                                       \
-    dst_type *dst_line;                                                 \
-    src_type *src_line;                                                 \
-    int32_t dst_stride, src_stride;                                     \
-                                                                        \
-    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type,           \
-                           src_stride, src_line, src_cnt);              \
-    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
-                           dst_stride, dst_line, dst_cnt);              \
-                                                                        \
-    pixman_composite_##name##_asm_##cputype (width, height,             \
-                                             dst_line, dst_stride,      \
-                                             src_line, src_stride);     \
-}
-
-#define PIXMAN_ARM_BIND_FAST_PATH_N_DST(flags, cputype, name,           \
-                                        dst_type, dst_cnt)              \
-void                                                                    \
-pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
-                                         int32_t    h,                  \
-                                         dst_type  *dst,                \
-                                         int32_t    dst_stride,         \
-                                         uint32_t   src);               \
-                                                                        \
-static void                                                             \
-cputype##_composite_##name (pixman_implementation_t *imp,               \
-                            pixman_op_t              op,                \
-                            pixman_image_t *         src_image,         \
-                            pixman_image_t *         mask_image,        \
-                            pixman_image_t *         dst_image,         \
-                            int32_t                  src_x,             \
-                            int32_t                  src_y,             \
-                            int32_t                  mask_x,            \
-                            int32_t                  mask_y,            \
-                            int32_t                  dest_x,            \
-                            int32_t                  dest_y,            \
-                            int32_t                  width,             \
-                            int32_t                  height)            \
-{                                                                       \
-    dst_type  *dst_line;                                                \
-    int32_t    dst_stride;                                              \
-    uint32_t   src;                                                     \
-                                                                        \
-    src = _pixman_image_get_solid (					\
-	imp, src_image, dst_image->bits.format);			\
-                                                                        \
-    if ((flags & SKIP_ZERO_SRC) && src == 0)                            \
-	return;                                                         \
-                                                                        \
-    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
-                           dst_stride, dst_line, dst_cnt);              \
-                                                                        \
-    pixman_composite_##name##_asm_##cputype (width, height,             \
-                                             dst_line, dst_stride,      \
-                                             src);                      \
-}
-
-#define PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST(flags, cputype, name,      \
-                                             mask_type, mask_cnt,       \
-                                             dst_type, dst_cnt)         \
-void                                                                    \
-pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
-                                         int32_t    h,                  \
-                                         dst_type  *dst,                \
-                                         int32_t    dst_stride,         \
-                                         uint32_t   src,                \
-                                         int32_t    unused,             \
-                                         mask_type *mask,               \
-                                         int32_t    mask_stride);       \
-                                                                        \
-static void                                                             \
-cputype##_composite_##name (pixman_implementation_t *imp,               \
-                            pixman_op_t              op,                \
-                            pixman_image_t *         src_image,         \
-                            pixman_image_t *         mask_image,        \
-                            pixman_image_t *         dst_image,         \
-                            int32_t                  src_x,             \
-                            int32_t                  src_y,             \
-                            int32_t                  mask_x,            \
-                            int32_t                  mask_y,            \
-                            int32_t                  dest_x,            \
-                            int32_t                  dest_y,            \
-                            int32_t                  width,             \
-                            int32_t                  height)            \
-{                                                                       \
-    dst_type  *dst_line;                                                \
-    mask_type *mask_line;                                               \
-    int32_t    dst_stride, mask_stride;                                 \
-    uint32_t   src;                                                     \
-                                                                        \
-    src = _pixman_image_get_solid (					\
-	imp, src_image, dst_image->bits.format);			\
-                                                                        \
-    if ((flags & SKIP_ZERO_SRC) && src == 0)                            \
-	return;                                                         \
-                                                                        \
-    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
-                           dst_stride, dst_line, dst_cnt);              \
-    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type,       \
-                           mask_stride, mask_line, mask_cnt);           \
-                                                                        \
-    pixman_composite_##name##_asm_##cputype (width, height,             \
-                                             dst_line, dst_stride,      \
-                                             src, 0,                    \
-                                             mask_line, mask_stride);   \
-}
-
-#define PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST(flags, cputype, name,       \
-                                            src_type, src_cnt,          \
-                                            dst_type, dst_cnt)          \
-void                                                                    \
-pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
-                                         int32_t    h,                  \
-                                         dst_type  *dst,                \
-                                         int32_t    dst_stride,         \
-                                         src_type  *src,                \
-                                         int32_t    src_stride,         \
-                                         uint32_t   mask);              \
-                                                                        \
-static void                                                             \
-cputype##_composite_##name (pixman_implementation_t *imp,               \
-                            pixman_op_t              op,                \
-                            pixman_image_t *         src_image,         \
-                            pixman_image_t *         mask_image,        \
-                            pixman_image_t *         dst_image,         \
-                            int32_t                  src_x,             \
-                            int32_t                  src_y,             \
-                            int32_t                  mask_x,            \
-                            int32_t                  mask_y,            \
-                            int32_t                  dest_x,            \
-                            int32_t                  dest_y,            \
-                            int32_t                  width,             \
-                            int32_t                  height)            \
-{                                                                       \
-    dst_type  *dst_line;                                                \
-    src_type  *src_line;                                                \
-    int32_t    dst_stride, src_stride;                                  \
-    uint32_t   mask;                                                    \
-                                                                        \
-    mask = _pixman_image_get_solid (					\
-	imp, mask_image, dst_image->bits.format);			\
-                                                                        \
-    if ((flags & SKIP_ZERO_MASK) && mask == 0)                          \
-	return;                                                         \
-                                                                        \
-    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
-                           dst_stride, dst_line, dst_cnt);              \
-    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type,           \
-                           src_stride, src_line, src_cnt);              \
-                                                                        \
-    pixman_composite_##name##_asm_##cputype (width, height,             \
-                                             dst_line, dst_stride,      \
-                                             src_line, src_stride,      \
-                                             mask);                     \
-}
-
-#define PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST(cputype, name,           \
-                                               src_type, src_cnt,       \
-                                               mask_type, mask_cnt,     \
-                                               dst_type, dst_cnt)       \
-void                                                                    \
-pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
-                                         int32_t    h,                  \
-                                         dst_type  *dst,                \
-                                         int32_t    dst_stride,         \
-                                         src_type  *src,                \
-                                         int32_t    src_stride,         \
-                                         mask_type *mask,               \
-                                         int32_t    mask_stride);       \
-                                                                        \
-static void                                                             \
-cputype##_composite_##name (pixman_implementation_t *imp,               \
-                            pixman_op_t              op,                \
-                            pixman_image_t *         src_image,         \
-                            pixman_image_t *         mask_image,        \
-                            pixman_image_t *         dst_image,         \
-                            int32_t                  src_x,             \
-                            int32_t                  src_y,             \
-                            int32_t                  mask_x,            \
-                            int32_t                  mask_y,            \
-                            int32_t                  dest_x,            \
-                            int32_t                  dest_y,            \
-                            int32_t                  width,             \
-                            int32_t                  height)            \
-{                                                                       \
-    dst_type  *dst_line;                                                \
-    src_type  *src_line;                                                \
-    mask_type *mask_line;                                               \
-    int32_t    dst_stride, src_stride, mask_stride;                     \
-                                                                        \
-    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
-                           dst_stride, dst_line, dst_cnt);              \
-    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type,           \
-                           src_stride, src_line, src_cnt);              \
-    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type,       \
-                           mask_stride, mask_line, mask_cnt);           \
-                                                                        \
-    pixman_composite_##name##_asm_##cputype (width, height,             \
-                                             dst_line, dst_stride,      \
-                                             src_line, src_stride,      \
-                                             mask_line, mask_stride);   \
-}
-
-#define PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST(cputype, name, op,             \
-                                               src_type, dst_type)            \
-void                                                                          \
-pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (                \
-                                                   int32_t          w,        \
-                                                   dst_type *       dst,      \
-                                                   const src_type * src,      \
-                                                   pixman_fixed_t   vx,       \
-                                                   pixman_fixed_t   unit_x);  \
-                                                                              \
-static force_inline void                                                      \
-scaled_nearest_scanline_##cputype##_##name##_##op (dst_type *       pd,       \
-                                                   const src_type * ps,       \
-                                                   int32_t          w,        \
-                                                   pixman_fixed_t   vx,       \
-                                                   pixman_fixed_t   unit_x,   \
-                                                   pixman_fixed_t   max_vx,   \
-                                                   pixman_bool_t    zero_src) \
-{                                                                             \
-    pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (w, pd, ps,  \
-                                                                  vx, unit_x);\
-}                                                                             \
-                                                                              \
-FAST_NEAREST_MAINLOOP (cputype##_##name##_cover_##op,                         \
-                       scaled_nearest_scanline_##cputype##_##name##_##op,     \
-                       src_type, dst_type, COVER)                             \
-FAST_NEAREST_MAINLOOP (cputype##_##name##_none_##op,                          \
-                       scaled_nearest_scanline_##cputype##_##name##_##op,     \
-                       src_type, dst_type, NONE)                              \
-FAST_NEAREST_MAINLOOP (cputype##_##name##_pad_##op,                           \
-                       scaled_nearest_scanline_##cputype##_##name##_##op,     \
-                       src_type, dst_type, PAD)
-
-/* Provide entries for the fast path table */
-#define PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH(op,s,d,func)                      \
-    SIMPLE_NEAREST_FAST_PATH_COVER (op,s,d,func),                             \
-    SIMPLE_NEAREST_FAST_PATH_NONE (op,s,d,func),                              \
-    SIMPLE_NEAREST_FAST_PATH_PAD (op,s,d,func)
-
-#define PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_A8_DST(flags, cputype, name, op,   \
-                                                  src_type, dst_type)         \
-void                                                                          \
-pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (                \
-                                                   int32_t          w,        \
-                                                   dst_type *       dst,      \
-                                                   const src_type * src,      \
-                                                   pixman_fixed_t   vx,       \
-                                                   pixman_fixed_t   unit_x,   \
-                                                   const uint8_t *  mask);    \
-                                                                              \
-static force_inline void                                                      \
-scaled_nearest_scanline_##cputype##_##name##_##op (const uint8_t *  mask,     \
-                                                   dst_type *       pd,       \
-                                                   const src_type * ps,       \
-                                                   int32_t          w,        \
-                                                   pixman_fixed_t   vx,       \
-                                                   pixman_fixed_t   unit_x,   \
-                                                   pixman_fixed_t   max_vx,   \
-                                                   pixman_bool_t    zero_src) \
-{                                                                             \
-    if ((flags & SKIP_ZERO_SRC) && zero_src)                                  \
-	return;                                                               \
-    pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (w, pd, ps,  \
-                                                                  vx, unit_x, \
-                                                                  mask);      \
-}                                                                             \
-                                                                              \
-FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_cover_##op,                  \
-                              scaled_nearest_scanline_##cputype##_##name##_##op,\
-                              src_type, uint8_t, dst_type, COVER, TRUE, FALSE)\
-FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_none_##op,                   \
-                              scaled_nearest_scanline_##cputype##_##name##_##op,\
-                              src_type, uint8_t, dst_type, NONE, TRUE, FALSE) \
-FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_pad_##op,                    \
-                              scaled_nearest_scanline_##cputype##_##name##_##op,\
-                              src_type, uint8_t, dst_type, PAD, TRUE, FALSE)
-
-/* Provide entries for the fast path table */
-#define PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH(op,s,d,func)              \
-    SIMPLE_NEAREST_A8_MASK_FAST_PATH_COVER (op,s,d,func),                     \
-    SIMPLE_NEAREST_A8_MASK_FAST_PATH_NONE (op,s,d,func),                      \
-    SIMPLE_NEAREST_A8_MASK_FAST_PATH_PAD (op,s,d,func)
-
-/*****************************************************************************/
-
-#define PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST(flags, cputype, name, op,     \
-                                                src_type, dst_type)           \
-void                                                                          \
-pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype (               \
-                                                dst_type *       dst,         \
-                                                const src_type * top,         \
-                                                const src_type * bottom,      \
-                                                int              wt,          \
-                                                int              wb,          \
-                                                pixman_fixed_t   x,           \
-                                                pixman_fixed_t   ux,          \
-                                                int              width);      \
-                                                                              \
-static force_inline void                                                      \
-scaled_bilinear_scanline_##cputype##_##name##_##op (                          \
-                                                dst_type *       dst,         \
-                                                const uint32_t * mask,        \
-                                                const src_type * src_top,     \
-                                                const src_type * src_bottom,  \
-                                                int32_t          w,           \
-                                                int              wt,          \
-                                                int              wb,          \
-                                                pixman_fixed_t   vx,          \
-                                                pixman_fixed_t   unit_x,      \
-                                                pixman_fixed_t   max_vx,      \
-                                                pixman_bool_t    zero_src)    \
-{                                                                             \
-    if ((flags & SKIP_ZERO_SRC) && zero_src)                                  \
-	return;                                                               \
-    pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype (           \
-                            dst, src_top, src_bottom, wt, wb, vx, unit_x, w); \
-}                                                                             \
-                                                                              \
-FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_cover_##op,                 \
-                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
-                       src_type, uint32_t, dst_type, COVER, FALSE, FALSE)     \
-FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_none_##op,                  \
-                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
-                       src_type, uint32_t, dst_type, NONE, FALSE, FALSE)      \
-FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_pad_##op,                   \
-                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
-                       src_type, uint32_t, dst_type, PAD, FALSE, FALSE)
-
-#endif
+/*
+ * Copyright © 2010 Nokia Corporation
+ *
+ * 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.
+ *
+ * Author:  Siarhei Siamashka (siarhei.siamashka@nokia.com)
+ */
+
+#ifndef PIXMAN_ARM_COMMON_H
+#define PIXMAN_ARM_COMMON_H
+
+#include "pixman-fast-path.h"
+
+/* Define some macros which can expand into proxy functions between
+ * ARM assembly optimized functions and the rest of pixman fast path API.
+ *
+ * All the low level ARM assembly functions have to use ARM EABI
+ * calling convention and take up to 8 arguments:
+ *    width, height, dst, dst_stride, src, src_stride, mask, mask_stride
+ *
+ * The arguments are ordered with the most important coming first (the
+ * first 4 arguments are passed to function in registers, the rest are
+ * on stack). The last arguments are optional, for example if the
+ * function is not using mask, then 'mask' and 'mask_stride' can be
+ * omitted when doing a function call.
+ *
+ * Arguments 'src' and 'mask' contain either a pointer to the top left
+ * pixel of the composited rectangle or a pixel color value depending
+ * on the function type. In the case of just a color value (solid source
+ * or mask), the corresponding stride argument is unused.
+ */
+
+#define SKIP_ZERO_SRC  1
+#define SKIP_ZERO_MASK 2
+
+#define PIXMAN_ARM_BIND_FAST_PATH_SRC_DST(cputype, name,                \
+                                          src_type, src_cnt,            \
+                                          dst_type, dst_cnt)            \
+void                                                                    \
+pixman_composite_##name##_asm_##cputype (int32_t   w,                   \
+                                         int32_t   h,                   \
+                                         dst_type *dst,                 \
+                                         int32_t   dst_stride,          \
+                                         src_type *src,                 \
+                                         int32_t   src_stride);         \
+                                                                        \
+static void                                                             \
+cputype##_composite_##name (pixman_implementation_t *imp,               \
+                            pixman_op_t              op,                \
+                            pixman_image_t *         src_image,         \
+                            pixman_image_t *         mask_image,        \
+                            pixman_image_t *         dst_image,         \
+                            int32_t                  src_x,             \
+                            int32_t                  src_y,             \
+                            int32_t                  mask_x,            \
+                            int32_t                  mask_y,            \
+                            int32_t                  dest_x,            \
+                            int32_t                  dest_y,            \
+                            int32_t                  width,             \
+                            int32_t                  height)            \
+{                                                                       \
+    dst_type *dst_line;                                                 \
+    src_type *src_line;                                                 \
+    int32_t dst_stride, src_stride;                                     \
+                                                                        \
+    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type,           \
+                           src_stride, src_line, src_cnt);              \
+    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
+                           dst_stride, dst_line, dst_cnt);              \
+                                                                        \
+    pixman_composite_##name##_asm_##cputype (width, height,             \
+                                             dst_line, dst_stride,      \
+                                             src_line, src_stride);     \
+}
+
+#define PIXMAN_ARM_BIND_FAST_PATH_N_DST(flags, cputype, name,           \
+                                        dst_type, dst_cnt)              \
+void                                                                    \
+pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
+                                         int32_t    h,                  \
+                                         dst_type  *dst,                \
+                                         int32_t    dst_stride,         \
+                                         uint32_t   src);               \
+                                                                        \
+static void                                                             \
+cputype##_composite_##name (pixman_implementation_t *imp,               \
+                            pixman_op_t              op,                \
+                            pixman_image_t *         src_image,         \
+                            pixman_image_t *         mask_image,        \
+                            pixman_image_t *         dst_image,         \
+                            int32_t                  src_x,             \
+                            int32_t                  src_y,             \
+                            int32_t                  mask_x,            \
+                            int32_t                  mask_y,            \
+                            int32_t                  dest_x,            \
+                            int32_t                  dest_y,            \
+                            int32_t                  width,             \
+                            int32_t                  height)            \
+{                                                                       \
+    dst_type  *dst_line;                                                \
+    int32_t    dst_stride;                                              \
+    uint32_t   src;                                                     \
+                                                                        \
+    src = _pixman_image_get_solid (					\
+	imp, src_image, dst_image->bits.format);			\
+                                                                        \
+    if ((flags & SKIP_ZERO_SRC) && src == 0)                            \
+	return;                                                         \
+                                                                        \
+    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
+                           dst_stride, dst_line, dst_cnt);              \
+                                                                        \
+    pixman_composite_##name##_asm_##cputype (width, height,             \
+                                             dst_line, dst_stride,      \
+                                             src);                      \
+}
+
+#define PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST(flags, cputype, name,      \
+                                             mask_type, mask_cnt,       \
+                                             dst_type, dst_cnt)         \
+void                                                                    \
+pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
+                                         int32_t    h,                  \
+                                         dst_type  *dst,                \
+                                         int32_t    dst_stride,         \
+                                         uint32_t   src,                \
+                                         int32_t    unused,             \
+                                         mask_type *mask,               \
+                                         int32_t    mask_stride);       \
+                                                                        \
+static void                                                             \
+cputype##_composite_##name (pixman_implementation_t *imp,               \
+                            pixman_op_t              op,                \
+                            pixman_image_t *         src_image,         \
+                            pixman_image_t *         mask_image,        \
+                            pixman_image_t *         dst_image,         \
+                            int32_t                  src_x,             \
+                            int32_t                  src_y,             \
+                            int32_t                  mask_x,            \
+                            int32_t                  mask_y,            \
+                            int32_t                  dest_x,            \
+                            int32_t                  dest_y,            \
+                            int32_t                  width,             \
+                            int32_t                  height)            \
+{                                                                       \
+    dst_type  *dst_line;                                                \
+    mask_type *mask_line;                                               \
+    int32_t    dst_stride, mask_stride;                                 \
+    uint32_t   src;                                                     \
+                                                                        \
+    src = _pixman_image_get_solid (					\
+	imp, src_image, dst_image->bits.format);			\
+                                                                        \
+    if ((flags & SKIP_ZERO_SRC) && src == 0)                            \
+	return;                                                         \
+                                                                        \
+    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
+                           dst_stride, dst_line, dst_cnt);              \
+    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type,       \
+                           mask_stride, mask_line, mask_cnt);           \
+                                                                        \
+    pixman_composite_##name##_asm_##cputype (width, height,             \
+                                             dst_line, dst_stride,      \
+                                             src, 0,                    \
+                                             mask_line, mask_stride);   \
+}
+
+#define PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST(flags, cputype, name,       \
+                                            src_type, src_cnt,          \
+                                            dst_type, dst_cnt)          \
+void                                                                    \
+pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
+                                         int32_t    h,                  \
+                                         dst_type  *dst,                \
+                                         int32_t    dst_stride,         \
+                                         src_type  *src,                \
+                                         int32_t    src_stride,         \
+                                         uint32_t   mask);              \
+                                                                        \
+static void                                                             \
+cputype##_composite_##name (pixman_implementation_t *imp,               \
+                            pixman_op_t              op,                \
+                            pixman_image_t *         src_image,         \
+                            pixman_image_t *         mask_image,        \
+                            pixman_image_t *         dst_image,         \
+                            int32_t                  src_x,             \
+                            int32_t                  src_y,             \
+                            int32_t                  mask_x,            \
+                            int32_t                  mask_y,            \
+                            int32_t                  dest_x,            \
+                            int32_t                  dest_y,            \
+                            int32_t                  width,             \
+                            int32_t                  height)            \
+{                                                                       \
+    dst_type  *dst_line;                                                \
+    src_type  *src_line;                                                \
+    int32_t    dst_stride, src_stride;                                  \
+    uint32_t   mask;                                                    \
+                                                                        \
+    mask = _pixman_image_get_solid (					\
+	imp, mask_image, dst_image->bits.format);			\
+                                                                        \
+    if ((flags & SKIP_ZERO_MASK) && mask == 0)                          \
+	return;                                                         \
+                                                                        \
+    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
+                           dst_stride, dst_line, dst_cnt);              \
+    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type,           \
+                           src_stride, src_line, src_cnt);              \
+                                                                        \
+    pixman_composite_##name##_asm_##cputype (width, height,             \
+                                             dst_line, dst_stride,      \
+                                             src_line, src_stride,      \
+                                             mask);                     \
+}
+
+#define PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST(cputype, name,           \
+                                               src_type, src_cnt,       \
+                                               mask_type, mask_cnt,     \
+                                               dst_type, dst_cnt)       \
+void                                                                    \
+pixman_composite_##name##_asm_##cputype (int32_t    w,                  \
+                                         int32_t    h,                  \
+                                         dst_type  *dst,                \
+                                         int32_t    dst_stride,         \
+                                         src_type  *src,                \
+                                         int32_t    src_stride,         \
+                                         mask_type *mask,               \
+                                         int32_t    mask_stride);       \
+                                                                        \
+static void                                                             \
+cputype##_composite_##name (pixman_implementation_t *imp,               \
+                            pixman_op_t              op,                \
+                            pixman_image_t *         src_image,         \
+                            pixman_image_t *         mask_image,        \
+                            pixman_image_t *         dst_image,         \
+                            int32_t                  src_x,             \
+                            int32_t                  src_y,             \
+                            int32_t                  mask_x,            \
+                            int32_t                  mask_y,            \
+                            int32_t                  dest_x,            \
+                            int32_t                  dest_y,            \
+                            int32_t                  width,             \
+                            int32_t                  height)            \
+{                                                                       \
+    dst_type  *dst_line;                                                \
+    src_type  *src_line;                                                \
+    mask_type *mask_line;                                               \
+    int32_t    dst_stride, src_stride, mask_stride;                     \
+                                                                        \
+    PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type,         \
+                           dst_stride, dst_line, dst_cnt);              \
+    PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, src_type,           \
+                           src_stride, src_line, src_cnt);              \
+    PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type,       \
+                           mask_stride, mask_line, mask_cnt);           \
+                                                                        \
+    pixman_composite_##name##_asm_##cputype (width, height,             \
+                                             dst_line, dst_stride,      \
+                                             src_line, src_stride,      \
+                                             mask_line, mask_stride);   \
+}
+
+#define PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST(cputype, name, op,             \
+                                               src_type, dst_type)            \
+void                                                                          \
+pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (                \
+                                                   int32_t          w,        \
+                                                   dst_type *       dst,      \
+                                                   const src_type * src,      \
+                                                   pixman_fixed_t   vx,       \
+                                                   pixman_fixed_t   unit_x);  \
+                                                                              \
+static force_inline void                                                      \
+scaled_nearest_scanline_##cputype##_##name##_##op (dst_type *       pd,       \
+                                                   const src_type * ps,       \
+                                                   int32_t          w,        \
+                                                   pixman_fixed_t   vx,       \
+                                                   pixman_fixed_t   unit_x,   \
+                                                   pixman_fixed_t   max_vx,   \
+                                                   pixman_bool_t    zero_src) \
+{                                                                             \
+    pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (w, pd, ps,  \
+                                                                  vx, unit_x);\
+}                                                                             \
+                                                                              \
+FAST_NEAREST_MAINLOOP (cputype##_##name##_cover_##op,                         \
+                       scaled_nearest_scanline_##cputype##_##name##_##op,     \
+                       src_type, dst_type, COVER)                             \
+FAST_NEAREST_MAINLOOP (cputype##_##name##_none_##op,                          \
+                       scaled_nearest_scanline_##cputype##_##name##_##op,     \
+                       src_type, dst_type, NONE)                              \
+FAST_NEAREST_MAINLOOP (cputype##_##name##_pad_##op,                           \
+                       scaled_nearest_scanline_##cputype##_##name##_##op,     \
+                       src_type, dst_type, PAD)
+
+/* Provide entries for the fast path table */
+#define PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH(op,s,d,func)                      \
+    SIMPLE_NEAREST_FAST_PATH_COVER (op,s,d,func),                             \
+    SIMPLE_NEAREST_FAST_PATH_NONE (op,s,d,func),                              \
+    SIMPLE_NEAREST_FAST_PATH_PAD (op,s,d,func)
+
+#define PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_A8_DST(flags, cputype, name, op,   \
+                                                  src_type, dst_type)         \
+void                                                                          \
+pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (                \
+                                                   int32_t          w,        \
+                                                   dst_type *       dst,      \
+                                                   const src_type * src,      \
+                                                   pixman_fixed_t   vx,       \
+                                                   pixman_fixed_t   unit_x,   \
+                                                   const uint8_t *  mask);    \
+                                                                              \
+static force_inline void                                                      \
+scaled_nearest_scanline_##cputype##_##name##_##op (const uint8_t *  mask,     \
+                                                   dst_type *       pd,       \
+                                                   const src_type * ps,       \
+                                                   int32_t          w,        \
+                                                   pixman_fixed_t   vx,       \
+                                                   pixman_fixed_t   unit_x,   \
+                                                   pixman_fixed_t   max_vx,   \
+                                                   pixman_bool_t    zero_src) \
+{                                                                             \
+    if ((flags & SKIP_ZERO_SRC) && zero_src)                                  \
+	return;                                                               \
+    pixman_scaled_nearest_scanline_##name##_##op##_asm_##cputype (w, pd, ps,  \
+                                                                  vx, unit_x, \
+                                                                  mask);      \
+}                                                                             \
+                                                                              \
+FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_cover_##op,                  \
+                              scaled_nearest_scanline_##cputype##_##name##_##op,\
+                              src_type, uint8_t, dst_type, COVER, TRUE, FALSE)\
+FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_none_##op,                   \
+                              scaled_nearest_scanline_##cputype##_##name##_##op,\
+                              src_type, uint8_t, dst_type, NONE, TRUE, FALSE) \
+FAST_NEAREST_MAINLOOP_COMMON (cputype##_##name##_pad_##op,                    \
+                              scaled_nearest_scanline_##cputype##_##name##_##op,\
+                              src_type, uint8_t, dst_type, PAD, TRUE, FALSE)
+
+/* Provide entries for the fast path table */
+#define PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH(op,s,d,func)              \
+    SIMPLE_NEAREST_A8_MASK_FAST_PATH_COVER (op,s,d,func),                     \
+    SIMPLE_NEAREST_A8_MASK_FAST_PATH_NONE (op,s,d,func),                      \
+    SIMPLE_NEAREST_A8_MASK_FAST_PATH_PAD (op,s,d,func)
+
+/*****************************************************************************/
+
+#define PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST(flags, cputype, name, op,     \
+                                                src_type, dst_type)           \
+void                                                                          \
+pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype (               \
+                                                dst_type *       dst,         \
+                                                const src_type * top,         \
+                                                const src_type * bottom,      \
+                                                int              wt,          \
+                                                int              wb,          \
+                                                pixman_fixed_t   x,           \
+                                                pixman_fixed_t   ux,          \
+                                                int              width);      \
+                                                                              \
+static force_inline void                                                      \
+scaled_bilinear_scanline_##cputype##_##name##_##op (                          \
+                                                dst_type *       dst,         \
+                                                const uint32_t * mask,        \
+                                                const src_type * src_top,     \
+                                                const src_type * src_bottom,  \
+                                                int32_t          w,           \
+                                                int              wt,          \
+                                                int              wb,          \
+                                                pixman_fixed_t   vx,          \
+                                                pixman_fixed_t   unit_x,      \
+                                                pixman_fixed_t   max_vx,      \
+                                                pixman_bool_t    zero_src)    \
+{                                                                             \
+    if ((flags & SKIP_ZERO_SRC) && zero_src)                                  \
+	return;                                                               \
+    pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype (           \
+                            dst, src_top, src_bottom, wt, wb, vx, unit_x, w); \
+}                                                                             \
+                                                                              \
+FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_cover_##op,                 \
+                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
+                       src_type, uint32_t, dst_type, COVER, FALSE, FALSE)     \
+FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_none_##op,                  \
+                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
+                       src_type, uint32_t, dst_type, NONE, FALSE, FALSE)      \
+FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_pad_##op,                   \
+                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
+                       src_type, uint32_t, dst_type, PAD, FALSE, FALSE)
+
+
+#define PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST(flags, cputype, name, op,  \
+                                                src_type, dst_type)           \
+void                                                                          \
+pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype (               \
+                                                dst_type *       dst,         \
+                                                const uint8_t *  mask,        \
+                                                const src_type * top,         \
+                                                const src_type * bottom,      \
+                                                int              wt,          \
+                                                int              wb,          \
+                                                pixman_fixed_t   x,           \
+                                                pixman_fixed_t   ux,          \
+                                                int              width);      \
+                                                                              \
+static force_inline void                                                      \
+scaled_bilinear_scanline_##cputype##_##name##_##op (                          \
+                                                dst_type *       dst,         \
+                                                const uint8_t *  mask,        \
+                                                const src_type * src_top,     \
+                                                const src_type * src_bottom,  \
+                                                int32_t          w,           \
+                                                int              wt,          \
+                                                int              wb,          \
+                                                pixman_fixed_t   vx,          \
+                                                pixman_fixed_t   unit_x,      \
+                                                pixman_fixed_t   max_vx,      \
+                                                pixman_bool_t    zero_src)    \
+{                                                                             \
+    if ((flags & SKIP_ZERO_SRC) && zero_src)                                  \
+	return;                                                                   \
+    pixman_scaled_bilinear_scanline_##name##_##op##_asm_##cputype (           \
+                      dst, mask, src_top, src_bottom, wt, wb, vx, unit_x, w); \
+}                                                                             \
+                                                                              \
+FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_cover_##op,                 \
+                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
+                       src_type, uint8_t, dst_type, COVER, TRUE, FALSE)       \
+FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_none_##op,                  \
+                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
+                       src_type, uint8_t, dst_type, NONE, TRUE, FALSE)        \
+FAST_BILINEAR_MAINLOOP_COMMON (cputype##_##name##_pad_##op,                   \
+                       scaled_bilinear_scanline_##cputype##_##name##_##op,    \
+                       src_type, uint8_t, dst_type, PAD, TRUE, FALSE)
+
+#endif
diff --git a/pixman/pixman/pixman-arm-neon-asm-bilinear.S b/pixman/pixman/pixman-arm-neon-asm-bilinear.S
new file mode 100644
index 000000000..9a4a1ffba
--- /dev/null
+++ b/pixman/pixman/pixman-arm-neon-asm-bilinear.S
@@ -0,0 +1,768 @@
+/*
+ * Copyright © 2011 SCore Corporation
+ *
+ * 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.
+ *
+ * Author:  Siarhei Siamashka (siarhei.siamashka@nokia.com)
+ * Author:  Taekyun Kim (tkq.kim@samsung.com)
+ */
+
+/*
+ * This file contains scaled bilinear scanline functions implemented
+ * using older siarhei's bilinear macro template.
+ *
+ * << General scanline function procedures >>
+ *  1. bilinear interpolate source pixels
+ *  2. load mask pixels
+ *  3. load destination pixels
+ *  4. duplicate mask to fill whole register
+ *  5. interleave source & destination pixels
+ *  6. apply mask to source pixels
+ *  7. combine source & destination pixels
+ *  8, Deinterleave final result
+ *  9. store destination pixels
+ *
+ * All registers with single number (i.e. src0, tmp0) are 64-bits registers.
+ * Registers with double numbers(src01, dst01) are 128-bits registers.
+ * All temp registers can be used freely outside the code block.
+ * Assume that symbol(register .req) OUT and MASK are defined at caller of these macro blocks.
+ *
+ * TODOs
+ *  Support 0565 pixel format
+ *  Optimization for two and last pixel cases
+ *
+ * Remarks
+ *  There can be lots of pipeline stalls inside code block and between code blocks.
+ *  Further optimizations will be done by new macro templates using head/tail_head/tail scheme.
+ */
+
+/* Prevent the stack from becoming executable for no reason... */
+#if defined(__linux__) && defined (__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
+
+.text
+.fpu neon
+.arch armv7a
+.object_arch armv4
+.eabi_attribute 10, 0
+.eabi_attribute 12, 0
+.arm
+.altmacro
+
+#include "pixman-arm-neon-asm.h"
+
+/*
+ * Bilinear macros from pixman-arm-neon-asm.S
+ */
+
+/* Supplementary macro for setting function attributes */
+.macro pixman_asm_function fname
+    .func fname
+    .global fname
+#ifdef __ELF__
+    .hidden fname
+    .type fname, %function
+#endif
+fname:
+.endm
+
+/*
+ * Bilinear scaling support code which tries to provide pixel fetching, color
+ * format conversion, and interpolation as separate macros which can be used
+ * as the basic building blocks for constructing bilinear scanline functions.
+ */
+
+.macro bilinear_load_8888 reg1, reg2, tmp
+    mov       TMP2, X, asr #16
+    add       X, X, UX
+    add       TMP1, TOP, TMP2, asl #2
+    add       TMP2, BOTTOM, TMP2, asl #2
+    vld1.32   {reg1}, [TMP1]
+    vld1.32   {reg2}, [TMP2]
+.endm
+
+.macro bilinear_load_0565 reg1, reg2, tmp
+    mov       TMP2, X, asr #16
+    add       X, X, UX
+    add       TMP1, TOP, TMP2, asl #1
+    add       TMP2, BOTTOM, TMP2, asl #1
+    vld1.32   {reg2[0]}, [TMP1]
+    vld1.32   {reg2[1]}, [TMP2]
+    convert_four_0565_to_x888_packed reg2, reg1, reg2, tmp
+.endm
+
+.macro bilinear_load_and_vertical_interpolate_two_8888 \
+                    acc1, acc2, reg1, reg2, reg3, reg4, tmp1, tmp2
+
+    bilinear_load_8888 reg1, reg2, tmp1
+    vmull.u8  acc1, reg1, d28
+    vmlal.u8  acc1, reg2, d29
+    bilinear_load_8888 reg3, reg4, tmp2
+    vmull.u8  acc2, reg3, d28
+    vmlal.u8  acc2, reg4, d29
+.endm
+
+.macro bilinear_load_and_vertical_interpolate_four_8888 \
+                xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi \
+                yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi
+
+    bilinear_load_and_vertical_interpolate_two_8888 \
+                xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi
+    bilinear_load_and_vertical_interpolate_two_8888 \
+                yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi
+.endm
+
+.macro bilinear_load_and_vertical_interpolate_two_0565 \
+                acc1, acc2, reg1, reg2, reg3, reg4, acc2lo, acc2hi
+
+    mov       TMP2, X, asr #16
+    add       X, X, UX
+    mov       TMP4, X, asr #16
+    add       X, X, UX
+    add       TMP1, TOP, TMP2, asl #1
+    add       TMP2, BOTTOM, TMP2, asl #1
+    add       TMP3, TOP, TMP4, asl #1
+    add       TMP4, BOTTOM, TMP4, asl #1
+    vld1.32   {acc2lo[0]}, [TMP1]
+    vld1.32   {acc2hi[0]}, [TMP3]
+    vld1.32   {acc2lo[1]}, [TMP2]
+    vld1.32   {acc2hi[1]}, [TMP4]
+    convert_0565_to_x888 acc2, reg3, reg2, reg1
+    vzip.u8   reg1, reg3
+    vzip.u8   reg2, reg4
+    vzip.u8   reg3, reg4
+    vzip.u8   reg1, reg2
+    vmull.u8  acc1, reg1, d28
+    vmlal.u8  acc1, reg2, d29
+    vmull.u8  acc2, reg3, d28
+    vmlal.u8  acc2, reg4, d29
+.endm
+
+.macro bilinear_load_and_vertical_interpolate_four_0565 \
+                xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi \
+                yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi
+
+    mov       TMP2, X, asr #16
+    add       X, X, UX
+    mov       TMP4, X, asr #16
+    add       X, X, UX
+    add       TMP1, TOP, TMP2, asl #1
+    add       TMP2, BOTTOM, TMP2, asl #1
+    add       TMP3, TOP, TMP4, asl #1
+    add       TMP4, BOTTOM, TMP4, asl #1
+    vld1.32   {xacc2lo[0]}, [TMP1]
+    vld1.32   {xacc2hi[0]}, [TMP3]
+    vld1.32   {xacc2lo[1]}, [TMP2]
+    vld1.32   {xacc2hi[1]}, [TMP4]
+    convert_0565_to_x888 xacc2, xreg3, xreg2, xreg1
+    mov       TMP2, X, asr #16
+    add       X, X, UX
+    mov       TMP4, X, asr #16
+    add       X, X, UX
+    add       TMP1, TOP, TMP2, asl #1
+    add       TMP2, BOTTOM, TMP2, asl #1
+    add       TMP3, TOP, TMP4, asl #1
+    add       TMP4, BOTTOM, TMP4, asl #1
+    vld1.32   {yacc2lo[0]}, [TMP1]
+    vzip.u8   xreg1, xreg3
+    vld1.32   {yacc2hi[0]}, [TMP3]
+    vzip.u8   xreg2, xreg4
+    vld1.32   {yacc2lo[1]}, [TMP2]
+    vzip.u8   xreg3, xreg4
+    vld1.32   {yacc2hi[1]}, [TMP4]
+    vzip.u8   xreg1, xreg2
+    convert_0565_to_x888 yacc2, yreg3, yreg2, yreg1
+    vmull.u8  xacc1, xreg1, d28
+    vzip.u8   yreg1, yreg3
+    vmlal.u8  xacc1, xreg2, d29
+    vzip.u8   yreg2, yreg4
+    vmull.u8  xacc2, xreg3, d28
+    vzip.u8   yreg3, yreg4
+    vmlal.u8  xacc2, xreg4, d29
+    vzip.u8   yreg1, yreg2
+    vmull.u8  yacc1, yreg1, d28
+    vmlal.u8  yacc1, yreg2, d29
+    vmull.u8  yacc2, yreg3, d28
+    vmlal.u8  yacc2, yreg4, d29
+.endm
+
+.macro bilinear_store_8888 numpix, tmp1, tmp2
+.if numpix == 4
+    vst1.32   {d0, d1}, [OUT]!
+.elseif numpix == 2
+    vst1.32   {d0}, [OUT]!
+.elseif numpix == 1
+    vst1.32   {d0[0]}, [OUT, :32]!
+.else
+    .error bilinear_store_8888 numpix is unsupported
+.endif
+.endm
+
+.macro bilinear_store_0565 numpix, tmp1, tmp2
+    vuzp.u8 d0, d1
+    vuzp.u8 d2, d3
+    vuzp.u8 d1, d3
+    vuzp.u8 d0, d2
+    convert_8888_to_0565 d2, d1, d0, q1, tmp1, tmp2
+.if numpix == 4
+    vst1.16   {d2}, [OUT]!
+.elseif numpix == 2
+    vst1.32   {d2[0]}, [OUT]!
+.elseif numpix == 1
+    vst1.16   {d2[0]}, [OUT]!
+.else
+    .error bilinear_store_0565 numpix is unsupported
+.endif
+.endm
+
+
+/*
+ * Macros for loading mask pixels into register 'mask'.
+ * vdup must be done in somewhere else.
+ */
+.macro bilinear_load_mask_x numpix, mask
+.endm
+
+.macro bilinear_load_mask_8 numpix, mask
+.if numpix == 4
+    vld1.32     {mask[0]}, [MASK]!
+.elseif numpix == 2
+    vld1.16     {mask[0]}, [MASK]!
+.elseif numpix == 1
+    vld1.8      {mask[0]}, [MASK]!
+.else
+    .error bilinear_load_mask_8 numpix is unsupported
+.endif
+.endm
+
+.macro bilinear_load_mask mask_fmt, numpix, mask
+    bilinear_load_mask_&mask_fmt numpix, mask
+.endm
+
+
+/*
+ * Macros for loading destination pixels into register 'dst0' and 'dst1'.
+ * Interleave should be done somewhere else.
+ */
+.macro bilinear_load_dst_0565_src numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_load_dst_8888_src numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_load_dst_8888 numpix, dst0, dst1, dst01
+.if numpix == 4
+    vld1.32     {dst0, dst1}, [OUT]
+.elseif numpix == 2
+    vld1.32     {dst0}, [OUT]
+.elseif numpix == 1
+    vld1.32     {dst0[0]}, [OUT]
+.else
+    .error bilinear_load_dst_8888 numpix is unsupported
+.endif
+.endm
+
+.macro bilinear_load_dst_8888_over numpix, dst0, dst1, dst01
+    bilinear_load_dst_8888 numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_load_dst_8888_add numpix, dst0, dst1, dst01
+    bilinear_load_dst_8888 numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_load_dst dst_fmt, op, numpix, dst0, dst1, dst01
+    bilinear_load_dst_&dst_fmt&_&op numpix, dst0, dst1, dst01
+.endm
+
+/*
+ * Macros for duplicating partially loaded mask to fill entire register.
+ * We will apply mask to interleaved source pixels, that is
+ *  (r0, r1, r2, r3, g0, g1, g2, g3) x (m0, m1, m2, m3, m0, m1, m2, m3)
+ *  (b0, b1, b2, b3, a0, a1, a2, a3) x (m0, m1, m2, m3, m0, m1, m2, m3)
+ * So, we need to duplicate loaded mask into whole register.
+ *
+ * For two pixel case
+ *  (r0, r1, x, x, g0, g1, x, x) x (m0, m1, m0, m1, m0, m1, m0, m1)
+ *  (b0, b1, x, x, a0, a1, x, x) x (m0, m1, m0, m1, m0, m1, m0, m1)
+ * We can do some optimizations for this including one pixel cases.
+ */
+.macro bilinear_duplicate_mask_x numpix, mask
+.endm
+
+.macro bilinear_duplicate_mask_8 numpix, mask
+.if numpix == 4
+    vdup.32     mask, mask[0]
+.elseif numpix == 2
+    vdup.16     mask, mask[0]
+.elseif numpix == 1
+    vdup.8      mask, mask[0]
+.else
+    .error bilinear_duplicate_mask_8 is unsupported
+.endif
+.endm
+
+.macro bilinear_duplicate_mask mask_fmt, numpix, mask
+    bilinear_duplicate_mask_&mask_fmt numpix, mask
+.endm
+
+/*
+ * Macros for interleaving src and dst pixels to rrrr gggg bbbb aaaa form.
+ * Interleave should be done when maks is enabled or operator is 'over'.
+ */
+.macro bilinear_interleave src0, src1, dst0, dst1
+    vuzp.8      src0, src1
+    vuzp.8      dst0, dst1
+    vuzp.8      src0, src1
+    vuzp.8      dst0, dst1
+.endm
+
+.macro bilinear_interleave_src_dst_x_src \
+                numpix, src0, src1, src01, dst0, dst1, dst01
+.endm
+
+.macro bilinear_interleave_src_dst_x_over \
+                numpix, src0, src1, src01, dst0, dst1, dst01
+
+    bilinear_interleave src0, src1, dst0, dst1
+.endm
+
+.macro bilinear_interleave_src_dst_x_add \
+                numpix, src0, src1, src01, dst0, dst1, dst01
+.endm
+
+.macro bilinear_interleave_src_dst_8_src \
+                numpix, src0, src1, src01, dst0, dst1, dst01
+
+    bilinear_interleave src0, src1, dst0, dst1
+.endm
+
+.macro bilinear_interleave_src_dst_8_over \
+                numpix, src0, src1, src01, dst0, dst1, dst01
+
+    bilinear_interleave src0, src1, dst0, dst1
+.endm
+
+.macro bilinear_interleave_src_dst_8_add \
+                numpix, src0, src1, src01, dst0, dst1, dst01
+
+    bilinear_interleave src0, src1, dst0, dst1
+.endm
+
+.macro bilinear_interleave_src_dst \
+                mask_fmt, op, numpix, src0, src1, src01, dst0, dst1, dst01
+
+    bilinear_interleave_src_dst_&mask_fmt&_&op \
+                numpix, src0, src1, src01, dst0, dst1, dst01
+.endm
+
+
+/*
+ * Macros for applying masks to src pixels. (see combine_mask_u() function)
+ * src, dst should be in interleaved form.
+ * mask register should be in form (m0, m1, m2, m3).
+ */
+.macro bilinear_apply_mask_to_src_x \
+                numpix, src0, src1, src01, mask, \
+                tmp01, tmp23, tmp45, tmp67
+.endm
+
+.macro bilinear_apply_mask_to_src_8 \
+                numpix, src0, src1, src01, mask, \
+                tmp01, tmp23, tmp45, tmp67
+
+    vmull.u8        tmp01, src0, mask
+    vmull.u8        tmp23, src1, mask
+    /* bubbles */
+    vrshr.u16       tmp45, tmp01, #8
+    vrshr.u16       tmp67, tmp23, #8
+    /* bubbles */
+    vraddhn.u16     src0, tmp45, tmp01
+    vraddhn.u16     src1, tmp67, tmp23
+.endm
+
+.macro bilinear_apply_mask_to_src \
+                mask_fmt, numpix, src0, src1, src01, mask, \
+                tmp01, tmp23, tmp45, tmp67
+
+    bilinear_apply_mask_to_src_&mask_fmt \
+                numpix, src0, src1, src01, mask, \
+                tmp01, tmp23, tmp45, tmp67
+.endm
+
+
+/*
+ * Macros for combining src and destination pixels.
+ * Interleave or not is depending on operator 'op'.
+ */
+.macro bilinear_combine_src \
+                numpix, src0, src1, src01, dst0, dst1, dst01, \
+                tmp01, tmp23, tmp45, tmp67, tmp8
+.endm
+
+.macro bilinear_combine_over \
+                numpix, src0, src1, src01, dst0, dst1, dst01, \
+                tmp01, tmp23, tmp45, tmp67, tmp8
+
+    vdup.32     tmp8, src1[1]
+    /* bubbles */
+    vmvn.8      tmp8, tmp8
+    /* bubbles */
+    vmull.u8    tmp01, dst0, tmp8
+    /* bubbles */
+    vmull.u8    tmp23, dst1, tmp8
+    /* bubbles */
+    vrshr.u16   tmp45, tmp01, #8
+    vrshr.u16   tmp67, tmp23, #8
+    /* bubbles */
+    vraddhn.u16 dst0, tmp45, tmp01
+    vraddhn.u16 dst1, tmp67, tmp23
+    /* bubbles */
+    vqadd.u8    src01, dst01, src01
+.endm
+
+.macro bilinear_combine_add \
+                numpix, src0, src1, src01, dst0, dst1, dst01, \
+                tmp01, tmp23, tmp45, tmp67, tmp8
+
+    vqadd.u8    src01, dst01, src01
+.endm
+
+.macro bilinear_combine \
+                op, numpix, src0, src1, src01, dst0, dst1, dst01, \
+                tmp01, tmp23, tmp45, tmp67, tmp8
+
+    bilinear_combine_&op \
+                numpix, src0, src1, src01, dst0, dst1, dst01, \
+                tmp01, tmp23, tmp45, tmp67, tmp8
+.endm
+
+/*
+ * Macros for final deinterleaving of destination pixels if needed.
+ */
+.macro bilinear_deinterleave numpix, dst0, dst1, dst01
+    vuzp.8      dst0, dst1
+    /* bubbles */
+    vuzp.8      dst0, dst1
+.endm
+
+.macro bilinear_deinterleave_dst_x_src numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_deinterleave_dst_x_over numpix, dst0, dst1, dst01
+    bilinear_deinterleave numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_deinterleave_dst_x_add numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_deinterleave_dst_8_src numpix, dst0, dst1, dst01
+    bilinear_deinterleave numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_deinterleave_dst_8_over numpix, dst0, dst1, dst01
+    bilinear_deinterleave numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_deinterleave_dst_8_add numpix, dst0, dst1, dst01
+    bilinear_deinterleave numpix, dst0, dst1, dst01
+.endm
+
+.macro bilinear_deinterleave_dst mask_fmt, op, numpix, dst0, dst1, dst01
+    bilinear_deinterleave_dst_&mask_fmt&_&op numpix, dst0, dst1, dst01
+.endm
+
+
+.macro bilinear_interpolate_last_pixel src_fmt, mask_fmt, dst_fmt, op
+    bilinear_load_&src_fmt d0, d1, d2
+    bilinear_load_mask mask_fmt, 1, d4
+    bilinear_load_dst dst_fmt, op, 1, d18, d19, q9
+    vmull.u8  q1, d0, d28
+    vmlal.u8  q1, d1, d29
+    vshr.u16  d30, d24, #8
+    /* 4 cycles bubble */
+    vshll.u16 q0, d2, #8
+    vmlsl.u16 q0, d2, d30
+    vmlal.u16 q0, d3, d30
+    /* 5 cycles bubble */
+    bilinear_duplicate_mask mask_fmt, 1, d4
+    vshrn.u32 d0, q0, #16
+    /* 3 cycles bubble */
+    vmovn.u16 d0, q0
+    /* 1 cycle bubble */
+    bilinear_interleave_src_dst \
+                mask_fmt, op, 1, d0, d1, q0, d18, d19, q9
+    bilinear_apply_mask_to_src \
+                mask_fmt, 1, d0, d1, q0, d4, \
+                q3, q8, q10, q11
+    bilinear_combine \
+                op, 1, d0, d1, q0, d18, d19, q9, \
+                q3, q8, q10, q11, d5
+    bilinear_deinterleave_dst mask_fmt, op, 1, d0, d1, q0
+    bilinear_store_&dst_fmt 1, q2, q3
+.endm
+
+.macro bilinear_interpolate_two_pixels src_fmt, mask_fmt, dst_fmt, op
+    bilinear_load_and_vertical_interpolate_two_&src_fmt \
+                q1, q11, d0, d1, d20, d21, d22, d23
+    bilinear_load_mask mask_fmt, 2, d4
+    bilinear_load_dst dst_fmt, op, 2, d18, d19, q9
+    vshr.u16  q15, q12, #8
+    vadd.u16  q12, q12, q13
+    vshll.u16 q0, d2, #8
+    vmlsl.u16 q0, d2, d30
+    vmlal.u16 q0, d3, d30
+    vshll.u16 q10, d22, #8
+    vmlsl.u16 q10, d22, d31
+    vmlal.u16 q10, d23, d31
+    vshrn.u32 d30, q0, #16
+    vshrn.u32 d31, q10, #16
+    bilinear_duplicate_mask mask_fmt, 2, d4
+    vmovn.u16 d0, q15
+    bilinear_interleave_src_dst \
+                mask_fmt, op, 2, d0, d1, q0, d18, d19, q9
+    bilinear_apply_mask_to_src \
+                mask_fmt, 2, d0, d1, q0, d4, \
+                q3, q8, q10, q11
+    bilinear_combine \
+                op, 2, d0, d1, q0, d18, d19, q9, \
+                q3, q8, q10, q11, d5
+    bilinear_deinterleave_dst mask_fmt, op, 2, d0, d1, q0
+    bilinear_store_&dst_fmt 2, q2, q3
+.endm
+
+.macro bilinear_interpolate_four_pixels src_fmt, mask_fmt, dst_fmt, op
+    bilinear_load_and_vertical_interpolate_four_&src_fmt \
+                q1, q11, d0, d1, d20, d21, d22, d23 \
+                q3, q9,  d4, d5, d16, d17, d18, d19
+    pld       [TMP1, PF_OFFS]
+    vshr.u16  q15, q12, #8
+    vadd.u16  q12, q12, q13
+    vshll.u16 q0, d2, #8
+    vmlsl.u16 q0, d2, d30
+    vmlal.u16 q0, d3, d30
+    vshll.u16 q10, d22, #8
+    vmlsl.u16 q10, d22, d31
+    vmlal.u16 q10, d23, d31
+    vshr.u16  q15, q12, #8
+    vshll.u16 q2, d6, #8
+    vmlsl.u16 q2, d6, d30
+    vmlal.u16 q2, d7, d30
+    vshll.u16 q8, d18, #8
+    bilinear_load_mask mask_fmt, 4, d30
+    bilinear_load_dst dst_fmt, op, 4, d2, d3, q1
+    pld       [TMP2, PF_OFFS]
+    vmlsl.u16 q8, d18, d31
+    vmlal.u16 q8, d19, d31
+    vadd.u16  q12, q12, q13
+    vshrn.u32 d0, q0, #16
+    vshrn.u32 d1, q10, #16
+    vshrn.u32 d4, q2, #16
+    vshrn.u32 d5, q8, #16
+    bilinear_duplicate_mask mask_fmt, 4, d30
+    vmovn.u16 d0, q0
+    vmovn.u16 d1, q2
+    bilinear_interleave_src_dst \
+                mask_fmt, op, 4, d0, d1, q0, d2, d3, q1
+    bilinear_apply_mask_to_src \
+                mask_fmt, 4, d0, d1, q0, d30, \
+                q3, q8, q9, q10
+    bilinear_combine \
+                op, 4, d0, d1, q0, d2, d3, q1, \
+                q3, q8, q9, q10, d22
+    bilinear_deinterleave_dst mask_fmt, op, 4, d0, d1, q0
+    bilinear_store_&dst_fmt 4, q2, q3
+.endm
+
+.macro generate_bilinear_scanline_func_src_dst \
+                fname, src_fmt, dst_fmt, op, \
+                bpp_shift, prefetch_distance
+
+pixman_asm_function fname
+    OUT       .req      r0
+    TOP       .req      r1
+    BOTTOM    .req      r2
+    WT        .req      r3
+    WB        .req      r4
+    X         .req      r5
+    UX        .req      r6
+    WIDTH     .req      ip
+    TMP1      .req      r3
+    TMP2      .req      r4
+    PF_OFFS   .req      r7
+    TMP3      .req      r8
+    TMP4      .req      r9
+
+    mov       ip, sp
+    push      {r4, r5, r6, r7, r8, r9}
+    mov       PF_OFFS, #prefetch_distance
+    ldmia     ip, {WB, X, UX, WIDTH}
+    mul       PF_OFFS, PF_OFFS, UX
+
+    cmp       WIDTH, #0
+    ble       3f
+
+    vdup.u16  q12, X
+    vdup.u16  q13, UX
+    vdup.u8   d28, WT
+    vdup.u8   d29, WB
+    vadd.u16  d25, d25, d26
+    vadd.u16  q13, q13, q13
+
+    subs      WIDTH, WIDTH, #4
+    blt       1f
+    mov       PF_OFFS, PF_OFFS, asr #(16 - bpp_shift)
+0:
+    bilinear_interpolate_four_pixels src_fmt, x, dst_fmt, op
+    subs      WIDTH, WIDTH, #4
+    bge       0b
+1:
+    tst       WIDTH, #2
+    beq       2f
+    bilinear_interpolate_two_pixels src_fmt, x, dst_fmt, op
+2:
+    tst       WIDTH, #1
+    beq       3f
+    bilinear_interpolate_last_pixel src_fmt, x, dst_fmt, op
+3:
+    pop       {r4, r5, r6, r7, r8, r9}
+    bx        lr
+
+    .unreq    OUT
+    .unreq    TOP
+    .unreq    BOTTOM
+    .unreq    WT
+    .unreq    WB
+    .unreq    X
+    .unreq    UX
+    .unreq    WIDTH
+    .unreq    TMP1
+    .unreq    TMP2
+    .unreq    PF_OFFS
+    .unreq    TMP3
+    .unreq    TMP4
+.endfunc
+
+.endm
+
+.macro generate_bilinear_scanline_func_src_a8_dst \
+                fname, src_fmt, dst_fmt, op, \
+                bpp_shift, prefetch_distance
+
+pixman_asm_function fname
+    OUT       .req      r0
+    MASK      .req      r1
+    TOP       .req      r2
+    BOTTOM    .req      r3
+    WT        .req      r4
+    WB        .req      r5
+    X         .req      r6
+    UX        .req      r7
+    WIDTH     .req      ip
+    TMP1      .req      r4
+    TMP2      .req      r5
+    PF_OFFS   .req      r8
+    TMP3      .req      r9
+    TMP4      .req      r10
+
+    mov       ip, sp
+    push      {r4, r5, r6, r7, r8, r9, r10, ip}
+    mov       PF_OFFS, #prefetch_distance
+    ldmia     ip, {WT, WB, X, UX, WIDTH}
+    mul       PF_OFFS, PF_OFFS, UX
+
+    cmp       WIDTH, #0
+    ble       3f
+
+    vdup.u16  q12, X
+    vdup.u16  q13, UX
+    vdup.u8   d28, WT
+    vdup.u8   d29, WB
+    vadd.u16  d25, d25, d26
+    vadd.u16  q13, q13, q13
+
+    subs      WIDTH, WIDTH, #4
+    blt       1f
+    mov       PF_OFFS, PF_OFFS, asr #(16 - bpp_shift)
+0:
+    bilinear_interpolate_four_pixels src_fmt, 8, dst_fmt, op
+    subs      WIDTH, WIDTH, #4
+    bge       0b
+1:
+    tst       WIDTH, #2
+    beq       2f
+    bilinear_interpolate_two_pixels src_fmt, 8, dst_fmt, op
+2:
+    tst       WIDTH, #1
+    beq       3f
+    bilinear_interpolate_last_pixel src_fmt, 8, dst_fmt, op
+3:
+    pop       {r4, r5, r6, r7, r8, r9, r10, ip}
+    bx        lr
+
+    .unreq    OUT
+    .unreq    TOP
+    .unreq    BOTTOM
+    .unreq    WT
+    .unreq    WB
+    .unreq    X
+    .unreq    UX
+    .unreq    WIDTH
+    .unreq    MASK
+    .unreq    TMP1
+    .unreq    TMP2
+    .unreq    PF_OFFS
+    .unreq    TMP3
+    .unreq    TMP4
+.endfunc
+
+.endm
+
+generate_bilinear_scanline_func_src_dst \
+    pixman_scaled_bilinear_scanline_8888_8888_OVER_asm_neon, \
+    8888, 8888, over, 2, 28
+
+generate_bilinear_scanline_func_src_dst \
+    pixman_scaled_bilinear_scanline_8888_8888_ADD_asm_neon, \
+    8888, 8888, add, 2, 28
+
+generate_bilinear_scanline_func_src_a8_dst \
+    pixman_scaled_bilinear_scanline_8888_8_8888_SRC_asm_neon, \
+    8888, 8888, src, 2, 28
+
+generate_bilinear_scanline_func_src_a8_dst \
+    pixman_scaled_bilinear_scanline_8888_8_0565_SRC_asm_neon, \
+    8888, 0565, src, 2, 28
+
+generate_bilinear_scanline_func_src_a8_dst \
+    pixman_scaled_bilinear_scanline_0565_8_x888_SRC_asm_neon, \
+    0565, 8888, src, 1, 28
+
+generate_bilinear_scanline_func_src_a8_dst \
+    pixman_scaled_bilinear_scanline_0565_8_0565_SRC_asm_neon, \
+    0565, 0565, src, 1, 28
+
+generate_bilinear_scanline_func_src_a8_dst \
+    pixman_scaled_bilinear_scanline_8888_8_8888_OVER_asm_neon, \
+    8888, 8888, over, 2, 28
+
+generate_bilinear_scanline_func_src_a8_dst \
+    pixman_scaled_bilinear_scanline_8888_8_8888_ADD_asm_neon, \
+    8888, 8888, add, 2, 28
diff --git a/pixman/pixman/pixman-arm-neon-asm.S b/pixman/pixman/pixman-arm-neon-asm.S
index 5e9fda34e..833f18c2e 100644
--- a/pixman/pixman/pixman-arm-neon-asm.S
+++ b/pixman/pixman/pixman-arm-neon-asm.S
@@ -1426,6 +1426,175 @@ generate_composite_function \
 
 /******************************************************************************/
 
+.macro pixman_composite_over_n_8888_0565_ca_process_pixblock_head
+    /*
+     * 'combine_mask_ca' replacement
+     *
+     * input:  solid src (n) in {d8,  d9,  d10, d11}  [B, G, R, A]
+     *         mask in          {d24, d25, d26}       [B, G, R]
+     * output: updated src in   {d0,  d1,  d2 }       [B, G, R]
+     *         updated mask in  {d24, d25, d26}       [B, G, R]
+     */
+    vmull.u8    q0,  d24, d8
+    vmull.u8    q1,  d25, d9
+    vmull.u8    q6,  d26, d10
+    vmull.u8    q9,  d11, d25
+    vmull.u8    q12, d11, d24
+    vmull.u8    q13, d11, d26
+    vrshr.u16   q8,  q0,  #8
+    vrshr.u16   q10, q1,  #8
+    vrshr.u16   q11, q6,  #8
+    vraddhn.u16 d0,  q0,  q8
+    vraddhn.u16 d1,  q1,  q10
+    vraddhn.u16 d2,  q6,  q11
+    vrshr.u16   q11, q12, #8
+    vrshr.u16   q8,  q9,  #8
+    vrshr.u16   q6,  q13, #8
+    vraddhn.u16 d24, q12, q11
+    vraddhn.u16 d25, q9,  q8
+    /*
+     * convert 8 r5g6b5 pixel data from {d4, d5} to planar 8-bit format
+     * and put data into d16 - blue, d17 - green, d18 - red
+     */
+       vshrn.u16   d17, q2,  #3
+       vshrn.u16   d18, q2,  #8
+    vraddhn.u16 d26, q13, q6
+       vsli.u16    q2,  q2,  #5
+       vsri.u8     d18, d18, #5
+       vsri.u8     d17, d17, #6
+    /*
+     * 'combine_over_ca' replacement
+     *
+     * output: updated dest in d16 - blue, d17 - green, d18 - red
+     */
+    vmvn.8      q12, q12
+       vshrn.u16   d16, q2,  #2
+    vmvn.8      d26, d26
+    vmull.u8    q6,  d16, d24
+    vmull.u8    q7,  d17, d25
+    vmull.u8    q11, d18, d26
+.endm
+
+.macro pixman_composite_over_n_8888_0565_ca_process_pixblock_tail
+    /* ... continue 'combine_over_ca' replacement */
+    vrshr.u16   q10, q6,  #8
+    vrshr.u16   q14, q7,  #8
+    vrshr.u16   q15, q11, #8
+    vraddhn.u16 d16, q10, q6
+    vraddhn.u16 d17, q14, q7
+    vraddhn.u16 d18, q15, q11
+    vqadd.u8    q8,  q0,  q8
+    vqadd.u8    d18, d2,  d18
+    /*
+     * convert the results in d16, d17, d18 to r5g6b5 and store
+     * them into {d28, d29}
+     */
+    vshll.u8    q14, d18, #8
+    vshll.u8    q10, d17, #8
+    vshll.u8    q15, d16, #8
+    vsri.u16    q14, q10, #5
+    vsri.u16    q14, q15, #11
+.endm
+
+.macro pixman_composite_over_n_8888_0565_ca_process_pixblock_tail_head
+    fetch_mask_pixblock
+        vrshr.u16   q10, q6, #8
+        vrshr.u16   q14, q7, #8
+    vld1.16     {d4, d5}, [DST_R, :128]!
+        vrshr.u16   q15, q11, #8
+        vraddhn.u16 d16, q10, q6
+        vraddhn.u16 d17, q14, q7
+        vraddhn.u16 d22, q15, q11
+            /* process_pixblock_head */
+            /*
+             * 'combine_mask_ca' replacement
+             *
+             * input:  solid src (n) in {d8,  d9,  d10, d11}  [B, G, R, A]
+             *         mask in          {d24, d25, d26}       [B, G, R]
+             * output: updated src in   {d0,  d1,  d2 }       [B, G, R]
+             *         updated mask in  {d24, d25, d26}       [B, G, R]
+             */
+            vmull.u8    q1,  d25, d9
+        vqadd.u8    q8,  q0, q8
+            vmull.u8    q0,  d24, d8
+        vqadd.u8    d22, d2, d22
+            vmull.u8    q6,  d26, d10
+        /*
+         * convert the result in d16, d17, d22 to r5g6b5 and store
+         * it into {d28, d29}
+         */
+        vshll.u8    q14, d22, #8
+        vshll.u8    q10, d17, #8
+        vshll.u8    q15, d16, #8
+            vmull.u8    q9,  d11, d25
+        vsri.u16    q14, q10, #5
+            vmull.u8    q12, d11, d24
+            vmull.u8    q13, d11, d26
+        vsri.u16    q14, q15, #11
+    cache_preload 8, 8
+            vrshr.u16   q8,  q0,  #8
+            vrshr.u16   q10, q1,  #8
+            vrshr.u16   q11, q6,  #8
+            vraddhn.u16 d0,  q0,  q8
+            vraddhn.u16 d1,  q1,  q10
+            vraddhn.u16 d2,  q6,  q11
+            vrshr.u16   q11, q12, #8
+            vrshr.u16   q8,  q9,  #8
+            vrshr.u16   q6,  q13, #8
+            vraddhn.u16 d25, q9,  q8
+                /*
+                 * convert 8 r5g6b5 pixel data from {d4, d5} to planar
+	         * 8-bit format and put data into d16 - blue, d17 - green,
+	         * d18 - red
+                 */
+                vshrn.u16   d17, q2,  #3
+                vshrn.u16   d18, q2,  #8
+            vraddhn.u16 d24, q12, q11
+            vraddhn.u16 d26, q13, q6
+                vsli.u16    q2,  q2,  #5
+                vsri.u8     d18, d18, #5
+                vsri.u8     d17, d17, #6
+            /*
+             * 'combine_over_ca' replacement
+             *
+             * output: updated dest in d16 - blue, d17 - green, d18 - red
+             */
+            vmvn.8      q12, q12
+                vshrn.u16   d16, q2,  #2
+            vmvn.8      d26, d26
+            vmull.u8    q7,  d17, d25
+            vmull.u8    q6,  d16, d24
+            vmull.u8    q11, d18, d26
+    vst1.16     {d28, d29}, [DST_W, :128]!
+.endm
+
+.macro pixman_composite_over_n_8888_0565_ca_init
+    add         DUMMY, sp, #ARGS_STACK_OFFSET
+    vpush       {d8-d15}
+    vld1.32     {d11[0]}, [DUMMY]
+    vdup.8      d8, d11[0]
+    vdup.8      d9, d11[1]
+    vdup.8      d10, d11[2]
+    vdup.8      d11, d11[3]
+.endm
+
+.macro pixman_composite_over_n_8888_0565_ca_cleanup
+    vpop        {d8-d15}
+.endm
+
+generate_composite_function \
+    pixman_composite_over_n_8888_0565_ca_asm_neon, 0, 32, 16, \
+    FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \
+    8, /* number of pixels, processed in a single block */ \
+    5, /* prefetch distance */ \
+    pixman_composite_over_n_8888_0565_ca_init, \
+    pixman_composite_over_n_8888_0565_ca_cleanup, \
+    pixman_composite_over_n_8888_0565_ca_process_pixblock_head, \
+    pixman_composite_over_n_8888_0565_ca_process_pixblock_tail, \
+    pixman_composite_over_n_8888_0565_ca_process_pixblock_tail_head
+
+/******************************************************************************/
+
 .macro pixman_composite_in_n_8_process_pixblock_head
     /* expecting source data in {d0, d1, d2, d3} */
     /* and destination data in {d4, d5, d6, d7} */
diff --git a/pixman/pixman/pixman-arm-neon.c b/pixman/pixman/pixman-arm-neon.c
index 5213a2007..e5127a65f 100644
--- a/pixman/pixman/pixman-arm-neon.c
+++ b/pixman/pixman/pixman-arm-neon.c
@@ -1,460 +1,503 @@
-/*
- * Copyright © 2009 ARM Ltd, Movial Creative Technologies Oy
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of ARM Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  ARM Ltd makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- * Author:  Ian Rickards (ian.rickards@arm.com)
- * Author:  Jonathan Morton (jonathan.morton@movial.com)
- * Author:  Markku Vire (markku.vire@movial.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include "pixman-private.h"
-#include "pixman-arm-common.h"
-
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_8888_8888,
-                                   uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_x888_8888,
-                                   uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0565_0565,
-                                   uint16_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0888_0888,
-                                   uint8_t, 3, uint8_t, 3)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_8888_0565,
-                                   uint32_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0565_8888,
-                                   uint16_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0888_8888_rev,
-                                   uint8_t, 3, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0888_0565_rev,
-                                   uint8_t, 3, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_pixbuf_8888,
-                                   uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_rpixbuf_8888,
-                                   uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, add_8_8,
-                                   uint8_t, 1, uint8_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, add_8888_8888,
-                                   uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, over_8888_0565,
-                                   uint32_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, over_8888_8888,
-                                   uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, out_reverse_8_0565,
-                                   uint8_t, 1, uint16_t, 1)
-
-PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_n_0565,
-                                 uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_n_8888,
-                                 uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_reverse_n_8888,
-                                 uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_DST (0, neon, in_n_8,
-                                 uint8_t, 1)
-
-PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_0565,
-                                      uint8_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_8888,
-                                      uint8_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8888_8888_ca,
-                                      uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_8,
-                                      uint8_t, 1, uint8_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, add_n_8_8,
-                                      uint8_t, 1, uint8_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, add_n_8_8888,
-                                      uint8_t, 1, uint32_t, 1)
-
-PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_8888_n_8888,
-                                     uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_8888_n_0565,
-                                     uint32_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_0565_n_0565,
-                                     uint16_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, add_8888_n_8888,
-                                     uint32_t, 1, uint32_t, 1)
-
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8_8_8,
-                                        uint8_t, 1, uint8_t, 1, uint8_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_0565_8_0565,
-                                        uint16_t, 1, uint8_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8888_8_8888,
-                                        uint32_t, 1, uint8_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8888_8888_8888,
-                                        uint32_t, 1, uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_8888_8_8888,
-                                        uint32_t, 1, uint8_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_8888_8888_8888,
-                                        uint32_t, 1, uint32_t, 1, uint32_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_8888_8_0565,
-                                        uint32_t, 1, uint8_t, 1, uint16_t, 1)
-PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_0565_8_0565,
-                                        uint16_t, 1, uint8_t, 1, uint16_t, 1)
-
-PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 8888_8888, OVER,
-                                        uint32_t, uint32_t)
-PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 8888_0565, OVER,
-                                        uint32_t, uint16_t)
-PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 8888_0565, SRC,
-                                        uint32_t, uint16_t)
-PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 0565_8888, SRC,
-                                        uint16_t, uint32_t)
-
-PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_A8_DST (SKIP_ZERO_SRC, neon, 8888_8_0565,
-                                           OVER, uint32_t, uint16_t)
-PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_A8_DST (SKIP_ZERO_SRC, neon, 0565_8_0565,
-                                           OVER, uint16_t, uint16_t)
-
-PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 8888_8888, SRC,
-                                         uint32_t, uint32_t)
-PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 8888_0565, SRC,
-                                         uint32_t, uint16_t)
-PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 0565_x888, SRC,
-                                         uint16_t, uint32_t)
-PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 0565_0565, SRC,
-                                         uint16_t, uint16_t)
-
-void
-pixman_composite_src_n_8_asm_neon (int32_t   w,
-                                   int32_t   h,
-                                   uint8_t  *dst,
-                                   int32_t   dst_stride,
-                                   uint8_t   src);
-
-void
-pixman_composite_src_n_0565_asm_neon (int32_t   w,
-                                      int32_t   h,
-                                      uint16_t *dst,
-                                      int32_t   dst_stride,
-                                      uint16_t  src);
-
-void
-pixman_composite_src_n_8888_asm_neon (int32_t   w,
-                                      int32_t   h,
-                                      uint32_t *dst,
-                                      int32_t   dst_stride,
-                                      uint32_t  src);
-
-static pixman_bool_t
-pixman_fill_neon (uint32_t *bits,
-                  int       stride,
-                  int       bpp,
-                  int       x,
-                  int       y,
-                  int       width,
-                  int       height,
-                  uint32_t  _xor)
-{
-    /* stride is always multiple of 32bit units in pixman */
-    uint32_t byte_stride = stride * sizeof(uint32_t);
-
-    switch (bpp)
-    {
-    case 8:
-	pixman_composite_src_n_8_asm_neon (
-		width,
-		height,
-		(uint8_t *)(((char *) bits) + y * byte_stride + x),
-		byte_stride,
-		_xor & 0xff);
-	return TRUE;
-    case 16:
-	pixman_composite_src_n_0565_asm_neon (
-		width,
-		height,
-		(uint16_t *)(((char *) bits) + y * byte_stride + x * 2),
-		byte_stride / 2,
-		_xor & 0xffff);
-	return TRUE;
-    case 32:
-	pixman_composite_src_n_8888_asm_neon (
-		width,
-		height,
-		(uint32_t *)(((char *) bits) + y * byte_stride + x * 4),
-		byte_stride / 4,
-		_xor);
-	return TRUE;
-    default:
-	return FALSE;
-    }
-}
-
-static pixman_bool_t
-pixman_blt_neon (uint32_t *src_bits,
-                 uint32_t *dst_bits,
-                 int       src_stride,
-                 int       dst_stride,
-                 int       src_bpp,
-                 int       dst_bpp,
-                 int       src_x,
-                 int       src_y,
-                 int       dst_x,
-                 int       dst_y,
-                 int       width,
-                 int       height)
-{
-    if (src_bpp != dst_bpp)
-	return FALSE;
-
-    switch (src_bpp)
-    {
-    case 16:
-	pixman_composite_src_0565_0565_asm_neon (
-		width, height,
-		(uint16_t *)(((char *) dst_bits) +
-		dst_y * dst_stride * 4 + dst_x * 2), dst_stride * 2,
-		(uint16_t *)(((char *) src_bits) +
-		src_y * src_stride * 4 + src_x * 2), src_stride * 2);
-	return TRUE;
-    case 32:
-	pixman_composite_src_8888_8888_asm_neon (
-		width, height,
-		(uint32_t *)(((char *) dst_bits) +
-		dst_y * dst_stride * 4 + dst_x * 4), dst_stride,
-		(uint32_t *)(((char *) src_bits) +
-		src_y * src_stride * 4 + src_x * 4), src_stride);
-	return TRUE;
-    default:
-	return FALSE;
-    }
-}
-
-static const pixman_fast_path_t arm_neon_fast_paths[] =
-{
-    PIXMAN_STD_FAST_PATH (SRC,  r5g6b5,   null,     r5g6b5,   neon_composite_src_0565_0565),
-    PIXMAN_STD_FAST_PATH (SRC,  b5g6r5,   null,     b5g6r5,   neon_composite_src_0565_0565),
-    PIXMAN_STD_FAST_PATH (SRC,  a8r8g8b8, null,     r5g6b5,   neon_composite_src_8888_0565),
-    PIXMAN_STD_FAST_PATH (SRC,  x8r8g8b8, null,     r5g6b5,   neon_composite_src_8888_0565),
-    PIXMAN_STD_FAST_PATH (SRC,  a8b8g8r8, null,     b5g6r5,   neon_composite_src_8888_0565),
-    PIXMAN_STD_FAST_PATH (SRC,  x8b8g8r8, null,     b5g6r5,   neon_composite_src_8888_0565),
-    PIXMAN_STD_FAST_PATH (SRC,  r5g6b5,   null,     a8r8g8b8, neon_composite_src_0565_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  r5g6b5,   null,     x8r8g8b8, neon_composite_src_0565_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  b5g6r5,   null,     a8b8g8r8, neon_composite_src_0565_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  b5g6r5,   null,     x8b8g8r8, neon_composite_src_0565_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  a8r8g8b8, null,     x8r8g8b8, neon_composite_src_8888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  x8r8g8b8, null,     x8r8g8b8, neon_composite_src_8888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  a8b8g8r8, null,     x8b8g8r8, neon_composite_src_8888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  x8b8g8r8, null,     x8b8g8r8, neon_composite_src_8888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  a8r8g8b8, null,     a8r8g8b8, neon_composite_src_8888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  a8b8g8r8, null,     a8b8g8r8, neon_composite_src_8888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  x8r8g8b8, null,     a8r8g8b8, neon_composite_src_x888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  x8b8g8r8, null,     a8b8g8r8, neon_composite_src_x888_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  r8g8b8,   null,     r8g8b8,   neon_composite_src_0888_0888),
-    PIXMAN_STD_FAST_PATH (SRC,  b8g8r8,   null,     x8r8g8b8, neon_composite_src_0888_8888_rev),
-    PIXMAN_STD_FAST_PATH (SRC,  b8g8r8,   null,     r5g6b5,   neon_composite_src_0888_0565_rev),
-    PIXMAN_STD_FAST_PATH (SRC,  pixbuf,   pixbuf,   a8r8g8b8, neon_composite_src_pixbuf_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  pixbuf,   pixbuf,   a8b8g8r8, neon_composite_src_rpixbuf_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  rpixbuf,  rpixbuf,  a8r8g8b8, neon_composite_src_rpixbuf_8888),
-    PIXMAN_STD_FAST_PATH (SRC,  rpixbuf,  rpixbuf,  a8b8g8r8, neon_composite_src_pixbuf_8888),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       a8,       neon_composite_over_n_8_8),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       r5g6b5,   neon_composite_over_n_8_0565),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       b5g6r5,   neon_composite_over_n_8_0565),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       a8r8g8b8, neon_composite_over_n_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       x8r8g8b8, neon_composite_over_n_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       a8b8g8r8, neon_composite_over_n_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       x8b8g8r8, neon_composite_over_n_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    null,     r5g6b5,   neon_composite_over_n_0565),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    null,     a8r8g8b8, neon_composite_over_n_8888),
-    PIXMAN_STD_FAST_PATH (OVER, solid,    null,     x8r8g8b8, neon_composite_over_n_8888),
-    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, a8r8g8b8, neon_composite_over_n_8888_8888_ca),
-    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, x8r8g8b8, neon_composite_over_n_8888_8888_ca),
-    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, a8b8g8r8, neon_composite_over_n_8888_8888_ca),
-    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, x8b8g8r8, neon_composite_over_n_8888_8888_ca),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid,    a8r8g8b8, neon_composite_over_8888_n_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid,    x8r8g8b8, neon_composite_over_8888_n_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid,    r5g6b5,   neon_composite_over_8888_n_0565),
-    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid,    b5g6r5,   neon_composite_over_8888_n_0565),
-    PIXMAN_STD_FAST_PATH (OVER, r5g6b5,   solid,    r5g6b5,   neon_composite_over_0565_n_0565),
-    PIXMAN_STD_FAST_PATH (OVER, b5g6r5,   solid,    b5g6r5,   neon_composite_over_0565_n_0565),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8,       a8r8g8b8, neon_composite_over_8888_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8,       x8r8g8b8, neon_composite_over_8888_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, a8,       a8b8g8r8, neon_composite_over_8888_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, a8,       x8b8g8r8, neon_composite_over_8888_8_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8,       r5g6b5,   neon_composite_over_8888_8_0565),
-    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, a8,       b5g6r5,   neon_composite_over_8888_8_0565),
-    PIXMAN_STD_FAST_PATH (OVER, r5g6b5,   a8,       r5g6b5,   neon_composite_over_0565_8_0565),
-    PIXMAN_STD_FAST_PATH (OVER, b5g6r5,   a8,       b5g6r5,   neon_composite_over_0565_8_0565),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, a8r8g8b8, neon_composite_over_8888_8888_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null,     r5g6b5,   neon_composite_over_8888_0565),
-    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null,     b5g6r5,   neon_composite_over_8888_0565),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null,     a8r8g8b8, neon_composite_over_8888_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null,     x8r8g8b8, neon_composite_over_8888_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null,     a8b8g8r8, neon_composite_over_8888_8888),
-    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null,     x8b8g8r8, neon_composite_over_8888_8888),
-    PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, null,     a8r8g8b8, neon_composite_src_x888_8888),
-    PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, null,     a8b8g8r8, neon_composite_src_x888_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  solid,    a8,       a8,       neon_composite_add_n_8_8),
-    PIXMAN_STD_FAST_PATH (ADD,  solid,    a8,       a8r8g8b8, neon_composite_add_n_8_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  solid,    a8,       a8b8g8r8, neon_composite_add_n_8_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  a8,       a8,       a8,       neon_composite_add_8_8_8),
-    PIXMAN_STD_FAST_PATH (ADD,  r5g6b5,   a8,       r5g6b5,   neon_composite_add_0565_8_0565),
-    PIXMAN_STD_FAST_PATH (ADD,  b5g6r5,   a8,       b5g6r5,   neon_composite_add_0565_8_0565),
-    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, a8,       a8r8g8b8, neon_composite_add_8888_8_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  a8b8g8r8, a8,       a8b8g8r8, neon_composite_add_8888_8_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, a8r8g8b8, a8r8g8b8, neon_composite_add_8888_8888_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, solid,    a8r8g8b8, neon_composite_add_8888_n_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  a8b8g8r8, solid,    a8b8g8r8, neon_composite_add_8888_n_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  a8,       null,     a8,       neon_composite_add_8_8),
-    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, null,     a8r8g8b8, neon_composite_add_8888_8888),
-    PIXMAN_STD_FAST_PATH (ADD,  a8b8g8r8, null,     a8b8g8r8, neon_composite_add_8888_8888),
-    PIXMAN_STD_FAST_PATH (IN,   solid,    null,     a8,       neon_composite_in_n_8),
-    PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8r8g8b8, neon_composite_over_reverse_n_8888),
-    PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8b8g8r8, neon_composite_over_reverse_n_8888),
-    PIXMAN_STD_FAST_PATH (OUT_REVERSE,  a8,    null, r5g6b5,   neon_composite_out_reverse_8_0565),
-    PIXMAN_STD_FAST_PATH (OUT_REVERSE,  a8,    null, b5g6r5,   neon_composite_out_reverse_8_0565),
-
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, neon_8888_8888),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, a8b8g8r8, neon_8888_8888),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, neon_8888_8888),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, x8b8g8r8, neon_8888_8888),
-
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, r5g6b5, neon_8888_0565),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, b5g6r5, neon_8888_0565),
-
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, r5g6b5, neon_8888_0565),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, r5g6b5, neon_8888_0565),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8b8g8r8, b5g6r5, neon_8888_0565),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, x8b8g8r8, b5g6r5, neon_8888_0565),
-
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, b5g6r5, x8b8g8r8, neon_0565_8888),
-    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, r5g6b5, x8r8g8b8, neon_0565_8888),
-    /* Note: NONE repeat is not supported yet */
-    SIMPLE_NEAREST_FAST_PATH_COVER (SRC, r5g6b5, a8r8g8b8, neon_0565_8888),
-    SIMPLE_NEAREST_FAST_PATH_COVER (SRC, b5g6r5, a8b8g8r8, neon_0565_8888),
-    SIMPLE_NEAREST_FAST_PATH_PAD (SRC, r5g6b5, a8r8g8b8, neon_0565_8888),
-    SIMPLE_NEAREST_FAST_PATH_PAD (SRC, b5g6r5, a8b8g8r8, neon_0565_8888),
-
-    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, a8r8g8b8, r5g6b5, neon_8888_8_0565),
-    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, a8b8g8r8, b5g6r5, neon_8888_8_0565),
-
-    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, r5g6b5, r5g6b5, neon_0565_8_0565),
-    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, b5g6r5, b5g6r5, neon_0565_8_0565),
-
-    SIMPLE_BILINEAR_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, neon_8888_8888),
-    SIMPLE_BILINEAR_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, neon_8888_8888),
-    SIMPLE_BILINEAR_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, neon_8888_8888),
-
-    SIMPLE_BILINEAR_FAST_PATH (SRC, a8r8g8b8, r5g6b5, neon_8888_0565),
-    SIMPLE_BILINEAR_FAST_PATH (SRC, x8r8g8b8, r5g6b5, neon_8888_0565),
-
-    SIMPLE_BILINEAR_FAST_PATH (SRC, r5g6b5, x8r8g8b8, neon_0565_x888),
-    SIMPLE_BILINEAR_FAST_PATH (SRC, r5g6b5, r5g6b5, neon_0565_0565),
-
-    { PIXMAN_OP_NONE },
-};
-
-static pixman_bool_t
-arm_neon_blt (pixman_implementation_t *imp,
-              uint32_t *               src_bits,
-              uint32_t *               dst_bits,
-              int                      src_stride,
-              int                      dst_stride,
-              int                      src_bpp,
-              int                      dst_bpp,
-              int                      src_x,
-              int                      src_y,
-              int                      dst_x,
-              int                      dst_y,
-              int                      width,
-              int                      height)
-{
-    if (!pixman_blt_neon (
-            src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
-            src_x, src_y, dst_x, dst_y, width, height))
-
-    {
-	return _pixman_implementation_blt (
-	    imp->delegate,
-	    src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
-	    src_x, src_y, dst_x, dst_y, width, height);
-    }
-
-    return TRUE;
-}
-
-static pixman_bool_t
-arm_neon_fill (pixman_implementation_t *imp,
-               uint32_t *               bits,
-               int                      stride,
-               int                      bpp,
-               int                      x,
-               int                      y,
-               int                      width,
-               int                      height,
-               uint32_t xor)
-{
-    if (pixman_fill_neon (bits, stride, bpp, x, y, width, height, xor))
-	return TRUE;
-
-    return _pixman_implementation_fill (
-	imp->delegate, bits, stride, bpp, x, y, width, height, xor);
-}
-
-#define BIND_COMBINE_U(name)                                             \
-void                                                                     \
-pixman_composite_scanline_##name##_mask_asm_neon (int32_t         w,     \
-                                                  const uint32_t *dst,   \
-                                                  const uint32_t *src,   \
-                                                  const uint32_t *mask); \
-                                                                         \
-void                                                                     \
-pixman_composite_scanline_##name##_asm_neon (int32_t         w,          \
-                                             const uint32_t *dst,        \
-                                             const uint32_t *src);       \
-                                                                         \
-static void                                                              \
-neon_combine_##name##_u (pixman_implementation_t *imp,                   \
-                         pixman_op_t              op,                    \
-                         uint32_t *               dest,                  \
-                         const uint32_t *         src,                   \
-                         const uint32_t *         mask,                  \
-                         int                      width)                 \
-{                                                                        \
-    if (mask)                                                            \
-	pixman_composite_scanline_##name##_mask_asm_neon (width, dest,   \
-	                                                  src, mask);    \
-    else                                                                 \
-	pixman_composite_scanline_##name##_asm_neon (width, dest, src);  \
-}
-
-BIND_COMBINE_U (over)
-BIND_COMBINE_U (add)
-BIND_COMBINE_U (out_reverse)
-
-pixman_implementation_t *
-_pixman_implementation_create_arm_neon (pixman_implementation_t *fallback)
-{
-    pixman_implementation_t *imp =
-	_pixman_implementation_create (fallback, arm_neon_fast_paths);
-
-    imp->combine_32[PIXMAN_OP_OVER] = neon_combine_over_u;
-    imp->combine_32[PIXMAN_OP_ADD] = neon_combine_add_u;
-    imp->combine_32[PIXMAN_OP_OUT_REVERSE] = neon_combine_out_reverse_u;
-
-    imp->blt = arm_neon_blt;
-    imp->fill = arm_neon_fill;
-
-    return imp;
-}
+/*
+ * Copyright © 2009 ARM Ltd, Movial Creative Technologies Oy
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of ARM Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  ARM Ltd makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Author:  Ian Rickards (ian.rickards@arm.com)
+ * Author:  Jonathan Morton (jonathan.morton@movial.com)
+ * Author:  Markku Vire (markku.vire@movial.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include "pixman-private.h"
+#include "pixman-arm-common.h"
+
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_8888_8888,
+                                   uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_x888_8888,
+                                   uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0565_0565,
+                                   uint16_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0888_0888,
+                                   uint8_t, 3, uint8_t, 3)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_8888_0565,
+                                   uint32_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0565_8888,
+                                   uint16_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0888_8888_rev,
+                                   uint8_t, 3, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_0888_0565_rev,
+                                   uint8_t, 3, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_pixbuf_8888,
+                                   uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, src_rpixbuf_8888,
+                                   uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, add_8_8,
+                                   uint8_t, 1, uint8_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, add_8888_8888,
+                                   uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, over_8888_0565,
+                                   uint32_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, over_8888_8888,
+                                   uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, out_reverse_8_0565,
+                                   uint8_t, 1, uint16_t, 1)
+
+PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_n_0565,
+                                 uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_n_8888,
+                                 uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_reverse_n_8888,
+                                 uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_DST (0, neon, in_n_8,
+                                 uint8_t, 1)
+
+PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_0565,
+                                      uint8_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_8888,
+                                      uint8_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8888_8888_ca,
+                                      uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8888_0565_ca,
+				      uint32_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_8,
+                                      uint8_t, 1, uint8_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, add_n_8_8,
+                                      uint8_t, 1, uint8_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, add_n_8_8888,
+                                      uint8_t, 1, uint32_t, 1)
+
+PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_8888_n_8888,
+                                     uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_8888_n_0565,
+                                     uint32_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_0565_n_0565,
+                                     uint16_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, add_8888_n_8888,
+                                     uint32_t, 1, uint32_t, 1)
+
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8_8_8,
+                                        uint8_t, 1, uint8_t, 1, uint8_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_0565_8_0565,
+                                        uint16_t, 1, uint8_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8888_8_8888,
+                                        uint32_t, 1, uint8_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8888_8888_8888,
+                                        uint32_t, 1, uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_8888_8_8888,
+                                        uint32_t, 1, uint8_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_8888_8888_8888,
+                                        uint32_t, 1, uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_8888_8_0565,
+                                        uint32_t, 1, uint8_t, 1, uint16_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_0565_8_0565,
+                                        uint16_t, 1, uint8_t, 1, uint16_t, 1)
+
+PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 8888_8888, OVER,
+                                        uint32_t, uint32_t)
+PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 8888_0565, OVER,
+                                        uint32_t, uint16_t)
+PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 8888_0565, SRC,
+                                        uint32_t, uint16_t)
+PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (neon, 0565_8888, SRC,
+                                        uint16_t, uint32_t)
+
+PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_A8_DST (SKIP_ZERO_SRC, neon, 8888_8_0565,
+                                           OVER, uint32_t, uint16_t)
+PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_A8_DST (SKIP_ZERO_SRC, neon, 0565_8_0565,
+                                           OVER, uint16_t, uint16_t)
+
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 8888_8888, SRC,
+                                         uint32_t, uint32_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 8888_0565, SRC,
+                                         uint32_t, uint16_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 0565_x888, SRC,
+                                         uint16_t, uint32_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (0, neon, 0565_0565, SRC,
+                                         uint16_t, uint16_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (SKIP_ZERO_SRC, neon, 8888_8888, OVER,
+                                         uint32_t, uint32_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_DST (SKIP_ZERO_SRC, neon, 8888_8888, ADD,
+                                         uint32_t, uint32_t)
+
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST (0, neon, 8888_8_8888, SRC,
+                                            uint32_t, uint32_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST (0, neon, 8888_8_0565, SRC,
+                                            uint32_t, uint16_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST (0, neon, 0565_8_x888, SRC,
+                                            uint16_t, uint32_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST (0, neon, 0565_8_0565, SRC,
+                                            uint16_t, uint16_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST (SKIP_ZERO_SRC, neon, 8888_8_8888, OVER,
+                                            uint32_t, uint32_t)
+PIXMAN_ARM_BIND_SCALED_BILINEAR_SRC_A8_DST (SKIP_ZERO_SRC, neon, 8888_8_8888, ADD,
+                                            uint32_t, uint32_t)
+
+void
+pixman_composite_src_n_8_asm_neon (int32_t   w,
+                                   int32_t   h,
+                                   uint8_t  *dst,
+                                   int32_t   dst_stride,
+                                   uint8_t   src);
+
+void
+pixman_composite_src_n_0565_asm_neon (int32_t   w,
+                                      int32_t   h,
+                                      uint16_t *dst,
+                                      int32_t   dst_stride,
+                                      uint16_t  src);
+
+void
+pixman_composite_src_n_8888_asm_neon (int32_t   w,
+                                      int32_t   h,
+                                      uint32_t *dst,
+                                      int32_t   dst_stride,
+                                      uint32_t  src);
+
+static pixman_bool_t
+pixman_fill_neon (uint32_t *bits,
+                  int       stride,
+                  int       bpp,
+                  int       x,
+                  int       y,
+                  int       width,
+                  int       height,
+                  uint32_t  _xor)
+{
+    /* stride is always multiple of 32bit units in pixman */
+    uint32_t byte_stride = stride * sizeof(uint32_t);
+
+    switch (bpp)
+    {
+    case 8:
+	pixman_composite_src_n_8_asm_neon (
+		width,
+		height,
+		(uint8_t *)(((char *) bits) + y * byte_stride + x),
+		byte_stride,
+		_xor & 0xff);
+	return TRUE;
+    case 16:
+	pixman_composite_src_n_0565_asm_neon (
+		width,
+		height,
+		(uint16_t *)(((char *) bits) + y * byte_stride + x * 2),
+		byte_stride / 2,
+		_xor & 0xffff);
+	return TRUE;
+    case 32:
+	pixman_composite_src_n_8888_asm_neon (
+		width,
+		height,
+		(uint32_t *)(((char *) bits) + y * byte_stride + x * 4),
+		byte_stride / 4,
+		_xor);
+	return TRUE;
+    default:
+	return FALSE;
+    }
+}
+
+static pixman_bool_t
+pixman_blt_neon (uint32_t *src_bits,
+                 uint32_t *dst_bits,
+                 int       src_stride,
+                 int       dst_stride,
+                 int       src_bpp,
+                 int       dst_bpp,
+                 int       src_x,
+                 int       src_y,
+                 int       dst_x,
+                 int       dst_y,
+                 int       width,
+                 int       height)
+{
+    if (src_bpp != dst_bpp)
+	return FALSE;
+
+    switch (src_bpp)
+    {
+    case 16:
+	pixman_composite_src_0565_0565_asm_neon (
+		width, height,
+		(uint16_t *)(((char *) dst_bits) +
+		dst_y * dst_stride * 4 + dst_x * 2), dst_stride * 2,
+		(uint16_t *)(((char *) src_bits) +
+		src_y * src_stride * 4 + src_x * 2), src_stride * 2);
+	return TRUE;
+    case 32:
+	pixman_composite_src_8888_8888_asm_neon (
+		width, height,
+		(uint32_t *)(((char *) dst_bits) +
+		dst_y * dst_stride * 4 + dst_x * 4), dst_stride,
+		(uint32_t *)(((char *) src_bits) +
+		src_y * src_stride * 4 + src_x * 4), src_stride);
+	return TRUE;
+    default:
+	return FALSE;
+    }
+}
+
+static const pixman_fast_path_t arm_neon_fast_paths[] =
+{
+    PIXMAN_STD_FAST_PATH (SRC,  r5g6b5,   null,     r5g6b5,   neon_composite_src_0565_0565),
+    PIXMAN_STD_FAST_PATH (SRC,  b5g6r5,   null,     b5g6r5,   neon_composite_src_0565_0565),
+    PIXMAN_STD_FAST_PATH (SRC,  a8r8g8b8, null,     r5g6b5,   neon_composite_src_8888_0565),
+    PIXMAN_STD_FAST_PATH (SRC,  x8r8g8b8, null,     r5g6b5,   neon_composite_src_8888_0565),
+    PIXMAN_STD_FAST_PATH (SRC,  a8b8g8r8, null,     b5g6r5,   neon_composite_src_8888_0565),
+    PIXMAN_STD_FAST_PATH (SRC,  x8b8g8r8, null,     b5g6r5,   neon_composite_src_8888_0565),
+    PIXMAN_STD_FAST_PATH (SRC,  r5g6b5,   null,     a8r8g8b8, neon_composite_src_0565_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  r5g6b5,   null,     x8r8g8b8, neon_composite_src_0565_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  b5g6r5,   null,     a8b8g8r8, neon_composite_src_0565_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  b5g6r5,   null,     x8b8g8r8, neon_composite_src_0565_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  a8r8g8b8, null,     x8r8g8b8, neon_composite_src_8888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  x8r8g8b8, null,     x8r8g8b8, neon_composite_src_8888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  a8b8g8r8, null,     x8b8g8r8, neon_composite_src_8888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  x8b8g8r8, null,     x8b8g8r8, neon_composite_src_8888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  a8r8g8b8, null,     a8r8g8b8, neon_composite_src_8888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  a8b8g8r8, null,     a8b8g8r8, neon_composite_src_8888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  x8r8g8b8, null,     a8r8g8b8, neon_composite_src_x888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  x8b8g8r8, null,     a8b8g8r8, neon_composite_src_x888_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  r8g8b8,   null,     r8g8b8,   neon_composite_src_0888_0888),
+    PIXMAN_STD_FAST_PATH (SRC,  b8g8r8,   null,     x8r8g8b8, neon_composite_src_0888_8888_rev),
+    PIXMAN_STD_FAST_PATH (SRC,  b8g8r8,   null,     r5g6b5,   neon_composite_src_0888_0565_rev),
+    PIXMAN_STD_FAST_PATH (SRC,  pixbuf,   pixbuf,   a8r8g8b8, neon_composite_src_pixbuf_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  pixbuf,   pixbuf,   a8b8g8r8, neon_composite_src_rpixbuf_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  rpixbuf,  rpixbuf,  a8r8g8b8, neon_composite_src_rpixbuf_8888),
+    PIXMAN_STD_FAST_PATH (SRC,  rpixbuf,  rpixbuf,  a8b8g8r8, neon_composite_src_pixbuf_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       a8,       neon_composite_over_n_8_8),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       r5g6b5,   neon_composite_over_n_8_0565),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       b5g6r5,   neon_composite_over_n_8_0565),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       a8r8g8b8, neon_composite_over_n_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       x8r8g8b8, neon_composite_over_n_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       a8b8g8r8, neon_composite_over_n_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    a8,       x8b8g8r8, neon_composite_over_n_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    null,     r5g6b5,   neon_composite_over_n_0565),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    null,     a8r8g8b8, neon_composite_over_n_8888),
+    PIXMAN_STD_FAST_PATH (OVER, solid,    null,     x8r8g8b8, neon_composite_over_n_8888),
+    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, a8r8g8b8, neon_composite_over_n_8888_8888_ca),
+    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, x8r8g8b8, neon_composite_over_n_8888_8888_ca),
+    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, a8b8g8r8, neon_composite_over_n_8888_8888_ca),
+    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, x8b8g8r8, neon_composite_over_n_8888_8888_ca),
+    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, r5g6b5,   neon_composite_over_n_8888_0565_ca),
+    PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, b5g6r5,   neon_composite_over_n_8888_0565_ca),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid,    a8r8g8b8, neon_composite_over_8888_n_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid,    x8r8g8b8, neon_composite_over_8888_n_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid,    r5g6b5,   neon_composite_over_8888_n_0565),
+    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid,    b5g6r5,   neon_composite_over_8888_n_0565),
+    PIXMAN_STD_FAST_PATH (OVER, r5g6b5,   solid,    r5g6b5,   neon_composite_over_0565_n_0565),
+    PIXMAN_STD_FAST_PATH (OVER, b5g6r5,   solid,    b5g6r5,   neon_composite_over_0565_n_0565),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8,       a8r8g8b8, neon_composite_over_8888_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8,       x8r8g8b8, neon_composite_over_8888_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, a8,       a8b8g8r8, neon_composite_over_8888_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, a8,       x8b8g8r8, neon_composite_over_8888_8_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8,       r5g6b5,   neon_composite_over_8888_8_0565),
+    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, a8,       b5g6r5,   neon_composite_over_8888_8_0565),
+    PIXMAN_STD_FAST_PATH (OVER, r5g6b5,   a8,       r5g6b5,   neon_composite_over_0565_8_0565),
+    PIXMAN_STD_FAST_PATH (OVER, b5g6r5,   a8,       b5g6r5,   neon_composite_over_0565_8_0565),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, a8r8g8b8, neon_composite_over_8888_8888_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null,     r5g6b5,   neon_composite_over_8888_0565),
+    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null,     b5g6r5,   neon_composite_over_8888_0565),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null,     a8r8g8b8, neon_composite_over_8888_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null,     x8r8g8b8, neon_composite_over_8888_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null,     a8b8g8r8, neon_composite_over_8888_8888),
+    PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null,     x8b8g8r8, neon_composite_over_8888_8888),
+    PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, null,     a8r8g8b8, neon_composite_src_x888_8888),
+    PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, null,     a8b8g8r8, neon_composite_src_x888_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  solid,    a8,       a8,       neon_composite_add_n_8_8),
+    PIXMAN_STD_FAST_PATH (ADD,  solid,    a8,       a8r8g8b8, neon_composite_add_n_8_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  solid,    a8,       a8b8g8r8, neon_composite_add_n_8_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  a8,       a8,       a8,       neon_composite_add_8_8_8),
+    PIXMAN_STD_FAST_PATH (ADD,  r5g6b5,   a8,       r5g6b5,   neon_composite_add_0565_8_0565),
+    PIXMAN_STD_FAST_PATH (ADD,  b5g6r5,   a8,       b5g6r5,   neon_composite_add_0565_8_0565),
+    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, a8,       a8r8g8b8, neon_composite_add_8888_8_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  a8b8g8r8, a8,       a8b8g8r8, neon_composite_add_8888_8_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, a8r8g8b8, a8r8g8b8, neon_composite_add_8888_8888_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, solid,    a8r8g8b8, neon_composite_add_8888_n_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  a8b8g8r8, solid,    a8b8g8r8, neon_composite_add_8888_n_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  a8,       null,     a8,       neon_composite_add_8_8),
+    PIXMAN_STD_FAST_PATH (ADD,  a8r8g8b8, null,     a8r8g8b8, neon_composite_add_8888_8888),
+    PIXMAN_STD_FAST_PATH (ADD,  a8b8g8r8, null,     a8b8g8r8, neon_composite_add_8888_8888),
+    PIXMAN_STD_FAST_PATH (IN,   solid,    null,     a8,       neon_composite_in_n_8),
+    PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8r8g8b8, neon_composite_over_reverse_n_8888),
+    PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8b8g8r8, neon_composite_over_reverse_n_8888),
+    PIXMAN_STD_FAST_PATH (OUT_REVERSE,  a8,    null, r5g6b5,   neon_composite_out_reverse_8_0565),
+    PIXMAN_STD_FAST_PATH (OUT_REVERSE,  a8,    null, b5g6r5,   neon_composite_out_reverse_8_0565),
+
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, neon_8888_8888),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, a8b8g8r8, neon_8888_8888),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, neon_8888_8888),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, x8b8g8r8, neon_8888_8888),
+
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, r5g6b5, neon_8888_0565),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, b5g6r5, neon_8888_0565),
+
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, r5g6b5, neon_8888_0565),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, r5g6b5, neon_8888_0565),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, a8b8g8r8, b5g6r5, neon_8888_0565),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, x8b8g8r8, b5g6r5, neon_8888_0565),
+
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, b5g6r5, x8b8g8r8, neon_0565_8888),
+    PIXMAN_ARM_SIMPLE_NEAREST_FAST_PATH (SRC, r5g6b5, x8r8g8b8, neon_0565_8888),
+    /* Note: NONE repeat is not supported yet */
+    SIMPLE_NEAREST_FAST_PATH_COVER (SRC, r5g6b5, a8r8g8b8, neon_0565_8888),
+    SIMPLE_NEAREST_FAST_PATH_COVER (SRC, b5g6r5, a8b8g8r8, neon_0565_8888),
+    SIMPLE_NEAREST_FAST_PATH_PAD (SRC, r5g6b5, a8r8g8b8, neon_0565_8888),
+    SIMPLE_NEAREST_FAST_PATH_PAD (SRC, b5g6r5, a8b8g8r8, neon_0565_8888),
+
+    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, a8r8g8b8, r5g6b5, neon_8888_8_0565),
+    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, a8b8g8r8, b5g6r5, neon_8888_8_0565),
+
+    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, r5g6b5, r5g6b5, neon_0565_8_0565),
+    PIXMAN_ARM_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, b5g6r5, b5g6r5, neon_0565_8_0565),
+
+    SIMPLE_BILINEAR_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, neon_8888_8888),
+    SIMPLE_BILINEAR_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, neon_8888_8888),
+    SIMPLE_BILINEAR_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, neon_8888_8888),
+
+    SIMPLE_BILINEAR_FAST_PATH (SRC, a8r8g8b8, r5g6b5, neon_8888_0565),
+    SIMPLE_BILINEAR_FAST_PATH (SRC, x8r8g8b8, r5g6b5, neon_8888_0565),
+
+    SIMPLE_BILINEAR_FAST_PATH (SRC, r5g6b5, x8r8g8b8, neon_0565_x888),
+    SIMPLE_BILINEAR_FAST_PATH (SRC, r5g6b5, r5g6b5, neon_0565_0565),
+
+    SIMPLE_BILINEAR_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, neon_8888_8888),
+    SIMPLE_BILINEAR_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, neon_8888_8888),
+
+    SIMPLE_BILINEAR_FAST_PATH (ADD, a8r8g8b8, a8r8g8b8, neon_8888_8888),
+    SIMPLE_BILINEAR_FAST_PATH (ADD, a8r8g8b8, x8r8g8b8, neon_8888_8888),
+
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, neon_8888_8_8888),
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, neon_8888_8_8888),
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, neon_8888_8_8888),
+
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, a8r8g8b8, r5g6b5, neon_8888_8_0565),
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, x8r8g8b8, r5g6b5, neon_8888_8_0565),
+
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, r5g6b5, x8r8g8b8, neon_0565_8_x888),
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, r5g6b5, r5g6b5, neon_0565_8_0565),
+
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, neon_8888_8_8888),
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, neon_8888_8_8888),
+
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (ADD, a8r8g8b8, a8r8g8b8, neon_8888_8_8888),
+    SIMPLE_BILINEAR_A8_MASK_FAST_PATH (ADD, a8r8g8b8, x8r8g8b8, neon_8888_8_8888),
+
+    { PIXMAN_OP_NONE },
+};
+
+static pixman_bool_t
+arm_neon_blt (pixman_implementation_t *imp,
+              uint32_t *               src_bits,
+              uint32_t *               dst_bits,
+              int                      src_stride,
+              int                      dst_stride,
+              int                      src_bpp,
+              int                      dst_bpp,
+              int                      src_x,
+              int                      src_y,
+              int                      dst_x,
+              int                      dst_y,
+              int                      width,
+              int                      height)
+{
+    if (!pixman_blt_neon (
+            src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
+            src_x, src_y, dst_x, dst_y, width, height))
+
+    {
+	return _pixman_implementation_blt (
+	    imp->delegate,
+	    src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
+	    src_x, src_y, dst_x, dst_y, width, height);
+    }
+
+    return TRUE;
+}
+
+static pixman_bool_t
+arm_neon_fill (pixman_implementation_t *imp,
+               uint32_t *               bits,
+               int                      stride,
+               int                      bpp,
+               int                      x,
+               int                      y,
+               int                      width,
+               int                      height,
+               uint32_t xor)
+{
+    if (pixman_fill_neon (bits, stride, bpp, x, y, width, height, xor))
+	return TRUE;
+
+    return _pixman_implementation_fill (
+	imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+}
+
+#define BIND_COMBINE_U(name)                                             \
+void                                                                     \
+pixman_composite_scanline_##name##_mask_asm_neon (int32_t         w,     \
+                                                  const uint32_t *dst,   \
+                                                  const uint32_t *src,   \
+                                                  const uint32_t *mask); \
+                                                                         \
+void                                                                     \
+pixman_composite_scanline_##name##_asm_neon (int32_t         w,          \
+                                             const uint32_t *dst,        \
+                                             const uint32_t *src);       \
+                                                                         \
+static void                                                              \
+neon_combine_##name##_u (pixman_implementation_t *imp,                   \
+                         pixman_op_t              op,                    \
+                         uint32_t *               dest,                  \
+                         const uint32_t *         src,                   \
+                         const uint32_t *         mask,                  \
+                         int                      width)                 \
+{                                                                        \
+    if (mask)                                                            \
+	pixman_composite_scanline_##name##_mask_asm_neon (width, dest,   \
+	                                                  src, mask);    \
+    else                                                                 \
+	pixman_composite_scanline_##name##_asm_neon (width, dest, src);  \
+}
+
+BIND_COMBINE_U (over)
+BIND_COMBINE_U (add)
+BIND_COMBINE_U (out_reverse)
+
+pixman_implementation_t *
+_pixman_implementation_create_arm_neon (pixman_implementation_t *fallback)
+{
+    pixman_implementation_t *imp =
+	_pixman_implementation_create (fallback, arm_neon_fast_paths);
+
+    imp->combine_32[PIXMAN_OP_OVER] = neon_combine_over_u;
+    imp->combine_32[PIXMAN_OP_ADD] = neon_combine_add_u;
+    imp->combine_32[PIXMAN_OP_OUT_REVERSE] = neon_combine_out_reverse_u;
+
+    imp->blt = arm_neon_blt;
+    imp->fill = arm_neon_fill;
+
+    return imp;
+}
diff --git a/pixman/pixman/pixman-trap.c b/pixman/pixman/pixman-trap.c
index 6e85acd49..c99f03ecc 100644
--- a/pixman/pixman/pixman-trap.c
+++ b/pixman/pixman/pixman-trap.c
@@ -1,657 +1,668 @@
-/*
- * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
- * Copyright © 2004 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "pixman-private.h"
-
-/*
- * Compute the smallest value greater than or equal to y which is on a
- * grid row.
- */
-
-PIXMAN_EXPORT pixman_fixed_t
-pixman_sample_ceil_y (pixman_fixed_t y, int n)
-{
-    pixman_fixed_t f = pixman_fixed_frac (y);
-    pixman_fixed_t i = pixman_fixed_floor (y);
-
-    f = DIV (f - Y_FRAC_FIRST (n) + (STEP_Y_SMALL (n) - pixman_fixed_e), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) +
-	Y_FRAC_FIRST (n);
-    
-    if (f > Y_FRAC_LAST (n))
-    {
-	if (pixman_fixed_to_int (i) == 0x7fff)
-	{
-	    f = 0xffff; /* saturate */
-	}
-	else
-	{
-	    f = Y_FRAC_FIRST (n);
-	    i += pixman_fixed_1;
-	}
-    }
-    return (i | f);
-}
-
-/*
- * Compute the largest value strictly less than y which is on a
- * grid row.
- */
-PIXMAN_EXPORT pixman_fixed_t
-pixman_sample_floor_y (pixman_fixed_t y,
-                       int            n)
-{
-    pixman_fixed_t f = pixman_fixed_frac (y);
-    pixman_fixed_t i = pixman_fixed_floor (y);
-
-    f = DIV (f - pixman_fixed_e - Y_FRAC_FIRST (n), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) +
-	Y_FRAC_FIRST (n);
-
-    if (f < Y_FRAC_FIRST (n))
-    {
-	if (pixman_fixed_to_int (i) == 0x8000)
-	{
-	    f = 0; /* saturate */
-	}
-	else
-	{
-	    f = Y_FRAC_LAST (n);
-	    i -= pixman_fixed_1;
-	}
-    }
-    return (i | f);
-}
-
-/*
- * Step an edge by any amount (including negative values)
- */
-PIXMAN_EXPORT void
-pixman_edge_step (pixman_edge_t *e,
-                  int            n)
-{
-    pixman_fixed_48_16_t ne;
-
-    e->x += n * e->stepx;
-
-    ne = e->e + n * (pixman_fixed_48_16_t) e->dx;
-
-    if (n >= 0)
-    {
-	if (ne > 0)
-	{
-	    int nx = (ne + e->dy - 1) / e->dy;
-	    e->e = ne - nx * (pixman_fixed_48_16_t) e->dy;
-	    e->x += nx * e->signdx;
-	}
-    }
-    else
-    {
-	if (ne <= -e->dy)
-	{
-	    int nx = (-ne) / e->dy;
-	    e->e = ne + nx * (pixman_fixed_48_16_t) e->dy;
-	    e->x -= nx * e->signdx;
-	}
-    }
-}
-
-/*
- * A private routine to initialize the multi-step
- * elements of an edge structure
- */
-static void
-_pixman_edge_multi_init (pixman_edge_t * e,
-                         int             n,
-                         pixman_fixed_t *stepx_p,
-                         pixman_fixed_t *dx_p)
-{
-    pixman_fixed_t stepx;
-    pixman_fixed_48_16_t ne;
-
-    ne = n * (pixman_fixed_48_16_t) e->dx;
-    stepx = n * e->stepx;
-
-    if (ne > 0)
-    {
-	int nx = ne / e->dy;
-	ne -= nx * e->dy;
-	stepx += nx * e->signdx;
-    }
-
-    *dx_p = ne;
-    *stepx_p = stepx;
-}
-
-/*
- * Initialize one edge structure given the line endpoints and a
- * starting y value
- */
-PIXMAN_EXPORT void
-pixman_edge_init (pixman_edge_t *e,
-                  int            n,
-                  pixman_fixed_t y_start,
-                  pixman_fixed_t x_top,
-                  pixman_fixed_t y_top,
-                  pixman_fixed_t x_bot,
-                  pixman_fixed_t y_bot)
-{
-    pixman_fixed_t dx, dy;
-
-    e->x = x_top;
-    e->e = 0;
-    dx = x_bot - x_top;
-    dy = y_bot - y_top;
-    e->dy = dy;
-    e->dx = 0;
-
-    if (dy)
-    {
-	if (dx >= 0)
-	{
-	    e->signdx = 1;
-	    e->stepx = dx / dy;
-	    e->dx = dx % dy;
-	    e->e = -dy;
-	}
-	else
-	{
-	    e->signdx = -1;
-	    e->stepx = -(-dx / dy);
-	    e->dx = -dx % dy;
-	    e->e = 0;
-	}
-
-	_pixman_edge_multi_init (e, STEP_Y_SMALL (n),
-				 &e->stepx_small, &e->dx_small);
-
-	_pixman_edge_multi_init (e, STEP_Y_BIG (n),
-				 &e->stepx_big, &e->dx_big);
-    }
-    pixman_edge_step (e, y_start - y_top);
-}
-
-/*
- * Initialize one edge structure given a line, starting y value
- * and a pixel offset for the line
- */
-PIXMAN_EXPORT void
-pixman_line_fixed_edge_init (pixman_edge_t *            e,
-                             int                        n,
-                             pixman_fixed_t             y,
-                             const pixman_line_fixed_t *line,
-                             int                        x_off,
-                             int                        y_off)
-{
-    pixman_fixed_t x_off_fixed = pixman_int_to_fixed (x_off);
-    pixman_fixed_t y_off_fixed = pixman_int_to_fixed (y_off);
-    const pixman_point_fixed_t *top, *bot;
-
-    if (line->p1.y <= line->p2.y)
-    {
-	top = &line->p1;
-	bot = &line->p2;
-    }
-    else
-    {
-	top = &line->p2;
-	bot = &line->p1;
-    }
-    
-    pixman_edge_init (e, n, y,
-                      top->x + x_off_fixed,
-                      top->y + y_off_fixed,
-                      bot->x + x_off_fixed,
-                      bot->y + y_off_fixed);
-}
-
-PIXMAN_EXPORT void
-pixman_add_traps (pixman_image_t * image,
-                  int16_t          x_off,
-                  int16_t          y_off,
-                  int              ntrap,
-                  pixman_trap_t *  traps)
-{
-    int bpp;
-    int height;
-
-    pixman_fixed_t x_off_fixed;
-    pixman_fixed_t y_off_fixed;
-    pixman_edge_t l, r;
-    pixman_fixed_t t, b;
-
-    _pixman_image_validate (image);
-    
-    height = image->bits.height;
-    bpp = PIXMAN_FORMAT_BPP (image->bits.format);
-
-    x_off_fixed = pixman_int_to_fixed (x_off);
-    y_off_fixed = pixman_int_to_fixed (y_off);
-
-    while (ntrap--)
-    {
-	t = traps->top.y + y_off_fixed;
-	if (t < 0)
-	    t = 0;
-	t = pixman_sample_ceil_y (t, bpp);
-
-	b = traps->bot.y + y_off_fixed;
-	if (pixman_fixed_to_int (b) >= height)
-	    b = pixman_int_to_fixed (height) - 1;
-	b = pixman_sample_floor_y (b, bpp);
-
-	if (b >= t)
-	{
-	    /* initialize edge walkers */
-	    pixman_edge_init (&l, bpp, t,
-	                      traps->top.l + x_off_fixed,
-	                      traps->top.y + y_off_fixed,
-	                      traps->bot.l + x_off_fixed,
-	                      traps->bot.y + y_off_fixed);
-
-	    pixman_edge_init (&r, bpp, t,
-	                      traps->top.r + x_off_fixed,
-	                      traps->top.y + y_off_fixed,
-	                      traps->bot.r + x_off_fixed,
-	                      traps->bot.y + y_off_fixed);
-
-	    pixman_rasterize_edges (image, &l, &r, t, b);
-	}
-
-	traps++;
-    }
-}
-
-#if 0
-static void
-dump_image (pixman_image_t *image,
-            const char *    title)
-{
-    int i, j;
-
-    if (!image->type == BITS)
-	printf ("%s is not a regular image\n", title);
-
-    if (!image->bits.format == PIXMAN_a8)
-	printf ("%s is not an alpha mask\n", title);
-
-    printf ("\n\n\n%s: \n", title);
-
-    for (i = 0; i < image->bits.height; ++i)
-    {
-	uint8_t *line =
-	    (uint8_t *)&(image->bits.bits[i * image->bits.rowstride]);
-
-	for (j = 0; j < image->bits.width; ++j)
-	    printf ("%c", line[j] ? '#' : ' ');
-
-	printf ("\n");
-    }
-}
-#endif
-
-PIXMAN_EXPORT void
-pixman_add_trapezoids (pixman_image_t *          image,
-                       int16_t                   x_off,
-                       int                       y_off,
-                       int                       ntraps,
-                       const pixman_trapezoid_t *traps)
-{
-    int i;
-
-#if 0
-    dump_image (image, "before");
-#endif
-
-    for (i = 0; i < ntraps; ++i)
-    {
-	const pixman_trapezoid_t *trap = &(traps[i]);
-
-	if (!pixman_trapezoid_valid (trap))
-	    continue;
-
-	pixman_rasterize_trapezoid (image, trap, x_off, y_off);
-    }
-
-#if 0
-    dump_image (image, "after");
-#endif
-}
-
-PIXMAN_EXPORT void
-pixman_rasterize_trapezoid (pixman_image_t *          image,
-                            const pixman_trapezoid_t *trap,
-                            int                       x_off,
-                            int                       y_off)
-{
-    int bpp;
-    int height;
-
-    pixman_fixed_t y_off_fixed;
-    pixman_edge_t l, r;
-    pixman_fixed_t t, b;
-
-    return_if_fail (image->type == BITS);
-
-    _pixman_image_validate (image);
-    
-    if (!pixman_trapezoid_valid (trap))
-	return;
-
-    height = image->bits.height;
-    bpp = PIXMAN_FORMAT_BPP (image->bits.format);
-
-    y_off_fixed = pixman_int_to_fixed (y_off);
-
-    t = trap->top + y_off_fixed;
-    if (t < 0)
-	t = 0;
-    t = pixman_sample_ceil_y (t, bpp);
-
-    b = trap->bottom + y_off_fixed;
-    if (pixman_fixed_to_int (b) >= height)
-	b = pixman_int_to_fixed (height) - 1;
-    b = pixman_sample_floor_y (b, bpp);
-    
-    if (b >= t)
-    {
-	/* initialize edge walkers */
-	pixman_line_fixed_edge_init (&l, bpp, t, &trap->left, x_off, y_off);
-	pixman_line_fixed_edge_init (&r, bpp, t, &trap->right, x_off, y_off);
-
-	pixman_rasterize_edges (image, &l, &r, t, b);
-    }
-}
-
-PIXMAN_EXPORT void
-pixman_composite_trapezoids (pixman_op_t		op,
-			     pixman_image_t *		src,
-			     pixman_image_t *		dst,
-			     pixman_format_code_t	mask_format,
-			     int			x_src,
-			     int			y_src,
-			     int			x_dst,
-			     int			y_dst,
-			     int			n_traps,
-			     const pixman_trapezoid_t *	traps)
-{
-    int i;
-
-    if (n_traps <= 0)
-	return;
-
-    _pixman_image_validate (src);
-    _pixman_image_validate (dst);
-
-    if (op == PIXMAN_OP_ADD &&
-	(src->common.flags & FAST_PATH_IS_OPAQUE)		&&
-	(mask_format == dst->common.extended_format_code)	&&
-	!(dst->common.have_clip_region))
-    {
-	for (i = 0; i < n_traps; ++i)
-	{
-	    const pixman_trapezoid_t *trap = &(traps[i]);
-	    
-	    if (!pixman_trapezoid_valid (trap))
-		continue;
-	    
-	    pixman_rasterize_trapezoid (dst, trap, 0, 0);
-	}
-    }
-    else
-    {
-	pixman_image_t *tmp;
-	pixman_box32_t box;
-	int x_rel, y_rel;
-	
-	box.x1 = INT32_MAX;
-	box.y1 = INT32_MAX;
-	box.x2 = INT32_MIN;
-	box.y2 = INT32_MIN;
-	
-	for (i = 0; i < n_traps; ++i)
-	{
-	    const pixman_trapezoid_t *trap = &(traps[i]);
-	    int y1, y2;
-	    
-	    if (!pixman_trapezoid_valid (trap))
-		continue;
-	    
-	    y1 = pixman_fixed_to_int (trap->top);
-	    if (y1 < box.y1)
-		box.y1 = y1;
-	    
-	    y2 = pixman_fixed_to_int (pixman_fixed_ceil (trap->bottom));
-	    if (y2 > box.y2)
-		box.y2 = y2;
-	    
-#define EXTEND_MIN(x)							\
-	    if (pixman_fixed_to_int ((x)) < box.x1)			\
-		box.x1 = pixman_fixed_to_int ((x));
-#define EXTEND_MAX(x)							\
-	    if (pixman_fixed_to_int (pixman_fixed_ceil ((x))) > box.x2)	\
-		box.x2 = pixman_fixed_to_int (pixman_fixed_ceil ((x)));
-	    
-#define EXTEND(x)							\
-	    EXTEND_MIN(x);						\
-	    EXTEND_MAX(x);
-	    
-	    EXTEND(trap->left.p1.x);
-	    EXTEND(trap->left.p2.x);
-	    EXTEND(trap->right.p1.x);
-	    EXTEND(trap->right.p2.x);
-	}
-	
-	if (box.x1 >= box.x2 || box.y1 >= box.y2)
-	    return;
-	
-	tmp = pixman_image_create_bits (
-	    mask_format, box.x2 - box.x1, box.y2 - box.y1, NULL, -1);
-	
-	for (i = 0; i < n_traps; ++i)
-	{
-	    const pixman_trapezoid_t *trap = &(traps[i]);
-	    
-	    if (!pixman_trapezoid_valid (trap))
-		continue;
-	    
-	    pixman_rasterize_trapezoid (tmp, trap, - box.x1, - box.y1);
-	}
-	
-	x_rel = box.x1 + x_src - x_dst;
-	y_rel = box.y1 + y_src - y_dst;
-	
-	pixman_image_composite (op, src, tmp, dst,
-				x_rel, y_rel, 0, 0, box.x1, box.y1,
-				box.x2 - box.x1, box.y2 - box.y1);
-	
-	pixman_image_unref (tmp);
-    }
-}
-
-static int
-greater_y (const pixman_point_fixed_t *a, const pixman_point_fixed_t *b)
-{
-    if (a->y == b->y)
-	return a->x > b->x;
-    return a->y > b->y;
-}
-
-/*
- * Note that the definition of this function is a bit odd because
- * of the X coordinate space (y increasing downwards).
- */
-static int
-clockwise (const pixman_point_fixed_t *ref,
-	   const pixman_point_fixed_t *a,
-	   const pixman_point_fixed_t *b)
-{
-    pixman_point_fixed_t	ad, bd;
-
-    ad.x = a->x - ref->x;
-    ad.y = a->y - ref->y;
-    bd.x = b->x - ref->x;
-    bd.y = b->y - ref->y;
-
-    return ((pixman_fixed_32_32_t) bd.y * ad.x -
-	    (pixman_fixed_32_32_t) ad.y * bd.x) < 0;
-}
-
-static void
-triangle_to_trapezoids (const pixman_triangle_t *tri, pixman_trapezoid_t *traps)
-{
-    const pixman_point_fixed_t *top, *left, *right, *tmp;
-
-    top = &tri->p1;
-    left = &tri->p2;
-    right = &tri->p3;
-
-    if (greater_y (top, left))
-    {
-	tmp = left;
-	left = top;
-	top = tmp;
-    }
-
-    if (greater_y (top, right))
-    {
-	tmp = right;
-	right = top;
-	top = tmp;
-    }
-
-    if (clockwise (top, right, left))
-    {
-	tmp = right;
-	right = left;
-	left = tmp;
-    }
-    
-    /*
-     * Two cases:
-     *
-     *		+		+
-     *	       / \             / \
-     *	      /   \           /	  \
-     *	     /     +         +	   \
-     *      /    --           --    \
-     *     /   --               --   \
-     *    / ---                   --- \
-     *	 +--                         --+
-     */
-
-    traps->top = top->y;
-    traps->left.p1 = *top;
-    traps->left.p2 = *left;
-    traps->right.p1 = *top;
-    traps->right.p2 = *right;
-
-    if (right->y < left->y)
-	traps->bottom = right->y;
-    else
-	traps->bottom = left->y;
-
-    traps++;
-
-    *traps = *(traps - 1);
-    
-    if (right->y < left->y)
-    {
-	traps->top = right->y;
-	traps->bottom = left->y;
-	traps->right.p1 = *right;
-	traps->right.p2 = *left;
-    }
-    else
-    {
-	traps->top = left->y;
-	traps->bottom = right->y;
-	traps->left.p1 = *left;
-	traps->left.p2 = *right;
-    }
-}
-
-static pixman_trapezoid_t *
-convert_triangles (int n_tris, const pixman_triangle_t *tris)
-{
-    pixman_trapezoid_t *traps;
-    int i;
-
-    if (n_tris <= 0)
-	return NULL;
-    
-    traps = pixman_malloc_ab (n_tris, 2 * sizeof (pixman_trapezoid_t));
-    if (!traps)
-	return NULL;
-
-    for (i = 0; i < n_tris; ++i)
-	triangle_to_trapezoids (&(tris[i]), traps + 2 * i);
-
-    return traps;
-}
-
-PIXMAN_EXPORT void
-pixman_composite_triangles (pixman_op_t			op,
-			    pixman_image_t *		src,
-			    pixman_image_t *		dst,
-			    pixman_format_code_t	mask_format,
-			    int				x_src,
-			    int				y_src,
-			    int				x_dst,
-			    int				y_dst,
-			    int				n_tris,
-			    const pixman_triangle_t *	tris)
-{
-    pixman_trapezoid_t *traps;
-
-    if ((traps = convert_triangles (n_tris, tris)))
-    {
-	pixman_composite_trapezoids (op, src, dst, mask_format,
-				     x_src, y_src, x_dst, y_dst,
-				     n_tris * 2, traps);
-	
-	free (traps);
-    }
-}
-
-PIXMAN_EXPORT void
-pixman_add_triangles (pixman_image_t          *image,
-		      int32_t	               x_off,
-		      int32_t	               y_off,
-		      int	               n_tris,
-		      const pixman_triangle_t *tris)
-{
-    pixman_trapezoid_t *traps;
-
-    if ((traps = convert_triangles (n_tris, tris)))
-    {
-	pixman_add_trapezoids (image, x_off, y_off,
-			       n_tris * 2, traps);
-
-	free (traps);
-    }
-}
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "pixman-private.h"
+
+/*
+ * Compute the smallest value greater than or equal to y which is on a
+ * grid row.
+ */
+
+PIXMAN_EXPORT pixman_fixed_t
+pixman_sample_ceil_y (pixman_fixed_t y, int n)
+{
+    pixman_fixed_t f = pixman_fixed_frac (y);
+    pixman_fixed_t i = pixman_fixed_floor (y);
+
+    f = DIV (f - Y_FRAC_FIRST (n) + (STEP_Y_SMALL (n) - pixman_fixed_e), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) +
+	Y_FRAC_FIRST (n);
+    
+    if (f > Y_FRAC_LAST (n))
+    {
+	if (pixman_fixed_to_int (i) == 0x7fff)
+	{
+	    f = 0xffff; /* saturate */
+	}
+	else
+	{
+	    f = Y_FRAC_FIRST (n);
+	    i += pixman_fixed_1;
+	}
+    }
+    return (i | f);
+}
+
+/*
+ * Compute the largest value strictly less than y which is on a
+ * grid row.
+ */
+PIXMAN_EXPORT pixman_fixed_t
+pixman_sample_floor_y (pixman_fixed_t y,
+                       int            n)
+{
+    pixman_fixed_t f = pixman_fixed_frac (y);
+    pixman_fixed_t i = pixman_fixed_floor (y);
+
+    f = DIV (f - pixman_fixed_e - Y_FRAC_FIRST (n), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) +
+	Y_FRAC_FIRST (n);
+
+    if (f < Y_FRAC_FIRST (n))
+    {
+	if (pixman_fixed_to_int (i) == 0x8000)
+	{
+	    f = 0; /* saturate */
+	}
+	else
+	{
+	    f = Y_FRAC_LAST (n);
+	    i -= pixman_fixed_1;
+	}
+    }
+    return (i | f);
+}
+
+/*
+ * Step an edge by any amount (including negative values)
+ */
+PIXMAN_EXPORT void
+pixman_edge_step (pixman_edge_t *e,
+                  int            n)
+{
+    pixman_fixed_48_16_t ne;
+
+    e->x += n * e->stepx;
+
+    ne = e->e + n * (pixman_fixed_48_16_t) e->dx;
+
+    if (n >= 0)
+    {
+	if (ne > 0)
+	{
+	    int nx = (ne + e->dy - 1) / e->dy;
+	    e->e = ne - nx * (pixman_fixed_48_16_t) e->dy;
+	    e->x += nx * e->signdx;
+	}
+    }
+    else
+    {
+	if (ne <= -e->dy)
+	{
+	    int nx = (-ne) / e->dy;
+	    e->e = ne + nx * (pixman_fixed_48_16_t) e->dy;
+	    e->x -= nx * e->signdx;
+	}
+    }
+}
+
+/*
+ * A private routine to initialize the multi-step
+ * elements of an edge structure
+ */
+static void
+_pixman_edge_multi_init (pixman_edge_t * e,
+                         int             n,
+                         pixman_fixed_t *stepx_p,
+                         pixman_fixed_t *dx_p)
+{
+    pixman_fixed_t stepx;
+    pixman_fixed_48_16_t ne;
+
+    ne = n * (pixman_fixed_48_16_t) e->dx;
+    stepx = n * e->stepx;
+
+    if (ne > 0)
+    {
+	int nx = ne / e->dy;
+	ne -= nx * e->dy;
+	stepx += nx * e->signdx;
+    }
+
+    *dx_p = ne;
+    *stepx_p = stepx;
+}
+
+/*
+ * Initialize one edge structure given the line endpoints and a
+ * starting y value
+ */
+PIXMAN_EXPORT void
+pixman_edge_init (pixman_edge_t *e,
+                  int            n,
+                  pixman_fixed_t y_start,
+                  pixman_fixed_t x_top,
+                  pixman_fixed_t y_top,
+                  pixman_fixed_t x_bot,
+                  pixman_fixed_t y_bot)
+{
+    pixman_fixed_t dx, dy;
+
+    e->x = x_top;
+    e->e = 0;
+    dx = x_bot - x_top;
+    dy = y_bot - y_top;
+    e->dy = dy;
+    e->dx = 0;
+
+    if (dy)
+    {
+	if (dx >= 0)
+	{
+	    e->signdx = 1;
+	    e->stepx = dx / dy;
+	    e->dx = dx % dy;
+	    e->e = -dy;
+	}
+	else
+	{
+	    e->signdx = -1;
+	    e->stepx = -(-dx / dy);
+	    e->dx = -dx % dy;
+	    e->e = 0;
+	}
+
+	_pixman_edge_multi_init (e, STEP_Y_SMALL (n),
+				 &e->stepx_small, &e->dx_small);
+
+	_pixman_edge_multi_init (e, STEP_Y_BIG (n),
+				 &e->stepx_big, &e->dx_big);
+    }
+    pixman_edge_step (e, y_start - y_top);
+}
+
+/*
+ * Initialize one edge structure given a line, starting y value
+ * and a pixel offset for the line
+ */
+PIXMAN_EXPORT void
+pixman_line_fixed_edge_init (pixman_edge_t *            e,
+                             int                        n,
+                             pixman_fixed_t             y,
+                             const pixman_line_fixed_t *line,
+                             int                        x_off,
+                             int                        y_off)
+{
+    pixman_fixed_t x_off_fixed = pixman_int_to_fixed (x_off);
+    pixman_fixed_t y_off_fixed = pixman_int_to_fixed (y_off);
+    const pixman_point_fixed_t *top, *bot;
+
+    if (line->p1.y <= line->p2.y)
+    {
+	top = &line->p1;
+	bot = &line->p2;
+    }
+    else
+    {
+	top = &line->p2;
+	bot = &line->p1;
+    }
+    
+    pixman_edge_init (e, n, y,
+                      top->x + x_off_fixed,
+                      top->y + y_off_fixed,
+                      bot->x + x_off_fixed,
+                      bot->y + y_off_fixed);
+}
+
+PIXMAN_EXPORT void
+pixman_add_traps (pixman_image_t * image,
+                  int16_t          x_off,
+                  int16_t          y_off,
+                  int              ntrap,
+                  pixman_trap_t *  traps)
+{
+    int bpp;
+    int height;
+
+    pixman_fixed_t x_off_fixed;
+    pixman_fixed_t y_off_fixed;
+    pixman_edge_t l, r;
+    pixman_fixed_t t, b;
+
+    _pixman_image_validate (image);
+    
+    height = image->bits.height;
+    bpp = PIXMAN_FORMAT_BPP (image->bits.format);
+
+    x_off_fixed = pixman_int_to_fixed (x_off);
+    y_off_fixed = pixman_int_to_fixed (y_off);
+
+    while (ntrap--)
+    {
+	t = traps->top.y + y_off_fixed;
+	if (t < 0)
+	    t = 0;
+	t = pixman_sample_ceil_y (t, bpp);
+
+	b = traps->bot.y + y_off_fixed;
+	if (pixman_fixed_to_int (b) >= height)
+	    b = pixman_int_to_fixed (height) - 1;
+	b = pixman_sample_floor_y (b, bpp);
+
+	if (b >= t)
+	{
+	    /* initialize edge walkers */
+	    pixman_edge_init (&l, bpp, t,
+	                      traps->top.l + x_off_fixed,
+	                      traps->top.y + y_off_fixed,
+	                      traps->bot.l + x_off_fixed,
+	                      traps->bot.y + y_off_fixed);
+
+	    pixman_edge_init (&r, bpp, t,
+	                      traps->top.r + x_off_fixed,
+	                      traps->top.y + y_off_fixed,
+	                      traps->bot.r + x_off_fixed,
+	                      traps->bot.y + y_off_fixed);
+
+	    pixman_rasterize_edges (image, &l, &r, t, b);
+	}
+
+	traps++;
+    }
+}
+
+#if 0
+static void
+dump_image (pixman_image_t *image,
+            const char *    title)
+{
+    int i, j;
+
+    if (!image->type == BITS)
+	printf ("%s is not a regular image\n", title);
+
+    if (!image->bits.format == PIXMAN_a8)
+	printf ("%s is not an alpha mask\n", title);
+
+    printf ("\n\n\n%s: \n", title);
+
+    for (i = 0; i < image->bits.height; ++i)
+    {
+	uint8_t *line =
+	    (uint8_t *)&(image->bits.bits[i * image->bits.rowstride]);
+
+	for (j = 0; j < image->bits.width; ++j)
+	    printf ("%c", line[j] ? '#' : ' ');
+
+	printf ("\n");
+    }
+}
+#endif
+
+PIXMAN_EXPORT void
+pixman_add_trapezoids (pixman_image_t *          image,
+                       int16_t                   x_off,
+                       int                       y_off,
+                       int                       ntraps,
+                       const pixman_trapezoid_t *traps)
+{
+    int i;
+
+#if 0
+    dump_image (image, "before");
+#endif
+
+    for (i = 0; i < ntraps; ++i)
+    {
+	const pixman_trapezoid_t *trap = &(traps[i]);
+
+	if (!pixman_trapezoid_valid (trap))
+	    continue;
+
+	pixman_rasterize_trapezoid (image, trap, x_off, y_off);
+    }
+
+#if 0
+    dump_image (image, "after");
+#endif
+}
+
+PIXMAN_EXPORT void
+pixman_rasterize_trapezoid (pixman_image_t *          image,
+                            const pixman_trapezoid_t *trap,
+                            int                       x_off,
+                            int                       y_off)
+{
+    int bpp;
+    int height;
+
+    pixman_fixed_t y_off_fixed;
+    pixman_edge_t l, r;
+    pixman_fixed_t t, b;
+
+    return_if_fail (image->type == BITS);
+
+    _pixman_image_validate (image);
+    
+    if (!pixman_trapezoid_valid (trap))
+	return;
+
+    height = image->bits.height;
+    bpp = PIXMAN_FORMAT_BPP (image->bits.format);
+
+    y_off_fixed = pixman_int_to_fixed (y_off);
+
+    t = trap->top + y_off_fixed;
+    if (t < 0)
+	t = 0;
+    t = pixman_sample_ceil_y (t, bpp);
+
+    b = trap->bottom + y_off_fixed;
+    if (pixman_fixed_to_int (b) >= height)
+	b = pixman_int_to_fixed (height) - 1;
+    b = pixman_sample_floor_y (b, bpp);
+    
+    if (b >= t)
+    {
+	/* initialize edge walkers */
+	pixman_line_fixed_edge_init (&l, bpp, t, &trap->left, x_off, y_off);
+	pixman_line_fixed_edge_init (&r, bpp, t, &trap->right, x_off, y_off);
+
+	pixman_rasterize_edges (image, &l, &r, t, b);
+    }
+}
+
+/*
+ * pixman_composite_trapezoids()
+ *
+ * All the trapezoids are conceptually rendered to an infinitely big image.
+ * The (0, 0) coordinates of this image are then aligned with the (x, y)
+ * coordinates of the source image, and then both images are aligned with
+ * the (x, y) coordinates of the destination. Then, in principle, compositing
+ * of these three images takes place across the entire destination.
+ *
+ * FIXME: However, there is currently a bug, where we restrict this compositing
+ * to the bounding box of the trapezoids. This is incorrect for operators such
+ * as SRC and IN where blank source pixels do have an effect on the destination.
+ */
+PIXMAN_EXPORT void
+pixman_composite_trapezoids (pixman_op_t		op,
+			     pixman_image_t *		src,
+			     pixman_image_t *		dst,
+			     pixman_format_code_t	mask_format,
+			     int			x_src,
+			     int			y_src,
+			     int			x_dst,
+			     int			y_dst,
+			     int			n_traps,
+			     const pixman_trapezoid_t *	traps)
+{
+    int i;
+
+    if (n_traps <= 0)
+	return;
+
+    _pixman_image_validate (src);
+    _pixman_image_validate (dst);
+
+    if (op == PIXMAN_OP_ADD &&
+	(src->common.flags & FAST_PATH_IS_OPAQUE)		&&
+	(mask_format == dst->common.extended_format_code)	&&
+	!(dst->common.have_clip_region))
+    {
+	for (i = 0; i < n_traps; ++i)
+	{
+	    const pixman_trapezoid_t *trap = &(traps[i]);
+	    
+	    if (!pixman_trapezoid_valid (trap))
+		continue;
+	    
+	    pixman_rasterize_trapezoid (dst, trap, x_dst, y_dst);
+	}
+    }
+    else
+    {
+	pixman_image_t *tmp;
+	pixman_box32_t box;
+	
+	box.x1 = INT32_MAX;
+	box.y1 = INT32_MAX;
+	box.x2 = INT32_MIN;
+	box.y2 = INT32_MIN;
+	
+	for (i = 0; i < n_traps; ++i)
+	{
+	    const pixman_trapezoid_t *trap = &(traps[i]);
+	    int y1, y2;
+	    
+	    if (!pixman_trapezoid_valid (trap))
+		continue;
+	    
+	    y1 = pixman_fixed_to_int (trap->top);
+	    if (y1 < box.y1)
+		box.y1 = y1;
+	    
+	    y2 = pixman_fixed_to_int (pixman_fixed_ceil (trap->bottom));
+	    if (y2 > box.y2)
+		box.y2 = y2;
+	    
+#define EXTEND_MIN(x)							\
+	    if (pixman_fixed_to_int ((x)) < box.x1)			\
+		box.x1 = pixman_fixed_to_int ((x));
+#define EXTEND_MAX(x)							\
+	    if (pixman_fixed_to_int (pixman_fixed_ceil ((x))) > box.x2)	\
+		box.x2 = pixman_fixed_to_int (pixman_fixed_ceil ((x)));
+	    
+#define EXTEND(x)							\
+	    EXTEND_MIN(x);						\
+	    EXTEND_MAX(x);
+	    
+	    EXTEND(trap->left.p1.x);
+	    EXTEND(trap->left.p2.x);
+	    EXTEND(trap->right.p1.x);
+	    EXTEND(trap->right.p2.x);
+	}
+	
+	if (box.x1 >= box.x2 || box.y1 >= box.y2)
+	    return;
+	
+	tmp = pixman_image_create_bits (
+	    mask_format, box.x2 - box.x1, box.y2 - box.y1, NULL, -1);
+	
+	for (i = 0; i < n_traps; ++i)
+	{
+	    const pixman_trapezoid_t *trap = &(traps[i]);
+	    
+	    if (!pixman_trapezoid_valid (trap))
+		continue;
+	    
+	    pixman_rasterize_trapezoid (tmp, trap, - box.x1, - box.y1);
+	}
+	
+	pixman_image_composite (op, src, tmp, dst,
+				x_src + box.x1, y_src + box.y1,
+				0, 0,
+				x_dst + box.x1, y_dst + box.y1,
+				box.x2 - box.x1, box.y2 - box.y1);
+	
+	pixman_image_unref (tmp);
+    }
+}
+
+static int
+greater_y (const pixman_point_fixed_t *a, const pixman_point_fixed_t *b)
+{
+    if (a->y == b->y)
+	return a->x > b->x;
+    return a->y > b->y;
+}
+
+/*
+ * Note that the definition of this function is a bit odd because
+ * of the X coordinate space (y increasing downwards).
+ */
+static int
+clockwise (const pixman_point_fixed_t *ref,
+	   const pixman_point_fixed_t *a,
+	   const pixman_point_fixed_t *b)
+{
+    pixman_point_fixed_t	ad, bd;
+
+    ad.x = a->x - ref->x;
+    ad.y = a->y - ref->y;
+    bd.x = b->x - ref->x;
+    bd.y = b->y - ref->y;
+
+    return ((pixman_fixed_32_32_t) bd.y * ad.x -
+	    (pixman_fixed_32_32_t) ad.y * bd.x) < 0;
+}
+
+static void
+triangle_to_trapezoids (const pixman_triangle_t *tri, pixman_trapezoid_t *traps)
+{
+    const pixman_point_fixed_t *top, *left, *right, *tmp;
+
+    top = &tri->p1;
+    left = &tri->p2;
+    right = &tri->p3;
+
+    if (greater_y (top, left))
+    {
+	tmp = left;
+	left = top;
+	top = tmp;
+    }
+
+    if (greater_y (top, right))
+    {
+	tmp = right;
+	right = top;
+	top = tmp;
+    }
+
+    if (clockwise (top, right, left))
+    {
+	tmp = right;
+	right = left;
+	left = tmp;
+    }
+    
+    /*
+     * Two cases:
+     *
+     *		+		+
+     *	       / \             / \
+     *	      /   \           /	  \
+     *	     /     +         +	   \
+     *      /    --           --    \
+     *     /   --               --   \
+     *    / ---                   --- \
+     *	 +--                         --+
+     */
+
+    traps->top = top->y;
+    traps->left.p1 = *top;
+    traps->left.p2 = *left;
+    traps->right.p1 = *top;
+    traps->right.p2 = *right;
+
+    if (right->y < left->y)
+	traps->bottom = right->y;
+    else
+	traps->bottom = left->y;
+
+    traps++;
+
+    *traps = *(traps - 1);
+    
+    if (right->y < left->y)
+    {
+	traps->top = right->y;
+	traps->bottom = left->y;
+	traps->right.p1 = *right;
+	traps->right.p2 = *left;
+    }
+    else
+    {
+	traps->top = left->y;
+	traps->bottom = right->y;
+	traps->left.p1 = *left;
+	traps->left.p2 = *right;
+    }
+}
+
+static pixman_trapezoid_t *
+convert_triangles (int n_tris, const pixman_triangle_t *tris)
+{
+    pixman_trapezoid_t *traps;
+    int i;
+
+    if (n_tris <= 0)
+	return NULL;
+    
+    traps = pixman_malloc_ab (n_tris, 2 * sizeof (pixman_trapezoid_t));
+    if (!traps)
+	return NULL;
+
+    for (i = 0; i < n_tris; ++i)
+	triangle_to_trapezoids (&(tris[i]), traps + 2 * i);
+
+    return traps;
+}
+
+PIXMAN_EXPORT void
+pixman_composite_triangles (pixman_op_t			op,
+			    pixman_image_t *		src,
+			    pixman_image_t *		dst,
+			    pixman_format_code_t	mask_format,
+			    int				x_src,
+			    int				y_src,
+			    int				x_dst,
+			    int				y_dst,
+			    int				n_tris,
+			    const pixman_triangle_t *	tris)
+{
+    pixman_trapezoid_t *traps;
+
+    if ((traps = convert_triangles (n_tris, tris)))
+    {
+	pixman_composite_trapezoids (op, src, dst, mask_format,
+				     x_src, y_src, x_dst, y_dst,
+				     n_tris * 2, traps);
+	
+	free (traps);
+    }
+}
+
+PIXMAN_EXPORT void
+pixman_add_triangles (pixman_image_t          *image,
+		      int32_t	               x_off,
+		      int32_t	               y_off,
+		      int	               n_tris,
+		      const pixman_triangle_t *tris)
+{
+    pixman_trapezoid_t *traps;
+
+    if ((traps = convert_triangles (n_tris, tris)))
+    {
+	pixman_add_trapezoids (image, x_off, y_off,
+			       n_tris * 2, traps);
+
+	free (traps);
+    }
+}
diff --git a/pixman/test/composite-traps-test.c b/pixman/test/composite-traps-test.c
index 9ea7293ce..fa6d8a988 100644
--- a/pixman/test/composite-traps-test.c
+++ b/pixman/test/composite-traps-test.c
@@ -1,257 +1,257 @@
-/* Based loosely on scaling-test */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "utils.h"
-
-#define MAX_SRC_WIDTH  48
-#define MAX_SRC_HEIGHT 48
-#define MAX_DST_WIDTH  48
-#define MAX_DST_HEIGHT 48
-#define MAX_STRIDE     4
-
-static pixman_format_code_t formats[] =
-{
-    PIXMAN_a8r8g8b8, PIXMAN_a8, PIXMAN_r5g6b5, PIXMAN_a1, PIXMAN_a4
-};
-
-static pixman_format_code_t mask_formats[] =
-{
-    PIXMAN_a1, PIXMAN_a4, PIXMAN_a8,
-};
-
-static pixman_op_t operators[] =
-{
-    PIXMAN_OP_OVER, PIXMAN_OP_ADD, PIXMAN_OP_SRC, PIXMAN_OP_IN
-};
-
-#define RANDOM_ELT(array)						\
-    ((array)[lcg_rand_n(ARRAY_LENGTH((array)))])
-
-static void
-destroy_bits (pixman_image_t *image, void *data)
-{
-    fence_free (data);
-}
-
-static pixman_fixed_t
-random_fixed (int n)
-{
-    return lcg_rand_N (n << 16);
-}
-
-/*
- * Composite operation with pseudorandom images
- */
-uint32_t
-test_composite (int      testnum,
-		int      verbose)
-{
-    int                i;
-    pixman_image_t *   src_img;
-    pixman_image_t *   dst_img;
-    pixman_region16_t  clip;
-    int                dst_width, dst_height;
-    int                dst_stride;
-    int                dst_x, dst_y;
-    int                dst_bpp;
-    pixman_op_t        op;
-    uint32_t *         dst_bits;
-    uint32_t           crc32;
-    pixman_format_code_t mask_format, dst_format;
-    pixman_trapezoid_t *traps;
-    int src_x, src_y;
-    int n_traps;
-
-    static pixman_color_t colors[] =
-    {
-	{ 0xffff, 0xffff, 0xffff, 0xffff },
-	{ 0x0000, 0x0000, 0x0000, 0x0000 },
-	{ 0xabcd, 0xabcd, 0x0000, 0xabcd },
-	{ 0x0000, 0x0000, 0x0000, 0xffff },
-	{ 0x0101, 0x0101, 0x0101, 0x0101 },
-	{ 0x7777, 0x6666, 0x5555, 0x9999 },
-    };
-    
-    FLOAT_REGS_CORRUPTION_DETECTOR_START ();
-
-    lcg_srand (testnum);
-
-    op = RANDOM_ELT (operators);
-    mask_format = RANDOM_ELT (mask_formats);
-
-    /* Create source image */
-    
-    if (lcg_rand_n (4) == 0)
-    {
-	src_img = pixman_image_create_solid_fill (
-	    &(colors[lcg_rand_n (ARRAY_LENGTH (colors))]));
-
-	src_x = 10;
-	src_y = 234;
-    }
-    else
-    {
-	pixman_format_code_t src_format = RANDOM_ELT(formats);
-	int src_bpp = (PIXMAN_FORMAT_BPP (src_format) + 7) / 8;
-	int src_width = lcg_rand_n (MAX_SRC_WIDTH) + 1;
-	int src_height = lcg_rand_n (MAX_SRC_HEIGHT) + 1;
-	int src_stride = src_width * src_bpp + lcg_rand_n (MAX_STRIDE) * src_bpp;
-	uint32_t *bits;
-
-	src_x = -(src_width / 4) + lcg_rand_n (src_width * 3 / 2);
-	src_y = -(src_height / 4) + lcg_rand_n (src_height * 3 / 2);
-
-	src_stride = (src_stride + 3) & ~3;
-	
-	bits = (uint32_t *)make_random_bytes (src_stride * src_height);
-
-	src_img = pixman_image_create_bits (
-	    src_format, src_width, src_height, bits, src_stride);
-
-	pixman_image_set_destroy_function (src_img, destroy_bits, bits);
-
-	if (lcg_rand_n (8) == 0)
-	{
-	    pixman_box16_t clip_boxes[2];
-	    int            n = lcg_rand_n (2) + 1;
-	    
-	    for (i = 0; i < n; i++)
-	    {
-		clip_boxes[i].x1 = lcg_rand_n (src_width);
-		clip_boxes[i].y1 = lcg_rand_n (src_height);
-		clip_boxes[i].x2 =
-		    clip_boxes[i].x1 + lcg_rand_n (src_width - clip_boxes[i].x1);
-		clip_boxes[i].y2 =
-		    clip_boxes[i].y1 + lcg_rand_n (src_height - clip_boxes[i].y1);
-		
-		if (verbose)
-		{
-		    printf ("source clip box: [%d,%d-%d,%d]\n",
-			    clip_boxes[i].x1, clip_boxes[i].y1,
-			    clip_boxes[i].x2, clip_boxes[i].y2);
-		}
-	    }
-	    
-	    pixman_region_init_rects (&clip, clip_boxes, n);
-	    pixman_image_set_clip_region (src_img, &clip);
-	    pixman_image_set_source_clipping (src_img, 1);
-	    pixman_region_fini (&clip);
-	}
-
-	image_endian_swap (src_img);
-    }
-
-    /* Create destination image */
-    {
-	dst_format = RANDOM_ELT(formats);
-	dst_bpp = (PIXMAN_FORMAT_BPP (dst_format) + 7) / 8;
-	dst_width = lcg_rand_n (MAX_DST_WIDTH) + 1;
-	dst_height = lcg_rand_n (MAX_DST_HEIGHT) + 1;
-	dst_stride = dst_width * dst_bpp + lcg_rand_n (MAX_STRIDE) * dst_bpp;
-	dst_stride = (dst_stride + 3) & ~3;
-	
-	dst_bits = (uint32_t *)make_random_bytes (dst_stride * dst_height);
-
-	dst_x = -(dst_width / 4) + lcg_rand_n (dst_width * 3 / 2);
-	dst_y = -(dst_height / 4) + lcg_rand_n (dst_height * 3 / 2);
-	
-	dst_img = pixman_image_create_bits (
-	    dst_format, dst_width, dst_height, dst_bits, dst_stride);
-
-	image_endian_swap (dst_img);
-    }
-
-    /* Create traps */
-    {
-	int i;
-
-	n_traps = lcg_rand_n (25);
-	traps = fence_malloc (n_traps * sizeof (pixman_trapezoid_t));
-
-	for (i = 0; i < n_traps; ++i)
-	{
-	    pixman_trapezoid_t *t = &(traps[i]);
-	    
-	    t->top = random_fixed (MAX_DST_HEIGHT) - MAX_DST_HEIGHT / 2;
-	    t->bottom = t->top + random_fixed (MAX_DST_HEIGHT);
-	    t->left.p1.x = random_fixed (MAX_DST_WIDTH) - MAX_DST_WIDTH / 2;
-	    t->left.p1.y = t->top - random_fixed (50);
-	    t->left.p2.x = random_fixed (MAX_DST_WIDTH) - MAX_DST_WIDTH / 2;
-	    t->left.p2.y = t->bottom + random_fixed (50);
-	    t->right.p1.x = t->left.p1.x + random_fixed (MAX_DST_WIDTH);
-	    t->right.p1.y = t->top - random_fixed (50);
-	    t->right.p2.x = t->left.p2.x + random_fixed (MAX_DST_WIDTH);
-	    t->right.p2.y = t->bottom - random_fixed (50);
-	}
-    }
-    
-    if (lcg_rand_n (8) == 0)
-    {
-	pixman_box16_t clip_boxes[2];
-	int            n = lcg_rand_n (2) + 1;
-	for (i = 0; i < n; i++)
-	{
-	    clip_boxes[i].x1 = lcg_rand_n (dst_width);
-	    clip_boxes[i].y1 = lcg_rand_n (dst_height);
-	    clip_boxes[i].x2 =
-		clip_boxes[i].x1 + lcg_rand_n (dst_width - clip_boxes[i].x1);
-	    clip_boxes[i].y2 =
-		clip_boxes[i].y1 + lcg_rand_n (dst_height - clip_boxes[i].y1);
-
-	    if (verbose)
-	    {
-		printf ("destination clip box: [%d,%d-%d,%d]\n",
-		        clip_boxes[i].x1, clip_boxes[i].y1,
-		        clip_boxes[i].x2, clip_boxes[i].y2);
-	    }
-	}
-	pixman_region_init_rects (&clip, clip_boxes, n);
-	pixman_image_set_clip_region (dst_img, &clip);
-	pixman_region_fini (&clip);
-    }
-
-    pixman_composite_trapezoids (op, src_img, dst_img, mask_format,
-				 src_x, src_y, dst_x, dst_y, n_traps, traps);
-
-    if (dst_format == PIXMAN_x8r8g8b8)
-    {
-	/* ignore unused part */
-	for (i = 0; i < dst_stride * dst_height / 4; i++)
-	    dst_bits[i] &= 0xFFFFFF;
-    }
-
-    image_endian_swap (dst_img);
-
-    if (verbose)
-    {
-	int j;
-	
-	for (i = 0; i < dst_height; i++)
-	{
-	    for (j = 0; j < dst_stride; j++)
-		printf ("%02X ", *((uint8_t *)dst_bits + i * dst_stride + j));
-
-	    printf ("\n");
-	}
-    }
-
-    crc32 = compute_crc32 (0, dst_bits, dst_stride * dst_height);
-
-    fence_free (dst_bits);
-    
-    pixman_image_unref (src_img);
-    pixman_image_unref (dst_img);
-    fence_free (traps);
-
-    FLOAT_REGS_CORRUPTION_DETECTOR_FINISH ();
-    return crc32;
-}
-
-int
-main (int argc, const char *argv[])
-{
-    return fuzzer_test_main("composite traps", 40000, 0xA34F95C7,
-			    test_composite, argc, argv);
-}
+/* Based loosely on scaling-test */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "utils.h"
+
+#define MAX_SRC_WIDTH  48
+#define MAX_SRC_HEIGHT 48
+#define MAX_DST_WIDTH  48
+#define MAX_DST_HEIGHT 48
+#define MAX_STRIDE     4
+
+static pixman_format_code_t formats[] =
+{
+    PIXMAN_a8r8g8b8, PIXMAN_a8, PIXMAN_r5g6b5, PIXMAN_a1, PIXMAN_a4
+};
+
+static pixman_format_code_t mask_formats[] =
+{
+    PIXMAN_a1, PIXMAN_a4, PIXMAN_a8,
+};
+
+static pixman_op_t operators[] =
+{
+    PIXMAN_OP_OVER, PIXMAN_OP_ADD, PIXMAN_OP_SRC, PIXMAN_OP_IN
+};
+
+#define RANDOM_ELT(array)						\
+    ((array)[lcg_rand_n(ARRAY_LENGTH((array)))])
+
+static void
+destroy_bits (pixman_image_t *image, void *data)
+{
+    fence_free (data);
+}
+
+static pixman_fixed_t
+random_fixed (int n)
+{
+    return lcg_rand_N (n << 16);
+}
+
+/*
+ * Composite operation with pseudorandom images
+ */
+uint32_t
+test_composite (int      testnum,
+		int      verbose)
+{
+    int                i;
+    pixman_image_t *   src_img;
+    pixman_image_t *   dst_img;
+    pixman_region16_t  clip;
+    int                dst_width, dst_height;
+    int                dst_stride;
+    int                dst_x, dst_y;
+    int                dst_bpp;
+    pixman_op_t        op;
+    uint32_t *         dst_bits;
+    uint32_t           crc32;
+    pixman_format_code_t mask_format, dst_format;
+    pixman_trapezoid_t *traps;
+    int src_x, src_y;
+    int n_traps;
+
+    static pixman_color_t colors[] =
+    {
+	{ 0xffff, 0xffff, 0xffff, 0xffff },
+	{ 0x0000, 0x0000, 0x0000, 0x0000 },
+	{ 0xabcd, 0xabcd, 0x0000, 0xabcd },
+	{ 0x0000, 0x0000, 0x0000, 0xffff },
+	{ 0x0101, 0x0101, 0x0101, 0x0101 },
+	{ 0x7777, 0x6666, 0x5555, 0x9999 },
+    };
+    
+    FLOAT_REGS_CORRUPTION_DETECTOR_START ();
+
+    lcg_srand (testnum);
+
+    op = RANDOM_ELT (operators);
+    mask_format = RANDOM_ELT (mask_formats);
+
+    /* Create source image */
+    
+    if (lcg_rand_n (4) == 0)
+    {
+	src_img = pixman_image_create_solid_fill (
+	    &(colors[lcg_rand_n (ARRAY_LENGTH (colors))]));
+
+	src_x = 10;
+	src_y = 234;
+    }
+    else
+    {
+	pixman_format_code_t src_format = RANDOM_ELT(formats);
+	int src_bpp = (PIXMAN_FORMAT_BPP (src_format) + 7) / 8;
+	int src_width = lcg_rand_n (MAX_SRC_WIDTH) + 1;
+	int src_height = lcg_rand_n (MAX_SRC_HEIGHT) + 1;
+	int src_stride = src_width * src_bpp + lcg_rand_n (MAX_STRIDE) * src_bpp;
+	uint32_t *bits;
+
+	src_x = -(src_width / 4) + lcg_rand_n (src_width * 3 / 2);
+	src_y = -(src_height / 4) + lcg_rand_n (src_height * 3 / 2);
+
+	src_stride = (src_stride + 3) & ~3;
+	
+	bits = (uint32_t *)make_random_bytes (src_stride * src_height);
+
+	src_img = pixman_image_create_bits (
+	    src_format, src_width, src_height, bits, src_stride);
+
+	pixman_image_set_destroy_function (src_img, destroy_bits, bits);
+
+	if (lcg_rand_n (8) == 0)
+	{
+	    pixman_box16_t clip_boxes[2];
+	    int            n = lcg_rand_n (2) + 1;
+	    
+	    for (i = 0; i < n; i++)
+	    {
+		clip_boxes[i].x1 = lcg_rand_n (src_width);
+		clip_boxes[i].y1 = lcg_rand_n (src_height);
+		clip_boxes[i].x2 =
+		    clip_boxes[i].x1 + lcg_rand_n (src_width - clip_boxes[i].x1);
+		clip_boxes[i].y2 =
+		    clip_boxes[i].y1 + lcg_rand_n (src_height - clip_boxes[i].y1);
+		
+		if (verbose)
+		{
+		    printf ("source clip box: [%d,%d-%d,%d]\n",
+			    clip_boxes[i].x1, clip_boxes[i].y1,
+			    clip_boxes[i].x2, clip_boxes[i].y2);
+		}
+	    }
+	    
+	    pixman_region_init_rects (&clip, clip_boxes, n);
+	    pixman_image_set_clip_region (src_img, &clip);
+	    pixman_image_set_source_clipping (src_img, 1);
+	    pixman_region_fini (&clip);
+	}
+
+	image_endian_swap (src_img);
+    }
+
+    /* Create destination image */
+    {
+	dst_format = RANDOM_ELT(formats);
+	dst_bpp = (PIXMAN_FORMAT_BPP (dst_format) + 7) / 8;
+	dst_width = lcg_rand_n (MAX_DST_WIDTH) + 1;
+	dst_height = lcg_rand_n (MAX_DST_HEIGHT) + 1;
+	dst_stride = dst_width * dst_bpp + lcg_rand_n (MAX_STRIDE) * dst_bpp;
+	dst_stride = (dst_stride + 3) & ~3;
+	
+	dst_bits = (uint32_t *)make_random_bytes (dst_stride * dst_height);
+
+	dst_x = -(dst_width / 4) + lcg_rand_n (dst_width * 3 / 2);
+	dst_y = -(dst_height / 4) + lcg_rand_n (dst_height * 3 / 2);
+	
+	dst_img = pixman_image_create_bits (
+	    dst_format, dst_width, dst_height, dst_bits, dst_stride);
+
+	image_endian_swap (dst_img);
+    }
+
+    /* Create traps */
+    {
+	int i;
+
+	n_traps = lcg_rand_n (25);
+	traps = fence_malloc (n_traps * sizeof (pixman_trapezoid_t));
+
+	for (i = 0; i < n_traps; ++i)
+	{
+	    pixman_trapezoid_t *t = &(traps[i]);
+	    
+	    t->top = random_fixed (MAX_DST_HEIGHT) - MAX_DST_HEIGHT / 2;
+	    t->bottom = t->top + random_fixed (MAX_DST_HEIGHT);
+	    t->left.p1.x = random_fixed (MAX_DST_WIDTH) - MAX_DST_WIDTH / 2;
+	    t->left.p1.y = t->top - random_fixed (50);
+	    t->left.p2.x = random_fixed (MAX_DST_WIDTH) - MAX_DST_WIDTH / 2;
+	    t->left.p2.y = t->bottom + random_fixed (50);
+	    t->right.p1.x = t->left.p1.x + random_fixed (MAX_DST_WIDTH);
+	    t->right.p1.y = t->top - random_fixed (50);
+	    t->right.p2.x = t->left.p2.x + random_fixed (MAX_DST_WIDTH);
+	    t->right.p2.y = t->bottom - random_fixed (50);
+	}
+    }
+    
+    if (lcg_rand_n (8) == 0)
+    {
+	pixman_box16_t clip_boxes[2];
+	int            n = lcg_rand_n (2) + 1;
+	for (i = 0; i < n; i++)
+	{
+	    clip_boxes[i].x1 = lcg_rand_n (dst_width);
+	    clip_boxes[i].y1 = lcg_rand_n (dst_height);
+	    clip_boxes[i].x2 =
+		clip_boxes[i].x1 + lcg_rand_n (dst_width - clip_boxes[i].x1);
+	    clip_boxes[i].y2 =
+		clip_boxes[i].y1 + lcg_rand_n (dst_height - clip_boxes[i].y1);
+
+	    if (verbose)
+	    {
+		printf ("destination clip box: [%d,%d-%d,%d]\n",
+		        clip_boxes[i].x1, clip_boxes[i].y1,
+		        clip_boxes[i].x2, clip_boxes[i].y2);
+	    }
+	}
+	pixman_region_init_rects (&clip, clip_boxes, n);
+	pixman_image_set_clip_region (dst_img, &clip);
+	pixman_region_fini (&clip);
+    }
+
+    pixman_composite_trapezoids (op, src_img, dst_img, mask_format,
+				 src_x, src_y, dst_x, dst_y, n_traps, traps);
+
+    if (dst_format == PIXMAN_x8r8g8b8)
+    {
+	/* ignore unused part */
+	for (i = 0; i < dst_stride * dst_height / 4; i++)
+	    dst_bits[i] &= 0xFFFFFF;
+    }
+
+    image_endian_swap (dst_img);
+
+    if (verbose)
+    {
+	int j;
+	
+	for (i = 0; i < dst_height; i++)
+	{
+	    for (j = 0; j < dst_stride; j++)
+		printf ("%02X ", *((uint8_t *)dst_bits + i * dst_stride + j));
+
+	    printf ("\n");
+	}
+    }
+
+    crc32 = compute_crc32 (0, dst_bits, dst_stride * dst_height);
+
+    fence_free (dst_bits);
+    
+    pixman_image_unref (src_img);
+    pixman_image_unref (dst_img);
+    fence_free (traps);
+
+    FLOAT_REGS_CORRUPTION_DETECTOR_FINISH ();
+    return crc32;
+}
+
+int
+main (int argc, const char *argv[])
+{
+    return fuzzer_test_main("composite traps", 40000, 0xE3112106,
+			    test_composite, argc, argv);
+}
diff --git a/xorg-server/Xext/xtest.c b/xorg-server/Xext/xtest.c
index 6780aa62a..18e1ef7ae 100644
--- a/xorg-server/Xext/xtest.c
+++ b/xorg-server/Xext/xtest.c
@@ -423,7 +423,7 @@ ProcXTestFakeInput(ClientPtr client)
             break;
         case KeyPress:
         case KeyRelease:
-            nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail);
+            nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
             break;
     }
 
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 18803c95e..76d5c3759 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -535,6 +535,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     if (from->valuator)
     {
         ValuatorClassPtr v;
+
         if (!to->valuator)
         {
             classes = to->unused_classes;
@@ -543,18 +544,14 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
                 classes->valuator = NULL;
         }
 
-        to->valuator = realloc(to->valuator, sizeof(ValuatorClassRec) +
-                from->valuator->numAxes * sizeof(AxisInfo) +
-                from->valuator->numAxes * sizeof(double));
-        v = to->valuator;
+        v = AllocValuatorClass(to->valuator, from->valuator->numAxes);
+
         if (!v)
             FatalError("[Xi] no memory for class shift.\n");
 
-        v->numAxes = from->valuator->numAxes;
-        v->axes = (AxisInfoPtr)&v[1];
+        to->valuator = v;
         memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo));
 
-        v->axisVal = (double*)(v->axes + from->valuator->numAxes);
         v->sourceid = from->id;
     } else if (to->valuator && !from->valuator)
     {
diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c
index 0b7280d95..51e00783c 100644
--- a/xorg-server/Xi/extinit.c
+++ b/xorg-server/Xi/extinit.c
@@ -511,7 +511,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
         SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
     else if (rep->RepType == X_XIGrabDevice)
 	SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
-    else if (rep->RepType == X_XIGrabDevice)
+    else if (rep->RepType == X_XIPassiveGrabDevice)
 	SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
     else if (rep->RepType == X_XIListProperties)
 	SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
diff --git a/xorg-server/Xi/xichangehierarchy.c b/xorg-server/Xi/xichangehierarchy.c
index a3dcab57e..0736a5a36 100644
--- a/xorg-server/Xi/xichangehierarchy.c
+++ b/xorg-server/Xi/xichangehierarchy.c
@@ -116,7 +116,9 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
 
     ev->length = bytes_to_int32(ev->num_info * sizeof(xXIHierarchyInfo));
 
+    memset(&dummyDev, 0, sizeof(dummyDev));
     dummyDev.id = XIAllDevices;
+    dummyDev.type = SLAVE;
     SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
     free(ev);
 }
diff --git a/xorg-server/Xi/xipassivegrab.c b/xorg-server/Xi/xipassivegrab.c
index 487c2721b..ae4343344 100644
--- a/xorg-server/Xi/xipassivegrab.c
+++ b/xorg-server/Xi/xipassivegrab.c
@@ -1,307 +1,315 @@
-/*
- * Copyright © 2009 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.
- *
- * Author: Peter Hutterer
- */
-
-/***********************************************************************
- *
- * Request to grab or ungrab input device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h"	/* DeviceIntPtr      */
-#include "windowstr.h"	/* window structure  */
-#include <X11/extensions/XI2.h>
-#include <X11/extensions/XI2proto.h>
-#include "swaprep.h"
-
-#include "exglobals.h" /* BadDevice */
-#include "exevents.h"
-#include "xipassivegrab.h"
-#include "dixgrabs.h"
-
-int
-SProcXIPassiveGrabDevice(ClientPtr client)
-{
-    int i;
-    char n;
-    xXIModifierInfo *mods;
-
-    REQUEST(xXIPassiveGrabDeviceReq);
-
-    swaps(&stuff->length, n);
-    swaps(&stuff->deviceid, n);
-    swapl(&stuff->grab_window, n);
-    swapl(&stuff->cursor, n);
-    swapl(&stuff->time, n);
-    swapl(&stuff->detail, n);
-    swaps(&stuff->mask_len, n);
-    swaps(&stuff->num_modifiers, n);
-
-    mods = (xXIModifierInfo*)&stuff[1];
-
-    for (i = 0; i < stuff->num_modifiers; i++, mods++)
-    {
-        swapl(&mods->base_mods, n);
-        swapl(&mods->latched_mods, n);
-        swapl(&mods->locked_mods, n);
-    }
-
-    return ProcXIPassiveGrabDevice(client);
-}
-
-int
-ProcXIPassiveGrabDevice(ClientPtr client)
-{
-    DeviceIntPtr dev, mod_dev;
-    xXIPassiveGrabDeviceReply rep;
-    int i, ret = Success;
-    uint8_t status;
-    uint32_t *modifiers;
-    xXIGrabModifierInfo *modifiers_failed;
-    GrabMask mask;
-    GrabParameters param;
-    void *tmp;
-    int mask_len;
-
-    REQUEST(xXIPassiveGrabDeviceReq);
-    REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
-
-    if (stuff->deviceid == XIAllDevices)
-        dev = inputInfo.all_devices;
-    else if (stuff->deviceid == XIAllMasterDevices)
-        dev = inputInfo.all_master_devices;
-    else
-    {
-        ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
-        if (ret != Success)
-            return ret;
-    }
-
-    if (stuff->grab_type != XIGrabtypeButton &&
-        stuff->grab_type != XIGrabtypeKeycode &&
-        stuff->grab_type != XIGrabtypeEnter &&
-        stuff->grab_type != XIGrabtypeFocusIn)
-    {
-        client->errorValue = stuff->grab_type;
-        return BadValue;
-    }
-
-    if ((stuff->grab_type == XIGrabtypeEnter ||
-         stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
-    {
-        client->errorValue = stuff->detail;
-        return BadValue;
-    }
-
-    if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
-                               stuff->mask_len * 4) != Success)
-        return BadValue;
-
-    mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4);
-    memset(mask.xi2mask, 0, sizeof(mask.xi2mask));
-    memcpy(mask.xi2mask[stuff->deviceid], &stuff[1], mask_len * 4);
-
-    rep.repType = X_Reply;
-    rep.RepType = X_XIPassiveGrabDevice;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.num_modifiers = 0;
-
-    memset(&param, 0, sizeof(param));
-    param.grabtype = GRABTYPE_XI2;
-    param.ownerEvents = stuff->owner_events;
-    param.this_device_mode = stuff->grab_mode;
-    param.other_devices_mode = stuff->paired_device_mode;
-    param.grabWindow = stuff->grab_window;
-    param.cursor = stuff->cursor;
-
-    if (stuff->cursor != None)
-    {
-        status = dixLookupResourceByType(&tmp, stuff->cursor,
-                                         RT_CURSOR, client, DixUseAccess);
-	if (status != Success)
-	{
-	    client->errorValue = stuff->cursor;
-	    return status;
-	}
-    }
-
-    status = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
-    if (status != Success)
-	return status;
-
-    status = CheckGrabValues(client, &param);
-
-    modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
-    modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
-    if (!modifiers_failed)
-        return BadAlloc;
-
-    mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
-
-    for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
-    {
-        param.modifiers = *modifiers;
-        switch(stuff->grab_type)
-        {
-            case XIGrabtypeButton:
-                status = GrabButton(client, dev, mod_dev, stuff->detail,
-                                    &param, GRABTYPE_XI2, &mask);
-                break;
-            case XIGrabtypeKeycode:
-                status = GrabKey(client, dev, mod_dev, stuff->detail,
-                                 &param, GRABTYPE_XI2, &mask);
-                break;
-            case XIGrabtypeEnter:
-            case XIGrabtypeFocusIn:
-                status = GrabWindow(client, dev, stuff->grab_type,
-                                    &param, &mask);
-                break;
-        }
-
-        if (status != GrabSuccess)
-        {
-            xXIGrabModifierInfo *info = modifiers_failed + rep.num_modifiers;
-
-            info->status = status;
-            info->modifiers = *modifiers;
-            rep.num_modifiers++;
-            rep.length += bytes_to_int32(sizeof(xXIGrabModifierInfo));
-        }
-    }
-
-    WriteReplyToClient(client, sizeof(rep), &rep);
-    if (rep.num_modifiers)
-    {
-	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
-        WriteSwappedDataToClient(client, rep.length * 4, (char*)modifiers_failed);
-    }
-    free(modifiers_failed);
-    return ret;
-}
-
-void
-SRepXIPassiveGrabDevice(ClientPtr client, int size,
-                        xXIPassiveGrabDeviceReply * rep)
-{
-    char n;
-
-    swaps(&rep->sequenceNumber, n);
-    swapl(&rep->length, n);
-    swaps(&rep->num_modifiers, n);
-
-    WriteToClient(client, size, (char *)rep);
-}
-
-int
-SProcXIPassiveUngrabDevice(ClientPtr client)
-{
-    char n;
-    int i;
-    uint32_t *modifiers;
-
-    REQUEST(xXIPassiveUngrabDeviceReq);
-
-    swaps(&stuff->length, n);
-    swapl(&stuff->grab_window, n);
-    swaps(&stuff->deviceid, n);
-    swapl(&stuff->detail, n);
-    swaps(&stuff->num_modifiers, n);
-
-    modifiers = (uint32_t*)&stuff[1];
-
-    for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
-        swapl(modifiers, n);
-
-    return ProcXIPassiveUngrabDevice(client);
-}
-
-int
-ProcXIPassiveUngrabDevice(ClientPtr client)
-{
-    DeviceIntPtr dev, mod_dev;
-    WindowPtr win;
-    GrabRec tempGrab;
-    uint32_t* modifiers;
-    int i, rc;
-
-    REQUEST(xXIPassiveUngrabDeviceReq);
-    REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
-
-    rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
-    if (rc != Success)
-	return rc;
-
-    if (stuff->grab_type != XIGrabtypeButton &&
-        stuff->grab_type != XIGrabtypeKeycode &&
-        stuff->grab_type != XIGrabtypeEnter &&
-        stuff->grab_type != XIGrabtypeFocusIn)
-    {
-        client->errorValue = stuff->grab_type;
-        return BadValue;
-    }
-
-    if ((stuff->grab_type == XIGrabtypeEnter ||
-         stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
-    {
-        client->errorValue = stuff->detail;
-        return BadValue;
-    }
-
-    rc = dixLookupWindow(&win, stuff->grab_window, client, DixSetAttrAccess);
-    if (rc != Success)
-        return rc;
-
-    mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
-
-    tempGrab.resource = client->clientAsMask;
-    tempGrab.device = dev;
-    tempGrab.window = win;
-    switch(stuff->grab_type)
-    {
-        case XIGrabtypeButton:  tempGrab.type = XI_ButtonPress; break;
-        case XIGrabtypeKeycode:  tempGrab.type = XI_KeyPress;    break;
-        case XIGrabtypeEnter:   tempGrab.type = XI_Enter;       break;
-        case XIGrabtypeFocusIn: tempGrab.type = XI_FocusIn;     break;
-    }
-    tempGrab.grabtype = GRABTYPE_XI2;
-    tempGrab.modifierDevice = mod_dev;
-    tempGrab.modifiersDetail.pMask = NULL;
-    tempGrab.detail.exact = stuff->detail;
-    tempGrab.detail.pMask = NULL;
-
-    modifiers = (uint32_t*)&stuff[1];
-
-    for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
-    {
-        tempGrab.modifiersDetail.exact = *modifiers;
-        DeletePassiveGrabFromList(&tempGrab);
-    }
-
-    return Success;
-}
+/*
+ * Copyright © 2009 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.
+ *
+ * Author: Peter Hutterer
+ */
+
+/***********************************************************************
+ *
+ * Request to grab or ungrab input device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h"	/* DeviceIntPtr      */
+#include "windowstr.h"	/* window structure  */
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/XI2proto.h>
+#include "swaprep.h"
+
+#include "exglobals.h" /* BadDevice */
+#include "exevents.h"
+#include "xipassivegrab.h"
+#include "dixgrabs.h"
+#include "misc.h"
+
+int
+SProcXIPassiveGrabDevice(ClientPtr client)
+{
+    int i;
+    char n;
+    xXIModifierInfo *mods;
+
+    REQUEST(xXIPassiveGrabDeviceReq);
+
+    swaps(&stuff->length, n);
+    swaps(&stuff->deviceid, n);
+    swapl(&stuff->grab_window, n);
+    swapl(&stuff->cursor, n);
+    swapl(&stuff->time, n);
+    swapl(&stuff->detail, n);
+    swaps(&stuff->mask_len, n);
+    swaps(&stuff->num_modifiers, n);
+
+    mods = (xXIModifierInfo*)&stuff[1];
+
+    for (i = 0; i < stuff->num_modifiers; i++, mods++)
+    {
+        swapl(&mods->base_mods, n);
+        swapl(&mods->latched_mods, n);
+        swapl(&mods->locked_mods, n);
+    }
+
+    return ProcXIPassiveGrabDevice(client);
+}
+
+int
+ProcXIPassiveGrabDevice(ClientPtr client)
+{
+    DeviceIntPtr dev, mod_dev;
+    xXIPassiveGrabDeviceReply rep;
+    int i, ret = Success;
+    uint8_t status;
+    uint32_t *modifiers;
+    xXIGrabModifierInfo *modifiers_failed;
+    GrabMask mask;
+    GrabParameters param;
+    void *tmp;
+    int mask_len;
+    int n;
+
+    REQUEST(xXIPassiveGrabDeviceReq);
+    REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
+
+    if (stuff->deviceid == XIAllDevices)
+        dev = inputInfo.all_devices;
+    else if (stuff->deviceid == XIAllMasterDevices)
+        dev = inputInfo.all_master_devices;
+    else
+    {
+        ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
+        if (ret != Success)
+        {
+            client->errorValue = stuff->deviceid;
+            return ret;
+        }
+    }
+
+    if (stuff->grab_type != XIGrabtypeButton &&
+        stuff->grab_type != XIGrabtypeKeycode &&
+        stuff->grab_type != XIGrabtypeEnter &&
+        stuff->grab_type != XIGrabtypeFocusIn)
+    {
+        client->errorValue = stuff->grab_type;
+        return BadValue;
+    }
+
+    if ((stuff->grab_type == XIGrabtypeEnter ||
+         stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
+    {
+        client->errorValue = stuff->detail;
+        return BadValue;
+    }
+
+    if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
+                               stuff->mask_len * 4) != Success)
+        return BadValue;
+
+    mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4);
+    memset(mask.xi2mask, 0, sizeof(mask.xi2mask));
+    memcpy(mask.xi2mask[stuff->deviceid], &stuff[1], mask_len * 4);
+
+    rep.repType = X_Reply;
+    rep.RepType = X_XIPassiveGrabDevice;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.num_modifiers = 0;
+
+    memset(&param, 0, sizeof(param));
+    param.grabtype = GRABTYPE_XI2;
+    param.ownerEvents = stuff->owner_events;
+    param.this_device_mode = stuff->grab_mode;
+    param.other_devices_mode = stuff->paired_device_mode;
+    param.grabWindow = stuff->grab_window;
+    param.cursor = stuff->cursor;
+
+    if (stuff->cursor != None)
+    {
+        status = dixLookupResourceByType(&tmp, stuff->cursor,
+                                         RT_CURSOR, client, DixUseAccess);
+	if (status != Success)
+	{
+	    client->errorValue = stuff->cursor;
+	    return status;
+	}
+    }
+
+    status = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
+    if (status != Success)
+	return status;
+
+    status = CheckGrabValues(client, &param);
+    if (status != Success)
+        return status;
+
+    modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
+    modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
+    if (!modifiers_failed)
+        return BadAlloc;
+
+    mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
+
+    for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
+    {
+        param.modifiers = *modifiers;
+        switch(stuff->grab_type)
+        {
+            case XIGrabtypeButton:
+                status = GrabButton(client, dev, mod_dev, stuff->detail,
+                                    &param, GRABTYPE_XI2, &mask);
+                break;
+            case XIGrabtypeKeycode:
+                status = GrabKey(client, dev, mod_dev, stuff->detail,
+                                 &param, GRABTYPE_XI2, &mask);
+                break;
+            case XIGrabtypeEnter:
+            case XIGrabtypeFocusIn:
+                status = GrabWindow(client, dev, stuff->grab_type,
+                                    &param, &mask);
+                break;
+        }
+
+        if (status != GrabSuccess)
+        {
+            xXIGrabModifierInfo *info = modifiers_failed + rep.num_modifiers;
+
+            info->status = status;
+            info->modifiers = *modifiers;
+            if (client->swapped)
+                swapl(&info->modifiers, n);
+
+            rep.num_modifiers++;
+            rep.length += bytes_to_int32(sizeof(xXIGrabModifierInfo));
+        }
+    }
+
+    WriteReplyToClient(client, sizeof(rep), &rep);
+    if (rep.num_modifiers)
+        WriteToClient(client, rep.length * 4, (char*)modifiers_failed);
+
+    free(modifiers_failed);
+    return ret;
+}
+
+void
+SRepXIPassiveGrabDevice(ClientPtr client, int size,
+                        xXIPassiveGrabDeviceReply * rep)
+{
+    char n;
+
+    swaps(&rep->sequenceNumber, n);
+    swapl(&rep->length, n);
+    swaps(&rep->num_modifiers, n);
+
+    WriteToClient(client, size, (char *)rep);
+}
+
+int
+SProcXIPassiveUngrabDevice(ClientPtr client)
+{
+    char n;
+    int i;
+    uint32_t *modifiers;
+
+    REQUEST(xXIPassiveUngrabDeviceReq);
+
+    swaps(&stuff->length, n);
+    swapl(&stuff->grab_window, n);
+    swaps(&stuff->deviceid, n);
+    swapl(&stuff->detail, n);
+    swaps(&stuff->num_modifiers, n);
+
+    modifiers = (uint32_t*)&stuff[1];
+
+    for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
+        swapl(modifiers, n);
+
+    return ProcXIPassiveUngrabDevice(client);
+}
+
+int
+ProcXIPassiveUngrabDevice(ClientPtr client)
+{
+    DeviceIntPtr dev, mod_dev;
+    WindowPtr win;
+    GrabRec tempGrab;
+    uint32_t* modifiers;
+    int i, rc;
+
+    REQUEST(xXIPassiveUngrabDeviceReq);
+    REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
+
+    rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
+    if (rc != Success)
+	return rc;
+
+    if (stuff->grab_type != XIGrabtypeButton &&
+        stuff->grab_type != XIGrabtypeKeycode &&
+        stuff->grab_type != XIGrabtypeEnter &&
+        stuff->grab_type != XIGrabtypeFocusIn)
+    {
+        client->errorValue = stuff->grab_type;
+        return BadValue;
+    }
+
+    if ((stuff->grab_type == XIGrabtypeEnter ||
+         stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
+    {
+        client->errorValue = stuff->detail;
+        return BadValue;
+    }
+
+    rc = dixLookupWindow(&win, stuff->grab_window, client, DixSetAttrAccess);
+    if (rc != Success)
+        return rc;
+
+    mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
+
+    tempGrab.resource = client->clientAsMask;
+    tempGrab.device = dev;
+    tempGrab.window = win;
+    switch(stuff->grab_type)
+    {
+        case XIGrabtypeButton:  tempGrab.type = XI_ButtonPress; break;
+        case XIGrabtypeKeycode:  tempGrab.type = XI_KeyPress;    break;
+        case XIGrabtypeEnter:   tempGrab.type = XI_Enter;       break;
+        case XIGrabtypeFocusIn: tempGrab.type = XI_FocusIn;     break;
+    }
+    tempGrab.grabtype = GRABTYPE_XI2;
+    tempGrab.modifierDevice = mod_dev;
+    tempGrab.modifiersDetail.pMask = NULL;
+    tempGrab.detail.exact = stuff->detail;
+    tempGrab.detail.pMask = NULL;
+
+    modifiers = (uint32_t*)&stuff[1];
+
+    for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
+    {
+        tempGrab.modifiersDetail.exact = *modifiers;
+        DeletePassiveGrabFromList(&tempGrab);
+    }
+
+    return Success;
+}
diff --git a/xorg-server/composite/compalloc.c b/xorg-server/composite/compalloc.c
index 745166621..7164c0d3c 100644
--- a/xorg-server/composite/compalloc.c
+++ b/xorg-server/composite/compalloc.c
@@ -1,711 +1,685 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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.
- *
- * Copyright © 2003 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "compint.h"
-
-static void
-compScreenUpdate (ScreenPtr pScreen)
-{
-    compCheckTree (pScreen);
-    compPaintChildrenToWindow (pScreen->root);
-}
-
-static void
-compBlockHandler (int	    i,
-		  pointer   blockData,
-		  pointer   pTimeout,
-		  pointer   pReadmask)
-{
-    ScreenPtr	    pScreen = screenInfo.screens[i];
-    CompScreenPtr   cs = GetCompScreen (pScreen);
-
-    pScreen->BlockHandler = cs->BlockHandler;
-    compScreenUpdate (pScreen);
-    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
-
-    /* Next damage will restore the block handler */
-    cs->BlockHandler = NULL;
-}
-
-static void
-compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
-{
-    WindowPtr	    pWin = (WindowPtr) closure;
-    ScreenPtr	    pScreen = pWin->drawable.pScreen;
-    CompScreenPtr   cs = GetCompScreen (pScreen);
-    CompWindowPtr   cw = GetCompWindow (pWin);
-
-    if (!cs->BlockHandler) {
-        cs->BlockHandler = pScreen->BlockHandler;
-        pScreen->BlockHandler = compBlockHandler;
-    }
-    cw->damaged = TRUE;
-
-    /* Mark the ancestors */
-    pWin = pWin->parent;
-    while (pWin) {
-	if (pWin->damagedDescendants)
-	    break;
-	pWin->damagedDescendants = TRUE;
-	pWin = pWin->parent;
-    }
-}
-
-static void
-compDestroyDamage (DamagePtr pDamage, void *closure)
-{
-    WindowPtr	    pWin = (WindowPtr) closure;
-    CompWindowPtr   cw = GetCompWindow (pWin);
-
-    cw->damage = 0;
-}
-
-/*
- * Redirect one window for one client
- */
-int
-compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
-{
-    CompWindowPtr	cw = GetCompWindow (pWin);
-    CompClientWindowPtr	ccw;
-    Bool		wasMapped = pWin->mapped;
-    CompScreenPtr       cs = GetCompScreen(pWin->drawable.pScreen);
-    
-    if (pWin == cs->pOverlayWin) {
-	return Success;
-    }
-
-    if (!pWin->parent)
-	return BadMatch;
-
-    /*
-     * Only one Manual update is allowed
-     */
-    if (cw && update == CompositeRedirectManual)
-	for (ccw = cw->clients; ccw; ccw = ccw->next)
-	    if (ccw->update == CompositeRedirectManual)
-		return BadAccess;
-    
-    /*
-     * Allocate per-client per-window structure 
-     * The client *could* allocate multiple, but while supported,
-     * it is not expected to be common
-     */
-    ccw = malloc(sizeof (CompClientWindowRec));
-    if (!ccw)
-	return BadAlloc;
-    ccw->id = FakeClientID (pClient->index);
-    ccw->update = update;
-    /*
-     * Now make sure there's a per-window structure to hang this from
-     */
-    if (!cw)
-    {
-	cw = malloc(sizeof (CompWindowRec));
-	if (!cw)
-	{
-	    free(ccw);
-	    return BadAlloc;
-	}
-	cw->damage = DamageCreate (compReportDamage,
-				   compDestroyDamage,
-				   DamageReportNonEmpty,
-				   FALSE,
-				   pWin->drawable.pScreen,
-				   pWin);
-	if (!cw->damage)
-	{
-	    free(ccw);
-	    free(cw);
-	    return BadAlloc;
-	}
-	if (wasMapped)
-	{
-	    DisableMapUnmapEvents (pWin);
-	    UnmapWindow (pWin, FALSE);
-	    EnableMapUnmapEvents (pWin);
-	}
-
-	RegionNull(&cw->borderClip);
-	cw->borderClipX = 0;
-	cw->borderClipY = 0;
-	cw->update = CompositeRedirectAutomatic;
-	cw->clients = 0;
-	cw->oldx = COMP_ORIGIN_INVALID;
-	cw->oldy = COMP_ORIGIN_INVALID;
-	cw->damageRegistered = FALSE;
-	cw->damaged = FALSE;
-	cw->pOldPixmap = NullPixmap;
-	dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
-    }
-    ccw->next = cw->clients;
-    cw->clients = ccw;
-    if (!AddResource (ccw->id, CompositeClientWindowType, pWin))
-	return BadAlloc;
-    if (ccw->update == CompositeRedirectManual)
-    {
-	/* If the window was CompositeRedirectAutomatic, then
-	 * unmap the window so that the parent clip list will
-	 * be correctly recomputed.
-	 */
-	if (pWin->mapped) 
-	{
-	    DisableMapUnmapEvents (pWin);
-	    UnmapWindow (pWin, FALSE);
-	    EnableMapUnmapEvents (pWin);
-	}
-	if (cw->damageRegistered)
-	{
-	    DamageUnregister (&pWin->drawable, cw->damage);
-	    cw->damageRegistered = FALSE;
-	}
-	cw->update = CompositeRedirectManual;
-    }
-
-    if (!compCheckRedirect (pWin))
-    {
-	FreeResource (ccw->id, RT_NONE);
-	return BadAlloc;
-    }
-    if (wasMapped && !pWin->mapped)
-    {
-	Bool	overrideRedirect = pWin->overrideRedirect;
-	pWin->overrideRedirect = TRUE;
-	DisableMapUnmapEvents (pWin);
-	MapWindow (pWin, pClient);
-	EnableMapUnmapEvents (pWin);
-	pWin->overrideRedirect = overrideRedirect;
-    }
-    
-    return Success;
-}
-
-/*
- * Free one of the per-client per-window resources, clearing
- * redirect and the per-window pointer as appropriate
- */
-void
-compFreeClientWindow (WindowPtr pWin, XID id)
-{
-    CompWindowPtr	cw = GetCompWindow (pWin);
-    CompClientWindowPtr	ccw, *prev;
-    Bool		wasMapped = pWin->mapped;
-
-    if (!cw)
-	return;
-    for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next)
-    {
-	if (ccw->id == id)
-	{
-	    *prev = ccw->next;
-	    if (ccw->update == CompositeRedirectManual)
-		cw->update = CompositeRedirectAutomatic;
-	    free(ccw);
-	    break;
-	}
-    }
-    if (!cw->clients)
-    {
-	if (wasMapped)
-	{
-	    DisableMapUnmapEvents (pWin);
-	    UnmapWindow (pWin, FALSE);
-	    EnableMapUnmapEvents (pWin);
-	}
-    
-	if (pWin->redirectDraw != RedirectDrawNone)
-	    compFreePixmap (pWin);
-
-	if (cw->damage)
-	    DamageDestroy (cw->damage);
-	
-	RegionUninit(&cw->borderClip);
-    
-	dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
-	free(cw);
-    }
-    else if (cw->update == CompositeRedirectAutomatic &&
-	     !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
-    {
-	DamageRegister (&pWin->drawable, cw->damage);
-	cw->damageRegistered = TRUE;
-	pWin->redirectDraw = RedirectDrawAutomatic;
-	DamageDamageRegion(&pWin->drawable, &pWin->borderSize);
-    }
-    if (wasMapped && !pWin->mapped)
-    {
-	Bool	overrideRedirect = pWin->overrideRedirect;
-	pWin->overrideRedirect = TRUE;
-	DisableMapUnmapEvents (pWin);
-	MapWindow (pWin, clients[CLIENT_ID(id)]);
-	EnableMapUnmapEvents (pWin);
-	pWin->overrideRedirect = overrideRedirect;
-    }
-}
-
-/*
- * This is easy, just free the appropriate resource.
- */
-
-int
-compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
-{
-    CompWindowPtr	cw = GetCompWindow (pWin);
-    CompClientWindowPtr	ccw;
-
-    if (!cw)
-	return BadValue;
-
-    for (ccw = cw->clients; ccw; ccw = ccw->next)
-	if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
-	{
-	    FreeResource (ccw->id, RT_NONE);
-	    return Success;
-	}
-    return BadValue;
-}
-	
-/*
- * Redirect all subwindows for one client
- */
-
-int
-compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
-{
-    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
-    CompClientWindowPtr	ccw;
-    WindowPtr		pChild;
-
-    /*
-     * Only one Manual update is allowed
-     */
-    if (csw && update == CompositeRedirectManual)
-	for (ccw = csw->clients; ccw; ccw = ccw->next)
-	    if (ccw->update == CompositeRedirectManual)
-		return BadAccess;
-    /*
-     * Allocate per-client per-window structure 
-     * The client *could* allocate multiple, but while supported,
-     * it is not expected to be common
-     */
-    ccw = malloc(sizeof (CompClientWindowRec));
-    if (!ccw)
-	return BadAlloc;
-    ccw->id = FakeClientID (pClient->index);
-    ccw->update = update;
-    /*
-     * Now make sure there's a per-window structure to hang this from
-     */
-    if (!csw)
-    {
-	csw = malloc(sizeof (CompSubwindowsRec));
-	if (!csw)
-	{
-	    free(ccw);
-	    return BadAlloc;
-	}
-	csw->update = CompositeRedirectAutomatic;
-	csw->clients = 0;
-	dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
-    }
-    /*
-     * Redirect all existing windows
-     */
-    for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
-    {
-	int ret = compRedirectWindow (pClient, pChild, update);
-	if (ret != Success)
-	{
-	    for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
-		(void) compUnredirectWindow (pClient, pChild, update);
-	    if (!csw->clients)
-	    {
-		free(csw);
-		dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
-	    }
-	    free(ccw);
-	    return ret;
-	}
-    }
-    /*
-     * Hook into subwindows list
-     */
-    ccw->next = csw->clients;
-    csw->clients = ccw;
-    if (!AddResource (ccw->id, CompositeClientSubwindowsType, pWin))
-	return BadAlloc;
-    if (ccw->update == CompositeRedirectManual)
-    {
-	csw->update = CompositeRedirectManual;
-	/* 
-	 * tell damage extension that damage events for this client are
-	 * critical output
-	 */
-	DamageExtSetCritical (pClient, TRUE);
-    }
-    return Success;
-}
-
-/*
- * Free one of the per-client per-subwindows resources,
- * which frees one redirect per subwindow
- */
-void
-compFreeClientSubwindows (WindowPtr pWin, XID id)
-{
-    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
-    CompClientWindowPtr	ccw, *prev;
-    WindowPtr		pChild;
-
-    if (!csw)
-	return;
-    for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next)
-    {
-	if (ccw->id == id)
-	{
-	    ClientPtr	pClient = clients[CLIENT_ID(id)];
-	    
-	    *prev = ccw->next;
-	    if (ccw->update == CompositeRedirectManual)
-	    {
-		/* 
-		 * tell damage extension that damage events for this client are
-		 * critical output
-		 */
-		DamageExtSetCritical (pClient, FALSE);
-		csw->update = CompositeRedirectAutomatic;
-		if (pWin->mapped)
-		    (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, TRUE);
-	    }
-
-	    /*
-	     * Unredirect all existing subwindows
-	     */
-	    for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
-		(void) compUnredirectWindow (pClient, pChild, ccw->update);
-
-	    free(ccw);
-	    break;
-	}
-    }
-
-    /*
-     * Check if all of the per-client records are gone
-     */
-    if (!csw->clients)
-    {
-	dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
-	free(csw);
-    }
-}
-
-/*
- * This is easy, just free the appropriate resource.
- */
-
-int
-compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
-{
-    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
-    CompClientWindowPtr	ccw;
-    
-    if (!csw)
-	return BadValue;
-    for (ccw = csw->clients; ccw; ccw = ccw->next)
-	if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
-	{
-	    FreeResource (ccw->id, RT_NONE);
-	    return Success;
-	}
-    return BadValue;
-}
-
-/*
- * Add redirection information for one subwindow (during reparent)
- */
-
-int
-compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
-{
-    CompSubwindowsPtr	csw = GetCompSubwindows (pParent);
-    CompClientWindowPtr	ccw;
-
-    if (!csw)
-	return Success;
-    for (ccw = csw->clients; ccw; ccw = ccw->next)
-    {
-	int ret = compRedirectWindow (clients[CLIENT_ID(ccw->id)],
-				      pWin, ccw->update);
-	if (ret != Success)
-	    return ret;
-    }
-    return Success;
-}
-
-/*
- * Remove redirection information for one subwindow (during reparent)
- */
-
-int
-compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
-{
-    CompSubwindowsPtr	csw = GetCompSubwindows (pParent);
-    CompClientWindowPtr	ccw;
-
-    if (!csw)
-	return Success;
-    for (ccw = csw->clients; ccw; ccw = ccw->next)
-    {
-	int ret = compUnredirectWindow (clients[CLIENT_ID(ccw->id)],
-					pWin, ccw->update);
-	if (ret != Success)
-	    return ret;
-    }
-    return Success;
-}
-
-static int
-bgNoneVisitWindow(WindowPtr pWin, void *null)
-{
-    if (pWin->backgroundState != BackgroundPixmap)
-	return WT_WALKCHILDREN;
-    if (pWin->background.pixmap != None)
-	return WT_WALKCHILDREN;
-
-    return WT_STOPWALKING;
-}
-
-static PixmapPtr
-compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map)
-{
-    ScreenPtr	    pScreen = pWin->drawable.pScreen;
-    WindowPtr	    pParent = pWin->parent;
-    PixmapPtr	    pPixmap;
-
-    pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth,
-					CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
-
-    if (!pPixmap)
-	return 0;
-    
-    pPixmap->screen_x = x;
-    pPixmap->screen_y = y;
-
-    /* resize allocations will update later in compCopyWindow, not here */
-    if (!map)
-	return pPixmap;
-
-    /*
-     * If there's no bg=None in the tree, we're done.
-     *
-     * We could optimize this more by collection the regions of all the
-     * bg=None subwindows and feeding that in as the clip for the
-     * CopyArea below, but since window trees are shallow these days it
-     * might not be worth the effort.
-     */
-    if (TraverseTree(pWin, bgNoneVisitWindow, NULL) == WT_NOMATCH)
-	return pPixmap;
-
-    /*
-     * Copy bits from the parent into the new pixmap so that it will
-     * have "reasonable" contents in case for background None areas.
-     */
-    if (pParent->drawable.depth == pWin->drawable.depth)
-    {
-	GCPtr	pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-	
-	if (pGC)
-	{
-	    ChangeGCVal val;
-	    val.val = IncludeInferiors;
-	    
-	    ValidateGC(&pPixmap->drawable, pGC);
-	    ChangeGC (serverClient, pGC, GCSubwindowMode, &val);
-	    (*pGC->ops->CopyArea) (&pParent->drawable,
-				   &pPixmap->drawable,
-				   pGC,
-				   x - pParent->drawable.x,
-				   y - pParent->drawable.y,
-				   w, h, 0, 0);
-	    FreeScratchGC (pGC);
-	}
-    }
-    else
-    {
-	PictFormatPtr	pSrcFormat = compWindowFormat (pParent);
-	PictFormatPtr	pDstFormat = compWindowFormat (pWin);
-	XID		inferiors = IncludeInferiors;
-	int		error;
-
-	PicturePtr	pSrcPicture = CreatePicture (None,
-						     &pParent->drawable,
-						     pSrcFormat,
-						     CPSubwindowMode,
-						     &inferiors,
-						     serverClient, &error);
-						    
-	PicturePtr	pDstPicture = CreatePicture (None,
-						     &pPixmap->drawable,
-						     pDstFormat,
-						     0, 0,
-						     serverClient, &error);
-
-	if (pSrcPicture && pDstPicture)
-	{
-	    CompositePicture (PictOpSrc,
-			      pSrcPicture,
-			      NULL,
-			      pDstPicture,
-			      x - pParent->drawable.x,
-			      y - pParent->drawable.y,
-			      0, 0, 0, 0, w, h);
-	}
-	if (pSrcPicture)
-	    FreePicture (pSrcPicture, 0);
-	if (pDstPicture)
-	    FreePicture (pDstPicture, 0);
-    }
-    return pPixmap;
-}
-
-Bool
-compAllocPixmap (WindowPtr pWin)
-{
-    int		    bw = (int) pWin->borderWidth;
-    int		    x = pWin->drawable.x - bw;
-    int		    y = pWin->drawable.y - bw;
-    int		    w = pWin->drawable.width + (bw << 1);
-    int		    h = pWin->drawable.height + (bw << 1);
-    PixmapPtr	    pPixmap = compNewPixmap (pWin, x, y, w, h, TRUE);
-    CompWindowPtr   cw = GetCompWindow (pWin);
-
-    if (!pPixmap)
-	return FALSE;
-    if (cw->update == CompositeRedirectAutomatic)
-	pWin->redirectDraw = RedirectDrawAutomatic;
-    else
-	pWin->redirectDraw = RedirectDrawManual;
-
-    compSetPixmap (pWin, pPixmap);
-    cw->oldx = COMP_ORIGIN_INVALID;
-    cw->oldy = COMP_ORIGIN_INVALID;
-    cw->damageRegistered = FALSE;
-    if (cw->update == CompositeRedirectAutomatic)
-    {
-	DamageRegister (&pWin->drawable, cw->damage);
-	cw->damageRegistered = TRUE;
-    }
-    return TRUE;
-}
-
-void
-compFreePixmap (WindowPtr pWin)
-{
-    ScreenPtr	    pScreen = pWin->drawable.pScreen;
-    PixmapPtr	    pRedirectPixmap, pParentPixmap;
-    CompWindowPtr   cw = GetCompWindow (pWin);
-
-    if (cw->damageRegistered)
-    {
-	DamageUnregister (&pWin->drawable, cw->damage);
-	cw->damageRegistered = FALSE;
-	DamageEmpty (cw->damage);
-    }
-    /*
-     * Move the parent-constrained border clip region back into
-     * the window so that ValidateTree will handle the unmap
-     * case correctly.  Unmap adds the window borderClip to the
-     * parent exposed area; regions beyond the parent cause crashes
-     */
-    RegionCopy(&pWin->borderClip, &cw->borderClip);
-    pRedirectPixmap = (*pScreen->GetWindowPixmap) (pWin);
-    pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent);
-    pWin->redirectDraw = RedirectDrawNone;
-    compSetPixmap (pWin, pParentPixmap);
-    (*pScreen->DestroyPixmap) (pRedirectPixmap);
-}
-
-/*
- * Make sure the pixmap is the right size and offset.  Allocate a new
- * pixmap to change size, adjust origin to change offset, leaving the
- * old pixmap in cw->pOldPixmap so bits can be recovered
- */
-Bool
-compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
-		   unsigned int w, unsigned int h, int bw)
-{
-    ScreenPtr	    pScreen = pWin->drawable.pScreen;
-    PixmapPtr	    pOld = (*pScreen->GetWindowPixmap) (pWin);
-    PixmapPtr	    pNew;
-    CompWindowPtr   cw = GetCompWindow (pWin);
-    int		    pix_x, pix_y;
-    int		    pix_w, pix_h;
-
-    assert (cw && pWin->redirectDraw != RedirectDrawNone);
-    cw->oldx = pOld->screen_x;
-    cw->oldy = pOld->screen_y;
-    pix_x = draw_x - bw;
-    pix_y = draw_y - bw;
-    pix_w = w + (bw << 1);
-    pix_h = h + (bw << 1);
-    if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
-    {
-	pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h, FALSE);
-	if (!pNew)
-	    return FALSE;
-	cw->pOldPixmap = pOld;
-	compSetPixmap (pWin, pNew);
-    }
-    else
-    {
-	pNew = pOld;
-	cw->pOldPixmap = 0;
-    }
-    pNew->screen_x = pix_x;
-    pNew->screen_y = pix_y;
-    return TRUE;
-}
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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.
+ *
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "compint.h"
+
+static void
+compScreenUpdate (ScreenPtr pScreen)
+{
+    compCheckTree (pScreen);
+    compPaintChildrenToWindow (pScreen->root);
+}
+
+static void
+compBlockHandler (int	    i,
+		  pointer   blockData,
+		  pointer   pTimeout,
+		  pointer   pReadmask)
+{
+    ScreenPtr	    pScreen = screenInfo.screens[i];
+    CompScreenPtr   cs = GetCompScreen (pScreen);
+
+    pScreen->BlockHandler = cs->BlockHandler;
+    compScreenUpdate (pScreen);
+    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+
+    /* Next damage will restore the block handler */
+    cs->BlockHandler = NULL;
+}
+
+static void
+compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
+{
+    WindowPtr	    pWin = (WindowPtr) closure;
+    ScreenPtr	    pScreen = pWin->drawable.pScreen;
+    CompScreenPtr   cs = GetCompScreen (pScreen);
+    CompWindowPtr   cw = GetCompWindow (pWin);
+
+    if (!cs->BlockHandler) {
+        cs->BlockHandler = pScreen->BlockHandler;
+        pScreen->BlockHandler = compBlockHandler;
+    }
+    cw->damaged = TRUE;
+
+    /* Mark the ancestors */
+    pWin = pWin->parent;
+    while (pWin) {
+	if (pWin->damagedDescendants)
+	    break;
+	pWin->damagedDescendants = TRUE;
+	pWin = pWin->parent;
+    }
+}
+
+static void
+compDestroyDamage (DamagePtr pDamage, void *closure)
+{
+    WindowPtr	    pWin = (WindowPtr) closure;
+    CompWindowPtr   cw = GetCompWindow (pWin);
+
+    cw->damage = 0;
+}
+
+/*
+ * Redirect one window for one client
+ */
+int
+compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
+{
+    CompWindowPtr	cw = GetCompWindow (pWin);
+    CompClientWindowPtr	ccw;
+    Bool		wasMapped = pWin->mapped;
+    CompScreenPtr       cs = GetCompScreen(pWin->drawable.pScreen);
+    
+    if (pWin == cs->pOverlayWin) {
+	return Success;
+    }
+
+    if (!pWin->parent)
+	return BadMatch;
+
+    /*
+     * Only one Manual update is allowed
+     */
+    if (cw && update == CompositeRedirectManual)
+	for (ccw = cw->clients; ccw; ccw = ccw->next)
+	    if (ccw->update == CompositeRedirectManual)
+		return BadAccess;
+    
+    /*
+     * Allocate per-client per-window structure 
+     * The client *could* allocate multiple, but while supported,
+     * it is not expected to be common
+     */
+    ccw = malloc(sizeof (CompClientWindowRec));
+    if (!ccw)
+	return BadAlloc;
+    ccw->id = FakeClientID (pClient->index);
+    ccw->update = update;
+    /*
+     * Now make sure there's a per-window structure to hang this from
+     */
+    if (!cw)
+    {
+	cw = malloc(sizeof (CompWindowRec));
+	if (!cw)
+	{
+	    free(ccw);
+	    return BadAlloc;
+	}
+	cw->damage = DamageCreate (compReportDamage,
+				   compDestroyDamage,
+				   DamageReportNonEmpty,
+				   FALSE,
+				   pWin->drawable.pScreen,
+				   pWin);
+	if (!cw->damage)
+	{
+	    free(ccw);
+	    free(cw);
+	    return BadAlloc;
+	}
+	if (wasMapped)
+	{
+	    DisableMapUnmapEvents (pWin);
+	    UnmapWindow (pWin, FALSE);
+	    EnableMapUnmapEvents (pWin);
+	}
+
+	RegionNull(&cw->borderClip);
+	cw->borderClipX = 0;
+	cw->borderClipY = 0;
+	cw->update = CompositeRedirectAutomatic;
+	cw->clients = 0;
+	cw->oldx = COMP_ORIGIN_INVALID;
+	cw->oldy = COMP_ORIGIN_INVALID;
+	cw->damageRegistered = FALSE;
+	cw->damaged = FALSE;
+	cw->pOldPixmap = NullPixmap;
+	dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
+    }
+    ccw->next = cw->clients;
+    cw->clients = ccw;
+    if (!AddResource (ccw->id, CompositeClientWindowType, pWin))
+	return BadAlloc;
+    if (ccw->update == CompositeRedirectManual)
+    {
+	/* If the window was CompositeRedirectAutomatic, then
+	 * unmap the window so that the parent clip list will
+	 * be correctly recomputed.
+	 */
+	if (pWin->mapped) 
+	{
+	    DisableMapUnmapEvents (pWin);
+	    UnmapWindow (pWin, FALSE);
+	    EnableMapUnmapEvents (pWin);
+	}
+	if (cw->damageRegistered)
+	{
+	    DamageUnregister (&pWin->drawable, cw->damage);
+	    cw->damageRegistered = FALSE;
+	}
+	cw->update = CompositeRedirectManual;
+    }
+
+    if (!compCheckRedirect (pWin))
+    {
+	FreeResource (ccw->id, RT_NONE);
+	return BadAlloc;
+    }
+    if (wasMapped && !pWin->mapped)
+    {
+	Bool	overrideRedirect = pWin->overrideRedirect;
+	pWin->overrideRedirect = TRUE;
+	DisableMapUnmapEvents (pWin);
+	MapWindow (pWin, pClient);
+	EnableMapUnmapEvents (pWin);
+	pWin->overrideRedirect = overrideRedirect;
+    }
+    
+    return Success;
+}
+
+/*
+ * Free one of the per-client per-window resources, clearing
+ * redirect and the per-window pointer as appropriate
+ */
+void
+compFreeClientWindow (WindowPtr pWin, XID id)
+{
+    CompWindowPtr	cw = GetCompWindow (pWin);
+    CompClientWindowPtr	ccw, *prev;
+    Bool		wasMapped = pWin->mapped;
+
+    if (!cw)
+	return;
+    for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next)
+    {
+	if (ccw->id == id)
+	{
+	    *prev = ccw->next;
+	    if (ccw->update == CompositeRedirectManual)
+		cw->update = CompositeRedirectAutomatic;
+	    free(ccw);
+	    break;
+	}
+    }
+    if (!cw->clients)
+    {
+	if (wasMapped)
+	{
+	    DisableMapUnmapEvents (pWin);
+	    UnmapWindow (pWin, FALSE);
+	    EnableMapUnmapEvents (pWin);
+	}
+    
+	if (pWin->redirectDraw != RedirectDrawNone)
+	    compFreePixmap (pWin);
+
+	if (cw->damage)
+	    DamageDestroy (cw->damage);
+	
+	RegionUninit(&cw->borderClip);
+    
+	dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
+	free(cw);
+    }
+    else if (cw->update == CompositeRedirectAutomatic &&
+	     !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
+    {
+	DamageRegister (&pWin->drawable, cw->damage);
+	cw->damageRegistered = TRUE;
+	pWin->redirectDraw = RedirectDrawAutomatic;
+	DamageDamageRegion(&pWin->drawable, &pWin->borderSize);
+    }
+    if (wasMapped && !pWin->mapped)
+    {
+	Bool	overrideRedirect = pWin->overrideRedirect;
+	pWin->overrideRedirect = TRUE;
+	DisableMapUnmapEvents (pWin);
+	MapWindow (pWin, clients[CLIENT_ID(id)]);
+	EnableMapUnmapEvents (pWin);
+	pWin->overrideRedirect = overrideRedirect;
+    }
+}
+
+/*
+ * This is easy, just free the appropriate resource.
+ */
+
+int
+compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
+{
+    CompWindowPtr	cw = GetCompWindow (pWin);
+    CompClientWindowPtr	ccw;
+
+    if (!cw)
+	return BadValue;
+
+    for (ccw = cw->clients; ccw; ccw = ccw->next)
+	if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
+	{
+	    FreeResource (ccw->id, RT_NONE);
+	    return Success;
+	}
+    return BadValue;
+}
+	
+/*
+ * Redirect all subwindows for one client
+ */
+
+int
+compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
+{
+    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
+    CompClientWindowPtr	ccw;
+    WindowPtr		pChild;
+
+    /*
+     * Only one Manual update is allowed
+     */
+    if (csw && update == CompositeRedirectManual)
+	for (ccw = csw->clients; ccw; ccw = ccw->next)
+	    if (ccw->update == CompositeRedirectManual)
+		return BadAccess;
+    /*
+     * Allocate per-client per-window structure 
+     * The client *could* allocate multiple, but while supported,
+     * it is not expected to be common
+     */
+    ccw = malloc(sizeof (CompClientWindowRec));
+    if (!ccw)
+	return BadAlloc;
+    ccw->id = FakeClientID (pClient->index);
+    ccw->update = update;
+    /*
+     * Now make sure there's a per-window structure to hang this from
+     */
+    if (!csw)
+    {
+	csw = malloc(sizeof (CompSubwindowsRec));
+	if (!csw)
+	{
+	    free(ccw);
+	    return BadAlloc;
+	}
+	csw->update = CompositeRedirectAutomatic;
+	csw->clients = 0;
+	dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
+    }
+    /*
+     * Redirect all existing windows
+     */
+    for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
+    {
+	int ret = compRedirectWindow (pClient, pChild, update);
+	if (ret != Success)
+	{
+	    for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
+		(void) compUnredirectWindow (pClient, pChild, update);
+	    if (!csw->clients)
+	    {
+		free(csw);
+		dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
+	    }
+	    free(ccw);
+	    return ret;
+	}
+    }
+    /*
+     * Hook into subwindows list
+     */
+    ccw->next = csw->clients;
+    csw->clients = ccw;
+    if (!AddResource (ccw->id, CompositeClientSubwindowsType, pWin))
+	return BadAlloc;
+    if (ccw->update == CompositeRedirectManual)
+    {
+	csw->update = CompositeRedirectManual;
+	/* 
+	 * tell damage extension that damage events for this client are
+	 * critical output
+	 */
+	DamageExtSetCritical (pClient, TRUE);
+    }
+    return Success;
+}
+
+/*
+ * Free one of the per-client per-subwindows resources,
+ * which frees one redirect per subwindow
+ */
+void
+compFreeClientSubwindows (WindowPtr pWin, XID id)
+{
+    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
+    CompClientWindowPtr	ccw, *prev;
+    WindowPtr		pChild;
+
+    if (!csw)
+	return;
+    for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next)
+    {
+	if (ccw->id == id)
+	{
+	    ClientPtr	pClient = clients[CLIENT_ID(id)];
+	    
+	    *prev = ccw->next;
+	    if (ccw->update == CompositeRedirectManual)
+	    {
+		/* 
+		 * tell damage extension that damage events for this client are
+		 * critical output
+		 */
+		DamageExtSetCritical (pClient, FALSE);
+		csw->update = CompositeRedirectAutomatic;
+		if (pWin->mapped)
+		    (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, TRUE);
+	    }
+
+	    /*
+	     * Unredirect all existing subwindows
+	     */
+	    for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
+		(void) compUnredirectWindow (pClient, pChild, ccw->update);
+
+	    free(ccw);
+	    break;
+	}
+    }
+
+    /*
+     * Check if all of the per-client records are gone
+     */
+    if (!csw->clients)
+    {
+	dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
+	free(csw);
+    }
+}
+
+/*
+ * This is easy, just free the appropriate resource.
+ */
+
+int
+compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
+{
+    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
+    CompClientWindowPtr	ccw;
+    
+    if (!csw)
+	return BadValue;
+    for (ccw = csw->clients; ccw; ccw = ccw->next)
+	if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
+	{
+	    FreeResource (ccw->id, RT_NONE);
+	    return Success;
+	}
+    return BadValue;
+}
+
+/*
+ * Add redirection information for one subwindow (during reparent)
+ */
+
+int
+compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
+{
+    CompSubwindowsPtr	csw = GetCompSubwindows (pParent);
+    CompClientWindowPtr	ccw;
+
+    if (!csw)
+	return Success;
+    for (ccw = csw->clients; ccw; ccw = ccw->next)
+    {
+	int ret = compRedirectWindow (clients[CLIENT_ID(ccw->id)],
+				      pWin, ccw->update);
+	if (ret != Success)
+	    return ret;
+    }
+    return Success;
+}
+
+/*
+ * Remove redirection information for one subwindow (during reparent)
+ */
+
+int
+compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
+{
+    CompSubwindowsPtr	csw = GetCompSubwindows (pParent);
+    CompClientWindowPtr	ccw;
+
+    if (!csw)
+	return Success;
+    for (ccw = csw->clients; ccw; ccw = ccw->next)
+    {
+	int ret = compUnredirectWindow (clients[CLIENT_ID(ccw->id)],
+					pWin, ccw->update);
+	if (ret != Success)
+	    return ret;
+    }
+    return Success;
+}
+
+static PixmapPtr
+compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map)
+{
+    ScreenPtr	    pScreen = pWin->drawable.pScreen;
+    WindowPtr	    pParent = pWin->parent;
+    PixmapPtr	    pPixmap;
+
+    pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth,
+					CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+
+    if (!pPixmap)
+	return 0;
+    
+    pPixmap->screen_x = x;
+    pPixmap->screen_y = y;
+
+    /* resize allocations will update later in compCopyWindow, not here */
+    if (!map)
+	return pPixmap;
+
+    if (pParent->drawable.depth == pWin->drawable.depth)
+    {
+	GCPtr	pGC = GetScratchGC (pWin->drawable.depth, pScreen);
+	
+	if (pGC)
+	{
+	    ChangeGCVal val;
+	    val.val = IncludeInferiors;
+	    
+	    ValidateGC(&pPixmap->drawable, pGC);
+	    ChangeGC (serverClient, pGC, GCSubwindowMode, &val);
+	    (*pGC->ops->CopyArea) (&pParent->drawable,
+				   &pPixmap->drawable,
+				   pGC,
+				   x - pParent->drawable.x,
+				   y - pParent->drawable.y,
+				   w, h, 0, 0);
+	    FreeScratchGC (pGC);
+	}
+    }
+    else
+    {
+	PictFormatPtr	pSrcFormat = compWindowFormat (pParent);
+	PictFormatPtr	pDstFormat = compWindowFormat (pWin);
+	XID		inferiors = IncludeInferiors;
+	int		error;
+
+	PicturePtr	pSrcPicture = CreatePicture (None,
+						     &pParent->drawable,
+						     pSrcFormat,
+						     CPSubwindowMode,
+						     &inferiors,
+						     serverClient, &error);
+						    
+	PicturePtr	pDstPicture = CreatePicture (None,
+						     &pPixmap->drawable,
+						     pDstFormat,
+						     0, 0,
+						     serverClient, &error);
+
+	if (pSrcPicture && pDstPicture)
+	{
+	    CompositePicture (PictOpSrc,
+			      pSrcPicture,
+			      NULL,
+			      pDstPicture,
+			      x - pParent->drawable.x,
+			      y - pParent->drawable.y,
+			      0, 0, 0, 0, w, h);
+	}
+	if (pSrcPicture)
+	    FreePicture (pSrcPicture, 0);
+	if (pDstPicture)
+	    FreePicture (pDstPicture, 0);
+    }
+    return pPixmap;
+}
+
+Bool
+compAllocPixmap (WindowPtr pWin)
+{
+    int		    bw = (int) pWin->borderWidth;
+    int		    x = pWin->drawable.x - bw;
+    int		    y = pWin->drawable.y - bw;
+    int		    w = pWin->drawable.width + (bw << 1);
+    int		    h = pWin->drawable.height + (bw << 1);
+    PixmapPtr	    pPixmap = compNewPixmap (pWin, x, y, w, h, TRUE);
+    CompWindowPtr   cw = GetCompWindow (pWin);
+
+    if (!pPixmap)
+	return FALSE;
+    if (cw->update == CompositeRedirectAutomatic)
+	pWin->redirectDraw = RedirectDrawAutomatic;
+    else
+	pWin->redirectDraw = RedirectDrawManual;
+
+    compSetPixmap (pWin, pPixmap);
+    cw->oldx = COMP_ORIGIN_INVALID;
+    cw->oldy = COMP_ORIGIN_INVALID;
+    cw->damageRegistered = FALSE;
+    if (cw->update == CompositeRedirectAutomatic)
+    {
+	DamageRegister (&pWin->drawable, cw->damage);
+	cw->damageRegistered = TRUE;
+    }
+    return TRUE;
+}
+
+void
+compFreePixmap (WindowPtr pWin)
+{
+    ScreenPtr	    pScreen = pWin->drawable.pScreen;
+    PixmapPtr	    pRedirectPixmap, pParentPixmap;
+    CompWindowPtr   cw = GetCompWindow (pWin);
+
+    if (cw->damageRegistered)
+    {
+	DamageUnregister (&pWin->drawable, cw->damage);
+	cw->damageRegistered = FALSE;
+	DamageEmpty (cw->damage);
+    }
+    /*
+     * Move the parent-constrained border clip region back into
+     * the window so that ValidateTree will handle the unmap
+     * case correctly.  Unmap adds the window borderClip to the
+     * parent exposed area; regions beyond the parent cause crashes
+     */
+    RegionCopy(&pWin->borderClip, &cw->borderClip);
+    pRedirectPixmap = (*pScreen->GetWindowPixmap) (pWin);
+    pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent);
+    pWin->redirectDraw = RedirectDrawNone;
+    compSetPixmap (pWin, pParentPixmap);
+    (*pScreen->DestroyPixmap) (pRedirectPixmap);
+}
+
+/*
+ * Make sure the pixmap is the right size and offset.  Allocate a new
+ * pixmap to change size, adjust origin to change offset, leaving the
+ * old pixmap in cw->pOldPixmap so bits can be recovered
+ */
+Bool
+compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
+		   unsigned int w, unsigned int h, int bw)
+{
+    ScreenPtr	    pScreen = pWin->drawable.pScreen;
+    PixmapPtr	    pOld = (*pScreen->GetWindowPixmap) (pWin);
+    PixmapPtr	    pNew;
+    CompWindowPtr   cw = GetCompWindow (pWin);
+    int		    pix_x, pix_y;
+    int		    pix_w, pix_h;
+
+    assert (cw && pWin->redirectDraw != RedirectDrawNone);
+    cw->oldx = pOld->screen_x;
+    cw->oldy = pOld->screen_y;
+    pix_x = draw_x - bw;
+    pix_y = draw_y - bw;
+    pix_w = w + (bw << 1);
+    pix_h = h + (bw << 1);
+    if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
+    {
+	pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h, FALSE);
+	if (!pNew)
+	    return FALSE;
+	cw->pOldPixmap = pOld;
+	compSetPixmap (pWin, pNew);
+    }
+    else
+    {
+	pNew = pOld;
+	cw->pOldPixmap = 0;
+    }
+    pNew->screen_x = pix_x;
+    pNew->screen_y = pix_y;
+    return TRUE;
+}
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 9e04ff015..56e51a407 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -35,7 +35,7 @@ AM_MAINTAINER_MODE
 # Require xorg-macros minimum of 1.13 for XORG_ENABLE_UNIT_TESTS
 m4_ifndef([XORG_MACROS_VERSION],
           [m4_fatal([must install xorg-macros 1.13 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.10)
+XORG_MACROS_VERSION(1.13)
 XORG_DEFAULT_OPTIONS
 XORG_WITH_DOXYGEN(1.6.1)
 XORG_CHECK_SGML_DOCTOOLS(1.5)
@@ -44,7 +44,6 @@ XORG_ENABLE_DEVEL_DOCS
 XORG_WITH_XMLTO(0.0.20)
 XORG_WITH_FOP
 XORG_ENABLE_UNIT_TESTS
-XORG_WITH_GLIB
 XORG_LD_WRAP
 
 m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
@@ -726,9 +725,9 @@ case $host_os in
 		 		save_LDFLAGS=$LDFLAGS
 				LDFLAGS="$LDFLAGS -framework Carbon"
 				AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
-				[xorg_cv_Carbon_framework=yes],
-				[xorg_cv_Carbon_framework=no])
-			LDFLAGS=$save_LDFLAGS])
+				               [xorg_cv_Carbon_framework=yes],
+				               [xorg_cv_Carbon_framework=no])
+			        LDFLAGS=$save_LDFLAGS])
                 
 			if test "X$xorg_cv_Carbon_framework" = Xyes; then
 				XQUARTZ=yes
@@ -737,6 +736,10 @@ case $host_os in
 			fi
 		fi
 
+		AC_CHECK_FUNC(dispatch_async,
+		              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
+		              [])
+
 		if test "x$XQUARTZ" = xyes ; then
 			XQUARTZ=yes
 			XVFB=no
@@ -791,7 +794,6 @@ LIBXFONT="xfont >= 1.4.2"
 LIBXI="xi >= 1.2.99.1"
 LIBXTST="xtst >= 1.0.99.2"
 LIBPCIACCESS="pciaccess >= 0.8.0"
-LIBGLIB="glib-2.0 >= 2.16"
 LIBUDEV="libudev >= 143"
 LIBSELINUX="libselinux >= 2.0.86"
 LIBDBUS="dbus-1 >= 1.0"
@@ -1006,7 +1008,7 @@ else
 fi
 AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
 
-if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
+if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a \( "x$DRI" = xyes -o "x$DRI2" = xyes \); then
 	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
 else
 	AIGLX=no
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 534931c3e..3f46ad6fb 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -1221,13 +1221,46 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom* labels,
     return TRUE;
 }
 
+/**
+ * Allocate a valuator class and set up the pointers for the axis values
+ * appropriately.
+ *
+ * @param src If non-NULL, the memory is reallocated from src. If NULL, the
+ * memory is calloc'd.
+ * @parma numAxes Number of axes to allocate.
+ * @return The allocated valuator struct.
+ */
+ValuatorClassPtr
+AllocValuatorClass(ValuatorClassPtr src, int numAxes)
+{
+    ValuatorClassPtr v;
+    /* force alignment with double */
+    union align_u { ValuatorClassRec valc; double d; } *align;
+    int size;
+
+    size = sizeof(union align_u) + numAxes * (sizeof(double) + sizeof(AxisInfo));
+    align = (union align_u *) realloc(src, size);
+
+    if (!align)
+        return NULL;
+
+    if (!src)
+        memset(align, 0, size);
+
+    v = &align->valc;
+    v->numAxes = numAxes;
+    v->axisVal = (double*)(align + 1);
+    v->axes = (AxisInfoPtr)(v->axisVal + numAxes);
+
+    return v;
+}
+
 Bool
 InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
                               int numMotionEvents, int mode)
 {
     int i;
     ValuatorClassPtr valc;
-    union align_u { ValuatorClassRec valc; double d; } *align;
 
     if (!dev)
         return FALSE;
@@ -1240,13 +1273,10 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
         numAxes = MAX_VALUATORS;
     }
 
-    align = (union align_u *) calloc(1, sizeof(union align_u) +
-				     numAxes * sizeof(double) +
-				     numAxes * sizeof(AxisInfo));
-    if (!align)
-	return FALSE;
+    valc = AllocValuatorClass(NULL, numAxes);
+    if (!valc)
+        return FALSE;
 
-    valc = &align->valc;
     valc->sourceid = dev->id;
     valc->motion = NULL;
     valc->first_motion = 0;
@@ -1254,9 +1284,6 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
 
     valc->numMotionEvents = numMotionEvents;
     valc->motionHintWindow = NullWindow;
-    valc->numAxes = numAxes;
-    valc->axisVal = (double *)(align + 1);
-    valc->axes = (AxisInfoPtr)(valc->axisVal + numAxes);
 
     if (mode & OutOfProximity)
         InitProximityClassDeviceStruct(dev);
@@ -2365,7 +2392,7 @@ ReleaseButtonsAndKeys(DeviceIntPtr dev)
     {
         if (BitIsOn(k->down, i))
         {
-            nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i);
+            nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i, NULL);
             for (j = 0; j < nevents; j++)
                 mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL);
         }
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 644b3887e..0fa8046df 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -616,8 +616,8 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, ValuatorMask *mask,
 
 
 /**
- * Returns the maximum number of events GetKeyboardEvents,
- * GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
+ * Returns the maximum number of events GetKeyboardEvents
+ * and GetPointerEvents will ever return.
  *
  * This MUST be absolutely constant, from init until exit.
  */
@@ -925,19 +925,6 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
     }
 }
 
-/**
- * Convenience wrapper around GetKeyboardValuatorEvents, that takes no
- * valuators.
- */
-int
-GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, int key_code) {
-    ValuatorMask mask;
-
-    valuator_mask_zero(&mask);
-    return GetKeyboardValuatorEvents(events, pDev, type, key_code, &mask);
-}
-
-
 /**
  * Returns a set of InternalEvents for KeyPress/KeyRelease, optionally
  * also with valuator events.
@@ -947,8 +934,8 @@ GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, int key_code)
  * place via GetMaximumEventsNum(), and for freeing it.
  */
 int
-GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
-                          int key_code, const ValuatorMask *mask_in) {
+GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type,
+                  int key_code, const ValuatorMask *mask_in) {
     int num_events = 0;
     CARD32 ms = 0;
     DeviceEvent *event;
diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c
index e95d804c2..dfccf1581 100644
--- a/xorg-server/dix/ptrveloc.c
+++ b/xorg-server/dix/ptrveloc.c
@@ -1,1216 +1,1268 @@
-/*
- *
- * Copyright © 2006-2009 Simon Thum             simon dot thum at gmx dot de
- *
- * 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 <math.h>
-#include <ptrveloc.h>
-#include <exevents.h>
-#include <X11/Xatom.h>
-#include <os.h>
-
-#include <xserver-properties.h>
-
-/*****************************************************************************
- * Predictable pointer acceleration
- *
- * 2006-2009 by Simon Thum (simon [dot] thum [at] gmx de)
- *
- * Serves 3 complementary functions:
- * 1) provide a sophisticated ballistic velocity estimate to improve
- *    the relation between velocity (of the device) and acceleration
- * 2) make arbitrary acceleration profiles possible
- * 3) decelerate by two means (constant and adaptive) if enabled
- *
- * Important concepts are the
- *
- * - Scheme
- *      which selects the basic algorithm
- *      (see devices.c/InitPointerAccelerationScheme)
- * - Profile
- *      which returns an acceleration
- *      for a given velocity
- *
- *  The profile can be selected by the user at runtime.
- *  The classic profile is intended to cleanly perform old-style
- *  function selection (threshold =/!= 0)
- *
- ****************************************************************************/
-
-/* fwds */
-int
-SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
-static float
-SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, float velocity,
-                    float threshold, float acc);
-static PointerAccelerationProfileFunc
-GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
-static BOOL
-InitializePredictableAccelerationProperties(DeviceIntPtr,
-                                            DeviceVelocityPtr,
-                                            PredictableAccelSchemePtr);
-static BOOL
-DeletePredictableAccelerationProperties(DeviceIntPtr,
-                                        PredictableAccelSchemePtr);
-
-/*#define PTRACCEL_DEBUGGING*/
-
-#ifdef PTRACCEL_DEBUGGING
-#define DebugAccelF ErrorF
-#else
-#define DebugAccelF(...) /* */
-#endif
-
-/********************************
- *  Init/Uninit
- *******************************/
-
-/* some int which is not a profile number */
-#define PROFILE_UNINITIALIZE (-100)
-
-/**
- * Init DeviceVelocity struct so it should match the average case
- */
-void
-InitVelocityData(DeviceVelocityPtr vel)
-{
-    memset(vel, 0, sizeof(DeviceVelocityRec));
-
-    vel->corr_mul = 10.0;      /* dots per 10 milisecond should be usable */
-    vel->const_acceleration = 1.0;   /* no acceleration/deceleration  */
-    vel->reset_time = 300;
-    vel->use_softening = 1;
-    vel->min_acceleration = 1.0; /* don't decelerate */
-    vel->max_rel_diff = 0.2;
-    vel->max_diff = 1.0;
-    vel->initial_range = 2;
-    vel->average_accel = TRUE;
-    SetAccelerationProfile(vel, AccelProfileClassic);
-    InitTrackers(vel, 16);
-}
-
-
-/**
- * Clean up DeviceVelocityRec
- */
-void
-FreeVelocityData(DeviceVelocityPtr vel){
-    free(vel->tracker);
-    SetAccelerationProfile(vel, PROFILE_UNINITIALIZE);
-}
-
-
-/**
- * Init predictable scheme
- */
-Bool
-InitPredictableAccelerationScheme(DeviceIntPtr dev,
-                                  ValuatorAccelerationPtr protoScheme) {
-    DeviceVelocityPtr vel;
-    ValuatorAccelerationRec scheme;
-    PredictableAccelSchemePtr schemeData;
-    scheme = *protoScheme;
-    vel = calloc(1, sizeof(DeviceVelocityRec));
-    schemeData = calloc(1, sizeof(PredictableAccelSchemeRec));
-    if (!vel || !schemeData)
-        return FALSE;
-    InitVelocityData(vel);
-    schemeData->vel = vel;
-    scheme.accelData = schemeData;
-    if (!InitializePredictableAccelerationProperties(dev, vel, schemeData))
-        return FALSE;
-    /* all fine, assign scheme to device */
-    dev->valuator->accelScheme = scheme;
-    return TRUE;
-}
-
-
-/**
- *  Uninit scheme
- */
-void
-AccelerationDefaultCleanup(DeviceIntPtr dev)
-{
-    DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
-    if (vel) {
-        /* the proper guarantee would be that we're not inside of
-         * AccelSchemeProc(), but that seems impossible. Schemes don't get
-         * switched often anyway.
-         */
-        OsBlockSignals();
-        dev->valuator->accelScheme.AccelSchemeProc = NULL;
-        FreeVelocityData(vel);
-        free(vel);
-        DeletePredictableAccelerationProperties(dev,
-            (PredictableAccelSchemePtr) dev->valuator->accelScheme.accelData);
-        free(dev->valuator->accelScheme.accelData);
-        dev->valuator->accelScheme.accelData = NULL;
-        OsReleaseSignals();
-    }
-}
-
-
-/*************************
- * Input property support
- ************************/
-
-/**
- * choose profile
- */
-static int
-AccelSetProfileProperty(DeviceIntPtr dev, Atom atom,
-                        XIPropertyValuePtr val, BOOL checkOnly)
-{
-    DeviceVelocityPtr vel;
-    int profile, *ptr = &profile;
-    int rc;
-    int nelem = 1;
-
-    if (atom != XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER))
-        return Success;
-
-    vel = GetDevicePredictableAccelData(dev);
-    if (!vel)
-        return BadValue;
-    rc = XIPropToInt(val, &nelem, &ptr);
-
-    if(checkOnly)
-    {
-        if (rc)
-            return rc;
-
-        if (GetAccelerationProfile(vel, profile) == NULL)
-            return BadValue;
-    } else
-	SetAccelerationProfile(vel, profile);
-
-    return Success;
-}
-
-static long
-AccelInitProfileProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
-{
-    int profile = vel->statistics.profile_number;
-    Atom prop_profile_number = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
-
-    XIChangeDeviceProperty(dev, prop_profile_number, XA_INTEGER, 32,
-                           PropModeReplace, 1, &profile, FALSE);
-    XISetDevicePropertyDeletable(dev, prop_profile_number, FALSE);
-    return XIRegisterPropertyHandler(dev, AccelSetProfileProperty, NULL, NULL);
-}
-
-/**
- * constant deceleration
- */
-static int
-AccelSetDecelProperty(DeviceIntPtr dev, Atom atom,
-                      XIPropertyValuePtr val, BOOL checkOnly)
-{
-    DeviceVelocityPtr vel;
-    float v, *ptr = &v;
-    int rc;
-    int nelem = 1;
-
-    if (atom != XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION))
-        return Success;
-
-    vel = GetDevicePredictableAccelData(dev);
-    if (!vel)
-        return BadValue;
-    rc = XIPropToFloat(val, &nelem, &ptr);
-
-    if(checkOnly)
-    {
-        if (rc)
-            return rc;
-	return (v >= 1.0f) ? Success : BadValue;
-    }
-
-    if(v >= 1.0f)
-	vel->const_acceleration = 1/v;
-
-    return Success;
-}
-
-static long
-AccelInitDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
-{
-    float fval = 1.0/vel->const_acceleration;
-    Atom prop_const_decel = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
-    XIChangeDeviceProperty(dev, prop_const_decel,
-                           XIGetKnownProperty(XATOM_FLOAT), 32,
-                           PropModeReplace, 1, &fval, FALSE);
-    XISetDevicePropertyDeletable(dev, prop_const_decel, FALSE);
-    return XIRegisterPropertyHandler(dev, AccelSetDecelProperty, NULL, NULL);
-}
-
-
-/**
- * adaptive deceleration
- */
-static int
-AccelSetAdaptDecelProperty(DeviceIntPtr dev, Atom atom,
-                           XIPropertyValuePtr val, BOOL checkOnly)
-{
-    DeviceVelocityPtr veloc;
-    float v, *ptr = &v;
-    int rc;
-    int nelem = 1;
-
-    if (atom != XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION))
-        return Success;
-
-    veloc = GetDevicePredictableAccelData(dev);
-    if (!veloc)
-        return BadValue;
-    rc = XIPropToFloat(val, &nelem, &ptr);
-
-    if(checkOnly)
-    {
-        if (rc)
-            return rc;
-	return (v >= 1.0f) ? Success : BadValue;
-    }
-
-    if(v >= 1.0f)
-	veloc->min_acceleration = 1/v;
-
-    return Success;
-}
-
-static long
-AccelInitAdaptDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
-{
-    float fval = 1.0/vel->min_acceleration;
-    Atom prop_adapt_decel = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
-
-    XIChangeDeviceProperty(dev, prop_adapt_decel, XIGetKnownProperty(XATOM_FLOAT), 32,
-                           PropModeReplace, 1, &fval, FALSE);
-    XISetDevicePropertyDeletable(dev, prop_adapt_decel, FALSE);
-    return XIRegisterPropertyHandler(dev, AccelSetAdaptDecelProperty, NULL, NULL);
-}
-
-
-/**
- * velocity scaling
- */
-static int
-AccelSetScaleProperty(DeviceIntPtr dev, Atom atom,
-                      XIPropertyValuePtr val, BOOL checkOnly)
-{
-    DeviceVelocityPtr vel;
-    float v, *ptr = &v;
-    int rc;
-    int nelem = 1;
-
-    if (atom != XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING))
-        return Success;
-
-    vel = GetDevicePredictableAccelData(dev);
-    if (!vel)
-        return BadValue;
-    rc = XIPropToFloat(val, &nelem, &ptr);
-
-    if (checkOnly)
-    {
-        if (rc)
-            return rc;
-
-        return (v > 0) ? Success : BadValue;
-    }
-
-    if(v > 0)
-	vel->corr_mul = v;
-
-    return Success;
-}
-
-static long
-AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
-{
-    float fval = vel->corr_mul;
-    Atom prop_velo_scale = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
-
-    XIChangeDeviceProperty(dev, prop_velo_scale, XIGetKnownProperty(XATOM_FLOAT), 32,
-                           PropModeReplace, 1, &fval, FALSE);
-    XISetDevicePropertyDeletable(dev, prop_velo_scale, FALSE);
-    return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
-}
-
-static BOOL
-InitializePredictableAccelerationProperties(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr  vel,
-    PredictableAccelSchemePtr schemeData)
-{
-    int num_handlers = 4;
-    if(!vel)
-        return FALSE;
-
-    schemeData->prop_handlers = calloc(num_handlers, sizeof(long));
-    if (!schemeData->prop_handlers)
-        return FALSE;
-    schemeData->num_prop_handlers = num_handlers;
-    schemeData->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
-    schemeData->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
-    schemeData->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
-    schemeData->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
-
-    return TRUE;
-}
-
-BOOL
-DeletePredictableAccelerationProperties(
-    DeviceIntPtr dev,
-    PredictableAccelSchemePtr scheme)
-{
-    DeviceVelocityPtr vel;
-    Atom prop;
-    int i;
-
-    prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
-    XIDeleteDeviceProperty(dev, prop, FALSE);
-    prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
-    XIDeleteDeviceProperty(dev, prop, FALSE);
-    prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
-    XIDeleteDeviceProperty(dev, prop, FALSE);
-    prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
-    XIDeleteDeviceProperty(dev, prop, FALSE);
-
-    vel = GetDevicePredictableAccelData(dev);
-    if (vel) {
-        for (i = 0; i < scheme->num_prop_handlers; i++)
-            if (scheme->prop_handlers[i])
-                XIUnregisterPropertyHandler(dev, scheme->prop_handlers[i]);
-    }
-
-    free(scheme->prop_handlers);
-    scheme->prop_handlers = NULL;
-    scheme->num_prop_handlers = 0;
-    return TRUE;
-}
-
-/*********************
- * Tracking logic
- ********************/
-
-void
-InitTrackers(DeviceVelocityPtr vel, int ntracker)
-{
-    if(ntracker < 1){
-	ErrorF("(dix ptracc) invalid number of trackers\n");
-	return;
-    }
-    free(vel->tracker);
-    vel->tracker = (MotionTrackerPtr)calloc(ntracker, sizeof(MotionTracker));
-    vel->num_tracker = ntracker;
-}
-
-/**
- * return a bit field of possible directions.
- * 0 = N, 2 = E, 4 = S, 6 = W, in-between is as you guess.
- * There's no reason against widening to more precise directions (<45 degrees),
- * should it not perform well. All this is needed for is sort out non-linear
- * motion, so precision isn't paramount. However, one should not flag direction
- * too narrow, since it would then cut the linear segment to zero size way too
- * often.
- */
-static int
-DoGetDirection(int dx, int dy){
-    float r;
-    int i1, i2;
-    /* on insignificant mickeys, flag 135 degrees */
-    if(abs(dx) < 2 && abs(dy < 2)){
-	/* first check diagonal cases */
-	if(dx > 0 && dy > 0)
-	    return 4+8+16;
-	if(dx > 0 && dy < 0)
-	    return 1+2+4;
-	if(dx < 0 && dy < 0)
-	    return 1+128+64;
-	if(dx < 0 && dy > 0)
-	    return 16+32+64;
-        /* check axis-aligned directions */
-	if(dx > 0)
-            return 2+4+8; /*E*/
-        if(dx < 0)
-            return 128+64+32; /*W*/
-        if(dy > 0)
-            return 32+16+8; /*S*/
-        if(dy < 0)
-            return 128+1+2; /*N*/
-        return 255; /* shouldn't happen */
-    }
-    /* else, compute angle and set appropriate flags */
-#ifdef _ISOC99_SOURCE
-    r = atan2f(dy, dx);
-#else
-    r = atan2(dy, dx);
-#endif
-    /* find direction. We avoid r to become negative,
-     * since C has no well-defined modulo for such cases. */
-    r = (r+(M_PI*2.5))/(M_PI/4);
-    /* this intends to flag 2 directions (90 degrees),
-     * except on very well-aligned mickeys. */
-    i1 = (int)(r+0.1) % 8;
-    i2 = (int)(r+0.9) % 8;
-    if(i1 < 0 || i1 > 7 || i2 < 0 || i2 > 7)
-	return 255; /* shouldn't happen */
-    return 1 << i1 | 1 << i2;
-}
-
-#define DIRECTION_CACHE_RANGE 5
-#define DIRECTION_CACHE_SIZE (DIRECTION_CACHE_RANGE*2+1)
-
-/* cache DoGetDirection(). */
-static int
-GetDirection(int dx, int dy){
-    static int cache[DIRECTION_CACHE_SIZE][DIRECTION_CACHE_SIZE];
-    int i;
-    if (abs(dx) <= DIRECTION_CACHE_RANGE &&
-	abs(dy) <= DIRECTION_CACHE_RANGE) {
-	/* cacheable */
-	i = cache[DIRECTION_CACHE_RANGE+dx][DIRECTION_CACHE_RANGE+dy];
-	if(i != 0){
-	    return i;
-	}else{
-	    i = DoGetDirection(dx, dy);
-	    cache[DIRECTION_CACHE_RANGE+dx][DIRECTION_CACHE_RANGE+dy] = i;
-	    return i;
-	}
-    }else{
-	/* non-cacheable */
-	return DoGetDirection(dx, dy);
-    }
-}
-
-#undef DIRECTION_CACHE_RANGE
-#undef DIRECTION_CACHE_SIZE
-
-
-/* convert offset (age) to array index */
-#define TRACKER_INDEX(s, d) (((s)->num_tracker + (s)->cur_tracker - (d)) % (s)->num_tracker)
-
-static inline void
-FeedTrackers(DeviceVelocityPtr vel, int dx, int dy, int cur_t)
-{
-    int n;
-    for(n = 0; n < vel->num_tracker; n++){
-	vel->tracker[n].dx += dx;
-	vel->tracker[n].dy += dy;
-    }
-    n = (vel->cur_tracker + 1) % vel->num_tracker;
-    vel->tracker[n].dx = 0;
-    vel->tracker[n].dy = 0;
-    vel->tracker[n].time = cur_t;
-    vel->tracker[n].dir = GetDirection(dx, dy);
-    DebugAccelF("(dix prtacc) motion [dx: %i dy: %i dir:%i diff: %i]\n",
-                dx, dy, vel->tracker[n].dir,
-                cur_t - vel->tracker[vel->cur_tracker].time);
-    vel->cur_tracker = n;
-}
-
-/**
- * calc velocity for given tracker, with
- * velocity scaling.
- * This assumes linear motion.
- */
-static float
-CalcTracker(DeviceVelocityPtr vel, int offset, int cur_t){
-    int index = TRACKER_INDEX(vel, offset);
-    float dist = sqrt(  vel->tracker[index].dx * vel->tracker[index].dx
-                      + vel->tracker[index].dy * vel->tracker[index].dy);
-    int dtime = cur_t - vel->tracker[index].time;
-    if(dtime > 0)
-	return dist / dtime;
-    else
-	return 0;/* synonymous for NaN, since we're not C99 */
-}
-
-/* find the most plausible velocity. That is, the most distant
- * (in time) tracker which isn't too old, beyond a linear partition,
- * or simply too much off initial velocity.
- *
- * May return 0.
- */
-static float
-QueryTrackers(DeviceVelocityPtr vel, int cur_t){
-    int n, offset, dir = 255, i = -1, age_ms;
-    /* initial velocity: a low-offset, valid velocity */
-    float iveloc = 0, res = 0, tmp, vdiff;
-    float vfac =  vel->corr_mul * vel->const_acceleration; /* premultiply */
-    /* loop from current to older data */
-    for(offset = 1; offset < vel->num_tracker; offset++){
-	n = TRACKER_INDEX(vel, offset);
-
-	age_ms = cur_t - vel->tracker[n].time;
-
-	/* bail out if data is too old and protect from overrun */
-	if (age_ms >= vel->reset_time || age_ms < 0) {
-	    DebugAccelF("(dix prtacc) query: tracker too old\n");
-	    break;
-	}
-
-	/*
-	 * this heuristic avoids using the linear-motion velocity formula
-	 * in CalcTracker() on motion that isn't exactly linear. So to get
-	 * even more precision we could subdivide as a final step, so possible
-	 * non-linearities are accounted for.
-	 */
-	dir &= vel->tracker[n].dir;
-	if(dir == 0){
-	    DebugAccelF("(dix prtacc) query: no longer linear\n");
-	    /* instead of breaking it we might also inspect the partition after,
-	     * but actual improvement with this is probably rare. */
-	    break;
-	}
-
-	tmp = CalcTracker(vel, offset, cur_t) * vfac;
-
-	if ((iveloc == 0 || offset <= vel->initial_range) && tmp != 0) {
-	    /* set initial velocity and result */
-	    res = iveloc = tmp;
-	    i = offset;
-	} else if (iveloc != 0 && tmp != 0) {
-	    vdiff = fabs(iveloc - tmp);
-	    if (vdiff <= vel->max_diff ||
-		vdiff/(iveloc + tmp) < vel->max_rel_diff) {
-		/* we're in range with the initial velocity,
-		 * so this result is likely better
-		 * (it contains more information). */
-		res = tmp;
-		i = offset;
-	    }else{
-		/* we're not in range, quit - it won't get better. */
-		DebugAccelF("(dix prtacc) query: tracker too different:"
-		            " old %2.2f initial %2.2f diff: %2.2f\n",
-		            tmp, iveloc, vdiff);
-		break;
-	    }
-	}
-    }
-    if(offset == vel->num_tracker){
-	DebugAccelF("(dix prtacc) query: last tracker in effect\n");
-	i = vel->num_tracker-1;
-    }
-    if(i>=0){
-        n = TRACKER_INDEX(vel, i);
-	DebugAccelF("(dix prtacc) result: offset %i [dx: %i dy: %i diff: %i]\n",
-	            i,
-	            vel->tracker[n].dx,
-	            vel->tracker[n].dy,
-	            cur_t - vel->tracker[n].time);
-    }
-    return res;
-}
-
-#undef TRACKER_INDEX
-
-/**
- * Perform velocity approximation based on 2D 'mickeys' (mouse motion delta).
- * return true if non-visible state reset is suggested
- */
-short
-ProcessVelocityData2D(
-    DeviceVelocityPtr vel,
-    int dx,
-    int dy,
-    int time)
-{
-    float velocity;
-
-    vel->last_velocity = vel->velocity;
-
-    FeedTrackers(vel, dx, dy, time);
-
-    velocity = QueryTrackers(vel, time);
-
-    vel->velocity = velocity;
-    return velocity == 0;
-}
-
-/**
- * this flattens significant ( > 1) mickeys a little bit for more steady
- * constant-velocity response
- */
-static inline float
-ApplySimpleSoftening(int od, int d)
-{
-    float res = d;
-    if (d <= 1 && d >= -1)
-        return res;
-    if (d > od)
-        res -= 0.5;
-    else if (d < od)
-        res += 0.5;
-    return res;
-}
-
-
-static void
-ApplySofteningAndConstantDeceleration(
-        DeviceVelocityPtr vel,
-        int dx,
-        int dy,
-        float* fdx,
-        float* fdy,
-        short do_soften)
-{
-    if (do_soften && vel->use_softening) {
-        *fdx = ApplySimpleSoftening(vel->last_dx, dx);
-        *fdy = ApplySimpleSoftening(vel->last_dy, dy);
-    } else {
-        *fdx = dx;
-        *fdy = dy;
-    }
-
-    *fdx *= vel->const_acceleration;
-    *fdy *= vel->const_acceleration;
-}
-
-/*
- * compute the acceleration for given velocity and enforce min_acceleartion
- */
-float
-BasicComputeAcceleration(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc){
-
-    float result;
-    result = vel->Profile(dev, vel, velocity, threshold, acc);
-
-    /* enforce min_acceleration */
-    if (result < vel->min_acceleration)
-	result = vel->min_acceleration;
-    return result;
-}
-
-/**
- * Compute acceleration. Takes into account averaging, nv-reset, etc.
- */
-static float
-ComputeAcceleration(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float threshold,
-    float acc){
-    float res;
-
-    if(vel->velocity <= 0){
-	DebugAccelF("(dix ptracc) profile skipped\n");
-        /*
-         * If we have no idea about device velocity, don't pretend it.
-         */
-	return 1;
-    }
-
-    if(vel->average_accel && vel->velocity != vel->last_velocity){
-	/* use simpson's rule to average acceleration between
-	 * current and previous velocity.
-	 * Though being the more natural choice, it causes a minor delay
-	 * in comparison, so it can be disabled. */
-	res = BasicComputeAcceleration(
-	          dev, vel, vel->velocity, threshold, acc);
-	res += BasicComputeAcceleration(
-	          dev, vel, vel->last_velocity, threshold, acc);
-	res += 4.0f * BasicComputeAcceleration(dev, vel,
-	                   (vel->last_velocity + vel->velocity) / 2,
-	                   threshold, acc);
-	res /= 6.0f;
-	DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
-	            vel->velocity, vel->last_velocity, res);
-        return res;
-    }else{
-	res = BasicComputeAcceleration(dev, vel,
-	                               vel->velocity, threshold, acc);
-	DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
-               vel->velocity, res);
-	return res;
-    }
-}
-
-
-/*****************************************
- *  Acceleration functions and profiles
- ****************************************/
-
-/**
- * Polynomial function similar previous one, but with f(1) = 1
- */
-static float
-PolynomialAccelerationProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float ignored,
-    float acc)
-{
-   return pow(velocity, (acc - 1.0) * 0.5);
-}
-
-
-/**
- * returns acceleration for velocity.
- * This profile selects the two functions like the old scheme did
- */
-static float
-ClassicProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc)
-{
-    if (threshold > 0) {
-	return SimpleSmoothProfile (dev,
-	                            vel,
-	                            velocity,
-                                    threshold,
-                                    acc);
-    } else {
-	return PolynomialAccelerationProfile (dev,
-	                                      vel,
-	                                      velocity,
-                                              0,
-                                              acc);
-    }
-}
-
-
-/**
- * Power profile
- * This has a completely smooth transition curve, i.e. no jumps in the
- * derivatives.
- *
- * This has the expense of overall response dependency on min-acceleration.
- * In effect, min_acceleration mimics const_acceleration in this profile.
- */
-static float
-PowerProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc)
-{
-    float vel_dist;
-
-    acc = (acc-1.0) * 0.1f + 1.0; /* without this, acc of 2 is unuseable */
-
-    if (velocity <= threshold)
-        return vel->min_acceleration;
-    vel_dist = velocity - threshold;
-    return (pow(acc, vel_dist)) * vel->min_acceleration;
-}
-
-
-/**
- * just a smooth function in [0..1] -> [0..1]
- *  - point symmetry at 0.5
- *  - f'(0) = f'(1) = 0
- *  - starts faster than a sinoid
- *  - smoothness C1 (Cinf if you dare to ignore endpoints)
- */
-static inline float
-CalcPenumbralGradient(float x){
-    x *= 2.0f;
-    x -= 1.0f;
-    return 0.5f + (x * sqrt(1.0f - x*x) + asin(x))/M_PI;
-}
-
-
-/**
- * acceleration function similar to classic accelerated/unaccelerated,
- * but with smooth transition in between (and towards zero for adaptive dec.).
- */
-static float
-SimpleSmoothProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc)
-{
-    if(velocity < 1.0f)
-        return CalcPenumbralGradient(0.5 + velocity*0.5) * 2.0f - 1.0f;
-    if(threshold < 1.0f)
-        threshold = 1.0f;
-    if (velocity <= threshold)
-        return 1;
-    velocity /= threshold;
-    if (velocity >= acc)
-        return acc;
-    else
-        return 1.0f + (CalcPenumbralGradient(velocity/acc) * (acc - 1.0f));
-}
-
-
-/**
- * This profile uses the first half of the penumbral gradient as a start
- * and then scales linearly.
- */
-static float
-SmoothLinearProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc)
-{
-    float res, nv;
-
-    if(acc > 1.0f)
-        acc -= 1.0f; /*this is so acc = 1 is no acceleration */
-    else
-        return 1.0f;
-
-    nv = (velocity - threshold) * acc * 0.5f;
-
-    if(nv < 0){
-        res = 0;
-    }else if(nv < 2){
-        res = CalcPenumbralGradient(nv*0.25f)*2.0f;
-    }else{
-        nv -= 2.0f;
-        res = nv * 2.0f / M_PI  /* steepness of gradient at 0.5 */
-              + 1.0f; /* gradient crosses 2|1 */
-    }
-    res += vel->min_acceleration;
-    return res;
-}
-
-
-/**
- * From 0 to threshold, the response graduates smoothly from min_accel to
- * acceleration. Beyond threshold it is exactly the specified acceleration.
- */
-static float
-SmoothLimitedProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc)
-{
-    float res;
-
-    if(velocity >= threshold || threshold == 0.0f)
-	return acc;
-
-    velocity /= threshold; /* should be [0..1[ now */
-
-    res = CalcPenumbralGradient(velocity) * (acc - vel->min_acceleration);
-
-    return vel->min_acceleration + res;
-}
-
-
-static float
-LinearProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc)
-{
-    return acc * velocity;
-}
-
-static float
-NoProfile(
-    DeviceIntPtr dev,
-    DeviceVelocityPtr vel,
-    float velocity,
-    float threshold,
-    float acc)
-{
-    return 1.0f;
-}
-
-static PointerAccelerationProfileFunc
-GetAccelerationProfile(
-    DeviceVelocityPtr vel,
-    int profile_num)
-{
-    switch(profile_num){
-        case AccelProfileClassic:
-            return ClassicProfile;
-        case AccelProfileDeviceSpecific:
-            return vel->deviceSpecificProfile;
-        case AccelProfilePolynomial:
-            return PolynomialAccelerationProfile;
-        case AccelProfileSmoothLinear:
-            return SmoothLinearProfile;
-        case AccelProfileSimple:
-            return SimpleSmoothProfile;
-        case AccelProfilePower:
-            return PowerProfile;
-        case AccelProfileLinear:
-            return LinearProfile;
-        case AccelProfileSmoothLimited:
-            return SmoothLimitedProfile;
-        case AccelProfileNone:
-            return NoProfile;
-        default:
-            return NULL;
-    }
-}
-
-/**
- * Set the profile by number.
- * Intended to make profiles exchangeable at runtime.
- * If you created a profile, give it a number here and in the header to
- * make it selectable. In case some profile-specific init is needed, here
- * would be a good place, since FreeVelocityData() also calls this with
- * PROFILE_UNINITIALIZE.
- *
- * returns FALSE if profile number is unavailable, TRUE otherwise.
- */
-int
-SetAccelerationProfile(
-    DeviceVelocityPtr vel,
-    int profile_num)
-{
-    PointerAccelerationProfileFunc profile;
-    profile = GetAccelerationProfile(vel, profile_num);
-
-    if(profile == NULL && profile_num != PROFILE_UNINITIALIZE)
-	return FALSE;
-
-    /* Here one could free old profile-private data */
-    free(vel->profile_private);
-    vel->profile_private = NULL;
-    /* Here one could init profile-private data */
-    vel->Profile = profile;
-    vel->statistics.profile_number = profile_num;
-    return TRUE;
-}
-
-/**********************************************
- * driver interaction
- **********************************************/
-
-
-/**
- * device-specific profile
- *
- * The device-specific profile is intended as a hook for a driver
- * which may want to provide an own acceleration profile.
- * It should not rely on profile-private data, instead
- * it should do init/uninit in the driver (ie. with DEVICE_INIT and friends).
- * Users may override or choose it.
- */
-void
-SetDeviceSpecificAccelerationProfile(
-        DeviceVelocityPtr vel,
-        PointerAccelerationProfileFunc profile)
-{
-    if(vel)
-	vel->deviceSpecificProfile = profile;
-}
-
-/**
- * Use this function to obtain a DeviceVelocityPtr for a device. Will return NULL if
- * the predictable acceleration scheme is not in effect.
- */
-DeviceVelocityPtr
-GetDevicePredictableAccelData(
-	DeviceIntPtr dev)
-{
-    /*sanity check*/
-    if(!dev){
-	ErrorF("[dix] accel: DeviceIntPtr was NULL");
-	return NULL;
-    }
-    if( dev->valuator &&
-	dev->valuator->accelScheme.AccelSchemeProc ==
-	    acceleratePointerPredictable &&
-	dev->valuator->accelScheme.accelData != NULL){
-
-	return ((PredictableAccelSchemePtr)
-		dev->valuator->accelScheme.accelData)->vel;
-    }
-    return NULL;
-}
-
-/********************************
- *  acceleration schemes
- *******************************/
-
-/**
- * Modifies valuators in-place.
- * This version employs a velocity approximation algorithm to
- * enable fine-grained predictable acceleration profiles.
- */
-void
-acceleratePointerPredictable(
-    DeviceIntPtr dev,
-    ValuatorMask* val,
-    CARD32 evtime)
-{
-    float fdx, fdy, tmp, mult; /* no need to init */
-    int dx = 0, dy = 0, tmpi;
-    DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
-    Bool soften = TRUE;
-
-    if (!velocitydata)
-        return;
-
-    if (velocitydata->statistics.profile_number == AccelProfileNone &&
-        velocitydata->const_acceleration == 1.0f) {
-        return; /*we're inactive anyway, so skip the whole thing.*/
-    }
-
-    if (valuator_mask_isset(val, 0)) {
-        dx = valuator_mask_get(val, 0);
-    }
-
-    if (valuator_mask_isset(val, 1)) {
-        dy = valuator_mask_get(val, 1);
-    }
-
-    if (dx || dy){
-        /* reset non-visible state? */
-        if (ProcessVelocityData2D(velocitydata, dx , dy, evtime)) {
-            soften = FALSE;
-        }
-
-        if (dev->ptrfeed && dev->ptrfeed->ctrl.num) {
-            /* invoke acceleration profile to determine acceleration */
-            mult = ComputeAcceleration (dev, velocitydata,
-                                        dev->ptrfeed->ctrl.threshold,
-                                        (float)dev->ptrfeed->ctrl.num /
-                                            (float)dev->ptrfeed->ctrl.den);
-
-            if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
-                ApplySofteningAndConstantDeceleration(velocitydata,
-                                                      dx, dy,
-                                                      &fdx, &fdy,
-                                                      (mult > 1.0f) && soften);
-
-                if (dx) {
-                    tmp = mult * fdx + dev->last.remainder[0];
-                    /* Since it may not be apparent: lrintf() does not offer
-                     * strong statements about rounding; however because we
-                     * process each axis conditionally, there's no danger
-                     * of a toggling remainder. Its lack of guarantees likely
-                     * makes it faster on the average target. */
-                    tmpi = lrintf(tmp);
-                    valuator_mask_set(val, 0, tmpi);
-                    dev->last.remainder[0] = tmp - (float)tmpi;
-                }
-                if (dy) {
-                    tmp = mult * fdy + dev->last.remainder[1];
-                    tmpi = lrintf(tmp);
-                    valuator_mask_set(val, 1, tmpi);
-                    dev->last.remainder[1] = tmp - (float)tmpi;
-                }
-                DebugAccelF("pos (%i | %i) remainders x: %.3f y: %.3f delta x:%.3f y:%.3f\n",
-                            *px, *py, dev->last.remainder[0], dev->last.remainder[1], fdx, fdy);
-            }
-        }
-    }
-    /* remember last motion delta (for softening/slow movement treatment) */
-    velocitydata->last_dx = dx;
-    velocitydata->last_dy = dy;
-}
-
-
-
-/**
- * Originally a part of xf86PostMotionEvent; modifies valuators
- * in-place. Retained mostly for embedded scenarios.
- */
-void
-acceleratePointerLightweight(
-    DeviceIntPtr dev,
-    ValuatorMask* val,
-    CARD32 ignored)
-{
-    float mult = 0.0, tmpf;
-    int dx = 0, dy = 0, tmpi;
-
-    if (valuator_mask_isset(val, 0)) {
-        dx = valuator_mask_get(val, 0);
-    }
-
-    if (valuator_mask_isset(val, 1)) {
-        dy = valuator_mask_get(val, 1);
-    }
-
-    if (!dx && !dy)
-        return;
-
-    if (dev->ptrfeed && dev->ptrfeed->ctrl.num) {
-        /* modeled from xf86Events.c */
-        if (dev->ptrfeed->ctrl.threshold) {
-            if ((abs(dx) + abs(dy)) >= dev->ptrfeed->ctrl.threshold) {
-                tmpf = ((float)dx *
-                        (float)(dev->ptrfeed->ctrl.num)) /
-                       (float)(dev->ptrfeed->ctrl.den) +
-                       dev->last.remainder[0];
-                if (dx) {
-                    tmpi = (int) tmpf;
-                    valuator_mask_set(val, 0, tmpi);
-                    dev->last.remainder[0] = tmpf - (float)tmpi;
-                }
-
-                tmpf = ((float)dy *
-                        (float)(dev->ptrfeed->ctrl.num)) /
-                       (float)(dev->ptrfeed->ctrl.den) +
-                       dev->last.remainder[1];
-                if (dy) {
-                    tmpi = (int) tmpf;
-                    valuator_mask_set(val, 1, tmpi);
-                    dev->last.remainder[1] = tmpf - (float)tmpi;
-                }
-            }
-        }
-        else {
-            mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
-                       ((float)(dev->ptrfeed->ctrl.num) /
-                        (float)(dev->ptrfeed->ctrl.den) - 1.0) /
-                       2.0) / 2.0;
-            if (dx) {
-                tmpf = mult * (float)dx +
-                       dev->last.remainder[0];
-                tmpi = (int) tmpf;
-                valuator_mask_set(val, 0, tmpi);
-                dev->last.remainder[0] = tmpf - (float)tmpi;
-            }
-            if (dy) {
-                tmpf = mult * (float)dy +
-                       dev->last.remainder[1];
-                tmpi = (int)tmpf;
-                valuator_mask_set(val, 1, tmpi);
-                dev->last.remainder[1] = tmpf - (float)tmpi;
-            }
-        }
-    }
-}
+/*
+ *
+ * Copyright © 2006-2009 Simon Thum             simon dot thum at gmx dot de
+ *
+ * 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 <math.h>
+#include <ptrveloc.h>
+#include <exevents.h>
+#include <X11/Xatom.h>
+#include <os.h>
+
+#include <xserver-properties.h>
+
+/*****************************************************************************
+ * Predictable pointer acceleration
+ *
+ * 2006-2009 by Simon Thum (simon [dot] thum [at] gmx de)
+ *
+ * Serves 3 complementary functions:
+ * 1) provide a sophisticated ballistic velocity estimate to improve
+ *    the relation between velocity (of the device) and acceleration
+ * 2) make arbitrary acceleration profiles possible
+ * 3) decelerate by two means (constant and adaptive) if enabled
+ *
+ * Important concepts are the
+ *
+ * - Scheme
+ *      which selects the basic algorithm
+ *      (see devices.c/InitPointerAccelerationScheme)
+ * - Profile
+ *      which returns an acceleration
+ *      for a given velocity
+ *
+ *  The profile can be selected by the user at runtime.
+ *  The classic profile is intended to cleanly perform old-style
+ *  function selection (threshold =/!= 0)
+ *
+ ****************************************************************************/
+
+/* fwds */
+int
+SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
+static float
+SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, float velocity,
+                    float threshold, float acc);
+static PointerAccelerationProfileFunc
+GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
+static BOOL
+InitializePredictableAccelerationProperties(DeviceIntPtr,
+                                            DeviceVelocityPtr,
+                                            PredictableAccelSchemePtr);
+static BOOL
+DeletePredictableAccelerationProperties(DeviceIntPtr,
+                                        PredictableAccelSchemePtr);
+
+/*#define PTRACCEL_DEBUGGING*/
+
+#ifdef PTRACCEL_DEBUGGING
+#define DebugAccelF ErrorF
+#else
+#define DebugAccelF(...) /* */
+#endif
+
+/********************************
+ *  Init/Uninit
+ *******************************/
+
+/* some int which is not a profile number */
+#define PROFILE_UNINITIALIZE (-100)
+
+/**
+ * Init DeviceVelocity struct so it should match the average case
+ */
+void
+InitVelocityData(DeviceVelocityPtr vel)
+{
+    memset(vel, 0, sizeof(DeviceVelocityRec));
+
+    vel->corr_mul = 10.0;      /* dots per 10 milisecond should be usable */
+    vel->const_acceleration = 1.0;   /* no acceleration/deceleration  */
+    vel->reset_time = 300;
+    vel->use_softening = 1;
+    vel->min_acceleration = 1.0; /* don't decelerate */
+    vel->max_rel_diff = 0.2;
+    vel->max_diff = 1.0;
+    vel->initial_range = 2;
+    vel->average_accel = TRUE;
+    SetAccelerationProfile(vel, AccelProfileClassic);
+    InitTrackers(vel, 16);
+}
+
+
+/**
+ * Clean up DeviceVelocityRec
+ */
+void
+FreeVelocityData(DeviceVelocityPtr vel){
+    free(vel->tracker);
+    SetAccelerationProfile(vel, PROFILE_UNINITIALIZE);
+}
+
+
+/**
+ * Init predictable scheme
+ */
+Bool
+InitPredictableAccelerationScheme(DeviceIntPtr dev,
+                                  ValuatorAccelerationPtr protoScheme) {
+    DeviceVelocityPtr vel;
+    ValuatorAccelerationRec scheme;
+    PredictableAccelSchemePtr schemeData;
+    scheme = *protoScheme;
+    vel = calloc(1, sizeof(DeviceVelocityRec));
+    schemeData = calloc(1, sizeof(PredictableAccelSchemeRec));
+    if (!vel || !schemeData)
+        return FALSE;
+    InitVelocityData(vel);
+    schemeData->vel = vel;
+    scheme.accelData = schemeData;
+    if (!InitializePredictableAccelerationProperties(dev, vel, schemeData))
+        return FALSE;
+    /* all fine, assign scheme to device */
+    dev->valuator->accelScheme = scheme;
+    return TRUE;
+}
+
+
+/**
+ *  Uninit scheme
+ */
+void
+AccelerationDefaultCleanup(DeviceIntPtr dev)
+{
+    DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
+    if (vel) {
+        /* the proper guarantee would be that we're not inside of
+         * AccelSchemeProc(), but that seems impossible. Schemes don't get
+         * switched often anyway.
+         */
+        OsBlockSignals();
+        dev->valuator->accelScheme.AccelSchemeProc = NULL;
+        FreeVelocityData(vel);
+        free(vel);
+        DeletePredictableAccelerationProperties(dev,
+            (PredictableAccelSchemePtr) dev->valuator->accelScheme.accelData);
+        free(dev->valuator->accelScheme.accelData);
+        dev->valuator->accelScheme.accelData = NULL;
+        OsReleaseSignals();
+    }
+}
+
+
+/*************************
+ * Input property support
+ ************************/
+
+/**
+ * choose profile
+ */
+static int
+AccelSetProfileProperty(DeviceIntPtr dev, Atom atom,
+                        XIPropertyValuePtr val, BOOL checkOnly)
+{
+    DeviceVelocityPtr vel;
+    int profile, *ptr = &profile;
+    int rc;
+    int nelem = 1;
+
+    if (atom != XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER))
+        return Success;
+
+    vel = GetDevicePredictableAccelData(dev);
+    if (!vel)
+        return BadValue;
+    rc = XIPropToInt(val, &nelem, &ptr);
+
+    if(checkOnly)
+    {
+        if (rc)
+            return rc;
+
+        if (GetAccelerationProfile(vel, profile) == NULL)
+            return BadValue;
+    } else
+	SetAccelerationProfile(vel, profile);
+
+    return Success;
+}
+
+static long
+AccelInitProfileProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
+{
+    int profile = vel->statistics.profile_number;
+    Atom prop_profile_number = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
+
+    XIChangeDeviceProperty(dev, prop_profile_number, XA_INTEGER, 32,
+                           PropModeReplace, 1, &profile, FALSE);
+    XISetDevicePropertyDeletable(dev, prop_profile_number, FALSE);
+    return XIRegisterPropertyHandler(dev, AccelSetProfileProperty, NULL, NULL);
+}
+
+/**
+ * constant deceleration
+ */
+static int
+AccelSetDecelProperty(DeviceIntPtr dev, Atom atom,
+                      XIPropertyValuePtr val, BOOL checkOnly)
+{
+    DeviceVelocityPtr vel;
+    float v, *ptr = &v;
+    int rc;
+    int nelem = 1;
+
+    if (atom != XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION))
+        return Success;
+
+    vel = GetDevicePredictableAccelData(dev);
+    if (!vel)
+        return BadValue;
+    rc = XIPropToFloat(val, &nelem, &ptr);
+
+    if(checkOnly)
+    {
+        if (rc)
+            return rc;
+	return (v >= 1.0f) ? Success : BadValue;
+    }
+
+    if(v >= 1.0f)
+	vel->const_acceleration = 1/v;
+
+    return Success;
+}
+
+static long
+AccelInitDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
+{
+    float fval = 1.0/vel->const_acceleration;
+    Atom prop_const_decel = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
+    XIChangeDeviceProperty(dev, prop_const_decel,
+                           XIGetKnownProperty(XATOM_FLOAT), 32,
+                           PropModeReplace, 1, &fval, FALSE);
+    XISetDevicePropertyDeletable(dev, prop_const_decel, FALSE);
+    return XIRegisterPropertyHandler(dev, AccelSetDecelProperty, NULL, NULL);
+}
+
+
+/**
+ * adaptive deceleration
+ */
+static int
+AccelSetAdaptDecelProperty(DeviceIntPtr dev, Atom atom,
+                           XIPropertyValuePtr val, BOOL checkOnly)
+{
+    DeviceVelocityPtr veloc;
+    float v, *ptr = &v;
+    int rc;
+    int nelem = 1;
+
+    if (atom != XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION))
+        return Success;
+
+    veloc = GetDevicePredictableAccelData(dev);
+    if (!veloc)
+        return BadValue;
+    rc = XIPropToFloat(val, &nelem, &ptr);
+
+    if(checkOnly)
+    {
+        if (rc)
+            return rc;
+	return (v >= 1.0f) ? Success : BadValue;
+    }
+
+    if(v >= 1.0f)
+	veloc->min_acceleration = 1/v;
+
+    return Success;
+}
+
+static long
+AccelInitAdaptDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
+{
+    float fval = 1.0/vel->min_acceleration;
+    Atom prop_adapt_decel = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
+
+    XIChangeDeviceProperty(dev, prop_adapt_decel, XIGetKnownProperty(XATOM_FLOAT), 32,
+                           PropModeReplace, 1, &fval, FALSE);
+    XISetDevicePropertyDeletable(dev, prop_adapt_decel, FALSE);
+    return XIRegisterPropertyHandler(dev, AccelSetAdaptDecelProperty, NULL, NULL);
+}
+
+
+/**
+ * velocity scaling
+ */
+static int
+AccelSetScaleProperty(DeviceIntPtr dev, Atom atom,
+                      XIPropertyValuePtr val, BOOL checkOnly)
+{
+    DeviceVelocityPtr vel;
+    float v, *ptr = &v;
+    int rc;
+    int nelem = 1;
+
+    if (atom != XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING))
+        return Success;
+
+    vel = GetDevicePredictableAccelData(dev);
+    if (!vel)
+        return BadValue;
+    rc = XIPropToFloat(val, &nelem, &ptr);
+
+    if (checkOnly)
+    {
+        if (rc)
+            return rc;
+
+        return (v > 0) ? Success : BadValue;
+    }
+
+    if(v > 0)
+	vel->corr_mul = v;
+
+    return Success;
+}
+
+static long
+AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
+{
+    float fval = vel->corr_mul;
+    Atom prop_velo_scale = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
+
+    XIChangeDeviceProperty(dev, prop_velo_scale, XIGetKnownProperty(XATOM_FLOAT), 32,
+                           PropModeReplace, 1, &fval, FALSE);
+    XISetDevicePropertyDeletable(dev, prop_velo_scale, FALSE);
+    return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
+}
+
+static BOOL
+InitializePredictableAccelerationProperties(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr  vel,
+    PredictableAccelSchemePtr schemeData)
+{
+    int num_handlers = 4;
+    if(!vel)
+        return FALSE;
+
+    schemeData->prop_handlers = calloc(num_handlers, sizeof(long));
+    if (!schemeData->prop_handlers)
+        return FALSE;
+    schemeData->num_prop_handlers = num_handlers;
+    schemeData->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
+    schemeData->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
+    schemeData->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
+    schemeData->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
+
+    return TRUE;
+}
+
+BOOL
+DeletePredictableAccelerationProperties(
+    DeviceIntPtr dev,
+    PredictableAccelSchemePtr scheme)
+{
+    DeviceVelocityPtr vel;
+    Atom prop;
+    int i;
+
+    prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
+    XIDeleteDeviceProperty(dev, prop, FALSE);
+    prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
+    XIDeleteDeviceProperty(dev, prop, FALSE);
+    prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
+    XIDeleteDeviceProperty(dev, prop, FALSE);
+    prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
+    XIDeleteDeviceProperty(dev, prop, FALSE);
+
+    vel = GetDevicePredictableAccelData(dev);
+    if (vel) {
+        for (i = 0; i < scheme->num_prop_handlers; i++)
+            if (scheme->prop_handlers[i])
+                XIUnregisterPropertyHandler(dev, scheme->prop_handlers[i]);
+    }
+
+    free(scheme->prop_handlers);
+    scheme->prop_handlers = NULL;
+    scheme->num_prop_handlers = 0;
+    return TRUE;
+}
+
+/*********************
+ * Tracking logic
+ ********************/
+
+void
+InitTrackers(DeviceVelocityPtr vel, int ntracker)
+{
+    if(ntracker < 1){
+	ErrorF("(dix ptracc) invalid number of trackers\n");
+	return;
+    }
+    free(vel->tracker);
+    vel->tracker = (MotionTrackerPtr)calloc(ntracker, sizeof(MotionTracker));
+    vel->num_tracker = ntracker;
+}
+
+enum directions {
+    N   = (1 << 0),
+    NE  = (1 << 1),
+    E   = (1 << 2),
+    SE  = (1 << 3),
+    S   = (1 << 4),
+    SW  = (1 << 5),
+    W   = (1 << 6),
+    NW  = (1 << 7),
+    UNDEFINED = 0xFF
+};
+/**
+ * return a bit field of possible directions.
+ * There's no reason against widening to more precise directions (<45 degrees),
+ * should it not perform well. All this is needed for is sort out non-linear
+ * motion, so precision isn't paramount. However, one should not flag direction
+ * too narrow, since it would then cut the linear segment to zero size way too
+ * often.
+ *
+ * @return A bitmask for N, NE, S, SE, etc. indicating the directions for
+ * this movement.
+ */
+static int
+DoGetDirection(int dx, int dy){
+    int dir = 0;
+
+    /* on insignificant mickeys, flag 135 degrees */
+    if(abs(dx) < 2 && abs(dy) < 2){
+        /* first check diagonal cases */
+        if(dx > 0 && dy > 0)
+            dir = E | SE | S;
+        else if(dx > 0 && dy < 0)
+            dir =  N | NE | E;
+        else if(dx < 0 && dy < 0)
+            dir =  W | NW | N;
+        else if(dx < 0 && dy > 0)
+            dir =  W | SW | S;
+        /* check axis-aligned directions */
+        else if(dx > 0)
+            dir =  NE | E | SE;
+        else if(dx < 0)
+            dir =  NW | W | SW;
+        else if(dy > 0)
+            dir =  SE | S | SW;
+        else if(dy < 0)
+            dir =  NE | N | NW;
+        else
+            dir = UNDEFINED; /* shouldn't happen */
+    } else { /* compute angle and set appropriate flags */
+        float r;
+        int i1, i2;
+
+#ifdef _ISOC99_SOURCE
+        r = atan2f(dy, dx);
+#else
+        r = atan2(dy, dx);
+#endif
+        /* find direction.
+         *
+         * Add 360° to avoid r become negative since C has no well-defined
+         * modulo for such cases. Then divide by 45° to get the octant
+         * number,  e.g.
+         *          0 <= r <= 1 is [0-45]°
+         *          1 <= r <= 2 is [45-90]°
+         *          etc.
+         * But we add extra 90° to match up with our N, S, etc. defines up
+         * there, rest stays the same.
+         */
+        r = (r+(M_PI*2.5))/(M_PI/4);
+        /* this intends to flag 2 directions (45 degrees),
+         * except on very well-aligned mickeys. */
+        i1 = (int)(r+0.1) % 8;
+        i2 = (int)(r+0.9) % 8;
+        if(i1 < 0 || i1 > 7 || i2 < 0 || i2 > 7)
+            dir = UNDEFINED; /* shouldn't happen */
+        else
+            dir = (1 << i1 | 1 << i2);
+    }
+    return dir;
+}
+
+#define DIRECTION_CACHE_RANGE 5
+#define DIRECTION_CACHE_SIZE (DIRECTION_CACHE_RANGE*2+1)
+
+/* cache DoGetDirection().
+ * To avoid excessive use of direction calculation, cache the values for
+ * [-5..5] for both x/y. Anything outside of that is calcualted on the fly.
+ *
+ * @return A bitmask for N, NE, S, SE, etc. indicating the directions for
+ * this movement.
+ */
+static int
+GetDirection(int dx, int dy){
+    static int cache[DIRECTION_CACHE_SIZE][DIRECTION_CACHE_SIZE];
+    int dir;
+    if (abs(dx) <= DIRECTION_CACHE_RANGE &&
+	abs(dy) <= DIRECTION_CACHE_RANGE) {
+	/* cacheable */
+	dir = cache[DIRECTION_CACHE_RANGE+dx][DIRECTION_CACHE_RANGE+dy];
+	if(dir == 0) {
+	    dir = DoGetDirection(dx, dy);
+	    cache[DIRECTION_CACHE_RANGE+dx][DIRECTION_CACHE_RANGE+dy] = dir;
+	}
+    }else{
+	/* non-cacheable */
+	dir = DoGetDirection(dx, dy);
+    }
+
+    return dir;
+}
+
+#undef DIRECTION_CACHE_RANGE
+#undef DIRECTION_CACHE_SIZE
+
+
+/* convert offset (age) to array index */
+#define TRACKER_INDEX(s, d) (((s)->num_tracker + (s)->cur_tracker - (d)) % (s)->num_tracker)
+#define TRACKER(s, d) &(s)->tracker[TRACKER_INDEX(s,d)]
+
+/**
+ * Add the delta motion to each tracker, then reset the latest tracker to
+ * 0/0 and set it as the current one.
+ */
+static inline void
+FeedTrackers(DeviceVelocityPtr vel, int dx, int dy, int cur_t)
+{
+    int n;
+    for(n = 0; n < vel->num_tracker; n++){
+	vel->tracker[n].dx += dx;
+	vel->tracker[n].dy += dy;
+    }
+    n = (vel->cur_tracker + 1) % vel->num_tracker;
+    vel->tracker[n].dx = 0;
+    vel->tracker[n].dy = 0;
+    vel->tracker[n].time = cur_t;
+    vel->tracker[n].dir = GetDirection(dx, dy);
+    DebugAccelF("(dix prtacc) motion [dx: %i dy: %i dir:%i diff: %i]\n",
+                dx, dy, vel->tracker[n].dir,
+                cur_t - vel->tracker[vel->cur_tracker].time);
+    vel->cur_tracker = n;
+}
+
+/**
+ * calc velocity for given tracker, with
+ * velocity scaling.
+ * This assumes linear motion.
+ */
+static float
+CalcTracker(const MotionTracker *tracker, int cur_t){
+    float dist = sqrt(tracker->dx * tracker->dx + tracker->dy * tracker->dy);
+    int dtime = cur_t - tracker->time;
+    if(dtime > 0)
+	return dist / dtime;
+    else
+	return 0;/* synonymous for NaN, since we're not C99 */
+}
+
+/* find the most plausible velocity. That is, the most distant
+ * (in time) tracker which isn't too old, the movement vector was
+ * in the same octant, and where the velocity is within an
+ * acceptable range to the inital velocity.
+ *
+ * @return The tracker's velocity or 0 if the above conditions are unmet
+ */
+static float
+QueryTrackers(DeviceVelocityPtr vel, int cur_t){
+    int offset, dir = UNDEFINED, used_offset = -1, age_ms;
+    /* initial velocity: a low-offset, valid velocity */
+    float initial_velocity = 0, result = 0, velocity_diff;
+    float velocity_factor =  vel->corr_mul * vel->const_acceleration; /* premultiply */
+    /* loop from current to older data */
+    for(offset = 1; offset < vel->num_tracker; offset++){
+	MotionTracker *tracker = TRACKER(vel, offset);
+	float tracker_velocity;
+
+	age_ms = cur_t - tracker->time;
+
+	/* bail out if data is too old and protect from overrun */
+	if (age_ms >= vel->reset_time || age_ms < 0) {
+	    DebugAccelF("(dix prtacc) query: tracker too old\n");
+	    break;
+	}
+
+	/*
+	 * this heuristic avoids using the linear-motion velocity formula
+	 * in CalcTracker() on motion that isn't exactly linear. So to get
+	 * even more precision we could subdivide as a final step, so possible
+	 * non-linearities are accounted for.
+	 */
+	dir &= tracker->dir;
+	if(dir == 0){ /* we've changed octant of movement (e.g. NE → NW) */
+	    DebugAccelF("(dix prtacc) query: no longer linear\n");
+	    /* instead of breaking it we might also inspect the partition after,
+	     * but actual improvement with this is probably rare. */
+	    break;
+	}
+
+	tracker_velocity = CalcTracker(tracker, cur_t) * velocity_factor;
+
+	if ((initial_velocity == 0 || offset <= vel->initial_range) && tracker_velocity != 0) {
+	    /* set initial velocity and result */
+	    result = initial_velocity = tracker_velocity;
+	    used_offset = offset;
+	} else if (initial_velocity != 0 && tracker_velocity != 0) {
+	    velocity_diff = fabs(initial_velocity - tracker_velocity);
+
+	    if (velocity_diff > vel->max_diff &&
+		velocity_diff/(initial_velocity + tracker_velocity) >= vel->max_rel_diff) {
+		/* we're not in range, quit - it won't get better. */
+		DebugAccelF("(dix prtacc) query: tracker too different:"
+		            " old %2.2f initial %2.2f diff: %2.2f\n",
+		            tracker_velocity, initial_velocity, velocity_diff);
+		break;
+	    }
+	    /* we're in range with the initial velocity,
+	     * so this result is likely better
+	     * (it contains more information). */
+	    result = tracker_velocity;
+	    used_offset = offset;
+	}
+    }
+    if(offset == vel->num_tracker){
+	DebugAccelF("(dix prtacc) query: last tracker in effect\n");
+	used_offset = vel->num_tracker-1;
+    }
+#ifdef PTRACCEL_DEBUGGING
+    if(used_offset >= 0){
+	MotionTracker *tracker = TRACKER(vel, used_offset);
+	DebugAccelF("(dix prtacc) result: offset %i [dx: %i dy: %i diff: %i]\n",
+	            used_offset, tracker->dx, tracker->dy, cur_t - tracker->time);
+    }
+#endif
+    return result;
+}
+
+#undef TRACKER_INDEX
+#undef TRACKER
+
+/**
+ * Perform velocity approximation based on 2D 'mickeys' (mouse motion delta).
+ * return true if non-visible state reset is suggested
+ */
+BOOL
+ProcessVelocityData2D(
+    DeviceVelocityPtr vel,
+    int dx,
+    int dy,
+    int time)
+{
+    float velocity;
+
+    vel->last_velocity = vel->velocity;
+
+    FeedTrackers(vel, dx, dy, time);
+
+    velocity = QueryTrackers(vel, time);
+
+    vel->velocity = velocity;
+    return velocity == 0;
+}
+
+/**
+ * this flattens significant ( > 1) mickeys a little bit for more steady
+ * constant-velocity response
+ */
+static inline float
+ApplySimpleSoftening(int prev_delta, int delta)
+{
+    float result = delta;
+
+    if (delta < -1 || delta > 1) {
+	if (delta > prev_delta)
+	    result -= 0.5;
+	else if (delta < prev_delta)
+	    result += 0.5;
+    }
+    return result;
+}
+
+
+/**
+ * Soften the delta based on previous deltas stored in vel.
+ *
+ * @param[in,out] fdx Delta X, modified in-place.
+ * @param[in,out] fdx Delta Y, modified in-place.
+ */
+static void
+ApplySoftening(
+        DeviceVelocityPtr vel,
+        float* fdx,
+        float* fdy)
+{
+    if (vel->use_softening) {
+        *fdx = ApplySimpleSoftening(vel->last_dx, *fdx);
+        *fdy = ApplySimpleSoftening(vel->last_dy, *fdy);
+    }
+}
+
+static void
+ApplyConstantDeceleration(DeviceVelocityPtr vel, float *fdx, float *fdy)
+{
+    *fdx *= vel->const_acceleration;
+    *fdy *= vel->const_acceleration;
+}
+
+/*
+ * compute the acceleration for given velocity and enforce min_acceleartion
+ */
+float
+BasicComputeAcceleration(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc){
+
+    float result;
+    result = vel->Profile(dev, vel, velocity, threshold, acc);
+
+    /* enforce min_acceleration */
+    if (result < vel->min_acceleration)
+	result = vel->min_acceleration;
+    return result;
+}
+
+/**
+ * Compute acceleration. Takes into account averaging, nv-reset, etc.
+ * If the velocity has changed, an average is taken of 6 velocity factors:
+ * current velocity, last velocity and 4 times the average between the two.
+ */
+static float
+ComputeAcceleration(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float threshold,
+    float acc){
+    float result;
+
+    if(vel->velocity <= 0){
+	DebugAccelF("(dix ptracc) profile skipped\n");
+        /*
+         * If we have no idea about device velocity, don't pretend it.
+         */
+	return 1;
+    }
+
+    if(vel->average_accel && vel->velocity != vel->last_velocity){
+	/* use simpson's rule to average acceleration between
+	 * current and previous velocity.
+	 * Though being the more natural choice, it causes a minor delay
+	 * in comparison, so it can be disabled. */
+	result = BasicComputeAcceleration(
+	          dev, vel, vel->velocity, threshold, acc);
+	result += BasicComputeAcceleration(
+	          dev, vel, vel->last_velocity, threshold, acc);
+	result += 4.0f * BasicComputeAcceleration(dev, vel,
+	                   (vel->last_velocity + vel->velocity) / 2,
+	                   threshold, acc);
+	result /= 6.0f;
+	DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
+	            vel->velocity, vel->last_velocity, result);
+    }else{
+	result = BasicComputeAcceleration(dev, vel,
+	                                  vel->velocity, threshold, acc);
+	DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
+               vel->velocity, res);
+    }
+
+    return result;
+}
+
+
+/*****************************************
+ *  Acceleration functions and profiles
+ ****************************************/
+
+/**
+ * Polynomial function similar previous one, but with f(1) = 1
+ */
+static float
+PolynomialAccelerationProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float ignored,
+    float acc)
+{
+   return pow(velocity, (acc - 1.0) * 0.5);
+}
+
+
+/**
+ * returns acceleration for velocity.
+ * This profile selects the two functions like the old scheme did
+ */
+static float
+ClassicProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc)
+{
+    if (threshold > 0) {
+	return SimpleSmoothProfile (dev,
+	                            vel,
+	                            velocity,
+                                    threshold,
+                                    acc);
+    } else {
+	return PolynomialAccelerationProfile (dev,
+	                                      vel,
+	                                      velocity,
+                                              0,
+                                              acc);
+    }
+}
+
+
+/**
+ * Power profile
+ * This has a completely smooth transition curve, i.e. no jumps in the
+ * derivatives.
+ *
+ * This has the expense of overall response dependency on min-acceleration.
+ * In effect, min_acceleration mimics const_acceleration in this profile.
+ */
+static float
+PowerProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc)
+{
+    float vel_dist;
+
+    acc = (acc-1.0) * 0.1f + 1.0; /* without this, acc of 2 is unuseable */
+
+    if (velocity <= threshold)
+        return vel->min_acceleration;
+    vel_dist = velocity - threshold;
+    return (pow(acc, vel_dist)) * vel->min_acceleration;
+}
+
+
+/**
+ * just a smooth function in [0..1] -> [0..1]
+ *  - point symmetry at 0.5
+ *  - f'(0) = f'(1) = 0
+ *  - starts faster than a sinoid
+ *  - smoothness C1 (Cinf if you dare to ignore endpoints)
+ */
+static inline float
+CalcPenumbralGradient(float x){
+    x *= 2.0f;
+    x -= 1.0f;
+    return 0.5f + (x * sqrt(1.0f - x*x) + asin(x))/M_PI;
+}
+
+
+/**
+ * acceleration function similar to classic accelerated/unaccelerated,
+ * but with smooth transition in between (and towards zero for adaptive dec.).
+ */
+static float
+SimpleSmoothProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc)
+{
+    if(velocity < 1.0f)
+        return CalcPenumbralGradient(0.5 + velocity*0.5) * 2.0f - 1.0f;
+    if(threshold < 1.0f)
+        threshold = 1.0f;
+    if (velocity <= threshold)
+        return 1;
+    velocity /= threshold;
+    if (velocity >= acc)
+        return acc;
+    else
+        return 1.0f + (CalcPenumbralGradient(velocity/acc) * (acc - 1.0f));
+}
+
+
+/**
+ * This profile uses the first half of the penumbral gradient as a start
+ * and then scales linearly.
+ */
+static float
+SmoothLinearProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc)
+{
+    float res, nv;
+
+    if(acc > 1.0f)
+        acc -= 1.0f; /*this is so acc = 1 is no acceleration */
+    else
+        return 1.0f;
+
+    nv = (velocity - threshold) * acc * 0.5f;
+
+    if(nv < 0){
+        res = 0;
+    }else if(nv < 2){
+        res = CalcPenumbralGradient(nv*0.25f)*2.0f;
+    }else{
+        nv -= 2.0f;
+        res = nv * 2.0f / M_PI  /* steepness of gradient at 0.5 */
+              + 1.0f; /* gradient crosses 2|1 */
+    }
+    res += vel->min_acceleration;
+    return res;
+}
+
+
+/**
+ * From 0 to threshold, the response graduates smoothly from min_accel to
+ * acceleration. Beyond threshold it is exactly the specified acceleration.
+ */
+static float
+SmoothLimitedProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc)
+{
+    float res;
+
+    if(velocity >= threshold || threshold == 0.0f)
+	return acc;
+
+    velocity /= threshold; /* should be [0..1[ now */
+
+    res = CalcPenumbralGradient(velocity) * (acc - vel->min_acceleration);
+
+    return vel->min_acceleration + res;
+}
+
+
+static float
+LinearProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc)
+{
+    return acc * velocity;
+}
+
+static float
+NoProfile(
+    DeviceIntPtr dev,
+    DeviceVelocityPtr vel,
+    float velocity,
+    float threshold,
+    float acc)
+{
+    return 1.0f;
+}
+
+static PointerAccelerationProfileFunc
+GetAccelerationProfile(
+    DeviceVelocityPtr vel,
+    int profile_num)
+{
+    switch(profile_num){
+        case AccelProfileClassic:
+            return ClassicProfile;
+        case AccelProfileDeviceSpecific:
+            return vel->deviceSpecificProfile;
+        case AccelProfilePolynomial:
+            return PolynomialAccelerationProfile;
+        case AccelProfileSmoothLinear:
+            return SmoothLinearProfile;
+        case AccelProfileSimple:
+            return SimpleSmoothProfile;
+        case AccelProfilePower:
+            return PowerProfile;
+        case AccelProfileLinear:
+            return LinearProfile;
+        case AccelProfileSmoothLimited:
+            return SmoothLimitedProfile;
+        case AccelProfileNone:
+            return NoProfile;
+        default:
+            return NULL;
+    }
+}
+
+/**
+ * Set the profile by number.
+ * Intended to make profiles exchangeable at runtime.
+ * If you created a profile, give it a number here and in the header to
+ * make it selectable. In case some profile-specific init is needed, here
+ * would be a good place, since FreeVelocityData() also calls this with
+ * PROFILE_UNINITIALIZE.
+ *
+ * returns FALSE if profile number is unavailable, TRUE otherwise.
+ */
+int
+SetAccelerationProfile(
+    DeviceVelocityPtr vel,
+    int profile_num)
+{
+    PointerAccelerationProfileFunc profile;
+    profile = GetAccelerationProfile(vel, profile_num);
+
+    if(profile == NULL && profile_num != PROFILE_UNINITIALIZE)
+	return FALSE;
+
+    /* Here one could free old profile-private data */
+    free(vel->profile_private);
+    vel->profile_private = NULL;
+    /* Here one could init profile-private data */
+    vel->Profile = profile;
+    vel->statistics.profile_number = profile_num;
+    return TRUE;
+}
+
+/**********************************************
+ * driver interaction
+ **********************************************/
+
+
+/**
+ * device-specific profile
+ *
+ * The device-specific profile is intended as a hook for a driver
+ * which may want to provide an own acceleration profile.
+ * It should not rely on profile-private data, instead
+ * it should do init/uninit in the driver (ie. with DEVICE_INIT and friends).
+ * Users may override or choose it.
+ */
+void
+SetDeviceSpecificAccelerationProfile(
+        DeviceVelocityPtr vel,
+        PointerAccelerationProfileFunc profile)
+{
+    if(vel)
+	vel->deviceSpecificProfile = profile;
+}
+
+/**
+ * Use this function to obtain a DeviceVelocityPtr for a device. Will return NULL if
+ * the predictable acceleration scheme is not in effect.
+ */
+DeviceVelocityPtr
+GetDevicePredictableAccelData(
+	DeviceIntPtr dev)
+{
+    /*sanity check*/
+    if(!dev){
+	ErrorF("[dix] accel: DeviceIntPtr was NULL");
+	return NULL;
+    }
+    if( dev->valuator &&
+	dev->valuator->accelScheme.AccelSchemeProc ==
+	    acceleratePointerPredictable &&
+	dev->valuator->accelScheme.accelData != NULL){
+
+	return ((PredictableAccelSchemePtr)
+		dev->valuator->accelScheme.accelData)->vel;
+    }
+    return NULL;
+}
+
+/********************************
+ *  acceleration schemes
+ *******************************/
+
+/**
+ * Modifies valuators in-place.
+ * This version employs a velocity approximation algorithm to
+ * enable fine-grained predictable acceleration profiles.
+ */
+void
+acceleratePointerPredictable(
+    DeviceIntPtr dev,
+    ValuatorMask* val,
+    CARD32 evtime)
+{
+    int dx = 0, dy = 0, tmpi;
+    DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
+    Bool soften = TRUE;
+
+    if (!velocitydata)
+        return;
+
+    if (velocitydata->statistics.profile_number == AccelProfileNone &&
+        velocitydata->const_acceleration == 1.0f) {
+        return; /*we're inactive anyway, so skip the whole thing.*/
+    }
+
+    if (valuator_mask_isset(val, 0)) {
+        dx = valuator_mask_get(val, 0);
+    }
+
+    if (valuator_mask_isset(val, 1)) {
+        dy = valuator_mask_get(val, 1);
+    }
+
+    if (dx || dy){
+        /* reset non-visible state? */
+        if (ProcessVelocityData2D(velocitydata, dx , dy, evtime)) {
+            soften = FALSE;
+        }
+
+        if (dev->ptrfeed && dev->ptrfeed->ctrl.num) {
+            float mult;
+
+            /* invoke acceleration profile to determine acceleration */
+            mult = ComputeAcceleration (dev, velocitydata,
+                                        dev->ptrfeed->ctrl.threshold,
+                                        (float)dev->ptrfeed->ctrl.num /
+                                            (float)dev->ptrfeed->ctrl.den);
+
+            if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
+                float fdx = dx,
+                      fdy = dy;
+
+                if (mult > 1.0f && soften)
+                    ApplySoftening(velocitydata, &fdx, &fdy);
+                ApplyConstantDeceleration(velocitydata, &fdx, &fdy);
+
+                /* Calculate the new delta (with accel) and drop it back
+                 * into the valuator masks */
+                if (dx) {
+                    float tmp;
+                    tmp = mult * fdx + dev->last.remainder[0];
+                    /* Since it may not be apparent: lrintf() does not offer
+                     * strong statements about rounding; however because we
+                     * process each axis conditionally, there's no danger
+                     * of a toggling remainder. Its lack of guarantees likely
+                     * makes it faster on the average target. */
+                    tmpi = lrintf(tmp);
+                    valuator_mask_set(val, 0, tmpi);
+                    dev->last.remainder[0] = tmp - (float)tmpi;
+                }
+                if (dy) {
+                    float tmp;
+                    tmp = mult * fdy + dev->last.remainder[1];
+                    tmpi = lrintf(tmp);
+                    valuator_mask_set(val, 1, tmpi);
+                    dev->last.remainder[1] = tmp - (float)tmpi;
+                }
+                DebugAccelF("pos (%i | %i) remainders x: %.3f y: %.3f delta x:%.3f y:%.3f\n",
+                            *px, *py, dev->last.remainder[0], dev->last.remainder[1], fdx, fdy);
+            }
+        }
+    }
+    /* remember last motion delta (for softening/slow movement treatment) */
+    velocitydata->last_dx = dx;
+    velocitydata->last_dy = dy;
+}
+
+
+
+/**
+ * Originally a part of xf86PostMotionEvent; modifies valuators
+ * in-place. Retained mostly for embedded scenarios.
+ */
+void
+acceleratePointerLightweight(
+    DeviceIntPtr dev,
+    ValuatorMask* val,
+    CARD32 ignored)
+{
+    float mult = 0.0, tmpf;
+    int dx = 0, dy = 0, tmpi;
+
+    if (valuator_mask_isset(val, 0)) {
+        dx = valuator_mask_get(val, 0);
+    }
+
+    if (valuator_mask_isset(val, 1)) {
+        dy = valuator_mask_get(val, 1);
+    }
+
+    if (!dx && !dy)
+        return;
+
+    if (dev->ptrfeed && dev->ptrfeed->ctrl.num) {
+        /* modeled from xf86Events.c */
+        if (dev->ptrfeed->ctrl.threshold) {
+            if ((abs(dx) + abs(dy)) >= dev->ptrfeed->ctrl.threshold) {
+                tmpf = ((float)dx *
+                        (float)(dev->ptrfeed->ctrl.num)) /
+                       (float)(dev->ptrfeed->ctrl.den) +
+                       dev->last.remainder[0];
+                if (dx) {
+                    tmpi = (int) tmpf;
+                    valuator_mask_set(val, 0, tmpi);
+                    dev->last.remainder[0] = tmpf - (float)tmpi;
+                }
+
+                tmpf = ((float)dy *
+                        (float)(dev->ptrfeed->ctrl.num)) /
+                       (float)(dev->ptrfeed->ctrl.den) +
+                       dev->last.remainder[1];
+                if (dy) {
+                    tmpi = (int) tmpf;
+                    valuator_mask_set(val, 1, tmpi);
+                    dev->last.remainder[1] = tmpf - (float)tmpi;
+                }
+            }
+        }
+        else {
+            mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
+                       ((float)(dev->ptrfeed->ctrl.num) /
+                        (float)(dev->ptrfeed->ctrl.den) - 1.0) /
+                       2.0) / 2.0;
+            if (dx) {
+                tmpf = mult * (float)dx +
+                       dev->last.remainder[0];
+                tmpi = (int) tmpf;
+                valuator_mask_set(val, 0, tmpi);
+                dev->last.remainder[0] = tmpf - (float)tmpi;
+            }
+            if (dy) {
+                tmpf = mult * (float)dy +
+                       dev->last.remainder[1];
+                tmpi = (int)tmpf;
+                valuator_mask_set(val, 1, tmpi);
+                dev->last.remainder[1] = tmpf - (float)tmpi;
+            }
+        }
+    }
+}
diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c
index 339ab403b..eb9f0492a 100644
--- a/xorg-server/dix/resource.c
+++ b/xorg-server/dix/resource.c
@@ -1,963 +1,963 @@
-/************************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice 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
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-********************************************************/
-/* The panoramix components contained the following notice */
-/*****************************************************************
-
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-
-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.
-
-The above copyright notice and this permission notice 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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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.
-
-Except as contained in this notice, the name of Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-/* XSERVER_DTRACE additions:
- * Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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.
- */
-
-/*	Routines to manage various kinds of resources:
- *
- *	CreateNewResourceType, CreateNewResourceClass, InitClientResources,
- *	FakeClientID, AddResource, FreeResource, FreeClientResources,
- *	FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange
- */
-
-/* 
- *      A resource ID is a 32 bit quantity, the upper 2 bits of which are
- *	off-limits for client-visible resources.  The next 8 bits are
- *      used as client ID, and the low 22 bits come from the client.
- *	A resource ID is "hashed" by extracting and xoring subfields
- *      (varying with the size of the hash table).
- *
- *      It is sometimes necessary for the server to create an ID that looks
- *      like it belongs to a client.  This ID, however,  must not be one
- *      the client actually can create, or we have the potential for conflict.
- *      The 31st bit of the ID is reserved for the server's use for this
- *      purpose.  By setting CLIENT_ID(id) to the client, the SERVER_BIT to
- *      1, and an otherwise arbitrary ID in the low 22 bits, we can create a
- *      resource "owned" by the client.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "os.h"
-#include "resource.h"
-#include "dixstruct.h" 
-#include "opaque.h"
-#include "windowstr.h"
-#include "dixfont.h"
-#include "colormap.h"
-#include "inputstr.h"
-#include "dixevents.h"
-#include "dixgrabs.h"
-#include "cursor.h"
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-#include "xace.h"
-#include <assert.h>
-#include "registry.h"
-
-#ifdef XSERVER_DTRACE
-#include <sys/types.h>
-typedef const char *string;
-#include "Xserver-dtrace.h"
-
-#define TypeNameString(t) LookupResourceName(t)
-#endif
-
-static void RebuildTable(
-    int /*client*/
-);
-
-#define SERVER_MINID 32
-
-#define INITBUCKETS 64
-#define INITHASHSIZE 6
-#define MAXHASHSIZE 11
-
-typedef struct _Resource {
-    struct _Resource	*next;
-    XID			id;
-    RESTYPE		type;
-    pointer		value;
-} ResourceRec, *ResourcePtr;
-
-typedef struct _ClientResource {
-    ResourcePtr *resources;
-    int		elements;
-    int		buckets;
-    int		hashsize;	/* log(2)(buckets) */
-    XID		fakeID;
-    XID		endFakeID;
-} ClientResourceRec;
-
-RESTYPE lastResourceType;
-static RESTYPE lastResourceClass;
-RESTYPE TypeMask;
-
-struct ResourceType {
-    DeleteType deleteFunc;
-    int errorValue;
-};
-
-static struct ResourceType *resourceTypes;
-static const struct ResourceType predefTypes[] = {
-    [RT_NONE & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = (DeleteType)NoopDDA,
-	.errorValue = BadValue,
-    },
-    [RT_WINDOW & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = DeleteWindow,
-	.errorValue = BadWindow,
-    },
-    [RT_PIXMAP & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = dixDestroyPixmap,
-	.errorValue = BadPixmap,
-    },
-    [RT_GC & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = FreeGC,
-	.errorValue = BadGC,
-    },
-    [RT_FONT & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = CloseFont,
-	.errorValue = BadFont,
-    },
-    [RT_CURSOR & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = FreeCursor,
-	.errorValue = BadCursor,
-    },
-    [RT_COLORMAP & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = FreeColormap,
-	.errorValue = BadColor,
-    },
-    [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = FreeClientPixels,
-	.errorValue = BadColor,
-    },
-    [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = OtherClientGone,
-	.errorValue = BadValue,
-    },
-    [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = {
-	.deleteFunc = DeletePassiveGrab,
-	.errorValue = BadValue,
-    },
-};
-
-CallbackListPtr ResourceStateCallback;
-
-static _X_INLINE void
-CallResourceStateCallback(ResourceState state, ResourceRec *res)
-{
-    if (ResourceStateCallback) {
-	ResourceStateInfoRec rsi = { state, res->id, res->type, res->value };
-	CallCallbacks(&ResourceStateCallback, &rsi);
-    }
-}
-
-RESTYPE
-CreateNewResourceType(DeleteType deleteFunc, char *name)
-{
-    RESTYPE next = lastResourceType + 1;
-    struct ResourceType *types;
-
-    if (next & lastResourceClass)
-	return 0;
-    types = realloc(resourceTypes, (next + 1) * sizeof(*resourceTypes));
-    if (!types)
-	return 0;
-
-    lastResourceType = next;
-    resourceTypes = types;
-    resourceTypes[next].deleteFunc = deleteFunc;
-    resourceTypes[next].errorValue = BadValue;
-
-    /* Called even if name is NULL, to remove any previous entry */
-    RegisterResourceName(next, name);
-
-    return next;
-}
-
-void
-SetResourceTypeErrorValue(RESTYPE type, int errorValue)
-{
-    resourceTypes[type & TypeMask].errorValue = errorValue;
-}
-
-RESTYPE
-CreateNewResourceClass(void)
-{
-    RESTYPE next = lastResourceClass >> 1;
-
-    if (next & lastResourceType)
-	return 0;
-    lastResourceClass = next;
-    TypeMask = next - 1;
-    return next;
-}
-
-static ClientResourceRec clientTable[MAXCLIENTS];
-
-/*****************
- * InitClientResources
- *    When a new client is created, call this to allocate space
- *    in resource table
- *****************/
-
-Bool
-InitClientResources(ClientPtr client)
-{
-    int i, j;
- 
-    if (client == serverClient)
-    {
-	lastResourceType = RT_LASTPREDEF;
-	lastResourceClass = RC_LASTPREDEF;
-	TypeMask = RC_LASTPREDEF - 1;
-	free(resourceTypes);
-	resourceTypes = malloc(sizeof(predefTypes));
-	if (!resourceTypes)
-	    return FALSE;
-	memcpy(resourceTypes, predefTypes, sizeof(predefTypes));
-    }
-    clientTable[i = client->index].resources =
-	malloc(INITBUCKETS*sizeof(ResourcePtr));
-    if (!clientTable[i].resources)
-	return FALSE;
-    clientTable[i].buckets = INITBUCKETS;
-    clientTable[i].elements = 0;
-    clientTable[i].hashsize = INITHASHSIZE;
-    /* Many IDs allocated from the server client are visible to clients,
-     * so we don't use the SERVER_BIT for them, but we have to start
-     * past the magic value constants used in the protocol.  For normal
-     * clients, we can start from zero, with SERVER_BIT set.
-     */
-    clientTable[i].fakeID = client->clientAsMask |
-			    (client->index ? SERVER_BIT : SERVER_MINID);
-    clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
-    for (j=0; j<INITBUCKETS; j++) 
-    {
-        clientTable[i].resources[j] = NULL;
-    }
-    return TRUE;
-}
-
-
-static int
-Hash(int client, XID id)
-{
-    id &= RESOURCE_ID_MASK;
-    switch (clientTable[client].hashsize)
-    {
-	case 6:
-	    return ((int)(0x03F & (id ^ (id>>6) ^ (id>>12))));
-	case 7:
-	    return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13))));
-	case 8:
-	    return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16))));
-	case 9:
-	    return ((int)(0x1FF & (id ^ (id>>9))));
-	case 10:
-	    return ((int)(0x3FF & (id ^ (id>>10))));
-	case 11:
-	    return ((int)(0x7FF & (id ^ (id>>11))));
-    }
-    return -1;
-}
-
-static XID
-AvailableID(
-    int client,
-    XID id,
-    XID maxid,
-    XID goodid)
-{
-    ResourcePtr res;
-
-    if ((goodid >= id) && (goodid <= maxid))
-	return goodid;
-    for (; id <= maxid; id++)
-    {
-	res = clientTable[client].resources[Hash(client, id)];
-	while (res && (res->id != id))
-	    res = res->next;
-	if (!res)
-	    return id;
-    }
-    return 0;
-}
-
-void
-GetXIDRange(int client, Bool server, XID *minp, XID *maxp)
-{
-    XID id, maxid;
-    ResourcePtr *resp;
-    ResourcePtr res;
-    int i;
-    XID goodid;
-
-    id = (Mask)client << CLIENTOFFSET;
-    if (server)
-	id |= client ? SERVER_BIT : SERVER_MINID;
-    maxid = id | RESOURCE_ID_MASK;
-    goodid = 0;
-    for (resp = clientTable[client].resources, i = clientTable[client].buckets;
-	 --i >= 0;)
-    {
-	for (res = *resp++; res; res = res->next)
-	{
-	    if ((res->id < id) || (res->id > maxid))
-		continue;
-	    if (((res->id - id) >= (maxid - res->id)) ?
-		(goodid = AvailableID(client, id, res->id - 1, goodid)) :
-		!(goodid = AvailableID(client, res->id + 1, maxid, goodid)))
-		maxid = res->id - 1;
-	    else
-		id = res->id + 1;
-	}
-    }
-    if (id > maxid)
-	id = maxid = 0;
-    *minp = id;
-    *maxp = maxid;
-}
-
-/**
- *  GetXIDList is called by the XC-MISC extension's MiscGetXIDList function.
- *  This function tries to find count unused XIDs for the given client.  It 
- *  puts the IDs in the array pids and returns the number found, which should
- *  almost always be the number requested.
- *
- *  The circumstances that lead to a call to this function are very rare.
- *  Xlib must run out of IDs while trying to generate a request that wants
- *  multiple ID's, like the Multi-buffering CreateImageBuffers request.
- *
- *  No rocket science in the implementation; just iterate over all
- *  possible IDs for the given client and pick the first count IDs
- *  that aren't in use.  A more efficient algorithm could probably be
- *  invented, but this will be used so rarely that this should suffice.
- */
-
-unsigned int
-GetXIDList(ClientPtr pClient, unsigned count, XID *pids)
-{
-    unsigned int found = 0;
-    XID rc, id = pClient->clientAsMask;
-    XID maxid;
-    pointer val;
-
-    maxid = id | RESOURCE_ID_MASK;
-    while ( (found < count) && (id <= maxid) )
-    {
-	rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
-				      DixGetAttrAccess);
-	if (rc == BadValue)
-	{
-	    pids[found++] = id;
-	}
-	id++;
-    }
-    return found;
-}
-
-/*
- * Return the next usable fake client ID.
- *
- * Normally this is just the next one in line, but if we've used the last
- * in the range, we need to find a new range of safe IDs to avoid
- * over-running another client.
- */
-
-XID
-FakeClientID(int client)
-{
-    XID id, maxid;
-
-    id = clientTable[client].fakeID++;
-    if (id != clientTable[client].endFakeID)
-	return id;
-    GetXIDRange(client, TRUE, &id, &maxid);
-    if (!id) {
-	if (!client)
-	    FatalError("FakeClientID: server internal ids exhausted\n");
-	MarkClientException(clients[client]);
-	id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3);
-	maxid = id | RESOURCE_ID_MASK;
-    }
-    clientTable[client].fakeID = id + 1;
-    clientTable[client].endFakeID = maxid + 1;
-    return id;
-}
-
-Bool
-AddResource(XID id, RESTYPE type, pointer value)
-{
-    int client;
-    ClientResourceRec *rrec;
-    ResourcePtr res, *head;
-    	
-#ifdef XSERVER_DTRACE
-    XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
-#endif
-    client = CLIENT_ID(id);
-    rrec = &clientTable[client];
-    if (!rrec->buckets)
-    {
-	ErrorF("[dix] AddResource(%lx, %lx, %lx), client=%d \n",
-		(unsigned long)id, type, (unsigned long)value, client);
-        FatalError("client not in use\n");
-    }
-    if ((rrec->elements >= 4*rrec->buckets) &&
-	(rrec->hashsize < MAXHASHSIZE))
-	RebuildTable(client);
-    head = &rrec->resources[Hash(client, id)];
-    res = malloc(sizeof(ResourceRec));
-    if (!res)
-    {
-	(*resourceTypes[type & TypeMask].deleteFunc)(value, id);
-	return FALSE;
-    }
-    res->next = *head;
-    res->id = id;
-    res->type = type;
-    res->value = value;
-    *head = res;
-    rrec->elements++;
-    CallResourceStateCallback(ResourceStateAdding, res);
-    return TRUE;
-}
-
-static void
-RebuildTable(int client)
-{
-    int j;
-    ResourcePtr res, next;
-    ResourcePtr **tails, *resources;
-    ResourcePtr **tptr, *rptr;
-
-    /*
-     * For now, preserve insertion order, since some ddx layers depend
-     * on resources being free in the opposite order they are added.
-     */
-
-    j = 2 * clientTable[client].buckets;
-    tails = malloc(j * sizeof(ResourcePtr *));
-    if (!tails)
-	return;
-    resources = malloc(j * sizeof(ResourcePtr));
-    if (!resources)
-    {
-	free(tails);
-	return;
-    }
-    for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
-    {
-	*rptr = NULL;
-	*tptr = rptr;
-    }
-    clientTable[client].hashsize++;
-    for (j = clientTable[client].buckets,
-	 rptr = clientTable[client].resources;
-	 --j >= 0;
-	 rptr++)
-    {
-	for (res = *rptr; res; res = next)
-	{
-	    next = res->next;
-	    res->next = NULL;
-	    tptr = &tails[Hash(client, res->id)];
-	    **tptr = res;
-	    *tptr = &res->next;
-	}
-    }
-    free(tails);
-    clientTable[client].buckets *= 2;
-    free(clientTable[client].resources);
-    clientTable[client].resources = resources;
-}
-
-static void
-doFreeResource(ResourcePtr res, Bool skip)
-{
-    CallResourceStateCallback(ResourceStateFreeing, res);
-
-    if (!skip)
-	resourceTypes[res->type & TypeMask].deleteFunc(res->value, res->id);
-
-    free(res);
-}
-
-void
-FreeResource(XID id, RESTYPE skipDeleteFuncType)
-{
-    int		cid;
-    ResourcePtr res;
-    ResourcePtr *prev, *head;
-    int *eltptr;
-    int		elements;
-
-    if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
-    {
-	head = &clientTable[cid].resources[Hash(cid, id)];
-	eltptr = &clientTable[cid].elements;
-
-	prev = head;
-	while ( (res = *prev) )
-	{
-	    if (res->id == id)
-	    {
-		RESTYPE rtype = res->type;
-
-#ifdef XSERVER_DTRACE
-		XSERVER_RESOURCE_FREE(res->id, res->type,
-			      res->value, TypeNameString(res->type));
-#endif		    
-		*prev = res->next;
-		elements = --*eltptr;
-
-		doFreeResource(res, rtype == skipDeleteFuncType);
-
-		if (*eltptr != elements)
-		    prev = head; /* prev may no longer be valid */
-	    }
-	    else
-		prev = &res->next;
-        }
-    }
-}
-
-void
-FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
-{
-    int		cid;
-    ResourcePtr res;
-    ResourcePtr *prev, *head;
-    if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
-    {
-	head = &clientTable[cid].resources[Hash(cid, id)];
-
-	prev = head;
-	while ( (res = *prev) )
-	{
-	    if (res->id == id && res->type == type)
-	    {
-#ifdef XSERVER_DTRACE
-		XSERVER_RESOURCE_FREE(res->id, res->type,
-			      res->value, TypeNameString(res->type));
-#endif		    		    
-		*prev = res->next;
-		clientTable[cid].elements--;
-
-		doFreeResource(res, skipFree);
-
-		break;
-	    }
-	    else
-		prev = &res->next;
-        }
-    }
-}
-
-/*
- * Change the value associated with a resource id.  Caller
- * is responsible for "doing the right thing" with the old
- * data
- */
-
-Bool
-ChangeResourceValue (XID id, RESTYPE rtype, pointer value)
-{
-    int    cid;
-    ResourcePtr res;
-
-    if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
-    {
-	res = clientTable[cid].resources[Hash(cid, id)];
-
-	for (; res; res = res->next)
-	    if ((res->id == id) && (res->type == rtype))
-	    {
-		res->value = value;
-		return TRUE;
-	    }
-    }
-    return FALSE;
-}
-
-/* Note: if func adds or deletes resources, then func can get called
- * more than once for some resources.  If func adds new resources,
- * func might or might not get called for them.  func cannot both
- * add and delete an equal number of resources!
- */
-
-void
-FindClientResourcesByType(
-    ClientPtr client,
-    RESTYPE type,
-    FindResType func,
-    pointer cdata
-){
-    ResourcePtr *resources;
-    ResourcePtr this, next;
-    int i, elements;
-    int *eltptr;
-
-    if (!client)
-	client = serverClient;
-
-    resources = clientTable[client->index].resources;
-    eltptr = &clientTable[client->index].elements;
-    for (i = 0; i < clientTable[client->index].buckets; i++) 
-    {
-        for (this = resources[i]; this; this = next)
-	{
-	    next = this->next;
-	    if (!type || this->type == type) {
-		elements = *eltptr;
-		(*func)(this->value, this->id, cdata);
-		if (*eltptr != elements)
-		    next = resources[i]; /* start over */
-	    }
-	}
-    }
-}
-
-void
-FindAllClientResources(
-    ClientPtr client,
-    FindAllRes func,
-    pointer cdata
-){
-    ResourcePtr *resources;
-    ResourcePtr this, next;
-    int i, elements;
-    int *eltptr;
-
-    if (!client)
-        client = serverClient;
-
-    resources = clientTable[client->index].resources;
-    eltptr = &clientTable[client->index].elements;
-    for (i = 0; i < clientTable[client->index].buckets; i++)
-    {
-        for (this = resources[i]; this; this = next)
-        {
-            next = this->next;
-            elements = *eltptr;
-            (*func)(this->value, this->id, this->type, cdata);
-            if (*eltptr != elements)
-                next = resources[i]; /* start over */
-        }
-    }
-}
-
-
-pointer
-LookupClientResourceComplex(
-    ClientPtr client,
-    RESTYPE type,
-    FindComplexResType func,
-    pointer cdata
-){
-    ResourcePtr *resources;
-    ResourcePtr this, next;
-    pointer value;
-    int i;
-
-    if (!client)
-	client = serverClient;
-
-    resources = clientTable[client->index].resources;
-    for (i = 0; i < clientTable[client->index].buckets; i++) {
-        for (this = resources[i]; this; this = next) {
-	    next = this->next;
-	    if (!type || this->type == type) {
-		/* workaround func freeing the type as DRI1 does */
-		value = this->value;
-		if((*func)(value, this->id, cdata))
-		    return value;
-	    }
-	}
-    }
-    return NULL;
-}
-
-
-void
-FreeClientNeverRetainResources(ClientPtr client)
-{
-    ResourcePtr *resources;
-    ResourcePtr this;
-    ResourcePtr *prev;
-    int j, elements;
-    int *eltptr;
-
-    if (!client)
-	return;
-
-    resources = clientTable[client->index].resources;
-    eltptr = &clientTable[client->index].elements;
-    for (j=0; j < clientTable[client->index].buckets; j++) 
-    {
-	prev = &resources[j];
-        while ( (this = *prev) )
-	{
-	    RESTYPE rtype = this->type;
-	    if (rtype & RC_NEVERRETAIN)
-	    {
-#ifdef XSERVER_DTRACE
-		XSERVER_RESOURCE_FREE(this->id, this->type,
-			      this->value, TypeNameString(this->type));
-#endif		    
-		*prev = this->next;
-		clientTable[client->index].elements--;
-		elements = *eltptr;
-
-		doFreeResource(this, FALSE);
-
-		if (*eltptr != elements)
-		    prev = &resources[j]; /* prev may no longer be valid */
-	    }
-	    else
-		prev = &this->next;
-	}
-    }
-}
-
-void
-FreeClientResources(ClientPtr client)
-{
-    ResourcePtr *resources;
-    ResourcePtr this;
-    int j;
-
-    /* This routine shouldn't be called with a null client, but just in
-	case ... */
-
-    if (!client)
-	return;
-
-    HandleSaveSet(client);
-
-    resources = clientTable[client->index].resources;
-    for (j=0; j < clientTable[client->index].buckets; j++) 
-    {
-        /* It may seem silly to update the head of this resource list as
-	we delete the members, since the entire list will be deleted any way, 
-	but there are some resource deletion functions "FreeClientPixels" for 
-	one which do a LookupID on another resource id (a Colormap id in this
-	case), so the resource list must be kept valid up to the point that
-	it is deleted, so every time we delete a resource, we must update the
-	head, just like in FreeResource. I hope that this doesn't slow down
-	mass deletion appreciably. PRH */
-
-	ResourcePtr *head;
-
-	head = &resources[j];
-
-        for (this = *head; this; this = *head)
-	{
-#ifdef XSERVER_DTRACE
-	    XSERVER_RESOURCE_FREE(this->id, this->type,
-			  this->value, TypeNameString(this->type));
-#endif		    
-	    *head = this->next;
-	    clientTable[client->index].elements--;
-
-	    doFreeResource(this, FALSE);
-	}
-    }
-    free(clientTable[client->index].resources);
-    clientTable[client->index].resources = NULL;
-    clientTable[client->index].buckets = 0;
-}
-
-void
-FreeAllResources(void)
-{
-    int	i;
-
-    for (i = currentMaxClients; --i >= 0; ) 
-    {
-        if (clientTable[i].buckets) 
-	    FreeClientResources(clients[i]);
-    }
-}
-
-Bool
-LegalNewID(XID id, ClientPtr client)
-{
-    pointer val;
-    int rc;
-
-#ifdef PANORAMIX
-    XID 	minid, maxid;
-
-    if (!noPanoramiXExtension) {
-        minid = client->clientAsMask | (client->index ?
-                                        SERVER_BIT : SERVER_MINID);
-        maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
-        if ((id >= minid) && (id <= maxid))
-            return TRUE;
-    }
-#endif /* PANORAMIX */
-    if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
-    {
-        rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
-                                      DixGetAttrAccess);
-        return rc == BadValue;
-    }
-    return FALSE;
-}
-
-int
-dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
-			ClientPtr client, Mask mode)
-{
-    int cid = CLIENT_ID(id);
-    ResourcePtr res = NULL;
-
-    *result = NULL;
-    if ((rtype & TypeMask) > lastResourceType)
-	return BadImplementation;
-
-    if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
-	res = clientTable[cid].resources[Hash(cid, id)];
-
-	for (; res; res = res->next)
-	    if (res->id == id && res->type == rtype)
-		break;
-    }
-    if (!res)
-	return resourceTypes[rtype & TypeMask].errorValue;
-
-    if (client) {
-	client->errorValue = id;
-	cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
-		       res->value, RT_NONE, NULL, mode);
-	if (cid == BadValue)
-	    return resourceTypes[rtype & TypeMask].errorValue;
-	if (cid != Success)
-	    return cid;
-    }
-
-    *result = res->value;
-    return Success;
-}
-
-int
-dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass,
-			 ClientPtr client, Mask mode)
-{
-    int cid = CLIENT_ID(id);
-    ResourcePtr res = NULL;
-
-    *result = NULL;
-
-    if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
-	res = clientTable[cid].resources[Hash(cid, id)];
-
-	for (; res; res = res->next)
-	    if (res->id == id && (res->type & rclass))
-		break;
-    }
-    if (!res)
-	return BadValue;
-
-    if (client) {
-	client->errorValue = id;
-	cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
-		       res->value, RT_NONE, NULL, mode);
-	if (cid != Success)
-	    return cid;
-    }
-
-    *result = res->value;
-    return Success;
-}
+/************************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice 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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* The panoramix components contained the following notice */
+/*****************************************************************
+
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+The above copyright notice and this permission notice 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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+/* XSERVER_DTRACE additions:
+ * Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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.
+ */
+
+/*	Routines to manage various kinds of resources:
+ *
+ *	CreateNewResourceType, CreateNewResourceClass, InitClientResources,
+ *	FakeClientID, AddResource, FreeResource, FreeClientResources,
+ *	FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange
+ */
+
+/* 
+ *      A resource ID is a 32 bit quantity, the upper 2 bits of which are
+ *	off-limits for client-visible resources.  The next 8 bits are
+ *      used as client ID, and the low 22 bits come from the client.
+ *	A resource ID is "hashed" by extracting and xoring subfields
+ *      (varying with the size of the hash table).
+ *
+ *      It is sometimes necessary for the server to create an ID that looks
+ *      like it belongs to a client.  This ID, however,  must not be one
+ *      the client actually can create, or we have the potential for conflict.
+ *      The 31st bit of the ID is reserved for the server's use for this
+ *      purpose.  By setting CLIENT_ID(id) to the client, the SERVER_BIT to
+ *      1, and an otherwise arbitrary ID in the low 22 bits, we can create a
+ *      resource "owned" by the client.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "misc.h"
+#include "os.h"
+#include "resource.h"
+#include "dixstruct.h" 
+#include "opaque.h"
+#include "windowstr.h"
+#include "dixfont.h"
+#include "colormap.h"
+#include "inputstr.h"
+#include "dixevents.h"
+#include "dixgrabs.h"
+#include "cursor.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#include "xace.h"
+#include <assert.h>
+#include "registry.h"
+
+#ifdef XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include "Xserver-dtrace.h"
+
+#define TypeNameString(t) LookupResourceName(t)
+#endif
+
+static void RebuildTable(
+    int /*client*/
+);
+
+#define SERVER_MINID 32
+
+#define INITBUCKETS 64
+#define INITHASHSIZE 6
+#define MAXHASHSIZE 11
+
+typedef struct _Resource {
+    struct _Resource	*next;
+    XID			id;
+    RESTYPE		type;
+    pointer		value;
+} ResourceRec, *ResourcePtr;
+
+typedef struct _ClientResource {
+    ResourcePtr *resources;
+    int		elements;
+    int		buckets;
+    int		hashsize;	/* log(2)(buckets) */
+    XID		fakeID;
+    XID		endFakeID;
+} ClientResourceRec;
+
+RESTYPE lastResourceType;
+static RESTYPE lastResourceClass;
+RESTYPE TypeMask;
+
+struct ResourceType {
+    DeleteType deleteFunc;
+    int errorValue;
+};
+
+static struct ResourceType *resourceTypes;
+static const struct ResourceType predefTypes[] = {
+    [RT_NONE & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = (DeleteType)NoopDDA,
+	.errorValue = BadValue,
+    },
+    [RT_WINDOW & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = DeleteWindow,
+	.errorValue = BadWindow,
+    },
+    [RT_PIXMAP & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = dixDestroyPixmap,
+	.errorValue = BadPixmap,
+    },
+    [RT_GC & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = FreeGC,
+	.errorValue = BadGC,
+    },
+    [RT_FONT & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = CloseFont,
+	.errorValue = BadFont,
+    },
+    [RT_CURSOR & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = FreeCursor,
+	.errorValue = BadCursor,
+    },
+    [RT_COLORMAP & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = FreeColormap,
+	.errorValue = BadColor,
+    },
+    [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = FreeClientPixels,
+	.errorValue = BadColor,
+    },
+    [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = OtherClientGone,
+	.errorValue = BadValue,
+    },
+    [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = {
+	.deleteFunc = DeletePassiveGrab,
+	.errorValue = BadValue,
+    },
+};
+
+CallbackListPtr ResourceStateCallback;
+
+static _X_INLINE void
+CallResourceStateCallback(ResourceState state, ResourceRec *res)
+{
+    if (ResourceStateCallback) {
+	ResourceStateInfoRec rsi = { state, res->id, res->type, res->value };
+	CallCallbacks(&ResourceStateCallback, &rsi);
+    }
+}
+
+RESTYPE
+CreateNewResourceType(DeleteType deleteFunc, char *name)
+{
+    RESTYPE next = lastResourceType + 1;
+    struct ResourceType *types;
+
+    if (next & lastResourceClass)
+	return 0;
+    types = realloc(resourceTypes, (next + 1) * sizeof(*resourceTypes));
+    if (!types)
+	return 0;
+
+    lastResourceType = next;
+    resourceTypes = types;
+    resourceTypes[next].deleteFunc = deleteFunc;
+    resourceTypes[next].errorValue = BadValue;
+
+    /* Called even if name is NULL, to remove any previous entry */
+    RegisterResourceName(next, name);
+
+    return next;
+}
+
+void
+SetResourceTypeErrorValue(RESTYPE type, int errorValue)
+{
+    resourceTypes[type & TypeMask].errorValue = errorValue;
+}
+
+RESTYPE
+CreateNewResourceClass(void)
+{
+    RESTYPE next = lastResourceClass >> 1;
+
+    if (next & lastResourceType)
+	return 0;
+    lastResourceClass = next;
+    TypeMask = next - 1;
+    return next;
+}
+
+static ClientResourceRec clientTable[MAXCLIENTS];
+
+/*****************
+ * InitClientResources
+ *    When a new client is created, call this to allocate space
+ *    in resource table
+ *****************/
+
+Bool
+InitClientResources(ClientPtr client)
+{
+    int i, j;
+ 
+    if (client == serverClient)
+    {
+	lastResourceType = RT_LASTPREDEF;
+	lastResourceClass = RC_LASTPREDEF;
+	TypeMask = RC_LASTPREDEF - 1;
+	free(resourceTypes);
+	resourceTypes = malloc(sizeof(predefTypes));
+	if (!resourceTypes)
+	    return FALSE;
+	memcpy(resourceTypes, predefTypes, sizeof(predefTypes));
+    }
+    clientTable[i = client->index].resources =
+	malloc(INITBUCKETS*sizeof(ResourcePtr));
+    if (!clientTable[i].resources)
+	return FALSE;
+    clientTable[i].buckets = INITBUCKETS;
+    clientTable[i].elements = 0;
+    clientTable[i].hashsize = INITHASHSIZE;
+    /* Many IDs allocated from the server client are visible to clients,
+     * so we don't use the SERVER_BIT for them, but we have to start
+     * past the magic value constants used in the protocol.  For normal
+     * clients, we can start from zero, with SERVER_BIT set.
+     */
+    clientTable[i].fakeID = client->clientAsMask |
+			    (client->index ? SERVER_BIT : SERVER_MINID);
+    clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
+    for (j=0; j<INITBUCKETS; j++) 
+    {
+        clientTable[i].resources[j] = NULL;
+    }
+    return TRUE;
+}
+
+
+static int
+Hash(int client, XID id)
+{
+    id &= RESOURCE_ID_MASK;
+    switch (clientTable[client].hashsize)
+    {
+	case 6:
+	    return ((int)(0x03F & (id ^ (id>>6) ^ (id>>12))));
+	case 7:
+	    return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13))));
+	case 8:
+	    return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16))));
+	case 9:
+	    return ((int)(0x1FF & (id ^ (id>>9))));
+	case 10:
+	    return ((int)(0x3FF & (id ^ (id>>10))));
+	case 11:
+	    return ((int)(0x7FF & (id ^ (id>>11))));
+    }
+    return -1;
+}
+
+static XID
+AvailableID(
+    int client,
+    XID id,
+    XID maxid,
+    XID goodid)
+{
+    ResourcePtr res;
+
+    if ((goodid >= id) && (goodid <= maxid))
+	return goodid;
+    for (; id <= maxid; id++)
+    {
+	res = clientTable[client].resources[Hash(client, id)];
+	while (res && (res->id != id))
+	    res = res->next;
+	if (!res)
+	    return id;
+    }
+    return 0;
+}
+
+void
+GetXIDRange(int client, Bool server, XID *minp, XID *maxp)
+{
+    XID id, maxid;
+    ResourcePtr *resp;
+    ResourcePtr res;
+    int i;
+    XID goodid;
+
+    id = (Mask)client << CLIENTOFFSET;
+    if (server)
+	id |= client ? SERVER_BIT : SERVER_MINID;
+    maxid = id | RESOURCE_ID_MASK;
+    goodid = 0;
+    for (resp = clientTable[client].resources, i = clientTable[client].buckets;
+	 --i >= 0;)
+    {
+	for (res = *resp++; res; res = res->next)
+	{
+	    if ((res->id < id) || (res->id > maxid))
+		continue;
+	    if (((res->id - id) >= (maxid - res->id)) ?
+		(goodid = AvailableID(client, id, res->id - 1, goodid)) :
+		!(goodid = AvailableID(client, res->id + 1, maxid, goodid)))
+		maxid = res->id - 1;
+	    else
+		id = res->id + 1;
+	}
+    }
+    if (id > maxid)
+	id = maxid = 0;
+    *minp = id;
+    *maxp = maxid;
+}
+
+/**
+ *  GetXIDList is called by the XC-MISC extension's MiscGetXIDList function.
+ *  This function tries to find count unused XIDs for the given client.  It 
+ *  puts the IDs in the array pids and returns the number found, which should
+ *  almost always be the number requested.
+ *
+ *  The circumstances that lead to a call to this function are very rare.
+ *  Xlib must run out of IDs while trying to generate a request that wants
+ *  multiple ID's, like the Multi-buffering CreateImageBuffers request.
+ *
+ *  No rocket science in the implementation; just iterate over all
+ *  possible IDs for the given client and pick the first count IDs
+ *  that aren't in use.  A more efficient algorithm could probably be
+ *  invented, but this will be used so rarely that this should suffice.
+ */
+
+unsigned int
+GetXIDList(ClientPtr pClient, unsigned count, XID *pids)
+{
+    unsigned int found = 0;
+    XID rc, id = pClient->clientAsMask;
+    XID maxid;
+    pointer val;
+
+    maxid = id | RESOURCE_ID_MASK;
+    while ( (found < count) && (id <= maxid) )
+    {
+	rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
+				      DixGetAttrAccess);
+	if (rc == BadValue)
+	{
+	    pids[found++] = id;
+	}
+	id++;
+    }
+    return found;
+}
+
+/*
+ * Return the next usable fake client ID.
+ *
+ * Normally this is just the next one in line, but if we've used the last
+ * in the range, we need to find a new range of safe IDs to avoid
+ * over-running another client.
+ */
+
+XID
+FakeClientID(int client)
+{
+    XID id, maxid;
+
+    id = clientTable[client].fakeID++;
+    if (id != clientTable[client].endFakeID)
+	return id;
+    GetXIDRange(client, TRUE, &id, &maxid);
+    if (!id) {
+	if (!client)
+	    FatalError("FakeClientID: server internal ids exhausted\n");
+	MarkClientException(clients[client]);
+	id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3);
+	maxid = id | RESOURCE_ID_MASK;
+    }
+    clientTable[client].fakeID = id + 1;
+    clientTable[client].endFakeID = maxid + 1;
+    return id;
+}
+
+Bool
+AddResource(XID id, RESTYPE type, pointer value)
+{
+    int client;
+    ClientResourceRec *rrec;
+    ResourcePtr res, *head;
+    	
+#ifdef XSERVER_DTRACE
+    XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
+#endif
+    client = CLIENT_ID(id);
+    rrec = &clientTable[client];
+    if (!rrec->buckets)
+    {
+	ErrorF("[dix] AddResource(%lx, %x, %lx), client=%d \n",
+		(unsigned long)id, type, (unsigned long)value, client);
+        FatalError("client not in use\n");
+    }
+    if ((rrec->elements >= 4*rrec->buckets) &&
+	(rrec->hashsize < MAXHASHSIZE))
+	RebuildTable(client);
+    head = &rrec->resources[Hash(client, id)];
+    res = malloc(sizeof(ResourceRec));
+    if (!res)
+    {
+	(*resourceTypes[type & TypeMask].deleteFunc)(value, id);
+	return FALSE;
+    }
+    res->next = *head;
+    res->id = id;
+    res->type = type;
+    res->value = value;
+    *head = res;
+    rrec->elements++;
+    CallResourceStateCallback(ResourceStateAdding, res);
+    return TRUE;
+}
+
+static void
+RebuildTable(int client)
+{
+    int j;
+    ResourcePtr res, next;
+    ResourcePtr **tails, *resources;
+    ResourcePtr **tptr, *rptr;
+
+    /*
+     * For now, preserve insertion order, since some ddx layers depend
+     * on resources being free in the opposite order they are added.
+     */
+
+    j = 2 * clientTable[client].buckets;
+    tails = malloc(j * sizeof(ResourcePtr *));
+    if (!tails)
+	return;
+    resources = malloc(j * sizeof(ResourcePtr));
+    if (!resources)
+    {
+	free(tails);
+	return;
+    }
+    for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
+    {
+	*rptr = NULL;
+	*tptr = rptr;
+    }
+    clientTable[client].hashsize++;
+    for (j = clientTable[client].buckets,
+	 rptr = clientTable[client].resources;
+	 --j >= 0;
+	 rptr++)
+    {
+	for (res = *rptr; res; res = next)
+	{
+	    next = res->next;
+	    res->next = NULL;
+	    tptr = &tails[Hash(client, res->id)];
+	    **tptr = res;
+	    *tptr = &res->next;
+	}
+    }
+    free(tails);
+    clientTable[client].buckets *= 2;
+    free(clientTable[client].resources);
+    clientTable[client].resources = resources;
+}
+
+static void
+doFreeResource(ResourcePtr res, Bool skip)
+{
+    CallResourceStateCallback(ResourceStateFreeing, res);
+
+    if (!skip)
+	resourceTypes[res->type & TypeMask].deleteFunc(res->value, res->id);
+
+    free(res);
+}
+
+void
+FreeResource(XID id, RESTYPE skipDeleteFuncType)
+{
+    int		cid;
+    ResourcePtr res;
+    ResourcePtr *prev, *head;
+    int *eltptr;
+    int		elements;
+
+    if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
+    {
+	head = &clientTable[cid].resources[Hash(cid, id)];
+	eltptr = &clientTable[cid].elements;
+
+	prev = head;
+	while ( (res = *prev) )
+	{
+	    if (res->id == id)
+	    {
+		RESTYPE rtype = res->type;
+
+#ifdef XSERVER_DTRACE
+		XSERVER_RESOURCE_FREE(res->id, res->type,
+			      res->value, TypeNameString(res->type));
+#endif		    
+		*prev = res->next;
+		elements = --*eltptr;
+
+		doFreeResource(res, rtype == skipDeleteFuncType);
+
+		if (*eltptr != elements)
+		    prev = head; /* prev may no longer be valid */
+	    }
+	    else
+		prev = &res->next;
+        }
+    }
+}
+
+void
+FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
+{
+    int		cid;
+    ResourcePtr res;
+    ResourcePtr *prev, *head;
+    if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
+    {
+	head = &clientTable[cid].resources[Hash(cid, id)];
+
+	prev = head;
+	while ( (res = *prev) )
+	{
+	    if (res->id == id && res->type == type)
+	    {
+#ifdef XSERVER_DTRACE
+		XSERVER_RESOURCE_FREE(res->id, res->type,
+			      res->value, TypeNameString(res->type));
+#endif		    		    
+		*prev = res->next;
+		clientTable[cid].elements--;
+
+		doFreeResource(res, skipFree);
+
+		break;
+	    }
+	    else
+		prev = &res->next;
+        }
+    }
+}
+
+/*
+ * Change the value associated with a resource id.  Caller
+ * is responsible for "doing the right thing" with the old
+ * data
+ */
+
+Bool
+ChangeResourceValue (XID id, RESTYPE rtype, pointer value)
+{
+    int    cid;
+    ResourcePtr res;
+
+    if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
+    {
+	res = clientTable[cid].resources[Hash(cid, id)];
+
+	for (; res; res = res->next)
+	    if ((res->id == id) && (res->type == rtype))
+	    {
+		res->value = value;
+		return TRUE;
+	    }
+    }
+    return FALSE;
+}
+
+/* Note: if func adds or deletes resources, then func can get called
+ * more than once for some resources.  If func adds new resources,
+ * func might or might not get called for them.  func cannot both
+ * add and delete an equal number of resources!
+ */
+
+void
+FindClientResourcesByType(
+    ClientPtr client,
+    RESTYPE type,
+    FindResType func,
+    pointer cdata
+){
+    ResourcePtr *resources;
+    ResourcePtr this, next;
+    int i, elements;
+    int *eltptr;
+
+    if (!client)
+	client = serverClient;
+
+    resources = clientTable[client->index].resources;
+    eltptr = &clientTable[client->index].elements;
+    for (i = 0; i < clientTable[client->index].buckets; i++) 
+    {
+        for (this = resources[i]; this; this = next)
+	{
+	    next = this->next;
+	    if (!type || this->type == type) {
+		elements = *eltptr;
+		(*func)(this->value, this->id, cdata);
+		if (*eltptr != elements)
+		    next = resources[i]; /* start over */
+	    }
+	}
+    }
+}
+
+void
+FindAllClientResources(
+    ClientPtr client,
+    FindAllRes func,
+    pointer cdata
+){
+    ResourcePtr *resources;
+    ResourcePtr this, next;
+    int i, elements;
+    int *eltptr;
+
+    if (!client)
+        client = serverClient;
+
+    resources = clientTable[client->index].resources;
+    eltptr = &clientTable[client->index].elements;
+    for (i = 0; i < clientTable[client->index].buckets; i++)
+    {
+        for (this = resources[i]; this; this = next)
+        {
+            next = this->next;
+            elements = *eltptr;
+            (*func)(this->value, this->id, this->type, cdata);
+            if (*eltptr != elements)
+                next = resources[i]; /* start over */
+        }
+    }
+}
+
+
+pointer
+LookupClientResourceComplex(
+    ClientPtr client,
+    RESTYPE type,
+    FindComplexResType func,
+    pointer cdata
+){
+    ResourcePtr *resources;
+    ResourcePtr this, next;
+    pointer value;
+    int i;
+
+    if (!client)
+	client = serverClient;
+
+    resources = clientTable[client->index].resources;
+    for (i = 0; i < clientTable[client->index].buckets; i++) {
+        for (this = resources[i]; this; this = next) {
+	    next = this->next;
+	    if (!type || this->type == type) {
+		/* workaround func freeing the type as DRI1 does */
+		value = this->value;
+		if((*func)(value, this->id, cdata))
+		    return value;
+	    }
+	}
+    }
+    return NULL;
+}
+
+
+void
+FreeClientNeverRetainResources(ClientPtr client)
+{
+    ResourcePtr *resources;
+    ResourcePtr this;
+    ResourcePtr *prev;
+    int j, elements;
+    int *eltptr;
+
+    if (!client)
+	return;
+
+    resources = clientTable[client->index].resources;
+    eltptr = &clientTable[client->index].elements;
+    for (j=0; j < clientTable[client->index].buckets; j++) 
+    {
+	prev = &resources[j];
+        while ( (this = *prev) )
+	{
+	    RESTYPE rtype = this->type;
+	    if (rtype & RC_NEVERRETAIN)
+	    {
+#ifdef XSERVER_DTRACE
+		XSERVER_RESOURCE_FREE(this->id, this->type,
+			      this->value, TypeNameString(this->type));
+#endif		    
+		*prev = this->next;
+		clientTable[client->index].elements--;
+		elements = *eltptr;
+
+		doFreeResource(this, FALSE);
+
+		if (*eltptr != elements)
+		    prev = &resources[j]; /* prev may no longer be valid */
+	    }
+	    else
+		prev = &this->next;
+	}
+    }
+}
+
+void
+FreeClientResources(ClientPtr client)
+{
+    ResourcePtr *resources;
+    ResourcePtr this;
+    int j;
+
+    /* This routine shouldn't be called with a null client, but just in
+	case ... */
+
+    if (!client)
+	return;
+
+    HandleSaveSet(client);
+
+    resources = clientTable[client->index].resources;
+    for (j=0; j < clientTable[client->index].buckets; j++) 
+    {
+        /* It may seem silly to update the head of this resource list as
+	we delete the members, since the entire list will be deleted any way, 
+	but there are some resource deletion functions "FreeClientPixels" for 
+	one which do a LookupID on another resource id (a Colormap id in this
+	case), so the resource list must be kept valid up to the point that
+	it is deleted, so every time we delete a resource, we must update the
+	head, just like in FreeResource. I hope that this doesn't slow down
+	mass deletion appreciably. PRH */
+
+	ResourcePtr *head;
+
+	head = &resources[j];
+
+        for (this = *head; this; this = *head)
+	{
+#ifdef XSERVER_DTRACE
+	    XSERVER_RESOURCE_FREE(this->id, this->type,
+			  this->value, TypeNameString(this->type));
+#endif		    
+	    *head = this->next;
+	    clientTable[client->index].elements--;
+
+	    doFreeResource(this, FALSE);
+	}
+    }
+    free(clientTable[client->index].resources);
+    clientTable[client->index].resources = NULL;
+    clientTable[client->index].buckets = 0;
+}
+
+void
+FreeAllResources(void)
+{
+    int	i;
+
+    for (i = currentMaxClients; --i >= 0; ) 
+    {
+        if (clientTable[i].buckets) 
+	    FreeClientResources(clients[i]);
+    }
+}
+
+Bool
+LegalNewID(XID id, ClientPtr client)
+{
+    pointer val;
+    int rc;
+
+#ifdef PANORAMIX
+    XID 	minid, maxid;
+
+    if (!noPanoramiXExtension) {
+        minid = client->clientAsMask | (client->index ?
+                                        SERVER_BIT : SERVER_MINID);
+        maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
+        if ((id >= minid) && (id <= maxid))
+            return TRUE;
+    }
+#endif /* PANORAMIX */
+    if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
+    {
+        rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
+                                      DixGetAttrAccess);
+        return rc == BadValue;
+    }
+    return FALSE;
+}
+
+int
+dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
+			ClientPtr client, Mask mode)
+{
+    int cid = CLIENT_ID(id);
+    ResourcePtr res = NULL;
+
+    *result = NULL;
+    if ((rtype & TypeMask) > lastResourceType)
+	return BadImplementation;
+
+    if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
+	res = clientTable[cid].resources[Hash(cid, id)];
+
+	for (; res; res = res->next)
+	    if (res->id == id && res->type == rtype)
+		break;
+    }
+    if (!res)
+	return resourceTypes[rtype & TypeMask].errorValue;
+
+    if (client) {
+	client->errorValue = id;
+	cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
+		       res->value, RT_NONE, NULL, mode);
+	if (cid == BadValue)
+	    return resourceTypes[rtype & TypeMask].errorValue;
+	if (cid != Success)
+	    return cid;
+    }
+
+    *result = res->value;
+    return Success;
+}
+
+int
+dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass,
+			 ClientPtr client, Mask mode)
+{
+    int cid = CLIENT_ID(id);
+    ResourcePtr res = NULL;
+
+    *result = NULL;
+
+    if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
+	res = clientTable[cid].resources[Hash(cid, id)];
+
+	for (; res; res = res->next)
+	    if (res->id == id && (res->type & rclass))
+		break;
+    }
+    if (!res)
+	return BadValue;
+
+    if (client) {
+	client->errorValue = id;
+	cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
+		       res->value, RT_NONE, NULL, mode);
+	if (cid != Success)
+	    return cid;
+    }
+
+    *result = res->value;
+    return Success;
+}
diff --git a/xorg-server/glx/Makefile.am b/xorg-server/glx/Makefile.am
index 41fdf5fc2..ef8677a7c 100644
--- a/xorg-server/glx/Makefile.am
+++ b/xorg-server/glx/Makefile.am
@@ -1,98 +1,101 @@
-if AIGLX
-GLXDRI_LIBRARY = libglxdri.la
-endif
-
-noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY)
-
-AM_CFLAGS = \
-	@DIX_CFLAGS@ \
-	@GL_CFLAGS@ \
-	@DRI_CFLAGS@ \
-	@XLIB_CFLAGS@ \
-	@LIBDRM_CFLAGS@ \
-	@DRIPROTO_CFLAGS@ \
-	@GLX_DEFINES@ \
-	@GLX_ARCH_DEFINES@
-
-# none yet
-#sdk_HEADERS =
-
-INCLUDES = \
-	-I$(top_srcdir)/hw/xfree86/os-support \
-	-I$(top_srcdir)/hw/xfree86/os-support/bus \
-	-I$(top_srcdir)/hw/xfree86/common \
-	-I$(top_srcdir)/hw/xfree86/dri \
-	-I$(top_srcdir)/mi
-
-if DRI2_AIGLX
-INCLUDES += -I$(top_srcdir)/hw/xfree86/dri2
-endif
-
-glapi_sources =					\
-	indirect_dispatch.c			\
-	indirect_dispatch.h			\
-	indirect_dispatch_swap.c		\
-	indirect_reqsize.c			\
-	indirect_reqsize.h			\
-	indirect_size.h				\
-	indirect_size_get.c			\
-	indirect_size_get.h			\
-	indirect_table.c			\
-	dispatch.h				\
-	glapitable.h				\
-	glapi.c					\
-	glapi.h					\
-	glapioffsets.h				\
-	glprocs.h				\
-	glthread.c				\
-	glthread.h
-
-libglxdri_la_SOURCES = \
-        glxdri.c \
-        extension_string.c \
-        extension_string.h
-
-if DRI2_AIGLX
-libglxdri_la_SOURCES += glxdri2.c
-endif
-
-libglxdri_la_LIBADD = $(DLOPEN_LIBS)
-
-libglx_la_SOURCES = \
-	$(indirect_sources) \
-	$(glapi_sources) \
-	indirect_util.c \
-	indirect_util.h \
-	indirect_program.c \
-	indirect_table.h \
-	indirect_texture_compression.c \
-        glxbyteorder.h \
-        glxcmds.c \
-        glxcmdsswap.c \
-        glxcontext.h \
-        glxdrawable.h \
-        glxext.c \
-        glxext.h \
-	glxdriswrast.c \
-	glxdricommon.c \
-	glxdricommon.h \
-        glxscreens.c \
-        glxscreens.h \
-        glxserver.h \
-        glxutil.h \
-        render2.c \
-        render2swap.c \
-        renderpix.c \
-        renderpixswap.c \
-        rensize.c \
-        single2.c \
-        single2swap.c \
-        singlepix.c \
-        singlepixswap.c \
-        singlesize.c \
-        singlesize.h \
-        swap_interval.c \
-        unpack.h \
-        xfont.c
-
-libglx_la_LIBADD = $(DLOPEN_LIBS)
+if AIGLX
+GLXDRI_LIBRARY = libglxdri.la
+endif
+
+noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY)
+
+AM_CFLAGS = \
+	@DIX_CFLAGS@ \
+	@GL_CFLAGS@ \
+	@DRI_CFLAGS@ \
+	@XLIB_CFLAGS@ \
+	@LIBDRM_CFLAGS@ \
+	@DRIPROTO_CFLAGS@ \
+	@GLX_DEFINES@ \
+	@GLX_ARCH_DEFINES@
+
+# none yet
+#sdk_HEADERS =
+
+INCLUDES = \
+	-I$(top_srcdir)/hw/xfree86/os-support \
+	-I$(top_srcdir)/hw/xfree86/os-support/bus \
+	-I$(top_srcdir)/hw/xfree86/common \
+	-I$(top_srcdir)/hw/xfree86/dri \
+	-I$(top_srcdir)/mi
+
+if DRI2_AIGLX
+INCLUDES += -I$(top_srcdir)/hw/xfree86/dri2
+endif
+
+glapi_sources =					\
+	indirect_dispatch.c			\
+	indirect_dispatch.h			\
+	indirect_dispatch_swap.c		\
+	indirect_reqsize.c			\
+	indirect_reqsize.h			\
+	indirect_size.h				\
+	indirect_size_get.c			\
+	indirect_size_get.h			\
+	indirect_table.c			\
+	dispatch.h				\
+	glapitable.h				\
+	glapi.c					\
+	glapi.h					\
+	glapioffsets.h				\
+	glprocs.h				\
+	glthread.c				\
+	glthread.h
+
+libglxdri_la_SOURCES = \
+        extension_string.c \
+        extension_string.h
+
+if DRI
+libglxdri_la_SOURCES += glxdri.c
+endif
+
+if DRI2_AIGLX
+libglxdri_la_SOURCES += glxdri2.c
+endif
+
+libglxdri_la_LIBADD = $(DLOPEN_LIBS)
+
+libglx_la_SOURCES = \
+	$(indirect_sources) \
+	$(glapi_sources) \
+	indirect_util.c \
+	indirect_util.h \
+	indirect_program.c \
+	indirect_table.h \
+	indirect_texture_compression.c \
+        glxbyteorder.h \
+        glxcmds.c \
+        glxcmdsswap.c \
+        glxcontext.h \
+        glxdrawable.h \
+        glxext.c \
+        glxext.h \
+	glxdriswrast.c \
+	glxdricommon.c \
+	glxdricommon.h \
+        glxscreens.c \
+        glxscreens.h \
+        glxserver.h \
+        glxutil.h \
+        render2.c \
+        render2swap.c \
+        renderpix.c \
+        renderpixswap.c \
+        rensize.c \
+        single2.c \
+        single2swap.c \
+        singlepix.c \
+        singlepixswap.c \
+        singlesize.c \
+        singlesize.h \
+        swap_interval.c \
+        unpack.h \
+        xfont.c
+
+libglx_la_LIBADD = $(DLOPEN_LIBS)
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index b524597a8..d5b764fd0 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -1,2331 +1,2334 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-#include <assert.h>
-
-#include "glxserver.h"
-#include <GL/glxtokens.h>
-#include <unpack.h>
-#include <pixmapstr.h>
-#include <windowstr.h>
-#include "glxutil.h"
-#include "glxext.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-#include "indirect_dispatch.h"
-#include "indirect_table.h"
-#include "indirect_util.h"
-
-static int
-validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
-{
-    /*
-    ** Check if screen exists.
-    */
-    if (screen < 0 || screen >= screenInfo.numScreens) {
-	client->errorValue = screen;
-	*err = BadValue;
-	return FALSE;
-    }
-    *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
-
-    return TRUE;
-}
-
-static int
-validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
-		 __GLXconfig **config, int *err)
-{
-    __GLXconfig *m;
-
-    for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
-	if (m->fbconfigID == id) {
-	    *config = m;
-	    return TRUE;
-	}
-
-    client->errorValue = id;
-    *err = __glXError(GLXBadFBConfig);
-
-    return FALSE;
-}
-
-static int
-validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
-	       __GLXconfig **config, int *err)
-{
-    int i;
-
-    for (i = 0; i < pGlxScreen->numVisuals; i++)
- 	if (pGlxScreen->visuals[i]->visualID == id) {
-	    *config = pGlxScreen->visuals[i];
-	    return TRUE;
-	}
-
-    client->errorValue = id;
-    *err = BadValue;
-
-    return FALSE;
-}
-
-static int
-validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
-			  DrawablePtr pDraw, int *err)
-{
-    ScreenPtr pScreen = pDraw->pScreen;
-    VisualPtr pVisual = NULL;
-    XID vid;
-    int i;
-
-    vid = wVisual((WindowPtr)pDraw);
-    for (i = 0; i < pScreen->numVisuals; i++) {
-	if (pScreen->visuals[i].vid == vid) {
-	    pVisual = &pScreen->visuals[i];
-	    break;
-	}
-    }
-
-    /* FIXME: What exactly should we check here... */
-    if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
-	!(config->drawableType & GLX_WINDOW_BIT)) {
-	client->errorValue = pDraw->id;
-	*err = BadMatch;
-	return FALSE;
-    }
-
-    return TRUE;
-}
-
-static int
-validGlxContext(ClientPtr client, XID id, int access_mode,
-		__GLXcontext **context, int *err)
-{
-    *err = dixLookupResourceByType((pointer *) context, id,
-				   __glXContextRes, client, access_mode);
-    if (*err != Success || (*context)->idExists == GL_FALSE) {
-	client->errorValue = id;
-	if (*err == BadValue || *err == Success)
-	    *err = __glXError(GLXBadContext);
-	return FALSE;
-    }
-
-    return TRUE;
-}
-
-static int
-validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
-		 __GLXdrawable **drawable, int *err)
-{
-    int rc;
-
-    rc = dixLookupResourceByType((pointer *) drawable, id,
-				 __glXDrawableRes, client, access_mode);
-    if (rc != Success && rc != BadValue) {
-	*err = rc;
-	client->errorValue = id;
-	return FALSE;
-    }
-
-    /* If the ID of the glx drawable we looked up doesn't match the id
-     * we looked for, it's because we looked it up under the X
-     * drawable ID (see DoCreateGLXDrawable). */
-    if (rc == BadValue ||
-	(*drawable)->drawId != id ||
-	(type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
-	client->errorValue = id;
-	switch (type) {
-	case GLX_DRAWABLE_WINDOW:
-	    *err = __glXError(GLXBadWindow);
-	    return FALSE;
-	case GLX_DRAWABLE_PIXMAP:
-	    *err = __glXError(GLXBadPixmap);
-	    return FALSE;
-	case GLX_DRAWABLE_PBUFFER:
-	    *err = __glXError(GLXBadPbuffer);
-	    return FALSE;
-	case GLX_DRAWABLE_ANY:
-	    *err = __glXError(GLXBadDrawable);
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
-}
-
-void
-__glXContextDestroy(__GLXcontext *context)
-{
-    __glXFlushContextCache();
-}
-
-static void __glXdirectContextDestroy(__GLXcontext *context)
-{
-    __glXContextDestroy(context);
-    free(context);
-}
-
-static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
-					      __GLXconfig *modes,
-					      __GLXcontext *shareContext)
-{
-    __GLXcontext *context;
-
-    context = calloc(1, sizeof (__GLXcontext));
-    if (context == NULL)
-	return NULL;
-
-    context->destroy = __glXdirectContextDestroy;
-
-    return context;
-}
-
-/**
- * Create a GL context with the given properties.  This routine is used
- * to implement \c glXCreateContext, \c glXCreateNewContext, and
- * \c glXCreateContextWithConfigSGIX.  This works becuase of the hack way
- * that GLXFBConfigs are implemented.  Basically, the FBConfigID is the
- * same as the VisualID.
- */
-
-static int
-DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
-		GLXContextID shareList, __GLXconfig *config,
-		__GLXscreen *pGlxScreen, GLboolean isDirect)
-{
-    ClientPtr client = cl->client;
-    __GLXcontext *glxc, *shareglxc;
-    int err;
-    
-    LEGAL_NEW_RESOURCE(gcId, client);
-
-    /*
-    ** Find the display list space that we want to share.  
-    **
-    ** NOTE: In a multithreaded X server, we would need to keep a reference
-    ** count for each display list so that if one client detroyed a list that 
-    ** another client was using, the list would not really be freed until it 
-    ** was no longer in use.  Since this sample implementation has no support 
-    ** for multithreaded servers, we don't do this.  
-    */
-    if (shareList == None) {
-	shareglxc = 0;
-    } else {
-	if (!validGlxContext(client, shareList, DixReadAccess,
-			     &shareglxc, &err))
-	    return err;
-
-	if (shareglxc->isDirect) {
-	    /*
-	    ** NOTE: no support for sharing display lists between direct
-	    ** contexts, even if they are in the same address space.
-	    */
-#if 0
-            /* Disabling this code seems to allow shared display lists
-             * and texture objects to work.  We'll leave it disabled for now.
-             */
-	    client->errorValue = shareList;
-	    return BadMatch;
-#endif
-	} else {
-	    /*
-	    ** Create an indirect context regardless of what the client asked
-	    ** for; this way we can share display list space with shareList.
-	    */
-	    isDirect = GL_FALSE;
-	}
-    }
-
-    /*
-    ** Allocate memory for the new context
-    */
-    if (!isDirect)
-	glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
-    else
-	glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
-    if (!glxc) {
-	return BadAlloc;
-    }
-
-    /*
-    ** Initially, setup the part of the context that could be used by
-    ** a GL core that needs windowing information (e.g., Mesa).
-    */
-    glxc->pGlxScreen = pGlxScreen;
-    glxc->config = config;
-
-    /*
-    ** Register this context as a resource.
-    */
-    if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
-	(*glxc->destroy)(glxc);
-	client->errorValue = gcId;
-	return BadAlloc;
-    }
-    
-    /*
-    ** Finally, now that everything is working, setup the rest of the
-    ** context.
-    */
-    glxc->id = gcId;
-    glxc->share_id = shareList;
-    glxc->idExists = GL_TRUE;
-    glxc->isCurrent = GL_FALSE;
-    glxc->isDirect = isDirect;
-    glxc->renderMode = GL_RENDER;
-
-    __glXAddToContextList(glxc);
-
-    return Success;
-}
-
-int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
-    __GLXconfig *config;
-    __GLXscreen *pGlxScreen;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXCreateContextReq);
-
-    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
-	return err;
-    if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
-	return err;
-
-    return DoCreateContext(cl, req->context, req->shareList,
-			   config, pGlxScreen, req->isDirect);
-}
-
-int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
-    __GLXconfig *config;
-    __GLXscreen *pGlxScreen;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
-
-    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
-	return err;
-    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
-	return err;
-
-    return DoCreateContext(cl, req->context, req->shareList,
-			   config, pGlxScreen, req->isDirect);
-}
-
-int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreateContextWithConfigSGIXReq *req = 
-	(xGLXCreateContextWithConfigSGIXReq *) pc;
-    __GLXconfig *config;
-    __GLXscreen *pGlxScreen;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
-
-    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
-	return err;
-    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
-	return err;
-
-    return DoCreateContext(cl, req->context, req->shareList,
-			   config, pGlxScreen, req->isDirect);
-}
-
-int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
-    __GLXcontext *glxc;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
-
-    if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
-			 &glxc, &err))
-	    return err;
-
-    glxc->idExists = GL_FALSE;
-    if (!glxc->isCurrent)
-        FreeResourceByType(req->context, __glXContextRes, FALSE);
-
-    return Success;
-}
-
-/*
- * This will return "deleted" contexts, ie, where idExists is GL_FALSE.
- * Contrast validGlxContext, which will not.  We're cheating here and
- * using the XID as the context tag, which is fine as long as we defer
- * actually destroying the context until it's no longer referenced, and
- * block clients from trying to MakeCurrent on contexts that are on the
- * way to destruction.  Notice that DoMakeCurrent calls validGlxContext
- * for new contexts but __glXLookupContextByTag for previous contexts.
- */
-__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
-{
-    __GLXcontext *ret;
-
-    if (dixLookupResourceByType((void **)&ret, tag, __glXContextRes,
-                                cl->client, DixUseAccess) == Success)
-        return ret;
-
-    return NULL;
-}
-
-/*****************************************************************************/
-
-static void StopUsingContext(__GLXcontext *glxc)
-{
-    if (glxc) {
-	if (glxc == __glXLastContext) {
-	    /* Tell server GL library */
-	    __glXLastContext = 0;
-	}
-	glxc->isCurrent = GL_FALSE;
-	if (!glxc->idExists) {
-            FreeResourceByType(glxc->id, __glXContextRes, FALSE);
-	}
-    }
-}
-
-static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
-{
-    glxc->isCurrent = GL_TRUE;
-    __glXLastContext = glxc;	
-}
-
-/**
- * This is a helper function to handle the legacy (pre GLX 1.3) cases
- * where passing an X window to glXMakeCurrent is valid.  Given a
- * resource ID, look up the GLX drawable if available, otherwise, make
- * sure it's an X window and create a GLX drawable one the fly.
- */
-static __GLXdrawable *
-__glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
-		 int *error)
-{
-    DrawablePtr pDraw;
-    __GLXdrawable *pGlxDraw;
-    int rc;
-
-    if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
-			 DixWriteAccess, &pGlxDraw, &rc)) {
-	if (glxc != NULL && pGlxDraw->config != glxc->config) {
-	    client->errorValue = drawId;
-	    *error = BadMatch;
-	    return NULL;
-	}
-
-	return pGlxDraw;
-    }
-
-    /* No active context and an unknown drawable, bail. */
-    if (glxc == NULL) {
-	    client->errorValue = drawId;
-	    *error = BadMatch;
-	    return NULL;
-    }
-
-    /* The drawId wasn't a GLX drawable.  Make sure it's a window and
-     * create a GLXWindow for it.  Check that the drawable screen
-     * matches the context screen and that the context fbconfig is
-     * compatible with the window visual. */
-
-    rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
-    if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
-	client->errorValue = drawId;
-	*error = __glXError(GLXBadDrawable);
-	return NULL;
-    }
-
-    if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
-	client->errorValue = pDraw->pScreen->myNum;
-	*error = BadMatch;
-	return NULL;
-    }
-
-    if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
-	return NULL;
-
-    pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
-						pDraw, drawId,
-						GLX_DRAWABLE_WINDOW,
-						drawId, glxc->config);
-
-    /* since we are creating the drawablePrivate, drawId should be new */
-    if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
-	pGlxDraw->destroy (pGlxDraw);
-	*error = BadAlloc;
-	return NULL;
-    }
-
-    return pGlxDraw;
-}
-
-/*****************************************************************************/
-/*
-** Make an OpenGL context and drawable current.
-*/
-
-static int
-DoMakeCurrent(__GLXclientState *cl,
-	      GLXDrawable drawId, GLXDrawable readId,
-	      GLXContextID contextId, GLXContextTag tag)
-{
-    ClientPtr client = cl->client;
-    xGLXMakeCurrentReply reply;
-    __GLXcontext *glxc, *prevglxc;
-    __GLXdrawable *drawPriv = NULL;
-    __GLXdrawable *readPriv = NULL;
-    int error;
-    GLuint  mask;
-
-    /*
-    ** If one is None and the other isn't, it's a bad match.
-    */
-
-    mask  = (drawId == None)    ? (1 << 0) : 0;
-    mask |= (readId == None)    ? (1 << 1) : 0;
-    mask |= (contextId == None) ? (1 << 2) : 0;
-
-    if ( (mask != 0x00) && (mask != 0x07) ) {
-	return BadMatch;
-    }
-    
-    /*
-    ** Lookup old context.  If we have one, it must be in a usable state.
-    */
-    if (tag != 0) {
-	prevglxc = __glXLookupContextByTag(cl, tag);
-	if (!prevglxc) {
-	    /*
-	    ** Tag for previous context is invalid.
-	    */
-	    return __glXError(GLXBadContextTag);
-	}
-	if (prevglxc->renderMode != GL_RENDER) {
-	    /* Oops.  Not in render mode render. */
-	    client->errorValue = prevglxc->id;
-	    return __glXError(GLXBadContextState);
-	}
-    } else {
-	prevglxc = 0;
-    }
-
-    /*
-    ** Lookup new context.  It must not be current for someone else.
-    */
-    if (contextId != None) {
-	int  status;
-
-	if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
-	    return error;
-	if ((glxc != prevglxc) && glxc->isCurrent) {
-	    /* Context is current to somebody else */
-	    return BadAccess;
-	}
-
-	assert( drawId != None );
-	assert( readId != None );
-
-	drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
-	if (drawPriv == NULL)
-	    return status;
-
-	readPriv = __glXGetDrawable(glxc, readId, client, &status);
-	if (readPriv == NULL)
-	    return status;
-
-    } else {
-	/* Switching to no context.  Ignore new drawable. */
-	glxc = 0;
-	drawPriv = 0;
-	readPriv = 0;
-    }
-
-
-    if (prevglxc) {
-	/*
-	** Flush the previous context if needed.
-	*/
-	if (prevglxc->hasUnflushedCommands) {
-	    if (__glXForceCurrent(cl, tag, (int *)&error)) {
-		CALL_Flush( GET_DISPATCH(), () );
-		prevglxc->hasUnflushedCommands = GL_FALSE;
-	    } else {
-		return error;
-	    }
-	}
-
-	/*
-	** Make the previous context not current.
-	*/
-	if (!(*prevglxc->loseCurrent)(prevglxc)) {
-	    return __glXError(GLXBadContext);
-	}
-	__glXFlushContextCache();
-	if (!prevglxc->isDirect) {
-	    prevglxc->drawPriv = NULL;
-	    prevglxc->readPriv = NULL;
-	}
-    }
-	
-
-    if ((glxc != 0) && !glxc->isDirect) {
-
-	glxc->drawPriv = drawPriv;
-	glxc->readPriv = readPriv;
-
-	/* make the context current */
-	if (!(*glxc->makeCurrent)(glxc)) {
-	    glxc->drawPriv = NULL;
-	    glxc->readPriv = NULL;
-	    return __glXError(GLXBadContext);
-	}
-
-	glxc->isCurrent = GL_TRUE;
-    }
-
-    StopUsingContext(prevglxc);
-
-    if (glxc) {
-	StartUsingContext(cl, glxc);
-	reply.contextTag = glxc->id;
-    } else {
-	reply.contextTag = 0;
-    }
-
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-
-    if (client->swapped) {
-	__glXSwapMakeCurrentReply(client, &reply);
-    } else {
-	WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply);
-    }
-    return Success;
-}
-
-int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
-
-    return DoMakeCurrent( cl, req->drawable, req->drawable,
-			  req->context, req->oldContextTag );
-}
-
-int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
-
-    return DoMakeCurrent( cl, req->drawable, req->readdrawable,
-			  req->context, req->oldContextTag );
-}
-
-int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
-
-    return DoMakeCurrent( cl, req->drawable, req->readable,
-			  req->context, req->oldContextTag );
-}
-
-int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
-    xGLXIsDirectReply reply;
-    __GLXcontext *glxc;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXIsDirectReq);
-
-    if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
-	return err;
-
-    reply.isDirect = glxc->isDirect;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-
-    if (client->swapped) {
-	__glXSwapIsDirectReply(client, &reply);
-    } else {
-	WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
-    }
-
-    return Success;
-}
-
-int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
-    xGLXQueryVersionReply reply;
-    GLuint major, minor;
-
-    REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
-
-    major = req->majorVersion;
-    minor = req->minorVersion;
-    (void)major;
-    (void)minor;
-
-    /*
-    ** Server should take into consideration the version numbers sent by the
-    ** client if it wants to work with older clients; however, in this
-    ** implementation the server just returns its version number.
-    */
-    reply.majorVersion = glxMajorVersion;
-    reply.minorVersion = glxMinorVersion;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-
-    if (client->swapped) {
-	__glXSwapQueryVersionReply(client, &reply);
-    } else {
-	WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
-    }
-    return Success;
-}
-
-int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
-    GLXContextTag tag;
-    __GLXcontext *glxc = NULL;
-    int error;
-
-    REQUEST_SIZE_MATCH(xGLXWaitGLReq);
-
-    tag = req->contextTag;
-    if (tag) {
-	glxc = __glXLookupContextByTag(cl, tag);
-	if (!glxc)
-	    return __glXError(GLXBadContextTag);
-    
-	if (!__glXForceCurrent(cl, req->contextTag, &error))
-	    return error;
-
-	CALL_Finish( GET_DISPATCH(), () );
-    }
-
-    if (glxc && glxc->drawPriv->waitGL)
-	(*glxc->drawPriv->waitGL)(glxc->drawPriv);
-
-    return Success;
-}
-
-int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
-    GLXContextTag tag;
-    __GLXcontext *glxc = NULL;
-    int error;
-
-    REQUEST_SIZE_MATCH(xGLXWaitXReq);
-
-    tag = req->contextTag;
-    if (tag) {
-	glxc = __glXLookupContextByTag(cl, tag);
-	if (!glxc)
-	    return __glXError(GLXBadContextTag);
-    
-	if (!__glXForceCurrent(cl, req->contextTag, &error))
-	    return error;
-    }
-
-    if (glxc && glxc->drawPriv->waitX)
-	(*glxc->drawPriv->waitX)(glxc->drawPriv);
-
-    return Success;
-}
-
-int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
-    GLXContextID source;
-    GLXContextID dest;
-    GLXContextTag tag;
-    unsigned long mask;
-    __GLXcontext *src, *dst;
-    int error;
-
-    REQUEST_SIZE_MATCH(xGLXCopyContextReq);
-
-    source = req->source;
-    dest = req->dest;
-    tag = req->contextTag;
-    mask = req->mask;
-    if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
-	return error;
-    if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
-	return error;
-
-    /*
-    ** They must be in the same address space, and same screen.
-    ** NOTE: no support for direct rendering contexts here.
-    */
-    if (src->isDirect || dst->isDirect ||
-	(src->pGlxScreen != dst->pGlxScreen)) {
-	client->errorValue = source;
-	return BadMatch;
-    }
-
-    /*
-    ** The destination context must not be current for any client.
-    */
-    if (dst->isCurrent) {
-	client->errorValue = dest;
-	return BadAccess;
-    }
-
-    if (tag) {
-	__GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
-	
-	if (!tagcx) {
-	    return __glXError(GLXBadContextTag);
-	}
-	if (tagcx != src) {
-	    /*
-	    ** This would be caused by a faulty implementation of the client
-	    ** library.
-	    */
-	    return BadMatch;
-	}
-	/*
-	** In this case, glXCopyContext is in both GL and X streams, in terms
-	** of sequentiality.
-	*/
-	if (__glXForceCurrent(cl, tag, &error)) {
-	    /*
-	    ** Do whatever is needed to make sure that all preceding requests
-	    ** in both streams are completed before the copy is executed.
-	    */
-	    CALL_Finish( GET_DISPATCH(), () );
-	    tagcx->hasUnflushedCommands = GL_FALSE;
-	} else {
-	    return error;
-	}
-    }
-    /*
-    ** Issue copy.  The only reason for failure is a bad mask.
-    */
-    if (!(*dst->copy)(dst, src, mask)) {
-	client->errorValue = mask;
-	return BadValue;
-    }
-    return Success;
-}
-
-enum {
-    GLX_VIS_CONFIG_UNPAIRED = 18,
-    GLX_VIS_CONFIG_PAIRED = 20
-};
-
-enum {
-    GLX_VIS_CONFIG_TOTAL = GLX_VIS_CONFIG_UNPAIRED + GLX_VIS_CONFIG_PAIRED
-};
-
-int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
-{
-    xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
-    ClientPtr client = cl->client;
-    xGLXGetVisualConfigsReply reply;
-    __GLXscreen *pGlxScreen;
-    __GLXconfig *modes;
-    CARD32 buf[GLX_VIS_CONFIG_TOTAL];
-    int p, i, err;
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
-    REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
-
-    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
-	return err;
-
-    reply.numVisuals = pGlxScreen->numVisuals;
-    reply.numProps = GLX_VIS_CONFIG_TOTAL;
-    reply.length = (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-
-    if (client->swapped) {
-	__GLX_SWAP_SHORT(&reply.sequenceNumber);
-	__GLX_SWAP_INT(&reply.length);
-	__GLX_SWAP_INT(&reply.numVisuals);
-	__GLX_SWAP_INT(&reply.numProps);
-    }
-
-    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
-
-    for (i = 0; i < pGlxScreen->numVisuals; i++) {
-	modes = pGlxScreen->visuals[i];
-
-	p = 0;
-	buf[p++] = modes->visualID;
-	buf[p++] = glxConvertToXVisualType( modes->visualType );
-	buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
-
-	buf[p++] = modes->redBits;
-	buf[p++] = modes->greenBits;
-	buf[p++] = modes->blueBits;
-	buf[p++] = modes->alphaBits;
-	buf[p++] = modes->accumRedBits;
-	buf[p++] = modes->accumGreenBits;
-	buf[p++] = modes->accumBlueBits;
-	buf[p++] = modes->accumAlphaBits;
-
-	buf[p++] = modes->doubleBufferMode;
-	buf[p++] = modes->stereoMode;
-
-	buf[p++] = modes->rgbBits;
-	buf[p++] = modes->depthBits;
-	buf[p++] = modes->stencilBits;
-	buf[p++] = modes->numAuxBuffers;
-	buf[p++] = modes->level;
-
-	assert(p == GLX_VIS_CONFIG_UNPAIRED);
-	/* 
-	** Add token/value pairs for extensions.
-	*/
-	buf[p++] = GLX_VISUAL_CAVEAT_EXT;
-	buf[p++] = modes->visualRating;
-	buf[p++] = GLX_TRANSPARENT_TYPE;
-	buf[p++] = modes->transparentPixel;
-	buf[p++] = GLX_TRANSPARENT_RED_VALUE;
-	buf[p++] = modes->transparentRed;
-	buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
-	buf[p++] = modes->transparentGreen;
-	buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
-	buf[p++] = modes->transparentBlue;
-	buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
-	buf[p++] = modes->transparentAlpha;
-	buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
-	buf[p++] = modes->transparentIndex;
-	buf[p++] = GLX_SAMPLES_SGIS;
-	buf[p++] = modes->samples;
-	buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
-	buf[p++] = modes->sampleBuffers;
-	buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
-	buf[p++] = 0;
-
-	assert(p == GLX_VIS_CONFIG_TOTAL);
-	if (client->swapped) {
-	    __GLX_SWAP_INT_ARRAY(buf, p);
-	}
-	WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf);
-    }
-    return Success;
-}
-
-#define __GLX_TOTAL_FBCONFIG_ATTRIBS (36)
-#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
-/**
- * Send the set of GLXFBConfigs to the client.  There is not currently
- * and interface into the driver on the server-side to get GLXFBConfigs,
- * so we "invent" some based on the \c __GLXvisualConfig structures that
- * the driver does supply.
- * 
- * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX
- * is the same, so this routine pulls double duty.
- */
-
-static int
-DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
-{
-    ClientPtr client = cl->client;
-    xGLXGetFBConfigsReply reply;
-    __GLXscreen *pGlxScreen;
-    CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
-    int p, err;
-    __GLXconfig *modes;
-    __GLX_DECLARE_SWAP_VARIABLES;
-    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
-    if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
-	return err;
-
-    reply.numFBConfigs = pGlxScreen->numFBConfigs;
-    reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
-    reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs);
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-
-    if (client->swapped) {
-	__GLX_SWAP_SHORT(&reply.sequenceNumber);
-	__GLX_SWAP_INT(&reply.length);
-	__GLX_SWAP_INT(&reply.numFBConfigs);
-	__GLX_SWAP_INT(&reply.numAttribs);
-    }
-
-    WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
-
-    for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
-	p = 0;
-
-#define WRITE_PAIR(tag,value) \
-    do { buf[p++] = tag ; buf[p++] = value ; } while( 0 )
-
-	WRITE_PAIR( GLX_VISUAL_ID,        modes->visualID );
-	WRITE_PAIR( GLX_FBCONFIG_ID,      modes->fbconfigID );
-	WRITE_PAIR( GLX_X_RENDERABLE,     GL_TRUE );
-
-	WRITE_PAIR( GLX_RGBA,
-		    (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE );
-	WRITE_PAIR( GLX_RENDER_TYPE,      modes->renderType );
-	WRITE_PAIR( GLX_DOUBLEBUFFER,     modes->doubleBufferMode );
-	WRITE_PAIR( GLX_STEREO,           modes->stereoMode );
-
-	WRITE_PAIR( GLX_BUFFER_SIZE,      modes->rgbBits );
-	WRITE_PAIR( GLX_LEVEL,            modes->level );
-	WRITE_PAIR( GLX_AUX_BUFFERS,      modes->numAuxBuffers );
-	WRITE_PAIR( GLX_RED_SIZE,         modes->redBits );
-	WRITE_PAIR( GLX_GREEN_SIZE,       modes->greenBits );
-	WRITE_PAIR( GLX_BLUE_SIZE,        modes->blueBits );
-	WRITE_PAIR( GLX_ALPHA_SIZE,       modes->alphaBits );
-	WRITE_PAIR( GLX_ACCUM_RED_SIZE,   modes->accumRedBits );
-	WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits );
-	WRITE_PAIR( GLX_ACCUM_BLUE_SIZE,  modes->accumBlueBits );
-	WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits );
-	WRITE_PAIR( GLX_DEPTH_SIZE,       modes->depthBits );
-	WRITE_PAIR( GLX_STENCIL_SIZE,     modes->stencilBits );
-	WRITE_PAIR( GLX_X_VISUAL_TYPE,    modes->visualType );
-	WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating );
-	WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel );
-	WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed );
-	WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen );
-	WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue );
-	WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
-	WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
-	WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
-	WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
-	WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
-	/* GLX_VISUAL_SELECT_GROUP_SGIX ? */
-	WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
-	WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
-	WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
-	WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
-	WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
-
-	if (client->swapped) {
-	    __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
-	}
-	WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
-		      (char *)buf);
-    }
-    return Success;
-}
-
-
-int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
-    REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
-    return DoGetFBConfigs(cl, req->screen);
-}
-
-int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
-    /* work around mesa bug, don't use REQUEST_SIZE_MATCH */
-    REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
-    return DoGetFBConfigs(cl, req->screen);
-}
-
-GLboolean
-__glXDrawableInit(__GLXdrawable *drawable,
-		  __GLXscreen *screen, DrawablePtr pDraw, int type,
-		  XID drawId, __GLXconfig *config)
-{
-    drawable->pDraw = pDraw;
-    drawable->type = type;
-    drawable->drawId = drawId;
-    drawable->config = config;
-    drawable->eventMask = 0;
-
-    return GL_TRUE;
-}
-
-void
-__glXDrawableRelease(__GLXdrawable *drawable)
-{
-}
-
-static int 
-DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
-		    __GLXconfig *config, DrawablePtr pDraw, XID drawableId,
-		    XID glxDrawableId, int type)
-{
-    __GLXdrawable *pGlxDraw;
-
-    if (pGlxScreen->pScreen != pDraw->pScreen)
-	return BadMatch;
-
-    pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw,
-					  drawableId, type,
-					  glxDrawableId, config);
-    if (pGlxDraw == NULL)
-	return BadAlloc;
-
-    if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw)) {
-	pGlxDraw->destroy (pGlxDraw);
-	return BadAlloc;
-    }
-
-    /* Add the glx drawable under the XID of the underlying X drawable
-     * too.  That way we'll get a callback in DrawableGone and can
-     * clean up properly when the drawable is destroyed. */
-    if (drawableId != glxDrawableId &&
-	!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
-	pGlxDraw->destroy (pGlxDraw);
-	return BadAlloc;
-    }
-
-    return Success;
-}
-
-static int
-DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
-		  XID drawableId, XID glxDrawableId)
-{
-    DrawablePtr pDraw;
-    int err;
-
-    LEGAL_NEW_RESOURCE(glxDrawableId, client);
-
-    err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
-    if (err != Success) {
-	client->errorValue = drawableId;
-	return err;
-    }
-    if (pDraw->type != DRAWABLE_PIXMAP) {
-	client->errorValue = drawableId;
-	return BadPixmap;
-    }
-
-    err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId,
-			      glxDrawableId, GLX_DRAWABLE_PIXMAP);
-
-    return err;
-}
-
-static void
-determineTextureTarget(ClientPtr client, XID glxDrawableID,
-		       CARD32 *attribs, CARD32 numAttribs)
-{
-    GLenum target = 0;
-    GLenum format = 0;
-    int i, err;
-    __GLXdrawable *pGlxDraw;
-
-    if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP,
-			  DixWriteAccess, &pGlxDraw, &err))
-	/* We just added it in CreatePixmap, so we should never get here. */
-	return;
-
-    for (i = 0; i < numAttribs; i++) {
-	if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
-	    switch (attribs[2 * i + 1]) {
-	    case GLX_TEXTURE_2D_EXT:
-		target = GL_TEXTURE_2D;
-		break;
-	    case GLX_TEXTURE_RECTANGLE_EXT:
-		target = GL_TEXTURE_RECTANGLE_ARB;
-		break;
-	    }
-	}
-
-	if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
-		format = attribs[2 * i + 1];
-    }
- 
-    if (!target) {
-	int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
-	
-	if (h & (h - 1) || w & (w - 1))
-	    target = GL_TEXTURE_RECTANGLE_ARB;
-	else
-	    target = GL_TEXTURE_2D;
-    }
-
-    pGlxDraw->target = target;
-    pGlxDraw->format = format;
-}
-
-int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
-    __GLXconfig *config;
-    __GLXscreen *pGlxScreen;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
-
-    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
-	return err;
-    if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
-	return err;
-
-    return DoCreateGLXPixmap(cl->client, pGlxScreen, config,
-			     req->pixmap, req->glxpixmap);
-}
-
-int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
-    __GLXconfig *config;
-    __GLXscreen *pGlxScreen;
-    int err;
-
-    REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
-    if (req->numAttribs > (UINT32_MAX >> 3)) {
-	client->errorValue = req->numAttribs;
-	return BadValue;
-    }
-    REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
-
-    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
-	return err;
-    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
-	return err;
-
-    err = DoCreateGLXPixmap(cl->client, pGlxScreen, config,
-			    req->pixmap, req->glxpixmap);
-    if (err != Success)
-	return err;
-
-    determineTextureTarget(cl->client, req->glxpixmap,
-			   (CARD32*) (req + 1), req->numAttribs);
-
-    return Success;
-}
-
-int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreateGLXPixmapWithConfigSGIXReq *req = 
-	(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
-    __GLXconfig *config;
-    __GLXscreen *pGlxScreen;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
-
-    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
-	return err;
-    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
-	return err;
-
-    return DoCreateGLXPixmap(cl->client, pGlxScreen,
-			     config, req->pixmap, req->glxpixmap);
-}
-
-
-static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type)
-{
-    __GLXdrawable *pGlxDraw;
-    int err;
-
-    if (!validGlxDrawable(cl->client, glxdrawable, type,
-			  DixDestroyAccess, &pGlxDraw, &err))
-	return err;
-
-    FreeResource(glxdrawable, FALSE);
-
-    return Success;
-}
-
-int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
-
-    return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
-}
-
-int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
-
-    /* should be REQUEST_SIZE_MATCH, but mesa's glXDestroyPixmap used to set
-     * length to 3 instead of 2 */
-    REQUEST_AT_LEAST_SIZE(xGLXDestroyPixmapReq);
-
-    return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
-}
-
-static int
-DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
-		int width, int height, XID glxDrawableId)
-{
-    __GLXconfig	*config;
-    __GLXscreen		*pGlxScreen;
-    PixmapPtr		 pPixmap;
-    int			 err;
-
-    LEGAL_NEW_RESOURCE(glxDrawableId, client);
-
-    if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
-	return err;
-    if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
-	return err;
-
-    __glXenterServer(GL_FALSE);
-    pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
-						    width, height, config->rgbBits, 0);
-    __glXleaveServer(GL_FALSE);
-
-    /* Assign the pixmap the same id as the pbuffer and add it as a
-     * resource so it and the DRI2 drawable will be reclaimed when the
-     * pbuffer is destroyed. */
-    pPixmap->drawable.id = glxDrawableId;
-    if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
-	return BadAlloc;
-
-    return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
-			       glxDrawableId, glxDrawableId,
-			       GLX_DRAWABLE_PBUFFER);
-}
-
-int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreatePbufferReq	*req = (xGLXCreatePbufferReq *) pc;
-    CARD32			*attrs;
-    int				 width, height, i;
-
-    REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
-    if (req->numAttribs > (UINT32_MAX >> 3)) {
-	client->errorValue = req->numAttribs;
-	return BadValue;
-    }
-    REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
-
-    attrs = (CARD32 *) (req + 1);
-    width = 0;
-    height = 0;
-
-    for (i = 0; i < req->numAttribs; i++) {
-	switch (attrs[i * 2]) {
-	case GLX_PBUFFER_WIDTH:
-	    width = attrs[i * 2 + 1];
-	    break;
-	case GLX_PBUFFER_HEIGHT:
-	    height = attrs[i * 2 + 1];
-	    break;
-	case GLX_LARGEST_PBUFFER:
-	case GLX_PRESERVED_CONTENTS:
-	    /* FIXME: huh... */
-	    break;
-	}
-    }
-
-    return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
-			   width, height, req->pbuffer);
-}
-
-int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
-
-    REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
-
-    return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
-			   req->width, req->height, req->pbuffer);
-}
-
-int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq);
-
-    return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
-}
-
-int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq);
-
-    return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
-}
-
-static int
-DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable,
-			   int numAttribs, CARD32 *attribs)
-{
-    __GLXdrawable *pGlxDraw;
-    int i, err;
-
-    if (!validGlxDrawable(client, glxdrawable, GLX_DRAWABLE_ANY,
-			  DixSetAttrAccess, &pGlxDraw, &err))
-	return err;
-
-    for (i = 0; i < numAttribs; i++) {
-	switch(attribs[i * 2]) {
-	case GLX_EVENT_MASK:
-	    /* All we do is to record the event mask so we can send it
-	     * back when queried.  We never actually clobber the
-	     * pbuffers, so we never need to send out the event. */
-	    pGlxDraw->eventMask = attribs[i * 2 + 1];
-	    break;
-	}
-    }
-
-    return Success;
-}
-
-int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXChangeDrawableAttributesReq *req =
-	(xGLXChangeDrawableAttributesReq *) pc;
-
-    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
-    if (req->numAttribs > (UINT32_MAX >> 3)) {
-	client->errorValue = req->numAttribs;
-	return BadValue;
-    }
-#if 0
-    /* mesa sends an additional 8 bytes */
-    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
-#else
-    if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
-	    return BadLength;
-#endif
-
-    return DoChangeDrawableAttributes(cl->client, req->drawable,
-				      req->numAttribs, (CARD32 *) (req + 1));
-}
-
-int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXChangeDrawableAttributesSGIXReq *req =
-	(xGLXChangeDrawableAttributesSGIXReq *)pc;
-
-    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
-    if (req->numAttribs > (UINT32_MAX >> 3)) {
-	client->errorValue = req->numAttribs;
-	return BadValue;
-    }
-    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
-
-    return DoChangeDrawableAttributes(cl->client, req->drawable,
-				      req->numAttribs, (CARD32 *) (req + 1));
-}
-
-int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
-{
-    xGLXCreateWindowReq	*req = (xGLXCreateWindowReq *) pc;
-    __GLXconfig	*config;
-    __GLXscreen		*pGlxScreen;
-    ClientPtr		 client = cl->client;
-    DrawablePtr		 pDraw;
-    int			 err;
-
-    REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
-    if (req->numAttribs > (UINT32_MAX >> 3)) {
-	client->errorValue = req->numAttribs;
-	return BadValue;
-    }
-    REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
-
-    LEGAL_NEW_RESOURCE(req->glxwindow, client);
-
-    if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
-	return err;
-    if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
-	return err;
-
-    err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess);
-    if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
-	client->errorValue = req->window;
-	return BadWindow;
-    }
-
-    if (!validGlxFBConfigForWindow(client, config, pDraw, &err))
-	return err;
-
-    return DoCreateGLXDrawable(client, pGlxScreen, config,
-			       pDraw, req->window,
-			       req->glxwindow, GLX_DRAWABLE_WINDOW);
-}
-
-int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
-
-    /* mesa's glXDestroyWindow used to set length to 3 instead of 2 */
-    REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
-
-    return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
-}
-
-
-/*****************************************************************************/
-
-/*
-** NOTE: There is no portable implementation for swap buffers as of
-** this time that is of value.  Consequently, this code must be
-** implemented by somebody other than SGI.
-*/
-int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
-    GLXContextTag tag;
-    XID drawId;
-    __GLXcontext *glxc = NULL;
-    __GLXdrawable *pGlxDraw;
-    int error;
-
-    REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
-
-    tag = req->contextTag;
-    drawId = req->drawable;
-    if (tag) {
-	glxc = __glXLookupContextByTag(cl, tag);
-	if (!glxc) {
-	    return __glXError(GLXBadContextTag);
-	}
-	/*
-	** The calling thread is swapping its current drawable.  In this case,
-	** glxSwapBuffers is in both GL and X streams, in terms of
-	** sequentiality.
-	*/
-	if (__glXForceCurrent(cl, tag, &error)) {
-	    /*
-	    ** Do whatever is needed to make sure that all preceding requests
-	    ** in both streams are completed before the swap is executed.
-	    */
-	    CALL_Finish( GET_DISPATCH(), () );
-	    glxc->hasUnflushedCommands = GL_FALSE;
-	} else {
-	    return error;
-	}
-    }
-
-    pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
-    if (pGlxDraw == NULL)
-	return error;
-
-    if (pGlxDraw->type == DRAWABLE_WINDOW &&
-	(*pGlxDraw->swapBuffers)(cl->client, pGlxDraw) == GL_FALSE)
-	return __glXError(GLXBadDrawable);
-
-    return Success;
-}
-
-
-static int
-DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
-{
-    ClientPtr client = cl->client;
-    __GLXcontext *ctx;
-    xGLXQueryContextInfoEXTReply reply;
-    int nProps;
-    int *sendBuf, *pSendBuf;
-    int nReplyBytes;
-    int err;
-
-    if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
-	return err;
-
-    nProps = 3;
-    reply.length = nProps << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.n = nProps;
-
-    nReplyBytes = reply.length << 2;
-    sendBuf = (int *)malloc((size_t)nReplyBytes);
-    if (sendBuf == NULL) {
-	return __glXError(GLXBadContext);	/* XXX: Is this correct? */
-    }
-    pSendBuf = sendBuf;
-    *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
-    *pSendBuf++ = (int)(ctx->share_id);
-    *pSendBuf++ = GLX_VISUAL_ID_EXT;
-    *pSendBuf++ = (int)(ctx->config->visualID);
-    *pSendBuf++ = GLX_SCREEN_EXT;
-    *pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
-
-    if (client->swapped) {
-	__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
-    } else {
-	WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
-	WriteToClient(client, nReplyBytes, (char *)sendBuf);
-    }
-    free((char *)sendBuf);
-
-    return Success;
-}
-
-int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq);
-
-    return DoQueryContext(cl, req->context);
-}
-
-int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
-
-    REQUEST_SIZE_MATCH(xGLXQueryContextReq);
-
-    return DoQueryContext(cl, req->context);
-}
-
-int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
-{
-    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
-    ClientPtr		 client = cl->client;
-    __GLXcontext	*context;
-    __GLXdrawable	*pGlxDraw;
-    GLXDrawable		 drawId;
-    int			 buffer;
-    int			 error;
-    CARD32		 num_attribs;
-
-    if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
-	return BadLength;
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-
-    drawId = *((CARD32 *) (pc));
-    buffer = *((INT32 *)  (pc + 4));
-    num_attribs = *((CARD32 *) (pc + 8));
-    if (num_attribs > (UINT32_MAX >> 3)) {
-	client->errorValue = num_attribs;
-	return BadValue;
-    }
-    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 12 + (num_attribs << 3));
-
-    if (buffer != GLX_FRONT_LEFT_EXT)
-	return __glXError(GLXBadPixmap);
-
-    context = __glXForceCurrent (cl, req->contextTag, &error);
-    if (!context)
-	return error;
-
-    if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
-			  DixReadAccess, &pGlxDraw, &error))
-	return error;
-
-    if (!context->textureFromPixmap)
-	return __glXError(GLXUnsupportedPrivateRequest);
-
-    return context->textureFromPixmap->bindTexImage(context,
-						    buffer,
-						    pGlxDraw);
-}
-
-int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
-{
-    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
-    ClientPtr		 client = cl->client;
-    __GLXdrawable	*pGlxDraw;
-    __GLXcontext	*context;
-    GLXDrawable		 drawId;
-    int			 buffer;
-    int			 error;
-
-    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-
-    drawId = *((CARD32 *) (pc));
-    buffer = *((INT32 *)  (pc + 4));
-    
-    context = __glXForceCurrent (cl, req->contextTag, &error);
-    if (!context)
-	return error;
-
-    if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
-			  DixReadAccess, &pGlxDraw, &error))
-	return error;
-
-    if (!context->textureFromPixmap)
-	return __glXError(GLXUnsupportedPrivateRequest);
-
-    return context->textureFromPixmap->releaseTexImage(context,
-						       buffer,
-						       pGlxDraw);
-}
-
-int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
-{
-    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
-    GLXContextTag         tag = req->contextTag;
-    __GLXcontext         *glxc = NULL;
-    __GLXdrawable        *pGlxDraw;
-    ClientPtr		  client = cl->client;
-    GLXDrawable		  drawId;
-    int                   error;
-    int                   x, y, width, height;
-
-    (void) client;
-    (void) req;
-
-    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-
-    drawId = *((CARD32 *) (pc));
-    x      = *((INT32 *)  (pc + 4));
-    y      = *((INT32 *)  (pc + 8));
-    width  = *((INT32 *)  (pc + 12));
-    height = *((INT32 *)  (pc + 16));
-
-    if (tag) {
-	glxc = __glXLookupContextByTag(cl, tag);
-	if (!glxc) {
-	    return __glXError(GLXBadContextTag);
-	}
-	/*
-	** The calling thread is swapping its current drawable.  In this case,
-	** glxSwapBuffers is in both GL and X streams, in terms of
-	** sequentiality.
-	*/
-	if (__glXForceCurrent(cl, tag, &error)) {
-	    /*
-	    ** Do whatever is needed to make sure that all preceding requests
-	    ** in both streams are completed before the swap is executed.
-	    */
-	    CALL_Finish( GET_DISPATCH(), () );
-	    glxc->hasUnflushedCommands = GL_FALSE;
-	} else {
-	    return error;
-	}
-    }
-
-    pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
-    if (!pGlxDraw)
-	return error;
-
-    if (pGlxDraw == NULL ||
-	pGlxDraw->type != GLX_DRAWABLE_WINDOW ||
-	pGlxDraw->copySubBuffer == NULL)
-	return __glXError(GLXBadDrawable);
-
-    (*pGlxDraw->copySubBuffer)(pGlxDraw, x, y, width, height);
-
-    return Success;
-}
-
-/*
-** Get drawable attributes
-*/
-static int
-DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
-{
-    ClientPtr client = cl->client;
-    xGLXGetDrawableAttributesReply reply;
-    __GLXdrawable *pGlxDraw;
-    CARD32 attributes[6];
-    int numAttribs, error;
-
-    if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
-			  DixGetAttrAccess, &pGlxDraw, &error))
-	return error;
-
-    numAttribs = 3;
-    reply.length = numAttribs << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.numAttribs = numAttribs;
-
-    attributes[0] = GLX_TEXTURE_TARGET_EXT;
-    attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
-	GLX_TEXTURE_RECTANGLE_EXT;
-    attributes[2] = GLX_Y_INVERTED_EXT;
-    attributes[3] = GL_FALSE;
-    attributes[4] = GLX_EVENT_MASK;
-    attributes[5] = pGlxDraw->eventMask;
-
-    if (client->swapped) {
-	__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
-    } else {
-	WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
-		      (char *)&reply);
-	WriteToClient(client, reply.length * sizeof (CARD32),
-		      (char *)attributes);
-    }
-
-    return Success;
-}
-
-int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
-
-    /* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */
-    REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
-
-    return DoGetDrawableAttributes(cl, req->drawable);
-}
-
-int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXGetDrawableAttributesSGIXReq *req =
-	(xGLXGetDrawableAttributesSGIXReq *)pc;
-    
-    REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
-
-    return DoGetDrawableAttributes(cl, req->drawable);
-}
-
-/************************************************************************/
-
-/*
-** Render and Renderlarge are not in the GLX API.  They are used by the GLX
-** client library to send batches of GL rendering commands.
-*/
-
-/*
-** Execute all the drawing commands in a request.
-*/
-int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
-{
-    xGLXRenderReq *req;
-    ClientPtr client= cl->client;
-    int left, cmdlen, error;
-    int commandsDone;
-    CARD16 opcode;
-    __GLXrenderHeader *hdr;
-    __GLXcontext *glxc;
-    __GLX_DECLARE_SWAP_VARIABLES;
-
-    REQUEST_AT_LEAST_SIZE(xGLXRenderReq);
-
-    req = (xGLXRenderReq *) pc;
-    if (client->swapped) {
-	__GLX_SWAP_SHORT(&req->length);
-	__GLX_SWAP_INT(&req->contextTag);
-    }
-
-    glxc = __glXForceCurrent(cl, req->contextTag, &error);
-    if (!glxc) {
-	return error;
-    }
-
-    commandsDone = 0;
-    pc += sz_xGLXRenderReq;
-    left = (req->length << 2) - sz_xGLXRenderReq;
-    while (left > 0) {
-        __GLXrenderSizeData entry;
-        int extra;
-	__GLXdispatchRenderProcPtr proc;
-	int err;
-
-	if (left < sizeof(__GLXrenderHeader))
-	    return BadLength;
-
-	/*
-	** Verify that the header length and the overall length agree.
-	** Also, each command must be word aligned.
-	*/
-	hdr = (__GLXrenderHeader *) pc;
-	if (client->swapped) {
-	    __GLX_SWAP_SHORT(&hdr->length);
-	    __GLX_SWAP_SHORT(&hdr->opcode);
-	}
-	cmdlen = hdr->length;
-	opcode = hdr->opcode;
-
-	/*
-	** Check for core opcodes and grab entry data.
-	*/
-	err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
-	proc = (__GLXdispatchRenderProcPtr)
-	    __glXGetProtocolDecodeFunction(& Render_dispatch_info,
-					   opcode, client->swapped);
-
-	if ((err < 0) || (proc == NULL)) {
-	    client->errorValue = commandsDone;
-	    return __glXError(GLXBadRenderRequest);
-	}
-
-        if (entry.varsize) {
-            /* variable size command */
-            extra = (*entry.varsize)(pc + __GLX_RENDER_HDR_SIZE,
-				     client->swapped);
-            if (extra < 0) {
-                extra = 0;
-            }
-            if (cmdlen != __GLX_PAD(entry.bytes + extra)) {
-                return BadLength;
-            }
-        } else {
-            /* constant size command */
-            if (cmdlen != __GLX_PAD(entry.bytes)) {
-                return BadLength;
-            }
-        }
-	if (left < cmdlen) {
-	    return BadLength;
-	}
-
-	/*
-	** Skip over the header and execute the command.  We allow the
-	** caller to trash the command memory.  This is useful especially
-	** for things that require double alignment - they can just shift
-	** the data towards lower memory (trashing the header) by 4 bytes
-	** and achieve the required alignment.
-	*/
-	(*proc)(pc + __GLX_RENDER_HDR_SIZE);
-	pc += cmdlen;
-	left -= cmdlen;
-	commandsDone++;
-    }
-    glxc->hasUnflushedCommands = GL_TRUE;
-    return Success;
-}
-
-
-/*
-** Execute a large rendering request (one that spans multiple X requests).
-*/
-int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
-{
-    xGLXRenderLargeReq *req;
-    ClientPtr client= cl->client;
-    size_t dataBytes;
-    __GLXrenderLargeHeader *hdr;
-    __GLXcontext *glxc;
-    int error;
-    CARD16 opcode;
-    __GLX_DECLARE_SWAP_VARIABLES;
-    
-    req = (xGLXRenderLargeReq *) pc;
-    if (client->swapped) {
-	__GLX_SWAP_SHORT(&req->length);
-	__GLX_SWAP_INT(&req->contextTag);
-	__GLX_SWAP_INT(&req->dataBytes);
-	__GLX_SWAP_SHORT(&req->requestNumber);
-	__GLX_SWAP_SHORT(&req->requestTotal);
-    }
-
-    glxc = __glXForceCurrent(cl, req->contextTag, &error);
-    if (!glxc) {
-	/* Reset in case this isn't 1st request. */
-	__glXResetLargeCommandStatus(cl);
-	return error;
-    }
-    dataBytes = req->dataBytes;
-
-    /*
-    ** Check the request length.
-    */
-    if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
-	client->errorValue = req->length;
-	/* Reset in case this isn't 1st request. */
-	__glXResetLargeCommandStatus(cl);
-	return BadLength;
-    }
-    pc += sz_xGLXRenderLargeReq;
-    
-    if (cl->largeCmdRequestsSoFar == 0) {
-	__GLXrenderSizeData entry;
-	int extra;
-	size_t cmdlen;
-	int err;
-
-	/*
-	** This is the first request of a multi request command.
-	** Make enough space in the buffer, then copy the entire request.
-	*/
-	if (req->requestNumber != 1) {
-	    client->errorValue = req->requestNumber;
-	    return __glXError(GLXBadLargeRequest);
-	}
-
-	hdr = (__GLXrenderLargeHeader *) pc;
-	if (client->swapped) {
-	    __GLX_SWAP_INT(&hdr->length);
-	    __GLX_SWAP_INT(&hdr->opcode);
-	}
-	cmdlen = hdr->length;
-	opcode = hdr->opcode;
-
-	/*
-	** Check for core opcodes and grab entry data.
-	*/
-	err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
-	if (err < 0) {
-	    client->errorValue = opcode;
-	    return __glXError(GLXBadLargeRequest);
-	}
-
-	if (entry.varsize) {
-	    /*
-	    ** If it's a variable-size command (a command whose length must
-	    ** be computed from its parameters), all the parameters needed
-	    ** will be in the 1st request, so it's okay to do this.
-	    */
-	    extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE,
-				     client->swapped);
-	    if (extra < 0) {
-		extra = 0;
-	    }
-	    /* large command's header is 4 bytes longer, so add 4 */
-	    if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
-		return BadLength;
-	    }
-	} else {
-	    /* constant size command */
-	    if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
-		return BadLength;
-	    }
-	}
-	/*
-	** Make enough space in the buffer, then copy the entire request.
-	*/
-	if (cl->largeCmdBufSize < cmdlen) {
-	    if (!cl->largeCmdBuf) {
-		cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
-	    } else {
-		cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
-	    }
-	    if (!cl->largeCmdBuf) {
-		return BadAlloc;
-	    }
-	    cl->largeCmdBufSize = cmdlen;
-	}
-	memcpy(cl->largeCmdBuf, pc, dataBytes);
-
-	cl->largeCmdBytesSoFar = dataBytes;
-	cl->largeCmdBytesTotal = cmdlen;
-	cl->largeCmdRequestsSoFar = 1;
-	cl->largeCmdRequestsTotal = req->requestTotal;
-	return Success;
-	
-    } else {
-	/*
-	** We are receiving subsequent (i.e. not the first) requests of a
-	** multi request command.
-	*/
-
-	/*
-	** Check the request number and the total request count.
-	*/
-	if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
-	    client->errorValue = req->requestNumber;
-	    __glXResetLargeCommandStatus(cl);
-	    return __glXError(GLXBadLargeRequest);
-	}
-	if (req->requestTotal != cl->largeCmdRequestsTotal) {
-	    client->errorValue = req->requestTotal;
-	    __glXResetLargeCommandStatus(cl);
-	    return __glXError(GLXBadLargeRequest);
-	}
-
-	/*
-	** Check that we didn't get too much data.
-	*/
-	if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
-	    client->errorValue = dataBytes;
-	    __glXResetLargeCommandStatus(cl);
-	    return __glXError(GLXBadLargeRequest);
-	}
-	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
-	cl->largeCmdBytesSoFar += dataBytes;
-	cl->largeCmdRequestsSoFar++;
-
-	if (req->requestNumber == cl->largeCmdRequestsTotal) {
-	    __GLXdispatchRenderProcPtr proc;
-
-	    /*
-	    ** This is the last request; it must have enough bytes to complete
-	    ** the command.
-	    */
-	    /* NOTE: the two pad macros have been added below; they are needed
-	    ** because the client library pads the total byte count, but not
-	    ** the per-request byte counts.  The Protocol Encoding says the
-	    ** total byte count should not be padded, so a proposal will be 
-	    ** made to the ARB to relax the padding constraint on the total 
-	    ** byte count, thus preserving backward compatibility.  Meanwhile, 
-	    ** the padding done below fixes a bug that did not allow
-	    ** large commands of odd sizes to be accepted by the server.
-	    */
-	    if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
-		__GLX_PAD(cl->largeCmdBytesTotal)) {
-		client->errorValue = dataBytes;
-		__glXResetLargeCommandStatus(cl);
-		return __glXError(GLXBadLargeRequest);
-	    }
-	    hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
-	    /*
-	    ** The opcode and length field in the header had already been
-	    ** swapped when the first request was received.
-	    **
-	    ** Use the opcode to index into the procedure table.
-	    */
-	    opcode = hdr->opcode;
-
-	    proc = (__GLXdispatchRenderProcPtr)
-	      __glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode,
-					     client->swapped);
-	    if (proc == NULL) {
-		client->errorValue = opcode;
-		return __glXError(GLXBadLargeRequest);
-	    }
-
-	    /*
-	    ** Skip over the header and execute the command.
-	    */
-	    (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
-	    glxc->hasUnflushedCommands = GL_TRUE;
-
-	    /*
-	    ** Reset for the next RenderLarge series.
-	    */
-	    __glXResetLargeCommandStatus(cl);
-	} else {
-	    /*
-	    ** This is neither the first nor the last request.
-	    */
-	}
-	return Success;
-    }
-}
-
-/************************************************************************/
-
-/*
-** No support is provided for the vendor-private requests other than
-** allocating the entry points in the dispatch table.
-*/
-
-int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
-    GLint vendorcode = req->vendorCode;
-    __GLXdispatchVendorPrivProcPtr proc;
-
-    REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
-
-    proc = (__GLXdispatchVendorPrivProcPtr)
-      __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
-				     vendorcode, 0);
-    if (proc != NULL) {
-	(*proc)(cl, (GLbyte*)req);
-	return Success;
-    }
-
-    cl->client->errorValue = req->vendorCode;
-    return __glXError(GLXUnsupportedPrivateRequest);
-}
-
-int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
-    GLint vendorcode = req->vendorCode;
-    __GLXdispatchVendorPrivProcPtr proc;
-
-    REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
-
-    proc = (__GLXdispatchVendorPrivProcPtr)
-      __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
-				     vendorcode, 0);
-    if (proc != NULL) {
-	return (*proc)(cl, (GLbyte*)req);
-    }
-
-    cl->client->errorValue = vendorcode;
-    return __glXError(GLXUnsupportedPrivateRequest);
-}
-
-int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
-    xGLXQueryExtensionsStringReply reply;
-    __GLXscreen *pGlxScreen;
-    size_t n, length;
-    char *buf;
-    int err;
-
-    REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
-
-    if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
-	return err;
-
-    n = strlen(pGlxScreen->GLXextensions) + 1;
-    length = __GLX_PAD(n) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = n;
-
-    /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
-    buf = (char *) malloc(length << 2);
-    if (buf == NULL)
-        return BadAlloc;
-    memcpy(buf, pGlxScreen->GLXextensions, n);
-
-    if (client->swapped) {
-        glxSwapQueryExtensionsStringReply(client, &reply, buf);
-    } else {
-        WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
-        WriteToClient(client, (int)(length << 2), (char *)buf);
-    }
-
-    free(buf);
-    return Success;
-}
-
-int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
-    xGLXQueryServerStringReply reply;
-    size_t n, length;
-    const char *ptr;
-    char *buf;
-    __GLXscreen *pGlxScreen;
-    int err;
-    char ver_str[16];
-
-    REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
-
-    if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
-	return err;
-
-    switch(req->name) {
-	case GLX_VENDOR:
-	    ptr = pGlxScreen->GLXvendor;
-	    break;
-	case GLX_VERSION:
-	    /* Return to the server version rather than the screen version
-	     * to prevent confusion when they do not match.
-	     */
-	    snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
-	    ptr = ver_str;
-	    break;
-	case GLX_EXTENSIONS:
-	    ptr = pGlxScreen->GLXextensions;
-	    break;
-	default:
-	    return BadValue; 
-    }
-
-    n = strlen(ptr) + 1;
-    length = __GLX_PAD(n) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = n;
-
-    buf = (char *) malloc(length << 2);
-    if (buf == NULL) {
-        return BadAlloc;
-    }
-    memcpy(buf, ptr, n);
-
-    if (client->swapped) {
-        glxSwapQueryServerStringReply(client, &reply, buf);
-    } else {
-        WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
-        WriteToClient(client, (int)(length << 2), buf);
-    }
-
-    free(buf);
-    return Success;
-}
-
-int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
-{
-    ClientPtr client = cl->client;
-    xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
-    const char *buf;
-   
-    REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
-
-    buf = (const char *)(req+1);
-    if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
-	return BadLength;
-
-    cl->GLClientmajorVersion = req->major;
-    cl->GLClientminorVersion = req->minor;
-    free(cl->GLClientextensions);
-    cl->GLClientextensions = strdup(buf);
-
-    return Success;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+#include <assert.h>
+
+#include "glxserver.h"
+#include <GL/glxtokens.h>
+#include <unpack.h>
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "glxutil.h"
+#include "glxext.h"
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+#include "indirect_dispatch.h"
+#include "indirect_table.h"
+#include "indirect_util.h"
+
+static int
+validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
+{
+    /*
+    ** Check if screen exists.
+    */
+    if (screen < 0 || screen >= screenInfo.numScreens) {
+	client->errorValue = screen;
+	*err = BadValue;
+	return FALSE;
+    }
+    *pGlxScreen = glxGetScreen(screenInfo.screens[screen]);
+
+    return TRUE;
+}
+
+static int
+validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
+		 __GLXconfig **config, int *err)
+{
+    __GLXconfig *m;
+
+    for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
+	if (m->fbconfigID == id) {
+	    *config = m;
+	    return TRUE;
+	}
+
+    client->errorValue = id;
+    *err = __glXError(GLXBadFBConfig);
+
+    return FALSE;
+}
+
+static int
+validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
+	       __GLXconfig **config, int *err)
+{
+    int i;
+
+    for (i = 0; i < pGlxScreen->numVisuals; i++)
+ 	if (pGlxScreen->visuals[i]->visualID == id) {
+	    *config = pGlxScreen->visuals[i];
+	    return TRUE;
+	}
+
+    client->errorValue = id;
+    *err = BadValue;
+
+    return FALSE;
+}
+
+static int
+validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
+			  DrawablePtr pDraw, int *err)
+{
+    ScreenPtr pScreen = pDraw->pScreen;
+    VisualPtr pVisual = NULL;
+    XID vid;
+    int i;
+
+    vid = wVisual((WindowPtr)pDraw);
+    for (i = 0; i < pScreen->numVisuals; i++) {
+	if (pScreen->visuals[i].vid == vid) {
+	    pVisual = &pScreen->visuals[i];
+	    break;
+	}
+    }
+
+    /* FIXME: What exactly should we check here... */
+    if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
+	!(config->drawableType & GLX_WINDOW_BIT)) {
+	client->errorValue = pDraw->id;
+	*err = BadMatch;
+	return FALSE;
+    }
+
+    return TRUE;
+}
+
+static int
+validGlxContext(ClientPtr client, XID id, int access_mode,
+		__GLXcontext **context, int *err)
+{
+    *err = dixLookupResourceByType((pointer *) context, id,
+				   __glXContextRes, client, access_mode);
+    if (*err != Success || (*context)->idExists == GL_FALSE) {
+	client->errorValue = id;
+	if (*err == BadValue || *err == Success)
+	    *err = __glXError(GLXBadContext);
+	return FALSE;
+    }
+
+    return TRUE;
+}
+
+static int
+validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
+		 __GLXdrawable **drawable, int *err)
+{
+    int rc;
+
+    rc = dixLookupResourceByType((pointer *) drawable, id,
+				 __glXDrawableRes, client, access_mode);
+    if (rc != Success && rc != BadValue) {
+	*err = rc;
+	client->errorValue = id;
+	return FALSE;
+    }
+
+    /* If the ID of the glx drawable we looked up doesn't match the id
+     * we looked for, it's because we looked it up under the X
+     * drawable ID (see DoCreateGLXDrawable). */
+    if (rc == BadValue ||
+	(*drawable)->drawId != id ||
+	(type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
+	client->errorValue = id;
+	switch (type) {
+	case GLX_DRAWABLE_WINDOW:
+	    *err = __glXError(GLXBadWindow);
+	    return FALSE;
+	case GLX_DRAWABLE_PIXMAP:
+	    *err = __glXError(GLXBadPixmap);
+	    return FALSE;
+	case GLX_DRAWABLE_PBUFFER:
+	    *err = __glXError(GLXBadPbuffer);
+	    return FALSE;
+	case GLX_DRAWABLE_ANY:
+	    *err = __glXError(GLXBadDrawable);
+	    return FALSE;
+	}
+    }
+
+    return TRUE;
+}
+
+void
+__glXContextDestroy(__GLXcontext *context)
+{
+    __glXFlushContextCache();
+}
+
+static void __glXdirectContextDestroy(__GLXcontext *context)
+{
+    __glXContextDestroy(context);
+    free(context);
+}
+
+static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
+					      __GLXconfig *modes,
+					      __GLXcontext *shareContext)
+{
+    __GLXcontext *context;
+
+    context = calloc(1, sizeof (__GLXcontext));
+    if (context == NULL)
+	return NULL;
+
+    context->destroy = __glXdirectContextDestroy;
+
+    return context;
+}
+
+/**
+ * Create a GL context with the given properties.  This routine is used
+ * to implement \c glXCreateContext, \c glXCreateNewContext, and
+ * \c glXCreateContextWithConfigSGIX.  This works becuase of the hack way
+ * that GLXFBConfigs are implemented.  Basically, the FBConfigID is the
+ * same as the VisualID.
+ */
+
+static int
+DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
+		GLXContextID shareList, __GLXconfig *config,
+		__GLXscreen *pGlxScreen, GLboolean isDirect)
+{
+    ClientPtr client = cl->client;
+    __GLXcontext *glxc, *shareglxc;
+    int err;
+    
+    LEGAL_NEW_RESOURCE(gcId, client);
+
+    /*
+    ** Find the display list space that we want to share.  
+    **
+    ** NOTE: In a multithreaded X server, we would need to keep a reference
+    ** count for each display list so that if one client detroyed a list that 
+    ** another client was using, the list would not really be freed until it 
+    ** was no longer in use.  Since this sample implementation has no support 
+    ** for multithreaded servers, we don't do this.  
+    */
+    if (shareList == None) {
+	shareglxc = 0;
+    } else {
+	if (!validGlxContext(client, shareList, DixReadAccess,
+			     &shareglxc, &err))
+	    return err;
+
+	if (shareglxc->isDirect) {
+	    /*
+	    ** NOTE: no support for sharing display lists between direct
+	    ** contexts, even if they are in the same address space.
+	    */
+#if 0
+            /* Disabling this code seems to allow shared display lists
+             * and texture objects to work.  We'll leave it disabled for now.
+             */
+	    client->errorValue = shareList;
+	    return BadMatch;
+#endif
+	} else {
+	    /*
+	    ** Create an indirect context regardless of what the client asked
+	    ** for; this way we can share display list space with shareList.
+	    */
+	    isDirect = GL_FALSE;
+	}
+    }
+
+    /*
+    ** Allocate memory for the new context
+    */
+    if (!isDirect)
+	glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
+    else
+	glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
+    if (!glxc) {
+	return BadAlloc;
+    }
+
+    /*
+    ** Initially, setup the part of the context that could be used by
+    ** a GL core that needs windowing information (e.g., Mesa).
+    */
+    glxc->pGlxScreen = pGlxScreen;
+    glxc->config = config;
+
+    /*
+    ** Register this context as a resource.
+    */
+    if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+	(*glxc->destroy)(glxc);
+	client->errorValue = gcId;
+	return BadAlloc;
+    }
+    
+    /*
+    ** Finally, now that everything is working, setup the rest of the
+    ** context.
+    */
+    glxc->id = gcId;
+    glxc->share_id = shareList;
+    glxc->idExists = GL_TRUE;
+    glxc->isCurrent = GL_FALSE;
+    glxc->isDirect = isDirect;
+    glxc->renderMode = GL_RENDER;
+
+    __glXAddToContextList(glxc);
+
+    return Success;
+}
+
+int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+    __GLXconfig *config;
+    __GLXscreen *pGlxScreen;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXCreateContextReq);
+
+    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
+	return err;
+    if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
+	return err;
+
+    return DoCreateContext(cl, req->context, req->shareList,
+			   config, pGlxScreen, req->isDirect);
+}
+
+int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+    __GLXconfig *config;
+    __GLXscreen *pGlxScreen;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
+
+    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
+	return err;
+    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
+	return err;
+
+    return DoCreateContext(cl, req->context, req->shareList,
+			   config, pGlxScreen, req->isDirect);
+}
+
+int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreateContextWithConfigSGIXReq *req = 
+	(xGLXCreateContextWithConfigSGIXReq *) pc;
+    __GLXconfig *config;
+    __GLXscreen *pGlxScreen;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
+
+    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
+	return err;
+    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
+	return err;
+
+    return DoCreateContext(cl, req->context, req->shareList,
+			   config, pGlxScreen, req->isDirect);
+}
+
+int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+    __GLXcontext *glxc;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
+
+    if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
+			 &glxc, &err))
+	    return err;
+
+    glxc->idExists = GL_FALSE;
+    if (!glxc->isCurrent)
+        FreeResourceByType(req->context, __glXContextRes, FALSE);
+
+    return Success;
+}
+
+/*
+ * This will return "deleted" contexts, ie, where idExists is GL_FALSE.
+ * Contrast validGlxContext, which will not.  We're cheating here and
+ * using the XID as the context tag, which is fine as long as we defer
+ * actually destroying the context until it's no longer referenced, and
+ * block clients from trying to MakeCurrent on contexts that are on the
+ * way to destruction.  Notice that DoMakeCurrent calls validGlxContext
+ * for new contexts but __glXLookupContextByTag for previous contexts.
+ */
+__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+{
+    __GLXcontext *ret;
+
+    if (dixLookupResourceByType((void **)&ret, tag, __glXContextRes,
+                                cl->client, DixUseAccess) == Success)
+        return ret;
+
+    return NULL;
+}
+
+/*****************************************************************************/
+
+static void StopUsingContext(__GLXcontext *glxc)
+{
+    if (glxc) {
+	if (glxc == __glXLastContext) {
+	    /* Tell server GL library */
+	    __glXLastContext = 0;
+	}
+	glxc->isCurrent = GL_FALSE;
+	if (!glxc->idExists) {
+            FreeResourceByType(glxc->id, __glXContextRes, FALSE);
+	}
+    }
+}
+
+static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+{
+    glxc->isCurrent = GL_TRUE;
+    __glXLastContext = glxc;	
+}
+
+/**
+ * This is a helper function to handle the legacy (pre GLX 1.3) cases
+ * where passing an X window to glXMakeCurrent is valid.  Given a
+ * resource ID, look up the GLX drawable if available, otherwise, make
+ * sure it's an X window and create a GLX drawable one the fly.
+ */
+static __GLXdrawable *
+__glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
+		 int *error)
+{
+    DrawablePtr pDraw;
+    __GLXdrawable *pGlxDraw;
+    int rc;
+
+    if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
+			 DixWriteAccess, &pGlxDraw, &rc)) {
+	if (glxc != NULL && pGlxDraw->config != glxc->config) {
+	    client->errorValue = drawId;
+	    *error = BadMatch;
+	    return NULL;
+	}
+
+	return pGlxDraw;
+    }
+
+    /* No active context and an unknown drawable, bail. */
+    if (glxc == NULL) {
+	    client->errorValue = drawId;
+	    *error = BadMatch;
+	    return NULL;
+    }
+
+    /* The drawId wasn't a GLX drawable.  Make sure it's a window and
+     * create a GLXWindow for it.  Check that the drawable screen
+     * matches the context screen and that the context fbconfig is
+     * compatible with the window visual. */
+
+    rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
+    if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
+	client->errorValue = drawId;
+	*error = __glXError(GLXBadDrawable);
+	return NULL;
+    }
+
+    if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
+	client->errorValue = pDraw->pScreen->myNum;
+	*error = BadMatch;
+	return NULL;
+    }
+
+    if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
+	return NULL;
+
+    pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
+						pDraw, drawId,
+						GLX_DRAWABLE_WINDOW,
+						drawId, glxc->config);
+
+    /* since we are creating the drawablePrivate, drawId should be new */
+    if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
+	pGlxDraw->destroy (pGlxDraw);
+	*error = BadAlloc;
+	return NULL;
+    }
+
+    return pGlxDraw;
+}
+
+/*****************************************************************************/
+/*
+** Make an OpenGL context and drawable current.
+*/
+
+static int
+DoMakeCurrent(__GLXclientState *cl,
+	      GLXDrawable drawId, GLXDrawable readId,
+	      GLXContextID contextId, GLXContextTag tag)
+{
+    ClientPtr client = cl->client;
+    xGLXMakeCurrentReply reply;
+    __GLXcontext *glxc, *prevglxc;
+    __GLXdrawable *drawPriv = NULL;
+    __GLXdrawable *readPriv = NULL;
+    int error;
+    GLuint  mask;
+
+    /*
+    ** If one is None and the other isn't, it's a bad match.
+    */
+
+    mask  = (drawId == None)    ? (1 << 0) : 0;
+    mask |= (readId == None)    ? (1 << 1) : 0;
+    mask |= (contextId == None) ? (1 << 2) : 0;
+
+    if ( (mask != 0x00) && (mask != 0x07) ) {
+	return BadMatch;
+    }
+    
+    /*
+    ** Lookup old context.  If we have one, it must be in a usable state.
+    */
+    if (tag != 0) {
+	prevglxc = __glXLookupContextByTag(cl, tag);
+	if (!prevglxc) {
+	    /*
+	    ** Tag for previous context is invalid.
+	    */
+	    return __glXError(GLXBadContextTag);
+	}
+	if (prevglxc->renderMode != GL_RENDER) {
+	    /* Oops.  Not in render mode render. */
+	    client->errorValue = prevglxc->id;
+	    return __glXError(GLXBadContextState);
+	}
+    } else {
+	prevglxc = 0;
+    }
+
+    /*
+    ** Lookup new context.  It must not be current for someone else.
+    */
+    if (contextId != None) {
+	int  status;
+
+	if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
+	    return error;
+	if ((glxc != prevglxc) && glxc->isCurrent) {
+	    /* Context is current to somebody else */
+	    return BadAccess;
+	}
+
+	assert( drawId != None );
+	assert( readId != None );
+
+	drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
+	if (drawPriv == NULL)
+	    return status;
+
+	readPriv = __glXGetDrawable(glxc, readId, client, &status);
+	if (readPriv == NULL)
+	    return status;
+
+    } else {
+	/* Switching to no context.  Ignore new drawable. */
+	glxc = 0;
+	drawPriv = 0;
+	readPriv = 0;
+    }
+
+
+    if (prevglxc) {
+	/*
+	** Flush the previous context if needed.
+	*/
+	if (prevglxc->hasUnflushedCommands) {
+	    if (__glXForceCurrent(cl, tag, (int *)&error)) {
+		CALL_Flush( GET_DISPATCH(), () );
+		prevglxc->hasUnflushedCommands = GL_FALSE;
+	    } else {
+		return error;
+	    }
+	}
+
+	/*
+	** Make the previous context not current.
+	*/
+	if (!(*prevglxc->loseCurrent)(prevglxc)) {
+	    return __glXError(GLXBadContext);
+	}
+	__glXFlushContextCache();
+	if (!prevglxc->isDirect) {
+	    prevglxc->drawPriv = NULL;
+	    prevglxc->readPriv = NULL;
+	}
+    }
+	
+
+    if ((glxc != 0) && !glxc->isDirect) {
+
+	glxc->drawPriv = drawPriv;
+	glxc->readPriv = readPriv;
+
+	/* make the context current */
+	if (!(*glxc->makeCurrent)(glxc)) {
+	    glxc->drawPriv = NULL;
+	    glxc->readPriv = NULL;
+	    return __glXError(GLXBadContext);
+	}
+
+	glxc->isCurrent = GL_TRUE;
+    }
+
+    StopUsingContext(prevglxc);
+
+    if (glxc) {
+	StartUsingContext(cl, glxc);
+	reply.contextTag = glxc->id;
+    } else {
+	reply.contextTag = 0;
+    }
+
+    reply.length = 0;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+
+    if (client->swapped) {
+	__glXSwapMakeCurrentReply(client, &reply);
+    } else {
+	WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply);
+    }
+    return Success;
+}
+
+int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
+
+    return DoMakeCurrent( cl, req->drawable, req->drawable,
+			  req->context, req->oldContextTag );
+}
+
+int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
+
+    return DoMakeCurrent( cl, req->drawable, req->readdrawable,
+			  req->context, req->oldContextTag );
+}
+
+int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
+
+    return DoMakeCurrent( cl, req->drawable, req->readable,
+			  req->context, req->oldContextTag );
+}
+
+int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+    xGLXIsDirectReply reply;
+    __GLXcontext *glxc;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXIsDirectReq);
+
+    if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
+	return err;
+
+    reply.isDirect = glxc->isDirect;
+    reply.length = 0;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+
+    if (client->swapped) {
+	__glXSwapIsDirectReply(client, &reply);
+    } else {
+	WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+    }
+
+    return Success;
+}
+
+int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
+    xGLXQueryVersionReply reply;
+    GLuint major, minor;
+
+    REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
+
+    major = req->majorVersion;
+    minor = req->minorVersion;
+    (void)major;
+    (void)minor;
+
+    /*
+    ** Server should take into consideration the version numbers sent by the
+    ** client if it wants to work with older clients; however, in this
+    ** implementation the server just returns its version number.
+    */
+    reply.majorVersion = glxMajorVersion;
+    reply.minorVersion = glxMinorVersion;
+    reply.length = 0;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+
+    if (client->swapped) {
+	__glXSwapQueryVersionReply(client, &reply);
+    } else {
+	WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+    }
+    return Success;
+}
+
+int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
+    GLXContextTag tag;
+    __GLXcontext *glxc = NULL;
+    int error;
+
+    REQUEST_SIZE_MATCH(xGLXWaitGLReq);
+
+    tag = req->contextTag;
+    if (tag) {
+	glxc = __glXLookupContextByTag(cl, tag);
+	if (!glxc)
+	    return __glXError(GLXBadContextTag);
+    
+	if (!__glXForceCurrent(cl, req->contextTag, &error))
+	    return error;
+
+	CALL_Finish( GET_DISPATCH(), () );
+    }
+
+    if (glxc && glxc->drawPriv->waitGL)
+	(*glxc->drawPriv->waitGL)(glxc->drawPriv);
+
+    return Success;
+}
+
+int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
+    GLXContextTag tag;
+    __GLXcontext *glxc = NULL;
+    int error;
+
+    REQUEST_SIZE_MATCH(xGLXWaitXReq);
+
+    tag = req->contextTag;
+    if (tag) {
+	glxc = __glXLookupContextByTag(cl, tag);
+	if (!glxc)
+	    return __glXError(GLXBadContextTag);
+    
+	if (!__glXForceCurrent(cl, req->contextTag, &error))
+	    return error;
+    }
+
+    if (glxc && glxc->drawPriv->waitX)
+	(*glxc->drawPriv->waitX)(glxc->drawPriv);
+
+    return Success;
+}
+
+int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+    GLXContextID source;
+    GLXContextID dest;
+    GLXContextTag tag;
+    unsigned long mask;
+    __GLXcontext *src, *dst;
+    int error;
+
+    REQUEST_SIZE_MATCH(xGLXCopyContextReq);
+
+    source = req->source;
+    dest = req->dest;
+    tag = req->contextTag;
+    mask = req->mask;
+    if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
+	return error;
+    if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
+	return error;
+
+    /*
+    ** They must be in the same address space, and same screen.
+    ** NOTE: no support for direct rendering contexts here.
+    */
+    if (src->isDirect || dst->isDirect ||
+	(src->pGlxScreen != dst->pGlxScreen)) {
+	client->errorValue = source;
+	return BadMatch;
+    }
+
+    /*
+    ** The destination context must not be current for any client.
+    */
+    if (dst->isCurrent) {
+	client->errorValue = dest;
+	return BadAccess;
+    }
+
+    if (tag) {
+	__GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+	
+	if (!tagcx) {
+	    return __glXError(GLXBadContextTag);
+	}
+	if (tagcx != src) {
+	    /*
+	    ** This would be caused by a faulty implementation of the client
+	    ** library.
+	    */
+	    return BadMatch;
+	}
+	/*
+	** In this case, glXCopyContext is in both GL and X streams, in terms
+	** of sequentiality.
+	*/
+	if (__glXForceCurrent(cl, tag, &error)) {
+	    /*
+	    ** Do whatever is needed to make sure that all preceding requests
+	    ** in both streams are completed before the copy is executed.
+	    */
+	    CALL_Finish( GET_DISPATCH(), () );
+	    tagcx->hasUnflushedCommands = GL_FALSE;
+	} else {
+	    return error;
+	}
+    }
+    /*
+    ** Issue copy.  The only reason for failure is a bad mask.
+    */
+    if (!(*dst->copy)(dst, src, mask)) {
+	client->errorValue = mask;
+	return BadValue;
+    }
+    return Success;
+}
+
+enum {
+    GLX_VIS_CONFIG_UNPAIRED = 18,
+    GLX_VIS_CONFIG_PAIRED = 20
+};
+
+enum {
+    GLX_VIS_CONFIG_TOTAL = GLX_VIS_CONFIG_UNPAIRED + GLX_VIS_CONFIG_PAIRED
+};
+
+int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+    ClientPtr client = cl->client;
+    xGLXGetVisualConfigsReply reply;
+    __GLXscreen *pGlxScreen;
+    __GLXconfig *modes;
+    CARD32 buf[GLX_VIS_CONFIG_TOTAL];
+    int p, i, err;
+    __GLX_DECLARE_SWAP_VARIABLES;
+    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+    REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
+
+    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
+	return err;
+
+    reply.numVisuals = pGlxScreen->numVisuals;
+    reply.numProps = GLX_VIS_CONFIG_TOTAL;
+    reply.length = (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+
+    if (client->swapped) {
+	__GLX_SWAP_SHORT(&reply.sequenceNumber);
+	__GLX_SWAP_INT(&reply.length);
+	__GLX_SWAP_INT(&reply.numVisuals);
+	__GLX_SWAP_INT(&reply.numProps);
+    }
+
+    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
+
+    for (i = 0; i < pGlxScreen->numVisuals; i++) {
+	modes = pGlxScreen->visuals[i];
+
+	p = 0;
+	buf[p++] = modes->visualID;
+	buf[p++] = glxConvertToXVisualType( modes->visualType );
+	buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
+
+	buf[p++] = modes->redBits;
+	buf[p++] = modes->greenBits;
+	buf[p++] = modes->blueBits;
+	buf[p++] = modes->alphaBits;
+	buf[p++] = modes->accumRedBits;
+	buf[p++] = modes->accumGreenBits;
+	buf[p++] = modes->accumBlueBits;
+	buf[p++] = modes->accumAlphaBits;
+
+	buf[p++] = modes->doubleBufferMode;
+	buf[p++] = modes->stereoMode;
+
+	buf[p++] = modes->rgbBits;
+	buf[p++] = modes->depthBits;
+	buf[p++] = modes->stencilBits;
+	buf[p++] = modes->numAuxBuffers;
+	buf[p++] = modes->level;
+
+	assert(p == GLX_VIS_CONFIG_UNPAIRED);
+	/* 
+	** Add token/value pairs for extensions.
+	*/
+	buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+	buf[p++] = modes->visualRating;
+	buf[p++] = GLX_TRANSPARENT_TYPE;
+	buf[p++] = modes->transparentPixel;
+	buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+	buf[p++] = modes->transparentRed;
+	buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+	buf[p++] = modes->transparentGreen;
+	buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+	buf[p++] = modes->transparentBlue;
+	buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+	buf[p++] = modes->transparentAlpha;
+	buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+	buf[p++] = modes->transparentIndex;
+	buf[p++] = GLX_SAMPLES_SGIS;
+	buf[p++] = modes->samples;
+	buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+	buf[p++] = modes->sampleBuffers;
+	buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
+	buf[p++] = 0;
+
+	assert(p == GLX_VIS_CONFIG_TOTAL);
+	if (client->swapped) {
+	    __GLX_SWAP_INT_ARRAY(buf, p);
+	}
+	WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf);
+    }
+    return Success;
+}
+
+#define __GLX_TOTAL_FBCONFIG_ATTRIBS (36)
+#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
+/**
+ * Send the set of GLXFBConfigs to the client.  There is not currently
+ * and interface into the driver on the server-side to get GLXFBConfigs,
+ * so we "invent" some based on the \c __GLXvisualConfig structures that
+ * the driver does supply.
+ * 
+ * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX
+ * is the same, so this routine pulls double duty.
+ */
+
+static int
+DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
+{
+    ClientPtr client = cl->client;
+    xGLXGetFBConfigsReply reply;
+    __GLXscreen *pGlxScreen;
+    CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
+    int p, err;
+    __GLXconfig *modes;
+    __GLX_DECLARE_SWAP_VARIABLES;
+    __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+    if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
+	return err;
+
+    reply.numFBConfigs = pGlxScreen->numFBConfigs;
+    reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
+    reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs);
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+
+    if (client->swapped) {
+	__GLX_SWAP_SHORT(&reply.sequenceNumber);
+	__GLX_SWAP_INT(&reply.length);
+	__GLX_SWAP_INT(&reply.numFBConfigs);
+	__GLX_SWAP_INT(&reply.numAttribs);
+    }
+
+    WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
+
+    for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
+	p = 0;
+
+#define WRITE_PAIR(tag,value) \
+    do { buf[p++] = tag ; buf[p++] = value ; } while( 0 )
+
+	WRITE_PAIR( GLX_VISUAL_ID,        modes->visualID );
+	WRITE_PAIR( GLX_FBCONFIG_ID,      modes->fbconfigID );
+	WRITE_PAIR( GLX_X_RENDERABLE,     GL_TRUE );
+
+	WRITE_PAIR( GLX_RGBA,
+		    (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE );
+	WRITE_PAIR( GLX_RENDER_TYPE,      modes->renderType );
+	WRITE_PAIR( GLX_DOUBLEBUFFER,     modes->doubleBufferMode );
+	WRITE_PAIR( GLX_STEREO,           modes->stereoMode );
+
+	WRITE_PAIR( GLX_BUFFER_SIZE,      modes->rgbBits );
+	WRITE_PAIR( GLX_LEVEL,            modes->level );
+	WRITE_PAIR( GLX_AUX_BUFFERS,      modes->numAuxBuffers );
+	WRITE_PAIR( GLX_RED_SIZE,         modes->redBits );
+	WRITE_PAIR( GLX_GREEN_SIZE,       modes->greenBits );
+	WRITE_PAIR( GLX_BLUE_SIZE,        modes->blueBits );
+	WRITE_PAIR( GLX_ALPHA_SIZE,       modes->alphaBits );
+	WRITE_PAIR( GLX_ACCUM_RED_SIZE,   modes->accumRedBits );
+	WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits );
+	WRITE_PAIR( GLX_ACCUM_BLUE_SIZE,  modes->accumBlueBits );
+	WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits );
+	WRITE_PAIR( GLX_DEPTH_SIZE,       modes->depthBits );
+	WRITE_PAIR( GLX_STENCIL_SIZE,     modes->stencilBits );
+	WRITE_PAIR( GLX_X_VISUAL_TYPE,    modes->visualType );
+	WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating );
+	WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel );
+	WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed );
+	WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen );
+	WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue );
+	WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
+	WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
+	WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
+	WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
+	WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
+	/* GLX_VISUAL_SELECT_GROUP_SGIX ? */
+	WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
+	WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
+	WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
+	WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
+	WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
+
+	if (client->swapped) {
+	    __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
+	}
+	WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH,
+		      (char *)buf);
+    }
+    return Success;
+}
+
+
+int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+    REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
+    return DoGetFBConfigs(cl, req->screen);
+}
+
+int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+    /* work around mesa bug, don't use REQUEST_SIZE_MATCH */
+    REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
+    return DoGetFBConfigs(cl, req->screen);
+}
+
+GLboolean
+__glXDrawableInit(__GLXdrawable *drawable,
+		  __GLXscreen *screen, DrawablePtr pDraw, int type,
+		  XID drawId, __GLXconfig *config)
+{
+    drawable->pDraw = pDraw;
+    drawable->type = type;
+    drawable->drawId = drawId;
+    drawable->config = config;
+    drawable->eventMask = 0;
+
+    return GL_TRUE;
+}
+
+void
+__glXDrawableRelease(__GLXdrawable *drawable)
+{
+}
+
+static int 
+DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
+		    __GLXconfig *config, DrawablePtr pDraw, XID drawableId,
+		    XID glxDrawableId, int type)
+{
+    __GLXdrawable *pGlxDraw;
+
+    if (pGlxScreen->pScreen != pDraw->pScreen)
+	return BadMatch;
+
+    pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw,
+					  drawableId, type,
+					  glxDrawableId, config);
+    if (pGlxDraw == NULL)
+	return BadAlloc;
+
+    if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw)) {
+	pGlxDraw->destroy (pGlxDraw);
+	return BadAlloc;
+    }
+
+    /*
+     * Windows aren't refcounted, so track both the X and the GLX window
+     * so we get called regardless of destruction order.
+     */
+    if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
+	!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
+	pGlxDraw->destroy (pGlxDraw);
+	return BadAlloc;
+    }
+
+    return Success;
+}
+
+static int
+DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
+		  XID drawableId, XID glxDrawableId)
+{
+    DrawablePtr pDraw;
+    int err;
+
+    LEGAL_NEW_RESOURCE(glxDrawableId, client);
+
+    err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
+    if (err != Success) {
+	client->errorValue = drawableId;
+	return err;
+    }
+    if (pDraw->type != DRAWABLE_PIXMAP) {
+	client->errorValue = drawableId;
+	return BadPixmap;
+    }
+
+    err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId,
+			      glxDrawableId, GLX_DRAWABLE_PIXMAP);
+
+    ((PixmapPtr)pDraw)->refcnt++;
+
+    return err;
+}
+
+static void
+determineTextureTarget(ClientPtr client, XID glxDrawableID,
+		       CARD32 *attribs, CARD32 numAttribs)
+{
+    GLenum target = 0;
+    GLenum format = 0;
+    int i, err;
+    __GLXdrawable *pGlxDraw;
+
+    if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP,
+			  DixWriteAccess, &pGlxDraw, &err))
+	/* We just added it in CreatePixmap, so we should never get here. */
+	return;
+
+    for (i = 0; i < numAttribs; i++) {
+	if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
+	    switch (attribs[2 * i + 1]) {
+	    case GLX_TEXTURE_2D_EXT:
+		target = GL_TEXTURE_2D;
+		break;
+	    case GLX_TEXTURE_RECTANGLE_EXT:
+		target = GL_TEXTURE_RECTANGLE_ARB;
+		break;
+	    }
+	}
+
+	if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
+		format = attribs[2 * i + 1];
+    }
+ 
+    if (!target) {
+	int w = pGlxDraw->pDraw->width, h = pGlxDraw->pDraw->height;
+	
+	if (h & (h - 1) || w & (w - 1))
+	    target = GL_TEXTURE_RECTANGLE_ARB;
+	else
+	    target = GL_TEXTURE_2D;
+    }
+
+    pGlxDraw->target = target;
+    pGlxDraw->format = format;
+}
+
+int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+    __GLXconfig *config;
+    __GLXscreen *pGlxScreen;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
+
+    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
+	return err;
+    if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
+	return err;
+
+    return DoCreateGLXPixmap(cl->client, pGlxScreen, config,
+			     req->pixmap, req->glxpixmap);
+}
+
+int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+    __GLXconfig *config;
+    __GLXscreen *pGlxScreen;
+    int err;
+
+    REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
+    REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
+
+    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
+	return err;
+    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
+	return err;
+
+    err = DoCreateGLXPixmap(cl->client, pGlxScreen, config,
+			    req->pixmap, req->glxpixmap);
+    if (err != Success)
+	return err;
+
+    determineTextureTarget(cl->client, req->glxpixmap,
+			   (CARD32*) (req + 1), req->numAttribs);
+
+    return Success;
+}
+
+int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreateGLXPixmapWithConfigSGIXReq *req = 
+	(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
+    __GLXconfig *config;
+    __GLXscreen *pGlxScreen;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
+
+    if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
+	return err;
+    if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
+	return err;
+
+    return DoCreateGLXPixmap(cl->client, pGlxScreen,
+			     config, req->pixmap, req->glxpixmap);
+}
+
+
+static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type)
+{
+    __GLXdrawable *pGlxDraw;
+    int err;
+
+    if (!validGlxDrawable(cl->client, glxdrawable, type,
+			  DixDestroyAccess, &pGlxDraw, &err))
+	return err;
+
+    FreeResource(glxdrawable, FALSE);
+
+    return Success;
+}
+
+int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
+
+    return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
+}
+
+int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
+
+    /* should be REQUEST_SIZE_MATCH, but mesa's glXDestroyPixmap used to set
+     * length to 3 instead of 2 */
+    REQUEST_AT_LEAST_SIZE(xGLXDestroyPixmapReq);
+
+    return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
+}
+
+static int
+DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
+		int width, int height, XID glxDrawableId)
+{
+    __GLXconfig	*config;
+    __GLXscreen		*pGlxScreen;
+    PixmapPtr		 pPixmap;
+    int			 err;
+
+    LEGAL_NEW_RESOURCE(glxDrawableId, client);
+
+    if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
+	return err;
+    if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
+	return err;
+
+    __glXenterServer(GL_FALSE);
+    pPixmap = (*pGlxScreen->pScreen->CreatePixmap) (pGlxScreen->pScreen,
+						    width, height, config->rgbBits, 0);
+    __glXleaveServer(GL_FALSE);
+
+    /* Assign the pixmap the same id as the pbuffer and add it as a
+     * resource so it and the DRI2 drawable will be reclaimed when the
+     * pbuffer is destroyed. */
+    pPixmap->drawable.id = glxDrawableId;
+    if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
+	return BadAlloc;
+
+    return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
+			       glxDrawableId, glxDrawableId,
+			       GLX_DRAWABLE_PBUFFER);
+}
+
+int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreatePbufferReq	*req = (xGLXCreatePbufferReq *) pc;
+    CARD32			*attrs;
+    int				 width, height, i;
+
+    REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
+    REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
+
+    attrs = (CARD32 *) (req + 1);
+    width = 0;
+    height = 0;
+
+    for (i = 0; i < req->numAttribs; i++) {
+	switch (attrs[i * 2]) {
+	case GLX_PBUFFER_WIDTH:
+	    width = attrs[i * 2 + 1];
+	    break;
+	case GLX_PBUFFER_HEIGHT:
+	    height = attrs[i * 2 + 1];
+	    break;
+	case GLX_LARGEST_PBUFFER:
+	case GLX_PRESERVED_CONTENTS:
+	    /* FIXME: huh... */
+	    break;
+	}
+    }
+
+    return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
+			   width, height, req->pbuffer);
+}
+
+int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
+
+    REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
+
+    return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
+			   req->width, req->height, req->pbuffer);
+}
+
+int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq);
+
+    return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
+}
+
+int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq);
+
+    return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
+}
+
+static int
+DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable,
+			   int numAttribs, CARD32 *attribs)
+{
+    __GLXdrawable *pGlxDraw;
+    int i, err;
+
+    if (!validGlxDrawable(client, glxdrawable, GLX_DRAWABLE_ANY,
+			  DixSetAttrAccess, &pGlxDraw, &err))
+	return err;
+
+    for (i = 0; i < numAttribs; i++) {
+	switch(attribs[i * 2]) {
+	case GLX_EVENT_MASK:
+	    /* All we do is to record the event mask so we can send it
+	     * back when queried.  We never actually clobber the
+	     * pbuffers, so we never need to send out the event. */
+	    pGlxDraw->eventMask = attribs[i * 2 + 1];
+	    break;
+	}
+    }
+
+    return Success;
+}
+
+int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXChangeDrawableAttributesReq *req =
+	(xGLXChangeDrawableAttributesReq *) pc;
+
+    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
+#if 0
+    /* mesa sends an additional 8 bytes */
+    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
+#else
+    if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
+	    return BadLength;
+#endif
+
+    return DoChangeDrawableAttributes(cl->client, req->drawable,
+				      req->numAttribs, (CARD32 *) (req + 1));
+}
+
+int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXChangeDrawableAttributesSGIXReq *req =
+	(xGLXChangeDrawableAttributesSGIXReq *)pc;
+
+    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
+    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
+
+    return DoChangeDrawableAttributes(cl->client, req->drawable,
+				      req->numAttribs, (CARD32 *) (req + 1));
+}
+
+int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXCreateWindowReq	*req = (xGLXCreateWindowReq *) pc;
+    __GLXconfig	*config;
+    __GLXscreen		*pGlxScreen;
+    ClientPtr		 client = cl->client;
+    DrawablePtr		 pDraw;
+    int			 err;
+
+    REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
+    REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
+
+    LEGAL_NEW_RESOURCE(req->glxwindow, client);
+
+    if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
+	return err;
+    if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
+	return err;
+
+    err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess);
+    if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
+	client->errorValue = req->window;
+	return BadWindow;
+    }
+
+    if (!validGlxFBConfigForWindow(client, config, pDraw, &err))
+	return err;
+
+    return DoCreateGLXDrawable(client, pGlxScreen, config,
+			       pDraw, req->window,
+			       req->glxwindow, GLX_DRAWABLE_WINDOW);
+}
+
+int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+
+    /* mesa's glXDestroyWindow used to set length to 3 instead of 2 */
+    REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
+
+    return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
+}
+
+
+/*****************************************************************************/
+
+/*
+** NOTE: There is no portable implementation for swap buffers as of
+** this time that is of value.  Consequently, this code must be
+** implemented by somebody other than SGI.
+*/
+int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+    GLXContextTag tag;
+    XID drawId;
+    __GLXcontext *glxc = NULL;
+    __GLXdrawable *pGlxDraw;
+    int error;
+
+    REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
+
+    tag = req->contextTag;
+    drawId = req->drawable;
+    if (tag) {
+	glxc = __glXLookupContextByTag(cl, tag);
+	if (!glxc) {
+	    return __glXError(GLXBadContextTag);
+	}
+	/*
+	** The calling thread is swapping its current drawable.  In this case,
+	** glxSwapBuffers is in both GL and X streams, in terms of
+	** sequentiality.
+	*/
+	if (__glXForceCurrent(cl, tag, &error)) {
+	    /*
+	    ** Do whatever is needed to make sure that all preceding requests
+	    ** in both streams are completed before the swap is executed.
+	    */
+	    CALL_Finish( GET_DISPATCH(), () );
+	    glxc->hasUnflushedCommands = GL_FALSE;
+	} else {
+	    return error;
+	}
+    }
+
+    pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
+    if (pGlxDraw == NULL)
+	return error;
+
+    if (pGlxDraw->type == DRAWABLE_WINDOW &&
+	(*pGlxDraw->swapBuffers)(cl->client, pGlxDraw) == GL_FALSE)
+	return __glXError(GLXBadDrawable);
+
+    return Success;
+}
+
+
+static int
+DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
+{
+    ClientPtr client = cl->client;
+    __GLXcontext *ctx;
+    xGLXQueryContextInfoEXTReply reply;
+    int nProps;
+    int *sendBuf, *pSendBuf;
+    int nReplyBytes;
+    int err;
+
+    if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
+	return err;
+
+    nProps = 3;
+    reply.length = nProps << 1;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+    reply.n = nProps;
+
+    nReplyBytes = reply.length << 2;
+    sendBuf = (int *)malloc((size_t)nReplyBytes);
+    if (sendBuf == NULL) {
+	return __glXError(GLXBadContext);	/* XXX: Is this correct? */
+    }
+    pSendBuf = sendBuf;
+    *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
+    *pSendBuf++ = (int)(ctx->share_id);
+    *pSendBuf++ = GLX_VISUAL_ID_EXT;
+    *pSendBuf++ = (int)(ctx->config->visualID);
+    *pSendBuf++ = GLX_SCREEN_EXT;
+    *pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
+
+    if (client->swapped) {
+	__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+    } else {
+	WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
+	WriteToClient(client, nReplyBytes, (char *)sendBuf);
+    }
+    free((char *)sendBuf);
+
+    return Success;
+}
+
+int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq);
+
+    return DoQueryContext(cl, req->context);
+}
+
+int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
+
+    REQUEST_SIZE_MATCH(xGLXQueryContextReq);
+
+    return DoQueryContext(cl, req->context);
+}
+
+int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+    ClientPtr		 client = cl->client;
+    __GLXcontext	*context;
+    __GLXdrawable	*pGlxDraw;
+    GLXDrawable		 drawId;
+    int			 buffer;
+    int			 error;
+    CARD32		 num_attribs;
+
+    if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
+	return BadLength;
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+
+    drawId = *((CARD32 *) (pc));
+    buffer = *((INT32 *)  (pc + 4));
+    num_attribs = *((CARD32 *) (pc + 8));
+    if (num_attribs > (UINT32_MAX >> 3)) {
+	client->errorValue = num_attribs;
+	return BadValue;
+    }
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 12 + (num_attribs << 3));
+
+    if (buffer != GLX_FRONT_LEFT_EXT)
+	return __glXError(GLXBadPixmap);
+
+    context = __glXForceCurrent (cl, req->contextTag, &error);
+    if (!context)
+	return error;
+
+    if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
+			  DixReadAccess, &pGlxDraw, &error))
+	return error;
+
+    if (!context->textureFromPixmap)
+	return __glXError(GLXUnsupportedPrivateRequest);
+
+    return context->textureFromPixmap->bindTexImage(context,
+						    buffer,
+						    pGlxDraw);
+}
+
+int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+    ClientPtr		 client = cl->client;
+    __GLXdrawable	*pGlxDraw;
+    __GLXcontext	*context;
+    GLXDrawable		 drawId;
+    int			 buffer;
+    int			 error;
+
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+
+    drawId = *((CARD32 *) (pc));
+    buffer = *((INT32 *)  (pc + 4));
+    
+    context = __glXForceCurrent (cl, req->contextTag, &error);
+    if (!context)
+	return error;
+
+    if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
+			  DixReadAccess, &pGlxDraw, &error))
+	return error;
+
+    if (!context->textureFromPixmap)
+	return __glXError(GLXUnsupportedPrivateRequest);
+
+    return context->textureFromPixmap->releaseTexImage(context,
+						       buffer,
+						       pGlxDraw);
+}
+
+int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+    GLXContextTag         tag = req->contextTag;
+    __GLXcontext         *glxc = NULL;
+    __GLXdrawable        *pGlxDraw;
+    ClientPtr		  client = cl->client;
+    GLXDrawable		  drawId;
+    int                   error;
+    int                   x, y, width, height;
+
+    (void) client;
+    (void) req;
+
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20);
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+
+    drawId = *((CARD32 *) (pc));
+    x      = *((INT32 *)  (pc + 4));
+    y      = *((INT32 *)  (pc + 8));
+    width  = *((INT32 *)  (pc + 12));
+    height = *((INT32 *)  (pc + 16));
+
+    if (tag) {
+	glxc = __glXLookupContextByTag(cl, tag);
+	if (!glxc) {
+	    return __glXError(GLXBadContextTag);
+	}
+	/*
+	** The calling thread is swapping its current drawable.  In this case,
+	** glxSwapBuffers is in both GL and X streams, in terms of
+	** sequentiality.
+	*/
+	if (__glXForceCurrent(cl, tag, &error)) {
+	    /*
+	    ** Do whatever is needed to make sure that all preceding requests
+	    ** in both streams are completed before the swap is executed.
+	    */
+	    CALL_Finish( GET_DISPATCH(), () );
+	    glxc->hasUnflushedCommands = GL_FALSE;
+	} else {
+	    return error;
+	}
+    }
+
+    pGlxDraw = __glXGetDrawable(glxc, drawId, client, &error);
+    if (!pGlxDraw)
+	return error;
+
+    if (pGlxDraw == NULL ||
+	pGlxDraw->type != GLX_DRAWABLE_WINDOW ||
+	pGlxDraw->copySubBuffer == NULL)
+	return __glXError(GLXBadDrawable);
+
+    (*pGlxDraw->copySubBuffer)(pGlxDraw, x, y, width, height);
+
+    return Success;
+}
+
+/*
+** Get drawable attributes
+*/
+static int
+DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
+{
+    ClientPtr client = cl->client;
+    xGLXGetDrawableAttributesReply reply;
+    __GLXdrawable *pGlxDraw;
+    CARD32 attributes[6];
+    int numAttribs, error;
+
+    if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
+			  DixGetAttrAccess, &pGlxDraw, &error))
+	return error;
+
+    numAttribs = 3;
+    reply.length = numAttribs << 1;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+    reply.numAttribs = numAttribs;
+
+    attributes[0] = GLX_TEXTURE_TARGET_EXT;
+    attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
+	GLX_TEXTURE_RECTANGLE_EXT;
+    attributes[2] = GLX_Y_INVERTED_EXT;
+    attributes[3] = GL_FALSE;
+    attributes[4] = GLX_EVENT_MASK;
+    attributes[5] = pGlxDraw->eventMask;
+
+    if (client->swapped) {
+	__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
+    } else {
+	WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
+		      (char *)&reply);
+	WriteToClient(client, reply.length * sizeof (CARD32),
+		      (char *)attributes);
+    }
+
+    return Success;
+}
+
+int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+
+    /* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */
+    REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
+
+    return DoGetDrawableAttributes(cl, req->drawable);
+}
+
+int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXGetDrawableAttributesSGIXReq *req =
+	(xGLXGetDrawableAttributesSGIXReq *)pc;
+    
+    REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
+
+    return DoGetDrawableAttributes(cl, req->drawable);
+}
+
+/************************************************************************/
+
+/*
+** Render and Renderlarge are not in the GLX API.  They are used by the GLX
+** client library to send batches of GL rendering commands.
+*/
+
+/*
+** Execute all the drawing commands in a request.
+*/
+int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXRenderReq *req;
+    ClientPtr client= cl->client;
+    int left, cmdlen, error;
+    int commandsDone;
+    CARD16 opcode;
+    __GLXrenderHeader *hdr;
+    __GLXcontext *glxc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    REQUEST_AT_LEAST_SIZE(xGLXRenderReq);
+
+    req = (xGLXRenderReq *) pc;
+    if (client->swapped) {
+	__GLX_SWAP_SHORT(&req->length);
+	__GLX_SWAP_INT(&req->contextTag);
+    }
+
+    glxc = __glXForceCurrent(cl, req->contextTag, &error);
+    if (!glxc) {
+	return error;
+    }
+
+    commandsDone = 0;
+    pc += sz_xGLXRenderReq;
+    left = (req->length << 2) - sz_xGLXRenderReq;
+    while (left > 0) {
+        __GLXrenderSizeData entry;
+        int extra;
+	__GLXdispatchRenderProcPtr proc;
+	int err;
+
+	if (left < sizeof(__GLXrenderHeader))
+	    return BadLength;
+
+	/*
+	** Verify that the header length and the overall length agree.
+	** Also, each command must be word aligned.
+	*/
+	hdr = (__GLXrenderHeader *) pc;
+	if (client->swapped) {
+	    __GLX_SWAP_SHORT(&hdr->length);
+	    __GLX_SWAP_SHORT(&hdr->opcode);
+	}
+	cmdlen = hdr->length;
+	opcode = hdr->opcode;
+
+	/*
+	** Check for core opcodes and grab entry data.
+	*/
+	err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
+	proc = (__GLXdispatchRenderProcPtr)
+	    __glXGetProtocolDecodeFunction(& Render_dispatch_info,
+					   opcode, client->swapped);
+
+	if ((err < 0) || (proc == NULL)) {
+	    client->errorValue = commandsDone;
+	    return __glXError(GLXBadRenderRequest);
+	}
+
+        if (entry.varsize) {
+            /* variable size command */
+            extra = (*entry.varsize)(pc + __GLX_RENDER_HDR_SIZE,
+				     client->swapped);
+            if (extra < 0) {
+                extra = 0;
+            }
+            if (cmdlen != __GLX_PAD(entry.bytes + extra)) {
+                return BadLength;
+            }
+        } else {
+            /* constant size command */
+            if (cmdlen != __GLX_PAD(entry.bytes)) {
+                return BadLength;
+            }
+        }
+	if (left < cmdlen) {
+	    return BadLength;
+	}
+
+	/*
+	** Skip over the header and execute the command.  We allow the
+	** caller to trash the command memory.  This is useful especially
+	** for things that require double alignment - they can just shift
+	** the data towards lower memory (trashing the header) by 4 bytes
+	** and achieve the required alignment.
+	*/
+	(*proc)(pc + __GLX_RENDER_HDR_SIZE);
+	pc += cmdlen;
+	left -= cmdlen;
+	commandsDone++;
+    }
+    glxc->hasUnflushedCommands = GL_TRUE;
+    return Success;
+}
+
+
+/*
+** Execute a large rendering request (one that spans multiple X requests).
+*/
+int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
+{
+    xGLXRenderLargeReq *req;
+    ClientPtr client= cl->client;
+    size_t dataBytes;
+    __GLXrenderLargeHeader *hdr;
+    __GLXcontext *glxc;
+    int error;
+    CARD16 opcode;
+    __GLX_DECLARE_SWAP_VARIABLES;
+    
+    req = (xGLXRenderLargeReq *) pc;
+    if (client->swapped) {
+	__GLX_SWAP_SHORT(&req->length);
+	__GLX_SWAP_INT(&req->contextTag);
+	__GLX_SWAP_INT(&req->dataBytes);
+	__GLX_SWAP_SHORT(&req->requestNumber);
+	__GLX_SWAP_SHORT(&req->requestTotal);
+    }
+
+    glxc = __glXForceCurrent(cl, req->contextTag, &error);
+    if (!glxc) {
+	/* Reset in case this isn't 1st request. */
+	__glXResetLargeCommandStatus(cl);
+	return error;
+    }
+    dataBytes = req->dataBytes;
+
+    /*
+    ** Check the request length.
+    */
+    if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
+	client->errorValue = req->length;
+	/* Reset in case this isn't 1st request. */
+	__glXResetLargeCommandStatus(cl);
+	return BadLength;
+    }
+    pc += sz_xGLXRenderLargeReq;
+    
+    if (cl->largeCmdRequestsSoFar == 0) {
+	__GLXrenderSizeData entry;
+	int extra;
+	size_t cmdlen;
+	int err;
+
+	/*
+	** This is the first request of a multi request command.
+	** Make enough space in the buffer, then copy the entire request.
+	*/
+	if (req->requestNumber != 1) {
+	    client->errorValue = req->requestNumber;
+	    return __glXError(GLXBadLargeRequest);
+	}
+
+	hdr = (__GLXrenderLargeHeader *) pc;
+	if (client->swapped) {
+	    __GLX_SWAP_INT(&hdr->length);
+	    __GLX_SWAP_INT(&hdr->opcode);
+	}
+	cmdlen = hdr->length;
+	opcode = hdr->opcode;
+
+	/*
+	** Check for core opcodes and grab entry data.
+	*/
+	err = __glXGetProtocolSizeData(& Render_dispatch_info, opcode, & entry);
+	if (err < 0) {
+	    client->errorValue = opcode;
+	    return __glXError(GLXBadLargeRequest);
+	}
+
+	if (entry.varsize) {
+	    /*
+	    ** If it's a variable-size command (a command whose length must
+	    ** be computed from its parameters), all the parameters needed
+	    ** will be in the 1st request, so it's okay to do this.
+	    */
+	    extra = (*entry.varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE,
+				     client->swapped);
+	    if (extra < 0) {
+		extra = 0;
+	    }
+	    /* large command's header is 4 bytes longer, so add 4 */
+	    if (cmdlen != __GLX_PAD(entry.bytes + 4 + extra)) {
+		return BadLength;
+	    }
+	} else {
+	    /* constant size command */
+	    if (cmdlen != __GLX_PAD(entry.bytes + 4)) {
+		return BadLength;
+	    }
+	}
+	/*
+	** Make enough space in the buffer, then copy the entire request.
+	*/
+	if (cl->largeCmdBufSize < cmdlen) {
+	    if (!cl->largeCmdBuf) {
+		cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
+	    } else {
+		cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
+	    }
+	    if (!cl->largeCmdBuf) {
+		return BadAlloc;
+	    }
+	    cl->largeCmdBufSize = cmdlen;
+	}
+	memcpy(cl->largeCmdBuf, pc, dataBytes);
+
+	cl->largeCmdBytesSoFar = dataBytes;
+	cl->largeCmdBytesTotal = cmdlen;
+	cl->largeCmdRequestsSoFar = 1;
+	cl->largeCmdRequestsTotal = req->requestTotal;
+	return Success;
+	
+    } else {
+	/*
+	** We are receiving subsequent (i.e. not the first) requests of a
+	** multi request command.
+	*/
+
+	/*
+	** Check the request number and the total request count.
+	*/
+	if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
+	    client->errorValue = req->requestNumber;
+	    __glXResetLargeCommandStatus(cl);
+	    return __glXError(GLXBadLargeRequest);
+	}
+	if (req->requestTotal != cl->largeCmdRequestsTotal) {
+	    client->errorValue = req->requestTotal;
+	    __glXResetLargeCommandStatus(cl);
+	    return __glXError(GLXBadLargeRequest);
+	}
+
+	/*
+	** Check that we didn't get too much data.
+	*/
+	if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
+	    client->errorValue = dataBytes;
+	    __glXResetLargeCommandStatus(cl);
+	    return __glXError(GLXBadLargeRequest);
+	}
+	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+	cl->largeCmdBytesSoFar += dataBytes;
+	cl->largeCmdRequestsSoFar++;
+
+	if (req->requestNumber == cl->largeCmdRequestsTotal) {
+	    __GLXdispatchRenderProcPtr proc;
+
+	    /*
+	    ** This is the last request; it must have enough bytes to complete
+	    ** the command.
+	    */
+	    /* NOTE: the two pad macros have been added below; they are needed
+	    ** because the client library pads the total byte count, but not
+	    ** the per-request byte counts.  The Protocol Encoding says the
+	    ** total byte count should not be padded, so a proposal will be 
+	    ** made to the ARB to relax the padding constraint on the total 
+	    ** byte count, thus preserving backward compatibility.  Meanwhile, 
+	    ** the padding done below fixes a bug that did not allow
+	    ** large commands of odd sizes to be accepted by the server.
+	    */
+	    if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
+		__GLX_PAD(cl->largeCmdBytesTotal)) {
+		client->errorValue = dataBytes;
+		__glXResetLargeCommandStatus(cl);
+		return __glXError(GLXBadLargeRequest);
+	    }
+	    hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
+	    /*
+	    ** The opcode and length field in the header had already been
+	    ** swapped when the first request was received.
+	    **
+	    ** Use the opcode to index into the procedure table.
+	    */
+	    opcode = hdr->opcode;
+
+	    proc = (__GLXdispatchRenderProcPtr)
+	      __glXGetProtocolDecodeFunction(& Render_dispatch_info, opcode,
+					     client->swapped);
+	    if (proc == NULL) {
+		client->errorValue = opcode;
+		return __glXError(GLXBadLargeRequest);
+	    }
+
+	    /*
+	    ** Skip over the header and execute the command.
+	    */
+	    (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
+	    glxc->hasUnflushedCommands = GL_TRUE;
+
+	    /*
+	    ** Reset for the next RenderLarge series.
+	    */
+	    __glXResetLargeCommandStatus(cl);
+	} else {
+	    /*
+	    ** This is neither the first nor the last request.
+	    */
+	}
+	return Success;
+    }
+}
+
+/************************************************************************/
+
+/*
+** No support is provided for the vendor-private requests other than
+** allocating the entry points in the dispatch table.
+*/
+
+int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+    GLint vendorcode = req->vendorCode;
+    __GLXdispatchVendorPrivProcPtr proc;
+
+    REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
+
+    proc = (__GLXdispatchVendorPrivProcPtr)
+      __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
+				     vendorcode, 0);
+    if (proc != NULL) {
+	(*proc)(cl, (GLbyte*)req);
+	return Success;
+    }
+
+    cl->client->errorValue = req->vendorCode;
+    return __glXError(GLXUnsupportedPrivateRequest);
+}
+
+int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+    GLint vendorcode = req->vendorCode;
+    __GLXdispatchVendorPrivProcPtr proc;
+
+    REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
+
+    proc = (__GLXdispatchVendorPrivProcPtr)
+      __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
+				     vendorcode, 0);
+    if (proc != NULL) {
+	return (*proc)(cl, (GLbyte*)req);
+    }
+
+    cl->client->errorValue = vendorcode;
+    return __glXError(GLXUnsupportedPrivateRequest);
+}
+
+int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
+    xGLXQueryExtensionsStringReply reply;
+    __GLXscreen *pGlxScreen;
+    size_t n, length;
+    char *buf;
+    int err;
+
+    REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
+
+    if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
+	return err;
+
+    n = strlen(pGlxScreen->GLXextensions) + 1;
+    length = __GLX_PAD(n) >> 2;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+    reply.length = length;
+    reply.n = n;
+
+    /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
+    buf = (char *) malloc(length << 2);
+    if (buf == NULL)
+        return BadAlloc;
+    memcpy(buf, pGlxScreen->GLXextensions, n);
+
+    if (client->swapped) {
+        glxSwapQueryExtensionsStringReply(client, &reply, buf);
+    } else {
+        WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
+        WriteToClient(client, (int)(length << 2), (char *)buf);
+    }
+
+    free(buf);
+    return Success;
+}
+
+int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
+    xGLXQueryServerStringReply reply;
+    size_t n, length;
+    const char *ptr;
+    char *buf;
+    __GLXscreen *pGlxScreen;
+    int err;
+    char ver_str[16];
+
+    REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
+
+    if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
+	return err;
+
+    switch(req->name) {
+	case GLX_VENDOR:
+	    ptr = pGlxScreen->GLXvendor;
+	    break;
+	case GLX_VERSION:
+	    /* Return to the server version rather than the screen version
+	     * to prevent confusion when they do not match.
+	     */
+	    snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion);
+	    ptr = ver_str;
+	    break;
+	case GLX_EXTENSIONS:
+	    ptr = pGlxScreen->GLXextensions;
+	    break;
+	default:
+	    return BadValue; 
+    }
+
+    n = strlen(ptr) + 1;
+    length = __GLX_PAD(n) >> 2;
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+    reply.length = length;
+    reply.n = n;
+
+    buf = (char *) malloc(length << 2);
+    if (buf == NULL) {
+        return BadAlloc;
+    }
+    memcpy(buf, ptr, n);
+
+    if (client->swapped) {
+        glxSwapQueryServerStringReply(client, &reply, buf);
+    } else {
+        WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
+        WriteToClient(client, (int)(length << 2), buf);
+    }
+
+    free(buf);
+    return Success;
+}
+
+int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
+{
+    ClientPtr client = cl->client;
+    xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
+    const char *buf;
+   
+    REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
+
+    buf = (const char *)(req+1);
+    if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
+	return BadLength;
+
+    cl->GLClientmajorVersion = req->major;
+    cl->GLClientminorVersion = req->minor;
+    free(cl->GLClientextensions);
+    cl->GLClientextensions = strdup(buf);
+
+    return Success;
+}
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index db0d3d999..d97971739 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -1,791 +1,792 @@
-/*
- * Copyright © 2007 Red Hat, Inc
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of Red Hat,
- * Inc not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission.  Red Hat, Inc makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL RED HAT, INC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <dlfcn.h>
-
-#include <drm.h>
-#include <GL/gl.h>
-#include <GL/internal/dri_interface.h>
-#include <GL/glxtokens.h>
-
-#include <windowstr.h>
-#include <os.h>
-
-#define _XF86DRI_SERVER_
-#include <xf86drm.h>
-#include <xf86.h>
-#include <dri2.h>
-
-#include "glxserver.h"
-#include "glxutil.h"
-#include "glxdricommon.h"
-
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-#include "extension_string.h"
-
-typedef struct __GLXDRIscreen   __GLXDRIscreen;
-typedef struct __GLXDRIcontext  __GLXDRIcontext;
-typedef struct __GLXDRIdrawable __GLXDRIdrawable;
-
-struct __GLXDRIscreen {
-    __GLXscreen		 base;
-    __DRIscreen		*driScreen;
-    void		*driver;
-    int			 fd;
-
-    xf86EnterVTProc	*enterVT;
-    xf86LeaveVTProc	*leaveVT;
-
-    const __DRIcoreExtension *core;
-    const __DRIdri2Extension *dri2;
-    const __DRI2flushExtension *flush;
-    const __DRIcopySubBufferExtension *copySubBuffer;
-    const __DRIswapControlExtension *swapControl;
-    const __DRItexBufferExtension *texBuffer;
-
-    unsigned char glx_enable_bits[__GLX_EXT_BYTES];
-};
-
-struct __GLXDRIcontext {
-    __GLXcontext	 base;
-    __DRIcontext	*driContext;
-};
-
-#define MAX_DRAWABLE_BUFFERS 5
-
-struct __GLXDRIdrawable {
-    __GLXdrawable	 base;
-    __DRIdrawable	*driDrawable;
-    __GLXDRIscreen	*screen;
-
-    /* Dimensions as last reported by DRI2GetBuffers. */
-    int width;
-    int height;
-    __DRIbuffer buffers[MAX_DRAWABLE_BUFFERS];
-    int count;
-};
-
-static void
-__glXDRIdrawableDestroy(__GLXdrawable *drawable)
-{
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
-    const __DRIcoreExtension *core = private->screen->core;
-    
-    (*core->destroyDrawable)(private->driDrawable);
-
-    __glXDrawableRelease(drawable);
-
-    free(private);
-}
-
-static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable *drawable,
-			       int x, int y, int w, int h)
-{
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
-    BoxRec box;
-    RegionRec region;
-
-    box.x1 = x;
-    box.y1 = private->height - y - h;
-    box.x2 = x + w;
-    box.y2 = private->height - y;
-    RegionInit(&region, &box, 0);
-
-    DRI2CopyRegion(drawable->pDraw, &region,
-		   DRI2BufferFrontLeft, DRI2BufferBackLeft);
-}
-
-static void
-__glXDRIdrawableWaitX(__GLXdrawable *drawable)
-{
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
-    BoxRec box;
-    RegionRec region;
-
-    box.x1 = 0;
-    box.y1 = 0;
-    box.x2 = private->width;
-    box.y2 = private->height;
-    RegionInit(&region, &box, 0);
-
-    DRI2CopyRegion(drawable->pDraw, &region,
-		   DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
-}
-
-static void
-__glXDRIdrawableWaitGL(__GLXdrawable *drawable)
-{
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
-    BoxRec box;
-    RegionRec region;
-
-    box.x1 = 0;
-    box.y1 = 0;
-    box.x2 = private->width;
-    box.y2 = private->height;
-    RegionInit(&region, &box, 0);
-
-    DRI2CopyRegion(drawable->pDraw, &region,
-		   DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
-}
-
-static void
-__glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
-		  CARD64 msc, CARD64 sbc)
-{
-    __GLXdrawable *drawable = data;
-    xGLXBufferSwapComplete wire;
-
-    if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
-	return;
-
-    wire.type = __glXEventBase + GLX_BufferSwapComplete;
-    switch (type) {
-    case DRI2_EXCHANGE_COMPLETE:
-	wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-	break;
-    case DRI2_BLIT_COMPLETE:
-	wire.event_type = GLX_BLIT_COMPLETE_INTEL;
-	break;
-    case DRI2_FLIP_COMPLETE:
-	wire.event_type = GLX_FLIP_COMPLETE_INTEL;
-	break;
-    default:
-	/* unknown swap completion type */
-	break;
-    }
-    wire.drawable = drawable->drawId;
-    wire.ust_hi = ust >> 32;
-    wire.ust_lo = ust & 0xffffffff;
-    wire.msc_hi = msc >> 32;
-    wire.msc_lo = msc & 0xffffffff;
-    wire.sbc_hi = sbc >> 32;
-    wire.sbc_lo = sbc & 0xffffffff;
-
-    WriteEventsToClient(client, 1, (xEvent *) &wire);
-}
-
-/*
- * Copy or flip back to front, honoring the swap interval if possible.
- *
- * If the kernel supports it, we request an event for the frame when the
- * swap should happen, then perform the copy when we receive it.
- */
-static GLboolean
-__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
-{
-    __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable;
-    __GLXDRIscreen *screen = priv->screen;
-    CARD64 unused;
-
-#if __DRI2_FLUSH_VERSION >= 3
-    if (screen->flush) {
-	(*screen->flush->flush)(priv->driDrawable);
-	(*screen->flush->invalidate)(priv->driDrawable);
-    }
-#else
-    if (screen->flush)
-	(*screen->flush->flushInvalidate)(priv->driDrawable);
-#endif
-
-    if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
-			__glXdriSwapEvent, drawable->pDraw) != Success)
-	return FALSE;
-
-    return TRUE;
-}
-
-static int
-__glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
-{
-    if (interval <= 0) /* || interval > BIGNUM? */
-	return GLX_BAD_VALUE;
-
-    DRI2SwapInterval(drawable->pDraw, interval);
-
-    return 0;
-}
-
-static void
-__glXDRIcontextDestroy(__GLXcontext *baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-
-    (*screen->core->destroyContext)(context->driContext);
-    __glXContextDestroy(&context->base);
-    free(context);
-}
-
-static int
-__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
-    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-
-    return (*screen->core->bindContext)(context->driContext,
-					draw->driDrawable,
-					read->driDrawable);
-}					      
-
-static int
-__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-
-    return (*screen->core->unbindContext)(context->driContext);
-}
-
-static int
-__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
-		    unsigned long mask)
-{
-    __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
-    __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
-
-    return (*screen->core->copyContext)(dst->driContext,
-					src->driContext, mask);
-}
-
-static Bool
-__glXDRIcontextWait(__GLXcontext *baseContext,
-		    __GLXclientState *cl, int *error)
-{
-    if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) {
-	*error = cl->client->noClientException;
-	return TRUE;
-    }
-
-    return FALSE;
-}
-
-#ifdef __DRI_TEX_BUFFER
-
-static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
-		     int buffer,
-		     __GLXdrawable *glxPixmap)
-{
-    __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap;
-    const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer;
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-
-    if (texBuffer == NULL)
-        return Success;
-
-#if __DRI_TEX_BUFFER_VERSION >= 2
-    if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) {
-	(*texBuffer->setTexBuffer2)(context->driContext,
-				    glxPixmap->target,
-				    glxPixmap->format,
-				    drawable->driDrawable);
-    } else
-#endif
-    {
-	texBuffer->setTexBuffer(context->driContext,
-				glxPixmap->target,
-				drawable->driDrawable);
-    }
-
-    return Success;
-}
-
-static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
-			int buffer,
-			__GLXdrawable *pixmap)
-{
-    /* FIXME: Just unbind the texture? */
-    return Success;
-}
-
-#else
-
-static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
-		     int buffer,
-		     __GLXdrawable *glxPixmap)
-{
-    return Success;
-}
-
-static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
-			int buffer,
-			__GLXdrawable *pixmap)
-{
-    return Success;
-}
-
-#endif
-
-static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
-    __glXDRIbindTexImage,
-    __glXDRIreleaseTexImage
-};
-
-static void
-__glXDRIscreenDestroy(__GLXscreen *baseScreen)
-{
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
-
-    (*screen->core->destroyScreen)(screen->driScreen);
-
-    dlclose(screen->driver);
-
-    __glXScreenDestroy(baseScreen);
-
-    free(screen);
-}
-
-static __GLXcontext *
-__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
-			    __GLXconfig *glxConfig,
-			    __GLXcontext *baseShareContext)
-{
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
-    __GLXDRIcontext *context, *shareContext;
-    __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
-    __DRIcontext *driShare;
-
-    shareContext = (__GLXDRIcontext *) baseShareContext;
-    if (shareContext)
-	driShare = shareContext->driContext;
-    else
-	driShare = NULL;
-
-    context = calloc(1, sizeof *context);
-    if (context == NULL)
-	return NULL;
-
-    context->base.destroy           = __glXDRIcontextDestroy;
-    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
-    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
-    context->base.copy              = __glXDRIcontextCopy;
-    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
-    context->base.wait              = __glXDRIcontextWait;
-
-    context->driContext =
-	(*screen->dri2->createNewContext)(screen->driScreen,
-					  config->driConfig,
-					  driShare, context);
-    if (context->driContext == NULL) {
-	    free(context);
-        return NULL;
-    }
-
-    return &context->base;
-}
-
-static void
-__glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv)
-{
-#if __DRI2_FLUSH_VERSION >= 3
-    __GLXDRIdrawable *private = priv;
-    __GLXDRIscreen *screen = private->screen;
-
-    if (screen->flush)
-	(*screen->flush->invalidate)(private->driDrawable);
-#endif
-}
-
-static __GLXdrawable *
-__glXDRIscreenCreateDrawable(ClientPtr client,
-			     __GLXscreen *screen,
-			     DrawablePtr pDraw,
-			     XID drawId,
-			     int type,
-			     XID glxDrawId,
-			     __GLXconfig *glxConfig)
-{
-    __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
-    __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
-    __GLXDRIdrawable *private;
-
-    private = calloc(1, sizeof *private);
-    if (private == NULL)
-	return NULL;
-
-    private->screen = driScreen;
-    if (!__glXDrawableInit(&private->base, screen,
-			   pDraw, type, glxDrawId, glxConfig)) {
-        free(private);
-	return NULL;
-    }
-
-    private->base.destroy       = __glXDRIdrawableDestroy;
-    private->base.swapBuffers   = __glXDRIdrawableSwapBuffers;
-    private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
-    private->base.waitGL	= __glXDRIdrawableWaitGL;
-    private->base.waitX		= __glXDRIdrawableWaitX;
-
-    if (DRI2CreateDrawable(client, pDraw, drawId,
-			   __glXDRIinvalidateBuffers, private)) {
-	    free(private);
-	    return NULL;
-    }
-
-    private->driDrawable =
-	(*driScreen->dri2->createNewDrawable)(driScreen->driScreen,
-					      config->driConfig, private);
-
-    return &private->base;
-}
-
-static __DRIbuffer *
-dri2GetBuffers(__DRIdrawable *driDrawable,
-	       int *width, int *height,
-	       unsigned int *attachments, int count,
-	       int *out_count, void *loaderPrivate)
-{
-    __GLXDRIdrawable *private = loaderPrivate;
-    DRI2BufferPtr *buffers;
-    int i;
-    int j;
-
-    buffers = DRI2GetBuffers(private->base.pDraw,
-			     width, height, attachments, count, out_count);
-    if (*out_count > MAX_DRAWABLE_BUFFERS) {
-	*out_count = 0;
-	return NULL;
-    }
-	
-    private->width = *width;
-    private->height = *height;
-
-    /* This assumes the DRI2 buffer attachment tokens matches the
-     * __DRIbuffer tokens. */
-    j = 0;
-    for (i = 0; i < *out_count; i++) {
-	/* Do not send the real front buffer of a window to the client.
-	 */
-	if ((private->base.pDraw->type == DRAWABLE_WINDOW)
-	    && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
-	    continue;
-	}
-
-	private->buffers[j].attachment = buffers[i]->attachment;
-	private->buffers[j].name = buffers[i]->name;
-	private->buffers[j].pitch = buffers[i]->pitch;
-	private->buffers[j].cpp = buffers[i]->cpp;
-	private->buffers[j].flags = buffers[i]->flags;
-	j++;
-    }
-
-    *out_count = j;
-    return private->buffers;
-}
-
-static __DRIbuffer *
-dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
-			 int *width, int *height,
-			 unsigned int *attachments, int count,
-			 int *out_count, void *loaderPrivate)
-{
-    __GLXDRIdrawable *private = loaderPrivate;
-    DRI2BufferPtr *buffers;
-    int i;
-    int j = 0;
-
-    buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
-				       width, height, attachments, count,
-				       out_count);
-    if (*out_count > MAX_DRAWABLE_BUFFERS) {
-	*out_count = 0;
-	return NULL;
-    }
-
-    private->width = *width;
-    private->height = *height;
-
-    /* This assumes the DRI2 buffer attachment tokens matches the
-     * __DRIbuffer tokens. */
-    for (i = 0; i < *out_count; i++) {
-	/* Do not send the real front buffer of a window to the client.
-	 */
-	if ((private->base.pDraw->type == DRAWABLE_WINDOW)
-	    && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
-	    continue;
-	}
-
-	private->buffers[j].attachment = buffers[i]->attachment;
-	private->buffers[j].name = buffers[i]->name;
-	private->buffers[j].pitch = buffers[i]->pitch;
-	private->buffers[j].cpp = buffers[i]->cpp;
-	private->buffers[j].flags = buffers[i]->flags;
-	j++;
-    }
-
-    *out_count = j;
-    return private->buffers;
-}
-
-static void 
-dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate)
-{
-    (void) driDrawable;
-    __glXDRIdrawableWaitGL((__GLXdrawable *) loaderPrivate);
-}
-
-static const __DRIdri2LoaderExtension loaderExtension = {
-    { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
-    dri2GetBuffers,
-    dri2FlushFrontBuffer,
-    dri2GetBuffersWithFormat,
-};
-
-#ifdef __DRI_USE_INVALIDATE
-static const __DRIuseInvalidateExtension dri2UseInvalidate = {
-   { __DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION }
-};
-#endif
-
-static const __DRIextension *loader_extensions[] = {
-    &systemTimeExtension.base,
-    &loaderExtension.base,
-#ifdef __DRI_USE_INVALIDATE
-    &dri2UseInvalidate.base,
-#endif
-    NULL
-};
-
-static Bool
-glxDRIEnterVT (int index, int flags)
-{
-    ScrnInfoPtr scrn = xf86Screens[index];
-    Bool	ret;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) 
-	glxGetScreen(screenInfo.screens[index]);
-
-    LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
-
-    scrn->EnterVT = screen->enterVT;
-
-    ret = scrn->EnterVT (index, flags);
-
-    screen->enterVT = scrn->EnterVT;
-    scrn->EnterVT = glxDRIEnterVT;
-
-    if (!ret)
-	return FALSE;
-    
-    glxResumeClients();
-
-    return TRUE;
-}
-
-static void
-glxDRILeaveVT (int index, int flags)
-{
-    ScrnInfoPtr scrn = xf86Screens[index];
-    __GLXDRIscreen *screen = (__GLXDRIscreen *)
-	glxGetScreen(screenInfo.screens[index]);
-
-    LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
-
-    glxSuspendClients();
-
-    scrn->LeaveVT = screen->leaveVT;
-    (*screen->leaveVT) (index, flags);
-    screen->leaveVT = scrn->LeaveVT;
-    scrn->LeaveVT = glxDRILeaveVT;
-}
-
-static void
-initializeExtensions(__GLXDRIscreen *screen)
-{
-    ScreenPtr pScreen = screen->base.pScreen;
-    const __DRIextension **extensions;
-    int i;
-
-    extensions = screen->core->getExtensions(screen->driScreen);
-
-    __glXEnableExtension(screen->glx_enable_bits,
-			 "GLX_MESA_copy_sub_buffer");
-    LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
-
-    __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
-    LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
-
-    if (DRI2HasSwapControl(pScreen)) {
-	__glXEnableExtension(screen->glx_enable_bits,
-			     "GLX_SGI_swap_control");
-	__glXEnableExtension(screen->glx_enable_bits,
-			     "GLX_MESA_swap_control");
-	LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
-    }
-
-    for (i = 0; extensions[i]; i++) {
-#ifdef __DRI_READ_DRAWABLE
-	if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
-	    __glXEnableExtension(screen->glx_enable_bits,
-				 "GLX_SGI_make_current_read");
-
-	    LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
-	}
-#endif
-
-#ifdef __DRI_TEX_BUFFER
-	if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
-	    screen->texBuffer =
-		(const __DRItexBufferExtension *) extensions[i];
-	    /* GLX_EXT_texture_from_pixmap is always enabled. */
-	    LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
-	}
-#endif
-
-#ifdef __DRI2_FLUSH
-	if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 &&
-	    extensions[i]->version >= 3) {
-		screen->flush = (__DRI2flushExtension *) extensions[i];
-	}
-#endif
-
-	/* Ignore unknown extensions */
-    }
-}
-
-static __GLXscreen *
-__glXDRIscreenProbe(ScreenPtr pScreen)
-{
-    const char *driverName, *deviceName;
-    __GLXDRIscreen *screen;
-    size_t buffer_size;
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    const __DRIconfig **driConfigs;
-
-    screen = calloc(1, sizeof *screen);
-    if (screen == NULL)
-	return NULL;
-
-    if (!xf86LoaderCheckSymbol("DRI2Connect") ||
-	!DRI2Connect(pScreen, DRI2DriverDRI,
-		     &screen->fd, &driverName, &deviceName)) {
-	LogMessage(X_INFO,
-		   "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
-	return NULL;
-    }
-
-    screen->base.destroy        = __glXDRIscreenDestroy;
-    screen->base.createContext  = __glXDRIscreenCreateContext;
-    screen->base.createDrawable = __glXDRIscreenCreateDrawable;
-    screen->base.swapInterval   = __glXDRIdrawableSwapInterval;
-    screen->base.pScreen       = pScreen;
-
-    __glXInitExtensionEnableBits(screen->glx_enable_bits);
-
-    screen->driver = glxProbeDriver(driverName, (void **)&screen->core, __DRI_CORE, 1,
-				    (void **)&screen->dri2, __DRI_DRI2, 1);
-    if (screen->driver == NULL) {
-        goto handle_error;
-    }
-    
-    screen->driScreen =
-	(*screen->dri2->createNewScreen)(pScreen->myNum,
-					 screen->fd,
-					 loader_extensions,
-					 &driConfigs,
-					 screen);
-
-    if (screen->driScreen == NULL) {
-	LogMessage(X_ERROR,
-		   "AIGLX error: Calling driver entry point failed\n");
-	goto handle_error;
-    }
-
-    initializeExtensions(screen);
-
-    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs,
-					       GLX_WINDOW_BIT |
-					       GLX_PIXMAP_BIT |
-					       GLX_PBUFFER_BIT);
-
-    __glXScreenInit(&screen->base, pScreen);
-
-    /* The first call simply determines the length of the extension string.
-     * This allows us to allocate some memory to hold the extension string,
-     * but it requires that we call __glXGetExtensionString a second time.
-     */
-    buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
-    if (buffer_size > 0) {
-	free(screen->base.GLXextensions);
-
-	screen->base.GLXextensions = xnfalloc(buffer_size);
-	(void) __glXGetExtensionString(screen->glx_enable_bits, 
-				       screen->base.GLXextensions);
-    }
-
-    /* We're going to assume (perhaps incorrectly?) that all DRI2-enabled
-     * drivers support the required extensions for GLX 1.4.  The extensions
-     * we're assuming are:
-     *
-     *    - GLX_SGI_make_current_read (1.3)
-     *    - GLX_SGIX_fbconfig (1.3)
-     *    - GLX_SGIX_pbuffer (1.3)
-     *    - GLX_ARB_multisample (1.4)
-     */
-    screen->base.GLXmajor = 1;
-    screen->base.GLXminor = 4;
-    
-    screen->enterVT = pScrn->EnterVT;
-    pScrn->EnterVT = glxDRIEnterVT; 
-    screen->leaveVT = pScrn->LeaveVT;
-    pScrn->LeaveVT = glxDRILeaveVT;
-
-    LogMessage(X_INFO,
-	       "AIGLX: Loaded and initialized %s\n", driverName);
-
-    return &screen->base;
-
- handle_error:
-    if (screen->driver)
-        dlclose(screen->driver);
-
-    free(screen);
-
-    LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
-
-    return NULL;
-}
-
-_X_EXPORT __GLXprovider __glXDRI2Provider = {
-    __glXDRIscreenProbe,
-    "DRI2",
-    NULL
-};
+/*
+ * Copyright © 2007 Red Hat, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Red Hat,
+ * Inc not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission.  Red Hat, Inc makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL RED HAT, INC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <dlfcn.h>
+
+#include <drm.h>
+#include <GL/gl.h>
+#include <GL/internal/dri_interface.h>
+#include <GL/glxtokens.h>
+
+#include <windowstr.h>
+#include <os.h>
+
+#define _XF86DRI_SERVER_
+#include <xf86drm.h>
+#include <xf86.h>
+#include <dri2.h>
+
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glxdricommon.h"
+
+#include "glapitable.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "dispatch.h"
+#include "extension_string.h"
+
+typedef struct __GLXDRIscreen   __GLXDRIscreen;
+typedef struct __GLXDRIcontext  __GLXDRIcontext;
+typedef struct __GLXDRIdrawable __GLXDRIdrawable;
+
+struct __GLXDRIscreen {
+    __GLXscreen		 base;
+    __DRIscreen		*driScreen;
+    void		*driver;
+    int			 fd;
+
+    xf86EnterVTProc	*enterVT;
+    xf86LeaveVTProc	*leaveVT;
+
+    const __DRIcoreExtension *core;
+    const __DRIdri2Extension *dri2;
+    const __DRI2flushExtension *flush;
+    const __DRIcopySubBufferExtension *copySubBuffer;
+    const __DRIswapControlExtension *swapControl;
+    const __DRItexBufferExtension *texBuffer;
+
+    unsigned char glx_enable_bits[__GLX_EXT_BYTES];
+};
+
+struct __GLXDRIcontext {
+    __GLXcontext	 base;
+    __DRIcontext	*driContext;
+};
+
+#define MAX_DRAWABLE_BUFFERS 5
+
+struct __GLXDRIdrawable {
+    __GLXdrawable	 base;
+    __DRIdrawable	*driDrawable;
+    __GLXDRIscreen	*screen;
+
+    /* Dimensions as last reported by DRI2GetBuffers. */
+    int width;
+    int height;
+    __DRIbuffer buffers[MAX_DRAWABLE_BUFFERS];
+    int count;
+};
+
+static void
+__glXDRIdrawableDestroy(__GLXdrawable *drawable)
+{
+    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
+    const __DRIcoreExtension *core = private->screen->core;
+    
+    (*core->destroyDrawable)(private->driDrawable);
+
+    __glXDrawableRelease(drawable);
+
+    free(private);
+}
+
+static void
+__glXDRIdrawableCopySubBuffer(__GLXdrawable *drawable,
+			       int x, int y, int w, int h)
+{
+    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
+    BoxRec box;
+    RegionRec region;
+
+    box.x1 = x;
+    box.y1 = private->height - y - h;
+    box.x2 = x + w;
+    box.y2 = private->height - y;
+    RegionInit(&region, &box, 0);
+
+    DRI2CopyRegion(drawable->pDraw, &region,
+		   DRI2BufferFrontLeft, DRI2BufferBackLeft);
+}
+
+static void
+__glXDRIdrawableWaitX(__GLXdrawable *drawable)
+{
+    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
+    BoxRec box;
+    RegionRec region;
+
+    box.x1 = 0;
+    box.y1 = 0;
+    box.x2 = private->width;
+    box.y2 = private->height;
+    RegionInit(&region, &box, 0);
+
+    DRI2CopyRegion(drawable->pDraw, &region,
+		   DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+}
+
+static void
+__glXDRIdrawableWaitGL(__GLXdrawable *drawable)
+{
+    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
+    BoxRec box;
+    RegionRec region;
+
+    box.x1 = 0;
+    box.y1 = 0;
+    box.x2 = private->width;
+    box.y2 = private->height;
+    RegionInit(&region, &box, 0);
+
+    DRI2CopyRegion(drawable->pDraw, &region,
+		   DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+}
+
+static void
+__glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
+		  CARD64 msc, CARD64 sbc)
+{
+    __GLXdrawable *drawable = data;
+    xGLXBufferSwapComplete wire;
+
+    if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+	return;
+
+    wire.type = __glXEventBase + GLX_BufferSwapComplete;
+    switch (type) {
+    case DRI2_EXCHANGE_COMPLETE:
+	wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+	break;
+    case DRI2_BLIT_COMPLETE:
+	wire.event_type = GLX_BLIT_COMPLETE_INTEL;
+	break;
+    case DRI2_FLIP_COMPLETE:
+	wire.event_type = GLX_FLIP_COMPLETE_INTEL;
+	break;
+    default:
+	/* unknown swap completion type */
+	wire.event_type = 0;
+	break;
+    }
+    wire.drawable = drawable->drawId;
+    wire.ust_hi = ust >> 32;
+    wire.ust_lo = ust & 0xffffffff;
+    wire.msc_hi = msc >> 32;
+    wire.msc_lo = msc & 0xffffffff;
+    wire.sbc_hi = sbc >> 32;
+    wire.sbc_lo = sbc & 0xffffffff;
+
+    WriteEventsToClient(client, 1, (xEvent *) &wire);
+}
+
+/*
+ * Copy or flip back to front, honoring the swap interval if possible.
+ *
+ * If the kernel supports it, we request an event for the frame when the
+ * swap should happen, then perform the copy when we receive it.
+ */
+static GLboolean
+__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
+{
+    __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable;
+    __GLXDRIscreen *screen = priv->screen;
+    CARD64 unused;
+
+#if __DRI2_FLUSH_VERSION >= 3
+    if (screen->flush) {
+	(*screen->flush->flush)(priv->driDrawable);
+	(*screen->flush->invalidate)(priv->driDrawable);
+    }
+#else
+    if (screen->flush)
+	(*screen->flush->flushInvalidate)(priv->driDrawable);
+#endif
+
+    if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
+			__glXdriSwapEvent, drawable->pDraw) != Success)
+	return FALSE;
+
+    return TRUE;
+}
+
+static int
+__glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
+{
+    if (interval <= 0) /* || interval > BIGNUM? */
+	return GLX_BAD_VALUE;
+
+    DRI2SwapInterval(drawable->pDraw, interval);
+
+    return 0;
+}
+
+static void
+__glXDRIcontextDestroy(__GLXcontext *baseContext)
+{
+    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
+    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
+
+    (*screen->core->destroyContext)(context->driContext);
+    __glXContextDestroy(&context->base);
+    free(context);
+}
+
+static int
+__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
+{
+    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
+    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
+    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
+    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
+
+    return (*screen->core->bindContext)(context->driContext,
+					draw->driDrawable,
+					read->driDrawable);
+}					      
+
+static int
+__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
+{
+    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
+    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
+
+    return (*screen->core->unbindContext)(context->driContext);
+}
+
+static int
+__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
+		    unsigned long mask)
+{
+    __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
+    __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
+    __GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
+
+    return (*screen->core->copyContext)(dst->driContext,
+					src->driContext, mask);
+}
+
+static Bool
+__glXDRIcontextWait(__GLXcontext *baseContext,
+		    __GLXclientState *cl, int *error)
+{
+    if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) {
+	*error = cl->client->noClientException;
+	return TRUE;
+    }
+
+    return FALSE;
+}
+
+#ifdef __DRI_TEX_BUFFER
+
+static int
+__glXDRIbindTexImage(__GLXcontext *baseContext,
+		     int buffer,
+		     __GLXdrawable *glxPixmap)
+{
+    __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap;
+    const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer;
+    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
+
+    if (texBuffer == NULL)
+        return Success;
+
+#if __DRI_TEX_BUFFER_VERSION >= 2
+    if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) {
+	(*texBuffer->setTexBuffer2)(context->driContext,
+				    glxPixmap->target,
+				    glxPixmap->format,
+				    drawable->driDrawable);
+    } else
+#endif
+    {
+	texBuffer->setTexBuffer(context->driContext,
+				glxPixmap->target,
+				drawable->driDrawable);
+    }
+
+    return Success;
+}
+
+static int
+__glXDRIreleaseTexImage(__GLXcontext *baseContext,
+			int buffer,
+			__GLXdrawable *pixmap)
+{
+    /* FIXME: Just unbind the texture? */
+    return Success;
+}
+
+#else
+
+static int
+__glXDRIbindTexImage(__GLXcontext *baseContext,
+		     int buffer,
+		     __GLXdrawable *glxPixmap)
+{
+    return Success;
+}
+
+static int
+__glXDRIreleaseTexImage(__GLXcontext *baseContext,
+			int buffer,
+			__GLXdrawable *pixmap)
+{
+    return Success;
+}
+
+#endif
+
+static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
+    __glXDRIbindTexImage,
+    __glXDRIreleaseTexImage
+};
+
+static void
+__glXDRIscreenDestroy(__GLXscreen *baseScreen)
+{
+    __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
+
+    (*screen->core->destroyScreen)(screen->driScreen);
+
+    dlclose(screen->driver);
+
+    __glXScreenDestroy(baseScreen);
+
+    free(screen);
+}
+
+static __GLXcontext *
+__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
+			    __GLXconfig *glxConfig,
+			    __GLXcontext *baseShareContext)
+{
+    __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
+    __GLXDRIcontext *context, *shareContext;
+    __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
+    __DRIcontext *driShare;
+
+    shareContext = (__GLXDRIcontext *) baseShareContext;
+    if (shareContext)
+	driShare = shareContext->driContext;
+    else
+	driShare = NULL;
+
+    context = calloc(1, sizeof *context);
+    if (context == NULL)
+	return NULL;
+
+    context->base.destroy           = __glXDRIcontextDestroy;
+    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
+    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
+    context->base.copy              = __glXDRIcontextCopy;
+    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
+    context->base.wait              = __glXDRIcontextWait;
+
+    context->driContext =
+	(*screen->dri2->createNewContext)(screen->driScreen,
+					  config->driConfig,
+					  driShare, context);
+    if (context->driContext == NULL) {
+	    free(context);
+        return NULL;
+    }
+
+    return &context->base;
+}
+
+static void
+__glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv)
+{
+#if __DRI2_FLUSH_VERSION >= 3
+    __GLXDRIdrawable *private = priv;
+    __GLXDRIscreen *screen = private->screen;
+
+    if (screen->flush)
+	(*screen->flush->invalidate)(private->driDrawable);
+#endif
+}
+
+static __GLXdrawable *
+__glXDRIscreenCreateDrawable(ClientPtr client,
+			     __GLXscreen *screen,
+			     DrawablePtr pDraw,
+			     XID drawId,
+			     int type,
+			     XID glxDrawId,
+			     __GLXconfig *glxConfig)
+{
+    __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
+    __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
+    __GLXDRIdrawable *private;
+
+    private = calloc(1, sizeof *private);
+    if (private == NULL)
+	return NULL;
+
+    private->screen = driScreen;
+    if (!__glXDrawableInit(&private->base, screen,
+			   pDraw, type, glxDrawId, glxConfig)) {
+        free(private);
+	return NULL;
+    }
+
+    private->base.destroy       = __glXDRIdrawableDestroy;
+    private->base.swapBuffers   = __glXDRIdrawableSwapBuffers;
+    private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
+    private->base.waitGL	= __glXDRIdrawableWaitGL;
+    private->base.waitX		= __glXDRIdrawableWaitX;
+
+    if (DRI2CreateDrawable(client, pDraw, drawId,
+			   __glXDRIinvalidateBuffers, private)) {
+	    free(private);
+	    return NULL;
+    }
+
+    private->driDrawable =
+	(*driScreen->dri2->createNewDrawable)(driScreen->driScreen,
+					      config->driConfig, private);
+
+    return &private->base;
+}
+
+static __DRIbuffer *
+dri2GetBuffers(__DRIdrawable *driDrawable,
+	       int *width, int *height,
+	       unsigned int *attachments, int count,
+	       int *out_count, void *loaderPrivate)
+{
+    __GLXDRIdrawable *private = loaderPrivate;
+    DRI2BufferPtr *buffers;
+    int i;
+    int j;
+
+    buffers = DRI2GetBuffers(private->base.pDraw,
+			     width, height, attachments, count, out_count);
+    if (*out_count > MAX_DRAWABLE_BUFFERS) {
+	*out_count = 0;
+	return NULL;
+    }
+	
+    private->width = *width;
+    private->height = *height;
+
+    /* This assumes the DRI2 buffer attachment tokens matches the
+     * __DRIbuffer tokens. */
+    j = 0;
+    for (i = 0; i < *out_count; i++) {
+	/* Do not send the real front buffer of a window to the client.
+	 */
+	if ((private->base.pDraw->type == DRAWABLE_WINDOW)
+	    && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
+	    continue;
+	}
+
+	private->buffers[j].attachment = buffers[i]->attachment;
+	private->buffers[j].name = buffers[i]->name;
+	private->buffers[j].pitch = buffers[i]->pitch;
+	private->buffers[j].cpp = buffers[i]->cpp;
+	private->buffers[j].flags = buffers[i]->flags;
+	j++;
+    }
+
+    *out_count = j;
+    return private->buffers;
+}
+
+static __DRIbuffer *
+dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
+			 int *width, int *height,
+			 unsigned int *attachments, int count,
+			 int *out_count, void *loaderPrivate)
+{
+    __GLXDRIdrawable *private = loaderPrivate;
+    DRI2BufferPtr *buffers;
+    int i;
+    int j = 0;
+
+    buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
+				       width, height, attachments, count,
+				       out_count);
+    if (*out_count > MAX_DRAWABLE_BUFFERS) {
+	*out_count = 0;
+	return NULL;
+    }
+
+    private->width = *width;
+    private->height = *height;
+
+    /* This assumes the DRI2 buffer attachment tokens matches the
+     * __DRIbuffer tokens. */
+    for (i = 0; i < *out_count; i++) {
+	/* Do not send the real front buffer of a window to the client.
+	 */
+	if ((private->base.pDraw->type == DRAWABLE_WINDOW)
+	    && (buffers[i]->attachment == DRI2BufferFrontLeft)) {
+	    continue;
+	}
+
+	private->buffers[j].attachment = buffers[i]->attachment;
+	private->buffers[j].name = buffers[i]->name;
+	private->buffers[j].pitch = buffers[i]->pitch;
+	private->buffers[j].cpp = buffers[i]->cpp;
+	private->buffers[j].flags = buffers[i]->flags;
+	j++;
+    }
+
+    *out_count = j;
+    return private->buffers;
+}
+
+static void 
+dri2FlushFrontBuffer(__DRIdrawable *driDrawable, void *loaderPrivate)
+{
+    (void) driDrawable;
+    __glXDRIdrawableWaitGL((__GLXdrawable *) loaderPrivate);
+}
+
+static const __DRIdri2LoaderExtension loaderExtension = {
+    { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
+    dri2GetBuffers,
+    dri2FlushFrontBuffer,
+    dri2GetBuffersWithFormat,
+};
+
+#ifdef __DRI_USE_INVALIDATE
+static const __DRIuseInvalidateExtension dri2UseInvalidate = {
+   { __DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION }
+};
+#endif
+
+static const __DRIextension *loader_extensions[] = {
+    &systemTimeExtension.base,
+    &loaderExtension.base,
+#ifdef __DRI_USE_INVALIDATE
+    &dri2UseInvalidate.base,
+#endif
+    NULL
+};
+
+static Bool
+glxDRIEnterVT (int index, int flags)
+{
+    ScrnInfoPtr scrn = xf86Screens[index];
+    Bool	ret;
+    __GLXDRIscreen *screen = (__GLXDRIscreen *) 
+	glxGetScreen(screenInfo.screens[index]);
+
+    LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
+
+    scrn->EnterVT = screen->enterVT;
+
+    ret = scrn->EnterVT (index, flags);
+
+    screen->enterVT = scrn->EnterVT;
+    scrn->EnterVT = glxDRIEnterVT;
+
+    if (!ret)
+	return FALSE;
+    
+    glxResumeClients();
+
+    return TRUE;
+}
+
+static void
+glxDRILeaveVT (int index, int flags)
+{
+    ScrnInfoPtr scrn = xf86Screens[index];
+    __GLXDRIscreen *screen = (__GLXDRIscreen *)
+	glxGetScreen(screenInfo.screens[index]);
+
+    LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
+
+    glxSuspendClients();
+
+    scrn->LeaveVT = screen->leaveVT;
+    (*screen->leaveVT) (index, flags);
+    screen->leaveVT = scrn->LeaveVT;
+    scrn->LeaveVT = glxDRILeaveVT;
+}
+
+static void
+initializeExtensions(__GLXDRIscreen *screen)
+{
+    ScreenPtr pScreen = screen->base.pScreen;
+    const __DRIextension **extensions;
+    int i;
+
+    extensions = screen->core->getExtensions(screen->driScreen);
+
+    __glXEnableExtension(screen->glx_enable_bits,
+			 "GLX_MESA_copy_sub_buffer");
+    LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+
+    __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
+    LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
+
+    if (DRI2HasSwapControl(pScreen)) {
+	__glXEnableExtension(screen->glx_enable_bits,
+			     "GLX_SGI_swap_control");
+	__glXEnableExtension(screen->glx_enable_bits,
+			     "GLX_MESA_swap_control");
+	LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
+    }
+
+    for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_READ_DRAWABLE
+	if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+	    __glXEnableExtension(screen->glx_enable_bits,
+				 "GLX_SGI_make_current_read");
+
+	    LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+	}
+#endif
+
+#ifdef __DRI_TEX_BUFFER
+	if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
+	    screen->texBuffer =
+		(const __DRItexBufferExtension *) extensions[i];
+	    /* GLX_EXT_texture_from_pixmap is always enabled. */
+	    LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
+	}
+#endif
+
+#ifdef __DRI2_FLUSH
+	if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 &&
+	    extensions[i]->version >= 3) {
+		screen->flush = (__DRI2flushExtension *) extensions[i];
+	}
+#endif
+
+	/* Ignore unknown extensions */
+    }
+}
+
+static __GLXscreen *
+__glXDRIscreenProbe(ScreenPtr pScreen)
+{
+    const char *driverName, *deviceName;
+    __GLXDRIscreen *screen;
+    size_t buffer_size;
+    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    const __DRIconfig **driConfigs;
+
+    screen = calloc(1, sizeof *screen);
+    if (screen == NULL)
+	return NULL;
+
+    if (!xf86LoaderCheckSymbol("DRI2Connect") ||
+	!DRI2Connect(pScreen, DRI2DriverDRI,
+		     &screen->fd, &driverName, &deviceName)) {
+	LogMessage(X_INFO,
+		   "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
+	return NULL;
+    }
+
+    screen->base.destroy        = __glXDRIscreenDestroy;
+    screen->base.createContext  = __glXDRIscreenCreateContext;
+    screen->base.createDrawable = __glXDRIscreenCreateDrawable;
+    screen->base.swapInterval   = __glXDRIdrawableSwapInterval;
+    screen->base.pScreen       = pScreen;
+
+    __glXInitExtensionEnableBits(screen->glx_enable_bits);
+
+    screen->driver = glxProbeDriver(driverName, (void **)&screen->core, __DRI_CORE, 1,
+				    (void **)&screen->dri2, __DRI_DRI2, 1);
+    if (screen->driver == NULL) {
+        goto handle_error;
+    }
+    
+    screen->driScreen =
+	(*screen->dri2->createNewScreen)(pScreen->myNum,
+					 screen->fd,
+					 loader_extensions,
+					 &driConfigs,
+					 screen);
+
+    if (screen->driScreen == NULL) {
+	LogMessage(X_ERROR,
+		   "AIGLX error: Calling driver entry point failed\n");
+	goto handle_error;
+    }
+
+    initializeExtensions(screen);
+
+    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs,
+					       GLX_WINDOW_BIT |
+					       GLX_PIXMAP_BIT |
+					       GLX_PBUFFER_BIT);
+
+    __glXScreenInit(&screen->base, pScreen);
+
+    /* The first call simply determines the length of the extension string.
+     * This allows us to allocate some memory to hold the extension string,
+     * but it requires that we call __glXGetExtensionString a second time.
+     */
+    buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
+    if (buffer_size > 0) {
+	free(screen->base.GLXextensions);
+
+	screen->base.GLXextensions = xnfalloc(buffer_size);
+	(void) __glXGetExtensionString(screen->glx_enable_bits, 
+				       screen->base.GLXextensions);
+    }
+
+    /* We're going to assume (perhaps incorrectly?) that all DRI2-enabled
+     * drivers support the required extensions for GLX 1.4.  The extensions
+     * we're assuming are:
+     *
+     *    - GLX_SGI_make_current_read (1.3)
+     *    - GLX_SGIX_fbconfig (1.3)
+     *    - GLX_SGIX_pbuffer (1.3)
+     *    - GLX_ARB_multisample (1.4)
+     */
+    screen->base.GLXmajor = 1;
+    screen->base.GLXminor = 4;
+    
+    screen->enterVT = pScrn->EnterVT;
+    pScrn->EnterVT = glxDRIEnterVT; 
+    screen->leaveVT = pScrn->LeaveVT;
+    pScrn->LeaveVT = glxDRILeaveVT;
+
+    LogMessage(X_INFO,
+	       "AIGLX: Loaded and initialized %s\n", driverName);
+
+    return &screen->base;
+
+ handle_error:
+    if (screen->driver)
+        dlclose(screen->driver);
+
+    free(screen);
+
+    LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
+
+    return NULL;
+}
+
+_X_EXPORT __GLXprovider __glXDRI2Provider = {
+    __glXDRIscreenProbe,
+    "DRI2",
+    NULL
+};
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index 054ece76d..9cfc096c3 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -1,552 +1,556 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-#include "glxserver.h"
-#include <windowstr.h>
-#include <propertyst.h>
-#include <registry.h>
-#include "privates.h"
-#include <os.h>
-#include "unpack.h"
-#include "glxutil.h"
-#include "glxext.h"
-#include "indirect_table.h"
-#include "indirect_util.h"
-
-/*
-** The last context used by the server.  It is the context that is current
-** from the server's perspective.
-*/
-__GLXcontext *__glXLastContext;
-
-/*
-** X resources.
-*/
-RESTYPE __glXContextRes;
-RESTYPE __glXDrawableRes;
-
-/*
-** Reply for most singles.
-*/
-xGLXSingleReply __glXReply;
-
-static DevPrivateKeyRec glxClientPrivateKeyRec;
-#define glxClientPrivateKey (&glxClientPrivateKeyRec)
-
-/*
-** Forward declarations.
-*/
-static int __glXDispatch(ClientPtr);
-
-/*
-** Called when the extension is reset.
-*/
-static void ResetExtension(ExtensionEntry* extEntry)
-{
-    __glXFlushContextCache();
-}
-
-/*
-** Reset state used to keep track of large (multi-request) commands.
-*/
-void __glXResetLargeCommandStatus(__GLXclientState *cl)
-{
-    cl->largeCmdBytesSoFar = 0;
-    cl->largeCmdBytesTotal = 0;
-    cl->largeCmdRequestsSoFar = 0;
-    cl->largeCmdRequestsTotal = 0;
-}
-
-/*
-** This procedure is called when the client who created the context goes
-** away OR when glXDestroyContext is called.  In either case, all we do is
-** flag that the ID is no longer valid, and (maybe) free the context.
-** use.
-*/
-static int ContextGone(__GLXcontext* cx, XID id)
-{
-    cx->idExists = GL_FALSE;
-    if (!cx->isCurrent) {
-	__glXFreeContext(cx);
-    }
-
-    return True;
-}
-
-static __GLXcontext *glxPendingDestroyContexts;
-static __GLXcontext *glxAllContexts;
-static int glxServerLeaveCount;
-static int glxBlockClients;
-
-/*
-** Destroy routine that gets called when a drawable is freed.  A drawable
-** contains the ancillary buffers needed for rendering.
-*/
-static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
-{
-    __GLXcontext *c, *next;
-
-    /* If this drawable was created using glx 1.3 drawable
-     * constructors, we added it as a glx drawable resource under both
-     * its glx drawable ID and it X drawable ID.  Remove the other
-     * resource now so we don't a callback for freed memory. */
-    if (glxPriv->drawId != glxPriv->pDraw->id) {
-	if (xid == glxPriv->drawId)
-	    FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
-	else
-	    FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
-    }
-
-    for (c = glxAllContexts; c; c = next) {
-	next = c->next;
-	if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
-	    (*c->loseCurrent)(c);
-	    c->isCurrent = GL_FALSE;
-	    if (c == __glXLastContext)
-		__glXFlushContextCache();
-	}
-	if (c->drawPriv == glxPriv)
-	    c->drawPriv = NULL;
-	if (c->readPriv == glxPriv)
-	    c->readPriv = NULL;
-    }
-
-    glxPriv->destroy(glxPriv);
-
-    return True;
-}
-
-void __glXAddToContextList(__GLXcontext *cx)
-{
-    cx->next = glxAllContexts;
-    glxAllContexts = cx;
-}
-
-static void __glXRemoveFromContextList(__GLXcontext *cx)
-{
-    __GLXcontext *c, *prev;
-
-    if (cx == glxAllContexts)
-	glxAllContexts = cx->next;
-    else {
-	prev = glxAllContexts;
-	for (c = glxAllContexts; c; c = c->next) {
-	    if (c == cx)
-		prev->next = c->next;
-	    prev = c;
-	}
-    }
-}
-
-/*
-** Free a context.
-*/
-GLboolean __glXFreeContext(__GLXcontext *cx)
-{
-    if (cx->idExists || cx->isCurrent) return GL_FALSE;
-    
-    free(cx->feedbackBuf);
-    free(cx->selectBuf);
-    if (cx == __glXLastContext) {
-	__glXFlushContextCache();
-    }
-
-    __glXRemoveFromContextList(cx);
-
-    /* We can get here through both regular dispatching from
-     * __glXDispatch() or as a callback from the resource manager.  In
-     * the latter case we need to lift the DRI lock manually. */
-
-    if (!glxBlockClients) {
-	__glXleaveServer(GL_FALSE);
-	cx->destroy(cx);
-	__glXenterServer(GL_FALSE);
-    } else {
-	cx->next = glxPendingDestroyContexts;
-	glxPendingDestroyContexts = cx;
-    }
-
-    return GL_TRUE;
-}
-
-/************************************************************************/
-
-/*
-** These routines can be used to check whether a particular GL command
-** has caused an error.  Specifically, we use them to check whether a
-** given query has caused an error, in which case a zero-length data
-** reply is sent to the client.
-*/
-
-static GLboolean errorOccured = GL_FALSE;
-
-/*
-** The GL was will call this routine if an error occurs.
-*/
-void __glXErrorCallBack(GLenum code)
-{
-    errorOccured = GL_TRUE;
-}
-
-/*
-** Clear the error flag before calling the GL command.
-*/
-void __glXClearErrorOccured(void)
-{
-    errorOccured = GL_FALSE;
-}
-
-/*
-** Check if the GL command caused an error.
-*/
-GLboolean __glXErrorOccured(void)
-{
-    return errorOccured;
-}
-
-static int __glXErrorBase;
-int __glXEventBase;
-
-int __glXError(int error)
-{
-    return __glXErrorBase + error;
-}
-
-__GLXclientState *
-glxGetClient(ClientPtr pClient)
-{
-    return dixLookupPrivate(&pClient->devPrivates, glxClientPrivateKey);
-}
-
-static void
-glxClientCallback (CallbackListPtr	*list,
-		   pointer		closure,
-		   pointer		data)
-{
-    NewClientInfoRec	*clientinfo = (NewClientInfoRec *) data;
-    ClientPtr		pClient = clientinfo->client;
-    __GLXclientState	*cl = glxGetClient(pClient);
-
-    switch (pClient->clientState) {
-    case ClientStateRunning:
-	/*
-	** By default, assume that the client supports
-	** GLX major version 1 minor version 0 protocol.
-	*/
-	cl->GLClientmajorVersion = 1;
-	cl->GLClientminorVersion = 0;
-	cl->client = pClient;
-	break;
-
-    case ClientStateGone:
-	free(cl->returnBuf);
-	free(cl->largeCmdBuf);
-	free(cl->GLClientextensions);
-	break;
-
-    default:
-	break;
-    }
-}
-
-/************************************************************************/
-
-static __GLXprovider *__glXProviderStack;
-
-void GlxPushProvider(__GLXprovider *provider)
-{
-    provider->next = __glXProviderStack;
-    __glXProviderStack = provider;
-}
-
-/*
-** Initialize the GLX extension.
-*/
-void GlxExtensionInit(void)
-{
-    ExtensionEntry *extEntry;
-    ScreenPtr pScreen;
-    int i;
-    __GLXprovider *p;
-    Bool glx_provided = False;
-
-    __glXContextRes = CreateNewResourceType((DeleteType)ContextGone,
-					    "GLXContext");
-    __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone,
-					     "GLXDrawable");
-    if (!__glXContextRes || !__glXDrawableRes)
-	return;
-
-    if (!dixRegisterPrivateKey(&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (__GLXclientState)))
-	return;
-    if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
-	return;
-
-    for (i = 0; i < screenInfo.numScreens; i++) {
-	pScreen = screenInfo.screens[i];
-
-	for (p = __glXProviderStack; p != NULL; p = p->next) {
-	    __GLXscreen *glxScreen;
-
-	    glxScreen = p->screenProbe(pScreen);
-	    if (glxScreen != NULL) {
-	        if (glxScreen->GLXminor < glxMinorVersion)
-		    glxMinorVersion = glxScreen->GLXminor;
-		LogMessage(X_INFO,
-			   "GLX: Initialized %s GL provider for screen %d\n",
-			   p->name, i);
-		break;
-	    }
-
-	}
-
-	if (!p)
-	    LogMessage(X_INFO,
-		       "GLX: no usable GL providers found for screen %d\n", i);
-	else
-	    glx_provided = True;
-    }
-
-    /* don't register extension if GL is not provided on any screen */
-    if (!glx_provided)
-	return;
-
-    /*
-    ** Add extension to server extensions.
-    */
-    extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
-			    __GLX_NUMBER_ERRORS, __glXDispatch,
-			    __glXDispatch, ResetExtension,
-			    StandardMinorOpcode);
-    if (!extEntry) {
-	FatalError("__glXExtensionInit: AddExtensions failed\n");
-	return;
-    }
-    if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
-	ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
-	return;
-    }
-
-    __glXErrorBase = extEntry->errorBase;
-    __glXEventBase = extEntry->eventBase;
-}
-
-/************************************************************************/
-
-void __glXFlushContextCache(void)
-{
-    __glXLastContext = 0;
-}
-
-/*
-** Make a context the current one for the GL (in this implementation, there
-** is only one instance of the GL, and we use it to serve all GL clients by
-** switching it between different contexts).  While we are at it, look up
-** a context by its tag and return its (__GLXcontext *).
-*/
-__GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
-				int *error)
-{
-    __GLXcontext *cx;
-
-    /*
-    ** See if the context tag is legal; it is managed by the extension,
-    ** so if it's invalid, we have an implementation error.
-    */
-    cx = __glXLookupContextByTag(cl, tag);
-    if (!cx) {
-	cl->client->errorValue = tag;
-	*error = __glXError(GLXBadContextTag);
-	return 0;
-    }
-
-    if (!cx->isDirect) {
-	if (cx->drawPriv == NULL) {
-	    /*
-	    ** The drawable has vanished.  It must be a window, because only
-	    ** windows can be destroyed from under us; GLX pixmaps are
-	    ** refcounted and don't go away until no one is using them.
-	    */
-	    *error = __glXError(GLXBadCurrentWindow);
-	    return 0;
-    	}
-    }
-    
-    if (cx->wait && (*cx->wait)(cx, cl, error))
-	return NULL;
-
-    if (cx == __glXLastContext) {
-	/* No need to re-bind */
-	return cx;
-    }
-
-    /* Make this context the current one for the GL. */
-    if (!cx->isDirect) {
-	if (!(*cx->makeCurrent)(cx)) {
-	    /* Bind failed, and set the error code.  Bummer */
-	    cl->client->errorValue = cx->id;
-	    *error = __glXError(GLXBadContextState);
-	    return 0;
-    	}
-    }
-    __glXLastContext = cx;
-    return cx;
-}
-
-/************************************************************************/
-
-void glxSuspendClients(void)
-{
-    int i;
-
-    for (i = 1; i < currentMaxClients; i++) {
-	if (clients[i] && glxGetClient(clients[i])->inUse)
-	    IgnoreClient(clients[i]);
-    }
-
-    glxBlockClients = TRUE;
-}
-
-void glxResumeClients(void)
-{
-    __GLXcontext *cx, *next;
-    int i;
-
-    glxBlockClients = FALSE;
-
-    for (i = 1; i < currentMaxClients; i++) {
-	if (clients[i] && glxGetClient(clients[i])->inUse)
-	    AttendClient(clients[i]);
-    }
-
-    __glXleaveServer(GL_FALSE);
-    for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
-	next = cx->next;
-
-	cx->destroy(cx);
-    }
-    glxPendingDestroyContexts = NULL;
-    __glXenterServer(GL_FALSE);
-}
-
-static void
-__glXnopEnterServer(GLboolean rendering)
-{
-}
-    
-static void
-__glXnopLeaveServer(GLboolean rendering)
-{
-}
-
-static void (*__glXenterServerFunc)(GLboolean) = __glXnopEnterServer;
-static void (*__glXleaveServerFunc)(GLboolean)  = __glXnopLeaveServer;
-
-void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
-				   void (*leave)(GLboolean))
-{
-  __glXenterServerFunc = enter;
-  __glXleaveServerFunc = leave;
-}
-
-
-void __glXenterServer(GLboolean rendering)
-{
-  glxServerLeaveCount--;
-
-  if (glxServerLeaveCount == 0)
-    (*__glXenterServerFunc)(rendering);
-}
-
-void __glXleaveServer(GLboolean rendering)
-{
-  if (glxServerLeaveCount == 0)
-    (*__glXleaveServerFunc)(rendering);
-
-  glxServerLeaveCount++;
-}
-
-/*
-** Top level dispatcher; all commands are executed from here down.
-*/
-static int __glXDispatch(ClientPtr client)
-{
-    REQUEST(xGLXSingleReq);
-    CARD8 opcode;
-    __GLXdispatchSingleProcPtr proc;
-    __GLXclientState *cl;
-    int retval;
-
-    opcode = stuff->glxCode;
-    cl = glxGetClient(client);
-    /* Mark it in use so we suspend it on VT switch. */
-    cl->inUse = TRUE;
-
-    /*
-    ** If we're expecting a glXRenderLarge request, this better be one.
-    */
-    if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
-	client->errorValue = stuff->glxCode;
-	return __glXError(GLXBadLargeRequest);
-    }
-
-    /* If we're currently blocking GLX clients, just put this guy to
-     * sleep, reset the request and return. */
-    if (glxBlockClients) {
-	ResetCurrentRequest(client);
-	client->sequence--;
-	IgnoreClient(client);
-	return Success;
-    }
-
-    /*
-    ** Use the opcode to index into the procedure table.
-    */
-    proc = __glXGetProtocolDecodeFunction(& Single_dispatch_info, opcode,
-                                          client->swapped);
-    if (proc != NULL) {
-	GLboolean rendering = opcode <= X_GLXRenderLarge;
-	__glXleaveServer(rendering);
-
-	retval = (*proc)(cl, (GLbyte *) stuff);
-
-	__glXenterServer(rendering);
-    }
-    else {
-	retval = BadRequest;
-    }
-
-    return retval;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+#include "glxserver.h"
+#include <windowstr.h>
+#include <propertyst.h>
+#include <registry.h>
+#include "privates.h"
+#include <os.h>
+#include "unpack.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "indirect_table.h"
+#include "indirect_util.h"
+
+/*
+** The last context used by the server.  It is the context that is current
+** from the server's perspective.
+*/
+__GLXcontext *__glXLastContext;
+
+/*
+** X resources.
+*/
+RESTYPE __glXContextRes;
+RESTYPE __glXDrawableRes;
+
+/*
+** Reply for most singles.
+*/
+xGLXSingleReply __glXReply;
+
+static DevPrivateKeyRec glxClientPrivateKeyRec;
+#define glxClientPrivateKey (&glxClientPrivateKeyRec)
+
+/*
+** Forward declarations.
+*/
+static int __glXDispatch(ClientPtr);
+
+/*
+** Called when the extension is reset.
+*/
+static void ResetExtension(ExtensionEntry* extEntry)
+{
+    __glXFlushContextCache();
+}
+
+/*
+** Reset state used to keep track of large (multi-request) commands.
+*/
+void __glXResetLargeCommandStatus(__GLXclientState *cl)
+{
+    cl->largeCmdBytesSoFar = 0;
+    cl->largeCmdBytesTotal = 0;
+    cl->largeCmdRequestsSoFar = 0;
+    cl->largeCmdRequestsTotal = 0;
+}
+
+/*
+** This procedure is called when the client who created the context goes
+** away OR when glXDestroyContext is called.  In either case, all we do is
+** flag that the ID is no longer valid, and (maybe) free the context.
+** use.
+*/
+static int ContextGone(__GLXcontext* cx, XID id)
+{
+    cx->idExists = GL_FALSE;
+    if (!cx->isCurrent) {
+	__glXFreeContext(cx);
+    }
+
+    return True;
+}
+
+static __GLXcontext *glxPendingDestroyContexts;
+static __GLXcontext *glxAllContexts;
+static int glxServerLeaveCount;
+static int glxBlockClients;
+
+/*
+** Destroy routine that gets called when a drawable is freed.  A drawable
+** contains the ancillary buffers needed for rendering.
+*/
+static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
+{
+    __GLXcontext *c, *next;
+
+    if (glxPriv->type == GLX_DRAWABLE_WINDOW) {
+        /* If this was created by glXCreateWindow, free the matching resource */
+        if (glxPriv->drawId != glxPriv->pDraw->id) {
+            if (xid == glxPriv->drawId)
+                FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
+            else
+                FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
+        }
+        /* otherwise this window was implicitly created by MakeCurrent */
+    }
+
+    for (c = glxAllContexts; c; c = next) {
+	next = c->next;
+	if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+	    (*c->loseCurrent)(c);
+	    c->isCurrent = GL_FALSE;
+	    if (c == __glXLastContext)
+		__glXFlushContextCache();
+	}
+	if (c->drawPriv == glxPriv)
+	    c->drawPriv = NULL;
+	if (c->readPriv == glxPriv)
+	    c->readPriv = NULL;
+    }
+
+    /* drop our reference to any backing pixmap */
+    if (glxPriv->type == GLX_DRAWABLE_PIXMAP)
+        glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr)glxPriv->pDraw);
+
+    glxPriv->destroy(glxPriv);
+
+    return True;
+}
+
+void __glXAddToContextList(__GLXcontext *cx)
+{
+    cx->next = glxAllContexts;
+    glxAllContexts = cx;
+}
+
+static void __glXRemoveFromContextList(__GLXcontext *cx)
+{
+    __GLXcontext *c, *prev;
+
+    if (cx == glxAllContexts)
+	glxAllContexts = cx->next;
+    else {
+	prev = glxAllContexts;
+	for (c = glxAllContexts; c; c = c->next) {
+	    if (c == cx)
+		prev->next = c->next;
+	    prev = c;
+	}
+    }
+}
+
+/*
+** Free a context.
+*/
+GLboolean __glXFreeContext(__GLXcontext *cx)
+{
+    if (cx->idExists || cx->isCurrent) return GL_FALSE;
+    
+    free(cx->feedbackBuf);
+    free(cx->selectBuf);
+    if (cx == __glXLastContext) {
+	__glXFlushContextCache();
+    }
+
+    __glXRemoveFromContextList(cx);
+
+    /* We can get here through both regular dispatching from
+     * __glXDispatch() or as a callback from the resource manager.  In
+     * the latter case we need to lift the DRI lock manually. */
+
+    if (!glxBlockClients) {
+	__glXleaveServer(GL_FALSE);
+	cx->destroy(cx);
+	__glXenterServer(GL_FALSE);
+    } else {
+	cx->next = glxPendingDestroyContexts;
+	glxPendingDestroyContexts = cx;
+    }
+
+    return GL_TRUE;
+}
+
+/************************************************************************/
+
+/*
+** These routines can be used to check whether a particular GL command
+** has caused an error.  Specifically, we use them to check whether a
+** given query has caused an error, in which case a zero-length data
+** reply is sent to the client.
+*/
+
+static GLboolean errorOccured = GL_FALSE;
+
+/*
+** The GL was will call this routine if an error occurs.
+*/
+void __glXErrorCallBack(GLenum code)
+{
+    errorOccured = GL_TRUE;
+}
+
+/*
+** Clear the error flag before calling the GL command.
+*/
+void __glXClearErrorOccured(void)
+{
+    errorOccured = GL_FALSE;
+}
+
+/*
+** Check if the GL command caused an error.
+*/
+GLboolean __glXErrorOccured(void)
+{
+    return errorOccured;
+}
+
+static int __glXErrorBase;
+int __glXEventBase;
+
+int __glXError(int error)
+{
+    return __glXErrorBase + error;
+}
+
+__GLXclientState *
+glxGetClient(ClientPtr pClient)
+{
+    return dixLookupPrivate(&pClient->devPrivates, glxClientPrivateKey);
+}
+
+static void
+glxClientCallback (CallbackListPtr	*list,
+		   pointer		closure,
+		   pointer		data)
+{
+    NewClientInfoRec	*clientinfo = (NewClientInfoRec *) data;
+    ClientPtr		pClient = clientinfo->client;
+    __GLXclientState	*cl = glxGetClient(pClient);
+
+    switch (pClient->clientState) {
+    case ClientStateRunning:
+	/*
+	** By default, assume that the client supports
+	** GLX major version 1 minor version 0 protocol.
+	*/
+	cl->GLClientmajorVersion = 1;
+	cl->GLClientminorVersion = 0;
+	cl->client = pClient;
+	break;
+
+    case ClientStateGone:
+	free(cl->returnBuf);
+	free(cl->largeCmdBuf);
+	free(cl->GLClientextensions);
+	break;
+
+    default:
+	break;
+    }
+}
+
+/************************************************************************/
+
+static __GLXprovider *__glXProviderStack;
+
+void GlxPushProvider(__GLXprovider *provider)
+{
+    provider->next = __glXProviderStack;
+    __glXProviderStack = provider;
+}
+
+/*
+** Initialize the GLX extension.
+*/
+void GlxExtensionInit(void)
+{
+    ExtensionEntry *extEntry;
+    ScreenPtr pScreen;
+    int i;
+    __GLXprovider *p;
+    Bool glx_provided = False;
+
+    __glXContextRes = CreateNewResourceType((DeleteType)ContextGone,
+					    "GLXContext");
+    __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone,
+					     "GLXDrawable");
+    if (!__glXContextRes || !__glXDrawableRes)
+	return;
+
+    if (!dixRegisterPrivateKey(&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (__GLXclientState)))
+	return;
+    if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
+	return;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+	pScreen = screenInfo.screens[i];
+
+	for (p = __glXProviderStack; p != NULL; p = p->next) {
+	    __GLXscreen *glxScreen;
+
+	    glxScreen = p->screenProbe(pScreen);
+	    if (glxScreen != NULL) {
+	        if (glxScreen->GLXminor < glxMinorVersion)
+		    glxMinorVersion = glxScreen->GLXminor;
+		LogMessage(X_INFO,
+			   "GLX: Initialized %s GL provider for screen %d\n",
+			   p->name, i);
+		break;
+	    }
+
+	}
+
+	if (!p)
+	    LogMessage(X_INFO,
+		       "GLX: no usable GL providers found for screen %d\n", i);
+	else
+	    glx_provided = True;
+    }
+
+    /* don't register extension if GL is not provided on any screen */
+    if (!glx_provided)
+	return;
+
+    /*
+    ** Add extension to server extensions.
+    */
+    extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
+			    __GLX_NUMBER_ERRORS, __glXDispatch,
+			    __glXDispatch, ResetExtension,
+			    StandardMinorOpcode);
+    if (!extEntry) {
+	FatalError("__glXExtensionInit: AddExtensions failed\n");
+	return;
+    }
+    if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
+	ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
+	return;
+    }
+
+    __glXErrorBase = extEntry->errorBase;
+    __glXEventBase = extEntry->eventBase;
+}
+
+/************************************************************************/
+
+void __glXFlushContextCache(void)
+{
+    __glXLastContext = 0;
+}
+
+/*
+** Make a context the current one for the GL (in this implementation, there
+** is only one instance of the GL, and we use it to serve all GL clients by
+** switching it between different contexts).  While we are at it, look up
+** a context by its tag and return its (__GLXcontext *).
+*/
+__GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
+				int *error)
+{
+    __GLXcontext *cx;
+
+    /*
+    ** See if the context tag is legal; it is managed by the extension,
+    ** so if it's invalid, we have an implementation error.
+    */
+    cx = __glXLookupContextByTag(cl, tag);
+    if (!cx) {
+	cl->client->errorValue = tag;
+	*error = __glXError(GLXBadContextTag);
+	return 0;
+    }
+
+    if (!cx->isDirect) {
+	if (cx->drawPriv == NULL) {
+	    /*
+	    ** The drawable has vanished.  It must be a window, because only
+	    ** windows can be destroyed from under us; GLX pixmaps are
+	    ** refcounted and don't go away until no one is using them.
+	    */
+	    *error = __glXError(GLXBadCurrentWindow);
+	    return 0;
+    	}
+    }
+    
+    if (cx->wait && (*cx->wait)(cx, cl, error))
+	return NULL;
+
+    if (cx == __glXLastContext) {
+	/* No need to re-bind */
+	return cx;
+    }
+
+    /* Make this context the current one for the GL. */
+    if (!cx->isDirect) {
+	if (!(*cx->makeCurrent)(cx)) {
+	    /* Bind failed, and set the error code.  Bummer */
+	    cl->client->errorValue = cx->id;
+	    *error = __glXError(GLXBadContextState);
+	    return 0;
+    	}
+    }
+    __glXLastContext = cx;
+    return cx;
+}
+
+/************************************************************************/
+
+void glxSuspendClients(void)
+{
+    int i;
+
+    for (i = 1; i < currentMaxClients; i++) {
+	if (clients[i] && glxGetClient(clients[i])->inUse)
+	    IgnoreClient(clients[i]);
+    }
+
+    glxBlockClients = TRUE;
+}
+
+void glxResumeClients(void)
+{
+    __GLXcontext *cx, *next;
+    int i;
+
+    glxBlockClients = FALSE;
+
+    for (i = 1; i < currentMaxClients; i++) {
+	if (clients[i] && glxGetClient(clients[i])->inUse)
+	    AttendClient(clients[i]);
+    }
+
+    __glXleaveServer(GL_FALSE);
+    for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
+	next = cx->next;
+
+	cx->destroy(cx);
+    }
+    glxPendingDestroyContexts = NULL;
+    __glXenterServer(GL_FALSE);
+}
+
+static void
+__glXnopEnterServer(GLboolean rendering)
+{
+}
+    
+static void
+__glXnopLeaveServer(GLboolean rendering)
+{
+}
+
+static void (*__glXenterServerFunc)(GLboolean) = __glXnopEnterServer;
+static void (*__glXleaveServerFunc)(GLboolean)  = __glXnopLeaveServer;
+
+void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
+				   void (*leave)(GLboolean))
+{
+  __glXenterServerFunc = enter;
+  __glXleaveServerFunc = leave;
+}
+
+
+void __glXenterServer(GLboolean rendering)
+{
+  glxServerLeaveCount--;
+
+  if (glxServerLeaveCount == 0)
+    (*__glXenterServerFunc)(rendering);
+}
+
+void __glXleaveServer(GLboolean rendering)
+{
+  if (glxServerLeaveCount == 0)
+    (*__glXleaveServerFunc)(rendering);
+
+  glxServerLeaveCount++;
+}
+
+/*
+** Top level dispatcher; all commands are executed from here down.
+*/
+static int __glXDispatch(ClientPtr client)
+{
+    REQUEST(xGLXSingleReq);
+    CARD8 opcode;
+    __GLXdispatchSingleProcPtr proc;
+    __GLXclientState *cl;
+    int retval;
+
+    opcode = stuff->glxCode;
+    cl = glxGetClient(client);
+    /* Mark it in use so we suspend it on VT switch. */
+    cl->inUse = TRUE;
+
+    /*
+    ** If we're expecting a glXRenderLarge request, this better be one.
+    */
+    if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
+	client->errorValue = stuff->glxCode;
+	return __glXError(GLXBadLargeRequest);
+    }
+
+    /* If we're currently blocking GLX clients, just put this guy to
+     * sleep, reset the request and return. */
+    if (glxBlockClients) {
+	ResetCurrentRequest(client);
+	client->sequence--;
+	IgnoreClient(client);
+	return Success;
+    }
+
+    /*
+    ** Use the opcode to index into the procedure table.
+    */
+    proc = __glXGetProtocolDecodeFunction(& Single_dispatch_info, opcode,
+                                          client->swapped);
+    if (proc != NULL) {
+	GLboolean rendering = opcode <= X_GLXRenderLarge;
+	__glXleaveServer(rendering);
+
+	retval = (*proc)(cl, (GLbyte *) stuff);
+
+	__glXenterServer(rendering);
+    }
+    else {
+	retval = BadRequest;
+    }
+
+    return retval;
+}
diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c
index efcd07da3..15d80f5bb 100644
--- a/xorg-server/hw/dmx/input/dmxevents.c
+++ b/xorg-server/hw/dmx/input/dmxevents.c
@@ -1,800 +1,800 @@
-/*
- * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on 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
- * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- *   Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * Provide support and helper functions for enqueing events received by
- * the low-level input drivers. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_EVENTS_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxevents.h"
-#include "dmxcb.h"
-#include "dmxcommon.h"
-#include "dmxcursor.h"
-#include "dmxmotion.h"
-#include "dmxsigio.h"
-#include "dmxmap.h"
-
-#include <X11/keysym.h>
-#include "opaque.h"
-#include "inputstr.h"
-#include "inpututils.h"
-#include "mipointer.h"
-#include "mi.h"
-#include "exglobals.h"
-
-#include "xkbsrv.h"
-#include "XIstubs.h"
-
-static int  dmxGlobalX, dmxGlobalY; /* Global cursor position */
-static int  dmxGlobalInvalid;       /* Flag indicating dmxCoreMotion
-                                     * should move the mouse anyway. */
-
-#if DMX_EVENTS_DEBUG
-#define DMXDBG0(f)               dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a)             dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b)           dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c)         dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)       dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)     dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)   dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#endif
-
-static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
-{
-    int i;
-    int rc = 0;
-
-    for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
-        if (dmxInput->devs[i]->functions)
-            rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f);
-    return rc;
-}
-
-static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
-                                int type,
-                                KeySym keySym)
-{
-    DMXInputInfo   *dmxInput = &dmxInputs[dmxLocal->inputIdx];
-
-#if 1 /* hack to detect ctrl-alt-q, etc */
-    static int ctrl = 0, alt = 0;
-    /* keep track of ctrl/alt key status */
-    if (type == KeyPress && keySym == 0xffe3) {
-        ctrl = 1;
-    }
-    else if (type == KeyRelease && keySym == 0xffe3) {
-        ctrl = 0;
-    }
-    else if (type == KeyPress && keySym == 0xffe9) {
-        alt = 1;
-    }
-    else if (type == KeyRelease && keySym == 0xffe9) {
-        alt = 0;
-    }
-    if (!ctrl || !alt)
-        return 0;
-#else
-    unsigned short state = 0;
-
-    if (dmxLocal->sendsCore)
-        state = dmxLocalCoreKeyboard->pDevice->key->state;
-    else if (dmxLocal->pDevice->key)
-        state = dmxLocal->pDevice->key->state;
-    
-    DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
-            keySym, type == KeyPress ? "press" : "release", state);
-
-    if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
-        return 0;
-#endif
-
-    switch (keySym) {
-    case XK_g:
-        if (type == KeyPress)
-            dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB);
-        return 1;
-    case XK_f:
-        if (type == KeyPress)
-            dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE);
-        return 1;
-    case XK_q:
-        if (type == KeyPress && dmxLocal->sendsCore)
-            if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) {
-                dmxLog(dmxInfo, "User request for termination\n");
-                dispatchException |= DE_TERMINATE;
-            }
-        return 1;
-    }
-    
-    return 0;
-}
-
-
-DMXScreenInfo *dmxFindFirstScreen(int x, int y)
-{
-    int i;
-
-    for (i = 0; i < dmxNumScreens; i++) {
-        DMXScreenInfo *dmxScreen = &dmxScreens[i];
-        if (dmxOnScreen(x, y, dmxScreen))
-            return dmxScreen;
-    }
-    return NULL;
-}
-
-
-/**
- * Enqueue a motion event.
- */
-static void enqueueMotion(DevicePtr pDev, int x, int y)
-{
-    GETDMXLOCALFROMPDEV;
-    DeviceIntPtr p = dmxLocal->pDevice;
-    int i, nevents, valuators[3];
-    EventListPtr events;
-    int detail = 0;  /* XXX should this be mask of pressed buttons? */
-    ValuatorMask mask;
-    valuators[0] = x;
-    valuators[1] = y;
-
-    valuator_mask_set_range(&mask, 0, 2, valuators);
-    GetEventList(&events);
-    nevents = GetPointerEvents(events, p, MotionNotify, detail,
-                               POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
-    for (i = 0; i < nevents; i++)
-       mieqEnqueue(p, (InternalEvent*)(events + i)->event);
-    return;
-}
-
-
-void
-dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
-{
-    DMXScreenInfo *dmxScreen;
-    DMXInputInfo  *dmxInput;
-    ScreenPtr     pScreen;
-    int           localX;
-    int           localY;
-    int           i;
-
-    if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
-        return;
-    
-    DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
-            x, y, delta, dmxGlobalX, dmxGlobalY);
-
-    dmxGlobalInvalid = 0;
-    dmxGlobalX       = x;
-    dmxGlobalY       = y;
-
-    if (dmxGlobalX < 0)
-        dmxGlobalX = 0;
-    if (dmxGlobalY < 0)
-        dmxGlobalY = 0;
-    if (dmxGlobalX >= dmxGlobalWidth)
-        dmxGlobalX = dmxGlobalWidth  + delta -1;
-    if (dmxGlobalY >= dmxGlobalHeight)
-        dmxGlobalY = dmxGlobalHeight + delta -1;
-    
-    if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
-        localX = dmxGlobalX - dmxScreen->rootXOrigin;
-        localY = dmxGlobalY - dmxScreen->rootYOrigin;
-        if ((pScreen = miPointerGetScreen(inputInfo.pointer))
-            && pScreen->myNum == dmxScreen->index) {
-                                /* Screen is old screen */
-            if (block)
-                dmxSigioBlock();
-            if (pDev)
-               enqueueMotion(pDev, localX, localY);
-            if (block)
-                dmxSigioUnblock();
-        } else {
-                                /* Screen is new */
-            DMXDBG4("   New screen: old=%d new=%d localX=%d localY=%d\n",
-                    pScreen->myNum, dmxScreen->index, localX, localY);
-            if (block)
-                dmxSigioBlock();
-            mieqProcessInputEvents();
-            miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
-                               localX, localY);
-            if (pDev)
-               enqueueMotion(pDev, localX, localY);
-            if (block)
-                dmxSigioUnblock();
-        }
-#if 00
-        miPointerGetPosition(inputInfo.pointer, &localX, &localY);
-
-        if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
-            dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
-            dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
-            ErrorF("Global is now %d, %d  %d, %d\n", dmxGlobalX, dmxGlobalY,
-                   localX, localY);
-            DMXDBG6("   Moved to dmxGlobalX=%d dmxGlobalY=%d"
-                    " on screen index=%d/%d localX=%d localY=%d\n",
-                    dmxGlobalX, dmxGlobalY,
-                    dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
-                    localX, localY);
-        }
-#endif
-    }
-                                /* Send updates down to all core input
-                                 * drivers */
-    for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
-        int j;
-        for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
-            if (!dmxInput->detached
-                && dmxInput->devs[j]->sendsCore
-                && dmxInput->devs[j]->update_position)
-                dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
-                                                   dmxGlobalX, dmxGlobalY);
-    }
-    if (!dmxScreen) ProcessInputEvents();
-}
-
-
-
-#define DMX_MAX_AXES 32         /* Max axes reported by this routine */
-static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
-                         int *v, int firstAxis, int axesCount,
-                         DMXMotionType type, DMXBlockType block)
-{
-    DeviceIntPtr           pDevice = dmxLocal->pDevice;
-    xEvent                 xE[2 * DMX_MAX_AXES/6];
-    deviceKeyButtonPointer *xev    = (deviceKeyButtonPointer *)xE;
-    deviceValuator         *xv     = (deviceValuator *)xev+1;
-    int                    thisX   = 0;
-    int                    thisY   = 0;
-    int                    i;
-    int                    count;
-    EventListPtr           events;
-    int                    nevents;
-    ValuatorMask           mask;
-
-    memset(xE, 0, sizeof(xE));
-
-    if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
-
-    if ((valuator_get_mode(pDevice,0) == Relative) && axesCount == 2) {
-                                /* The dmx console is a relative mode
-                                 * device that sometimes reports
-                                 * absolute motion.  It only has two
-                                 * axes. */
-        if (type == DMX_RELATIVE) {
-            thisX = -v[0];
-            thisY = -v[1];
-            dmxLocal->lastX += thisX;
-            dmxLocal->lastY += thisY;
-            if (dmxLocal->update_position)
-                dmxLocal->update_position(dmxLocal->private,
-                                          dmxLocal->lastX, dmxLocal->lastY);
-        } else {                    /* Convert to relative */
-            if (dmxLocal->lastX || dmxLocal->lastY) {
-                thisX = v[0] - dmxLocal->lastX;
-                thisY = v[1] - dmxLocal->lastY;
-            }
-            dmxLocal->lastX = v[0];
-            dmxLocal->lastY = v[1];
-        }
-        v[0] = thisX;
-        v[1] = thisY;
-    }
-
-    if (axesCount <= 6) {
-                                /* Optimize for the common case when
-                                 * only 1 or 2 axes change. */
-            xev->time          = GetTimeInMillis();
-            xev->type          = DeviceMotionNotify;
-            xev->detail        = 0;
-            xev->deviceid      = pDevice->id | MORE_EVENTS;
-            
-            xv->type           = DeviceValuator;
-            xv->deviceid       = pDevice->id;
-            xv->num_valuators  = axesCount;
-            xv->first_valuator = firstAxis;
-            switch (xv->num_valuators) {
-            case 6: xv->valuator5 = v[5];
-            case 5: xv->valuator4 = v[4];
-            case 4: xv->valuator3 = v[3];
-            case 3: xv->valuator2 = v[2];
-            case 2: xv->valuator1 = v[1];
-            case 1: xv->valuator0 = v[0];
-            }
-            count              = 2;
-    } else {
-        for (i = 0, count = 0; i < axesCount; i += 6) {
-            xev->time          = GetTimeInMillis();
-            xev->type          = DeviceMotionNotify;
-            xev->detail        = 0;
-            xev->deviceid      = pDevice->id | MORE_EVENTS;
-            xev               += 2;
-            
-            xv->type           = DeviceValuator;
-            xv->deviceid       = pDevice->id;
-            xv->num_valuators  = (i+6 >= axesCount ? axesCount - i : 6);
-            xv->first_valuator = firstAxis + i;
-            switch (xv->num_valuators) {
-            case 6: xv->valuator5 = v[i+5];
-            case 5: xv->valuator4 = v[i+4];
-            case 4: xv->valuator3 = v[i+3];
-            case 3: xv->valuator2 = v[i+2];
-            case 2: xv->valuator1 = v[i+1];
-            case 1: xv->valuator0 = v[i+0];
-            }
-            xv                += 2;
-            count             += 2;
-        }
-    }
-
-    if (block)
-        dmxSigioBlock();
-    valuator_mask_set_range(&mask, firstAxis, axesCount, v);
-    GetEventList(&events);
-    nevents = GetPointerEvents(events, pDevice, MotionNotify, 0,
-                               POINTER_ABSOLUTE, &mask);
-    for (i = 0; i < nevents; i++)
-        mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
-    if (block)
-        dmxSigioUnblock();
-}
-
-static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
-                                          XEvent *e, DMXBlockType block)
-{
-    int                    type;
-    int                    event   = -1;
-    XDeviceKeyEvent        *ke     = (XDeviceKeyEvent *)e;
-    XDeviceMotionEvent     *me     = (XDeviceMotionEvent *)e;
-    DeviceIntPtr           pDevice = dmxLocal->pDevice;
-    int                    valuators[MAX_VALUATORS];
-    EventListPtr           events;
-    int                    nevents, i;
-    ValuatorMask           mask;
-
-    if (!e)
-        return -1;          /* No extended event passed, cannot handle */
-
-    if ((XID)dmxLocal->deviceId != ke->deviceid) {
-                                /* Search for the correct dmxLocal,
-                                 * since backend and console events are
-                                 * picked up for the first device on
-                                 * that X server. */
-        int i;
-        DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
-        for (i = 0; i < dmxInput->numDevs; i++) {
-            dmxLocal = dmxInput->devs[i];
-            if ((XID)dmxLocal->deviceId == ke->deviceid)
-                break;
-        }
-    }
-
-    if ((XID)dmxLocal->deviceId != ke->deviceid
-        || (type = dmxMapLookup(dmxLocal, e->type)) < 0)
-        return -1;    /* No mapping, so this event is unhandled */
-
-    switch (type) {
-    case XI_DeviceValuator:          event = DeviceValuator;          break;
-    case XI_DeviceKeyPress:          event = KeyPress;                break;
-    case XI_DeviceKeyRelease:        event = KeyRelease;              break;
-    case XI_DeviceButtonPress:       event = ButtonPress;             break;
-    case XI_DeviceButtonRelease:     event = ButtonRelease;           break;
-    case XI_DeviceMotionNotify:      event = MotionNotify;            break;
-    case XI_DeviceFocusIn:           event = DeviceFocusIn;           break;
-    case XI_DeviceFocusOut:          event = DeviceFocusOut;          break;
-    case XI_ProximityIn:             event = ProximityIn;             break;
-    case XI_ProximityOut:            event = ProximityOut;            break;
-    case XI_DeviceStateNotify:       event = DeviceStateNotify;       break;
-    case XI_DeviceMappingNotify:     event = DeviceMappingNotify;     break;
-    case XI_ChangeDeviceNotify:      event = ChangeDeviceNotify;      break;
-    case XI_DeviceKeystateNotify:    event = DeviceStateNotify;       break;
-    case XI_DeviceButtonstateNotify: event = DeviceStateNotify;       break;
-    }
-
-#define EXTRACT_VALUATORS(ke, valuators) \
-        valuators[0] = ke->axis_data[0]; \
-        valuators[1] = ke->axis_data[1]; \
-        valuators[2] = ke->axis_data[2]; \
-        valuators[3] = ke->axis_data[3]; \
-        valuators[4] = ke->axis_data[4]; \
-        valuators[5] = ke->axis_data[5]; \
-
-    switch (type) {
-    case XI_DeviceKeyPress:
-    case XI_DeviceKeyRelease:
-        EXTRACT_VALUATORS(ke, valuators);
-        valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
-        if (block)
-            dmxSigioBlock();
-        GetEventList(&events);
-        nevents = GetKeyboardValuatorEvents(events, pDevice, event,
-                                            ke->keycode, &mask);
-        for (i = 0; i < nevents; i++)
-            mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
-        if (block)
-            dmxSigioUnblock();
-        break;
-    case XI_DeviceButtonPress:
-    case XI_DeviceButtonRelease:
-        EXTRACT_VALUATORS(ke, valuators);
-        valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
-        if (block)
-            dmxSigioBlock();
-        GetEventList(&events);
-        nevents = GetPointerEvents(events, pDevice, event, ke->keycode,
-                                   POINTER_ABSOLUTE, &mask);
-        for (i = 0; i < nevents; i++)
-            mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
-        if (block)
-            dmxSigioUnblock();
-        break;
-    case XI_ProximityIn:
-    case XI_ProximityOut:
-        EXTRACT_VALUATORS(ke, valuators);
-        valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
-        if (block)
-            dmxSigioBlock();
-        GetEventList(&events);
-        nevents = GetProximityEvents(events, pDevice, event, &mask);
-        for (i = 0; i < nevents; i++)
-            mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
-        if (block)
-            dmxSigioUnblock();
-        break;
-
-        break;
-
-    case XI_DeviceMotionNotify:
-        dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count,
-                     DMX_ABSOLUTE, block);
-        break;
-    case XI_DeviceFocusIn:
-    case XI_DeviceFocusOut:
-    case XI_DeviceStateNotify:
-    case XI_DeviceMappingNotify:
-    case XI_ChangeDeviceNotify:
-    case XI_DeviceKeystateNotify:
-    case XI_DeviceButtonstateNotify:
-                                /* These are ignored, since DMX will
-                                 * generate its own events of these
-                                 * types, as necessary.
-
-                                 * Perhaps ChangeDeviceNotify should
-                                 * generate an error, because it is
-                                 * unexpected? */
-        break;
-    case XI_DeviceValuator:
-    default:
-        dmxLog(dmxWarning,
-               "XInput extension event (remote=%d -> zero-based=%d)"
-               " not supported yet\n", e->type, type);
-        return -1;
-    }
-    return 0;
-}
-
-static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
-{
-    ButtonClassPtr b = dmxLocal->pDevice->button;
-
-    if (button > b->numButtons) { /* This shouldn't happen. */
-        dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
-               button, b->numButtons);
-        return button;
-    }
-    return b->map[button];
-}
-
-/** Return DMX's notion of the pointer position in the global coordinate
- * space. */
-void dmxGetGlobalPosition(int *x, int *y)
-{
-    *x = dmxGlobalX;
-    *y = dmxGlobalY;
-}
-
-/** Invalidate the global position for #dmxCoreMotion. */
-void dmxInvalidateGlobalPosition(void)
-{
-    dmxGlobalInvalid = 1;
-}
-
-/** Enqueue a motion event for \a pDev.  The \a v vector has length \a
- * axesCount, and contains values for each of the axes, starting at \a
- * firstAxes.
- *
- * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or
- * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be
- * allowed to move outside the global boundaires).
- *
- * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
- * blocked around calls to \a enqueueMotion(). */
-void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
-               DMXMotionType type, DMXBlockType block)
-{
-    GETDMXLOCALFROMPDEV;
-
-    if (!dmxLocal->sendsCore) {
-        dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block);
-        return;
-    }
-    if (axesCount == 2) {
-        switch (type) {
-        case DMX_RELATIVE:
-            dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block);
-            break;
-        case DMX_ABSOLUTE:
-            dmxCoreMotion(pDev, v[0], v[1], 0, block);
-            break;
-        case DMX_ABSOLUTE_CONFINED:
-            dmxCoreMotion(pDev, v[0], v[1], -1, block);
-            break;
-        }
-    }
-}
-
-static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
-                                 KeyCode keyCode)
-{
-    KeySym keysym = NoSymbol;
-    int effectiveGroup;
-    XkbSrvInfoPtr xkbi;
-
-    if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
-        goto out;
-
-    xkbi = dmxLocal->pDevice->key->xkbInfo;
-    effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode);
-
-    if (effectiveGroup == -1)
-        goto out;
-
-    keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup);
-    DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
-            keyCode, keysym);
-
-out:
-    return keysym;
-}
-
-static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
-                                  int tryFirst)
-{
-    /* FIXME: this is quite ineffective, converting to a core map first and
-     * then extracting the info from there. It'd be better to run the actual
-     * xkb map */
-    XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo;
-    KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice);
-    int        i;
-
-                                /* Optimize for similar maps */
-    if (XkbKeycodeInRange(xkbi->desc, tryFirst)
-        && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
-                         * pKeySyms->mapWidth] == keySym)
-        return tryFirst;
-
-    for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) {
-        if (pKeySyms->map[(i - pKeySyms->minKeyCode)
-                          * pKeySyms->mapWidth] == keySym) {
-            DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
-                    " keyCode=%d (reverses to core keySym=0x%04x)\n",
-                    keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
-            return i;
-        }
-    }
-    return 0;
-}
-
-static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
-{
-    GETDMXLOCALFROMPDEV;
-    int keyCode;
-    
-    if (!dmxLocal->pDevice->key) {
-        dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n",
-               dmxLocal->pDevice->name);
-        return NoSymbol;
-    }
-    if (!keySym)
-        keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
-    if (keySym == NoSymbol)
-        return detail;
-    keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
-
-    return keyCode ? keyCode : detail;
-}
-
-/** Enqueue an event from the \a pDev device with the
- * specified \a type and \a detail.  If the event is a KeyPress or
- * KeyRelease event, then the \a keySym is also specified.
- *
- * FIXME: make the code do what the comment says, or remove this comment.
- * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
- * blocked around calls to dmxeqEnqueue(). */
-    
-void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
-                XEvent *e, DMXBlockType block)
-{
-    GETDMXINPUTFROMPDEV;
-    xEvent xE;
-    DeviceIntPtr p = dmxLocal->pDevice;
-    int i, nevents, valuators[3];
-    EventListPtr events;
-    ValuatorMask mask;
-
-    DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
-
-    switch (type) {
-    case KeyPress:
-    case KeyRelease:
-        if (!keySym)
-            keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
-        if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
-            return;
-        if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
-            xE.u.u.detail = dmxFixup(pDev, detail, keySym);
-
-        GetEventList(&events);
-        /*ErrorF("KEY %d  sym %d\n", detail, (int) keySym);*/
-        nevents = GetKeyboardEvents(events, p, type, detail);
-        for (i = 0; i < nevents; i++)
-            mieqEnqueue(p, (InternalEvent*)(events + i)->event);
-        return;
-
-    case ButtonPress:
-    case ButtonRelease:
-        detail = dmxGetButtonMapping(dmxLocal, detail);
-        valuator_mask_zero(&mask);
-        GetEventList(&events);
-        nevents = GetPointerEvents(events, p, type, detail,
-                                   POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
-        for (i = 0; i < nevents; i++)
-            mieqEnqueue(p, (InternalEvent*)(events + i)->event);
-        return;
-
-    case MotionNotify:
-        GetEventList(&events);
-        valuators[0] = e->xmotion.x;
-        valuators[1] = e->xmotion.y;
-        valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
-        valuator_mask_set_range(&mask, 0, 3, valuators);
-        nevents = GetPointerEvents(events, p, type, detail, 
-                                   POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
-        for (i = 0; i < nevents; i++)
-            mieqEnqueue(p, (InternalEvent*)(events + i)->event);
-        return;
-
-    case EnterNotify:
-    case LeaveNotify:
-    case KeymapNotify:
-    case MappingNotify:         /* This is sent because we change the
-                                 * modifier map on the backend/console
-                                 * input device so that we have complete
-                                 * control of the input device LEDs. */
-        return;
-    default:
-        if (type == ProximityIn || type == ProximityOut) {
-            if (dmxLocal->sendsCore)
-                return; /* Not a core event */
-            break;
-        }
-        if (type >= LASTEvent) {
-            if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
-                dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
-        } else {
-            dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
-                        type, dmxEventName(type));
-        }
-        return;
-    }
-
-}
-
-/** A pointer to this routine is passed to low-level input drivers so
- * that all special keychecking is unified to this file.  This function
- * returns 0 if no special keys have been pressed.  If the user has
- * requested termination of the DMX server, -1 is returned.  If the user
- * has requested a switch to a VT, then the (1-based) number of that VT
- * is returned. */
-int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
-{
-    GETDMXINPUTFROMPDEV;
-    int            vt    = 0;
-    unsigned short state = 0;
-
-    if (dmxLocal->sendsCore)
-        state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state);
-    else if (dmxLocal->pDevice->key)
-        state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state);
-
-    if (!dmxLocal->sendsCore) return 0; /* Only for core devices */
-
-    DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym,state);
-    
-    if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
-    
-    switch (keySym) {
-    case XK_F1:
-    case XK_F2:
-    case XK_F3:
-    case XK_F4:
-    case XK_F5:
-    case XK_F6:
-    case XK_F7:
-    case XK_F8:
-    case XK_F9:
-    case XK_F10:
-        vt = keySym - XK_F1 + 1;
-        break;
-
-    case XK_F11:
-    case XK_F12:
-        vt = keySym - XK_F11 + 11;
-        break;
-
-    case XK_q:                  /* To avoid confusion  */
-    case XK_BackSpace:
-    case XK_Delete:
-    case XK_KP_Delete:
-        dmxLog(dmxInfo, "User request for termination\n");
-        dispatchException |= DE_TERMINATE;
-        return -1;              /* Terminate */
-    }
-
-    if (vt) {
-        dmxLog(dmxInfo, "Request to switch to VT %d\n", vt);
-        dmxInput->vt_switch_pending = vt;
-        return vt;
-    }
-
-    return 0;                   /* Do nothing */
-}
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ *   Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide support and helper functions for enqueing events received by
+ * the low-level input drivers. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_EVENTS_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxevents.h"
+#include "dmxcb.h"
+#include "dmxcommon.h"
+#include "dmxcursor.h"
+#include "dmxmotion.h"
+#include "dmxsigio.h"
+#include "dmxmap.h"
+
+#include <X11/keysym.h>
+#include "opaque.h"
+#include "inputstr.h"
+#include "inpututils.h"
+#include "mipointer.h"
+#include "mi.h"
+#include "exglobals.h"
+
+#include "xkbsrv.h"
+#include "XIstubs.h"
+
+static int  dmxGlobalX, dmxGlobalY; /* Global cursor position */
+static int  dmxGlobalInvalid;       /* Flag indicating dmxCoreMotion
+                                     * should move the mouse anyway. */
+
+#if DMX_EVENTS_DEBUG
+#define DMXDBG0(f)               dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a)             dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b)           dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c)         dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)       dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)     dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)   dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
+{
+    int i;
+    int rc = 0;
+
+    for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
+        if (dmxInput->devs[i]->functions)
+            rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f);
+    return rc;
+}
+
+static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
+                                int type,
+                                KeySym keySym)
+{
+    DMXInputInfo   *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+
+#if 1 /* hack to detect ctrl-alt-q, etc */
+    static int ctrl = 0, alt = 0;
+    /* keep track of ctrl/alt key status */
+    if (type == KeyPress && keySym == 0xffe3) {
+        ctrl = 1;
+    }
+    else if (type == KeyRelease && keySym == 0xffe3) {
+        ctrl = 0;
+    }
+    else if (type == KeyPress && keySym == 0xffe9) {
+        alt = 1;
+    }
+    else if (type == KeyRelease && keySym == 0xffe9) {
+        alt = 0;
+    }
+    if (!ctrl || !alt)
+        return 0;
+#else
+    unsigned short state = 0;
+
+    if (dmxLocal->sendsCore)
+        state = dmxLocalCoreKeyboard->pDevice->key->state;
+    else if (dmxLocal->pDevice->key)
+        state = dmxLocal->pDevice->key->state;
+    
+    DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
+            keySym, type == KeyPress ? "press" : "release", state);
+
+    if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
+        return 0;
+#endif
+
+    switch (keySym) {
+    case XK_g:
+        if (type == KeyPress)
+            dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB);
+        return 1;
+    case XK_f:
+        if (type == KeyPress)
+            dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE);
+        return 1;
+    case XK_q:
+        if (type == KeyPress && dmxLocal->sendsCore)
+            if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) {
+                dmxLog(dmxInfo, "User request for termination\n");
+                dispatchException |= DE_TERMINATE;
+            }
+        return 1;
+    }
+    
+    return 0;
+}
+
+
+DMXScreenInfo *dmxFindFirstScreen(int x, int y)
+{
+    int i;
+
+    for (i = 0; i < dmxNumScreens; i++) {
+        DMXScreenInfo *dmxScreen = &dmxScreens[i];
+        if (dmxOnScreen(x, y, dmxScreen))
+            return dmxScreen;
+    }
+    return NULL;
+}
+
+
+/**
+ * Enqueue a motion event.
+ */
+static void enqueueMotion(DevicePtr pDev, int x, int y)
+{
+    GETDMXLOCALFROMPDEV;
+    DeviceIntPtr p = dmxLocal->pDevice;
+    int i, nevents, valuators[3];
+    EventListPtr events;
+    int detail = 0;  /* XXX should this be mask of pressed buttons? */
+    ValuatorMask mask;
+    valuators[0] = x;
+    valuators[1] = y;
+
+    valuator_mask_set_range(&mask, 0, 2, valuators);
+    GetEventList(&events);
+    nevents = GetPointerEvents(events, p, MotionNotify, detail,
+                               POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+    for (i = 0; i < nevents; i++)
+       mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+    return;
+}
+
+
+void
+dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
+{
+    DMXScreenInfo *dmxScreen;
+    DMXInputInfo  *dmxInput;
+    ScreenPtr     pScreen;
+    int           localX;
+    int           localY;
+    int           i;
+
+    if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
+        return;
+    
+    DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
+            x, y, delta, dmxGlobalX, dmxGlobalY);
+
+    dmxGlobalInvalid = 0;
+    dmxGlobalX       = x;
+    dmxGlobalY       = y;
+
+    if (dmxGlobalX < 0)
+        dmxGlobalX = 0;
+    if (dmxGlobalY < 0)
+        dmxGlobalY = 0;
+    if (dmxGlobalX >= dmxGlobalWidth)
+        dmxGlobalX = dmxGlobalWidth  + delta -1;
+    if (dmxGlobalY >= dmxGlobalHeight)
+        dmxGlobalY = dmxGlobalHeight + delta -1;
+    
+    if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
+        localX = dmxGlobalX - dmxScreen->rootXOrigin;
+        localY = dmxGlobalY - dmxScreen->rootYOrigin;
+        if ((pScreen = miPointerGetScreen(inputInfo.pointer))
+            && pScreen->myNum == dmxScreen->index) {
+                                /* Screen is old screen */
+            if (block)
+                dmxSigioBlock();
+            if (pDev)
+               enqueueMotion(pDev, localX, localY);
+            if (block)
+                dmxSigioUnblock();
+        } else {
+                                /* Screen is new */
+            DMXDBG4("   New screen: old=%d new=%d localX=%d localY=%d\n",
+                    pScreen->myNum, dmxScreen->index, localX, localY);
+            if (block)
+                dmxSigioBlock();
+            mieqProcessInputEvents();
+            miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
+                               localX, localY);
+            if (pDev)
+               enqueueMotion(pDev, localX, localY);
+            if (block)
+                dmxSigioUnblock();
+        }
+#if 00
+        miPointerGetPosition(inputInfo.pointer, &localX, &localY);
+
+        if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
+            dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
+            dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
+            ErrorF("Global is now %d, %d  %d, %d\n", dmxGlobalX, dmxGlobalY,
+                   localX, localY);
+            DMXDBG6("   Moved to dmxGlobalX=%d dmxGlobalY=%d"
+                    " on screen index=%d/%d localX=%d localY=%d\n",
+                    dmxGlobalX, dmxGlobalY,
+                    dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
+                    localX, localY);
+        }
+#endif
+    }
+                                /* Send updates down to all core input
+                                 * drivers */
+    for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
+        int j;
+        for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
+            if (!dmxInput->detached
+                && dmxInput->devs[j]->sendsCore
+                && dmxInput->devs[j]->update_position)
+                dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
+                                                   dmxGlobalX, dmxGlobalY);
+    }
+    if (!dmxScreen) ProcessInputEvents();
+}
+
+
+
+#define DMX_MAX_AXES 32         /* Max axes reported by this routine */
+static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
+                         int *v, int firstAxis, int axesCount,
+                         DMXMotionType type, DMXBlockType block)
+{
+    DeviceIntPtr           pDevice = dmxLocal->pDevice;
+    xEvent                 xE[2 * DMX_MAX_AXES/6];
+    deviceKeyButtonPointer *xev    = (deviceKeyButtonPointer *)xE;
+    deviceValuator         *xv     = (deviceValuator *)xev+1;
+    int                    thisX   = 0;
+    int                    thisY   = 0;
+    int                    i;
+    int                    count;
+    EventListPtr           events;
+    int                    nevents;
+    ValuatorMask           mask;
+
+    memset(xE, 0, sizeof(xE));
+
+    if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
+
+    if ((valuator_get_mode(pDevice,0) == Relative) && axesCount == 2) {
+                                /* The dmx console is a relative mode
+                                 * device that sometimes reports
+                                 * absolute motion.  It only has two
+                                 * axes. */
+        if (type == DMX_RELATIVE) {
+            thisX = -v[0];
+            thisY = -v[1];
+            dmxLocal->lastX += thisX;
+            dmxLocal->lastY += thisY;
+            if (dmxLocal->update_position)
+                dmxLocal->update_position(dmxLocal->private,
+                                          dmxLocal->lastX, dmxLocal->lastY);
+        } else {                    /* Convert to relative */
+            if (dmxLocal->lastX || dmxLocal->lastY) {
+                thisX = v[0] - dmxLocal->lastX;
+                thisY = v[1] - dmxLocal->lastY;
+            }
+            dmxLocal->lastX = v[0];
+            dmxLocal->lastY = v[1];
+        }
+        v[0] = thisX;
+        v[1] = thisY;
+    }
+
+    if (axesCount <= 6) {
+                                /* Optimize for the common case when
+                                 * only 1 or 2 axes change. */
+            xev->time          = GetTimeInMillis();
+            xev->type          = DeviceMotionNotify;
+            xev->detail        = 0;
+            xev->deviceid      = pDevice->id | MORE_EVENTS;
+            
+            xv->type           = DeviceValuator;
+            xv->deviceid       = pDevice->id;
+            xv->num_valuators  = axesCount;
+            xv->first_valuator = firstAxis;
+            switch (xv->num_valuators) {
+            case 6: xv->valuator5 = v[5];
+            case 5: xv->valuator4 = v[4];
+            case 4: xv->valuator3 = v[3];
+            case 3: xv->valuator2 = v[2];
+            case 2: xv->valuator1 = v[1];
+            case 1: xv->valuator0 = v[0];
+            }
+            count              = 2;
+    } else {
+        for (i = 0, count = 0; i < axesCount; i += 6) {
+            xev->time          = GetTimeInMillis();
+            xev->type          = DeviceMotionNotify;
+            xev->detail        = 0;
+            xev->deviceid      = pDevice->id | MORE_EVENTS;
+            xev               += 2;
+            
+            xv->type           = DeviceValuator;
+            xv->deviceid       = pDevice->id;
+            xv->num_valuators  = (i+6 >= axesCount ? axesCount - i : 6);
+            xv->first_valuator = firstAxis + i;
+            switch (xv->num_valuators) {
+            case 6: xv->valuator5 = v[i+5];
+            case 5: xv->valuator4 = v[i+4];
+            case 4: xv->valuator3 = v[i+3];
+            case 3: xv->valuator2 = v[i+2];
+            case 2: xv->valuator1 = v[i+1];
+            case 1: xv->valuator0 = v[i+0];
+            }
+            xv                += 2;
+            count             += 2;
+        }
+    }
+
+    if (block)
+        dmxSigioBlock();
+    valuator_mask_set_range(&mask, firstAxis, axesCount, v);
+    GetEventList(&events);
+    nevents = GetPointerEvents(events, pDevice, MotionNotify, 0,
+                               POINTER_ABSOLUTE, &mask);
+    for (i = 0; i < nevents; i++)
+        mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+    if (block)
+        dmxSigioUnblock();
+}
+
+static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
+                                          XEvent *e, DMXBlockType block)
+{
+    int                    type;
+    int                    event   = -1;
+    XDeviceKeyEvent        *ke     = (XDeviceKeyEvent *)e;
+    XDeviceMotionEvent     *me     = (XDeviceMotionEvent *)e;
+    DeviceIntPtr           pDevice = dmxLocal->pDevice;
+    int                    valuators[MAX_VALUATORS];
+    EventListPtr           events;
+    int                    nevents, i;
+    ValuatorMask           mask;
+
+    if (!e)
+        return -1;          /* No extended event passed, cannot handle */
+
+    if ((XID)dmxLocal->deviceId != ke->deviceid) {
+                                /* Search for the correct dmxLocal,
+                                 * since backend and console events are
+                                 * picked up for the first device on
+                                 * that X server. */
+        int i;
+        DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+        for (i = 0; i < dmxInput->numDevs; i++) {
+            dmxLocal = dmxInput->devs[i];
+            if ((XID)dmxLocal->deviceId == ke->deviceid)
+                break;
+        }
+    }
+
+    if ((XID)dmxLocal->deviceId != ke->deviceid
+        || (type = dmxMapLookup(dmxLocal, e->type)) < 0)
+        return -1;    /* No mapping, so this event is unhandled */
+
+    switch (type) {
+    case XI_DeviceValuator:          event = DeviceValuator;          break;
+    case XI_DeviceKeyPress:          event = KeyPress;                break;
+    case XI_DeviceKeyRelease:        event = KeyRelease;              break;
+    case XI_DeviceButtonPress:       event = ButtonPress;             break;
+    case XI_DeviceButtonRelease:     event = ButtonRelease;           break;
+    case XI_DeviceMotionNotify:      event = MotionNotify;            break;
+    case XI_DeviceFocusIn:           event = DeviceFocusIn;           break;
+    case XI_DeviceFocusOut:          event = DeviceFocusOut;          break;
+    case XI_ProximityIn:             event = ProximityIn;             break;
+    case XI_ProximityOut:            event = ProximityOut;            break;
+    case XI_DeviceStateNotify:       event = DeviceStateNotify;       break;
+    case XI_DeviceMappingNotify:     event = DeviceMappingNotify;     break;
+    case XI_ChangeDeviceNotify:      event = ChangeDeviceNotify;      break;
+    case XI_DeviceKeystateNotify:    event = DeviceStateNotify;       break;
+    case XI_DeviceButtonstateNotify: event = DeviceStateNotify;       break;
+    }
+
+#define EXTRACT_VALUATORS(ke, valuators) \
+        valuators[0] = ke->axis_data[0]; \
+        valuators[1] = ke->axis_data[1]; \
+        valuators[2] = ke->axis_data[2]; \
+        valuators[3] = ke->axis_data[3]; \
+        valuators[4] = ke->axis_data[4]; \
+        valuators[5] = ke->axis_data[5]; \
+
+    switch (type) {
+    case XI_DeviceKeyPress:
+    case XI_DeviceKeyRelease:
+        EXTRACT_VALUATORS(ke, valuators);
+        valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+        if (block)
+            dmxSigioBlock();
+        GetEventList(&events);
+        nevents = GetKeyboardEvents(events, pDevice, event,
+                                    ke->keycode, &mask);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+        if (block)
+            dmxSigioUnblock();
+        break;
+    case XI_DeviceButtonPress:
+    case XI_DeviceButtonRelease:
+        EXTRACT_VALUATORS(ke, valuators);
+        valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+        if (block)
+            dmxSigioBlock();
+        GetEventList(&events);
+        nevents = GetPointerEvents(events, pDevice, event, ke->keycode,
+                                   POINTER_ABSOLUTE, &mask);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+        if (block)
+            dmxSigioUnblock();
+        break;
+    case XI_ProximityIn:
+    case XI_ProximityOut:
+        EXTRACT_VALUATORS(ke, valuators);
+        valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+        if (block)
+            dmxSigioBlock();
+        GetEventList(&events);
+        nevents = GetProximityEvents(events, pDevice, event, &mask);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+        if (block)
+            dmxSigioUnblock();
+        break;
+
+        break;
+
+    case XI_DeviceMotionNotify:
+        dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count,
+                     DMX_ABSOLUTE, block);
+        break;
+    case XI_DeviceFocusIn:
+    case XI_DeviceFocusOut:
+    case XI_DeviceStateNotify:
+    case XI_DeviceMappingNotify:
+    case XI_ChangeDeviceNotify:
+    case XI_DeviceKeystateNotify:
+    case XI_DeviceButtonstateNotify:
+                                /* These are ignored, since DMX will
+                                 * generate its own events of these
+                                 * types, as necessary.
+
+                                 * Perhaps ChangeDeviceNotify should
+                                 * generate an error, because it is
+                                 * unexpected? */
+        break;
+    case XI_DeviceValuator:
+    default:
+        dmxLog(dmxWarning,
+               "XInput extension event (remote=%d -> zero-based=%d)"
+               " not supported yet\n", e->type, type);
+        return -1;
+    }
+    return 0;
+}
+
+static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
+{
+    ButtonClassPtr b = dmxLocal->pDevice->button;
+
+    if (button > b->numButtons) { /* This shouldn't happen. */
+        dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
+               button, b->numButtons);
+        return button;
+    }
+    return b->map[button];
+}
+
+/** Return DMX's notion of the pointer position in the global coordinate
+ * space. */
+void dmxGetGlobalPosition(int *x, int *y)
+{
+    *x = dmxGlobalX;
+    *y = dmxGlobalY;
+}
+
+/** Invalidate the global position for #dmxCoreMotion. */
+void dmxInvalidateGlobalPosition(void)
+{
+    dmxGlobalInvalid = 1;
+}
+
+/** Enqueue a motion event for \a pDev.  The \a v vector has length \a
+ * axesCount, and contains values for each of the axes, starting at \a
+ * firstAxes.
+ *
+ * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or
+ * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be
+ * allowed to move outside the global boundaires).
+ *
+ * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
+ * blocked around calls to \a enqueueMotion(). */
+void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
+               DMXMotionType type, DMXBlockType block)
+{
+    GETDMXLOCALFROMPDEV;
+
+    if (!dmxLocal->sendsCore) {
+        dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block);
+        return;
+    }
+    if (axesCount == 2) {
+        switch (type) {
+        case DMX_RELATIVE:
+            dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block);
+            break;
+        case DMX_ABSOLUTE:
+            dmxCoreMotion(pDev, v[0], v[1], 0, block);
+            break;
+        case DMX_ABSOLUTE_CONFINED:
+            dmxCoreMotion(pDev, v[0], v[1], -1, block);
+            break;
+        }
+    }
+}
+
+static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
+                                 KeyCode keyCode)
+{
+    KeySym keysym = NoSymbol;
+    int effectiveGroup;
+    XkbSrvInfoPtr xkbi;
+
+    if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
+        goto out;
+
+    xkbi = dmxLocal->pDevice->key->xkbInfo;
+    effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode);
+
+    if (effectiveGroup == -1)
+        goto out;
+
+    keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup);
+    DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
+            keyCode, keysym);
+
+out:
+    return keysym;
+}
+
+static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
+                                  int tryFirst)
+{
+    /* FIXME: this is quite ineffective, converting to a core map first and
+     * then extracting the info from there. It'd be better to run the actual
+     * xkb map */
+    XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo;
+    KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice);
+    int        i;
+
+                                /* Optimize for similar maps */
+    if (XkbKeycodeInRange(xkbi->desc, tryFirst)
+        && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
+                         * pKeySyms->mapWidth] == keySym)
+        return tryFirst;
+
+    for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) {
+        if (pKeySyms->map[(i - pKeySyms->minKeyCode)
+                          * pKeySyms->mapWidth] == keySym) {
+            DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
+                    " keyCode=%d (reverses to core keySym=0x%04x)\n",
+                    keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
+            return i;
+        }
+    }
+    return 0;
+}
+
+static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
+{
+    GETDMXLOCALFROMPDEV;
+    int keyCode;
+    
+    if (!dmxLocal->pDevice->key) {
+        dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n",
+               dmxLocal->pDevice->name);
+        return NoSymbol;
+    }
+    if (!keySym)
+        keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+    if (keySym == NoSymbol)
+        return detail;
+    keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
+
+    return keyCode ? keyCode : detail;
+}
+
+/** Enqueue an event from the \a pDev device with the
+ * specified \a type and \a detail.  If the event is a KeyPress or
+ * KeyRelease event, then the \a keySym is also specified.
+ *
+ * FIXME: make the code do what the comment says, or remove this comment.
+ * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
+ * blocked around calls to dmxeqEnqueue(). */
+    
+void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
+                XEvent *e, DMXBlockType block)
+{
+    GETDMXINPUTFROMPDEV;
+    xEvent xE;
+    DeviceIntPtr p = dmxLocal->pDevice;
+    int i, nevents, valuators[3];
+    EventListPtr events;
+    ValuatorMask mask;
+
+    DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
+
+    switch (type) {
+    case KeyPress:
+    case KeyRelease:
+        if (!keySym)
+            keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+        if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
+            return;
+        if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
+            xE.u.u.detail = dmxFixup(pDev, detail, keySym);
+
+        GetEventList(&events);
+        /*ErrorF("KEY %d  sym %d\n", detail, (int) keySym);*/
+        nevents = GetKeyboardEvents(events, p, type, detail, NULL);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+        return;
+
+    case ButtonPress:
+    case ButtonRelease:
+        detail = dmxGetButtonMapping(dmxLocal, detail);
+        valuator_mask_zero(&mask);
+        GetEventList(&events);
+        nevents = GetPointerEvents(events, p, type, detail,
+                                   POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+        return;
+
+    case MotionNotify:
+        GetEventList(&events);
+        valuators[0] = e->xmotion.x;
+        valuators[1] = e->xmotion.y;
+        valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
+        valuator_mask_set_range(&mask, 0, 3, valuators);
+        nevents = GetPointerEvents(events, p, type, detail, 
+                                   POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+        return;
+
+    case EnterNotify:
+    case LeaveNotify:
+    case KeymapNotify:
+    case MappingNotify:         /* This is sent because we change the
+                                 * modifier map on the backend/console
+                                 * input device so that we have complete
+                                 * control of the input device LEDs. */
+        return;
+    default:
+        if (type == ProximityIn || type == ProximityOut) {
+            if (dmxLocal->sendsCore)
+                return; /* Not a core event */
+            break;
+        }
+        if (type >= LASTEvent) {
+            if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
+                dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
+        } else {
+            dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
+                        type, dmxEventName(type));
+        }
+        return;
+    }
+
+}
+
+/** A pointer to this routine is passed to low-level input drivers so
+ * that all special keychecking is unified to this file.  This function
+ * returns 0 if no special keys have been pressed.  If the user has
+ * requested termination of the DMX server, -1 is returned.  If the user
+ * has requested a switch to a VT, then the (1-based) number of that VT
+ * is returned. */
+int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
+{
+    GETDMXINPUTFROMPDEV;
+    int            vt    = 0;
+    unsigned short state = 0;
+
+    if (dmxLocal->sendsCore)
+        state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state);
+    else if (dmxLocal->pDevice->key)
+        state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state);
+
+    if (!dmxLocal->sendsCore) return 0; /* Only for core devices */
+
+    DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym,state);
+    
+    if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
+    
+    switch (keySym) {
+    case XK_F1:
+    case XK_F2:
+    case XK_F3:
+    case XK_F4:
+    case XK_F5:
+    case XK_F6:
+    case XK_F7:
+    case XK_F8:
+    case XK_F9:
+    case XK_F10:
+        vt = keySym - XK_F1 + 1;
+        break;
+
+    case XK_F11:
+    case XK_F12:
+        vt = keySym - XK_F11 + 11;
+        break;
+
+    case XK_q:                  /* To avoid confusion  */
+    case XK_BackSpace:
+    case XK_Delete:
+    case XK_KP_Delete:
+        dmxLog(dmxInfo, "User request for termination\n");
+        dispatchException |= DE_TERMINATE;
+        return -1;              /* Terminate */
+    }
+
+    if (vt) {
+        dmxLog(dmxInfo, "Request to switch to VT %d\n", vt);
+        dmxInput->vt_switch_pending = vt;
+        return vt;
+    }
+
+    return 0;                   /* Do nothing */
+}
diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c
index e3bc4c523..f21475fb6 100644
--- a/xorg-server/hw/kdrive/src/kinput.c
+++ b/xorg-server/hw/kdrive/src/kinput.c
@@ -1804,7 +1804,7 @@ KdReleaseAllKeys (void)
             if (key_is_down(ki->dixdev, key, KEY_POSTED | KEY_PROCESSED)) {
                 KdHandleKeyboardEvent(ki, KeyRelease, key);
                 GetEventList(&kdEvents);
-                nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
+                nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key, NULL);
                 for (i = 0; i < nEvents; i++)
                     KdQueueEvent (ki->dixdev, (kdEvents + i)->event);
             }
@@ -1864,7 +1864,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo   *ki,
 
         GetEventList(&kdEvents);
 
-        nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
+        nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code, NULL);
         for (i = 0; i < nEvents; i++)
             KdQueueEvent(ki->dixdev, (InternalEvent *)((kdEvents + i)->event));
     }
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
index bccdd403c..975266943 100644
--- a/xorg-server/hw/xfree86/common/xf86Configure.c
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -1,762 +1,755 @@
-/*
- * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Alan Hourihane makes no representations
- * about the suitability of this software for any purpose.  It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:  Alan Hourihane, alanh@fairlite.demon.co.uk
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Config.h"
-#include "xf86_OSlib.h"
-#include "xf86Priv.h"
-#define IN_XSERVER
-#include "Configint.h"
-#include "xf86DDC.h"
-#include "xf86pciBus.h"
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-#include "xf86Bus.h"
-#include "xf86Sbus.h"
-#endif
-#include "misc.h"
-
-typedef struct _DevToConfig {
-    GDevRec GDev;
-    struct pci_device * pVideo;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-    sbusDevicePtr sVideo;
-#endif
-    int iDriver;
-} DevToConfigRec, *DevToConfigPtr;
-
-static DevToConfigPtr DevToConfig = NULL;
-static int nDevToConfig = 0, CurrentDriver;
-
-xf86MonPtr ConfiguredMonitor;
-Bool xf86DoConfigurePass1 = TRUE;
-static Bool foundMouse = FALSE;
-
-#if   defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
-static char *DFLT_MOUSE_PROTO = "auto";
-#elif defined(linux)
-static char DFLT_MOUSE_DEV[] = "/dev/input/mice";
-static char DFLT_MOUSE_PROTO[] = "auto";
-#else
-static char *DFLT_MOUSE_DEV = "/dev/mouse";
-static char *DFLT_MOUSE_PROTO = "auto";
-#endif
-
-/*
- * This is called by the driver, either through xf86Match???Instances() or
- * directly.  We allocate a GDevRec and fill it in as much as we can, letting
- * the caller fill in the rest and/or change it as it sees fit.
- */
-GDevPtr
-xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
-{
-    int ret, i, j;
-
-    if (!xf86DoConfigure || !xf86DoConfigurePass1)
-	return NULL;
-
-    /* Check for duplicates */
-    for (i = 0;  i < nDevToConfig;  i++) {
-        switch (bus) {
-            case BUS_PCI:
-                ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
-                break;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-            case BUS_SBUS:
-                ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
-                break;
-#endif
-            default:
-                return NULL;
-        }
-        if (ret == 0)
-            goto out;
-    }
-
-    /* Allocate new structure occurrence */
-    i = nDevToConfig++;
-    DevToConfig =
-	xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
-    memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
-
-    DevToConfig[i].GDev.chipID =
-            DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1;
-
-    DevToConfig[i].iDriver = CurrentDriver;
-
-    /* Fill in what we know, converting the driver name to lower case */
-    DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1);
-    for (j = 0;  (DevToConfig[i].GDev.driver[j] = tolower(driver[j]));  j++);
-
-    switch (bus) {
-        case BUS_PCI:
-            xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
-                                   &DevToConfig[i].GDev, &chipset);
-	        break;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-        case BUS_SBUS:
-            xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
-                                    &DevToConfig[i].GDev);
-	        break;
-#endif
-        default:
-	        break;
-    }
-
-    /* Get driver's available options */
-    if (xf86DriverList[CurrentDriver]->AvailableOptions)
-	DevToConfig[i].GDev.options = (OptionInfoPtr)
-	    (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset,
-							       bus);
-
-    return &DevToConfig[i].GDev;
-
-out:
-    return NULL;
-}
-
-static XF86ConfInputPtr
-configureInputSection (void)
-{
-    XF86ConfInputPtr mouse = NULL;
-    parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
-    ptr->inp_identifier = "Keyboard0";
-    ptr->inp_driver = "kbd";
-    ptr->list.next = NULL;
-
-    /* Crude mechanism to auto-detect mouse (os dependent) */
-    { 
-	int fd;
-#ifdef WSCONS_SUPPORT
-	fd = open("/dev/wsmouse", 0);
-	if (fd >= 0) {
-	    DFLT_MOUSE_DEV = "/dev/wsmouse";
-	    DFLT_MOUSE_PROTO = "wsmouse";
-	    close(fd);
-	} else {
-	    ErrorF("cannot open /dev/wsmouse\n");
-	}
-#endif
-
-	fd = open(DFLT_MOUSE_DEV, 0);
-	if (fd != -1) {
-	    foundMouse = TRUE;
-	    close(fd);
-	}
-    }
-
-    mouse = calloc(1, sizeof(XF86ConfInputRec));
-    mouse->inp_identifier = "Mouse0";
-    mouse->inp_driver = "mouse";
-    mouse->inp_option_lst = 
-		xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
-				strdup(DFLT_MOUSE_PROTO));
-    mouse->inp_option_lst = 
-		xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
-				strdup(DFLT_MOUSE_DEV));
-    mouse->inp_option_lst = 
-		xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
-				strdup("4 5 6 7"));
-    ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
-    return ptr;
-}
-
-static XF86ConfScreenPtr
-configureScreenSection (int screennum)
-{
-    int i;
-    int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
-    parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
-
-    XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
-    XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
-    XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
-
-    for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
-    {
-	XF86ConfDisplayPtr display;
-
-	display = calloc(1, sizeof(XF86ConfDisplayRec));
-	display->disp_depth = depths[i];
-	display->disp_black.red = display->disp_white.red = -1;
-	display->disp_black.green = display->disp_white.green = -1;
-	display->disp_black.blue = display->disp_white.blue = -1;
-	ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem(
-				     (glp)ptr->scrn_display_lst, (glp)display);
-    }
-
-    return ptr;
-}
-
-static const char* 
-optionTypeToString(OptionValueType type)
-{
-    switch (type) {
-    case OPTV_NONE:
-        return "";
-    case OPTV_INTEGER:
-        return "<i>";
-    case OPTV_STRING:
-        return "<str>";
-    case OPTV_ANYSTR:
-       return "[<str>]";
-    case OPTV_REAL:
-        return "<f>";
-    case OPTV_BOOLEAN:
-        return "[<bool>]";
-    case OPTV_FREQ:
-        return "<freq>";
-    case OPTV_PERCENT:
-        return "<percent>";
-    default:
-        return "";
-    }
-}
-
-static XF86ConfDevicePtr
-configureDeviceSection (int screennum)
-{
-    OptionInfoPtr p;
-    int i = 0;
-    parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
-
-    /* Move device info to parser structure */
-    if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
-        ptr->dev_identifier = NULL;
-    ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
-    ptr->dev_busid = DevToConfig[screennum].GDev.busID;
-    ptr->dev_driver = DevToConfig[screennum].GDev.driver;
-    ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac;
-    for (i = 0;  (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS);  i++)
-        ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
-    ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
-    ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq;
-    ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase;
-    ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase;
-    ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase;
-    ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip;
-    for (i = 0;  (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks);  i++)
-        ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i];
-    ptr->dev_clocks = i;
-    ptr->dev_chipid = DevToConfig[screennum].GDev.chipID;
-    ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev;
-    ptr->dev_irq = DevToConfig[screennum].GDev.irq;
-
-    /* Make sure older drivers don't segv */
-    if (DevToConfig[screennum].GDev.options) {
-    	/* Fill in the available driver options for people to use */
-	const char *descrip =
-	    "        ### Available Driver options are:-\n"
-	    "        ### Values: <i>: integer, <f>: float, "
-			"<bool>: \"True\"/\"False\",\n"
-	    "        ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
-	    "        ### <percent>: \"<f>%\"\n"
-	    "        ### [arg]: arg optional\n";
-	ptr->dev_comment = strdup(descrip);
-	if (ptr->dev_comment) {
-    	    for (p = DevToConfig[screennum].GDev.options;
-		 p->name != NULL; p++) {
-		char *p_e;
-		const char *prefix = "        #Option     ";
-		const char *middle = " \t# ";
-		const char *suffix = "\n";
-		const char *opttype = optionTypeToString(p->type);
-		char *optname;
-		int len = strlen(ptr->dev_comment) + strlen(prefix) +
-			  strlen(middle) + strlen(suffix) + 1;
-		
-		if (asprintf(&optname, "\"%s\"", p->name) == -1)
-		    break;
-
-		len += max(20, strlen(optname));
-		len += strlen(opttype);
-
-		ptr->dev_comment = realloc(ptr->dev_comment, len);
-		if (!ptr->dev_comment)
-		    break;
-		p_e = ptr->dev_comment + strlen(ptr->dev_comment);
-		sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
-			opttype, suffix);
-		free(optname);
-	    }
-    	}
-    }
-
-    return ptr;
-}
-
-static XF86ConfLayoutPtr
-configureLayoutSection (void)
-{
-    int scrnum = 0;
-    parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
-
-    ptr->lay_identifier = "X.org Configured";
-
-    {
-	XF86ConfInputrefPtr iptr;
-
-	iptr = malloc (sizeof (XF86ConfInputrefRec));
-	iptr->list.next = NULL;
-	iptr->iref_option_lst = NULL;
-	iptr->iref_inputdev_str = "Mouse0";
-	iptr->iref_option_lst =
-		xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL);
-	ptr->lay_input_lst = (XF86ConfInputrefPtr)
-		xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
-    }
-
-    {
-	XF86ConfInputrefPtr iptr;
-
-	iptr = malloc (sizeof (XF86ConfInputrefRec));
-	iptr->list.next = NULL;
-	iptr->iref_option_lst = NULL;
-	iptr->iref_inputdev_str = "Keyboard0";
-	iptr->iref_option_lst =
-		xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL);
-	ptr->lay_input_lst = (XF86ConfInputrefPtr)
-		xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
-    }
-
-    for (scrnum = 0;  scrnum < nDevToConfig;  scrnum++) {
-	XF86ConfAdjacencyPtr aptr;
-
-	aptr = malloc (sizeof (XF86ConfAdjacencyRec));
-	aptr->list.next = NULL;
-	aptr->adj_x = 0;
-	aptr->adj_y = 0;
-	aptr->adj_scrnum = scrnum;
-	XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
-	if (scrnum == 0) {
-	    aptr->adj_where = CONF_ADJ_ABSOLUTE;
-	    aptr->adj_refscreen = NULL;
-	}
-	else {
-	    aptr->adj_where = CONF_ADJ_RIGHTOF;
-	    XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
-	}
-    	ptr->lay_adjacency_lst =
-	    (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
-					      (glp)aptr);
-    }
-
-    return ptr;
-}
-
-static XF86ConfFlagsPtr
-configureFlagsSection (void)
-{
-    parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
-
-    return ptr;
-}
-
-static XF86ConfModulePtr
-configureModuleSection (void)
-{
-    char **elist, **el;
-    /* Find the list of extension & font modules. */
-    const char *esubdirs[] = {
-	"extensions",
-	"fonts",
-	NULL
-    };
-    parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
-
-    elist = LoaderListDirs(esubdirs, NULL);
-    if (elist) {
-	for (el = elist; *el; el++) {
-	    XF86LoadPtr module;
-
-    	    module = calloc(1, sizeof(XF86LoadRec));
-    	    module->load_name = *el;
-            ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
-                                (glp)ptr->mod_load_lst, (glp)module);
-    	}
-	free(elist);
-    }
-
-    return ptr;
-}
-
-static XF86ConfFilesPtr
-configureFilesSection (void)
-{
-    parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
-
-   if (xf86ModulePath)
-       ptr->file_modulepath = strdup(xf86ModulePath);
-   if (defaultFontPath)
-       ptr->file_fontpath = strdup(defaultFontPath);
-   
-    return ptr;
-}
-
-static XF86ConfMonitorPtr
-configureMonitorSection (int screennum)
-{
-    parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
-
-    XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
-    ptr->mon_vendor = strdup("Monitor Vendor");
-    ptr->mon_modelname = strdup("Monitor Model");
-
-    return ptr;
-}
-
-/* Initialize Configure Monitor from Detailed Timing Block */
-static void handle_detailed_input(struct detailed_monitor_section *det_mon,
-                                  void *data)
-{
-    XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data;
-
-    switch (det_mon->type) {
-    case DS_NAME:
-        ptr->mon_modelname = realloc(ptr->mon_modelname,
-                                     strlen((char*)(det_mon->section.name)) +
-                                     1);
-        strcpy(ptr->mon_modelname,
-	      (char*)(det_mon->section.name));
-        break;
-    case DS_RANGES:
-        ptr->mon_hsync[ptr->mon_n_hsync].lo =
-            det_mon->section.ranges.min_h;
-        ptr->mon_hsync[ptr->mon_n_hsync].hi =
-            det_mon->section.ranges.max_h;
-        ptr->mon_n_vrefresh = 1;
-        ptr->mon_vrefresh[ptr->mon_n_hsync].lo =
-            det_mon->section.ranges.min_v;
-        ptr->mon_vrefresh[ptr->mon_n_hsync].hi =
-            det_mon->section.ranges.max_v;
-        ptr->mon_n_hsync++;
-    default:
-        break;
-    }
-}
-
-static XF86ConfMonitorPtr
-configureDDCMonitorSection (int screennum)
-{
-    int len, mon_width, mon_height;
-#define displaySizeMaxLen 80
-    char displaySize_string[displaySizeMaxLen];
-    int displaySizeLen;
-
-    parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
-
-    XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
-    ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
-    XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
-
-    /* features in centimetres, we want millimetres */
-    mon_width  = 10 * ConfiguredMonitor->features.hsize ;
-    mon_height = 10 * ConfiguredMonitor->features.vsize ;
-
-#ifdef CONFIGURE_DISPLAYSIZE
-    ptr->mon_width  = mon_width;
-    ptr->mon_height = mon_height;
-#else
-    if (mon_width && mon_height) {
-      /* when values available add DisplaySize option AS A COMMENT */
-
-      displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen,
-				"\t#DisplaySize\t%5d %5d\t# mm\n",
-				mon_width, mon_height);
-
-      if (displaySizeLen>0 && displaySizeLen<displaySizeMaxLen) {
-	if (ptr->mon_comment) {
-	  len = strlen(ptr->mon_comment);
-	} else {
-	  len = 0;
-	}
-	if ((ptr->mon_comment =
-	     realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) {
-	  strcpy(ptr->mon_comment + len, displaySize_string);
-	}
-      }
-    }
-#endif /* def CONFIGURE_DISPLAYSIZE */
-
-    xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input,
-                             ptr);
-
-    if (ConfiguredMonitor->features.dpms) {
-      ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
-    }
-
-    return ptr;
-}
-
-void
-DoConfigure(void)
-{
-    int i,j, screennum = -1;
-    char *home = NULL;
-    char filename[PATH_MAX];
-    char *addslash = "";
-    XF86ConfigPtr xf86config = NULL;
-    char **vlist, **vl;
-    int *dev2screen;
-
-    vlist = xf86DriverlistFromCompile();
-
-    if (!vlist) {
-	ErrorF("Missing output drivers.  Configuration failed.\n");
-	goto bail;
-    }
-
-    ErrorF("List of video drivers:\n");
-    for (vl = vlist; *vl; vl++)
-	ErrorF("\t%s\n", *vl);
-
-    /* Load all the drivers that were found. */
-    xf86LoadModules(vlist, NULL);
-
-    free(vlist);
-
-    for (i = 0; i < xf86NumDrivers; i++) {
-	xorgHWFlags flags;
-	if (!xf86DriverList[i]->driverFunc
-	    || !xf86DriverList[i]->driverFunc(NULL,
-					      GET_REQUIRED_HW_INTERFACES,
-					      &flags)
-	    || NEED_IO_ENABLED(flags)) {
-	    xorgHWAccess = TRUE;
-	    break;
-	}
-    }
-    /* Enable full I/O access */
-    if (xorgHWAccess) {
-	if(!xf86EnableIO())
-	    /* oops, we have failed */
-	    xorgHWAccess = FALSE;
-    }
-
-    /* Create XF86Config file structure */
-    xf86config = calloc(1, sizeof(XF86ConfigRec));
-
-    /* Call all of the probe functions, reporting the results. */
-    for (CurrentDriver = 0;  CurrentDriver < xf86NumDrivers;  CurrentDriver++) {
-	xorgHWFlags flags;
-	Bool found_screen;
-	DriverRec * const drv = xf86DriverList[CurrentDriver];
-
-	if (!xorgHWAccess) {
-	    if (!drv->driverFunc
-		|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
-		|| NEED_IO_ENABLED(flags)) 
-		continue;
-	}
-	
-	found_screen = xf86CallDriverProbe( drv, TRUE );
-	if ( found_screen && drv->Identify ) {
-	    (*drv->Identify)(0);
-	}
-    }
-
-    if (nDevToConfig <= 0) {
-	ErrorF("No devices to configure.  Configuration failed.\n");
-	goto bail;
-    }
-
-    /* Add device, monitor and screen sections for detected devices */
-    for (screennum = 0;  screennum < nDevToConfig;  screennum++) {
-    	XF86ConfDevicePtr DevicePtr;
-	XF86ConfMonitorPtr MonitorPtr;
-	XF86ConfScreenPtr ScreenPtr;
-
-	DevicePtr = configureDeviceSection(screennum);
-    	xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem(
-			    (glp)xf86config->conf_device_lst, (glp)DevicePtr);
-	MonitorPtr = configureMonitorSection(screennum);
-    	xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
-			    (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
-	ScreenPtr = configureScreenSection(screennum);
-    	xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
-			    (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
-    }
-
-    xf86config->conf_files = configureFilesSection();
-    xf86config->conf_modules = configureModuleSection();
-    xf86config->conf_flags = configureFlagsSection();
-    xf86config->conf_videoadaptor_lst = NULL;
-    xf86config->conf_modes_lst = NULL;
-    xf86config->conf_vendor_lst = NULL;
-    xf86config->conf_dri = NULL;
-    xf86config->conf_input_lst = configureInputSection();
-    xf86config->conf_layout_lst = configureLayoutSection();
-
-    home = getenv("HOME");
-    if ((home == NULL) || (home[0] == '\0')) {
-    	home = "/";
-    } else {
-	/* Determine if trailing slash is present or needed */
-	int l = strlen(home);
-
-	if (home[l-1] != '/') {
-	    addslash = "/";
-	}
-    }
-
-    snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
-	     home, addslash);
-
-    if (xf86writeConfigFile(filename, xf86config) == 0) {
-	xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
-		filename, strerror(errno));
-	goto bail;
-    }
-
-    xf86DoConfigurePass1 = FALSE;
-    /* Try to get DDC information filled in */
-    xf86ConfigFile = filename;
-    if (xf86HandleConfigFile(FALSE) != CONFIG_OK) {
-	goto bail;
-    }
-
-    xf86DoConfigurePass1 = FALSE;
-    
-    dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int));
-
-    {
-	Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool));
-	for (screennum = 0;  screennum < nDevToConfig;  screennum++) {
-	    int k,l,n,oldNumScreens;
-
-	    i = DevToConfig[screennum].iDriver;
-
-	    if (driverProbed[i]) continue;
-	    driverProbed[i] = TRUE;
-	    
-	    oldNumScreens = xf86NumScreens;
-
-	    xf86CallDriverProbe( xf86DriverList[i], FALSE );
-
-	    /* reorder */
-	    k = screennum > 0 ? screennum : 1;
-	    for (l = oldNumScreens; l < xf86NumScreens; l++) {
-	        /* is screen primary? */
-	        Bool primary = FALSE;
-		for (n = 0; n<xf86Screens[l]->numEntities; n++) {
-	            if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) {
-		        dev2screen[0] = l;
-			primary = TRUE;
-			break;
-		    }
-		}
-		if (primary) continue;
-		/* not primary: assign it to next device of same driver */
-		/* 
-		 * NOTE: we assume that devices in DevToConfig 
-		 * and xf86Screens[] have the same order except
-		 * for the primary device which always comes first.
-		 */
-		for (; k < nDevToConfig; k++) {
-		    if (DevToConfig[k].iDriver == i) {
-		        dev2screen[k++] = l;
-			break;
-		    }
-		}
-	    }
-	}
-	free(driverProbed);
-    }
-    
-
-    if (nDevToConfig != xf86NumScreens) {
-	ErrorF("Number of created screens does not match number of detected"
-	       " devices.\n  Configuration failed.\n");
-	goto bail;
-    }
-
-    xf86PostProbe();
-
-    for (j = 0; j < xf86NumScreens; j++) {
-	xf86Screens[j]->scrnIndex = j;
-    }
-
-    xf86freeMonitorList(xf86config->conf_monitor_lst);
-    xf86config->conf_monitor_lst = NULL;
-    xf86freeScreenList(xf86config->conf_screen_lst);
-    xf86config->conf_screen_lst = NULL;
-    for (j = 0; j < xf86NumScreens; j++) {
-	XF86ConfMonitorPtr MonitorPtr;
-	XF86ConfScreenPtr ScreenPtr;
-
-	ConfiguredMonitor = NULL;
-
-	if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], 
-						   PROBE_DETECT) &&
-	    ConfiguredMonitor) {
-	    MonitorPtr = configureDDCMonitorSection(j);
-	} else {
-	    MonitorPtr = configureMonitorSection(j);
-	}
-	ScreenPtr = configureScreenSection(j);
-	xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
-		(glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
-	xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
-		(glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
-    }
-
-    if (xf86writeConfigFile(filename, xf86config) == 0) {
-	xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
-		filename, strerror(errno));
-	goto bail;
-    }
-
-    ErrorF("\n");
-
-    if (!foundMouse) {
-	ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n"
-		"Edit the file and correct the Device.\n");
-    } else {
-	ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n"
-		"Please check your config if the mouse is still not\n"
-		"operational, as by default "__XSERVERNAME__
-	       " tries to autodetect\n"
-		"the protocol.\n",DFLT_MOUSE_DEV);
-    }
-
-    if (xf86NumScreens > 1) {
-	ErrorF("\n"__XSERVERNAME__
-	       " has configured a multihead system, please check your config.\n");
-    }
-
-    ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename);
-    ErrorF("To test the server, run 'X -config %s'\n\n", filename);
-
-bail:
-    OsCleanup(TRUE);
-    AbortDDX();
-    fflush(stderr);
-    exit(0);
-}
+/*
+ * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose.  It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author:  Alan Hourihane, alanh@fairlite.demon.co.uk
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Config.h"
+#include "xf86_OSlib.h"
+#include "xf86Priv.h"
+#define IN_XSERVER
+#include "Configint.h"
+#include "xf86DDC.h"
+#include "xf86pciBus.h"
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+#include "xf86Bus.h"
+#include "xf86Sbus.h"
+#endif
+#include "misc.h"
+
+typedef struct _DevToConfig {
+    GDevRec GDev;
+    struct pci_device * pVideo;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+    sbusDevicePtr sVideo;
+#endif
+    int iDriver;
+} DevToConfigRec, *DevToConfigPtr;
+
+static DevToConfigPtr DevToConfig = NULL;
+static int nDevToConfig = 0, CurrentDriver;
+
+xf86MonPtr ConfiguredMonitor;
+Bool xf86DoConfigurePass1 = TRUE;
+static Bool foundMouse = FALSE;
+
+#if   defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
+static char *DFLT_MOUSE_PROTO = "auto";
+#elif defined(linux)
+static char DFLT_MOUSE_DEV[] = "/dev/input/mice";
+static char DFLT_MOUSE_PROTO[] = "auto";
+#elif defined(WSCONS_SUPPORT)
+static char *DFLT_MOUSE_DEV = "/dev/wsmouse";
+static char *DFLT_MOUSE_PROTO = "wsmouse";
+#else
+static char *DFLT_MOUSE_DEV = "/dev/mouse";
+static char *DFLT_MOUSE_PROTO = "auto";
+#endif
+
+/*
+ * This is called by the driver, either through xf86Match???Instances() or
+ * directly.  We allocate a GDevRec and fill it in as much as we can, letting
+ * the caller fill in the rest and/or change it as it sees fit.
+ */
+GDevPtr
+xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
+{
+    int ret, i, j;
+
+    if (!xf86DoConfigure || !xf86DoConfigurePass1)
+	return NULL;
+
+    /* Check for duplicates */
+    for (i = 0;  i < nDevToConfig;  i++) {
+        switch (bus) {
+            case BUS_PCI:
+                ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
+                break;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+            case BUS_SBUS:
+                ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
+                break;
+#endif
+            default:
+                return NULL;
+        }
+        if (ret == 0)
+            goto out;
+    }
+
+    /* Allocate new structure occurrence */
+    i = nDevToConfig++;
+    DevToConfig =
+	xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
+    memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
+
+    DevToConfig[i].GDev.chipID =
+            DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1;
+
+    DevToConfig[i].iDriver = CurrentDriver;
+
+    /* Fill in what we know, converting the driver name to lower case */
+    DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1);
+    for (j = 0;  (DevToConfig[i].GDev.driver[j] = tolower(driver[j]));  j++);
+
+    switch (bus) {
+        case BUS_PCI:
+            xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
+                                   &DevToConfig[i].GDev, &chipset);
+	        break;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+        case BUS_SBUS:
+            xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
+                                    &DevToConfig[i].GDev);
+	        break;
+#endif
+        default:
+	        break;
+    }
+
+    /* Get driver's available options */
+    if (xf86DriverList[CurrentDriver]->AvailableOptions)
+	DevToConfig[i].GDev.options = (OptionInfoPtr)
+	    (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset,
+							       bus);
+
+    return &DevToConfig[i].GDev;
+
+out:
+    return NULL;
+}
+
+static XF86ConfInputPtr
+configureInputSection (void)
+{
+    XF86ConfInputPtr mouse = NULL;
+    parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+
+    ptr->inp_identifier = "Keyboard0";
+    ptr->inp_driver = "kbd";
+    ptr->list.next = NULL;
+
+    /* Crude mechanism to auto-detect mouse (os dependent) */
+    { 
+	int fd;
+
+	fd = open(DFLT_MOUSE_DEV, 0);
+	if (fd != -1) {
+	    foundMouse = TRUE;
+	    close(fd);
+	}
+    }
+
+    mouse = calloc(1, sizeof(XF86ConfInputRec));
+    mouse->inp_identifier = "Mouse0";
+    mouse->inp_driver = "mouse";
+    mouse->inp_option_lst = 
+		xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
+				strdup(DFLT_MOUSE_PROTO));
+    mouse->inp_option_lst = 
+		xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
+				strdup(DFLT_MOUSE_DEV));
+    mouse->inp_option_lst = 
+		xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
+				strdup("4 5 6 7"));
+    ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
+    return ptr;
+}
+
+static XF86ConfScreenPtr
+configureScreenSection (int screennum)
+{
+    int i;
+    int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
+    parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
+
+    XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
+    XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
+    XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
+
+    for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
+    {
+	XF86ConfDisplayPtr display;
+
+	display = calloc(1, sizeof(XF86ConfDisplayRec));
+	display->disp_depth = depths[i];
+	display->disp_black.red = display->disp_white.red = -1;
+	display->disp_black.green = display->disp_white.green = -1;
+	display->disp_black.blue = display->disp_white.blue = -1;
+	ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem(
+				     (glp)ptr->scrn_display_lst, (glp)display);
+    }
+
+    return ptr;
+}
+
+static const char* 
+optionTypeToString(OptionValueType type)
+{
+    switch (type) {
+    case OPTV_NONE:
+        return "";
+    case OPTV_INTEGER:
+        return "<i>";
+    case OPTV_STRING:
+        return "<str>";
+    case OPTV_ANYSTR:
+       return "[<str>]";
+    case OPTV_REAL:
+        return "<f>";
+    case OPTV_BOOLEAN:
+        return "[<bool>]";
+    case OPTV_FREQ:
+        return "<freq>";
+    case OPTV_PERCENT:
+        return "<percent>";
+    default:
+        return "";
+    }
+}
+
+static XF86ConfDevicePtr
+configureDeviceSection (int screennum)
+{
+    OptionInfoPtr p;
+    int i = 0;
+    parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
+
+    /* Move device info to parser structure */
+    if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
+        ptr->dev_identifier = NULL;
+    ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
+    ptr->dev_busid = DevToConfig[screennum].GDev.busID;
+    ptr->dev_driver = DevToConfig[screennum].GDev.driver;
+    ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac;
+    for (i = 0;  (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS);  i++)
+        ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
+    ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
+    ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq;
+    ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase;
+    ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase;
+    ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase;
+    ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip;
+    for (i = 0;  (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks);  i++)
+        ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i];
+    ptr->dev_clocks = i;
+    ptr->dev_chipid = DevToConfig[screennum].GDev.chipID;
+    ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev;
+    ptr->dev_irq = DevToConfig[screennum].GDev.irq;
+
+    /* Make sure older drivers don't segv */
+    if (DevToConfig[screennum].GDev.options) {
+    	/* Fill in the available driver options for people to use */
+	const char *descrip =
+	    "        ### Available Driver options are:-\n"
+	    "        ### Values: <i>: integer, <f>: float, "
+			"<bool>: \"True\"/\"False\",\n"
+	    "        ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
+	    "        ### <percent>: \"<f>%\"\n"
+	    "        ### [arg]: arg optional\n";
+	ptr->dev_comment = strdup(descrip);
+	if (ptr->dev_comment) {
+    	    for (p = DevToConfig[screennum].GDev.options;
+		 p->name != NULL; p++) {
+		char *p_e;
+		const char *prefix = "        #Option     ";
+		const char *middle = " \t# ";
+		const char *suffix = "\n";
+		const char *opttype = optionTypeToString(p->type);
+		char *optname;
+		int len = strlen(ptr->dev_comment) + strlen(prefix) +
+			  strlen(middle) + strlen(suffix) + 1;
+		
+		if (asprintf(&optname, "\"%s\"", p->name) == -1)
+		    break;
+
+		len += max(20, strlen(optname));
+		len += strlen(opttype);
+
+		ptr->dev_comment = realloc(ptr->dev_comment, len);
+		if (!ptr->dev_comment)
+		    break;
+		p_e = ptr->dev_comment + strlen(ptr->dev_comment);
+		sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
+			opttype, suffix);
+		free(optname);
+	    }
+    	}
+    }
+
+    return ptr;
+}
+
+static XF86ConfLayoutPtr
+configureLayoutSection (void)
+{
+    int scrnum = 0;
+    parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
+
+    ptr->lay_identifier = "X.org Configured";
+
+    {
+	XF86ConfInputrefPtr iptr;
+
+	iptr = malloc (sizeof (XF86ConfInputrefRec));
+	iptr->list.next = NULL;
+	iptr->iref_option_lst = NULL;
+	iptr->iref_inputdev_str = "Mouse0";
+	iptr->iref_option_lst =
+		xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL);
+	ptr->lay_input_lst = (XF86ConfInputrefPtr)
+		xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
+    }
+
+    {
+	XF86ConfInputrefPtr iptr;
+
+	iptr = malloc (sizeof (XF86ConfInputrefRec));
+	iptr->list.next = NULL;
+	iptr->iref_option_lst = NULL;
+	iptr->iref_inputdev_str = "Keyboard0";
+	iptr->iref_option_lst =
+		xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL);
+	ptr->lay_input_lst = (XF86ConfInputrefPtr)
+		xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
+    }
+
+    for (scrnum = 0;  scrnum < nDevToConfig;  scrnum++) {
+	XF86ConfAdjacencyPtr aptr;
+
+	aptr = malloc (sizeof (XF86ConfAdjacencyRec));
+	aptr->list.next = NULL;
+	aptr->adj_x = 0;
+	aptr->adj_y = 0;
+	aptr->adj_scrnum = scrnum;
+	XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
+	if (scrnum == 0) {
+	    aptr->adj_where = CONF_ADJ_ABSOLUTE;
+	    aptr->adj_refscreen = NULL;
+	}
+	else {
+	    aptr->adj_where = CONF_ADJ_RIGHTOF;
+	    XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
+	}
+    	ptr->lay_adjacency_lst =
+	    (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
+					      (glp)aptr);
+    }
+
+    return ptr;
+}
+
+static XF86ConfFlagsPtr
+configureFlagsSection (void)
+{
+    parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
+
+    return ptr;
+}
+
+static XF86ConfModulePtr
+configureModuleSection (void)
+{
+    char **elist, **el;
+    /* Find the list of extension & font modules. */
+    const char *esubdirs[] = {
+	"extensions",
+	"fonts",
+	NULL
+    };
+    parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
+
+    elist = LoaderListDirs(esubdirs, NULL);
+    if (elist) {
+	for (el = elist; *el; el++) {
+	    XF86LoadPtr module;
+
+    	    module = calloc(1, sizeof(XF86LoadRec));
+    	    module->load_name = *el;
+            ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
+                                (glp)ptr->mod_load_lst, (glp)module);
+    	}
+	free(elist);
+    }
+
+    return ptr;
+}
+
+static XF86ConfFilesPtr
+configureFilesSection (void)
+{
+    parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
+
+   if (xf86ModulePath)
+       ptr->file_modulepath = strdup(xf86ModulePath);
+   if (defaultFontPath)
+       ptr->file_fontpath = strdup(defaultFontPath);
+   
+    return ptr;
+}
+
+static XF86ConfMonitorPtr
+configureMonitorSection (int screennum)
+{
+    parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
+
+    XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
+    ptr->mon_vendor = strdup("Monitor Vendor");
+    ptr->mon_modelname = strdup("Monitor Model");
+
+    return ptr;
+}
+
+/* Initialize Configure Monitor from Detailed Timing Block */
+static void handle_detailed_input(struct detailed_monitor_section *det_mon,
+                                  void *data)
+{
+    XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data;
+
+    switch (det_mon->type) {
+    case DS_NAME:
+        ptr->mon_modelname = realloc(ptr->mon_modelname,
+                                     strlen((char*)(det_mon->section.name)) +
+                                     1);
+        strcpy(ptr->mon_modelname,
+	      (char*)(det_mon->section.name));
+        break;
+    case DS_RANGES:
+        ptr->mon_hsync[ptr->mon_n_hsync].lo =
+            det_mon->section.ranges.min_h;
+        ptr->mon_hsync[ptr->mon_n_hsync].hi =
+            det_mon->section.ranges.max_h;
+        ptr->mon_n_vrefresh = 1;
+        ptr->mon_vrefresh[ptr->mon_n_hsync].lo =
+            det_mon->section.ranges.min_v;
+        ptr->mon_vrefresh[ptr->mon_n_hsync].hi =
+            det_mon->section.ranges.max_v;
+        ptr->mon_n_hsync++;
+    default:
+        break;
+    }
+}
+
+static XF86ConfMonitorPtr
+configureDDCMonitorSection (int screennum)
+{
+    int len, mon_width, mon_height;
+#define displaySizeMaxLen 80
+    char displaySize_string[displaySizeMaxLen];
+    int displaySizeLen;
+
+    parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
+
+    XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
+    ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
+    XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
+
+    /* features in centimetres, we want millimetres */
+    mon_width  = 10 * ConfiguredMonitor->features.hsize ;
+    mon_height = 10 * ConfiguredMonitor->features.vsize ;
+
+#ifdef CONFIGURE_DISPLAYSIZE
+    ptr->mon_width  = mon_width;
+    ptr->mon_height = mon_height;
+#else
+    if (mon_width && mon_height) {
+      /* when values available add DisplaySize option AS A COMMENT */
+
+      displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen,
+				"\t#DisplaySize\t%5d %5d\t# mm\n",
+				mon_width, mon_height);
+
+      if (displaySizeLen>0 && displaySizeLen<displaySizeMaxLen) {
+	if (ptr->mon_comment) {
+	  len = strlen(ptr->mon_comment);
+	} else {
+	  len = 0;
+	}
+	if ((ptr->mon_comment =
+	     realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) {
+	  strcpy(ptr->mon_comment + len, displaySize_string);
+	}
+      }
+    }
+#endif /* def CONFIGURE_DISPLAYSIZE */
+
+    xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input,
+                             ptr);
+
+    if (ConfiguredMonitor->features.dpms) {
+      ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
+    }
+
+    return ptr;
+}
+
+void
+DoConfigure(void)
+{
+    int i,j, screennum = -1;
+    char *home = NULL;
+    char filename[PATH_MAX];
+    char *addslash = "";
+    XF86ConfigPtr xf86config = NULL;
+    char **vlist, **vl;
+    int *dev2screen;
+
+    vlist = xf86DriverlistFromCompile();
+
+    if (!vlist) {
+	ErrorF("Missing output drivers.  Configuration failed.\n");
+	goto bail;
+    }
+
+    ErrorF("List of video drivers:\n");
+    for (vl = vlist; *vl; vl++)
+	ErrorF("\t%s\n", *vl);
+
+    /* Load all the drivers that were found. */
+    xf86LoadModules(vlist, NULL);
+
+    free(vlist);
+
+    for (i = 0; i < xf86NumDrivers; i++) {
+	xorgHWFlags flags;
+	if (!xf86DriverList[i]->driverFunc
+	    || !xf86DriverList[i]->driverFunc(NULL,
+					      GET_REQUIRED_HW_INTERFACES,
+					      &flags)
+	    || NEED_IO_ENABLED(flags)) {
+	    xorgHWAccess = TRUE;
+	    break;
+	}
+    }
+    /* Enable full I/O access */
+    if (xorgHWAccess) {
+	if(!xf86EnableIO())
+	    /* oops, we have failed */
+	    xorgHWAccess = FALSE;
+    }
+
+    /* Create XF86Config file structure */
+    xf86config = calloc(1, sizeof(XF86ConfigRec));
+
+    /* Call all of the probe functions, reporting the results. */
+    for (CurrentDriver = 0;  CurrentDriver < xf86NumDrivers;  CurrentDriver++) {
+	xorgHWFlags flags;
+	Bool found_screen;
+	DriverRec * const drv = xf86DriverList[CurrentDriver];
+
+	if (!xorgHWAccess) {
+	    if (!drv->driverFunc
+		|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
+		|| NEED_IO_ENABLED(flags)) 
+		continue;
+	}
+	
+	found_screen = xf86CallDriverProbe( drv, TRUE );
+	if ( found_screen && drv->Identify ) {
+	    (*drv->Identify)(0);
+	}
+    }
+
+    if (nDevToConfig <= 0) {
+	ErrorF("No devices to configure.  Configuration failed.\n");
+	goto bail;
+    }
+
+    /* Add device, monitor and screen sections for detected devices */
+    for (screennum = 0;  screennum < nDevToConfig;  screennum++) {
+    	XF86ConfDevicePtr DevicePtr;
+	XF86ConfMonitorPtr MonitorPtr;
+	XF86ConfScreenPtr ScreenPtr;
+
+	DevicePtr = configureDeviceSection(screennum);
+    	xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem(
+			    (glp)xf86config->conf_device_lst, (glp)DevicePtr);
+	MonitorPtr = configureMonitorSection(screennum);
+    	xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
+			    (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
+	ScreenPtr = configureScreenSection(screennum);
+    	xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
+			    (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
+    }
+
+    xf86config->conf_files = configureFilesSection();
+    xf86config->conf_modules = configureModuleSection();
+    xf86config->conf_flags = configureFlagsSection();
+    xf86config->conf_videoadaptor_lst = NULL;
+    xf86config->conf_modes_lst = NULL;
+    xf86config->conf_vendor_lst = NULL;
+    xf86config->conf_dri = NULL;
+    xf86config->conf_input_lst = configureInputSection();
+    xf86config->conf_layout_lst = configureLayoutSection();
+
+    home = getenv("HOME");
+    if ((home == NULL) || (home[0] == '\0')) {
+    	home = "/";
+    } else {
+	/* Determine if trailing slash is present or needed */
+	int l = strlen(home);
+
+	if (home[l-1] != '/') {
+	    addslash = "/";
+	}
+    }
+
+    snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
+	     home, addslash);
+
+    if (xf86writeConfigFile(filename, xf86config) == 0) {
+	xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
+		filename, strerror(errno));
+	goto bail;
+    }
+
+    xf86DoConfigurePass1 = FALSE;
+    /* Try to get DDC information filled in */
+    xf86ConfigFile = filename;
+    if (xf86HandleConfigFile(FALSE) != CONFIG_OK) {
+	goto bail;
+    }
+
+    xf86DoConfigurePass1 = FALSE;
+    
+    dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int));
+
+    {
+	Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool));
+	for (screennum = 0;  screennum < nDevToConfig;  screennum++) {
+	    int k,l,n,oldNumScreens;
+
+	    i = DevToConfig[screennum].iDriver;
+
+	    if (driverProbed[i]) continue;
+	    driverProbed[i] = TRUE;
+	    
+	    oldNumScreens = xf86NumScreens;
+
+	    xf86CallDriverProbe( xf86DriverList[i], FALSE );
+
+	    /* reorder */
+	    k = screennum > 0 ? screennum : 1;
+	    for (l = oldNumScreens; l < xf86NumScreens; l++) {
+	        /* is screen primary? */
+	        Bool primary = FALSE;
+		for (n = 0; n<xf86Screens[l]->numEntities; n++) {
+	            if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) {
+		        dev2screen[0] = l;
+			primary = TRUE;
+			break;
+		    }
+		}
+		if (primary) continue;
+		/* not primary: assign it to next device of same driver */
+		/* 
+		 * NOTE: we assume that devices in DevToConfig 
+		 * and xf86Screens[] have the same order except
+		 * for the primary device which always comes first.
+		 */
+		for (; k < nDevToConfig; k++) {
+		    if (DevToConfig[k].iDriver == i) {
+		        dev2screen[k++] = l;
+			break;
+		    }
+		}
+	    }
+	}
+	free(driverProbed);
+    }
+    
+
+    if (nDevToConfig != xf86NumScreens) {
+	ErrorF("Number of created screens does not match number of detected"
+	       " devices.\n  Configuration failed.\n");
+	goto bail;
+    }
+
+    xf86PostProbe();
+
+    for (j = 0; j < xf86NumScreens; j++) {
+	xf86Screens[j]->scrnIndex = j;
+    }
+
+    xf86freeMonitorList(xf86config->conf_monitor_lst);
+    xf86config->conf_monitor_lst = NULL;
+    xf86freeScreenList(xf86config->conf_screen_lst);
+    xf86config->conf_screen_lst = NULL;
+    for (j = 0; j < xf86NumScreens; j++) {
+	XF86ConfMonitorPtr MonitorPtr;
+	XF86ConfScreenPtr ScreenPtr;
+
+	ConfiguredMonitor = NULL;
+
+	if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], 
+						   PROBE_DETECT) &&
+	    ConfiguredMonitor) {
+	    MonitorPtr = configureDDCMonitorSection(j);
+	} else {
+	    MonitorPtr = configureMonitorSection(j);
+	}
+	ScreenPtr = configureScreenSection(j);
+	xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
+		(glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
+	xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
+		(glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
+    }
+
+    if (xf86writeConfigFile(filename, xf86config) == 0) {
+	xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
+		filename, strerror(errno));
+	goto bail;
+    }
+
+    ErrorF("\n");
+
+    if (!foundMouse) {
+	ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n"
+		"Edit the file and correct the Device.\n");
+    } else {
+	ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n"
+		"Please check your config if the mouse is still not\n"
+		"operational, as by default "__XSERVERNAME__
+	       " tries to autodetect\n"
+		"the protocol.\n",DFLT_MOUSE_DEV);
+    }
+
+    if (xf86NumScreens > 1) {
+	ErrorF("\n"__XSERVERNAME__
+	       " has configured a multihead system, please check your config.\n");
+    }
+
+    ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename);
+    ErrorF("To test the server, run 'X -config %s'\n\n", filename);
+
+bail:
+    OsCleanup(TRUE);
+    AbortDDX();
+    fflush(stderr);
+    exit(0);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index 84c0d182a..3006ad183 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -399,7 +399,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
          i++) {
         if (key_is_down(pDev, i, KEY_POSTED)) {
             sigstate = xf86BlockSIGIO ();
-            nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
+            nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i, NULL);
             for (j = 0; j < nevents; j++)
                 mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event);
             xf86UnblockSIGIO(sigstate);
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index ae22ef268..ef4542c5f 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -1013,7 +1013,6 @@ xf86PostMotionEventM(DeviceIntPtr	device,
                      const ValuatorMask	*mask)
 {
     int i = 0, nevents = 0;
-    DeviceEvent *event;
     int flags = 0;
 
     if (valuator_mask_num_valuators(mask) > 0)
@@ -1054,7 +1053,6 @@ xf86PostMotionEventM(DeviceIntPtr	device,
     nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0, flags, mask);
 
     for (i = 0; i < nevents; i++) {
-        event = (DeviceEvent*)((xf86Events + i)->event);
         mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
     }
 }
@@ -1252,16 +1250,9 @@ xf86PostKeyEventM(DeviceIntPtr	device,
     }
 #endif
 
-    if (is_absolute) {
-        nevents = GetKeyboardValuatorEvents(xf86Events, device,
-                                            is_down ? KeyPress : KeyRelease,
-                                            key_code, mask);
-    }
-    else {
-        nevents = GetKeyboardEvents(xf86Events, device,
-                                    is_down ? KeyPress : KeyRelease,
-                                    key_code);
-    }
+    nevents = GetKeyboardEvents(xf86Events, device,
+                                is_down ? KeyPress : KeyRelease,
+                                key_code, mask);
 
     for (i = 0; i < nevents; i++)
         mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
index d1f29d909..77dfb2f16 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -1,330 +1,345 @@
-/*
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Orest Zborowski and David Wexelblat
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission.  Orest Zborowski
- * and David Wexelblat make no representations about the suitability of this
- * software for any purpose.  It is provided "as is" without express or
- * implied warranty.
- *
- * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include <sys/stat.h>
-
-static Bool KeepTty = FALSE;
-static Bool VTSwitch = TRUE;
-static Bool ShareVTs = FALSE;
-static int activeVT = -1;
-
-static char vtname[11];
-static struct termios tty_attr; /* tty state to restore */
-static int tty_mode; /* kbd mode to restore */
-
-static void *console_handler;
-
-static void
-drain_console(int fd, void *closure)
-{
-    errno = 0;
-    if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) {
-	xf86RemoveGeneralHandler(console_handler);
-	console_handler = NULL;
-    }
-}
-
-static void
-switch_to(int vt, const char *from)
-{
-    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt) < 0)
-        FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
-
-    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt) < 0)
-        FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
-}
-
-void
-xf86OpenConsole(void)
-{
-    int i, fd = -1;
-    struct vt_mode VT;
-    struct vt_stat vts;
-    MessageType from = X_PROBED;
-    char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
-    char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
-
-    if (serverGeneration == 1) {
-
-	/* when KeepTty check if we're run with euid==0 */
-	if (KeepTty && geteuid() != 0) 
-	    FatalError("xf86OpenConsole:"
-		       " Server must be suid root for option \"KeepTTY\"\n");
-
-	/*
-	 * setup the virtual terminal manager
-	 */
-	if (xf86Info.vtno != -1) {
-	    from = X_CMDLINE;
-	} else {
-
-	    i=0;
-	    while (tty0[i] != NULL) {
-		if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
-		  break;
-		i++;
-	    }
-	    
-	    if (fd < 0)
-		FatalError(
-		    "xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
-		    strerror(errno));
-
-            if (ShareVTs)
-            {
-                if (ioctl(fd, VT_GETSTATE, &vts) == 0)
-                    xf86Info.vtno = vts.v_active;
-                else
-                    FatalError("xf86OpenConsole: Cannot find the current"
-                               " VT (%s)\n", strerror(errno));
-            } else {
-	        if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
-		    (xf86Info.vtno == -1))
-		    FatalError("xf86OpenConsole: Cannot find a free VT: %s\n",
-                               strerror(errno));
-            }
-	    close(fd);
-	}
-
-	xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
-
-	if (!KeepTty) {
-	    pid_t ppid = getppid();
-	    pid_t ppgid;
-	    ppgid = getpgid(ppid);
-
-	    /*
-	     * change to parent process group that pgid != pid so
-	     * that setsid() doesn't fail and we become process
-	     * group leader
-	     */
-	    if (setpgid(0,ppgid) < 0)
-		xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
-			strerror(errno));
-
-	    /* become process group leader */
-	    if ((setsid() < 0))
-		xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
-			strerror(errno));
-	}
-
-        i=0;
-        while (vcs[i] != NULL) {
-            sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
-     	    if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
-		break;
-            i++;
-        }
-
-	if (xf86Info.consoleFd < 0)
-	    FatalError("xf86OpenConsole: Cannot open virtual console"
-		       " %d (%s)\n", xf86Info.vtno, strerror(errno));
-
-	/*
-	 * Linux doesn't switch to an active vt after the last close of a vt,
-	 * so we do this ourselves by remembering which is active now.
-	 */
-	if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
-	    xf86Msg(X_WARNING,"xf86OpenConsole: VT_GETSTATE failed: %s\n",
-		    strerror(errno));
-	else
-	    activeVT = vts.v_active;
-
-#if 0
-	if (!KeepTty) {
-	    /*
-	     * Detach from the controlling tty to avoid char loss
-	     */
-	    if ((i = open("/dev/tty",O_RDWR)) >= 0) {
-		ioctl(i, TIOCNOTTY, 0);
-		close(i);
-	    }
-	}
-#endif
-
-        if (!ShareVTs)
-        {
-            struct termios nTty;
-
-	    /*
-	     * now get the VT.  This _must_ succeed, or else fail completely.
-	     */
-            switch_to(xf86Info.vtno, "xf86OpenConsole");
-
-	    if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
-	        FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
-		           strerror(errno));
-
-	    signal(SIGUSR1, xf86VTRequest);
-
-	    VT.mode = VT_PROCESS;
-	    VT.relsig = SIGUSR1;
-	    VT.acqsig = SIGUSR1;
-
-	    if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
-	        FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
-		    strerror(errno));
-	
-	    if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
-	        FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
-		           strerror(errno));
-
-            tcgetattr(xf86Info.consoleFd, &tty_attr);
-            ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
-
-            if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
-                FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
-                        strerror(errno));
-
-            nTty = tty_attr;
-            nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
-            nTty.c_oflag = 0;
-            nTty.c_cflag = CREAD | CS8;
-            nTty.c_lflag = 0;
-            nTty.c_cc[VTIME]=0;
-            nTty.c_cc[VMIN]=1;
-            cfsetispeed(&nTty, 9600);
-            cfsetospeed(&nTty, 9600);
-            tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
-
-            /* need to keep the buffer clean, else the kernel gets angry */
-	    xf86SetConsoleHandler(drain_console, NULL);
-
-	    /* we really should have a InitOSInputDevices() function instead
-	     * of Init?$#*&Device(). So I just place it here */
-        }
-    } else { 	/* serverGeneration != 1 */
-        if (!ShareVTs && VTSwitch)
-        {
-	    /* now get the VT */
-            switch_to(xf86Info.vtno, "xf86OpenConsole");
-        }
-    }
-}
-
-void
-xf86CloseConsole(void)
-{
-    struct vt_mode   VT;
-
-    if (ShareVTs) {
-        close(xf86Info.consoleFd);
-        return;
-    }
-
-    if (console_handler) {
-	xf86RemoveGeneralHandler(console_handler);
-	console_handler = NULL;
-    };
-
-    /* Back to text mode ... */
-    if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
-	xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
-		strerror(errno));
-
-    ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
-    tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
-
-    if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) 
-	xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
-		strerror(errno));
-    else {
-	/* set dflt vt handling */
-	VT.mode = VT_AUTO;
-	if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) 
-	    xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
-		    strerror(errno));
-    }
-
-    if (VTSwitch)
-    {
-        /*
-         * Perform a switch back to the active VT when we were started
-         */
-        if (activeVT >= 0) {
-            switch_to(activeVT, "xf86CloseConsole");
-	    activeVT = -1;
-        }
-    }
-    close(xf86Info.consoleFd);	/* make the vt-manager happy */
-}
-
-int
-xf86ProcessArgument(int argc, char *argv[], int i)
-{
-	/*
-	 * Keep server from detaching from controlling tty.  This is useful
-	 * when debugging (so the server can receive keyboard signals.
-	 */
-	if (!strcmp(argv[i], "-keeptty"))
-	{
-		KeepTty = TRUE;
-		return 1;
-	}
-        if (!strcmp(argv[i], "-novtswitch"))
-        {
-                VTSwitch = FALSE;
-                return 1;
-        }
-        if (!strcmp(argv[i], "-sharevts"))
-        {
-                ShareVTs = TRUE;
-                return 1;
-        }
-	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
-	{
-		if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0)
-		{
-			UseMsg();
-			xf86Info.vtno = -1;
-			return 0;
-		}
-		return 1;
-	}
-	return 0;
-}
-
-void
-xf86UseMsg(void)
-{
-	ErrorF("vtXX                   use the specified VT number\n");
-	ErrorF("-keeptty               ");
-	ErrorF("don't detach controlling tty (for debugging only)\n");
-	ErrorF("-novtswitch            don't immediately switch to new VT\n");
-	ErrorF("-sharevts              share VTs with another X server\n");
-}
+/*
+ * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Orest Zborowski and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission.  Orest Zborowski
+ * and David Wexelblat make no representations about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or
+ * implied warranty.
+ *
+ * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <sys/stat.h>
+
+static Bool KeepTty = FALSE;
+static Bool VTSwitch = TRUE;
+static Bool ShareVTs = FALSE;
+static int activeVT = -1;
+
+static char vtname[11];
+static struct termios tty_attr; /* tty state to restore */
+static int tty_mode; /* kbd mode to restore */
+
+static void *console_handler;
+
+static void
+drain_console(int fd, void *closure)
+{
+    errno = 0;
+    if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) {
+	xf86RemoveGeneralHandler(console_handler);
+	console_handler = NULL;
+    }
+}
+
+static void
+switch_to(int vt, const char *from)
+{
+    int ret;
+
+    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
+    if (ret < 0)
+	FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
+
+    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
+    if (ret < 0)
+	FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+}
+
+void
+xf86OpenConsole(void)
+{
+    int i, fd = -1, ret;
+    struct vt_mode VT;
+    struct vt_stat vts;
+    MessageType from = X_PROBED;
+    char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
+    char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
+
+    if (serverGeneration == 1) {
+
+	/* when KeepTty check if we're run with euid==0 */
+	if (KeepTty && geteuid() != 0) 
+	    FatalError("xf86OpenConsole:"
+		       " Server must be suid root for option \"KeepTTY\"\n");
+
+	/*
+	 * setup the virtual terminal manager
+	 */
+	if (xf86Info.vtno != -1) {
+	    from = X_CMDLINE;
+	} else {
+
+	    i=0;
+	    while (tty0[i] != NULL) {
+		if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
+		  break;
+		i++;
+	    }
+	    
+	    if (fd < 0)
+		FatalError(
+		    "xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
+		    strerror(errno));
+
+            if (ShareVTs)
+            {
+		SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
+		if (ret < 0)
+		    FatalError("xf86OpenConsole: Cannot find the current"
+			       " VT (%s)\n", strerror(errno));
+                xf86Info.vtno = vts.v_active;
+            } else {
+		SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
+		if (ret < 0)
+		    FatalError("xf86OpenConsole: Cannot find a free VT: "
+			       "%s\n", strerror(errno));
+		if (xf86Info.vtno == -1)
+		    FatalError("xf86OpenConsole: Cannot find a free VT\n");
+	    }
+	    close(fd);
+	}
+
+	xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+
+	if (!KeepTty) {
+	    pid_t ppid = getppid();
+	    pid_t ppgid;
+	    ppgid = getpgid(ppid);
+
+	    /*
+	     * change to parent process group that pgid != pid so
+	     * that setsid() doesn't fail and we become process
+	     * group leader
+	     */
+	    if (setpgid(0,ppgid) < 0)
+		xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
+			strerror(errno));
+
+	    /* become process group leader */
+	    if ((setsid() < 0))
+		xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
+			strerror(errno));
+	}
+
+        i=0;
+        while (vcs[i] != NULL) {
+            sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
+     	    if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
+		break;
+            i++;
+        }
+
+	if (xf86Info.consoleFd < 0)
+	    FatalError("xf86OpenConsole: Cannot open virtual console"
+		       " %d (%s)\n", xf86Info.vtno, strerror(errno));
+
+	/*
+	 * Linux doesn't switch to an active vt after the last close of a vt,
+	 * so we do this ourselves by remembering which is active now.
+	 */
+	SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
+	if (ret < 0)
+	    xf86Msg(X_WARNING,"xf86OpenConsole: VT_GETSTATE failed: %s\n",
+		    strerror(errno));
+	else
+	    activeVT = vts.v_active;
+
+#if 0
+	if (!KeepTty) {
+	    /*
+	     * Detach from the controlling tty to avoid char loss
+	     */
+	    if ((i = open("/dev/tty",O_RDWR)) >= 0) {
+		SYSCALL(ioctl(i, TIOCNOTTY, 0));
+		close(i);
+	    }
+	}
+#endif
+
+        if (!ShareVTs)
+        {
+            struct termios nTty;
+
+	    /*
+	     * now get the VT.  This _must_ succeed, or else fail completely.
+	     */
+            switch_to(xf86Info.vtno, "xf86OpenConsole");
+
+	    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
+	    if (ret < 0)
+		FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
+			   strerror(errno));
+
+	    signal(SIGUSR1, xf86VTRequest);
+
+	    VT.mode = VT_PROCESS;
+	    VT.relsig = SIGUSR1;
+	    VT.acqsig = SIGUSR1;
+
+	    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
+	    if (ret < 0)
+		FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
+		    strerror(errno));
+
+	    SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
+	    if (ret < 0)
+		FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
+			   strerror(errno));
+
+            tcgetattr(xf86Info.consoleFd, &tty_attr);
+	    SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
+
+	    SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
+	    if (ret < 0)
+		FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+			strerror(errno));
+
+            nTty = tty_attr;
+            nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+            nTty.c_oflag = 0;
+            nTty.c_cflag = CREAD | CS8;
+            nTty.c_lflag = 0;
+            nTty.c_cc[VTIME]=0;
+            nTty.c_cc[VMIN]=1;
+            cfsetispeed(&nTty, 9600);
+            cfsetospeed(&nTty, 9600);
+            tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
+
+            /* need to keep the buffer clean, else the kernel gets angry */
+	    xf86SetConsoleHandler(drain_console, NULL);
+
+	    /* we really should have a InitOSInputDevices() function instead
+	     * of Init?$#*&Device(). So I just place it here */
+        }
+    } else { 	/* serverGeneration != 1 */
+        if (!ShareVTs && VTSwitch)
+        {
+	    /* now get the VT */
+            switch_to(xf86Info.vtno, "xf86OpenConsole");
+        }
+    }
+}
+
+void
+xf86CloseConsole(void)
+{
+    struct vt_mode   VT;
+    int ret;
+
+    if (ShareVTs) {
+        close(xf86Info.consoleFd);
+        return;
+    }
+
+    if (console_handler) {
+	xf86RemoveGeneralHandler(console_handler);
+	console_handler = NULL;
+    };
+
+    /* Back to text mode ... */
+    SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
+    if (ret < 0)
+	xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
+		strerror(errno));
+
+    SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
+    tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+
+    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
+    if (ret < 0)
+	xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
+		strerror(errno));
+    else {
+	/* set dflt vt handling */
+	VT.mode = VT_AUTO;
+	SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
+	if (ret < 0)
+	    xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
+		    strerror(errno));
+    }
+
+    if (VTSwitch)
+    {
+        /*
+         * Perform a switch back to the active VT when we were started
+         */
+        if (activeVT >= 0) {
+            switch_to(activeVT, "xf86CloseConsole");
+	    activeVT = -1;
+        }
+    }
+    close(xf86Info.consoleFd);	/* make the vt-manager happy */
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+	/*
+	 * Keep server from detaching from controlling tty.  This is useful
+	 * when debugging (so the server can receive keyboard signals.
+	 */
+	if (!strcmp(argv[i], "-keeptty"))
+	{
+		KeepTty = TRUE;
+		return 1;
+	}
+        if (!strcmp(argv[i], "-novtswitch"))
+        {
+                VTSwitch = FALSE;
+                return 1;
+        }
+        if (!strcmp(argv[i], "-sharevts"))
+        {
+                ShareVTs = TRUE;
+                return 1;
+        }
+	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+	{
+		if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0)
+		{
+			UseMsg();
+			xf86Info.vtno = -1;
+			return 0;
+		}
+		return 1;
+	}
+	return 0;
+}
+
+void
+xf86UseMsg(void)
+{
+	ErrorF("vtXX                   use the specified VT number\n");
+	ErrorF("-keeptty               ");
+	ErrorF("don't detach controlling tty (for debugging only)\n");
+	ErrorF("-novtswitch            don't immediately switch to new VT\n");
+	ErrorF("-sharevts              share VTs with another X server\n");
+}
diff --git a/xorg-server/hw/xnest/Events.c b/xorg-server/hw/xnest/Events.c
index 6b8edf143..5c800860a 100644
--- a/xorg-server/hw/xnest/Events.c
+++ b/xorg-server/hw/xnest/Events.c
@@ -1,233 +1,233 @@
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation.  Davor Matic makes no representations about
-the suitability of this software for any purpose.  It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "screenint.h"
-#include "input.h"
-#include "misc.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "inputstr.h"
-#include "inpututils.h"
-
-#include "mi.h"
-
-#include "Xnest.h"
-
-#include "Args.h"
-#include "Color.h"
-#include "Display.h"
-#include "Screen.h"
-#include "XNWindow.h"
-#include "Events.h"
-#include "Keyboard.h"
-#include "Pointer.h"
-#include "mipointer.h"
-
-CARD32 lastEventTime = 0;
-
-extern EventList *xnestEvents;
-
-void
-ProcessInputEvents(void)
-{
-  mieqProcessInputEvents();
-}
-
-int
-TimeSinceLastInputEvent(void)
-{
-    if (lastEventTime == 0)
-        lastEventTime = GetTimeInMillis();
-    return GetTimeInMillis() - lastEventTime;
-}
-
-void
-SetTimeSinceLastInputEvent(void)
-{
-  lastEventTime = GetTimeInMillis();
-}
-
-static Bool
-xnestExposurePredicate(Display *display, XEvent *event, char *args)
-{
-  return event->type == Expose || event->type == ProcessedExpose;
-}
-
-static Bool
-xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
-{
-  return !xnestExposurePredicate(display, event, args);
-}
-
-void
-xnestCollectExposures(void)
-{
-  XEvent X;
-  WindowPtr pWin;
-  RegionRec Rgn;
-  BoxRec Box;
-  
-  while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
-    pWin = xnestWindowPtr(X.xexpose.window);
-    
-    if (pWin && X.xexpose.width && X.xexpose.height) {
-      Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
-      Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
-      Box.x2 = Box.x1 + X.xexpose.width;
-      Box.y2 = Box.y1 + X.xexpose.height;
-      
-      RegionInit(&Rgn, &Box, 1);
-      
-      miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
-    }
-  }
-}
-
-void
-xnestQueueKeyEvent(int type, unsigned int keycode)
-{
-  int i, n;
-
-  GetEventList(&xnestEvents);
-  lastEventTime = GetTimeInMillis();
-  n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
-  for (i = 0; i < n; i++)
-    mieqEnqueue(xnestKeyboardDevice, (InternalEvent*)(xnestEvents + i)->event);
-}
-
-void
-xnestCollectEvents(void)
-{
-  XEvent X;
-  int i, n, valuators[2];
-  ValuatorMask mask;
-  ScreenPtr pScreen;
-  GetEventList(&xnestEvents);
-
-  while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
-    switch (X.type) {
-    case KeyPress:
-      xnestUpdateModifierState(X.xkey.state);
-      xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
-      break;
-      
-    case KeyRelease:
-      xnestUpdateModifierState(X.xkey.state);
-      xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
-      break;
-      
-    case ButtonPress:
-      valuator_mask_set_range(&mask, 0, 0, NULL);
-      xnestUpdateModifierState(X.xkey.state);
-      lastEventTime = GetTimeInMillis();
-      n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
-                           X.xbutton.button, POINTER_RELATIVE, &mask);
-      for (i = 0; i < n; i++)
-        mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
-      break;
-      
-    case ButtonRelease:
-      valuator_mask_set_range(&mask, 0, 0, NULL);
-      xnestUpdateModifierState(X.xkey.state);
-      lastEventTime = GetTimeInMillis();
-      n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
-                           X.xbutton.button, POINTER_RELATIVE, &mask);
-      for (i = 0; i < n; i++)
-        mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
-      break;
-      
-    case MotionNotify:
-      valuators[0] = X.xmotion.x;
-      valuators[1] = X.xmotion.y;
-      valuator_mask_set_range(&mask, 0, 2, valuators);
-      lastEventTime = GetTimeInMillis();
-      n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
-                           0, POINTER_ABSOLUTE, &mask);
-      for (i = 0; i < n; i++)
-        mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
-      break;
-      
-    case FocusIn:
-      if (X.xfocus.detail != NotifyInferior) {
-	pScreen = xnestScreen(X.xfocus.window);
-	if (pScreen)
-	  xnestDirectInstallColormaps(pScreen);
-      }
-      break;
-   
-    case FocusOut:
-      if (X.xfocus.detail != NotifyInferior) {
-	pScreen = xnestScreen(X.xfocus.window);
-	if (pScreen)
-	  xnestDirectUninstallColormaps(pScreen);
-      }
-      break;
-
-    case KeymapNotify:
-      break;
-
-    case EnterNotify:
-      if (X.xcrossing.detail != NotifyInferior) {
-	pScreen = xnestScreen(X.xcrossing.window);
-	if (pScreen) {
-	  NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y);
-          valuators[0] = X.xcrossing.x;
-          valuators[1] = X.xcrossing.y;
-          valuator_mask_set_range(&mask, 0, 2, valuators);
-          lastEventTime = GetTimeInMillis();
-          n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
-                               0, POINTER_ABSOLUTE, &mask);
-          for (i = 0; i < n; i++)
-            mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
-	  xnestDirectInstallColormaps(pScreen);
-	}
-      }
-      break;
-      
-    case LeaveNotify:
-      if (X.xcrossing.detail != NotifyInferior) {
-	pScreen = xnestScreen(X.xcrossing.window);
-	if (pScreen) {
-	  xnestDirectUninstallColormaps(pScreen);
-	}	
-      }
-      break;
-      
-    case DestroyNotify:
-      if (xnestParentWindow != (Window) 0 &&
-	  X.xdestroywindow.window == xnestParentWindow)
-	exit (0);
-      break;
-
-    case CirculateNotify:
-    case ConfigureNotify:
-    case GravityNotify:
-    case MapNotify:
-    case ReparentNotify:
-    case UnmapNotify:
-      break;
-      
-    default:
-      ErrorF("xnest warning: unhandled event\n");
-      break;
-    }
-  }
-}
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation.  Davor Matic makes no representations about
+the suitability of this software for any purpose.  It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "inputstr.h"
+#include "inpututils.h"
+
+#include "mi.h"
+
+#include "Xnest.h"
+
+#include "Args.h"
+#include "Color.h"
+#include "Display.h"
+#include "Screen.h"
+#include "XNWindow.h"
+#include "Events.h"
+#include "Keyboard.h"
+#include "Pointer.h"
+#include "mipointer.h"
+
+CARD32 lastEventTime = 0;
+
+extern EventList *xnestEvents;
+
+void
+ProcessInputEvents(void)
+{
+  mieqProcessInputEvents();
+}
+
+int
+TimeSinceLastInputEvent(void)
+{
+    if (lastEventTime == 0)
+        lastEventTime = GetTimeInMillis();
+    return GetTimeInMillis() - lastEventTime;
+}
+
+void
+SetTimeSinceLastInputEvent(void)
+{
+  lastEventTime = GetTimeInMillis();
+}
+
+static Bool
+xnestExposurePredicate(Display *display, XEvent *event, char *args)
+{
+  return event->type == Expose || event->type == ProcessedExpose;
+}
+
+static Bool
+xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
+{
+  return !xnestExposurePredicate(display, event, args);
+}
+
+void
+xnestCollectExposures(void)
+{
+  XEvent X;
+  WindowPtr pWin;
+  RegionRec Rgn;
+  BoxRec Box;
+  
+  while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
+    pWin = xnestWindowPtr(X.xexpose.window);
+    
+    if (pWin && X.xexpose.width && X.xexpose.height) {
+      Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
+      Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
+      Box.x2 = Box.x1 + X.xexpose.width;
+      Box.y2 = Box.y1 + X.xexpose.height;
+      
+      RegionInit(&Rgn, &Box, 1);
+      
+      miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
+    }
+  }
+}
+
+void
+xnestQueueKeyEvent(int type, unsigned int keycode)
+{
+  int i, n;
+
+  GetEventList(&xnestEvents);
+  lastEventTime = GetTimeInMillis();
+  n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode, NULL);
+  for (i = 0; i < n; i++)
+    mieqEnqueue(xnestKeyboardDevice, (InternalEvent*)(xnestEvents + i)->event);
+}
+
+void
+xnestCollectEvents(void)
+{
+  XEvent X;
+  int i, n, valuators[2];
+  ValuatorMask mask;
+  ScreenPtr pScreen;
+  GetEventList(&xnestEvents);
+
+  while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
+    switch (X.type) {
+    case KeyPress:
+      xnestUpdateModifierState(X.xkey.state);
+      xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
+      break;
+      
+    case KeyRelease:
+      xnestUpdateModifierState(X.xkey.state);
+      xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
+      break;
+      
+    case ButtonPress:
+      valuator_mask_set_range(&mask, 0, 0, NULL);
+      xnestUpdateModifierState(X.xkey.state);
+      lastEventTime = GetTimeInMillis();
+      n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
+                           X.xbutton.button, POINTER_RELATIVE, &mask);
+      for (i = 0; i < n; i++)
+        mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+      break;
+      
+    case ButtonRelease:
+      valuator_mask_set_range(&mask, 0, 0, NULL);
+      xnestUpdateModifierState(X.xkey.state);
+      lastEventTime = GetTimeInMillis();
+      n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
+                           X.xbutton.button, POINTER_RELATIVE, &mask);
+      for (i = 0; i < n; i++)
+        mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+      break;
+      
+    case MotionNotify:
+      valuators[0] = X.xmotion.x;
+      valuators[1] = X.xmotion.y;
+      valuator_mask_set_range(&mask, 0, 2, valuators);
+      lastEventTime = GetTimeInMillis();
+      n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+                           0, POINTER_ABSOLUTE, &mask);
+      for (i = 0; i < n; i++)
+        mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+      break;
+      
+    case FocusIn:
+      if (X.xfocus.detail != NotifyInferior) {
+	pScreen = xnestScreen(X.xfocus.window);
+	if (pScreen)
+	  xnestDirectInstallColormaps(pScreen);
+      }
+      break;
+   
+    case FocusOut:
+      if (X.xfocus.detail != NotifyInferior) {
+	pScreen = xnestScreen(X.xfocus.window);
+	if (pScreen)
+	  xnestDirectUninstallColormaps(pScreen);
+      }
+      break;
+
+    case KeymapNotify:
+      break;
+
+    case EnterNotify:
+      if (X.xcrossing.detail != NotifyInferior) {
+	pScreen = xnestScreen(X.xcrossing.window);
+	if (pScreen) {
+	  NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y);
+          valuators[0] = X.xcrossing.x;
+          valuators[1] = X.xcrossing.y;
+          valuator_mask_set_range(&mask, 0, 2, valuators);
+          lastEventTime = GetTimeInMillis();
+          n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+                               0, POINTER_ABSOLUTE, &mask);
+          for (i = 0; i < n; i++)
+            mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+	  xnestDirectInstallColormaps(pScreen);
+	}
+      }
+      break;
+      
+    case LeaveNotify:
+      if (X.xcrossing.detail != NotifyInferior) {
+	pScreen = xnestScreen(X.xcrossing.window);
+	if (pScreen) {
+	  xnestDirectUninstallColormaps(pScreen);
+	}	
+      }
+      break;
+      
+    case DestroyNotify:
+      if (xnestParentWindow != (Window) 0 &&
+	  X.xdestroywindow.window == xnestParentWindow)
+	exit (0);
+      break;
+
+    case CirculateNotify:
+    case ConfigureNotify:
+    case GravityNotify:
+    case MapNotify:
+    case ReparentNotify:
+    case UnmapNotify:
+      break;
+      
+    default:
+      ErrorF("xnest warning: unhandled event\n");
+      break;
+    }
+  }
+}
diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m
index 3521517a2..e56bf0cf3 100644
--- a/xorg-server/hw/xquartz/X11Application.m
+++ b/xorg-server/hw/xquartz/X11Application.m
@@ -61,6 +61,12 @@ extern int xpbproxy_run (void);
 #define XSERVER_VERSION "?"
 #endif
 
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+
+static dispatch_queue_t eventTranslationQueue;
+#endif
+
 /* Stuck modifier / button state... force release when we context switch */
 static NSEventType keyState[NUM_KEYCODES];
 
@@ -385,7 +391,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
     
     if (for_appkit) [super sendEvent:e];
     
-    if (for_x) [self sendX11NSEvent:e];
+    if (for_x) {
+#ifdef HAVE_LIBDISPATCH
+        dispatch_async(eventTranslationQueue, ^{
+#endif
+            [self sendX11NSEvent:e];
+#ifdef HAVE_LIBDISPATCH
+        });
+#endif
+    }
 }
 
 - (void) set_window_menu:(NSArray *)list {
@@ -950,7 +964,7 @@ environment the next time you start X11?", @"Startup xinitrc dialog");
     [X11App prefs_synchronize];
 }
 
-static inline pthread_t create_thread(void *func, void *arg) {
+static inline pthread_t create_thread(void *(*func)(void *), void *arg) {
     pthread_attr_t attr;
     pthread_t tid;
     
@@ -999,6 +1013,11 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
     aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
     NSMaxY([[NSScreen mainScreen] visibleFrame]);
 
+#ifdef HAVE_LIBDISPATCH
+    eventTranslationQueue = dispatch_queue_create(LAUNCHD_ID_PREFIX".X11.NSEventsToX11EventsQueue", NULL);
+    assert(eventTranslationQueue != NULL);
+#endif
+    
     /* Set the key layout seed before we start the server */
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
     last_key_layout = TISCopyCurrentKeyboardLayoutInputSource();    
@@ -1079,13 +1098,29 @@ static const char *untrusted_str(NSEvent *e) {
 #endif
 
 - (void) sendX11NSEvent:(NSEvent *)e {
-    NSPoint location = NSZeroPoint, tilt = NSZeroPoint;
+    NSPoint location = NSZeroPoint;
     int ev_button, ev_type;
-    float pressure = 0.0;
+    static float pressure = 0.0;       // static so ProximityOut will have the value from the previous tablet event
+    static NSPoint tilt;               // static so ProximityOut will have the value from the previous tablet event
+    static DeviceIntPtr darwinTabletCurrent = NULL;
+    static BOOL needsProximityIn = NO; // Do we do need to handle a pending ProximityIn once we have pressure/tilt?
     DeviceIntPtr pDev;
     int modifierFlags;
     BOOL isMouseOrTabletEvent, isTabletEvent;
 
+#ifdef HAVE_LIBDISPATCH
+    static dispatch_once_t once_pred;
+    dispatch_once(&once_pred, ^{
+        tilt = NSZeroPoint;
+        darwinTabletCurrent = darwinTabletStylus;
+    });
+#else
+    if(!darwinTabletCurrent) {
+        tilt = NSZeroPoint;
+        darwinTabletCurrent = darwinTabletStylus;
+    }
+#endif
+    
     isMouseOrTabletEvent =  [e type] == NSLeftMouseDown    ||  [e type] == NSOtherMouseDown    ||  [e type] == NSRightMouseDown    ||
                             [e type] == NSLeftMouseUp      ||  [e type] == NSOtherMouseUp      ||  [e type] == NSRightMouseUp      ||
                             [e type] == NSLeftMouseDragged ||  [e type] == NSOtherMouseDragged ||  [e type] == NSRightMouseDragged ||
@@ -1207,19 +1242,14 @@ static const char *untrusted_str(NSEvent *e) {
                         darwinTabletCurrent=darwinTabletCursor;
                         break;
                 }
-                
-                /* NSTabletProximityEventSubtype doesn't encode pressure ant tilt
-                 * So we just pretend the motion was caused by the mouse.  Hopefully
-                 * we'll have a better solution for this in the future (like maybe
-                 * NSTabletProximityEventSubtype will come from NSTabletPoint
-                 * rather than NSMouseMoved.
-                pressure = [e pressure];
-                tilt     = [e tilt];
-                pDev = darwinTabletCurrent;                
-                 */
 
-                DarwinSendProximityEvents([e isEnteringProximity] ? ProximityIn : ProximityOut,
-                                          location.x, location.y);
+                if([e isEnteringProximity])
+                    needsProximityIn = YES;
+                else
+                    DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
+                                              location.x, location.y, pressure,
+                                              tilt.x, tilt.y);
+                return;
             }
 
 			if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
@@ -1227,6 +1257,14 @@ static const char *untrusted_str(NSEvent *e) {
                 tilt     = [e tilt];
                 
                 pDev = darwinTabletCurrent;
+                
+                if(needsProximityIn) {
+                    DarwinSendProximityEvents(darwinTabletCurrent, ProximityIn,
+                                              location.x, location.y, pressure,
+                                              tilt.x, tilt.y);
+
+                    needsProximityIn = NO;
+                }
             }
 
             if(!XQuartzServerVisible && noTestExtensions) {
@@ -1280,8 +1318,12 @@ static const char *untrusted_str(NSEvent *e) {
                     break;
             }
             
-			DarwinSendProximityEvents([e isEnteringProximity] ? ProximityIn : ProximityOut,
-                                      location.x, location.y);
+            if([e isEnteringProximity])
+                needsProximityIn = YES;
+            else
+                DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
+                                          location.x, location.y, pressure,
+                                          tilt.x, tilt.y);
             break;
             
 		case NSScrollWheel:
diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c
index 3b6f0a29e..00be74ba0 100644
--- a/xorg-server/hw/xquartz/darwin.c
+++ b/xorg-server/hw/xquartz/darwin.c
@@ -117,7 +117,6 @@ unsigned int            windowItemModMask = NX_COMMANDMASK;
 // devices
 DeviceIntPtr            darwinKeyboard = NULL;
 DeviceIntPtr            darwinPointer = NULL;
-DeviceIntPtr            darwinTabletCurrent = NULL;
 DeviceIntPtr            darwinTabletStylus = NULL;
 DeviceIntPtr            darwinTabletCursor = NULL;
 DeviceIntPtr            darwinTabletEraser = NULL;
@@ -492,8 +491,6 @@ void InitInput( int argc, char **argv )
     darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
     darwinTabletEraser->name = strdup("eraser");
 
-    darwinTabletCurrent = darwinTabletStylus;
-
     DarwinEQInit();
 
     QuartzInitInput(argc, argv);
diff --git a/xorg-server/hw/xquartz/darwin.h b/xorg-server/hw/xquartz/darwin.h
index e874af24c..360225742 100644
--- a/xorg-server/hw/xquartz/darwin.h
+++ b/xorg-server/hw/xquartz/darwin.h
@@ -56,7 +56,6 @@ extern io_connect_t     darwinParamConnect;
 extern int              darwinEventReadFD;
 extern int              darwinEventWriteFD;
 extern DeviceIntPtr     darwinPointer;
-extern DeviceIntPtr     darwinTabletCurrent;
 extern DeviceIntPtr     darwinTabletCursor;
 extern DeviceIntPtr     darwinTabletStylus;
 extern DeviceIntPtr     darwinTabletEraser;
diff --git a/xorg-server/hw/xquartz/darwinEvents.c b/xorg-server/hw/xquartz/darwinEvents.c
index 16fec4a01..40d8a4e9e 100644
--- a/xorg-server/hw/xquartz/darwinEvents.c
+++ b/xorg-server/hw/xquartz/darwinEvents.c
@@ -61,6 +61,7 @@ in this Software without prior written authorization from The Open Group.
 #include <unistd.h>
 #include <pthread.h>
 #include <errno.h>
+#include <time.h>
 
 #include <IOKit/hidsystem/IOLLEvent.h>
 
@@ -93,7 +94,7 @@ static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER;
 
 /*** Pthread Magics ***/
-static pthread_t create_thread(void *func, void *arg) {
+static pthread_t create_thread(void *(*func)(void *), void *arg) {
     pthread_attr_t attr;
     pthread_t tid;
 
@@ -304,7 +305,28 @@ void DarwinListenOnOpenFD(int fd) {
     pthread_mutex_unlock(&fd_add_lock);
 }
 
-static void DarwinProcessFDAdditionQueue_thread(void *args) {
+static void *DarwinProcessFDAdditionQueue_thread(void *args) {
+    /* TODO: Possibly adjust this to no longer be a race... maybe trigger this
+     *       once a client connects and claims to be the WM.
+     *
+     * From ajax:
+     * There's already an internal callback chain for setting selection [in 1.5]
+     * ownership.  See the CallSelectionCallback at the bottom of
+     * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook
+     * into it.
+     */
+
+    struct timespec sleep_for;
+    struct timespec sleep_remaining;
+
+    sleep_for.tv_sec = 3;
+    sleep_for.tv_nsec = 0;
+
+    ErrorF("X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup.\n");
+    while(nanosleep(&sleep_for, &sleep_remaining) != 0) {
+        sleep_for = sleep_remaining;
+    }
+
     pthread_mutex_lock(&fd_add_lock);
     while(true) {
         while(fd_add_count) {
@@ -312,6 +334,8 @@ static void DarwinProcessFDAdditionQueue_thread(void *args) {
         }
         pthread_cond_wait(&fd_add_ready_cond, &fd_add_lock);
     }
+
+    return NULL;
 }
 
 Bool DarwinEQInit(void) { 
@@ -465,7 +489,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
     DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
     darwinEvents_lock(); {
         ValuatorMask mask;
-        valuator_mask_set_range(&mask, 0, (pDev == darwinTabletCurrent) ? 5 : 2, valuators);
+        valuator_mask_set_range(&mask, 0, (pDev == darwinPointer) ? 2 : 5, valuators);
         num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button, 
                                       POINTER_ABSOLUTE, &mask);
         for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event);
@@ -482,24 +506,24 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
 	}
 
     darwinEvents_lock(); {
-        num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
+        num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE, NULL);
         for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard, (InternalEvent*)darwinEvents[i].event);
         if(num_events > 0) DarwinPokeEQ();
     } darwinEvents_unlock();
 }
 
-void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
-	int i, num_events;
+void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, float pointer_y,  
+                               float pressure, float tilt_x, float tilt_y) {
+    int i, num_events;
     ScreenPtr screen;
-    DeviceIntPtr pDev = darwinTabletCurrent;
     int valuators[5];
 
-	DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y);
+    DEBUG_LOG("DarwinSendProximityEvents: %d l:%f,%f p:%f t:%f,%f\n", ev_type, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
 
-	if(!darwinEvents) {
-		DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n");
-		return;
-	}
+    if(!darwinEvents) {
+        DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n");
+        return;
+    }
     
     screen = miPointerGetScreen(pDev);
     if(!screen) {
@@ -507,7 +531,7 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
         return;
     }    
 
-    DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f);
+    DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
     darwinEvents_lock(); {
         ValuatorMask mask;
         valuator_mask_set_range(&mask, 0, 5, valuators);
diff --git a/xorg-server/hw/xquartz/darwinEvents.h b/xorg-server/hw/xquartz/darwinEvents.h
index 590305f3e..6769c8bd8 100644
--- a/xorg-server/hw/xquartz/darwinEvents.h
+++ b/xorg-server/hw/xquartz/darwinEvents.h
@@ -37,7 +37,8 @@ void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
 void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
 void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y,
 			     float pressure, float tilt_x, float tilt_y);
-void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y);
+void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, float pointer_y,
+                               float pressure, float tilt_x, float tilt_y);
 void DarwinSendKeyboardEvents(int ev_type, int keycode);
 void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x, float pointer_y,
 			    float pressure, float tilt_x, float tilt_y);
diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
index aaff1c625..6a6c01c3b 100644
--- a/xorg-server/hw/xquartz/mach-startup/bundle-main.c
+++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c
@@ -1,691 +1,698 @@
-/* main.c -- X application launcher
- 
- Copyright (c) 2007 Jeremy Huddleston
- Copyright (c) 2007 Apple 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 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 ABOVE LISTED COPYRIGHT
- HOLDER(S) 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.
- 
- Except as contained in this notice, the name(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization. */
-
-#include <CoreFoundation/CoreFoundation.h>
-#include <AvailabilityMacros.h>
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/Xlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <stdbool.h>
-#include <signal.h>
-
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include <sys/time.h>
-#include <fcntl.h>
-
-#include <mach/mach.h>
-#include <mach/mach_error.h>
-#include <servers/bootstrap.h>
-#include "mach_startup.h"
-#include "mach_startupServer.h"
-
-#include "launchd_fd.h"
-/* From darwinEvents.c ... but don't want to pull in all the server cruft */
-void DarwinListenOnOpenFD(int fd);
-
-extern int noPanoramiXExtension;
-
-#define DEFAULT_CLIENT X11BINDIR "/xterm"
-#define DEFAULT_STARTX X11BINDIR "/startx"
-#define DEFAULT_SHELL  "/bin/sh"
-
-#ifndef BUILD_DATE
-#define BUILD_DATE ""
-#endif
-#ifndef XSERVER_VERSION
-#define XSERVER_VERSION "?"
-#endif
-
-static char __crashreporter_info_buff__[4096] = {0};
-static const char *__crashreporter_info__ __attribute__((__used__)) = &__crashreporter_info_buff__[0];
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
-// This is actually a toolchain requirement, but I'm not sure the correct check,
-// but it should be fine to just only include it for Leopard and later.  This line
-// just tells the linker to never strip this symbol (such as for space optimization)
-asm (".desc ___crashreporter_info__, 0x10");
-#endif
-
-static const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
-
-static char *launchd_id_prefix = NULL;
-static char *server_bootstrap_name = NULL;
-
-#define DEBUG 1
-
-/* This is in quartzStartup.c */
-int server_main(int argc, char **argv, char **envp);
-
-static int execute(const char *command);
-static char *command_from_prefs(const char *key, const char *default_value);
-
-/*** Pthread Magics ***/
-static pthread_t create_thread(void *func, void *arg) {
-    pthread_attr_t attr;
-    pthread_t tid;
-	
-    pthread_attr_init (&attr);
-    pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
-    pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
-    pthread_create (&tid, &attr, func, arg);
-    pthread_attr_destroy (&attr);
-	
-    return tid;
-}
-
-/*** Mach-O IPC Stuffs ***/
-
-union MaxMsgSize {
-	union __RequestUnion__mach_startup_subsystem req;
-	union __ReplyUnion__mach_startup_subsystem rep; 
-};
-
-static mach_port_t checkin_or_register(char *bname) {
-    kern_return_t kr;
-    mach_port_t mp;
-
-    /* If we're started by launchd or the old mach_init */
-    kr = bootstrap_check_in(bootstrap_port, bname, &mp);
-    if (kr == KERN_SUCCESS)
-        return mp;
-
-    /* We probably were not started by launchd or the old mach_init */
-    kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp);
-    if (kr != KERN_SUCCESS) {
-        fprintf(stderr, "mach_port_allocate(): %s\n", mach_error_string(kr));
-        exit(EXIT_FAILURE);
-    }
-
-    kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND);
-    if (kr != KERN_SUCCESS) {
-        fprintf(stderr, "mach_port_insert_right(): %s\n", mach_error_string(kr));
-        exit(EXIT_FAILURE);
-    }
-
-    kr = bootstrap_register(bootstrap_port, bname, mp);
-    if (kr != KERN_SUCCESS) {
-        fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr));
-        exit(EXIT_FAILURE);
-    }
-
-    return mp;
-}
-
-/*** $DISPLAY handoff ***/
-static int accept_fd_handoff(int connected_fd) {
-    int launchd_fd;
-    
-    char databuf[] = "display";
-    struct iovec iov[1];
-    
-    union {
-        struct cmsghdr hdr;
-        char bytes[CMSG_SPACE(sizeof(int))];
-    } buf;
-    
-    struct msghdr msg;
-    struct cmsghdr *cmsg;
-
-    iov[0].iov_base = databuf;
-    iov[0].iov_len  = sizeof(databuf);
-    
-    msg.msg_iov = iov;
-    msg.msg_iovlen = 1;
-    msg.msg_control = buf.bytes;
-    msg.msg_controllen = sizeof(buf);
-    msg.msg_name = 0;
-    msg.msg_namelen = 0;
-    msg.msg_flags = 0;
-    
-    cmsg = CMSG_FIRSTHDR (&msg);
-    cmsg->cmsg_level = SOL_SOCKET;
-    cmsg->cmsg_type = SCM_RIGHTS;
-    cmsg->cmsg_len = CMSG_LEN(sizeof(int));
-    
-    msg.msg_controllen = cmsg->cmsg_len;
-    
-    *((int*)CMSG_DATA(cmsg)) = -1;
-    
-    if(recvmsg(connected_fd, &msg, 0) < 0) {
-        fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor.  recvmsg() error: %s\n", strerror(errno));
-        return -1;
-    }
-    
-    launchd_fd = *((int*)CMSG_DATA(cmsg));
-    
-    return launchd_fd;
-}
-
-typedef struct {
-    int fd;
-    string_t filename;
-} socket_handoff_t;
-
-/* This thread accepts an incoming connection and hands off the file
- * descriptor for the new connection to accept_fd_handoff()
- */
-static void socket_handoff_thread(void *arg) {
-    socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
-    int launchd_fd = -1;
-    int connected_fd;
-    unsigned remain;
-
-    /* Now actually get the passed file descriptor from this connection
-     * If we encounter an error, keep listening.
-     */
-    while(launchd_fd == -1) {
-        connected_fd = accept(handoff_data->fd, NULL, NULL);
-        if(connected_fd == -1) {
-            fprintf(stderr, "X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n", handoff_data->fd, strerror(errno));
-            sleep(2);
-            continue;
-        }
-
-        launchd_fd = accept_fd_handoff(connected_fd);
-        if(launchd_fd == -1)
-            fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor, no descriptor received?  Waiting for another connection.\n");
-
-        close(connected_fd);
-    }
-
-    close(handoff_data->fd);
-    unlink(handoff_data->filename);
-    free(handoff_data);
-    
-    /* TODO: Clean up this race better... giving xinitrc time to run... need to wait for 1.5 branch:
-     *
-     * From ajax:
-     * There's already an internal callback chain for setting selection [in 1.5]
-     * ownership.  See the CallSelectionCallback at the bottom of
-     * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook
-     * into it.
-     */
-    
-    remain = 3000000;
-    fprintf(stderr, "X11.app: Received new $DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
-    while((remain = usleep(remain)) > 0);
-    
-    fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
-    DarwinListenOnOpenFD(launchd_fd);
-}
-
-static int create_socket(char *filename_out) {
-    struct sockaddr_un servaddr_un;
-    struct sockaddr *servaddr;
-    socklen_t servaddr_len;
-    int ret_fd;
-    size_t try, try_max;
-    
-    for(try=0, try_max=5; try < try_max; try++) {
-        tmpnam(filename_out);
-        
-        /* Setup servaddr_un */
-        memset (&servaddr_un, 0, sizeof (struct sockaddr_un));
-        servaddr_un.sun_family = AF_UNIX;
-        strlcpy(servaddr_un.sun_path, filename_out, sizeof(servaddr_un.sun_path));
-        
-        servaddr = (struct sockaddr *) &servaddr_un;
-        servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename_out);
-        
-        ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
-        if(ret_fd == -1) {
-            fprintf(stderr, "X11.app: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
-            continue;
-        }
-        
-        if(bind(ret_fd, servaddr, servaddr_len) != 0) {
-            fprintf(stderr, "X11.app: Failed to bind socket: %d - %s\n", errno, strerror(errno));
-            close(ret_fd);
-            return 0;
-        }
-        
-        if(listen(ret_fd, 10) != 0) {
-            fprintf(stderr, "X11.app: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno));
-            close(ret_fd);
-            return 0;
-        }
-        
-#ifdef DEBUG
-        fprintf(stderr, "X11.app: Listening on socket for fd handoff:  (%d) %s\n", ret_fd, filename_out);
-#endif
-        
-        return ret_fd;
-    }
-    
-    return 0;
-}
-
-static int launchd_socket_handed_off = 0;
-
-kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename) {
-    socket_handoff_t *handoff_data;
-    
-    launchd_socket_handed_off = 1;
-
-    handoff_data = (socket_handoff_t *)calloc(1,sizeof(socket_handoff_t));
-    if(!handoff_data) {
-        fprintf(stderr, "X11.app: Error allocating memory for handoff_data\n");
-        return KERN_FAILURE;
-    }
-
-    handoff_data->fd = create_socket(handoff_data->filename);
-    if(!handoff_data->fd) {
-        free(handoff_data);
-        return KERN_FAILURE;
-    }
-
-    strlcpy(filename, handoff_data->filename, STRING_T_SIZE);
-    
-    create_thread(socket_handoff_thread, handoff_data);
-    
-#ifdef DEBUG
-    fprintf(stderr, "X11.app: Thread created for handoff.  Returning success to tell caller to connect and push the fd.\n");
-#endif
-
-    return KERN_SUCCESS;
-}
-
-kern_return_t do_request_pid(mach_port_t port, int *my_pid) {
-    *my_pid = getpid();
-    return KERN_SUCCESS;
-}
-
-/*** Server Startup ***/
-kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
-                                  mach_msg_type_number_t argvCnt,
-                                  string_array_t envp,
-                                  mach_msg_type_number_t envpCnt) {
-    /* And now back to char ** */
-    char **_argv = alloca((argvCnt + 1) * sizeof(char *));
-    char **_envp = alloca((envpCnt + 1) * sizeof(char *));
-    size_t i;
-    
-    /* If we didn't get handed a launchd DISPLAY socket, we should
-     * unset DISPLAY or we can run into problems with pbproxy
-     */
-    if(!launchd_socket_handed_off) {
-        fprintf(stderr, "X11.app: No launchd socket handed off, unsetting DISPLAY\n");
-        unsetenv("DISPLAY");
-    }
-    
-    if(!_argv || !_envp) {
-        return KERN_FAILURE;
-    }
-
-    fprintf(stderr, "X11.app: do_start_x11_server(): argc=%d\n", argvCnt);
-    for(i=0; i < argvCnt; i++) {
-        _argv[i] = argv[i];
-        fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
-    }
-    _argv[argvCnt] = NULL;
-    
-    for(i=0; i < envpCnt; i++) {
-        _envp[i] = envp[i];
-    }
-    _envp[envpCnt] = NULL;
-    
-    if(server_main(argvCnt, _argv, _envp) == 0)
-        return KERN_SUCCESS;
-    else
-        return KERN_FAILURE;
-}
-
-static int startup_trigger(int argc, char **argv, char **envp) {
-    Display *display;
-    const char *s;
-    
-    /* Take care of the case where we're called like a normal DDX */
-    if(argc > 1 && argv[1][0] == ':') {
-        size_t i;
-        kern_return_t kr;
-        mach_port_t mp;
-        string_array_t newenvp;
-        string_array_t newargv;
-
-        /* We need to count envp */
-        int envpc;
-        for(envpc=0; envp[envpc]; envpc++);
-
-        /* We have fixed-size string lengths due to limitations in IPC,
-         * so we need to copy our argv and envp.
-         */
-        newargv = (string_array_t)alloca(argc * sizeof(string_t));
-        newenvp = (string_array_t)alloca(envpc * sizeof(string_t));
-        
-        if(!newargv || !newenvp) {
-            fprintf(stderr, "Memory allocation failure\n");
-            exit(EXIT_FAILURE);
-        }
-        
-        for(i=0; i < argc; i++) {
-            strlcpy(newargv[i], argv[i], STRING_T_SIZE);
-        }
-        for(i=0; i < envpc; i++) {
-            strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
-        }
-
-        kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
-        if (kr != KERN_SUCCESS) {
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
-            fprintf(stderr, "bootstrap_look_up(%s): %s\n", server_bootstrap_name, bootstrap_strerror(kr));
-#else
-            fprintf(stderr, "bootstrap_look_up(%s): %ul\n", server_bootstrap_name, (unsigned long)kr);
-#endif
-            exit(EXIT_FAILURE);
-        }
-
-        kr = start_x11_server(mp, newargv, argc, newenvp, envpc);
-        if (kr != KERN_SUCCESS) {
-            fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr));
-            exit(EXIT_FAILURE);
-        }
-        exit(EXIT_SUCCESS);
-    }
-
-    /* If we have a process serial number and it's our only arg, act as if
-     * the user double clicked the app bundle: launch app_to_run if possible
-     */
-    if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) {
-        /* Now, try to open a display, if so, run the launcher */
-        display = XOpenDisplay(NULL);
-        if(display) {
-            /* Could open the display, start the launcher */
-            XCloseDisplay(display);
-
-            return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT));
-        }
-    }
-
-    /* Start the server */
-    if((s = getenv("DISPLAY"))) {
-        fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting).  Starting X server.\n", s);
-        unsetenv("DISPLAY");
-    } else {
-        fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set).  Starting X server.\n");
-    }
-    return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
-}
-
-/** Setup the environment we want our child processes to inherit */
-static void ensure_path(const char *dir) {
-    char buf[1024], *temp;
-    
-    /* Make sure /usr/X11/bin is in the $PATH */
-    temp = getenv("PATH");
-    if(temp == NULL || temp[0] == 0) {
-        snprintf(buf, sizeof(buf), "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", dir);
-        setenv("PATH", buf, TRUE);
-    } else if(strnstr(temp, X11BINDIR, sizeof(temp)) == NULL) {
-        snprintf(buf, sizeof(buf), "%s:%s", temp, dir);
-        setenv("PATH", buf, TRUE);
-    }
-}
-
-static void setup_env(void) {
-    char *temp;
-    const char *pds = NULL;
-    const char *disp = getenv("DISPLAY");
-    size_t len;
-
-    /* Pass on our prefs domain to startx and its inheritors (mainly for
-     * quartz-wm and the Xquartz stub's MachIPC)
-     */
-    CFBundleRef bundle = CFBundleGetMainBundle();
-    if(bundle) {
-        CFStringRef pd = CFBundleGetIdentifier(bundle);
-        if(pd) {
-            pds = CFStringGetCStringPtr(pd, 0);
-        }
-    }
-
-    /* fallback to hardcoded value if we can't discover it */
-    if(!pds) {
-        pds = LAUNCHD_ID_PREFIX".X11";
-    }
-
-    server_bootstrap_name = strdup(pds);
-    if(!server_bootstrap_name) {
-        fprintf(stderr, "X11.app: Memory allocation error.\n");
-        exit(1);
-    }
-    setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1);
-    
-    len = strlen(server_bootstrap_name);
-    launchd_id_prefix = malloc(sizeof(char) * (len - 3));
-    if(!launchd_id_prefix) {
-        fprintf(stderr, "X11.app: Memory allocation error.\n");
-        exit(1);
-    }
-    strlcpy(launchd_id_prefix, server_bootstrap_name, len - 3);
-    
-    /* We need to unset DISPLAY if it is not our socket */
-    if(disp) {
-        /* s = basename(disp) */
-        const char *d, *s;
-	    for(s = NULL, d = disp; *d; d++) {
-            if(*d == '/')
-                s = d + 1;
-        }
-
-        if(s && *s) {
-            if(strcmp(launchd_id_prefix, "org.x") == 0 && strcmp(s, ":0") == 0) {
-                fprintf(stderr, "X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
-            } else {
-                temp = (char *)malloc(sizeof(char) * len);
-                if(!temp) {
-                    fprintf(stderr, "X11.app: Memory allocation error creating space for socket name test.\n");
-                    exit(1);
-                }
-                strlcpy(temp, launchd_id_prefix, len);
-                strlcat(temp, ":0", len);
-            
-                if(strcmp(temp, s) != 0) {
-                    /* If we don't have a match, unset it. */
-                    fprintf(stderr, "X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", disp, launchd_id_prefix);
-                    unsetenv("DISPLAY");
-                }
-                free(temp);
-            }
-        } else {
-            /* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */
-            fprintf(stderr, "X11.app: DISPLAY does not look like a launchd set variable, unsetting.\n");
-            unsetenv("DISPLAY");
-        }
-    }
-
-    /* Make sure PATH is right */
-    ensure_path(X11BINDIR);
-    
-    /* cd $HOME */
-    temp = getenv("HOME");
-    if(temp != NULL && temp[0] != '\0')
-        chdir(temp);
-}
-
-/*** Main ***/
-int main(int argc, char **argv, char **envp) {
-    Bool listenOnly = FALSE;
-    int i;
-    mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE;
-    mach_port_t mp;
-    kern_return_t kr;
-
-    /* Setup our environment for our children */
-    setup_env();
-    
-    /* The server must not run the PanoramiX operations. */
-    noPanoramiXExtension = TRUE;
-
-    /* Setup the initial crasherporter info */
-    strlcpy(__crashreporter_info_buff__, __crashreporter_info__base, sizeof(__crashreporter_info_buff__));
-    
-    fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
-    for(i=0; i < argc; i++) {
-        fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
-        if(!strcmp(argv[i], "--listenonly")) {
-            listenOnly = TRUE;
-        }
-    }
-
-    mp = checkin_or_register(server_bootstrap_name);
-    if(mp == MACH_PORT_NULL) {
-        fprintf(stderr, "NULL mach service: %s", server_bootstrap_name);
-        return EXIT_FAILURE;
-    }
-    
-    /* Check if we need to do something other than listen, and make another
-     * thread handle it.
-     */
-    if(!listenOnly) {
-        pid_t child1, child2;
-        int status;
-
-        /* Do the fork-twice trick to avoid having to reap zombies */
-        child1 = fork();
-        switch (child1) {
-            case -1:                                /* error */
-                break;
-
-            case 0:                                 /* child1 */
-                child2 = fork();
-
-                switch (child2) {
-                    int max_files, i;
-
-                    case -1:                            /* error */
-                        break;
-
-                    case 0:                             /* child2 */
-                        /* close all open files except for standard streams */
-                        max_files = sysconf(_SC_OPEN_MAX);
-                        for(i = 3; i < max_files; i++)
-                            close(i);
-
-                        /* ensure stdin is on /dev/null */
-                        close(0);
-                        open("/dev/null", O_RDONLY);
-
-                        return startup_trigger(argc, argv, envp);
-
-                    default:                            /* parent (child1) */
-                        _exit(0);
-                }
-                break;
-
-            default:                                /* parent */
-              waitpid(child1, &status, 0);
-        }
-    }
-    
-    /* Main event loop */
-    fprintf(stderr, "Waiting for startup parameters via Mach IPC.\n");
-    kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0);
-    if (kr != KERN_SUCCESS) {
-        fprintf(stderr, "%s.X11(mp): %s\n", LAUNCHD_ID_PREFIX, mach_error_string(kr));
-        return EXIT_FAILURE;
-    }
-    
-    return EXIT_SUCCESS;
-}
-
-static int execute(const char *command) {
-    const char *newargv[4];
-    const char **p;
-    
-    newargv[0] = command_from_prefs("login_shell", DEFAULT_SHELL);
-    newargv[1] = "-c";
-    newargv[2] = command;
-    newargv[3] = NULL;
-    
-    fprintf(stderr, "X11.app: Launching %s:\n", command);
-    for(p=newargv; *p; p++) {
-        fprintf(stderr, "\targv[%ld] = %s\n", (long int)(p - newargv), *p);
-    }
-
-    execvp (newargv[0], (char * const *) newargv);
-    perror ("X11.app: Couldn't exec.");
-    return 1;
-}
-
-static char *command_from_prefs(const char *key, const char *default_value) {
-    char *command = NULL;
-    
-    CFStringRef cfKey;
-    CFPropertyListRef PlistRef;
-
-    if(!key)
-        return NULL;
-
-    cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII);
-
-    if(!cfKey)
-        return NULL;
-
-    PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication);
-    
-    if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
-        CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII);
-        int len = strlen(default_value) + 1;
-
-        if(!cfDefaultValue)
-            goto command_from_prefs_out;
-
-        CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication);
-        CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
-        CFRelease(cfDefaultValue);
-        
-        command = (char *)malloc(len * sizeof(char));
-        if(!command)
-            goto command_from_prefs_out;
-        strcpy(command, default_value);
-    } else {
-        int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
-        command = (char *)malloc(len * sizeof(char));
-        if(!command)
-            goto command_from_prefs_out;
-        CFStringGetCString((CFStringRef)PlistRef, command, len,  kCFStringEncodingASCII);
-    }
-
-command_from_prefs_out:
-    if (PlistRef)
-        CFRelease(PlistRef);
-    if(cfKey)
-        CFRelease(cfKey);
-    return command;
-}
+/* main.c -- X application launcher
+ 
+ Copyright (c) 2007 Jeremy Huddleston
+ Copyright (c) 2007 Apple 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 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 ABOVE LISTED COPYRIGHT
+ HOLDER(S) 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.
+ 
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <AvailabilityMacros.h>
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/Xlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <signal.h>
+
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+#else
+#include <pthread.h>
+#endif
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <fcntl.h>
+
+#include <mach/mach.h>
+#include <mach/mach_error.h>
+#include <servers/bootstrap.h>
+#include "mach_startup.h"
+#include "mach_startupServer.h"
+
+#include "launchd_fd.h"
+/* From darwinEvents.c ... but don't want to pull in all the server cruft */
+void DarwinListenOnOpenFD(int fd);
+
+extern int noPanoramiXExtension;
+
+#define DEFAULT_CLIENT X11BINDIR "/xterm"
+#define DEFAULT_STARTX X11BINDIR "/startx"
+#define DEFAULT_SHELL  "/bin/sh"
+
+#ifndef BUILD_DATE
+#define BUILD_DATE ""
+#endif
+#ifndef XSERVER_VERSION
+#define XSERVER_VERSION "?"
+#endif
+
+static char __crashreporter_info_buff__[4096] = {0};
+static const char *__crashreporter_info__ __attribute__((__used__)) = &__crashreporter_info_buff__[0];
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+// This is actually a toolchain requirement, but I'm not sure the correct check,
+// but it should be fine to just only include it for Leopard and later.  This line
+// just tells the linker to never strip this symbol (such as for space optimization)
+asm (".desc ___crashreporter_info__, 0x10");
+#endif
+
+static const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
+
+static char *launchd_id_prefix = NULL;
+static char *server_bootstrap_name = NULL;
+
+#define DEBUG 1
+
+/* This is in quartzStartup.c */
+int server_main(int argc, char **argv, char **envp);
+
+static int execute(const char *command);
+static char *command_from_prefs(const char *key, const char *default_value);
+
+#ifndef HAVE_LIBDISPATCH
+/*** Pthread Magics ***/
+static pthread_t create_thread(void *(*func)(void *), void *arg) {
+    pthread_attr_t attr;
+    pthread_t tid;
+	
+    pthread_attr_init (&attr);
+    pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
+    pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+    pthread_create (&tid, &attr, func, arg);
+    pthread_attr_destroy (&attr);
+	
+    return tid;
+}
+#endif
+
+/*** Mach-O IPC Stuffs ***/
+
+union MaxMsgSize {
+	union __RequestUnion__mach_startup_subsystem req;
+	union __ReplyUnion__mach_startup_subsystem rep; 
+};
+
+static mach_port_t checkin_or_register(char *bname) {
+    kern_return_t kr;
+    mach_port_t mp;
+
+    /* If we're started by launchd or the old mach_init */
+    kr = bootstrap_check_in(bootstrap_port, bname, &mp);
+    if (kr == KERN_SUCCESS)
+        return mp;
+
+    /* We probably were not started by launchd or the old mach_init */
+    kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp);
+    if (kr != KERN_SUCCESS) {
+        fprintf(stderr, "mach_port_allocate(): %s\n", mach_error_string(kr));
+        exit(EXIT_FAILURE);
+    }
+
+    kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND);
+    if (kr != KERN_SUCCESS) {
+        fprintf(stderr, "mach_port_insert_right(): %s\n", mach_error_string(kr));
+        exit(EXIT_FAILURE);
+    }
+
+    kr = bootstrap_register(bootstrap_port, bname, mp);
+    if (kr != KERN_SUCCESS) {
+        fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr));
+        exit(EXIT_FAILURE);
+    }
+
+    return mp;
+}
+
+/*** $DISPLAY handoff ***/
+static int accept_fd_handoff(int connected_fd) {
+    int launchd_fd;
+    
+    char databuf[] = "display";
+    struct iovec iov[1];
+    
+    union {
+        struct cmsghdr hdr;
+        char bytes[CMSG_SPACE(sizeof(int))];
+    } buf;
+    
+    struct msghdr msg;
+    struct cmsghdr *cmsg;
+
+    iov[0].iov_base = databuf;
+    iov[0].iov_len  = sizeof(databuf);
+    
+    msg.msg_iov = iov;
+    msg.msg_iovlen = 1;
+    msg.msg_control = buf.bytes;
+    msg.msg_controllen = sizeof(buf);
+    msg.msg_name = 0;
+    msg.msg_namelen = 0;
+    msg.msg_flags = 0;
+    
+    cmsg = CMSG_FIRSTHDR (&msg);
+    cmsg->cmsg_level = SOL_SOCKET;
+    cmsg->cmsg_type = SCM_RIGHTS;
+    cmsg->cmsg_len = CMSG_LEN(sizeof(int));
+    
+    msg.msg_controllen = cmsg->cmsg_len;
+    
+    *((int*)CMSG_DATA(cmsg)) = -1;
+    
+    if(recvmsg(connected_fd, &msg, 0) < 0) {
+        fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor.  recvmsg() error: %s\n", strerror(errno));
+        return -1;
+    }
+    
+    launchd_fd = *((int*)CMSG_DATA(cmsg));
+    
+    return launchd_fd;
+}
+
+typedef struct {
+    int fd;
+    string_t filename;
+} socket_handoff_t;
+
+/* This thread accepts an incoming connection and hands off the file
+ * descriptor for the new connection to accept_fd_handoff()
+ */
+#ifdef HAVE_LIBDISPATCH
+static void socket_handoff(socket_handoff_t *handoff_data) {
+#else
+static void *socket_handoff_thread(void *arg) {
+    socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
+#endif
+
+    int launchd_fd = -1;
+    int connected_fd;
+
+    /* Now actually get the passed file descriptor from this connection
+     * If we encounter an error, keep listening.
+     */
+    while(launchd_fd == -1) {
+        connected_fd = accept(handoff_data->fd, NULL, NULL);
+        if(connected_fd == -1) {
+            fprintf(stderr, "X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n", handoff_data->fd, strerror(errno));
+            sleep(2);
+            continue;
+        }
+
+        launchd_fd = accept_fd_handoff(connected_fd);
+        if(launchd_fd == -1)
+            fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor, no descriptor received?  Waiting for another connection.\n");
+
+        close(connected_fd);
+    }
+
+    close(handoff_data->fd);
+    unlink(handoff_data->filename);
+    free(handoff_data);
+        
+    fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
+    DarwinListenOnOpenFD(launchd_fd);
+
+#ifndef HAVE_LIBDISPATCH
+    return NULL;
+#endif
+}
+
+static int create_socket(char *filename_out) {
+    struct sockaddr_un servaddr_un;
+    struct sockaddr *servaddr;
+    socklen_t servaddr_len;
+    int ret_fd;
+    size_t try, try_max;
+    
+    for(try=0, try_max=5; try < try_max; try++) {
+        tmpnam(filename_out);
+        
+        /* Setup servaddr_un */
+        memset (&servaddr_un, 0, sizeof (struct sockaddr_un));
+        servaddr_un.sun_family = AF_UNIX;
+        strlcpy(servaddr_un.sun_path, filename_out, sizeof(servaddr_un.sun_path));
+        
+        servaddr = (struct sockaddr *) &servaddr_un;
+        servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename_out);
+        
+        ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
+        if(ret_fd == -1) {
+            fprintf(stderr, "X11.app: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
+            continue;
+        }
+        
+        if(bind(ret_fd, servaddr, servaddr_len) != 0) {
+            fprintf(stderr, "X11.app: Failed to bind socket: %d - %s\n", errno, strerror(errno));
+            close(ret_fd);
+            return 0;
+        }
+        
+        if(listen(ret_fd, 10) != 0) {
+            fprintf(stderr, "X11.app: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno));
+            close(ret_fd);
+            return 0;
+        }
+        
+#ifdef DEBUG
+        fprintf(stderr, "X11.app: Listening on socket for fd handoff:  (%d) %s\n", ret_fd, filename_out);
+#endif
+        
+        return ret_fd;
+    }
+    
+    return 0;
+}
+
+static int launchd_socket_handed_off = 0;
+
+kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename) {
+    socket_handoff_t *handoff_data;
+    
+    launchd_socket_handed_off = 1;
+
+    handoff_data = (socket_handoff_t *)calloc(1,sizeof(socket_handoff_t));
+    if(!handoff_data) {
+        fprintf(stderr, "X11.app: Error allocating memory for handoff_data\n");
+        return KERN_FAILURE;
+    }
+
+    handoff_data->fd = create_socket(handoff_data->filename);
+    if(!handoff_data->fd) {
+        free(handoff_data);
+        return KERN_FAILURE;
+    }
+
+    strlcpy(filename, handoff_data->filename, STRING_T_SIZE);
+
+#ifdef HAVE_LIBDISPATCH
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
+        socket_handoff(handoff_data);
+    });
+#else
+    create_thread(socket_handoff_thread, handoff_data);
+#endif
+    
+#ifdef DEBUG
+    fprintf(stderr, "X11.app: Thread created for handoff.  Returning success to tell caller to connect and push the fd.\n");
+#endif
+
+    return KERN_SUCCESS;
+}
+
+kern_return_t do_request_pid(mach_port_t port, int *my_pid) {
+    *my_pid = getpid();
+    return KERN_SUCCESS;
+}
+
+/*** Server Startup ***/
+kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
+                                  mach_msg_type_number_t argvCnt,
+                                  string_array_t envp,
+                                  mach_msg_type_number_t envpCnt) {
+    /* And now back to char ** */
+    char **_argv = alloca((argvCnt + 1) * sizeof(char *));
+    char **_envp = alloca((envpCnt + 1) * sizeof(char *));
+    size_t i;
+    
+    /* If we didn't get handed a launchd DISPLAY socket, we should
+     * unset DISPLAY or we can run into problems with pbproxy
+     */
+    if(!launchd_socket_handed_off) {
+        fprintf(stderr, "X11.app: No launchd socket handed off, unsetting DISPLAY\n");
+        unsetenv("DISPLAY");
+    }
+    
+    if(!_argv || !_envp) {
+        return KERN_FAILURE;
+    }
+
+    fprintf(stderr, "X11.app: do_start_x11_server(): argc=%d\n", argvCnt);
+    for(i=0; i < argvCnt; i++) {
+        _argv[i] = argv[i];
+        fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
+    }
+    _argv[argvCnt] = NULL;
+    
+    for(i=0; i < envpCnt; i++) {
+        _envp[i] = envp[i];
+    }
+    _envp[envpCnt] = NULL;
+    
+    if(server_main(argvCnt, _argv, _envp) == 0)
+        return KERN_SUCCESS;
+    else
+        return KERN_FAILURE;
+}
+
+static int startup_trigger(int argc, char **argv, char **envp) {
+    Display *display;
+    const char *s;
+    
+    /* Take care of the case where we're called like a normal DDX */
+    if(argc > 1 && argv[1][0] == ':') {
+        size_t i;
+        kern_return_t kr;
+        mach_port_t mp;
+        string_array_t newenvp;
+        string_array_t newargv;
+
+        /* We need to count envp */
+        int envpc;
+        for(envpc=0; envp[envpc]; envpc++);
+
+        /* We have fixed-size string lengths due to limitations in IPC,
+         * so we need to copy our argv and envp.
+         */
+        newargv = (string_array_t)alloca(argc * sizeof(string_t));
+        newenvp = (string_array_t)alloca(envpc * sizeof(string_t));
+        
+        if(!newargv || !newenvp) {
+            fprintf(stderr, "Memory allocation failure\n");
+            exit(EXIT_FAILURE);
+        }
+        
+        for(i=0; i < argc; i++) {
+            strlcpy(newargv[i], argv[i], STRING_T_SIZE);
+        }
+        for(i=0; i < envpc; i++) {
+            strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
+        }
+
+        kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
+        if (kr != KERN_SUCCESS) {
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+            fprintf(stderr, "bootstrap_look_up(%s): %s\n", server_bootstrap_name, bootstrap_strerror(kr));
+#else
+            fprintf(stderr, "bootstrap_look_up(%s): %ul\n", server_bootstrap_name, (unsigned long)kr);
+#endif
+            exit(EXIT_FAILURE);
+        }
+
+        kr = start_x11_server(mp, newargv, argc, newenvp, envpc);
+        if (kr != KERN_SUCCESS) {
+            fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr));
+            exit(EXIT_FAILURE);
+        }
+        exit(EXIT_SUCCESS);
+    }
+
+    /* If we have a process serial number and it's our only arg, act as if
+     * the user double clicked the app bundle: launch app_to_run if possible
+     */
+    if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) {
+        /* Now, try to open a display, if so, run the launcher */
+        display = XOpenDisplay(NULL);
+        if(display) {
+            /* Could open the display, start the launcher */
+            XCloseDisplay(display);
+
+            return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT));
+        }
+    }
+
+    /* Start the server */
+    if((s = getenv("DISPLAY"))) {
+        fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting).  Starting X server.\n", s);
+        unsetenv("DISPLAY");
+    } else {
+        fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set).  Starting X server.\n");
+    }
+    return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
+}
+
+/** Setup the environment we want our child processes to inherit */
+static void ensure_path(const char *dir) {
+    char buf[1024], *temp;
+    
+    /* Make sure /usr/X11/bin is in the $PATH */
+    temp = getenv("PATH");
+    if(temp == NULL || temp[0] == 0) {
+        snprintf(buf, sizeof(buf), "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", dir);
+        setenv("PATH", buf, TRUE);
+    } else if(strnstr(temp, X11BINDIR, sizeof(temp)) == NULL) {
+        snprintf(buf, sizeof(buf), "%s:%s", temp, dir);
+        setenv("PATH", buf, TRUE);
+    }
+}
+
+static void setup_env(void) {
+    char *temp;
+    const char *pds = NULL;
+    const char *disp = getenv("DISPLAY");
+    size_t len;
+
+    /* Pass on our prefs domain to startx and its inheritors (mainly for
+     * quartz-wm and the Xquartz stub's MachIPC)
+     */
+    CFBundleRef bundle = CFBundleGetMainBundle();
+    if(bundle) {
+        CFStringRef pd = CFBundleGetIdentifier(bundle);
+        if(pd) {
+            pds = CFStringGetCStringPtr(pd, 0);
+        }
+    }
+
+    /* fallback to hardcoded value if we can't discover it */
+    if(!pds) {
+        pds = LAUNCHD_ID_PREFIX".X11";
+    }
+
+    server_bootstrap_name = strdup(pds);
+    if(!server_bootstrap_name) {
+        fprintf(stderr, "X11.app: Memory allocation error.\n");
+        exit(1);
+    }
+    setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1);
+    
+    len = strlen(server_bootstrap_name);
+    launchd_id_prefix = malloc(sizeof(char) * (len - 3));
+    if(!launchd_id_prefix) {
+        fprintf(stderr, "X11.app: Memory allocation error.\n");
+        exit(1);
+    }
+    strlcpy(launchd_id_prefix, server_bootstrap_name, len - 3);
+    
+    /* We need to unset DISPLAY if it is not our socket */
+    if(disp) {
+        /* s = basename(disp) */
+        const char *d, *s;
+	    for(s = NULL, d = disp; *d; d++) {
+            if(*d == '/')
+                s = d + 1;
+        }
+
+        if(s && *s) {
+            if(strcmp(launchd_id_prefix, "org.x") == 0 && strcmp(s, ":0") == 0) {
+                fprintf(stderr, "X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
+            } else {
+                temp = (char *)malloc(sizeof(char) * len);
+                if(!temp) {
+                    fprintf(stderr, "X11.app: Memory allocation error creating space for socket name test.\n");
+                    exit(1);
+                }
+                strlcpy(temp, launchd_id_prefix, len);
+                strlcat(temp, ":0", len);
+            
+                if(strcmp(temp, s) != 0) {
+                    /* If we don't have a match, unset it. */
+                    fprintf(stderr, "X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", disp, launchd_id_prefix);
+                    unsetenv("DISPLAY");
+                }
+                free(temp);
+            }
+        } else {
+            /* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */
+            fprintf(stderr, "X11.app: DISPLAY does not look like a launchd set variable, unsetting.\n");
+            unsetenv("DISPLAY");
+        }
+    }
+
+    /* Make sure PATH is right */
+    ensure_path(X11BINDIR);
+    
+    /* cd $HOME */
+    temp = getenv("HOME");
+    if(temp != NULL && temp[0] != '\0')
+        chdir(temp);
+}
+
+/*** Main ***/
+int main(int argc, char **argv, char **envp) {
+    Bool listenOnly = FALSE;
+    int i;
+    mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE;
+    mach_port_t mp;
+    kern_return_t kr;
+
+    /* Setup our environment for our children */
+    setup_env();
+    
+    /* The server must not run the PanoramiX operations. */
+    noPanoramiXExtension = TRUE;
+
+    /* Setup the initial crasherporter info */
+    strlcpy(__crashreporter_info_buff__, __crashreporter_info__base, sizeof(__crashreporter_info_buff__));
+    
+    fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
+    for(i=0; i < argc; i++) {
+        fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
+        if(!strcmp(argv[i], "--listenonly")) {
+            listenOnly = TRUE;
+        }
+    }
+
+    mp = checkin_or_register(server_bootstrap_name);
+    if(mp == MACH_PORT_NULL) {
+        fprintf(stderr, "NULL mach service: %s", server_bootstrap_name);
+        return EXIT_FAILURE;
+    }
+    
+    /* Check if we need to do something other than listen, and make another
+     * thread handle it.
+     */
+    if(!listenOnly) {
+        pid_t child1, child2;
+        int status;
+
+        /* Do the fork-twice trick to avoid having to reap zombies */
+        child1 = fork();
+        switch (child1) {
+            case -1:                                /* error */
+                break;
+
+            case 0:                                 /* child1 */
+                child2 = fork();
+
+                switch (child2) {
+                    int max_files, i;
+
+                    case -1:                            /* error */
+                        break;
+
+                    case 0:                             /* child2 */
+                        /* close all open files except for standard streams */
+                        max_files = sysconf(_SC_OPEN_MAX);
+                        for(i = 3; i < max_files; i++)
+                            close(i);
+
+                        /* ensure stdin is on /dev/null */
+                        close(0);
+                        open("/dev/null", O_RDONLY);
+
+                        return startup_trigger(argc, argv, envp);
+
+                    default:                            /* parent (child1) */
+                        _exit(0);
+                }
+                break;
+
+            default:                                /* parent */
+              waitpid(child1, &status, 0);
+        }
+    }
+    
+    /* Main event loop */
+    fprintf(stderr, "Waiting for startup parameters via Mach IPC.\n");
+    kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0);
+    if (kr != KERN_SUCCESS) {
+        fprintf(stderr, "%s.X11(mp): %s\n", LAUNCHD_ID_PREFIX, mach_error_string(kr));
+        return EXIT_FAILURE;
+    }
+    
+    return EXIT_SUCCESS;
+}
+
+static int execute(const char *command) {
+    const char *newargv[4];
+    const char **p;
+    
+    newargv[0] = command_from_prefs("login_shell", DEFAULT_SHELL);
+    newargv[1] = "-c";
+    newargv[2] = command;
+    newargv[3] = NULL;
+    
+    fprintf(stderr, "X11.app: Launching %s:\n", command);
+    for(p=newargv; *p; p++) {
+        fprintf(stderr, "\targv[%ld] = %s\n", (long int)(p - newargv), *p);
+    }
+
+    execvp (newargv[0], (char * const *) newargv);
+    perror ("X11.app: Couldn't exec.");
+    return 1;
+}
+
+static char *command_from_prefs(const char *key, const char *default_value) {
+    char *command = NULL;
+    
+    CFStringRef cfKey;
+    CFPropertyListRef PlistRef;
+
+    if(!key)
+        return NULL;
+
+    cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII);
+
+    if(!cfKey)
+        return NULL;
+
+    PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication);
+    
+    if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
+        CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII);
+        int len = strlen(default_value) + 1;
+
+        if(!cfDefaultValue)
+            goto command_from_prefs_out;
+
+        CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication);
+        CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+        CFRelease(cfDefaultValue);
+        
+        command = (char *)malloc(len * sizeof(char));
+        if(!command)
+            goto command_from_prefs_out;
+        strcpy(command, default_value);
+    } else {
+        int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
+        command = (char *)malloc(len * sizeof(char));
+        if(!command)
+            goto command_from_prefs_out;
+        CFStringGetCString((CFStringRef)PlistRef, command, len,  kCFStringEncodingASCII);
+    }
+
+command_from_prefs_out:
+    if (PlistRef)
+        CFRelease(PlistRef);
+    if(cfKey)
+        CFRelease(cfKey);
+    return command;
+}
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
index 94318969f..912e2de1c 100644
--- a/xorg-server/hw/xwin/winkeybd.c
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -1,531 +1,531 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), 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 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 XFREE86 PROJECT 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.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors:	Dakshinamurthy Karra
- *		Suhaib M Siddiqi
- *		Peter Busch
- *		Harold L Hunt II
- */
-
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-#include "winkeybd.h"
-#include "winconfig.h"
-#include "winmsg.h"
-
-#include "xkbsrv.h"
-
-static Bool g_winKeyState[NUM_KEYCODES];
-
-/*
- * Local prototypes
- */
-
-static void
-winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
-	      pointer pCtrl, int iClass);
-
-static void
-winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl);
-
-
-/* 
- * Translate a Windows WM_[SYS]KEY(UP/DOWN) message
- * into an ASCII scan code.
- *
- * We do this ourselves, rather than letting Windows handle it,
- * because Windows tends to munge the handling of special keys,
- * like AltGr on European keyboards.
- */
-
-void
-winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
-{
-  int		iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
-  int		iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
-  int		iParam = HIWORD (lParam);
-  int		iParamScanCode = LOBYTE (iParam);
-
-  winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
-
-/* WM_ key messages faked by Vista speech recognition (WSR) don't have a
- * scan code.
- *
- * Vocola 3 (Rick Mohr's supplement to WSR) uses
- * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a
- * scan code of 1
- */
-  if (iParamScanCode <= 1)
-    {
-      if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
-        /* Trigger special case table to translate to extended
-         * keycode, otherwise if num_lock is on, we can get keypad
-         * numbers instead of navigation keys. */
-        iParam |= KF_EXTENDED;
-      else
-        iParamScanCode = MapVirtualKeyEx(wParam,
-                         /*MAPVK_VK_TO_VSC*/0,
-                         GetKeyboardLayout(0));
-    }
-
-  /* Branch on special extended, special non-extended, or normal key */
-  if ((iParam & KF_EXTENDED) && iKeyFixupEx)
-    *piScanCode = iKeyFixupEx;
-  else if (iKeyFixup)
-    *piScanCode = iKeyFixup;
-  else if (wParam == 0 && iParamScanCode == 0x70)
-    *piScanCode = KEY_HKTG;
-  else
-    switch (iParamScanCode)
-    {
-      case 0x70:
-        *piScanCode = KEY_HKTG;
-        break;
-      case 0x73:
-        *piScanCode = KEY_BSlash2;
-        break;
-      default: 
-        *piScanCode = iParamScanCode;
-        break;
-    }
-}
-
-
-/* Ring the keyboard bell (system speaker on PCs) */
-static void
-winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
-	      pointer pCtrl, int iClass)
-{
-  /*
-   * We can't use Beep () here because it uses the PC speaker
-   * on NT/2000.  MessageBeep (MB_OK) will play the default system
-   * sound on systems with a sound card or it will beep the PC speaker
-   * on systems that do not have a sound card.
-   */
-  MessageBeep (MB_OK);
-}
-
-
-/* Change some keyboard configuration parameters */
-static void
-winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
-{
-}
-
-
-/* 
- * See Porting Layer Definition - p. 18
- * winKeybdProc is known as a DeviceProc.
- */
-
-int
-winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
-{
-  DevicePtr		pDevice = (DevicePtr) pDeviceInt;
-  XkbSrvInfoPtr       xkbi;
-  XkbControlsPtr      ctrl;
-
-  switch (iState)
-    {
-    case DEVICE_INIT:
-      winConfigKeyboard (pDeviceInt);
-
-      /* FIXME: Maybe we should use winGetKbdLeds () here? */
-      defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
-
-      winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
-                    " Variant = \"%s\" Options = \"%s\"\n",
-                    g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none",
-                    g_winInfo.xkb.model ? g_winInfo.xkb.model : "none",
-                    g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none",
-                    g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none",
-                    g_winInfo.xkb.options ? g_winInfo.xkb.options : "none");
-
-      InitKeyboardDeviceStruct (pDeviceInt,
-                                &g_winInfo.xkb,
-                                winKeybdBell,
-                                winKeybdCtrl);
-
-      xkbi = pDeviceInt->key->xkbInfo;
-      if ((xkbi != NULL) && (xkbi->desc != NULL))
-        {
-          ctrl = xkbi->desc->ctrls;
-          ctrl->repeat_delay = g_winInfo.keyboard.delay;
-          ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
-        }
-      else
-        {
-          winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat\n");
-        }
-
-      break;
-      
-    case DEVICE_ON: 
-      pDevice->on = TRUE;
-
-      // immediately copy the state of this keyboard device to the VCK
-      // (which otherwise happens lazily after the first keypress)
-      CopyKeyClass(pDeviceInt, inputInfo.keyboard);
-      break;
-
-    case DEVICE_CLOSE:
-    case DEVICE_OFF: 
-      pDevice->on = FALSE;
-      break;
-    }
-
-  return Success;
-}
-
-
-/*
- * Detect current mode key states upon server startup.
- *
- * Simulate a press and release of any key that is currently
- * toggled.
- */
-
-void
-winInitializeModeKeyStates (void)
-{
-  /* Restore NumLock */
-  if (GetKeyState (VK_NUMLOCK) & 0x0001)
-    {
-      winSendKeyEvent (KEY_NumLock, TRUE);
-      winSendKeyEvent (KEY_NumLock, FALSE);
-    }
-
-  /* Restore CapsLock */
-  if (GetKeyState (VK_CAPITAL) & 0x0001)
-    {
-      winSendKeyEvent (KEY_CapsLock, TRUE);
-      winSendKeyEvent (KEY_CapsLock, FALSE);
-    }
-
-  /* Restore ScrollLock */
-  if (GetKeyState (VK_SCROLL) & 0x0001)
-    {
-      winSendKeyEvent (KEY_ScrollLock, TRUE);
-      winSendKeyEvent (KEY_ScrollLock, FALSE);
-    }
-
-  /* Restore KanaLock */
-  if (GetKeyState (VK_KANA) & 0x0001)
-    {
-      winSendKeyEvent (KEY_HKTG, TRUE);
-      winSendKeyEvent (KEY_HKTG, FALSE);
-    }
-}
-
-
-/*
- * Upon regaining the keyboard focus we must
- * resynchronize our internal mode key states
- * with the actual state of the keys.
- */
-
-void
-winRestoreModeKeyStates (void)
-{
-  DWORD			dwKeyState;
-  BOOL			processEvents = TRUE;
-  unsigned short	internalKeyStates;
-
-  /* X server is being initialized */
-  if (!inputInfo.keyboard)
-    return;
-
-  /* Only process events if the rootwindow is mapped. The keyboard events
-   * will cause segfaults otherwise */
-  if (screenInfo.screens[0]->root && screenInfo.screens[0]->root->mapped == FALSE)
-    processEvents = FALSE;    
-  
-  /* Force to process all pending events in the mi event queue */
-  if (processEvents)
-    mieqProcessInputEvents ();
-  
-  /* Read the mode key states of our X server */
-  /* (stored in the virtual core keyboard) */
-  internalKeyStates = XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state);
-  winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
-
-  /* 
-   * NOTE: The C XOR operator, ^, will not work here because it is
-   * a bitwise operator, not a logical operator.  C does not
-   * have a logical XOR operator, so we use a macro instead.
-   */
-
-  /* Has the key state changed? */
-  dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
-  if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
-    {
-      winSendKeyEvent (KEY_NumLock, TRUE);
-      winSendKeyEvent (KEY_NumLock, FALSE);
-    }
-
-  /* Has the key state changed? */
-  dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001;
-  if (WIN_XOR (internalKeyStates & LockMask, dwKeyState))
-    {
-      winSendKeyEvent (KEY_CapsLock, TRUE);
-      winSendKeyEvent (KEY_CapsLock, FALSE);
-    }
-
-  /* Has the key state changed? */
-  dwKeyState = GetKeyState (VK_SCROLL) & 0x0001;
-  if (WIN_XOR (internalKeyStates & ScrollLockMask, dwKeyState))
-    {
-      winSendKeyEvent (KEY_ScrollLock, TRUE);
-      winSendKeyEvent (KEY_ScrollLock, FALSE);
-    }
-
-  /* Has the key state changed? */
-  dwKeyState = GetKeyState (VK_KANA) & 0x0001;
-  if (WIN_XOR (internalKeyStates & KanaMask, dwKeyState))
-    {
-      winSendKeyEvent (KEY_HKTG, TRUE);
-      winSendKeyEvent (KEY_HKTG, FALSE);
-    }
-}
-
-
-/*
- * Look for the lovely fake Control_L press/release generated by Windows
- * when AltGr is pressed/released on a non-U.S. keyboard.
- */
-
-Bool
-winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
-{
-  MSG		msgNext;
-  LONG		lTime;
-  Bool		fReturn;
-
-  /*
-   * Fake Ctrl_L presses will be followed by an Alt_R keypress
-   * with the same timestamp as the Ctrl_L press.
-   */
-  if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
-      && wParam == VK_CONTROL
-      && (HIWORD (lParam) & KF_EXTENDED) == 0)
-    {
-      /* Got a Ctrl_L press */
-
-      /* Get time of current message */
-      lTime = GetMessageTime ();
-
-      /* Look for fake Ctrl_L preceeding an Alt_R press. */
-      fReturn = PeekMessage (&msgNext, NULL,
-			     WM_KEYDOWN, WM_SYSKEYDOWN,
-			     PM_NOREMOVE);
-
-      /*
-       * Try again if the first call fails.
-       * NOTE: This usually happens when TweakUI is enabled.
-       */
-      if (!fReturn)
-	{
-	  /* Voodoo to make sure that the Alt_R message has posted */
-	  Sleep (0);
-
-	  /* Look for fake Ctrl_L preceeding an Alt_R press. */
-	  fReturn = PeekMessage (&msgNext, NULL,
-				 WM_KEYDOWN, WM_SYSKEYDOWN,
-				 PM_NOREMOVE);
-	}
-      if (msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN)
-          fReturn = 0;
-
-      /* Is next press an Alt_R with the same timestamp? */
-      if (fReturn && msgNext.wParam == VK_MENU
-	  && msgNext.time == lTime
-	  && (HIWORD (msgNext.lParam) & KF_EXTENDED))
-	{
-	  /* 
-	   * Next key press is Alt_R with same timestamp as current
-	   * Ctrl_L message.  Therefore, this Ctrl_L press is a fake
-	   * event, so discard it.
-	   */
-	  return TRUE;
-	}
-    }
-
-  /* 
-   * Fake Ctrl_L releases will be followed by an Alt_R release
-   * with the same timestamp as the Ctrl_L release.
-   */
-  if ((message == WM_KEYUP || message == WM_SYSKEYUP)
-      && wParam == VK_CONTROL
-      && (HIWORD (lParam) & KF_EXTENDED) == 0)
-    {
-      /* Got a Ctrl_L release */
-
-      /* Get time of current message */
-      lTime = GetMessageTime ();
-
-      /* Look for fake Ctrl_L release preceeding an Alt_R release. */
-      fReturn = PeekMessage (&msgNext, NULL,
-			     WM_KEYUP, WM_SYSKEYUP, 
-			     PM_NOREMOVE);
-
-      /*
-       * Try again if the first call fails.
-       * NOTE: This usually happens when TweakUI is enabled.
-       */
-      if (!fReturn)
-	{
-	  /* Voodoo to make sure that the Alt_R message has posted */
-	  Sleep (0);
-
-	  /* Look for fake Ctrl_L release preceeding an Alt_R release. */
-	  fReturn = PeekMessage (&msgNext, NULL,
-				 WM_KEYUP, WM_SYSKEYUP, 
-				 PM_NOREMOVE);
-	}
-
-      if (msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP)
-          fReturn = 0;
-      
-      /* Is next press an Alt_R with the same timestamp? */
-      if (fReturn
-	  && (msgNext.message == WM_KEYUP
-	      || msgNext.message == WM_SYSKEYUP)
-	  && msgNext.wParam == VK_MENU
-	  && msgNext.time == lTime
-	  && (HIWORD (msgNext.lParam) & KF_EXTENDED))
-	{
-	  /*
-	   * Next key release is Alt_R with same timestamp as current
-	   * Ctrl_L message. Therefore, this Ctrl_L release is a fake
-	   * event, so discard it.
-	   */
-	  return TRUE;
-	}
-    }
-  
-  /* Not a fake control left press/release */
-  return FALSE;
-}
-
-
-/*
- * Lift any modifier keys that are pressed
- */
-
-void
-winKeybdReleaseKeys (void)
-{
-  int				i;
-
-#ifdef HAS_DEVWINDOWS
-  /* Verify that the mi input system has been initialized */
-  if (g_fdMessageQueue == WIN_FD_INVALID)
-    return;
-#endif
-
-  /* Loop through all keys */
-  for (i = 0; i < NUM_KEYCODES; ++i)
-    {
-      /* Pop key if pressed */
-      if (g_winKeyState[i])
-	winSendKeyEvent (i, FALSE);
-
-      /* Reset pressed flag for keys */
-      g_winKeyState[i] = FALSE;
-    }
-}
-
-
-/*
- * Take a raw X key code and send an up or down event for it.
- *
- * Thanks to VNC for inspiration, though it is a simple function.
- */
-
-void
-winSendKeyEvent (DWORD dwKey, Bool fDown)
-{
-  EventListPtr events;
-  int i, nevents;
-
-  /*
-   * When alt-tabing between screens we can get phantom key up messages
-   * Here we only pass them through it we think we should!
-   */
-  if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return;
-
-  /* Update the keyState map */
-  g_winKeyState[dwKey] = fDown;
-
-  GetEventList(&events);
-  nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE);
-
-  for (i = 0; i < nevents; i++)
-    mieqEnqueue(g_pwinKeyboard, (InternalEvent*)events[i].event);
-
-  winDebug("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n",
-           dwKey, fDown, nevents);
-}
-
-BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
-{
-  switch (wParam)
-  {
-    case VK_CONTROL:
-      if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
-        return TRUE;
-      if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
-        return TRUE;
-      break;
-    case VK_SHIFT:
-      if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
-        return TRUE;
-      if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
-        return TRUE;
-      break;
-    default:
-      return TRUE;
-  }
-  return FALSE;
-}
-
-/* Only on shift release message is sent even if both are pressed.
- * Fix this here 
- */
-void winFixShiftKeys (int iScanCode)
-{
-  if (GetKeyState (VK_SHIFT) & 0x8000)
-    return;
-
-  if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
-    winSendKeyEvent (KEY_ShiftR, FALSE);
-  if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
-    winSendKeyEvent (KEY_ShiftL, FALSE);
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), 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 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 XFREE86 PROJECT 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.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors:	Dakshinamurthy Karra
+ *		Suhaib M Siddiqi
+ *		Peter Busch
+ *		Harold L Hunt II
+ */
+
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winkeybd.h"
+#include "winconfig.h"
+#include "winmsg.h"
+
+#include "xkbsrv.h"
+
+static Bool g_winKeyState[NUM_KEYCODES];
+
+/*
+ * Local prototypes
+ */
+
+static void
+winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
+	      pointer pCtrl, int iClass);
+
+static void
+winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl);
+
+
+/* 
+ * Translate a Windows WM_[SYS]KEY(UP/DOWN) message
+ * into an ASCII scan code.
+ *
+ * We do this ourselves, rather than letting Windows handle it,
+ * because Windows tends to munge the handling of special keys,
+ * like AltGr on European keyboards.
+ */
+
+void
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
+{
+  int		iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
+  int		iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
+  int		iParam = HIWORD (lParam);
+  int		iParamScanCode = LOBYTE (iParam);
+
+  winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
+
+/* WM_ key messages faked by Vista speech recognition (WSR) don't have a
+ * scan code.
+ *
+ * Vocola 3 (Rick Mohr's supplement to WSR) uses
+ * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a
+ * scan code of 1
+ */
+  if (iParamScanCode <= 1)
+    {
+      if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
+        /* Trigger special case table to translate to extended
+         * keycode, otherwise if num_lock is on, we can get keypad
+         * numbers instead of navigation keys. */
+        iParam |= KF_EXTENDED;
+      else
+        iParamScanCode = MapVirtualKeyEx(wParam,
+                         /*MAPVK_VK_TO_VSC*/0,
+                         GetKeyboardLayout(0));
+    }
+
+  /* Branch on special extended, special non-extended, or normal key */
+  if ((iParam & KF_EXTENDED) && iKeyFixupEx)
+    *piScanCode = iKeyFixupEx;
+  else if (iKeyFixup)
+    *piScanCode = iKeyFixup;
+  else if (wParam == 0 && iParamScanCode == 0x70)
+    *piScanCode = KEY_HKTG;
+  else
+    switch (iParamScanCode)
+    {
+      case 0x70:
+        *piScanCode = KEY_HKTG;
+        break;
+      case 0x73:
+        *piScanCode = KEY_BSlash2;
+        break;
+      default: 
+        *piScanCode = iParamScanCode;
+        break;
+    }
+}
+
+
+/* Ring the keyboard bell (system speaker on PCs) */
+static void
+winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
+	      pointer pCtrl, int iClass)
+{
+  /*
+   * We can't use Beep () here because it uses the PC speaker
+   * on NT/2000.  MessageBeep (MB_OK) will play the default system
+   * sound on systems with a sound card or it will beep the PC speaker
+   * on systems that do not have a sound card.
+   */
+  MessageBeep (MB_OK);
+}
+
+
+/* Change some keyboard configuration parameters */
+static void
+winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
+{
+}
+
+
+/* 
+ * See Porting Layer Definition - p. 18
+ * winKeybdProc is known as a DeviceProc.
+ */
+
+int
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
+{
+  DevicePtr		pDevice = (DevicePtr) pDeviceInt;
+  XkbSrvInfoPtr       xkbi;
+  XkbControlsPtr      ctrl;
+
+  switch (iState)
+    {
+    case DEVICE_INIT:
+      winConfigKeyboard (pDeviceInt);
+
+      /* FIXME: Maybe we should use winGetKbdLeds () here? */
+      defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
+
+      winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
+                    " Variant = \"%s\" Options = \"%s\"\n",
+                    g_winInfo.xkb.rules ? g_winInfo.xkb.rules : "none",
+                    g_winInfo.xkb.model ? g_winInfo.xkb.model : "none",
+                    g_winInfo.xkb.layout ? g_winInfo.xkb.layout : "none",
+                    g_winInfo.xkb.variant ? g_winInfo.xkb.variant : "none",
+                    g_winInfo.xkb.options ? g_winInfo.xkb.options : "none");
+
+      InitKeyboardDeviceStruct (pDeviceInt,
+                                &g_winInfo.xkb,
+                                winKeybdBell,
+                                winKeybdCtrl);
+
+      xkbi = pDeviceInt->key->xkbInfo;
+      if ((xkbi != NULL) && (xkbi->desc != NULL))
+        {
+          ctrl = xkbi->desc->ctrls;
+          ctrl->repeat_delay = g_winInfo.keyboard.delay;
+          ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
+        }
+      else
+        {
+          winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat\n");
+        }
+
+      break;
+      
+    case DEVICE_ON: 
+      pDevice->on = TRUE;
+
+      // immediately copy the state of this keyboard device to the VCK
+      // (which otherwise happens lazily after the first keypress)
+      CopyKeyClass(pDeviceInt, inputInfo.keyboard);
+      break;
+
+    case DEVICE_CLOSE:
+    case DEVICE_OFF: 
+      pDevice->on = FALSE;
+      break;
+    }
+
+  return Success;
+}
+
+
+/*
+ * Detect current mode key states upon server startup.
+ *
+ * Simulate a press and release of any key that is currently
+ * toggled.
+ */
+
+void
+winInitializeModeKeyStates (void)
+{
+  /* Restore NumLock */
+  if (GetKeyState (VK_NUMLOCK) & 0x0001)
+    {
+      winSendKeyEvent (KEY_NumLock, TRUE);
+      winSendKeyEvent (KEY_NumLock, FALSE);
+    }
+
+  /* Restore CapsLock */
+  if (GetKeyState (VK_CAPITAL) & 0x0001)
+    {
+      winSendKeyEvent (KEY_CapsLock, TRUE);
+      winSendKeyEvent (KEY_CapsLock, FALSE);
+    }
+
+  /* Restore ScrollLock */
+  if (GetKeyState (VK_SCROLL) & 0x0001)
+    {
+      winSendKeyEvent (KEY_ScrollLock, TRUE);
+      winSendKeyEvent (KEY_ScrollLock, FALSE);
+    }
+
+  /* Restore KanaLock */
+  if (GetKeyState (VK_KANA) & 0x0001)
+    {
+      winSendKeyEvent (KEY_HKTG, TRUE);
+      winSendKeyEvent (KEY_HKTG, FALSE);
+    }
+}
+
+
+/*
+ * Upon regaining the keyboard focus we must
+ * resynchronize our internal mode key states
+ * with the actual state of the keys.
+ */
+
+void
+winRestoreModeKeyStates (void)
+{
+  DWORD			dwKeyState;
+  BOOL			processEvents = TRUE;
+  unsigned short	internalKeyStates;
+
+  /* X server is being initialized */
+  if (!inputInfo.keyboard)
+    return;
+
+  /* Only process events if the rootwindow is mapped. The keyboard events
+   * will cause segfaults otherwise */
+  if (screenInfo.screens[0]->root && screenInfo.screens[0]->root->mapped == FALSE)
+    processEvents = FALSE;    
+  
+  /* Force to process all pending events in the mi event queue */
+  if (processEvents)
+    mieqProcessInputEvents ();
+  
+  /* Read the mode key states of our X server */
+  /* (stored in the virtual core keyboard) */
+  internalKeyStates = XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state);
+  winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
+
+  /* 
+   * NOTE: The C XOR operator, ^, will not work here because it is
+   * a bitwise operator, not a logical operator.  C does not
+   * have a logical XOR operator, so we use a macro instead.
+   */
+
+  /* Has the key state changed? */
+  dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
+  if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
+    {
+      winSendKeyEvent (KEY_NumLock, TRUE);
+      winSendKeyEvent (KEY_NumLock, FALSE);
+    }
+
+  /* Has the key state changed? */
+  dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001;
+  if (WIN_XOR (internalKeyStates & LockMask, dwKeyState))
+    {
+      winSendKeyEvent (KEY_CapsLock, TRUE);
+      winSendKeyEvent (KEY_CapsLock, FALSE);
+    }
+
+  /* Has the key state changed? */
+  dwKeyState = GetKeyState (VK_SCROLL) & 0x0001;
+  if (WIN_XOR (internalKeyStates & ScrollLockMask, dwKeyState))
+    {
+      winSendKeyEvent (KEY_ScrollLock, TRUE);
+      winSendKeyEvent (KEY_ScrollLock, FALSE);
+    }
+
+  /* Has the key state changed? */
+  dwKeyState = GetKeyState (VK_KANA) & 0x0001;
+  if (WIN_XOR (internalKeyStates & KanaMask, dwKeyState))
+    {
+      winSendKeyEvent (KEY_HKTG, TRUE);
+      winSendKeyEvent (KEY_HKTG, FALSE);
+    }
+}
+
+
+/*
+ * Look for the lovely fake Control_L press/release generated by Windows
+ * when AltGr is pressed/released on a non-U.S. keyboard.
+ */
+
+Bool
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
+{
+  MSG		msgNext;
+  LONG		lTime;
+  Bool		fReturn;
+
+  /*
+   * Fake Ctrl_L presses will be followed by an Alt_R keypress
+   * with the same timestamp as the Ctrl_L press.
+   */
+  if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
+      && wParam == VK_CONTROL
+      && (HIWORD (lParam) & KF_EXTENDED) == 0)
+    {
+      /* Got a Ctrl_L press */
+
+      /* Get time of current message */
+      lTime = GetMessageTime ();
+
+      /* Look for fake Ctrl_L preceeding an Alt_R press. */
+      fReturn = PeekMessage (&msgNext, NULL,
+			     WM_KEYDOWN, WM_SYSKEYDOWN,
+			     PM_NOREMOVE);
+
+      /*
+       * Try again if the first call fails.
+       * NOTE: This usually happens when TweakUI is enabled.
+       */
+      if (!fReturn)
+	{
+	  /* Voodoo to make sure that the Alt_R message has posted */
+	  Sleep (0);
+
+	  /* Look for fake Ctrl_L preceeding an Alt_R press. */
+	  fReturn = PeekMessage (&msgNext, NULL,
+				 WM_KEYDOWN, WM_SYSKEYDOWN,
+				 PM_NOREMOVE);
+	}
+      if (msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN)
+          fReturn = 0;
+
+      /* Is next press an Alt_R with the same timestamp? */
+      if (fReturn && msgNext.wParam == VK_MENU
+	  && msgNext.time == lTime
+	  && (HIWORD (msgNext.lParam) & KF_EXTENDED))
+	{
+	  /* 
+	   * Next key press is Alt_R with same timestamp as current
+	   * Ctrl_L message.  Therefore, this Ctrl_L press is a fake
+	   * event, so discard it.
+	   */
+	  return TRUE;
+	}
+    }
+
+  /* 
+   * Fake Ctrl_L releases will be followed by an Alt_R release
+   * with the same timestamp as the Ctrl_L release.
+   */
+  if ((message == WM_KEYUP || message == WM_SYSKEYUP)
+      && wParam == VK_CONTROL
+      && (HIWORD (lParam) & KF_EXTENDED) == 0)
+    {
+      /* Got a Ctrl_L release */
+
+      /* Get time of current message */
+      lTime = GetMessageTime ();
+
+      /* Look for fake Ctrl_L release preceeding an Alt_R release. */
+      fReturn = PeekMessage (&msgNext, NULL,
+			     WM_KEYUP, WM_SYSKEYUP, 
+			     PM_NOREMOVE);
+
+      /*
+       * Try again if the first call fails.
+       * NOTE: This usually happens when TweakUI is enabled.
+       */
+      if (!fReturn)
+	{
+	  /* Voodoo to make sure that the Alt_R message has posted */
+	  Sleep (0);
+
+	  /* Look for fake Ctrl_L release preceeding an Alt_R release. */
+	  fReturn = PeekMessage (&msgNext, NULL,
+				 WM_KEYUP, WM_SYSKEYUP, 
+				 PM_NOREMOVE);
+	}
+
+      if (msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP)
+          fReturn = 0;
+      
+      /* Is next press an Alt_R with the same timestamp? */
+      if (fReturn
+	  && (msgNext.message == WM_KEYUP
+	      || msgNext.message == WM_SYSKEYUP)
+	  && msgNext.wParam == VK_MENU
+	  && msgNext.time == lTime
+	  && (HIWORD (msgNext.lParam) & KF_EXTENDED))
+	{
+	  /*
+	   * Next key release is Alt_R with same timestamp as current
+	   * Ctrl_L message. Therefore, this Ctrl_L release is a fake
+	   * event, so discard it.
+	   */
+	  return TRUE;
+	}
+    }
+  
+  /* Not a fake control left press/release */
+  return FALSE;
+}
+
+
+/*
+ * Lift any modifier keys that are pressed
+ */
+
+void
+winKeybdReleaseKeys (void)
+{
+  int				i;
+
+#ifdef HAS_DEVWINDOWS
+  /* Verify that the mi input system has been initialized */
+  if (g_fdMessageQueue == WIN_FD_INVALID)
+    return;
+#endif
+
+  /* Loop through all keys */
+  for (i = 0; i < NUM_KEYCODES; ++i)
+    {
+      /* Pop key if pressed */
+      if (g_winKeyState[i])
+	winSendKeyEvent (i, FALSE);
+
+      /* Reset pressed flag for keys */
+      g_winKeyState[i] = FALSE;
+    }
+}
+
+
+/*
+ * Take a raw X key code and send an up or down event for it.
+ *
+ * Thanks to VNC for inspiration, though it is a simple function.
+ */
+
+void
+winSendKeyEvent (DWORD dwKey, Bool fDown)
+{
+  EventListPtr events;
+  int i, nevents;
+
+  /*
+   * When alt-tabing between screens we can get phantom key up messages
+   * Here we only pass them through it we think we should!
+   */
+  if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return;
+
+  /* Update the keyState map */
+  g_winKeyState[dwKey] = fDown;
+
+  GetEventList(&events);
+  nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL);
+
+  for (i = 0; i < nevents; i++)
+    mieqEnqueue(g_pwinKeyboard, (InternalEvent*)events[i].event);
+
+  winDebug("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n",
+           dwKey, fDown, nevents);
+}
+
+BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
+{
+  switch (wParam)
+  {
+    case VK_CONTROL:
+      if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
+        return TRUE;
+      if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
+        return TRUE;
+      break;
+    case VK_SHIFT:
+      if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
+        return TRUE;
+      if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
+        return TRUE;
+      break;
+    default:
+      return TRUE;
+  }
+  return FALSE;
+}
+
+/* Only on shift release message is sent even if both are pressed.
+ * Fix this here 
+ */
+void winFixShiftKeys (int iScanCode)
+{
+  if (GetKeyState (VK_SHIFT) & 0x8000)
+    return;
+
+  if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
+    winSendKeyEvent (KEY_ShiftR, FALSE);
+  if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
+    winSendKeyEvent (KEY_ShiftL, FALSE);
+}
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index fd9ecced2..14229b435 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -136,6 +136,9 @@
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
 
+/* Define to 1 if you have the libdispatch (GCD) available */
+#undef HAVE_LIBDISPATCH
+
 /* Define to 1 if you have the `link' function. */
 #undef HAVE_LINK
 
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index 2bb85ffaa..86078daee 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -102,6 +102,7 @@ typedef unsigned long Leds;
 typedef struct _OtherClients *OtherClientsPtr;
 typedef struct _InputClients *InputClientsPtr;
 typedef struct _DeviceIntRec *DeviceIntPtr;
+typedef struct _ValuatorClassRec *ValuatorClassPtr;
 typedef struct _ClassesRec *ClassesPtr;
 typedef struct _SpriteRec *SpritePtr;
 typedef union _GrabMask GrabMask;
@@ -300,6 +301,10 @@ extern _X_EXPORT Bool InitButtonClassDeviceStruct(
     Atom* /* labels */,
     CARD8* /*map*/);
 
+extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass(
+    ValuatorClassPtr src,
+    int numAxes);
+
 extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
     DeviceIntPtr /*device*/,
     int /*numAxes*/,
@@ -457,12 +462,6 @@ extern _X_EXPORT int GetPointerEvents(
     const ValuatorMask *mask);
 
 extern _X_EXPORT int GetKeyboardEvents(
-    EventListPtr events,
-    DeviceIntPtr pDev,
-    int type,
-    int key_code);
-
-extern int GetKeyboardValuatorEvents(
     EventListPtr events,
     DeviceIntPtr pDev,
     int type,
diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h
index f63df8087..bd7c78dec 100644
--- a/xorg-server/include/inputstr.h
+++ b/xorg-server/include/inputstr.h
@@ -283,7 +283,7 @@ typedef struct _ValuatorClassRec {
     unsigned short	  numAxes;
     double		  *axisVal; /* always absolute, but device-coord system */
     ValuatorAccelerationRec	accelScheme;
-} ValuatorClassRec, *ValuatorClassPtr;
+} ValuatorClassRec;
 
 typedef struct _ButtonClassRec {
     int			sourceid;
diff --git a/xorg-server/include/ptrveloc.h b/xorg-server/include/ptrveloc.h
index 1198146f1..6ca309c8c 100644
--- a/xorg-server/include/ptrveloc.h
+++ b/xorg-server/include/ptrveloc.h
@@ -1,144 +1,144 @@
-/*
- *
- * Copyright © 2006-2011 Simon Thum             simon dot thum at gmx dot de
- *
- * 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.
- */
-
-#ifndef POINTERVELOCITY_H
-#define POINTERVELOCITY_H
-
-#include <input.h>
-
-/* constants for acceleration profiles */
-
-#define AccelProfileNone -1
-#define AccelProfileClassic  0
-#define AccelProfileDeviceSpecific 1
-#define AccelProfilePolynomial 2
-#define AccelProfileSmoothLinear 3
-#define AccelProfileSimple 4
-#define AccelProfilePower 5
-#define AccelProfileLinear 6
-#define AccelProfileSmoothLimited 7
-#define AccelProfileLAST AccelProfileSmoothLimited
-
-/* fwd */
-struct _DeviceVelocityRec;
-
-/**
- * profile
- * returns actual acceleration depending on velocity, acceleration control,...
- */
-typedef float (*PointerAccelerationProfileFunc)
-              (DeviceIntPtr dev, struct _DeviceVelocityRec* vel,
-               float velocity, float threshold, float accelCoeff);
-
-/**
- * a motion history, with just enough information to
- * calc mean velocity and decide which motion was along
- * a more or less straight line
- */
-typedef struct _MotionTracker {
-    int dx, dy;     /* accumulated delta for each axis */
-    int time;         /* time of creation */
-    int dir;        /* initial direction bitfield */
-} MotionTracker, *MotionTrackerPtr;
-
-/**
- * Contains all data needed to implement mouse ballistics
- */
-typedef struct _DeviceVelocityRec {
-    MotionTrackerPtr tracker;
-    int num_tracker;
-    int cur_tracker;        /* current index */
-    float   velocity;       /* velocity as guessed by algorithm */
-    float   last_velocity;  /* previous velocity estimate */
-    int     last_dx;      /* last time-difference */
-    int     last_dy ;     /* phase of last/current estimate */
-    float   corr_mul;       /* config: multiply this into velocity */
-    float   const_acceleration;  /* config: (recipr.) const deceleration */
-    float   min_acceleration;    /* config: minimum acceleration */
-    short   reset_time;     /* config: reset non-visible state after # ms */
-    short   use_softening;  /* config: use softening of mouse values */
-    float   max_rel_diff;   /* config: max. relative difference */
-    float   max_diff;       /* config: max. difference */
-    int     initial_range;  /* config: max. offset used as initial velocity */
-    Bool    average_accel;  /* config: average acceleration over velocity */
-    PointerAccelerationProfileFunc Profile;
-    PointerAccelerationProfileFunc deviceSpecificProfile;
-    void*   profile_private;/* extended data, see  SetAccelerationProfile() */
-    struct {   /* to be able to query this information */
-        int     profile_number;
-    } statistics;
-} DeviceVelocityRec, *DeviceVelocityPtr;
-
-/**
- * contains the run-time data for the predictable scheme, that is, a
- * DeviceVelocityPtr and the property handlers.
- */
-typedef struct _PredictableAccelSchemeRec {
-    DeviceVelocityPtr vel;
-    long* prop_handlers;
-    int num_prop_handlers;
-} PredictableAccelSchemeRec, *PredictableAccelSchemePtr;
-
-extern _X_EXPORT void
-InitVelocityData(DeviceVelocityPtr vel);
-
-extern _X_EXPORT void
-InitTrackers(DeviceVelocityPtr vel, int ntracker);
-
-extern _X_EXPORT short
-ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time);
-
-extern _X_EXPORT float
-BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
-    float velocity, float threshold, float acc);
-
-extern _X_EXPORT void
-FreeVelocityData(DeviceVelocityPtr vel);
-
-extern _X_EXPORT int
-SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
-
-extern _X_EXPORT DeviceVelocityPtr
-GetDevicePredictableAccelData(DeviceIntPtr dev);
-
-extern _X_EXPORT void
-SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
-                                     PointerAccelerationProfileFunc profile);
-
-extern _X_INTERNAL void
-AccelerationDefaultCleanup(DeviceIntPtr dev);
-
-extern _X_INTERNAL Bool
-InitPredictableAccelerationScheme(DeviceIntPtr dev,
-				  struct _ValuatorAccelerationRec* protoScheme);
-
-extern _X_INTERNAL void
-acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask* val,
-                             CARD32 evtime);
-
-extern _X_INTERNAL void
-acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask* val,
-                             CARD32 evtime);
-
-#endif  /* POINTERVELOCITY_H */
+/*
+ *
+ * Copyright © 2006-2011 Simon Thum             simon dot thum at gmx dot de
+ *
+ * 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.
+ */
+
+#ifndef POINTERVELOCITY_H
+#define POINTERVELOCITY_H
+
+#include <input.h>
+
+/* constants for acceleration profiles */
+
+#define AccelProfileNone -1
+#define AccelProfileClassic  0
+#define AccelProfileDeviceSpecific 1
+#define AccelProfilePolynomial 2
+#define AccelProfileSmoothLinear 3
+#define AccelProfileSimple 4
+#define AccelProfilePower 5
+#define AccelProfileLinear 6
+#define AccelProfileSmoothLimited 7
+#define AccelProfileLAST AccelProfileSmoothLimited
+
+/* fwd */
+struct _DeviceVelocityRec;
+
+/**
+ * profile
+ * returns actual acceleration depending on velocity, acceleration control,...
+ */
+typedef float (*PointerAccelerationProfileFunc)
+              (DeviceIntPtr dev, struct _DeviceVelocityRec* vel,
+               float velocity, float threshold, float accelCoeff);
+
+/**
+ * a motion history, with just enough information to
+ * calc mean velocity and decide which motion was along
+ * a more or less straight line
+ */
+typedef struct _MotionTracker {
+    int dx, dy;     /* accumulated delta for each axis */
+    int time;         /* time of creation */
+    int dir;        /* initial direction bitfield */
+} MotionTracker, *MotionTrackerPtr;
+
+/**
+ * Contains all data needed to implement mouse ballistics
+ */
+typedef struct _DeviceVelocityRec {
+    MotionTrackerPtr tracker;
+    int num_tracker;
+    int cur_tracker;        /* current index */
+    float   velocity;       /* velocity as guessed by algorithm */
+    float   last_velocity;  /* previous velocity estimate */
+    int     last_dx;      /* last time-difference */
+    int     last_dy ;     /* phase of last/current estimate */
+    float   corr_mul;       /* config: multiply this into velocity */
+    float   const_acceleration;  /* config: (recipr.) const deceleration */
+    float   min_acceleration;    /* config: minimum acceleration */
+    short   reset_time;     /* config: reset non-visible state after # ms */
+    short   use_softening;  /* config: use softening of mouse values */
+    float   max_rel_diff;   /* config: max. relative difference */
+    float   max_diff;       /* config: max. difference */
+    int     initial_range;  /* config: max. offset used as initial velocity */
+    Bool    average_accel;  /* config: average acceleration over velocity */
+    PointerAccelerationProfileFunc Profile;
+    PointerAccelerationProfileFunc deviceSpecificProfile;
+    void*   profile_private;/* extended data, see  SetAccelerationProfile() */
+    struct {   /* to be able to query this information */
+        int     profile_number;
+    } statistics;
+} DeviceVelocityRec, *DeviceVelocityPtr;
+
+/**
+ * contains the run-time data for the predictable scheme, that is, a
+ * DeviceVelocityPtr and the property handlers.
+ */
+typedef struct _PredictableAccelSchemeRec {
+    DeviceVelocityPtr vel;
+    long* prop_handlers;
+    int num_prop_handlers;
+} PredictableAccelSchemeRec, *PredictableAccelSchemePtr;
+
+extern _X_EXPORT void
+InitVelocityData(DeviceVelocityPtr vel);
+
+extern _X_EXPORT void
+InitTrackers(DeviceVelocityPtr vel, int ntracker);
+
+extern _X_EXPORT BOOL
+ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time);
+
+extern _X_EXPORT float
+BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
+    float velocity, float threshold, float acc);
+
+extern _X_EXPORT void
+FreeVelocityData(DeviceVelocityPtr vel);
+
+extern _X_EXPORT int
+SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
+
+extern _X_EXPORT DeviceVelocityPtr
+GetDevicePredictableAccelData(DeviceIntPtr dev);
+
+extern _X_EXPORT void
+SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
+                                     PointerAccelerationProfileFunc profile);
+
+extern _X_INTERNAL void
+AccelerationDefaultCleanup(DeviceIntPtr dev);
+
+extern _X_INTERNAL Bool
+InitPredictableAccelerationScheme(DeviceIntPtr dev,
+				  struct _ValuatorAccelerationRec* protoScheme);
+
+extern _X_INTERNAL void
+acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask* val,
+                             CARD32 evtime);
+
+extern _X_INTERNAL void
+acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask* val,
+                             CARD32 evtime);
+
+#endif  /* POINTERVELOCITY_H */
diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am
index f3265b788..fe9bc1f2e 100644
--- a/xorg-server/test/Makefile.am
+++ b/xorg-server/test/Makefile.am
@@ -1,5 +1,4 @@
 if ENABLE_UNIT_TESTS
-if HAVE_GLIB
 if HAVE_LD_WRAP
 SUBDIRS= . xi2
 noinst_PROGRAMS = xkb input xtest list
@@ -7,9 +6,9 @@ check_LTLIBRARIES = libxservertest.la
 
 TESTS=$(noinst_PROGRAMS)
 
-AM_CFLAGS = $(DIX_CFLAGS) $(GLIB_CFLAGS) @XORG_CFLAGS@
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 INCLUDES = @XORG_INCS@
-TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLIB_LIBS)
+TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
@@ -38,7 +37,6 @@ libxservertest_la_LIBADD = \
             @XORG_LIBS@
 endif
 endif
-endif
 
 CLEANFILES=libxservertest.c
 
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index c13b4f213..ac37d67a1 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -40,7 +40,7 @@
 #include "dixgrabs.h"
 #include "eventstr.h"
 #include "inpututils.h"
-#include <glib.h>
+#include "assert.h"
 
 /**
  * Init a device with axes.
@@ -60,24 +60,24 @@ static void dix_init_valuators(void)
     memset(&dev, 0, sizeof(DeviceIntRec));
     dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */
 
-    g_assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE);
-    g_assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute));
+    assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE);
+    assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute));
 
     val = dev.valuator;
-    g_assert(val);
-    g_assert(val->numAxes == num_axes);
-    g_assert(val->numMotionEvents == 0);
-    g_assert(val->axisVal);
+    assert(val);
+    assert(val->numAxes == num_axes);
+    assert(val->numMotionEvents == 0);
+    assert(val->axisVal);
 
     for (i = 0; i < num_axes; i++)
     {
-        g_assert(val->axisVal[i] == 0);
-        g_assert(val->axes->min_value == NO_AXIS_LIMITS);
-        g_assert(val->axes->max_value == NO_AXIS_LIMITS);
-        g_assert(val->axes->mode == Absolute);
+        assert(val->axisVal[i] == 0);
+        assert(val->axes->min_value == NO_AXIS_LIMITS);
+        assert(val->axes->max_value == NO_AXIS_LIMITS);
+        assert(val->axes->mode == Absolute);
     }
 
-    g_assert(dev.last.numValuators == num_axes);
+    assert(dev.last.numValuators == num_axes);
 }
 
 /* just check the known success cases, and that error cases set the client's
@@ -97,48 +97,48 @@ static void dix_check_grab_values(void)
     param.ownerEvents = FALSE;
 
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == Success);
+    assert(rc == Success);
 
     param.this_device_mode = GrabModeAsync;
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == Success);
+    assert(rc == Success);
 
     param.this_device_mode = GrabModeAsync + 1;
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == BadValue);
-    g_assert(client.errorValue == param.this_device_mode);
-    g_assert(client.errorValue == GrabModeAsync + 1);
+    assert(rc == BadValue);
+    assert(client.errorValue == param.this_device_mode);
+    assert(client.errorValue == GrabModeAsync + 1);
 
     param.this_device_mode = GrabModeSync;
     param.other_devices_mode = GrabModeAsync;
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == Success);
+    assert(rc == Success);
 
     param.other_devices_mode = GrabModeAsync + 1;
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == BadValue);
-    g_assert(client.errorValue == param.other_devices_mode);
-    g_assert(client.errorValue == GrabModeAsync + 1);
+    assert(rc == BadValue);
+    assert(client.errorValue == param.other_devices_mode);
+    assert(client.errorValue == GrabModeAsync + 1);
 
     param.other_devices_mode = GrabModeSync;
 
     param.modifiers = 1 << 13;
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == BadValue);
-    g_assert(client.errorValue == param.modifiers);
-    g_assert(client.errorValue == (1 << 13));
+    assert(rc == BadValue);
+    assert(client.errorValue == param.modifiers);
+    assert(client.errorValue == (1 << 13));
 
 
     param.modifiers = AnyModifier;
     param.ownerEvents = TRUE;
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == Success);
+    assert(rc == Success);
 
     param.ownerEvents = 3;
     rc = CheckGrabValues(&client, &param);
-    g_assert(rc == BadValue);
-    g_assert(client.errorValue == param.ownerEvents);
-    g_assert(client.errorValue == 3);
+    assert(rc == BadValue);
+    assert(client.errorValue == param.ownerEvents);
+    assert(client.errorValue == 3);
 }
 
 
@@ -160,21 +160,21 @@ static void dix_event_to_core(int type)
 
     /* EventToCore memsets the event to 0 */
 #define test_event() \
-    g_assert(rc == Success); \
-    g_assert(core); \
-    g_assert(count == 1); \
-    g_assert(core->u.u.type == type); \
-    g_assert(core->u.u.detail == detail); \
-    g_assert(core->u.keyButtonPointer.time == time); \
-    g_assert(core->u.keyButtonPointer.rootX == x); \
-    g_assert(core->u.keyButtonPointer.rootY == y); \
-    g_assert(core->u.keyButtonPointer.state == state); \
-    g_assert(core->u.keyButtonPointer.eventX == 0); \
-    g_assert(core->u.keyButtonPointer.eventY == 0); \
-    g_assert(core->u.keyButtonPointer.root == ROOT_WINDOW_ID); \
-    g_assert(core->u.keyButtonPointer.event == 0); \
-    g_assert(core->u.keyButtonPointer.child == 0); \
-    g_assert(core->u.keyButtonPointer.sameScreen == FALSE);
+    assert(rc == Success); \
+    assert(core); \
+    assert(count == 1); \
+    assert(core->u.u.type == type); \
+    assert(core->u.u.detail == detail); \
+    assert(core->u.keyButtonPointer.time == time); \
+    assert(core->u.keyButtonPointer.rootX == x); \
+    assert(core->u.keyButtonPointer.rootY == y); \
+    assert(core->u.keyButtonPointer.state == state); \
+    assert(core->u.keyButtonPointer.eventX == 0); \
+    assert(core->u.keyButtonPointer.eventY == 0); \
+    assert(core->u.keyButtonPointer.root == ROOT_WINDOW_ID); \
+    assert(core->u.keyButtonPointer.event == 0); \
+    assert(core->u.keyButtonPointer.child == 0); \
+    assert(core->u.keyButtonPointer.sameScreen == FALSE);
 
     x = 0;
     y = 0;
@@ -217,11 +217,11 @@ static void dix_event_to_core(int type)
     ev.root_x = x;
     ev.root_y = y;
     rc = EventToCore((InternalEvent*)&ev, &core, &count);
-    g_assert(rc == Success);
-    g_assert(core);
-    g_assert(count == 1);
-    g_assert(core->u.keyButtonPointer.rootX != x);
-    g_assert(core->u.keyButtonPointer.rootY != y);
+    assert(rc == Success);
+    assert(core);
+    assert(count == 1);
+    assert(core->u.keyButtonPointer.rootX != x);
+    assert(core->u.keyButtonPointer.rootY != y);
 
     x = 0x7FFF;
     y = 0x7FFF;
@@ -245,7 +245,7 @@ static void dix_event_to_core(int type)
     detail = 0xFFF; /* too big */
     ev.detail.key = detail;
     rc = EventToCore((InternalEvent*)&ev, &core, &count);
-    g_assert(rc == BadMatch);
+    assert(rc == BadMatch);
 
     detail = 0xFF; /* too big */
     ev.detail.key = detail;
@@ -257,11 +257,11 @@ static void dix_event_to_core(int type)
     state = 0x10000; /* too big */
     ev.corestate = state;
     rc = EventToCore((InternalEvent*)&ev, &core, &count);
-    g_assert(rc == Success);
-    g_assert(core);
-    g_assert(count == 1);
-    g_assert(core->u.keyButtonPointer.state != state);
-    g_assert(core->u.keyButtonPointer.state == (state & 0xFFFF));
+    assert(rc == Success);
+    assert(core);
+    assert(count == 1);
+    assert(core->u.keyButtonPointer.state != state);
+    assert(core->u.keyButtonPointer.state == (state & 0xFFFF));
 
 #undef test_event
 }
@@ -278,7 +278,7 @@ static void dix_event_to_core_fail(int evtype, int expected_rc)
 
     ev.type     = evtype;
     rc = EventToCore((InternalEvent*)&ev, &core, &count);
-    g_assert(rc == expected_rc);
+    assert(rc == expected_rc);
 }
 
 static void dix_event_to_core_conversion(void)
@@ -304,28 +304,28 @@ _dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
     int rc;
 
     rc = EventToXI((InternalEvent*)ev, &xi, &count);
-    g_assert(rc == expected_rc);
-    g_assert(count >= expected_count);
+    assert(rc == expected_rc);
+    assert(count >= expected_count);
     if (count > 0){
         deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*)xi;
-        g_assert(kbp->type == IEventBase + ev->type);
-        g_assert(kbp->detail == ev->detail.key);
-        g_assert(kbp->time == ev->time);
-        g_assert((kbp->deviceid & ~MORE_EVENTS) == ev->deviceid);
-        g_assert(kbp->root_x == ev->root_x);
-        g_assert(kbp->root_y == ev->root_y);
-        g_assert(kbp->state == ev->corestate);
-        g_assert(kbp->event_x == 0);
-        g_assert(kbp->event_y == 0);
-        g_assert(kbp->root == ev->root);
-        g_assert(kbp->event == 0);
-        g_assert(kbp->child == 0);
-        g_assert(kbp->same_screen == FALSE);
+        assert(kbp->type == IEventBase + ev->type);
+        assert(kbp->detail == ev->detail.key);
+        assert(kbp->time == ev->time);
+        assert((kbp->deviceid & ~MORE_EVENTS) == ev->deviceid);
+        assert(kbp->root_x == ev->root_x);
+        assert(kbp->root_y == ev->root_y);
+        assert(kbp->state == ev->corestate);
+        assert(kbp->event_x == 0);
+        assert(kbp->event_y == 0);
+        assert(kbp->root == ev->root);
+        assert(kbp->event == 0);
+        assert(kbp->child == 0);
+        assert(kbp->same_screen == FALSE);
 
         while (--count > 0) {
             deviceValuator *v = (deviceValuator*)&xi[count];
-            g_assert(v->type == DeviceValuator);
-            g_assert(v->num_valuators <= 6);
+            assert(v->type == DeviceValuator);
+            assert(v->num_valuators <= 6);
         }
 
 
@@ -436,7 +436,7 @@ static void dix_event_to_xi1_conversion(void)
 static void xi2_struct_sizes(void)
 {
 #define compare(req) \
-    g_assert(sizeof(req) == sz_##req);
+    assert(sizeof(req) == sz_##req);
 
     compare(xXIQueryVersionReq);
     compare(xXIWarpPointerReq);
@@ -476,23 +476,23 @@ static void dix_grab_matching(void)
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_XI2;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI2;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_CORE;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* XI2 grabs for different devices must fail, regardless of ignoreDevice
      * XI2 grabs for master devices must fail against a slave */
@@ -516,28 +516,28 @@ static void dix_grab_matching(void)
     b.device = &dev2;
 
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.device = &dev2;
     b.device = &dev1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&a, &b, TRUE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.device = inputInfo.all_master_devices;
     b.device = &dev1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&a, &b, TRUE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.device = &dev1;
     b.device = inputInfo.all_master_devices;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&a, &b, TRUE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* ignoreDevice FALSE must fail for different devices for CORE and XI */
     a.grabtype = GRABTYPE_XI;
@@ -547,7 +547,7 @@ static void dix_grab_matching(void)
     a.modifierDevice = &dev1;
     b.modifierDevice = &dev1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
@@ -556,7 +556,7 @@ static void dix_grab_matching(void)
     a.modifierDevice = &dev1;
     b.modifierDevice = &dev1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* ignoreDevice FALSE must fail for different modifier devices for CORE
      * and XI */
@@ -567,7 +567,7 @@ static void dix_grab_matching(void)
     a.modifierDevice = &dev1;
     b.modifierDevice = &dev2;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
@@ -576,7 +576,7 @@ static void dix_grab_matching(void)
     a.modifierDevice = &dev1;
     b.modifierDevice = &dev2;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* different event type must fail */
     a.grabtype = GRABTYPE_XI2;
@@ -588,9 +588,9 @@ static void dix_grab_matching(void)
     a.type = XI_KeyPress;
     b.type = XI_KeyRelease;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&a, &b, TRUE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
@@ -601,9 +601,9 @@ static void dix_grab_matching(void)
     a.type = XI_KeyPress;
     b.type = XI_KeyRelease;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&a, &b, TRUE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI;
@@ -614,9 +614,9 @@ static void dix_grab_matching(void)
     a.type = XI_KeyPress;
     b.type = XI_KeyRelease;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&a, &b, TRUE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* different modifiers must fail */
     a.grabtype = GRABTYPE_XI2;
@@ -630,23 +630,23 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 2;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* AnyModifier must fail for XI2 */
     a.grabtype = GRABTYPE_XI2;
@@ -654,9 +654,9 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = AnyModifier;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* XIAnyModifier must fail for CORE and XI */
     a.grabtype = GRABTYPE_XI;
@@ -664,18 +664,18 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = XIAnyModifier;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
     a.modifiersDetail.exact = XIAnyModifier;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* different detail must fail */
     a.grabtype = GRABTYPE_XI2;
@@ -685,23 +685,23 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* detail of AnyModifier must fail */
     a.grabtype = GRABTYPE_XI2;
@@ -711,23 +711,23 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* detail of XIAnyModifier must fail */
     a.grabtype = GRABTYPE_XI2;
@@ -737,23 +737,23 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == FALSE);
+    assert(rc == FALSE);
 
     /* XIAnyModifier or AnyModifer must succeed */
     a.grabtype = GRABTYPE_XI2;
@@ -763,9 +763,9 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = XIAnyModifier;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
@@ -774,9 +774,9 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = AnyModifier;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI;
@@ -785,9 +785,9 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = AnyModifier;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
 
     /* AnyKey or XIAnyKeycode must succeed */
     a.grabtype = GRABTYPE_XI2;
@@ -797,9 +797,9 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
 
     a.grabtype = GRABTYPE_CORE;
     b.grabtype = GRABTYPE_CORE;
@@ -808,9 +808,9 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
 
     a.grabtype = GRABTYPE_XI;
     b.grabtype = GRABTYPE_XI;
@@ -819,9 +819,9 @@ static void dix_grab_matching(void)
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 1;
     rc = GrabMatchesSecond(&a, &b, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
     rc = GrabMatchesSecond(&b, &a, FALSE);
-    g_assert(rc == TRUE);
+    assert(rc == TRUE);
 }
 
 static void test_bits_to_byte(int i)
@@ -829,9 +829,9 @@ static void test_bits_to_byte(int i)
         int expected_bytes;
         expected_bytes = (i + 7)/8;
 
-        g_assert(bits_to_bytes(i) >= i/8);
-        g_assert((bits_to_bytes(i) * 8) - i <= 7);
-        g_assert(expected_bytes == bits_to_bytes(i));
+        assert(bits_to_bytes(i) >= i/8);
+        assert((bits_to_bytes(i) * 8) - i <= 7);
+        assert(expected_bytes == bits_to_bytes(i));
 }
 
 static void test_bytes_to_int32(int i)
@@ -839,9 +839,9 @@ static void test_bytes_to_int32(int i)
         int expected_4byte;
         expected_4byte = (i + 3)/4;
 
-        g_assert(bytes_to_int32(i) <= i);
-        g_assert((bytes_to_int32(i) * 4) - i <= 3);
-        g_assert(expected_4byte == bytes_to_int32(i));
+        assert(bytes_to_int32(i) <= i);
+        assert((bytes_to_int32(i) * 4) - i <= 3);
+        assert(expected_4byte == bytes_to_int32(i));
 }
 
 static void test_pad_to_int32(int i)
@@ -849,13 +849,13 @@ static void test_pad_to_int32(int i)
         int expected_bytes;
         expected_bytes = ((i + 3)/4) * 4;
 
-        g_assert(pad_to_int32(i) >= i);
-        g_assert(pad_to_int32(i) - i <= 3);
-        g_assert(expected_bytes == pad_to_int32(i));
+        assert(pad_to_int32(i) >= i);
+        assert(pad_to_int32(i) - i <= 3);
+        assert(expected_bytes == pad_to_int32(i));
 }
 static void include_byte_padding_macros(void)
 {
-    g_test_message("Testing bits_to_bytes()");
+    printf("Testing bits_to_bytes()\n");
 
     /* the macros don't provide overflow protection */
     test_bits_to_byte(0);
@@ -868,7 +868,7 @@ static void include_byte_padding_macros(void)
     test_bits_to_byte(INT_MAX - 9);
     test_bits_to_byte(INT_MAX - 8);
 
-    g_test_message("Testing bytes_to_int32()");
+    printf("Testing bytes_to_int32()\n");
 
     test_bytes_to_int32(0);
     test_bytes_to_int32(1);
@@ -884,7 +884,7 @@ static void include_byte_padding_macros(void)
     test_bytes_to_int32(INT_MAX - 4);
     test_bytes_to_int32(INT_MAX - 3);
 
-    g_test_message("Testing pad_to_int32");
+    printf("Testing pad_to_int32\n");
 
     test_pad_to_int32(0);
     test_pad_to_int32(0);
@@ -910,47 +910,47 @@ static void xi_unregister_handlers(void)
     memset(&dev, 0, sizeof(dev));
 
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 1);
+    assert(handler == 1);
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 2);
+    assert(handler == 2);
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 3);
+    assert(handler == 3);
 
-    g_test_message("Unlinking from front.");
+    printf("Unlinking from front.\n");
 
     XIUnregisterPropertyHandler(&dev, 4); /* NOOP */
-    g_assert(dev.properties.handlers->id == 3);
+    assert(dev.properties.handlers->id == 3);
     XIUnregisterPropertyHandler(&dev, 3);
-    g_assert(dev.properties.handlers->id == 2);
+    assert(dev.properties.handlers->id == 2);
     XIUnregisterPropertyHandler(&dev, 2);
-    g_assert(dev.properties.handlers->id == 1);
+    assert(dev.properties.handlers->id == 1);
     XIUnregisterPropertyHandler(&dev, 1);
-    g_assert(dev.properties.handlers == NULL);
+    assert(dev.properties.handlers == NULL);
 
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 4);
+    assert(handler == 4);
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 5);
+    assert(handler == 5);
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 6);
+    assert(handler == 6);
     XIUnregisterPropertyHandler(&dev, 3); /* NOOP */
-    g_assert(dev.properties.handlers->next->next->next == NULL);
+    assert(dev.properties.handlers->next->next->next == NULL);
     XIUnregisterPropertyHandler(&dev, 4);
-    g_assert(dev.properties.handlers->next->next == NULL);
+    assert(dev.properties.handlers->next->next == NULL);
     XIUnregisterPropertyHandler(&dev, 5);
-    g_assert(dev.properties.handlers->next == NULL);
+    assert(dev.properties.handlers->next == NULL);
     XIUnregisterPropertyHandler(&dev, 6);
-    g_assert(dev.properties.handlers == NULL);
+    assert(dev.properties.handlers == NULL);
 
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 7);
+    assert(handler == 7);
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 8);
+    assert(handler == 8);
     handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL);
-    g_assert(handler == 9);
+    assert(handler == 9);
 
     XIDeleteAllDeviceProperties(&dev);
-    g_assert(dev.properties.handlers == NULL);
+    assert(dev.properties.handlers == NULL);
     XIUnregisterPropertyHandler(&dev, 7); /* NOOP */
 
 }
@@ -960,44 +960,44 @@ static void cmp_attr_fields(InputAttributes *attr1,
 {
     char **tags1, **tags2;
 
-    g_assert(attr1 && attr2);
-    g_assert(attr1 != attr2);
-    g_assert(attr1->flags == attr2->flags);
+    assert(attr1 && attr2);
+    assert(attr1 != attr2);
+    assert(attr1->flags == attr2->flags);
 
     if (attr1->product != NULL)
     {
-        g_assert(attr1->product != attr2->product);
-        g_assert(strcmp(attr1->product, attr2->product) == 0);
+        assert(attr1->product != attr2->product);
+        assert(strcmp(attr1->product, attr2->product) == 0);
     } else
-        g_assert(attr2->product == NULL);
+        assert(attr2->product == NULL);
 
     if (attr1->vendor != NULL)
     {
-        g_assert(attr1->vendor != attr2->vendor);
-        g_assert(strcmp(attr1->vendor, attr2->vendor) == 0);
+        assert(attr1->vendor != attr2->vendor);
+        assert(strcmp(attr1->vendor, attr2->vendor) == 0);
     } else
-        g_assert(attr2->vendor == NULL);
+        assert(attr2->vendor == NULL);
 
     if (attr1->device != NULL)
     {
-        g_assert(attr1->device != attr2->device);
-        g_assert(strcmp(attr1->device, attr2->device) == 0);
+        assert(attr1->device != attr2->device);
+        assert(strcmp(attr1->device, attr2->device) == 0);
     } else
-        g_assert(attr2->device == NULL);
+        assert(attr2->device == NULL);
 
     if (attr1->pnp_id != NULL)
     {
-        g_assert(attr1->pnp_id != attr2->pnp_id);
-        g_assert(strcmp(attr1->pnp_id, attr2->pnp_id) == 0);
+        assert(attr1->pnp_id != attr2->pnp_id);
+        assert(strcmp(attr1->pnp_id, attr2->pnp_id) == 0);
     } else
-        g_assert(attr2->pnp_id == NULL);
+        assert(attr2->pnp_id == NULL);
 
     if (attr1->usb_id != NULL)
     {
-        g_assert(attr1->usb_id != attr2->usb_id);
-        g_assert(strcmp(attr1->usb_id, attr2->usb_id) == 0);
+        assert(attr1->usb_id != attr2->usb_id);
+        assert(strcmp(attr1->usb_id, attr2->usb_id) == 0);
     } else
-        g_assert(attr2->usb_id == NULL);
+        assert(attr2->usb_id == NULL);
 
     tags1 = attr1->tags;
     tags2 = attr2->tags;
@@ -1005,25 +1005,25 @@ static void cmp_attr_fields(InputAttributes *attr1,
     /* if we don't have any tags, skip the tag checking bits */
     if (!tags1)
     {
-        g_assert(!tags2);
+        assert(!tags2);
         return;
     }
 
     /* Don't lug around empty arrays */
-    g_assert(*tags1);
-    g_assert(*tags2);
+    assert(*tags1);
+    assert(*tags2);
 
     /* check for identical content, but duplicated */
     while (*tags1)
     {
-        g_assert(*tags1 != *tags2);
-        g_assert(strcmp(*tags1, *tags2) == 0);
+        assert(*tags1 != *tags2);
+        assert(strcmp(*tags1, *tags2) == 0);
         tags1++;
         tags2++;
     }
 
     /* ensure tags1 and tags2 have the same no of elements */
-    g_assert(!*tags2);
+    assert(!*tags2);
 
     /* check for not sharing memory */
     tags1 = attr1->tags;
@@ -1031,7 +1031,7 @@ static void cmp_attr_fields(InputAttributes *attr1,
     {
         tags2 = attr2->tags;
         while (*tags2)
-            g_assert(*tags1 != *tags2++);
+            assert(*tags1 != *tags2++);
 
         tags1++;
     }
@@ -1044,10 +1044,10 @@ static void dix_input_attributes(void)
     char *tags[4] = {"tag1", "tag2", "tag2", NULL};
 
     new = DuplicateInputAttributes(NULL);
-    g_assert(!new);
+    assert(!new);
 
     new = DuplicateInputAttributes(&orig);
-    g_assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0);
+    assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0);
 
     orig.product = "product name";
     new = DuplicateInputAttributes(&orig);
@@ -1097,69 +1097,69 @@ static void dix_input_valuator_masks(void)
         valuators[i] = i;
 
     mask = valuator_mask_new(nvaluators);
-    g_assert(mask != NULL);
-    g_assert(valuator_mask_size(mask) == 0);
-    g_assert(valuator_mask_num_valuators(mask) == 0);
+    assert(mask != NULL);
+    assert(valuator_mask_size(mask) == 0);
+    assert(valuator_mask_num_valuators(mask) == 0);
 
     for (i = 0; i < nvaluators; i++)
     {
-        g_assert(!valuator_mask_isset(mask, i));
+        assert(!valuator_mask_isset(mask, i));
         valuator_mask_set(mask, i, valuators[i]);
-        g_assert(valuator_mask_isset(mask, i));
-        g_assert(valuator_mask_get(mask, i) == valuators[i]);
-        g_assert(valuator_mask_size(mask) == i + 1);
-        g_assert(valuator_mask_num_valuators(mask) == i + 1);
+        assert(valuator_mask_isset(mask, i));
+        assert(valuator_mask_get(mask, i) == valuators[i]);
+        assert(valuator_mask_size(mask) == i + 1);
+        assert(valuator_mask_num_valuators(mask) == i + 1);
     }
 
     for (i = 0; i < nvaluators; i++)
     {
-        g_assert(valuator_mask_isset(mask, i));
+        assert(valuator_mask_isset(mask, i));
         valuator_mask_unset(mask, i);
         /* we're removing valuators from the front, so size should stay the
          * same until the last bit is removed */
         if (i < nvaluators - 1)
-            g_assert(valuator_mask_size(mask) == nvaluators);
-        g_assert(!valuator_mask_isset(mask, i));
+            assert(valuator_mask_size(mask) == nvaluators);
+        assert(!valuator_mask_isset(mask, i));
     }
 
-    g_assert(valuator_mask_size(mask) == 0);
+    assert(valuator_mask_size(mask) == 0);
     valuator_mask_zero(mask);
-    g_assert(valuator_mask_size(mask) == 0);
-    g_assert(valuator_mask_num_valuators(mask) == 0);
+    assert(valuator_mask_size(mask) == 0);
+    assert(valuator_mask_num_valuators(mask) == 0);
     for (i = 0; i < nvaluators; i++)
-        g_assert(!valuator_mask_isset(mask, i));
+        assert(!valuator_mask_isset(mask, i));
 
     first_val = 5;
     num_vals = 6;
 
     valuator_mask_set_range(mask, first_val, num_vals, valuators);
-    g_assert(valuator_mask_size(mask) == first_val + num_vals);
-    g_assert(valuator_mask_num_valuators(mask) == num_vals);
+    assert(valuator_mask_size(mask) == first_val + num_vals);
+    assert(valuator_mask_num_valuators(mask) == num_vals);
     for (i = 0; i < nvaluators; i++)
     {
         if (i < first_val || i >= first_val + num_vals)
-            g_assert(!valuator_mask_isset(mask, i));
+            assert(!valuator_mask_isset(mask, i));
         else
         {
-            g_assert(valuator_mask_isset(mask, i));
-            g_assert(valuator_mask_get(mask, i) == valuators[i - first_val]);
+            assert(valuator_mask_isset(mask, i));
+            assert(valuator_mask_get(mask, i) == valuators[i - first_val]);
         }
     }
 
     copy = valuator_mask_new(nvaluators);
     valuator_mask_copy(copy, mask);
-    g_assert(mask != copy);
-    g_assert(valuator_mask_size(mask) == valuator_mask_size(copy));
-    g_assert(valuator_mask_num_valuators(mask) == valuator_mask_num_valuators(copy));
+    assert(mask != copy);
+    assert(valuator_mask_size(mask) == valuator_mask_size(copy));
+    assert(valuator_mask_num_valuators(mask) == valuator_mask_num_valuators(copy));
 
     for (i = 0; i < nvaluators; i++)
     {
-        g_assert(valuator_mask_isset(mask, i) == valuator_mask_isset(copy, i));
-        g_assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i));
+        assert(valuator_mask_isset(mask, i) == valuator_mask_isset(copy, i));
+        assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i));
     }
 
     valuator_mask_free(&mask);
-    g_assert(mask == NULL);
+    assert(mask == NULL);
 }
 
 static void dix_valuator_mode(void)
@@ -1172,24 +1172,24 @@ static void dix_valuator_mode(void)
     memset(&dev, 0, sizeof(DeviceIntRec));
     dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */
 
-    g_assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE);
-    g_assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute));
+    assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE);
+    assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute));
 
     for (i = 0; i < num_axes; i++)
     {
-        g_assert(valuator_get_mode(&dev, i) == Absolute);
+        assert(valuator_get_mode(&dev, i) == Absolute);
         valuator_set_mode(&dev, i, Relative);
-        g_assert(dev.valuator->axes[i].mode == Relative);
-        g_assert(valuator_get_mode(&dev, i) == Relative);
+        assert(dev.valuator->axes[i].mode == Relative);
+        assert(valuator_get_mode(&dev, i) == Relative);
     }
 
     valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Absolute);
     for (i = 0; i < num_axes; i++)
-        g_assert(valuator_get_mode(&dev, i) == Absolute);
+        assert(valuator_get_mode(&dev, i) == Absolute);
 
     valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Relative);
     for (i = 0; i < num_axes; i++)
-        g_assert(valuator_get_mode(&dev, i) == Relative);
+        assert(valuator_get_mode(&dev, i) == Relative);
 }
 
 static void include_bit_test_macros(void)
@@ -1199,34 +1199,53 @@ static void include_bit_test_macros(void)
 
     for (i = 0; i < sizeof(mask)/sizeof(mask[0]); i++)
     {
-        g_assert(BitIsOn(mask, i) == 0);
+        assert(BitIsOn(mask, i) == 0);
         SetBit(mask, i);
-        g_assert(BitIsOn(mask, i) == 1);
-        g_assert(!!(mask[i/8] & (1 << (i % 8))));
-        g_assert(CountBits(mask, sizeof(mask)) == 1);
+        assert(BitIsOn(mask, i) == 1);
+        assert(!!(mask[i/8] & (1 << (i % 8))));
+        assert(CountBits(mask, sizeof(mask)) == 1);
         ClearBit(mask, i);
-        g_assert(BitIsOn(mask, i) == 0);
+        assert(BitIsOn(mask, i) == 0);
     }
 }
 
+/**
+ * Ensure that val->axisVal and val->axes are aligned on doubles.
+ */
+static void dix_valuator_alloc(void)
+{
+    ValuatorClassPtr v = NULL;
+    int num_axes = 0;
+
+    while (num_axes < 5)
+    {
+        v = AllocValuatorClass(v, num_axes);
+
+        assert(v);
+        assert(v->numAxes == num_axes);
+        assert(((void*)v->axisVal - (void*)v) % sizeof(double) == 0);
+        assert(((void*)v->axes - (void*)v) % sizeof(double) == 0);
+        num_axes ++;
+    }
+
+    free(v);
+}
+
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
-    g_test_add_func("/dix/input/valuator-masks", dix_input_valuator_masks);
-    g_test_add_func("/dix/input/attributes", dix_input_attributes);
-    g_test_add_func("/dix/input/init-valuators", dix_init_valuators);
-    g_test_add_func("/dix/input/event-core-conversion", dix_event_to_core_conversion);
-    g_test_add_func("/dix/input/event-xi1-conversion", dix_event_to_xi1_conversion);
-    g_test_add_func("/dix/input/check-grab-values", dix_check_grab_values);
-    g_test_add_func("/dix/input/xi2-struct-sizes", xi2_struct_sizes);
-    g_test_add_func("/dix/input/grab_matching", dix_grab_matching);
-    g_test_add_func("/dix/input/valuator_mode", dix_valuator_mode);
-    g_test_add_func("/include/byte_padding_macros", include_byte_padding_macros);
-    g_test_add_func("/include/bit_test_macros", include_bit_test_macros);
-    g_test_add_func("/Xi/xiproperty/register-unregister", xi_unregister_handlers);
-
-
-    return g_test_run();
+    dix_input_valuator_masks();
+    dix_input_attributes();
+    dix_init_valuators();
+    dix_event_to_core_conversion();
+    dix_event_to_xi1_conversion();
+    dix_check_grab_values();
+    xi2_struct_sizes();
+    dix_grab_matching();
+    dix_valuator_mode();
+    include_byte_padding_macros();
+    include_bit_test_macros();
+    xi_unregister_handlers();
+    dix_valuator_alloc();
+
+    return 0;
 }
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index 7e035fe58..b101c7619 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -1,176 +1,173 @@
-/**
- * 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 <X11/Xlib.h>
-#include <list.h>
-#include <string.h>
-#include <glib.h>
-
-struct parent {
-    int a;
-    struct list children;
-    int b;
-};
-
-struct child {
-    int foo;
-    int bar;
-    struct list node;
-};
-
-static void
-test_list_init(void)
-{
-    struct parent parent, tmp;
-
-    memset(&parent, 0, sizeof(parent));
-    parent.a = 0xa5a5a5;
-    parent.b = ~0xa5a5a5;
-
-    tmp = parent;
-
-    list_init(&parent.children);
-
-    /* test we haven't touched anything else. */
-    g_assert(parent.a == tmp.a);
-    g_assert(parent.b == tmp.b);
-
-    g_assert(list_is_empty(&parent.children));
-}
-
-static void
-test_list_add(void)
-{
-    struct parent parent = {0};
-    struct child child[3];
-    struct child *c;
-
-    list_init(&parent.children);
-
-    list_add(&child[0].node, &parent.children);
-    g_assert(!list_is_empty(&parent.children));
-
-    c = list_first_entry(&parent.children, struct child, node);
-    g_assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
-
-    /* note: list_add prepends */
-    list_add(&child[1].node, &parent.children);
-    c = list_first_entry(&parent.children, struct child, node);
-    g_assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
-
-    list_add(&child[2].node, &parent.children);
-    c = list_first_entry(&parent.children, struct child, node);
-    g_assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
-};
-
-static void
-test_list_del(void)
-{
-    struct parent parent = {0};
-    struct child child[3];
-    struct child *c;
-
-    list_init(&parent.children);
-
-    list_add(&child[0].node, &parent.children);
-    g_assert(!list_is_empty(&parent.children));
-
-    list_del(&parent.children);
-    g_assert(list_is_empty(&parent.children));
-
-    list_add(&child[0].node, &parent.children);
-    list_del(&child[0].node);
-    g_assert(list_is_empty(&parent.children));
-
-    list_add(&child[0].node, &parent.children);
-    list_add(&child[1].node, &parent.children);
-
-    c = list_first_entry(&parent.children, struct child, node);
-    g_assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
-
-    /* delete first node */
-    list_del(&child[1].node);
-    g_assert(!list_is_empty(&parent.children));
-    g_assert(list_is_empty(&child[1].node));
-    c = list_first_entry(&parent.children, struct child, node);
-    g_assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
-
-    /* delete last node */
-    list_add(&child[1].node, &parent.children);
-    list_del(&child[0].node);
-    c = list_first_entry(&parent.children, struct child, node);
-    g_assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
-
-    /* delete list head */
-    list_add(&child[0].node, &parent.children);
-    list_del(&parent.children);
-    g_assert(list_is_empty(&parent.children));
-    g_assert(!list_is_empty(&child[1].node));
-    g_assert(!list_is_empty(&child[2].node));
-}
-
-static void
-test_list_for_each(void)
-{
-    struct parent parent = {0};
-    struct child child[3];
-    struct child *c;
-    int i = 0;
-
-    list_init(&parent.children);
-
-    list_add(&child[2].node, &parent.children);
-    list_add(&child[1].node, &parent.children);
-    list_add(&child[0].node, &parent.children);
-
-    list_for_each_entry(c, &parent.children, node) {
-        g_assert(memcmp(c, &child[i], sizeof(struct child)) == 0);
-        i++;
-    }
-
-    /* foreach on empty list */
-    list_del(&parent.children);
-    g_assert(list_is_empty(&parent.children));
-
-    list_for_each_entry(c, &parent.children, node) {
-        g_assert(0); /* we must not get here */
-    }
-}
-
-
-int main(int argc, char** argv)
-{
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
-    g_test_add_func("/list/init", test_list_init);
-    g_test_add_func("/list/add", test_list_add);
-    g_test_add_func("/list/del", test_list_del);
-    g_test_add_func("/list/for_each", test_list_for_each);
-
-    return g_test_run();
-}
+/**
+ * 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 <X11/Xlib.h>
+#include <list.h>
+#include <string.h>
+#include <assert.h>
+
+struct parent {
+    int a;
+    struct list children;
+    int b;
+};
+
+struct child {
+    int foo;
+    int bar;
+    struct list node;
+};
+
+static void
+test_list_init(void)
+{
+    struct parent parent, tmp;
+
+    memset(&parent, 0, sizeof(parent));
+    parent.a = 0xa5a5a5;
+    parent.b = ~0xa5a5a5;
+
+    tmp = parent;
+
+    list_init(&parent.children);
+
+    /* test we haven't touched anything else. */
+    assert(parent.a == tmp.a);
+    assert(parent.b == tmp.b);
+
+    assert(list_is_empty(&parent.children));
+}
+
+static void
+test_list_add(void)
+{
+    struct parent parent = {0};
+    struct child child[3];
+    struct child *c;
+
+    list_init(&parent.children);
+
+    list_add(&child[0].node, &parent.children);
+    assert(!list_is_empty(&parent.children));
+
+    c = list_first_entry(&parent.children, struct child, node);
+    assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
+
+    /* note: list_add prepends */
+    list_add(&child[1].node, &parent.children);
+    c = list_first_entry(&parent.children, struct child, node);
+    assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
+
+    list_add(&child[2].node, &parent.children);
+    c = list_first_entry(&parent.children, struct child, node);
+    assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
+};
+
+static void
+test_list_del(void)
+{
+    struct parent parent = {0};
+    struct child child[3];
+    struct child *c;
+
+    list_init(&parent.children);
+
+    list_add(&child[0].node, &parent.children);
+    assert(!list_is_empty(&parent.children));
+
+    list_del(&parent.children);
+    assert(list_is_empty(&parent.children));
+
+    list_add(&child[0].node, &parent.children);
+    list_del(&child[0].node);
+    assert(list_is_empty(&parent.children));
+
+    list_add(&child[0].node, &parent.children);
+    list_add(&child[1].node, &parent.children);
+
+    c = list_first_entry(&parent.children, struct child, node);
+    assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
+
+    /* delete first node */
+    list_del(&child[1].node);
+    assert(!list_is_empty(&parent.children));
+    assert(list_is_empty(&child[1].node));
+    c = list_first_entry(&parent.children, struct child, node);
+    assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
+
+    /* delete last node */
+    list_add(&child[1].node, &parent.children);
+    list_del(&child[0].node);
+    c = list_first_entry(&parent.children, struct child, node);
+    assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
+
+    /* delete list head */
+    list_add(&child[0].node, &parent.children);
+    list_del(&parent.children);
+    assert(list_is_empty(&parent.children));
+    assert(!list_is_empty(&child[1].node));
+    assert(!list_is_empty(&child[2].node));
+}
+
+static void
+test_list_for_each(void)
+{
+    struct parent parent = {0};
+    struct child child[3];
+    struct child *c;
+    int i = 0;
+
+    list_init(&parent.children);
+
+    list_add(&child[2].node, &parent.children);
+    list_add(&child[1].node, &parent.children);
+    list_add(&child[0].node, &parent.children);
+
+    list_for_each_entry(c, &parent.children, node) {
+        assert(memcmp(c, &child[i], sizeof(struct child)) == 0);
+        i++;
+    }
+
+    /* foreach on empty list */
+    list_del(&parent.children);
+    assert(list_is_empty(&parent.children));
+
+    list_for_each_entry(c, &parent.children, node) {
+        assert(0); /* we must not get here */
+    }
+}
+
+
+int main(int argc, char** argv)
+{
+    test_list_init();
+    test_list_add();
+    test_list_del();
+    test_list_for_each();
+
+    return 0;
+}
diff --git a/xorg-server/test/xi2/Makefile.am b/xorg-server/test/xi2/Makefile.am
index 1b9bfe08e..b15d8ba02 100644
--- a/xorg-server/test/xi2/Makefile.am
+++ b/xorg-server/test/xi2/Makefile.am
@@ -1,5 +1,4 @@
 if ENABLE_UNIT_TESTS
-if HAVE_GLIB
 if HAVE_LD_WRAP
 noinst_PROGRAMS =  \
 	protocol-xiqueryversion \
@@ -8,15 +7,16 @@ noinst_PROGRAMS =  \
 	protocol-xigetselectedevents \
         protocol-xisetclientpointer \
         protocol-xigetclientpointer \
+        protocol-xipassivegrabdevice \
         protocol-xiquerypointer \
         protocol-xiwarppointer \
         protocol-eventconvert
 
 TESTS=$(noinst_PROGRAMS)
 
-AM_CFLAGS = $(DIX_CFLAGS) $(GLIB_CFLAGS) @XORG_CFLAGS@
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 INCLUDES = @XORG_INCS@
-TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLIB_LIBS)
+TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
 
 if SPECIAL_DTRACE_OBJECTS
@@ -30,6 +30,7 @@ protocol_xigetselectedevents_LDADD=$(TEST_LDADD)
 protocol_xisetclientpointer_LDADD=$(TEST_LDADD)
 protocol_xigetclientpointer_LDADD=$(TEST_LDADD)
 protocol_xiquerypointer_LDADD=$(TEST_LDADD)
+protocol_xipassivegrabdevice_LDADD=$(TEST_LDADD)
 protocol_xiwarppointer_LDADD=$(TEST_LDADD)
 protocol_eventconvert_LDADD=$(TEST_LDADD)
 
@@ -39,6 +40,7 @@ protocol_xiselectevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupWindow -Wl,-wra
 protocol_xigetselectedevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource
 protocol_xisetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupClient
 protocol_xigetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient
+protocol_xipassivegrabdevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,GrabButton -Wl,-wrap,dixLookupWindow -Wl,-wrap,WriteToClient
 protocol_xiquerypointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow
 protocol_xiwarppointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow
 
@@ -49,7 +51,7 @@ protocol_xigetselectedevents_SOURCES=$(COMMON_SOURCES) protocol-xigetselectedeve
 protocol_xisetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xisetclientpointer.c
 protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xigetclientpointer.c
 protocol_xiquerypointer_SOURCES=$(COMMON_SOURCES) protocol-xiquerypointer.c
+protocol_xipassivegrabdevice_SOURCES=$(COMMON_SOURCES) protocol-xipassivegrabdevice.c
 protocol_xiwarppointer_SOURCES=$(COMMON_SOURCES) protocol-xiwarppointer.c
 endif
 endif
-endif
diff --git a/xorg-server/test/xi2/protocol-common.c b/xorg-server/test/xi2/protocol-common.c
index 86a7201b8..6ffc69721 100644
--- a/xorg-server/test/xi2/protocol-common.c
+++ b/xorg-server/test/xi2/protocol-common.c
@@ -1,178 +1,177 @@
-/**
- * Copyright © 2009 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 <stdint.h>
-#include "extinit.h" /* for XInputExtensionInit */
-#include "exglobals.h"
-#include "xkbsrv.h" /* for XkbInitPrivates */
-#include <glib.h>
-
-#include "protocol-common.h"
-
-struct devices devices;
-ScreenRec screen;
-WindowRec root;
-WindowRec window;
-
-void *userdata;
-
-extern int CorePointerProc(DeviceIntPtr pDev, int what);
-extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
-
-static void fake_init_sprite(DeviceIntPtr dev)
-{
-    SpritePtr sprite;
-    sprite = dev->spriteInfo->sprite;
-
-    sprite->spriteTraceSize = 10;
-    sprite->spriteTrace = calloc(sprite->spriteTraceSize, sizeof(WindowPtr));
-    sprite->spriteTraceGood = 1;
-    sprite->spriteTrace[0] = &root;
-    sprite->hot.x = SPRITE_X;
-    sprite->hot.y = SPRITE_Y;
-    sprite->hotPhys.x = sprite->hot.x;
-    sprite->hotPhys.y = sprite->hot.y;
-    sprite->win = &window;
-    sprite->hotPhys.pScreen = &screen;
-    sprite->physLimits.x1 = 0;
-    sprite->physLimits.y1 = 0;
-    sprite->physLimits.x2 = screen.width;
-    sprite->physLimits.y2 = screen.height;
-}
-
-/**
- * Create and init 2 master devices (VCP + VCK) and two slave devices, one
- * default mouse, one default keyboard.
- */
-struct devices init_devices(void)
-{
-    ClientRec client;
-    struct devices devices;
-
-    client = init_client(0, NULL);
-
-    AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck,
-                    CorePointerProc, CoreKeyboardProc, TRUE);
-    inputInfo.pointer = devices.vcp;
-    inputInfo.keyboard = devices.vck;
-    ActivateDevice(devices.vcp, FALSE);
-    ActivateDevice(devices.vck, FALSE);
-    EnableDevice(devices.vcp, FALSE);
-    EnableDevice(devices.vck, FALSE);
-
-    AllocDevicePair(&client, "", &devices.mouse, &devices.kbd,
-                    CorePointerProc, CoreKeyboardProc, FALSE);
-    ActivateDevice(devices.mouse, FALSE);
-    ActivateDevice(devices.kbd, FALSE);
-    EnableDevice(devices.mouse, FALSE);
-    EnableDevice(devices.kbd, FALSE);
-
-    devices.num_devices = 4;
-    devices.num_master_devices = 2;
-
-    fake_init_sprite(devices.mouse);
-    fake_init_sprite(devices.vcp);
-
-    return devices;
-}
-
-
-/* Create minimal client, with the given buffer and len as request buffer */
-ClientRec init_client(int len, void *data)
-{
-    ClientRec client = { 0 };
-
-    /* we store the privates now and reassign it after the memset. this way
-     * we can share them across multiple test runs and don't have to worry
-     * about freeing them after each test run. */
-
-    client.index = CLIENT_INDEX;
-    client.clientAsMask = CLIENT_MASK;
-    client.sequence = CLIENT_SEQUENCE;
-    client.req_len = len;
-
-    client.requestBuffer = data;
-    dixAllocatePrivates(&client.devPrivates, PRIVATE_CLIENT);
-    return client;
-}
-
-void init_window(WindowPtr window, WindowPtr parent, int id)
-{
-    memset(window, 0, sizeof(window));
-
-    window->drawable.id = id;
-    if (parent)
-    {
-        window->drawable.x = 30;
-        window->drawable.y = 50;
-        window->drawable.width = 100;
-        window->drawable.height = 200;
-    }
-    window->parent = parent;
-    window->optional = calloc(1, sizeof(WindowOptRec));
-    g_assert(window->optional);
-}
-
-extern DevPrivateKeyRec miPointerScreenKeyRec;
-extern DevPrivateKeyRec miPointerPrivKeyRec;
-
-/* Needed for the screen setup, otherwise we crash during sprite initialization */
-static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
-static Bool set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) { return TRUE; }
-void init_simple(void)
-{
-    screenInfo.numScreens = 1;
-    screenInfo.screens[0] = &screen;
-
-    screen.myNum = 0;
-    screen.id = 100;
-    screen.width = 640;
-    screen.height = 480;
-    screen.DeviceCursorInitialize = device_cursor_init;
-    screen.SetCursorPosition = set_cursor_pos;
-
-    dixResetPrivates();
-    InitAtoms();
-    XkbInitPrivates();
-    dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
-    dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
-    dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
-    XInputExtensionInit();
-
-    init_window(&root, NULL, ROOT_WINDOW_ID);
-    init_window(&window, &root, CLIENT_WINDOW_ID);
-
-    devices = init_devices();
-}
-
-void __wrap_WriteToClient(ClientPtr client, int len, void *data)
-{
-    g_assert(reply_handler != NULL);
-
-    (*reply_handler)(client, len, data, userdata);
-}
-
+/**
+ * Copyright © 2009 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 <stdint.h>
+#include "extinit.h" /* for XInputExtensionInit */
+#include "exglobals.h"
+#include "xkbsrv.h" /* for XkbInitPrivates */
+
+#include "protocol-common.h"
+
+struct devices devices;
+ScreenRec screen;
+WindowRec root;
+WindowRec window;
+
+void *userdata;
+
+extern int CorePointerProc(DeviceIntPtr pDev, int what);
+extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
+
+static void fake_init_sprite(DeviceIntPtr dev)
+{
+    SpritePtr sprite;
+    sprite = dev->spriteInfo->sprite;
+
+    sprite->spriteTraceSize = 10;
+    sprite->spriteTrace = calloc(sprite->spriteTraceSize, sizeof(WindowPtr));
+    sprite->spriteTraceGood = 1;
+    sprite->spriteTrace[0] = &root;
+    sprite->hot.x = SPRITE_X;
+    sprite->hot.y = SPRITE_Y;
+    sprite->hotPhys.x = sprite->hot.x;
+    sprite->hotPhys.y = sprite->hot.y;
+    sprite->win = &window;
+    sprite->hotPhys.pScreen = &screen;
+    sprite->physLimits.x1 = 0;
+    sprite->physLimits.y1 = 0;
+    sprite->physLimits.x2 = screen.width;
+    sprite->physLimits.y2 = screen.height;
+}
+
+/**
+ * Create and init 2 master devices (VCP + VCK) and two slave devices, one
+ * default mouse, one default keyboard.
+ */
+struct devices init_devices(void)
+{
+    ClientRec client;
+    struct devices devices;
+
+    client = init_client(0, NULL);
+
+    AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck,
+                    CorePointerProc, CoreKeyboardProc, TRUE);
+    inputInfo.pointer = devices.vcp;
+    inputInfo.keyboard = devices.vck;
+    ActivateDevice(devices.vcp, FALSE);
+    ActivateDevice(devices.vck, FALSE);
+    EnableDevice(devices.vcp, FALSE);
+    EnableDevice(devices.vck, FALSE);
+
+    AllocDevicePair(&client, "", &devices.mouse, &devices.kbd,
+                    CorePointerProc, CoreKeyboardProc, FALSE);
+    ActivateDevice(devices.mouse, FALSE);
+    ActivateDevice(devices.kbd, FALSE);
+    EnableDevice(devices.mouse, FALSE);
+    EnableDevice(devices.kbd, FALSE);
+
+    devices.num_devices = 4;
+    devices.num_master_devices = 2;
+
+    fake_init_sprite(devices.mouse);
+    fake_init_sprite(devices.vcp);
+
+    return devices;
+}
+
+
+/* Create minimal client, with the given buffer and len as request buffer */
+ClientRec init_client(int len, void *data)
+{
+    ClientRec client = { 0 };
+
+    /* we store the privates now and reassign it after the memset. this way
+     * we can share them across multiple test runs and don't have to worry
+     * about freeing them after each test run. */
+
+    client.index = CLIENT_INDEX;
+    client.clientAsMask = CLIENT_MASK;
+    client.sequence = CLIENT_SEQUENCE;
+    client.req_len = len;
+
+    client.requestBuffer = data;
+    dixAllocatePrivates(&client.devPrivates, PRIVATE_CLIENT);
+    return client;
+}
+
+void init_window(WindowPtr window, WindowPtr parent, int id)
+{
+    memset(window, 0, sizeof(window));
+
+    window->drawable.id = id;
+    if (parent)
+    {
+        window->drawable.x = 30;
+        window->drawable.y = 50;
+        window->drawable.width = 100;
+        window->drawable.height = 200;
+    }
+    window->parent = parent;
+    window->optional = calloc(1, sizeof(WindowOptRec));
+    assert(window->optional);
+}
+
+extern DevPrivateKeyRec miPointerScreenKeyRec;
+extern DevPrivateKeyRec miPointerPrivKeyRec;
+
+/* Needed for the screen setup, otherwise we crash during sprite initialization */
+static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
+static Bool set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) { return TRUE; }
+void init_simple(void)
+{
+    screenInfo.numScreens = 1;
+    screenInfo.screens[0] = &screen;
+
+    screen.myNum = 0;
+    screen.id = 100;
+    screen.width = 640;
+    screen.height = 480;
+    screen.DeviceCursorInitialize = device_cursor_init;
+    screen.SetCursorPosition = set_cursor_pos;
+
+    dixResetPrivates();
+    InitAtoms();
+    XkbInitPrivates();
+    dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
+    dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
+    dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
+    XInputExtensionInit();
+
+    init_window(&root, NULL, ROOT_WINDOW_ID);
+    init_window(&window, &root, CLIENT_WINDOW_ID);
+
+    devices = init_devices();
+}
+
+void __wrap_WriteToClient(ClientPtr client, int len, void *data)
+{
+    assert(reply_handler != NULL);
+
+    (*reply_handler)(client, len, data, userdata);
+}
+
diff --git a/xorg-server/test/xi2/protocol-common.h b/xorg-server/test/xi2/protocol-common.h
index afa08780c..18c61e62a 100644
--- a/xorg-server/test/xi2/protocol-common.h
+++ b/xorg-server/test/xi2/protocol-common.h
@@ -29,6 +29,7 @@
 #include "windowstr.h"
 #include "scrnintstr.h"
 #include "exevents.h"
+#include <assert.h>
 
 #ifndef PROTOCOL_COMMON_H
 #define PROTOCOL_COMMON_H
@@ -38,11 +39,11 @@ extern int BadDevice;
 /* Check default values in a reply */
 #define reply_check_defaults(rep, len, type) \
     { \
-        g_assert((len) >= sz_x##type##Reply); \
-        g_assert((rep)->repType == X_Reply); \
-        g_assert((rep)->RepType == X_##type); \
-        g_assert((rep)->sequenceNumber == CLIENT_SEQUENCE); \
-        g_assert((rep)->length >= (sz_x##type##Reply - 32)/4); \
+        assert((len) >= sz_x##type##Reply); \
+        assert((rep)->repType == X_Reply); \
+        assert((rep)->RepType == X_##type); \
+        assert((rep)->sequenceNumber == CLIENT_SEQUENCE); \
+        assert((rep)->length >= (sz_x##type##Reply - 32)/4); \
     }
 
 /* initialise default values for request */
diff --git a/xorg-server/test/xi2/protocol-eventconvert.c b/xorg-server/test/xi2/protocol-eventconvert.c
index 0478c33fe..edba974bf 100644
--- a/xorg-server/test/xi2/protocol-eventconvert.c
+++ b/xorg-server/test/xi2/protocol-eventconvert.c
@@ -25,7 +25,6 @@
 #endif
 
 #include <stdint.h>
-#include <glib.h>
 
 #include "inputstr.h"
 #include "eventstr.h"
@@ -33,7 +32,6 @@
 #include "exevents.h"
 #include <X11/extensions/XI2proto.h>
 
-
 static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
                                    BOOL swap)
 {
@@ -58,21 +56,21 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
     }
 
 
-    g_assert(out->type == GenericEvent);
-    g_assert(out->extension == 0); /* IReqCode defaults to 0 */
-    g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
-    g_assert(out->time == in->time);
-    g_assert(out->detail == in->detail.button);
-    g_assert(out->deviceid == in->deviceid);
-    g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
-    g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */
+    assert(out->type == GenericEvent);
+    assert(out->extension == 0); /* IReqCode defaults to 0 */
+    assert(out->evtype == GetXI2Type((InternalEvent*)in));
+    assert(out->time == in->time);
+    assert(out->detail == in->detail.button);
+    assert(out->deviceid == in->deviceid);
+    assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
+    assert(out->flags == 0); /* FIXME: we don't set the flags yet */
 
     ptr = (unsigned char*)&out[1];
     bits_set = 0;
 
     for (i = 0; out->valuators_len && i < sizeof(in->valuators.mask) * 8; i++)
     {
-        g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
+        assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
         if (XIMaskIsSet(in->valuators.mask, i))
             bits_set++;
     }
@@ -81,13 +79,13 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
      * set. Each bit set represents 2 8-byte values, hence the
      * 'bits_set * 4' */
     len = out->valuators_len + bits_set * 4;
-    g_assert(out->length == len);
+    assert(out->length == len);
 
     nvals = 0;
 
     for (i = 0; out->valuators_len && i < MAX_VALUATORS; i++)
     {
-        g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
+        assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
         if (XIMaskIsSet(in->valuators.mask, i))
         {
             FP3232 vi, vo;
@@ -106,8 +104,8 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
                 swapl(&vo.frac, n);
             }
 
-            g_assert(vi.integral == vo.integral);
-            g_assert(vi.frac == vo.frac);
+            assert(vi.integral == vo.integral);
+            assert(vi.frac == vo.frac);
 
             raw_value = value + bits_set;
 
@@ -123,8 +121,8 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
                 swapl(&vo.frac, n);
             }
 
-            g_assert(vi.integral == vo.integral);
-            g_assert(vi.frac == vo.frac);
+            assert(vi.integral == vo.integral);
+            assert(vi.frac == vo.frac);
 
             nvals++;
         }
@@ -137,7 +135,7 @@ static void test_XIRawEvent(RawDeviceEvent *in)
     int rc;
 
     rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
-    g_assert(rc == Success);
+    assert(rc == Success);
 
     test_values_XIRawEvent(in, out, FALSE);
 
@@ -158,24 +156,24 @@ static void test_convert_XIFocusEvent(void)
     in.header = ET_Internal;
     in.type = ET_Enter;
     rc = EventToXI2((InternalEvent*)&in, &out);
-    g_assert(rc == Success);
-    g_assert(out == NULL);
+    assert(rc == Success);
+    assert(out == NULL);
 
     in.header = ET_Internal;
     in.type = ET_FocusIn;
     rc = EventToXI2((InternalEvent*)&in, &out);
-    g_assert(rc == Success);
-    g_assert(out == NULL);
+    assert(rc == Success);
+    assert(out == NULL);
 
     in.header = ET_Internal;
     in.type = ET_FocusOut;
     rc = EventToXI2((InternalEvent*)&in, &out);
-    g_assert(rc == BadImplementation);
+    assert(rc == BadImplementation);
 
     in.header = ET_Internal;
     in.type = ET_Leave;
     rc = EventToXI2((InternalEvent*)&in, &out);
-    g_assert(rc == BadImplementation);
+    assert(rc == BadImplementation);
 }
 
 
@@ -186,7 +184,7 @@ static void test_convert_XIRawEvent(void)
 
     memset(&in, 0, sizeof(in));
 
-    g_test_message("Testing all event types");
+    printf("Testing all event types\n");
     in.header = ET_Internal;
     in.type = ET_RawMotion;
     test_XIRawEvent(&in);
@@ -207,7 +205,7 @@ static void test_convert_XIRawEvent(void)
     in.type = ET_RawButtonRelease;
     test_XIRawEvent(&in);
 
-    g_test_message("Testing details and other fields");
+    printf("Testing details and other fields\n");
     in.detail.button = 1L;
     test_XIRawEvent(&in);
     in.detail.button = 1L << 8;
@@ -239,7 +237,7 @@ static void test_convert_XIRawEvent(void)
     in.deviceid = ~0 & 0xFF;
     test_XIRawEvent(&in);
 
-    g_test_message("Testing valuator masks");
+    printf("Testing valuator masks\n");
     for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
     {
         XISetMask(in.valuators.mask, i);
@@ -301,14 +299,14 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
         swapl(&out->flags, n);
     }
 
-    g_assert(out->extension == 0); /* IReqCode defaults to 0 */
-    g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
-    g_assert(out->time == in->time);
-    g_assert(out->detail == in->detail.button);
-    g_assert(out->length >= 12);
+    assert(out->extension == 0); /* IReqCode defaults to 0 */
+    assert(out->evtype == GetXI2Type((InternalEvent*)in));
+    assert(out->time == in->time);
+    assert(out->detail == in->detail.button);
+    assert(out->length >= 12);
 
-    g_assert(out->deviceid == in->deviceid);
-    g_assert(out->sourceid == in->sourceid);
+    assert(out->deviceid == in->deviceid);
+    assert(out->sourceid == in->sourceid);
 
     switch (in->type) {
         case ET_KeyPress:
@@ -318,41 +316,41 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
             flagmask = 0;
             break;
     }
-    g_assert((out->flags & ~flagmask) == 0);
+    assert((out->flags & ~flagmask) == 0);
 
-    g_assert(out->root == in->root);
-    g_assert(out->event == None); /* set in FixUpEventFromWindow */
-    g_assert(out->child == None); /* set in FixUpEventFromWindow */
+    assert(out->root == in->root);
+    assert(out->event == None); /* set in FixUpEventFromWindow */
+    assert(out->child == None); /* set in FixUpEventFromWindow */
 
-    g_assert(out->mods.base_mods == in->mods.base);
-    g_assert(out->mods.latched_mods == in->mods.latched);
-    g_assert(out->mods.locked_mods == in->mods.locked);
-    g_assert(out->mods.effective_mods == in->mods.effective);
+    assert(out->mods.base_mods == in->mods.base);
+    assert(out->mods.latched_mods == in->mods.latched);
+    assert(out->mods.locked_mods == in->mods.locked);
+    assert(out->mods.effective_mods == in->mods.effective);
 
-    g_assert(out->group.base_group == in->group.base);
-    g_assert(out->group.latched_group == in->group.latched);
-    g_assert(out->group.locked_group == in->group.locked);
-    g_assert(out->group.effective_group == in->group.effective);
+    assert(out->group.base_group == in->group.base);
+    assert(out->group.latched_group == in->group.latched);
+    assert(out->group.locked_group == in->group.locked);
+    assert(out->group.effective_group == in->group.effective);
 
-    g_assert(out->event_x == 0); /* set in FixUpEventFromWindow */
-    g_assert(out->event_y == 0); /* set in FixUpEventFromWindow */
+    assert(out->event_x == 0); /* set in FixUpEventFromWindow */
+    assert(out->event_y == 0); /* set in FixUpEventFromWindow */
 
-    g_assert(out->root_x == FP1616(in->root_x, in->root_x_frac));
-    g_assert(out->root_y == FP1616(in->root_y, in->root_y_frac));
+    assert(out->root_x == FP1616(in->root_x, in->root_x_frac));
+    assert(out->root_y == FP1616(in->root_y, in->root_y_frac));
 
     buttons = 0;
     for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++)
     {
         if (XIMaskIsSet(in->buttons, i))
         {
-            g_assert(out->buttons_len >= bytes_to_int32(bits_to_bytes(i)));
+            assert(out->buttons_len >= bytes_to_int32(bits_to_bytes(i)));
             buttons++;
         }
     }
 
     ptr = (unsigned char*)&out[1];
     for (i = 0; i < sizeof(in->buttons) * 8; i++)
-        g_assert(XIMaskIsSet(in->buttons, i) == XIMaskIsSet(ptr, i));
+        assert(XIMaskIsSet(in->buttons, i) == XIMaskIsSet(ptr, i));
 
 
     valuators = 0;
@@ -360,7 +358,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
         if (XIMaskIsSet(in->valuators.mask, i))
             valuators++;
 
-    g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(valuators)));
+    assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(valuators)));
 
     ptr += out->buttons_len * 4;
     values = (FP3232*)(ptr + out->valuators_len * 4);
@@ -368,11 +366,11 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
                 i < (out->valuators_len * 4) * 8; i++)
     {
         if (i > sizeof(in->valuators.mask) * 8)
-            g_assert(!XIMaskIsSet(ptr, i));
+            assert(!XIMaskIsSet(ptr, i));
         else if (i > out->valuators_len * 4 * 8)
-            g_assert(!XIMaskIsSet(in->valuators.mask, i));
+            assert(!XIMaskIsSet(in->valuators.mask, i));
         else {
-            g_assert(XIMaskIsSet(in->valuators.mask, i) ==
+            assert(XIMaskIsSet(in->valuators.mask, i) ==
                      XIMaskIsSet(ptr, i));
 
             if (XIMaskIsSet(ptr, i))
@@ -392,8 +390,8 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
                 }
 
 
-                g_assert(vi.integral == vo.integral);
-                g_assert(vi.frac == vo.frac);
+                assert(vi.integral == vo.integral);
+                assert(vi.frac == vo.frac);
                 values++;
             }
         }
@@ -406,7 +404,7 @@ static void test_XIDeviceEvent(DeviceEvent *in)
     int rc;
 
     rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
-    g_assert(rc == Success);
+    assert(rc == Success);
 
     test_values_XIDeviceEvent(in, out, FALSE);
 
@@ -425,7 +423,7 @@ static void test_convert_XIDeviceEvent(void)
 
     memset(&in, 0, sizeof(in));
 
-    g_test_message("Testing simple field values");
+    printf("Testing simple field values\n");
     in.header = ET_Internal;
     in.type = ET_Motion;
     in.length = sizeof(DeviceEvent);
@@ -449,7 +447,7 @@ static void test_convert_XIDeviceEvent(void)
 
     test_XIDeviceEvent(&in);
 
-    g_test_message("Testing field ranges");
+    printf("Testing field ranges\n");
     /* 32 bit */
     in.detail.button = 1L;
     test_XIDeviceEvent(&in);
@@ -597,7 +595,7 @@ static void test_convert_XIDeviceEvent(void)
     in.mods.effective = ~0 & 0xFF;
     test_XIDeviceEvent(&in);
 
-    g_test_message("Testing button masks");
+    printf("Testing button masks\n");
     for (i = 0; i < sizeof(in.buttons) * 8; i++)
     {
         XISetMask(in.buttons, i);
@@ -611,7 +609,7 @@ static void test_convert_XIDeviceEvent(void)
         test_XIDeviceEvent(&in);
     }
 
-    g_test_message("Testing valuator masks");
+    printf("Testing valuator masks\n");
     for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
     {
         XISetMask(in.valuators.mask, i);
@@ -656,12 +654,12 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
         swaps(&out->num_classes, n);
     }
 
-    g_assert(out->type == GenericEvent);
-    g_assert(out->extension == 0); /* IReqCode defaults to 0 */
-    g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
-    g_assert(out->time == in->time);
-    g_assert(out->deviceid == in->deviceid);
-    g_assert(out->sourceid == in->sourceid);
+    assert(out->type == GenericEvent);
+    assert(out->extension == 0); /* IReqCode defaults to 0 */
+    assert(out->evtype == GetXI2Type((InternalEvent*)in));
+    assert(out->time == in->time);
+    assert(out->deviceid == in->deviceid);
+    assert(out->sourceid == in->sourceid);
 
     ptr = (unsigned char*)&out[1];
     for (i = 0; i < out->num_classes; i++)
@@ -689,11 +687,11 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
                         swaps(&b->num_buttons, n);
                     }
 
-                    g_assert(b->length ==
+                    assert(b->length ==
                             bytes_to_int32(sizeof(xXIButtonInfo)) +
                             bytes_to_int32(bits_to_bytes(b->num_buttons)) +
                             b->num_buttons);
-                    g_assert(b->num_buttons == in->buttons.num_buttons);
+                    assert(b->num_buttons == in->buttons.num_buttons);
 
                     names = (Atom*)((char*)&b[1] +
                             pad_to_int32(bits_to_bytes(b->num_buttons)));
@@ -704,7 +702,7 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
                             char n;
                             swapl(&names[j], n);
                         }
-                        g_assert(names[j] == in->buttons.names[j]);
+                        assert(names[j] == in->buttons.names[j]);
                     }
                 }
                 break;
@@ -719,10 +717,10 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
                         swaps(&k->num_keycodes, n);
                     }
 
-                    g_assert(k->length ==
+                    assert(k->length ==
                             bytes_to_int32(sizeof(xXIKeyInfo)) +
                             k->num_keycodes);
-                    g_assert(k->num_keycodes == in->keys.max_keycode -
+                    assert(k->num_keycodes == in->keys.max_keycode -
                             in->keys.min_keycode + 1);
 
                     kc = (uint32_t*)&k[1];
@@ -733,21 +731,22 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
                             char n;
                             swapl(&kc[j], n);
                         }
-                        g_assert(kc[j] >= in->keys.min_keycode);
-                        g_assert(kc[j] <= in->keys.max_keycode);
+                        assert(kc[j] >= in->keys.min_keycode);
+                        assert(kc[j] <= in->keys.max_keycode);
                     }
                 }
                 break;
             case XIValuatorClass:
                 {
                     xXIValuatorInfo *v = (xXIValuatorInfo*)any;
-                    g_assert(v->length ==
+                    assert(v->length ==
                              bytes_to_int32(sizeof(xXIValuatorInfo)));
 
                 }
                 break;
             default:
-                g_error("Invalid class type.\n");
+                printf("Invalid class type.\n\n");
+                assert(1);
                 break;
         }
 
@@ -762,7 +761,7 @@ static void test_XIDeviceChangedEvent(DeviceChangedEvent *in)
     int rc;
 
     rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
-    g_assert(rc == Success);
+    assert(rc == Success);
 
     test_values_XIDeviceChangedEvent(in, out, FALSE);
 
@@ -779,7 +778,7 @@ static void test_convert_XIDeviceChangedEvent(void)
     DeviceChangedEvent in;
     int i;
 
-    g_test_message("Testing simple field values");
+    printf("Testing simple field values\n");
     memset(&in, 0, sizeof(in));
     in.header = ET_Internal;
     in.type = ET_DeviceChanged;
@@ -905,13 +904,10 @@ static void test_convert_XIDeviceChangedEvent(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
-    g_test_add_func("/xi2/eventconvert/XIRawEvent", test_convert_XIRawEvent);
-    g_test_add_func("/xi2/eventconvert/XIFocusEvent", test_convert_XIFocusEvent);
-    g_test_add_func("/xi2/eventconvert/XIDeviceEvent", test_convert_XIDeviceEvent);
-    g_test_add_func("/xi2/eventconvert/XIDeviceChangedEvent", test_convert_XIDeviceChangedEvent);
+    test_convert_XIRawEvent();
+    test_convert_XIFocusEvent();
+    test_convert_XIDeviceEvent();
+    test_convert_XIDeviceChangedEvent();
 
-    return g_test_run();
+    return 0;
 }
diff --git a/xorg-server/test/xi2/protocol-xigetclientpointer.c b/xorg-server/test/xi2/protocol-xigetclientpointer.c
index 6b4d04957..5e45e7b32 100644
--- a/xorg-server/test/xi2/protocol-xigetclientpointer.c
+++ b/xorg-server/test/xi2/protocol-xigetclientpointer.c
@@ -39,7 +39,6 @@
 #include "exevents.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 
 struct {
     int cp_is_set;
@@ -79,9 +78,9 @@ static void reply_XIGetClientPointer(ClientPtr client, int len, char *data, void
 
     reply_check_defaults(rep, len, XIGetClientPointer);
 
-    g_assert(rep->set == test_data.cp_is_set);
+    assert(rep->set == test_data.cp_is_set);
     if (rep->set)
-        g_assert(rep->deviceid == test_data.dev->id);
+        assert(rep->deviceid == test_data.dev->id);
 }
 
 static void request_XIGetClientPointer(ClientPtr client, xXIGetClientPointerReq* req, int error)
@@ -92,19 +91,19 @@ static void request_XIGetClientPointer(ClientPtr client, xXIGetClientPointerReq*
     test_data.win = req->win;
 
     rc = ProcXIGetClientPointer(&client_request);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadWindow)
-        g_assert(client_request.errorValue == req->win);
+        assert(client_request.errorValue == req->win);
 
     client_request.swapped = TRUE;
     swapl(&req->win, n);
     swaps(&req->length, n);
     rc = SProcXIGetClientPointer(&client_request);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadWindow)
-        g_assert(client_request.errorValue == req->win);
+        assert(client_request.errorValue == req->win);
 
 }
 
@@ -121,21 +120,21 @@ static void test_XIGetClientPointer(void)
 
     client_request = init_client(request.length, &request);
 
-    g_test_message("Testing invalid window");
+    printf("Testing invalid window\n");
     request.win = INVALID_WINDOW_ID;
     request_XIGetClientPointer(&client_request, &request, BadWindow);
 
     test_data.cp_is_set = FALSE;
 
-    g_test_message("Testing window None, unset ClientPointer.");
+    printf("Testing window None, unset ClientPointer.\n");
     request.win = None;
     request_XIGetClientPointer(&client_request, &request, Success);
 
-    g_test_message("Testing valid window, unset ClientPointer.");
+    printf("Testing valid window, unset ClientPointer.\n");
     request.win = CLIENT_WINDOW_ID;
     request_XIGetClientPointer(&client_request, &request, Success);
 
-    g_test_message("Testing valid window, set ClientPointer.");
+    printf("Testing valid window, set ClientPointer.\n");
     client_window.clientPtr = devices.vcp;
     test_data.dev = devices.vcp;
     test_data.cp_is_set = TRUE;
@@ -144,7 +143,7 @@ static void test_XIGetClientPointer(void)
 
     client_window.clientPtr = NULL;
 
-    g_test_message("Testing window None, set ClientPointer.");
+    printf("Testing window None, set ClientPointer.\n");
     client_request.clientPtr = devices.vcp;
     test_data.dev = devices.vcp;
     test_data.cp_is_set = TRUE;
@@ -154,14 +153,10 @@ static void test_XIGetClientPointer(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
     client_window = init_client(0, NULL);
 
+    test_XIGetClientPointer();
 
-    g_test_add_func("/xi2/protocol/XIGetClientPointer", test_XIGetClientPointer);
-
-    return g_test_run();
+    return 0;
 }
diff --git a/xorg-server/test/xi2/protocol-xigetselectedevents.c b/xorg-server/test/xi2/protocol-xigetselectedevents.c
index 97aae159f..55de77356 100644
--- a/xorg-server/test/xi2/protocol-xigetselectedevents.c
+++ b/xorg-server/test/xi2/protocol-xigetselectedevents.c
@@ -48,7 +48,6 @@
 #include "exevents.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 
 static void reply_XIGetSelectedEvents(ClientPtr client, int len, char *data, void *userdata);
 static void reply_XIGetSelectedEvents_data(ClientPtr client, int len, char *data, void *userdata);
@@ -100,7 +99,7 @@ static void reply_XIGetSelectedEvents(ClientPtr client, int len, char *data, voi
 
     reply_check_defaults(rep, len, XIGetSelectedEvents);
 
-    g_assert(rep->num_masks == test_data.num_masks_expected);
+    assert(rep->num_masks == test_data.num_masks_expected);
 
     reply_handler = reply_XIGetSelectedEvents_data;
 }
@@ -121,11 +120,11 @@ static void reply_XIGetSelectedEvents_data(ClientPtr client, int len, char *data
             swaps(&mask->mask_len, n);
         }
 
-        g_assert(mask->deviceid < 6);
-        g_assert(mask->mask_len <= (((XI2LASTEVENT + 8)/8) + 3)/4) ;
+        assert(mask->deviceid < 6);
+        assert(mask->mask_len <= (((XI2LASTEVENT + 8)/8) + 3)/4) ;
 
         bitmask = (unsigned char*)&mask[1];
-        g_assert(memcmp(bitmask,
+        assert(memcmp(bitmask,
                     test_data.mask[mask->deviceid],
                     mask->mask_len * 4) == 0);
 
@@ -145,14 +144,14 @@ static void request_XIGetSelectedEvents(xXIGetSelectedEventsReq* req, int error)
     reply_handler = reply_XIGetSelectedEvents;
 
     rc = ProcXIGetSelectedEvents(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 
     reply_handler = reply_XIGetSelectedEvents;
     client.swapped = TRUE;
     swapl(&req->win, n);
     swaps(&req->length, n);
     rc = SProcXIGetSelectedEvents(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 }
 
 static void test_XIGetSelectedEvents(void)
@@ -165,11 +164,11 @@ static void test_XIGetSelectedEvents(void)
 
     request_init(&request, XIGetSelectedEvents);
 
-    g_test_message("Testing for BadWindow on invalid window.");
+    printf("Testing for BadWindow on invalid window.\n");
     request.win = None;
     request_XIGetSelectedEvents(&request, BadWindow);
 
-    g_test_message("Testing for zero-length (unset) masks.");
+    printf("Testing for zero-length (unset) masks.\n");
     /* No masks set yet */
     test_data.num_masks_expected = 0;
     request.win = ROOT_WINDOW_ID;
@@ -181,7 +180,7 @@ static void test_XIGetSelectedEvents(void)
     memset(test_data.mask, 0,
            sizeof(test_data.mask));
 
-    g_test_message("Testing for valid masks");
+    printf("Testing for valid masks\n");
     memset(&dev, 0, sizeof(dev)); /* dev->id is enough for XISetEventMask */
     request.win = ROOT_WINDOW_ID;
 
@@ -210,7 +209,7 @@ static void test_XIGetSelectedEvents(void)
         }
     }
 
-    g_test_message("Testing removing all masks");
+    printf("Testing removing all masks\n");
     /* Unset all masks one-by-one */
     for (j = MAXDEVICES - 1; j >= 0; j--)
     {
@@ -229,13 +228,10 @@ static void test_XIGetSelectedEvents(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
 
-    g_test_add_func("/xi2/protocol/XIGetSelectedEvents", test_XIGetSelectedEvents);
+    test_XIGetSelectedEvents();
 
-    return g_test_run();
+    return 0;
 }
 
diff --git a/xorg-server/test/xi2/protocol-xipassivegrabdevice.c b/xorg-server/test/xi2/protocol-xipassivegrabdevice.c
new file mode 100644
index 000000000..a61c1549c
--- /dev/null
+++ b/xorg-server/test/xi2/protocol-xipassivegrabdevice.c
@@ -0,0 +1,234 @@
+/**
+ * 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
+
+/*
+ * Protocol testing for XIPassiveGrab request.
+ */
+#include <stdint.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/extensions/XI2proto.h>
+#include "inputstr.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "xipassivegrab.h"
+#include "exevents.h"
+
+#include "protocol-common.h"
+
+static ClientRec client_request;
+#define N_MODS 7
+static uint32_t modifiers[N_MODS] = {1, 2, 3, 4, 5, 6, 7};
+
+struct test_data {
+    int num_modifiers;
+} testdata;
+
+int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
+                      int button, GrabParameters *param, GrabType grabtype,
+                      GrabMask *mask);
+static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *userdata);
+
+int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+{
+    if (id == root.drawable.id)
+    {
+        *win = &root;
+        return Success;
+    } else if (id == window.drawable.id)
+    {
+        *win = &window;
+        return Success;
+    }
+
+    return __real_dixLookupWindow(win, id, client, access);
+}
+
+int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
+                      int button, GrabParameters *param, GrabType grabtype,
+                      GrabMask *mask)
+{
+    /* Fail every odd modifier */
+    if (param->modifiers % 2)
+        return BadAccess;
+
+    return Success;
+}
+
+static void reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, void *userdata)
+{
+    xXIPassiveGrabDeviceReply *rep = (xXIPassiveGrabDeviceReply*)data;
+
+    if (client->swapped)
+    {
+        char n;
+        swaps(&rep->sequenceNumber, n);
+        swapl(&rep->length, n);
+        swaps(&rep->num_modifiers, n);
+
+        testdata.num_modifiers = rep->num_modifiers;
+    }
+
+    reply_check_defaults(rep, len, XIPassiveGrabDevice);
+
+    /* ProcXIPassiveGrabDevice sends the data in two batches, let the second
+     * handler handle the modifier data */
+    if (rep->num_modifiers > 0)
+        reply_handler = reply_XIPassiveGrabDevice_data;
+}
+
+static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *userdata)
+{
+    int i;
+    int n;
+
+    xXIGrabModifierInfo *mods = (xXIGrabModifierInfo*)data;
+
+    for (i = 0; i < testdata.num_modifiers; i++, mods++)
+    {
+        if (client->swapped)
+            swapl(&mods->modifiers, n);
+
+        /* 1 - 7 is the range we use for the global modifiers array
+         * above */
+        assert(mods->modifiers > 0);
+        assert(mods->modifiers <= 7);
+        assert(mods->modifiers % 2 == 1); /* because we fail odd ones */
+        assert(mods->status != Success);
+        assert(mods->pad0 == 0);
+        assert(mods->pad1 == 0);
+    }
+
+    reply_handler = reply_XIPassiveGrabDevice;
+}
+
+static void request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq* req, int error, int errval)
+{
+    char n;
+    int rc;
+    int modifiers;
+
+    rc = ProcXIPassiveGrabDevice(&client_request);
+    assert(rc == error);
+
+    if (rc != Success)
+        assert(client_request.errorValue == errval);
+
+    client_request.swapped = TRUE;
+    swaps(&req->length, n);
+    swapl(&req->time, n);
+    swapl(&req->grab_window, n);
+    swapl(&req->cursor, n);
+    swapl(&req->detail, n);
+    swaps(&req->deviceid, n);
+    modifiers = req->num_modifiers;
+    swaps(&req->num_modifiers, n);
+    swaps(&req->mask_len, n);
+
+    while(modifiers--)
+    {
+        CARD32 *mod = ((CARD32*)(req + 1)) + modifiers;
+        swapl(mod, n);
+    }
+
+    rc = SProcXIPassiveGrabDevice(&client_request);
+    assert(rc == error);
+
+    if (rc != Success)
+        assert(client_request.errorValue == errval);
+}
+
+static unsigned char *data[4096]; /* the request buffer */
+static void test_XIPassiveGrabDevice(void)
+{
+    int i;
+    xXIPassiveGrabDeviceReq *request = (xXIPassiveGrabDeviceReq*)data;
+    unsigned char *mask;
+
+    request_init(request, XIPassiveGrabDevice);
+
+    request->grab_window = CLIENT_WINDOW_ID;
+
+    reply_handler = reply_XIPassiveGrabDevice;
+    client_request = init_client(request->length, request);
+
+    printf("Testing invalid device\n");
+    request->deviceid = 12;
+    request_XIPassiveGrabDevice(&client_request, request, BadDevice, request->deviceid);
+
+    request->deviceid = XIAllMasterDevices;
+
+    printf("Testing invalid grab types\n");
+    for (i = XIGrabtypeFocusIn + 1; i < 0xFF; i++)
+    {
+        request->grab_type = i;
+        request_XIPassiveGrabDevice(&client_request, request, BadValue, request->grab_type);
+    }
+
+    printf("Testing invalid grab type + detail combinations\n");
+    request->grab_type = XIGrabtypeEnter;
+    request->detail = 1;
+    request_XIPassiveGrabDevice(&client_request, request, BadValue, request->detail);
+
+    request->grab_type = XIGrabtypeFocusIn;
+    request_XIPassiveGrabDevice(&client_request, request, BadValue, request->detail);
+
+    request->detail = 0;
+
+    printf("Testing invalid masks\n");
+    mask = (unsigned char*)&request[1];
+
+    request->mask_len = bytes_to_int32(XI2LASTEVENT + 1);
+    request->length += request->mask_len;
+    SetBit(mask, XI2LASTEVENT + 1);
+    request_XIPassiveGrabDevice(&client_request, request, BadValue, XI2LASTEVENT + 1);
+
+    ClearBit(mask, XI2LASTEVENT + 1);
+
+    /* tested all special cases now, test a few valid cases */
+
+    /* no modifiers */
+    request->deviceid = XIAllDevices;
+    request->grab_type = XIGrabtypeButton;
+    request->detail = XIAnyButton;
+    request_XIPassiveGrabDevice(&client_request, request, Success, 0);
+
+    /* some modifiers */
+    request->num_modifiers = N_MODS;
+    request->length += N_MODS;
+    memcpy((uint32_t*)(request + 1) + request->mask_len, modifiers, sizeof(modifiers));
+    request_XIPassiveGrabDevice(&client_request, request, Success, 0);
+}
+
+int main(int argc, char** argv)
+{
+    init_simple();
+
+    test_XIPassiveGrabDevice();
+
+    return 0;
+}
diff --git a/xorg-server/test/xi2/protocol-xiquerydevice.c b/xorg-server/test/xi2/protocol-xiquerydevice.c
index 508fc4dfb..cb1cc8130 100644
--- a/xorg-server/test/xi2/protocol-xiquerydevice.c
+++ b/xorg-server/test/xi2/protocol-xiquerydevice.c
@@ -38,7 +38,6 @@
 #include "xiquerydevice.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 /*
  * Protocol testing for XIQueryDevice request and reply.
  *
@@ -74,11 +73,11 @@ static void reply_XIQueryDevice(ClientPtr client, int len, char* data, void *use
     reply_check_defaults(rep, len, XIQueryDevice);
 
     if (querydata->which_device == XIAllDevices)
-        g_assert(rep->num_devices == devices.num_devices);
+        assert(rep->num_devices == devices.num_devices);
     else if (querydata->which_device == XIAllMasterDevices)
-        g_assert(rep->num_devices == devices.num_master_devices);
+        assert(rep->num_devices == devices.num_master_devices);
     else
-        g_assert(rep->num_devices == 1);
+        assert(rep->num_devices == 1);
 
     querydata->num_devices_in_reply = rep->num_devices;
     reply_handler = reply_XIQueryDevice_data;
@@ -107,46 +106,46 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
         }
 
         if (querydata->which_device > XIAllMasterDevices)
-            g_assert(info->deviceid == querydata->which_device);
+            assert(info->deviceid == querydata->which_device);
 
-        g_assert(info->deviceid >=  2); /* 0 and 1 is reserved */
+        assert(info->deviceid >=  2); /* 0 and 1 is reserved */
 
 
         switch(info->deviceid)
         {
             case 2:  /* VCP */
                 dev = devices.vcp;
-                g_assert(info->use == XIMasterPointer);
-                g_assert(info->attachment == devices.vck->id);
-                g_assert(info->num_classes == 3); /* 2 axes + button */
+                assert(info->use == XIMasterPointer);
+                assert(info->attachment == devices.vck->id);
+                assert(info->num_classes == 3); /* 2 axes + button */
                 break;
             case 3:  /* VCK */
                 dev = devices.vck;
-                g_assert(info->use == XIMasterKeyboard);
-                g_assert(info->attachment == devices.vcp->id);
-                g_assert(info->num_classes == 1);
+                assert(info->use == XIMasterKeyboard);
+                assert(info->attachment == devices.vcp->id);
+                assert(info->num_classes == 1);
                 break;
             case 4:  /* mouse */
                 dev = devices.mouse;
-                g_assert(info->use == XISlavePointer);
-                g_assert(info->attachment == devices.vcp->id);
-                g_assert(info->num_classes == 3); /* 2 axes + button */
+                assert(info->use == XISlavePointer);
+                assert(info->attachment == devices.vcp->id);
+                assert(info->num_classes == 3); /* 2 axes + button */
                 break;
             case 5:  /* keyboard */
                 dev = devices.kbd;
-                g_assert(info->use == XISlaveKeyboard);
-                g_assert(info->attachment == devices.vck->id);
-                g_assert(info->num_classes == 1);
+                assert(info->use == XISlaveKeyboard);
+                assert(info->attachment == devices.vck->id);
+                assert(info->num_classes == 1);
                 break;
 
             default:
                 /* We shouldn't get here */
-                g_assert(0);
+                assert(0);
                 break;
         }
-        g_assert(info->enabled == dev->enabled);
-        g_assert(info->name_len == strlen(dev->name));
-        g_assert(strncmp((char*)&info[1], dev->name, info->name_len) == 0);
+        assert(info->enabled == dev->enabled);
+        assert(info->name_len == strlen(dev->name));
+        assert(strncmp((char*)&info[1], dev->name, info->name_len) == 0);
 
         any = (xXIAnyInfo*)((char*)&info[1] + ((info->name_len + 3)/4) * 4);
         for (j = 0; j < info->num_classes; j++)
@@ -171,9 +170,9 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
                         if (client->swapped)
                             swaps(&ki->num_keycodes, n);
 
-                        g_assert(any->type == XIKeyClass);
-                        g_assert(ki->num_keycodes == (xkb->max_key_code - xkb->min_key_code + 1));
-                        g_assert(any->length == (2 + ki->num_keycodes));
+                        assert(any->type == XIKeyClass);
+                        assert(ki->num_keycodes == (xkb->max_key_code - xkb->min_key_code + 1));
+                        assert(any->length == (2 + ki->num_keycodes));
 
                         kc = (uint32_t*)&ki[1];
                         for (k = 0; k < ki->num_keycodes; k++, kc++)
@@ -181,15 +180,15 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
                             if (client->swapped)
                                 swapl(kc, n);
 
-                            g_assert(*kc >= xkb->min_key_code);
-                            g_assert(*kc <= xkb->max_key_code);
+                            assert(*kc >= xkb->min_key_code);
+                            assert(*kc <= xkb->max_key_code);
                         }
                         break;
                     }
                 case 2: /* VCP and mouse have the same properties */
                 case 4:
                     {
-                        g_assert(any->type == XIButtonClass ||
+                        assert(any->type == XIButtonClass ||
                                 any->type == XIValuatorClass);
 
                         if (any->type == XIButtonClass)
@@ -200,10 +199,10 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
                             if (client->swapped)
                                 swaps(&bi->num_buttons, n);
 
-                            g_assert(bi->num_buttons == devices.vcp->button->numButtons);
+                            assert(bi->num_buttons == devices.vcp->button->numButtons);
 
                             len = 2 + bi->num_buttons + bytes_to_int32(bits_to_bytes(bi->num_buttons));
-                            g_assert(bi->length == len);
+                            assert(bi->length == len);
                         } else if (any->type == XIValuatorClass)
                         {
                             xXIValuatorInfo *vi = (xXIValuatorInfo*)any;
@@ -219,17 +218,17 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
                                 swapl(&vi->resolution, n);
                             }
 
-                            g_assert(vi->length == 11);
-                            g_assert(vi->number == 0 ||
+                            assert(vi->length == 11);
+                            assert(vi->number == 0 ||
                                      vi->number == 1);
-                            g_assert(vi->mode == XIModeRelative);
+                            assert(vi->mode == XIModeRelative);
                             /* device was set up as relative, so standard
                              * values here. */
-                            g_assert(vi->min.integral == -1);
-                            g_assert(vi->min.frac == 0);
-                            g_assert(vi->max.integral == -1);
-                            g_assert(vi->max.frac == 0);
-                            g_assert(vi->resolution == 0);
+                            assert(vi->min.integral == -1);
+                            assert(vi->min.frac == 0);
+                            assert(vi->max.integral == -1);
+                            assert(vi->max.frac == 0);
+                            assert(vi->resolution == 0);
                         }
                     }
                     break;
@@ -257,10 +256,10 @@ static void request_XIQueryDevice(struct test_data *querydata,
 
     request.deviceid = deviceid;
     rc = ProcXIQueryDevice(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc != Success)
-        g_assert(client.errorValue == deviceid);
+        assert(client.errorValue == deviceid);
 
     reply_handler = reply_XIQueryDevice;
 
@@ -268,10 +267,10 @@ static void request_XIQueryDevice(struct test_data *querydata,
     swaps(&request.length, n);
     swaps(&request.deviceid, n);
     rc = SProcXIQueryDevice(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc != Success)
-        g_assert(client.errorValue == deviceid);
+        assert(client.errorValue == deviceid);
 }
 
 static void test_XIQueryDevice(void)
@@ -284,16 +283,16 @@ static void test_XIQueryDevice(void)
     userdata = &data;
     request_init(&request, XIQueryDevice);
 
-    g_test_message("Testing XIAllDevices.");
+    printf("Testing XIAllDevices.\n");
     request_XIQueryDevice(&data, XIAllDevices, Success);
-    g_test_message("Testing XIAllMasterDevices.");
+    printf("Testing XIAllMasterDevices.\n");
     request_XIQueryDevice(&data, XIAllMasterDevices, Success);
 
-    g_test_message("Testing existing device ids.");
+    printf("Testing existing device ids.\n");
     for (i = 2; i < 6; i++)
         request_XIQueryDevice(&data, i, Success);
 
-    g_test_message("Testing non-existing device ids.");
+    printf("Testing non-existing device ids.\n");
     for (i = 6; i <= 0xFFFF; i++)
         request_XIQueryDevice(&data, i, BadDevice);
 
@@ -304,13 +303,10 @@ static void test_XIQueryDevice(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
 
-    g_test_add_func("/dix/xi2protocol/XIQueryDevice", test_XIQueryDevice);
+    test_XIQueryDevice();
 
-    return g_test_run();
+    return 0;
 }
 
diff --git a/xorg-server/test/xi2/protocol-xiquerypointer.c b/xorg-server/test/xi2/protocol-xiquerypointer.c
index a42d59515..0985ec70d 100644
--- a/xorg-server/test/xi2/protocol-xiquerypointer.c
+++ b/xorg-server/test/xi2/protocol-xiquerypointer.c
@@ -39,7 +39,6 @@
 #include "exevents.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 
 static ClientRec client_request;
 static void reply_XIQueryPointer_data(ClientPtr client, int len,
@@ -96,18 +95,18 @@ static void reply_XIQueryPointer(ClientPtr client, int len, char *data,
 
     reply_check_defaults(rep, len, XIQueryPointer);
 
-    g_assert(rep->root == root.drawable.id);
-    g_assert(rep->same_screen == xTrue);
+    assert(rep->root == root.drawable.id);
+    assert(rep->same_screen == xTrue);
 
     sprite = test_data.dev->spriteInfo->sprite;
-    g_assert((rep->root_x >> 16) == sprite->hot.x);
-    g_assert((rep->root_y >> 16) == sprite->hot.y);
+    assert((rep->root_x >> 16) == sprite->hot.x);
+    assert((rep->root_y >> 16) == sprite->hot.y);
 
     if (test_data.win == &root)
     {
-        g_assert(rep->root_x == rep->win_x);
-        g_assert(rep->root_y == rep->win_y);
-        g_assert(rep->child == window.drawable.id);
+        assert(rep->root_x == rep->win_x);
+        assert(rep->root_y == rep->win_y);
+        assert(rep->child == window.drawable.id);
     } else
     {
         int x, y;
@@ -115,13 +114,13 @@ static void reply_XIQueryPointer(ClientPtr client, int len, char *data,
         x = sprite->hot.x - window.drawable.x;
         y = sprite->hot.y - window.drawable.y;
 
-        g_assert((rep->win_x >> 16) == x);
-        g_assert((rep->win_y >> 16) == y);
-        g_assert(rep->child == None);
+        assert((rep->win_x >> 16) == x);
+        assert((rep->win_y >> 16) == y);
+        assert(rep->child == None);
     }
 
 
-    g_assert(rep->same_screen == xTrue);
+    assert(rep->same_screen == xTrue);
 
     reply_handler = reply_XIQueryPointer_data;
 }
@@ -137,19 +136,19 @@ static void request_XIQueryPointer(ClientPtr client, xXIQueryPointerReq* req, in
     int rc;
 
     rc = ProcXIQueryPointer(&client_request);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadDevice)
-        g_assert(client_request.errorValue == req->deviceid);
+        assert(client_request.errorValue == req->deviceid);
 
     client_request.swapped = TRUE;
     swaps(&req->deviceid, n);
     swaps(&req->length, n);
     rc = SProcXIQueryPointer(&client_request);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadDevice)
-        g_assert(client_request.errorValue == req->deviceid);
+        assert(client_request.errorValue == req->deviceid);
 }
 
 static void test_XIQueryPointer(void)
@@ -209,12 +208,9 @@ static void test_XIQueryPointer(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
 
-    g_test_add_func("/xi2/protocol/XIQueryPointer", test_XIQueryPointer);
+    test_XIQueryPointer();
 
-    return g_test_run();
+    return 0;
 }
diff --git a/xorg-server/test/xi2/protocol-xiqueryversion.c b/xorg-server/test/xi2/protocol-xiqueryversion.c
index 46e62acbd..3bb356e7f 100644
--- a/xorg-server/test/xi2/protocol-xiqueryversion.c
+++ b/xorg-server/test/xi2/protocol-xiqueryversion.c
@@ -46,7 +46,6 @@
 #include "xiqueryversion.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 
 extern XExtensionVersion XIVersion;
 
@@ -74,14 +73,14 @@ static void reply_XIQueryVersion(ClientPtr client, int len, char* data, void *us
 
     reply_check_defaults(rep, len, XIQueryVersion);
 
-    g_assert(rep->length == 0);
+    assert(rep->length == 0);
 
     sver = versions->major_server * 1000 + versions->minor_server;
     cver = versions->major_client * 1000 + versions->minor_client;
     ver = rep->major_version * 1000 + rep->minor_version;
 
-    g_assert(ver >= 2000);
-    g_assert((sver > cver) ? ver == cver : ver == sver);
+    assert(ver >= 2000);
+    assert((sver > cver) ? ver == cver : ver == sver);
 }
 
 /**
@@ -115,7 +114,7 @@ static void request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int e
     request.major_version = versions.major_client;
     request.minor_version = versions.minor_client;
     rc = ProcXIQueryVersion(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 
     client.swapped = TRUE;
 
@@ -124,7 +123,7 @@ static void request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int e
     swaps(&request.minor_version, n);
 
     rc = SProcXIQueryVersion(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 }
 
 /* Client version less than 2.0 must return BadValue, all other combinations
@@ -133,23 +132,23 @@ static void test_XIQueryVersion(void)
 {
     reply_handler = reply_XIQueryVersion;
 
-    g_test_message("Server version 2.0 - client versions [1..3].0");
+    printf("Server version 2.0 - client versions [1..3].0\n");
     /* some simple tests to catch common errors quickly */
     request_XIQueryVersion(2, 0, 1, 0, BadValue);
     request_XIQueryVersion(2, 0, 2, 0, Success);
     request_XIQueryVersion(2, 0, 3, 0, Success);
 
-    g_test_message("Server version 3.0 - client versions [1..3].0");
+    printf("Server version 3.0 - client versions [1..3].0\n");
     request_XIQueryVersion(3, 0, 1, 0, BadValue);
     request_XIQueryVersion(3, 0, 2, 0, Success);
     request_XIQueryVersion(3, 0, 3, 0, Success);
 
-    g_test_message("Server version 2.0 - client versions [1..3].[1..3]");
+    printf("Server version 2.0 - client versions [1..3].[1..3]\n");
     request_XIQueryVersion(2, 0, 1, 1, BadValue);
     request_XIQueryVersion(2, 0, 2, 2, Success);
     request_XIQueryVersion(2, 0, 3, 3, Success);
 
-    g_test_message("Server version 2.2 - client versions [1..3].0");
+    printf("Server version 2.2 - client versions [1..3].0\n");
     request_XIQueryVersion(2, 2, 1, 0, BadValue);
     request_XIQueryVersion(2, 2, 2, 0, Success);
     request_XIQueryVersion(2, 2, 3, 0, Success);
@@ -158,7 +157,7 @@ static void test_XIQueryVersion(void)
     /* this one takes a while */
     unsigned int cmin, cmaj, smin, smaj;
 
-    g_test_message("Testing all combinations.");
+    printf("Testing all combinations.\n");
     for (smaj = 2; smaj <= 0xFFFF; smaj++)
         for (smin = 0; smin <= 0xFFFF; smin++)
             for (cmin = 0; cmin <= 0xFFFF; cmin++)
@@ -175,12 +174,9 @@ static void test_XIQueryVersion(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
 
-    g_test_add_func("/xi2/protocol/XIQueryVersion", test_XIQueryVersion);
+    test_XIQueryVersion();
 
-    return g_test_run();
+    return 0;
 }
diff --git a/xorg-server/test/xi2/protocol-xiselectevents.c b/xorg-server/test/xi2/protocol-xiselectevents.c
index f951a14fe..fa422e2cb 100644
--- a/xorg-server/test/xi2/protocol-xiselectevents.c
+++ b/xorg-server/test/xi2/protocol-xiselectevents.c
@@ -58,7 +58,6 @@
 #include "xiselectev.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 
 static unsigned char *data[4096 * 20]; /* the request data buffer */
 
@@ -107,7 +106,7 @@ static void request_XISelectEvent(xXISelectEventsReq *req, int error)
     client = init_client(req->length, req);
 
     rc = ProcXISelectEvents(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 
     client.swapped = TRUE;
 
@@ -124,7 +123,7 @@ static void request_XISelectEvent(xXISelectEventsReq *req, int error)
     swaps(&req->length, n);
     swaps(&req->num_masks, n);
     rc = SProcXISelectEvents(&client);
-    g_assert(rc == error);
+    assert(rc == error);
 }
 
 static void request_XISelectEvents_masks(xXISelectEventsReq *req)
@@ -250,7 +249,7 @@ static void test_XISelectEvents(void)
 
     request_init(req, XISelectEvents);
 
-    g_test_message("Testing for BadValue on zero-length masks");
+    printf("Testing for BadValue on zero-length masks\n");
     /* zero masks are BadValue, regardless of the window */
     req->num_masks = 0;
 
@@ -263,7 +262,7 @@ static void test_XISelectEvents(void)
     req->win = CLIENT_WINDOW_ID;
     request_XISelectEvent(req, BadValue);
 
-    g_test_message("Testing for BadWindow.");
+    printf("Testing for BadWindow.\n");
     /* None window is BadWindow, regardless of the masks.
      * We don't actually need to set the masks here, BadWindow must occur
      * before checking the masks.
@@ -283,7 +282,7 @@ static void test_XISelectEvents(void)
     req->num_masks = 0xFFFC;
     request_XISelectEvent(req, BadWindow);
 
-    g_test_message("Triggering num_masks/length overflow");
+    printf("Triggering num_masks/length overflow\n");
     req->win = ROOT_WINDOW_ID;
     /* Integer overflow - req->length can't hold that much */
     req->num_masks = 0xFFFF;
@@ -292,14 +291,14 @@ static void test_XISelectEvents(void)
     req->win = ROOT_WINDOW_ID;
     req->num_masks = 1;
 
-    g_test_message("Triggering bogus mask length error");
+    printf("Triggering bogus mask length error\n");
     mask = (xXIEventMask*)&req[1];
     mask->deviceid = 0;
     mask->mask_len = 0xFFFF;
     request_XISelectEvent(req, BadLength);
 
     /* testing various device ids */
-    g_test_message("Testing existing device ids.");
+    printf("Testing existing device ids.\n");
     for (i = 0; i < 6; i++)
     {
         mask = (xXIEventMask*)&req[1];
@@ -310,7 +309,7 @@ static void test_XISelectEvents(void)
         request_XISelectEvent(req, Success);
     }
 
-    g_test_message("Testing non-existing device ids.");
+    printf("Testing non-existing device ids.\n");
     for (i = 6; i <= 0xFFFF; i++)
     {
         req->win = ROOT_WINDOW_ID;
@@ -326,13 +325,10 @@ static void test_XISelectEvents(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
 
-    g_test_add_func("/xi2/protocol/XISelectEvents", test_XISelectEvents);
+    test_XISelectEvents();
 
-    return g_test_run();
+    return 0;
 }
 
diff --git a/xorg-server/test/xi2/protocol-xisetclientpointer.c b/xorg-server/test/xi2/protocol-xisetclientpointer.c
index 2e638eea7..c266b6560 100644
--- a/xorg-server/test/xi2/protocol-xisetclientpointer.c
+++ b/xorg-server/test/xi2/protocol-xisetclientpointer.c
@@ -46,7 +46,6 @@
 #include "exevents.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 
 static ClientRec client_window;
 static ClientRec client_request;
@@ -72,20 +71,20 @@ static void request_XISetClientPointer(xXISetClientPointerReq* req, int error)
     client_request = init_client(req->length, req);
 
     rc = ProcXISetClientPointer(&client_request);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadDevice)
-        g_assert(client_request.errorValue == req->deviceid);
+        assert(client_request.errorValue == req->deviceid);
 
     client_request.swapped = TRUE;
     swapl(&req->win, n);
     swaps(&req->length, n);
     swaps(&req->deviceid, n);
     rc = SProcXISetClientPointer(&client_request);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadDevice)
-        g_assert(client_request.errorValue == req->deviceid);
+        assert(client_request.errorValue == req->deviceid);
 
 }
 
@@ -98,36 +97,36 @@ static void test_XISetClientPointer(void)
 
     request.win = CLIENT_WINDOW_ID;
 
-    g_test_message("Testing BadDevice error for XIAllDevices and XIMasterDevices.");
+    printf("Testing BadDevice error for XIAllDevices and XIMasterDevices.\n");
     request.deviceid = XIAllDevices;
     request_XISetClientPointer(&request, BadDevice);
 
     request.deviceid = XIAllMasterDevices;
     request_XISetClientPointer(&request, BadDevice);
 
-    g_test_message("Testing Success for VCP and VCK.");
+    printf("Testing Success for VCP and VCK.\n");
     request.deviceid = devices.vcp->id; /* 2 */
     request_XISetClientPointer(&request, Success);
-    g_assert(client_window.clientPtr->id == 2);
+    assert(client_window.clientPtr->id == 2);
 
     request.deviceid = devices.vck->id; /* 3 */
     request_XISetClientPointer(&request, Success);
-    g_assert(client_window.clientPtr->id == 2);
+    assert(client_window.clientPtr->id == 2);
 
-    g_test_message("Testing BadDevice error for all other devices.");
+    printf("Testing BadDevice error for all other devices.\n");
     for (i = 4; i <= 0xFFFF; i++)
     {
         request.deviceid = i;
         request_XISetClientPointer(&request, BadDevice);
     }
 
-    g_test_message("Testing window None");
+    printf("Testing window None\n");
     request.win = None;
     request.deviceid = devices.vcp->id; /* 2 */
     request_XISetClientPointer(&request, Success);
-    g_assert(client_request.clientPtr->id == 2);
+    assert(client_request.clientPtr->id == 2);
 
-    g_test_message("Testing invalid window");
+    printf("Testing invalid window\n");
     request.win = INVALID_WINDOW_ID;
     request.deviceid = devices.vcp->id;
     request_XISetClientPointer(&request, BadWindow);
@@ -137,13 +136,10 @@ static void test_XISetClientPointer(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
     client_window = init_client(0, NULL);
 
-    g_test_add_func("/xi2/protocol/XISetClientPointer", test_XISetClientPointer);
+    test_XISetClientPointer();
 
-    return g_test_run();
+    return 0;
 }
diff --git a/xorg-server/test/xi2/protocol-xiwarppointer.c b/xorg-server/test/xi2/protocol-xiwarppointer.c
index 75b7617a0..0c8db453d 100644
--- a/xorg-server/test/xi2/protocol-xiwarppointer.c
+++ b/xorg-server/test/xi2/protocol-xiwarppointer.c
@@ -39,7 +39,6 @@
 #include "exevents.h"
 
 #include "protocol-common.h"
-#include <glib.h>
 
 static int expected_x = SPRITE_X;
 static int expected_y = SPRITE_Y;
@@ -70,8 +69,8 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access
 static Bool ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr screen,
                                     int x, int y, Bool generateEvent)
 {
-    g_assert(x == expected_x);
-    g_assert(y == expected_y);
+    assert(x == expected_x);
+    assert(y == expected_y);
     return TRUE;
 }
 
@@ -83,12 +82,12 @@ static void request_XIWarpPointer(ClientPtr client, xXIWarpPointerReq* req,
     int rc;
 
     rc = ProcXIWarpPointer(client);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadDevice)
-        g_assert(client->errorValue == req->deviceid);
+        assert(client->errorValue == req->deviceid);
     else if (rc == BadWindow)
-        g_assert(client->errorValue == req->dst_win ||
+        assert(client->errorValue == req->dst_win ||
                  client->errorValue == req->src_win);
 
 
@@ -105,12 +104,12 @@ static void request_XIWarpPointer(ClientPtr client, xXIWarpPointerReq* req,
     swaps(&req->deviceid, n);
 
     rc = SProcXIWarpPointer(client);
-    g_assert(rc == error);
+    assert(rc == error);
 
     if (rc == BadDevice)
-        g_assert(client->errorValue == req->deviceid);
+        assert(client->errorValue == req->deviceid);
     else if (rc == BadWindow)
-        g_assert(client->errorValue == req->dst_win ||
+        assert(client->errorValue == req->dst_win ||
                  client->errorValue == req->src_win);
 
     client->swapped = FALSE;
@@ -204,13 +203,10 @@ static void test_XIWarpPointer(void)
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
     init_simple();
     screen.SetCursorPosition = ScreenSetCursorPosition;
 
-    g_test_add_func("/xi2/protocol/XIWarpPointer", test_XIWarpPointer);
+    test_XIWarpPointer();
 
-    return g_test_run();
+    return 0;
 }
diff --git a/xorg-server/test/xkb.c b/xorg-server/test/xkb.c
index 6fbb26a01..421153cd1 100644
--- a/xorg-server/test/xkb.c
+++ b/xorg-server/test/xkb.c
@@ -46,8 +46,7 @@
 #include <X11/extensions/XKMformat.h>
 #include "xkbfile.h"
 #include "../xkb/xkb.h"
-
-#include <glib.h>
+#include <assert.h>
 
 /**
  * Initialize an empty XkbRMLVOSet.
@@ -62,16 +61,16 @@ static void xkb_get_rules_test(void)
     XkbGetRulesDflts(&rmlvo);
 
 
-    g_assert(rmlvo.rules);
-    g_assert(rmlvo.model);
-    g_assert(rmlvo.layout);
-    g_assert(rmlvo.variant);
-    g_assert(rmlvo.options);
-    g_assert(strcmp(rmlvo.rules, XKB_DFLT_RULES) == 0);
-    g_assert(strcmp(rmlvo.model, XKB_DFLT_MODEL) == 0);
-    g_assert(strcmp(rmlvo.layout, XKB_DFLT_LAYOUT) == 0);
-    g_assert(strcmp(rmlvo.variant, XKB_DFLT_VARIANT) == 0);
-    g_assert(strcmp(rmlvo.options, XKB_DFLT_OPTIONS) == 0);
+    assert(rmlvo.rules);
+    assert(rmlvo.model);
+    assert(rmlvo.layout);
+    assert(rmlvo.variant);
+    assert(rmlvo.options);
+    assert(strcmp(rmlvo.rules, XKB_DFLT_RULES) == 0);
+    assert(strcmp(rmlvo.model, XKB_DFLT_MODEL) == 0);
+    assert(strcmp(rmlvo.layout, XKB_DFLT_LAYOUT) == 0);
+    assert(strcmp(rmlvo.variant, XKB_DFLT_VARIANT) == 0);
+    assert(strcmp(rmlvo.options, XKB_DFLT_OPTIONS) == 0);
 }
 
 /**
@@ -95,17 +94,17 @@ static void xkb_set_rules_test(void)
     XkbGetRulesDflts(&rmlvo_new);
 
     /* XkbGetRulesDflts strdups the values */
-    g_assert(rmlvo.rules != rmlvo_new.rules);
-    g_assert(rmlvo.model != rmlvo_new.model);
-    g_assert(rmlvo.layout != rmlvo_new.layout);
-    g_assert(rmlvo.variant != rmlvo_new.variant);
-    g_assert(rmlvo.options != rmlvo_new.options);
-
-    g_assert(strcmp(rmlvo.rules, rmlvo_new.rules) == 0);
-    g_assert(strcmp(rmlvo.model, rmlvo_new.model) == 0);
-    g_assert(strcmp(rmlvo.layout, rmlvo_new.layout) == 0);
-    g_assert(strcmp(rmlvo.variant, rmlvo_new.variant) == 0);
-    g_assert(strcmp(rmlvo.options, rmlvo_new.options) == 0);
+    assert(rmlvo.rules != rmlvo_new.rules);
+    assert(rmlvo.model != rmlvo_new.model);
+    assert(rmlvo.layout != rmlvo_new.layout);
+    assert(rmlvo.variant != rmlvo_new.variant);
+    assert(rmlvo.options != rmlvo_new.options);
+
+    assert(strcmp(rmlvo.rules, rmlvo_new.rules) == 0);
+    assert(strcmp(rmlvo.model, rmlvo_new.model) == 0);
+    assert(strcmp(rmlvo.layout, rmlvo_new.layout) == 0);
+    assert(strcmp(rmlvo.variant, rmlvo_new.variant) == 0);
+    assert(strcmp(rmlvo.options, rmlvo_new.options) == 0);
 }
 
 
@@ -145,29 +144,26 @@ static void xkb_set_get_rules_test(void)
 
     /* This test is iffy, because strictly we may be comparing against already
      * freed memory */
-    g_assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0);
-    g_assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0);
-    g_assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0);
-    g_assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0);
-    g_assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0);
+    assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0);
+    assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0);
+    assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0);
+    assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0);
+    assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0);
 
     XkbGetRulesDflts(&rmlvo);
-    g_assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0);
-    g_assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0);
-    g_assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0);
-    g_assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0);
-    g_assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0);
+    assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0);
+    assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0);
+    assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0);
+    assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0);
+    assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0);
 }
 
 
 int main(int argc, char** argv)
 {
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
-    g_test_add_func("/xkb/set-get-rules", xkb_set_get_rules_test);
-    g_test_add_func("/xkb/get-rules", xkb_get_rules_test);
-    g_test_add_func("/xkb/set-rules", xkb_set_rules_test);
+    xkb_set_get_rules_test();
+    xkb_get_rules_test();
+    xkb_set_rules_test();
 
-    return g_test_run();
+    return 0;
 }
diff --git a/xorg-server/test/xtest.c b/xorg-server/test/xtest.c
index cd8f23bff..2ab46505f 100644
--- a/xorg-server/test/xtest.c
+++ b/xorg-server/test/xtest.c
@@ -1,118 +1,113 @@
-/**
- * Copyright © 2009 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 <stdint.h>
-#include <X11/Xatom.h>
-#include "input.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "exevents.h"
-#include "xkbsrv.h"
-#include "xserver-properties.h"
-
-#include <glib.h>
-
-/**
- */
-
-/* from Xext/xtest.c */
-extern DeviceIntPtr xtestpointer, xtestkeyboard;
-
-/* Needed for the screen setup, otherwise we crash during sprite initialization */
-static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
-
-static void xtest_init_devices(void)
-{
-    ScreenRec screen;
-
-    /* random stuff that needs initialization */
-    memset(&screen, 0, sizeof(screen));
-    screenInfo.numScreens = 1;
-    screenInfo.screens[0] = &screen;
-    screen.myNum = 0;
-    screen.id = 100;
-    screen.width = 640;
-    screen.height = 480;
-    screen.DeviceCursorInitialize = device_cursor_init;
-    dixResetPrivates();
-    InitAtoms();
-
-    XkbInitPrivates();
-
-    /* this also inits the xtest devices */
-    InitCoreDevices();
-
-    g_assert(xtestpointer);
-    g_assert(xtestkeyboard);
-    g_assert(IsXTestDevice(xtestpointer, NULL));
-    g_assert(IsXTestDevice(xtestkeyboard, NULL));
-    g_assert(IsXTestDevice(xtestpointer, inputInfo.pointer));
-    g_assert(IsXTestDevice(xtestkeyboard, inputInfo.keyboard));
-    g_assert(GetXTestDevice(inputInfo.pointer) == xtestpointer);
-    g_assert(GetXTestDevice(inputInfo.keyboard) == xtestkeyboard);
-}
-
-/**
- * Each xtest devices has a property attached marking it. This property
- * cannot be changed.
- */
-static void xtest_properties(void)
-{
-    int rc;
-    char value = 1;
-    XIPropertyValuePtr prop;
-    Atom xtest_prop = XIGetKnownProperty(XI_PROP_XTEST_DEVICE);
-
-    rc = XIGetDeviceProperty(xtestpointer, xtest_prop, &prop);
-    g_assert(rc == Success);
-    g_assert(prop);
-
-    rc = XIGetDeviceProperty(xtestkeyboard, xtest_prop, &prop);
-    g_assert(rc == Success);
-    g_assert(prop != NULL);
-
-    rc = XIChangeDeviceProperty(xtestpointer, xtest_prop,
-                                XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
-    g_assert(rc == BadAccess);
-    rc = XIChangeDeviceProperty(xtestkeyboard, xtest_prop,
-                                XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
-    g_assert(rc == BadAccess);
-}
-
-
-
-int main(int argc, char** argv)
-{
-    g_test_init(&argc, &argv,NULL);
-    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
-    g_test_add_func("/dix/xtest/init", xtest_init_devices);
-    g_test_add_func("/dix/xtest/properties", xtest_properties);
-
-    return g_test_run();
-}
-
-
+/**
+ * Copyright © 2009 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 <stdint.h>
+#include <X11/Xatom.h>
+#include "input.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "exevents.h"
+#include "xkbsrv.h"
+#include "xserver-properties.h"
+
+/**
+ */
+
+/* from Xext/xtest.c */
+extern DeviceIntPtr xtestpointer, xtestkeyboard;
+
+/* Needed for the screen setup, otherwise we crash during sprite initialization */
+static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
+
+static void xtest_init_devices(void)
+{
+    ScreenRec screen;
+
+    /* random stuff that needs initialization */
+    memset(&screen, 0, sizeof(screen));
+    screenInfo.numScreens = 1;
+    screenInfo.screens[0] = &screen;
+    screen.myNum = 0;
+    screen.id = 100;
+    screen.width = 640;
+    screen.height = 480;
+    screen.DeviceCursorInitialize = device_cursor_init;
+    dixResetPrivates();
+    InitAtoms();
+
+    XkbInitPrivates();
+
+    /* this also inits the xtest devices */
+    InitCoreDevices();
+
+    assert(xtestpointer);
+    assert(xtestkeyboard);
+    assert(IsXTestDevice(xtestpointer, NULL));
+    assert(IsXTestDevice(xtestkeyboard, NULL));
+    assert(IsXTestDevice(xtestpointer, inputInfo.pointer));
+    assert(IsXTestDevice(xtestkeyboard, inputInfo.keyboard));
+    assert(GetXTestDevice(inputInfo.pointer) == xtestpointer);
+    assert(GetXTestDevice(inputInfo.keyboard) == xtestkeyboard);
+}
+
+/**
+ * Each xtest devices has a property attached marking it. This property
+ * cannot be changed.
+ */
+static void xtest_properties(void)
+{
+    int rc;
+    char value = 1;
+    XIPropertyValuePtr prop;
+    Atom xtest_prop = XIGetKnownProperty(XI_PROP_XTEST_DEVICE);
+
+    rc = XIGetDeviceProperty(xtestpointer, xtest_prop, &prop);
+    assert(rc == Success);
+    assert(prop);
+
+    rc = XIGetDeviceProperty(xtestkeyboard, xtest_prop, &prop);
+    assert(rc == Success);
+    assert(prop != NULL);
+
+    rc = XIChangeDeviceProperty(xtestpointer, xtest_prop,
+                                XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
+    assert(rc == BadAccess);
+    rc = XIChangeDeviceProperty(xtestkeyboard, xtest_prop,
+                                XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
+    assert(rc == BadAccess);
+}
+
+
+
+int main(int argc, char** argv)
+{
+    xtest_init_devices();
+    xtest_properties();
+
+    return 0;
+}
+
+
diff --git a/xorg-server/xkeyboard-config/rules/base.extras.xml.in b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
index 19f8fade7..4faff93c3 100644
--- a/xorg-server/xkeyboard-config/rules/base.extras.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
@@ -7,7 +7,7 @@
       <configItem>
         <name>apl</name>
         <_shortDescription>APL</_shortDescription>
-        <_description>APL</_description>
+        <_description>APL Keyboard Symbols</_description>
         <languageList><iso639Id>eng</iso639Id></languageList>
       </configItem>
       <variantList/>
@@ -40,7 +40,7 @@
       <configItem>
         <name>ir</name>
         <_shortDescription>Iran</_shortDescription>
-        <_description>Iran</_description>
+        <_description>Persian</_description>
         <languageList><iso639Id>per</iso639Id></languageList>
       </configItem>
       <variantList>
@@ -88,13 +88,13 @@
         <variant>
           <configItem>
             <name>ykeydvorak</name>
-            <_description>Latvian (US Dvorak, Y-letter variant)</_description>
+            <_description>Latvian (US Dvorak, Y variant)</_description>
           </configItem>
         </variant>
         <variant>
           <configItem>
             <name>minuskeydvorak</name>
-            <_description>Latvian (US Dvorak, minus-letter variant)</_description>
+            <_description>Latvian (US Dvorak, minus variant)</_description>
           </configItem>
         </variant>
         <variant>
@@ -106,13 +106,13 @@
         <variant>
           <configItem>
             <name>ykeydvorakprogr</name>
-            <_description>Latvian (programmer US Dvorak, Y-letter variant)</_description>
+            <_description>Latvian (programmer US Dvorak, Y variant)</_description>
           </configItem>
         </variant>
         <variant>
           <configItem>
             <name>minuskeydvorakprogr</name>
-	    <_description>Latvian (programmer US Dvorak - minus-letter variant)</_description>
+	    <_description>Latvian (programmer US Dvorak, minus variant)</_description>
           </configItem>
         </variant>
         <variant>
@@ -132,15 +132,15 @@
     <layout>
       <configItem>
         <name>us</name>
-        <_shortDescription>USA</_shortDescription>
-        <_description>USA</_description>
+        <_shortDescription>en</_shortDescription>
+        <_description>English (US)</_description>
         <languageList><iso639Id>eng</iso639Id></languageList>
       </configItem>
       <variantList>
         <variant>
           <configItem>
             <name>intl-unicode</name>
-            <_description>English (US, international (AltGr Unicode combining)</_description>
+            <_description>English (US, international AltGr Unicode combining)</_description>
           </configItem>
         </variant>
         <variant>
@@ -185,7 +185,7 @@
       <configItem>
         <name>rs</name>
         <_shortDescription>Srb</_shortDescription>
-        <_description>Serbia</_description>
+        <_description>Serbian</_description>
         <languageList><iso639Id>srp</iso639Id></languageList>
       </configItem>
       <variantList>
diff --git a/xorg-server/xkeyboard-config/symbols/apl b/xorg-server/xkeyboard-config/symbols/apl
index 4421cc398..0ebc26843 100644
--- a/xorg-server/xkeyboard-config/symbols/apl
+++ b/xorg-server/xkeyboard-config/symbols/apl
@@ -122,7 +122,7 @@ xkb_symbols "unified" {
 default
 partial alphanumeric_keys modifier_keys 
 xkb_symbols "sax" {
-	name[Group1]= "APL Keyboard Symbols: Sharp APL for Unix";
+	name[Group1]= "APL Keyboard Symbols";
 
 	include "apl(unified)"
 
diff --git a/xorg-server/xkeyboard-config/symbols/et b/xorg-server/xkeyboard-config/symbols/et
index dccf9ca06..22ba892aa 100644
--- a/xorg-server/xkeyboard-config/symbols/et
+++ b/xorg-server/xkeyboard-config/symbols/et
@@ -14,7 +14,7 @@ xkb_symbols "basic" {
 partial alphanumeric_keys
 xkb_symbols "olpc" {
 
-    name[Group1]="Ethiopia";
+    name[Group1]="Amharic";
 
     key <AE01>	{ [        0x01001369,  0x01001372 ] }; // 1
     key <AE02>	{ [        0x0100136a,  0x01001373 ] }; // 2
diff --git a/xorg-server/xkeyboard-config/symbols/lv b/xorg-server/xkeyboard-config/symbols/lv
index 97e4220fc..77a9458b0 100644
--- a/xorg-server/xkeyboard-config/symbols/lv
+++ b/xorg-server/xkeyboard-config/symbols/lv
@@ -452,7 +452,7 @@ xkb_symbols "ykeydvorakprogr" {
 
 	include "lv(dvorakprogr)"
 
-	name[Group1]= "Latvian (programmer US-Dvorak, Y variant)";
+	name[Group1]= "Latvian (programmer US Dvorak, Y variant)";
 
 	key <AD05> {[ISO_Level3_Latch, ISO_Level3_Latch, y, Y]};
 	key <SPCE> {[space, space, y, Y]};
diff --git a/xorg-server/xkeyboard-config/symbols/us b/xorg-server/xkeyboard-config/symbols/us
index 19ddae869..1d8bdd0dd 100644
--- a/xorg-server/xkeyboard-config/symbols/us
+++ b/xorg-server/xkeyboard-config/symbols/us
@@ -992,7 +992,7 @@ partial alphanumeric_keys
 xkb_symbols "olpc" {
 
    include "us(basic)"
-   name[Group1]= "USA";
+   name[Group1]= "English (US)";
 
    // OLPC international US English keyboard layout.
    // It's a little different from the usual international layout.
@@ -1146,7 +1146,7 @@ xkb_symbols "hbs" {
 partial alphanumeric_keys
 xkb_symbols "htcdream" {
         include "inet(htcdream)"
-        name[Group1]= "English (USA)";
+        name[Group1]= "English (US)";
 
         //second row
         key <AD01> { [ q, Q, Tab, Tab ] };
diff --git a/xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh b/xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh
index ccaaba7e0..90981a939 100644
--- a/xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh
+++ b/xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh
@@ -1,43 +1,51 @@
-#!/bin/sh
-
-#
-# This script compares the group names which "have to be", according to the descriptions in base.xml -
-# and actually existing in the symbol files. Some differences are ok (like extra double quotes or 
-# extra escaping character) - but all the rest should be in sync.
-#
-
-ROOT="`dirname $0`/.."
-F1=reg2ll.lst
-F2=gn2ll.lst
-
-xsltproc $ROOT/xslt/reg2ll.xsl $ROOT/rules/base.xml | sort | uniq > $F1
-
-for i in $ROOT/symbols/*; do
-  if [ -f $i ]; then
-    id="`basename $i`"
-    export id
-    gawk 'BEGIN{
-  FS = "\"";
-  id = ENVIRON["id"];
-  isDefault = 0;
-}
-/.*default.*/{
-  isDefault = 1;
-}
-/xkb_symbols/{
-  variant = $2;
-}/^[[:space:]]*name\[Group1\][[:space:]]*=/{
-  if (isDefault == 1)
-  {
-    printf "%s:\"%s\"\n",id,$2;
-    isDefault=0;
-  } else
-  {
-    name=$2;
-    printf "%s(%s):\"%s\"\n", id, variant, name;
-  }
-}' $i
-  fi
-done | sort | uniq > $F2
-
-diff $F1 $F2
+#!/bin/sh
+
+#
+# This script compares the group names which "have to be", according to the descriptions in base.xml -
+# and actually existing in the symbol files. Some differences are ok (like extra double quotes or 
+# extra escaping character) - but all the rest should be in sync.
+#
+
+ROOT="`dirname $0`/.."
+F1=reg2ll.lst
+F2=gn2ll.lst
+F1b=${F1}base
+F1e=${F1}extras
+
+xsltproc $ROOT/xslt/reg2ll.xsl $ROOT/rules/base.xml > $F1b
+xsltproc $ROOT/xslt/reg2ll.xsl $ROOT/rules/base.extras.xml > $F1e
+cat $F1b $F1e | sort | uniq > $F1
+rm -f $F1e $F1e
+
+for i in $ROOT/symbols/*; do
+  if [ -f $i ]; then
+    id="`basename $i`"
+    export id
+    gawk 'BEGIN{
+  FS = "\"";
+  id = ENVIRON["id"];
+  isDefault = 0;
+}
+/.*default.*/{
+  isDefault = 1;
+}
+/xkb_symbols/{
+  variant = $2;
+}/^[[:space:]]*name\[Group1\][[:space:]]*=/{
+  if (isDefault == 1)
+  {
+    printf "%s:\"%s\"\n",id,$2;
+    isDefault=0;
+  } else
+  {
+    name=$2;
+    if (variant == "olpc" || variant == "htcdream")
+      printf "%s:\"%s\"\n", id, name;
+    else
+      printf "%s(%s):\"%s\"\n", id, variant, name;
+  }
+}' $i
+  fi
+done | sort | uniq > $F2
+
+diff $F1 $F2
-- 
cgit v1.2.3