Retire miniglx and move the actual glx code up to src/glx
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 9 Feb 2010 14:58:36 +0000 (09:58 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 9 Feb 2010 14:58:36 +0000 (09:58 -0500)
118 files changed:
Makefile
configs/darwin
configs/freebsd-dri
configs/linux-dri
configs/linux-dri-xcb
configs/linux-indirect
configure.ac
docs/egl.html
src/gallium/state_trackers/egl/Makefile
src/gallium/state_trackers/egl/x11/glxinit.c
src/glx/Makefile
src/glx/XF86dri.c [new file with mode: 0644]
src/glx/clientattrib.c [new file with mode: 0644]
src/glx/compsize.c [new file with mode: 0644]
src/glx/dri2.c [new file with mode: 0644]
src/glx/dri2.h [new file with mode: 0644]
src/glx/dri2_glx.c [new file with mode: 0644]
src/glx/dri_common.c [new file with mode: 0644]
src/glx/dri_common.h [new file with mode: 0644]
src/glx/dri_glx.c [new file with mode: 0644]
src/glx/drisw_glx.c [new file with mode: 0644]
src/glx/eval.c [new file with mode: 0644]
src/glx/glcontextmodes.c [new file with mode: 0644]
src/glx/glcontextmodes.h [new file with mode: 0644]
src/glx/glx_pbuffer.c [new file with mode: 0644]
src/glx/glx_query.c [new file with mode: 0644]
src/glx/glxclient.h [new file with mode: 0644]
src/glx/glxcmds.c [new file with mode: 0644]
src/glx/glxcurrent.c [new file with mode: 0644]
src/glx/glxext.c [new file with mode: 0644]
src/glx/glxextensions.c [new file with mode: 0644]
src/glx/glxextensions.h [new file with mode: 0644]
src/glx/glxhash.c [new file with mode: 0644]
src/glx/glxhash.h [new file with mode: 0644]
src/glx/indirect.c [new file with mode: 0644]
src/glx/indirect.h [new file with mode: 0644]
src/glx/indirect_init.c [new file with mode: 0644]
src/glx/indirect_init.h [new file with mode: 0644]
src/glx/indirect_size.c [new file with mode: 0644]
src/glx/indirect_size.h [new file with mode: 0644]
src/glx/indirect_texture_compression.c [new file with mode: 0644]
src/glx/indirect_transpose_matrix.c [new file with mode: 0644]
src/glx/indirect_vertex_array.c [new file with mode: 0644]
src/glx/indirect_vertex_array.h [new file with mode: 0644]
src/glx/indirect_vertex_array_priv.h [new file with mode: 0644]
src/glx/indirect_vertex_program.c [new file with mode: 0644]
src/glx/indirect_window_pos.c [new file with mode: 0644]
src/glx/mini/Makefile [deleted file]
src/glx/mini/NOTES [deleted file]
src/glx/mini/dispatch.c [deleted file]
src/glx/mini/driver.h [deleted file]
src/glx/mini/example.miniglx.conf [deleted file]
src/glx/mini/miniglx.c [deleted file]
src/glx/mini/miniglxP.h [deleted file]
src/glx/mini/miniglx_events.c [deleted file]
src/glx/packrender.h [new file with mode: 0644]
src/glx/packsingle.h [new file with mode: 0644]
src/glx/pixel.c [new file with mode: 0644]
src/glx/pixelstore.c [new file with mode: 0644]
src/glx/render2.c [new file with mode: 0644]
src/glx/renderpix.c [new file with mode: 0644]
src/glx/single2.c [new file with mode: 0644]
src/glx/singlepix.c [new file with mode: 0644]
src/glx/vertarr.c [new file with mode: 0644]
src/glx/x11/Makefile [deleted file]
src/glx/x11/XF86dri.c [deleted file]
src/glx/x11/clientattrib.c [deleted file]
src/glx/x11/compsize.c [deleted file]
src/glx/x11/dri2.c [deleted file]
src/glx/x11/dri2.h [deleted file]
src/glx/x11/dri2_glx.c [deleted file]
src/glx/x11/dri_common.c [deleted file]
src/glx/x11/dri_common.h [deleted file]
src/glx/x11/dri_glx.c [deleted file]
src/glx/x11/drisw_glx.c [deleted file]
src/glx/x11/eval.c [deleted file]
src/glx/x11/glcontextmodes.c [deleted file]
src/glx/x11/glcontextmodes.h [deleted file]
src/glx/x11/glx_pbuffer.c [deleted file]
src/glx/x11/glx_query.c [deleted file]
src/glx/x11/glxclient.h [deleted file]
src/glx/x11/glxcmds.c [deleted file]
src/glx/x11/glxcurrent.c [deleted file]
src/glx/x11/glxext.c [deleted file]
src/glx/x11/glxextensions.c [deleted file]
src/glx/x11/glxextensions.h [deleted file]
src/glx/x11/glxhash.c [deleted file]
src/glx/x11/glxhash.h [deleted file]
src/glx/x11/indirect.c [deleted file]
src/glx/x11/indirect.h [deleted file]
src/glx/x11/indirect_init.c [deleted file]
src/glx/x11/indirect_init.h [deleted file]
src/glx/x11/indirect_size.c [deleted file]
src/glx/x11/indirect_size.h [deleted file]
src/glx/x11/indirect_texture_compression.c [deleted file]
src/glx/x11/indirect_transpose_matrix.c [deleted file]
src/glx/x11/indirect_vertex_array.c [deleted file]
src/glx/x11/indirect_vertex_array.h [deleted file]
src/glx/x11/indirect_vertex_array_priv.h [deleted file]
src/glx/x11/indirect_vertex_program.c [deleted file]
src/glx/x11/indirect_window_pos.c [deleted file]
src/glx/x11/packrender.h [deleted file]
src/glx/x11/packsingle.h [deleted file]
src/glx/x11/pixel.c [deleted file]
src/glx/x11/pixelstore.c [deleted file]
src/glx/x11/render2.c [deleted file]
src/glx/x11/renderpix.c [deleted file]
src/glx/x11/single2.c [deleted file]
src/glx/x11/singlepix.c [deleted file]
src/glx/x11/vertarr.c [deleted file]
src/glx/x11/xf86dri.h [deleted file]
src/glx/x11/xf86dristr.h [deleted file]
src/glx/x11/xfont.c [deleted file]
src/glx/xf86dri.h [new file with mode: 0644]
src/glx/xf86dristr.h [new file with mode: 0644]
src/glx/xfont.c [new file with mode: 0644]
src/mesa/glapi/Makefile
src/mesa/main/dispatch.c

index bf8debfd5b37a8aa465ad2f88e4bdd813d8ef4cf..09a8ca29771a3813c7e55a470bbe99176b9a30b3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -361,8 +361,8 @@ DRI_FILES = \
        $(DIRECTORY)/include/GL/internal/glcore.h                       \
        $(DIRECTORY)/include/GL/internal/sarea.h                        \
        $(DIRECTORY)/src/glx/Makefile                                   \
-       $(DIRECTORY)/src/glx/x11/Makefile                               \
-       $(DIRECTORY)/src/glx/x11/*.[ch]                                 \
+       $(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                     \
@@ -488,7 +488,7 @@ GLUT_FILES = \
 
 DEPEND_FILES = \
        $(TOP)/src/mesa/depend          \
-       $(TOP)/src/glx/x11/depend       \
+       $(TOP)/src/glx/depend           \
        $(TOP)/src/glw/depend           \
        $(TOP)/src/glut/glx/depend      \
        $(TOP)/src/glu/sgi/depend
index 7556688fe6dd431c74a7f731b3d0402be4600db5..d28d5906ba14df5fe525ebc4e0a10e65c660450a 100644 (file)
@@ -16,7 +16,7 @@ DEFINES =  -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
           -DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING
 
 # -D_GNU_SOURCE          - for src/mesa/main ...
-# -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx/x11
+# -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx
 # -DGLX_USE_APPLEGL      - supposed to be used with GLX_DIRECT_RENDERING to use AGL rather than DRM, but doesn't compile
 # -DIN_DRI_DRIVER
 
@@ -49,7 +49,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X
 APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
 
 # omit glw lib for now:
-SRC_DIRS = glsl glx/x11 mesa gallium glu glut/glx glew
+SRC_DIRS = glsl glx mesa gallium glu glut/glx glew
 GLU_DIRS = sgi
 DRIVER_DIRS = osmesa
 #DRIVER_DIRS = dri
index 0ec25f916ed24660e65509fc1b21bafae4e43ece..da63e3b78c5da749e7bb97c07a0ea545ba8ca31d 100644 (file)
@@ -41,7 +41,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
 
 
 # Directories
-SRC_DIRS = glx/x11 gallium mesa glu glut/glx glew glw
+SRC_DIRS = glx gallium mesa glu glut/glx glew glw
 DRIVER_DIRS = dri
 PROGRAM_DIRS = 
 WINDOW_SYSTEM=dri
index 95f77ade1dd2301e60618dd19a910d3ec246fc2f..634546c64ca5e7429b9e5c80bbd94a2091d2984f 100644 (file)
@@ -51,7 +51,7 @@ GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
 
 
 # Directories
-SRC_DIRS := glx/x11 egl $(SRC_DIRS)
+SRC_DIRS := glx egl $(SRC_DIRS)
 PROGRAM_DIRS := egl $(PROGRAM_DIRS)
 
 # EGL directories
index 7b99dccdb88fa1fc6adfa29e0cb9dc02dcecdf54..691f8e4918c1f70bf26174a667601333cc5524d7 100644 (file)
@@ -47,7 +47,7 @@ DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
 GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
                 $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx)
 
-SRC_DIRS = glx/x11 gallium mesa glu glut/glx glew glw
+SRC_DIRS = glx gallium mesa glu glut/glx glew glw
 PROGRAM_DIRS = xdemos
 
 DRIVER_DIRS = dri
index 4b81383c072235ab0c015321938a42a0646acd85..0914fba19bc16be53b7260f36c105c4643483099 100644 (file)
@@ -47,7 +47,7 @@ GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
 
 
 # Directories
-SRC_DIRS = glx/x11 glu glut/glx glew glw
+SRC_DIRS = glx glu glut/glx glew glw
 DRIVER_DIRS =
 PROGRAM_DIRS = 
 WINDOW_SYSTEM=dri
index b6c6535fc6e547bcc3f7adbce9707247aa779529..a273a16c891870af86813f21f8f0ed2854850c9f 100644 (file)
@@ -445,7 +445,7 @@ xlib)
     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
     ;;
 dri)
-    SRC_DIRS="$SRC_DIRS glx/x11"
+    SRC_DIRS="$SRC_DIRS glx"
     DRIVER_DIRS="dri"
     WINDOW_SYSTEM="dri"
     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
index 9eba402411d9f1a420173d96f9ada800e831d1f7..844cc32079e7dd978557df9c1cd5444dbd1f8c99 100644 (file)
@@ -309,7 +309,6 @@ surfaces.</p>
 <li>Pass the conformance tests</li>
 <li>Better automatic driver selection: <code>EGL_DISPLAY</code> loads all
 drivers and might eat too much memory.</li>
-<li>Stop using <code>glxinit.c</code> and sources from <code>src/glx/x11/</code></li>
 
 </ul>
 
index 2863320a480618dbff5971c5a67a61833762d9fd..794785006f5781f66c37c303e74d028556355f02 100644 (file)
@@ -14,12 +14,12 @@ common_OBJECTS = $(common_SOURCES:.c=.o)
 
 x11_INCLUDES = \
        -I$(TOP)/src/gallium/drivers \
-       -I$(TOP)/src/glx/x11 \
+       -I$(TOP)/src/glx \
        -I$(TOP)/src/mesa \
        $(shell pkg-config --cflags-only-I libdrm)
 
 x11_SOURCES = $(wildcard x11/*.c) \
-             $(TOP)/src/glx/x11/dri2.c
+             $(TOP)/src/glx/dri2.c
 x11_OBJECTS = $(x11_SOURCES:.c=.o)
 
 
index ba6132788a7fd9e58ba8ebc119a7f0b820280f83..1ed2afd3458cf2af274603e878089fc8ef3855f2 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * GLX initialization.  Code based on glxext.c, glx_query.c, and
- * glcontextmodes.c under src/glx/x11/.  The major difference is that DRI
+ * glcontextmodes.c under src/glx/.  The major difference is that DRI
  * related code is stripped out.
  *
  * If the maintenance of this file takes too much time, we should consider
index e0ab4a024016bac5a609ad6442792242c546a6ab..e681be834f058ee4dc321f27c7e4804306474875 100644 (file)
@@ -1,12 +1,97 @@
-
-TOP = ../..
+TOP = ../../..
 include $(TOP)/configs/current
 
+EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \
+                -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
+
+SOURCES = \
+         glcontextmodes.c \
+         clientattrib.c \
+         compsize.c \
+         eval.c \
+         glxcmds.c \
+         glxcurrent.c \
+         glxext.c \
+         glxextensions.c \
+         indirect.c \
+         indirect_init.c \
+         indirect_size.c \
+         indirect_window_pos.c \
+         indirect_texture_compression.c \
+         indirect_transpose_matrix.c \
+         indirect_vertex_array.c \
+         indirect_vertex_program.c \
+         pixel.c \
+         pixelstore.c \
+         render2.c \
+         renderpix.c \
+         single2.c \
+         singlepix.c \
+         vertarr.c \
+         xfont.c \
+         glx_pbuffer.c \
+         glx_query.c \
+         drisw_glx.c \
+         dri_common.c \
+         dri_glx.c \
+         XF86dri.c \
+         glxhash.c \
+         dri2_glx.c \
+         dri2.c
+
+GLAPI_LIB = $(TOP)/src/mesa/libglapi.a
+
+OBJECTS = $(SOURCES:.c=.o)
+
+INCLUDES = -I. \
+       -I$(TOP)/include \
+       -I$(TOP)/include/GL/internal \
+       -I$(TOP)/src/mesa \
+       -I$(TOP)/src/mesa/glapi \
+       $(LIBDRM_CFLAGS) \
+       $(DRI2PROTO_CFLAGS) \
+       $(X11_INCLUDES)
+
+
+##### RULES #####
+
+.c.o:
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
+
+.S.o:
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES)  $< -o $@
+
+##### TARGETS #####
+
+default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+
+# Make libGL
+$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(GLAPI_LIB) Makefile
+       $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+               -major 1 -minor 2 $(MKLIB_OPTIONS) \
+               -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
+               $(GL_LIB_DEPS) $(OBJECTS) $(GLAPI_LIB)
+
+$(GLAPI_LIB):
+       @$(MAKE) -C $(TOP)/src/mesa libglapi.a
+
+depend: $(SOURCES) Makefile
+       rm -f depend
+       touch depend
+       $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES)
+
 
-default:
-       cd mini && $(MAKE)
+# Emacs tags
+tags:
+       etags `find . -name \*.[ch]` `find $(TOP)/include`
 
+install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
+       $(MAKE) -C $(TOP)/src/mesa install-libgl
 
+# Remove .o and backup files
 clean:
-       -@cd mini && $(MAKE) clean
+       -rm -f $(TOP)/$(LIB_DIR)/libGL.so*
+       -rm -f *.o *~
+       -rm -f depend depend.bak
 
+-include depend
diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c
new file mode 100644 (file)
index 0000000..248d96a
--- /dev/null
@@ -0,0 +1,637 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <martin@valinux.com>
+ *   Jens Owen <jens@tungstengraphics.com>
+ *   Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifdef GLX_DIRECT_RENDERING
+
+#define NEED_REPLIES
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include "xf86dristr.h"
+
+
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+#  define PUBLIC __attribute__((visibility("default")))
+#  define USED __attribute__((used))
+#else
+#  define PUBLIC
+#  define USED
+#endif
+
+
+
+static XExtensionInfo _xf86dri_info_data;
+static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
+static char xf86dri_extension_name[] = XF86DRINAME;
+
+#define XF86DRICheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xf86dri_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display * dpy, XExtCodes * extCodes);
+static /* const */ XExtensionHooks xf86dri_extension_hooks = {
+   NULL,                        /* create_gc */
+   NULL,                        /* copy_gc */
+   NULL,                        /* flush_gc */
+   NULL,                        /* free_gc */
+   NULL,                        /* create_font */
+   NULL,                        /* free_font */
+   close_display,               /* close_display */
+   NULL,                        /* wire_to_event */
+   NULL,                        /* event_to_wire */
+   NULL,                        /* error */
+   NULL,                        /* error_string */
+};
+
+static
+XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
+                           xf86dri_extension_name,
+                           &xf86dri_extension_hooks, 0, NULL)
+
+static
+XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public XFree86-DRI Extension routines                    *
+ *                                                                           *
+ *****************************************************************************/
+#if 0
+#include <stdio.h>
+#define TRACE(msg)  fprintf(stderr,"XF86DRI%s\n", msg);
+#else
+#define TRACE(msg)
+#endif
+
+Bool
+XF86DRIQueryExtension(Display * dpy, int *event_basep,
+                      int *error_basep)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+
+   TRACE("QueryExtension...");
+   if (XextHasExtension(info)) {
+      *event_basep = info->codes->first_event;
+      *error_basep = info->codes->first_error;
+      TRACE("QueryExtension... return True");
+      return True;
+   }
+   else {
+      TRACE("QueryExtension... return False");
+      return False;
+   }
+}
+
+Bool
+XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
+                    int *patchVersion)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIQueryVersionReply rep;
+   xXF86DRIQueryVersionReq *req;
+
+   TRACE("QueryVersion...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIQueryVersion, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIQueryVersion;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("QueryVersion... return False");
+      return False;
+   }
+   *majorVersion = rep.majorVersion;
+   *minorVersion = rep.minorVersion;
+   *patchVersion = rep.patchVersion;
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("QueryVersion... return True");
+   return True;
+}
+
+Bool
+XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
+                                   Bool * isCapable)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIQueryDirectRenderingCapableReply rep;
+   xXF86DRIQueryDirectRenderingCapableReq *req;
+
+   TRACE("QueryDirectRenderingCapable...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIQueryDirectRenderingCapable, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
+   req->screen = screen;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("QueryDirectRenderingCapable... return False");
+      return False;
+   }
+   *isCapable = rep.isCapable;
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("QueryDirectRenderingCapable... return True");
+   return True;
+}
+
+Bool
+XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
+                      char **busIdString)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIOpenConnectionReply rep;
+   xXF86DRIOpenConnectionReq *req;
+
+   TRACE("OpenConnection...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIOpenConnection, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIOpenConnection;
+   req->screen = screen;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("OpenConnection... return False");
+      return False;
+   }
+
+   *hSAREA = rep.hSAREALow;
+   if (sizeof(drm_handle_t) == 8) {
+      int shift = 32;           /* var to prevent warning on next line */
+      *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
+   }
+
+   if (rep.length) {
+      if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) {
+         _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
+         UnlockDisplay(dpy);
+         SyncHandle();
+         TRACE("OpenConnection... return False");
+         return False;
+      }
+      _XReadPad(dpy, *busIdString, rep.busIdStringLength);
+   }
+   else {
+      *busIdString = NULL;
+   }
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("OpenConnection... return True");
+   return True;
+}
+
+Bool
+XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIAuthConnectionReq *req;
+   xXF86DRIAuthConnectionReply rep;
+
+   TRACE("AuthConnection...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIAuthConnection, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIAuthConnection;
+   req->screen = screen;
+   req->magic = magic;
+   rep.authenticated = 0;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("AuthConnection... return False");
+      return False;
+   }
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("AuthConnection... return True");
+   return True;
+}
+
+Bool
+XF86DRICloseConnection(Display * dpy, int screen)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRICloseConnectionReq *req;
+
+   TRACE("CloseConnection...");
+
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRICloseConnection, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRICloseConnection;
+   req->screen = screen;
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("CloseConnection... return True");
+   return True;
+}
+
+Bool
+XF86DRIGetClientDriverName(Display * dpy, int screen,
+                           int *ddxDriverMajorVersion,
+                           int *ddxDriverMinorVersion,
+                           int *ddxDriverPatchVersion,
+                           char **clientDriverName)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIGetClientDriverNameReply rep;
+   xXF86DRIGetClientDriverNameReq *req;
+
+   TRACE("GetClientDriverName...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIGetClientDriverName, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIGetClientDriverName;
+   req->screen = screen;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("GetClientDriverName... return False");
+      return False;
+   }
+
+   *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
+   *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
+   *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
+
+   if (rep.length) {
+      if (!
+          (*clientDriverName =
+           (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) {
+         _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
+         UnlockDisplay(dpy);
+         SyncHandle();
+         TRACE("GetClientDriverName... return False");
+         return False;
+      }
+      _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
+   }
+   else {
+      *clientDriverName = NULL;
+   }
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("GetClientDriverName... return True");
+   return True;
+}
+
+Bool
+XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
+                               XID * context, drm_context_t * hHWContext)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRICreateContextReply rep;
+   xXF86DRICreateContextReq *req;
+
+   TRACE("CreateContext...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRICreateContext, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRICreateContext;
+   req->visual = configID;
+   req->screen = screen;
+   *context = XAllocID(dpy);
+   req->context = *context;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("CreateContext... return False");
+      return False;
+   }
+   *hHWContext = rep.hHWContext;
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("CreateContext... return True");
+   return True;
+}
+
+Bool
+XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
+                     XID * context, drm_context_t * hHWContext)
+{
+   return XF86DRICreateContextWithConfig(dpy, screen, visual->visualid,
+                                         context, hHWContext);
+}
+
+Bool
+XF86DRIDestroyContext(Display * dpy, int screen, XID context)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIDestroyContextReq *req;
+
+   TRACE("DestroyContext...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIDestroyContext, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIDestroyContext;
+   req->screen = screen;
+   req->context = context;
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("DestroyContext... return True");
+   return True;
+}
+
+Bool
+XF86DRICreateDrawable(Display * dpy, int screen,
+                      XID drawable, drm_drawable_t * hHWDrawable)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRICreateDrawableReply rep;
+   xXF86DRICreateDrawableReq *req;
+
+   TRACE("CreateDrawable...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRICreateDrawable, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRICreateDrawable;
+   req->screen = screen;
+   req->drawable = drawable;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("CreateDrawable... return False");
+      return False;
+   }
+   *hHWDrawable = rep.hHWDrawable;
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("CreateDrawable... return True");
+   return True;
+}
+
+static int
+noopErrorHandler(Display * dpy, XErrorEvent * xerr)
+{
+   return 0;
+}
+
+Bool
+XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIDestroyDrawableReq *req;
+   int (*oldXErrorHandler) (Display *, XErrorEvent *);
+
+   TRACE("DestroyDrawable...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   /* This is called from the DRI driver, which used call it like this
+    *
+    *   if (windowExists(drawable))
+    *     destroyDrawable(drawable);
+    *
+    * which is a textbook race condition - the window may disappear
+    * from the server between checking for its existance and
+    * destroying it.  Instead we change the semantics of
+    * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+    * the windows is gone, by wrapping the destroy call in an error
+    * handler. */
+
+   XSync(dpy, False);
+   oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIDestroyDrawable, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIDestroyDrawable;
+   req->screen = screen;
+   req->drawable = drawable;
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   XSetErrorHandler(oldXErrorHandler);
+
+   TRACE("DestroyDrawable... return True");
+   return True;
+}
+
+Bool
+XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+                       unsigned int *index, unsigned int *stamp,
+                       int *X, int *Y, int *W, int *H,
+                       int *numClipRects, drm_clip_rect_t ** pClipRects,
+                       int *backX, int *backY,
+                       int *numBackClipRects,
+                       drm_clip_rect_t ** pBackClipRects)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIGetDrawableInfoReply rep;
+   xXF86DRIGetDrawableInfoReq *req;
+   int total_rects;
+
+   TRACE("GetDrawableInfo...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIGetDrawableInfo, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIGetDrawableInfo;
+   req->screen = screen;
+   req->drawable = drawable;
+
+   if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("GetDrawableInfo... return False");
+      return False;
+   }
+   *index = rep.drawableTableIndex;
+   *stamp = rep.drawableTableStamp;
+   *X = (int) rep.drawableX;
+   *Y = (int) rep.drawableY;
+   *W = (int) rep.drawableWidth;
+   *H = (int) rep.drawableHeight;
+   *numClipRects = rep.numClipRects;
+   total_rects = *numClipRects;
+
+   *backX = rep.backX;
+   *backY = rep.backY;
+   *numBackClipRects = rep.numBackClipRects;
+   total_rects += *numBackClipRects;
+
+#if 0
+   /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
+    * backwards compatibility (Because of the >> 2 shift) but the fix
+    * enables multi-threaded apps to work.
+    */
+   if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
+                         SIZEOF(xGenericReply) +
+                         total_rects * sizeof(drm_clip_rect_t)) +
+                        3) & ~3) >> 2)) {
+      _XEatData(dpy, rep.length);
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("GetDrawableInfo... return False");
+      return False;
+   }
+#endif
+
+   if (*numClipRects) {
+      int len = sizeof(drm_clip_rect_t) * (*numClipRects);
+
+      *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
+      if (*pClipRects)
+         _XRead(dpy, (char *) *pClipRects, len);
+   }
+   else {
+      *pClipRects = NULL;
+   }
+
+   if (*numBackClipRects) {
+      int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
+
+      *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
+      if (*pBackClipRects)
+         _XRead(dpy, (char *) *pBackClipRects, len);
+   }
+   else {
+      *pBackClipRects = NULL;
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("GetDrawableInfo... return True");
+   return True;
+}
+
+Bool
+XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer,
+                     int *fbOrigin, int *fbSize, int *fbStride,
+                     int *devPrivateSize, void **pDevPrivate)
+{
+   XExtDisplayInfo *info = find_display(dpy);
+   xXF86DRIGetDeviceInfoReply rep;
+   xXF86DRIGetDeviceInfoReq *req;
+
+   TRACE("GetDeviceInfo...");
+   XF86DRICheckExtension(dpy, info, False);
+
+   LockDisplay(dpy);
+   GetReq(XF86DRIGetDeviceInfo, req);
+   req->reqType = info->codes->major_opcode;
+   req->driReqType = X_XF86DRIGetDeviceInfo;
+   req->screen = screen;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      TRACE("GetDeviceInfo... return False");
+      return False;
+   }
+
+   *hFrameBuffer = rep.hFrameBufferLow;
+   if (sizeof(drm_handle_t) == 8) {
+      int shift = 32;           /* var to prevent warning on next line */
+      *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
+   }
+
+   *fbOrigin = rep.framebufferOrigin;
+   *fbSize = rep.framebufferSize;
+   *fbStride = rep.framebufferStride;
+   *devPrivateSize = rep.devPrivateSize;
+
+   if (rep.length) {
+      if (!(*pDevPrivate = (void *) Xcalloc(rep.devPrivateSize, 1))) {
+         _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
+         UnlockDisplay(dpy);
+         SyncHandle();
+         TRACE("GetDeviceInfo... return False");
+         return False;
+      }
+      _XRead(dpy, (char *) *pDevPrivate, rep.devPrivateSize);
+   }
+   else {
+      *pDevPrivate = NULL;
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+   TRACE("GetDeviceInfo... return True");
+   return True;
+}
+
+Bool
+XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable)
+{
+   /* This function and the underlying X protocol are deprecated.
+    */
+   (void) dpy;
+   (void) screen;
+   (void) drawable;
+   return False;
+}
+
+Bool
+XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable)
+{
+   /* This function and the underlying X protocol are deprecated.
+    */
+   (void) dpy;
+   (void) screen;
+   (void) drawable;
+   return True;
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/clientattrib.c b/src/glx/clientattrib.c
new file mode 100644 (file)
index 0000000..a7dfb53
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+
+#include <assert.h>
+#include "glxclient.h"
+#include "indirect.h"
+#include "indirect_vertex_array.h"
+
+/*****************************************************************************/
+
+static void
+do_enable_disable(GLenum array, GLboolean val)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   unsigned index = 0;
+
+   if (array == GL_TEXTURE_COORD_ARRAY) {
+      index = __glXGetActiveTextureUnit(state);
+   }
+
+   if (!__glXSetArrayEnable(state, array, index, val)) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+   }
+}
+
+void
+__indirect_glEnableClientState(GLenum array)
+{
+   do_enable_disable(array, GL_TRUE);
+}
+
+void
+__indirect_glDisableClientState(GLenum array)
+{
+   do_enable_disable(array, GL_FALSE);
+}
+
+/************************************************************************/
+
+void
+__indirect_glPushClientAttrib(GLuint mask)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   __GLXattribute **spp = gc->attributes.stackPointer, *sp;
+
+   if (spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]) {
+      if (!(sp = *spp)) {
+         sp = (__GLXattribute *) Xmalloc(sizeof(__GLXattribute));
+         *spp = sp;
+      }
+      sp->mask = mask;
+      gc->attributes.stackPointer = spp + 1;
+      if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
+         sp->storePack = state->storePack;
+         sp->storeUnpack = state->storeUnpack;
+      }
+      if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
+         __glXPushArrayState(state);
+      }
+   }
+   else {
+      __glXSetError(gc, GL_STACK_OVERFLOW);
+      return;
+   }
+}
+
+void
+__indirect_glPopClientAttrib(void)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   __GLXattribute **spp = gc->attributes.stackPointer, *sp;
+   GLuint mask;
+
+   if (spp > &gc->attributes.stack[0]) {
+      --spp;
+      sp = *spp;
+      assert(sp != 0);
+      mask = sp->mask;
+      gc->attributes.stackPointer = spp;
+
+      if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
+         state->storePack = sp->storePack;
+         state->storeUnpack = sp->storeUnpack;
+      }
+      if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
+         __glXPopArrayState(state);
+      }
+
+      sp->mask = 0;
+   }
+   else {
+      __glXSetError(gc, GL_STACK_UNDERFLOW);
+      return;
+   }
+}
+
+void
+__glFreeAttributeState(__GLXcontext * gc)
+{
+   __GLXattribute *sp, **spp;
+
+   for (spp = &gc->attributes.stack[0];
+        spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; spp++) {
+      sp = *spp;
+      if (sp) {
+         XFree((char *) sp);
+      }
+      else {
+         break;
+      }
+   }
+}
diff --git a/src/glx/compsize.c b/src/glx/compsize.c
new file mode 100644 (file)
index 0000000..5ba6dc9
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * 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.
+ */
+
+#include <GL/gl.h>
+#include "glxclient.h"
+
+/*
+** Return the number of elements per group of a specified format
+*/
+GLint
+__glElementsPerGroup(GLenum format, GLenum type)
+{
+   /*
+    ** To make row length computation valid for image extraction,
+    ** packed pixel types assume elements per group equals one.
+    */
+   switch (type) {
+   case GL_UNSIGNED_BYTE_3_3_2:
+   case GL_UNSIGNED_BYTE_2_3_3_REV:
+   case GL_UNSIGNED_SHORT_5_6_5:
+   case GL_UNSIGNED_SHORT_5_6_5_REV:
+   case GL_UNSIGNED_SHORT_4_4_4_4:
+   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+   case GL_UNSIGNED_SHORT_5_5_5_1:
+   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+   case GL_UNSIGNED_SHORT_8_8_APPLE:
+   case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+   case GL_UNSIGNED_SHORT_15_1_MESA:
+   case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+   case GL_UNSIGNED_INT_8_8_8_8:
+   case GL_UNSIGNED_INT_8_8_8_8_REV:
+   case GL_UNSIGNED_INT_10_10_10_2:
+   case GL_UNSIGNED_INT_2_10_10_10_REV:
+   case GL_UNSIGNED_INT_24_8_NV:
+   case GL_UNSIGNED_INT_24_8_MESA:
+   case GL_UNSIGNED_INT_8_24_REV_MESA:
+      return 1;
+   default:
+      break;
+   }
+
+   switch (format) {
+   case GL_RGB:
+   case GL_BGR:
+      return 3;
+   case GL_422_EXT:
+   case GL_422_REV_EXT:
+   case GL_422_AVERAGE_EXT:
+   case GL_422_REV_AVERAGE_EXT:
+   case GL_YCBCR_422_APPLE:
+   case GL_LUMINANCE_ALPHA:
+      return 2;
+   case GL_RGBA:
+   case GL_BGRA:
+   case GL_ABGR_EXT:
+      return 4;
+   case GL_COLOR_INDEX:
+   case GL_STENCIL_INDEX:
+   case GL_DEPTH_COMPONENT:
+   case GL_RED:
+   case GL_GREEN:
+   case GL_BLUE:
+   case GL_ALPHA:
+   case GL_LUMINANCE:
+   case GL_INTENSITY:
+      return 1;
+   default:
+      return 0;
+   }
+}
+
+/*
+** Return the number of bytes per element, based on the element type (other
+** than GL_BITMAP).
+*/
+GLint
+__glBytesPerElement(GLenum type)
+{
+   switch (type) {
+   case GL_UNSIGNED_SHORT:
+   case GL_SHORT:
+   case GL_UNSIGNED_SHORT_5_6_5:
+   case GL_UNSIGNED_SHORT_5_6_5_REV:
+   case GL_UNSIGNED_SHORT_4_4_4_4:
+   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+   case GL_UNSIGNED_SHORT_5_5_5_1:
+   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+   case GL_UNSIGNED_SHORT_8_8_APPLE:
+   case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+   case GL_UNSIGNED_SHORT_15_1_MESA:
+   case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+      return 2;
+   case GL_UNSIGNED_BYTE:
+   case GL_BYTE:
+   case GL_UNSIGNED_BYTE_3_3_2:
+   case GL_UNSIGNED_BYTE_2_3_3_REV:
+      return 1;
+   case GL_INT:
+   case GL_UNSIGNED_INT:
+   case GL_FLOAT:
+   case GL_UNSIGNED_INT_8_8_8_8:
+   case GL_UNSIGNED_INT_8_8_8_8_REV:
+   case GL_UNSIGNED_INT_10_10_10_2:
+   case GL_UNSIGNED_INT_2_10_10_10_REV:
+   case GL_UNSIGNED_INT_24_8_NV:
+   case GL_UNSIGNED_INT_24_8_MESA:
+   case GL_UNSIGNED_INT_8_24_REV_MESA:
+      return 4;
+   default:
+      return 0;
+   }
+}
+
+/*
+** Compute memory required for internal packed array of data of given type
+** and format.
+*/
+GLint
+__glImageSize(GLsizei width, GLsizei height, GLsizei depth,
+              GLenum format, GLenum type, GLenum target)
+{
+   int bytes_per_row;
+   int components;
+
+   switch (target) {
+   case GL_PROXY_TEXTURE_1D:
+   case GL_PROXY_TEXTURE_2D:
+   case GL_PROXY_TEXTURE_3D:
+   case GL_PROXY_TEXTURE_4D_SGIS:
+   case GL_PROXY_TEXTURE_CUBE_MAP:
+   case GL_PROXY_TEXTURE_RECTANGLE_ARB:
+   case GL_PROXY_HISTOGRAM:
+   case GL_PROXY_COLOR_TABLE:
+   case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+   case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
+   case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
+   case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
+      return 0;
+   }
+
+   if (width < 0 || height < 0 || depth < 0) {
+      return 0;
+   }
+
+   /*
+    ** Zero is returned if either format or type are invalid.
+    */
+   components = __glElementsPerGroup(format, type);
+   if (type == GL_BITMAP) {
+      if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+         bytes_per_row = (width + 7) >> 3;
+      }
+      else {
+         return 0;
+      }
+   }
+   else {
+      bytes_per_row = __glBytesPerElement(type) * width;
+   }
+
+   return bytes_per_row * height * depth * components;
+}
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
new file mode 100644 (file)
index 0000000..91053d3
--- /dev/null
@@ -0,0 +1,645 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL 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 PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kristian Høgsberg (krh@redhat.com)
+ */
+
+
+#ifdef GLX_DIRECT_RENDERING
+
+#define NEED_REPLIES
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/dri2proto.h>
+#include "xf86drm.h"
+#include "dri2.h"
+#include "glxclient.h"
+#include "GL/glxext.h"
+
+/* Allow the build to work with an older versions of dri2proto.h and
+ * dri2tokens.h.
+ */
+#if DRI2_MINOR < 1
+#undef DRI2_MINOR
+#define DRI2_MINOR 1
+#define X_DRI2GetBuffersWithFormat 7
+#endif
+
+
+static char dri2ExtensionName[] = DRI2_NAME;
+static XExtensionInfo *dri2Info;
+static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
+
+static Bool
+DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire);
+static Status
+DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire);
+
+static /* const */ XExtensionHooks dri2ExtensionHooks = {
+  NULL,                   /* create_gc */
+  NULL,                   /* copy_gc */
+  NULL,                   /* flush_gc */
+  NULL,                   /* free_gc */
+  NULL,                   /* create_font */
+  NULL,                   /* free_font */
+  DRI2CloseDisplay,       /* close_display */
+  DRI2WireToEvent,        /* wire_to_event */
+  DRI2EventToWire,        /* event_to_wire */
+  NULL,                   /* error */
+  NULL,                   /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
+                                   dri2Info,
+                                   dri2ExtensionName,
+                                   &dri2ExtensionHooks,
+                                   1, NULL)
+
+static Bool
+DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   XExtDisplayInfo *glx_info = __glXFindDisplay(dpy);
+   static int glx_event_base;
+   static Bool found_glx_info = False;
+
+   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+   switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
+
+#ifdef X_DRI2SwapBuffers
+   case DRI2_BufferSwapComplete:
+   {
+      GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
+      xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
+      aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+      aevent->type =
+         (glx_info->codes->first_event + GLX_BufferSwapComplete) & 0x75;
+      aevent->send_event = (awire->type & 0x80) != 0;
+      aevent->display = dpy;
+      aevent->drawable = awire->drawable;
+      switch (awire->event_type) {
+      case DRI2_EXCHANGE_COMPLETE:
+        aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+        break;
+      case DRI2_BLIT_COMPLETE:
+        aevent->event_type = GLX_BLIT_COMPLETE_INTEL;
+        break;
+      case DRI2_FLIP_COMPLETE:
+        aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
+        break;
+      default:
+        /* unknown swap completion type */
+        return False;
+      }
+      aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+      aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+      aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+      return True;
+   }
+#endif
+
+   default:
+      /* client doesn't support server event */
+      break;
+   }
+
+   return False;
+}
+
+/* We don't actually support this.  It doesn't make sense for clients to
+ * send each other DRI2 events.
+ */
+static Status
+DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+
+   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+   switch (event->type) {
+   default:
+      /* client doesn't support server event */
+      break;
+   }
+
+   return Success;
+}
+
+Bool
+DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+
+   if (XextHasExtension(info)) {
+      *eventBase = info->codes->first_event;
+      *errorBase = info->codes->first_error;
+      return True;
+   }
+
+   return False;
+}
+
+Bool
+DRI2QueryVersion(Display * dpy, int *major, int *minor)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2QueryVersionReply rep;
+   xDRI2QueryVersionReq *req;
+
+   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+   LockDisplay(dpy);
+   GetReq(DRI2QueryVersion, req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2QueryVersion;
+   req->majorVersion = DRI2_MAJOR;
+   req->minorVersion = DRI2_MINOR;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return False;
+   }
+   *major = rep.majorVersion;
+   *minor = rep.minorVersion;
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return True;
+}
+
+Bool
+DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2ConnectReply rep;
+   xDRI2ConnectReq *req;
+
+   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+   LockDisplay(dpy);
+   GetReq(DRI2Connect, req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2Connect;
+   req->window = window;
+   req->driverType = DRI2DriverDRI;
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return False;
+   }
+
+   if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return False;
+   }
+
+   *driverName = Xmalloc(rep.driverNameLength + 1);
+   if (*driverName == NULL) {
+      _XEatData(dpy,
+                ((rep.driverNameLength + 3) & ~3) +
+                ((rep.deviceNameLength + 3) & ~3));
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return False;
+   }
+   _XReadPad(dpy, *driverName, rep.driverNameLength);
+   (*driverName)[rep.driverNameLength] = '\0';
+
+   *deviceName = Xmalloc(rep.deviceNameLength + 1);
+   if (*deviceName == NULL) {
+      Xfree(*driverName);
+      _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return False;
+   }
+   _XReadPad(dpy, *deviceName, rep.deviceNameLength);
+   (*deviceName)[rep.deviceNameLength] = '\0';
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return True;
+}
+
+Bool
+DRI2Authenticate(Display * dpy, XID window, drm_magic_t magic)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2AuthenticateReq *req;
+   xDRI2AuthenticateReply rep;
+
+   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+   LockDisplay(dpy);
+   GetReq(DRI2Authenticate, req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2Authenticate;
+   req->window = window;
+   req->magic = magic;
+
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return False;
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return rep.authenticated;
+}
+
+void
+DRI2CreateDrawable(Display * dpy, XID drawable)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2CreateDrawableReq *req;
+
+   XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
+
+   LockDisplay(dpy);
+   GetReq(DRI2CreateDrawable, req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2CreateDrawable;
+   req->drawable = drawable;
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+void
+DRI2DestroyDrawable(Display * dpy, XID drawable)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2DestroyDrawableReq *req;
+
+   XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
+
+   XSync(dpy, False);
+
+   LockDisplay(dpy);
+   GetReq(DRI2DestroyDrawable, req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2DestroyDrawable;
+   req->drawable = drawable;
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+DRI2Buffer *
+DRI2GetBuffers(Display * dpy, XID drawable,
+               int *width, int *height,
+               unsigned int *attachments, int count, int *outCount)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2GetBuffersReply rep;
+   xDRI2GetBuffersReq *req;
+   DRI2Buffer *buffers;
+   xDRI2Buffer repBuffer;
+   CARD32 *p;
+   int i;
+
+   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+   LockDisplay(dpy);
+   GetReqExtra(DRI2GetBuffers, count * 4, req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2GetBuffers;
+   req->drawable = drawable;
+   req->count = count;
+   p = (CARD32 *) & req[1];
+   for (i = 0; i < count; i++)
+      p[i] = attachments[i];
+
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return NULL;
+   }
+
+   *width = rep.width;
+   *height = rep.height;
+   *outCount = rep.count;
+
+   buffers = Xmalloc(rep.count * sizeof buffers[0]);
+   if (buffers == NULL) {
+      _XEatData(dpy, rep.count * sizeof repBuffer);
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return NULL;
+   }
+
+   for (i = 0; i < rep.count; i++) {
+      _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
+      buffers[i].attachment = repBuffer.attachment;
+      buffers[i].name = repBuffer.name;
+      buffers[i].pitch = repBuffer.pitch;
+      buffers[i].cpp = repBuffer.cpp;
+      buffers[i].flags = repBuffer.flags;
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return buffers;
+}
+
+
+DRI2Buffer *
+DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
+                         int *width, int *height,
+                         unsigned int *attachments, int count, int *outCount)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2GetBuffersReply rep;
+   xDRI2GetBuffersReq *req;
+   DRI2Buffer *buffers;
+   xDRI2Buffer repBuffer;
+   CARD32 *p;
+   int i;
+
+   XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+   LockDisplay(dpy);
+   GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2GetBuffersWithFormat;
+   req->drawable = drawable;
+   req->count = count;
+   p = (CARD32 *) & req[1];
+   for (i = 0; i < (count * 2); i++)
+      p[i] = attachments[i];
+
+   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return NULL;
+   }
+
+   *width = rep.width;
+   *height = rep.height;
+   *outCount = rep.count;
+
+   buffers = Xmalloc(rep.count * sizeof buffers[0]);
+   if (buffers == NULL) {
+      _XEatData(dpy, rep.count * sizeof repBuffer);
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return NULL;
+   }
+
+   for (i = 0; i < rep.count; i++) {
+      _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
+      buffers[i].attachment = repBuffer.attachment;
+      buffers[i].name = repBuffer.name;
+      buffers[i].pitch = repBuffer.pitch;
+      buffers[i].cpp = repBuffer.cpp;
+      buffers[i].flags = repBuffer.flags;
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return buffers;
+}
+
+
+void
+DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region,
+               CARD32 dest, CARD32 src)
+{
+   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   xDRI2CopyRegionReq *req;
+   xDRI2CopyRegionReply rep;
+
+   XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
+
+   LockDisplay(dpy);
+   GetReq(DRI2CopyRegion, req);
+   req->reqType = info->codes->major_opcode;
+   req->dri2ReqType = X_DRI2CopyRegion;
+   req->drawable = drawable;
+   req->region = region;
+   req->dest = dest;
+   req->src = src;
+
+   _XReply(dpy, (xReply *) & rep, 0, xFalse);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+#ifdef X_DRI2SwapBuffers
+static void
+load_swap_req(xDRI2SwapBuffersReq *req, CARD64 target, CARD64 divisor,
+            CARD64 remainder)
+{
+    req->target_msc_hi = target >> 32;
+    req->target_msc_lo = target & 0xffffffff;
+    req->divisor_hi = divisor >> 32;
+    req->divisor_lo = divisor & 0xffffffff;
+    req->remainder_hi = remainder >> 32;
+    req->remainder_lo = remainder & 0xffffffff;
+}
+
+static CARD64
+vals_to_card64(CARD32 lo, CARD32 hi)
+{
+    return (CARD64)hi << 32 | lo;
+}
+
+void DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc,
+                    CARD64 divisor, CARD64 remainder, CARD64 *count)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2SwapBuffersReq *req;
+    xDRI2SwapBuffersReply rep;
+
+    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+    LockDisplay(dpy);
+    GetReq(DRI2SwapBuffers, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2SwapBuffers;
+    req->drawable = drawable;
+    load_swap_req(req, target_msc, divisor, remainder);
+
+    _XReply(dpy, (xReply *)&rep, 0, xFalse);
+
+    *count = vals_to_card64(rep.swap_lo, rep.swap_hi);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+#endif
+
+#ifdef X_DRI2GetMSC
+Bool DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc,
+               CARD64 *sbc)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2GetMSCReq *req;
+    xDRI2MSCReply rep;
+
+    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+    LockDisplay(dpy);
+    GetReq(DRI2GetMSC, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2GetMSC;
+    req->drawable = drawable;
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    *ust = vals_to_card64(rep.ust_lo, rep.ust_hi);
+    *msc = vals_to_card64(rep.msc_lo, rep.msc_hi);
+    *sbc = vals_to_card64(rep.sbc_lo, rep.sbc_hi);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return True;
+}
+#endif
+
+#ifdef X_DRI2WaitMSC
+static void
+load_msc_req(xDRI2WaitMSCReq *req, CARD64 target, CARD64 divisor,
+            CARD64 remainder)
+{
+    req->target_msc_hi = target >> 32;
+    req->target_msc_lo = target & 0xffffffff;
+    req->divisor_hi = divisor >> 32;
+    req->divisor_lo = divisor & 0xffffffff;
+    req->remainder_hi = remainder >> 32;
+    req->remainder_lo = remainder & 0xffffffff;
+}
+
+Bool DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
+                CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2WaitMSCReq *req;
+    xDRI2MSCReply rep;
+
+    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+    LockDisplay(dpy);
+    GetReq(DRI2WaitMSC, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2WaitMSC;
+    req->drawable = drawable;
+    load_msc_req(req, target_msc, divisor, remainder);
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    *ust = ((CARD64)rep.ust_hi << 32) | (CARD64)rep.ust_lo;
+    *msc = ((CARD64)rep.msc_hi << 32) | (CARD64)rep.msc_lo;
+    *sbc = ((CARD64)rep.sbc_hi << 32) | (CARD64)rep.sbc_lo;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return True;
+}
+#endif
+
+#ifdef X_DRI2WaitSBC
+static void
+load_sbc_req(xDRI2WaitSBCReq *req, CARD64 target)
+{
+    req->target_sbc_hi = target >> 32;
+    req->target_sbc_lo = target & 0xffffffff;
+}
+
+Bool DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust,
+                CARD64 *msc, CARD64 *sbc)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2WaitSBCReq *req;
+    xDRI2MSCReply rep;
+
+    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+    LockDisplay(dpy);
+    GetReq(DRI2WaitSBC, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2WaitSBC;
+    req->drawable = drawable;
+    load_sbc_req(req, target_sbc);
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    *ust = ((CARD64)rep.ust_hi << 32) | rep.ust_lo;
+    *msc = ((CARD64)rep.msc_hi << 32) | rep.msc_lo;
+    *sbc = ((CARD64)rep.sbc_hi << 32) | rep.sbc_lo;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return True;
+}
+#endif
+
+#ifdef X_DRI2SwapInterval
+void DRI2SwapInterval(Display *dpy, XID drawable, int interval)
+{
+    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+    xDRI2SwapIntervalReq *req;
+
+    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+    LockDisplay(dpy);
+    GetReq(DRI2SwapInterval, req);
+    req->reqType = info->codes->major_opcode;
+    req->dri2ReqType = X_DRI2SwapInterval;
+    req->drawable = drawable;
+    req->interval = interval;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+#endif
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/dri2.h b/src/glx/dri2.h
new file mode 100644 (file)
index 0000000..114e9f8
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright © 2007,2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL 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 PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifndef _DRI2_H_
+#define _DRI2_H_
+
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/dri2tokens.h>
+
+typedef struct
+{
+   unsigned int attachment;
+   unsigned int name;
+   unsigned int pitch;
+   unsigned int cpp;
+   unsigned int flags;
+} DRI2Buffer;
+
+extern Bool
+DRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
+
+extern Bool
+DRI2QueryVersion(Display * display, int *major, int *minor);
+
+extern Bool
+DRI2Connect(Display * display, XID window,
+            char **driverName, char **deviceName);
+
+extern Bool
+DRI2Authenticate(Display * display, XID window, drm_magic_t magic);
+
+extern void
+DRI2CreateDrawable(Display * display, XID drawable);
+
+extern void
+DRI2DestroyDrawable(Display * display, XID handle);
+
+extern DRI2Buffer*
+DRI2GetBuffers(Display * dpy, XID drawable,
+               int *width, int *height,
+               unsigned int *attachments, int count,
+               int *outCount);
+
+/**
+ * \note
+ * This function is only supported with DRI2 version 1.1 or later.
+ */
+extern DRI2Buffer*
+DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
+                         int *width, int *height,
+                         unsigned int *attachments,
+                         int count, int *outCount);
+
+extern void
+DRI2CopyRegion(Display * dpy, XID drawable,
+               XserverRegion region,
+               CARD32 dest, CARD32 src);
+
+extern void
+DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
+               CARD64 remainder, CARD64 *count);
+
+extern Bool
+DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
+
+extern Bool
+DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
+           CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
+
+extern Bool
+DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust,
+           CARD64 *msc, CARD64 *sbc);
+
+extern void
+DRI2SwapInterval(Display *dpy, XID drawable, int interval);
+
+#endif
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
new file mode 100644 (file)
index 0000000..15a3ea5
--- /dev/null
@@ -0,0 +1,666 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL 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 PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include <X11/Xlib.h>
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/Xdamage.h>
+#include "glapi.h"
+#include "glxclient.h"
+#include <X11/extensions/dri2proto.h>
+#include "xf86dri.h"
+#include <dlfcn.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include "xf86drm.h"
+#include "dri2.h"
+#include "dri_common.h"
+#include "../../mesa/drivers/dri/common/dri_util.h"
+
+#undef DRI2_MINOR
+#define DRI2_MINOR 1
+
+typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
+typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
+typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
+
+struct __GLXDRIdisplayPrivateRec
+{
+   __GLXDRIdisplay base;
+
+   /*
+    ** XFree86-DRI version information
+    */
+   int driMajor;
+   int driMinor;
+   int driPatch;
+   int swapAvailable;
+};
+
+struct __GLXDRIcontextPrivateRec
+{
+   __GLXDRIcontext base;
+   __DRIcontext *driContext;
+   __GLXscreenConfigs *psc;
+};
+
+struct __GLXDRIdrawablePrivateRec
+{
+   __GLXDRIdrawable base;
+   __DRIbuffer buffers[5];
+   int bufferCount;
+   int width, height;
+   int have_back;
+   int have_fake_front;
+   int swap_interval;
+};
+
+static void dri2WaitX(__GLXDRIdrawable * pdraw);
+
+static void
+dri2DestroyContext(__GLXDRIcontext * context,
+                   __GLXscreenConfigs * psc, Display * dpy)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   (*core->destroyContext) (pcp->driContext);
+
+   Xfree(pcp);
+}
+
+static Bool
+dri2BindContext(__GLXDRIcontext * context,
+                __GLXDRIdrawable * draw, __GLXDRIdrawable * read)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   return (*core->bindContext) (pcp->driContext,
+                                draw->driDrawable, read->driDrawable);
+}
+
+static void
+dri2UnbindContext(__GLXDRIcontext * context)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   (*core->unbindContext) (pcp->driContext);
+}
+
+static __GLXDRIcontext *
+dri2CreateContext(__GLXscreenConfigs * psc,
+                  const __GLcontextModes * mode,
+                  GLXContext gc, GLXContext shareList, int renderType)
+{
+   __GLXDRIcontextPrivate *pcp, *pcp_shared;
+   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
+   __DRIcontext *shared = NULL;
+
+   if (shareList) {
+      pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
+      shared = pcp_shared->driContext;
+   }
+
+   pcp = Xmalloc(sizeof *pcp);
+   if (pcp == NULL)
+      return NULL;
+
+   pcp->psc = psc;
+   pcp->driContext =
+      (*psc->dri2->createNewContext) (psc->__driScreen,
+                                      config->driConfig, shared, pcp);
+   gc->__driContext = pcp->driContext;
+
+   if (pcp->driContext == NULL) {
+      Xfree(pcp);
+      return NULL;
+   }
+
+   pcp->base.destroyContext = dri2DestroyContext;
+   pcp->base.bindContext = dri2BindContext;
+   pcp->base.unbindContext = dri2UnbindContext;
+
+   return &pcp->base;
+}
+
+static void
+dri2DestroyDrawable(__GLXDRIdrawable * pdraw)
+{
+   const __DRIcoreExtension *core = pdraw->psc->core;
+
+   (*core->destroyDrawable) (pdraw->driDrawable);
+   DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->xDrawable);
+   Xfree(pdraw);
+}
+
+static __GLXDRIdrawable *
+dri2CreateDrawable(__GLXscreenConfigs * psc,
+                   XID xDrawable,
+                   GLXDrawable drawable, const __GLcontextModes * modes)
+{
+   __GLXDRIdrawablePrivate *pdraw;
+   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
+
+   pdraw = Xmalloc(sizeof(*pdraw));
+   if (!pdraw)
+      return NULL;
+
+   pdraw->base.destroyDrawable = dri2DestroyDrawable;
+   pdraw->base.xDrawable = xDrawable;
+   pdraw->base.drawable = drawable;
+   pdraw->base.psc = psc;
+   pdraw->bufferCount = 0;
+
+   DRI2CreateDrawable(psc->dpy, xDrawable);
+
+   /* Create a new drawable */
+   pdraw->base.driDrawable =
+      (*psc->dri2->createNewDrawable) (psc->__driScreen,
+                                       config->driConfig, pdraw);
+
+   if (!pdraw->base.driDrawable) {
+      DRI2DestroyDrawable(psc->dpy, xDrawable);
+      Xfree(pdraw);
+      return NULL;
+   }
+
+   return &pdraw->base;
+}
+
+static int
+dri2DrawableGetMSC(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
+                  int64_t *ust, int64_t *msc, int64_t *sbc)
+{
+   return DRI2GetMSC(psc->dpy, pdraw->xDrawable, ust, msc, sbc);
+}
+
+static int
+dri2WaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
+              int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
+{
+   return DRI2WaitMSC(pdraw->psc->dpy, pdraw->xDrawable, target_msc, divisor,
+                     remainder, ust, msc, sbc);
+}
+
+static int
+dri2WaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
+              int64_t *msc, int64_t *sbc)
+{
+   return DRI2WaitSBC(pdraw->psc->dpy, pdraw->xDrawable, target_sbc, ust, msc,
+                     sbc);
+}
+
+static void
+dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y, int width, int height)
+{
+   __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+   XRectangle xrect;
+   XserverRegion region;
+
+   /* Check we have the right attachments */
+   if (!priv->have_back)
+      return;
+
+   xrect.x = x;
+   xrect.y = priv->height - y - height;
+   xrect.width = width;
+   xrect.height = height;
+
+#ifdef __DRI2_FLUSH
+   if (pdraw->psc->f)
+      (*pdraw->psc->f->flush) (pdraw->driDrawable);
+#endif
+
+   region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+   /* should get a fence ID back from here at some point */
+   DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
+                  DRI2BufferFrontLeft, DRI2BufferBackLeft);
+   XFixesDestroyRegion(pdraw->psc->dpy, region);
+
+   /* Refresh the fake front (if present) after we just damaged the real
+    * front.
+    */
+   dri2WaitX(pdraw);
+}
+
+static void
+dri2WaitX(__GLXDRIdrawable *pdraw)
+{
+   __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+   XRectangle xrect;
+   XserverRegion region;
+
+   /* Check we have the right attachments */
+   if (!priv->have_fake_front)
+      return;
+
+   xrect.x = 0;
+   xrect.y = 0;
+   xrect.width = priv->width;
+   xrect.height = priv->height;
+
+#ifdef __DRI2_FLUSH
+   if (pdraw->psc->f)
+      (*pdraw->psc->f->flush) (pdraw->driDrawable);
+#endif
+
+   region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+   DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
+                  DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+   XFixesDestroyRegion(pdraw->psc->dpy, region);
+}
+
+static void
+dri2WaitGL(__GLXDRIdrawable * pdraw)
+{
+   __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+   XRectangle xrect;
+   XserverRegion region;
+
+   if (!priv->have_fake_front)
+      return;
+
+   xrect.x = 0;
+   xrect.y = 0;
+   xrect.width = priv->width;
+   xrect.height = priv->height;
+
+#ifdef __DRI2_FLUSH
+   if (pdraw->psc->f)
+      (*pdraw->psc->f->flush) (pdraw->driDrawable);
+#endif
+
+   region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+   DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
+                  DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+   XFixesDestroyRegion(pdraw->psc->dpy, region);
+}
+
+
+static void
+dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
+{
+   (void) driDrawable;
+   dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
+}
+
+
+static void
+dri2DestroyScreen(__GLXscreenConfigs * psc)
+{
+   /* Free the direct rendering per screen data */
+   (*psc->core->destroyScreen) (psc->__driScreen);
+   close(psc->fd);
+   psc->__driScreen = NULL;
+}
+
+/**
+ * Process list of buffer received from the server
+ *
+ * Processes the list of buffers received in a reply from the server to either
+ * \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat.
+ */
+static void
+process_buffers(__GLXDRIdrawablePrivate * pdraw, DRI2Buffer * buffers,
+                unsigned count)
+{
+   int i;
+
+   pdraw->bufferCount = count;
+   pdraw->have_fake_front = 0;
+   pdraw->have_back = 0;
+
+   /* This assumes the DRI2 buffer attachment tokens matches the
+    * __DRIbuffer tokens. */
+   for (i = 0; i < count; i++) {
+      pdraw->buffers[i].attachment = buffers[i].attachment;
+      pdraw->buffers[i].name = buffers[i].name;
+      pdraw->buffers[i].pitch = buffers[i].pitch;
+      pdraw->buffers[i].cpp = buffers[i].cpp;
+      pdraw->buffers[i].flags = buffers[i].flags;
+      if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
+         pdraw->have_fake_front = 1;
+      if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
+         pdraw->have_back = 1;
+   }
+
+}
+
+static int64_t
+dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
+               int64_t remainder)
+{
+    __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+    __GLXdisplayPrivate *dpyPriv = __glXInitialize(priv->base.psc->dpy);
+    __GLXDRIdisplayPrivate *pdp =
+       (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;
+    int64_t ret;
+
+#ifdef __DRI2_FLUSH
+    if (pdraw->psc->f)
+       (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
+    /* Old servers can't handle swapbuffers */
+    if (!pdp->swapAvailable) {
+       dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
+       return 0;
+    }
+
+#ifdef X_DRI2SwapBuffers
+    DRI2SwapBuffers(pdraw->psc->dpy, pdraw->xDrawable, target_msc, divisor,
+                   remainder, &ret);
+#endif
+
+#if __DRI2_FLUSH_VERSION >= 2
+    if (pdraw->psc->f)
+       (*pdraw->psc->f->flushInvalidate)(pdraw->driDrawable);
+#endif
+
+    return ret;
+}
+
+static __DRIbuffer *
+dri2GetBuffers(__DRIdrawable * driDrawable,
+               int *width, int *height,
+               unsigned int *attachments, int count,
+               int *out_count, void *loaderPrivate)
+{
+   __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
+   DRI2Buffer *buffers;
+
+   buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
+                            width, height, attachments, count, out_count);
+   if (buffers == NULL)
+      return NULL;
+
+   pdraw->width = *width;
+   pdraw->height = *height;
+   process_buffers(pdraw, buffers, *out_count);
+
+   Xfree(buffers);
+
+   return pdraw->buffers;
+}
+
+static __DRIbuffer *
+dri2GetBuffersWithFormat(__DRIdrawable * driDrawable,
+                         int *width, int *height,
+                         unsigned int *attachments, int count,
+                         int *out_count, void *loaderPrivate)
+{
+   __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
+   DRI2Buffer *buffers;
+
+   buffers = DRI2GetBuffersWithFormat(pdraw->base.psc->dpy,
+                                      pdraw->base.xDrawable,
+                                      width, height, attachments,
+                                      count, out_count);
+   if (buffers == NULL)
+      return NULL;
+
+   pdraw->width = *width;
+   pdraw->height = *height;
+   process_buffers(pdraw, buffers, *out_count);
+
+   Xfree(buffers);
+
+   return pdraw->buffers;
+}
+
+static void
+dri2SetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
+{
+   __GLXDRIdrawablePrivate *priv =  (__GLXDRIdrawablePrivate *) pdraw;
+
+   DRI2SwapInterval(priv->base.psc->dpy, pdraw->xDrawable, interval);
+   priv->swap_interval = interval;
+}
+
+static unsigned int
+dri2GetSwapInterval(__GLXDRIdrawable *pdraw)
+{
+   __GLXDRIdrawablePrivate *priv =  (__GLXDRIdrawablePrivate *) pdraw;
+
+  return priv->swap_interval;
+}
+
+static const __DRIdri2LoaderExtension dri2LoaderExtension = {
+   {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
+   dri2GetBuffers,
+   dri2FlushFrontBuffer,
+   dri2GetBuffersWithFormat,
+};
+
+static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
+   {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
+   dri2GetBuffers,
+   dri2FlushFrontBuffer,
+   NULL,
+};
+
+static const __DRIextension *loader_extensions[] = {
+   &dri2LoaderExtension.base,
+   &systemTimeExtension.base,
+   NULL
+};
+
+static const __DRIextension *loader_extensions_old[] = {
+   &dri2LoaderExtension_old.base,
+   &systemTimeExtension.base,
+   NULL
+};
+
+static __GLXDRIscreen *
+dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
+                 __GLXdisplayPrivate * priv)
+{
+   const __DRIconfig **driver_configs;
+   const __DRIextension **extensions;
+   const __GLXDRIdisplayPrivate *const pdp = (__GLXDRIdisplayPrivate *)
+      priv->dri2Display;
+   __GLXDRIscreen *psp;
+   char *driverName, *deviceName;
+   drm_magic_t magic;
+   int i;
+
+   psp = Xmalloc(sizeof *psp);
+   if (psp == NULL)
+      return NULL;
+
+   /* Initialize per screen dynamic client GLX extensions */
+   psc->ext_list_first_time = GL_TRUE;
+
+   if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
+                   &driverName, &deviceName)) {
+      XFree(psp);
+      return NULL;
+   }
+
+   psc->driver = driOpenDriver(driverName);
+   if (psc->driver == NULL) {
+      ErrorMessageF("driver pointer missing\n");
+      goto handle_error;
+   }
+
+   extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
+   if (extensions == NULL) {
+      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
+      goto handle_error;
+   }
+
+   for (i = 0; extensions[i]; i++) {
+      if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
+        psc->core = (__DRIcoreExtension *) extensions[i];
+      if (strcmp(extensions[i]->name, __DRI_DRI2) == 0)
+        psc->dri2 = (__DRIdri2Extension *) extensions[i];
+   }
+
+   if (psc->core == NULL || psc->dri2 == NULL) {
+      ErrorMessageF("core dri or dri2 extension not found\n");
+      goto handle_error;
+   }
+
+   psc->fd = open(deviceName, O_RDWR);
+   if (psc->fd < 0) {
+      ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
+      goto handle_error;
+   }
+
+   if (drmGetMagic(psc->fd, &magic)) {
+      ErrorMessageF("failed to get magic\n");
+      goto handle_error;
+   }
+
+   if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
+      ErrorMessageF("failed to authenticate magic %d\n", magic);
+      goto handle_error;
+   }
+
+   /* If the server does not support the protocol for
+    * DRI2GetBuffersWithFormat, don't supply that interface to the driver.
+    */
+   psc->__driScreen =
+      psc->dri2->createNewScreen(screen, psc->fd, ((pdp->driMinor < 1)
+                                                  ? loader_extensions_old
+                                                  : loader_extensions),
+                                &driver_configs, psc);
+
+   if (psc->__driScreen == NULL) {
+      ErrorMessageF("failed to create dri screen\n");
+      goto handle_error;
+   }
+
+   driBindCommonExtensions(psc);
+   dri2BindExtensions(psc);
+
+   psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
+   psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
+
+   psc->driver_configs = driver_configs;
+
+   psp->destroyScreen = dri2DestroyScreen;
+   psp->createContext = dri2CreateContext;
+   psp->createDrawable = dri2CreateDrawable;
+   psp->swapBuffers = dri2SwapBuffers;
+   psp->waitGL = dri2WaitGL;
+   psp->waitX = dri2WaitX;
+   psp->getDrawableMSC = NULL;
+   psp->waitForMSC = NULL;
+   psp->waitForSBC = NULL;
+   psp->setSwapInterval = NULL;
+   psp->getSwapInterval = NULL;
+
+   if (pdp->driMinor >= 2) {
+#ifdef X_DRI2GetMSC
+      psp->getDrawableMSC = dri2DrawableGetMSC;
+#endif
+#ifdef X_DRI2WaitMSC
+      psp->waitForMSC = dri2WaitForMSC;
+      psp->waitForSBC = dri2WaitForSBC;
+#endif
+#ifdef X_DRI2SwapInterval
+      psp->setSwapInterval = dri2SetSwapInterval;
+      psp->getSwapInterval = dri2GetSwapInterval;
+#endif
+   }
+
+   /* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
+    * available.*/
+   psp->copySubBuffer = dri2CopySubBuffer;
+   __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
+
+   Xfree(driverName);
+   Xfree(deviceName);
+
+   return psp;
+
+handle_error:
+   Xfree(driverName);
+   Xfree(deviceName);
+   XFree(psp);
+
+   /* FIXME: clean up here */
+
+   return NULL;
+}
+
+/* Called from __glXFreeDisplayPrivate.
+ */
+static void
+dri2DestroyDisplay(__GLXDRIdisplay * dpy)
+{
+   Xfree(dpy);
+}
+
+/*
+ * Allocate, initialize and return a __DRIdisplayPrivate object.
+ * This is called from __glXInitialize() when we are given a new
+ * display pointer.
+ */
+_X_HIDDEN __GLXDRIdisplay *
+dri2CreateDisplay(Display * dpy)
+{
+   __GLXDRIdisplayPrivate *pdp;
+   int eventBase, errorBase;
+
+   if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
+      return NULL;
+
+   pdp = Xmalloc(sizeof *pdp);
+   if (pdp == NULL)
+      return NULL;
+
+   if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) {
+      Xfree(pdp);
+      return NULL;
+   }
+
+   pdp->driPatch = 0;
+   pdp->swapAvailable = 0;
+#ifdef X_DRI2SwapBuffers
+   if (pdp->driMinor >= 2)
+      pdp->swapAvailable = 1;
+#endif
+
+   pdp->base.destroyDisplay = dri2DestroyDisplay;
+   pdp->base.createScreen = dri2CreateScreen;
+
+   return &pdp->base;
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
new file mode 100644 (file)
index 0000000..e403416
--- /dev/null
@@ -0,0 +1,450 @@
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL 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 PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kevin E. Martin <kevin@precisioninsight.com>
+ *   Brian Paul <brian@precisioninsight.com>
+ *   Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include <unistd.h>
+#include <dlfcn.h>
+#include <stdarg.h>
+#include "glxclient.h"
+#include "glcontextmodes.h"
+#include "dri_common.h"
+
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+_X_HIDDEN void
+InfoMessageF(const char *f, ...)
+{
+   va_list args;
+   const char *env;
+
+   if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
+      fprintf(stderr, "libGL: ");
+      va_start(args, f);
+      vfprintf(stderr, f, args);
+      va_end(args);
+   }
+}
+
+/**
+ * Print error to stderr, unless LIBGL_DEBUG=="quiet".
+ */
+_X_HIDDEN void
+ErrorMessageF(const char *f, ...)
+{
+   va_list args;
+   const char *env;
+
+   if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) {
+      fprintf(stderr, "libGL error: ");
+      va_start(args, f);
+      vfprintf(stderr, f, args);
+      va_end(args);
+   }
+}
+
+#ifndef DEFAULT_DRIVER_DIR
+/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
+#define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
+#endif
+
+/**
+ * Try to \c dlopen the named driver.
+ *
+ * This function adds the "_dri.so" suffix to the driver name and searches the
+ * directories specified by the \c LIBGL_DRIVERS_PATH environment variable in
+ * order to find the driver.
+ *
+ * \param driverName - a name like "tdfx", "i810", "mga", etc.
+ *
+ * \returns
+ * A handle from \c dlopen, or \c NULL if driver file not found.
+ */
+_X_HIDDEN void *
+driOpenDriver(const char *driverName)
+{
+   void *glhandle, *handle;
+   const char *libPaths, *p, *next;
+   char realDriverName[200];
+   int len;
+
+   /* Attempt to make sure libGL symbols will be visible to the driver */
+   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+
+   libPaths = NULL;
+   if (geteuid() == getuid()) {
+      /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
+      libPaths = getenv("LIBGL_DRIVERS_PATH");
+      if (!libPaths)
+         libPaths = getenv("LIBGL_DRIVERS_DIR");        /* deprecated */
+   }
+   if (libPaths == NULL)
+      libPaths = DEFAULT_DRIVER_DIR;
+
+   handle = NULL;
+   for (p = libPaths; *p; p = next) {
+      next = strchr(p, ':');
+      if (next == NULL) {
+         len = strlen(p);
+         next = p + len;
+      }
+      else {
+         len = next - p;
+         next++;
+      }
+
+#ifdef GLX_USE_TLS
+      snprintf(realDriverName, sizeof realDriverName,
+               "%.*s/tls/%s_dri.so", len, p, driverName);
+      InfoMessageF("OpenDriver: trying %s\n", realDriverName);
+      handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
+#endif
+
+      if (handle == NULL) {
+         snprintf(realDriverName, sizeof realDriverName,
+                  "%.*s/%s_dri.so", len, p, driverName);
+         InfoMessageF("OpenDriver: trying %s\n", realDriverName);
+         handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
+      }
+
+      if (handle != NULL)
+         break;
+      else
+         ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
+   }
+
+   if (!handle)
+      ErrorMessageF("unable to load driver: %s_dri.so\n", driverName);
+
+   if (glhandle)
+      dlclose(glhandle);
+
+   return handle;
+}
+
+_X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
+   {__DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION},
+   __glXGetUST,
+   __driGetMscRateOML
+};
+
+#define __ATTRIB(attrib, field) \
+    { attrib, offsetof(__GLcontextModes, field) }
+
+static const struct
+{
+   unsigned int attrib, offset;
+} attribMap[] = {
+   __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
+      __ATTRIB(__DRI_ATTRIB_LEVEL, level),
+      __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
+      __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
+      __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
+      __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
+      __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
+      __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
+      __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
+      __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
+      __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
+      __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
+      __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
+      __ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
+      __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
+      __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
+      __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
+#if 0
+      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
+      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentIndex),
+      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
+      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
+      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
+      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
+      __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
+      __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
+      __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
+      __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
+#endif
+      __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
+      __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
+      __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
+      __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
+      __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
+#if 0
+      __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
+#endif
+__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
+      __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
+      __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,
+                     bindToMipmapTexture),
+      __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),};
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+static int
+scalarEqual(__GLcontextModes * mode, unsigned int attrib, unsigned int value)
+{
+   unsigned int glxValue;
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(attribMap); i++)
+      if (attribMap[i].attrib == attrib) {
+         glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
+         return glxValue == GLX_DONT_CARE || glxValue == value;
+      }
+
+   return GL_TRUE;              /* Is a non-existing attribute equal to value? */
+}
+
+static int
+driConfigEqual(const __DRIcoreExtension * core,
+               __GLcontextModes * modes, const __DRIconfig * driConfig)
+{
+   unsigned int attrib, value, glxValue;
+   int i;
+
+   i = 0;
+   while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
+      switch (attrib) {
+      case __DRI_ATTRIB_RENDER_TYPE:
+         glxValue = 0;
+         if (value & __DRI_ATTRIB_RGBA_BIT) {
+            glxValue |= GLX_RGBA_BIT;
+         }
+         else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
+            glxValue |= GLX_COLOR_INDEX_BIT;
+         }
+         if (glxValue != modes->renderType)
+            return GL_FALSE;
+         break;
+
+      case __DRI_ATTRIB_CONFIG_CAVEAT:
+         if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
+            glxValue = GLX_NON_CONFORMANT_CONFIG;
+         else if (value & __DRI_ATTRIB_SLOW_BIT)
+            glxValue = GLX_SLOW_CONFIG;
+         else
+            glxValue = GLX_NONE;
+         if (glxValue != modes->visualRating)
+            return GL_FALSE;
+         break;
+
+      case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
+         glxValue = 0;
+         if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
+            glxValue |= GLX_TEXTURE_1D_BIT_EXT;
+         if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
+            glxValue |= GLX_TEXTURE_2D_BIT_EXT;
+         if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
+            glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
+         if (modes->bindToTextureTargets != GLX_DONT_CARE &&
+             glxValue != modes->bindToTextureTargets)
+            return GL_FALSE;
+         break;
+
+      default:
+         if (!scalarEqual(modes, attrib, value))
+            return GL_FALSE;
+      }
+   }
+
+   return GL_TRUE;
+}
+
+static __GLcontextModes *
+createDriMode(const __DRIcoreExtension * core,
+              __GLcontextModes * modes, const __DRIconfig ** driConfigs)
+{
+   __GLXDRIconfigPrivate *config;
+   int i;
+
+   for (i = 0; driConfigs[i]; i++) {
+      if (driConfigEqual(core, modes, driConfigs[i]))
+         break;
+   }
+
+   if (driConfigs[i] == NULL)
+      return NULL;
+
+   config = Xmalloc(sizeof *config);
+   if (config == NULL)
+      return NULL;
+
+   config->modes = *modes;
+   config->driConfig = driConfigs[i];
+
+   return &config->modes;
+}
+
+_X_HIDDEN __GLcontextModes *
+driConvertConfigs(const __DRIcoreExtension * core,
+                  __GLcontextModes * modes, const __DRIconfig ** configs)
+{
+   __GLcontextModes head, *tail, *m;
+
+   tail = &head;
+   head.next = NULL;
+   for (m = modes; m; m = m->next) {
+      tail->next = createDriMode(core, m, configs);
+      if (tail->next == NULL) {
+         /* no matching dri config for m */
+         continue;
+      }
+
+
+      tail = tail->next;
+   }
+
+   _gl_context_modes_destroy(modes);
+
+   return head.next;
+}
+
+/* Bind DRI1 specific extensions */
+_X_HIDDEN void
+driBindExtensions(__GLXscreenConfigs *psc)
+{
+   const __DRIextension **extensions;
+   int i;
+
+   extensions = psc->core->getExtensions(psc->__driScreen);
+
+   for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_SWAP_CONTROL
+      /* No DRI2 support for swap_control at the moment, since SwapBuffers
+       * is done by the X server */
+      if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
+        psc->swapControl = (__DRIswapControlExtension *) extensions[i];
+        __glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
+        __glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
+      }
+#endif
+
+#ifdef __DRI_MEDIA_STREAM_COUNTER
+      if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) {
+         psc->msc = (__DRImediaStreamCounterExtension *) extensions[i];
+         __glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
+      }
+#endif
+
+#ifdef __DRI_SWAP_BUFFER_COUNTER
+      /* No driver supports this at this time and the extension is
+       * not defined in dri_interface.h.  Will enable
+       * GLX_OML_sync_control if implemented. */
+#endif
+
+      /* Ignore unknown extensions */
+   }
+}
+
+/* Bind DRI2 specific extensions */
+_X_HIDDEN void
+dri2BindExtensions(__GLXscreenConfigs *psc)
+{
+   const __DRIextension **extensions;
+   int i;
+
+   extensions = psc->core->getExtensions(psc->__driScreen);
+
+   for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_TEX_BUFFER
+      if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0)) {
+        psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
+        __glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap");
+      }
+#endif
+
+      __glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
+      __glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
+      __glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
+
+      /* FIXME: if DRI2 version supports it... */
+      __glXEnableDirectExtension(psc, "INTEL_swap_event");
+
+#ifdef __DRI2_FLUSH
+      if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0)) {
+        psc->f = (__DRI2flushExtension *) extensions[i];
+        /* internal driver extension, no GL extension exposed */
+      }
+#endif
+   }
+}
+
+/* Bind extensions common to DRI1 and DRI2 */
+_X_HIDDEN void
+driBindCommonExtensions(__GLXscreenConfigs *psc)
+{
+   const __DRIextension **extensions;
+   int i;
+
+   extensions = psc->core->getExtensions(psc->__driScreen);
+
+   for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_COPY_SUB_BUFFER
+      if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
+        psc->driCopySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
+        __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
+      }
+#endif
+
+#ifdef __DRI_ALLOCATE
+      if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) {
+        psc->allocate = (__DRIallocateExtension *) extensions[i];
+        __glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory");
+      }
+#endif
+
+#ifdef __DRI_FRAME_TRACKING
+      if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
+        psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
+        __glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage");
+      }
+#endif
+
+#ifdef __DRI_READ_DRAWABLE
+      if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+        __glXEnableDirectExtension(psc, "GLX_SGI_make_current_read");
+      }
+#endif
+
+      /* Ignore unknown extensions */
+   }
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
new file mode 100644 (file)
index 0000000..bb178db
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL 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 PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ *   Kevin E. Martin <kevin@precisioninsight.com>
+ *   Brian Paul <brian@precisioninsight.com>
+ *   Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifndef _DRI_COMMON_H
+#define _DRI_COMMON_H
+
+typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
+
+struct __GLXDRIconfigPrivateRec
+{
+   __GLcontextModes modes;
+   const __DRIconfig *driConfig;
+};
+
+extern __GLcontextModes *driConvertConfigs(const __DRIcoreExtension * core,
+                                           __GLcontextModes * modes,
+                                           const __DRIconfig ** configs);
+
+extern const __DRIsystemTimeExtension systemTimeExtension;
+
+extern void InfoMessageF(const char *f, ...);
+
+extern void ErrorMessageF(const char *f, ...);
+
+extern void *driOpenDriver(const char *driverName);
+
+extern void driBindExtensions(__GLXscreenConfigs * psc);
+extern void dri2BindExtensions(__GLXscreenConfigs * psc);
+extern void driBindCommonExtensions(__GLXscreenConfigs * psc);
+
+#endif /* _DRI_COMMON_H */
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
new file mode 100644 (file)
index 0000000..0ff53c3
--- /dev/null
@@ -0,0 +1,751 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <kevin@precisioninsight.com>
+ *   Brian Paul <brian@precisioninsight.com>
+ *
+ */
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include <X11/Xlib.h>
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/Xdamage.h>
+#include "glxclient.h"
+#include "xf86dri.h"
+#include "dri2.h"
+#include "sarea.h"
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include "xf86drm.h"
+#include "dri_common.h"
+
+typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
+typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
+
+struct __GLXDRIdisplayPrivateRec
+{
+   __GLXDRIdisplay base;
+
+   /*
+    ** XFree86-DRI version information
+    */
+   int driMajor;
+   int driMinor;
+   int driPatch;
+};
+
+struct __GLXDRIcontextPrivateRec
+{
+   __GLXDRIcontext base;
+   __DRIcontext *driContext;
+   XID hwContextID;
+   __GLXscreenConfigs *psc;
+};
+
+/*
+ * Given a display pointer and screen number, determine the name of
+ * the DRI driver for the screen. (I.e. "r128", "tdfx", etc).
+ * Return True for success, False for failure.
+ */
+static Bool
+driGetDriverName(Display * dpy, int scrNum, char **driverName)
+{
+   int directCapable;
+   Bool b;
+   int event, error;
+   int driverMajor, driverMinor, driverPatch;
+
+   *driverName = NULL;
+
+   if (XF86DRIQueryExtension(dpy, &event, &error)) {    /* DRI1 */
+      if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) {
+         ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n");
+         return False;
+      }
+      if (!directCapable) {
+         ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n");
+         return False;
+      }
+
+      b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor,
+                                     &driverPatch, driverName);
+      if (!b) {
+         ErrorMessageF("Cannot determine driver name for screen %d\n",
+                       scrNum);
+         return False;
+      }
+
+      InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
+                   driverMajor, driverMinor, driverPatch, *driverName,
+                   scrNum);
+
+      return True;
+   }
+   else if (DRI2QueryExtension(dpy, &event, &error)) {  /* DRI2 */
+      char *dev;
+      Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev);
+
+      if (ret)
+         Xfree(dev);
+
+      return ret;
+   }
+
+   return False;
+}
+
+/*
+ * Exported function for querying the DRI driver for a given screen.
+ *
+ * The returned char pointer points to a static array that will be
+ * overwritten by subsequent calls.
+ */
+PUBLIC const char *
+glXGetScreenDriver(Display * dpy, int scrNum)
+{
+   static char ret[32];
+   char *driverName;
+   if (driGetDriverName(dpy, scrNum, &driverName)) {
+      int len;
+      if (!driverName)
+         return NULL;
+      len = strlen(driverName);
+      if (len >= 31)
+         return NULL;
+      memcpy(ret, driverName, len + 1);
+      Xfree(driverName);
+      return ret;
+   }
+   return NULL;
+}
+
+/*
+ * Exported function for obtaining a driver's option list (UTF-8 encoded XML).
+ *
+ * The returned char pointer points directly into the driver. Therefore
+ * it should be treated as a constant.
+ *
+ * If the driver was not found or does not support configuration NULL is
+ * returned.
+ *
+ * Note: The driver remains opened after this function returns.
+ */
+PUBLIC const char *
+glXGetDriverConfig(const char *driverName)
+{
+   void *handle = driOpenDriver(driverName);
+   if (handle)
+      return dlsym(handle, "__driConfigOptions");
+   else
+      return NULL;
+}
+
+#ifdef XDAMAGE_1_1_INTERFACE
+
+static GLboolean
+has_damage_post(Display * dpy)
+{
+   static GLboolean inited = GL_FALSE;
+   static GLboolean has_damage;
+
+   if (!inited) {
+      int major, minor;
+
+      if (XDamageQueryVersion(dpy, &major, &minor) &&
+          major == 1 && minor >= 1) {
+         has_damage = GL_TRUE;
+      }
+      else {
+         has_damage = GL_FALSE;
+      }
+      inited = GL_TRUE;
+   }
+
+   return has_damage;
+}
+
+static void
+__glXReportDamage(__DRIdrawable * driDraw,
+                  int x, int y,
+                  drm_clip_rect_t * rects, int num_rects,
+                  GLboolean front_buffer, void *loaderPrivate)
+{
+   XRectangle *xrects;
+   XserverRegion region;
+   int i;
+   int x_off, y_off;
+   __GLXDRIdrawable *glxDraw = loaderPrivate;
+   __GLXscreenConfigs *psc = glxDraw->psc;
+   Display *dpy = psc->dpy;
+   Drawable drawable;
+
+   if (!has_damage_post(dpy))
+      return;
+
+   if (front_buffer) {
+      x_off = x;
+      y_off = y;
+      drawable = RootWindow(dpy, psc->scr);
+   }
+   else {
+      x_off = 0;
+      y_off = 0;
+      drawable = glxDraw->xDrawable;
+   }
+
+   xrects = malloc(sizeof(XRectangle) * num_rects);
+   if (xrects == NULL)
+      return;
+
+   for (i = 0; i < num_rects; i++) {
+      xrects[i].x = rects[i].x1 + x_off;
+      xrects[i].y = rects[i].y1 + y_off;
+      xrects[i].width = rects[i].x2 - rects[i].x1;
+      xrects[i].height = rects[i].y2 - rects[i].y1;
+   }
+   region = XFixesCreateRegion(dpy, xrects, num_rects);
+   free(xrects);
+   XDamageAdd(dpy, drawable, region);
+   XFixesDestroyRegion(dpy, region);
+}
+
+static const __DRIdamageExtension damageExtension = {
+   {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
+   __glXReportDamage,
+};
+
+#endif
+
+static GLboolean
+__glXDRIGetDrawableInfo(__DRIdrawable * drawable,
+                        unsigned int *index, unsigned int *stamp,
+                        int *X, int *Y, int *W, int *H,
+                        int *numClipRects, drm_clip_rect_t ** pClipRects,
+                        int *backX, int *backY,
+                        int *numBackClipRects,
+                        drm_clip_rect_t ** pBackClipRects,
+                        void *loaderPrivate)
+{
+   __GLXDRIdrawable *glxDraw = loaderPrivate;
+   __GLXscreenConfigs *psc = glxDraw->psc;
+   Display *dpy = psc->dpy;
+
+   return XF86DRIGetDrawableInfo(dpy, psc->scr, glxDraw->drawable,
+                                 index, stamp, X, Y, W, H,
+                                 numClipRects, pClipRects,
+                                 backX, backY,
+                                 numBackClipRects, pBackClipRects);
+}
+
+static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
+   {__DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION},
+   __glXDRIGetDrawableInfo
+};
+
+static const __DRIextension *loader_extensions[] = {
+   &systemTimeExtension.base,
+   &getDrawableInfoExtension.base,
+#ifdef XDAMAGE_1_1_INTERFACE
+   &damageExtension.base,
+#endif
+   NULL
+};
+
+/**
+ * Perform the required libGL-side initialization and call the client-side
+ * driver's \c __driCreateNewScreen function.
+ * 
+ * \param dpy    Display pointer.
+ * \param scrn   Screen number on the display.
+ * \param psc    DRI screen information.
+ * \param driDpy DRI display information.
+ * \param createNewScreen  Pointer to the client-side driver's
+ *               \c __driCreateNewScreen function.
+ * \returns A pointer to the \c __DRIscreen structure returned by
+ *          the client-side driver on success, or \c NULL on failure.
+ */
+static void *
+CallCreateNewScreen(Display * dpy, int scrn, __GLXscreenConfigs * psc,
+                    __GLXDRIdisplayPrivate * driDpy)
+{
+   void *psp = NULL;
+   drm_handle_t hSAREA;
+   drmAddress pSAREA = MAP_FAILED;
+   char *BusID;
+   __DRIversion ddx_version;
+   __DRIversion dri_version;
+   __DRIversion drm_version;
+   __DRIframebuffer framebuffer;
+   int fd = -1;
+   int status;
+
+   drm_magic_t magic;
+   drmVersionPtr version;
+   int newlyopened;
+   char *driverName;
+   drm_handle_t hFB;
+   int junk;
+   const __DRIconfig **driver_configs;
+   __GLcontextModes *visual;
+
+   /* DRI protocol version. */
+   dri_version.major = driDpy->driMajor;
+   dri_version.minor = driDpy->driMinor;
+   dri_version.patch = driDpy->driPatch;
+
+   framebuffer.base = MAP_FAILED;
+   framebuffer.dev_priv = NULL;
+
+   if (!XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) {
+      ErrorMessageF("XF86DRIOpenConnection failed\n");
+      goto handle_error;
+   }
+
+   fd = drmOpenOnce(NULL, BusID, &newlyopened);
+
+   Xfree(BusID);                /* No longer needed */
+
+   if (fd < 0) {
+      ErrorMessageF("drmOpenOnce failed (%s)\n", strerror(-fd));
+      goto handle_error;
+   }
+
+   if (drmGetMagic(fd, &magic)) {
+      ErrorMessageF("drmGetMagic failed\n");
+      goto handle_error;
+   }
+
+   version = drmGetVersion(fd);
+   if (version) {
+      drm_version.major = version->version_major;
+      drm_version.minor = version->version_minor;
+      drm_version.patch = version->version_patchlevel;
+      drmFreeVersion(version);
+   }
+   else {
+      drm_version.major = -1;
+      drm_version.minor = -1;
+      drm_version.patch = -1;
+   }
+
+   if (newlyopened && !XF86DRIAuthConnection(dpy, scrn, magic)) {
+      ErrorMessageF("XF86DRIAuthConnection failed\n");
+      goto handle_error;
+   }
+
+   /* Get device name (like "tdfx") and the ddx version numbers.
+    * We'll check the version in each DRI driver's "createNewScreen"
+    * function. */
+   if (!XF86DRIGetClientDriverName(dpy, scrn,
+                                   &ddx_version.major,
+                                   &ddx_version.minor,
+                                   &ddx_version.patch, &driverName)) {
+      ErrorMessageF("XF86DRIGetClientDriverName failed\n");
+      goto handle_error;
+   }
+
+   Xfree(driverName);           /* No longer needed. */
+
+   /*
+    * Get device-specific info.  pDevPriv will point to a struct
+    * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
+    * has information about the screen size, depth, pitch, ancilliary
+    * buffers, DRM mmap handles, etc.
+    */
+   if (!XF86DRIGetDeviceInfo(dpy, scrn, &hFB, &junk,
+                             &framebuffer.size, &framebuffer.stride,
+                             &framebuffer.dev_priv_size,
+                             &framebuffer.dev_priv)) {
+      ErrorMessageF("XF86DRIGetDeviceInfo failed");
+      goto handle_error;
+   }
+
+   framebuffer.width = DisplayWidth(dpy, scrn);
+   framebuffer.height = DisplayHeight(dpy, scrn);
+
+   /* Map the framebuffer region. */
+   status = drmMap(fd, hFB, framebuffer.size,
+                   (drmAddressPtr) & framebuffer.base);
+   if (status != 0) {
+      ErrorMessageF("drmMap of framebuffer failed (%s)", strerror(-status));
+      goto handle_error;
+   }
+
+   /* Map the SAREA region.  Further mmap regions may be setup in
+    * each DRI driver's "createNewScreen" function.
+    */
+   status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
+   if (status != 0) {
+      ErrorMessageF("drmMap of SAREA failed (%s)", strerror(-status));
+      goto handle_error;
+   }
+
+   psp = (*psc->legacy->createNewScreen) (scrn,
+                                          &ddx_version,
+                                          &dri_version,
+                                          &drm_version,
+                                          &framebuffer,
+                                          pSAREA,
+                                          fd,
+                                          loader_extensions,
+                                          &driver_configs, psc);
+
+   if (psp == NULL) {
+      ErrorMessageF("Calling driver entry point failed");
+      goto handle_error;
+   }
+
+   psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
+   psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
+
+   psc->driver_configs = driver_configs;
+
+   /* Visuals with depth != screen depth are subject to automatic compositing
+    * in the X server, so DRI1 can't render to them properly. Mark them as
+    * non-conformant to prevent apps from picking them up accidentally.
+    */
+   for (visual = psc->visuals; visual; visual = visual->next) {
+      XVisualInfo template;
+      XVisualInfo *visuals;
+      int num_visuals;
+      long mask;
+
+      template.visualid = visual->visualID;
+      mask = VisualIDMask;
+      visuals = XGetVisualInfo(dpy, mask, &template, &num_visuals);
+
+      if (visuals) {
+         if (num_visuals > 0 && visuals->depth != DefaultDepth(dpy, scrn))
+            visual->visualRating = GLX_NON_CONFORMANT_CONFIG;
+
+         XFree(visuals);
+      }
+   }
+
+   return psp;
+
+ handle_error:
+   if (pSAREA != MAP_FAILED)
+      drmUnmap(pSAREA, SAREA_MAX);
+
+   if (framebuffer.base != MAP_FAILED)
+      drmUnmap((drmAddress) framebuffer.base, framebuffer.size);
+
+   if (framebuffer.dev_priv != NULL)
+      Xfree(framebuffer.dev_priv);
+
+   if (fd >= 0)
+      drmCloseOnce(fd);
+
+   XF86DRICloseConnection(dpy, scrn);
+
+   ErrorMessageF("reverting to software direct rendering\n");
+
+   return NULL;
+}
+
+static void
+driDestroyContext(__GLXDRIcontext * context,
+                  __GLXscreenConfigs * psc, Display * dpy)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+
+   (*psc->core->destroyContext) (pcp->driContext);
+
+   XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
+   Xfree(pcp);
+}
+
+static Bool
+driBindContext(__GLXDRIcontext * context,
+               __GLXDRIdrawable * draw, __GLXDRIdrawable * read)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   return (*core->bindContext) (pcp->driContext,
+                                draw->driDrawable, read->driDrawable);
+}
+
+static void
+driUnbindContext(__GLXDRIcontext * context)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   (*core->unbindContext) (pcp->driContext);
+}
+
+static __GLXDRIcontext *
+driCreateContext(__GLXscreenConfigs * psc,
+                 const __GLcontextModes * mode,
+                 GLXContext gc, GLXContext shareList, int renderType)
+{
+   __GLXDRIcontextPrivate *pcp, *pcp_shared;
+   drm_context_t hwContext;
+   __DRIcontext *shared = NULL;
+   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
+
+   if (!psc || !psc->driScreen)
+      return NULL;
+
+   if (shareList) {
+      pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
+      shared = pcp_shared->driContext;
+   }
+
+   pcp = Xmalloc(sizeof *pcp);
+   if (pcp == NULL)
+      return NULL;
+
+   pcp->psc = psc;
+   if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr,
+                                       mode->visualID,
+                                       &pcp->hwContextID, &hwContext)) {
+      Xfree(pcp);
+      return NULL;
+   }
+
+   pcp->driContext =
+      (*psc->legacy->createNewContext) (psc->__driScreen,
+                                        config->driConfig,
+                                        renderType, shared, hwContext, pcp);
+   if (pcp->driContext == NULL) {
+      XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
+      Xfree(pcp);
+      return NULL;
+   }
+
+   pcp->base.destroyContext = driDestroyContext;
+   pcp->base.bindContext = driBindContext;
+   pcp->base.unbindContext = driUnbindContext;
+
+   return &pcp->base;
+}
+
+static void
+driDestroyDrawable(__GLXDRIdrawable * pdraw)
+{
+   __GLXscreenConfigs *psc = pdraw->psc;
+
+   (*psc->core->destroyDrawable) (pdraw->driDrawable);
+   XF86DRIDestroyDrawable(psc->dpy, psc->scr, pdraw->drawable);
+   Xfree(pdraw);
+}
+
+static __GLXDRIdrawable *
+driCreateDrawable(__GLXscreenConfigs * psc,
+                  XID xDrawable,
+                  GLXDrawable drawable, const __GLcontextModes * modes)
+{
+   __GLXDRIdrawable *pdraw;
+   drm_drawable_t hwDrawable;
+   void *empty_attribute_list = NULL;
+   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
+
+   /* Old dri can't handle GLX 1.3+ drawable constructors. */
+   if (xDrawable != drawable)
+      return NULL;
+
+   pdraw = Xmalloc(sizeof(*pdraw));
+   if (!pdraw)
+      return NULL;
+
+   pdraw->drawable = drawable;
+   pdraw->psc = psc;
+
+   if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) {
+      Xfree(pdraw);
+      return NULL;
+   }
+
+   /* Create a new drawable */
+   pdraw->driDrawable =
+      (*psc->legacy->createNewDrawable) (psc->__driScreen,
+                                         config->driConfig,
+                                         hwDrawable,
+                                         GLX_WINDOW_BIT,
+                                         empty_attribute_list, pdraw);
+
+   if (!pdraw->driDrawable) {
+      XF86DRIDestroyDrawable(psc->dpy, psc->scr, drawable);
+      Xfree(pdraw);
+      return NULL;
+   }
+
+   pdraw->destroyDrawable = driDestroyDrawable;
+
+   return pdraw;
+}
+
+static int64_t
+driSwapBuffers(__GLXDRIdrawable * pdraw, int64_t unused1, int64_t unused2,
+              int64_t unused3)
+{
+   (*pdraw->psc->core->swapBuffers) (pdraw->driDrawable);
+   return 0;
+}
+
+static void
+driCopySubBuffer(__GLXDRIdrawable * pdraw,
+                 int x, int y, int width, int height)
+{
+   (*pdraw->psc->driCopySubBuffer->copySubBuffer) (pdraw->driDrawable,
+                                                   x, y, width, height);
+}
+
+static void
+driDestroyScreen(__GLXscreenConfigs * psc)
+{
+   /* Free the direct rendering per screen data */
+   if (psc->__driScreen)
+      (*psc->core->destroyScreen) (psc->__driScreen);
+   psc->__driScreen = NULL;
+   if (psc->driver)
+      dlclose(psc->driver);
+}
+
+static __GLXDRIscreen *
+driCreateScreen(__GLXscreenConfigs * psc, int screen,
+                __GLXdisplayPrivate * priv)
+{
+   __GLXDRIdisplayPrivate *pdp;
+   __GLXDRIscreen *psp;
+   const __DRIextension **extensions;
+   char *driverName;
+   int i;
+
+   psp = Xcalloc(1, sizeof *psp);
+   if (psp == NULL)
+      return NULL;
+
+   /* Initialize per screen dynamic client GLX extensions */
+   psc->ext_list_first_time = GL_TRUE;
+
+   if (!driGetDriverName(priv->dpy, screen, &driverName)) {
+      Xfree(psp);
+      return NULL;
+   }
+
+   psc->driver = driOpenDriver(driverName);
+   Xfree(driverName);
+   if (psc->driver == NULL) {
+      Xfree(psp);
+      return NULL;
+   }
+
+   extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
+   if (extensions == NULL) {
+      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
+      Xfree(psp);
+      return NULL;
+   }
+
+   for (i = 0; extensions[i]; i++) {
+      if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
+        psc->core = (__DRIcoreExtension *) extensions[i];
+      if (strcmp(extensions[i]->name, __DRI_LEGACY) == 0)
+        psc->legacy = (__DRIlegacyExtension *) extensions[i];
+   }
+
+   if (psc->core == NULL || psc->legacy == NULL) {
+      Xfree(psp);
+      return NULL;
+   }
+
+   pdp = (__GLXDRIdisplayPrivate *) priv->driDisplay;
+   psc->__driScreen = CallCreateNewScreen(psc->dpy, screen, psc, pdp);
+   if (psc->__driScreen == NULL) {
+      dlclose(psc->driver);
+      Xfree(psp);
+      return NULL;
+   }
+
+   driBindExtensions(psc);
+   driBindCommonExtensions(psc);
+
+   if (psc->driCopySubBuffer)
+      psp->copySubBuffer = driCopySubBuffer;
+
+   psp->destroyScreen = driDestroyScreen;
+   psp->createContext = driCreateContext;
+   psp->createDrawable = driCreateDrawable;
+   psp->swapBuffers = driSwapBuffers;
+   psp->waitX = NULL;
+   psp->waitGL = NULL;
+
+   return psp;
+}
+
+/* Called from __glXFreeDisplayPrivate.
+ */
+static void
+driDestroyDisplay(__GLXDRIdisplay * dpy)
+{
+   Xfree(dpy);
+}
+
+/*
+ * Allocate, initialize and return a __DRIdisplayPrivate object.
+ * This is called from __glXInitialize() when we are given a new
+ * display pointer.
+ */
+_X_HIDDEN __GLXDRIdisplay *
+driCreateDisplay(Display * dpy)
+{
+   __GLXDRIdisplayPrivate *pdpyp;
+   int eventBase, errorBase;
+   int major, minor, patch;
+
+   if (!XF86DRIQueryExtension(dpy, &eventBase, &errorBase)) {
+      return NULL;
+   }
+
+   if (!XF86DRIQueryVersion(dpy, &major, &minor, &patch)) {
+      return NULL;
+   }
+
+   pdpyp = Xmalloc(sizeof *pdpyp);
+   if (!pdpyp) {
+      return NULL;
+   }
+
+   pdpyp->driMajor = major;
+   pdpyp->driMinor = minor;
+   pdpyp->driPatch = patch;
+
+   pdpyp->base.destroyDisplay = driDestroyDisplay;
+   pdpyp->base.createScreen = driCreateScreen;
+
+   return &pdpyp->base;
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
new file mode 100644 (file)
index 0000000..eed9a8c
--- /dev/null
@@ -0,0 +1,456 @@
+/*
+ * Copyright 2008 George Sapountzis
+ *
+ * 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 GLX_DIRECT_RENDERING
+
+#include <X11/Xlib.h>
+#include "glxclient.h"
+#include <dlfcn.h>
+#include "dri_common.h"
+
+typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
+typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
+typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
+
+struct __GLXDRIdisplayPrivateRec
+{
+   __GLXDRIdisplay base;
+};
+
+struct __GLXDRIcontextPrivateRec
+{
+   __GLXDRIcontext base;
+   __DRIcontext *driContext;
+   __GLXscreenConfigs *psc;
+};
+
+struct __GLXDRIdrawablePrivateRec
+{
+   __GLXDRIdrawable base;
+
+   GC gc;
+   GC swapgc;
+
+   XVisualInfo *visinfo;
+   XImage *ximage;
+   int bpp;
+};
+
+/**
+ * swrast loader functions
+ */
+
+static Bool
+XCreateDrawable(__GLXDRIdrawablePrivate * pdp,
+                Display * dpy, XID drawable, int visualid)
+{
+   XGCValues gcvalues;
+   long visMask;
+   XVisualInfo visTemp;
+   int num_visuals;
+
+   /* create GC's */
+   pdp->gc = XCreateGC(dpy, drawable, 0, NULL);
+   pdp->swapgc = XCreateGC(dpy, drawable, 0, NULL);
+
+   gcvalues.function = GXcopy;
+   gcvalues.graphics_exposures = False;
+   XChangeGC(dpy, pdp->gc, GCFunction, &gcvalues);
+   XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues);
+   XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues);
+
+   /* create XImage  */
+   visTemp.screen = DefaultScreen(dpy);
+   visTemp.visualid = visualid;
+   visMask = (VisualScreenMask | VisualIDMask);
+   pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
+
+   pdp->ximage = XCreateImage(dpy, pdp->visinfo->visual, pdp->visinfo->depth, ZPixmap, 0,       /* format, offset */
+                              NULL,     /* data */
+                              0, 0,     /* size */
+                              32,       /* bitmap_pad */
+                              0);       /* bytes_per_line */
+
+   /* get the true number of bits per pixel */
+   pdp->bpp = pdp->ximage->bits_per_pixel;
+
+   return True;
+}
+
+static void
+XDestroyDrawable(__GLXDRIdrawablePrivate * pdp, Display * dpy, XID drawable)
+{
+   XDestroyImage(pdp->ximage);
+   XFree(pdp->visinfo);
+
+   XFreeGC(dpy, pdp->gc);
+   XFreeGC(dpy, pdp->swapgc);
+}
+
+static void
+swrastGetDrawableInfo(__DRIdrawable * draw,
+                      int *x, int *y, int *w, int *h, void *loaderPrivate)
+{
+   __GLXDRIdrawablePrivate *pdp = loaderPrivate;
+   __GLXDRIdrawable *pdraw = &(pdp->base);
+   Display *dpy = pdraw->psc->dpy;
+   Drawable drawable;
+
+   Window root;
+   Status stat;
+   unsigned int bw, depth;
+
+   drawable = pdraw->xDrawable;
+
+   stat = XGetGeometry(dpy, drawable, &root,
+                       x, y, (unsigned int *) w, (unsigned int *) h,
+                       &bw, &depth);
+}
+
+static inline int
+bytes_per_line(int w, int bpp, unsigned mul)
+{
+   unsigned mask = mul - 1;
+
+   return ((w * bpp + mask) & ~mask) / 8;
+}
+
+static void
+swrastPutImage(__DRIdrawable * draw, int op,
+               int x, int y, int w, int h, char *data, void *loaderPrivate)
+{
+   __GLXDRIdrawablePrivate *pdp = loaderPrivate;
+   __GLXDRIdrawable *pdraw = &(pdp->base);
+   Display *dpy = pdraw->psc->dpy;
+   Drawable drawable;
+   XImage *ximage;
+   GC gc;
+
+   switch (op) {
+   case __DRI_SWRAST_IMAGE_OP_DRAW:
+      gc = pdp->gc;
+      break;
+   case __DRI_SWRAST_IMAGE_OP_SWAP:
+      gc = pdp->swapgc;
+      break;
+   default:
+      return;
+   }
+
+   drawable = pdraw->xDrawable;
+
+   ximage = pdp->ximage;
+   ximage->data = data;
+   ximage->width = w;
+   ximage->height = h;
+   ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
+
+   XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
+
+   ximage->data = NULL;
+}
+
+static void
+swrastGetImage(__DRIdrawable * draw,
+               int x, int y, int w, int h, char *data, void *loaderPrivate)
+{
+   __GLXDRIdrawablePrivate *pdp = loaderPrivate;
+   __GLXDRIdrawable *pdraw = &(pdp->base);
+   Display *dpy = pdraw->psc->dpy;
+   Drawable drawable;
+   XImage *ximage;
+
+   drawable = pdraw->xDrawable;
+
+   ximage = pdp->ximage;
+   ximage->data = data;
+   ximage->width = w;
+   ximage->height = h;
+   ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
+
+   XGetSubImage(dpy, drawable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
+
+   ximage->data = NULL;
+}
+
+static const __DRIswrastLoaderExtension swrastLoaderExtension = {
+   {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
+   swrastGetDrawableInfo,
+   swrastPutImage,
+   swrastGetImage
+};
+
+static const __DRIextension *loader_extensions[] = {
+   &systemTimeExtension.base,
+   &swrastLoaderExtension.base,
+   NULL
+};
+
+/**
+ * GLXDRI functions
+ */
+
+static void
+driDestroyContext(__GLXDRIcontext * context,
+                  __GLXscreenConfigs * psc, Display * dpy)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   (*core->destroyContext) (pcp->driContext);
+
+   Xfree(pcp);
+}
+
+static Bool
+driBindContext(__GLXDRIcontext * context,
+               __GLXDRIdrawable * draw, __GLXDRIdrawable * read)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   return (*core->bindContext) (pcp->driContext,
+                                draw->driDrawable, read->driDrawable);
+}
+
+static void
+driUnbindContext(__GLXDRIcontext * context)
+{
+   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+   const __DRIcoreExtension *core = pcp->psc->core;
+
+   (*core->unbindContext) (pcp->driContext);
+}
+
+static __GLXDRIcontext *
+driCreateContext(__GLXscreenConfigs * psc,
+                 const __GLcontextModes * mode,
+                 GLXContext gc, GLXContext shareList, int renderType)
+{
+   __GLXDRIcontextPrivate *pcp, *pcp_shared;
+   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
+   const __DRIcoreExtension *core;
+   __DRIcontext *shared = NULL;
+
+   if (!psc || !psc->driScreen)
+      return NULL;
+
+   core = psc->core;
+
+   if (shareList) {
+      pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
+      shared = pcp_shared->driContext;
+   }
+
+   pcp = Xmalloc(sizeof *pcp);
+   if (pcp == NULL)
+      return NULL;
+
+   pcp->psc = psc;
+   pcp->driContext =
+      (*core->createNewContext) (psc->__driScreen,
+                                 config->driConfig, shared, pcp);
+   if (pcp->driContext == NULL) {
+      Xfree(pcp);
+      return NULL;
+   }
+
+   pcp->base.destroyContext = driDestroyContext;
+   pcp->base.bindContext = driBindContext;
+   pcp->base.unbindContext = driUnbindContext;
+
+   return &pcp->base;
+}
+
+static void
+driDestroyDrawable(__GLXDRIdrawable * pdraw)
+{
+   __GLXDRIdrawablePrivate *pdp = (__GLXDRIdrawablePrivate *) pdraw;
+   const __DRIcoreExtension *core = pdraw->psc->core;
+
+   (*core->destroyDrawable) (pdraw->driDrawable);
+
+   XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
+   Xfree(pdp);
+}
+
+static __GLXDRIdrawable *
+driCreateDrawable(__GLXscreenConfigs * psc,
+                  XID xDrawable,
+                  GLXDrawable drawable, const __GLcontextModes * modes)
+{
+   __GLXDRIdrawable *pdraw;
+   __GLXDRIdrawablePrivate *pdp;
+   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
+   const __DRIswrastExtension *swrast = psc->swrast;
+
+   /* Old dri can't handle GLX 1.3+ drawable constructors. */
+   if (xDrawable != drawable)
+      return NULL;
+
+   pdp = Xmalloc(sizeof(*pdp));
+   if (!pdp)
+      return NULL;
+
+   pdraw = &(pdp->base);
+   pdraw->xDrawable = xDrawable;
+   pdraw->drawable = drawable;
+   pdraw->psc = psc;
+
+   XCreateDrawable(pdp, psc->dpy, xDrawable, modes->visualID);
+
+   /* Create a new drawable */
+   pdraw->driDrawable =
+      (*swrast->createNewDrawable) (psc->__driScreen, config->driConfig, pdp);
+
+   if (!pdraw->driDrawable) {
+      XDestroyDrawable(pdp, psc->dpy, xDrawable);
+      Xfree(pdp);
+      return NULL;
+   }
+
+   pdraw->destroyDrawable = driDestroyDrawable;
+
+   return pdraw;
+}
+
+static void
+driSwapBuffers(__GLXDRIdrawable * pdraw)
+{
+   (*pdraw->psc->core->swapBuffers) (pdraw->driDrawable);
+}
+
+static void
+driDestroyScreen(__GLXscreenConfigs * psc)
+{
+   /* Free the direct rendering per screen data */
+   (*psc->core->destroyScreen) (psc->__driScreen);
+   psc->__driScreen = NULL;
+   if (psc->driver)
+      dlclose(psc->driver);
+}
+
+static __GLXDRIscreen *
+driCreateScreen(__GLXscreenConfigs * psc, int screen,
+                __GLXdisplayPrivate * priv)
+{
+   __GLXDRIscreen *psp;
+   const __DRIconfig **driver_configs;
+   const __DRIextension **extensions;
+   const char *driverName = "swrast";
+   int i;
+
+   psp = Xcalloc(1, sizeof *psp);
+   if (psp == NULL)
+      return NULL;
+
+   /* Initialize per screen dynamic client GLX extensions */
+   psc->ext_list_first_time = GL_TRUE;
+
+   psc->driver = driOpenDriver(driverName);
+   if (psc->driver == NULL)
+      goto handle_error;
+
+   extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
+   if (extensions == NULL) {
+      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
+      goto handle_error;
+   }
+
+   for (i = 0; extensions[i]; i++) {
+      if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
+         psc->core = (__DRIcoreExtension *) extensions[i];
+      if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0)
+         psc->swrast = (__DRIswrastExtension *) extensions[i];
+   }
+
+   if (psc->core == NULL || psc->swrast == NULL) {
+      ErrorMessageF("core dri extension not found\n");
+      goto handle_error;
+   }
+
+   psc->__driScreen =
+      psc->swrast->createNewScreen(screen,
+                                   loader_extensions, &driver_configs, psc);
+   if (psc->__driScreen == NULL) {
+      ErrorMessageF("failed to create dri screen\n");
+      goto handle_error;
+   }
+
+   driBindExtensions(psc);
+   driBindCommonExtensions(psc);
+
+   psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
+   psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
+
+   psc->driver_configs = driver_configs;
+
+   psp->destroyScreen = driDestroyScreen;
+   psp->createContext = driCreateContext;
+   psp->createDrawable = driCreateDrawable;
+   psp->swapBuffers = driSwapBuffers;
+   psp->waitX = NULL;
+   psp->waitGL = NULL;
+
+   return psp;
+
+ handle_error:
+   Xfree(psp);
+
+   if (psc->driver)
+      dlclose(psc->driver);
+
+   ErrorMessageF("reverting to indirect rendering\n");
+
+   return NULL;
+}
+
+/* Called from __glXFreeDisplayPrivate.
+ */
+static void
+driDestroyDisplay(__GLXDRIdisplay * dpy)
+{
+   Xfree(dpy);
+}
+
+/*
+ * Allocate, initialize and return a __DRIdisplayPrivate object.
+ * This is called from __glXInitialize() when we are given a new
+ * display pointer.
+ */
+_X_HIDDEN __GLXDRIdisplay *
+driswCreateDisplay(Display * dpy)
+{
+   __GLXDRIdisplayPrivate *pdpyp;
+
+   pdpyp = Xmalloc(sizeof *pdpyp);
+   if (pdpyp == NULL)
+      return NULL;
+
+   pdpyp->base.destroyDisplay = driDestroyDisplay;
+   pdpyp->base.createScreen = driCreateScreen;
+
+   return &pdpyp->base;
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/eval.c b/src/glx/eval.c
new file mode 100644 (file)
index 0000000..226fb7d
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+#include "packrender.h"
+
+/*
+** Routines to pack evaluator maps into the transport buffer.  Maps are
+** allowed to have extra arbitrary data, so these routines extract just
+** the information that the GL needs.
+*/
+
+void
+__glFillMap1f(GLint k, GLint order, GLint stride,
+              const GLfloat * points, GLubyte * pc)
+{
+   if (stride == k) {
+      /* Just copy the data */
+      __GLX_PUT_FLOAT_ARRAY(0, points, order * k);
+   }
+   else {
+      GLint i;
+
+      for (i = 0; i < order; i++) {
+         __GLX_PUT_FLOAT_ARRAY(0, points, k);
+         points += stride;
+         pc += k * __GLX_SIZE_FLOAT32;
+      }
+   }
+}
+
+void
+__glFillMap1d(GLint k, GLint order, GLint stride,
+              const GLdouble * points, GLubyte * pc)
+{
+   if (stride == k) {
+      /* Just copy the data */
+      __GLX_PUT_DOUBLE_ARRAY(0, points, order * k);
+   }
+   else {
+      GLint i;
+      for (i = 0; i < order; i++) {
+         __GLX_PUT_DOUBLE_ARRAY(0, points, k);
+         points += stride;
+         pc += k * __GLX_SIZE_FLOAT64;
+      }
+   }
+}
+
+void
+__glFillMap2f(GLint k, GLint majorOrder, GLint minorOrder,
+              GLint majorStride, GLint minorStride,
+              const GLfloat * points, GLfloat * data)
+{
+   GLint i, j, x;
+
+   if ((minorStride == k) && (majorStride == minorOrder * k)) {
+      /* Just copy the data */
+      __GLX_MEM_COPY(data, points, majorOrder * majorStride *
+                     __GLX_SIZE_FLOAT32);
+      return;
+   }
+   for (i = 0; i < majorOrder; i++) {
+      for (j = 0; j < minorOrder; j++) {
+         for (x = 0; x < k; x++) {
+            data[x] = points[x];
+         }
+         points += minorStride;
+         data += k;
+      }
+      points += majorStride - minorStride * minorOrder;
+   }
+}
+
+void
+__glFillMap2d(GLint k, GLint majorOrder, GLint minorOrder,
+              GLint majorStride, GLint minorStride,
+              const GLdouble * points, GLdouble * data)
+{
+   int i, j, x;
+
+   if ((minorStride == k) && (majorStride == minorOrder * k)) {
+      /* Just copy the data */
+      __GLX_MEM_COPY(data, points, majorOrder * majorStride *
+                     __GLX_SIZE_FLOAT64);
+      return;
+   }
+
+#ifdef __GLX_ALIGN64
+   x = k * __GLX_SIZE_FLOAT64;
+#endif
+   for (i = 0; i < majorOrder; i++) {
+      for (j = 0; j < minorOrder; j++) {
+#ifdef __GLX_ALIGN64
+         __GLX_MEM_COPY(data, points, x);
+#else
+         for (x = 0; x < k; x++) {
+            data[x] = points[x];
+         }
+#endif
+         points += minorStride;
+         data += k;
+      }
+      points += majorStride - minorStride * minorOrder;
+   }
+}
diff --git a/src/glx/glcontextmodes.c b/src/glx/glcontextmodes.c
new file mode 100644 (file)
index 0000000..232031c
--- /dev/null
@@ -0,0 +1,544 @@
+/*
+ * (C) Copyright IBM Corporation 2003
+ * 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 glcontextmodes.c
+ * Utility routines for working with \c __GLcontextModes structures.  At
+ * some point most or all of these functions will be moved to the Mesa
+ * code base.
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#if defined(IN_MINI_GLX)
+#include <GL/gl.h>
+#else
+#if defined(HAVE_DIX_CONFIG_H)
+# include <dix-config.h>
+#endif
+#include <X11/X.h>
+#include <GL/glx.h>
+#include "GL/glxint.h"
+#endif
+
+/* Memory macros */
+#if defined(IN_MINI_GLX)
+# include <stdlib.h>
+# include <string.h>
+# define _mesa_malloc(b) malloc(b)
+# define _mesa_free(m) free(m)
+# define _mesa_memset  memset
+#else
+# ifdef XFree86Server
+# include <os.h>
+# include <string.h>
+#  define _mesa_malloc(b) xalloc(b)
+#  define _mesa_free(m)   xfree(m)
+#  define _mesa_memset   memset
+# else
+#  include <X11/Xlibint.h>
+#  define _mesa_memset memset
+#  define _mesa_malloc(b) Xmalloc(b)
+#  define _mesa_free(m) Xfree(m)
+# endif /* XFree86Server */
+#endif /* !defined(IN_MINI_GLX) */
+
+#include "glcontextmodes.h"
+
+#if !defined(IN_MINI_GLX)
+#define NUM_VISUAL_TYPES   6
+
+/**
+ * Convert an X visual type to a GLX visual type.
+ * 
+ * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.)
+ *        to be converted.
+ * \return If \c visualType is a valid X visual type, a GLX visual type will
+ *         be returned.  Otherwise \c GLX_NONE will be returned.
+ */
+GLint
+_gl_convert_from_x_visual_type(int visualType)
+{
+   static const int glx_visual_types[NUM_VISUAL_TYPES] = {
+      GLX_STATIC_GRAY, GLX_GRAY_SCALE,
+      GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
+      GLX_TRUE_COLOR, GLX_DIRECT_COLOR
+   };
+
+   return ((unsigned) visualType < NUM_VISUAL_TYPES)
+      ? glx_visual_types[visualType] : GLX_NONE;
+}
+
+
+/**
+ * Convert a GLX visual type to an X visual type.
+ * 
+ * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, 
+ *                   \c GLX_STATIC_GRAY, etc.) to be converted.
+ * \return If \c visualType is a valid GLX visual type, an X visual type will
+ *         be returned.  Otherwise -1 will be returned.
+ */
+GLint
+_gl_convert_to_x_visual_type(int visualType)
+{
+   static const int x_visual_types[NUM_VISUAL_TYPES] = {
+      TrueColor, DirectColor,
+      PseudoColor, StaticColor,
+      GrayScale, StaticGray
+   };
+
+   return ((unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES)
+      ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1;
+}
+
+
+/**
+ * Copy a GLX visual config structure to a GL context mode structure.  All
+ * of the fields in \c config are copied to \c mode.  Additional fields in
+ * \c mode that can be derrived from the fields of \c config (i.e.,
+ * \c haveDepthBuffer) are also filled in.  The remaining fields in \c mode
+ * that cannot be derived are set to default values.
+ * 
+ * \param mode   Destination GL context mode.
+ * \param config Source GLX visual config.
+ * 
+ * \note
+ * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes
+ * structure will be set to the \c vid of the \c __GLXvisualConfig structure.
+ */
+void
+_gl_copy_visual_to_context_mode(__GLcontextModes * mode,
+                                const __GLXvisualConfig * config)
+{
+   __GLcontextModes *const next = mode->next;
+
+   (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes));
+   mode->next = next;
+
+   mode->visualID = config->vid;
+   mode->visualType = _gl_convert_from_x_visual_type(config->class);
+   mode->xRenderable = GL_TRUE;
+   mode->fbconfigID = config->vid;
+   mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+
+   mode->rgbMode = (config->rgba != 0);
+   mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+
+   mode->colorIndexMode = !(mode->rgbMode);
+   mode->doubleBufferMode = (config->doubleBuffer != 0);
+   mode->stereoMode = (config->stereo != 0);
+
+   mode->haveAccumBuffer = ((config->accumRedSize +
+                             config->accumGreenSize +
+                             config->accumBlueSize +
+                             config->accumAlphaSize) > 0);
+   mode->haveDepthBuffer = (config->depthSize > 0);
+   mode->haveStencilBuffer = (config->stencilSize > 0);
+
+   mode->redBits = config->redSize;
+   mode->greenBits = config->greenSize;
+   mode->blueBits = config->blueSize;
+   mode->alphaBits = config->alphaSize;
+   mode->redMask = config->redMask;
+   mode->greenMask = config->greenMask;
+   mode->blueMask = config->blueMask;
+   mode->alphaMask = config->alphaMask;
+   mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
+   mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
+
+   mode->accumRedBits = config->accumRedSize;
+   mode->accumGreenBits = config->accumGreenSize;
+   mode->accumBlueBits = config->accumBlueSize;
+   mode->accumAlphaBits = config->accumAlphaSize;
+   mode->depthBits = config->depthSize;
+   mode->stencilBits = config->stencilSize;
+
+   mode->numAuxBuffers = config->auxBuffers;
+   mode->level = config->level;
+
+   mode->visualRating = config->visualRating;
+   mode->transparentPixel = config->transparentPixel;
+   mode->transparentRed = config->transparentRed;
+   mode->transparentGreen = config->transparentGreen;
+   mode->transparentBlue = config->transparentBlue;
+   mode->transparentAlpha = config->transparentAlpha;
+   mode->transparentIndex = config->transparentIndex;
+   mode->samples = config->multiSampleSize;
+   mode->sampleBuffers = config->nMultiSampleBuffers;
+   /* mode->visualSelectGroup = config->visualSelectGroup; ? */
+
+   mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
+
+   mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
+   mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
+      GL_TRUE : GL_FALSE;
+   mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
+   mode->bindToTextureTargets = mode->rgbMode ?
+      GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
+      GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
+   mode->yInverted = GL_FALSE;
+}
+
+
+/**
+ * Get data from a GL context mode.
+ * 
+ * \param mode         GL context mode whose data is to be returned.
+ * \param attribute    Attribute of \c mode that is to be returned.
+ * \param value_return Location to store the data member of \c mode.
+ * \return  If \c attribute is a valid attribute of \c mode, zero is
+ *          returned.  Otherwise \c GLX_BAD_ATTRIBUTE is returned.
+ */
+int
+_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
+                          int *value_return)
+{
+   switch (attribute) {
+   case GLX_USE_GL:
+      *value_return = GL_TRUE;
+      return 0;
+   case GLX_BUFFER_SIZE:
+      *value_return = mode->rgbBits;
+      return 0;
+   case GLX_RGBA:
+      *value_return = mode->rgbMode;
+      return 0;
+   case GLX_RED_SIZE:
+      *value_return = mode->redBits;
+      return 0;
+   case GLX_GREEN_SIZE:
+      *value_return = mode->greenBits;
+      return 0;
+   case GLX_BLUE_SIZE:
+      *value_return = mode->blueBits;
+      return 0;
+   case GLX_ALPHA_SIZE:
+      *value_return = mode->alphaBits;
+      return 0;
+   case GLX_DOUBLEBUFFER:
+      *value_return = mode->doubleBufferMode;
+      return 0;
+   case GLX_STEREO:
+      *value_return = mode->stereoMode;
+      return 0;
+   case GLX_AUX_BUFFERS:
+      *value_return = mode->numAuxBuffers;
+      return 0;
+   case GLX_DEPTH_SIZE:
+      *value_return = mode->depthBits;
+      return 0;
+   case GLX_STENCIL_SIZE:
+      *value_return = mode->stencilBits;
+      return 0;
+   case GLX_ACCUM_RED_SIZE:
+      *value_return = mode->accumRedBits;
+      return 0;
+   case GLX_ACCUM_GREEN_SIZE:
+      *value_return = mode->accumGreenBits;
+      return 0;
+   case GLX_ACCUM_BLUE_SIZE:
+      *value_return = mode->accumBlueBits;
+      return 0;
+   case GLX_ACCUM_ALPHA_SIZE:
+      *value_return = mode->accumAlphaBits;
+      return 0;
+   case GLX_LEVEL:
+      *value_return = mode->level;
+      return 0;
+   case GLX_TRANSPARENT_TYPE_EXT:
+      *value_return = mode->transparentPixel;
+      return 0;
+   case GLX_TRANSPARENT_RED_VALUE:
+      *value_return = mode->transparentRed;
+      return 0;
+   case GLX_TRANSPARENT_GREEN_VALUE:
+      *value_return = mode->transparentGreen;
+      return 0;
+   case GLX_TRANSPARENT_BLUE_VALUE:
+      *value_return = mode->transparentBlue;
+      return 0;
+   case GLX_TRANSPARENT_ALPHA_VALUE:
+      *value_return = mode->transparentAlpha;
+      return 0;
+   case GLX_TRANSPARENT_INDEX_VALUE:
+      *value_return = mode->transparentIndex;
+      return 0;
+   case GLX_X_VISUAL_TYPE:
+      *value_return = mode->visualType;
+      return 0;
+   case GLX_CONFIG_CAVEAT:
+      *value_return = mode->visualRating;
+      return 0;
+   case GLX_VISUAL_ID:
+      *value_return = mode->visualID;
+      return 0;
+   case GLX_DRAWABLE_TYPE:
+      *value_return = mode->drawableType;
+      return 0;
+   case GLX_RENDER_TYPE:
+      *value_return = mode->renderType;
+      return 0;
+   case GLX_X_RENDERABLE:
+      *value_return = mode->xRenderable;
+      return 0;
+   case GLX_FBCONFIG_ID:
+      *value_return = mode->fbconfigID;
+      return 0;
+   case GLX_MAX_PBUFFER_WIDTH:
+      *value_return = mode->maxPbufferWidth;
+      return 0;
+   case GLX_MAX_PBUFFER_HEIGHT:
+      *value_return = mode->maxPbufferHeight;
+      return 0;
+   case GLX_MAX_PBUFFER_PIXELS:
+      *value_return = mode->maxPbufferPixels;
+      return 0;
+   case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+      *value_return = mode->optimalPbufferWidth;
+      return 0;
+   case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+      *value_return = mode->optimalPbufferHeight;
+      return 0;
+   case GLX_SWAP_METHOD_OML:
+      *value_return = mode->swapMethod;
+      return 0;
+   case GLX_SAMPLE_BUFFERS_SGIS:
+      *value_return = mode->sampleBuffers;
+      return 0;
+   case GLX_SAMPLES_SGIS:
+      *value_return = mode->samples;
+      return 0;
+   case GLX_BIND_TO_TEXTURE_RGB_EXT:
+      *value_return = mode->bindToTextureRgb;
+      return 0;
+   case GLX_BIND_TO_TEXTURE_RGBA_EXT:
+      *value_return = mode->bindToTextureRgba;
+      return 0;
+   case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
+      *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
+         GL_FALSE;
+      return 0;
+   case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
+      *value_return = mode->bindToTextureTargets;
+      return 0;
+   case GLX_Y_INVERTED_EXT:
+      *value_return = mode->yInverted;
+      return 0;
+
+      /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
+       * It is ONLY for communication between the GLX client and the GLX
+       * server.
+       */
+   case GLX_VISUAL_SELECT_GROUP_SGIX:
+   default:
+      return GLX_BAD_ATTRIBUTE;
+   }
+}
+#endif /* !defined(IN_MINI_GLX) */
+
+
+/**
+ * Allocate a linked list of \c __GLcontextModes structures.  The fields of
+ * each structure will be initialized to "reasonable" default values.  In
+ * most cases this is the default value defined by table 3.4 of the GLX
+ * 1.3 specification.  This means that most values are either initialized to
+ * zero or \c GLX_DONT_CARE (which is -1).  As support for additional
+ * extensions is added, the new values will be initialized to appropriate
+ * values from the extension specification.
+ * 
+ * \param count         Number of structures to allocate.
+ * \param minimum_size  Minimum size of a structure to allocate.  This allows
+ *                      for differences in the version of the
+ *                      \c __GLcontextModes stucture used in libGL and in a
+ *                      DRI-based driver.
+ * \returns A pointer to the first element in a linked list of \c count
+ *          stuctures on success, or \c NULL on failure.
+ * 
+ * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
+ *          The fundamental assumption is that if the \c minimum_size
+ *          specified by the driver and the size of the \c __GLcontextModes
+ *          structure in libGL is the same, then the meaning of each byte in
+ *          the structure is the same in both places.  \b Be \b careful!
+ *          Basically this means that fields have to be added in libGL and
+ *          then propagated to drivers.  Drivers should \b never arbitrarilly
+ *          extend the \c __GLcontextModes data-structure.
+ */
+__GLcontextModes *
+_gl_context_modes_create(unsigned count, size_t minimum_size)
+{
+   const size_t size = (minimum_size > sizeof(__GLcontextModes))
+      ? minimum_size : sizeof(__GLcontextModes);
+   __GLcontextModes *base = NULL;
+   __GLcontextModes **next;
+   unsigned i;
+
+   next = &base;
+   for (i = 0; i < count; i++) {
+      *next = (__GLcontextModes *) _mesa_malloc(size);
+      if (*next == NULL) {
+         _gl_context_modes_destroy(base);
+         base = NULL;
+         break;
+      }
+
+      (void) _mesa_memset(*next, 0, size);
+      (*next)->visualID = GLX_DONT_CARE;
+      (*next)->visualType = GLX_DONT_CARE;
+      (*next)->visualRating = GLX_NONE;
+      (*next)->transparentPixel = GLX_NONE;
+      (*next)->transparentRed = GLX_DONT_CARE;
+      (*next)->transparentGreen = GLX_DONT_CARE;
+      (*next)->transparentBlue = GLX_DONT_CARE;
+      (*next)->transparentAlpha = GLX_DONT_CARE;
+      (*next)->transparentIndex = GLX_DONT_CARE;
+      (*next)->xRenderable = GLX_DONT_CARE;
+      (*next)->fbconfigID = GLX_DONT_CARE;
+      (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
+      (*next)->bindToTextureRgb = GLX_DONT_CARE;
+      (*next)->bindToTextureRgba = GLX_DONT_CARE;
+      (*next)->bindToMipmapTexture = GLX_DONT_CARE;
+      (*next)->bindToTextureTargets = GLX_DONT_CARE;
+      (*next)->yInverted = GLX_DONT_CARE;
+
+      next = &((*next)->next);
+   }
+
+   return base;
+}
+
+
+/**
+ * Destroy a linked list of \c __GLcontextModes structures created by
+ * \c _gl_context_modes_create.
+ * 
+ * \param modes  Linked list of structures to be destroyed.  All structres
+ *               in the list will be freed.
+ */
+void
+_gl_context_modes_destroy(__GLcontextModes * modes)
+{
+   while (modes != NULL) {
+      __GLcontextModes *const next = modes->next;
+
+      _mesa_free(modes);
+      modes = next;
+   }
+}
+
+
+/**
+ * Find a context mode matching a Visual ID.
+ *
+ * \param modes  List list of context-mode structures to be searched.
+ * \param vid    Visual ID to be found.
+ * \returns A pointer to a context-mode in \c modes if \c vid was found in
+ *          the list, or \c NULL if it was not.
+ */
+
+__GLcontextModes *
+_gl_context_modes_find_visual(__GLcontextModes * modes, int vid)
+{
+   __GLcontextModes *m;
+
+   for (m = modes; m != NULL; m = m->next)
+      if (m->visualID == vid)
+         return m;
+
+   return NULL;
+}
+
+__GLcontextModes *
+_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid)
+{
+   __GLcontextModes *m;
+
+   for (m = modes; m != NULL; m = m->next)
+      if (m->fbconfigID == fbid)
+         return m;
+
+   return NULL;
+}
+
+/**
+ * Determine if two context-modes are the same.  This is intended to be used
+ * by libGL implementations to compare to sets of driver generated FBconfigs.
+ * 
+ * \param a  Context-mode to be compared.
+ * \param b  Context-mode to be compared.
+ * \returns \c GL_TRUE if the two context-modes are the same.  \c GL_FALSE is
+ *          returned otherwise.
+ */
+GLboolean
+_gl_context_modes_are_same(const __GLcontextModes * a,
+                           const __GLcontextModes * b)
+{
+   return ((a->rgbMode == b->rgbMode) &&
+           (a->floatMode == b->floatMode) &&
+           (a->colorIndexMode == b->colorIndexMode) &&
+           (a->doubleBufferMode == b->doubleBufferMode) &&
+           (a->stereoMode == b->stereoMode) &&
+           (a->redBits == b->redBits) &&
+           (a->greenBits == b->greenBits) &&
+           (a->blueBits == b->blueBits) && (a->alphaBits == b->alphaBits) &&
+#if 0                           /* For some reason these don't get set on the client-side in libGL. */
+           (a->redMask == b->redMask) &&
+           (a->greenMask == b->greenMask) &&
+           (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) &&
+#endif
+           (a->rgbBits == b->rgbBits) &&
+           (a->indexBits == b->indexBits) &&
+           (a->accumRedBits == b->accumRedBits) &&
+           (a->accumGreenBits == b->accumGreenBits) &&
+           (a->accumBlueBits == b->accumBlueBits) &&
+           (a->accumAlphaBits == b->accumAlphaBits) &&
+           (a->depthBits == b->depthBits) &&
+           (a->stencilBits == b->stencilBits) &&
+           (a->numAuxBuffers == b->numAuxBuffers) &&
+           (a->level == b->level) &&
+           (a->pixmapMode == b->pixmapMode) &&
+           (a->visualRating == b->visualRating) &&
+           (a->transparentPixel == b->transparentPixel) &&
+           ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
+            ((a->transparentRed == b->transparentRed) &&
+             (a->transparentGreen == b->transparentGreen) &&
+             (a->transparentBlue == b->transparentBlue) &&
+             (a->transparentAlpha == b->transparentAlpha))) &&
+           ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
+            (a->transparentIndex == b->transparentIndex)) &&
+           (a->sampleBuffers == b->sampleBuffers) &&
+           (a->samples == b->samples) &&
+           ((a->drawableType & b->drawableType) != 0) &&
+           (a->renderType == b->renderType) &&
+           (a->maxPbufferWidth == b->maxPbufferWidth) &&
+           (a->maxPbufferHeight == b->maxPbufferHeight) &&
+           (a->maxPbufferPixels == b->maxPbufferPixels) &&
+           (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
+           (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
+           (a->swapMethod == b->swapMethod) &&
+           (a->bindToTextureRgb == b->bindToTextureRgb) &&
+           (a->bindToTextureRgba == b->bindToTextureRgba) &&
+           (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
+           (a->bindToTextureTargets == b->bindToTextureTargets) &&
+           (a->yInverted == b->yInverted));
+}
diff --git a/src/glx/glcontextmodes.h b/src/glx/glcontextmodes.h
new file mode 100644 (file)
index 0000000..6676ae3
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * (C) Copyright IBM Corporation 2003
+ * 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 glcontextmodes.h
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#ifndef GLCONTEXTMODES_H
+#define GLCONTEXTMODES_H
+
+#include "GL/internal/glcore.h"
+
+#if !defined(IN_MINI_GLX)
+extern GLint _gl_convert_from_x_visual_type(int visualType);
+extern GLint _gl_convert_to_x_visual_type(int visualType);
+extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode,
+                                            const __GLXvisualConfig * config);
+extern int _gl_get_context_mode_data(const __GLcontextModes * mode,
+                                     int attribute, int *value_return);
+#endif /* !defined(IN_MINI_GLX) */
+
+extern __GLcontextModes *_gl_context_modes_create(unsigned count,
+                                                  size_t minimum_size);
+extern void _gl_context_modes_destroy(__GLcontextModes * modes);
+extern __GLcontextModes *_gl_context_modes_find_visual(__GLcontextModes *
+                                                       modes, int vid);
+extern __GLcontextModes *_gl_context_modes_find_fbconfig(__GLcontextModes *
+                                                         modes, int fbid);
+extern GLboolean _gl_context_modes_are_same(const __GLcontextModes * a,
+                                            const __GLcontextModes * b);
+
+#endif /* GLCONTEXTMODES_H */
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
new file mode 100644 (file)
index 0000000..a0a0223
--- /dev/null
@@ -0,0 +1,724 @@
+/*
+ * (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
+ * 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 glx_pbuffer.c
+ * Implementation of pbuffer related functions.
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#include <inttypes.h>
+#include "glxclient.h"
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xext.h>
+#include <assert.h>
+#include <string.h>
+#include "glxextensions.h"
+
+#define WARN_ONCE_GLX_1_3(a, b) {              \
+               static int warned=1;            \
+               if(warned) {                    \
+                       warn_GLX_1_3((a), b );  \
+                       warned=0;               \
+               }                               \
+       }
+
+/**
+ * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
+ */
+static void
+warn_GLX_1_3(Display *dpy, const char *function_name)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+
+   if (priv->minorVersion < 3) {
+      fprintf(stderr, 
+             "WARNING: Application calling GLX 1.3 function \"%s\" "
+             "when GLX 1.3 is not supported!  This is an application bug!\n",
+             function_name);
+   }
+}
+
+
+/**
+ * Change a drawable's attribute.
+ *
+ * This function is used to implement \c glXSelectEvent and
+ * \c glXSelectEventSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static void
+ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
+                        const CARD32 * attribs, size_t num_attribs)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   CARD32 *output;
+   CARD8 opcode;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+
+   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+      xGLXChangeDrawableAttributesReq *req;
+
+      GetReqExtra(GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req);
+      output = (CARD32 *) (req + 1);
+
+      req->reqType = opcode;
+      req->glxCode = X_GLXChangeDrawableAttributes;
+      req->drawable = drawable;
+      req->numAttribs = (CARD32) num_attribs;
+   }
+   else {
+      xGLXVendorPrivateWithReplyReq *vpreq;
+
+      GetReqExtra(GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq);
+      output = (CARD32 *) (vpreq + 1);
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivateWithReply;
+      vpreq->vendorCode = X_GLXvop_ChangeDrawableAttributesSGIX;
+
+      output[0] = (CARD32) drawable;
+      output++;
+   }
+
+   (void) memcpy(output, attribs, sizeof(CARD32) * 2 * num_attribs);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return;
+}
+
+
+/**
+ * Destroy a pbuffer.
+ *
+ * This function is used to implement \c glXDestroyPbuffer and
+ * \c glXDestroyGLXPbufferSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static void
+DestroyPbuffer(Display * dpy, GLXDrawable drawable)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   CARD8 opcode;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+
+   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+      xGLXDestroyPbufferReq *req;
+
+      GetReq(GLXDestroyPbuffer, req);
+      req->reqType = opcode;
+      req->glxCode = X_GLXDestroyPbuffer;
+      req->pbuffer = (GLXPbuffer) drawable;
+   }
+   else {
+      xGLXVendorPrivateWithReplyReq *vpreq;
+      CARD32 *data;
+
+      GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
+      data = (CARD32 *) (vpreq + 1);
+
+      data[0] = (CARD32) drawable;
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivateWithReply;
+      vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX;
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return;
+}
+
+
+#ifdef GLX_DIRECT_RENDERING
+extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
+                                           GLXDrawable drawable,
+                                           int *const scrn_num);
+
+static GLenum
+determineTextureTarget(const int *attribs, int numAttribs)
+{
+   GLenum target = 0;
+   int i;
+
+   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;
+         }
+      }
+   }
+
+   return target;
+}
+
+
+static GLenum
+determineTextureFormat(const int *attribs, int numAttribs)
+{
+   int i;
+
+   for (i = 0; i < numAttribs; i++) {
+      if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
+         return attribs[2 * i + 1];
+   }
+
+   return 0;
+}
+#endif
+
+/**
+ * Get a drawable's attribute.
+ *
+ * This function is used to implement \c glXGetSelectedEvent and
+ * \c glXGetSelectedEventSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * The number of attributes returned is likely to be small, probably less than
+ * 10.  Given that, this routine should try to use an array on the stack to
+ * capture the reply rather than always calling Xmalloc.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static int
+GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
+                     int attribute, unsigned int *value)
+{
+   __GLXdisplayPrivate *priv;
+   xGLXGetDrawableAttributesReply reply;
+   CARD32 *data;
+   CARD8 opcode;
+   unsigned int length;
+   unsigned int i;
+   unsigned int num_attributes;
+   GLboolean use_glx_1_3;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return 0;
+   }
+
+   priv = __glXInitialize(dpy);
+   use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
+
+   *value = 0;
+
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return 0;
+
+   LockDisplay(dpy);
+
+   if (use_glx_1_3) {
+      xGLXGetDrawableAttributesReq *req;
+
+      GetReqExtra(GLXGetDrawableAttributes, 4, req);
+      req->reqType = opcode;
+      req->glxCode = X_GLXGetDrawableAttributes;
+      req->drawable = drawable;
+   }
+   else {
+      xGLXVendorPrivateWithReplyReq *vpreq;
+
+      GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
+      data = (CARD32 *) (vpreq + 1);
+      data[0] = (CARD32) drawable;
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivateWithReply;
+      vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
+   }
+
+   _XReply(dpy, (xReply *) & reply, 0, False);
+
+   if (reply.type == X_Error) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return 0;
+   }
+
+   length = reply.length;
+   if (length) {
+      num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
+      data = (CARD32 *) Xmalloc(length * sizeof(CARD32));
+      if (data == NULL) {
+         /* Throw data on the floor */
+         _XEatData(dpy, length);
+      }
+      else {
+         _XRead(dpy, (char *) data, length * sizeof(CARD32));
+
+         /* Search the set of returned attributes for the attribute requested by
+          * the caller.
+          */
+         for (i = 0; i < num_attributes; i++) {
+            if (data[i * 2] == attribute) {
+               *value = data[(i * 2) + 1];
+               break;
+            }
+         }
+
+#ifdef GLX_DIRECT_RENDERING
+         {
+            __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+
+            if (pdraw != NULL && !pdraw->textureTarget)
+               pdraw->textureTarget =
+                  determineTextureTarget((const int *) data, num_attributes);
+            if (pdraw != NULL && !pdraw->textureFormat)
+               pdraw->textureFormat =
+                  determineTextureFormat((const int *) data, num_attributes);
+         }
+#endif
+
+         Xfree(data);
+      }
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return 0;
+}
+
+/**
+ * Create a non-pbuffer GLX drawable.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static GLXDrawable
+CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig,
+               Drawable drawable, const int *attrib_list, CARD8 glxCode)
+{
+   xGLXCreateWindowReq *req;
+   CARD32 *data;
+   unsigned int i;
+   CARD8 opcode;
+
+   i = 0;
+   if (attrib_list) {
+      while (attrib_list[i * 2] != None)
+         i++;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return None;
+
+   LockDisplay(dpy);
+   GetReqExtra(GLXCreateWindow, 8 * i, req);
+   data = (CARD32 *) (req + 1);
+
+   req->reqType = opcode;
+   req->glxCode = glxCode;
+   req->screen = (CARD32) fbconfig->screen;
+   req->fbconfig = fbconfig->fbconfigID;
+   req->window = (CARD32) drawable;
+   req->glxwindow = (GLXWindow) XAllocID(dpy);
+   req->numAttribs = (CARD32) i;
+
+   memcpy(data, attrib_list, 8 * i);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+#ifdef GLX_DIRECT_RENDERING
+   do {
+      /* FIXME: Maybe delay __DRIdrawable creation until the drawable
+       * is actually bound to a context... */
+
+      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+      __GLXDRIdrawable *pdraw;
+      __GLXscreenConfigs *psc;
+
+      psc = &priv->screenConfigs[fbconfig->screen];
+      if (psc->driScreen == NULL)
+         break;
+      pdraw = psc->driScreen->createDrawable(psc, drawable,
+                                             req->glxwindow, fbconfig);
+      if (pdraw == NULL) {
+         fprintf(stderr, "failed to create drawable\n");
+         break;
+      }
+
+      if (__glxHashInsert(psc->drawHash, req->glxwindow, pdraw)) {
+         (*pdraw->destroyDrawable) (pdraw);
+         return None;           /* FIXME: Check what we're supposed to do here... */
+      }
+
+      pdraw->textureTarget = determineTextureTarget(attrib_list, i);
+      pdraw->textureFormat = determineTextureFormat(attrib_list, i);
+   } while (0);
+#endif
+
+   return (GLXDrawable) req->glxwindow;
+}
+
+
+/**
+ * Destroy a non-pbuffer GLX drawable.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static void
+DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode)
+{
+   xGLXDestroyPbufferReq *req;
+   CARD8 opcode;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return;
+   }
+
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+
+   GetReqExtra(GLXDestroyPbuffer, 4, req);
+   req->reqType = opcode;
+   req->glxCode = glxCode;
+   req->pbuffer = (GLXPbuffer) drawable;
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+#ifdef GLX_DIRECT_RENDERING
+   {
+      int screen;
+      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+      __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
+
+      if (pdraw != NULL) {
+         (*pdraw->destroyDrawable) (pdraw);
+         __glxHashDelete(psc->drawHash, drawable);
+      }
+   }
+#endif
+
+   return;
+}
+
+
+/**
+ * Create a pbuffer.
+ *
+ * This function is used to implement \c glXCreatePbuffer and
+ * \c glXCreateGLXPbufferSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static GLXDrawable
+CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig,
+              unsigned int width, unsigned int height,
+              const int *attrib_list, GLboolean size_in_attribs)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   GLXDrawable id = 0;
+   CARD32 *data;
+   CARD8 opcode;
+   unsigned int i;
+
+   i = 0;
+   if (attrib_list) {
+      while (attrib_list[i * 2])
+         i++;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return None;
+
+   LockDisplay(dpy);
+   id = XAllocID(dpy);
+
+   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+      xGLXCreatePbufferReq *req;
+      unsigned int extra = (size_in_attribs) ? 0 : 2;
+
+      GetReqExtra(GLXCreatePbuffer, (8 * (i + extra)), req);
+      data = (CARD32 *) (req + 1);
+
+      req->reqType = opcode;
+      req->glxCode = X_GLXCreatePbuffer;
+      req->screen = (CARD32) fbconfig->screen;
+      req->fbconfig = fbconfig->fbconfigID;
+      req->pbuffer = (GLXPbuffer) id;
+      req->numAttribs = (CARD32) (i + extra);
+
+      if (!size_in_attribs) {
+         data[(2 * i) + 0] = GLX_PBUFFER_WIDTH;
+         data[(2 * i) + 1] = width;
+         data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT;
+         data[(2 * i) + 3] = height;
+         data += 4;
+      }
+   }
+   else {
+      xGLXVendorPrivateReq *vpreq;
+
+      GetReqExtra(GLXVendorPrivate, 20 + (8 * i), vpreq);
+      data = (CARD32 *) (vpreq + 1);
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivate;
+      vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX;
+
+      data[0] = (CARD32) fbconfig->screen;
+      data[1] = (CARD32) fbconfig->fbconfigID;
+      data[2] = (CARD32) id;
+      data[3] = (CARD32) width;
+      data[4] = (CARD32) height;
+      data += 5;
+   }
+
+   (void) memcpy(data, attrib_list, sizeof(CARD32) * 2 * i);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return id;
+}
+
+
+/**
+ * Create a new pbuffer.
+ */
+PUBLIC GLXPbufferSGIX
+glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
+                        unsigned int width, unsigned int height,
+                        int *attrib_list)
+{
+   return (GLXPbufferSGIX) CreatePbuffer(dpy, (__GLcontextModes *) config,
+                                         width, height,
+                                         attrib_list, GL_FALSE);
+}
+
+
+/**
+ * Create a new pbuffer.
+ */
+PUBLIC GLXPbuffer
+glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
+{
+   int i, width, height;
+
+   width = 0;
+   height = 0;
+
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+
+   for (i = 0; attrib_list[i * 2]; i++) {
+      switch (attrib_list[i * 2]) {
+      case GLX_PBUFFER_WIDTH:
+         width = attrib_list[i * 2 + 1];
+         break;
+      case GLX_PBUFFER_HEIGHT:
+         height = attrib_list[i * 2 + 1];
+         break;
+      }
+   }
+
+   return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config,
+                                     width, height, attrib_list, GL_TRUE);
+}
+
+
+/**
+ * Destroy an existing pbuffer.
+ */
+PUBLIC void
+glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf)
+{
+   DestroyPbuffer(dpy, pbuf);
+}
+
+
+/**
+ * Query an attribute of a drawable.
+ */
+PUBLIC void
+glXQueryDrawable(Display * dpy, GLXDrawable drawable,
+                 int attribute, unsigned int *value)
+{
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+   GetDrawableAttribute(dpy, drawable, attribute, value);
+}
+
+
+/**
+ * Query an attribute of a pbuffer.
+ */
+PUBLIC int
+glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
+                       int attribute, unsigned int *value)
+{
+   return GetDrawableAttribute(dpy, drawable, attribute, value);
+}
+
+
+/**
+ * Select the event mask for a drawable.
+ */
+PUBLIC void
+glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
+{
+   CARD32 attribs[2];
+
+   attribs[0] = (CARD32) GLX_EVENT_MASK;
+   attribs[1] = (CARD32) mask;
+
+   ChangeDrawableAttribute(dpy, drawable, attribs, 1);
+}
+
+
+/**
+ * Get the selected event mask for a drawable.
+ */
+PUBLIC void
+glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
+{
+   unsigned int value;
+
+
+   /* The non-sense with value is required because on LP64 platforms
+    * sizeof(unsigned int) != sizeof(unsigned long).  On little-endian
+    * we could just type-cast the pointer, but why?
+    */
+
+   GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
+   *mask = value;
+}
+
+
+PUBLIC GLXPixmap
+glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
+                const int *attrib_list)
+{
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+
+   return CreateDrawable(dpy, (__GLcontextModes *) config,
+                         (Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
+}
+
+
+PUBLIC GLXWindow
+glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
+                const int *attrib_list)
+{
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+
+   return CreateDrawable(dpy, (__GLcontextModes *) config,
+                         (Drawable) win, attrib_list, X_GLXCreateWindow);
+}
+
+
+PUBLIC void
+glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
+{
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+
+   DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
+}
+
+
+PUBLIC void
+glXDestroyWindow(Display * dpy, GLXWindow win)
+{
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+
+   DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
+}
+
+
+PUBLIC
+GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
+               (Display * dpy, GLXPbufferSGIX pbuf),
+               (dpy, pbuf), glXDestroyPbuffer)
+
+PUBLIC
+GLX_ALIAS_VOID(glXSelectEventSGIX,
+               (Display * dpy, GLXDrawable drawable,
+                unsigned long mask), (dpy, drawable, mask), glXSelectEvent)
+
+PUBLIC
+GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
+               (Display * dpy, GLXDrawable drawable,
+                unsigned long *mask), (dpy, drawable, mask),
+               glXGetSelectedEvent)
+
diff --git a/src/glx/glx_query.c b/src/glx/glx_query.c
new file mode 100644 (file)
index 0000000..efad13d
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * (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
+ * 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 glx_query.c
+ * Generic utility functions to query internal data from the server.
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#include "glxclient.h"
+
+#if defined(USE_XCB)
+# include <X11/Xlib-xcb.h>
+# include <xcb/xcb.h>
+# include <xcb/glx.h>
+#endif
+
+#ifdef USE_XCB
+
+/**
+ * Exchange a protocol request for glXQueryServerString.
+ */
+char *
+__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
+{
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_query_server_string_reply_t *reply =
+      xcb_glx_query_server_string_reply(c,
+                                        xcb_glx_query_server_string(c,
+                                                                    screen,
+                                                                    name),
+                                        NULL);
+
+   /* The spec doesn't mention this, but the Xorg server replies with
+    * a string already terminated with '\0'. */
+   uint32_t len = xcb_glx_query_server_string_string_length(reply);
+   char *buf = Xmalloc(len);
+   memcpy(buf, xcb_glx_query_server_string_string(reply), len);
+   free(reply);
+
+   return buf;
+}
+
+/**
+ * Exchange a protocol request for glGetString.
+ */
+char *
+__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
+{
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_get_string_reply_t *reply = xcb_glx_get_string_reply(c,
+                                                                xcb_glx_get_string
+                                                                (c,
+                                                                 contextTag,
+                                                                 name),
+                                                                NULL);
+
+   /* The spec doesn't mention this, but the Xorg server replies with
+    * a string already terminated with '\0'. */
+   uint32_t len = xcb_glx_get_string_string_length(reply);
+   char *buf = Xmalloc(len);
+   memcpy(buf, xcb_glx_get_string_string(reply), len);
+   free(reply);
+
+   return buf;
+}
+
+#else
+
+/**
+ * GLX protocol structure for the ficticious "GXLGenericGetString" request.
+ *
+ * This is a non-existant protocol packet.  It just so happens that all of
+ * the real protocol packets used to request a string from the server have
+ * an identical binary layout.  The only difference between them is the
+ * meaning of the \c for_whom field and the value of the \c glxCode.
+ */
+typedef struct GLXGenericGetString
+{
+   CARD8 reqType;
+   CARD8 glxCode;
+   CARD16 length B16;
+   CARD32 for_whom B32;
+   CARD32 name B32;
+} xGLXGenericGetStringReq;
+
+/* These defines are only needed to make the GetReq macro happy.
+ */
+#define sz_xGLXGenericGetStringReq 12
+#define X_GLXGenericGetString 0
+
+/**
+ * Query the Server GLX string.
+ * This routine will allocate the necessay space for the string.
+ */
+static char *
+__glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
+                         CARD32 for_whom, CARD32 name)
+{
+   xGLXGenericGetStringReq *req;
+   xGLXSingleReply reply;
+   int length;
+   int numbytes;
+   char *buf;
+
+
+   LockDisplay(dpy);
+
+
+   /* All of the GLX protocol requests for getting a string from the server
+    * look the same.  The exact meaning of the for_whom field is usually
+    * either the screen number (for glXQueryServerString) or the context tag
+    * (for GLXSingle).
+    */
+
+   GetReq(GLXGenericGetString, req);
+   req->reqType = opcode;
+   req->glxCode = glxCode;
+   req->for_whom = for_whom;
+   req->name = name;
+
+   _XReply(dpy, (xReply *) & reply, 0, False);
+
+   length = reply.length * 4;
+   numbytes = reply.size;
+
+   buf = (char *) Xmalloc(numbytes);
+   if (buf != NULL) {
+      _XRead(dpy, buf, numbytes);
+      length -= numbytes;
+   }
+
+   _XEatData(dpy, length);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return buf;
+}
+
+char *
+__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
+{
+   return __glXGetStringFromServer(dpy, opcode,
+                                   X_GLXQueryServerString, screen, name);
+}
+
+char *
+__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
+{
+   return __glXGetStringFromServer(dpy, opcode, X_GLsop_GetString,
+                                   contextTag, name);
+}
+
+#endif /* USE_XCB */
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
new file mode 100644 (file)
index 0000000..e0b286b
--- /dev/null
@@ -0,0 +1,803 @@
+/*
+ * 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.
+ */
+
+/**
+ * \file glxclient.h
+ * Direct rendering support added by Precision Insight, Inc.
+ *
+ * \author Kevin E. Martin <kevin@precisioninsight.com>
+ */
+
+#ifndef _GLX_client_h_
+#define _GLX_client_h_
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/extutil.h>
+#define GLX_GLXEXT_PROTOTYPES
+#include <GL/glx.h>
+#include <GL/glxext.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef WIN32
+#include <stdint.h>
+#endif
+#include "GL/glxint.h"
+#include "GL/glxproto.h"
+#include "GL/internal/glcore.h"
+#include "glapi/glapitable.h"
+#include "glxhash.h"
+#if defined( PTHREADS )
+# include <pthread.h>
+#endif
+
+#include "glxextensions.h"
+
+
+/* If we build the library with gcc's -fvisibility=hidden flag, we'll
+ * use the PUBLIC macro to mark functions that are to be exported.
+ *
+ * We also need to define a USED attribute, so the optimizer doesn't
+ * inline a static function that we later use in an alias. - ajax
+ */
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+#  define PUBLIC __attribute__((visibility("default")))
+#  define USED __attribute__((used))
+#else
+#  define PUBLIC
+#  define USED
+#endif
+
+
+
+#define GLX_MAJOR_VERSION 1       /* current version numbers */
+#define GLX_MINOR_VERSION 4
+
+#define __GLX_MAX_TEXTURE_UNITS 32
+
+typedef struct __GLXscreenConfigsRec __GLXscreenConfigs;
+typedef struct __GLXcontextRec __GLXcontext;
+typedef struct __GLXdrawableRec __GLXdrawable;
+typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
+typedef struct _glapi_table __GLapi;
+
+/************************************************************************/
+
+#ifdef GLX_DIRECT_RENDERING
+
+#define containerOf(ptr, type, member)              \
+    (type *)( (char *)ptr - offsetof(type,member) )
+
+#include <GL/internal/dri_interface.h>
+
+
+/**
+ * Display dependent methods.  This structure is initialized during the
+ * \c driCreateDisplay call.
+ */
+typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
+typedef struct __GLXDRIscreenRec __GLXDRIscreen;
+typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
+typedef struct __GLXDRIcontextRec __GLXDRIcontext;
+
+#include "glxextensions.h"
+
+struct __GLXDRIdisplayRec
+{
+    /**
+     * Method to destroy the private DRI display data.
+     */
+   void (*destroyDisplay) (__GLXDRIdisplay * display);
+
+   __GLXDRIscreen *(*createScreen) (__GLXscreenConfigs * psc, int screen,
+                                    __GLXdisplayPrivate * priv);
+};
+
+struct __GLXDRIscreenRec {
+
+   void (*destroyScreen)(__GLXscreenConfigs *psc);
+
+   __GLXDRIcontext *(*createContext)(__GLXscreenConfigs *psc,
+                                    const __GLcontextModes *mode,
+                                    GLXContext gc,
+                                    GLXContext shareList, int renderType);
+
+   __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
+                                      XID drawable,
+                                      GLXDrawable glxDrawable,
+                                      const __GLcontextModes *modes);
+
+   int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc,
+                         int64_t divisor, int64_t remainder);
+   void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
+                        int x, int y, int width, int height);
+   void (*waitX)(__GLXDRIdrawable *pdraw);
+   void (*waitGL)(__GLXDRIdrawable *pdraw);
+   int (*getDrawableMSC)(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
+                        int64_t *ust, int64_t *msc, int64_t *sbc);
+   int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc,
+                    int64_t divisor, int64_t remainder, int64_t *ust,
+                    int64_t *msc, int64_t *sbc);
+   int (*waitForSBC)(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
+                    int64_t *msc, int64_t *sbc);
+   void (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval);
+   int (*getSwapInterval)(__GLXDRIdrawable *pdraw);
+};
+
+struct __GLXDRIcontextRec
+{
+   void (*destroyContext) (__GLXDRIcontext * context,
+                           __GLXscreenConfigs * psc, Display * dpy);
+     Bool(*bindContext) (__GLXDRIcontext * context, __GLXDRIdrawable * pdraw,
+                         __GLXDRIdrawable * pread);
+
+   void (*unbindContext) (__GLXDRIcontext * context);
+};
+
+struct __GLXDRIdrawableRec
+{
+   void (*destroyDrawable) (__GLXDRIdrawable * drawable);
+
+   XID xDrawable;
+   XID drawable;
+   __GLXscreenConfigs *psc;
+   GLenum textureTarget;
+   __DRIdrawable *driDrawable;
+   GLenum textureFormat;        /* EXT_texture_from_pixmap support */
+};
+
+/*
+** Function to create and DRI display data and initialize the display
+** dependent methods.
+*/
+extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
+extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
+extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
+
+extern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
+
+/*
+** Functions to obtain driver configuration information from a direct
+** rendering client application
+*/
+extern const char *glXGetScreenDriver(Display * dpy, int scrNum);
+
+extern const char *glXGetDriverConfig(const char *driverName);
+
+#endif
+
+/************************************************************************/
+
+#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
+
+typedef struct __GLXpixelStoreModeRec
+{
+   GLboolean swapEndian;
+   GLboolean lsbFirst;
+   GLuint rowLength;
+   GLuint imageHeight;
+   GLuint imageDepth;
+   GLuint skipRows;
+   GLuint skipPixels;
+   GLuint skipImages;
+   GLuint alignment;
+} __GLXpixelStoreMode;
+
+
+typedef struct __GLXattributeRec
+{
+   GLuint mask;
+
+    /**
+     * Pixel storage state.  Most of the pixel store mode state is kept
+     * here and used by the client code to manage the packing and
+     * unpacking of data sent to/received from the server.
+     */
+   __GLXpixelStoreMode storePack, storeUnpack;
+
+    /**
+     * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
+     * disabled?
+     */
+   GLboolean NoDrawArraysProtocol;
+
+    /**
+     * Vertex Array storage state.  The vertex array component
+     * state is stored here and is used to manage the packing of
+     * DrawArrays data sent to the server.
+     */
+   struct array_state_vector *array_state;
+} __GLXattribute;
+
+typedef struct __GLXattributeMachineRec
+{
+   __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
+   __GLXattribute **stackPointer;
+} __GLXattributeMachine;
+
+/**
+ * GLX state that needs to be kept on the client.  One of these records
+ * exist for each context that has been made current by this client.
+ */
+struct __GLXcontextRec
+{
+    /**
+     * \name Drawing command buffer.
+     *
+     * Drawing commands are packed into this buffer before being sent as a
+     * single GLX protocol request.  The buffer is sent when it overflows or
+     * is flushed by \c __glXFlushRenderBuffer.  \c pc is the next location
+     * in the buffer to be filled.  \c limit is described above in the buffer
+     * slop discussion.
+     *
+     * Commands that require large amounts of data to be transfered will
+     * also use this buffer to hold a header that describes the large
+     * command.
+     *
+     * These must be the first 6 fields since they are static initialized
+     * in the dummy context in glxext.c
+     */
+   /*@{ */
+   GLubyte *buf;
+   GLubyte *pc;
+   GLubyte *limit;
+   GLubyte *bufEnd;
+   GLint bufSize;
+   /*@} */
+
+    /**
+     * The XID of this rendering context.  When the context is created a
+     * new XID is allocated.  This is set to None when the context is
+     * destroyed but is still current to some thread. In this case the
+     * context will be freed on next MakeCurrent.
+     */
+   XID xid;
+
+    /**
+     * The XID of the \c shareList context.
+     */
+   XID share_xid;
+
+    /**
+     * Screen number.
+     */
+   GLint screen;
+   __GLXscreenConfigs *psc;
+
+    /**
+     * \c GL_TRUE if the context was created with ImportContext, which
+     * means the server-side context was created by another X client.
+     */
+   GLboolean imported;
+
+    /**
+     * The context tag returned by MakeCurrent when this context is made
+     * current. This tag is used to identify the context that a thread has
+     * current so that proper server context management can be done.  It is
+     * used for all context specific commands (i.e., \c Render, \c RenderLarge,
+     * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
+     * context)).
+     */
+   GLXContextTag currentContextTag;
+
+    /**
+     * \name Rendering mode
+     *
+     * The rendering mode is kept on the client as well as the server.
+     * When \c glRenderMode is called, the buffer associated with the
+     * previous rendering mode (feedback or select) is filled.
+     */
+   /*@{ */
+   GLenum renderMode;
+   GLfloat *feedbackBuf;
+   GLuint *selectBuf;
+   /*@} */
+
+    /**
+     * This is \c GL_TRUE if the pixel unpack modes are such that an image
+     * can be unpacked from the clients memory by just copying.  It may
+     * still be true that the server will have to do some work.  This
+     * just promises that a straight copy will fetch the correct bytes.
+     */
+   GLboolean fastImageUnpack;
+
+    /**
+     * Fill newImage with the unpacked form of \c oldImage getting it
+     * ready for transport to the server.
+     */
+   void (*fillImage) (__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
+                      GLenum, const GLvoid *, GLubyte *, GLubyte *);
+
+    /**
+     * Client side attribs.
+     */
+   __GLXattributeMachine attributes;
+
+    /**
+     * Client side error code.  This is set when client side gl API
+     * routines need to set an error because of a bad enumerant or
+     * running out of memory, etc.
+     */
+   GLenum error;
+
+    /**
+     * Whether this context does direct rendering.
+     */
+   Bool isDirect;
+
+    /**
+     * \c dpy of current display for this context.  Will be \c NULL if not
+     * current to any display, or if this is the "dummy context".
+     */
+   Display *currentDpy;
+
+    /**
+     * The current drawable for this context.  Will be None if this
+     * context is not current to any drawable.  currentReadable is below.
+     */
+   GLXDrawable currentDrawable;
+
+    /**
+     * \name GL Constant Strings
+     *
+     * Constant strings that describe the server implementation
+     * These pertain to GL attributes, not to be confused with
+     * GLX versioning attributes.
+     */
+   /*@{ */
+   GLubyte *vendor;
+   GLubyte *renderer;
+   GLubyte *version;
+   GLubyte *extensions;
+   /*@} */
+
+    /**
+     * Record the dpy this context was created on for later freeing
+     */
+   Display *createDpy;
+
+    /**
+     * Maximum small render command size.  This is the smaller of 64k and
+     * the size of the above buffer.
+     */
+   GLint maxSmallRenderCommandSize;
+
+    /**
+     * Major opcode for the extension.  Copied here so a lookup isn't
+     * needed.
+     */
+   GLint majorOpcode;
+
+    /**
+     * Pointer to the mode used to create this context.
+     */
+   const __GLcontextModes *mode;
+
+#ifdef GLX_DIRECT_RENDERING
+   __GLXDRIcontext *driContext;
+   __DRIcontext *__driContext;
+#endif
+
+    /**
+     * The current read-drawable for this context.  Will be None if this
+     * context is not current to any drawable.
+     *
+     * \since Internal API version 20030606.
+     */
+   GLXDrawable currentReadable;
+
+   /**
+    * Pointer to client-state data that is private to libGL.  This is only
+    * used for indirect rendering contexts.
+    *
+    * No internal API version change was made for this change.  Client-side
+    * drivers should NEVER use this data or even care that it exists.
+    */
+   void *client_state_private;
+
+   /**
+    * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
+    */
+   int renderType;
+
+   /**
+    * \name Raw server GL version
+    *
+    * True core GL version supported by the server.  This is the raw value
+    * returned by the server, and it may not reflect what is actually
+    * supported (or reported) by the client-side library.
+    */
+   /*@{ */
+   int server_major;        /**< Major version number. */
+   int server_minor;        /**< Minor version number. */
+   /*@} */
+
+   /**
+    * Thread ID we're currently current in. Zero if none.
+    */
+   unsigned long thread_id;
+
+   char gl_extension_bits[__GL_EXT_BYTES];
+};
+
+#define __glXSetError(gc,code)  \
+   if (!(gc)->error) {          \
+      (gc)->error = code;       \
+   }
+
+extern void __glFreeAttributeState(__GLXcontext *);
+
+/************************************************************************/
+
+/**
+ * The size of the largest drawing command known to the implementation
+ * that will use the GLXRender GLX command.  In this case it is
+ * \c glPolygonStipple.
+ */
+#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
+
+/**
+ * To keep the implementation fast, the code uses a "limit" pointer
+ * to determine when the drawing command buffer is too full to hold
+ * another fixed size command.  This constant defines the amount of
+ * space that must always be available in the drawing command buffer
+ * at all times for the implementation to work.  It is important that
+ * the number be just large enough, but not so large as to reduce the
+ * efficacy of the buffer.  The "+32" is just to keep the code working
+ * in case somebody counts wrong.
+ */
+#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
+
+/**
+ * This implementation uses a smaller threshold for switching
+ * to the RenderLarge protocol than the protcol requires so that
+ * large copies don't occur.
+ */
+#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
+
+/**
+ * One of these records exists per screen of the display.  It contains
+ * a pointer to the config data for that screen (if the screen supports GL).
+ */
+struct __GLXscreenConfigsRec
+{
+    /**
+     * GLX extension string reported by the X-server.
+     */
+   const char *serverGLXexts;
+
+    /**
+     * GLX extension string to be reported to applications.  This is the
+     * set of extensions that the application can actually use.
+     */
+   char *effectiveGLXexts;
+
+#ifdef GLX_DIRECT_RENDERING
+    /**
+     * Per screen direct rendering interface functions and data.
+     */
+   __DRIscreen *__driScreen;
+   const __DRIcoreExtension *core;
+   const __DRIlegacyExtension *legacy;
+   const __DRIswrastExtension *swrast;
+   const __DRIdri2Extension *dri2;
+   __glxHashTable *drawHash;
+   Display *dpy;
+   int scr, fd;
+   void *driver;
+
+   __GLXDRIscreen *driScreen;
+
+   const __DRIconfig **driver_configs;
+
+#ifdef __DRI_COPY_SUB_BUFFER
+   const __DRIcopySubBufferExtension *driCopySubBuffer;
+#endif
+
+#ifdef __DRI_SWAP_CONTROL
+   const __DRIswapControlExtension *swapControl;
+#endif
+
+#ifdef __DRI_ALLOCATE
+   const __DRIallocateExtension *allocate;
+#endif
+
+#ifdef __DRI_FRAME_TRACKING
+   const __DRIframeTrackingExtension *frameTracking;
+#endif
+
+#ifdef __DRI_MEDIA_STREAM_COUNTER
+   const __DRImediaStreamCounterExtension *msc;
+#endif
+
+#ifdef __DRI_TEX_BUFFER
+   const __DRItexBufferExtension *texBuffer;
+#endif
+
+#ifdef __DRI2_FLUSH
+   const __DRI2flushExtension *f;
+#endif
+
+#endif
+
+    /**
+     * Linked list of glx visuals and  fbconfigs for this screen.
+     */
+   __GLcontextModes *visuals, *configs;
+
+    /**
+     * Per-screen dynamic GLX extension tracking.  The \c direct_support
+     * field only contains enough bits for 64 extensions.  Should libGL
+     * ever need to track more than 64 GLX extensions, we can safely grow
+     * this field.  The \c __GLXscreenConfigs structure is not used outside
+     * libGL.
+     */
+   /*@{ */
+   unsigned char direct_support[8];
+   GLboolean ext_list_first_time;
+   /*@} */
+
+};
+
+/**
+ * Per display private data.  One of these records exists for each display
+ * that is using the OpenGL (GLX) extension.
+ */
+struct __GLXdisplayPrivateRec
+{
+    /**
+     * Back pointer to the display
+     */
+   Display *dpy;
+
+    /**
+     * The \c majorOpcode is common to all connections to the same server.
+     * It is also copied into the context structure.
+     */
+   int majorOpcode;
+
+    /**
+     * \name Server Version
+     *
+     * Major and minor version returned by the server during initialization.
+     */
+   /*@{ */
+   int majorVersion, minorVersion;
+   /*@} */
+
+    /**
+     * \name Storage for the servers GLX vendor and versions strings.
+     *
+     * These are the same for all screens on this display. These fields will
+     * be filled in on demand.
+     */
+   /*@{ */
+   const char *serverGLXvendor;
+   const char *serverGLXversion;
+   /*@} */
+
+    /**
+     * Configurations of visuals for all screens on this display.
+     * Also, per screen data which now includes the server \c GLX_EXTENSION
+     * string.
+     */
+   __GLXscreenConfigs *screenConfigs;
+
+#ifdef GLX_DIRECT_RENDERING
+    /**
+     * Per display direct rendering interface functions and data.
+     */
+   __GLXDRIdisplay *driswDisplay;
+   __GLXDRIdisplay *driDisplay;
+   __GLXDRIdisplay *dri2Display;
+#endif
+};
+
+
+extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);
+
+extern void __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
+                                GLint totalRequests,
+                                const GLvoid * data, GLint dataLen);
+
+extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
+                                  const GLvoid *, GLint);
+
+/* Initialize the GLX extension for dpy */
+extern __GLXdisplayPrivate *__glXInitialize(Display *);
+
+extern void __glXPreferEGL(int state);
+
+/************************************************************************/
+
+extern int __glXDebug;
+
+/* This is per-thread storage in an MT environment */
+#if defined( PTHREADS )
+
+extern void __glXSetCurrentContext(__GLXcontext * c);
+
+# if defined( GLX_USE_TLS )
+
+extern __thread void *__glX_tls_Context
+   __attribute__ ((tls_model("initial-exec")));
+
+#  define __glXGetCurrentContext() __glX_tls_Context
+
+# else
+
+extern __GLXcontext *__glXGetCurrentContext(void);
+
+# endif /* defined( GLX_USE_TLS ) */
+
+#else
+
+extern __GLXcontext *__glXcurrentContext;
+#define __glXGetCurrentContext() __glXcurrentContext
+#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
+
+#endif /* defined( PTHREADS ) */
+
+extern void __glXSetCurrentContextNull(void);
+
+extern void __glXFreeContext(__GLXcontext *);
+
+
+/*
+** Global lock for all threads in this address space using the GLX
+** extension
+*/
+#if defined( PTHREADS )
+extern pthread_mutex_t __glXmutex;
+#define __glXLock()    pthread_mutex_lock(&__glXmutex)
+#define __glXUnlock()  pthread_mutex_unlock(&__glXmutex)
+#else
+#define __glXLock()
+#define __glXUnlock()
+#endif
+
+/*
+** Setup for a command.  Initialize the extension for dpy if necessary.
+*/
+extern CARD8 __glXSetupForCommand(Display * dpy);
+
+/************************************************************************/
+
+/*
+** Data conversion and packing support.
+*/
+
+extern const GLuint __glXDefaultPixelStore[9];
+
+/* Send an image to the server using RenderLarge. */
+extern void __glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
+                                GLint width, GLint height, GLint depth,
+                                GLenum format, GLenum type,
+                                const GLvoid * src, GLubyte * pc,
+                                GLubyte * modes);
+
+/* Return the size, in bytes, of some pixel data */
+extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
+
+/* Return the number of elements per group of a specified format*/
+extern GLint __glElementsPerGroup(GLenum format, GLenum type);
+
+/* Return the number of bytes per element, based on the element type (other
+** than GL_BITMAP).
+*/
+extern GLint __glBytesPerElement(GLenum type);
+
+/*
+** Fill the transport buffer with the data from the users buffer,
+** applying some of the pixel store modes (unpack modes) to the data
+** first.  As a side effect of this call, the "modes" field is
+** updated to contain the modes needed by the server to decode the
+** sent data.
+*/
+extern void __glFillImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
+                          GLenum, const GLvoid *, GLubyte *, GLubyte *);
+
+/* Copy map data with a stride into a packed buffer */
+extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
+extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
+extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
+                          const GLfloat *, GLfloat *);
+extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
+                          const GLdouble *, GLdouble *);
+
+/*
+** Empty an image out of the reply buffer into the clients memory applying
+** the pack modes to pack back into the clients requested format.
+*/
+extern void __glEmptyImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
+                           GLenum, const GLubyte *, GLvoid *);
+
+
+/*
+** Allocate and Initialize Vertex Array client state, and free.
+*/
+extern void __glXInitVertexArrayState(__GLXcontext *);
+extern void __glXFreeVertexArrayState(__GLXcontext *);
+
+/*
+** Inform the Server of the major and minor numbers and of the client
+** libraries extension string.
+*/
+extern void __glXClientInfo(Display * dpy, int opcode);
+
+/************************************************************************/
+
+/*
+** Declarations that should be in Xlib
+*/
+#ifdef __GL_USE_OUR_PROTOTYPES
+extern void _XFlush(Display *);
+extern Status _XReply(Display *, xReply *, int, Bool);
+extern void _XRead(Display *, void *, long);
+extern void _XSend(Display *, const void *, long);
+#endif
+
+
+extern void __glXInitializeVisualConfigFromTags(__GLcontextModes * config,
+                                                int count, const INT32 * bp,
+                                                Bool tagged_only,
+                                                Bool fbconfig_style_tags);
+
+extern char *__glXQueryServerString(Display * dpy, int opcode,
+                                    CARD32 screen, CARD32 name);
+extern char *__glXGetString(Display * dpy, int opcode,
+                            CARD32 screen, CARD32 name);
+
+extern char *__glXstrdup(const char *str);
+
+
+extern const char __glXGLClientVersion[];
+extern const char __glXGLClientExtensions[];
+
+/* Get the unadjusted system time */
+extern int __glXGetUST(int64_t * ust);
+
+extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
+                                    int32_t * numerator,
+                                    int32_t * denominator);
+
+#ifdef GLX_DIRECT_RENDERING
+GLboolean
+__driGetMscRateOML(__DRIdrawable * draw,
+                   int32_t * numerator, int32_t * denominator, void *private);
+
+/* So that dri2.c:DRI2WireToEvent() can access
+ * glx_info->codes->first_event */
+XExtDisplayInfo *__glXFindDisplay (Display *dpy);
+#endif
+
+#endif /* !__GLX_client_h__ */
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
new file mode 100644 (file)
index 0000000..c3be974
--- /dev/null
@@ -0,0 +1,3173 @@
+/*
+ * 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.
+ */
+
+/**
+ * \file glxcmds.c
+ * Client-side GLX interface.
+ */
+
+#include "glxclient.h"
+#include "glapi.h"
+#include "glxextensions.h"
+#include "glcontextmodes.h"
+
+#ifdef GLX_DIRECT_RENDERING
+#include <sys/time.h>
+#include <X11/extensions/xf86vmode.h>
+#include "xf86dri.h"
+#endif
+
+#if defined(USE_XCB)
+#include <X11/Xlib-xcb.h>
+#include <xcb/xcb.h>
+#include <xcb/glx.h>
+#endif
+
+static const char __glXGLXClientVendorName[] = "Mesa Project and SGI";
+static const char __glXGLXClientVersion[] = "1.4";
+
+
+/****************************************************************************/
+
+#ifdef GLX_DIRECT_RENDERING
+
+static Bool windowExistsFlag;
+static int
+windowExistsErrorHandler(Display * dpy, XErrorEvent * xerr)
+{
+   if (xerr->error_code == BadWindow) {
+      windowExistsFlag = GL_FALSE;
+   }
+   return 0;
+}
+
+/**
+ * Find drawables in the local hash that have been destroyed on the
+ * server.
+ *
+ * \param dpy    Display to destroy drawables for
+ * \param screen Screen number to destroy drawables for
+ */
+static void
+GarbageCollectDRIDrawables(Display * dpy, __GLXscreenConfigs * sc)
+{
+   XID draw;
+   __GLXDRIdrawable *pdraw;
+   XWindowAttributes xwa;
+   int (*oldXErrorHandler) (Display *, XErrorEvent *);
+
+   /* Set no-op error handler so Xlib doesn't bail out if the windows
+    * has alreay been destroyed on the server. */
+   XSync(dpy, GL_FALSE);
+   oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler);
+
+   if (__glxHashFirst(sc->drawHash, &draw, (void *) &pdraw) == 1) {
+      do {
+         windowExistsFlag = GL_TRUE;
+         XGetWindowAttributes(dpy, draw, &xwa); /* dummy request */
+         if (!windowExistsFlag) {
+            /* Destroy the local drawable data, if the drawable no
+               longer exists in the Xserver */
+            (*pdraw->destroyDrawable) (pdraw);
+            __glxHashDelete(sc->drawHash, draw);
+         }
+      } while (__glxHashNext(sc->drawHash, &draw, (void *) &pdraw) == 1);
+   }
+
+   XSync(dpy, GL_FALSE);
+   XSetErrorHandler(oldXErrorHandler);
+}
+
+extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
+                                           GLXDrawable drawable,
+                                           int *const scrn_num);
+
+/**
+ * Get the __DRIdrawable for the drawable associated with a GLXContext
+ *
+ * \param dpy       The display associated with \c drawable.
+ * \param drawable  GLXDrawable whose __DRIdrawable part is to be retrieved.
+ * \param scrn_num  If non-NULL, the drawables screen is stored there
+ * \returns  A pointer to the context's __DRIdrawable on success, or NULL if
+ *           the drawable is not associated with a direct-rendering context.
+ */
+_X_HIDDEN __GLXDRIdrawable *
+GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable, int *const scrn_num)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   __GLXDRIdrawable *pdraw;
+   const unsigned screen_count = ScreenCount(dpy);
+   unsigned i;
+   __GLXscreenConfigs *psc;
+
+   if (priv == NULL)
+      return NULL;
+
+   for (i = 0; i < screen_count; i++) {
+      psc = &priv->screenConfigs[i];
+      if (psc->drawHash == NULL)
+         continue;
+
+      if (__glxHashLookup(psc->drawHash, drawable, (void *) &pdraw) == 0) {
+         if (scrn_num != NULL)
+            *scrn_num = i;
+         return pdraw;
+      }
+   }
+
+   return NULL;
+}
+
+#endif
+
+
+/**
+ * Get the GLX per-screen data structure associated with a GLX context.
+ *
+ * \param dpy   Display for which the GLX per-screen information is to be
+ *              retrieved.
+ * \param scrn  Screen on \c dpy for which the GLX per-screen information is
+ *              to be retrieved.
+ * \returns A pointer to the GLX per-screen data if \c dpy and \c scrn
+ *          specify a valid GLX screen, or NULL otherwise.
+ *
+ * \todo Should this function validate that \c scrn is within the screen
+ *       number range for \c dpy?
+ */
+
+static __GLXscreenConfigs *
+GetGLXScreenConfigs(Display * dpy, int scrn)
+{
+   __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+
+   return (priv
+           && priv->screenConfigs !=
+           NULL) ? &priv->screenConfigs[scrn] : NULL;
+}
+
+
+static int
+GetGLXPrivScreenConfig(Display * dpy, int scrn, __GLXdisplayPrivate ** ppriv,
+                       __GLXscreenConfigs ** ppsc)
+{
+   /* Initialize the extension, if needed .  This has the added value
+    * of initializing/allocating the display private
+    */
+
+   if (dpy == NULL) {
+      return GLX_NO_EXTENSION;
+   }
+
+   *ppriv = __glXInitialize(dpy);
+   if (*ppriv == NULL) {
+      return GLX_NO_EXTENSION;
+   }
+
+   /* Check screen number to see if its valid */
+   if ((scrn < 0) || (scrn >= ScreenCount(dpy))) {
+      return GLX_BAD_SCREEN;
+   }
+
+   /* Check to see if the GL is supported on this screen */
+   *ppsc = &((*ppriv)->screenConfigs[scrn]);
+   if ((*ppsc)->configs == NULL) {
+      /* No support for GL on this screen regardless of visual */
+      return GLX_BAD_VISUAL;
+   }
+
+   return Success;
+}
+
+
+/**
+ * Determine if a \c GLXFBConfig supplied by the application is valid.
+ *
+ * \param dpy     Application supplied \c Display pointer.
+ * \param config  Application supplied \c GLXFBConfig.
+ *
+ * \returns If the \c GLXFBConfig is valid, the a pointer to the matching
+ *          \c __GLcontextModes structure is returned.  Otherwise, \c NULL
+ *          is returned.
+ */
+static __GLcontextModes *
+ValidateGLXFBConfig(Display * dpy, GLXFBConfig config)
+{
+   __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+   const unsigned num_screens = ScreenCount(dpy);
+   unsigned i;
+   const __GLcontextModes *modes;
+
+
+   if (priv != NULL) {
+      for (i = 0; i < num_screens; i++) {
+         for (modes = priv->screenConfigs[i].configs; modes != NULL;
+              modes = modes->next) {
+            if (modes == (__GLcontextModes *) config) {
+               return (__GLcontextModes *) config;
+            }
+         }
+      }
+   }
+
+   return NULL;
+}
+
+
+/**
+ * \todo It should be possible to move the allocate of \c client_state_private
+ * later in the function for direct-rendering contexts.  Direct-rendering
+ * contexts don't need to track client state, so they don't need that memory
+ * at all.
+ *
+ * \todo Eliminate \c __glXInitVertexArrayState.  Replace it with a new
+ * function called \c __glXAllocateClientState that allocates the memory and
+ * does all the initialization (including the pixel pack / unpack).
+ */
+static GLXContext
+AllocateGLXContext(Display * dpy)
+{
+   GLXContext gc;
+   int bufSize;
+   CARD8 opcode;
+   __GLXattribute *state;
+
+   if (!dpy)
+      return NULL;
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return NULL;
+   }
+
+   /* Allocate our context record */
+   gc = (GLXContext) Xmalloc(sizeof(struct __GLXcontextRec));
+   if (!gc) {
+      /* Out of memory */
+      return NULL;
+   }
+   memset(gc, 0, sizeof(struct __GLXcontextRec));
+
+   state = Xmalloc(sizeof(struct __GLXattributeRec));
+   if (state == NULL) {
+      /* Out of memory */
+      Xfree(gc);
+      return NULL;
+   }
+   gc->client_state_private = state;
+   memset(gc->client_state_private, 0, sizeof(struct __GLXattributeRec));
+   state->NoDrawArraysProtocol = (getenv("LIBGL_NO_DRAWARRAYS") != NULL);
+
+   /*
+    ** Create a temporary buffer to hold GLX rendering commands.  The size
+    ** of the buffer is selected so that the maximum number of GLX rendering
+    ** commands can fit in a single X packet and still have room in the X
+    ** packet for the GLXRenderReq header.
+    */
+
+   bufSize = (XMaxRequestSize(dpy) * 4) - sz_xGLXRenderReq;
+   gc->buf = (GLubyte *) Xmalloc(bufSize);
+   if (!gc->buf) {
+      Xfree(gc->client_state_private);
+      Xfree(gc);
+      return NULL;
+   }
+   gc->bufSize = bufSize;
+
+   /* Fill in the new context */
+   gc->renderMode = GL_RENDER;
+
+   state->storePack.alignment = 4;
+   state->storeUnpack.alignment = 4;
+
+   gc->attributes.stackPointer = &gc->attributes.stack[0];
+
+   /*
+    ** PERFORMANCE NOTE: A mode dependent fill image can speed things up.
+    ** Other code uses the fastImageUnpack bit, but it is never set
+    ** to GL_TRUE.
+    */
+   gc->fastImageUnpack = GL_FALSE;
+   gc->fillImage = __glFillImage;
+   gc->pc = gc->buf;
+   gc->bufEnd = gc->buf + bufSize;
+   gc->isDirect = GL_FALSE;
+   if (__glXDebug) {
+      /*
+       ** Set limit register so that there will be one command per packet
+       */
+      gc->limit = gc->buf;
+   }
+   else {
+      gc->limit = gc->buf + bufSize - __GLX_BUFFER_LIMIT_SIZE;
+   }
+   gc->createDpy = dpy;
+   gc->majorOpcode = opcode;
+
+   /*
+    ** Constrain the maximum drawing command size allowed to be
+    ** transfered using the X_GLXRender protocol request.  First
+    ** constrain by a software limit, then constrain by the protocl
+    ** limit.
+    */
+   if (bufSize > __GLX_RENDER_CMD_SIZE_LIMIT) {
+      bufSize = __GLX_RENDER_CMD_SIZE_LIMIT;
+   }
+   if (bufSize > __GLX_MAX_RENDER_CMD_SIZE) {
+      bufSize = __GLX_MAX_RENDER_CMD_SIZE;
+   }
+   gc->maxSmallRenderCommandSize = bufSize;
+   return gc;
+}
+
+
+/**
+ * Create a new context.  Exactly one of \c vis and \c fbconfig should be
+ * non-NULL.
+ *
+ * \param use_glx_1_3  For FBConfigs, should GLX 1.3 protocol or
+ *                     SGIX_fbconfig protocol be used?
+ * \param renderType   For FBConfigs, what is the rendering type?
+ */
+
+static GLXContext
+CreateContext(Display * dpy, XVisualInfo * vis,
+              const __GLcontextModes * const fbconfig,
+              GLXContext shareList,
+              Bool allowDirect, GLXContextID contextID,
+              Bool use_glx_1_3, int renderType)
+{
+   GLXContext gc;
+#ifdef GLX_DIRECT_RENDERING
+   int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen;
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+#endif
+
+   if (dpy == NULL)
+      return NULL;
+
+   gc = AllocateGLXContext(dpy);
+   if (!gc)
+      return NULL;
+
+   if (None == contextID) {
+      if ((vis == NULL) && (fbconfig == NULL))
+         return NULL;
+
+#ifdef GLX_DIRECT_RENDERING
+      if (allowDirect && psc->driScreen) {
+         const __GLcontextModes *mode;
+
+         if (fbconfig == NULL) {
+            mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
+            if (mode == NULL) {
+               xError error;
+
+               error.errorCode = BadValue;
+               error.resourceID = vis->visualid;
+               error.sequenceNumber = dpy->request;
+               error.type = X_Error;
+               error.majorCode = gc->majorOpcode;
+               error.minorCode = X_GLXCreateContext;
+               _XError(dpy, &error);
+               return None;
+            }
+            if (renderType == 0) {
+               /* Initialize renderType now */
+               renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE;
+            }
+         }
+         else {
+            mode = fbconfig;
+         }
+
+         gc->driContext = psc->driScreen->createContext(psc, mode, gc,
+                                                        shareList,
+                                                        renderType);
+         if (gc->driContext != NULL) {
+            gc->screen = mode->screen;
+            gc->psc = psc;
+            gc->mode = mode;
+            gc->isDirect = GL_TRUE;
+         }
+      }
+#endif
+
+      LockDisplay(dpy);
+      if (fbconfig == NULL) {
+         xGLXCreateContextReq *req;
+
+         /* Send the glXCreateContext request */
+         GetReq(GLXCreateContext, req);
+         req->reqType = gc->majorOpcode;
+         req->glxCode = X_GLXCreateContext;
+         req->context = gc->xid = XAllocID(dpy);
+         req->visual = vis->visualid;
+         req->screen = vis->screen;
+         req->shareList = shareList ? shareList->xid : None;
+#ifdef GLX_DIRECT_RENDERING
+         req->isDirect = gc->driContext != NULL;
+#else
+         req->isDirect = 0;
+#endif
+      }
+      else if (use_glx_1_3) {
+         xGLXCreateNewContextReq *req;
+
+         /* Send the glXCreateNewContext request */
+         GetReq(GLXCreateNewContext, req);
+         req->reqType = gc->majorOpcode;
+         req->glxCode = X_GLXCreateNewContext;
+         req->context = gc->xid = XAllocID(dpy);
+         req->fbconfig = fbconfig->fbconfigID;
+         req->screen = fbconfig->screen;
+         req->renderType = renderType;
+         req->shareList = shareList ? shareList->xid : None;
+#ifdef GLX_DIRECT_RENDERING
+         req->isDirect = gc->driContext != NULL;
+#else
+         req->isDirect = 0;
+#endif
+      }
+      else {
+         xGLXVendorPrivateWithReplyReq *vpreq;
+         xGLXCreateContextWithConfigSGIXReq *req;
+
+         /* Send the glXCreateNewContext request */
+         GetReqExtra(GLXVendorPrivateWithReply,
+                     sz_xGLXCreateContextWithConfigSGIXReq -
+                     sz_xGLXVendorPrivateWithReplyReq, vpreq);
+         req = (xGLXCreateContextWithConfigSGIXReq *) vpreq;
+         req->reqType = gc->majorOpcode;
+         req->glxCode = X_GLXVendorPrivateWithReply;
+         req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
+         req->context = gc->xid = XAllocID(dpy);
+         req->fbconfig = fbconfig->fbconfigID;
+         req->screen = fbconfig->screen;
+         req->renderType = renderType;
+         req->shareList = shareList ? shareList->xid : None;
+#ifdef GLX_DIRECT_RENDERING
+         req->isDirect = gc->driContext != NULL;
+#else
+         req->isDirect = 0;
+#endif
+      }
+
+      UnlockDisplay(dpy);
+      SyncHandle();
+      gc->imported = GL_FALSE;
+   }
+   else {
+      gc->xid = contextID;
+      gc->imported = GL_TRUE;
+   }
+
+   gc->renderType = renderType;
+
+   return gc;
+}
+
+PUBLIC GLXContext
+glXCreateContext(Display * dpy, XVisualInfo * vis,
+                 GLXContext shareList, Bool allowDirect)
+{
+   return CreateContext(dpy, vis, NULL, shareList, allowDirect, None,
+                        False, 0);
+}
+
+_X_HIDDEN void
+__glXFreeContext(__GLXcontext * gc)
+{
+   if (gc->vendor)
+      XFree((char *) gc->vendor);
+   if (gc->renderer)
+      XFree((char *) gc->renderer);
+   if (gc->version)
+      XFree((char *) gc->version);
+   if (gc->extensions)
+      XFree((char *) gc->extensions);
+   __glFreeAttributeState(gc);
+   XFree((char *) gc->buf);
+   Xfree((char *) gc->client_state_private);
+   XFree((char *) gc);
+
+}
+
+/*
+** Destroy the named context
+*/
+static void
+DestroyContext(Display * dpy, GLXContext gc)
+{
+   xGLXDestroyContextReq *req;
+   GLXContextID xid;
+   CARD8 opcode;
+   GLboolean imported;
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode || !gc) {
+      return;
+   }
+
+   __glXLock();
+   xid = gc->xid;
+   imported = gc->imported;
+   gc->xid = None;
+
+   if (gc->currentDpy) {
+      /* This context is bound to some thread.  According to the man page,
+       * we should not actually delete the context until it's unbound.
+       * Note that we set gc->xid = None above.  In MakeContextCurrent()
+       * we check for that and delete the context there.
+       */
+      __glXUnlock();
+      return;
+   }
+
+#ifdef GLX_DIRECT_RENDERING
+   /* Destroy the direct rendering context */
+   if (gc->driContext) {
+      (*gc->driContext->destroyContext) (gc->driContext, gc->psc, dpy);
+      gc->driContext = NULL;
+      GarbageCollectDRIDrawables(dpy, gc->psc);
+   }
+#endif
+
+   __glXFreeVertexArrayState(gc);
+
+   if (gc->currentDpy) {
+      /* Have to free later cuz it's in use now */
+      __glXUnlock();
+   }
+   else {
+      /* Destroy the handle if not current to anybody */
+      __glXUnlock();
+      __glXFreeContext(gc);
+   }
+
+   if (!imported) {
+      /*
+       ** This dpy also created the server side part of the context.
+       ** Send the glXDestroyContext request.
+       */
+      LockDisplay(dpy);
+      GetReq(GLXDestroyContext, req);
+      req->reqType = opcode;
+      req->glxCode = X_GLXDestroyContext;
+      req->context = xid;
+      UnlockDisplay(dpy);
+      SyncHandle();
+   }
+}
+
+PUBLIC void
+glXDestroyContext(Display * dpy, GLXContext gc)
+{
+   DestroyContext(dpy, gc);
+}
+
+/*
+** Return the major and minor version #s for the GLX extension
+*/
+PUBLIC Bool
+glXQueryVersion(Display * dpy, int *major, int *minor)
+{
+   __GLXdisplayPrivate *priv;
+
+   /* Init the extension.  This fetches the major and minor version. */
+   priv = __glXInitialize(dpy);
+   if (!priv)
+      return GL_FALSE;
+
+   if (major)
+      *major = priv->majorVersion;
+   if (minor)
+      *minor = priv->minorVersion;
+   return GL_TRUE;
+}
+
+/*
+** Query the existance of the GLX extension
+*/
+PUBLIC Bool
+glXQueryExtension(Display * dpy, int *errorBase, int *eventBase)
+{
+   int major_op, erb, evb;
+   Bool rv;
+
+   rv = XQueryExtension(dpy, GLX_EXTENSION_NAME, &major_op, &evb, &erb);
+   if (rv) {
+      if (errorBase)
+         *errorBase = erb;
+      if (eventBase)
+         *eventBase = evb;
+   }
+   return rv;
+}
+
+/*
+** Put a barrier in the token stream that forces the GL to finish its
+** work before X can proceed.
+*/
+PUBLIC void
+glXWaitGL(void)
+{
+   xGLXWaitGLReq *req;
+   GLXContext gc = __glXGetCurrentContext();
+   Display *dpy = gc->currentDpy;
+
+   if (!dpy)
+      return;
+
+   /* Flush any pending commands out */
+   __glXFlushRenderBuffer(gc, gc->pc);
+
+#ifdef GLX_DIRECT_RENDERING
+   if (gc->driContext) {
+      int screen;
+      __GLXDRIdrawable *pdraw =
+         GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
+
+      if (pdraw != NULL) {
+         __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+         glFlush();
+         if (psc->driScreen->waitGL != NULL)
+            (*psc->driScreen->waitGL) (pdraw);
+      }
+      return;
+   }
+#endif
+
+   /* Send the glXWaitGL request */
+   LockDisplay(dpy);
+   GetReq(GLXWaitGL, req);
+   req->reqType = gc->majorOpcode;
+   req->glxCode = X_GLXWaitGL;
+   req->contextTag = gc->currentContextTag;
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+/*
+** Put a barrier in the token stream that forces X to finish its
+** work before GL can proceed.
+*/
+PUBLIC void
+glXWaitX(void)
+{
+   xGLXWaitXReq *req;
+   GLXContext gc = __glXGetCurrentContext();
+   Display *dpy = gc->currentDpy;
+
+   if (!dpy)
+      return;
+
+   /* Flush any pending commands out */
+   __glXFlushRenderBuffer(gc, gc->pc);
+
+#ifdef GLX_DIRECT_RENDERING
+   if (gc->driContext) {
+      int screen;
+      __GLXDRIdrawable *pdraw =
+         GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
+
+      if (pdraw != NULL) {
+         __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+         if (psc->driScreen->waitX != NULL)
+            (*psc->driScreen->waitX) (pdraw);
+      }
+      else
+         XSync(dpy, False);
+      return;
+   }
+#endif
+
+   /*
+    ** Send the glXWaitX request.
+    */
+   LockDisplay(dpy);
+   GetReq(GLXWaitX, req);
+   req->reqType = gc->majorOpcode;
+   req->glxCode = X_GLXWaitX;
+   req->contextTag = gc->currentContextTag;
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+PUBLIC void
+glXUseXFont(Font font, int first, int count, int listBase)
+{
+   xGLXUseXFontReq *req;
+   GLXContext gc = __glXGetCurrentContext();
+   Display *dpy = gc->currentDpy;
+
+   if (!dpy)
+      return;
+
+   /* Flush any pending commands out */
+   (void) __glXFlushRenderBuffer(gc, gc->pc);
+
+#ifdef GLX_DIRECT_RENDERING
+   if (gc->driContext) {
+      DRI_glXUseXFont(font, first, count, listBase);
+      return;
+   }
+#endif
+
+   /* Send the glXUseFont request */
+   LockDisplay(dpy);
+   GetReq(GLXUseXFont, req);
+   req->reqType = gc->majorOpcode;
+   req->glxCode = X_GLXUseXFont;
+   req->contextTag = gc->currentContextTag;
+   req->font = font;
+   req->first = first;
+   req->count = count;
+   req->listBase = listBase;
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+/************************************************************************/
+
+/*
+** Copy the source context to the destination context using the
+** attribute "mask".
+*/
+PUBLIC void
+glXCopyContext(Display * dpy, GLXContext source,
+               GLXContext dest, unsigned long mask)
+{
+   xGLXCopyContextReq *req;
+   GLXContext gc = __glXGetCurrentContext();
+   GLXContextTag tag;
+   CARD8 opcode;
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return;
+   }
+
+#ifdef GLX_DIRECT_RENDERING
+   if (gc->driContext) {
+      /* NOT_DONE: This does not work yet */
+   }
+#endif
+
+   /*
+    ** If the source is the current context, send its tag so that the context
+    ** can be flushed before the copy.
+    */
+   if (source == gc && dpy == gc->currentDpy) {
+      tag = gc->currentContextTag;
+   }
+   else {
+      tag = 0;
+   }
+
+   /* Send the glXCopyContext request */
+   LockDisplay(dpy);
+   GetReq(GLXCopyContext, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXCopyContext;
+   req->source = source ? source->xid : None;
+   req->dest = dest ? dest->xid : None;
+   req->mask = mask;
+   req->contextTag = tag;
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+
+/**
+ * Determine if a context uses direct rendering.
+ *
+ * \param dpy        Display where the context was created.
+ * \param contextID  ID of the context to be tested.
+ *
+ * \returns \c GL_TRUE if the context is direct rendering or not.
+ */
+static Bool
+__glXIsDirect(Display * dpy, GLXContextID contextID)
+{
+#if !defined(USE_XCB)
+   xGLXIsDirectReq *req;
+   xGLXIsDirectReply reply;
+#endif
+   CARD8 opcode;
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return GL_FALSE;
+   }
+
+#ifdef USE_XCB
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_is_direct_reply_t *reply = xcb_glx_is_direct_reply(c,
+                                                              xcb_glx_is_direct
+                                                              (c, contextID),
+                                                              NULL);
+
+   const Bool is_direct = reply->is_direct ? True : False;
+   free(reply);
+
+   return is_direct;
+#else
+   /* Send the glXIsDirect request */
+   LockDisplay(dpy);
+   GetReq(GLXIsDirect, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXIsDirect;
+   req->context = contextID;
+   _XReply(dpy, (xReply *) & reply, 0, False);
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return reply.isDirect;
+#endif /* USE_XCB */
+}
+
+/**
+ * \todo
+ * Shouldn't this function \b always return \c GL_FALSE when
+ * \c GLX_DIRECT_RENDERING is not defined?  Do we really need to bother with
+ * the GLX protocol here at all?
+ */
+PUBLIC Bool
+glXIsDirect(Display * dpy, GLXContext gc)
+{
+   if (!gc) {
+      return GL_FALSE;
+#ifdef GLX_DIRECT_RENDERING
+   }
+   else if (gc->driContext) {
+      return GL_TRUE;
+#endif
+   }
+   return __glXIsDirect(dpy, gc->xid);
+}
+
+PUBLIC GLXPixmap
+glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
+{
+   xGLXCreateGLXPixmapReq *req;
+   GLXPixmap xid;
+   CARD8 opcode;
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return None;
+   }
+
+   /* Send the glXCreateGLXPixmap request */
+   LockDisplay(dpy);
+   GetReq(GLXCreateGLXPixmap, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXCreateGLXPixmap;
+   req->screen = vis->screen;
+   req->visual = vis->visualid;
+   req->pixmap = pixmap;
+   req->glxpixmap = xid = XAllocID(dpy);
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+#ifdef GLX_DIRECT_RENDERING
+   do {
+      /* FIXME: Maybe delay __DRIdrawable creation until the drawable
+       * is actually bound to a context... */
+
+      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+      __GLXDRIdrawable *pdraw;
+      __GLXscreenConfigs *psc;
+      __GLcontextModes *modes;
+
+      psc = &priv->screenConfigs[vis->screen];
+      if (psc->driScreen == NULL)
+         break;
+      modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
+      pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, modes);
+      if (pdraw == NULL) {
+         fprintf(stderr, "failed to create pixmap\n");
+         break;
+      }
+
+      if (__glxHashInsert(psc->drawHash, req->glxpixmap, pdraw)) {
+         (*pdraw->destroyDrawable) (pdraw);
+         return None;           /* FIXME: Check what we're supposed to do here... */
+      }
+   } while (0);
+#endif
+
+   return xid;
+}
+
+/*
+** Destroy the named pixmap
+*/
+PUBLIC void
+glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
+{
+   xGLXDestroyGLXPixmapReq *req;
+   CARD8 opcode;
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return;
+   }
+
+   /* Send the glXDestroyGLXPixmap request */
+   LockDisplay(dpy);
+   GetReq(GLXDestroyGLXPixmap, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXDestroyGLXPixmap;
+   req->glxpixmap = glxpixmap;
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+#ifdef GLX_DIRECT_RENDERING
+   {
+      int screen;
+      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap, &screen);
+      __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
+
+      if (pdraw != NULL) {
+         (*pdraw->destroyDrawable) (pdraw);
+         __glxHashDelete(psc->drawHash, glxpixmap);
+      }
+   }
+#endif
+}
+
+PUBLIC void
+glXSwapBuffers(Display * dpy, GLXDrawable drawable)
+{
+   GLXContext gc;
+   GLXContextTag tag;
+   CARD8 opcode;
+#ifdef USE_XCB
+   xcb_connection_t *c;
+#else
+   xGLXSwapBuffersReq *req;
+#endif
+
+#ifdef GLX_DIRECT_RENDERING
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+
+   if (pdraw != NULL) {
+      glFlush();
+      (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0);
+      return;
+   }
+#endif
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return;
+   }
+
+   /*
+    ** The calling thread may or may not have a current context.  If it
+    ** does, send the context tag so the server can do a flush.
+    */
+   gc = __glXGetCurrentContext();
+   if ((gc != NULL) && (dpy == gc->currentDpy) &&
+       ((drawable == gc->currentDrawable)
+        || (drawable == gc->currentReadable))) {
+      tag = gc->currentContextTag;
+   }
+   else {
+      tag = 0;
+   }
+
+#ifdef USE_XCB
+   c = XGetXCBConnection(dpy);
+   xcb_glx_swap_buffers(c, tag, drawable);
+   xcb_flush(c);
+#else
+   /* Send the glXSwapBuffers request */
+   LockDisplay(dpy);
+   GetReq(GLXSwapBuffers, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXSwapBuffers;
+   req->drawable = drawable;
+   req->contextTag = tag;
+   UnlockDisplay(dpy);
+   SyncHandle();
+   XFlush(dpy);
+#endif /* USE_XCB */
+}
+
+
+/*
+** Return configuration information for the given display, screen and
+** visual combination.
+*/
+PUBLIC int
+glXGetConfig(Display * dpy, XVisualInfo * vis, int attribute,
+             int *value_return)
+{
+   __GLXdisplayPrivate *priv;
+   __GLXscreenConfigs *psc;
+   __GLcontextModes *modes;
+   int status;
+
+   status = GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc);
+   if (status == Success) {
+      modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
+
+      /* Lookup attribute after first finding a match on the visual */
+      if (modes != NULL) {
+         return _gl_get_context_mode_data(modes, attribute, value_return);
+      }
+
+      status = GLX_BAD_VISUAL;
+   }
+
+   /*
+    ** If we can't find the config for this visual, this visual is not
+    ** supported by the OpenGL implementation on the server.
+    */
+   if ((status == GLX_BAD_VISUAL) && (attribute == GLX_USE_GL)) {
+      *value_return = GL_FALSE;
+      status = Success;
+   }
+
+   return status;
+}
+
+/************************************************************************/
+
+static void
+init_fbconfig_for_chooser(__GLcontextModes * config,
+                          GLboolean fbconfig_style_tags)
+{
+   memset(config, 0, sizeof(__GLcontextModes));
+   config->visualID = (XID) GLX_DONT_CARE;
+   config->visualType = GLX_DONT_CARE;
+
+   /* glXChooseFBConfig specifies different defaults for these two than
+    * glXChooseVisual.
+    */
+   if (fbconfig_style_tags) {
+      config->rgbMode = GL_TRUE;
+      config->doubleBufferMode = GLX_DONT_CARE;
+   }
+
+   config->visualRating = GLX_DONT_CARE;
+   config->transparentPixel = GLX_NONE;
+   config->transparentRed = GLX_DONT_CARE;
+   config->transparentGreen = GLX_DONT_CARE;
+   config->transparentBlue = GLX_DONT_CARE;
+   config->transparentAlpha = GLX_DONT_CARE;
+   config->transparentIndex = GLX_DONT_CARE;
+
+   config->drawableType = GLX_WINDOW_BIT;
+   config->renderType =
+      (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+   config->xRenderable = GLX_DONT_CARE;
+   config->fbconfigID = (GLXFBConfigID) (GLX_DONT_CARE);
+
+   config->swapMethod = GLX_DONT_CARE;
+}
+
+#define MATCH_DONT_CARE( param )        \
+  do {                                  \
+    if ( (a-> param != GLX_DONT_CARE)   \
+         && (a-> param != b-> param) ) {        \
+      return False;                             \
+    }                                           \
+  } while ( 0 )
+
+#define MATCH_MINIMUM( param )                  \
+  do {                                          \
+    if ( (a-> param != GLX_DONT_CARE)           \
+         && (a-> param > b-> param) ) {         \
+      return False;                             \
+    }                                           \
+  } while ( 0 )
+
+#define MATCH_EXACT( param )                    \
+  do {                                          \
+    if ( a-> param != b-> param) {              \
+      return False;                             \
+    }                                           \
+  } while ( 0 )
+
+/**
+ * Determine if two GLXFBConfigs are compatible.
+ *
+ * \param a  Application specified config to test.
+ * \param b  Server specified config to test against \c a.
+ */
+static Bool
+fbconfigs_compatible(const __GLcontextModes * const a,
+                     const __GLcontextModes * const b)
+{
+   MATCH_DONT_CARE(doubleBufferMode);
+   MATCH_DONT_CARE(visualType);
+   MATCH_DONT_CARE(visualRating);
+   MATCH_DONT_CARE(xRenderable);
+   MATCH_DONT_CARE(fbconfigID);
+   MATCH_DONT_CARE(swapMethod);
+
+   MATCH_MINIMUM(rgbBits);
+   MATCH_MINIMUM(numAuxBuffers);
+   MATCH_MINIMUM(redBits);
+   MATCH_MINIMUM(greenBits);
+   MATCH_MINIMUM(blueBits);
+   MATCH_MINIMUM(alphaBits);
+   MATCH_MINIMUM(depthBits);
+   MATCH_MINIMUM(stencilBits);
+   MATCH_MINIMUM(accumRedBits);
+   MATCH_MINIMUM(accumGreenBits);
+   MATCH_MINIMUM(accumBlueBits);
+   MATCH_MINIMUM(accumAlphaBits);
+   MATCH_MINIMUM(sampleBuffers);
+   MATCH_MINIMUM(maxPbufferWidth);
+   MATCH_MINIMUM(maxPbufferHeight);
+   MATCH_MINIMUM(maxPbufferPixels);
+   MATCH_MINIMUM(samples);
+
+   MATCH_DONT_CARE(stereoMode);
+   MATCH_EXACT(level);
+
+   if (((a->drawableType & b->drawableType) == 0)
+       || ((a->renderType & b->renderType) == 0)) {
+      return False;
+   }
+
+
+   /* There is a bug in a few of the XFree86 DDX drivers.  They contain
+    * visuals with a "transparent type" of 0 when they really mean GLX_NONE.
+    * Technically speaking, it is a bug in the DDX driver, but there is
+    * enough of an installed base to work around the problem here.  In any
+    * case, 0 is not a valid value of the transparent type, so we'll treat 0
+    * from the app as GLX_DONT_CARE. We'll consider GLX_NONE from the app and
+    * 0 from the server to be a match to maintain backward compatibility with
+    * the (broken) drivers.
+    */
+
+   if (a->transparentPixel != GLX_DONT_CARE && a->transparentPixel != 0) {
+      if (a->transparentPixel == GLX_NONE) {
+         if (b->transparentPixel != GLX_NONE && b->transparentPixel != 0)
+            return False;
+      }
+      else {
+         MATCH_EXACT(transparentPixel);
+      }
+
+      switch (a->transparentPixel) {
+      case GLX_TRANSPARENT_RGB:
+         MATCH_DONT_CARE(transparentRed);
+         MATCH_DONT_CARE(transparentGreen);
+         MATCH_DONT_CARE(transparentBlue);
+         MATCH_DONT_CARE(transparentAlpha);
+         break;
+
+      case GLX_TRANSPARENT_INDEX:
+         MATCH_DONT_CARE(transparentIndex);
+         break;
+
+      default:
+         break;
+      }
+   }
+
+   return True;
+}
+
+
+/* There's some trickly language in the GLX spec about how this is supposed
+ * to work.  Basically, if a given component size is either not specified
+ * or the requested size is zero, it is supposed to act like PERFER_SMALLER.
+ * Well, that's really hard to do with the code as-is.  This behavior is
+ * closer to correct, but still not technically right.
+ */
+#define PREFER_LARGER_OR_ZERO(comp)             \
+  do {                                          \
+    if ( ((*a)-> comp) != ((*b)-> comp) ) {     \
+      if ( ((*a)-> comp) == 0 ) {               \
+        return -1;                              \
+      }                                         \
+      else if ( ((*b)-> comp) == 0 ) {          \
+        return 1;                               \
+      }                                         \
+      else {                                    \
+        return ((*b)-> comp) - ((*a)-> comp) ;  \
+      }                                         \
+    }                                           \
+  } while( 0 )
+
+#define PREFER_LARGER(comp)                     \
+  do {                                          \
+    if ( ((*a)-> comp) != ((*b)-> comp) ) {     \
+      return ((*b)-> comp) - ((*a)-> comp) ;    \
+    }                                           \
+  } while( 0 )
+
+#define PREFER_SMALLER(comp)                    \
+  do {                                          \
+    if ( ((*a)-> comp) != ((*b)-> comp) ) {     \
+      return ((*a)-> comp) - ((*b)-> comp) ;    \
+    }                                           \
+  } while( 0 )
+
+/**
+ * Compare two GLXFBConfigs.  This function is intended to be used as the
+ * compare function passed in to qsort.
+ *
+ * \returns If \c a is a "better" config, according to the specification of
+ *          SGIX_fbconfig, a number less than zero is returned.  If \c b is
+ *          better, then a number greater than zero is return.  If both are
+ *          equal, zero is returned.
+ * \sa qsort, glXChooseVisual, glXChooseFBConfig, glXChooseFBConfigSGIX
+ */
+static int
+fbconfig_compare(const __GLcontextModes * const *const a,
+                 const __GLcontextModes * const *const b)
+{
+   /* The order of these comparisons must NOT change.  It is defined by
+    * the GLX 1.3 spec and ARB_multisample.
+    */
+
+   PREFER_SMALLER(visualSelectGroup);
+
+   /* The sort order for the visualRating is GLX_NONE, GLX_SLOW, and
+    * GLX_NON_CONFORMANT_CONFIG.  It just so happens that this is the
+    * numerical sort order of the enums (0x8000, 0x8001, and 0x800D).
+    */
+   PREFER_SMALLER(visualRating);
+
+   /* This isn't quite right.  It is supposed to compare the sum of the
+    * components the user specifically set minimums for.
+    */
+   PREFER_LARGER_OR_ZERO(redBits);
+   PREFER_LARGER_OR_ZERO(greenBits);
+   PREFER_LARGER_OR_ZERO(blueBits);
+   PREFER_LARGER_OR_ZERO(alphaBits);
+
+   PREFER_SMALLER(rgbBits);
+
+   if (((*a)->doubleBufferMode != (*b)->doubleBufferMode)) {
+      /* Prefer single-buffer.
+       */
+      return (!(*a)->doubleBufferMode) ? -1 : 1;
+   }
+
+   PREFER_SMALLER(numAuxBuffers);
+
+   PREFER_LARGER_OR_ZERO(depthBits);
+   PREFER_SMALLER(stencilBits);
+
+   /* This isn't quite right.  It is supposed to compare the sum of the
+    * components the user specifically set minimums for.
+    */
+   PREFER_LARGER_OR_ZERO(accumRedBits);
+   PREFER_LARGER_OR_ZERO(accumGreenBits);
+   PREFER_LARGER_OR_ZERO(accumBlueBits);
+   PREFER_LARGER_OR_ZERO(accumAlphaBits);
+
+   PREFER_SMALLER(visualType);
+
+   /* None of the multisample specs say where this comparison should happen,
+    * so I put it near the end.
+    */
+   PREFER_SMALLER(sampleBuffers);
+   PREFER_SMALLER(samples);
+
+   /* None of the pbuffer or fbconfig specs say that this comparison needs
+    * to happen at all, but it seems like it should.
+    */
+   PREFER_LARGER(maxPbufferWidth);
+   PREFER_LARGER(maxPbufferHeight);
+   PREFER_LARGER(maxPbufferPixels);
+
+   return 0;
+}
+
+
+/**
+ * Selects and sorts a subset of the supplied configs based on the attributes.
+ * This function forms to basis of \c glXChooseVisual, \c glXChooseFBConfig,
+ * and \c glXChooseFBConfigSGIX.
+ *
+ * \param configs   Array of pointers to possible configs.  The elements of
+ *                  this array that do not meet the criteria will be set to
+ *                  NULL.  The remaining elements will be sorted according to
+ *                  the various visual / FBConfig selection rules.
+ * \param num_configs  Number of elements in the \c configs array.
+ * \param attribList   Attributes used select from \c configs.  This array is
+ *                     terminated by a \c None tag.  The array can either take
+ *                     the form expected by \c glXChooseVisual (where boolean
+ *                     tags do not have a value) or by \c glXChooseFBConfig
+ *                     (where every tag has a value).
+ * \param fbconfig_style_tags  Selects whether \c attribList is in
+ *                             \c glXChooseVisual style or
+ *                             \c glXChooseFBConfig style.
+ * \returns The number of valid elements left in \c configs.
+ *
+ * \sa glXChooseVisual, glXChooseFBConfig, glXChooseFBConfigSGIX
+ */
+static int
+choose_visual(__GLcontextModes ** configs, int num_configs,
+              const int *attribList, GLboolean fbconfig_style_tags)
+{
+   __GLcontextModes test_config;
+   int base;
+   int i;
+
+   /* This is a fairly direct implementation of the selection method
+    * described by GLX_SGIX_fbconfig.  Start by culling out all the
+    * configs that are not compatible with the selected parameter
+    * list.
+    */
+
+   init_fbconfig_for_chooser(&test_config, fbconfig_style_tags);
+   __glXInitializeVisualConfigFromTags(&test_config, 512,
+                                       (const INT32 *) attribList,
+                                       GL_TRUE, fbconfig_style_tags);
+
+   base = 0;
+   for (i = 0; i < num_configs; i++) {
+      if (fbconfigs_compatible(&test_config, configs[i])) {
+         configs[base] = configs[i];
+         base++;
+      }
+   }
+
+   if (base == 0) {
+      return 0;
+   }
+
+   if (base < num_configs) {
+      (void) memset(&configs[base], 0, sizeof(void *) * (num_configs - base));
+   }
+
+   /* After the incompatible configs are removed, the resulting
+    * list is sorted according to the rules set out in the various
+    * specifications.
+    */
+
+   qsort(configs, base, sizeof(__GLcontextModes *),
+         (int (*)(const void *, const void *)) fbconfig_compare);
+   return base;
+}
+
+
+
+
+/*
+** Return the visual that best matches the template.  Return None if no
+** visual matches the template.
+*/
+PUBLIC XVisualInfo *
+glXChooseVisual(Display * dpy, int screen, int *attribList)
+{
+   XVisualInfo *visualList = NULL;
+   __GLXdisplayPrivate *priv;
+   __GLXscreenConfigs *psc;
+   __GLcontextModes test_config;
+   __GLcontextModes *modes;
+   const __GLcontextModes *best_config = NULL;
+
+   /*
+    ** Get a list of all visuals, return if list is empty
+    */
+   if (GetGLXPrivScreenConfig(dpy, screen, &priv, &psc) != Success) {
+      return None;
+   }
+
+
+   /*
+    ** Build a template from the defaults and the attribute list
+    ** Free visual list and return if an unexpected token is encountered
+    */
+   init_fbconfig_for_chooser(&test_config, GL_FALSE);
+   __glXInitializeVisualConfigFromTags(&test_config, 512,
+                                       (const INT32 *) attribList,
+                                       GL_TRUE, GL_FALSE);
+
+   /*
+    ** Eliminate visuals that don't meet minimum requirements
+    ** Compute a score for those that do
+    ** Remember which visual, if any, got the highest score
+    ** If no visual is acceptable, return None
+    ** Otherwise, create an XVisualInfo list with just the selected X visual
+    ** and return this.
+    */
+   for (modes = psc->visuals; modes != NULL; modes = modes->next) {
+      if (fbconfigs_compatible(&test_config, modes)
+          && ((best_config == NULL)
+              ||
+              (fbconfig_compare
+               ((const __GLcontextModes * const *const) &modes,
+                &best_config) < 0))) {
+         XVisualInfo visualTemplate;
+         XVisualInfo *newList;
+         int i;
+
+         visualTemplate.screen = screen;
+         visualTemplate.visualid = modes->visualID;
+         newList = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask,
+                                  &visualTemplate, &i);
+
+         if (newList) {
+            Xfree(visualList);
+            visualList = newList;
+            best_config = modes;
+         }
+      }
+   }
+
+   return visualList;
+}
+
+
+PUBLIC const char *
+glXQueryExtensionsString(Display * dpy, int screen)
+{
+   __GLXscreenConfigs *psc;
+   __GLXdisplayPrivate *priv;
+
+   if (GetGLXPrivScreenConfig(dpy, screen, &priv, &psc) != Success) {
+      return NULL;
+   }
+
+   if (!psc->effectiveGLXexts) {
+      if (!psc->serverGLXexts) {
+         psc->serverGLXexts =
+            __glXQueryServerString(dpy, priv->majorOpcode, screen,
+                                   GLX_EXTENSIONS);
+      }
+
+      __glXCalculateUsableExtensions(psc,
+#ifdef GLX_DIRECT_RENDERING
+                                     (psc->driScreen != NULL),
+#else
+                                     GL_FALSE,
+#endif
+                                     priv->minorVersion);
+   }
+
+   return psc->effectiveGLXexts;
+}
+
+PUBLIC const char *
+glXGetClientString(Display * dpy, int name)
+{
+   switch (name) {
+   case GLX_VENDOR:
+      return (__glXGLXClientVendorName);
+   case GLX_VERSION:
+      return (__glXGLXClientVersion);
+   case GLX_EXTENSIONS:
+      return (__glXGetClientExtensions());
+   default:
+      return NULL;
+   }
+}
+
+PUBLIC const char *
+glXQueryServerString(Display * dpy, int screen, int name)
+{
+   __GLXscreenConfigs *psc;
+   __GLXdisplayPrivate *priv;
+   const char **str;
+
+
+   if (GetGLXPrivScreenConfig(dpy, screen, &priv, &psc) != Success) {
+      return NULL;
+   }
+
+   switch (name) {
+   case GLX_VENDOR:
+      str = &priv->serverGLXvendor;
+      break;
+   case GLX_VERSION:
+      str = &priv->serverGLXversion;
+      break;
+   case GLX_EXTENSIONS:
+      str = &psc->serverGLXexts;
+      break;
+   default:
+      return NULL;
+   }
+
+   if (*str == NULL) {
+      *str = __glXQueryServerString(dpy, priv->majorOpcode, screen, name);
+   }
+
+   return *str;
+}
+
+void
+__glXClientInfo(Display * dpy, int opcode)
+{
+   char *ext_str = __glXGetClientGLExtensionString();
+   int size = strlen(ext_str) + 1;
+
+#ifdef USE_XCB
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_client_info(c,
+                       GLX_MAJOR_VERSION, GLX_MINOR_VERSION, size, ext_str);
+#else
+   xGLXClientInfoReq *req;
+
+   /* Send the glXClientInfo request */
+   LockDisplay(dpy);
+   GetReq(GLXClientInfo, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXClientInfo;
+   req->major = GLX_MAJOR_VERSION;
+   req->minor = GLX_MINOR_VERSION;
+
+   req->length += (size + 3) >> 2;
+   req->numbytes = size;
+   Data(dpy, ext_str, size);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+#endif /* USE_XCB */
+
+   Xfree(ext_str);
+}
+
+
+/*
+** EXT_import_context
+*/
+
+PUBLIC Display *
+glXGetCurrentDisplay(void)
+{
+   GLXContext gc = __glXGetCurrentContext();
+   if (NULL == gc)
+      return NULL;
+   return gc->currentDpy;
+}
+
+PUBLIC
+GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (),
+          glXGetCurrentDisplay)
+
+/**
+ * Used internally by libGL to send \c xGLXQueryContextinfoExtReq requests
+ * to the X-server.
+ *
+ * \param dpy  Display where \c ctx was created.
+ * \param ctx  Context to query.
+ * \returns  \c Success on success.  \c GLX_BAD_CONTEXT if \c ctx is invalid,
+ *           or zero if the request failed due to internal problems (i.e.,
+ *           unable to allocate temporary memory, etc.)
+ *
+ * \note
+ * This function dynamically determines whether to use the EXT_import_context
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ */
+static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   xGLXQueryContextReply reply;
+   CARD8 opcode;
+   GLuint numValues;
+   int retval;
+
+   if (ctx == NULL) {
+      return GLX_BAD_CONTEXT;
+   }
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return 0;
+   }
+
+   /* Send the glXQueryContextInfoEXT request */
+   LockDisplay(dpy);
+
+   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+      xGLXQueryContextReq *req;
+
+      GetReq(GLXQueryContext, req);
+
+      req->reqType = opcode;
+      req->glxCode = X_GLXQueryContext;
+      req->context = (unsigned int) (ctx->xid);
+   }
+   else {
+      xGLXVendorPrivateReq *vpreq;
+      xGLXQueryContextInfoEXTReq *req;
+
+      GetReqExtra(GLXVendorPrivate,
+                  sz_xGLXQueryContextInfoEXTReq - sz_xGLXVendorPrivateReq,
+                  vpreq);
+      req = (xGLXQueryContextInfoEXTReq *) vpreq;
+      req->reqType = opcode;
+      req->glxCode = X_GLXVendorPrivateWithReply;
+      req->vendorCode = X_GLXvop_QueryContextInfoEXT;
+      req->context = (unsigned int) (ctx->xid);
+   }
+
+   _XReply(dpy, (xReply *) & reply, 0, False);
+
+   numValues = reply.n;
+   if (numValues == 0)
+      retval = Success;
+   else if (numValues > __GLX_MAX_CONTEXT_PROPS)
+      retval = 0;
+   else {
+      int *propList, *pProp;
+      int nPropListBytes;
+      int i;
+
+      nPropListBytes = numValues << 3;
+      propList = (int *) Xmalloc(nPropListBytes);
+      if (NULL == propList) {
+         retval = 0;
+      }
+      else {
+         _XRead(dpy, (char *) propList, nPropListBytes);
+         pProp = propList;
+         for (i = 0; i < numValues; i++) {
+            switch (*pProp++) {
+            case GLX_SHARE_CONTEXT_EXT:
+               ctx->share_xid = *pProp++;
+               break;
+            case GLX_VISUAL_ID_EXT:
+               ctx->mode =
+                  _gl_context_modes_find_visual(ctx->psc->visuals, *pProp++);
+               break;
+            case GLX_SCREEN:
+               ctx->screen = *pProp++;
+               break;
+            case GLX_FBCONFIG_ID:
+               ctx->mode =
+                  _gl_context_modes_find_fbconfig(ctx->psc->configs,
+                                                  *pProp++);
+               break;
+            case GLX_RENDER_TYPE:
+               ctx->renderType = *pProp++;
+               break;
+            default:
+               pProp++;
+               continue;
+            }
+         }
+         Xfree((char *) propList);
+         retval = Success;
+      }
+   }
+   UnlockDisplay(dpy);
+   SyncHandle();
+   return retval;
+}
+
+PUBLIC int
+glXQueryContext(Display * dpy, GLXContext ctx, int attribute, int *value)
+{
+   int retVal;
+
+   /* get the information from the server if we don't have it already */
+#ifdef GLX_DIRECT_RENDERING
+   if (!ctx->driContext && (ctx->mode == NULL)) {
+#else
+   if (ctx->mode == NULL) {
+#endif
+      retVal = __glXQueryContextInfo(dpy, ctx);
+      if (Success != retVal)
+         return retVal;
+   }
+   switch (attribute) {
+   case GLX_SHARE_CONTEXT_EXT:
+      *value = (int) (ctx->share_xid);
+      break;
+   case GLX_VISUAL_ID_EXT:
+      *value = ctx->mode ? ctx->mode->visualID : None;
+      break;
+   case GLX_SCREEN:
+      *value = (int) (ctx->screen);
+      break;
+   case GLX_FBCONFIG_ID:
+      *value = ctx->mode ? ctx->mode->fbconfigID : None;
+      break;
+   case GLX_RENDER_TYPE:
+      *value = (int) (ctx->renderType);
+      break;
+   default:
+      return GLX_BAD_ATTRIBUTE;
+   }
+   return Success;
+}
+
+PUBLIC
+GLX_ALIAS(int, glXQueryContextInfoEXT,
+          (Display * dpy, GLXContext ctx, int attribute, int *value),
+          (dpy, ctx, attribute, value), glXQueryContext)
+
+PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx)
+{
+   return ctx->xid;
+}
+
+PUBLIC GLXContext
+glXImportContextEXT(Display * dpy, GLXContextID contextID)
+{
+   GLXContext ctx;
+
+   if (contextID == None) {
+      return NULL;
+   }
+   if (__glXIsDirect(dpy, contextID)) {
+      return NULL;
+   }
+
+   ctx = CreateContext(dpy, NULL, NULL, NULL, False, contextID, False, 0);
+   if (NULL != ctx) {
+      if (Success != __glXQueryContextInfo(dpy, ctx)) {
+         return NULL;
+      }
+   }
+   return ctx;
+}
+
+PUBLIC void
+glXFreeContextEXT(Display * dpy, GLXContext ctx)
+{
+   DestroyContext(dpy, ctx);
+}
+
+
+
+/*
+ * GLX 1.3 functions - these are just stubs for now!
+ */
+
+PUBLIC GLXFBConfig *
+glXChooseFBConfig(Display * dpy, int screen,
+                  const int *attribList, int *nitems)
+{
+   __GLcontextModes **config_list;
+   int list_size;
+
+
+   config_list = (__GLcontextModes **)
+      glXGetFBConfigs(dpy, screen, &list_size);
+
+   if ((config_list != NULL) && (list_size > 0) && (attribList != NULL)) {
+      list_size = choose_visual(config_list, list_size, attribList, GL_TRUE);
+      if (list_size == 0) {
+         XFree(config_list);
+         config_list = NULL;
+      }
+   }
+
+   *nitems = list_size;
+   return (GLXFBConfig *) config_list;
+}
+
+
+PUBLIC GLXContext
+glXCreateNewContext(Display * dpy, GLXFBConfig config,
+                    int renderType, GLXContext shareList, Bool allowDirect)
+{
+   return CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList,
+                        allowDirect, None, True, renderType);
+}
+
+
+PUBLIC GLXDrawable
+glXGetCurrentReadDrawable(void)
+{
+   GLXContext gc = __glXGetCurrentContext();
+   return gc->currentReadable;
+}
+
+
+PUBLIC GLXFBConfig *
+glXGetFBConfigs(Display * dpy, int screen, int *nelements)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   __GLcontextModes **config = NULL;
+   int i;
+
+   *nelements = 0;
+   if (priv && (priv->screenConfigs != NULL)
+       && (screen >= 0) && (screen <= ScreenCount(dpy))
+       && (priv->screenConfigs[screen].configs != NULL)
+       && (priv->screenConfigs[screen].configs->fbconfigID != GLX_DONT_CARE)) {
+      unsigned num_configs = 0;
+      __GLcontextModes *modes;
+
+
+      for (modes = priv->screenConfigs[screen].configs; modes != NULL;
+           modes = modes->next) {
+         if (modes->fbconfigID != GLX_DONT_CARE) {
+            num_configs++;
+         }
+      }
+
+      config = (__GLcontextModes **) Xmalloc(sizeof(__GLcontextModes *)
+                                             * num_configs);
+      if (config != NULL) {
+         *nelements = num_configs;
+         i = 0;
+         for (modes = priv->screenConfigs[screen].configs; modes != NULL;
+              modes = modes->next) {
+            if (modes->fbconfigID != GLX_DONT_CARE) {
+               config[i] = modes;
+               i++;
+            }
+         }
+      }
+   }
+   return (GLXFBConfig *) config;
+}
+
+
+PUBLIC int
+glXGetFBConfigAttrib(Display * dpy, GLXFBConfig config,
+                     int attribute, int *value)
+{
+   __GLcontextModes *const modes = ValidateGLXFBConfig(dpy, config);
+
+   return (modes != NULL)
+      ? _gl_get_context_mode_data(modes, attribute, value)
+      : GLXBadFBConfig;
+}
+
+
+PUBLIC XVisualInfo *
+glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config)
+{
+   XVisualInfo visualTemplate;
+   __GLcontextModes *fbconfig = (__GLcontextModes *) config;
+   int count;
+
+   /*
+    ** Get a list of all visuals, return if list is empty
+    */
+   visualTemplate.visualid = fbconfig->visualID;
+   return XGetVisualInfo(dpy, VisualIDMask, &visualTemplate, &count);
+}
+
+
+/*
+** GLX_SGI_swap_control
+*/
+static int
+__glXSwapIntervalSGI(int interval)
+{
+   xGLXVendorPrivateReq *req;
+   GLXContext gc = __glXGetCurrentContext();
+   __GLXscreenConfigs *psc;
+   Display *dpy;
+   CARD32 *interval_ptr;
+   CARD8 opcode;
+
+   if (gc == NULL) {
+      return GLX_BAD_CONTEXT;
+   }
+
+   if (interval <= 0) {
+      return GLX_BAD_VALUE;
+   }
+
+#ifdef __DRI_SWAP_CONTROL
+   if (gc->driContext) {
+      __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
+                                                           gc->screen );
+      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
+                                                 gc->currentDrawable,
+                                                 NULL);
+      if (psc->swapControl != NULL && pdraw != NULL) {
+        psc->swapControl->setSwapInterval(pdraw->driDrawable, interval);
+        return 0;
+      }
+      else if (pdraw == NULL) {
+        return GLX_BAD_CONTEXT;
+      }
+   }
+#endif
+   psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
+
+   if (gc->driContext && psc->driScreen && psc->driScreen->setSwapInterval) {
+      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
+                                                 gc->currentDrawable,
+                                                 NULL);
+      psc->driScreen->setSwapInterval(pdraw, interval);
+      return 0;
+   }
+
+   dpy = gc->currentDpy;
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+      return 0;
+   }
+
+   /* Send the glXSwapIntervalSGI request */
+   LockDisplay(dpy);
+   GetReqExtra(GLXVendorPrivate, sizeof(CARD32), req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXVendorPrivate;
+   req->vendorCode = X_GLXvop_SwapIntervalSGI;
+   req->contextTag = gc->currentContextTag;
+
+   interval_ptr = (CARD32 *) (req + 1);
+   *interval_ptr = interval;
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+   XFlush(dpy);
+
+   return 0;
+}
+
+
+/*
+** GLX_MESA_swap_control
+*/
+static int
+__glXSwapIntervalMESA(unsigned int interval)
+{
+   GLXContext gc = __glXGetCurrentContext();
+
+   if (interval < 0) {
+      return GLX_BAD_VALUE;
+   }
+
+#ifdef __DRI_SWAP_CONTROL
+   if (gc != NULL && gc->driContext) {
+      __GLXscreenConfigs *const psc = GetGLXScreenConfigs(gc->currentDpy,
+                                                          gc->screen);
+
+      if ((psc != NULL) && (psc->driScreen != NULL)) {
+         __GLXDRIdrawable *pdraw =
+            GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+         if (psc->swapControl != NULL && pdraw != NULL) {
+            psc->swapControl->setSwapInterval(pdraw->driDrawable, interval);
+            return 0;
+         }
+      }
+   }
+#endif
+
+   if (gc != NULL && gc->driContext) {
+      __GLXscreenConfigs *psc;
+
+      psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
+      if (psc->driScreen && psc->driScreen->setSwapInterval) {
+         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
+                                                    gc->currentDrawable, NULL);
+        psc->driScreen->setSwapInterval(pdraw, interval);
+        return 0;
+      }
+   }
+
+   return GLX_BAD_CONTEXT;
+}
+
+
+static int
+__glXGetSwapIntervalMESA(void)
+{
+#ifdef __DRI_SWAP_CONTROL
+   GLXContext gc = __glXGetCurrentContext();
+
+   if (gc != NULL && gc->driContext) {
+      __GLXscreenConfigs *const psc = GetGLXScreenConfigs(gc->currentDpy,
+                                                          gc->screen);
+
+      if ((psc != NULL) && (psc->driScreen != NULL)) {
+         __GLXDRIdrawable *pdraw =
+            GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+         if (psc->swapControl != NULL && pdraw != NULL) {
+            return psc->swapControl->getSwapInterval(pdraw->driDrawable);
+         }
+      }
+   }
+#endif
+   if (gc != NULL && gc->driContext) {
+      __GLXscreenConfigs *psc;
+
+      psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
+      if (psc->driScreen && psc->driScreen->getSwapInterval) {
+         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
+                                                    gc->currentDrawable, NULL);
+        return psc->driScreen->getSwapInterval(pdraw);
+      }
+   }
+
+   return 0;
+}
+
+
+/*
+** GLX_MESA_swap_frame_usage
+*/
+
+static GLint
+__glXBeginFrameTrackingMESA(Display * dpy, GLXDrawable drawable)
+{
+   int status = GLX_BAD_CONTEXT;
+#ifdef __DRI_FRAME_TRACKING
+   int screen = 0;
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+
+   if (pdraw != NULL && psc->frameTracking != NULL)
+      status = psc->frameTracking->frameTracking(pdraw->driDrawable, GL_TRUE);
+#else
+   (void) dpy;
+   (void) drawable;
+#endif
+   return status;
+}
+
+
+static GLint
+__glXEndFrameTrackingMESA(Display * dpy, GLXDrawable drawable)
+{
+   int status = GLX_BAD_CONTEXT;
+#ifdef __DRI_FRAME_TRACKING
+   int screen = 0;
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   __GLXscreenConfigs *psc = GetGLXScreenConfigs(dpy, screen);
+
+   if (pdraw != NULL && psc->frameTracking != NULL)
+      status = psc->frameTracking->frameTracking(pdraw->driDrawable,
+                                                 GL_FALSE);
+#else
+   (void) dpy;
+   (void) drawable;
+#endif
+   return status;
+}
+
+
+static GLint
+__glXGetFrameUsageMESA(Display * dpy, GLXDrawable drawable, GLfloat * usage)
+{
+   int status = GLX_BAD_CONTEXT;
+#ifdef __DRI_FRAME_TRACKING
+   int screen = 0;
+   __GLXDRIdrawable *const pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+
+   if (pdraw != NULL && psc->frameTracking != NULL) {
+      int64_t sbc, missedFrames;
+      float lastMissedUsage;
+
+      status = psc->frameTracking->queryFrameTracking(pdraw->driDrawable,
+                                                      &sbc,
+                                                      &missedFrames,
+                                                      &lastMissedUsage,
+                                                      usage);
+   }
+#else
+   (void) dpy;
+   (void) drawable;
+   (void) usage;
+#endif
+   return status;
+}
+
+
+static GLint
+__glXQueryFrameTrackingMESA(Display * dpy, GLXDrawable drawable,
+                            int64_t * sbc, int64_t * missedFrames,
+                            GLfloat * lastMissedUsage)
+{
+   int status = GLX_BAD_CONTEXT;
+#ifdef __DRI_FRAME_TRACKING
+   int screen = 0;
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+
+   if (pdraw != NULL && psc->frameTracking != NULL) {
+      float usage;
+
+      status = psc->frameTracking->queryFrameTracking(pdraw->driDrawable,
+                                                      sbc, missedFrames,
+                                                      lastMissedUsage,
+                                                      &usage);
+   }
+#else
+   (void) dpy;
+   (void) drawable;
+   (void) sbc;
+   (void) missedFrames;
+   (void) lastMissedUsage;
+#endif
+   return status;
+}
+
+
+/*
+** GLX_SGI_video_sync
+*/
+static int
+__glXGetVideoSyncSGI(unsigned int *count)
+{
+   int64_t ust, msc, sbc;
+   int ret;
+   GLXContext gc = __glXGetCurrentContext();
+   __GLXscreenConfigs *psc;
+   __GLXDRIdrawable *pdraw;
+
+   if (!gc || !gc->driContext)
+      return GLX_BAD_CONTEXT;
+
+   psc = GetGLXScreenConfigs(gc->currentDpy, gc->screen);
+   pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+
+   /* FIXME: Looking at the GLX_SGI_video_sync spec in the extension registry,
+    * FIXME: there should be a GLX encoding for this call.  I can find no
+    * FIXME: documentation for the GLX encoding.
+    */
+#ifdef __DRI_MEDIA_STREAM_COUNTER
+   if ( psc->msc && psc->driScreen ) {
+      ret = (*psc->msc->getDrawableMSC)(psc->__driScreen,
+                                       pdraw->driDrawable, &msc);
+      *count = (unsigned) msc;
+
+      return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
+   }
+#endif
+   if (psc->driScreen && psc->driScreen->getDrawableMSC) {
+      ret = psc->driScreen->getDrawableMSC(psc, pdraw, &ust, &msc, &sbc);
+      *count = (unsigned) msc;
+      return (ret == True) ? 0 : GLX_BAD_CONTEXT;
+   }
+
+   return GLX_BAD_CONTEXT;
+}
+
+static int
+__glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
+{
+   GLXContext gc = __glXGetCurrentContext();
+   __GLXscreenConfigs *psc;
+   __GLXDRIdrawable *pdraw;
+   int64_t ust, msc, sbc;
+   int ret;
+
+   if (divisor <= 0 || remainder < 0)
+      return GLX_BAD_VALUE;
+
+   if (!gc || !gc->driContext)
+      return GLX_BAD_CONTEXT;
+
+   psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
+   pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
+
+#ifdef __DRI_MEDIA_STREAM_COUNTER
+   if (psc->msc != NULL && psc->driScreen ) {
+      ret = (*psc->msc->waitForMSC)(pdraw->driDrawable, 0,
+                                   divisor, remainder, &msc, &sbc);
+      *count = (unsigned) msc;
+      return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
+   }
+#endif
+   if (psc->driScreen && psc->driScreen->waitForMSC) {
+      ret = psc->driScreen->waitForMSC(pdraw, 0, divisor, remainder, &ust, &msc,
+                                      &sbc);
+      *count = (unsigned) msc;
+      return (ret == True) ? 0 : GLX_BAD_CONTEXT;
+   }
+
+   return GLX_BAD_CONTEXT;
+}
+
+
+/*
+** GLX_SGIX_fbconfig
+** Many of these functions are aliased to GLX 1.3 entry points in the 
+** GLX_functions table.
+*/
+
+PUBLIC
+GLX_ALIAS(int, glXGetFBConfigAttribSGIX,
+          (Display * dpy, GLXFBConfigSGIX config, int attribute, int *value),
+          (dpy, config, attribute, value), glXGetFBConfigAttrib)
+
+PUBLIC GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX,
+                 (Display * dpy, int screen, int *attrib_list,
+                  int *nelements), (dpy, screen, attrib_list, nelements),
+                 glXChooseFBConfig)
+
+PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX,
+                 (Display * dpy, GLXFBConfigSGIX config),
+                 (dpy, config), glXGetVisualFromFBConfig)
+
+PUBLIC GLXPixmap
+glXCreateGLXPixmapWithConfigSGIX(Display * dpy,
+                                 GLXFBConfigSGIX config,
+                                 Pixmap pixmap)
+{
+   xGLXVendorPrivateWithReplyReq *vpreq;
+   xGLXCreateGLXPixmapWithConfigSGIXReq *req;
+   GLXPixmap xid = None;
+   CARD8 opcode;
+   const __GLcontextModes *const fbconfig = (__GLcontextModes *) config;
+   __GLXscreenConfigs *psc;
+
+
+   if ((dpy == NULL) || (config == NULL)) {
+      return None;
+   }
+
+   psc = GetGLXScreenConfigs(dpy, fbconfig->screen);
+   if ((psc != NULL)
+       && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) {
+      opcode = __glXSetupForCommand(dpy);
+      if (!opcode) {
+         return None;
+      }
+
+      /* Send the glXCreateGLXPixmapWithConfigSGIX request */
+      LockDisplay(dpy);
+      GetReqExtra(GLXVendorPrivateWithReply,
+                  sz_xGLXCreateGLXPixmapWithConfigSGIXReq -
+                  sz_xGLXVendorPrivateWithReplyReq, vpreq);
+      req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) vpreq;
+      req->reqType = opcode;
+      req->glxCode = X_GLXVendorPrivateWithReply;
+      req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
+      req->screen = fbconfig->screen;
+      req->fbconfig = fbconfig->fbconfigID;
+      req->pixmap = pixmap;
+      req->glxpixmap = xid = XAllocID(dpy);
+      UnlockDisplay(dpy);
+      SyncHandle();
+   }
+
+   return xid;
+}
+
+PUBLIC GLXContext
+glXCreateContextWithConfigSGIX(Display * dpy,
+                               GLXFBConfigSGIX config, int renderType,
+                               GLXContext shareList, Bool allowDirect)
+{
+   GLXContext gc = NULL;
+   const __GLcontextModes *const fbconfig = (__GLcontextModes *) config;
+   __GLXscreenConfigs *psc;
+
+
+   if ((dpy == NULL) || (config == NULL)) {
+      return None;
+   }
+
+   psc = GetGLXScreenConfigs(dpy, fbconfig->screen);
+   if ((psc != NULL)
+       && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) {
+      gc = CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList,
+                         allowDirect, None, False, renderType);
+   }
+
+   return gc;
+}
+
+
+PUBLIC GLXFBConfigSGIX
+glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis)
+{
+   __GLXdisplayPrivate *priv;
+   __GLXscreenConfigs *psc = NULL;
+
+   if ((GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc) != Success)
+       && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)
+       && (psc->configs->fbconfigID != GLX_DONT_CARE)) {
+      return (GLXFBConfigSGIX) _gl_context_modes_find_visual(psc->configs,
+                                                             vis->visualid);
+   }
+
+   return NULL;
+}
+
+
+/*
+** GLX_SGIX_swap_group
+*/
+static void
+__glXJoinSwapGroupSGIX(Display * dpy, GLXDrawable drawable,
+                       GLXDrawable member)
+{
+   (void) dpy;
+   (void) drawable;
+   (void) member;
+}
+
+
+/*
+** GLX_SGIX_swap_barrier
+*/
+static void
+__glXBindSwapBarrierSGIX(Display * dpy, GLXDrawable drawable, int barrier)
+{
+   (void) dpy;
+   (void) drawable;
+   (void) barrier;
+}
+
+static Bool
+__glXQueryMaxSwapBarriersSGIX(Display * dpy, int screen, int *max)
+{
+   (void) dpy;
+   (void) screen;
+   (void) max;
+   return False;
+}
+
+
+/*
+** GLX_OML_sync_control
+*/
+static Bool
+__glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
+                      int64_t * ust, int64_t * msc, int64_t * sbc)
+{
+   __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
+   int i, ret;
+   __GLXDRIdrawable *pdraw;
+   __GLXscreenConfigs *psc;
+
+   if (!priv)
+      return False;
+
+   pdraw = GetGLXDRIDrawable(dpy, drawable, &i);
+   psc = &priv->screenConfigs[i];
+
+#if defined(__DRI_SWAP_BUFFER_COUNTER) && defined(__DRI_MEDIA_STREAM_COUNTER)
+   if (pdraw && psc->sbc && psc->sbc)
+      return ( (pdraw && psc->sbc && psc->msc)
+              && ((*psc->msc->getMSC)(psc->driScreen, msc) == 0)
+              && ((*psc->sbc->getSBC)(pdraw->driDrawable, sbc) == 0)
+              && (__glXGetUST(ust) == 0) );
+#endif
+   if (pdraw && psc && psc->driScreen && psc->driScreen->getDrawableMSC) {
+      ret = psc->driScreen->getDrawableMSC(psc, pdraw, ust, msc, sbc);
+      return ret;
+   }
+
+   return False;
+}
+
+#ifdef GLX_DIRECT_RENDERING
+_X_HIDDEN GLboolean
+__driGetMscRateOML(__DRIdrawable * draw,
+                   int32_t * numerator, int32_t * denominator, void *private)
+{
+#ifdef XF86VIDMODE
+   __GLXscreenConfigs *psc;
+   XF86VidModeModeLine mode_line;
+   int dot_clock;
+   int i;
+   __GLXDRIdrawable *glxDraw = private;
+
+   psc = glxDraw->psc;
+   if (XF86VidModeQueryVersion(psc->dpy, &i, &i) &&
+       XF86VidModeGetModeLine(psc->dpy, psc->scr, &dot_clock, &mode_line)) {
+      unsigned n = dot_clock * 1000;
+      unsigned d = mode_line.vtotal * mode_line.htotal;
+
+# define V_INTERLACE 0x010
+# define V_DBLSCAN   0x020
+
+      if (mode_line.flags & V_INTERLACE)
+         n *= 2;
+      else if (mode_line.flags & V_DBLSCAN)
+         d *= 2;
+
+      /* The OML_sync_control spec requires that if the refresh rate is a
+       * whole number, that the returned numerator be equal to the refresh
+       * rate and the denominator be 1.
+       */
+
+      if (n % d == 0) {
+         n /= d;
+         d = 1;
+      }
+      else {
+         static const unsigned f[] = { 13, 11, 7, 5, 3, 2, 0 };
+
+         /* This is a poor man's way to reduce a fraction.  It's far from
+          * perfect, but it will work well enough for this situation.
+          */
+
+         for (i = 0; f[i] != 0; i++) {
+            while (n % f[i] == 0 && d % f[i] == 0) {
+               d /= f[i];
+               n /= f[i];
+            }
+         }
+      }
+
+      *numerator = n;
+      *denominator = d;
+
+      return True;
+   }
+   else
+      return False;
+#else
+   return False;
+#endif
+}
+#endif
+
+/**
+ * Determine the refresh rate of the specified drawable and display.
+ *
+ * \param dpy          Display whose refresh rate is to be determined.
+ * \param drawable     Drawable whose refresh rate is to be determined.
+ * \param numerator    Numerator of the refresh rate.
+ * \param demoninator  Denominator of the refresh rate.
+ * \return  If the refresh rate for the specified display and drawable could
+ *          be calculated, True is returned.  Otherwise False is returned.
+ *
+ * \note This function is implemented entirely client-side.  A lot of other
+ *       functionality is required to export GLX_OML_sync_control, so on
+ *       XFree86 this function can be called for direct-rendering contexts
+ *       when GLX_OML_sync_control appears in the client extension string.
+ */
+
+_X_HIDDEN GLboolean
+__glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
+                   int32_t * numerator, int32_t * denominator)
+{
+#if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
+   __GLXDRIdrawable *draw = GetGLXDRIDrawable(dpy, drawable, NULL);
+
+   if (draw == NULL)
+      return False;
+
+   return __driGetMscRateOML(draw->driDrawable, numerator, denominator, draw);
+#else
+   (void) dpy;
+   (void) drawable;
+   (void) numerator;
+   (void) denominator;
+#endif
+   return False;
+}
+
+
+static int64_t
+__glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
+                       int64_t target_msc, int64_t divisor, int64_t remainder)
+{
+   GLXContext gc = __glXGetCurrentContext();
+   int screen;
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+
+   if (!pdraw || !gc->driContext) /* no GLX for this */
+      return -1;
+
+   /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
+    * error", but it also says "It [glXSwapBuffersMscOML] will return a value
+    * of -1 if the function failed because of errors detected in the input
+    * parameters"
+    */
+   if (divisor < 0 || remainder < 0 || target_msc < 0)
+      return -1;
+   if (divisor > 0 && remainder >= divisor)
+      return -1;
+
+#ifdef __DRI_SWAP_BUFFER_COUNTER
+   if (psc->counters != NULL)
+      return (*psc->sbc->swapBuffersMSC)(pdraw->driDrawable, target_msc,
+                                        divisor, remainder);
+#endif
+
+#ifdef GLX_DIRECT_RENDERING
+   if (psc->driScreen && psc->driScreen->swapBuffers)
+      return (*psc->driScreen->swapBuffers)(pdraw, target_msc, divisor,
+                                           remainder);
+#endif
+
+   return -1;
+}
+
+
+static Bool
+__glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
+                   int64_t target_msc, int64_t divisor,
+                   int64_t remainder, int64_t * ust,
+                   int64_t * msc, int64_t * sbc)
+{
+   int screen;
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
+   int ret;
+
+   fprintf(stderr, "waitmsc: %lld, %lld, %lld\n", target_msc, divisor,
+          remainder);
+
+   /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
+    * error", but the return type in the spec is Bool.
+    */
+   if (divisor < 0 || remainder < 0 || target_msc < 0)
+      return False;
+   if (divisor > 0 && remainder >= divisor)
+      return False;
+
+#ifdef __DRI_MEDIA_STREAM_COUNTER
+   if (pdraw != NULL && psc->msc != NULL) {
+      fprintf(stderr, "dri1 msc\n");
+      ret = (*psc->msc->waitForMSC) (pdraw->driDrawable, target_msc,
+                                     divisor, remainder, msc, sbc);
+
+      /* __glXGetUST returns zero on success and non-zero on failure.
+       * This function returns True on success and False on failure.
+       */
+      return ((ret == 0) && (__glXGetUST(ust) == 0));
+   }
+#endif
+   if (pdraw && psc->driScreen && psc->driScreen->waitForMSC) {
+      ret = psc->driScreen->waitForMSC(pdraw, target_msc, divisor, remainder,
+                                      ust, msc, sbc);
+      return ret;
+   }
+
+   fprintf(stderr, "no drawable??\n");
+   return False;
+}
+
+
+static Bool
+__glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
+                   int64_t target_sbc, int64_t * ust,
+                   int64_t * msc, int64_t * sbc)
+{
+   int screen;
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+   int ret;
+
+   /* The OML_sync_control spec says this should "generate a GLX_BAD_VALUE
+    * error", but the return type in the spec is Bool.
+    */
+   if (target_sbc < 0)
+      return False;
+#ifdef __DRI_SWAP_BUFFER_COUNTER
+   if (pdraw != NULL && psc->sbc != NULL) {
+      ret =
+         (*psc->sbc->waitForSBC) (pdraw->driDrawable, target_sbc, msc, sbc);
+
+      /* __glXGetUST returns zero on success and non-zero on failure.
+       * This function returns True on success and False on failure.
+       */
+      return ((ret == 0) && (__glXGetUST(ust) == 0));
+   }
+#endif
+   if (pdraw && psc->driScreen && psc->driScreen->waitForMSC) {
+      ret = psc->driScreen->waitForSBC(pdraw, target_sbc, ust, msc, sbc);
+      return ret;
+   }
+   return False;
+}
+
+
+/**
+ * GLX_MESA_allocate_memory
+ */
+/*@{*/
+
+PUBLIC void *
+glXAllocateMemoryMESA(Display * dpy, int scrn,
+                      size_t size, float readFreq,
+                      float writeFreq, float priority)
+{
+#ifdef __DRI_ALLOCATE
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
+
+   if (psc && psc->allocate)
+      return (*psc->allocate->allocateMemory) (psc->__driScreen, size,
+                                               readFreq, writeFreq, priority);
+
+#else
+   (void) dpy;
+   (void) scrn;
+   (void) size;
+   (void) readFreq;
+   (void) writeFreq;
+   (void) priority;
+#endif /* __DRI_ALLOCATE */
+
+   return NULL;
+}
+
+
+PUBLIC void
+glXFreeMemoryMESA(Display * dpy, int scrn, void *pointer)
+{
+#ifdef __DRI_ALLOCATE
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
+
+   if (psc && psc->allocate)
+      (*psc->allocate->freeMemory) (psc->__driScreen, pointer);
+
+#else
+   (void) dpy;
+   (void) scrn;
+   (void) pointer;
+#endif /* __DRI_ALLOCATE */
+}
+
+
+PUBLIC GLuint
+glXGetMemoryOffsetMESA(Display * dpy, int scrn, const void *pointer)
+{
+#ifdef __DRI_ALLOCATE
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
+
+   if (psc && psc->allocate)
+      return (*psc->allocate->memoryOffset) (psc->__driScreen, pointer);
+
+#else
+   (void) dpy;
+   (void) scrn;
+   (void) pointer;
+#endif /* GLX_DIRECT_RENDERING */
+
+   return ~0L;
+}
+
+/*@}*/
+
+
+/**
+ * Mesa extension stubs.  These will help reduce portability problems.
+ */
+/*@{*/
+
+/**
+ * Release all buffers associated with the specified GLX drawable.
+ *
+ * \todo
+ * This function was intended for stand-alone Mesa.  The issue there is that
+ * the library doesn't get any notification when a window is closed.  In
+ * DRI there is a similar but slightly different issue.  When GLX 1.3 is
+ * supported, there are 3 different functions to destroy a drawable.  It
+ * should be possible to create GLX protocol (or have it determine which
+ * protocol to use based on the type of the drawable) to have one function
+ * do the work of 3.  For the direct-rendering case, this function could
+ * just call the driver's \c __DRIdrawableRec::destroyDrawable function.
+ * This would reduce the frequency with which \c __driGarbageCollectDrawables
+ * would need to be used.  This really should be done as part of the new DRI
+ * interface work.
+ *
+ * \sa http://oss.sgi.com/projects/ogl-sample/registry/MESA/release_buffers.txt
+ *     __driGarbageCollectDrawables
+ *     glXDestroyGLXPixmap
+ *     glXDestroyPbuffer glXDestroyPixmap glXDestroyWindow
+ *     glXDestroyGLXPbufferSGIX glXDestroyGLXVideoSourceSGIX
+ */
+static Bool
+__glXReleaseBuffersMESA(Display * dpy, GLXDrawable d)
+{
+   (void) dpy;
+   (void) d;
+   return False;
+}
+
+
+PUBLIC GLXPixmap
+glXCreateGLXPixmapMESA(Display * dpy, XVisualInfo * visual,
+                       Pixmap pixmap, Colormap cmap)
+{
+   (void) dpy;
+   (void) visual;
+   (void) pixmap;
+   (void) cmap;
+   return 0;
+}
+
+/*@}*/
+
+
+/**
+ * GLX_MESA_copy_sub_buffer
+ */
+#define X_GLXvop_CopySubBufferMESA 5154 /* temporary */
+static void
+__glXCopySubBufferMESA(Display * dpy, GLXDrawable drawable,
+                       int x, int y, int width, int height)
+{
+   xGLXVendorPrivateReq *req;
+   GLXContext gc;
+   GLXContextTag tag;
+   CARD32 *drawable_ptr;
+   INT32 *x_ptr, *y_ptr, *w_ptr, *h_ptr;
+   CARD8 opcode;
+
+#ifdef __DRI_COPY_SUB_BUFFER
+   int screen;
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+   if (pdraw != NULL) {
+      __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+      if (psc->driScreen->copySubBuffer != NULL) {
+         glFlush();
+         (*psc->driScreen->copySubBuffer) (pdraw, x, y, width, height);
+      }
+
+      return;
+   }
+#endif
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   /*
+    ** The calling thread may or may not have a current context.  If it
+    ** does, send the context tag so the server can do a flush.
+    */
+   gc = __glXGetCurrentContext();
+   if ((gc != NULL) && (dpy == gc->currentDpy) &&
+       ((drawable == gc->currentDrawable) ||
+        (drawable == gc->currentReadable))) {
+      tag = gc->currentContextTag;
+   }
+   else {
+      tag = 0;
+   }
+
+   LockDisplay(dpy);
+   GetReqExtra(GLXVendorPrivate, sizeof(CARD32) + sizeof(INT32) * 4, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXVendorPrivate;
+   req->vendorCode = X_GLXvop_CopySubBufferMESA;
+   req->contextTag = tag;
+
+   drawable_ptr = (CARD32 *) (req + 1);
+   x_ptr = (INT32 *) (drawable_ptr + 1);
+   y_ptr = (INT32 *) (drawable_ptr + 2);
+   w_ptr = (INT32 *) (drawable_ptr + 3);
+   h_ptr = (INT32 *) (drawable_ptr + 4);
+
+   *drawable_ptr = drawable;
+   *x_ptr = x;
+   *y_ptr = y;
+   *w_ptr = width;
+   *h_ptr = height;
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+
+/**
+ * GLX_EXT_texture_from_pixmap
+ */
+/*@{*/
+static void
+__glXBindTexImageEXT(Display * dpy,
+                     GLXDrawable drawable, int buffer, const int *attrib_list)
+{
+   xGLXVendorPrivateReq *req;
+   GLXContext gc = __glXGetCurrentContext();
+   CARD32 *drawable_ptr;
+   INT32 *buffer_ptr;
+   CARD32 *num_attrib_ptr;
+   CARD32 *attrib_ptr;
+   CARD8 opcode;
+   unsigned int i;
+
+   if (gc == NULL)
+      return;
+
+   i = 0;
+   if (attrib_list) {
+      while (attrib_list[i * 2] != None)
+         i++;
+   }
+
+#ifdef GLX_DIRECT_RENDERING
+   if (gc->driContext) {
+      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+
+      if (pdraw != NULL) {
+         if (pdraw->psc->texBuffer->base.version >= 2 &&
+             pdraw->psc->texBuffer->setTexBuffer2 != NULL) {
+            (*pdraw->psc->texBuffer->setTexBuffer2) (gc->__driContext,
+                                                     pdraw->textureTarget,
+                                                     pdraw->textureFormat,
+                                                     pdraw->driDrawable);
+         }
+         else {
+            (*pdraw->psc->texBuffer->setTexBuffer) (gc->__driContext,
+                                                    pdraw->textureTarget,
+                                                    pdraw->driDrawable);
+         }
+      }
+      return;
+   }
+#endif
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+   GetReqExtra(GLXVendorPrivate, 12 + 8 * i, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXVendorPrivate;
+   req->vendorCode = X_GLXvop_BindTexImageEXT;
+   req->contextTag = gc->currentContextTag;
+
+   drawable_ptr = (CARD32 *) (req + 1);
+   buffer_ptr = (INT32 *) (drawable_ptr + 1);
+   num_attrib_ptr = (CARD32 *) (buffer_ptr + 1);
+   attrib_ptr = (CARD32 *) (num_attrib_ptr + 1);
+
+   *drawable_ptr = drawable;
+   *buffer_ptr = buffer;
+   *num_attrib_ptr = (CARD32) i;
+
+   i = 0;
+   if (attrib_list) {
+      while (attrib_list[i * 2] != None) {
+         *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 0];
+         *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 1];
+         i++;
+      }
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+static void
+__glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
+{
+   xGLXVendorPrivateReq *req;
+   GLXContext gc = __glXGetCurrentContext();
+   CARD32 *drawable_ptr;
+   INT32 *buffer_ptr;
+   CARD8 opcode;
+
+   if (gc == NULL)
+      return;
+
+#ifdef GLX_DIRECT_RENDERING
+   if (gc->driContext)
+      return;
+#endif
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+   GetReqExtra(GLXVendorPrivate, sizeof(CARD32) + sizeof(INT32), req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXVendorPrivate;
+   req->vendorCode = X_GLXvop_ReleaseTexImageEXT;
+   req->contextTag = gc->currentContextTag;
+
+   drawable_ptr = (CARD32 *) (req + 1);
+   buffer_ptr = (INT32 *) (drawable_ptr + 1);
+
+   *drawable_ptr = drawable;
+   *buffer_ptr = buffer;
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+/*@}*/
+
+/**
+ * \c strdup is actually not a standard ANSI C or POSIX routine.
+ * Irix will not define it if ANSI mode is in effect.
+ *
+ * \sa strdup
+ */
+_X_HIDDEN char *
+__glXstrdup(const char *str)
+{
+   char *copy;
+   copy = (char *) Xmalloc(strlen(str) + 1);
+   if (!copy)
+      return NULL;
+   strcpy(copy, str);
+   return copy;
+}
+
+/*
+** glXGetProcAddress support
+*/
+
+struct name_address_pair
+{
+   const char *Name;
+   GLvoid *Address;
+};
+
+#define GLX_FUNCTION(f) { # f, (GLvoid *) f }
+#define GLX_FUNCTION2(n,f) { # n, (GLvoid *) f }
+
+static const struct name_address_pair GLX_functions[] = {
+   /*** GLX_VERSION_1_0 ***/
+   GLX_FUNCTION(glXChooseVisual),
+   GLX_FUNCTION(glXCopyContext),
+   GLX_FUNCTION(glXCreateContext),
+   GLX_FUNCTION(glXCreateGLXPixmap),
+   GLX_FUNCTION(glXDestroyContext),
+   GLX_FUNCTION(glXDestroyGLXPixmap),
+   GLX_FUNCTION(glXGetConfig),
+   GLX_FUNCTION(glXGetCurrentContext),
+   GLX_FUNCTION(glXGetCurrentDrawable),
+   GLX_FUNCTION(glXIsDirect),
+   GLX_FUNCTION(glXMakeCurrent),
+   GLX_FUNCTION(glXQueryExtension),
+   GLX_FUNCTION(glXQueryVersion),
+   GLX_FUNCTION(glXSwapBuffers),
+   GLX_FUNCTION(glXUseXFont),
+   GLX_FUNCTION(glXWaitGL),
+   GLX_FUNCTION(glXWaitX),
+
+   /*** GLX_VERSION_1_1 ***/
+   GLX_FUNCTION(glXGetClientString),
+   GLX_FUNCTION(glXQueryExtensionsString),
+   GLX_FUNCTION(glXQueryServerString),
+
+   /*** GLX_VERSION_1_2 ***/
+   GLX_FUNCTION(glXGetCurrentDisplay),
+
+   /*** GLX_VERSION_1_3 ***/
+   GLX_FUNCTION(glXChooseFBConfig),
+   GLX_FUNCTION(glXCreateNewContext),
+   GLX_FUNCTION(glXCreatePbuffer),
+   GLX_FUNCTION(glXCreatePixmap),
+   GLX_FUNCTION(glXCreateWindow),
+   GLX_FUNCTION(glXDestroyPbuffer),
+   GLX_FUNCTION(glXDestroyPixmap),
+   GLX_FUNCTION(glXDestroyWindow),
+   GLX_FUNCTION(glXGetCurrentReadDrawable),
+   GLX_FUNCTION(glXGetFBConfigAttrib),
+   GLX_FUNCTION(glXGetFBConfigs),
+   GLX_FUNCTION(glXGetSelectedEvent),
+   GLX_FUNCTION(glXGetVisualFromFBConfig),
+   GLX_FUNCTION(glXMakeContextCurrent),
+   GLX_FUNCTION(glXQueryContext),
+   GLX_FUNCTION(glXQueryDrawable),
+   GLX_FUNCTION(glXSelectEvent),
+
+   /*** GLX_SGI_swap_control ***/
+   GLX_FUNCTION2(glXSwapIntervalSGI, __glXSwapIntervalSGI),
+
+   /*** GLX_SGI_video_sync ***/
+   GLX_FUNCTION2(glXGetVideoSyncSGI, __glXGetVideoSyncSGI),
+   GLX_FUNCTION2(glXWaitVideoSyncSGI, __glXWaitVideoSyncSGI),
+
+   /*** GLX_SGI_make_current_read ***/
+   GLX_FUNCTION2(glXMakeCurrentReadSGI, glXMakeContextCurrent),
+   GLX_FUNCTION2(glXGetCurrentReadDrawableSGI, glXGetCurrentReadDrawable),
+
+   /*** GLX_EXT_import_context ***/
+   GLX_FUNCTION(glXFreeContextEXT),
+   GLX_FUNCTION(glXGetContextIDEXT),
+   GLX_FUNCTION2(glXGetCurrentDisplayEXT, glXGetCurrentDisplay),
+   GLX_FUNCTION(glXImportContextEXT),
+   GLX_FUNCTION2(glXQueryContextInfoEXT, glXQueryContext),
+
+   /*** GLX_SGIX_fbconfig ***/
+   GLX_FUNCTION2(glXGetFBConfigAttribSGIX, glXGetFBConfigAttrib),
+   GLX_FUNCTION2(glXChooseFBConfigSGIX, glXChooseFBConfig),
+   GLX_FUNCTION(glXCreateGLXPixmapWithConfigSGIX),
+   GLX_FUNCTION(glXCreateContextWithConfigSGIX),
+   GLX_FUNCTION2(glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig),
+   GLX_FUNCTION(glXGetFBConfigFromVisualSGIX),
+
+   /*** GLX_SGIX_pbuffer ***/
+   GLX_FUNCTION(glXCreateGLXPbufferSGIX),
+   GLX_FUNCTION(glXDestroyGLXPbufferSGIX),
+   GLX_FUNCTION(glXQueryGLXPbufferSGIX),
+   GLX_FUNCTION(glXSelectEventSGIX),
+   GLX_FUNCTION(glXGetSelectedEventSGIX),
+
+   /*** GLX_SGIX_swap_group ***/
+   GLX_FUNCTION2(glXJoinSwapGroupSGIX, __glXJoinSwapGroupSGIX),
+
+   /*** GLX_SGIX_swap_barrier ***/
+   GLX_FUNCTION2(glXBindSwapBarrierSGIX, __glXBindSwapBarrierSGIX),
+   GLX_FUNCTION2(glXQueryMaxSwapBarriersSGIX, __glXQueryMaxSwapBarriersSGIX),
+
+   /*** GLX_MESA_allocate_memory ***/
+   GLX_FUNCTION(glXAllocateMemoryMESA),
+   GLX_FUNCTION(glXFreeMemoryMESA),
+   GLX_FUNCTION(glXGetMemoryOffsetMESA),
+
+   /*** GLX_MESA_copy_sub_buffer ***/
+   GLX_FUNCTION2(glXCopySubBufferMESA, __glXCopySubBufferMESA),
+
+   /*** GLX_MESA_pixmap_colormap ***/
+   GLX_FUNCTION(glXCreateGLXPixmapMESA),
+
+   /*** GLX_MESA_release_buffers ***/
+   GLX_FUNCTION2(glXReleaseBuffersMESA, __glXReleaseBuffersMESA),
+
+   /*** GLX_MESA_swap_control ***/
+   GLX_FUNCTION2(glXSwapIntervalMESA, __glXSwapIntervalMESA),
+   GLX_FUNCTION2(glXGetSwapIntervalMESA, __glXGetSwapIntervalMESA),
+
+   /*** GLX_MESA_swap_frame_usage ***/
+   GLX_FUNCTION2(glXBeginFrameTrackingMESA, __glXBeginFrameTrackingMESA),
+   GLX_FUNCTION2(glXEndFrameTrackingMESA, __glXEndFrameTrackingMESA),
+   GLX_FUNCTION2(glXGetFrameUsageMESA, __glXGetFrameUsageMESA),
+   GLX_FUNCTION2(glXQueryFrameTrackingMESA, __glXQueryFrameTrackingMESA),
+
+   /*** GLX_ARB_get_proc_address ***/
+   GLX_FUNCTION(glXGetProcAddressARB),
+
+   /*** GLX 1.4 ***/
+   GLX_FUNCTION2(glXGetProcAddress, glXGetProcAddressARB),
+
+   /*** GLX_OML_sync_control ***/
+   GLX_FUNCTION2(glXWaitForSbcOML, __glXWaitForSbcOML),
+   GLX_FUNCTION2(glXWaitForMscOML, __glXWaitForMscOML),
+   GLX_FUNCTION2(glXSwapBuffersMscOML, __glXSwapBuffersMscOML),
+   GLX_FUNCTION2(glXGetMscRateOML, __glXGetMscRateOML),
+   GLX_FUNCTION2(glXGetSyncValuesOML, __glXGetSyncValuesOML),
+
+   /*** GLX_EXT_texture_from_pixmap ***/
+   GLX_FUNCTION2(glXBindTexImageEXT, __glXBindTexImageEXT),
+   GLX_FUNCTION2(glXReleaseTexImageEXT, __glXReleaseTexImageEXT),
+
+#ifdef GLX_DIRECT_RENDERING
+   /*** DRI configuration ***/
+   GLX_FUNCTION(glXGetScreenDriver),
+   GLX_FUNCTION(glXGetDriverConfig),
+#endif
+
+   {NULL, NULL}                 /* end of list */
+};
+
+
+static const GLvoid *
+get_glx_proc_address(const char *funcName)
+{
+   GLuint i;
+
+   /* try static functions */
+   for (i = 0; GLX_functions[i].Name; i++) {
+      if (strcmp(GLX_functions[i].Name, funcName) == 0)
+         return GLX_functions[i].Address;
+   }
+
+   return NULL;
+}
+
+
+/**
+ * Get the address of a named GL function.  This is the pre-GLX 1.4 name for
+ * \c glXGetProcAddress.
+ *
+ * \param procName  Name of a GL or GLX function.
+ * \returns         A pointer to the named function
+ *
+ * \sa glXGetProcAddress
+ */
+PUBLIC void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
+{
+   typedef void (*gl_function) (void);
+   gl_function f;
+
+
+   /* Search the table of GLX and internal functions first.  If that
+    * fails and the supplied name could be a valid core GL name, try
+    * searching the core GL function table.  This check is done to prevent
+    * DRI based drivers from searching the core GL function table for
+    * internal API functions.
+    */
+
+   f = (gl_function) get_glx_proc_address((const char *) procName);
+   if ((f == NULL) && (procName[0] == 'g') && (procName[1] == 'l')
+       && (procName[2] != 'X')) {
+      f = (gl_function) _glapi_get_proc_address((const char *) procName);
+   }
+
+   return f;
+}
+
+/**
+ * Get the address of a named GL function.  This is the GLX 1.4 name for
+ * \c glXGetProcAddressARB.
+ *
+ * \param procName  Name of a GL or GLX function.
+ * \returns         A pointer to the named function
+ *
+ * \sa glXGetProcAddressARB
+ */
+PUBLIC void (*glXGetProcAddress(const GLubyte * procName)) (void)
+#if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
+   __attribute__ ((alias("glXGetProcAddressARB")));
+#else
+{
+   return glXGetProcAddressARB(procName);
+}
+#endif /* __GNUC__ */
+
+
+#ifdef GLX_DIRECT_RENDERING
+/**
+ * Get the unadjusted system time (UST).  Currently, the UST is measured in
+ * microseconds since Epoc.  The actual resolution of the UST may vary from
+ * system to system, and the units may vary from release to release.
+ * Drivers should not call this function directly.  They should instead use
+ * \c glXGetProcAddress to obtain a pointer to the function.
+ *
+ * \param ust Location to store the 64-bit UST
+ * \returns Zero on success or a negative errno value on failure.
+ *
+ * \sa glXGetProcAddress, PFNGLXGETUSTPROC
+ *
+ * \since Internal API version 20030317.
+ */
+_X_HIDDEN int
+__glXGetUST(int64_t * ust)
+{
+   struct timeval tv;
+
+   if (ust == NULL) {
+      return -EFAULT;
+   }
+
+   if (gettimeofday(&tv, NULL) == 0) {
+      ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
+      return 0;
+   }
+   else {
+      return -errno;
+   }
+}
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
new file mode 100644 (file)
index 0000000..c28360b
--- /dev/null
@@ -0,0 +1,513 @@
+/*
+ * 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.
+ */
+
+/**
+ * \file glxcurrent.c
+ * Client-side GLX interface for current context management.
+ */
+
+#include "glxclient.h"
+#include "glapi.h"
+#include "indirect_init.h"
+
+/*
+** We setup some dummy structures here so that the API can be used
+** even if no context is current.
+*/
+
+static GLubyte dummyBuffer[__GLX_BUFFER_LIMIT_SIZE];
+
+/*
+** Dummy context used by small commands when there is no current context.
+** All the
+** gl and glx entry points are designed to operate as nop's when using
+** the dummy context structure.
+*/
+static __GLXcontext dummyContext = {
+   &dummyBuffer[0],
+   &dummyBuffer[0],
+   &dummyBuffer[0],
+   &dummyBuffer[__GLX_BUFFER_LIMIT_SIZE],
+   sizeof(dummyBuffer),
+};
+
+
+/*
+** All indirect rendering contexts will share the same indirect dispatch table.
+*/
+static __GLapi *IndirectAPI = NULL;
+
+
+/*
+ * Current context management and locking
+ */
+
+#if defined( PTHREADS )
+
+_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
+
+# if defined( GLX_USE_TLS )
+
+/**
+ * Per-thread GLX context pointer.
+ *
+ * \c __glXSetCurrentContext is written is such a way that this pointer can
+ * \b never be \c NULL.  This is important!  Because of this
+ * \c __glXGetCurrentContext can be implemented as trivial macro.
+ */
+__thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec")))
+   = &dummyContext;
+
+_X_HIDDEN void
+__glXSetCurrentContext(__GLXcontext * c)
+{
+   __glX_tls_Context = (c != NULL) ? c : &dummyContext;
+}
+
+# else
+
+static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+
+/**
+ * Per-thread data key.
+ *
+ * Once \c init_thread_data has been called, the per-thread data key will
+ * take a value of \c NULL.  As each new thread is created the default
+ * value, in that thread, will be \c NULL.
+ */
+static pthread_key_t ContextTSD;
+
+/**
+ * Initialize the per-thread data key.
+ *
+ * This function is called \b exactly once per-process (not per-thread!) to
+ * initialize the per-thread data key.  This is ideally done using the
+ * \c pthread_once mechanism.
+ */
+static void
+init_thread_data(void)
+{
+   if (pthread_key_create(&ContextTSD, NULL) != 0) {
+      perror("pthread_key_create");
+      exit(-1);
+   }
+}
+
+_X_HIDDEN void
+__glXSetCurrentContext(__GLXcontext * c)
+{
+   pthread_once(&once_control, init_thread_data);
+   pthread_setspecific(ContextTSD, c);
+}
+
+_X_HIDDEN __GLXcontext *
+__glXGetCurrentContext(void)
+{
+   void *v;
+
+   pthread_once(&once_control, init_thread_data);
+
+   v = pthread_getspecific(ContextTSD);
+   return (v == NULL) ? &dummyContext : (__GLXcontext *) v;
+}
+
+# endif /* defined( GLX_USE_TLS ) */
+
+#elif defined( THREADS )
+
+#error Unknown threading method specified.
+
+#else
+
+/* not thread safe */
+_X_HIDDEN __GLXcontext *__glXcurrentContext = &dummyContext;
+
+#endif
+
+
+_X_HIDDEN void
+__glXSetCurrentContextNull(void)
+{
+   __glXSetCurrentContext(&dummyContext);
+#ifdef GLX_DIRECT_RENDERING
+   _glapi_set_dispatch(NULL);   /* no-op functions */
+   _glapi_set_context(NULL);
+#endif
+}
+
+
+/************************************************************************/
+
+PUBLIC GLXContext
+glXGetCurrentContext(void)
+{
+   GLXContext cx = __glXGetCurrentContext();
+
+   if (cx == &dummyContext) {
+      return NULL;
+   }
+   else {
+      return cx;
+   }
+}
+
+PUBLIC GLXDrawable
+glXGetCurrentDrawable(void)
+{
+   GLXContext gc = __glXGetCurrentContext();
+   return gc->currentDrawable;
+}
+
+
+/************************************************************************/
+
+/**
+ * Sends a GLX protocol message to the specified display to make the context
+ * and the drawables current.
+ *
+ * \param dpy     Display to send the message to.
+ * \param opcode  Major opcode value for the display.
+ * \param gc_id   Context tag for the context to be made current.
+ * \param draw    Drawable ID for the "draw" drawable.
+ * \param read    Drawable ID for the "read" drawable.
+ * \param reply   Space to store the X-server's reply.
+ *
+ * \warning
+ * This function assumes that \c dpy is locked with \c LockDisplay on entry.
+ */
+static Bool
+SendMakeCurrentRequest(Display * dpy, CARD8 opcode,
+                       GLXContextID gc_id, GLXContextTag gc_tag,
+                       GLXDrawable draw, GLXDrawable read,
+                       xGLXMakeCurrentReply * reply)
+{
+   Bool ret;
+
+
+   LockDisplay(dpy);
+
+   if (draw == read) {
+      xGLXMakeCurrentReq *req;
+
+      GetReq(GLXMakeCurrent, req);
+      req->reqType = opcode;
+      req->glxCode = X_GLXMakeCurrent;
+      req->drawable = draw;
+      req->context = gc_id;
+      req->oldContextTag = gc_tag;
+   }
+   else {
+      __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+
+      /* If the server can support the GLX 1.3 version, we should
+       * perfer that.  Not only that, some servers support GLX 1.3 but
+       * not the SGI extension.
+       */
+
+      if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+         xGLXMakeContextCurrentReq *req;
+
+         GetReq(GLXMakeContextCurrent, req);
+         req->reqType = opcode;
+         req->glxCode = X_GLXMakeContextCurrent;
+         req->drawable = draw;
+         req->readdrawable = read;
+         req->context = gc_id;
+         req->oldContextTag = gc_tag;
+      }
+      else {
+         xGLXVendorPrivateWithReplyReq *vpreq;
+         xGLXMakeCurrentReadSGIReq *req;
+
+         GetReqExtra(GLXVendorPrivateWithReply,
+                     sz_xGLXMakeCurrentReadSGIReq -
+                     sz_xGLXVendorPrivateWithReplyReq, vpreq);
+         req = (xGLXMakeCurrentReadSGIReq *) vpreq;
+         req->reqType = opcode;
+         req->glxCode = X_GLXVendorPrivateWithReply;
+         req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+         req->drawable = draw;
+         req->readable = read;
+         req->context = gc_id;
+         req->oldContextTag = gc_tag;
+      }
+   }
+
+   ret = _XReply(dpy, (xReply *) reply, 0, False);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return ret;
+}
+
+
+#ifdef GLX_DIRECT_RENDERING
+static __GLXDRIdrawable *
+FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc)
+{
+   __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+   __GLXDRIdrawable *pdraw;
+   __GLXscreenConfigs *psc;
+
+   if (priv == NULL)
+      return NULL;
+
+   psc = &priv->screenConfigs[gc->screen];
+   if (psc->drawHash == NULL)
+      return NULL;
+
+   if (__glxHashLookup(psc->drawHash, glxDrawable, (void *) &pdraw) == 0)
+      return pdraw;
+
+   pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
+                                          glxDrawable, gc->mode);
+   if (__glxHashInsert(psc->drawHash, glxDrawable, pdraw)) {
+      (*pdraw->destroyDrawable) (pdraw);
+      return NULL;
+   }
+
+   return pdraw;
+}
+#endif /* GLX_DIRECT_RENDERING */
+
+static void
+__glXGenerateError(Display * dpy, GLXContext gc, XID resource,
+                   BYTE errorCode, CARD16 minorCode)
+{
+   xError error;
+
+   error.errorCode = errorCode;
+   error.resourceID = resource;
+   error.sequenceNumber = dpy->request;
+   error.type = X_Error;
+   error.majorCode = gc->majorOpcode;
+   error.minorCode = minorCode;
+   _XError(dpy, &error);
+}
+
+/**
+ * Make a particular context current.
+ *
+ * \note This is in this file so that it can access dummyContext.
+ */
+static Bool
+MakeContextCurrent(Display * dpy, GLXDrawable draw,
+                   GLXDrawable read, GLXContext gc)
+{
+   xGLXMakeCurrentReply reply;
+   const GLXContext oldGC = __glXGetCurrentContext();
+   const CARD8 opcode = __glXSetupForCommand(dpy);
+   const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
+      ? opcode : __glXSetupForCommand(oldGC->currentDpy);
+   Bool bindReturnValue;
+   __GLXattribute *state;
+
+   if (!opcode || !oldOpcode) {
+      return GL_FALSE;
+   }
+
+   /* Make sure that the new context has a nonzero ID.  In the request,
+    * a zero context ID is used only to mean that we bind to no current
+    * context.
+    */
+   if ((gc != NULL) && (gc->xid == None)) {
+      return GL_FALSE;
+   }
+
+   if (gc == NULL && (draw != None || read != None)) {
+      __glXGenerateError(dpy, gc, (draw != None) ? draw : read,
+                         BadMatch, X_GLXMakeContextCurrent);
+      return False;
+   }
+   if (gc != NULL && (draw == None || read == None)) {
+      __glXGenerateError(dpy, gc, None, BadMatch, X_GLXMakeContextCurrent);
+      return False;
+   }
+
+   _glapi_check_multithread();
+
+   if (gc != NULL && gc->thread_id != 0 && gc->thread_id != _glthread_GetID()) {
+      __glXGenerateError(dpy, gc, gc->xid,
+                         BadAccess, X_GLXMakeContextCurrent);
+      return False;
+   }
+
+#ifdef GLX_DIRECT_RENDERING
+   /* Bind the direct rendering context to the drawable */
+   if (gc && gc->driContext) {
+      __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
+      __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc);
+
+      if ((pdraw == NULL) || (pread == NULL)) {
+         __glXGenerateError(dpy, gc, (pdraw == NULL) ? draw : read,
+                            GLXBadDrawable, X_GLXMakeContextCurrent);
+         return False;
+      }
+
+      bindReturnValue =
+         (gc->driContext->bindContext) (gc->driContext, pdraw, pread);
+   }
+   else if (!gc && oldGC && oldGC->driContext) {
+      bindReturnValue = True;
+   }
+   else
+#endif
+   {
+      /* Send a glXMakeCurrent request to bind the new context. */
+      bindReturnValue =
+         SendMakeCurrentRequest(dpy, opcode, gc ? gc->xid : None,
+                                ((dpy != oldGC->currentDpy)
+                                 || oldGC->isDirect)
+                                ? None : oldGC->currentContextTag, draw, read,
+                                &reply);
+   }
+
+
+   if (!bindReturnValue) {
+      return False;
+   }
+
+#ifdef GLX_DIRECT_RENDERING
+   if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) &&
+       !oldGC->isDirect && oldGC != &dummyContext) {
+#else
+   if ((dpy != oldGC->currentDpy) && oldGC != &dummyContext) {
+#endif
+      xGLXMakeCurrentReply dummy_reply;
+
+      /* We are either switching from one dpy to another and have to
+       * send a request to the previous dpy to unbind the previous
+       * context, or we are switching away from a indirect context to
+       * a direct context and have to send a request to the dpy to
+       * unbind the previous context.
+       */
+      (void) SendMakeCurrentRequest(oldGC->currentDpy, oldOpcode, None,
+                                    oldGC->currentContextTag, None, None,
+                                    &dummy_reply);
+   }
+#ifdef GLX_DIRECT_RENDERING
+   else if (oldGC->driContext && oldGC != gc) {
+      oldGC->driContext->unbindContext(oldGC->driContext);
+   }
+#endif
+
+
+   /* Update our notion of what is current */
+   __glXLock();
+   if (gc == oldGC) {
+      /* Even though the contexts are the same the drawable might have
+       * changed.  Note that gc cannot be the dummy, and that oldGC
+       * cannot be NULL, therefore if they are the same, gc is not
+       * NULL and not the dummy.
+       */
+      gc->currentDrawable = draw;
+      gc->currentReadable = read;
+   }
+   else {
+      if (oldGC != &dummyContext) {
+         /* Old current context is no longer current to anybody */
+         oldGC->currentDpy = 0;
+         oldGC->currentDrawable = None;
+         oldGC->currentReadable = None;
+         oldGC->currentContextTag = 0;
+         oldGC->thread_id = 0;
+
+         if (oldGC->xid == None) {
+            /* We are switching away from a context that was
+             * previously destroyed, so we need to free the memory
+             * for the old handle.
+             */
+#ifdef GLX_DIRECT_RENDERING
+            /* Destroy the old direct rendering context */
+            if (oldGC->driContext) {
+               oldGC->driContext->destroyContext(oldGC->driContext,
+                                                 oldGC->psc,
+                                                 oldGC->createDpy);
+               oldGC->driContext = NULL;
+            }
+#endif
+            __glXFreeContext(oldGC);
+         }
+      }
+      if (gc) {
+         __glXSetCurrentContext(gc);
+
+         gc->currentDpy = dpy;
+         gc->currentDrawable = draw;
+         gc->currentReadable = read;
+         gc->thread_id = _glthread_GetID();
+
+#ifdef GLX_DIRECT_RENDERING
+         if (!gc->driContext) {
+#endif
+            if (!IndirectAPI)
+               IndirectAPI = __glXNewIndirectAPI();
+            _glapi_set_dispatch(IndirectAPI);
+
+            state = (__GLXattribute *) (gc->client_state_private);
+
+            gc->currentContextTag = reply.contextTag;
+            if (state->array_state == NULL) {
+               (void) glGetString(GL_EXTENSIONS);
+               (void) glGetString(GL_VERSION);
+               __glXInitVertexArrayState(gc);
+            }
+#ifdef GLX_DIRECT_RENDERING
+         }
+         else {
+            gc->currentContextTag = -1;
+         }
+#endif
+      }
+      else {
+         __glXSetCurrentContextNull();
+      }
+   }
+   __glXUnlock();
+   return GL_TRUE;
+}
+
+
+PUBLIC Bool
+glXMakeCurrent(Display * dpy, GLXDrawable draw, GLXContext gc)
+{
+   return MakeContextCurrent(dpy, draw, draw, gc);
+}
+
+PUBLIC
+GLX_ALIAS(Bool, glXMakeCurrentReadSGI,
+          (Display * dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx),
+          (dpy, d, r, ctx), MakeContextCurrent)
+
+PUBLIC
+GLX_ALIAS(Bool, glXMakeContextCurrent,
+          (Display * dpy, GLXDrawable d, GLXDrawable r,
+           GLXContext ctx), (dpy, d, r, ctx), MakeContextCurrent)
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
new file mode 100644 (file)
index 0000000..c2de1a3
--- /dev/null
@@ -0,0 +1,1060 @@
+/*
+ * 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.
+ */
+
+/**
+ * \file glxext.c
+ * GLX protocol interface boot-strap code.
+ *
+ * Direct rendering support added by Precision Insight, Inc.
+ *
+ * \author Kevin E. Martin <kevin@precisioninsight.com>
+ */
+
+#include <assert.h>
+#include "glxclient.h"
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/dri2proto.h>
+#include "glxextensions.h"
+#include "glcontextmodes.h"
+
+#ifdef USE_XCB
+#include <X11/Xlib-xcb.h>
+#include <xcb/xcb.h>
+#include <xcb/glx.h>
+#endif
+
+
+#ifdef DEBUG
+void __glXDumpDrawBuffer(__GLXcontext * ctx);
+#endif
+
+/*
+** You can set this cell to 1 to force the gl drawing stuff to be
+** one command per packet
+*/
+_X_HIDDEN int __glXDebug = 0;
+
+/* Extension required boiler plate */
+
+static char *__glXExtensionName = GLX_EXTENSION_NAME;
+XExtensionInfo *__glXExtensionInfo = NULL;
+
+static /* const */ char *error_list[] = {
+   "GLXBadContext",
+   "GLXBadContextState",
+   "GLXBadDrawable",
+   "GLXBadPixmap",
+   "GLXBadContextTag",
+   "GLXBadCurrentWindow",
+   "GLXBadRenderRequest",
+   "GLXBadLargeRequest",
+   "GLXUnsupportedPrivateRequest",
+   "GLXBadFBConfig",
+   "GLXBadPbuffer",
+   "GLXBadCurrentDrawable",
+   "GLXBadWindow",
+};
+
+static int
+__glXCloseDisplay(Display * dpy, XExtCodes * codes)
+{
+   GLXContext gc;
+
+   gc = __glXGetCurrentContext();
+   if (dpy == gc->currentDpy) {
+      __glXSetCurrentContextNull();
+      __glXFreeContext(gc);
+   }
+
+   return XextRemoveDisplay(__glXExtensionInfo, dpy);
+}
+
+
+static
+XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
+                           __GLX_NUMBER_ERRORS, error_list)
+static Bool
+__glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire);
+static Status
+__glXEventToWire(Display *dpy, XEvent *event, xEvent *wire);
+
+static /* const */ XExtensionHooks __glXExtensionHooks = {
+  NULL,                   /* create_gc */
+  NULL,                   /* copy_gc */
+  NULL,                   /* flush_gc */
+  NULL,                   /* free_gc */
+  NULL,                   /* create_font */
+  NULL,                   /* free_font */
+  __glXCloseDisplay,      /* close_display */
+  __glXWireToEvent,       /* wire_to_event */
+  __glXEventToWire,       /* event_to_wire */
+  NULL,                   /* error */
+  __glXErrorString,       /* error_string */
+};
+
+XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
+                           __glXExtensionName, &__glXExtensionHooks,
+                           __GLX_NUMBER_EVENTS, NULL)
+
+/*
+ * GLX events are a bit funky.  We don't stuff the X event code into
+ * our user exposed (via XNextEvent) structure.  Instead we use the GLX
+ * private event code namespace (and hope it doesn't conflict).  Clients
+ * have to know that bit 15 in the event type field means they're getting
+ * a GLX event, and then handle the various sub-event types there, rather
+ * than simply checking the event code and handling it directly.
+ */
+
+static Bool
+__glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
+{
+   XExtDisplayInfo *info = __glXFindDisplay(dpy);
+
+   XextCheckExtension(dpy, info, __glXExtensionName, False);
+
+   switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
+   case GLX_PbufferClobber:
+   {
+      GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event;
+      xGLXPbufferClobberEvent *awire = (xGLXPbufferClobberEvent *)wire;
+      aevent->event_type = awire->type;
+      aevent->serial = awire->sequenceNumber;
+      aevent->event_type = awire->event_type;
+      aevent->draw_type = awire->draw_type;
+      aevent->drawable = awire->drawable;
+      aevent->buffer_mask = awire->buffer_mask;
+      aevent->aux_buffer = awire->aux_buffer;
+      aevent->x = awire->x;
+      aevent->y = awire->y;
+      aevent->width = awire->width;
+      aevent->height = awire->height;
+      aevent->count = awire->count;
+      return True;
+   }
+   /* No easy symbol to test for this, as GLX_BufferSwapComplete is
+    * defined in the local glx.h header, but the
+    * xGLXBufferSwapComplete typedef is only available in new versions
+    * of the external glxproto.h header, which doesn't have any
+    * testable versioning define.
+    *
+    * I'll use the related DRI2 define, in the hope that we won't
+    * receive these events unless we know how to ask for them:
+    */
+#ifdef X_DRI2SwapBuffers
+   case GLX_BufferSwapComplete:
+   {
+      GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
+      xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
+      aevent->event_type = awire->event_type;
+      aevent->drawable = awire->drawable;
+      aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+      aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+      aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+      return True;
+   }
+#endif
+   default:
+      /* client doesn't support server event */
+      break;
+   }
+
+   return False;
+}
+
+/* We don't actually support this.  It doesn't make sense for clients to
+ * send each other GLX events.
+ */
+static Status
+__glXEventToWire(Display *dpy, XEvent *event, xEvent *wire)
+{
+   XExtDisplayInfo *info = __glXFindDisplay(dpy);
+
+   XextCheckExtension(dpy, info, __glXExtensionName, False);
+
+   switch (event->type) {
+   case GLX_DAMAGED:
+      break;
+   case GLX_SAVED:
+      break;
+   case GLX_EXCHANGE_COMPLETE_INTEL:
+      break;
+   case GLX_BLIT_COMPLETE_INTEL:
+      break;
+   case GLX_FLIP_COMPLETE_INTEL:
+      break;
+   default:
+      /* client doesn't support server event */
+      break;
+   }
+
+   return Success;
+}
+
+/************************************************************************/
+/*
+** Free the per screen configs data as well as the array of
+** __glXScreenConfigs.
+*/
+static void
+FreeScreenConfigs(__GLXdisplayPrivate * priv)
+{
+   __GLXscreenConfigs *psc;
+   GLint i, screens;
+
+   /* Free screen configuration information */
+   psc = priv->screenConfigs;
+   screens = ScreenCount(priv->dpy);
+   for (i = 0; i < screens; i++, psc++) {
+      if (psc->configs) {
+         _gl_context_modes_destroy(psc->configs);
+         if (psc->effectiveGLXexts)
+            Xfree(psc->effectiveGLXexts);
+         psc->configs = NULL;   /* NOTE: just for paranoia */
+      }
+      if (psc->visuals) {
+         _gl_context_modes_destroy(psc->visuals);
+         psc->visuals = NULL;   /* NOTE: just for paranoia */
+      }
+      Xfree((char *) psc->serverGLXexts);
+
+#ifdef GLX_DIRECT_RENDERING
+      if (psc->driver_configs) {
+         unsigned int j;
+         for (j = 0; psc->driver_configs[j]; j++)
+            free((__DRIconfig *) psc->driver_configs[j]);
+         free(psc->driver_configs);
+         psc->driver_configs = NULL;
+      }
+      if (psc->driScreen) {
+         psc->driScreen->destroyScreen(psc);
+         __glxHashDestroy(psc->drawHash);
+         XFree(psc->driScreen);
+         psc->driScreen = NULL;
+      }
+#endif
+   }
+   XFree((char *) priv->screenConfigs);
+   priv->screenConfigs = NULL;
+}
+
+/*
+** Release the private memory referred to in a display private
+** structure.  The caller will free the extension structure.
+*/
+static int
+__glXFreeDisplayPrivate(XExtData * extension)
+{
+   __GLXdisplayPrivate *priv;
+
+   priv = (__GLXdisplayPrivate *) extension->private_data;
+   FreeScreenConfigs(priv);
+   if (priv->serverGLXvendor) {
+      Xfree((char *) priv->serverGLXvendor);
+      priv->serverGLXvendor = 0x0;      /* to protect against double free's */
+   }
+   if (priv->serverGLXversion) {
+      Xfree((char *) priv->serverGLXversion);
+      priv->serverGLXversion = 0x0;     /* to protect against double free's */
+   }
+
+#ifdef GLX_DIRECT_RENDERING
+   /* Free the direct rendering per display data */
+   if (priv->driswDisplay)
+      (*priv->driswDisplay->destroyDisplay) (priv->driswDisplay);
+   priv->driswDisplay = NULL;
+
+   if (priv->driDisplay)
+      (*priv->driDisplay->destroyDisplay) (priv->driDisplay);
+   priv->driDisplay = NULL;
+
+   if (priv->dri2Display)
+      (*priv->dri2Display->destroyDisplay) (priv->dri2Display);
+   priv->dri2Display = NULL;
+#endif
+
+   Xfree((char *) priv);
+   return 0;
+}
+
+/************************************************************************/
+
+/*
+** Query the version of the GLX extension.  This procedure works even if
+** the client extension is not completely set up.
+*/
+static Bool
+QueryVersion(Display * dpy, int opcode, int *major, int *minor)
+{
+#ifdef USE_XCB
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_query_version_reply_t *reply = xcb_glx_query_version_reply(c,
+                                                                      xcb_glx_query_version
+                                                                      (c,
+                                                                       GLX_MAJOR_VERSION,
+                                                                       GLX_MINOR_VERSION),
+                                                                      NULL);
+
+   if (reply->major_version != GLX_MAJOR_VERSION) {
+      free(reply);
+      return GL_FALSE;
+   }
+   *major = reply->major_version;
+   *minor = min(reply->minor_version, GLX_MINOR_VERSION);
+   free(reply);
+   return GL_TRUE;
+#else
+   xGLXQueryVersionReq *req;
+   xGLXQueryVersionReply reply;
+
+   /* Send the glXQueryVersion request */
+   LockDisplay(dpy);
+   GetReq(GLXQueryVersion, req);
+   req->reqType = opcode;
+   req->glxCode = X_GLXQueryVersion;
+   req->majorVersion = GLX_MAJOR_VERSION;
+   req->minorVersion = GLX_MINOR_VERSION;
+   _XReply(dpy, (xReply *) & reply, 0, False);
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   if (reply.majorVersion != GLX_MAJOR_VERSION) {
+      /*
+       ** The server does not support the same major release as this
+       ** client.
+       */
+      return GL_FALSE;
+   }
+   *major = reply.majorVersion;
+   *minor = min(reply.minorVersion, GLX_MINOR_VERSION);
+   return GL_TRUE;
+#endif /* USE_XCB */
+}
+
+
+_X_HIDDEN void
+__glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
+                                    const INT32 * bp, Bool tagged_only,
+                                    Bool fbconfig_style_tags)
+{
+   int i;
+
+   if (!tagged_only) {
+      /* Copy in the first set of properties */
+      config->visualID = *bp++;
+
+      config->visualType = _gl_convert_from_x_visual_type(*bp++);
+
+      config->rgbMode = *bp++;
+
+      config->redBits = *bp++;
+      config->greenBits = *bp++;
+      config->blueBits = *bp++;
+      config->alphaBits = *bp++;
+      config->accumRedBits = *bp++;
+      config->accumGreenBits = *bp++;
+      config->accumBlueBits = *bp++;
+      config->accumAlphaBits = *bp++;
+
+      config->doubleBufferMode = *bp++;
+      config->stereoMode = *bp++;
+
+      config->rgbBits = *bp++;
+      config->depthBits = *bp++;
+      config->stencilBits = *bp++;
+      config->numAuxBuffers = *bp++;
+      config->level = *bp++;
+
+      count -= __GLX_MIN_CONFIG_PROPS;
+   }
+
+   /*
+    ** Additional properties may be in a list at the end
+    ** of the reply.  They are in pairs of property type
+    ** and property value.
+    */
+
+#define FETCH_OR_SET(tag) \
+    config-> tag = ( fbconfig_style_tags ) ? *bp++ : 1
+
+   for (i = 0; i < count; i += 2) {
+      switch (*bp++) {
+      case GLX_RGBA:
+         FETCH_OR_SET(rgbMode);
+         break;
+      case GLX_BUFFER_SIZE:
+         config->rgbBits = *bp++;
+         break;
+      case GLX_LEVEL:
+         config->level = *bp++;
+         break;
+      case GLX_DOUBLEBUFFER:
+         FETCH_OR_SET(doubleBufferMode);
+         break;
+      case GLX_STEREO:
+         FETCH_OR_SET(stereoMode);
+         break;
+      case GLX_AUX_BUFFERS:
+         config->numAuxBuffers = *bp++;
+         break;
+      case GLX_RED_SIZE:
+         config->redBits = *bp++;
+         break;
+      case GLX_GREEN_SIZE:
+         config->greenBits = *bp++;
+         break;
+      case GLX_BLUE_SIZE:
+         config->blueBits = *bp++;
+         break;
+      case GLX_ALPHA_SIZE:
+         config->alphaBits = *bp++;
+         break;
+      case GLX_DEPTH_SIZE:
+         config->depthBits = *bp++;
+         break;
+      case GLX_STENCIL_SIZE:
+         config->stencilBits = *bp++;
+         break;
+      case GLX_ACCUM_RED_SIZE:
+         config->accumRedBits = *bp++;
+         break;
+      case GLX_ACCUM_GREEN_SIZE:
+         config->accumGreenBits = *bp++;
+         break;
+      case GLX_ACCUM_BLUE_SIZE:
+         config->accumBlueBits = *bp++;
+         break;
+      case GLX_ACCUM_ALPHA_SIZE:
+         config->accumAlphaBits = *bp++;
+         break;
+      case GLX_VISUAL_CAVEAT_EXT:
+         config->visualRating = *bp++;
+         break;
+      case GLX_X_VISUAL_TYPE:
+         config->visualType = *bp++;
+         break;
+      case GLX_TRANSPARENT_TYPE:
+         config->transparentPixel = *bp++;
+         break;
+      case GLX_TRANSPARENT_INDEX_VALUE:
+         config->transparentIndex = *bp++;
+         break;
+      case GLX_TRANSPARENT_RED_VALUE:
+         config->transparentRed = *bp++;
+         break;
+      case GLX_TRANSPARENT_GREEN_VALUE:
+         config->transparentGreen = *bp++;
+         break;
+      case GLX_TRANSPARENT_BLUE_VALUE:
+         config->transparentBlue = *bp++;
+         break;
+      case GLX_TRANSPARENT_ALPHA_VALUE:
+         config->transparentAlpha = *bp++;
+         break;
+      case GLX_VISUAL_ID:
+         config->visualID = *bp++;
+         break;
+      case GLX_DRAWABLE_TYPE:
+         config->drawableType = *bp++;
+         break;
+      case GLX_RENDER_TYPE:
+         config->renderType = *bp++;
+         break;
+      case GLX_X_RENDERABLE:
+         config->xRenderable = *bp++;
+         break;
+      case GLX_FBCONFIG_ID:
+         config->fbconfigID = *bp++;
+         break;
+      case GLX_MAX_PBUFFER_WIDTH:
+         config->maxPbufferWidth = *bp++;
+         break;
+      case GLX_MAX_PBUFFER_HEIGHT:
+         config->maxPbufferHeight = *bp++;
+         break;
+      case GLX_MAX_PBUFFER_PIXELS:
+         config->maxPbufferPixels = *bp++;
+         break;
+      case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+         config->optimalPbufferWidth = *bp++;
+         break;
+      case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+         config->optimalPbufferHeight = *bp++;
+         break;
+      case GLX_VISUAL_SELECT_GROUP_SGIX:
+         config->visualSelectGroup = *bp++;
+         break;
+      case GLX_SWAP_METHOD_OML:
+         config->swapMethod = *bp++;
+         break;
+      case GLX_SAMPLE_BUFFERS_SGIS:
+         config->sampleBuffers = *bp++;
+         break;
+      case GLX_SAMPLES_SGIS:
+         config->samples = *bp++;
+         break;
+      case GLX_BIND_TO_TEXTURE_RGB_EXT:
+         config->bindToTextureRgb = *bp++;
+         break;
+      case GLX_BIND_TO_TEXTURE_RGBA_EXT:
+         config->bindToTextureRgba = *bp++;
+         break;
+      case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
+         config->bindToMipmapTexture = *bp++;
+         break;
+      case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
+         config->bindToTextureTargets = *bp++;
+         break;
+      case GLX_Y_INVERTED_EXT:
+         config->yInverted = *bp++;
+         break;
+      case None:
+         i = count;
+         break;
+      default:
+         break;
+      }
+   }
+
+   config->renderType =
+      (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+
+   config->haveAccumBuffer = ((config->accumRedBits +
+                               config->accumGreenBits +
+                               config->accumBlueBits +
+                               config->accumAlphaBits) > 0);
+   config->haveDepthBuffer = (config->depthBits > 0);
+   config->haveStencilBuffer = (config->stencilBits > 0);
+}
+
+static __GLcontextModes *
+createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
+                            int screen, GLboolean tagged_only)
+{
+   INT32 buf[__GLX_TOTAL_CONFIG], *props;
+   unsigned prop_size;
+   __GLcontextModes *modes, *m;
+   int i;
+
+   if (nprops == 0)
+      return NULL;
+
+   /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for FBconfigs? */
+
+   /* Check number of properties */
+   if (nprops < __GLX_MIN_CONFIG_PROPS || nprops > __GLX_MAX_CONFIG_PROPS)
+      return NULL;
+
+   /* Allocate memory for our config structure */
+   modes = _gl_context_modes_create(nvisuals, sizeof(__GLcontextModes));
+   if (!modes)
+      return NULL;
+
+   prop_size = nprops * __GLX_SIZE_INT32;
+   if (prop_size <= sizeof(buf))
+      props = buf;
+   else
+      props = Xmalloc(prop_size);
+
+   /* Read each config structure and convert it into our format */
+   m = modes;
+   for (i = 0; i < nvisuals; i++) {
+      _XRead(dpy, (char *) props, prop_size);
+      /* Older X servers don't send this so we default it here. */
+      m->drawableType = GLX_WINDOW_BIT;
+      __glXInitializeVisualConfigFromTags(m, nprops, props,
+                                          tagged_only, GL_TRUE);
+      m->screen = screen;
+      m = m->next;
+   }
+
+   if (props != buf)
+      Xfree(props);
+
+   return modes;
+}
+
+static GLboolean
+getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
+{
+   xGLXGetVisualConfigsReq *req;
+   __GLXscreenConfigs *psc;
+   xGLXGetVisualConfigsReply reply;
+
+   LockDisplay(dpy);
+
+   psc = priv->screenConfigs + screen;
+   psc->visuals = NULL;
+   GetReq(GLXGetVisualConfigs, req);
+   req->reqType = priv->majorOpcode;
+   req->glxCode = X_GLXGetVisualConfigs;
+   req->screen = screen;
+
+   if (!_XReply(dpy, (xReply *) & reply, 0, False))
+      goto out;
+
+   psc->visuals = createConfigsFromProperties(dpy,
+                                              reply.numVisuals,
+                                              reply.numProps,
+                                              screen, GL_FALSE);
+
+ out:
+   UnlockDisplay(dpy);
+   return psc->visuals != NULL;
+}
+
+static GLboolean
+getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
+{
+   xGLXGetFBConfigsReq *fb_req;
+   xGLXGetFBConfigsSGIXReq *sgi_req;
+   xGLXVendorPrivateWithReplyReq *vpreq;
+   xGLXGetFBConfigsReply reply;
+   __GLXscreenConfigs *psc;
+
+   psc = priv->screenConfigs + screen;
+   psc->serverGLXexts =
+      __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
+
+   LockDisplay(dpy);
+
+   psc->configs = NULL;
+   if (atof(priv->serverGLXversion) >= 1.3) {
+      GetReq(GLXGetFBConfigs, fb_req);
+      fb_req->reqType = priv->majorOpcode;
+      fb_req->glxCode = X_GLXGetFBConfigs;
+      fb_req->screen = screen;
+   }
+   else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) {
+      GetReqExtra(GLXVendorPrivateWithReply,
+                  sz_xGLXGetFBConfigsSGIXReq +
+                  sz_xGLXVendorPrivateWithReplyReq, vpreq);
+      sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
+      sgi_req->reqType = priv->majorOpcode;
+      sgi_req->glxCode = X_GLXVendorPrivateWithReply;
+      sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
+      sgi_req->screen = screen;
+   }
+   else
+      goto out;
+
+   if (!_XReply(dpy, (xReply *) & reply, 0, False))
+      goto out;
+
+   psc->configs = createConfigsFromProperties(dpy,
+                                              reply.numFBConfigs,
+                                              reply.numAttribs * 2,
+                                              screen, GL_TRUE);
+
+ out:
+   UnlockDisplay(dpy);
+   return psc->configs != NULL;
+}
+
+/*
+** Allocate the memory for the per screen configs for each screen.
+** If that works then fetch the per screen configs data.
+*/
+static Bool
+AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
+{
+   __GLXscreenConfigs *psc;
+   GLint i, screens;
+
+   /*
+    ** First allocate memory for the array of per screen configs.
+    */
+   screens = ScreenCount(dpy);
+   psc = (__GLXscreenConfigs *) Xmalloc(screens * sizeof(__GLXscreenConfigs));
+   if (!psc) {
+      return GL_FALSE;
+   }
+   memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
+   priv->screenConfigs = psc;
+
+   priv->serverGLXversion =
+      __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
+   if (priv->serverGLXversion == NULL) {
+      FreeScreenConfigs(priv);
+      return GL_FALSE;
+   }
+
+   for (i = 0; i < screens; i++, psc++) {
+      getVisualConfigs(dpy, priv, i);
+      getFBConfigs(dpy, priv, i);
+
+#ifdef GLX_DIRECT_RENDERING
+      psc->scr = i;
+      psc->dpy = dpy;
+      psc->drawHash = __glxHashCreate();
+      if (psc->drawHash == NULL)
+         continue;
+
+      if (priv->dri2Display)
+         psc->driScreen = (*priv->dri2Display->createScreen) (psc, i, priv);
+
+      if (psc->driScreen == NULL && priv->driDisplay)
+         psc->driScreen = (*priv->driDisplay->createScreen) (psc, i, priv);
+
+      if (psc->driScreen == NULL && priv->driswDisplay)
+         psc->driScreen = (*priv->driswDisplay->createScreen) (psc, i, priv);
+
+      if (psc->driScreen == NULL) {
+         __glxHashDestroy(psc->drawHash);
+         psc->drawHash = NULL;
+      }
+#endif
+   }
+   SyncHandle();
+   return GL_TRUE;
+}
+
+/*
+** Initialize the client side extension code.
+*/
+_X_HIDDEN __GLXdisplayPrivate *
+__glXInitialize(Display * dpy)
+{
+   XExtDisplayInfo *info = __glXFindDisplay(dpy);
+   XExtData **privList, *private, *found;
+   __GLXdisplayPrivate *dpyPriv;
+   XEDataObject dataObj;
+   int major, minor;
+#ifdef GLX_DIRECT_RENDERING
+   Bool glx_direct, glx_accel;
+#endif
+
+   /* The one and only long long lock */
+   __glXLock();
+
+   if (!XextHasExtension(info)) {
+      /* No GLX extension supported by this server. Oh well. */
+      __glXUnlock();
+      XMissingExtension(dpy, __glXExtensionName);
+      return 0;
+   }
+
+   /* See if a display private already exists.  If so, return it */
+   dataObj.display = dpy;
+   privList = XEHeadOfExtensionList(dataObj);
+   found = XFindOnExtensionList(privList, info->codes->extension);
+   if (found) {
+      __glXUnlock();
+      return (__GLXdisplayPrivate *) found->private_data;
+   }
+
+   /* See if the versions are compatible */
+   if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) {
+      /* The client and server do not agree on versions.  Punt. */
+      __glXUnlock();
+      return 0;
+   }
+
+   /*
+    ** Allocate memory for all the pieces needed for this buffer.
+    */
+   private = (XExtData *) Xmalloc(sizeof(XExtData));
+   if (!private) {
+      __glXUnlock();
+      return 0;
+   }
+   dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
+   if (!dpyPriv) {
+      __glXUnlock();
+      Xfree((char *) private);
+      return 0;
+   }
+
+   /*
+    ** Init the display private and then read in the screen config
+    ** structures from the server.
+    */
+   dpyPriv->majorOpcode = info->codes->major_opcode;
+   dpyPriv->majorVersion = major;
+   dpyPriv->minorVersion = minor;
+   dpyPriv->dpy = dpy;
+
+   dpyPriv->serverGLXvendor = 0x0;
+   dpyPriv->serverGLXversion = 0x0;
+
+#ifdef GLX_DIRECT_RENDERING
+   glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
+   glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
+
+   /*
+    ** Initialize the direct rendering per display data and functions.
+    ** Note: This _must_ be done before calling any other DRI routines
+    ** (e.g., those called in AllocAndFetchScreenConfigs).
+    */
+   if (glx_direct && glx_accel) {
+      dpyPriv->dri2Display = dri2CreateDisplay(dpy);
+      dpyPriv->driDisplay = driCreateDisplay(dpy);
+   }
+   if (glx_direct)
+      dpyPriv->driswDisplay = driswCreateDisplay(dpy);
+#endif
+
+   if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
+      __glXUnlock();
+      Xfree((char *) dpyPriv);
+      Xfree((char *) private);
+      return 0;
+   }
+
+   /*
+    ** Fill in the private structure.  This is the actual structure that
+    ** hangs off of the Display structure.  Our private structure is
+    ** referred to by this structure.  Got that?
+    */
+   private->number = info->codes->extension;
+   private->next = 0;
+   private->free_private = __glXFreeDisplayPrivate;
+   private->private_data = (char *) dpyPriv;
+   XAddToExtensionList(privList, private);
+
+   if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) {
+      __glXClientInfo(dpy, dpyPriv->majorOpcode);
+   }
+   __glXUnlock();
+
+   return dpyPriv;
+}
+
+/*
+** Setup for sending a GLX command on dpy.  Make sure the extension is
+** initialized.  Try to avoid calling __glXInitialize as its kinda slow.
+*/
+_X_HIDDEN CARD8
+__glXSetupForCommand(Display * dpy)
+{
+   GLXContext gc;
+   __GLXdisplayPrivate *priv;
+
+   /* If this thread has a current context, flush its rendering commands */
+   gc = __glXGetCurrentContext();
+   if (gc->currentDpy) {
+      /* Flush rendering buffer of the current context, if any */
+      (void) __glXFlushRenderBuffer(gc, gc->pc);
+
+      if (gc->currentDpy == dpy) {
+         /* Use opcode from gc because its right */
+         return gc->majorOpcode;
+      }
+      else {
+         /*
+          ** Have to get info about argument dpy because it might be to
+          ** a different server
+          */
+      }
+   }
+
+   /* Forced to lookup extension via the slow initialize route */
+   priv = __glXInitialize(dpy);
+   if (!priv) {
+      return 0;
+   }
+   return priv->majorOpcode;
+}
+
+/**
+ * Flush the drawing command transport buffer.
+ *
+ * \param ctx  Context whose transport buffer is to be flushed.
+ * \param pc   Pointer to first unused buffer location.
+ *
+ * \todo
+ * Modify this function to use \c ctx->pc instead of the explicit
+ * \c pc parameter.
+ */
+_X_HIDDEN GLubyte *
+__glXFlushRenderBuffer(__GLXcontext * ctx, GLubyte * pc)
+{
+   Display *const dpy = ctx->currentDpy;
+#ifdef USE_XCB
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+#else
+   xGLXRenderReq *req;
+#endif /* USE_XCB */
+   const GLint size = pc - ctx->buf;
+
+   if ((dpy != NULL) && (size > 0)) {
+#ifdef USE_XCB
+      xcb_glx_render(c, ctx->currentContextTag, size,
+                     (const uint8_t *) ctx->buf);
+#else
+      /* Send the entire buffer as an X request */
+      LockDisplay(dpy);
+      GetReq(GLXRender, req);
+      req->reqType = ctx->majorOpcode;
+      req->glxCode = X_GLXRender;
+      req->contextTag = ctx->currentContextTag;
+      req->length += (size + 3) >> 2;
+      _XSend(dpy, (char *) ctx->buf, size);
+      UnlockDisplay(dpy);
+      SyncHandle();
+#endif
+   }
+
+   /* Reset pointer and return it */
+   ctx->pc = ctx->buf;
+   return ctx->pc;
+}
+
+
+/**
+ * Send a portion of a GLXRenderLarge command to the server.  The advantage of
+ * this function over \c __glXSendLargeCommand is that callers can use the
+ * data buffer in the GLX context and may be able to avoid allocating an
+ * extra buffer.  The disadvantage is the clients will have to do more
+ * GLX protocol work (i.e., calculating \c totalRequests, etc.).
+ *
+ * \sa __glXSendLargeCommand
+ *
+ * \param gc             GLX context
+ * \param requestNumber  Which part of the whole command is this?  The first
+ *                       request is 1.
+ * \param totalRequests  How many requests will there be?
+ * \param data           Command data.
+ * \param dataLen        Size, in bytes, of the command data.
+ */
+_X_HIDDEN void
+__glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
+                    GLint totalRequests, const GLvoid * data, GLint dataLen)
+{
+   Display *dpy = gc->currentDpy;
+#ifdef USE_XCB
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_render_large(c, gc->currentContextTag, requestNumber,
+                        totalRequests, dataLen, data);
+#else
+   xGLXRenderLargeReq *req;
+
+   if (requestNumber == 1) {
+      LockDisplay(dpy);
+   }
+
+   GetReq(GLXRenderLarge, req);
+   req->reqType = gc->majorOpcode;
+   req->glxCode = X_GLXRenderLarge;
+   req->contextTag = gc->currentContextTag;
+   req->length += (dataLen + 3) >> 2;
+   req->requestNumber = requestNumber;
+   req->requestTotal = totalRequests;
+   req->dataBytes = dataLen;
+   Data(dpy, data, dataLen);
+
+   if (requestNumber == totalRequests) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+   }
+#endif /* USE_XCB */
+}
+
+
+/**
+ * Send a command that is too large for the GLXRender protocol request.
+ *
+ * Send a large command, one that is too large for some reason to
+ * send using the GLXRender protocol request.  One reason to send
+ * a large command is to avoid copying the data.
+ *
+ * \param ctx        GLX context
+ * \param header     Header data.
+ * \param headerLen  Size, in bytes, of the header data.  It is assumed that
+ *                   the header data will always be small enough to fit in
+ *                   a single X protocol packet.
+ * \param data       Command data.
+ * \param dataLen    Size, in bytes, of the command data.
+ */
+_X_HIDDEN void
+__glXSendLargeCommand(__GLXcontext * ctx,
+                      const GLvoid * header, GLint headerLen,
+                      const GLvoid * data, GLint dataLen)
+{
+   GLint maxSize;
+   GLint totalRequests, requestNumber;
+
+   /*
+    ** Calculate the maximum amount of data can be stuffed into a single
+    ** packet.  sz_xGLXRenderReq is added because bufSize is the maximum
+    ** packet size minus sz_xGLXRenderReq.
+    */
+   maxSize = (ctx->bufSize + sz_xGLXRenderReq) - sz_xGLXRenderLargeReq;
+   totalRequests = 1 + (dataLen / maxSize);
+   if (dataLen % maxSize)
+      totalRequests++;
+
+   /*
+    ** Send all of the command, except the large array, as one request.
+    */
+   assert(headerLen <= maxSize);
+   __glXSendLargeChunk(ctx, 1, totalRequests, header, headerLen);
+
+   /*
+    ** Send enough requests until the whole array is sent.
+    */
+   for (requestNumber = 2; requestNumber <= (totalRequests - 1);
+        requestNumber++) {
+      __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, maxSize);
+      data = (const GLvoid *) (((const GLubyte *) data) + maxSize);
+      dataLen -= maxSize;
+      assert(dataLen > 0);
+   }
+
+   assert(dataLen <= maxSize);
+   __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, dataLen);
+}
+
+/************************************************************************/
+
+#ifdef DEBUG
+_X_HIDDEN void
+__glXDumpDrawBuffer(__GLXcontext * ctx)
+{
+   GLubyte *p = ctx->buf;
+   GLubyte *end = ctx->pc;
+   GLushort opcode, length;
+
+   while (p < end) {
+      /* Fetch opcode */
+      opcode = *((GLushort *) p);
+      length = *((GLushort *) (p + 2));
+      printf("%2x: %5d: ", opcode, length);
+      length -= 4;
+      p += 4;
+      while (length > 0) {
+         printf("%08x ", *((unsigned *) p));
+         p += 4;
+         length -= 4;
+      }
+      printf("\n");
+   }
+}
+#endif
diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
new file mode 100644 (file)
index 0000000..56c69cb
--- /dev/null
@@ -0,0 +1,714 @@
+/*
+ * (C) Copyright IBM Corporation 2002, 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
+ * THE COPYRIGHT HOLDERS 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 glxextensions.c
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#include "glxclient.h"
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xext.h>
+#include <string.h>
+#include "glxextensions.h"
+
+
+#define SET_BIT(m,b)   (m[ (b) / 8 ] |=  (1U << ((b) % 8)))
+#define CLR_BIT(m,b)   (m[ (b) / 8 ] &= ~(1U << ((b) % 8)))
+#define IS_SET(m,b)    ((m[ (b) / 8 ] & (1U << ((b) % 8))) != 0)
+#define CONCAT(a,b) a ## b
+#define GLX(n) "GLX_" # n, 4 + sizeof( # n ) - 1, CONCAT(n,_bit)
+#define GL(n)  "GL_" # n,  3 + sizeof( # n ) - 1, GL_ ## n ## _bit
+#define VER(a,b)  a, b
+#define Y  1
+#define N  0
+#define EXT_ENABLED(bit,supported) (IS_SET( supported, bit ))
+
+
+struct extension_info
+{
+   const char *const name;
+   unsigned name_len;
+
+   unsigned char bit;
+
+   /* This is the lowest version of GLX that "requires" this extension.
+    * For example, GLX 1.3 requires SGIX_fbconfig, SGIX_pbuffer, and
+    * SGI_make_current_read.  If the extension is not required by any known
+    * version of GLX, use 0, 0.
+    */
+   unsigned char version_major;
+   unsigned char version_minor;
+   unsigned char client_support;
+   unsigned char direct_support;
+   unsigned char client_only;        /** Is the extension client-side only? */
+   unsigned char direct_only;        /** Is the extension for direct
+                                     * contexts only?
+                                     */
+};
+
+/* *INDENT-OFF* */
+static const struct extension_info known_glx_extensions[] = {
+   { GLX(ARB_get_proc_address),        VER(1,4), Y, N, Y, N },
+   { GLX(ARB_multisample),             VER(1,4), Y, Y, N, N },
+   { GLX(ARB_render_texture),          VER(0,0), N, N, N, N },
+   { GLX(ATI_pixel_format_float),      VER(0,0), N, N, N, N },
+   { GLX(EXT_import_context),          VER(0,0), Y, Y, N, N },
+   { GLX(EXT_visual_info),             VER(0,0), Y, Y, N, N },
+   { GLX(EXT_visual_rating),           VER(0,0), Y, Y, N, N },
+   { GLX(MESA_agp_offset),             VER(0,0), N, N, N, Y }, /* Deprecated */
+   { GLX(MESA_allocate_memory),        VER(0,0), Y, N, N, Y },
+   { GLX(MESA_copy_sub_buffer),        VER(0,0), Y, N, N, N },
+   { GLX(MESA_pixmap_colormap),        VER(0,0), N, N, N, N }, /* Deprecated */
+   { GLX(MESA_release_buffers),        VER(0,0), N, N, N, N }, /* Deprecated */
+   { GLX(MESA_swap_control),           VER(0,0), Y, N, N, Y },
+   { GLX(MESA_swap_frame_usage),       VER(0,0), Y, N, N, Y },
+   { GLX(NV_float_buffer),             VER(0,0), N, N, N, N },
+   { GLX(NV_render_depth_texture),     VER(0,0), N, N, N, N },
+   { GLX(NV_render_texture_rectangle), VER(0,0), N, N, N, N },
+   { GLX(NV_vertex_array_range),       VER(0,0), N, N, N, Y }, /* Deprecated */
+   { GLX(OML_swap_method),             VER(0,0), Y, Y, N, N },
+   { GLX(OML_sync_control),            VER(0,0), Y, N, N, Y },
+   { GLX(SGI_make_current_read),       VER(1,3), Y, N, N, N },
+   { GLX(SGI_swap_control),            VER(0,0), Y, N, N, N },
+   { GLX(SGI_video_sync),              VER(0,0), Y, N, N, Y },
+   { GLX(SGIS_blended_overlay),        VER(0,0), N, N, N, N },
+   { GLX(SGIS_color_range),            VER(0,0), N, N, N, N },
+   { GLX(SGIS_multisample),            VER(0,0), Y, Y, N, N },
+   { GLX(SGIX_fbconfig),               VER(1,3), Y, Y, N, N },
+   { GLX(SGIX_pbuffer),                VER(1,3), Y, Y, N, N },
+   { GLX(SGIX_swap_barrier),           VER(0,0), N, N, N, N },
+   { GLX(SGIX_swap_group),             VER(0,0), N, N, N, N },
+   { GLX(SGIX_visual_select_group),    VER(0,0), Y, Y, N, N },
+   { GLX(EXT_texture_from_pixmap),     VER(0,0), Y, N, N, N },
+   { GLX(INTEL_swap_event),            VER(1,4), Y, Y, N, N },
+   { NULL }
+};
+
+static const struct extension_info known_gl_extensions[] = {
+   { GL(ARB_depth_texture),              VER(1,4), Y, N, N, N },
+   { GL(ARB_draw_buffers),               VER(0,0), Y, N, N, N },
+   { GL(ARB_fragment_program),           VER(0,0), Y, N, N, N },
+   { GL(ARB_fragment_program_shadow),    VER(0,0), Y, N, N, N },
+   { GL(ARB_framebuffer_object),         VER(0,0), Y, N, N, N },
+   { GL(ARB_imaging),                    VER(0,0), Y, N, N, N },
+   { GL(ARB_multisample),                VER(1,3), Y, N, N, N },
+   { GL(ARB_multitexture),               VER(1,3), Y, N, N, N },
+   { GL(ARB_occlusion_query),            VER(1,5), Y, N, N, N },
+   { GL(ARB_point_parameters),           VER(1,4), Y, N, N, N },
+   { GL(ARB_point_sprite),               VER(0,0), Y, N, N, N },
+   { GL(ARB_shadow),                     VER(1,4), Y, N, N, N },
+   { GL(ARB_shadow_ambient),             VER(0,0), Y, N, N, N },
+   { GL(ARB_texture_border_clamp),       VER(1,3), Y, N, N, N },
+   { GL(ARB_texture_compression),        VER(1,3), Y, N, N, N },
+   { GL(ARB_texture_cube_map),           VER(1,3), Y, N, N, N },
+   { GL(ARB_texture_env_add),            VER(1,3), Y, N, N, N },
+   { GL(ARB_texture_env_combine),        VER(1,3), Y, N, N, N },
+   { GL(ARB_texture_env_crossbar),       VER(1,4), Y, N, N, N },
+   { GL(ARB_texture_env_dot3),           VER(1,3), Y, N, N, N },
+   { GL(ARB_texture_mirrored_repeat),    VER(1,4), Y, N, N, N },
+   { GL(ARB_texture_non_power_of_two),   VER(1,5), Y, N, N, N },
+   { GL(ARB_texture_rectangle),          VER(0,0), Y, N, N, N },
+   { GL(ARB_transpose_matrix),           VER(1,3), Y, N, Y, N },
+   { GL(ARB_vertex_buffer_object),       VER(1,5), N, N, N, N },
+   { GL(ARB_vertex_program),             VER(0,0), Y, N, N, N },
+   { GL(ARB_window_pos),                 VER(1,4), Y, N, N, N },
+   { GL(EXT_abgr),                       VER(0,0), Y, N, N, N },
+   { GL(EXT_bgra),                       VER(1,2), Y, N, N, N },
+   { GL(EXT_blend_color),                VER(1,4), Y, N, N, N },
+   { GL(EXT_blend_equation_separate),    VER(0,0), Y, N, N, N },
+   { GL(EXT_blend_func_separate),        VER(1,4), Y, N, N, N },
+   { GL(EXT_blend_logic_op),             VER(1,4), Y, N, N, N },
+   { GL(EXT_blend_minmax),               VER(1,4), Y, N, N, N },
+   { GL(EXT_blend_subtract),             VER(1,4), Y, N, N, N },
+   { GL(EXT_clip_volume_hint),           VER(0,0), Y, N, N, N },
+   { GL(EXT_compiled_vertex_array),      VER(0,0), N, N, N, N },
+   { GL(EXT_convolution),                VER(0,0), N, N, N, N },
+   { GL(EXT_copy_texture),               VER(1,1), Y, N, N, N },
+   { GL(EXT_cull_vertex),                VER(0,0), N, N, N, N },
+   { GL(EXT_depth_bounds_test),          VER(0,0), N, N, N, N },
+   { GL(EXT_draw_range_elements),        VER(1,2), Y, N, Y, N },
+   { GL(EXT_fog_coord),                  VER(1,4), Y, N, N, N },
+   { GL(EXT_framebuffer_blit),           VER(0,0), Y, N, N, N },
+   { GL(EXT_framebuffer_multisample),    VER(0,0), Y, N, N, N },
+   { GL(EXT_framebuffer_object),         VER(0,0), Y, N, N, N },
+   { GL(EXT_multi_draw_arrays),          VER(1,4), Y, N, Y, N },
+   { GL(EXT_packed_depth_stencil),       VER(0,0), Y, N, N, N },
+   { GL(EXT_packed_pixels),              VER(1,2), Y, N, N, N },
+   { GL(EXT_paletted_texture),           VER(0,0), Y, N, N, N },
+   { GL(EXT_pixel_buffer_object),        VER(0,0), N, N, N, N },
+   { GL(EXT_point_parameters),           VER(1,4), Y, N, N, N },
+   { GL(EXT_polygon_offset),             VER(1,1), Y, N, N, N },
+   { GL(EXT_rescale_normal),             VER(1,2), Y, N, N, N },
+   { GL(EXT_secondary_color),            VER(1,4), Y, N, N, N },
+   { GL(EXT_separate_specular_color),    VER(1,2), Y, N, N, N },
+   { GL(EXT_shadow_funcs),               VER(1,5), Y, N, N, N },
+   { GL(EXT_shared_texture_palette),     VER(0,0), Y, N, N, N },
+   { GL(EXT_stencil_two_side),           VER(0,0), Y, N, N, N },
+   { GL(EXT_stencil_wrap),               VER(1,4), Y, N, N, N },
+   { GL(EXT_subtexture),                 VER(1,1), Y, N, N, N },
+   { GL(EXT_texture),                    VER(1,1), Y, N, N, N },
+   { GL(EXT_texture3D),                  VER(1,2), Y, N, N, N },
+   { GL(EXT_texture_compression_dxt1),   VER(0,0), Y, N, N, N },
+   { GL(EXT_texture_compression_s3tc),   VER(0,0), Y, N, N, N },
+   { GL(EXT_texture_edge_clamp),         VER(1,2), Y, N, N, N },
+   { GL(EXT_texture_env_add),            VER(1,3), Y, N, N, N },
+   { GL(EXT_texture_env_combine),        VER(1,3), Y, N, N, N },
+   { GL(EXT_texture_env_dot3),           VER(0,0), Y, N, N, N },
+   { GL(EXT_texture_filter_anisotropic), VER(0,0), Y, N, N, N },
+   { GL(EXT_texture_lod),                VER(1,2), Y, N, N, N },
+   { GL(EXT_texture_lod_bias),           VER(1,4), Y, N, N, N },
+   { GL(EXT_texture_mirror_clamp),       VER(0,0), Y, N, N, N },
+   { GL(EXT_texture_object),             VER(1,1), Y, N, N, N },
+   { GL(EXT_texture_rectangle),          VER(0,0), Y, N, N, N },
+   { GL(EXT_vertex_array),               VER(0,0), Y, N, N, N },
+   { GL(3DFX_texture_compression_FXT1),  VER(0,0), Y, N, N, N },
+   { GL(APPLE_packed_pixels),            VER(1,2), Y, N, N, N },
+   { GL(APPLE_ycbcr_422),                VER(0,0), Y, N, N, N },
+   { GL(ATI_draw_buffers),               VER(0,0), Y, N, N, N },
+   { GL(ATI_text_fragment_shader),       VER(0,0), Y, N, N, N },
+   { GL(ATI_texture_env_combine3),       VER(0,0), Y, N, N, N },
+   { GL(ATI_texture_float),              VER(0,0), Y, N, N, N },
+   { GL(ATI_texture_mirror_once),        VER(0,0), Y, N, N, N },
+   { GL(ATIX_texture_env_combine3),      VER(0,0), Y, N, N, N },
+   { GL(HP_convolution_border_modes),    VER(0,0), Y, N, N, N },
+   { GL(HP_occlusion_test),              VER(0,0), Y, N, N, N },
+   { GL(IBM_cull_vertex),                VER(0,0), Y, N, N, N },
+   { GL(IBM_pixel_filter_hint),          VER(0,0), Y, N, N, N },
+   { GL(IBM_rasterpos_clip),             VER(0,0), Y, N, N, N },
+   { GL(IBM_texture_clamp_nodraw),       VER(0,0), Y, N, N, N },
+   { GL(IBM_texture_mirrored_repeat),    VER(0,0), Y, N, N, N },
+   { GL(INGR_blend_func_separate),       VER(0,0), Y, N, N, N },
+   { GL(INGR_interlace_read),            VER(0,0), Y, N, N, N },
+   { GL(MESA_pack_invert),               VER(0,0), Y, N, N, N },
+   { GL(MESA_ycbcr_texture),             VER(0,0), Y, N, N, N },
+   { GL(NV_blend_square),                VER(1,4), Y, N, N, N },
+   { GL(NV_copy_depth_to_color),         VER(0,0), Y, N, N, N },
+   { GL(NV_depth_clamp),                 VER(0,0), Y, N, N, N },
+   { GL(NV_fog_distance),                VER(0,0), Y, N, N, N },
+   { GL(NV_fragment_program),            VER(0,0), Y, N, N, N },
+   { GL(NV_fragment_program_option),     VER(0,0), Y, N, N, N },
+   { GL(NV_fragment_program2),           VER(0,0), Y, N, N, N },
+   { GL(NV_light_max_exponent),          VER(0,0), Y, N, N, N },
+   { GL(NV_multisample_filter_hint),     VER(0,0), Y, N, N, N },
+   { GL(NV_packed_depth_stencil),        VER(0,0), Y, N, N, N },
+   { GL(NV_point_sprite),                VER(0,0), Y, N, N, N },
+   { GL(NV_texgen_reflection),           VER(0,0), Y, N, N, N },
+   { GL(NV_texture_compression_vtc),     VER(0,0), Y, N, N, N },
+   { GL(NV_texture_env_combine4),        VER(0,0), Y, N, N, N },
+   { GL(NV_texture_rectangle),           VER(0,0), Y, N, N, N },
+   { GL(NV_vertex_program),              VER(0,0), Y, N, N, N },
+   { GL(NV_vertex_program1_1),           VER(0,0), Y, N, N, N },
+   { GL(NV_vertex_program2),             VER(0,0), Y, N, N, N },
+   { GL(NV_vertex_program2_option),      VER(0,0), Y, N, N, N },
+   { GL(NV_vertex_program3),             VER(0,0), Y, N, N, N },
+   { GL(OES_read_format),                VER(0,0), Y, N, N, N },
+   { GL(OES_compressed_paletted_texture),VER(0,0), Y, N, N, N },
+   { GL(SGI_color_matrix),               VER(0,0), Y, N, N, N },
+   { GL(SGI_color_table),                VER(0,0), Y, N, N, N },
+   { GL(SGI_texture_color_table),        VER(0,0), Y, N, N, N },
+   { GL(SGIS_generate_mipmap),           VER(1,4), Y, N, N, N },
+   { GL(SGIS_multisample),               VER(0,0), Y, N, N, N },
+   { GL(SGIS_texture_border_clamp),      VER(1,3), Y, N, N, N },
+   { GL(SGIS_texture_edge_clamp),        VER(1,2), Y, N, N, N },
+   { GL(SGIS_texture_lod),               VER(1,2), Y, N, N, N },
+   { GL(SGIX_blend_alpha_minmax),        VER(0,0), Y, N, N, N },
+   { GL(SGIX_clipmap),                   VER(0,0), Y, N, N, N },
+   { GL(SGIX_depth_texture),             VER(0,0), Y, N, N, N },
+   { GL(SGIX_fog_offset),                VER(0,0), Y, N, N, N },
+   { GL(SGIX_shadow),                    VER(0,0), Y, N, N, N },
+   { GL(SGIX_shadow_ambient),            VER(0,0), Y, N, N, N },
+   { GL(SGIX_texture_coordinate_clamp),  VER(0,0), Y, N, N, N },
+   { GL(SGIX_texture_lod_bias),          VER(0,0), Y, N, N, N },
+   { GL(SGIX_texture_range),             VER(0,0), Y, N, N, N },
+   { GL(SGIX_texture_scale_bias),        VER(0,0), Y, N, N, N },
+   { GL(SGIX_vertex_preclip),            VER(0,0), Y, N, N, N },
+   { GL(SGIX_vertex_preclip_hint),       VER(0,0), Y, N, N, N },
+   { GL(SGIX_ycrcb),                     VER(0,0), Y, N, N, N },
+   { GL(SUN_convolution_border_modes),   VER(0,0), Y, N, N, N },
+   { GL(SUN_multi_draw_arrays),          VER(0,0), Y, N, Y, N },
+   { GL(SUN_slice_accum),                VER(0,0), Y, N, N, N },
+   { NULL }
+};
+/* *INDENT-ON* */
+
+
+/* global bit-fields of available extensions and their characteristics */
+static unsigned char client_glx_support[8];
+static unsigned char client_glx_only[8];
+static unsigned char direct_glx_only[8];
+static unsigned char client_gl_support[__GL_EXT_BYTES];
+static unsigned char client_gl_only[__GL_EXT_BYTES];
+
+/**
+ * Bits representing the set of extensions that are enabled by default in all
+ * direct rendering drivers.
+ */
+static unsigned char direct_glx_support[8];
+
+/**
+ * Highest core GL version that can be supported for indirect rendering.
+ */
+static const unsigned gl_major = 1;
+static const unsigned gl_minor = 4;
+
+/* client extensions string */
+static const char *__glXGLXClientExtensions = NULL;
+
+static void __glXExtensionsCtr(void);
+static void __glXExtensionsCtrScreen(__GLXscreenConfigs * psc);
+static void __glXProcessServerString(const struct extension_info *ext,
+                                     const char *server_string,
+                                     unsigned char *server_support);
+
+/**
+ * Set the state of a GLX extension.
+ *
+ * \param name      Name of the extension.
+ * \param name_len  Length, in characters, of the extension name.
+ * \param state     New state (either enabled or disabled) of the extension.
+ * \param supported Table in which the state of the extension is to be set.
+ */
+static void
+set_glx_extension(const struct extension_info *ext,
+                  const char *name, unsigned name_len, GLboolean state,
+                  unsigned char *supported)
+{
+   unsigned i;
+
+
+   for (i = 0; ext[i].name != NULL; i++) {
+      if ((name_len == ext[i].name_len)
+          && (strncmp(ext[i].name, name, name_len) == 0)) {
+         if (state) {
+            SET_BIT(supported, ext[i].bit);
+         }
+         else {
+            CLR_BIT(supported, ext[i].bit);
+         }
+
+         return;
+      }
+   }
+}
+
+
+#define NUL '\0'
+#define SEPARATOR ' '
+
+/**
+ * Convert the server's extension string to a bit-field.
+ *
+ * \param server_string   GLX extension string from the server.
+ * \param server_support  Bit-field of supported extensions.
+ *
+ * \note
+ * This function is used to process both GLX and GL extension strings.  The
+ * bit-fields used to track each of these have different sizes.  Therefore,
+ * the data pointed by \c server_support must be preinitialized to zero.
+ */
+static void
+__glXProcessServerString(const struct extension_info *ext,
+                         const char *server_string,
+                         unsigned char *server_support)
+{
+   unsigned base;
+   unsigned len;
+
+   for (base = 0; server_string[base] != NUL; /* empty */ ) {
+      /* Determine the length of the next extension name.
+       */
+      for (len = 0; (server_string[base + len] != SEPARATOR)
+           && (server_string[base + len] != NUL); len++) {
+         /* empty */
+      }
+
+      /* Set the bit for the extension in the server_support table.
+       */
+      set_glx_extension(ext, &server_string[base], len, GL_TRUE,
+                        server_support);
+
+
+      /* Advance to the next extension string.  This means that we skip
+       * over the previous string and any trialing white-space.
+       */
+      for (base += len; (server_string[base] == SEPARATOR)
+           && (server_string[base] != NUL); base++) {
+         /* empty */
+      }
+   }
+}
+
+void
+__glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name)
+{
+   __glXExtensionsCtr();
+   __glXExtensionsCtrScreen(psc);
+
+   set_glx_extension(known_glx_extensions,
+                     name, strlen(name), GL_TRUE, psc->direct_support);
+}
+
+/**
+ * Initialize global extension support tables.
+ */
+
+static void
+__glXExtensionsCtr(void)
+{
+   unsigned i;
+   static GLboolean ext_list_first_time = GL_TRUE;
+
+
+   if (ext_list_first_time) {
+      ext_list_first_time = GL_FALSE;
+
+      (void) memset(client_glx_support, 0, sizeof(client_glx_support));
+      (void) memset(direct_glx_support, 0, sizeof(direct_glx_support));
+      (void) memset(client_glx_only, 0, sizeof(client_glx_only));
+      (void) memset(direct_glx_only, 0, sizeof(direct_glx_only));
+
+      (void) memset(client_gl_support, 0, sizeof(client_gl_support));
+      (void) memset(client_gl_only, 0, sizeof(client_gl_only));
+
+      for (i = 0; known_glx_extensions[i].name != NULL; i++) {
+         const unsigned bit = known_glx_extensions[i].bit;
+
+         if (known_glx_extensions[i].client_support) {
+            SET_BIT(client_glx_support, bit);
+         }
+
+         if (known_glx_extensions[i].direct_support) {
+            SET_BIT(direct_glx_support, bit);
+         }
+
+         if (known_glx_extensions[i].client_only) {
+            SET_BIT(client_glx_only, bit);
+         }
+
+         if (known_glx_extensions[i].direct_only) {
+            SET_BIT(direct_glx_only, bit);
+         }
+      }
+
+      for (i = 0; known_gl_extensions[i].name != NULL; i++) {
+         const unsigned bit = known_gl_extensions[i].bit;
+
+         if (known_gl_extensions[i].client_support) {
+            SET_BIT(client_gl_support, bit);
+         }
+
+         if (known_gl_extensions[i].client_only) {
+            SET_BIT(client_gl_only, bit);
+         }
+      }
+
+#if 0
+      fprintf(stderr, "[%s:%u] Maximum client library version: %u.%u\n",
+              __func__, __LINE__, gl_major, gl_minor);
+#endif
+   }
+}
+
+
+/**
+ * Make sure that per-screen direct-support table is initialized.
+ *
+ * \param psc  Pointer to GLX per-screen record.
+ */
+
+static void
+__glXExtensionsCtrScreen(__GLXscreenConfigs * psc)
+{
+   if (psc->ext_list_first_time) {
+      psc->ext_list_first_time = GL_FALSE;
+      (void) memcpy(psc->direct_support, direct_glx_support,
+                    sizeof(direct_glx_support));
+   }
+}
+
+
+/**
+ * Check if a certain extension is enabled on a given screen.
+ *
+ * \param psc  Pointer to GLX per-screen record.
+ * \param bit  Bit index in the direct-support table.
+ * \returns If the extension bit is enabled for the screen, \c GL_TRUE is
+ *          returned.  If the extension bit is not enabled or if \c psc is
+ *          \c NULL, then \c GL_FALSE is returned.
+ */
+GLboolean
+__glXExtensionBitIsEnabled(__GLXscreenConfigs * psc, unsigned bit)
+{
+   GLboolean enabled = GL_FALSE;
+
+   if (psc != NULL) {
+      __glXExtensionsCtr();
+      __glXExtensionsCtrScreen(psc);
+      enabled = EXT_ENABLED(bit, psc->direct_support);
+   }
+
+   return enabled;
+}
+
+
+/**
+ * Check if a certain extension is enabled in a given context.
+ *
+ */
+GLboolean
+__glExtensionBitIsEnabled(const __GLXcontext * gc, unsigned bit)
+{
+   GLboolean enabled = GL_FALSE;
+
+   if (gc != NULL) {
+      enabled = EXT_ENABLED(bit, gc->gl_extension_bits);
+   }
+
+   return enabled;
+}
+
+
+
+/**
+ * Convert a bit-field to a string of supported extensions.
+ */
+static char *
+__glXGetStringFromTable(const struct extension_info *ext,
+                        const unsigned char *supported)
+{
+   unsigned i;
+   unsigned ext_str_len;
+   char *ext_str;
+   char *point;
+
+
+   ext_str_len = 0;
+   for (i = 0; ext[i].name != NULL; i++) {
+      if (EXT_ENABLED(ext[i].bit, supported)) {
+         ext_str_len += ext[i].name_len + 1;
+      }
+   }
+
+   ext_str = Xmalloc(ext_str_len + 1);
+   if (ext_str != NULL) {
+      point = ext_str;
+
+      for (i = 0; ext[i].name != NULL; i++) {
+         if (EXT_ENABLED(ext[i].bit, supported)) {
+            (void) memcpy(point, ext[i].name, ext[i].name_len);
+            point += ext[i].name_len;
+
+            *point = ' ';
+            point++;
+         }
+      }
+
+      *point = '\0';
+   }
+
+   return ext_str;
+}
+
+
+/**
+ * Get the string of client library supported extensions.
+ */
+const char *
+__glXGetClientExtensions(void)
+{
+   if (__glXGLXClientExtensions == NULL) {
+      __glXExtensionsCtr();
+      __glXGLXClientExtensions = __glXGetStringFromTable(known_glx_extensions,
+                                                         client_glx_support);
+   }
+
+   return __glXGLXClientExtensions;
+}
+
+
+/**
+ * Calculate the list of application usable extensions.  The resulting
+ * string is stored in \c psc->effectiveGLXexts.
+ *
+ * \param psc                        Pointer to GLX per-screen record.
+ * \param display_is_direct_capable  True if the display is capable of
+ *                                   direct rendering.
+ * \param minor_version              GLX minor version from the server.
+ */
+
+void
+__glXCalculateUsableExtensions(__GLXscreenConfigs * psc,
+                               GLboolean display_is_direct_capable,
+                               int minor_version)
+{
+   unsigned char server_support[8];
+   unsigned char usable[8];
+   unsigned i;
+
+   __glXExtensionsCtr();
+   __glXExtensionsCtrScreen(psc);
+
+   (void) memset(server_support, 0, sizeof(server_support));
+   __glXProcessServerString(known_glx_extensions,
+                            psc->serverGLXexts, server_support);
+
+
+   /* This is a hack.  Some servers support GLX 1.3 but don't export
+    * all of the extensions implied by GLX 1.3.  If the server claims
+    * support for GLX 1.3, enable support for the extensions that can be
+    * "emulated" as well.
+    */
+
+   if (minor_version >= 3) {
+      SET_BIT(server_support, EXT_visual_info_bit);
+      SET_BIT(server_support, EXT_visual_rating_bit);
+      SET_BIT(server_support, SGI_make_current_read_bit);
+      SET_BIT(server_support, SGIX_fbconfig_bit);
+      SET_BIT(server_support, SGIX_pbuffer_bit);
+
+      /* This one is a little iffy.  GLX 1.3 doesn't incorporate all of this
+       * extension.  However, the only part that is not strictly client-side
+       * is shared.  That's the glXQueryContext / glXQueryContextInfoEXT
+       * function.
+       */
+
+      SET_BIT(server_support, EXT_import_context_bit);
+   }
+
+
+   /* An extension is supported if the client-side (i.e., libGL) supports
+    * it and the "server" supports it.  In this case that means that either
+    * the true server supports it or it is only for direct-rendering and
+    * the direct rendering driver supports it.
+    *
+    * If the display is not capable of direct rendering, then the extension
+    * is enabled if and only if the client-side library and the server
+    * support it.
+    */
+
+   if (display_is_direct_capable) {
+      for (i = 0; i < 8; i++) {
+         usable[i] = (client_glx_support[i] & client_glx_only[i])
+            | (client_glx_support[i] & psc->direct_support[i] &
+               server_support[i])
+            | (client_glx_support[i] & psc->direct_support[i] &
+               direct_glx_only[i]);
+      }
+   }
+   else {
+      for (i = 0; i < 8; i++) {
+         usable[i] = (client_glx_support[i] & client_glx_only[i])
+            | (client_glx_support[i] & server_support[i]);
+      }
+   }
+
+   psc->effectiveGLXexts = __glXGetStringFromTable(known_glx_extensions,
+                                                   usable);
+}
+
+
+/**
+ * Calculate the list of application usable extensions.  The resulting
+ * string is stored in \c gc->extensions.
+ *
+ * \param gc             Pointer to GLX context.
+ * \param server_string  Extension string from the server.
+ * \param major_version  GL major version from the server.
+ * \param minor_version  GL minor version from the server.
+ */
+
+void
+__glXCalculateUsableGLExtensions(__GLXcontext * gc,
+                                 const char *server_string,
+                                 int major_version, int minor_version)
+{
+   unsigned char server_support[__GL_EXT_BYTES];
+   unsigned char usable[__GL_EXT_BYTES];
+   unsigned i;
+
+
+   __glXExtensionsCtr();
+
+   (void) memset(server_support, 0, sizeof(server_support));
+   __glXProcessServerString(known_gl_extensions, server_string,
+                            server_support);
+
+
+   /* Handle lazy servers that don't export all the extensions strings that
+    * are part of the GL core version that they support.
+    */
+
+   for (i = 0; i < __GL_EXT_BYTES; i++) {
+      if ((known_gl_extensions[i].version_major != 0)
+          && ((major_version > known_gl_extensions[i].version_major)
+              || ((major_version == known_gl_extensions[i].version_major)
+                  && (minor_version >=
+                      known_gl_extensions[i].version_minor)))) {
+         SET_BIT(server_support, known_gl_extensions[i].bit);
+      }
+   }
+
+
+   /* An extension is supported if the client-side (i.e., libGL) supports
+    * it and the server supports it or the client-side library supports it
+    * and it only needs client-side support.
+    */
+
+   for (i = 0; i < __GL_EXT_BYTES; i++) {
+      usable[i] = (client_gl_support[i] & client_gl_only[i])
+         | (client_gl_support[i] & server_support[i]);
+   }
+
+   gc->extensions = (unsigned char *)
+      __glXGetStringFromTable(known_gl_extensions, usable);
+   (void) memcpy(gc->gl_extension_bits, usable, sizeof(usable));
+}
+
+
+/**
+ * Calculates the maximum core GL version that can be supported for indirect
+ * rendering.
+ */
+void
+__glXGetGLVersion(int *major_version, int *minor_version)
+{
+   __glXExtensionsCtr();
+   *major_version = gl_major;
+   *minor_version = gl_minor;
+}
+
+
+/**
+ * Get a string representing the set of extensions supported by the client
+ * library.  This is currently only used to send the list of extensions
+ * supported by the client to the server.
+ */
+char *
+__glXGetClientGLExtensionString(void)
+{
+   __glXExtensionsCtr();
+   return __glXGetStringFromTable(known_gl_extensions, client_gl_support);
+}
diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
new file mode 100644 (file)
index 0000000..f556b12
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+ * (C) Copyright IBM Corporation 2002, 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
+ * THE COPYRIGHT HOLDERS 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 glxextensions.h
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#ifndef GLX_GLXEXTENSIONS_H
+#define GLX_GLXEXTENSIONS_H
+
+enum
+{
+   ARB_get_proc_address_bit = 0,
+   ARB_multisample_bit,
+   ARB_render_texture_bit,
+   ATI_pixel_format_float_bit,
+   EXT_visual_info_bit,
+   EXT_visual_rating_bit,
+   EXT_import_context_bit,
+   MESA_agp_offset_bit,
+   MESA_allocate_memory_bit,    /* Replaces MESA_agp_offset & NV_vertex_array_range */
+   MESA_copy_sub_buffer_bit,
+   MESA_depth_float_bit,
+   MESA_pixmap_colormap_bit,
+   MESA_release_buffers_bit,
+   MESA_swap_control_bit,
+   MESA_swap_frame_usage_bit,
+   NV_float_buffer_bit,
+   NV_render_depth_texture_bit,
+   NV_render_texture_rectangle_bit,
+   NV_vertex_array_range_bit,
+   OML_swap_method_bit,
+   OML_sync_control_bit,
+   SGI_make_current_read_bit,
+   SGI_swap_control_bit,
+   SGI_video_sync_bit,
+   SGIS_blended_overlay_bit,
+   SGIS_color_range_bit,
+   SGIS_multisample_bit,
+   SGIX_fbconfig_bit,
+   SGIX_pbuffer_bit,
+   SGIX_swap_barrier_bit,
+   SGIX_swap_group_bit,
+   SGIX_visual_select_group_bit,
+   EXT_texture_from_pixmap_bit,
+   INTEL_swap_event_bit,
+};
+
+enum
+{
+   GL_ARB_depth_texture_bit = 0,
+   GL_ARB_draw_buffers_bit,
+   GL_ARB_fragment_program_bit,
+   GL_ARB_fragment_program_shadow_bit,
+   GL_ARB_framebuffer_object_bit,
+   GL_ARB_imaging_bit,
+   GL_ARB_multisample_bit,
+   GL_ARB_multitexture_bit,
+   GL_ARB_occlusion_query_bit,
+   GL_ARB_point_parameters_bit,
+   GL_ARB_point_sprite_bit,
+   GL_ARB_shadow_bit,
+   GL_ARB_shadow_ambient_bit,
+   GL_ARB_texture_border_clamp_bit,
+   GL_ARB_texture_cube_map_bit,
+   GL_ARB_texture_compression_bit,
+   GL_ARB_texture_env_add_bit,
+   GL_ARB_texture_env_combine_bit,
+   GL_ARB_texture_env_crossbar_bit,
+   GL_ARB_texture_env_dot3_bit,
+   GL_ARB_texture_mirrored_repeat_bit,
+   GL_ARB_texture_non_power_of_two_bit,
+   GL_ARB_texture_rectangle_bit,
+   GL_ARB_transpose_matrix_bit,
+   GL_ARB_vertex_buffer_object_bit,
+   GL_ARB_vertex_program_bit,
+   GL_ARB_window_pos_bit,
+   GL_EXT_abgr_bit,
+   GL_EXT_bgra_bit,
+   GL_EXT_blend_color_bit,
+   GL_EXT_blend_equation_separate_bit,
+   GL_EXT_blend_func_separate_bit,
+   GL_EXT_blend_logic_op_bit,
+   GL_EXT_blend_minmax_bit,
+   GL_EXT_blend_subtract_bit,
+   GL_EXT_clip_volume_hint_bit,
+   GL_EXT_compiled_vertex_array_bit,
+   GL_EXT_convolution_bit,
+   GL_EXT_copy_texture_bit,
+   GL_EXT_cull_vertex_bit,
+   GL_EXT_depth_bounds_test_bit,
+   GL_EXT_draw_range_elements_bit,
+   GL_EXT_fog_coord_bit,
+   GL_EXT_framebuffer_blit_bit,
+   GL_EXT_framebuffer_multisample_bit,
+   GL_EXT_framebuffer_object_bit,
+   GL_EXT_multi_draw_arrays_bit,
+   GL_EXT_packed_depth_stencil_bit,
+   GL_EXT_packed_pixels_bit,
+   GL_EXT_paletted_texture_bit,
+   GL_EXT_pixel_buffer_object_bit,
+   GL_EXT_polygon_offset_bit,
+   GL_EXT_rescale_normal_bit,
+   GL_EXT_secondary_color_bit,
+   GL_EXT_separate_specular_color_bit,
+   GL_EXT_shadow_funcs_bit,
+   GL_EXT_shared_texture_palette_bit,
+   GL_EXT_stencil_two_side_bit,
+   GL_EXT_stencil_wrap_bit,
+   GL_EXT_subtexture_bit,
+   GL_EXT_texture_bit,
+   GL_EXT_texture3D_bit,
+   GL_EXT_texture_compression_dxt1_bit,
+   GL_EXT_texture_compression_s3tc_bit,
+   GL_EXT_texture_edge_clamp_bit,
+   GL_EXT_texture_env_combine_bit,
+   GL_EXT_texture_env_dot3_bit,
+   GL_EXT_texture_filter_anisotropic_bit,
+   GL_EXT_texture_lod_bit,
+   GL_EXT_texture_lod_bias_bit,
+   GL_EXT_texture_mirror_clamp_bit,
+   GL_EXT_texture_object_bit,
+   GL_EXT_vertex_array_bit,
+   GL_3DFX_texture_compression_FXT1_bit,
+   GL_APPLE_packed_pixels_bit,
+   GL_APPLE_ycbcr_422_bit,
+   GL_ATI_text_fragment_shader_bit,
+   GL_ATI_texture_env_combine3_bit,
+   GL_ATI_texture_float_bit,
+   GL_ATI_texture_mirror_once_bit,
+   GL_HP_convolution_border_modes_bit,
+   GL_HP_occlusion_test_bit,
+   GL_IBM_cull_vertex_bit,
+   GL_IBM_pixel_filter_hint_bit,
+   GL_IBM_rasterpos_clip_bit,
+   GL_IBM_texture_clamp_nodraw_bit,
+   GL_INGR_interlace_read_bit,
+   GL_MESA_pack_invert_bit,
+   GL_MESA_ycbcr_texture_bit,
+   GL_NV_blend_square_bit,
+   GL_NV_copy_depth_to_color_bit,
+   GL_NV_depth_clamp_bit,
+   GL_NV_fog_distance_bit,
+   GL_NV_fragment_program_bit,
+   GL_NV_fragment_program_option_bit,
+   GL_NV_fragment_program2_bit,
+   GL_NV_light_max_exponent_bit,
+   GL_NV_multisample_filter_hint_bit,
+   GL_NV_packed_depth_stencil_bit,
+   GL_NV_point_sprite_bit,
+   GL_NV_texgen_reflection_bit,
+   GL_NV_texture_compression_vtc_bit,
+   GL_NV_texture_env_combine4_bit,
+   GL_NV_vertex_program_bit,
+   GL_NV_vertex_program1_1_bit,
+   GL_NV_vertex_program2_bit,
+   GL_NV_vertex_program2_option_bit,
+   GL_NV_vertex_program3_bit,
+   GL_OES_compressed_paletted_texture_bit,
+   GL_OES_read_format_bit,
+   GL_SGI_color_matrix_bit,
+   GL_SGI_color_table_bit,
+   GL_SGI_texture_color_table_bit,
+   GL_SGIS_generate_mipmap_bit,
+   GL_SGIS_multisample_bit,
+   GL_SGIS_texture_lod_bit,
+   GL_SGIX_blend_alpha_minmax_bit,
+   GL_SGIX_clipmap_bit,
+   GL_SGIX_depth_texture_bit,
+   GL_SGIX_fog_offset_bit,
+   GL_SGIX_shadow_bit,
+   GL_SGIX_texture_coordinate_clamp_bit,
+   GL_SGIX_texture_lod_bias_bit,
+   GL_SGIX_texture_range_bit,
+   GL_SGIX_texture_scale_bias_bit,
+   GL_SGIX_vertex_preclip_bit,
+   GL_SGIX_vertex_preclip_hint_bit,
+   GL_SGIX_ycrcb_bit,
+   GL_SUN_convolution_border_modes_bit,
+   GL_SUN_slice_accum_bit,
+
+   /* This *MUST* go here.  If it gets put after the duplicate values it will
+    * get the value after the last duplicate.
+    */
+   __NUM_GL_EXTS,
+
+
+   /* Alias extension bits.  These extensions exist in either vendor-specific
+    * or EXT form and were later promoted to either EXT or ARB form.  In all
+    * cases, the meaning is *exactly* the same.  That's why
+    * EXT_texture_env_combine is *NOT* an alias of ARB_texture_env_combine and
+    * EXT_texture_env_dot3 is *NOT* an alias of ARB_texture_env_dot3.  Be
+    * careful!  When in doubt, src/mesa/main/extensions.c in the Mesa tree
+    * is a great reference.
+    */
+
+   GL_ATI_blend_equation_separate_bit = GL_EXT_blend_equation_separate_bit,
+   GL_ATI_draw_buffers_bit = GL_ARB_draw_buffers_bit,
+   GL_ATIX_texture_env_combine3_bit = GL_ATI_texture_env_combine3_bit,
+   GL_EXT_point_parameters_bit = GL_ARB_point_parameters_bit,
+   GL_EXT_texture_env_add_bit = GL_ARB_texture_env_add_bit,
+   GL_EXT_texture_rectangle_bit = GL_ARB_texture_rectangle_bit,
+   GL_IBM_texture_mirrored_repeat_bit = GL_ARB_texture_mirrored_repeat_bit,
+   GL_INGR_blend_func_separate_bit = GL_EXT_blend_func_separate_bit,
+   GL_MESA_window_pos_bit = GL_ARB_window_pos_bit,
+   GL_NV_texture_rectangle_bit = GL_ARB_texture_rectangle_bit,
+   GL_SGIS_texture_border_clamp_bit = GL_ARB_texture_border_clamp_bit,
+   GL_SGIS_texture_edge_clamp_bit = GL_EXT_texture_edge_clamp_bit,
+   GL_SGIX_shadow_ambient_bit = GL_ARB_shadow_ambient_bit,
+   GL_SUN_multi_draw_arrays_bit = GL_EXT_multi_draw_arrays_bit
+};
+
+#define __GL_EXT_BYTES   ((__NUM_GL_EXTS + 7) / 8)
+
+struct __GLXscreenConfigsRec;
+struct __GLXcontextRec;
+
+extern GLboolean __glXExtensionBitIsEnabled(struct __GLXscreenConfigsRec *psc,
+                                            unsigned bit);
+extern const char *__glXGetClientExtensions(void);
+extern void __glXCalculateUsableExtensions(struct __GLXscreenConfigsRec *psc,
+                                           GLboolean
+                                           display_is_direct_capable,
+                                           int server_minor_version);
+
+extern void __glXCalculateUsableGLExtensions(struct __GLXcontextRec *gc,
+                                             const char *server_string,
+                                             int major_version,
+                                             int minor_version);
+extern void __glXGetGLVersion(int *major_version, int *minor_version);
+extern char *__glXGetClientGLExtensionString(void);
+
+extern GLboolean __glExtensionBitIsEnabled(const struct __GLXcontextRec *gc,
+                                           unsigned bit);
+
+extern void
+__glXEnableDirectExtension(struct __GLXscreenConfigsRec *psc,
+                           const char *name);
+
+/* Source-level backwards compatibility with old drivers. They won't
+ * find the respective functions, though. 
+ */
+typedef void (*PFNGLXENABLEEXTENSIONPROC) (const char *name,
+                                           GLboolean force_client);
+typedef void (*PFNGLXDISABLEEXTENSIONPROC) (const char *name);
+
+/* GLX_ALIAS should be used for functions with a non-void return type.
+   GLX_ALIAS_VOID is for functions with a void return type. */
+#ifdef GLX_NO_STATIC_EXTENSION_FUNCTIONS
+# define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func)
+# define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func)
+#else
+# if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
+#  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
+   return_type  real_func  proto_args                                   \
+   __attribute__ ((alias( # aliased_func ) ));
+#  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
+   GLX_ALIAS(void, real_func, proto_args, args, aliased_func)
+# else
+#  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
+   return_type  real_func  proto_args                                   \
+   { return aliased_func args ; }
+#  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
+   void  real_func  proto_args                                      \
+   { aliased_func args ; }
+# endif /* __GNUC__ */
+#endif /* GLX_NO_STATIC_EXTENSION_FUNCTIONS */
+
+#endif /* GLX_GLXEXTENSIONS_H */
diff --git a/src/glx/glxhash.c b/src/glx/glxhash.c
new file mode 100644 (file)
index 0000000..b76ec32
--- /dev/null
@@ -0,0 +1,473 @@
+/* glxhash.c -- Small hash table support for integer -> integer mapping
+ * Taken from libdrm.
+ *
+ * Created: Sun Apr 18 09:35:45 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, 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, 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
+ * PRECISION INSIGHT 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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ * DESCRIPTION
+ *
+ * This file contains a straightforward implementation of a fixed-sized
+ * hash table using self-organizing linked lists [Knuth73, pp. 398-399] for
+ * collision resolution.  There are two potentially interesting things
+ * about this implementation:
+ *
+ * 1) The table is power-of-two sized.  Prime sized tables are more
+ * traditional, but do not have a significant advantage over power-of-two
+ * sized table, especially when double hashing is not used for collision
+ * resolution.
+ *
+ * 2) The hash computation uses a table of random integers [Hanson97,
+ * pp. 39-41].
+ *
+ * FUTURE ENHANCEMENTS
+ *
+ * With a table size of 512, the current implementation is sufficient for a
+ * few hundred keys.  Since this is well above the expected size of the
+ * tables for which this implementation was designed, the implementation of
+ * dynamic hash tables was postponed until the need arises.  A common (and
+ * naive) approach to dynamic hash table implementation simply creates a
+ * new hash table when necessary, rehashes all the data into the new table,
+ * and destroys the old table.  The approach in [Larson88] is superior in
+ * two ways: 1) only a portion of the table is expanded when needed,
+ * distributing the expansion cost over several insertions, and 2) portions
+ * of the table can be locked, enabling a scalable thread-safe
+ * implementation.
+ *
+ * REFERENCES
+ *
+ * [Hanson97] David R. Hanson.  C Interfaces and Implementations:
+ * Techniques for Creating Reusable Software.  Reading, Massachusetts:
+ * Addison-Wesley, 1997.
+ *
+ * [Knuth73] Donald E. Knuth. The Art of Computer Programming.  Volume 3:
+ * Sorting and Searching.  Reading, Massachusetts: Addison-Wesley, 1973.
+ *
+ * [Larson88] Per-Ake Larson. "Dynamic Hash Tables".  CACM 31(4), April
+ * 1988, pp. 446-457.
+ *
+ */
+
+#include "glxhash.h"
+#include <X11/Xfuncproto.h>
+
+#define HASH_MAIN 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define HASH_MAGIC 0xdeadbeef
+#define HASH_DEBUG 0
+#define HASH_SIZE  512          /* Good for about 100 entries */
+                                /* If you change this value, you probably
+                                   have to change the HashHash hashing
+                                   function! */
+
+#define HASH_ALLOC malloc
+#define HASH_FREE  free
+#ifndef __GLIBC__
+#define HASH_RANDOM_DECL       char *ps, rs[256]
+#define HASH_RANDOM_INIT(seed) ps = initstate(seed, rs, sizeof(rs))
+#define HASH_RANDOM            random()
+#define HASH_RANDOM_DESTROY    setstate(ps)
+#else
+#define HASH_RANDOM_DECL       struct random_data rd; int32_t rv; char rs[256]
+#define HASH_RANDOM_INIT(seed)                                 \
+   do {                                                                \
+      (void) memset(&rd, 0, sizeof(rd));                       \
+      (void) initstate_r(seed, rs, sizeof(rs), &rd);           \
+   } while(0)
+#define HASH_RANDOM             ((void) random_r(&rd, &rv), rv)
+#define HASH_RANDOM_DESTROY
+#endif
+
+typedef struct __glxHashBucket
+{
+   unsigned long key;
+   void *value;
+   struct __glxHashBucket *next;
+} __glxHashBucket, *__glxHashBucketPtr;
+
+typedef struct __glxHashTable *__glxHashTablePtr;
+struct __glxHashTable
+{
+   unsigned long magic;
+   unsigned long hits;          /* At top of linked list */
+   unsigned long partials;      /* Not at top of linked list */
+   unsigned long misses;        /* Not in table */
+   __glxHashBucketPtr buckets[HASH_SIZE];
+   int p0;
+   __glxHashBucketPtr p1;
+};
+
+static unsigned long
+HashHash(unsigned long key)
+{
+   unsigned long hash = 0;
+   unsigned long tmp = key;
+   static int init = 0;
+   static unsigned long scatter[256];
+   int i;
+
+   if (!init) {
+      HASH_RANDOM_DECL;
+      HASH_RANDOM_INIT(37);
+      for (i = 0; i < 256; i++)
+         scatter[i] = HASH_RANDOM;
+      HASH_RANDOM_DESTROY;
+      ++init;
+   }
+
+   while (tmp) {
+      hash = (hash << 1) + scatter[tmp & 0xff];
+      tmp >>= 8;
+   }
+
+   hash %= HASH_SIZE;
+#if HASH_DEBUG
+   printf("Hash(%d) = %d\n", key, hash);
+#endif
+   return hash;
+}
+
+_X_HIDDEN __glxHashTable *
+__glxHashCreate(void)
+{
+   __glxHashTablePtr table;
+   int i;
+
+   table = HASH_ALLOC(sizeof(*table));
+   if (!table)
+      return NULL;
+   table->magic = HASH_MAGIC;
+   table->hits = 0;
+   table->partials = 0;
+   table->misses = 0;
+
+   for (i = 0; i < HASH_SIZE; i++)
+      table->buckets[i] = NULL;
+   return table;
+}
+
+_X_HIDDEN int
+__glxHashDestroy(__glxHashTable * t)
+{
+   __glxHashTablePtr table = (__glxHashTablePtr) t;
+   __glxHashBucketPtr bucket;
+   __glxHashBucketPtr next;
+   int i;
+
+   if (table->magic != HASH_MAGIC)
+      return -1;                /* Bad magic */
+
+   for (i = 0; i < HASH_SIZE; i++) {
+      for (bucket = table->buckets[i]; bucket;) {
+         next = bucket->next;
+         HASH_FREE(bucket);
+         bucket = next;
+      }
+   }
+   HASH_FREE(table);
+   return 0;
+}
+
+/* Find the bucket and organize the list so that this bucket is at the
+   top. */
+
+static __glxHashBucketPtr
+HashFind(__glxHashTablePtr table, unsigned long key, unsigned long *h)
+{
+   unsigned long hash = HashHash(key);
+   __glxHashBucketPtr prev = NULL;
+   __glxHashBucketPtr bucket;
+
+   if (h)
+      *h = hash;
+
+   for (bucket = table->buckets[hash]; bucket; bucket = bucket->next) {
+      if (bucket->key == key) {
+         if (prev) {
+            /* Organize */
+            prev->next = bucket->next;
+            bucket->next = table->buckets[hash];
+            table->buckets[hash] = bucket;
+            ++table->partials;
+         }
+         else {
+            ++table->hits;
+         }
+         return bucket;
+      }
+      prev = bucket;
+   }
+   ++table->misses;
+   return NULL;
+}
+
+_X_HIDDEN int
+__glxHashLookup(__glxHashTable * t, unsigned long key, void **value)
+{
+   __glxHashTablePtr table = (__glxHashTablePtr) t;
+   __glxHashBucketPtr bucket;
+
+   if (!table || table->magic != HASH_MAGIC)
+      return -1;                /* Bad magic */
+
+   bucket = HashFind(table, key, NULL);
+   if (!bucket)
+      return 1;                 /* Not found */
+   *value = bucket->value;
+   return 0;                    /* Found */
+}
+
+_X_HIDDEN int
+__glxHashInsert(__glxHashTable * t, unsigned long key, void *value)
+{
+   __glxHashTablePtr table = (__glxHashTablePtr) t;
+   __glxHashBucketPtr bucket;
+   unsigned long hash;
+
+   if (table->magic != HASH_MAGIC)
+      return -1;                /* Bad magic */
+
+   if (HashFind(table, key, &hash))
+      return 1;                 /* Already in table */
+
+   bucket = HASH_ALLOC(sizeof(*bucket));
+   if (!bucket)
+      return -1;                /* Error */
+   bucket->key = key;
+   bucket->value = value;
+   bucket->next = table->buckets[hash];
+   table->buckets[hash] = bucket;
+#if HASH_DEBUG
+   printf("Inserted %d at %d/%p\n", key, hash, bucket);
+#endif
+   return 0;                    /* Added to table */
+}
+
+_X_HIDDEN int
+__glxHashDelete(__glxHashTable * t, unsigned long key)
+{
+   __glxHashTablePtr table = (__glxHashTablePtr) t;
+   unsigned long hash;
+   __glxHashBucketPtr bucket;
+
+   if (table->magic != HASH_MAGIC)
+      return -1;                /* Bad magic */
+
+   bucket = HashFind(table, key, &hash);
+
+   if (!bucket)
+      return 1;                 /* Not found */
+
+   table->buckets[hash] = bucket->next;
+   HASH_FREE(bucket);
+   return 0;
+}
+
+_X_HIDDEN int
+__glxHashNext(__glxHashTable * t, unsigned long *key, void **value)
+{
+   __glxHashTablePtr table = (__glxHashTablePtr) t;
+
+   while (table->p0 < HASH_SIZE) {
+      if (table->p1) {
+         *key = table->p1->key;
+         *value = table->p1->value;
+         table->p1 = table->p1->next;
+         return 1;
+      }
+      table->p1 = table->buckets[table->p0];
+      ++table->p0;
+   }
+   return 0;
+}
+
+_X_HIDDEN int
+__glxHashFirst(__glxHashTable * t, unsigned long *key, void **value)
+{
+   __glxHashTablePtr table = (__glxHashTablePtr) t;
+
+   if (table->magic != HASH_MAGIC)
+      return -1;                /* Bad magic */
+
+   table->p0 = 0;
+   table->p1 = table->buckets[0];
+   return __glxHashNext(table, key, value);
+}
+
+#if HASH_MAIN
+#define DIST_LIMIT 10
+static int dist[DIST_LIMIT];
+
+static void
+clear_dist(void)
+{
+   int i;
+
+   for (i = 0; i < DIST_LIMIT; i++)
+      dist[i] = 0;
+}
+
+static int
+count_entries(__glxHashBucketPtr bucket)
+{
+   int count = 0;
+
+   for (; bucket; bucket = bucket->next)
+      ++count;
+   return count;
+}
+
+static void
+update_dist(int count)
+{
+   if (count >= DIST_LIMIT)
+      ++dist[DIST_LIMIT - 1];
+   else
+      ++dist[count];
+}
+
+static void
+compute_dist(__glxHashTablePtr table)
+{
+   int i;
+   __glxHashBucketPtr bucket;
+
+   printf("Hits = %ld, partials = %ld, misses = %ld\n",
+          table->hits, table->partials, table->misses);
+   clear_dist();
+   for (i = 0; i < HASH_SIZE; i++) {
+      bucket = table->buckets[i];
+      update_dist(count_entries(bucket));
+   }
+   for (i = 0; i < DIST_LIMIT; i++) {
+      if (i != DIST_LIMIT - 1)
+         printf("%5d %10d\n", i, dist[i]);
+      else
+         printf("other %10d\n", dist[i]);
+   }
+}
+
+static void
+check_table(__glxHashTablePtr table, unsigned long key, unsigned long value)
+{
+   unsigned long retval = 0;
+   int retcode = __glxHashLookup(table, key, &retval);
+
+   switch (retcode) {
+   case -1:
+      printf("Bad magic = 0x%08lx:"
+             " key = %lu, expected = %lu, returned = %lu\n",
+             table->magic, key, value, retval);
+      break;
+   case 1:
+      printf("Not found: key = %lu, expected = %lu returned = %lu\n",
+             key, value, retval);
+      break;
+   case 0:
+      if (value != retval)
+         printf("Bad value: key = %lu, expected = %lu, returned = %lu\n",
+                key, value, retval);
+      break;
+   default:
+      printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n",
+             retcode, key, value, retval);
+      break;
+   }
+}
+
+int
+main(void)
+{
+   __glxHashTablePtr table;
+   int i;
+
+   printf("\n***** 256 consecutive integers ****\n");
+   table = __glxHashCreate();
+   for (i = 0; i < 256; i++)
+      __glxHashInsert(table, i, i);
+   for (i = 0; i < 256; i++)
+      check_table(table, i, i);
+   for (i = 256; i >= 0; i--)
+      check_table(table, i, i);
+   compute_dist(table);
+   __glxHashDestroy(table);
+
+   printf("\n***** 1024 consecutive integers ****\n");
+   table = __glxHashCreate();
+   for (i = 0; i < 1024; i++)
+      __glxHashInsert(table, i, i);
+   for (i = 0; i < 1024; i++)
+      check_table(table, i, i);
+   for (i = 1024; i >= 0; i--)
+      check_table(table, i, i);
+   compute_dist(table);
+   __glxHashDestroy(table);
+
+   printf("\n***** 1024 consecutive page addresses (4k pages) ****\n");
+   table = __glxHashCreate();
+   for (i = 0; i < 1024; i++)
+      __glxHashInsert(table, i * 4096, i);
+   for (i = 0; i < 1024; i++)
+      check_table(table, i * 4096, i);
+   for (i = 1024; i >= 0; i--)
+      check_table(table, i * 4096, i);
+   compute_dist(table);
+   __glxHashDestroy(table);
+
+   printf("\n***** 1024 random integers ****\n");
+   table = __glxHashCreate();
+   srandom(0xbeefbeef);
+   for (i = 0; i < 1024; i++)
+      __glxHashInsert(table, random(), i);
+   srandom(0xbeefbeef);
+   for (i = 0; i < 1024; i++)
+      check_table(table, random(), i);
+   srandom(0xbeefbeef);
+   for (i = 0; i < 1024; i++)
+      check_table(table, random(), i);
+   compute_dist(table);
+   __glxHashDestroy(table);
+
+   printf("\n***** 5000 random integers ****\n");
+   table = __glxHashCreate();
+   srandom(0xbeefbeef);
+   for (i = 0; i < 5000; i++)
+      __glxHashInsert(table, random(), i);
+   srandom(0xbeefbeef);
+   for (i = 0; i < 5000; i++)
+      check_table(table, random(), i);
+   srandom(0xbeefbeef);
+   for (i = 0; i < 5000; i++)
+      check_table(table, random(), i);
+   compute_dist(table);
+   __glxHashDestroy(table);
+
+   return 0;
+}
+#endif
diff --git a/src/glx/glxhash.h b/src/glx/glxhash.h
new file mode 100644 (file)
index 0000000..710712d
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef _GLX_HASH_H_
+#define _GLX_HASH_H_
+
+
+typedef struct __glxHashTable __glxHashTable;
+
+/* Hash table routines */
+extern __glxHashTable *__glxHashCreate(void);
+extern int __glxHashDestroy(__glxHashTable * t);
+extern int __glxHashLookup(__glxHashTable * t, unsigned long key,
+                           void **value);
+extern int __glxHashInsert(__glxHashTable * t, unsigned long key,
+                           void *value);
+extern int __glxHashDelete(__glxHashTable * t, unsigned long key);
+extern int __glxHashFirst(__glxHashTable * t, unsigned long *key,
+                          void **value);
+extern int __glxHashNext(__glxHashTable * t, unsigned long *key,
+                         void **value);
+
+#endif /* _GLX_HASH_H_ */
diff --git a/src/glx/indirect.c b/src/glx/indirect.c
new file mode 100644 (file)
index 0000000..48bae14
--- /dev/null
@@ -0,0 +1,10669 @@
+/* DO NOT EDIT - This file generated automatically by glX_proto_send.py (from Mesa) script */
+
+/*
+ * (C) Copyright IBM Corporation 2004, 2005
+ * 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
+ * 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.
+ */
+
+
+#include <GL/gl.h>
+#include "indirect.h"
+#include "glxclient.h"
+#include "indirect_size.h"
+#include "glapitable.h"
+#include "glapidispatch.h"
+#include "glapi.h"
+#include "glthread.h"
+#include <GL/glxproto.h>
+#ifdef USE_XCB
+#include <X11/Xlib-xcb.h>
+#include <xcb/xcb.h>
+#include <xcb/glx.h>
+#endif /* USE_XCB */
+
+#define __GLX_PAD(n) (((n) + 3) & ~3)
+
+#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#    define FASTCALL __attribute__((fastcall))
+#  else
+#    define FASTCALL
+#  endif
+#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#    define NOINLINE __attribute__((noinline))
+#  else
+#    define NOINLINE
+#  endif
+
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
+/* If the size and opcode values are known at compile-time, this will, on
+ * x86 at least, emit them with a single instruction.
+ */
+#define emit_header(dest, op, size)            \
+    do { union { short s[2]; int i; } temp;    \
+         temp.s[0] = (size); temp.s[1] = (op); \
+         *((int *)(dest)) = temp.i; } while(0)
+
+NOINLINE CARD32
+__glXReadReply(Display * dpy, size_t size, void *dest,
+               GLboolean reply_is_always_array)
+{
+    xGLXSingleReply reply;
+
+    (void) _XReply(dpy, (xReply *) & reply, 0, False);
+    if (size != 0) {
+        if ((reply.length > 0) || reply_is_always_array) {
+            const GLint bytes = (reply_is_always_array)
+                ? (4 * reply.length) : (reply.size * size);
+            const GLint extra = 4 - (bytes & 3);
+
+            _XRead(dpy, dest, bytes);
+            if (extra < 4) {
+                _XEatData(dpy, extra);
+            }
+        } else {
+            (void) memcpy(dest, &(reply.pad3), size);
+        }
+    }
+
+    return reply.retval;
+}
+
+NOINLINE void
+__glXReadPixelReply(Display * dpy, __GLXcontext * gc, unsigned max_dim,
+                    GLint width, GLint height, GLint depth, GLenum format,
+                    GLenum type, void *dest, GLboolean dimensions_in_reply)
+{
+    xGLXSingleReply reply;
+    GLint size;
+
+    (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+    if (dimensions_in_reply) {
+        width = reply.pad3;
+        height = reply.pad4;
+        depth = reply.pad5;
+
+        if ((height == 0) || (max_dim < 2)) {
+            height = 1;
+        }
+        if ((depth == 0) || (max_dim < 3)) {
+            depth = 1;
+        }
+    }
+
+    size = reply.length * 4;
+    if (size != 0) {
+        void *buf = Xmalloc(size);
+
+        if (buf == NULL) {
+            _XEatData(dpy, size);
+            __glXSetError(gc, GL_OUT_OF_MEMORY);
+        } else {
+            const GLint extra = 4 - (size & 3);
+
+            _XRead(dpy, buf, size);
+            if (extra < 4) {
+                _XEatData(dpy, extra);
+            }
+
+            __glEmptyImage(gc, 3, width, height, depth, format, type,
+                           buf, dest);
+            Xfree(buf);
+        }
+    }
+}
+
+#define X_GLXSingle 0
+
+NOINLINE FASTCALL GLubyte *
+__glXSetupSingleRequest(__GLXcontext * gc, GLint sop, GLint cmdlen)
+{
+    xGLXSingleReq *req;
+    Display *const dpy = gc->currentDpy;
+
+    (void) __glXFlushRenderBuffer(gc, gc->pc);
+    LockDisplay(dpy);
+    GetReqExtra(GLXSingle, cmdlen, req);
+    req->reqType = gc->majorOpcode;
+    req->contextTag = gc->currentContextTag;
+    req->glxCode = sop;
+    return (GLubyte *) (req) + sz_xGLXSingleReq;
+}
+
+NOINLINE FASTCALL GLubyte *
+__glXSetupVendorRequest(__GLXcontext * gc, GLint code, GLint vop,
+                        GLint cmdlen)
+{
+    xGLXVendorPrivateReq *req;
+    Display *const dpy = gc->currentDpy;
+
+    (void) __glXFlushRenderBuffer(gc, gc->pc);
+    LockDisplay(dpy);
+    GetReqExtra(GLXVendorPrivate, cmdlen, req);
+    req->reqType = gc->majorOpcode;
+    req->glxCode = code;
+    req->vendorCode = vop;
+    req->contextTag = gc->currentContextTag;
+    return (GLubyte *) (req) + sz_xGLXVendorPrivateReq;
+}
+
+const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
+
+#define zero                        (__glXDefaultPixelStore+0)
+#define one                         (__glXDefaultPixelStore+8)
+#define default_pixel_store_1D      (__glXDefaultPixelStore+4)
+#define default_pixel_store_1D_size 20
+#define default_pixel_store_2D      (__glXDefaultPixelStore+4)
+#define default_pixel_store_2D_size 20
+#define default_pixel_store_3D      (__glXDefaultPixelStore+0)
+#define default_pixel_store_3D_size 36
+#define default_pixel_store_4D      (__glXDefaultPixelStore+0)
+#define default_pixel_store_4D_size 36
+
+static FASTCALL NOINLINE void
+generic_3_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static FASTCALL NOINLINE void
+generic_4_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static FASTCALL NOINLINE void
+generic_6_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static FASTCALL NOINLINE void
+generic_8_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static FASTCALL NOINLINE void
+generic_12_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 12);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static FASTCALL NOINLINE void
+generic_16_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static FASTCALL NOINLINE void
+generic_24_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 24);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static FASTCALL NOINLINE void
+generic_32_byte(GLint rop, const void *ptr)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+
+    emit_header(gc->pc, rop, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), ptr, 32);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLsop_NewList 101
+void
+__indirect_glNewList(GLuint list, GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_new_list(c, gc->currentContextTag, list, mode);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_NewList, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&list), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&mode), 4);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_EndList 102
+void
+__indirect_glEndList(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 0;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_end_list(c, gc->currentContextTag);
+#else
+        (void) __glXSetupSingleRequest(gc, X_GLsop_EndList, cmdlen);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLrop_CallList 1
+void
+__indirect_glCallList(GLuint list)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_CallList, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&list), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CallLists 2
+void
+__indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glCallLists_size(type);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * n));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_CallLists, cmdlen);
+            (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
+            (void) memcpy((void *) (gc->pc + 8), (void *) (&type), 4);
+            (void) memcpy((void *) (gc->pc + 12), (void *) (lists),
+                          (compsize * n));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_CallLists;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&n), 4);
+            (void) memcpy((void *) (pc + 12), (void *) (&type), 4);
+            __glXSendLargeCommand(gc, pc, 16, lists, (compsize * n));
+        }
+    }
+}
+
+#define X_GLsop_DeleteLists 103
+void
+__indirect_glDeleteLists(GLuint list, GLsizei range)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_delete_lists(c, gc->currentContextTag, list, range);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_DeleteLists, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&list), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&range), 4);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GenLists 104
+GLuint
+__indirect_glGenLists(GLsizei range)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLuint retval = (GLuint) 0;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_gen_lists_reply_t *reply =
+            xcb_glx_gen_lists_reply(c,
+                                    xcb_glx_gen_lists(c,
+                                                      gc->currentContextTag,
+                                                      range), NULL);
+        retval = reply->ret_val;
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GenLists, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&range), 4);
+        retval = (GLuint) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return retval;
+}
+
+#define X_GLrop_ListBase 3
+void
+__indirect_glListBase(GLuint base)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ListBase, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&base), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Begin 4
+void
+__indirect_glBegin(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Begin, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Bitmap 5
+void
+__indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
+                    GLfloat yorig, GLfloat xmove, GLfloat ymove,
+                    const GLubyte *bitmap)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (bitmap != NULL) ? __glImageSize(width, height, 1, GL_COLOR_INDEX,
+                                         GL_BITMAP, 0) : 0;
+    const GLuint cmdlen = 48 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_Bitmap, cmdlen);
+            (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 28), (void *) (&height), 4);
+            (void) memcpy((void *) (gc->pc + 32), (void *) (&xorig), 4);
+            (void) memcpy((void *) (gc->pc + 36), (void *) (&yorig), 4);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&xmove), 4);
+            (void) memcpy((void *) (gc->pc + 44), (void *) (&ymove), 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, 2, width, height, 1, GL_COLOR_INDEX,
+                                  GL_BITMAP, bitmap, gc->pc + 48, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
+                              default_pixel_store_2D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_Bitmap;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 28), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 32), (void *) (&height), 4);
+            (void) memcpy((void *) (pc + 36), (void *) (&xorig), 4);
+            (void) memcpy((void *) (pc + 40), (void *) (&yorig), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&xmove), 4);
+            (void) memcpy((void *) (pc + 48), (void *) (&ymove), 4);
+            __glXSendLargeImage(gc, compsize, 2, width, height, 1,
+                                GL_COLOR_INDEX, GL_BITMAP, bitmap, pc + 52,
+                                pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_Color3bv 6
+void
+__indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Color3bv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3bv 6
+void
+__indirect_glColor3bv(const GLbyte *v)
+{
+    generic_3_byte(X_GLrop_Color3bv, v);
+}
+
+#define X_GLrop_Color3dv 7
+void
+__indirect_glColor3d(GLdouble red, GLdouble green, GLdouble blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_Color3dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&green), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&blue), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3dv 7
+void
+__indirect_glColor3dv(const GLdouble * v)
+{
+    generic_24_byte(X_GLrop_Color3dv, v);
+}
+
+#define X_GLrop_Color3fv 8
+void
+__indirect_glColor3f(GLfloat red, GLfloat green, GLfloat blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Color3fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3fv 8
+void
+__indirect_glColor3fv(const GLfloat * v)
+{
+    generic_12_byte(X_GLrop_Color3fv, v);
+}
+
+#define X_GLrop_Color3iv 9
+void
+__indirect_glColor3i(GLint red, GLint green, GLint blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Color3iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3iv 9
+void
+__indirect_glColor3iv(const GLint * v)
+{
+    generic_12_byte(X_GLrop_Color3iv, v);
+}
+
+#define X_GLrop_Color3sv 10
+void
+__indirect_glColor3s(GLshort red, GLshort green, GLshort blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Color3sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3sv 10
+void
+__indirect_glColor3sv(const GLshort * v)
+{
+    generic_6_byte(X_GLrop_Color3sv, v);
+}
+
+#define X_GLrop_Color3ubv 11
+void
+__indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Color3ubv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3ubv 11
+void
+__indirect_glColor3ubv(const GLubyte *v)
+{
+    generic_3_byte(X_GLrop_Color3ubv, v);
+}
+
+#define X_GLrop_Color3uiv 12
+void
+__indirect_glColor3ui(GLuint red, GLuint green, GLuint blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Color3uiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3uiv 12
+void
+__indirect_glColor3uiv(const GLuint * v)
+{
+    generic_12_byte(X_GLrop_Color3uiv, v);
+}
+
+#define X_GLrop_Color3usv 13
+void
+__indirect_glColor3us(GLushort red, GLushort green, GLushort blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Color3usv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color3usv 13
+void
+__indirect_glColor3usv(const GLushort * v)
+{
+    generic_6_byte(X_GLrop_Color3usv, v);
+}
+
+#define X_GLrop_Color4bv 14
+void
+__indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Color4bv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
+    (void) memcpy((void *) (gc->pc + 7), (void *) (&alpha), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4bv 14
+void
+__indirect_glColor4bv(const GLbyte *v)
+{
+    generic_4_byte(X_GLrop_Color4bv, v);
+}
+
+#define X_GLrop_Color4dv 15
+void
+__indirect_glColor4d(GLdouble red, GLdouble green, GLdouble blue,
+                     GLdouble alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_Color4dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&green), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&blue), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&alpha), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4dv 15
+void
+__indirect_glColor4dv(const GLdouble * v)
+{
+    generic_32_byte(X_GLrop_Color4dv, v);
+}
+
+#define X_GLrop_Color4fv 16
+void
+__indirect_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Color4fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4fv 16
+void
+__indirect_glColor4fv(const GLfloat * v)
+{
+    generic_16_byte(X_GLrop_Color4fv, v);
+}
+
+#define X_GLrop_Color4iv 17
+void
+__indirect_glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Color4iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4iv 17
+void
+__indirect_glColor4iv(const GLint * v)
+{
+    generic_16_byte(X_GLrop_Color4iv, v);
+}
+
+#define X_GLrop_Color4sv 18
+void
+__indirect_glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Color4sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&alpha), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4sv 18
+void
+__indirect_glColor4sv(const GLshort * v)
+{
+    generic_8_byte(X_GLrop_Color4sv, v);
+}
+
+#define X_GLrop_Color4ubv 19
+void
+__indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Color4ubv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
+    (void) memcpy((void *) (gc->pc + 7), (void *) (&alpha), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4ubv 19
+void
+__indirect_glColor4ubv(const GLubyte *v)
+{
+    generic_4_byte(X_GLrop_Color4ubv, v);
+}
+
+#define X_GLrop_Color4uiv 20
+void
+__indirect_glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Color4uiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4uiv 20
+void
+__indirect_glColor4uiv(const GLuint * v)
+{
+    generic_16_byte(X_GLrop_Color4uiv, v);
+}
+
+#define X_GLrop_Color4usv 21
+void
+__indirect_glColor4us(GLushort red, GLushort green, GLushort blue,
+                      GLushort alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Color4usv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&alpha), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Color4usv 21
+void
+__indirect_glColor4usv(const GLushort * v)
+{
+    generic_8_byte(X_GLrop_Color4usv, v);
+}
+
+#define X_GLrop_EdgeFlagv 22
+void
+__indirect_glEdgeFlag(GLboolean flag)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_EdgeFlagv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&flag), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EdgeFlagv 22
+void
+__indirect_glEdgeFlagv(const GLboolean * flag)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_EdgeFlagv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (flag), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_End 23
+void
+__indirect_glEnd(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 4;
+    emit_header(gc->pc, X_GLrop_End, cmdlen);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Indexdv 24
+void
+__indirect_glIndexd(GLdouble c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Indexdv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Indexdv 24
+void
+__indirect_glIndexdv(const GLdouble * c)
+{
+    generic_8_byte(X_GLrop_Indexdv, c);
+}
+
+#define X_GLrop_Indexfv 25
+void
+__indirect_glIndexf(GLfloat c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Indexfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Indexfv 25
+void
+__indirect_glIndexfv(const GLfloat * c)
+{
+    generic_4_byte(X_GLrop_Indexfv, c);
+}
+
+#define X_GLrop_Indexiv 26
+void
+__indirect_glIndexi(GLint c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Indexiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Indexiv 26
+void
+__indirect_glIndexiv(const GLint * c)
+{
+    generic_4_byte(X_GLrop_Indexiv, c);
+}
+
+#define X_GLrop_Indexsv 27
+void
+__indirect_glIndexs(GLshort c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Indexsv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Indexsv 27
+void
+__indirect_glIndexsv(const GLshort * c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Indexsv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (c), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Normal3bv 28
+void
+__indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Normal3bv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&ny), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&nz), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Normal3bv 28
+void
+__indirect_glNormal3bv(const GLbyte *v)
+{
+    generic_3_byte(X_GLrop_Normal3bv, v);
+}
+
+#define X_GLrop_Normal3dv 29
+void
+__indirect_glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_Normal3dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&ny), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&nz), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Normal3dv 29
+void
+__indirect_glNormal3dv(const GLdouble * v)
+{
+    generic_24_byte(X_GLrop_Normal3dv, v);
+}
+
+#define X_GLrop_Normal3fv 30
+void
+__indirect_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Normal3fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&ny), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&nz), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Normal3fv 30
+void
+__indirect_glNormal3fv(const GLfloat * v)
+{
+    generic_12_byte(X_GLrop_Normal3fv, v);
+}
+
+#define X_GLrop_Normal3iv 31
+void
+__indirect_glNormal3i(GLint nx, GLint ny, GLint nz)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Normal3iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&ny), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&nz), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Normal3iv 31
+void
+__indirect_glNormal3iv(const GLint * v)
+{
+    generic_12_byte(X_GLrop_Normal3iv, v);
+}
+
+#define X_GLrop_Normal3sv 32
+void
+__indirect_glNormal3s(GLshort nx, GLshort ny, GLshort nz)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Normal3sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&ny), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&nz), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Normal3sv 32
+void
+__indirect_glNormal3sv(const GLshort * v)
+{
+    generic_6_byte(X_GLrop_Normal3sv, v);
+}
+
+#define X_GLrop_RasterPos2dv 33
+void
+__indirect_glRasterPos2d(GLdouble x, GLdouble y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_RasterPos2dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos2dv 33
+void
+__indirect_glRasterPos2dv(const GLdouble * v)
+{
+    generic_16_byte(X_GLrop_RasterPos2dv, v);
+}
+
+#define X_GLrop_RasterPos2fv 34
+void
+__indirect_glRasterPos2f(GLfloat x, GLfloat y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_RasterPos2fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos2fv 34
+void
+__indirect_glRasterPos2fv(const GLfloat * v)
+{
+    generic_8_byte(X_GLrop_RasterPos2fv, v);
+}
+
+#define X_GLrop_RasterPos2iv 35
+void
+__indirect_glRasterPos2i(GLint x, GLint y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_RasterPos2iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos2iv 35
+void
+__indirect_glRasterPos2iv(const GLint * v)
+{
+    generic_8_byte(X_GLrop_RasterPos2iv, v);
+}
+
+#define X_GLrop_RasterPos2sv 36
+void
+__indirect_glRasterPos2s(GLshort x, GLshort y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_RasterPos2sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos2sv 36
+void
+__indirect_glRasterPos2sv(const GLshort * v)
+{
+    generic_4_byte(X_GLrop_RasterPos2sv, v);
+}
+
+#define X_GLrop_RasterPos3dv 37
+void
+__indirect_glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_RasterPos3dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos3dv 37
+void
+__indirect_glRasterPos3dv(const GLdouble * v)
+{
+    generic_24_byte(X_GLrop_RasterPos3dv, v);
+}
+
+#define X_GLrop_RasterPos3fv 38
+void
+__indirect_glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_RasterPos3fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos3fv 38
+void
+__indirect_glRasterPos3fv(const GLfloat * v)
+{
+    generic_12_byte(X_GLrop_RasterPos3fv, v);
+}
+
+#define X_GLrop_RasterPos3iv 39
+void
+__indirect_glRasterPos3i(GLint x, GLint y, GLint z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_RasterPos3iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos3iv 39
+void
+__indirect_glRasterPos3iv(const GLint * v)
+{
+    generic_12_byte(X_GLrop_RasterPos3iv, v);
+}
+
+#define X_GLrop_RasterPos3sv 40
+void
+__indirect_glRasterPos3s(GLshort x, GLshort y, GLshort z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_RasterPos3sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos3sv 40
+void
+__indirect_glRasterPos3sv(const GLshort * v)
+{
+    generic_6_byte(X_GLrop_RasterPos3sv, v);
+}
+
+#define X_GLrop_RasterPos4dv 41
+void
+__indirect_glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_RasterPos4dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&w), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos4dv 41
+void
+__indirect_glRasterPos4dv(const GLdouble * v)
+{
+    generic_32_byte(X_GLrop_RasterPos4dv, v);
+}
+
+#define X_GLrop_RasterPos4fv 42
+void
+__indirect_glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_RasterPos4fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos4fv 42
+void
+__indirect_glRasterPos4fv(const GLfloat * v)
+{
+    generic_16_byte(X_GLrop_RasterPos4fv, v);
+}
+
+#define X_GLrop_RasterPos4iv 43
+void
+__indirect_glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_RasterPos4iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos4iv 43
+void
+__indirect_glRasterPos4iv(const GLint * v)
+{
+    generic_16_byte(X_GLrop_RasterPos4iv, v);
+}
+
+#define X_GLrop_RasterPos4sv 44
+void
+__indirect_glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_RasterPos4sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&w), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_RasterPos4sv 44
+void
+__indirect_glRasterPos4sv(const GLshort * v)
+{
+    generic_8_byte(X_GLrop_RasterPos4sv, v);
+}
+
+#define X_GLrop_Rectdv 45
+void
+__indirect_glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_Rectdv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y1), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&x2), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&y2), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rectdv 45
+void
+__indirect_glRectdv(const GLdouble * v1, const GLdouble * v2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_Rectdv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 16);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (v2), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rectfv 46
+void
+__indirect_glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Rectfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y1), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x2), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y2), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rectfv 46
+void
+__indirect_glRectfv(const GLfloat * v1, const GLfloat * v2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Rectfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (v2), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rectiv 47
+void
+__indirect_glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Rectiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y1), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x2), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y2), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rectiv 47
+void
+__indirect_glRectiv(const GLint * v1, const GLint * v2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Rectiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (v2), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rectsv 48
+void
+__indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Rectsv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&y1), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x2), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&y2), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rectsv 48
+void
+__indirect_glRectsv(const GLshort * v1, const GLshort * v2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Rectsv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v2), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord1dv 49
+void
+__indirect_glTexCoord1d(GLdouble s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_TexCoord1dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord1dv 49
+void
+__indirect_glTexCoord1dv(const GLdouble * v)
+{
+    generic_8_byte(X_GLrop_TexCoord1dv, v);
+}
+
+#define X_GLrop_TexCoord1fv 50
+void
+__indirect_glTexCoord1f(GLfloat s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_TexCoord1fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord1fv 50
+void
+__indirect_glTexCoord1fv(const GLfloat * v)
+{
+    generic_4_byte(X_GLrop_TexCoord1fv, v);
+}
+
+#define X_GLrop_TexCoord1iv 51
+void
+__indirect_glTexCoord1i(GLint s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_TexCoord1iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord1iv 51
+void
+__indirect_glTexCoord1iv(const GLint * v)
+{
+    generic_4_byte(X_GLrop_TexCoord1iv, v);
+}
+
+#define X_GLrop_TexCoord1sv 52
+void
+__indirect_glTexCoord1s(GLshort s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_TexCoord1sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord1sv 52
+void
+__indirect_glTexCoord1sv(const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_TexCoord1sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord2dv 53
+void
+__indirect_glTexCoord2d(GLdouble s, GLdouble t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_TexCoord2dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord2dv 53
+void
+__indirect_glTexCoord2dv(const GLdouble * v)
+{
+    generic_16_byte(X_GLrop_TexCoord2dv, v);
+}
+
+#define X_GLrop_TexCoord2fv 54
+void
+__indirect_glTexCoord2f(GLfloat s, GLfloat t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_TexCoord2fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord2fv 54
+void
+__indirect_glTexCoord2fv(const GLfloat * v)
+{
+    generic_8_byte(X_GLrop_TexCoord2fv, v);
+}
+
+#define X_GLrop_TexCoord2iv 55
+void
+__indirect_glTexCoord2i(GLint s, GLint t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_TexCoord2iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord2iv 55
+void
+__indirect_glTexCoord2iv(const GLint * v)
+{
+    generic_8_byte(X_GLrop_TexCoord2iv, v);
+}
+
+#define X_GLrop_TexCoord2sv 56
+void
+__indirect_glTexCoord2s(GLshort s, GLshort t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_TexCoord2sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&t), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord2sv 56
+void
+__indirect_glTexCoord2sv(const GLshort * v)
+{
+    generic_4_byte(X_GLrop_TexCoord2sv, v);
+}
+
+#define X_GLrop_TexCoord3dv 57
+void
+__indirect_glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_TexCoord3dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord3dv 57
+void
+__indirect_glTexCoord3dv(const GLdouble * v)
+{
+    generic_24_byte(X_GLrop_TexCoord3dv, v);
+}
+
+#define X_GLrop_TexCoord3fv 58
+void
+__indirect_glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexCoord3fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord3fv 58
+void
+__indirect_glTexCoord3fv(const GLfloat * v)
+{
+    generic_12_byte(X_GLrop_TexCoord3fv, v);
+}
+
+#define X_GLrop_TexCoord3iv 59
+void
+__indirect_glTexCoord3i(GLint s, GLint t, GLint r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexCoord3iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord3iv 59
+void
+__indirect_glTexCoord3iv(const GLint * v)
+{
+    generic_12_byte(X_GLrop_TexCoord3iv, v);
+}
+
+#define X_GLrop_TexCoord3sv 60
+void
+__indirect_glTexCoord3s(GLshort s, GLshort t, GLshort r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_TexCoord3sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&t), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&r), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord3sv 60
+void
+__indirect_glTexCoord3sv(const GLshort * v)
+{
+    generic_6_byte(X_GLrop_TexCoord3sv, v);
+}
+
+#define X_GLrop_TexCoord4dv 61
+void
+__indirect_glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_TexCoord4dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&q), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord4dv 61
+void
+__indirect_glTexCoord4dv(const GLdouble * v)
+{
+    generic_32_byte(X_GLrop_TexCoord4dv, v);
+}
+
+#define X_GLrop_TexCoord4fv 62
+void
+__indirect_glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_TexCoord4fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&q), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord4fv 62
+void
+__indirect_glTexCoord4fv(const GLfloat * v)
+{
+    generic_16_byte(X_GLrop_TexCoord4fv, v);
+}
+
+#define X_GLrop_TexCoord4iv 63
+void
+__indirect_glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_TexCoord4iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&q), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord4iv 63
+void
+__indirect_glTexCoord4iv(const GLint * v)
+{
+    generic_16_byte(X_GLrop_TexCoord4iv, v);
+}
+
+#define X_GLrop_TexCoord4sv 64
+void
+__indirect_glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_TexCoord4sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&t), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&r), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&q), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexCoord4sv 64
+void
+__indirect_glTexCoord4sv(const GLshort * v)
+{
+    generic_8_byte(X_GLrop_TexCoord4sv, v);
+}
+
+#define X_GLrop_Vertex2dv 65
+void
+__indirect_glVertex2d(GLdouble x, GLdouble y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Vertex2dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex2dv 65
+void
+__indirect_glVertex2dv(const GLdouble * v)
+{
+    generic_16_byte(X_GLrop_Vertex2dv, v);
+}
+
+#define X_GLrop_Vertex2fv 66
+void
+__indirect_glVertex2f(GLfloat x, GLfloat y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Vertex2fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex2fv 66
+void
+__indirect_glVertex2fv(const GLfloat * v)
+{
+    generic_8_byte(X_GLrop_Vertex2fv, v);
+}
+
+#define X_GLrop_Vertex2iv 67
+void
+__indirect_glVertex2i(GLint x, GLint y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Vertex2iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex2iv 67
+void
+__indirect_glVertex2iv(const GLint * v)
+{
+    generic_8_byte(X_GLrop_Vertex2iv, v);
+}
+
+#define X_GLrop_Vertex2sv 68
+void
+__indirect_glVertex2s(GLshort x, GLshort y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Vertex2sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex2sv 68
+void
+__indirect_glVertex2sv(const GLshort * v)
+{
+    generic_4_byte(X_GLrop_Vertex2sv, v);
+}
+
+#define X_GLrop_Vertex3dv 69
+void
+__indirect_glVertex3d(GLdouble x, GLdouble y, GLdouble z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_Vertex3dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex3dv 69
+void
+__indirect_glVertex3dv(const GLdouble * v)
+{
+    generic_24_byte(X_GLrop_Vertex3dv, v);
+}
+
+#define X_GLrop_Vertex3fv 70
+void
+__indirect_glVertex3f(GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Vertex3fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex3fv 70
+void
+__indirect_glVertex3fv(const GLfloat * v)
+{
+    generic_12_byte(X_GLrop_Vertex3fv, v);
+}
+
+#define X_GLrop_Vertex3iv 71
+void
+__indirect_glVertex3i(GLint x, GLint y, GLint z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Vertex3iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex3iv 71
+void
+__indirect_glVertex3iv(const GLint * v)
+{
+    generic_12_byte(X_GLrop_Vertex3iv, v);
+}
+
+#define X_GLrop_Vertex3sv 72
+void
+__indirect_glVertex3s(GLshort x, GLshort y, GLshort z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Vertex3sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex3sv 72
+void
+__indirect_glVertex3sv(const GLshort * v)
+{
+    generic_6_byte(X_GLrop_Vertex3sv, v);
+}
+
+#define X_GLrop_Vertex4dv 73
+void
+__indirect_glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_Vertex4dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&w), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex4dv 73
+void
+__indirect_glVertex4dv(const GLdouble * v)
+{
+    generic_32_byte(X_GLrop_Vertex4dv, v);
+}
+
+#define X_GLrop_Vertex4fv 74
+void
+__indirect_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Vertex4fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex4fv 74
+void
+__indirect_glVertex4fv(const GLfloat * v)
+{
+    generic_16_byte(X_GLrop_Vertex4fv, v);
+}
+
+#define X_GLrop_Vertex4iv 75
+void
+__indirect_glVertex4i(GLint x, GLint y, GLint z, GLint w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Vertex4iv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex4iv 75
+void
+__indirect_glVertex4iv(const GLint * v)
+{
+    generic_16_byte(X_GLrop_Vertex4iv, v);
+}
+
+#define X_GLrop_Vertex4sv 76
+void
+__indirect_glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Vertex4sv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&w), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Vertex4sv 76
+void
+__indirect_glVertex4sv(const GLshort * v)
+{
+    generic_8_byte(X_GLrop_Vertex4sv, v);
+}
+
+#define X_GLrop_ClipPlane 77
+void
+__indirect_glClipPlane(GLenum plane, const GLdouble * equation)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_ClipPlane, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (equation), 32);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&plane), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ColorMaterial 78
+void
+__indirect_glColorMaterial(GLenum face, GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_ColorMaterial, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CullFace 79
+void
+__indirect_glCullFace(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_CullFace, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Fogf 80
+void
+__indirect_glFogf(GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Fogf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Fogfv 81
+void
+__indirect_glFogfv(GLenum pname, const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glFogfv_size(pname);
+    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_Fogfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Fogi 82
+void
+__indirect_glFogi(GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Fogi, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Fogiv 83
+void
+__indirect_glFogiv(GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glFogiv_size(pname);
+    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_Fogiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_FrontFace 84
+void
+__indirect_glFrontFace(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_FrontFace, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Hint 85
+void
+__indirect_glHint(GLenum target, GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Hint, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Lightf 86
+void
+__indirect_glLightf(GLenum light, GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Lightf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Lightfv 87
+void
+__indirect_glLightfv(GLenum light, GLenum pname, const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glLightfv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_Lightfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Lighti 88
+void
+__indirect_glLighti(GLenum light, GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Lighti, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Lightiv 89
+void
+__indirect_glLightiv(GLenum light, GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glLightiv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_Lightiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LightModelf 90
+void
+__indirect_glLightModelf(GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_LightModelf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LightModelfv 91
+void
+__indirect_glLightModelfv(GLenum pname, const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glLightModelfv_size(pname);
+    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_LightModelfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LightModeli 92
+void
+__indirect_glLightModeli(GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_LightModeli, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LightModeliv 93
+void
+__indirect_glLightModeliv(GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glLightModeliv_size(pname);
+    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_LightModeliv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LineStipple 94
+void
+__indirect_glLineStipple(GLint factor, GLushort pattern)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_LineStipple, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&factor), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pattern), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LineWidth 95
+void
+__indirect_glLineWidth(GLfloat width)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_LineWidth, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&width), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Materialf 96
+void
+__indirect_glMaterialf(GLenum face, GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Materialf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Materialfv 97
+void
+__indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glMaterialfv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_Materialfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Materiali 98
+void
+__indirect_glMateriali(GLenum face, GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Materiali, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Materialiv 99
+void
+__indirect_glMaterialiv(GLenum face, GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glMaterialiv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_Materialiv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PointSize 100
+void
+__indirect_glPointSize(GLfloat size)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_PointSize, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&size), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PolygonMode 101
+void
+__indirect_glPolygonMode(GLenum face, GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_PolygonMode, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PolygonStipple 102
+void
+__indirect_glPolygonStipple(const GLubyte *mask)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (mask != NULL) ? __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
+                                       0) : 0;
+    const GLuint cmdlen = 24 + __GLX_PAD(compsize);
+    emit_header(gc->pc, X_GLrop_PolygonStipple, cmdlen);
+    if (compsize > 0) {
+        (*gc->fillImage) (gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask,
+                          gc->pc + 24, gc->pc + 4);
+    } else {
+        (void) memcpy(gc->pc + 4, default_pixel_store_2D,
+                      default_pixel_store_2D_size);
+    }
+    gc->pc += cmdlen;
+    if (gc->pc > gc->limit) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Scissor 103
+void
+__indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Scissor, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ShadeModel 104
+void
+__indirect_glShadeModel(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ShadeModel, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexParameterf 105
+void
+__indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexParameterf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexParameterfv 106
+void
+__indirect_glTexParameterfv(GLenum target, GLenum pname,
+                            const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glTexParameterfv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_TexParameterfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexParameteri 107
+void
+__indirect_glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexParameteri, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexParameteriv 108
+void
+__indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glTexParameteriv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_TexParameteriv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static void
+__glx_TexImage_1D2D(unsigned opcode, unsigned dim, GLenum target, GLint level,
+                    GLint internalformat, GLsizei width, GLsizei height,
+                    GLint border, GLenum format, GLenum type,
+                    const GLvoid * pixels)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        __glImageSize(width, height, 1, format, type, target);
+    const GLuint cmdlen = 56 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, opcode, cmdlen);
+            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 28), (void *) (&level), 4);
+            (void) memcpy((void *) (gc->pc + 32), (void *) (&internalformat),
+                          4);
+            (void) memcpy((void *) (gc->pc + 36), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&height), 4);
+            (void) memcpy((void *) (gc->pc + 44), (void *) (&border), 4);
+            (void) memcpy((void *) (gc->pc + 48), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 52), (void *) (&type), 4);
+            if ((compsize > 0) && (pixels != NULL)) {
+                (*gc->fillImage) (gc, dim, width, height, 1, format, type,
+                                  pixels, gc->pc + 56, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
+                              default_pixel_store_2D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = opcode;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 32), (void *) (&level), 4);
+            (void) memcpy((void *) (pc + 36), (void *) (&internalformat), 4);
+            (void) memcpy((void *) (pc + 40), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&height), 4);
+            (void) memcpy((void *) (pc + 48), (void *) (&border), 4);
+            (void) memcpy((void *) (pc + 52), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 56), (void *) (&type), 4);
+            __glXSendLargeImage(gc, compsize, dim, width, height, 1, format,
+                                type, pixels, pc + 60, pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_TexImage1D 109
+void
+__indirect_glTexImage1D(GLenum target, GLint level, GLint internalformat,
+                        GLsizei width, GLint border, GLenum format,
+                        GLenum type, const GLvoid * pixels)
+{
+    __glx_TexImage_1D2D(X_GLrop_TexImage1D, 1, target, level, internalformat,
+                        width, 1, border, format, type, pixels);
+}
+
+#define X_GLrop_TexImage2D 110
+void
+__indirect_glTexImage2D(GLenum target, GLint level, GLint internalformat,
+                        GLsizei width, GLsizei height, GLint border,
+                        GLenum format, GLenum type, const GLvoid * pixels)
+{
+    __glx_TexImage_1D2D(X_GLrop_TexImage2D, 2, target, level, internalformat,
+                        width, height, border, format, type, pixels);
+}
+
+#define X_GLrop_TexEnvf 111
+void
+__indirect_glTexEnvf(GLenum target, GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexEnvf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexEnvfv 112
+void
+__indirect_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glTexEnvfv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_TexEnvfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexEnvi 113
+void
+__indirect_glTexEnvi(GLenum target, GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexEnvi, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexEnviv 114
+void
+__indirect_glTexEnviv(GLenum target, GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glTexEnviv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_TexEnviv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexGend 115
+void
+__indirect_glTexGend(GLenum coord, GLenum pname, GLdouble param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_TexGend, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&param), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&coord), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&pname), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexGendv 116
+void
+__indirect_glTexGendv(GLenum coord, GLenum pname, const GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glTexGendv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8));
+    emit_header(gc->pc, X_GLrop_TexGendv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 8));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexGenf 117
+void
+__indirect_glTexGenf(GLenum coord, GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexGenf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexGenfv 118
+void
+__indirect_glTexGenfv(GLenum coord, GLenum pname, const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glTexGenfv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_TexGenfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexGeni 119
+void
+__indirect_glTexGeni(GLenum coord, GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_TexGeni, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_TexGeniv 120
+void
+__indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glTexGeniv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_TexGeniv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_InitNames 121
+void
+__indirect_glInitNames(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 4;
+    emit_header(gc->pc, X_GLrop_InitNames, cmdlen);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LoadName 122
+void
+__indirect_glLoadName(GLuint name)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_LoadName, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&name), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PassThrough 123
+void
+__indirect_glPassThrough(GLfloat token)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_PassThrough, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&token), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PopName 124
+void
+__indirect_glPopName(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 4;
+    emit_header(gc->pc, X_GLrop_PopName, cmdlen);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PushName 125
+void
+__indirect_glPushName(GLuint name)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_PushName, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&name), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_DrawBuffer 126
+void
+__indirect_glDrawBuffer(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_DrawBuffer, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Clear 127
+void
+__indirect_glClear(GLbitfield mask)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Clear, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ClearAccum 128
+void
+__indirect_glClearAccum(GLfloat red, GLfloat green, GLfloat blue,
+                        GLfloat alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_ClearAccum, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ClearIndex 129
+void
+__indirect_glClearIndex(GLfloat c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ClearIndex, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ClearColor 130
+void
+__indirect_glClearColor(GLclampf red, GLclampf green, GLclampf blue,
+                        GLclampf alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_ClearColor, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ClearStencil 131
+void
+__indirect_glClearStencil(GLint s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ClearStencil, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ClearDepth 132
+void
+__indirect_glClearDepth(GLclampd depth)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_ClearDepth, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&depth), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_StencilMask 133
+void
+__indirect_glStencilMask(GLuint mask)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_StencilMask, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ColorMask 134
+void
+__indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue,
+                       GLboolean alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ColorMask, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
+    (void) memcpy((void *) (gc->pc + 7), (void *) (&alpha), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_DepthMask 135
+void
+__indirect_glDepthMask(GLboolean flag)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_DepthMask, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&flag), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_IndexMask 136
+void
+__indirect_glIndexMask(GLuint mask)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_IndexMask, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Accum 137
+void
+__indirect_glAccum(GLenum op, GLfloat value)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_Accum, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&op), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&value), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PopAttrib 141
+void
+__indirect_glPopAttrib(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 4;
+    emit_header(gc->pc, X_GLrop_PopAttrib, cmdlen);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PushAttrib 142
+void
+__indirect_glPushAttrib(GLbitfield mask)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_PushAttrib, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MapGrid1d 147
+void
+__indirect_glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_MapGrid1d, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&u1), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&un), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MapGrid1f 148
+void
+__indirect_glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MapGrid1f, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&un), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&u1), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MapGrid2d 149
+void
+__indirect_glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn,
+                       GLdouble v1, GLdouble v2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44;
+    emit_header(gc->pc, X_GLrop_MapGrid2d, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&u1), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&v1), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&v2), 8);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&un), 4);
+    (void) memcpy((void *) (gc->pc + 40), (void *) (&vn), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MapGrid2f 150
+void
+__indirect_glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1,
+                       GLfloat v2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_MapGrid2f, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&un), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&u1), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&vn), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&v1), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&v2), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalCoord1dv 151
+void
+__indirect_glEvalCoord1d(GLdouble u)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_EvalCoord1dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalCoord1dv 151
+void
+__indirect_glEvalCoord1dv(const GLdouble * u)
+{
+    generic_8_byte(X_GLrop_EvalCoord1dv, u);
+}
+
+#define X_GLrop_EvalCoord1fv 152
+void
+__indirect_glEvalCoord1f(GLfloat u)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_EvalCoord1fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalCoord1fv 152
+void
+__indirect_glEvalCoord1fv(const GLfloat * u)
+{
+    generic_4_byte(X_GLrop_EvalCoord1fv, u);
+}
+
+#define X_GLrop_EvalCoord2dv 153
+void
+__indirect_glEvalCoord2d(GLdouble u, GLdouble v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_EvalCoord2dv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalCoord2dv 153
+void
+__indirect_glEvalCoord2dv(const GLdouble * u)
+{
+    generic_16_byte(X_GLrop_EvalCoord2dv, u);
+}
+
+#define X_GLrop_EvalCoord2fv 154
+void
+__indirect_glEvalCoord2f(GLfloat u, GLfloat v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_EvalCoord2fv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalCoord2fv 154
+void
+__indirect_glEvalCoord2fv(const GLfloat * u)
+{
+    generic_8_byte(X_GLrop_EvalCoord2fv, u);
+}
+
+#define X_GLrop_EvalMesh1 155
+void
+__indirect_glEvalMesh1(GLenum mode, GLint i1, GLint i2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_EvalMesh1, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&i1), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&i2), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalPoint1 156
+void
+__indirect_glEvalPoint1(GLint i)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_EvalPoint1, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&i), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalMesh2 157
+void
+__indirect_glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_EvalMesh2, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&i1), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&i2), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&j1), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&j2), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_EvalPoint2 158
+void
+__indirect_glEvalPoint2(GLint i, GLint j)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_EvalPoint2, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&i), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&j), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_AlphaFunc 159
+void
+__indirect_glAlphaFunc(GLenum func, GLclampf ref)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_AlphaFunc, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&func), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&ref), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_BlendFunc 160
+void
+__indirect_glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BlendFunc, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&sfactor), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&dfactor), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LogicOp 161
+void
+__indirect_glLogicOp(GLenum opcode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_LogicOp, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&opcode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_StencilFunc 162
+void
+__indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_StencilFunc, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&func), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&ref), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&mask), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_StencilOp 163
+void
+__indirect_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_StencilOp, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&fail), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&zfail), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&zpass), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_DepthFunc 164
+void
+__indirect_glDepthFunc(GLenum func)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_DepthFunc, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&func), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PixelZoom 165
+void
+__indirect_glPixelZoom(GLfloat xfactor, GLfloat yfactor)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_PixelZoom, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&xfactor), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&yfactor), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PixelTransferf 166
+void
+__indirect_glPixelTransferf(GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_PixelTransferf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PixelTransferi 167
+void
+__indirect_glPixelTransferi(GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_PixelTransferi, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PixelMapfv 168
+void
+__indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
+    if (mapsize < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_PixelMapfv, cmdlen);
+            (void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
+            (void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
+            (void) memcpy((void *) (gc->pc + 12), (void *) (values),
+                          (mapsize * 4));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_PixelMapfv;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&map), 4);
+            (void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
+            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
+        }
+    }
+}
+
+#define X_GLrop_PixelMapuiv 169
+void
+__indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
+    if (mapsize < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_PixelMapuiv, cmdlen);
+            (void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
+            (void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
+            (void) memcpy((void *) (gc->pc + 12), (void *) (values),
+                          (mapsize * 4));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_PixelMapuiv;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&map), 4);
+            (void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
+            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
+        }
+    }
+}
+
+#define X_GLrop_PixelMapusv 170
+void
+__indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 2));
+    if (mapsize < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_PixelMapusv, cmdlen);
+            (void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
+            (void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
+            (void) memcpy((void *) (gc->pc + 12), (void *) (values),
+                          (mapsize * 2));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_PixelMapusv;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&map), 4);
+            (void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
+            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 2));
+        }
+    }
+}
+
+#define X_GLrop_ReadBuffer 171
+void
+__indirect_glReadBuffer(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ReadBuffer, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyPixels 172
+void
+__indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height,
+                        GLenum type)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_CopyPixels, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&type), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLsop_ReadPixels 111
+void
+__indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
+                        GLenum format, GLenum type, GLvoid * pixels)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const __GLXattribute *const state = gc->client_state_private;
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 28;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_read_pixels_reply_t *reply =
+            xcb_glx_read_pixels_reply(c,
+                                      xcb_glx_read_pixels(c,
+                                                          gc->
+                                                          currentContextTag,
+                                                          x, y, width, height,
+                                                          format, type,
+                                                          state->storePack.
+                                                          swapEndian, 0),
+                                      NULL);
+        (void) memcpy(pixels, xcb_glx_read_pixels_data(reply),
+                      xcb_glx_read_pixels_data_length(reply) *
+                      sizeof(GLvoid));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_ReadPixels, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&x), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&y), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&width), 4);
+        (void) memcpy((void *) (pc + 12), (void *) (&height), 4);
+        (void) memcpy((void *) (pc + 16), (void *) (&format), 4);
+        (void) memcpy((void *) (pc + 20), (void *) (&type), 4);
+        *(int32_t *) (pc + 24) = 0;
+        *(int8_t *) (pc + 24) = state->storePack.swapEndian;
+        __glXReadPixelReply(dpy, gc, 2, width, height, 1, format, type,
+                            pixels, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLrop_DrawPixels 173
+void
+__indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format,
+                        GLenum type, const GLvoid * pixels)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (pixels != NULL) ? __glImageSize(width, height, 1, format, type,
+                                         0) : 0;
+    const GLuint cmdlen = 40 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_DrawPixels, cmdlen);
+            (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 28), (void *) (&height), 4);
+            (void) memcpy((void *) (gc->pc + 32), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 36), (void *) (&type), 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, 2, width, height, 1, format, type,
+                                  pixels, gc->pc + 40, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
+                              default_pixel_store_2D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_DrawPixels;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 28), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 32), (void *) (&height), 4);
+            (void) memcpy((void *) (pc + 36), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 40), (void *) (&type), 4);
+            __glXSendLargeImage(gc, compsize, 2, width, height, 1, format,
+                                type, pixels, pc + 44, pc + 8);
+        }
+    }
+}
+
+#define X_GLsop_GetClipPlane 113
+void
+__indirect_glGetClipPlane(GLenum plane, GLdouble * equation)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_clip_plane_reply_t *reply =
+            xcb_glx_get_clip_plane_reply(c,
+                                         xcb_glx_get_clip_plane(c,
+                                                                gc->
+                                                                currentContextTag,
+                                                                plane), NULL);
+        (void) memcpy(equation, xcb_glx_get_clip_plane_data(reply),
+                      xcb_glx_get_clip_plane_data_length(reply) *
+                      sizeof(GLdouble));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetClipPlane, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&plane), 4);
+        (void) __glXReadReply(dpy, 8, equation, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetLightfv 118
+void
+__indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_lightfv_reply_t *reply =
+            xcb_glx_get_lightfv_reply(c,
+                                      xcb_glx_get_lightfv(c,
+                                                          gc->
+                                                          currentContextTag,
+                                                          light, pname),
+                                      NULL);
+        if (xcb_glx_get_lightfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_lightfv_data(reply),
+                          xcb_glx_get_lightfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetLightfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&light), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetLightiv 119
+void
+__indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_lightiv_reply_t *reply =
+            xcb_glx_get_lightiv_reply(c,
+                                      xcb_glx_get_lightiv(c,
+                                                          gc->
+                                                          currentContextTag,
+                                                          light, pname),
+                                      NULL);
+        if (xcb_glx_get_lightiv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_lightiv_data(reply),
+                          xcb_glx_get_lightiv_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetLightiv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&light), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetMapdv 120
+void
+__indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_mapdv_reply_t *reply =
+            xcb_glx_get_mapdv_reply(c,
+                                    xcb_glx_get_mapdv(c,
+                                                      gc->currentContextTag,
+                                                      target, query), NULL);
+        if (xcb_glx_get_mapdv_data_length(reply) == 0)
+            (void) memcpy(v, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(v, xcb_glx_get_mapdv_data(reply),
+                          xcb_glx_get_mapdv_data_length(reply) *
+                          sizeof(GLdouble));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMapdv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&query), 4);
+        (void) __glXReadReply(dpy, 8, v, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetMapfv 121
+void
+__indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_mapfv_reply_t *reply =
+            xcb_glx_get_mapfv_reply(c,
+                                    xcb_glx_get_mapfv(c,
+                                                      gc->currentContextTag,
+                                                      target, query), NULL);
+        if (xcb_glx_get_mapfv_data_length(reply) == 0)
+            (void) memcpy(v, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(v, xcb_glx_get_mapfv_data(reply),
+                          xcb_glx_get_mapfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMapfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&query), 4);
+        (void) __glXReadReply(dpy, 4, v, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetMapiv 122
+void
+__indirect_glGetMapiv(GLenum target, GLenum query, GLint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_mapiv_reply_t *reply =
+            xcb_glx_get_mapiv_reply(c,
+                                    xcb_glx_get_mapiv(c,
+                                                      gc->currentContextTag,
+                                                      target, query), NULL);
+        if (xcb_glx_get_mapiv_data_length(reply) == 0)
+            (void) memcpy(v, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(v, xcb_glx_get_mapiv_data(reply),
+                          xcb_glx_get_mapiv_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMapiv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&query), 4);
+        (void) __glXReadReply(dpy, 4, v, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetMaterialfv 123
+void
+__indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_materialfv_reply_t *reply =
+            xcb_glx_get_materialfv_reply(c,
+                                         xcb_glx_get_materialfv(c,
+                                                                gc->
+                                                                currentContextTag,
+                                                                face, pname),
+                                         NULL);
+        if (xcb_glx_get_materialfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_materialfv_data(reply),
+                          xcb_glx_get_materialfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMaterialfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&face), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetMaterialiv 124
+void
+__indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_materialiv_reply_t *reply =
+            xcb_glx_get_materialiv_reply(c,
+                                         xcb_glx_get_materialiv(c,
+                                                                gc->
+                                                                currentContextTag,
+                                                                face, pname),
+                                         NULL);
+        if (xcb_glx_get_materialiv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_materialiv_data(reply),
+                          xcb_glx_get_materialiv_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMaterialiv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&face), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetPixelMapfv 125
+void
+__indirect_glGetPixelMapfv(GLenum map, GLfloat * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_pixel_mapfv_reply_t *reply =
+            xcb_glx_get_pixel_mapfv_reply(c,
+                                          xcb_glx_get_pixel_mapfv(c,
+                                                                  gc->
+                                                                  currentContextTag,
+                                                                  map), NULL);
+        if (xcb_glx_get_pixel_mapfv_data_length(reply) == 0)
+            (void) memcpy(values, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(values, xcb_glx_get_pixel_mapfv_data(reply),
+                          xcb_glx_get_pixel_mapfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetPixelMapfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&map), 4);
+        (void) __glXReadReply(dpy, 4, values, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetPixelMapuiv 126
+void
+__indirect_glGetPixelMapuiv(GLenum map, GLuint * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_pixel_mapuiv_reply_t *reply =
+            xcb_glx_get_pixel_mapuiv_reply(c,
+                                           xcb_glx_get_pixel_mapuiv(c,
+                                                                    gc->
+                                                                    currentContextTag,
+                                                                    map),
+                                           NULL);
+        if (xcb_glx_get_pixel_mapuiv_data_length(reply) == 0)
+            (void) memcpy(values, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(values, xcb_glx_get_pixel_mapuiv_data(reply),
+                          xcb_glx_get_pixel_mapuiv_data_length(reply) *
+                          sizeof(GLuint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetPixelMapuiv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&map), 4);
+        (void) __glXReadReply(dpy, 4, values, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetPixelMapusv 127
+void
+__indirect_glGetPixelMapusv(GLenum map, GLushort * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_pixel_mapusv_reply_t *reply =
+            xcb_glx_get_pixel_mapusv_reply(c,
+                                           xcb_glx_get_pixel_mapusv(c,
+                                                                    gc->
+                                                                    currentContextTag,
+                                                                    map),
+                                           NULL);
+        if (xcb_glx_get_pixel_mapusv_data_length(reply) == 0)
+            (void) memcpy(values, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(values, xcb_glx_get_pixel_mapusv_data(reply),
+                          xcb_glx_get_pixel_mapusv_data_length(reply) *
+                          sizeof(GLushort));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetPixelMapusv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&map), 4);
+        (void) __glXReadReply(dpy, 2, values, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetPolygonStipple 128
+void
+__indirect_glGetPolygonStipple(GLubyte *mask)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_polygon_stipple_reply_t *reply =
+            xcb_glx_get_polygon_stipple_reply(c,
+                                              xcb_glx_get_polygon_stipple(c,
+                                                                          gc->
+                                                                          currentContextTag,
+                                                                          0),
+                                              NULL);
+        (void) memcpy(mask, xcb_glx_get_polygon_stipple_data(reply),
+                      xcb_glx_get_polygon_stipple_data_length(reply) *
+                      sizeof(GLubyte));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetPolygonStipple, cmdlen);
+        *(int32_t *) (pc + 0) = 0;
+        __glXReadPixelReply(dpy, gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
+                            mask, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexEnvfv 130
+void
+__indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_envfv_reply_t *reply =
+            xcb_glx_get_tex_envfv_reply(c,
+                                        xcb_glx_get_tex_envfv(c,
+                                                              gc->
+                                                              currentContextTag,
+                                                              target, pname),
+                                        NULL);
+        if (xcb_glx_get_tex_envfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_tex_envfv_data(reply),
+                          xcb_glx_get_tex_envfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexEnvfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexEnviv 131
+void
+__indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_enviv_reply_t *reply =
+            xcb_glx_get_tex_enviv_reply(c,
+                                        xcb_glx_get_tex_enviv(c,
+                                                              gc->
+                                                              currentContextTag,
+                                                              target, pname),
+                                        NULL);
+        if (xcb_glx_get_tex_enviv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_tex_enviv_data(reply),
+                          xcb_glx_get_tex_enviv_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexEnviv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexGendv 132
+void
+__indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_gendv_reply_t *reply =
+            xcb_glx_get_tex_gendv_reply(c,
+                                        xcb_glx_get_tex_gendv(c,
+                                                              gc->
+                                                              currentContextTag,
+                                                              coord, pname),
+                                        NULL);
+        if (xcb_glx_get_tex_gendv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_tex_gendv_data(reply),
+                          xcb_glx_get_tex_gendv_data_length(reply) *
+                          sizeof(GLdouble));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexGendv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&coord), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 8, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexGenfv 133
+void
+__indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_genfv_reply_t *reply =
+            xcb_glx_get_tex_genfv_reply(c,
+                                        xcb_glx_get_tex_genfv(c,
+                                                              gc->
+                                                              currentContextTag,
+                                                              coord, pname),
+                                        NULL);
+        if (xcb_glx_get_tex_genfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_tex_genfv_data(reply),
+                          xcb_glx_get_tex_genfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexGenfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&coord), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexGeniv 134
+void
+__indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_geniv_reply_t *reply =
+            xcb_glx_get_tex_geniv_reply(c,
+                                        xcb_glx_get_tex_geniv(c,
+                                                              gc->
+                                                              currentContextTag,
+                                                              coord, pname),
+                                        NULL);
+        if (xcb_glx_get_tex_geniv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_tex_geniv_data(reply),
+                          xcb_glx_get_tex_geniv_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexGeniv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&coord), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexImage 135
+void
+__indirect_glGetTexImage(GLenum target, GLint level, GLenum format,
+                         GLenum type, GLvoid * pixels)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const __GLXattribute *const state = gc->client_state_private;
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 20;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_image_reply_t *reply =
+            xcb_glx_get_tex_image_reply(c,
+                                        xcb_glx_get_tex_image(c,
+                                                              gc->
+                                                              currentContextTag,
+                                                              target, level,
+                                                              format, type,
+                                                              state->
+                                                              storePack.
+                                                              swapEndian),
+                                        NULL);
+        (void) memcpy(pixels, xcb_glx_get_tex_image_data(reply),
+                      xcb_glx_get_tex_image_data_length(reply) *
+                      sizeof(GLvoid));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexImage, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&level), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&format), 4);
+        (void) memcpy((void *) (pc + 12), (void *) (&type), 4);
+        *(int32_t *) (pc + 16) = 0;
+        *(int8_t *) (pc + 16) = state->storePack.swapEndian;
+        __glXReadPixelReply(dpy, gc, 3, 0, 0, 0, format, type, pixels,
+                            GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexParameterfv 136
+void
+__indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_parameterfv_reply_t *reply =
+            xcb_glx_get_tex_parameterfv_reply(c,
+                                              xcb_glx_get_tex_parameterfv(c,
+                                                                          gc->
+                                                                          currentContextTag,
+                                                                          target,
+                                                                          pname),
+                                              NULL);
+        if (xcb_glx_get_tex_parameterfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_tex_parameterfv_data(reply),
+                          xcb_glx_get_tex_parameterfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexParameterfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexParameteriv 137
+void
+__indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_parameteriv_reply_t *reply =
+            xcb_glx_get_tex_parameteriv_reply(c,
+                                              xcb_glx_get_tex_parameteriv(c,
+                                                                          gc->
+                                                                          currentContextTag,
+                                                                          target,
+                                                                          pname),
+                                              NULL);
+        if (xcb_glx_get_tex_parameteriv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_tex_parameteriv_data(reply),
+                          xcb_glx_get_tex_parameteriv_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexParameteriv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexLevelParameterfv 138
+void
+__indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname,
+                                    GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 12;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_level_parameterfv_reply_t *reply =
+            xcb_glx_get_tex_level_parameterfv_reply(c,
+                                                    xcb_glx_get_tex_level_parameterfv
+                                                    (c, gc->currentContextTag,
+                                                     target, level, pname),
+                                                    NULL);
+        if (xcb_glx_get_tex_level_parameterfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_tex_level_parameterfv_data(reply),
+                          xcb_glx_get_tex_level_parameterfv_data_length(reply)
+                          * sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexLevelParameterfv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&level), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetTexLevelParameteriv 139
+void
+__indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname,
+                                    GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 12;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_tex_level_parameteriv_reply_t *reply =
+            xcb_glx_get_tex_level_parameteriv_reply(c,
+                                                    xcb_glx_get_tex_level_parameteriv
+                                                    (c, gc->currentContextTag,
+                                                     target, level, pname),
+                                                    NULL);
+        if (xcb_glx_get_tex_level_parameteriv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_tex_level_parameteriv_data(reply),
+                          xcb_glx_get_tex_level_parameteriv_data_length(reply)
+                          * sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetTexLevelParameteriv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&level), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_IsList 141
+GLboolean
+__indirect_glIsList(GLuint list)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_is_list_reply_t *reply =
+            xcb_glx_is_list_reply(c,
+                                  xcb_glx_is_list(c, gc->currentContextTag,
+                                                  list), NULL);
+        retval = reply->ret_val;
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_IsList, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&list), 4);
+        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return retval;
+}
+
+#define X_GLrop_DepthRange 174
+void
+__indirect_glDepthRange(GLclampd zNear, GLclampd zFar)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_DepthRange, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&zNear), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&zFar), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Frustum 175
+void
+__indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom,
+                     GLdouble top, GLdouble zNear, GLdouble zFar)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 52;
+    emit_header(gc->pc, X_GLrop_Frustum, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&left), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&right), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&bottom), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&top), 8);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&zNear), 8);
+    (void) memcpy((void *) (gc->pc + 44), (void *) (&zFar), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LoadIdentity 176
+void
+__indirect_glLoadIdentity(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 4;
+    emit_header(gc->pc, X_GLrop_LoadIdentity, cmdlen);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LoadMatrixf 177
+void
+__indirect_glLoadMatrixf(const GLfloat * m)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 68;
+    emit_header(gc->pc, X_GLrop_LoadMatrixf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 64);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_LoadMatrixd 178
+void
+__indirect_glLoadMatrixd(const GLdouble * m)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 132;
+    emit_header(gc->pc, X_GLrop_LoadMatrixd, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 128);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MatrixMode 179
+void
+__indirect_glMatrixMode(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_MatrixMode, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultMatrixf 180
+void
+__indirect_glMultMatrixf(const GLfloat * m)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 68;
+    emit_header(gc->pc, X_GLrop_MultMatrixf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 64);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultMatrixd 181
+void
+__indirect_glMultMatrixd(const GLdouble * m)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 132;
+    emit_header(gc->pc, X_GLrop_MultMatrixd, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 128);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Ortho 182
+void
+__indirect_glOrtho(GLdouble left, GLdouble right, GLdouble bottom,
+                   GLdouble top, GLdouble zNear, GLdouble zFar)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 52;
+    emit_header(gc->pc, X_GLrop_Ortho, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&left), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&right), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&bottom), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&top), 8);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&zNear), 8);
+    (void) memcpy((void *) (gc->pc + 44), (void *) (&zFar), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PopMatrix 183
+void
+__indirect_glPopMatrix(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 4;
+    emit_header(gc->pc, X_GLrop_PopMatrix, cmdlen);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PushMatrix 184
+void
+__indirect_glPushMatrix(void)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 4;
+    emit_header(gc->pc, X_GLrop_PushMatrix, cmdlen);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rotated 185
+void
+__indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_Rotated, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&angle), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Rotatef 186
+void
+__indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Rotatef, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&angle), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Scaled 187
+void
+__indirect_glScaled(GLdouble x, GLdouble y, GLdouble z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_Scaled, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Scalef 188
+void
+__indirect_glScalef(GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Scalef, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Translated 189
+void
+__indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_Translated, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Translatef 190
+void
+__indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Translatef, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Viewport 191
+void
+__indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Viewport, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_BindTexture 4117
+void
+__indirect_glBindTexture(GLenum target, GLuint texture)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BindTexture, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&texture), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Indexubv 194
+void
+__indirect_glIndexub(GLubyte c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Indexubv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Indexubv 194
+void
+__indirect_glIndexubv(const GLubyte *c)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_Indexubv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (c), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PolygonOffset 192
+void
+__indirect_glPolygonOffset(GLfloat factor, GLfloat units)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_PolygonOffset, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&factor), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&units), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyTexImage1D 4119
+void
+__indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
+                            GLint x, GLint y, GLsizei width, GLint border)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 32;
+    emit_header(gc->pc, X_GLrop_CopyTexImage1D, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&border), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyTexImage2D 4120
+void
+__indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat,
+                            GLint x, GLint y, GLsizei width, GLsizei height,
+                            GLint border)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_CopyTexImage2D, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&height), 4);
+    (void) memcpy((void *) (gc->pc + 32), (void *) (&border), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyTexSubImage1D 4121
+void
+__indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset,
+                               GLint x, GLint y, GLsizei width)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_CopyTexSubImage1D, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&xoffset), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyTexSubImage2D 4122
+void
+__indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset,
+                               GLint yoffset, GLint x, GLint y, GLsizei width,
+                               GLsizei height)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 36;
+    emit_header(gc->pc, X_GLrop_CopyTexSubImage2D, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&xoffset), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&yoffset), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 32), (void *) (&height), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLsop_DeleteTextures 144
+void
+__indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_delete_textures(c, gc->currentContextTag, n, textures);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_DeleteTextures, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_DeleteTexturesEXT 12
+void
+glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+        if (n < 0) {
+            __glXSetError(gc, GL_INVALID_VALUE);
+            return;
+        }
+        if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivate,
+                                        X_GLvop_DeleteTexturesEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GenTextures 145
+void
+__indirect_glGenTextures(GLsizei n, GLuint * textures)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_gen_textures_reply_t *reply =
+            xcb_glx_gen_textures_reply(c,
+                                       xcb_glx_gen_textures(c,
+                                                            gc->
+                                                            currentContextTag,
+                                                            n), NULL);
+        (void) memcpy(textures, xcb_glx_gen_textures_data(reply),
+                      xcb_glx_gen_textures_data_length(reply) *
+                      sizeof(GLuint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GenTextures, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) __glXReadReply(dpy, 4, textures, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GenTexturesEXT 13
+void
+glGenTexturesEXT(GLsizei n, GLuint * textures)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GenTextures(GET_DISPATCH(), (n, textures));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 4;
+        if (n < 0) {
+            __glXSetError(gc, GL_INVALID_VALUE);
+            return;
+        }
+        if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GenTexturesEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+            (void) __glXReadReply(dpy, 4, textures, GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_IsTexture 146
+GLboolean
+__indirect_glIsTexture(GLuint texture)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_is_texture_reply_t *reply =
+            xcb_glx_is_texture_reply(c,
+                                     xcb_glx_is_texture(c,
+                                                        gc->currentContextTag,
+                                                        texture), NULL);
+        retval = reply->ret_val;
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_IsTexture, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&texture), 4);
+        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return retval;
+}
+
+#define X_GLvop_IsTextureEXT 14
+GLboolean
+glIsTextureEXT(GLuint texture)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        return CALL_IsTexture(GET_DISPATCH(), (texture));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        GLboolean retval = (GLboolean) 0;
+        const GLuint cmdlen = 4;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_IsTextureEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&texture), 4);
+            retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return retval;
+    }
+}
+
+#define X_GLrop_PrioritizeTextures 4118
+void
+__indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures,
+                                const GLclampf * priorities)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8 + __GLX_PAD((n * 4)) + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_PrioritizeTextures, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (textures), (n * 4));
+        (void) memcpy((void *) (gc->pc + 8 + (n * 4)), (void *) (priorities),
+                      (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+static void
+__glx_TexSubImage_1D2D(unsigned opcode, unsigned dim, GLenum target,
+                       GLint level, GLint xoffset, GLint yoffset,
+                       GLsizei width, GLsizei height, GLenum format,
+                       GLenum type, const GLvoid * pixels)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (pixels != NULL) ? __glImageSize(width, height, 1, format, type,
+                                         target) : 0;
+    const GLuint cmdlen = 60 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, opcode, cmdlen);
+            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 28), (void *) (&level), 4);
+            (void) memcpy((void *) (gc->pc + 32), (void *) (&xoffset), 4);
+            (void) memcpy((void *) (gc->pc + 36), (void *) (&yoffset), 4);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 44), (void *) (&height), 4);
+            (void) memcpy((void *) (gc->pc + 48), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 52), (void *) (&type), 4);
+            (void) memset((void *) (gc->pc + 56), 0, 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, dim, width, height, 1, format, type,
+                                  pixels, gc->pc + 60, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
+                              default_pixel_store_2D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = opcode;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 32), (void *) (&level), 4);
+            (void) memcpy((void *) (pc + 36), (void *) (&xoffset), 4);
+            (void) memcpy((void *) (pc + 40), (void *) (&yoffset), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 48), (void *) (&height), 4);
+            (void) memcpy((void *) (pc + 52), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 56), (void *) (&type), 4);
+            (void) memset((void *) (pc + 60), 0, 4);
+            __glXSendLargeImage(gc, compsize, dim, width, height, 1, format,
+                                type, pixels, pc + 64, pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_TexSubImage1D 4099
+void
+__indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset,
+                           GLsizei width, GLenum format, GLenum type,
+                           const GLvoid * pixels)
+{
+    __glx_TexSubImage_1D2D(X_GLrop_TexSubImage1D, 1, target, level, xoffset,
+                           1, width, 1, format, type, pixels);
+}
+
+#define X_GLrop_TexSubImage2D 4100
+void
+__indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset,
+                           GLint yoffset, GLsizei width, GLsizei height,
+                           GLenum format, GLenum type, const GLvoid * pixels)
+{
+    __glx_TexSubImage_1D2D(X_GLrop_TexSubImage2D, 2, target, level, xoffset,
+                           yoffset, width, height, format, type, pixels);
+}
+
+#define X_GLrop_BlendColor 4096
+void
+__indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue,
+                        GLclampf alpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_BlendColor, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_BlendEquation 4097
+void
+__indirect_glBlendEquation(GLenum mode)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_BlendEquation, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ColorTable 2053
+void
+__indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width,
+                        GLenum format, GLenum type, const GLvoid * table)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (table != NULL) ? __glImageSize(width, 1, 1, format, type,
+                                        target) : 0;
+    const GLuint cmdlen = 44 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_ColorTable, cmdlen);
+            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 28), (void *) (&internalformat),
+                          4);
+            (void) memcpy((void *) (gc->pc + 32), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 36), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&type), 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, 1, width, 1, 1, format, type, table,
+                                  gc->pc + 44, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_1D,
+                              default_pixel_store_1D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_ColorTable;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 32), (void *) (&internalformat), 4);
+            (void) memcpy((void *) (pc + 36), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 40), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&type), 4);
+            __glXSendLargeImage(gc, compsize, 1, width, 1, 1, format, type,
+                                table, pc + 48, pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_ColorTableParameterfv 2054
+void
+__indirect_glColorTableParameterfv(GLenum target, GLenum pname,
+                                   const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glColorTableParameterfv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_ColorTableParameterfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ColorTableParameteriv 2055
+void
+__indirect_glColorTableParameteriv(GLenum target, GLenum pname,
+                                   const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glColorTableParameteriv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_ColorTableParameteriv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyColorTable 2056
+void
+__indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x,
+                            GLint y, GLsizei width)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_CopyColorTable, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLsop_GetColorTable 147
+void
+__indirect_glGetColorTable(GLenum target, GLenum format, GLenum type,
+                           GLvoid * table)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const __GLXattribute *const state = gc->client_state_private;
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 16;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_color_table_reply_t *reply =
+            xcb_glx_get_color_table_reply(c,
+                                          xcb_glx_get_color_table(c,
+                                                                  gc->
+                                                                  currentContextTag,
+                                                                  target,
+                                                                  format,
+                                                                  type,
+                                                                  state->
+                                                                  storePack.
+                                                                  swapEndian),
+                                          NULL);
+        (void) memcpy(table, xcb_glx_get_color_table_data(reply),
+                      xcb_glx_get_color_table_data_length(reply) *
+                      sizeof(GLvoid));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetColorTable, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+        *(int32_t *) (pc + 12) = 0;
+        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+        __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, table,
+                            GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetColorTableSGI 4098
+void
+glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetColorTableSGI, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, table,
+                                GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetColorTableParameterfv 148
+void
+__indirect_glGetColorTableParameterfv(GLenum target, GLenum pname,
+                                      GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_color_table_parameterfv_reply_t *reply =
+            xcb_glx_get_color_table_parameterfv_reply(c,
+                                                      xcb_glx_get_color_table_parameterfv
+                                                      (c,
+                                                       gc->currentContextTag,
+                                                       target, pname), NULL);
+        if (xcb_glx_get_color_table_parameterfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_color_table_parameterfv_data(reply),
+                          xcb_glx_get_color_table_parameterfv_data_length
+                          (reply) * sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetColorTableParameterfv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetColorTableParameterfvSGI 4099
+void
+glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetColorTableParameterfv(GET_DISPATCH(),
+                                      (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetColorTableParameterfvSGI,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetColorTableParameteriv 149
+void
+__indirect_glGetColorTableParameteriv(GLenum target, GLenum pname,
+                                      GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_color_table_parameteriv_reply_t *reply =
+            xcb_glx_get_color_table_parameteriv_reply(c,
+                                                      xcb_glx_get_color_table_parameteriv
+                                                      (c,
+                                                       gc->currentContextTag,
+                                                       target, pname), NULL);
+        if (xcb_glx_get_color_table_parameteriv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_color_table_parameteriv_data(reply),
+                          xcb_glx_get_color_table_parameteriv_data_length
+                          (reply) * sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetColorTableParameteriv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetColorTableParameterivSGI 4100
+void
+glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetColorTableParameteriv(GET_DISPATCH(),
+                                      (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetColorTableParameterivSGI,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLrop_ColorSubTable 195
+void
+__indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count,
+                           GLenum format, GLenum type, const GLvoid * data)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (data != NULL) ? __glImageSize(count, 1, 1, format, type, target) : 0;
+    const GLuint cmdlen = 44 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_ColorSubTable, cmdlen);
+            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 28), (void *) (&start), 4);
+            (void) memcpy((void *) (gc->pc + 32), (void *) (&count), 4);
+            (void) memcpy((void *) (gc->pc + 36), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&type), 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, 1, count, 1, 1, format, type, data,
+                                  gc->pc + 44, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_1D,
+                              default_pixel_store_1D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_ColorSubTable;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 32), (void *) (&start), 4);
+            (void) memcpy((void *) (pc + 36), (void *) (&count), 4);
+            (void) memcpy((void *) (pc + 40), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&type), 4);
+            __glXSendLargeImage(gc, compsize, 1, count, 1, 1, format, type,
+                                data, pc + 48, pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_CopyColorSubTable 196
+void
+__indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y,
+                               GLsizei width)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_CopyColorSubTable, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&start), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static void
+__glx_ConvolutionFilter_1D2D(unsigned opcode, unsigned dim, GLenum target,
+                             GLenum internalformat, GLsizei width,
+                             GLsizei height, GLenum format, GLenum type,
+                             const GLvoid * image)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (image != NULL) ? __glImageSize(width, height, 1, format, type,
+                                        target) : 0;
+    const GLuint cmdlen = 48 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, opcode, cmdlen);
+            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 28), (void *) (&internalformat),
+                          4);
+            (void) memcpy((void *) (gc->pc + 32), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 36), (void *) (&height), 4);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 44), (void *) (&type), 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, dim, width, height, 1, format, type,
+                                  image, gc->pc + 48, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
+                              default_pixel_store_2D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = opcode;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 32), (void *) (&internalformat), 4);
+            (void) memcpy((void *) (pc + 36), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 40), (void *) (&height), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 48), (void *) (&type), 4);
+            __glXSendLargeImage(gc, compsize, dim, width, height, 1, format,
+                                type, image, pc + 52, pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_ConvolutionFilter1D 4101
+void
+__indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat,
+                                 GLsizei width, GLenum format, GLenum type,
+                                 const GLvoid * image)
+{
+    __glx_ConvolutionFilter_1D2D(X_GLrop_ConvolutionFilter1D, 1, target,
+                                 internalformat, width, 1, format, type,
+                                 image);
+}
+
+#define X_GLrop_ConvolutionFilter2D 4102
+void
+__indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat,
+                                 GLsizei width, GLsizei height, GLenum format,
+                                 GLenum type, const GLvoid * image)
+{
+    __glx_ConvolutionFilter_1D2D(X_GLrop_ConvolutionFilter2D, 2, target,
+                                 internalformat, width, height, format, type,
+                                 image);
+}
+
+#define X_GLrop_ConvolutionParameterf 4103
+void
+__indirect_glConvolutionParameterf(GLenum target, GLenum pname,
+                                   GLfloat params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_ConvolutionParameterf, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&params), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ConvolutionParameterfv 4104
+void
+__indirect_glConvolutionParameterfv(GLenum target, GLenum pname,
+                                    const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glConvolutionParameterfv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_ConvolutionParameterfv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ConvolutionParameteri 4105
+void
+__indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_ConvolutionParameteri, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&params), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ConvolutionParameteriv 4106
+void
+__indirect_glConvolutionParameteriv(GLenum target, GLenum pname,
+                                    const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glConvolutionParameteriv_size(pname);
+    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_ConvolutionParameteriv, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyConvolutionFilter1D 4107
+void
+__indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat,
+                                     GLint x, GLint y, GLsizei width)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_CopyConvolutionFilter1D, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_CopyConvolutionFilter2D 4108
+void
+__indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat,
+                                     GLint x, GLint y, GLsizei width,
+                                     GLsizei height)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_CopyConvolutionFilter2D, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&height), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLsop_GetConvolutionFilter 150
+void
+__indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
+                                  GLvoid * image)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const __GLXattribute *const state = gc->client_state_private;
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 16;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_convolution_filter_reply_t *reply =
+            xcb_glx_get_convolution_filter_reply(c,
+                                                 xcb_glx_get_convolution_filter
+                                                 (c, gc->currentContextTag,
+                                                  target, format, type,
+                                                  state->storePack.
+                                                  swapEndian), NULL);
+        (void) memcpy(image, xcb_glx_get_convolution_filter_data(reply),
+                      xcb_glx_get_convolution_filter_data_length(reply) *
+                      sizeof(GLvoid));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetConvolutionFilter, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+        *(int32_t *) (pc + 12) = 0;
+        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+        __glXReadPixelReply(dpy, gc, 2, 0, 0, 0, format, type, image,
+                            GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetConvolutionFilterEXT 1
+void
+gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
+                     GLvoid * image)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetConvolutionFilter(GET_DISPATCH(),
+                                  (target, format, type, image));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetConvolutionFilterEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            __glXReadPixelReply(dpy, gc, 2, 0, 0, 0, format, type, image,
+                                GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetConvolutionParameterfv 151
+void
+__indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname,
+                                       GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_convolution_parameterfv_reply_t *reply =
+            xcb_glx_get_convolution_parameterfv_reply(c,
+                                                      xcb_glx_get_convolution_parameterfv
+                                                      (c,
+                                                       gc->currentContextTag,
+                                                       target, pname), NULL);
+        if (xcb_glx_get_convolution_parameterfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_convolution_parameterfv_data(reply),
+                          xcb_glx_get_convolution_parameterfv_data_length
+                          (reply) * sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetConvolutionParameterfv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetConvolutionParameterfvEXT 2
+void
+gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetConvolutionParameterfv(GET_DISPATCH(),
+                                       (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetConvolutionParameterfvEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetConvolutionParameteriv 152
+void
+__indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname,
+                                       GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_convolution_parameteriv_reply_t *reply =
+            xcb_glx_get_convolution_parameteriv_reply(c,
+                                                      xcb_glx_get_convolution_parameteriv
+                                                      (c,
+                                                       gc->currentContextTag,
+                                                       target, pname), NULL);
+        if (xcb_glx_get_convolution_parameteriv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_convolution_parameteriv_data(reply),
+                          xcb_glx_get_convolution_parameteriv_data_length
+                          (reply) * sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetConvolutionParameteriv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetConvolutionParameterivEXT 3
+void
+gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+                                       (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetConvolutionParameterivEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetHistogram 154
+void
+__indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
+                          GLenum type, GLvoid * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const __GLXattribute *const state = gc->client_state_private;
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 16;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_histogram_reply_t *reply =
+            xcb_glx_get_histogram_reply(c,
+                                        xcb_glx_get_histogram(c,
+                                                              gc->
+                                                              currentContextTag,
+                                                              target, reset,
+                                                              format, type,
+                                                              state->
+                                                              storePack.
+                                                              swapEndian),
+                                        NULL);
+        (void) memcpy(values, xcb_glx_get_histogram_data(reply),
+                      xcb_glx_get_histogram_data_length(reply) *
+                      sizeof(GLvoid));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetHistogram, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+        *(int32_t *) (pc + 12) = 0;
+        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+        *(int8_t *) (pc + 13) = reset;
+        __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, values,
+                            GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetHistogramEXT 5
+void
+gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
+                     GLenum type, GLvoid * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetHistogram(GET_DISPATCH(),
+                          (target, reset, format, type, values));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetHistogramEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            *(int8_t *) (pc + 13) = reset;
+            __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, values,
+                                GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetHistogramParameterfv 155
+void
+__indirect_glGetHistogramParameterfv(GLenum target, GLenum pname,
+                                     GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_histogram_parameterfv_reply_t *reply =
+            xcb_glx_get_histogram_parameterfv_reply(c,
+                                                    xcb_glx_get_histogram_parameterfv
+                                                    (c, gc->currentContextTag,
+                                                     target, pname), NULL);
+        if (xcb_glx_get_histogram_parameterfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_histogram_parameterfv_data(reply),
+                          xcb_glx_get_histogram_parameterfv_data_length(reply)
+                          * sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetHistogramParameterfv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetHistogramParameterfvEXT 6
+void
+gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetHistogramParameterfvEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetHistogramParameteriv 156
+void
+__indirect_glGetHistogramParameteriv(GLenum target, GLenum pname,
+                                     GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_histogram_parameteriv_reply_t *reply =
+            xcb_glx_get_histogram_parameteriv_reply(c,
+                                                    xcb_glx_get_histogram_parameteriv
+                                                    (c, gc->currentContextTag,
+                                                     target, pname), NULL);
+        if (xcb_glx_get_histogram_parameteriv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params,
+                          xcb_glx_get_histogram_parameteriv_data(reply),
+                          xcb_glx_get_histogram_parameteriv_data_length(reply)
+                          * sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetHistogramParameteriv,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetHistogramParameterivEXT 7
+void
+gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetHistogramParameterivEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetMinmax 157
+void
+__indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format,
+                       GLenum type, GLvoid * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const __GLXattribute *const state = gc->client_state_private;
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 16;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_minmax_reply_t *reply =
+            xcb_glx_get_minmax_reply(c,
+                                     xcb_glx_get_minmax(c,
+                                                        gc->currentContextTag,
+                                                        target, reset, format,
+                                                        type,
+                                                        state->storePack.
+                                                        swapEndian), NULL);
+        (void) memcpy(values, xcb_glx_get_minmax_data(reply),
+                      xcb_glx_get_minmax_data_length(reply) * sizeof(GLvoid));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMinmax, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+        *(int32_t *) (pc + 12) = 0;
+        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+        *(int8_t *) (pc + 13) = reset;
+        __glXReadPixelReply(dpy, gc, 1, 2, 1, 1, format, type, values,
+                            GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetMinmaxEXT 8
+void
+gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
+                     GLenum type, GLvoid * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetMinmaxEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            *(int8_t *) (pc + 13) = reset;
+            __glXReadPixelReply(dpy, gc, 1, 2, 1, 1, format, type, values,
+                                GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetMinmaxParameterfv 158
+void
+__indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname,
+                                  GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_minmax_parameterfv_reply_t *reply =
+            xcb_glx_get_minmax_parameterfv_reply(c,
+                                                 xcb_glx_get_minmax_parameterfv
+                                                 (c, gc->currentContextTag,
+                                                  target, pname), NULL);
+        if (xcb_glx_get_minmax_parameterfv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_minmax_parameterfv_data(reply),
+                          xcb_glx_get_minmax_parameterfv_data_length(reply) *
+                          sizeof(GLfloat));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMinmaxParameterfv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetMinmaxParameterfvEXT 9
+void
+gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetMinmaxParameterfvEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLsop_GetMinmaxParameteriv 159
+void
+__indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_minmax_parameteriv_reply_t *reply =
+            xcb_glx_get_minmax_parameteriv_reply(c,
+                                                 xcb_glx_get_minmax_parameteriv
+                                                 (c, gc->currentContextTag,
+                                                  target, pname), NULL);
+        if (xcb_glx_get_minmax_parameteriv_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_minmax_parameteriv_data(reply),
+                          xcb_glx_get_minmax_parameteriv_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetMinmaxParameteriv, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLvop_GetMinmaxParameterivEXT 10
+void
+gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+    if (gc->driContext) {
+        CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
+    } else
+#endif
+    {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetMinmaxParameterivEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
+#define X_GLrop_Histogram 4110
+void
+__indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat,
+                       GLboolean sink)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_Histogram, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&sink), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_Minmax 4111
+void
+__indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_Minmax, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&sink), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ResetHistogram 4112
+void
+__indirect_glResetHistogram(GLenum target)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ResetHistogram, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ResetMinmax 4113
+void
+__indirect_glResetMinmax(GLenum target)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ResetMinmax, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+static void
+__glx_TexImage_3D4D(unsigned opcode, unsigned dim, GLenum target, GLint level,
+                    GLint internalformat, GLsizei width, GLsizei height,
+                    GLsizei depth, GLsizei extent, GLint border,
+                    GLenum format, GLenum type, const GLvoid * pixels)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (pixels != NULL) ? __glImageSize(width, height, depth, format, type,
+                                         target) : 0;
+    const GLuint cmdlen = 84 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, opcode, cmdlen);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 44), (void *) (&level), 4);
+            (void) memcpy((void *) (gc->pc + 48), (void *) (&internalformat),
+                          4);
+            (void) memcpy((void *) (gc->pc + 52), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 56), (void *) (&height), 4);
+            (void) memcpy((void *) (gc->pc + 60), (void *) (&depth), 4);
+            (void) memcpy((void *) (gc->pc + 64), (void *) (&extent), 4);
+            (void) memcpy((void *) (gc->pc + 68), (void *) (&border), 4);
+            (void) memcpy((void *) (gc->pc + 72), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 76), (void *) (&type), 4);
+            (void) memcpy((void *) (gc->pc + 80),
+                          (void *) ((pixels == NULL) ? one : zero), 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, dim, width, height, depth, format, type,
+                                  pixels, gc->pc + 84, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_4D,
+                              default_pixel_store_4D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = opcode;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 48), (void *) (&level), 4);
+            (void) memcpy((void *) (pc + 52), (void *) (&internalformat), 4);
+            (void) memcpy((void *) (pc + 56), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 60), (void *) (&height), 4);
+            (void) memcpy((void *) (pc + 64), (void *) (&depth), 4);
+            (void) memcpy((void *) (pc + 68), (void *) (&extent), 4);
+            (void) memcpy((void *) (pc + 72), (void *) (&border), 4);
+            (void) memcpy((void *) (pc + 76), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 80), (void *) (&type), 4);
+            (void) memcpy((void *) (pc + 84), zero, 4);
+            __glXSendLargeImage(gc, compsize, dim, width, height, depth,
+                                format, type, pixels, pc + 88, pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_TexImage3D 4114
+void
+__indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat,
+                        GLsizei width, GLsizei height, GLsizei depth,
+                        GLint border, GLenum format, GLenum type,
+                        const GLvoid * pixels)
+{
+    __glx_TexImage_3D4D(X_GLrop_TexImage3D, 3, target, level, internalformat,
+                        width, height, depth, 1, border, format, type,
+                        pixels);
+}
+
+static void
+__glx_TexSubImage_3D4D(unsigned opcode, unsigned dim, GLenum target,
+                       GLint level, GLint xoffset, GLint yoffset,
+                       GLint zoffset, GLint woffset, GLsizei width,
+                       GLsizei height, GLsizei depth, GLsizei extent,
+                       GLenum format, GLenum type, const GLvoid * pixels)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize =
+        (pixels != NULL) ? __glImageSize(width, height, depth, format, type,
+                                         target) : 0;
+    const GLuint cmdlen = 92 + __GLX_PAD(compsize);
+    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, opcode, cmdlen);
+            (void) memcpy((void *) (gc->pc + 40), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 44), (void *) (&level), 4);
+            (void) memcpy((void *) (gc->pc + 48), (void *) (&xoffset), 4);
+            (void) memcpy((void *) (gc->pc + 52), (void *) (&yoffset), 4);
+            (void) memcpy((void *) (gc->pc + 56), (void *) (&zoffset), 4);
+            (void) memcpy((void *) (gc->pc + 60), (void *) (&woffset), 4);
+            (void) memcpy((void *) (gc->pc + 64), (void *) (&width), 4);
+            (void) memcpy((void *) (gc->pc + 68), (void *) (&height), 4);
+            (void) memcpy((void *) (gc->pc + 72), (void *) (&depth), 4);
+            (void) memcpy((void *) (gc->pc + 76), (void *) (&extent), 4);
+            (void) memcpy((void *) (gc->pc + 80), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 84), (void *) (&type), 4);
+            (void) memset((void *) (gc->pc + 88), 0, 4);
+            if (compsize > 0) {
+                (*gc->fillImage) (gc, dim, width, height, depth, format, type,
+                                  pixels, gc->pc + 92, gc->pc + 4);
+            } else {
+                (void) memcpy(gc->pc + 4, default_pixel_store_4D,
+                              default_pixel_store_4D_size);
+            }
+            gc->pc += cmdlen;
+            if (gc->pc > gc->limit) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = opcode;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 44), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 48), (void *) (&level), 4);
+            (void) memcpy((void *) (pc + 52), (void *) (&xoffset), 4);
+            (void) memcpy((void *) (pc + 56), (void *) (&yoffset), 4);
+            (void) memcpy((void *) (pc + 60), (void *) (&zoffset), 4);
+            (void) memcpy((void *) (pc + 64), (void *) (&woffset), 4);
+            (void) memcpy((void *) (pc + 68), (void *) (&width), 4);
+            (void) memcpy((void *) (pc + 72), (void *) (&height), 4);
+            (void) memcpy((void *) (pc + 76), (void *) (&depth), 4);
+            (void) memcpy((void *) (pc + 80), (void *) (&extent), 4);
+            (void) memcpy((void *) (pc + 84), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 88), (void *) (&type), 4);
+            (void) memset((void *) (pc + 92), 0, 4);
+            __glXSendLargeImage(gc, compsize, dim, width, height, depth,
+                                format, type, pixels, pc + 96, pc + 8);
+        }
+    }
+}
+
+#define X_GLrop_TexSubImage3D 4115
+void
+__indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset,
+                           GLint yoffset, GLint zoffset, GLsizei width,
+                           GLsizei height, GLsizei depth, GLenum format,
+                           GLenum type, const GLvoid * pixels)
+{
+    __glx_TexSubImage_3D4D(X_GLrop_TexSubImage3D, 3, target, level, xoffset,
+                           yoffset, zoffset, 1, width, height, depth, 1,
+                           format, type, pixels);
+}
+
+#define X_GLrop_CopyTexSubImage3D 4123
+void
+__indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset,
+                               GLint yoffset, GLint zoffset, GLint x, GLint y,
+                               GLsizei width, GLsizei height)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_CopyTexSubImage3D, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&xoffset), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&yoffset), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&zoffset), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 32), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&height), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ActiveTextureARB 197
+void
+__indirect_glActiveTextureARB(GLenum texture)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ActiveTextureARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&texture), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1dvARB 198
+void
+__indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1dvARB 198
+void
+__indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1fvARB 199
+void
+__indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1fvARB 199
+void
+__indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1ivARB 200
+void
+__indirect_glMultiTexCoord1iARB(GLenum target, GLint s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1ivARB 200
+void
+__indirect_glMultiTexCoord1ivARB(GLenum target, const GLint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1svARB 201
+void
+__indirect_glMultiTexCoord1sARB(GLenum target, GLshort s)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord1svARB 201
+void
+__indirect_glMultiTexCoord1svARB(GLenum target, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord1svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2dvARB 202
+void
+__indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2dvARB 202
+void
+__indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 16);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2fvARB 203
+void
+__indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2fvARB 203
+void
+__indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2ivARB 204
+void
+__indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2ivARB 204
+void
+__indirect_glMultiTexCoord2ivARB(GLenum target, const GLint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2svARB 205
+void
+__indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&t), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord2svARB 205
+void
+__indirect_glMultiTexCoord2svARB(GLenum target, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord2svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3dvARB 206
+void
+__indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t,
+                                GLdouble r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 32;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3dvARB 206
+void
+__indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 32;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 24);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3fvARB 207
+void
+__indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t,
+                                GLfloat r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3fvARB 207
+void
+__indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3ivARB 208
+void
+__indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3ivARB 208
+void
+__indirect_glMultiTexCoord3ivARB(GLenum target, const GLint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3svARB 209
+void
+__indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t,
+                                GLshort r)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&t), 2);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord3svARB 209
+void
+__indirect_glMultiTexCoord3svARB(GLenum target, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord3svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 6);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4dvARB 210
+void
+__indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t,
+                                GLdouble r, GLdouble q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&q), 8);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4dvARB 210
+void
+__indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 32);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4fvARB 211
+void
+__indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t,
+                                GLfloat r, GLfloat q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&q), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4fvARB 211
+void
+__indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4ivARB 212
+void
+__indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r,
+                                GLint q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&q), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4ivARB 212
+void
+__indirect_glMultiTexCoord4ivARB(GLenum target, const GLint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4svARB 213
+void
+__indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t,
+                                GLshort r, GLshort q)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&t), 2);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 2);
+    (void) memcpy((void *) (gc->pc + 14), (void *) (&q), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_MultiTexCoord4svARB 213
+void
+__indirect_glMultiTexCoord4svARB(GLenum target, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_MultiTexCoord4svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SampleCoverageARB 229
+void
+__indirect_glSampleCoverageARB(GLclampf value, GLboolean invert)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_SampleCoverageARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&value), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&invert), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLvop_GetProgramStringARB 1308
+void
+__indirect_glGetProgramStringARB(GLenum target, GLenum pname, GLvoid * string)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramStringARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 1, string, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetProgramivARB 1307
+void
+__indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramivARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLrop_ProgramEnvParameter4dvARB 4185
+void
+__indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x,
+                                      GLdouble y, GLdouble z, GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44;
+    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramEnvParameter4dvARB 4185
+void
+__indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
+                                       const GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44;
+    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 32);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramEnvParameter4fvARB 4184
+void
+__indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x,
+                                      GLfloat y, GLfloat z, GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramEnvParameter4fvARB 4184
+void
+__indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index,
+                                       const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramLocalParameter4dvARB 4216
+void
+__indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index,
+                                        GLdouble x, GLdouble y, GLdouble z,
+                                        GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44;
+    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramLocalParameter4dvARB 4216
+void
+__indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index,
+                                         const GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44;
+    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 32);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramLocalParameter4fvARB 4215
+void
+__indirect_glProgramLocalParameter4fARB(GLenum target, GLuint index,
+                                        GLfloat x, GLfloat y, GLfloat z,
+                                        GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramLocalParameter4fvARB 4215
+void
+__indirect_glProgramLocalParameter4fvARB(GLenum target, GLuint index,
+                                         const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ProgramStringARB 4217
+void
+__indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len,
+                              const GLvoid * string)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((len >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_ProgramStringARB, cmdlen);
+            (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+            (void) memcpy((void *) (gc->pc + 8), (void *) (&format), 4);
+            (void) memcpy((void *) (gc->pc + 12), (void *) (&len), 4);
+            (void) memcpy((void *) (gc->pc + 16), (void *) (string), len);
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_ProgramStringARB;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 12), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 16), (void *) (&len), 4);
+            __glXSendLargeCommand(gc, pc, 20, string, len);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttrib1dvARB 4197
+void
+__indirect_glVertexAttrib1dARB(GLuint index, GLdouble x)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1dvARB 4197
+void
+__indirect_glVertexAttrib1dvARB(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1fvARB 4193
+void
+__indirect_glVertexAttrib1fARB(GLuint index, GLfloat x)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1fvARB 4193
+void
+__indirect_glVertexAttrib1fvARB(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1svARB 4189
+void
+__indirect_glVertexAttrib1sARB(GLuint index, GLshort x)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1svARB 4189
+void
+__indirect_glVertexAttrib1svARB(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2dvARB 4198
+void
+__indirect_glVertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2dvARB 4198
+void
+__indirect_glVertexAttrib2dvARB(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2fvARB 4194
+void
+__indirect_glVertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2fvARB 4194
+void
+__indirect_glVertexAttrib2fvARB(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2svARB 4190
+void
+__indirect_glVertexAttrib2sARB(GLuint index, GLshort x, GLshort y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2svARB 4190
+void
+__indirect_glVertexAttrib2svARB(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3dvARB 4199
+void
+__indirect_glVertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y,
+                               GLdouble z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 32;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3dvARB 4199
+void
+__indirect_glVertexAttrib3dvARB(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 32;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 24);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3fvARB 4195
+void
+__indirect_glVertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3fvARB 4195
+void
+__indirect_glVertexAttrib3fvARB(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3svARB 4191
+void
+__indirect_glVertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3svARB 4191
+void
+__indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 6);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4NbvARB 4235
+void
+__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte *v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4NbvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4NivARB 4237
+void
+__indirect_glVertexAttrib4NivARB(GLuint index, const GLint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4NivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4NsvARB 4236
+void
+__indirect_glVertexAttrib4NsvARB(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4NsvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4NubvARB 4201
+void
+__indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y,
+                                 GLubyte z, GLubyte w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4NubvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 1);
+    (void) memcpy((void *) (gc->pc + 9), (void *) (&y), 1);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&z), 1);
+    (void) memcpy((void *) (gc->pc + 11), (void *) (&w), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4NubvARB 4201
+void
+__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte *v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4NubvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4NuivARB 4239
+void
+__indirect_glVertexAttrib4NuivARB(GLuint index, const GLuint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4NuivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4NusvARB 4238
+void
+__indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4NusvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4bvARB 4230
+void
+__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte *v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4bvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4dvARB 4200
+void
+__indirect_glVertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y,
+                               GLdouble z, GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
+    (void) memcpy((void *) (gc->pc + 32), (void *) (&w), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4dvARB 4200
+void
+__indirect_glVertexAttrib4dvARB(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4dvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 32);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4fvARB 4196
+void
+__indirect_glVertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
+                               GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4fvARB 4196
+void
+__indirect_glVertexAttrib4fvARB(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4fvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4ivARB 4231
+void
+__indirect_glVertexAttrib4ivARB(GLuint index, const GLint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4ivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4svARB 4192
+void
+__indirect_glVertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z,
+                               GLshort w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
+    (void) memcpy((void *) (gc->pc + 14), (void *) (&w), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4svARB 4192
+void
+__indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4svARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4ubvARB 4232
+void
+__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte *v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4ubvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4uivARB 4234
+void
+__indirect_glVertexAttrib4uivARB(GLuint index, const GLuint * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4uivARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4usvARB 4233
+void
+__indirect_glVertexAttrib4usvARB(GLuint index, const GLushort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4usvARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_BeginQueryARB 231
+void
+__indirect_glBeginQueryARB(GLenum target, GLuint id)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BeginQueryARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&id), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLsop_DeleteQueriesARB 161
+void
+__indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_delete_queries_arb(c, gc->currentContextTag, n, ids);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_DeleteQueriesARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (ids), (n * 4));
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLrop_EndQueryARB 232
+void
+__indirect_glEndQueryARB(GLenum target)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_EndQueryARB, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLsop_GenQueriesARB 162
+void
+__indirect_glGenQueriesARB(GLsizei n, GLuint * ids)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_gen_queries_arb_reply_t *reply =
+            xcb_glx_gen_queries_arb_reply(c,
+                                          xcb_glx_gen_queries_arb(c,
+                                                                  gc->
+                                                                  currentContextTag,
+                                                                  n), NULL);
+        (void) memcpy(ids, xcb_glx_gen_queries_arb_data(reply),
+                      xcb_glx_gen_queries_arb_data_length(reply) *
+                      sizeof(GLuint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GenQueriesARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) __glXReadReply(dpy, 4, ids, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetQueryObjectivARB 165
+void
+__indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_query_objectiv_arb_reply_t *reply =
+            xcb_glx_get_query_objectiv_arb_reply(c,
+                                                 xcb_glx_get_query_objectiv_arb
+                                                 (c, gc->currentContextTag,
+                                                  id, pname), NULL);
+        if (xcb_glx_get_query_objectiv_arb_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_query_objectiv_arb_data(reply),
+                          xcb_glx_get_query_objectiv_arb_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectivARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetQueryObjectuivARB 166
+void
+__indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_query_objectuiv_arb_reply_t *reply =
+            xcb_glx_get_query_objectuiv_arb_reply(c,
+                                                  xcb_glx_get_query_objectuiv_arb
+                                                  (c, gc->currentContextTag,
+                                                   id, pname), NULL);
+        if (xcb_glx_get_query_objectuiv_arb_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_query_objectuiv_arb_data(reply),
+                          xcb_glx_get_query_objectuiv_arb_data_length(reply) *
+                          sizeof(GLuint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectuivARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_GetQueryivARB 164
+void
+__indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
+    const GLuint cmdlen = 8;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_get_queryiv_arb_reply_t *reply =
+            xcb_glx_get_queryiv_arb_reply(c,
+                                          xcb_glx_get_queryiv_arb(c,
+                                                                  gc->
+                                                                  currentContextTag,
+                                                                  target,
+                                                                  pname),
+                                          NULL);
+        if (xcb_glx_get_queryiv_arb_data_length(reply) == 0)
+            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
+        else
+            (void) memcpy(params, xcb_glx_get_queryiv_arb_data(reply),
+                          xcb_glx_get_queryiv_arb_data_length(reply) *
+                          sizeof(GLint));
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_GetQueryivARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return;
+}
+
+#define X_GLsop_IsQueryARB 163
+GLboolean
+__indirect_glIsQueryARB(GLuint id)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
+    const GLuint cmdlen = 4;
+#endif
+    if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_is_query_arb_reply_t *reply =
+            xcb_glx_is_query_arb_reply(c,
+                                       xcb_glx_is_query_arb(c,
+                                                            gc->
+                                                            currentContextTag,
+                                                            id), NULL);
+        retval = reply->ret_val;
+        free(reply);
+#else
+        GLubyte const *pc =
+            __glXSetupSingleRequest(gc, X_GLsop_IsQueryARB, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
+        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+#endif /* USE_XCB */
+    }
+    return retval;
+}
+
+#define X_GLrop_DrawBuffersARB 233
+void
+__indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ((gc->pc + cmdlen) > gc->bufEnd) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_DrawBuffersARB, cmdlen);
+            (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
+            (void) memcpy((void *) (gc->pc + 8), (void *) (bufs), (n * 4));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+        } else {
+            const GLint op = X_GLrop_DrawBuffersARB;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&n), 4);
+            __glXSendLargeCommand(gc, pc, 12, bufs, (n * 4));
+        }
+    }
+}
+
+#define X_GLrop_RenderbufferStorageMultisample 4331
+void
+__indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples,
+                                            GLenum internalformat,
+                                            GLsizei width, GLsizei height)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_RenderbufferStorageMultisample, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&samples), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&height), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SampleMaskSGIS 2048
+void
+__indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_SampleMaskSGIS, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&value), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&invert), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SamplePatternSGIS 2049
+void
+__indirect_glSamplePatternSGIS(GLenum pattern)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_SamplePatternSGIS, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pattern), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PointParameterfEXT 2065
+void
+__indirect_glPointParameterfEXT(GLenum pname, GLfloat param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_PointParameterfEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PointParameterfvEXT 2066
+void
+__indirect_glPointParameterfvEXT(GLenum pname, const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glPointParameterfvEXT_size(pname);
+    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_PointParameterfvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3bvEXT 4126
+void
+__indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3bvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3bvEXT 4126
+void
+__indirect_glSecondaryColor3bvEXT(const GLbyte *v)
+{
+    generic_3_byte(X_GLrop_SecondaryColor3bvEXT, v);
+}
+
+#define X_GLrop_SecondaryColor3dvEXT 4130
+void
+__indirect_glSecondaryColor3dEXT(GLdouble red, GLdouble green, GLdouble blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3dvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 8);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&green), 8);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&blue), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3dvEXT 4130
+void
+__indirect_glSecondaryColor3dvEXT(const GLdouble * v)
+{
+    generic_24_byte(X_GLrop_SecondaryColor3dvEXT, v);
+}
+
+#define X_GLrop_SecondaryColor3fvEXT 4129
+void
+__indirect_glSecondaryColor3fEXT(GLfloat red, GLfloat green, GLfloat blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3fvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3fvEXT 4129
+void
+__indirect_glSecondaryColor3fvEXT(const GLfloat * v)
+{
+    generic_12_byte(X_GLrop_SecondaryColor3fvEXT, v);
+}
+
+#define X_GLrop_SecondaryColor3ivEXT 4128
+void
+__indirect_glSecondaryColor3iEXT(GLint red, GLint green, GLint blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3ivEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3ivEXT 4128
+void
+__indirect_glSecondaryColor3ivEXT(const GLint * v)
+{
+    generic_12_byte(X_GLrop_SecondaryColor3ivEXT, v);
+}
+
+#define X_GLrop_SecondaryColor3svEXT 4127
+void
+__indirect_glSecondaryColor3sEXT(GLshort red, GLshort green, GLshort blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3svEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3svEXT 4127
+void
+__indirect_glSecondaryColor3svEXT(const GLshort * v)
+{
+    generic_6_byte(X_GLrop_SecondaryColor3svEXT, v);
+}
+
+#define X_GLrop_SecondaryColor3ubvEXT 4131
+void
+__indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3ubvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
+    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3ubvEXT 4131
+void
+__indirect_glSecondaryColor3ubvEXT(const GLubyte *v)
+{
+    generic_3_byte(X_GLrop_SecondaryColor3ubvEXT, v);
+}
+
+#define X_GLrop_SecondaryColor3uivEXT 4133
+void
+__indirect_glSecondaryColor3uiEXT(GLuint red, GLuint green, GLuint blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3uivEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3uivEXT 4133
+void
+__indirect_glSecondaryColor3uivEXT(const GLuint * v)
+{
+    generic_12_byte(X_GLrop_SecondaryColor3uivEXT, v);
+}
+
+#define X_GLrop_SecondaryColor3usvEXT 4132
+void
+__indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_SecondaryColor3usvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
+    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_SecondaryColor3usvEXT 4132
+void
+__indirect_glSecondaryColor3usvEXT(const GLushort * v)
+{
+    generic_6_byte(X_GLrop_SecondaryColor3usvEXT, v);
+}
+
+#define X_GLrop_FogCoorddvEXT 4125
+void
+__indirect_glFogCoorddEXT(GLdouble coord)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_FogCoorddvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_FogCoorddvEXT 4125
+void
+__indirect_glFogCoorddvEXT(const GLdouble * coord)
+{
+    generic_8_byte(X_GLrop_FogCoorddvEXT, coord);
+}
+
+#define X_GLrop_FogCoordfvEXT 4124
+void
+__indirect_glFogCoordfEXT(GLfloat coord)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_FogCoordfvEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_FogCoordfvEXT 4124
+void
+__indirect_glFogCoordfvEXT(const GLfloat * coord)
+{
+    generic_4_byte(X_GLrop_FogCoordfvEXT, coord);
+}
+
+#define X_GLrop_BlendFuncSeparateEXT 4134
+void
+__indirect_glBlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
+                                  GLenum sfactorAlpha, GLenum dfactorAlpha)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_BlendFuncSeparateEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&sfactorRGB), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&dfactorRGB), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&sfactorAlpha), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&dfactorAlpha), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_WindowPos3fvMESA 230
+void
+__indirect_glWindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_WindowPos3fvMESA, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_WindowPos3fvMESA 230
+void
+__indirect_glWindowPos3fvMESA(const GLfloat * v)
+{
+    generic_12_byte(X_GLrop_WindowPos3fvMESA, v);
+}
+
+#define X_GLvop_AreProgramsResidentNV 1293
+GLboolean
+__indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids,
+                                   GLboolean * residences)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLboolean retval = (GLboolean) 0;
+    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return 0;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_AreProgramsResidentNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (ids), (n * 4));
+        retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return retval;
+}
+
+#define X_GLrop_BindProgramNV 4180
+void
+__indirect_glBindProgramNV(GLenum target, GLuint program)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BindProgramNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&program), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLvop_DeleteProgramsNV 1294
+void
+__indirect_glDeleteProgramsNV(GLsizei n, const GLuint * programs)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivate,
+                                    X_GLvop_DeleteProgramsNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (programs), (n * 4));
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLrop_ExecuteProgramNV 4181
+void
+__indirect_glExecuteProgramNV(GLenum target, GLuint id,
+                              const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_ExecuteProgramNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&id), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLvop_GenProgramsNV 1295
+void
+__indirect_glGenProgramsNV(GLsizei n, GLuint * programs)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 4;
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GenProgramsNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) __glXReadReply(dpy, 4, programs, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetProgramParameterdvNV 1297
+void
+__indirect_glGetProgramParameterdvNV(GLenum target, GLuint index,
+                                     GLenum pname, GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 12;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramParameterdvNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 8, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetProgramParameterfvNV 1296
+void
+__indirect_glGetProgramParameterfvNV(GLenum target, GLuint index,
+                                     GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 12;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramParameterfvNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetProgramStringNV 1299
+void
+__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramStringNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 1, program, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetProgramivNV 1298
+void
+__indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramivNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetTrackMatrixivNV 1300
+void
+__indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname,
+                                GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 12;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetTrackMatrixivNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&address), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetVertexAttribdvNV 1301
+void
+__indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname,
+                                 GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetVertexAttribdvNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&index), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 8, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetVertexAttribfvNV 1302
+void
+__indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetVertexAttribfvNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&index), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetVertexAttribivNV 1303
+void
+__indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetVertexAttribivNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&index), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_IsProgramNV 1304
+GLboolean
+__indirect_glIsProgramNV(GLuint program)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLboolean retval = (GLboolean) 0;
+    const GLuint cmdlen = 4;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_IsProgramNV, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&program), 4);
+        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return retval;
+}
+
+#define X_GLrop_LoadProgramNV 4183
+void
+__indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
+                           const GLubyte *program)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(len >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_LoadProgramNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&id), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (&len), 4);
+        (void) memcpy((void *) (gc->pc + 16), (void *) (program), len);
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_ProgramParameters4dvNV 4187
+void
+__indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num,
+                                    const GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16 + __GLX_PAD((num * 32));
+    if (num < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(num >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_ProgramParameters4dvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (&num), 4);
+        (void) memcpy((void *) (gc->pc + 16), (void *) (params), (num * 32));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_ProgramParameters4fvNV 4186
+void
+__indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num,
+                                    const GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16 + __GLX_PAD((num * 16));
+    if (num < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(num >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_ProgramParameters4fvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (&num), 4);
+        (void) memcpy((void *) (gc->pc + 16), (void *) (params), (num * 16));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_RequestResidentProgramsNV 4182
+void
+__indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_RequestResidentProgramsNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (ids), (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_TrackMatrixNV 4188
+void
+__indirect_glTrackMatrixNV(GLenum target, GLuint address, GLenum matrix,
+                           GLenum transform)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_TrackMatrixNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&address), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&matrix), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&transform), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1dvNV 4273
+void
+__indirect_glVertexAttrib1dNV(GLuint index, GLdouble x)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1dvNV 4273
+void
+__indirect_glVertexAttrib1dvNV(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1fvNV 4269
+void
+__indirect_glVertexAttrib1fNV(GLuint index, GLfloat x)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1fvNV 4269
+void
+__indirect_glVertexAttrib1fvNV(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1svNV 4265
+void
+__indirect_glVertexAttrib1sNV(GLuint index, GLshort x)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib1svNV 4265
+void
+__indirect_glVertexAttrib1svNV(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib1svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2dvNV 4274
+void
+__indirect_glVertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2dvNV 4274
+void
+__indirect_glVertexAttrib2dvNV(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2fvNV 4270
+void
+__indirect_glVertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2fvNV 4270
+void
+__indirect_glVertexAttrib2fvNV(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2svNV 4266
+void
+__indirect_glVertexAttrib2sNV(GLuint index, GLshort x, GLshort y)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib2svNV 4266
+void
+__indirect_glVertexAttrib2svNV(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib2svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3dvNV 4275
+void
+__indirect_glVertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y,
+                              GLdouble z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 32;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3dvNV 4275
+void
+__indirect_glVertexAttrib3dvNV(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 32;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 24);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3fvNV 4271
+void
+__indirect_glVertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3fvNV 4271
+void
+__indirect_glVertexAttrib3fvNV(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3svNV 4267
+void
+__indirect_glVertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib3svNV 4267
+void
+__indirect_glVertexAttrib3svNV(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib3svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 6);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4dvNV 4276
+void
+__indirect_glVertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y,
+                              GLdouble z, GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
+    (void) memcpy((void *) (gc->pc + 32), (void *) (&w), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4dvNV 4276
+void
+__indirect_glVertexAttrib4dvNV(GLuint index, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 40;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4dvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 32);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4fvNV 4272
+void
+__indirect_glVertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z,
+                              GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&w), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4fvNV 4272
+void
+__indirect_glVertexAttrib4fvNV(GLuint index, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4fvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4svNV 4268
+void
+__indirect_glVertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z,
+                              GLshort w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
+    (void) memcpy((void *) (gc->pc + 14), (void *) (&w), 2);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4svNV 4268
+void
+__indirect_glVertexAttrib4svNV(GLuint index, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 16;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4svNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4ubvNV 4277
+void
+__indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z,
+                               GLubyte w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4ubvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 1);
+    (void) memcpy((void *) (gc->pc + 9), (void *) (&y), 1);
+    (void) memcpy((void *) (gc->pc + 10), (void *) (&z), 1);
+    (void) memcpy((void *) (gc->pc + 11), (void *) (&w), 1);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttrib4ubvNV 4277
+void
+__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte *v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_VertexAttrib4ubvNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_VertexAttribs1dvNV 4210
+void
+__indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs1dvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs1fvNV 4206
+void
+__indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs1fvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs1svNV 4202
+void
+__indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 2));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs1svNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 2));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs2dvNV 4211
+void
+__indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs2dvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 16));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs2fvNV 4207
+void
+__indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs2fvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs2svNV 4203
+void
+__indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs2svNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs3dvNV 4212
+void
+__indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 24));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs3dvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 24));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs3fvNV 4208
+void
+__indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 12));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs3fvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 12));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs3svNV 4204
+void
+__indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 6));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs3svNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 6));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs4dvNV 4213
+void
+__indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 32));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs4dvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 32));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs4fvNV 4209
+void
+__indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs4fvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 16));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs4svNV 4205
+void
+__indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs4svNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_VertexAttribs4ubvNV 4214
+void
+__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_VertexAttribs4ubvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_PointParameteriNV 4221
+void
+__indirect_glPointParameteriNV(GLenum pname, GLint param)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_PointParameteriNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_PointParameterivNV 4222
+void
+__indirect_glPointParameterivNV(GLenum pname, const GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint compsize = __glPointParameterivNV_size(pname);
+    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
+    emit_header(gc->pc, X_GLrop_PointParameterivNV, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_ActiveStencilFaceEXT 4220
+void
+__indirect_glActiveStencilFaceEXT(GLenum face)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_ActiveStencilFaceEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLvop_GetProgramNamedParameterdvNV 1311
+void
+__indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
+                                          const GLubyte *name,
+                                          GLdouble * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramNamedParameterdvNV,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&len), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (name), len);
+        (void) __glXReadReply(dpy, 8, params, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetProgramNamedParameterfvNV 1310
+void
+__indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
+                                          const GLubyte *name,
+                                          GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetProgramNamedParameterfvNV,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&len), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (name), len);
+        (void) __glXReadReply(dpy, 4, params, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLrop_ProgramNamedParameter4dvNV 4219
+void
+__indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
+                                       const GLubyte *name, GLdouble x,
+                                       GLdouble y, GLdouble z, GLdouble w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(len >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
+        (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
+        (void) memcpy((void *) (gc->pc + 28), (void *) (&w), 8);
+        (void) memcpy((void *) (gc->pc + 36), (void *) (&id), 4);
+        (void) memcpy((void *) (gc->pc + 40), (void *) (&len), 4);
+        (void) memcpy((void *) (gc->pc + 44), (void *) (name), len);
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_ProgramNamedParameter4dvNV 4219
+void
+__indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
+                                        const GLubyte *name,
+                                        const GLdouble * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(len >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (v), 32);
+        (void) memcpy((void *) (gc->pc + 36), (void *) (&id), 4);
+        (void) memcpy((void *) (gc->pc + 40), (void *) (&len), 4);
+        (void) memcpy((void *) (gc->pc + 44), (void *) (name), len);
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_ProgramNamedParameter4fvNV 4218
+void
+__indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
+                                       const GLubyte *name, GLfloat x,
+                                       GLfloat y, GLfloat z, GLfloat w)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(len >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&len), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+        (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+        (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
+        (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
+        (void) memcpy((void *) (gc->pc + 28), (void *) (name), len);
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_ProgramNamedParameter4fvNV 4218
+void
+__indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len,
+                                        const GLubyte *name,
+                                        const GLfloat * v)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(len >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (&len), 4);
+        (void) memcpy((void *) (gc->pc + 12), (void *) (v), 16);
+        (void) memcpy((void *) (gc->pc + 28), (void *) (name), len);
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_BlendEquationSeparateEXT 4228
+void
+__indirect_glBlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BlendEquationSeparateEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&modeRGB), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&modeA), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_BindFramebufferEXT 4319
+void
+__indirect_glBindFramebufferEXT(GLenum target, GLuint framebuffer)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BindFramebufferEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&framebuffer), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_BindRenderbufferEXT 4316
+void
+__indirect_glBindRenderbufferEXT(GLenum target, GLuint renderbuffer)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BindRenderbufferEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&renderbuffer), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLvop_CheckFramebufferStatusEXT 1427
+GLenum
+__indirect_glCheckFramebufferStatusEXT(GLenum target)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLenum retval = (GLenum) 0;
+    const GLuint cmdlen = 4;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_CheckFramebufferStatusEXT,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        retval = (GLenum) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return retval;
+}
+
+#define X_GLrop_DeleteFramebuffersEXT 4320
+void
+__indirect_glDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_DeleteFramebuffersEXT, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (framebuffers),
+                      (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_DeleteRenderbuffersEXT 4317
+void
+__indirect_glDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect(n >= 0, 1)) {
+        emit_header(gc->pc, X_GLrop_DeleteRenderbuffersEXT, cmdlen);
+        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
+        (void) memcpy((void *) (gc->pc + 8), (void *) (renderbuffers),
+                      (n * 4));
+        gc->pc += cmdlen;
+        if (__builtin_expect(gc->pc > gc->limit, 0)) {
+            (void) __glXFlushRenderBuffer(gc, gc->pc);
+        }
+    }
+}
+
+#define X_GLrop_FramebufferRenderbufferEXT 4324
+void
+__indirect_glFramebufferRenderbufferEXT(GLenum target, GLenum attachment,
+                                        GLenum renderbuffertarget,
+                                        GLuint renderbuffer)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_FramebufferRenderbufferEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&renderbuffertarget), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&renderbuffer), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_FramebufferTexture1DEXT 4321
+void
+__indirect_glFramebufferTexture1DEXT(GLenum target, GLenum attachment,
+                                     GLenum textarget, GLuint texture,
+                                     GLint level)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_FramebufferTexture1DEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&textarget), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&texture), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&level), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_FramebufferTexture2DEXT 4322
+void
+__indirect_glFramebufferTexture2DEXT(GLenum target, GLenum attachment,
+                                     GLenum textarget, GLuint texture,
+                                     GLint level)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_FramebufferTexture2DEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&textarget), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&texture), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&level), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_FramebufferTexture3DEXT 4323
+void
+__indirect_glFramebufferTexture3DEXT(GLenum target, GLenum attachment,
+                                     GLenum textarget, GLuint texture,
+                                     GLint level, GLint zoffset)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 28;
+    emit_header(gc->pc, X_GLrop_FramebufferTexture3DEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&textarget), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&texture), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&level), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&zoffset), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLvop_GenFramebuffersEXT 1426
+void
+__indirect_glGenFramebuffersEXT(GLsizei n, GLuint * framebuffers)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 4;
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GenFramebuffersEXT, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) __glXReadReply(dpy, 4, framebuffers, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GenRenderbuffersEXT 1423
+void
+__indirect_glGenRenderbuffersEXT(GLsizei n, GLuint * renderbuffers)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 4;
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GenRenderbuffersEXT, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+        (void) __glXReadReply(dpy, 4, renderbuffers, GL_TRUE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLrop_GenerateMipmapEXT 4325
+void
+__indirect_glGenerateMipmapEXT(GLenum target)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_GenerateMipmapEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLvop_GetFramebufferAttachmentParameterivEXT 1428
+void
+__indirect_glGetFramebufferAttachmentParameterivEXT(GLenum target,
+                                                    GLenum attachment,
+                                                    GLenum pname,
+                                                    GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 12;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetFramebufferAttachmentParameterivEXT,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&attachment), 4);
+        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_GetRenderbufferParameterivEXT 1424
+void
+__indirect_glGetRenderbufferParameterivEXT(GLenum target, GLenum pname,
+                                           GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetRenderbufferParameterivEXT,
+                                    cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return;
+}
+
+#define X_GLvop_IsFramebufferEXT 1425
+GLboolean
+__indirect_glIsFramebufferEXT(GLuint framebuffer)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLboolean retval = (GLboolean) 0;
+    const GLuint cmdlen = 4;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_IsFramebufferEXT, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&framebuffer), 4);
+        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return retval;
+}
+
+#define X_GLvop_IsRenderbufferEXT 1422
+GLboolean
+__indirect_glIsRenderbufferEXT(GLuint renderbuffer)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    Display *const dpy = gc->currentDpy;
+    GLboolean retval = (GLboolean) 0;
+    const GLuint cmdlen = 4;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_IsRenderbufferEXT, cmdlen);
+        (void) memcpy((void *) (pc + 0), (void *) (&renderbuffer), 4);
+        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy);
+        SyncHandle();
+    }
+    return retval;
+}
+
+#define X_GLrop_RenderbufferStorageEXT 4318
+void
+__indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat,
+                                    GLsizei width, GLsizei height)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 20;
+    emit_header(gc->pc, X_GLrop_RenderbufferStorageEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_BlitFramebufferEXT 4330
+void
+__indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1,
+                                GLint srcY1, GLint dstX0, GLint dstY0,
+                                GLint dstX1, GLint dstY1, GLbitfield mask,
+                                GLenum filter)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 44;
+    emit_header(gc->pc, X_GLrop_BlitFramebufferEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&srcX0), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&srcY0), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&srcX1), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&srcY1), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&dstX0), 4);
+    (void) memcpy((void *) (gc->pc + 24), (void *) (&dstY0), 4);
+    (void) memcpy((void *) (gc->pc + 28), (void *) (&dstX1), 4);
+    (void) memcpy((void *) (gc->pc + 32), (void *) (&dstY1), 4);
+    (void) memcpy((void *) (gc->pc + 36), (void *) (&mask), 4);
+    (void) memcpy((void *) (gc->pc + 40), (void *) (&filter), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+#define X_GLrop_FramebufferTextureLayerEXT 237
+void
+__indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment,
+                                        GLuint texture, GLint level,
+                                        GLint layer)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 24;
+    emit_header(gc->pc, X_GLrop_FramebufferTextureLayerEXT, cmdlen);
+    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
+    (void) memcpy((void *) (gc->pc + 12), (void *) (&texture), 4);
+    (void) memcpy((void *) (gc->pc + 16), (void *) (&level), 4);
+    (void) memcpy((void *) (gc->pc + 20), (void *) (&layer), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) {
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+    }
+}
+
+
+#  undef FASTCALL
+#  undef NOINLINE
diff --git a/src/glx/indirect.h b/src/glx/indirect.h
new file mode 100644 (file)
index 0000000..9e73b33
--- /dev/null
@@ -0,0 +1,721 @@
+/* DO NOT EDIT - This file generated automatically by glX_proto_send.py (from Mesa) script */
+
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * (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
+ * 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
+ * PRECISION INSIGHT, 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.
+ */
+
+#if !defined( _INDIRECT_H_ )
+#  define _INDIRECT_H_
+
+/**
+ * \file
+ * Prototypes for indirect rendering functions.
+ *
+ * \author Kevin E. Martin <kevin@precisioninsight.com>
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
+#    define HIDDEN  __attribute__((visibility("hidden")))
+#  else
+#    define HIDDEN
+#  endif
+#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#    define FASTCALL __attribute__((fastcall))
+#  else
+#    define FASTCALL
+#  endif
+#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#    define NOINLINE __attribute__((noinline))
+#  else
+#    define NOINLINE
+#  endif
+
+#include "glxclient.h"
+
+extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size,
+    void * dest, GLboolean reply_is_always_array );
+
+extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy,
+    __GLXcontext * gc, unsigned max_dim, GLint width, GLint height,
+    GLint depth, GLenum format, GLenum type, void * dest,
+    GLboolean dimensions_in_reply );
+
+extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest(
+    __GLXcontext * gc, GLint sop, GLint cmdlen );
+
+extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest(
+    __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen );
+
+extern HIDDEN void __indirect_glNewList(GLuint list, GLenum mode);
+extern HIDDEN void __indirect_glEndList(void);
+extern HIDDEN void __indirect_glCallList(GLuint list);
+extern HIDDEN void __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists);
+extern HIDDEN void __indirect_glDeleteLists(GLuint list, GLsizei range);
+extern HIDDEN GLuint __indirect_glGenLists(GLsizei range);
+extern HIDDEN void __indirect_glListBase(GLuint base);
+extern HIDDEN void __indirect_glBegin(GLenum mode);
+extern HIDDEN void __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap);
+extern HIDDEN void __indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue);
+extern HIDDEN void __indirect_glColor3bv(const GLbyte * v);
+extern HIDDEN void __indirect_glColor3d(GLdouble red, GLdouble green, GLdouble blue);
+extern HIDDEN void __indirect_glColor3dv(const GLdouble * v);
+extern HIDDEN void __indirect_glColor3f(GLfloat red, GLfloat green, GLfloat blue);
+extern HIDDEN void __indirect_glColor3fv(const GLfloat * v);
+extern HIDDEN void __indirect_glColor3i(GLint red, GLint green, GLint blue);
+extern HIDDEN void __indirect_glColor3iv(const GLint * v);
+extern HIDDEN void __indirect_glColor3s(GLshort red, GLshort green, GLshort blue);
+extern HIDDEN void __indirect_glColor3sv(const GLshort * v);
+extern HIDDEN void __indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
+extern HIDDEN void __indirect_glColor3ubv(const GLubyte * v);
+extern HIDDEN void __indirect_glColor3ui(GLuint red, GLuint green, GLuint blue);
+extern HIDDEN void __indirect_glColor3uiv(const GLuint * v);
+extern HIDDEN void __indirect_glColor3us(GLushort red, GLushort green, GLushort blue);
+extern HIDDEN void __indirect_glColor3usv(const GLushort * v);
+extern HIDDEN void __indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
+extern HIDDEN void __indirect_glColor4bv(const GLbyte * v);
+extern HIDDEN void __indirect_glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
+extern HIDDEN void __indirect_glColor4dv(const GLdouble * v);
+extern HIDDEN void __indirect_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+extern HIDDEN void __indirect_glColor4fv(const GLfloat * v);
+extern HIDDEN void __indirect_glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
+extern HIDDEN void __indirect_glColor4iv(const GLint * v);
+extern HIDDEN void __indirect_glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
+extern HIDDEN void __indirect_glColor4sv(const GLshort * v);
+extern HIDDEN void __indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+extern HIDDEN void __indirect_glColor4ubv(const GLubyte * v);
+extern HIDDEN void __indirect_glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
+extern HIDDEN void __indirect_glColor4uiv(const GLuint * v);
+extern HIDDEN void __indirect_glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
+extern HIDDEN void __indirect_glColor4usv(const GLushort * v);
+extern HIDDEN void __indirect_glEdgeFlag(GLboolean flag);
+extern HIDDEN void __indirect_glEdgeFlagv(const GLboolean * flag);
+extern HIDDEN void __indirect_glEnd(void);
+extern HIDDEN void __indirect_glIndexd(GLdouble c);
+extern HIDDEN void __indirect_glIndexdv(const GLdouble * c);
+extern HIDDEN void __indirect_glIndexf(GLfloat c);
+extern HIDDEN void __indirect_glIndexfv(const GLfloat * c);
+extern HIDDEN void __indirect_glIndexi(GLint c);
+extern HIDDEN void __indirect_glIndexiv(const GLint * c);
+extern HIDDEN void __indirect_glIndexs(GLshort c);
+extern HIDDEN void __indirect_glIndexsv(const GLshort * c);
+extern HIDDEN void __indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
+extern HIDDEN void __indirect_glNormal3bv(const GLbyte * v);
+extern HIDDEN void __indirect_glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
+extern HIDDEN void __indirect_glNormal3dv(const GLdouble * v);
+extern HIDDEN void __indirect_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
+extern HIDDEN void __indirect_glNormal3fv(const GLfloat * v);
+extern HIDDEN void __indirect_glNormal3i(GLint nx, GLint ny, GLint nz);
+extern HIDDEN void __indirect_glNormal3iv(const GLint * v);
+extern HIDDEN void __indirect_glNormal3s(GLshort nx, GLshort ny, GLshort nz);
+extern HIDDEN void __indirect_glNormal3sv(const GLshort * v);
+extern HIDDEN void __indirect_glRasterPos2d(GLdouble x, GLdouble y);
+extern HIDDEN void __indirect_glRasterPos2dv(const GLdouble * v);
+extern HIDDEN void __indirect_glRasterPos2f(GLfloat x, GLfloat y);
+extern HIDDEN void __indirect_glRasterPos2fv(const GLfloat * v);
+extern HIDDEN void __indirect_glRasterPos2i(GLint x, GLint y);
+extern HIDDEN void __indirect_glRasterPos2iv(const GLint * v);
+extern HIDDEN void __indirect_glRasterPos2s(GLshort x, GLshort y);
+extern HIDDEN void __indirect_glRasterPos2sv(const GLshort * v);
+extern HIDDEN void __indirect_glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glRasterPos3dv(const GLdouble * v);
+extern HIDDEN void __indirect_glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glRasterPos3fv(const GLfloat * v);
+extern HIDDEN void __indirect_glRasterPos3i(GLint x, GLint y, GLint z);
+extern HIDDEN void __indirect_glRasterPos3iv(const GLint * v);
+extern HIDDEN void __indirect_glRasterPos3s(GLshort x, GLshort y, GLshort z);
+extern HIDDEN void __indirect_glRasterPos3sv(const GLshort * v);
+extern HIDDEN void __indirect_glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern HIDDEN void __indirect_glRasterPos4dv(const GLdouble * v);
+extern HIDDEN void __indirect_glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern HIDDEN void __indirect_glRasterPos4fv(const GLfloat * v);
+extern HIDDEN void __indirect_glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
+extern HIDDEN void __indirect_glRasterPos4iv(const GLint * v);
+extern HIDDEN void __indirect_glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
+extern HIDDEN void __indirect_glRasterPos4sv(const GLshort * v);
+extern HIDDEN void __indirect_glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
+extern HIDDEN void __indirect_glRectdv(const GLdouble * v1, const GLdouble * v2);
+extern HIDDEN void __indirect_glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+extern HIDDEN void __indirect_glRectfv(const GLfloat * v1, const GLfloat * v2);
+extern HIDDEN void __indirect_glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
+extern HIDDEN void __indirect_glRectiv(const GLint * v1, const GLint * v2);
+extern HIDDEN void __indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
+extern HIDDEN void __indirect_glRectsv(const GLshort * v1, const GLshort * v2);
+extern HIDDEN void __indirect_glTexCoord1d(GLdouble s);
+extern HIDDEN void __indirect_glTexCoord1dv(const GLdouble * v);
+extern HIDDEN void __indirect_glTexCoord1f(GLfloat s);
+extern HIDDEN void __indirect_glTexCoord1fv(const GLfloat * v);
+extern HIDDEN void __indirect_glTexCoord1i(GLint s);
+extern HIDDEN void __indirect_glTexCoord1iv(const GLint * v);
+extern HIDDEN void __indirect_glTexCoord1s(GLshort s);
+extern HIDDEN void __indirect_glTexCoord1sv(const GLshort * v);
+extern HIDDEN void __indirect_glTexCoord2d(GLdouble s, GLdouble t);
+extern HIDDEN void __indirect_glTexCoord2dv(const GLdouble * v);
+extern HIDDEN void __indirect_glTexCoord2f(GLfloat s, GLfloat t);
+extern HIDDEN void __indirect_glTexCoord2fv(const GLfloat * v);
+extern HIDDEN void __indirect_glTexCoord2i(GLint s, GLint t);
+extern HIDDEN void __indirect_glTexCoord2iv(const GLint * v);
+extern HIDDEN void __indirect_glTexCoord2s(GLshort s, GLshort t);
+extern HIDDEN void __indirect_glTexCoord2sv(const GLshort * v);
+extern HIDDEN void __indirect_glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
+extern HIDDEN void __indirect_glTexCoord3dv(const GLdouble * v);
+extern HIDDEN void __indirect_glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
+extern HIDDEN void __indirect_glTexCoord3fv(const GLfloat * v);
+extern HIDDEN void __indirect_glTexCoord3i(GLint s, GLint t, GLint r);
+extern HIDDEN void __indirect_glTexCoord3iv(const GLint * v);
+extern HIDDEN void __indirect_glTexCoord3s(GLshort s, GLshort t, GLshort r);
+extern HIDDEN void __indirect_glTexCoord3sv(const GLshort * v);
+extern HIDDEN void __indirect_glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+extern HIDDEN void __indirect_glTexCoord4dv(const GLdouble * v);
+extern HIDDEN void __indirect_glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+extern HIDDEN void __indirect_glTexCoord4fv(const GLfloat * v);
+extern HIDDEN void __indirect_glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
+extern HIDDEN void __indirect_glTexCoord4iv(const GLint * v);
+extern HIDDEN void __indirect_glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
+extern HIDDEN void __indirect_glTexCoord4sv(const GLshort * v);
+extern HIDDEN void __indirect_glVertex2d(GLdouble x, GLdouble y);
+extern HIDDEN void __indirect_glVertex2dv(const GLdouble * v);
+extern HIDDEN void __indirect_glVertex2f(GLfloat x, GLfloat y);
+extern HIDDEN void __indirect_glVertex2fv(const GLfloat * v);
+extern HIDDEN void __indirect_glVertex2i(GLint x, GLint y);
+extern HIDDEN void __indirect_glVertex2iv(const GLint * v);
+extern HIDDEN void __indirect_glVertex2s(GLshort x, GLshort y);
+extern HIDDEN void __indirect_glVertex2sv(const GLshort * v);
+extern HIDDEN void __indirect_glVertex3d(GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glVertex3dv(const GLdouble * v);
+extern HIDDEN void __indirect_glVertex3f(GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glVertex3fv(const GLfloat * v);
+extern HIDDEN void __indirect_glVertex3i(GLint x, GLint y, GLint z);
+extern HIDDEN void __indirect_glVertex3iv(const GLint * v);
+extern HIDDEN void __indirect_glVertex3s(GLshort x, GLshort y, GLshort z);
+extern HIDDEN void __indirect_glVertex3sv(const GLshort * v);
+extern HIDDEN void __indirect_glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern HIDDEN void __indirect_glVertex4dv(const GLdouble * v);
+extern HIDDEN void __indirect_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern HIDDEN void __indirect_glVertex4fv(const GLfloat * v);
+extern HIDDEN void __indirect_glVertex4i(GLint x, GLint y, GLint z, GLint w);
+extern HIDDEN void __indirect_glVertex4iv(const GLint * v);
+extern HIDDEN void __indirect_glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
+extern HIDDEN void __indirect_glVertex4sv(const GLshort * v);
+extern HIDDEN void __indirect_glClipPlane(GLenum plane, const GLdouble * equation);
+extern HIDDEN void __indirect_glColorMaterial(GLenum face, GLenum mode);
+extern HIDDEN void __indirect_glCullFace(GLenum mode);
+extern HIDDEN void __indirect_glFogf(GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glFogfv(GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glFogi(GLenum pname, GLint param);
+extern HIDDEN void __indirect_glFogiv(GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glFrontFace(GLenum mode);
+extern HIDDEN void __indirect_glHint(GLenum target, GLenum mode);
+extern HIDDEN void __indirect_glLightf(GLenum light, GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glLightfv(GLenum light, GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glLighti(GLenum light, GLenum pname, GLint param);
+extern HIDDEN void __indirect_glLightiv(GLenum light, GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glLightModelf(GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glLightModelfv(GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glLightModeli(GLenum pname, GLint param);
+extern HIDDEN void __indirect_glLightModeliv(GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glLineStipple(GLint factor, GLushort pattern);
+extern HIDDEN void __indirect_glLineWidth(GLfloat width);
+extern HIDDEN void __indirect_glMaterialf(GLenum face, GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glMateriali(GLenum face, GLenum pname, GLint param);
+extern HIDDEN void __indirect_glMaterialiv(GLenum face, GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glPointSize(GLfloat size);
+extern HIDDEN void __indirect_glPolygonMode(GLenum face, GLenum mode);
+extern HIDDEN void __indirect_glPolygonStipple(const GLubyte * mask);
+extern HIDDEN void __indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glShadeModel(GLenum mode);
+extern HIDDEN void __indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glTexParameterfv(GLenum target, GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glTexParameteri(GLenum target, GLenum pname, GLint param);
+extern HIDDEN void __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
+extern HIDDEN void __indirect_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
+extern HIDDEN void __indirect_glTexEnvf(GLenum target, GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glTexEnvi(GLenum target, GLenum pname, GLint param);
+extern HIDDEN void __indirect_glTexEnviv(GLenum target, GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glTexGend(GLenum coord, GLenum pname, GLdouble param);
+extern HIDDEN void __indirect_glTexGendv(GLenum coord, GLenum pname, const GLdouble * params);
+extern HIDDEN void __indirect_glTexGenf(GLenum coord, GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glTexGenfv(GLenum coord, GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glTexGeni(GLenum coord, GLenum pname, GLint param);
+extern HIDDEN void __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glFeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer);
+extern HIDDEN void __indirect_glSelectBuffer(GLsizei size, GLuint * buffer);
+extern HIDDEN GLint __indirect_glRenderMode(GLenum mode);
+extern HIDDEN void __indirect_glInitNames(void);
+extern HIDDEN void __indirect_glLoadName(GLuint name);
+extern HIDDEN void __indirect_glPassThrough(GLfloat token);
+extern HIDDEN void __indirect_glPopName(void);
+extern HIDDEN void __indirect_glPushName(GLuint name);
+extern HIDDEN void __indirect_glDrawBuffer(GLenum mode);
+extern HIDDEN void __indirect_glClear(GLbitfield mask);
+extern HIDDEN void __indirect_glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+extern HIDDEN void __indirect_glClearIndex(GLfloat c);
+extern HIDDEN void __indirect_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+extern HIDDEN void __indirect_glClearStencil(GLint s);
+extern HIDDEN void __indirect_glClearDepth(GLclampd depth);
+extern HIDDEN void __indirect_glStencilMask(GLuint mask);
+extern HIDDEN void __indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+extern HIDDEN void __indirect_glDepthMask(GLboolean flag);
+extern HIDDEN void __indirect_glIndexMask(GLuint mask);
+extern HIDDEN void __indirect_glAccum(GLenum op, GLfloat value);
+extern HIDDEN void __indirect_glDisable(GLenum cap);
+extern HIDDEN void __indirect_glEnable(GLenum cap);
+extern HIDDEN void __indirect_glFinish(void);
+extern HIDDEN void __indirect_glFlush(void);
+extern HIDDEN void __indirect_glPopAttrib(void);
+extern HIDDEN void __indirect_glPushAttrib(GLbitfield mask);
+extern HIDDEN void __indirect_glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points);
+extern HIDDEN void __indirect_glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points);
+extern HIDDEN void __indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points);
+extern HIDDEN void __indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points);
+extern HIDDEN void __indirect_glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
+extern HIDDEN void __indirect_glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
+extern HIDDEN void __indirect_glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
+extern HIDDEN void __indirect_glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
+extern HIDDEN void __indirect_glEvalCoord1d(GLdouble u);
+extern HIDDEN void __indirect_glEvalCoord1dv(const GLdouble * u);
+extern HIDDEN void __indirect_glEvalCoord1f(GLfloat u);
+extern HIDDEN void __indirect_glEvalCoord1fv(const GLfloat * u);
+extern HIDDEN void __indirect_glEvalCoord2d(GLdouble u, GLdouble v);
+extern HIDDEN void __indirect_glEvalCoord2dv(const GLdouble * u);
+extern HIDDEN void __indirect_glEvalCoord2f(GLfloat u, GLfloat v);
+extern HIDDEN void __indirect_glEvalCoord2fv(const GLfloat * u);
+extern HIDDEN void __indirect_glEvalMesh1(GLenum mode, GLint i1, GLint i2);
+extern HIDDEN void __indirect_glEvalPoint1(GLint i);
+extern HIDDEN void __indirect_glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
+extern HIDDEN void __indirect_glEvalPoint2(GLint i, GLint j);
+extern HIDDEN void __indirect_glAlphaFunc(GLenum func, GLclampf ref);
+extern HIDDEN void __indirect_glBlendFunc(GLenum sfactor, GLenum dfactor);
+extern HIDDEN void __indirect_glLogicOp(GLenum opcode);
+extern HIDDEN void __indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask);
+extern HIDDEN void __indirect_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
+extern HIDDEN void __indirect_glDepthFunc(GLenum func);
+extern HIDDEN void __indirect_glPixelZoom(GLfloat xfactor, GLfloat yfactor);
+extern HIDDEN void __indirect_glPixelTransferf(GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glPixelTransferi(GLenum pname, GLint param);
+extern HIDDEN void __indirect_glPixelStoref(GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glPixelStorei(GLenum pname, GLint param);
+extern HIDDEN void __indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values);
+extern HIDDEN void __indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values);
+extern HIDDEN void __indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values);
+extern HIDDEN void __indirect_glReadBuffer(GLenum mode);
+extern HIDDEN void __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
+extern HIDDEN void __indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels);
+extern HIDDEN void __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels);
+extern HIDDEN void __indirect_glGetBooleanv(GLenum pname, GLboolean * params);
+extern HIDDEN void __indirect_glGetClipPlane(GLenum plane, GLdouble * equation);
+extern HIDDEN void __indirect_glGetDoublev(GLenum pname, GLdouble * params);
+extern HIDDEN GLenum __indirect_glGetError(void);
+extern HIDDEN void __indirect_glGetFloatv(GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetIntegerv(GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v);
+extern HIDDEN void __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v);
+extern HIDDEN void __indirect_glGetMapiv(GLenum target, GLenum query, GLint * v);
+extern HIDDEN void __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetPixelMapfv(GLenum map, GLfloat * values);
+extern HIDDEN void __indirect_glGetPixelMapuiv(GLenum map, GLuint * values);
+extern HIDDEN void __indirect_glGetPixelMapusv(GLenum map, GLushort * values);
+extern HIDDEN void __indirect_glGetPolygonStipple(GLubyte * mask);
+extern HIDDEN const GLubyte * __indirect_glGetString(GLenum name);
+extern HIDDEN void __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params);
+extern HIDDEN void __indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels);
+extern HIDDEN void __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint * params);
+extern HIDDEN GLboolean __indirect_glIsEnabled(GLenum cap);
+extern HIDDEN GLboolean __indirect_glIsList(GLuint list);
+extern HIDDEN void __indirect_glDepthRange(GLclampd zNear, GLclampd zFar);
+extern HIDDEN void __indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+extern HIDDEN void __indirect_glLoadIdentity(void);
+extern HIDDEN void __indirect_glLoadMatrixf(const GLfloat * m);
+extern HIDDEN void __indirect_glLoadMatrixd(const GLdouble * m);
+extern HIDDEN void __indirect_glMatrixMode(GLenum mode);
+extern HIDDEN void __indirect_glMultMatrixf(const GLfloat * m);
+extern HIDDEN void __indirect_glMultMatrixd(const GLdouble * m);
+extern HIDDEN void __indirect_glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+extern HIDDEN void __indirect_glPopMatrix(void);
+extern HIDDEN void __indirect_glPushMatrix(void);
+extern HIDDEN void __indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glScaled(GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glScalef(GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glArrayElement(GLint i);
+extern HIDDEN void __indirect_glBindTexture(GLenum target, GLuint texture);
+extern HIDDEN void __indirect_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glDisableClientState(GLenum array);
+extern HIDDEN void __indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count);
+extern HIDDEN void __indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices);
+extern HIDDEN void __indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glEnableClientState(GLenum array);
+extern HIDDEN void __indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glIndexub(GLubyte c);
+extern HIDDEN void __indirect_glIndexubv(const GLubyte * c);
+extern HIDDEN void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glNormalPointer(GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glPolygonOffset(GLfloat factor, GLfloat units);
+extern HIDDEN void __indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN GLboolean __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures, GLboolean * residences);
+GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolean * residences);
+extern HIDDEN void __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+extern HIDDEN void __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+extern HIDDEN void __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+extern HIDDEN void __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glDeleteTextures(GLsizei n, const GLuint * textures);
+GLAPI void GLAPIENTRY glDeleteTexturesEXT(GLsizei n, const GLuint * textures);
+extern HIDDEN void __indirect_glGenTextures(GLsizei n, GLuint * textures);
+GLAPI void GLAPIENTRY glGenTexturesEXT(GLsizei n, GLuint * textures);
+extern HIDDEN void __indirect_glGetPointerv(GLenum pname, GLvoid ** params);
+extern HIDDEN GLboolean __indirect_glIsTexture(GLuint texture);
+GLAPI GLboolean GLAPIENTRY glIsTextureEXT(GLuint texture);
+extern HIDDEN void __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures, const GLclampf * priorities);
+extern HIDDEN void __indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels);
+extern HIDDEN void __indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels);
+extern HIDDEN void __indirect_glPopClientAttrib(void);
+extern HIDDEN void __indirect_glPushClientAttrib(GLbitfield mask);
+extern HIDDEN void __indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+extern HIDDEN void __indirect_glBlendEquation(GLenum mode);
+extern HIDDEN void __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices);
+extern HIDDEN void __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table);
+extern HIDDEN void __indirect_glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glColorTableParameteriv(GLenum target, GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+extern HIDDEN void __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * table);
+GLAPI void GLAPIENTRY glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table);
+extern HIDDEN void __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat * params);
+GLAPI void GLAPIENTRY glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, GLint * params);
+GLAPI void GLAPIENTRY glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data);
+extern HIDDEN void __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+extern HIDDEN void __indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image);
+extern HIDDEN void __indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image);
+extern HIDDEN void __indirect_glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
+extern HIDDEN void __indirect_glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
+extern HIDDEN void __indirect_glConvolutionParameteriv(GLenum target, GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+extern HIDDEN void __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid * image);
+extern HIDDEN void gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, GLvoid * image);
+extern HIDDEN void __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span);
+extern HIDDEN void gl_dispatch_stub_359(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span);
+extern HIDDEN void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column);
+extern HIDDEN void __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
+extern HIDDEN void gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
+extern HIDDEN void __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
+extern HIDDEN void gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
+extern HIDDEN void __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+extern HIDDEN void __indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
+extern HIDDEN void __indirect_glResetHistogram(GLenum target);
+extern HIDDEN void __indirect_glResetMinmax(GLenum target);
+extern HIDDEN void __indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
+extern HIDDEN void __indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels);
+extern HIDDEN void __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glActiveTextureARB(GLenum texture);
+extern HIDDEN void __indirect_glClientActiveTextureARB(GLenum texture);
+extern HIDDEN void __indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s);
+extern HIDDEN void __indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble * v);
+extern HIDDEN void __indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s);
+extern HIDDEN void __indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat * v);
+extern HIDDEN void __indirect_glMultiTexCoord1iARB(GLenum target, GLint s);
+extern HIDDEN void __indirect_glMultiTexCoord1ivARB(GLenum target, const GLint * v);
+extern HIDDEN void __indirect_glMultiTexCoord1sARB(GLenum target, GLshort s);
+extern HIDDEN void __indirect_glMultiTexCoord1svARB(GLenum target, const GLshort * v);
+extern HIDDEN void __indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
+extern HIDDEN void __indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble * v);
+extern HIDDEN void __indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
+extern HIDDEN void __indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat * v);
+extern HIDDEN void __indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
+extern HIDDEN void __indirect_glMultiTexCoord2ivARB(GLenum target, const GLint * v);
+extern HIDDEN void __indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
+extern HIDDEN void __indirect_glMultiTexCoord2svARB(GLenum target, const GLshort * v);
+extern HIDDEN void __indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
+extern HIDDEN void __indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble * v);
+extern HIDDEN void __indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
+extern HIDDEN void __indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat * v);
+extern HIDDEN void __indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
+extern HIDDEN void __indirect_glMultiTexCoord3ivARB(GLenum target, const GLint * v);
+extern HIDDEN void __indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
+extern HIDDEN void __indirect_glMultiTexCoord3svARB(GLenum target, const GLshort * v);
+extern HIDDEN void __indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+extern HIDDEN void __indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble * v);
+extern HIDDEN void __indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+extern HIDDEN void __indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat * v);
+extern HIDDEN void __indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
+extern HIDDEN void __indirect_glMultiTexCoord4ivARB(GLenum target, const GLint * v);
+extern HIDDEN void __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+extern HIDDEN void __indirect_glMultiTexCoord4svARB(GLenum target, const GLshort * v);
+extern HIDDEN void __indirect_glLoadTransposeMatrixdARB(const GLdouble * m);
+extern HIDDEN void __indirect_glLoadTransposeMatrixfARB(const GLfloat * m);
+extern HIDDEN void __indirect_glMultTransposeMatrixdARB(const GLdouble * m);
+extern HIDDEN void __indirect_glMultTransposeMatrixfARB(const GLfloat * m);
+extern HIDDEN void __indirect_glSampleCoverageARB(GLclampf value, GLboolean invert);
+extern HIDDEN void __indirect_glCompressedTexImage1DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data);
+extern HIDDEN void __indirect_glCompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data);
+extern HIDDEN void __indirect_glCompressedTexImage3DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data);
+extern HIDDEN void __indirect_glCompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data);
+extern HIDDEN void __indirect_glCompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data);
+extern HIDDEN void __indirect_glCompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data);
+extern HIDDEN void __indirect_glGetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img);
+extern HIDDEN void __indirect_glDisableVertexAttribArrayARB(GLuint index);
+extern HIDDEN void __indirect_glEnableVertexAttribArrayARB(GLuint index);
+extern HIDDEN void __indirect_glGetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble * params);
+extern HIDDEN void __indirect_glGetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat * params);
+extern HIDDEN void __indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble * params);
+extern HIDDEN void __indirect_glGetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat * params);
+extern HIDDEN void __indirect_glGetProgramStringARB(GLenum target, GLenum pname, GLvoid * string);
+extern HIDDEN void __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble * params);
+extern HIDDEN void __indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern HIDDEN void __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
+extern HIDDEN void __indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern HIDDEN void __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
+extern HIDDEN void __indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern HIDDEN void __indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
+extern HIDDEN void __indirect_glProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern HIDDEN void __indirect_glProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
+extern HIDDEN void __indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid * string);
+extern HIDDEN void __indirect_glVertexAttrib1dARB(GLuint index, GLdouble x);
+extern HIDDEN void __indirect_glVertexAttrib1dvARB(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib1fARB(GLuint index, GLfloat x);
+extern HIDDEN void __indirect_glVertexAttrib1fvARB(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib1sARB(GLuint index, GLshort x);
+extern HIDDEN void __indirect_glVertexAttrib1svARB(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y);
+extern HIDDEN void __indirect_glVertexAttrib2dvARB(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y);
+extern HIDDEN void __indirect_glVertexAttrib2fvARB(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib2sARB(GLuint index, GLshort x, GLshort y);
+extern HIDDEN void __indirect_glVertexAttrib2svARB(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glVertexAttrib3dvARB(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glVertexAttrib3fvARB(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z);
+extern HIDDEN void __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v);
+extern HIDDEN void __indirect_glVertexAttrib4NivARB(GLuint index, const GLint * v);
+extern HIDDEN void __indirect_glVertexAttrib4NsvARB(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+extern HIDDEN void __indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v);
+extern HIDDEN void __indirect_glVertexAttrib4NuivARB(GLuint index, const GLuint * v);
+extern HIDDEN void __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v);
+extern HIDDEN void __indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte * v);
+extern HIDDEN void __indirect_glVertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern HIDDEN void __indirect_glVertexAttrib4dvARB(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern HIDDEN void __indirect_glVertexAttrib4fvARB(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib4ivARB(GLuint index, const GLint * v);
+extern HIDDEN void __indirect_glVertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+extern HIDDEN void __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v);
+extern HIDDEN void __indirect_glVertexAttrib4uivARB(GLuint index, const GLuint * v);
+extern HIDDEN void __indirect_glVertexAttrib4usvARB(GLuint index, const GLushort * v);
+extern HIDDEN void __indirect_glVertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glBeginQueryARB(GLenum target, GLuint id);
+extern HIDDEN void __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids);
+extern HIDDEN void __indirect_glEndQueryARB(GLenum target);
+extern HIDDEN void __indirect_glGenQueriesARB(GLsizei n, GLuint * ids);
+extern HIDDEN void __indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params);
+extern HIDDEN void __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN GLboolean __indirect_glIsQueryARB(GLuint id);
+extern HIDDEN void __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs);
+extern HIDDEN void __indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert);
+extern HIDDEN void __indirect_glSamplePatternSGIS(GLenum pattern);
+extern HIDDEN void __indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
+extern HIDDEN void __indirect_glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean * pointer);
+extern HIDDEN void __indirect_glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
+extern HIDDEN void __indirect_glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
+extern HIDDEN void __indirect_glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
+extern HIDDEN void __indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
+extern HIDDEN void __indirect_glPointParameterfEXT(GLenum pname, GLfloat param);
+extern HIDDEN void __indirect_glPointParameterfvEXT(GLenum pname, const GLfloat * params);
+extern HIDDEN void __indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue);
+extern HIDDEN void __indirect_glSecondaryColor3bvEXT(const GLbyte * v);
+extern HIDDEN void __indirect_glSecondaryColor3dEXT(GLdouble red, GLdouble green, GLdouble blue);
+extern HIDDEN void __indirect_glSecondaryColor3dvEXT(const GLdouble * v);
+extern HIDDEN void __indirect_glSecondaryColor3fEXT(GLfloat red, GLfloat green, GLfloat blue);
+extern HIDDEN void __indirect_glSecondaryColor3fvEXT(const GLfloat * v);
+extern HIDDEN void __indirect_glSecondaryColor3iEXT(GLint red, GLint green, GLint blue);
+extern HIDDEN void __indirect_glSecondaryColor3ivEXT(const GLint * v);
+extern HIDDEN void __indirect_glSecondaryColor3sEXT(GLshort red, GLshort green, GLshort blue);
+extern HIDDEN void __indirect_glSecondaryColor3svEXT(const GLshort * v);
+extern HIDDEN void __indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue);
+extern HIDDEN void __indirect_glSecondaryColor3ubvEXT(const GLubyte * v);
+extern HIDDEN void __indirect_glSecondaryColor3uiEXT(GLuint red, GLuint green, GLuint blue);
+extern HIDDEN void __indirect_glSecondaryColor3uivEXT(const GLuint * v);
+extern HIDDEN void __indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue);
+extern HIDDEN void __indirect_glSecondaryColor3usvEXT(const GLushort * v);
+extern HIDDEN void __indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
+extern HIDDEN void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount);
+extern HIDDEN void __indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glFogCoorddEXT(GLdouble coord);
+extern HIDDEN void __indirect_glFogCoorddvEXT(const GLdouble * coord);
+extern HIDDEN void __indirect_glFogCoordfEXT(GLfloat coord);
+extern HIDDEN void __indirect_glFogCoordfvEXT(const GLfloat * coord);
+extern HIDDEN void __indirect_glBlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+extern HIDDEN void __indirect_glWindowPos2dMESA(GLdouble x, GLdouble y);
+extern HIDDEN void __indirect_glWindowPos2dvMESA(const GLdouble * v);
+extern HIDDEN void __indirect_glWindowPos2fMESA(GLfloat x, GLfloat y);
+extern HIDDEN void __indirect_glWindowPos2fvMESA(const GLfloat * v);
+extern HIDDEN void __indirect_glWindowPos2iMESA(GLint x, GLint y);
+extern HIDDEN void __indirect_glWindowPos2ivMESA(const GLint * v);
+extern HIDDEN void __indirect_glWindowPos2sMESA(GLshort x, GLshort y);
+extern HIDDEN void __indirect_glWindowPos2svMESA(const GLshort * v);
+extern HIDDEN void __indirect_glWindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glWindowPos3dvMESA(const GLdouble * v);
+extern HIDDEN void __indirect_glWindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glWindowPos3fvMESA(const GLfloat * v);
+extern HIDDEN void __indirect_glWindowPos3iMESA(GLint x, GLint y, GLint z);
+extern HIDDEN void __indirect_glWindowPos3ivMESA(const GLint * v);
+extern HIDDEN void __indirect_glWindowPos3sMESA(GLshort x, GLshort y, GLshort z);
+extern HIDDEN void __indirect_glWindowPos3svMESA(const GLshort * v);
+extern HIDDEN GLboolean __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids, GLboolean * residences);
+extern HIDDEN void __indirect_glBindProgramNV(GLenum target, GLuint program);
+extern HIDDEN void __indirect_glDeleteProgramsNV(GLsizei n, const GLuint * programs);
+extern HIDDEN void __indirect_glExecuteProgramNV(GLenum target, GLuint id, const GLfloat * params);
+extern HIDDEN void __indirect_glGenProgramsNV(GLsizei n, GLuint * programs);
+extern HIDDEN void __indirect_glGetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble * params);
+extern HIDDEN void __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program);
+extern HIDDEN void __indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** pointer);
+extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params);
+extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params);
+extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);
+extern HIDDEN GLboolean __indirect_glIsProgramNV(GLuint program);
+extern HIDDEN void __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte * program);
+extern HIDDEN void __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble * params);
+extern HIDDEN void __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat * params);
+extern HIDDEN void __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids);
+extern HIDDEN void __indirect_glTrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform);
+extern HIDDEN void __indirect_glVertexAttrib1dNV(GLuint index, GLdouble x);
+extern HIDDEN void __indirect_glVertexAttrib1dvNV(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib1fNV(GLuint index, GLfloat x);
+extern HIDDEN void __indirect_glVertexAttrib1fvNV(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib1sNV(GLuint index, GLshort x);
+extern HIDDEN void __indirect_glVertexAttrib1svNV(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y);
+extern HIDDEN void __indirect_glVertexAttrib2dvNV(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y);
+extern HIDDEN void __indirect_glVertexAttrib2fvNV(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib2sNV(GLuint index, GLshort x, GLshort y);
+extern HIDDEN void __indirect_glVertexAttrib2svNV(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z);
+extern HIDDEN void __indirect_glVertexAttrib3dvNV(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+extern HIDDEN void __indirect_glVertexAttrib3fvNV(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z);
+extern HIDDEN void __indirect_glVertexAttrib3svNV(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern HIDDEN void __indirect_glVertexAttrib4dvNV(GLuint index, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern HIDDEN void __indirect_glVertexAttrib4fvNV(GLuint index, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+extern HIDDEN void __indirect_glVertexAttrib4svNV(GLuint index, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+extern HIDDEN void __indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v);
+extern HIDDEN void __indirect_glVertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
+extern HIDDEN void __indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v);
+extern HIDDEN void __indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v);
+extern HIDDEN void __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v);
+extern HIDDEN void __indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v);
+extern HIDDEN void __indirect_glPointParameteriNV(GLenum pname, GLint param);
+extern HIDDEN void __indirect_glPointParameterivNV(GLenum pname, const GLint * params);
+extern HIDDEN void __indirect_glActiveStencilFaceEXT(GLenum face);
+extern HIDDEN void __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params);
+extern HIDDEN void __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params);
+extern HIDDEN void __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern HIDDEN void __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v);
+extern HIDDEN void __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern HIDDEN void __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v);
+extern HIDDEN void __indirect_glBlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA);
+extern HIDDEN void __indirect_glBindFramebufferEXT(GLenum target, GLuint framebuffer);
+extern HIDDEN void __indirect_glBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
+extern HIDDEN GLenum __indirect_glCheckFramebufferStatusEXT(GLenum target);
+extern HIDDEN void __indirect_glDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers);
+extern HIDDEN void __indirect_glDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers);
+extern HIDDEN void __indirect_glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+extern HIDDEN void __indirect_glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+extern HIDDEN void __indirect_glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+extern HIDDEN void __indirect_glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+extern HIDDEN void __indirect_glGenFramebuffersEXT(GLsizei n, GLuint * framebuffers);
+extern HIDDEN void __indirect_glGenRenderbuffersEXT(GLsizei n, GLuint * renderbuffers);
+extern HIDDEN void __indirect_glGenerateMipmapEXT(GLenum target);
+extern HIDDEN void __indirect_glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN GLboolean __indirect_glIsFramebufferEXT(GLuint framebuffer);
+extern HIDDEN GLboolean __indirect_glIsRenderbufferEXT(GLuint renderbuffer);
+extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+extern HIDDEN void __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+
+#  undef HIDDEN
+#  undef FASTCALL
+#  undef NOINLINE
+
+#endif /* !defined( _INDIRECT_H_ ) */
diff --git a/src/glx/indirect_init.c b/src/glx/indirect_init.c
new file mode 100644 (file)
index 0000000..73ca993
--- /dev/null
@@ -0,0 +1,785 @@
+/* DO NOT EDIT - This file generated automatically by glX_proto_send.py (from Mesa) script */
+
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * (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
+ * 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
+ * PRECISION INSIGHT, 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 indirect_init.c
+ * Initialize indirect rendering dispatch table.
+ *
+ * \author Kevin E. Martin <kevin@precisioninsight.com>
+ * \author Brian Paul <brian@precisioninsight.com>
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#include "indirect_init.h"
+#include "indirect.h"
+#include "glapi.h"
+
+
+/**
+ * No-op function used to initialize functions that have no GLX protocol
+ * support.
+ */
+static int NoOp(void)
+{
+    return 0;
+}
+
+/**
+ * Create and initialize a new GL dispatch table.  The table is initialized
+ * with GLX indirect rendering protocol functions.
+ */
+__GLapi * __glXNewIndirectAPI( void )
+{
+    __GLapi *glAPI;
+    GLuint entries;
+
+    entries = _glapi_get_dispatch_table_size();
+    glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *));
+
+    /* first, set all entries to point to no-op functions */
+    {
+       int i;
+       void **dispatch = (void **) glAPI;
+       for (i = 0; i < entries; i++) {
+          dispatch[i] = (void *) NoOp;
+       }
+    }
+
+    /* now, initialize the entries we understand */
+
+    /* 1.0 */
+
+    glAPI->Accum = __indirect_glAccum;
+    glAPI->AlphaFunc = __indirect_glAlphaFunc;
+    glAPI->Begin = __indirect_glBegin;
+    glAPI->Bitmap = __indirect_glBitmap;
+    glAPI->BlendFunc = __indirect_glBlendFunc;
+    glAPI->CallList = __indirect_glCallList;
+    glAPI->CallLists = __indirect_glCallLists;
+    glAPI->Clear = __indirect_glClear;
+    glAPI->ClearAccum = __indirect_glClearAccum;
+    glAPI->ClearColor = __indirect_glClearColor;
+    glAPI->ClearDepth = __indirect_glClearDepth;
+    glAPI->ClearIndex = __indirect_glClearIndex;
+    glAPI->ClearStencil = __indirect_glClearStencil;
+    glAPI->ClipPlane = __indirect_glClipPlane;
+    glAPI->Color3b = __indirect_glColor3b;
+    glAPI->Color3bv = __indirect_glColor3bv;
+    glAPI->Color3d = __indirect_glColor3d;
+    glAPI->Color3dv = __indirect_glColor3dv;
+    glAPI->Color3f = __indirect_glColor3f;
+    glAPI->Color3fv = __indirect_glColor3fv;
+    glAPI->Color3i = __indirect_glColor3i;
+    glAPI->Color3iv = __indirect_glColor3iv;
+    glAPI->Color3s = __indirect_glColor3s;
+    glAPI->Color3sv = __indirect_glColor3sv;
+    glAPI->Color3ub = __indirect_glColor3ub;
+    glAPI->Color3ubv = __indirect_glColor3ubv;
+    glAPI->Color3ui = __indirect_glColor3ui;
+    glAPI->Color3uiv = __indirect_glColor3uiv;
+    glAPI->Color3us = __indirect_glColor3us;
+    glAPI->Color3usv = __indirect_glColor3usv;
+    glAPI->Color4b = __indirect_glColor4b;
+    glAPI->Color4bv = __indirect_glColor4bv;
+    glAPI->Color4d = __indirect_glColor4d;
+    glAPI->Color4dv = __indirect_glColor4dv;
+    glAPI->Color4f = __indirect_glColor4f;
+    glAPI->Color4fv = __indirect_glColor4fv;
+    glAPI->Color4i = __indirect_glColor4i;
+    glAPI->Color4iv = __indirect_glColor4iv;
+    glAPI->Color4s = __indirect_glColor4s;
+    glAPI->Color4sv = __indirect_glColor4sv;
+    glAPI->Color4ub = __indirect_glColor4ub;
+    glAPI->Color4ubv = __indirect_glColor4ubv;
+    glAPI->Color4ui = __indirect_glColor4ui;
+    glAPI->Color4uiv = __indirect_glColor4uiv;
+    glAPI->Color4us = __indirect_glColor4us;
+    glAPI->Color4usv = __indirect_glColor4usv;
+    glAPI->ColorMask = __indirect_glColorMask;
+    glAPI->ColorMaterial = __indirect_glColorMaterial;
+    glAPI->CopyPixels = __indirect_glCopyPixels;
+    glAPI->CullFace = __indirect_glCullFace;
+    glAPI->DeleteLists = __indirect_glDeleteLists;
+    glAPI->DepthFunc = __indirect_glDepthFunc;
+    glAPI->DepthMask = __indirect_glDepthMask;
+    glAPI->DepthRange = __indirect_glDepthRange;
+    glAPI->Disable = __indirect_glDisable;
+    glAPI->DrawBuffer = __indirect_glDrawBuffer;
+    glAPI->DrawPixels = __indirect_glDrawPixels;
+    glAPI->EdgeFlag = __indirect_glEdgeFlag;
+    glAPI->EdgeFlagv = __indirect_glEdgeFlagv;
+    glAPI->Enable = __indirect_glEnable;
+    glAPI->End = __indirect_glEnd;
+    glAPI->EndList = __indirect_glEndList;
+    glAPI->EvalCoord1d = __indirect_glEvalCoord1d;
+    glAPI->EvalCoord1dv = __indirect_glEvalCoord1dv;
+    glAPI->EvalCoord1f = __indirect_glEvalCoord1f;
+    glAPI->EvalCoord1fv = __indirect_glEvalCoord1fv;
+    glAPI->EvalCoord2d = __indirect_glEvalCoord2d;
+    glAPI->EvalCoord2dv = __indirect_glEvalCoord2dv;
+    glAPI->EvalCoord2f = __indirect_glEvalCoord2f;
+    glAPI->EvalCoord2fv = __indirect_glEvalCoord2fv;
+    glAPI->EvalMesh1 = __indirect_glEvalMesh1;
+    glAPI->EvalMesh2 = __indirect_glEvalMesh2;
+    glAPI->EvalPoint1 = __indirect_glEvalPoint1;
+    glAPI->EvalPoint2 = __indirect_glEvalPoint2;
+    glAPI->FeedbackBuffer = __indirect_glFeedbackBuffer;
+    glAPI->Finish = __indirect_glFinish;
+    glAPI->Flush = __indirect_glFlush;
+    glAPI->Fogf = __indirect_glFogf;
+    glAPI->Fogfv = __indirect_glFogfv;
+    glAPI->Fogi = __indirect_glFogi;
+    glAPI->Fogiv = __indirect_glFogiv;
+    glAPI->FrontFace = __indirect_glFrontFace;
+    glAPI->Frustum = __indirect_glFrustum;
+    glAPI->GenLists = __indirect_glGenLists;
+    glAPI->GetBooleanv = __indirect_glGetBooleanv;
+    glAPI->GetClipPlane = __indirect_glGetClipPlane;
+    glAPI->GetDoublev = __indirect_glGetDoublev;
+    glAPI->GetError = __indirect_glGetError;
+    glAPI->GetFloatv = __indirect_glGetFloatv;
+    glAPI->GetIntegerv = __indirect_glGetIntegerv;
+    glAPI->GetLightfv = __indirect_glGetLightfv;
+    glAPI->GetLightiv = __indirect_glGetLightiv;
+    glAPI->GetMapdv = __indirect_glGetMapdv;
+    glAPI->GetMapfv = __indirect_glGetMapfv;
+    glAPI->GetMapiv = __indirect_glGetMapiv;
+    glAPI->GetMaterialfv = __indirect_glGetMaterialfv;
+    glAPI->GetMaterialiv = __indirect_glGetMaterialiv;
+    glAPI->GetPixelMapfv = __indirect_glGetPixelMapfv;
+    glAPI->GetPixelMapuiv = __indirect_glGetPixelMapuiv;
+    glAPI->GetPixelMapusv = __indirect_glGetPixelMapusv;
+    glAPI->GetPolygonStipple = __indirect_glGetPolygonStipple;
+    glAPI->GetString = __indirect_glGetString;
+    glAPI->GetTexEnvfv = __indirect_glGetTexEnvfv;
+    glAPI->GetTexEnviv = __indirect_glGetTexEnviv;
+    glAPI->GetTexGendv = __indirect_glGetTexGendv;
+    glAPI->GetTexGenfv = __indirect_glGetTexGenfv;
+    glAPI->GetTexGeniv = __indirect_glGetTexGeniv;
+    glAPI->GetTexImage = __indirect_glGetTexImage;
+    glAPI->GetTexLevelParameterfv = __indirect_glGetTexLevelParameterfv;
+    glAPI->GetTexLevelParameteriv = __indirect_glGetTexLevelParameteriv;
+    glAPI->GetTexParameterfv = __indirect_glGetTexParameterfv;
+    glAPI->GetTexParameteriv = __indirect_glGetTexParameteriv;
+    glAPI->Hint = __indirect_glHint;
+    glAPI->IndexMask = __indirect_glIndexMask;
+    glAPI->Indexd = __indirect_glIndexd;
+    glAPI->Indexdv = __indirect_glIndexdv;
+    glAPI->Indexf = __indirect_glIndexf;
+    glAPI->Indexfv = __indirect_glIndexfv;
+    glAPI->Indexi = __indirect_glIndexi;
+    glAPI->Indexiv = __indirect_glIndexiv;
+    glAPI->Indexs = __indirect_glIndexs;
+    glAPI->Indexsv = __indirect_glIndexsv;
+    glAPI->InitNames = __indirect_glInitNames;
+    glAPI->IsEnabled = __indirect_glIsEnabled;
+    glAPI->IsList = __indirect_glIsList;
+    glAPI->LightModelf = __indirect_glLightModelf;
+    glAPI->LightModelfv = __indirect_glLightModelfv;
+    glAPI->LightModeli = __indirect_glLightModeli;
+    glAPI->LightModeliv = __indirect_glLightModeliv;
+    glAPI->Lightf = __indirect_glLightf;
+    glAPI->Lightfv = __indirect_glLightfv;
+    glAPI->Lighti = __indirect_glLighti;
+    glAPI->Lightiv = __indirect_glLightiv;
+    glAPI->LineStipple = __indirect_glLineStipple;
+    glAPI->LineWidth = __indirect_glLineWidth;
+    glAPI->ListBase = __indirect_glListBase;
+    glAPI->LoadIdentity = __indirect_glLoadIdentity;
+    glAPI->LoadMatrixd = __indirect_glLoadMatrixd;
+    glAPI->LoadMatrixf = __indirect_glLoadMatrixf;
+    glAPI->LoadName = __indirect_glLoadName;
+    glAPI->LogicOp = __indirect_glLogicOp;
+    glAPI->Map1d = __indirect_glMap1d;
+    glAPI->Map1f = __indirect_glMap1f;
+    glAPI->Map2d = __indirect_glMap2d;
+    glAPI->Map2f = __indirect_glMap2f;
+    glAPI->MapGrid1d = __indirect_glMapGrid1d;
+    glAPI->MapGrid1f = __indirect_glMapGrid1f;
+    glAPI->MapGrid2d = __indirect_glMapGrid2d;
+    glAPI->MapGrid2f = __indirect_glMapGrid2f;
+    glAPI->Materialf = __indirect_glMaterialf;
+    glAPI->Materialfv = __indirect_glMaterialfv;
+    glAPI->Materiali = __indirect_glMateriali;
+    glAPI->Materialiv = __indirect_glMaterialiv;
+    glAPI->MatrixMode = __indirect_glMatrixMode;
+    glAPI->MultMatrixd = __indirect_glMultMatrixd;
+    glAPI->MultMatrixf = __indirect_glMultMatrixf;
+    glAPI->NewList = __indirect_glNewList;
+    glAPI->Normal3b = __indirect_glNormal3b;
+    glAPI->Normal3bv = __indirect_glNormal3bv;
+    glAPI->Normal3d = __indirect_glNormal3d;
+    glAPI->Normal3dv = __indirect_glNormal3dv;
+    glAPI->Normal3f = __indirect_glNormal3f;
+    glAPI->Normal3fv = __indirect_glNormal3fv;
+    glAPI->Normal3i = __indirect_glNormal3i;
+    glAPI->Normal3iv = __indirect_glNormal3iv;
+    glAPI->Normal3s = __indirect_glNormal3s;
+    glAPI->Normal3sv = __indirect_glNormal3sv;
+    glAPI->Ortho = __indirect_glOrtho;
+    glAPI->PassThrough = __indirect_glPassThrough;
+    glAPI->PixelMapfv = __indirect_glPixelMapfv;
+    glAPI->PixelMapuiv = __indirect_glPixelMapuiv;
+    glAPI->PixelMapusv = __indirect_glPixelMapusv;
+    glAPI->PixelStoref = __indirect_glPixelStoref;
+    glAPI->PixelStorei = __indirect_glPixelStorei;
+    glAPI->PixelTransferf = __indirect_glPixelTransferf;
+    glAPI->PixelTransferi = __indirect_glPixelTransferi;
+    glAPI->PixelZoom = __indirect_glPixelZoom;
+    glAPI->PointSize = __indirect_glPointSize;
+    glAPI->PolygonMode = __indirect_glPolygonMode;
+    glAPI->PolygonStipple = __indirect_glPolygonStipple;
+    glAPI->PopAttrib = __indirect_glPopAttrib;
+    glAPI->PopMatrix = __indirect_glPopMatrix;
+    glAPI->PopName = __indirect_glPopName;
+    glAPI->PushAttrib = __indirect_glPushAttrib;
+    glAPI->PushMatrix = __indirect_glPushMatrix;
+    glAPI->PushName = __indirect_glPushName;
+    glAPI->RasterPos2d = __indirect_glRasterPos2d;
+    glAPI->RasterPos2dv = __indirect_glRasterPos2dv;
+    glAPI->RasterPos2f = __indirect_glRasterPos2f;
+    glAPI->RasterPos2fv = __indirect_glRasterPos2fv;
+    glAPI->RasterPos2i = __indirect_glRasterPos2i;
+    glAPI->RasterPos2iv = __indirect_glRasterPos2iv;
+    glAPI->RasterPos2s = __indirect_glRasterPos2s;
+    glAPI->RasterPos2sv = __indirect_glRasterPos2sv;
+    glAPI->RasterPos3d = __indirect_glRasterPos3d;
+    glAPI->RasterPos3dv = __indirect_glRasterPos3dv;
+    glAPI->RasterPos3f = __indirect_glRasterPos3f;
+    glAPI->RasterPos3fv = __indirect_glRasterPos3fv;
+    glAPI->RasterPos3i = __indirect_glRasterPos3i;
+    glAPI->RasterPos3iv = __indirect_glRasterPos3iv;
+    glAPI->RasterPos3s = __indirect_glRasterPos3s;
+    glAPI->RasterPos3sv = __indirect_glRasterPos3sv;
+    glAPI->RasterPos4d = __indirect_glRasterPos4d;
+    glAPI->RasterPos4dv = __indirect_glRasterPos4dv;
+    glAPI->RasterPos4f = __indirect_glRasterPos4f;
+    glAPI->RasterPos4fv = __indirect_glRasterPos4fv;
+    glAPI->RasterPos4i = __indirect_glRasterPos4i;
+    glAPI->RasterPos4iv = __indirect_glRasterPos4iv;
+    glAPI->RasterPos4s = __indirect_glRasterPos4s;
+    glAPI->RasterPos4sv = __indirect_glRasterPos4sv;
+    glAPI->ReadBuffer = __indirect_glReadBuffer;
+    glAPI->ReadPixels = __indirect_glReadPixels;
+    glAPI->Rectd = __indirect_glRectd;
+    glAPI->Rectdv = __indirect_glRectdv;
+    glAPI->Rectf = __indirect_glRectf;
+    glAPI->Rectfv = __indirect_glRectfv;
+    glAPI->Recti = __indirect_glRecti;
+    glAPI->Rectiv = __indirect_glRectiv;
+    glAPI->Rects = __indirect_glRects;
+    glAPI->Rectsv = __indirect_glRectsv;
+    glAPI->RenderMode = __indirect_glRenderMode;
+    glAPI->Rotated = __indirect_glRotated;
+    glAPI->Rotatef = __indirect_glRotatef;
+    glAPI->Scaled = __indirect_glScaled;
+    glAPI->Scalef = __indirect_glScalef;
+    glAPI->Scissor = __indirect_glScissor;
+    glAPI->SelectBuffer = __indirect_glSelectBuffer;
+    glAPI->ShadeModel = __indirect_glShadeModel;
+    glAPI->StencilFunc = __indirect_glStencilFunc;
+    glAPI->StencilMask = __indirect_glStencilMask;
+    glAPI->StencilOp = __indirect_glStencilOp;
+    glAPI->TexCoord1d = __indirect_glTexCoord1d;
+    glAPI->TexCoord1dv = __indirect_glTexCoord1dv;
+    glAPI->TexCoord1f = __indirect_glTexCoord1f;
+    glAPI->TexCoord1fv = __indirect_glTexCoord1fv;
+    glAPI->TexCoord1i = __indirect_glTexCoord1i;
+    glAPI->TexCoord1iv = __indirect_glTexCoord1iv;
+    glAPI->TexCoord1s = __indirect_glTexCoord1s;
+    glAPI->TexCoord1sv = __indirect_glTexCoord1sv;
+    glAPI->TexCoord2d = __indirect_glTexCoord2d;
+    glAPI->TexCoord2dv = __indirect_glTexCoord2dv;
+    glAPI->TexCoord2f = __indirect_glTexCoord2f;
+    glAPI->TexCoord2fv = __indirect_glTexCoord2fv;
+    glAPI->TexCoord2i = __indirect_glTexCoord2i;
+    glAPI->TexCoord2iv = __indirect_glTexCoord2iv;
+    glAPI->TexCoord2s = __indirect_glTexCoord2s;
+    glAPI->TexCoord2sv = __indirect_glTexCoord2sv;
+    glAPI->TexCoord3d = __indirect_glTexCoord3d;
+    glAPI->TexCoord3dv = __indirect_glTexCoord3dv;
+    glAPI->TexCoord3f = __indirect_glTexCoord3f;
+    glAPI->TexCoord3fv = __indirect_glTexCoord3fv;
+    glAPI->TexCoord3i = __indirect_glTexCoord3i;
+    glAPI->TexCoord3iv = __indirect_glTexCoord3iv;
+    glAPI->TexCoord3s = __indirect_glTexCoord3s;
+    glAPI->TexCoord3sv = __indirect_glTexCoord3sv;
+    glAPI->TexCoord4d = __indirect_glTexCoord4d;
+    glAPI->TexCoord4dv = __indirect_glTexCoord4dv;
+    glAPI->TexCoord4f = __indirect_glTexCoord4f;
+    glAPI->TexCoord4fv = __indirect_glTexCoord4fv;
+    glAPI->TexCoord4i = __indirect_glTexCoord4i;
+    glAPI->TexCoord4iv = __indirect_glTexCoord4iv;
+    glAPI->TexCoord4s = __indirect_glTexCoord4s;
+    glAPI->TexCoord4sv = __indirect_glTexCoord4sv;
+    glAPI->TexEnvf = __indirect_glTexEnvf;
+    glAPI->TexEnvfv = __indirect_glTexEnvfv;
+    glAPI->TexEnvi = __indirect_glTexEnvi;
+    glAPI->TexEnviv = __indirect_glTexEnviv;
+    glAPI->TexGend = __indirect_glTexGend;
+    glAPI->TexGendv = __indirect_glTexGendv;
+    glAPI->TexGenf = __indirect_glTexGenf;
+    glAPI->TexGenfv = __indirect_glTexGenfv;
+    glAPI->TexGeni = __indirect_glTexGeni;
+    glAPI->TexGeniv = __indirect_glTexGeniv;
+    glAPI->TexImage1D = __indirect_glTexImage1D;
+    glAPI->TexImage2D = __indirect_glTexImage2D;
+    glAPI->TexParameterf = __indirect_glTexParameterf;
+    glAPI->TexParameterfv = __indirect_glTexParameterfv;
+    glAPI->TexParameteri = __indirect_glTexParameteri;
+    glAPI->TexParameteriv = __indirect_glTexParameteriv;
+    glAPI->Translated = __indirect_glTranslated;
+    glAPI->Translatef = __indirect_glTranslatef;
+    glAPI->Vertex2d = __indirect_glVertex2d;
+    glAPI->Vertex2dv = __indirect_glVertex2dv;
+    glAPI->Vertex2f = __indirect_glVertex2f;
+    glAPI->Vertex2fv = __indirect_glVertex2fv;
+    glAPI->Vertex2i = __indirect_glVertex2i;
+    glAPI->Vertex2iv = __indirect_glVertex2iv;
+    glAPI->Vertex2s = __indirect_glVertex2s;
+    glAPI->Vertex2sv = __indirect_glVertex2sv;
+    glAPI->Vertex3d = __indirect_glVertex3d;
+    glAPI->Vertex3dv = __indirect_glVertex3dv;
+    glAPI->Vertex3f = __indirect_glVertex3f;
+    glAPI->Vertex3fv = __indirect_glVertex3fv;
+    glAPI->Vertex3i = __indirect_glVertex3i;
+    glAPI->Vertex3iv = __indirect_glVertex3iv;
+    glAPI->Vertex3s = __indirect_glVertex3s;
+    glAPI->Vertex3sv = __indirect_glVertex3sv;
+    glAPI->Vertex4d = __indirect_glVertex4d;
+    glAPI->Vertex4dv = __indirect_glVertex4dv;
+    glAPI->Vertex4f = __indirect_glVertex4f;
+    glAPI->Vertex4fv = __indirect_glVertex4fv;
+    glAPI->Vertex4i = __indirect_glVertex4i;
+    glAPI->Vertex4iv = __indirect_glVertex4iv;
+    glAPI->Vertex4s = __indirect_glVertex4s;
+    glAPI->Vertex4sv = __indirect_glVertex4sv;
+    glAPI->Viewport = __indirect_glViewport;
+
+    /* 1.1 */
+
+    glAPI->AreTexturesResident = __indirect_glAreTexturesResident;
+    glAPI->ArrayElement = __indirect_glArrayElement;
+    glAPI->BindTexture = __indirect_glBindTexture;
+    glAPI->ColorPointer = __indirect_glColorPointer;
+    glAPI->CopyTexImage1D = __indirect_glCopyTexImage1D;
+    glAPI->CopyTexImage2D = __indirect_glCopyTexImage2D;
+    glAPI->CopyTexSubImage1D = __indirect_glCopyTexSubImage1D;
+    glAPI->CopyTexSubImage2D = __indirect_glCopyTexSubImage2D;
+    glAPI->DeleteTextures = __indirect_glDeleteTextures;
+    glAPI->DisableClientState = __indirect_glDisableClientState;
+    glAPI->DrawArrays = __indirect_glDrawArrays;
+    glAPI->DrawElements = __indirect_glDrawElements;
+    glAPI->EdgeFlagPointer = __indirect_glEdgeFlagPointer;
+    glAPI->EnableClientState = __indirect_glEnableClientState;
+    glAPI->GenTextures = __indirect_glGenTextures;
+    glAPI->GetPointerv = __indirect_glGetPointerv;
+    glAPI->IndexPointer = __indirect_glIndexPointer;
+    glAPI->Indexub = __indirect_glIndexub;
+    glAPI->Indexubv = __indirect_glIndexubv;
+    glAPI->InterleavedArrays = __indirect_glInterleavedArrays;
+    glAPI->IsTexture = __indirect_glIsTexture;
+    glAPI->NormalPointer = __indirect_glNormalPointer;
+    glAPI->PolygonOffset = __indirect_glPolygonOffset;
+    glAPI->PopClientAttrib = __indirect_glPopClientAttrib;
+    glAPI->PrioritizeTextures = __indirect_glPrioritizeTextures;
+    glAPI->PushClientAttrib = __indirect_glPushClientAttrib;
+    glAPI->TexCoordPointer = __indirect_glTexCoordPointer;
+    glAPI->TexSubImage1D = __indirect_glTexSubImage1D;
+    glAPI->TexSubImage2D = __indirect_glTexSubImage2D;
+    glAPI->VertexPointer = __indirect_glVertexPointer;
+
+    /* 1.2 */
+
+    glAPI->BlendColor = __indirect_glBlendColor;
+    glAPI->BlendEquation = __indirect_glBlendEquation;
+    glAPI->ColorSubTable = __indirect_glColorSubTable;
+    glAPI->ColorTable = __indirect_glColorTable;
+    glAPI->ColorTableParameterfv = __indirect_glColorTableParameterfv;
+    glAPI->ColorTableParameteriv = __indirect_glColorTableParameteriv;
+    glAPI->ConvolutionFilter1D = __indirect_glConvolutionFilter1D;
+    glAPI->ConvolutionFilter2D = __indirect_glConvolutionFilter2D;
+    glAPI->ConvolutionParameterf = __indirect_glConvolutionParameterf;
+    glAPI->ConvolutionParameterfv = __indirect_glConvolutionParameterfv;
+    glAPI->ConvolutionParameteri = __indirect_glConvolutionParameteri;
+    glAPI->ConvolutionParameteriv = __indirect_glConvolutionParameteriv;
+    glAPI->CopyColorSubTable = __indirect_glCopyColorSubTable;
+    glAPI->CopyColorTable = __indirect_glCopyColorTable;
+    glAPI->CopyConvolutionFilter1D = __indirect_glCopyConvolutionFilter1D;
+    glAPI->CopyConvolutionFilter2D = __indirect_glCopyConvolutionFilter2D;
+    glAPI->CopyTexSubImage3D = __indirect_glCopyTexSubImage3D;
+    glAPI->DrawRangeElements = __indirect_glDrawRangeElements;
+    glAPI->GetColorTable = __indirect_glGetColorTable;
+    glAPI->GetColorTableParameterfv = __indirect_glGetColorTableParameterfv;
+    glAPI->GetColorTableParameteriv = __indirect_glGetColorTableParameteriv;
+    glAPI->GetConvolutionFilter = __indirect_glGetConvolutionFilter;
+    glAPI->GetConvolutionParameterfv = __indirect_glGetConvolutionParameterfv;
+    glAPI->GetConvolutionParameteriv = __indirect_glGetConvolutionParameteriv;
+    glAPI->GetHistogram = __indirect_glGetHistogram;
+    glAPI->GetHistogramParameterfv = __indirect_glGetHistogramParameterfv;
+    glAPI->GetHistogramParameteriv = __indirect_glGetHistogramParameteriv;
+    glAPI->GetMinmax = __indirect_glGetMinmax;
+    glAPI->GetMinmaxParameterfv = __indirect_glGetMinmaxParameterfv;
+    glAPI->GetMinmaxParameteriv = __indirect_glGetMinmaxParameteriv;
+    glAPI->GetSeparableFilter = __indirect_glGetSeparableFilter;
+    glAPI->Histogram = __indirect_glHistogram;
+    glAPI->Minmax = __indirect_glMinmax;
+    glAPI->ResetHistogram = __indirect_glResetHistogram;
+    glAPI->ResetMinmax = __indirect_glResetMinmax;
+    glAPI->SeparableFilter2D = __indirect_glSeparableFilter2D;
+    glAPI->TexImage3D = __indirect_glTexImage3D;
+    glAPI->TexSubImage3D = __indirect_glTexSubImage3D;
+
+    /*   1. GL_ARB_multitexture */
+
+    glAPI->ActiveTextureARB = __indirect_glActiveTextureARB;
+    glAPI->ClientActiveTextureARB = __indirect_glClientActiveTextureARB;
+    glAPI->MultiTexCoord1dARB = __indirect_glMultiTexCoord1dARB;
+    glAPI->MultiTexCoord1dvARB = __indirect_glMultiTexCoord1dvARB;
+    glAPI->MultiTexCoord1fARB = __indirect_glMultiTexCoord1fARB;
+    glAPI->MultiTexCoord1fvARB = __indirect_glMultiTexCoord1fvARB;
+    glAPI->MultiTexCoord1iARB = __indirect_glMultiTexCoord1iARB;
+    glAPI->MultiTexCoord1ivARB = __indirect_glMultiTexCoord1ivARB;
+    glAPI->MultiTexCoord1sARB = __indirect_glMultiTexCoord1sARB;
+    glAPI->MultiTexCoord1svARB = __indirect_glMultiTexCoord1svARB;
+    glAPI->MultiTexCoord2dARB = __indirect_glMultiTexCoord2dARB;
+    glAPI->MultiTexCoord2dvARB = __indirect_glMultiTexCoord2dvARB;
+    glAPI->MultiTexCoord2fARB = __indirect_glMultiTexCoord2fARB;
+    glAPI->MultiTexCoord2fvARB = __indirect_glMultiTexCoord2fvARB;
+    glAPI->MultiTexCoord2iARB = __indirect_glMultiTexCoord2iARB;
+    glAPI->MultiTexCoord2ivARB = __indirect_glMultiTexCoord2ivARB;
+    glAPI->MultiTexCoord2sARB = __indirect_glMultiTexCoord2sARB;
+    glAPI->MultiTexCoord2svARB = __indirect_glMultiTexCoord2svARB;
+    glAPI->MultiTexCoord3dARB = __indirect_glMultiTexCoord3dARB;
+    glAPI->MultiTexCoord3dvARB = __indirect_glMultiTexCoord3dvARB;
+    glAPI->MultiTexCoord3fARB = __indirect_glMultiTexCoord3fARB;
+    glAPI->MultiTexCoord3fvARB = __indirect_glMultiTexCoord3fvARB;
+    glAPI->MultiTexCoord3iARB = __indirect_glMultiTexCoord3iARB;
+    glAPI->MultiTexCoord3ivARB = __indirect_glMultiTexCoord3ivARB;
+    glAPI->MultiTexCoord3sARB = __indirect_glMultiTexCoord3sARB;
+    glAPI->MultiTexCoord3svARB = __indirect_glMultiTexCoord3svARB;
+    glAPI->MultiTexCoord4dARB = __indirect_glMultiTexCoord4dARB;
+    glAPI->MultiTexCoord4dvARB = __indirect_glMultiTexCoord4dvARB;
+    glAPI->MultiTexCoord4fARB = __indirect_glMultiTexCoord4fARB;
+    glAPI->MultiTexCoord4fvARB = __indirect_glMultiTexCoord4fvARB;
+    glAPI->MultiTexCoord4iARB = __indirect_glMultiTexCoord4iARB;
+    glAPI->MultiTexCoord4ivARB = __indirect_glMultiTexCoord4ivARB;
+    glAPI->MultiTexCoord4sARB = __indirect_glMultiTexCoord4sARB;
+    glAPI->MultiTexCoord4svARB = __indirect_glMultiTexCoord4svARB;
+
+    /*   3. GL_ARB_transpose_matrix */
+
+    glAPI->LoadTransposeMatrixdARB = __indirect_glLoadTransposeMatrixdARB;
+    glAPI->LoadTransposeMatrixfARB = __indirect_glLoadTransposeMatrixfARB;
+    glAPI->MultTransposeMatrixdARB = __indirect_glMultTransposeMatrixdARB;
+    glAPI->MultTransposeMatrixfARB = __indirect_glMultTransposeMatrixfARB;
+
+    /*   5. GL_ARB_multisample */
+
+    glAPI->SampleCoverageARB = __indirect_glSampleCoverageARB;
+
+    /*  12. GL_ARB_texture_compression */
+
+    glAPI->CompressedTexImage1DARB = __indirect_glCompressedTexImage1DARB;
+    glAPI->CompressedTexImage2DARB = __indirect_glCompressedTexImage2DARB;
+    glAPI->CompressedTexImage3DARB = __indirect_glCompressedTexImage3DARB;
+    glAPI->CompressedTexSubImage1DARB = __indirect_glCompressedTexSubImage1DARB;
+    glAPI->CompressedTexSubImage2DARB = __indirect_glCompressedTexSubImage2DARB;
+    glAPI->CompressedTexSubImage3DARB = __indirect_glCompressedTexSubImage3DARB;
+    glAPI->GetCompressedTexImageARB = __indirect_glGetCompressedTexImageARB;
+
+    /*  26. GL_ARB_vertex_program */
+
+    glAPI->DisableVertexAttribArrayARB = __indirect_glDisableVertexAttribArrayARB;
+    glAPI->EnableVertexAttribArrayARB = __indirect_glEnableVertexAttribArrayARB;
+    glAPI->GetProgramEnvParameterdvARB = __indirect_glGetProgramEnvParameterdvARB;
+    glAPI->GetProgramEnvParameterfvARB = __indirect_glGetProgramEnvParameterfvARB;
+    glAPI->GetProgramLocalParameterdvARB = __indirect_glGetProgramLocalParameterdvARB;
+    glAPI->GetProgramLocalParameterfvARB = __indirect_glGetProgramLocalParameterfvARB;
+    glAPI->GetProgramStringARB = __indirect_glGetProgramStringARB;
+    glAPI->GetProgramivARB = __indirect_glGetProgramivARB;
+    glAPI->GetVertexAttribdvARB = __indirect_glGetVertexAttribdvARB;
+    glAPI->GetVertexAttribfvARB = __indirect_glGetVertexAttribfvARB;
+    glAPI->GetVertexAttribivARB = __indirect_glGetVertexAttribivARB;
+    glAPI->ProgramEnvParameter4dARB = __indirect_glProgramEnvParameter4dARB;
+    glAPI->ProgramEnvParameter4dvARB = __indirect_glProgramEnvParameter4dvARB;
+    glAPI->ProgramEnvParameter4fARB = __indirect_glProgramEnvParameter4fARB;
+    glAPI->ProgramEnvParameter4fvARB = __indirect_glProgramEnvParameter4fvARB;
+    glAPI->ProgramLocalParameter4dARB = __indirect_glProgramLocalParameter4dARB;
+    glAPI->ProgramLocalParameter4dvARB = __indirect_glProgramLocalParameter4dvARB;
+    glAPI->ProgramLocalParameter4fARB = __indirect_glProgramLocalParameter4fARB;
+    glAPI->ProgramLocalParameter4fvARB = __indirect_glProgramLocalParameter4fvARB;
+    glAPI->ProgramStringARB = __indirect_glProgramStringARB;
+    glAPI->VertexAttrib1dARB = __indirect_glVertexAttrib1dARB;
+    glAPI->VertexAttrib1dvARB = __indirect_glVertexAttrib1dvARB;
+    glAPI->VertexAttrib1fARB = __indirect_glVertexAttrib1fARB;
+    glAPI->VertexAttrib1fvARB = __indirect_glVertexAttrib1fvARB;
+    glAPI->VertexAttrib1sARB = __indirect_glVertexAttrib1sARB;
+    glAPI->VertexAttrib1svARB = __indirect_glVertexAttrib1svARB;
+    glAPI->VertexAttrib2dARB = __indirect_glVertexAttrib2dARB;
+    glAPI->VertexAttrib2dvARB = __indirect_glVertexAttrib2dvARB;
+    glAPI->VertexAttrib2fARB = __indirect_glVertexAttrib2fARB;
+    glAPI->VertexAttrib2fvARB = __indirect_glVertexAttrib2fvARB;
+    glAPI->VertexAttrib2sARB = __indirect_glVertexAttrib2sARB;
+    glAPI->VertexAttrib2svARB = __indirect_glVertexAttrib2svARB;
+    glAPI->VertexAttrib3dARB = __indirect_glVertexAttrib3dARB;
+    glAPI->VertexAttrib3dvARB = __indirect_glVertexAttrib3dvARB;
+    glAPI->VertexAttrib3fARB = __indirect_glVertexAttrib3fARB;
+    glAPI->VertexAttrib3fvARB = __indirect_glVertexAttrib3fvARB;
+    glAPI->VertexAttrib3sARB = __indirect_glVertexAttrib3sARB;
+    glAPI->VertexAttrib3svARB = __indirect_glVertexAttrib3svARB;
+    glAPI->VertexAttrib4NbvARB = __indirect_glVertexAttrib4NbvARB;
+    glAPI->VertexAttrib4NivARB = __indirect_glVertexAttrib4NivARB;
+    glAPI->VertexAttrib4NsvARB = __indirect_glVertexAttrib4NsvARB;
+    glAPI->VertexAttrib4NubARB = __indirect_glVertexAttrib4NubARB;
+    glAPI->VertexAttrib4NubvARB = __indirect_glVertexAttrib4NubvARB;
+    glAPI->VertexAttrib4NuivARB = __indirect_glVertexAttrib4NuivARB;
+    glAPI->VertexAttrib4NusvARB = __indirect_glVertexAttrib4NusvARB;
+    glAPI->VertexAttrib4bvARB = __indirect_glVertexAttrib4bvARB;
+    glAPI->VertexAttrib4dARB = __indirect_glVertexAttrib4dARB;
+    glAPI->VertexAttrib4dvARB = __indirect_glVertexAttrib4dvARB;
+    glAPI->VertexAttrib4fARB = __indirect_glVertexAttrib4fARB;
+    glAPI->VertexAttrib4fvARB = __indirect_glVertexAttrib4fvARB;
+    glAPI->VertexAttrib4ivARB = __indirect_glVertexAttrib4ivARB;
+    glAPI->VertexAttrib4sARB = __indirect_glVertexAttrib4sARB;
+    glAPI->VertexAttrib4svARB = __indirect_glVertexAttrib4svARB;
+    glAPI->VertexAttrib4ubvARB = __indirect_glVertexAttrib4ubvARB;
+    glAPI->VertexAttrib4uivARB = __indirect_glVertexAttrib4uivARB;
+    glAPI->VertexAttrib4usvARB = __indirect_glVertexAttrib4usvARB;
+    glAPI->VertexAttribPointerARB = __indirect_glVertexAttribPointerARB;
+
+    /*  29. GL_ARB_occlusion_query */
+
+    glAPI->BeginQueryARB = __indirect_glBeginQueryARB;
+    glAPI->DeleteQueriesARB = __indirect_glDeleteQueriesARB;
+    glAPI->EndQueryARB = __indirect_glEndQueryARB;
+    glAPI->GenQueriesARB = __indirect_glGenQueriesARB;
+    glAPI->GetQueryObjectivARB = __indirect_glGetQueryObjectivARB;
+    glAPI->GetQueryObjectuivARB = __indirect_glGetQueryObjectuivARB;
+    glAPI->GetQueryivARB = __indirect_glGetQueryivARB;
+    glAPI->IsQueryARB = __indirect_glIsQueryARB;
+
+    /*  37. GL_ARB_draw_buffers */
+
+    glAPI->DrawBuffersARB = __indirect_glDrawBuffersARB;
+
+    /*  45. GL_ARB_framebuffer_object */
+
+    glAPI->RenderbufferStorageMultisample = __indirect_glRenderbufferStorageMultisample;
+
+    /*  25. GL_SGIS_multisample */
+
+    glAPI->SampleMaskSGIS = __indirect_glSampleMaskSGIS;
+    glAPI->SamplePatternSGIS = __indirect_glSamplePatternSGIS;
+
+    /*  30. GL_EXT_vertex_array */
+
+    glAPI->ColorPointerEXT = __indirect_glColorPointerEXT;
+    glAPI->EdgeFlagPointerEXT = __indirect_glEdgeFlagPointerEXT;
+    glAPI->IndexPointerEXT = __indirect_glIndexPointerEXT;
+    glAPI->NormalPointerEXT = __indirect_glNormalPointerEXT;
+    glAPI->TexCoordPointerEXT = __indirect_glTexCoordPointerEXT;
+    glAPI->VertexPointerEXT = __indirect_glVertexPointerEXT;
+
+    /*  54. GL_EXT_point_parameters */
+
+    glAPI->PointParameterfEXT = __indirect_glPointParameterfEXT;
+    glAPI->PointParameterfvEXT = __indirect_glPointParameterfvEXT;
+
+    /* 145. GL_EXT_secondary_color */
+
+    glAPI->SecondaryColor3bEXT = __indirect_glSecondaryColor3bEXT;
+    glAPI->SecondaryColor3bvEXT = __indirect_glSecondaryColor3bvEXT;
+    glAPI->SecondaryColor3dEXT = __indirect_glSecondaryColor3dEXT;
+    glAPI->SecondaryColor3dvEXT = __indirect_glSecondaryColor3dvEXT;
+    glAPI->SecondaryColor3fEXT = __indirect_glSecondaryColor3fEXT;
+    glAPI->SecondaryColor3fvEXT = __indirect_glSecondaryColor3fvEXT;
+    glAPI->SecondaryColor3iEXT = __indirect_glSecondaryColor3iEXT;
+    glAPI->SecondaryColor3ivEXT = __indirect_glSecondaryColor3ivEXT;
+    glAPI->SecondaryColor3sEXT = __indirect_glSecondaryColor3sEXT;
+    glAPI->SecondaryColor3svEXT = __indirect_glSecondaryColor3svEXT;
+    glAPI->SecondaryColor3ubEXT = __indirect_glSecondaryColor3ubEXT;
+    glAPI->SecondaryColor3ubvEXT = __indirect_glSecondaryColor3ubvEXT;
+    glAPI->SecondaryColor3uiEXT = __indirect_glSecondaryColor3uiEXT;
+    glAPI->SecondaryColor3uivEXT = __indirect_glSecondaryColor3uivEXT;
+    glAPI->SecondaryColor3usEXT = __indirect_glSecondaryColor3usEXT;
+    glAPI->SecondaryColor3usvEXT = __indirect_glSecondaryColor3usvEXT;
+    glAPI->SecondaryColorPointerEXT = __indirect_glSecondaryColorPointerEXT;
+
+    /* 148. GL_EXT_multi_draw_arrays */
+
+    glAPI->MultiDrawArraysEXT = __indirect_glMultiDrawArraysEXT;
+    glAPI->MultiDrawElementsEXT = __indirect_glMultiDrawElementsEXT;
+
+    /* 149. GL_EXT_fog_coord */
+
+    glAPI->FogCoordPointerEXT = __indirect_glFogCoordPointerEXT;
+    glAPI->FogCoorddEXT = __indirect_glFogCoorddEXT;
+    glAPI->FogCoorddvEXT = __indirect_glFogCoorddvEXT;
+    glAPI->FogCoordfEXT = __indirect_glFogCoordfEXT;
+    glAPI->FogCoordfvEXT = __indirect_glFogCoordfvEXT;
+
+    /* 173. GL_EXT_blend_func_separate */
+
+    glAPI->BlendFuncSeparateEXT = __indirect_glBlendFuncSeparateEXT;
+
+    /* 197. GL_MESA_window_pos */
+
+    glAPI->WindowPos2dMESA = __indirect_glWindowPos2dMESA;
+    glAPI->WindowPos2dvMESA = __indirect_glWindowPos2dvMESA;
+    glAPI->WindowPos2fMESA = __indirect_glWindowPos2fMESA;
+    glAPI->WindowPos2fvMESA = __indirect_glWindowPos2fvMESA;
+    glAPI->WindowPos2iMESA = __indirect_glWindowPos2iMESA;
+    glAPI->WindowPos2ivMESA = __indirect_glWindowPos2ivMESA;
+    glAPI->WindowPos2sMESA = __indirect_glWindowPos2sMESA;
+    glAPI->WindowPos2svMESA = __indirect_glWindowPos2svMESA;
+    glAPI->WindowPos3dMESA = __indirect_glWindowPos3dMESA;
+    glAPI->WindowPos3dvMESA = __indirect_glWindowPos3dvMESA;
+    glAPI->WindowPos3fMESA = __indirect_glWindowPos3fMESA;
+    glAPI->WindowPos3fvMESA = __indirect_glWindowPos3fvMESA;
+    glAPI->WindowPos3iMESA = __indirect_glWindowPos3iMESA;
+    glAPI->WindowPos3ivMESA = __indirect_glWindowPos3ivMESA;
+    glAPI->WindowPos3sMESA = __indirect_glWindowPos3sMESA;
+    glAPI->WindowPos3svMESA = __indirect_glWindowPos3svMESA;
+
+    /* 233. GL_NV_vertex_program */
+
+    glAPI->AreProgramsResidentNV = __indirect_glAreProgramsResidentNV;
+    glAPI->BindProgramNV = __indirect_glBindProgramNV;
+    glAPI->DeleteProgramsNV = __indirect_glDeleteProgramsNV;
+    glAPI->ExecuteProgramNV = __indirect_glExecuteProgramNV;
+    glAPI->GenProgramsNV = __indirect_glGenProgramsNV;
+    glAPI->GetProgramParameterdvNV = __indirect_glGetProgramParameterdvNV;
+    glAPI->GetProgramParameterfvNV = __indirect_glGetProgramParameterfvNV;
+    glAPI->GetProgramStringNV = __indirect_glGetProgramStringNV;
+    glAPI->GetProgramivNV = __indirect_glGetProgramivNV;
+    glAPI->GetTrackMatrixivNV = __indirect_glGetTrackMatrixivNV;
+    glAPI->GetVertexAttribPointervNV = __indirect_glGetVertexAttribPointervNV;
+    glAPI->GetVertexAttribdvNV = __indirect_glGetVertexAttribdvNV;
+    glAPI->GetVertexAttribfvNV = __indirect_glGetVertexAttribfvNV;
+    glAPI->GetVertexAttribivNV = __indirect_glGetVertexAttribivNV;
+    glAPI->IsProgramNV = __indirect_glIsProgramNV;
+    glAPI->LoadProgramNV = __indirect_glLoadProgramNV;
+    glAPI->ProgramParameters4dvNV = __indirect_glProgramParameters4dvNV;
+    glAPI->ProgramParameters4fvNV = __indirect_glProgramParameters4fvNV;
+    glAPI->RequestResidentProgramsNV = __indirect_glRequestResidentProgramsNV;
+    glAPI->TrackMatrixNV = __indirect_glTrackMatrixNV;
+    glAPI->VertexAttrib1dNV = __indirect_glVertexAttrib1dNV;
+    glAPI->VertexAttrib1dvNV = __indirect_glVertexAttrib1dvNV;
+    glAPI->VertexAttrib1fNV = __indirect_glVertexAttrib1fNV;
+    glAPI->VertexAttrib1fvNV = __indirect_glVertexAttrib1fvNV;
+    glAPI->VertexAttrib1sNV = __indirect_glVertexAttrib1sNV;
+    glAPI->VertexAttrib1svNV = __indirect_glVertexAttrib1svNV;
+    glAPI->VertexAttrib2dNV = __indirect_glVertexAttrib2dNV;
+    glAPI->VertexAttrib2dvNV = __indirect_glVertexAttrib2dvNV;
+    glAPI->VertexAttrib2fNV = __indirect_glVertexAttrib2fNV;
+    glAPI->VertexAttrib2fvNV = __indirect_glVertexAttrib2fvNV;
+    glAPI->VertexAttrib2sNV = __indirect_glVertexAttrib2sNV;
+    glAPI->VertexAttrib2svNV = __indirect_glVertexAttrib2svNV;
+    glAPI->VertexAttrib3dNV = __indirect_glVertexAttrib3dNV;
+    glAPI->VertexAttrib3dvNV = __indirect_glVertexAttrib3dvNV;
+    glAPI->VertexAttrib3fNV = __indirect_glVertexAttrib3fNV;
+    glAPI->VertexAttrib3fvNV = __indirect_glVertexAttrib3fvNV;
+    glAPI->VertexAttrib3sNV = __indirect_glVertexAttrib3sNV;
+    glAPI->VertexAttrib3svNV = __indirect_glVertexAttrib3svNV;
+    glAPI->VertexAttrib4dNV = __indirect_glVertexAttrib4dNV;
+    glAPI->VertexAttrib4dvNV = __indirect_glVertexAttrib4dvNV;
+    glAPI->VertexAttrib4fNV = __indirect_glVertexAttrib4fNV;
+    glAPI->VertexAttrib4fvNV = __indirect_glVertexAttrib4fvNV;
+    glAPI->VertexAttrib4sNV = __indirect_glVertexAttrib4sNV;
+    glAPI->VertexAttrib4svNV = __indirect_glVertexAttrib4svNV;
+    glAPI->VertexAttrib4ubNV = __indirect_glVertexAttrib4ubNV;
+    glAPI->VertexAttrib4ubvNV = __indirect_glVertexAttrib4ubvNV;
+    glAPI->VertexAttribPointerNV = __indirect_glVertexAttribPointerNV;
+    glAPI->VertexAttribs1dvNV = __indirect_glVertexAttribs1dvNV;
+    glAPI->VertexAttribs1fvNV = __indirect_glVertexAttribs1fvNV;
+    glAPI->VertexAttribs1svNV = __indirect_glVertexAttribs1svNV;
+    glAPI->VertexAttribs2dvNV = __indirect_glVertexAttribs2dvNV;
+    glAPI->VertexAttribs2fvNV = __indirect_glVertexAttribs2fvNV;
+    glAPI->VertexAttribs2svNV = __indirect_glVertexAttribs2svNV;
+    glAPI->VertexAttribs3dvNV = __indirect_glVertexAttribs3dvNV;
+    glAPI->VertexAttribs3fvNV = __indirect_glVertexAttribs3fvNV;
+    glAPI->VertexAttribs3svNV = __indirect_glVertexAttribs3svNV;
+    glAPI->VertexAttribs4dvNV = __indirect_glVertexAttribs4dvNV;
+    glAPI->VertexAttribs4fvNV = __indirect_glVertexAttribs4fvNV;
+    glAPI->VertexAttribs4svNV = __indirect_glVertexAttribs4svNV;
+    glAPI->VertexAttribs4ubvNV = __indirect_glVertexAttribs4ubvNV;
+
+    /* 262. GL_NV_point_sprite */
+
+    glAPI->PointParameteriNV = __indirect_glPointParameteriNV;
+    glAPI->PointParameterivNV = __indirect_glPointParameterivNV;
+
+    /* 268. GL_EXT_stencil_two_side */
+
+    glAPI->ActiveStencilFaceEXT = __indirect_glActiveStencilFaceEXT;
+
+    /* 282. GL_NV_fragment_program */
+
+    glAPI->GetProgramNamedParameterdvNV = __indirect_glGetProgramNamedParameterdvNV;
+    glAPI->GetProgramNamedParameterfvNV = __indirect_glGetProgramNamedParameterfvNV;
+    glAPI->ProgramNamedParameter4dNV = __indirect_glProgramNamedParameter4dNV;
+    glAPI->ProgramNamedParameter4dvNV = __indirect_glProgramNamedParameter4dvNV;
+    glAPI->ProgramNamedParameter4fNV = __indirect_glProgramNamedParameter4fNV;
+    glAPI->ProgramNamedParameter4fvNV = __indirect_glProgramNamedParameter4fvNV;
+
+    /* 299. GL_EXT_blend_equation_separate */
+
+    glAPI->BlendEquationSeparateEXT = __indirect_glBlendEquationSeparateEXT;
+
+    /* 310. GL_EXT_framebuffer_object */
+
+    glAPI->BindFramebufferEXT = __indirect_glBindFramebufferEXT;
+    glAPI->BindRenderbufferEXT = __indirect_glBindRenderbufferEXT;
+    glAPI->CheckFramebufferStatusEXT = __indirect_glCheckFramebufferStatusEXT;
+    glAPI->DeleteFramebuffersEXT = __indirect_glDeleteFramebuffersEXT;
+    glAPI->DeleteRenderbuffersEXT = __indirect_glDeleteRenderbuffersEXT;
+    glAPI->FramebufferRenderbufferEXT = __indirect_glFramebufferRenderbufferEXT;
+    glAPI->FramebufferTexture1DEXT = __indirect_glFramebufferTexture1DEXT;
+    glAPI->FramebufferTexture2DEXT = __indirect_glFramebufferTexture2DEXT;
+    glAPI->FramebufferTexture3DEXT = __indirect_glFramebufferTexture3DEXT;
+    glAPI->GenFramebuffersEXT = __indirect_glGenFramebuffersEXT;
+    glAPI->GenRenderbuffersEXT = __indirect_glGenRenderbuffersEXT;
+    glAPI->GenerateMipmapEXT = __indirect_glGenerateMipmapEXT;
+    glAPI->GetFramebufferAttachmentParameterivEXT = __indirect_glGetFramebufferAttachmentParameterivEXT;
+    glAPI->GetRenderbufferParameterivEXT = __indirect_glGetRenderbufferParameterivEXT;
+    glAPI->IsFramebufferEXT = __indirect_glIsFramebufferEXT;
+    glAPI->IsRenderbufferEXT = __indirect_glIsRenderbufferEXT;
+    glAPI->RenderbufferStorageEXT = __indirect_glRenderbufferStorageEXT;
+
+    /* 316. GL_EXT_framebuffer_blit */
+
+    glAPI->BlitFramebufferEXT = __indirect_glBlitFramebufferEXT;
+
+    /* 329. GL_EXT_texture_array */
+
+    glAPI->FramebufferTextureLayerEXT = __indirect_glFramebufferTextureLayerEXT;
+
+    return glAPI;
+}
+
diff --git a/src/glx/indirect_init.h b/src/glx/indirect_init.h
new file mode 100644 (file)
index 0000000..72255f1
--- /dev/null
@@ -0,0 +1,41 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ */
+
+#ifndef _INDIRECT_INIT_H_
+#define _INDIRECT_INIT_H_
+
+#include "glxclient.h"
+
+extern __GLapi *__glXNewIndirectAPI(void);
+
+#endif /* _INDIRECT_INIT_H_ */
diff --git a/src/glx/indirect_size.c b/src/glx/indirect_size.c
new file mode 100644 (file)
index 0000000..6356ddd
--- /dev/null
@@ -0,0 +1,388 @@
+/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
+
+/*
+ * (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
+ * 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
+ * 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.
+ */
+
+
+#include <GL/gl.h>
+#include "indirect_size.h"
+
+#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#    define PURE __attribute__((pure))
+#  else
+#    define PURE
+#  endif
+
+#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#    define FASTCALL __attribute__((fastcall))
+#  else
+#    define FASTCALL
+#  endif
+
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
+#    define INTERNAL  __attribute__((visibility("internal")))
+#  else
+#    define INTERNAL
+#  endif
+
+
+#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)
+#  undef HAVE_ALIAS
+#endif
+#ifdef HAVE_ALIAS
+#  define ALIAS2(from,to) \
+    INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \
+        __attribute__ ((alias( # to )));
+#  define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )
+#else
+#  define ALIAS(from,to) \
+    INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \
+    { return __gl ## to ## _size( e ); }
+#endif
+
+
+INTERNAL PURE FASTCALL GLint
+__glCallLists_size(GLenum e)
+{
+    switch (e) {
+    case GL_BYTE:
+    case GL_UNSIGNED_BYTE:
+        return 1;
+    case GL_SHORT:
+    case GL_UNSIGNED_SHORT:
+    case GL_2_BYTES:
+    case GL_HALF_FLOAT:
+        return 2;
+    case GL_3_BYTES:
+        return 3;
+    case GL_INT:
+    case GL_UNSIGNED_INT:
+    case GL_FLOAT:
+    case GL_4_BYTES:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glFogfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_FOG_INDEX:
+    case GL_FOG_DENSITY:
+    case GL_FOG_START:
+    case GL_FOG_END:
+    case GL_FOG_MODE:
+    case GL_FOG_OFFSET_VALUE_SGIX:
+    case GL_FOG_DISTANCE_MODE_NV:
+        return 1;
+    case GL_FOG_COLOR:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glLightfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_SPOT_EXPONENT:
+    case GL_SPOT_CUTOFF:
+    case GL_CONSTANT_ATTENUATION:
+    case GL_LINEAR_ATTENUATION:
+    case GL_QUADRATIC_ATTENUATION:
+        return 1;
+    case GL_SPOT_DIRECTION:
+        return 3;
+    case GL_AMBIENT:
+    case GL_DIFFUSE:
+    case GL_SPECULAR:
+    case GL_POSITION:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glLightModelfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_LIGHT_MODEL_LOCAL_VIEWER:
+    case GL_LIGHT_MODEL_TWO_SIDE:
+    case GL_LIGHT_MODEL_COLOR_CONTROL:
+/*      case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/
+        return 1;
+    case GL_LIGHT_MODEL_AMBIENT:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glMaterialfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_SHININESS:
+        return 1;
+    case GL_COLOR_INDEXES:
+        return 3;
+    case GL_AMBIENT:
+    case GL_DIFFUSE:
+    case GL_SPECULAR:
+    case GL_EMISSION:
+    case GL_AMBIENT_AND_DIFFUSE:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glTexParameterfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_TEXTURE_MAG_FILTER:
+    case GL_TEXTURE_MIN_FILTER:
+    case GL_TEXTURE_WRAP_S:
+    case GL_TEXTURE_WRAP_T:
+    case GL_TEXTURE_PRIORITY:
+    case GL_TEXTURE_WRAP_R:
+    case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
+/*      case GL_SHADOW_AMBIENT_SGIX:*/
+    case GL_TEXTURE_MIN_LOD:
+    case GL_TEXTURE_MAX_LOD:
+    case GL_TEXTURE_BASE_LEVEL:
+    case GL_TEXTURE_MAX_LEVEL:
+    case GL_TEXTURE_CLIPMAP_FRAME_SGIX:
+    case GL_TEXTURE_LOD_BIAS_S_SGIX:
+    case GL_TEXTURE_LOD_BIAS_T_SGIX:
+    case GL_TEXTURE_LOD_BIAS_R_SGIX:
+    case GL_GENERATE_MIPMAP:
+/*      case GL_GENERATE_MIPMAP_SGIS:*/
+    case GL_TEXTURE_COMPARE_SGIX:
+    case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+    case GL_TEXTURE_MAX_CLAMP_S_SGIX:
+    case GL_TEXTURE_MAX_CLAMP_T_SGIX:
+    case GL_TEXTURE_MAX_CLAMP_R_SGIX:
+    case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+    case GL_TEXTURE_LOD_BIAS:
+/*      case GL_TEXTURE_LOD_BIAS_EXT:*/
+    case GL_TEXTURE_STORAGE_HINT_APPLE:
+    case GL_STORAGE_PRIVATE_APPLE:
+    case GL_STORAGE_CACHED_APPLE:
+    case GL_STORAGE_SHARED_APPLE:
+    case GL_DEPTH_TEXTURE_MODE:
+/*      case GL_DEPTH_TEXTURE_MODE_ARB:*/
+    case GL_TEXTURE_COMPARE_MODE:
+/*      case GL_TEXTURE_COMPARE_MODE_ARB:*/
+    case GL_TEXTURE_COMPARE_FUNC:
+/*      case GL_TEXTURE_COMPARE_FUNC_ARB:*/
+    case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV:
+        return 1;
+    case GL_TEXTURE_CLIPMAP_CENTER_SGIX:
+    case GL_TEXTURE_CLIPMAP_OFFSET_SGIX:
+        return 2;
+    case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX:
+        return 3;
+    case GL_TEXTURE_BORDER_COLOR:
+    case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
+    case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glTexEnvfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_ALPHA_SCALE:
+    case GL_TEXTURE_ENV_MODE:
+    case GL_TEXTURE_LOD_BIAS:
+    case GL_COMBINE_RGB:
+    case GL_COMBINE_ALPHA:
+    case GL_RGB_SCALE:
+    case GL_SOURCE0_RGB:
+    case GL_SOURCE1_RGB:
+    case GL_SOURCE2_RGB:
+    case GL_SOURCE3_RGB_NV:
+    case GL_SOURCE0_ALPHA:
+    case GL_SOURCE1_ALPHA:
+    case GL_SOURCE2_ALPHA:
+    case GL_SOURCE3_ALPHA_NV:
+    case GL_OPERAND0_RGB:
+    case GL_OPERAND1_RGB:
+    case GL_OPERAND2_RGB:
+    case GL_OPERAND3_RGB_NV:
+    case GL_OPERAND0_ALPHA:
+    case GL_OPERAND1_ALPHA:
+    case GL_OPERAND2_ALPHA:
+    case GL_OPERAND3_ALPHA_NV:
+    case GL_BUMP_TARGET_ATI:
+    case GL_COORD_REPLACE_ARB:
+/*      case GL_COORD_REPLACE_NV:*/
+        return 1;
+    case GL_TEXTURE_ENV_COLOR:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glTexGendv_size(GLenum e)
+{
+    switch (e) {
+    case GL_TEXTURE_GEN_MODE:
+        return 1;
+    case GL_OBJECT_PLANE:
+    case GL_EYE_PLANE:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glMap1d_size(GLenum e)
+{
+    switch (e) {
+    case GL_MAP1_INDEX:
+    case GL_MAP1_TEXTURE_COORD_1:
+        return 1;
+    case GL_MAP1_TEXTURE_COORD_2:
+        return 2;
+    case GL_MAP1_NORMAL:
+    case GL_MAP1_TEXTURE_COORD_3:
+    case GL_MAP1_VERTEX_3:
+        return 3;
+    case GL_MAP1_COLOR_4:
+    case GL_MAP1_TEXTURE_COORD_4:
+    case GL_MAP1_VERTEX_4:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glMap2d_size(GLenum e)
+{
+    switch (e) {
+    case GL_MAP2_INDEX:
+    case GL_MAP2_TEXTURE_COORD_1:
+        return 1;
+    case GL_MAP2_TEXTURE_COORD_2:
+        return 2;
+    case GL_MAP2_NORMAL:
+    case GL_MAP2_TEXTURE_COORD_3:
+    case GL_MAP2_VERTEX_3:
+        return 3;
+    case GL_MAP2_COLOR_4:
+    case GL_MAP2_TEXTURE_COORD_4:
+    case GL_MAP2_VERTEX_4:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glColorTableParameterfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_COLOR_TABLE_SCALE:
+    case GL_COLOR_TABLE_BIAS:
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glConvolutionParameterfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_CONVOLUTION_BORDER_MODE:
+/*      case GL_CONVOLUTION_BORDER_MODE_EXT:*/
+        return 1;
+    case GL_CONVOLUTION_FILTER_SCALE:
+/*      case GL_CONVOLUTION_FILTER_SCALE_EXT:*/
+    case GL_CONVOLUTION_FILTER_BIAS:
+/*      case GL_CONVOLUTION_FILTER_BIAS_EXT:*/
+    case GL_CONVOLUTION_BORDER_COLOR:
+/*      case GL_CONVOLUTION_BORDER_COLOR_HP:*/
+        return 4;
+    default:
+        return 0;
+    }
+}
+
+INTERNAL PURE FASTCALL GLint
+__glPointParameterfvEXT_size(GLenum e)
+{
+    switch (e) {
+    case GL_POINT_SIZE_MIN:
+/*      case GL_POINT_SIZE_MIN_ARB:*/
+/*      case GL_POINT_SIZE_MIN_SGIS:*/
+    case GL_POINT_SIZE_MAX:
+/*      case GL_POINT_SIZE_MAX_ARB:*/
+/*      case GL_POINT_SIZE_MAX_SGIS:*/
+    case GL_POINT_FADE_THRESHOLD_SIZE:
+/*      case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/
+/*      case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/
+    case GL_POINT_SPRITE_R_MODE_NV:
+    case GL_POINT_SPRITE_COORD_ORIGIN:
+        return 1;
+    case GL_POINT_DISTANCE_ATTENUATION:
+/*      case GL_POINT_DISTANCE_ATTENUATION_ARB:*/
+/*      case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/
+        return 3;
+    default:
+        return 0;
+    }
+}
+
+ALIAS(Fogiv, Fogfv)
+    ALIAS(Lightiv, Lightfv)
+    ALIAS(LightModeliv, LightModelfv)
+    ALIAS(Materialiv, Materialfv)
+    ALIAS(TexParameteriv, TexParameterfv)
+    ALIAS(TexEnviv, TexEnvfv)
+    ALIAS(TexGenfv, TexGendv)
+    ALIAS(TexGeniv, TexGendv)
+    ALIAS(Map1f, Map1d)
+    ALIAS(Map2f, Map2d)
+    ALIAS(ColorTableParameteriv, ColorTableParameterfv)
+    ALIAS(ConvolutionParameteriv, ConvolutionParameterfv)
+    ALIAS(PointParameterivNV, PointParameterfvEXT)
+#  undef PURE
+#  undef FASTCALL
+#  undef INTERNAL
diff --git a/src/glx/indirect_size.h b/src/glx/indirect_size.h
new file mode 100644 (file)
index 0000000..af0919f
--- /dev/null
@@ -0,0 +1,88 @@
+/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
+
+/*
+ * (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
+ * 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
+ * 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.
+ */
+
+#if !defined( _INDIRECT_SIZE_H_ )
+#  define _INDIRECT_SIZE_H_
+
+/**
+ * \file
+ * Prototypes for functions used to determine the number of data elements in
+ * various GLX protocol messages.
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#    define PURE __attribute__((pure))
+#  else
+#    define PURE
+#  endif
+
+#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#    define FASTCALL __attribute__((fastcall))
+#  else
+#    define FASTCALL
+#  endif
+
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
+#    define INTERNAL  __attribute__((visibility("internal")))
+#  else
+#    define INTERNAL
+#  endif
+
+extern INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glFogiv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glLightfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glLightiv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glLightModelfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glLightModeliv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glMaterialfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glMaterialiv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glTexParameterfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glTexParameteriv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glTexEnvfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glTexEnviv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glTexGendv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glTexGenfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glTexGeniv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glMap1d_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glMap1f_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glMap2f_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glColorTableParameteriv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size(GLenum);
+extern INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum);
+
+#  undef PURE
+#  undef FASTCALL
+#  undef INTERNAL
+
+#endif /* !defined( _INDIRECT_SIZE_H_ ) */
diff --git a/src/glx/indirect_texture_compression.c b/src/glx/indirect_texture_compression.c
new file mode 100644 (file)
index 0000000..fa927eb
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ * (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
+ * THE COPYRIGHT HOLDERS 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 glx_texture_compression.c
+ * Contains the routines required to implement GLX protocol for
+ * ARB_texture_compression and related extensions.
+ *
+ * \sa http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_compression.txt
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#include "packrender.h"
+#include "packsingle.h"
+#include "indirect.h"
+
+#include <assert.h>
+
+
+void
+__indirect_glGetCompressedTexImageARB(GLenum target, GLint level,
+                                      GLvoid * img)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   xGLXGetTexImageReply reply;
+   size_t image_bytes;
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_GetCompressedTexImage, 8);
+   __GLX_SINGLE_PUT_LONG(0, target);
+   __GLX_SINGLE_PUT_LONG(4, level);
+   __GLX_SINGLE_READ_XREPLY();
+
+   image_bytes = reply.width;
+   assert(image_bytes <= ((4 * reply.length) - 0));
+   assert(image_bytes >= ((4 * reply.length) - 3));
+
+   if (image_bytes != 0) {
+      _XRead(dpy, (char *) img, image_bytes);
+      if (image_bytes < (4 * reply.length)) {
+         _XEatData(dpy, (4 * reply.length) - image_bytes);
+      }
+   }
+
+   __GLX_SINGLE_END();
+}
+
+
+/**
+ * Internal function used for \c glCompressedTexImage1D and
+ * \c glCompressedTexImage2D.
+ */
+static void
+CompressedTexImage1D2D(GLenum target, GLint level,
+                       GLenum internal_format,
+                       GLsizei width, GLsizei height,
+                       GLint border, GLsizei image_size,
+                       const GLvoid * data, CARD32 rop)
+{
+   __GLX_DECLARE_VARIABLES();
+
+   __GLX_LOAD_VARIABLES();
+   if (gc->currentDpy == NULL) {
+      return;
+   }
+
+   if ((target == GL_PROXY_TEXTURE_1D)
+       || (target == GL_PROXY_TEXTURE_2D)
+       || (target == GL_PROXY_TEXTURE_CUBE_MAP)) {
+      compsize = 0;
+   }
+   else {
+      compsize = image_size;
+   }
+
+   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + compsize);
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      __GLX_BEGIN_VARIABLE(rop, cmdlen);
+      __GLX_PUT_LONG(4, target);
+      __GLX_PUT_LONG(8, level);
+      __GLX_PUT_LONG(12, internal_format);
+      __GLX_PUT_LONG(16, width);
+      __GLX_PUT_LONG(20, height);
+      __GLX_PUT_LONG(24, border);
+      __GLX_PUT_LONG(28, image_size);
+      if (compsize != 0) {
+         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE,
+                              data, image_size);
+      }
+      __GLX_END(cmdlen);
+   }
+   else {
+      assert(compsize != 0);
+
+      __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4);
+      __GLX_PUT_LONG(8, target);
+      __GLX_PUT_LONG(12, level);
+      __GLX_PUT_LONG(16, internal_format);
+      __GLX_PUT_LONG(20, width);
+      __GLX_PUT_LONG(24, height);
+      __GLX_PUT_LONG(28, border);
+      __GLX_PUT_LONG(32, image_size);
+      __glXSendLargeCommand(gc, gc->pc,
+                            __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + 4,
+                            data, image_size);
+   }
+}
+
+
+/**
+ * Internal function used for \c glCompressedTexSubImage1D and
+ * \c glCompressedTexSubImage2D.
+ */
+static void
+CompressedTexSubImage1D2D(GLenum target, GLint level,
+                          GLsizei xoffset, GLsizei yoffset,
+                          GLsizei width, GLsizei height,
+                          GLenum format, GLsizei image_size,
+                          const GLvoid * data, CARD32 rop)
+{
+   __GLX_DECLARE_VARIABLES();
+
+   __GLX_LOAD_VARIABLES();
+   if (gc->currentDpy == NULL) {
+      return;
+   }
+
+   if (target == GL_PROXY_TEXTURE_3D) {
+      compsize = 0;
+   }
+   else {
+      compsize = image_size;
+   }
+
+   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + compsize);
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      __GLX_BEGIN_VARIABLE(rop, cmdlen);
+      __GLX_PUT_LONG(4, target);
+      __GLX_PUT_LONG(8, level);
+      __GLX_PUT_LONG(12, xoffset);
+      __GLX_PUT_LONG(16, yoffset);
+      __GLX_PUT_LONG(20, width);
+      __GLX_PUT_LONG(24, height);
+      __GLX_PUT_LONG(28, format);
+      __GLX_PUT_LONG(32, image_size);
+      if (compsize != 0) {
+         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE,
+                              data, image_size);
+      }
+      __GLX_END(cmdlen);
+   }
+   else {
+      assert(compsize != 0);
+
+      __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4);
+      __GLX_PUT_LONG(8, target);
+      __GLX_PUT_LONG(12, level);
+      __GLX_PUT_LONG(16, xoffset);
+      __GLX_PUT_LONG(20, yoffset);
+      __GLX_PUT_LONG(24, width);
+      __GLX_PUT_LONG(28, height);
+      __GLX_PUT_LONG(32, format);
+      __GLX_PUT_LONG(36, image_size);
+      __glXSendLargeCommand(gc, gc->pc,
+                            __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + 4,
+                            data, image_size);
+   }
+}
+
+
+void
+__indirect_glCompressedTexImage1DARB(GLenum target, GLint level,
+                                     GLenum internal_format, GLsizei width,
+                                     GLint border, GLsizei image_size,
+                                     const GLvoid * data)
+{
+   CompressedTexImage1D2D(target, level, internal_format, width, 0,
+                          border, image_size, data,
+                          X_GLrop_CompressedTexImage1D);
+}
+
+
+void
+__indirect_glCompressedTexImage2DARB(GLenum target, GLint level,
+                                     GLenum internal_format,
+                                     GLsizei width, GLsizei height,
+                                     GLint border, GLsizei image_size,
+                                     const GLvoid * data)
+{
+   CompressedTexImage1D2D(target, level, internal_format, width, height,
+                          border, image_size, data,
+                          X_GLrop_CompressedTexImage2D);
+}
+
+
+void
+__indirect_glCompressedTexImage3DARB(GLenum target, GLint level,
+                                     GLenum internal_format,
+                                     GLsizei width, GLsizei height,
+                                     GLsizei depth, GLint border,
+                                     GLsizei image_size, const GLvoid * data)
+{
+   __GLX_DECLARE_VARIABLES();
+
+   __GLX_LOAD_VARIABLES();
+   if (gc->currentDpy == NULL) {
+      return;
+   }
+
+   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + image_size);
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexImage3D, cmdlen);
+      __GLX_PUT_LONG(4, target);
+      __GLX_PUT_LONG(8, level);
+      __GLX_PUT_LONG(12, internal_format);
+      __GLX_PUT_LONG(16, width);
+      __GLX_PUT_LONG(20, height);
+      __GLX_PUT_LONG(24, depth);
+      __GLX_PUT_LONG(28, border);
+      __GLX_PUT_LONG(32, image_size);
+      if (image_size != 0) {
+         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE,
+                              data, image_size);
+      }
+      __GLX_END(cmdlen);
+   }
+   else {
+      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexImage3D, cmdlen + 4);
+      __GLX_PUT_LONG(8, target);
+      __GLX_PUT_LONG(12, level);
+      __GLX_PUT_LONG(16, internal_format);
+      __GLX_PUT_LONG(20, width);
+      __GLX_PUT_LONG(24, height);
+      __GLX_PUT_LONG(28, depth);
+      __GLX_PUT_LONG(32, border);
+      __GLX_PUT_LONG(36, image_size);
+      __glXSendLargeCommand(gc, gc->pc,
+                            __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + 4,
+                            data, image_size);
+   }
+}
+
+
+void
+__indirect_glCompressedTexSubImage1DARB(GLenum target, GLint level,
+                                        GLint xoffset,
+                                        GLsizei width,
+                                        GLenum format, GLsizei image_size,
+                                        const GLvoid * data)
+{
+   CompressedTexSubImage1D2D(target, level, xoffset, 0, width, 0,
+                             format, image_size, data,
+                             X_GLrop_CompressedTexSubImage1D);
+}
+
+
+void
+__indirect_glCompressedTexSubImage2DARB(GLenum target, GLint level,
+                                        GLint xoffset, GLint yoffset,
+                                        GLsizei width, GLsizei height,
+                                        GLenum format, GLsizei image_size,
+                                        const GLvoid * data)
+{
+   CompressedTexSubImage1D2D(target, level, xoffset, yoffset, width, height,
+                             format, image_size, data,
+                             X_GLrop_CompressedTexSubImage2D);
+}
+
+
+void
+__indirect_glCompressedTexSubImage3DARB(GLenum target, GLint level,
+                                        GLint xoffset, GLint yoffset,
+                                        GLint zoffset, GLsizei width,
+                                        GLsizei height, GLsizei depth,
+                                        GLenum format, GLsizei image_size,
+                                        const GLvoid * data)
+{
+   __GLX_DECLARE_VARIABLES();
+
+   __GLX_LOAD_VARIABLES();
+   if (gc->currentDpy == NULL) {
+      return;
+   }
+
+   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE
+                      + image_size);
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexSubImage3D, cmdlen);
+      __GLX_PUT_LONG(4, target);
+      __GLX_PUT_LONG(8, level);
+      __GLX_PUT_LONG(12, xoffset);
+      __GLX_PUT_LONG(16, yoffset);
+      __GLX_PUT_LONG(20, zoffset);
+      __GLX_PUT_LONG(24, width);
+      __GLX_PUT_LONG(28, height);
+      __GLX_PUT_LONG(32, depth);
+      __GLX_PUT_LONG(36, format);
+      __GLX_PUT_LONG(40, image_size);
+      if (image_size != 0) {
+         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE,
+                              data, image_size);
+      }
+      __GLX_END(cmdlen);
+   }
+   else {
+      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexSubImage3D, cmdlen + 4);
+      __GLX_PUT_LONG(8, target);
+      __GLX_PUT_LONG(12, level);
+      __GLX_PUT_LONG(16, xoffset);
+      __GLX_PUT_LONG(20, yoffset);
+      __GLX_PUT_LONG(24, zoffset);
+      __GLX_PUT_LONG(28, width);
+      __GLX_PUT_LONG(32, height);
+      __GLX_PUT_LONG(36, depth);
+      __GLX_PUT_LONG(40, format);
+      __GLX_PUT_LONG(44, image_size);
+      __glXSendLargeCommand(gc, gc->pc,
+                            __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE + 4,
+                            data, image_size);
+   }
+}
diff --git a/src/glx/indirect_transpose_matrix.c b/src/glx/indirect_transpose_matrix.c
new file mode 100644 (file)
index 0000000..618db9f
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * (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
+ * THE COPYRIGHT HOLDERS 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.
+ */
+
+#include <GL/gl.h>
+#include "indirect.h"
+
+static void
+TransposeMatrixf(const GLfloat s[16], GLfloat d[16])
+{
+   int i, j;
+   for (i = 0; i < 4; i++) {
+      for (j = 0; j < 4; j++) {
+         d[i * 4 + j] = s[j * 4 + i];
+      }
+   }
+}
+
+static void
+TransposeMatrixd(const GLdouble s[16], GLdouble d[16])
+{
+   int i, j;
+   for (i = 0; i < 4; i++) {
+      for (j = 0; j < 4; j++) {
+         d[i * 4 + j] = s[j * 4 + i];
+      }
+   }
+}
+
+
+void
+__indirect_glLoadTransposeMatrixdARB(const GLdouble * m)
+{
+   GLdouble mt[16];
+
+   TransposeMatrixd(m, mt);
+   __indirect_glLoadMatrixd(mt);
+}
+
+void
+__indirect_glLoadTransposeMatrixfARB(const GLfloat * m)
+{
+   GLfloat mt[16];
+
+   TransposeMatrixf(m, mt);
+   __indirect_glLoadMatrixf(mt);
+}
+
+void
+__indirect_glMultTransposeMatrixdARB(const GLdouble * m)
+{
+   GLdouble mt[16];
+
+   TransposeMatrixd(m, mt);
+   __indirect_glMultMatrixd(mt);
+}
+
+void
+__indirect_glMultTransposeMatrixfARB(const GLfloat * m)
+{
+   GLfloat mt[16];
+
+   TransposeMatrixf(m, mt);
+   __indirect_glMultMatrixf(mt);
+}
diff --git a/src/glx/indirect_vertex_array.c b/src/glx/indirect_vertex_array.c
new file mode 100644 (file)
index 0000000..ad98825
--- /dev/null
@@ -0,0 +1,1985 @@
+/*
+ * (C) Copyright IBM Corporation 2004, 2005
+ * 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
+ * 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.
+ */
+
+#include <inttypes.h>
+#include <assert.h>
+#include <string.h>
+
+#include "glxclient.h"
+#include "indirect.h"
+#include <GL/glxproto.h>
+#include "glxextensions.h"
+#include "indirect_vertex_array.h"
+#include "indirect_vertex_array_priv.h"
+
+#define __GLX_PAD(n) (((n)+3) & ~3)
+
+/**
+ * \file indirect_vertex_array.c
+ * Implement GLX protocol for vertex arrays and vertex buffer objects.
+ *
+ * The most important function in this fill is \c fill_array_info_cache.
+ * The \c array_state_vector contains a cache of the ARRAY_INFO data sent
+ * in the DrawArrays protocol.  Certain operations, such as enabling or
+ * disabling an array, can invalidate this cache.  \c fill_array_info_cache
+ * fills-in this data.  Additionally, it examines the enabled state and
+ * other factors to determine what "version" of DrawArrays protocoal can be
+ * used.
+ *
+ * Current, only two versions of DrawArrays protocol are implemented.  The
+ * first version is the "none" protocol.  This is the fallback when the
+ * server does not support GL 1.1 / EXT_vertex_arrays.  It is implemented
+ * by sending batches of immediate mode commands that are equivalent to the
+ * DrawArrays protocol.
+ *
+ * The other protocol that is currently implemented is the "old" protocol.
+ * This is the GL 1.1 DrawArrays protocol.  The only difference between GL
+ * 1.1 and EXT_vertex_arrays is the opcode used for the DrawArrays command.
+ * This protocol is called "old" because the ARB is in the process of
+ * defining a new protocol, which will probably be called wither "new" or
+ * "vbo", to support multiple texture coordinate arrays, generic attributes,
+ * and vertex buffer objects.
+ *
+ * \author Ian Romanick <ian.d.romanick@intel.com>
+ */
+
+static void emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count);
+static void emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count);
+
+static void emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
+                                   const GLvoid * indices);
+static void emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
+                                  const GLvoid * indices);
+
+
+static GLubyte *emit_element_none(GLubyte * dst,
+                                  const struct array_state_vector *arrays,
+                                  unsigned index);
+static GLubyte *emit_element_old(GLubyte * dst,
+                                 const struct array_state_vector *arrays,
+                                 unsigned index);
+static struct array_state *get_array_entry(const struct array_state_vector
+                                           *arrays, GLenum key,
+                                           unsigned index);
+static void fill_array_info_cache(struct array_state_vector *arrays);
+static GLboolean validate_mode(__GLXcontext * gc, GLenum mode);
+static GLboolean validate_count(__GLXcontext * gc, GLsizei count);
+static GLboolean validate_type(__GLXcontext * gc, GLenum type);
+
+
+/**
+ * Table of sizes, in bytes, of a GL types.  All of the type enums are be in
+ * the range 0x1400 - 0x140F.  That includes types added by extensions (i.e.,
+ * \c GL_HALF_FLOAT_NV).  This elements of this table correspond to the
+ * type enums masked with 0x0f.
+ *
+ * \notes
+ * \c GL_HALF_FLOAT_NV is not included.  Neither are \c GL_2_BYTES,
+ * \c GL_3_BYTES, or \c GL_4_BYTES.
+ */
+const GLuint __glXTypeSize_table[16] = {
+   1, 1, 2, 2, 4, 4, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0
+};
+
+
+/**
+ * Free the per-context array state that was allocated with
+ * __glXInitVertexArrayState().
+ */
+void
+__glXFreeVertexArrayState(__GLXcontext * gc)
+{
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+   if (arrays) {
+      if (arrays->stack) {
+         free(arrays->stack);
+         arrays->stack = NULL;
+      }
+      if (arrays->arrays) {
+         free(arrays->arrays);
+         arrays->arrays = NULL;
+      }
+      free(arrays);
+      state->array_state = NULL;
+   }
+}
+
+
+/**
+ * Initialize vertex array state of a GLX context.
+ *
+ * \param gc  GLX context whose vertex array state is to be initialized.
+ *
+ * \warning
+ * This function may only be called after __GLXcontext::gl_extension_bits,
+ * __GLXcontext::server_minor, and __GLXcontext::server_major have been
+ * initialized.  These values are used to determine what vertex arrays are
+ * supported.
+ *
+ * \bug
+ * Return values from malloc are not properly tested.
+ */
+void
+__glXInitVertexArrayState(__GLXcontext * gc)
+{
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays;
+
+   unsigned array_count;
+   int texture_units = 1, vertex_program_attribs = 0;
+   unsigned i, j;
+
+   GLboolean got_fog = GL_FALSE;
+   GLboolean got_secondary_color = GL_FALSE;
+
+
+   arrays = calloc(1, sizeof(struct array_state_vector));
+   state->array_state = arrays;
+
+   arrays->old_DrawArrays_possible = !state->NoDrawArraysProtocol;
+   arrays->new_DrawArrays_possible = GL_FALSE;
+   arrays->DrawArrays = NULL;
+
+   arrays->active_texture_unit = 0;
+
+
+   /* Determine how many arrays are actually needed.  Only arrays that
+    * are supported by the server are create.  For example, if the server
+    * supports only 2 texture units, then only 2 texture coordinate arrays
+    * are created.
+    *
+    * At the very least, GL_VERTEX_ARRAY, GL_NORMAL_ARRAY,
+    * GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY, and
+    * GL_EDGE_FLAG_ARRAY are supported.
+    */
+
+   array_count = 5;
+
+   if (__glExtensionBitIsEnabled(gc, GL_EXT_fog_coord_bit)
+       || (gc->server_major > 1) || (gc->server_minor >= 4)) {
+      got_fog = GL_TRUE;
+      array_count++;
+   }
+
+   if (__glExtensionBitIsEnabled(gc, GL_EXT_secondary_color_bit)
+       || (gc->server_major > 1) || (gc->server_minor >= 4)) {
+      got_secondary_color = GL_TRUE;
+      array_count++;
+   }
+
+   if (__glExtensionBitIsEnabled(gc, GL_ARB_multitexture_bit)
+       || (gc->server_major > 1) || (gc->server_minor >= 3)) {
+      __indirect_glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units);
+   }
+
+   if (__glExtensionBitIsEnabled(gc, GL_ARB_vertex_program_bit)) {
+      __indirect_glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,
+                                   GL_MAX_PROGRAM_ATTRIBS_ARB,
+                                   &vertex_program_attribs);
+   }
+
+   arrays->num_texture_units = texture_units;
+   arrays->num_vertex_program_attribs = vertex_program_attribs;
+   array_count += texture_units + vertex_program_attribs;
+   arrays->num_arrays = array_count;
+   arrays->arrays = calloc(array_count, sizeof(struct array_state));
+
+   arrays->arrays[0].data_type = GL_FLOAT;
+   arrays->arrays[0].count = 3;
+   arrays->arrays[0].key = GL_NORMAL_ARRAY;
+   arrays->arrays[0].normalized = GL_TRUE;
+   arrays->arrays[0].old_DrawArrays_possible = GL_TRUE;
+
+   arrays->arrays[1].data_type = GL_FLOAT;
+   arrays->arrays[1].count = 4;
+   arrays->arrays[1].key = GL_COLOR_ARRAY;
+   arrays->arrays[1].normalized = GL_TRUE;
+   arrays->arrays[1].old_DrawArrays_possible = GL_TRUE;
+
+   arrays->arrays[2].data_type = GL_FLOAT;
+   arrays->arrays[2].count = 1;
+   arrays->arrays[2].key = GL_INDEX_ARRAY;
+   arrays->arrays[2].old_DrawArrays_possible = GL_TRUE;
+
+   arrays->arrays[3].data_type = GL_UNSIGNED_BYTE;
+   arrays->arrays[3].count = 1;
+   arrays->arrays[3].key = GL_EDGE_FLAG_ARRAY;
+   arrays->arrays[3].old_DrawArrays_possible = GL_TRUE;
+
+   for (i = 0; i < texture_units; i++) {
+      arrays->arrays[4 + i].data_type = GL_FLOAT;
+      arrays->arrays[4 + i].count = 4;
+      arrays->arrays[4 + i].key = GL_TEXTURE_COORD_ARRAY;
+
+      arrays->arrays[4 + i].old_DrawArrays_possible = (i == 0);
+      arrays->arrays[4 + i].index = i;
+
+      arrays->arrays[4 + i].header[1] = i + GL_TEXTURE0;
+   }
+
+   i = 4 + texture_units;
+
+   if (got_fog) {
+      arrays->arrays[i].data_type = GL_FLOAT;
+      arrays->arrays[i].count = 1;
+      arrays->arrays[i].key = GL_FOG_COORDINATE_ARRAY;
+      arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
+      i++;
+   }
+
+   if (got_secondary_color) {
+      arrays->arrays[i].data_type = GL_FLOAT;
+      arrays->arrays[i].count = 3;
+      arrays->arrays[i].key = GL_SECONDARY_COLOR_ARRAY;
+      arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
+      arrays->arrays[i].normalized = GL_TRUE;
+      i++;
+   }
+
+
+   for (j = 0; j < vertex_program_attribs; j++) {
+      const unsigned idx = (vertex_program_attribs - (j + 1));
+
+
+      arrays->arrays[idx + i].data_type = GL_FLOAT;
+      arrays->arrays[idx + i].count = 4;
+      arrays->arrays[idx + i].key = GL_VERTEX_ATTRIB_ARRAY_POINTER;
+
+      arrays->arrays[idx + i].old_DrawArrays_possible = 0;
+      arrays->arrays[idx + i].index = idx;
+
+      arrays->arrays[idx + i].header[1] = idx;
+   }
+
+   i += vertex_program_attribs;
+
+
+   /* Vertex array *must* be last becuase of the way that
+    * emit_DrawArrays_none works.
+    */
+
+   arrays->arrays[i].data_type = GL_FLOAT;
+   arrays->arrays[i].count = 4;
+   arrays->arrays[i].key = GL_VERTEX_ARRAY;
+   arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
+
+   assert((i + 1) == arrays->num_arrays);
+
+   arrays->stack_index = 0;
+   arrays->stack = malloc(sizeof(struct array_stack_state)
+                          * arrays->num_arrays);
+}
+
+
+/**
+ * Calculate the size of a single vertex for the "none" protocol.  This is
+ * essentially the size of all the immediate-mode commands required to
+ * implement the enabled vertex arrays.
+ */
+static size_t
+calculate_single_vertex_size_none(const struct array_state_vector *arrays)
+{
+   size_t single_vertex_size = 0;
+   unsigned i;
+
+
+   for (i = 0; i < arrays->num_arrays; i++) {
+      if (arrays->arrays[i].enabled) {
+         single_vertex_size += ((uint16_t *) arrays->arrays[i].header)[0];
+      }
+   }
+
+   return single_vertex_size;
+}
+
+
+/**
+ * Emit a single element using non-DrawArrays protocol.
+ */
+GLubyte *
+emit_element_none(GLubyte * dst,
+                  const struct array_state_vector * arrays, unsigned index)
+{
+   unsigned i;
+
+
+   for (i = 0; i < arrays->num_arrays; i++) {
+      if (arrays->arrays[i].enabled) {
+         const size_t offset = index * arrays->arrays[i].true_stride;
+
+         /* The generic attributes can have more data than is in the
+          * elements.  This is because a vertex array can be a 2 element,
+          * normalized, unsigned short, but the "closest" immediate mode
+          * protocol is for a 4Nus.  Since the sizes are small, the
+          * performance impact on modern processors should be negligible.
+          */
+         (void) memset(dst, 0, ((uint16_t *) arrays->arrays[i].header)[0]);
+
+         (void) memcpy(dst, arrays->arrays[i].header,
+                       arrays->arrays[i].header_size);
+
+         dst += arrays->arrays[i].header_size;
+
+         (void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
+                       arrays->arrays[i].element_size);
+
+         dst += __GLX_PAD(arrays->arrays[i].element_size);
+      }
+   }
+
+   return dst;
+}
+
+
+/**
+ * Emit a single element using "old" DrawArrays protocol from
+ * EXT_vertex_arrays / OpenGL 1.1.
+ */
+GLubyte *
+emit_element_old(GLubyte * dst,
+                 const struct array_state_vector * arrays, unsigned index)
+{
+   unsigned i;
+
+
+   for (i = 0; i < arrays->num_arrays; i++) {
+      if (arrays->arrays[i].enabled) {
+         const size_t offset = index * arrays->arrays[i].true_stride;
+
+         (void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
+                       arrays->arrays[i].element_size);
+
+         dst += __GLX_PAD(arrays->arrays[i].element_size);
+      }
+   }
+
+   return dst;
+}
+
+
+struct array_state *
+get_array_entry(const struct array_state_vector *arrays,
+                GLenum key, unsigned index)
+{
+   unsigned i;
+
+   for (i = 0; i < arrays->num_arrays; i++) {
+      if ((arrays->arrays[i].key == key)
+          && (arrays->arrays[i].index == index)) {
+         return &arrays->arrays[i];
+      }
+   }
+
+   return NULL;
+}
+
+
+static GLboolean
+allocate_array_info_cache(struct array_state_vector *arrays,
+                          size_t required_size)
+{
+#define MAX_HEADER_SIZE 20
+   if (arrays->array_info_cache_buffer_size < required_size) {
+      GLubyte *temp = realloc(arrays->array_info_cache_base,
+                              required_size + MAX_HEADER_SIZE);
+
+      if (temp == NULL) {
+         return GL_FALSE;
+      }
+
+      arrays->array_info_cache_base = temp;
+      arrays->array_info_cache = temp + MAX_HEADER_SIZE;
+      arrays->array_info_cache_buffer_size = required_size;
+   }
+
+   arrays->array_info_cache_size = required_size;
+   return GL_TRUE;
+}
+
+
+/**
+ */
+void
+fill_array_info_cache(struct array_state_vector *arrays)
+{
+   GLboolean old_DrawArrays_possible;
+   unsigned i;
+
+
+   /* Determine how many arrays are enabled.
+    */
+
+   arrays->enabled_client_array_count = 0;
+   old_DrawArrays_possible = arrays->old_DrawArrays_possible;
+   for (i = 0; i < arrays->num_arrays; i++) {
+      if (arrays->arrays[i].enabled) {
+         arrays->enabled_client_array_count++;
+         old_DrawArrays_possible &= arrays->arrays[i].old_DrawArrays_possible;
+      }
+   }
+
+   if (arrays->new_DrawArrays_possible) {
+      assert(!arrays->new_DrawArrays_possible);
+   }
+   else if (old_DrawArrays_possible) {
+      const size_t required_size = arrays->enabled_client_array_count * 12;
+      uint32_t *info;
+
+
+      if (!allocate_array_info_cache(arrays, required_size)) {
+         return;
+      }
+
+
+      info = (uint32_t *) arrays->array_info_cache;
+      for (i = 0; i < arrays->num_arrays; i++) {
+         if (arrays->arrays[i].enabled) {
+            *(info++) = arrays->arrays[i].data_type;
+            *(info++) = arrays->arrays[i].count;
+            *(info++) = arrays->arrays[i].key;
+         }
+      }
+
+      arrays->DrawArrays = emit_DrawArrays_old;
+      arrays->DrawElements = emit_DrawElements_old;
+   }
+   else {
+      arrays->DrawArrays = emit_DrawArrays_none;
+      arrays->DrawElements = emit_DrawElements_none;
+   }
+
+   arrays->array_info_cache_valid = GL_TRUE;
+}
+
+
+/**
+ * Emit a \c glDrawArrays command using the "none" protocol.  That is,
+ * emit immediate-mode commands that are equivalent to the requiested
+ * \c glDrawArrays command.  This is used with servers that don't support
+ * the OpenGL 1.1 / EXT_vertex_arrays DrawArrays protocol or in cases where
+ * vertex state is enabled that is not compatible with that protocol.
+ */
+void
+emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+   size_t single_vertex_size;
+   GLubyte *pc;
+   unsigned i;
+   static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
+   static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
+
+
+   single_vertex_size = calculate_single_vertex_size_none(arrays);
+
+   pc = gc->pc;
+
+   (void) memcpy(pc, begin_cmd, 4);
+   *(int *) (pc + 4) = mode;
+
+   pc += 8;
+
+   for (i = 0; i < count; i++) {
+      if ((pc + single_vertex_size) >= gc->bufEnd) {
+         pc = __glXFlushRenderBuffer(gc, pc);
+      }
+
+      pc = emit_element_none(pc, arrays, first + i);
+   }
+
+   if ((pc + 4) >= gc->bufEnd) {
+      pc = __glXFlushRenderBuffer(gc, pc);
+   }
+
+   (void) memcpy(pc, end_cmd, 4);
+   pc += 4;
+
+   gc->pc = pc;
+   if (gc->pc > gc->limit) {
+      (void) __glXFlushRenderBuffer(gc, gc->pc);
+   }
+}
+
+
+/**
+ * Emit the header data for the GL 1.1 / EXT_vertex_arrays DrawArrays
+ * protocol.
+ *
+ * \param gc                    GLX context.
+ * \param arrays                Array state.
+ * \param elements_per_request  Location to store the number of elements that
+ *                              can fit in a single Render / RenderLarge
+ *                              command.
+ * \param total_request         Total number of requests for a RenderLarge
+ *                              command.  If a Render command is used, this
+ *                              will be zero.
+ * \param mode                  Drawing mode.
+ * \param count                 Number of vertices.
+ *
+ * \returns
+ * A pointer to the buffer for array data.
+ */
+static GLubyte *
+emit_DrawArrays_header_old(__GLXcontext * gc,
+                           struct array_state_vector *arrays,
+                           size_t * elements_per_request,
+                           unsigned int *total_requests,
+                           GLenum mode, GLsizei count)
+{
+   size_t command_size;
+   size_t single_vertex_size;
+   const unsigned header_size = 16;
+   unsigned i;
+   GLubyte *pc;
+
+
+   /* Determine the size of the whole command.  This includes the header,
+    * the ARRAY_INFO data and the array data.  Once this size is calculated,
+    * it will be known whether a Render or RenderLarge command is needed.
+    */
+
+   single_vertex_size = 0;
+   for (i = 0; i < arrays->num_arrays; i++) {
+      if (arrays->arrays[i].enabled) {
+         single_vertex_size += __GLX_PAD(arrays->arrays[i].element_size);
+      }
+   }
+
+   command_size = arrays->array_info_cache_size + header_size
+      + (single_vertex_size * count);
+
+
+   /* Write the header for either a Render command or a RenderLarge
+    * command.  After the header is written, write the ARRAY_INFO data.
+    */
+
+   if (command_size > gc->maxSmallRenderCommandSize) {
+      /* maxSize is the maximum amount of data can be stuffed into a single
+       * packet.  sz_xGLXRenderReq is added because bufSize is the maximum
+       * packet size minus sz_xGLXRenderReq.
+       */
+      const size_t maxSize = (gc->bufSize + sz_xGLXRenderReq)
+         - sz_xGLXRenderLargeReq;
+      unsigned vertex_requests;
+
+
+      /* Calculate the number of data packets that will be required to send
+       * the whole command.  To do this, the number of verticies that
+       * will fit in a single buffer must be calculated.
+       *
+       * The important value here is elements_per_request.  This is the
+       * number of complete array elements that will fit in a single
+       * buffer.  There may be some wasted space at the end of the buffer,
+       * but splitting elements across buffer boundries would be painful.
+       */
+
+      elements_per_request[0] = maxSize / single_vertex_size;
+
+      vertex_requests = (count + elements_per_request[0] - 1)
+         / elements_per_request[0];
+
+      *total_requests = vertex_requests + 1;
+
+
+      __glXFlushRenderBuffer(gc, gc->pc);
+
+      command_size += 4;
+
+      pc = ((GLubyte *) arrays->array_info_cache) - (header_size + 4);
+      *(uint32_t *) (pc + 0) = command_size;
+      *(uint32_t *) (pc + 4) = X_GLrop_DrawArrays;
+      *(uint32_t *) (pc + 8) = count;
+      *(uint32_t *) (pc + 12) = arrays->enabled_client_array_count;
+      *(uint32_t *) (pc + 16) = mode;
+
+      __glXSendLargeChunk(gc, 1, *total_requests, pc,
+                          header_size + 4 + arrays->array_info_cache_size);
+
+      pc = gc->pc;
+   }
+   else {
+      if ((gc->pc + command_size) >= gc->bufEnd) {
+         (void) __glXFlushRenderBuffer(gc, gc->pc);
+      }
+
+      pc = gc->pc;
+      *(uint16_t *) (pc + 0) = command_size;
+      *(uint16_t *) (pc + 2) = X_GLrop_DrawArrays;
+      *(uint32_t *) (pc + 4) = count;
+      *(uint32_t *) (pc + 8) = arrays->enabled_client_array_count;
+      *(uint32_t *) (pc + 12) = mode;
+
+      pc += header_size;
+
+      (void) memcpy(pc, arrays->array_info_cache,
+                    arrays->array_info_cache_size);
+      pc += arrays->array_info_cache_size;
+
+      *elements_per_request = count;
+      *total_requests = 0;
+   }
+
+
+   return pc;
+}
+
+
+/**
+ */
+void
+emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+   GLubyte *pc;
+   size_t elements_per_request;
+   unsigned total_requests = 0;
+   unsigned i;
+   size_t total_sent = 0;
+
+
+   pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
+                                   &total_requests, mode, count);
+
+
+   /* Write the arrays.
+    */
+
+   if (total_requests == 0) {
+      assert(elements_per_request >= count);
+
+      for (i = 0; i < count; i++) {
+         pc = emit_element_old(pc, arrays, i + first);
+      }
+
+      assert(pc <= gc->bufEnd);
+
+      gc->pc = pc;
+      if (gc->pc > gc->limit) {
+         (void) __glXFlushRenderBuffer(gc, gc->pc);
+      }
+   }
+   else {
+      unsigned req;
+
+
+      for (req = 2; req <= total_requests; req++) {
+         if (count < elements_per_request) {
+            elements_per_request = count;
+         }
+
+         pc = gc->pc;
+         for (i = 0; i < elements_per_request; i++) {
+            pc = emit_element_old(pc, arrays, i + first);
+         }
+
+         first += elements_per_request;
+
+         total_sent += (size_t) (pc - gc->pc);
+         __glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
+
+         count -= elements_per_request;
+      }
+   }
+}
+
+
+void
+emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
+                       const GLvoid * indices)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
+   static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
+
+   GLubyte *pc;
+   size_t single_vertex_size;
+   unsigned i;
+
+
+   single_vertex_size = calculate_single_vertex_size_none(arrays);
+
+
+   if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
+      gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
+   }
+
+   pc = gc->pc;
+
+   (void) memcpy(pc, begin_cmd, 4);
+   *(int *) (pc + 4) = mode;
+
+   pc += 8;
+
+   for (i = 0; i < count; i++) {
+      unsigned index = 0;
+
+      if ((pc + single_vertex_size) >= gc->bufEnd) {
+         pc = __glXFlushRenderBuffer(gc, pc);
+      }
+
+      switch (type) {
+      case GL_UNSIGNED_INT:
+         index = (unsigned) (((GLuint *) indices)[i]);
+         break;
+      case GL_UNSIGNED_SHORT:
+         index = (unsigned) (((GLushort *) indices)[i]);
+         break;
+      case GL_UNSIGNED_BYTE:
+         index = (unsigned) (((GLubyte *) indices)[i]);
+         break;
+      }
+      pc = emit_element_none(pc, arrays, index);
+   }
+
+   if ((pc + 4) >= gc->bufEnd) {
+      pc = __glXFlushRenderBuffer(gc, pc);
+   }
+
+   (void) memcpy(pc, end_cmd, 4);
+   pc += 4;
+
+   gc->pc = pc;
+   if (gc->pc > gc->limit) {
+      (void) __glXFlushRenderBuffer(gc, gc->pc);
+   }
+}
+
+
+/**
+ */
+void
+emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
+                      const GLvoid * indices)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+   GLubyte *pc;
+   size_t elements_per_request;
+   unsigned total_requests = 0;
+   unsigned i;
+   unsigned req;
+   unsigned req_element = 0;
+
+
+   pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
+                                   &total_requests, mode, count);
+
+
+   /* Write the arrays.
+    */
+
+   req = 2;
+   while (count > 0) {
+      if (count < elements_per_request) {
+         elements_per_request = count;
+      }
+
+      switch (type) {
+      case GL_UNSIGNED_INT:{
+            const GLuint *ui_ptr = (const GLuint *) indices + req_element;
+
+            for (i = 0; i < elements_per_request; i++) {
+               const GLint index = (GLint) * (ui_ptr++);
+               pc = emit_element_old(pc, arrays, index);
+            }
+            break;
+         }
+      case GL_UNSIGNED_SHORT:{
+            const GLushort *us_ptr = (const GLushort *) indices + req_element;
+
+            for (i = 0; i < elements_per_request; i++) {
+               const GLint index = (GLint) * (us_ptr++);
+               pc = emit_element_old(pc, arrays, index);
+            }
+            break;
+         }
+      case GL_UNSIGNED_BYTE:{
+            const GLubyte *ub_ptr = (const GLubyte *) indices + req_element;
+
+            for (i = 0; i < elements_per_request; i++) {
+               const GLint index = (GLint) * (ub_ptr++);
+               pc = emit_element_old(pc, arrays, index);
+            }
+            break;
+         }
+      }
+
+      if (total_requests != 0) {
+         __glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
+         pc = gc->pc;
+         req++;
+      }
+
+      count -= elements_per_request;
+      req_element += elements_per_request;
+   }
+
+
+   assert((total_requests == 0) || ((req - 1) == total_requests));
+
+   if (total_requests == 0) {
+      assert(pc <= gc->bufEnd);
+
+      gc->pc = pc;
+      if (gc->pc > gc->limit) {
+         (void) __glXFlushRenderBuffer(gc, gc->pc);
+      }
+   }
+}
+
+
+/**
+ * Validate that the \c mode parameter to \c glDrawArrays, et. al. is valid.
+ * If it is not valid, then an error code is set in the GLX context.
+ *
+ * \returns
+ * \c GL_TRUE if the argument is valid, \c GL_FALSE if is not.
+ */
+static GLboolean
+validate_mode(__GLXcontext * gc, GLenum mode)
+{
+   switch (mode) {
+   case GL_POINTS:
+   case GL_LINE_STRIP:
+   case GL_LINE_LOOP:
+   case GL_LINES:
+   case GL_TRIANGLE_STRIP:
+   case GL_TRIANGLE_FAN:
+   case GL_TRIANGLES:
+   case GL_QUAD_STRIP:
+   case GL_QUADS:
+   case GL_POLYGON:
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return GL_FALSE;
+   }
+
+   return GL_TRUE;
+}
+
+
+/**
+ * Validate that the \c count parameter to \c glDrawArrays, et. al. is valid.
+ * A value less than zero is invalid and will result in \c GL_INVALID_VALUE
+ * being set.  A value of zero will not result in an error being set, but
+ * will result in \c GL_FALSE being returned.
+ *
+ * \returns
+ * \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
+ */
+static GLboolean
+validate_count(__GLXcontext * gc, GLsizei count)
+{
+   if (count < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+   }
+
+   return (count > 0);
+}
+
+
+/**
+ * Validate that the \c type parameter to \c glDrawElements, et. al. is
+ * valid.  Only \c GL_UNSIGNED_BYTE, \c GL_UNSIGNED_SHORT, and
+ * \c GL_UNSIGNED_INT are valid.
+ *
+ * \returns
+ * \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
+ */
+static GLboolean
+validate_type(__GLXcontext * gc, GLenum type)
+{
+   switch (type) {
+   case GL_UNSIGNED_INT:
+   case GL_UNSIGNED_SHORT:
+   case GL_UNSIGNED_BYTE:
+      return GL_TRUE;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+
+   if (validate_mode(gc, mode) && validate_count(gc, count)) {
+      if (!arrays->array_info_cache_valid) {
+         fill_array_info_cache(arrays);
+      }
+
+      arrays->DrawArrays(mode, first, count);
+   }
+}
+
+
+void
+__indirect_glArrayElement(GLint index)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+   size_t single_vertex_size;
+
+
+   single_vertex_size = calculate_single_vertex_size_none(arrays);
+
+   if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
+      gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
+   }
+
+   gc->pc = emit_element_none(gc->pc, arrays, index);
+
+   if (gc->pc > gc->limit) {
+      (void) __glXFlushRenderBuffer(gc, gc->pc);
+   }
+}
+
+
+void
+__indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type,
+                          const GLvoid * indices)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+
+   if (validate_mode(gc, mode) && validate_count(gc, count)
+       && validate_type(gc, type)) {
+      if (!arrays->array_info_cache_valid) {
+         fill_array_info_cache(arrays);
+      }
+
+      arrays->DrawElements(mode, count, type, indices);
+   }
+}
+
+
+void
+__indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
+                               GLsizei count, GLenum type,
+                               const GLvoid * indices)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+
+
+   if (validate_mode(gc, mode) && validate_count(gc, count)
+       && validate_type(gc, type)) {
+      if (end < start) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+
+      if (!arrays->array_info_cache_valid) {
+         fill_array_info_cache(arrays);
+      }
+
+      arrays->DrawElements(mode, count, type, indices);
+   }
+}
+
+
+void
+__indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count,
+                                GLsizei primcount)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   GLsizei i;
+
+
+   if (validate_mode(gc, mode)) {
+      if (!arrays->array_info_cache_valid) {
+         fill_array_info_cache(arrays);
+      }
+
+      for (i = 0; i < primcount; i++) {
+         if (validate_count(gc, count[i])) {
+            arrays->DrawArrays(mode, first[i], count[i]);
+         }
+      }
+   }
+}
+
+
+void
+__indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count,
+                                  GLenum type, const GLvoid ** indices,
+                                  GLsizei primcount)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   const __GLXattribute *state =
+      (const __GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   GLsizei i;
+
+
+   if (validate_mode(gc, mode) && validate_type(gc, type)) {
+      if (!arrays->array_info_cache_valid) {
+         fill_array_info_cache(arrays);
+      }
+
+      for (i = 0; i < primcount; i++) {
+         if (validate_count(gc, count[i])) {
+            arrays->DrawElements(mode, count[i], type, indices[i]);
+         }
+      }
+   }
+}
+
+
+#define COMMON_ARRAY_DATA_INIT(a, PTR, TYPE, STRIDE, COUNT, NORMALIZED, HDR_SIZE, OPCODE) \
+  do {                                                                  \
+    (a)->data = PTR;                                                    \
+    (a)->data_type = TYPE;                                              \
+    (a)->user_stride = STRIDE;                                          \
+    (a)->count = COUNT;                                                 \
+    (a)->normalized = NORMALIZED;                                       \
+                                                                        \
+    (a)->element_size = __glXTypeSize( TYPE ) * COUNT;                  \
+    (a)->true_stride = (STRIDE == 0)                                    \
+      ? (a)->element_size : STRIDE;                                     \
+                                                                        \
+    (a)->header_size = HDR_SIZE;                                        \
+    ((uint16_t *) (a)->header)[0] = __GLX_PAD((a)->header_size + (a)->element_size); \
+    ((uint16_t *) (a)->header)[1] = OPCODE;                             \
+  } while(0)
+
+
+void
+__indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride,
+                           const GLvoid * pointer)
+{
+   static const uint16_t short_ops[5] = {
+      0, 0, X_GLrop_Vertex2sv, X_GLrop_Vertex3sv, X_GLrop_Vertex4sv
+   };
+   static const uint16_t int_ops[5] = {
+      0, 0, X_GLrop_Vertex2iv, X_GLrop_Vertex3iv, X_GLrop_Vertex4iv
+   };
+   static const uint16_t float_ops[5] = {
+      0, 0, X_GLrop_Vertex2fv, X_GLrop_Vertex3fv, X_GLrop_Vertex4fv
+   };
+   static const uint16_t double_ops[5] = {
+      0, 0, X_GLrop_Vertex2dv, X_GLrop_Vertex3dv, X_GLrop_Vertex4dv
+   };
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   if (size < 2 || size > 4 || stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   switch (type) {
+   case GL_SHORT:
+      opcode = short_ops[size];
+      break;
+   case GL_INT:
+      opcode = int_ops[size];
+      break;
+   case GL_FLOAT:
+      opcode = float_ops[size];
+      break;
+   case GL_DOUBLE:
+      opcode = double_ops[size];
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   a = get_array_entry(arrays, GL_VERTEX_ARRAY, 0);
+   assert(a != NULL);
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE, 4,
+                          opcode);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glNormalPointer(GLenum type, GLsizei stride,
+                           const GLvoid * pointer)
+{
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   if (stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   switch (type) {
+   case GL_BYTE:
+      opcode = X_GLrop_Normal3bv;
+      break;
+   case GL_SHORT:
+      opcode = X_GLrop_Normal3sv;
+      break;
+   case GL_INT:
+      opcode = X_GLrop_Normal3iv;
+      break;
+   case GL_FLOAT:
+      opcode = X_GLrop_Normal3fv;
+      break;
+   case GL_DOUBLE:
+      opcode = X_GLrop_Normal3dv;
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   a = get_array_entry(arrays, GL_NORMAL_ARRAY, 0);
+   assert(a != NULL);
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 3, GL_TRUE, 4, opcode);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glColorPointer(GLint size, GLenum type, GLsizei stride,
+                          const GLvoid * pointer)
+{
+   static const uint16_t byte_ops[5] = {
+      0, 0, 0, X_GLrop_Color3bv, X_GLrop_Color4bv
+   };
+   static const uint16_t ubyte_ops[5] = {
+      0, 0, 0, X_GLrop_Color3ubv, X_GLrop_Color4ubv
+   };
+   static const uint16_t short_ops[5] = {
+      0, 0, 0, X_GLrop_Color3sv, X_GLrop_Color4sv
+   };
+   static const uint16_t ushort_ops[5] = {
+      0, 0, 0, X_GLrop_Color3usv, X_GLrop_Color4usv
+   };
+   static const uint16_t int_ops[5] = {
+      0, 0, 0, X_GLrop_Color3iv, X_GLrop_Color4iv
+   };
+   static const uint16_t uint_ops[5] = {
+      0, 0, 0, X_GLrop_Color3uiv, X_GLrop_Color4uiv
+   };
+   static const uint16_t float_ops[5] = {
+      0, 0, 0, X_GLrop_Color3fv, X_GLrop_Color4fv
+   };
+   static const uint16_t double_ops[5] = {
+      0, 0, 0, X_GLrop_Color3dv, X_GLrop_Color4dv
+   };
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   if (size < 3 || size > 4 || stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   switch (type) {
+   case GL_BYTE:
+      opcode = byte_ops[size];
+      break;
+   case GL_UNSIGNED_BYTE:
+      opcode = ubyte_ops[size];
+      break;
+   case GL_SHORT:
+      opcode = short_ops[size];
+      break;
+   case GL_UNSIGNED_SHORT:
+      opcode = ushort_ops[size];
+      break;
+   case GL_INT:
+      opcode = int_ops[size];
+      break;
+   case GL_UNSIGNED_INT:
+      opcode = uint_ops[size];
+      break;
+   case GL_FLOAT:
+      opcode = float_ops[size];
+      break;
+   case GL_DOUBLE:
+      opcode = double_ops[size];
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   a = get_array_entry(arrays, GL_COLOR_ARRAY, 0);
+   assert(a != NULL);
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   if (stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   switch (type) {
+   case GL_UNSIGNED_BYTE:
+      opcode = X_GLrop_Indexubv;
+      break;
+   case GL_SHORT:
+      opcode = X_GLrop_Indexsv;
+      break;
+   case GL_INT:
+      opcode = X_GLrop_Indexiv;
+      break;
+   case GL_FLOAT:
+      opcode = X_GLrop_Indexfv;
+      break;
+   case GL_DOUBLE:
+      opcode = X_GLrop_Indexdv;
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   a = get_array_entry(arrays, GL_INDEX_ARRAY, 0);
+   assert(a != NULL);
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid * pointer)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   if (stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+
+   a = get_array_entry(arrays, GL_EDGE_FLAG_ARRAY, 0);
+   assert(a != NULL);
+   COMMON_ARRAY_DATA_INIT(a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE,
+                          4, X_GLrop_EdgeFlagv);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
+                             const GLvoid * pointer)
+{
+   static const uint16_t short_ops[5] = {
+      0, X_GLrop_TexCoord1sv, X_GLrop_TexCoord2sv, X_GLrop_TexCoord3sv,
+      X_GLrop_TexCoord4sv
+   };
+   static const uint16_t int_ops[5] = {
+      0, X_GLrop_TexCoord1iv, X_GLrop_TexCoord2iv, X_GLrop_TexCoord3iv,
+      X_GLrop_TexCoord4iv
+   };
+   static const uint16_t float_ops[5] = {
+      0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2fv, X_GLrop_TexCoord3fv,
+      X_GLrop_TexCoord4fv
+   };
+   static const uint16_t double_ops[5] = {
+      0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2dv, X_GLrop_TexCoord3dv,
+      X_GLrop_TexCoord4dv
+   };
+
+   static const uint16_t mshort_ops[5] = {
+      0, X_GLrop_MultiTexCoord1svARB, X_GLrop_MultiTexCoord2svARB,
+      X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
+   };
+   static const uint16_t mint_ops[5] = {
+      0, X_GLrop_MultiTexCoord1ivARB, X_GLrop_MultiTexCoord2ivARB,
+      X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
+   };
+   static const uint16_t mfloat_ops[5] = {
+      0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2fvARB,
+      X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
+   };
+   static const uint16_t mdouble_ops[5] = {
+      0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2dvARB,
+      X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
+   };
+
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+   unsigned header_size;
+   unsigned index;
+
+
+   if (size < 1 || size > 4 || stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   index = arrays->active_texture_unit;
+   if (index == 0) {
+      switch (type) {
+      case GL_SHORT:
+         opcode = short_ops[size];
+         break;
+      case GL_INT:
+         opcode = int_ops[size];
+         break;
+      case GL_FLOAT:
+         opcode = float_ops[size];
+         break;
+      case GL_DOUBLE:
+         opcode = double_ops[size];
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_ENUM);
+         return;
+      }
+
+      header_size = 4;
+   }
+   else {
+      switch (type) {
+      case GL_SHORT:
+         opcode = mshort_ops[size];
+         break;
+      case GL_INT:
+         opcode = mint_ops[size];
+         break;
+      case GL_FLOAT:
+         opcode = mfloat_ops[size];
+         break;
+      case GL_DOUBLE:
+         opcode = mdouble_ops[size];
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_ENUM);
+         return;
+      }
+
+      header_size = 8;
+   }
+
+   a = get_array_entry(arrays, GL_TEXTURE_COORD_ARRAY, index);
+   assert(a != NULL);
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE,
+                          header_size, opcode);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride,
+                                      const GLvoid * pointer)
+{
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   if (size != 3 || stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   switch (type) {
+   case GL_BYTE:
+      opcode = 4126;
+      break;
+   case GL_UNSIGNED_BYTE:
+      opcode = 4131;
+      break;
+   case GL_SHORT:
+      opcode = 4127;
+      break;
+   case GL_UNSIGNED_SHORT:
+      opcode = 4132;
+      break;
+   case GL_INT:
+      opcode = 4128;
+      break;
+   case GL_UNSIGNED_INT:
+      opcode = 4133;
+      break;
+   case GL_FLOAT:
+      opcode = 4129;
+      break;
+   case GL_DOUBLE:
+      opcode = 4130;
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   a = get_array_entry(arrays, GL_SECONDARY_COLOR_ARRAY, 0);
+   if (a == NULL) {
+      __glXSetError(gc, GL_INVALID_OPERATION);
+      return;
+   }
+
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride,
+                                const GLvoid * pointer)
+{
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   if (stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   switch (type) {
+   case GL_FLOAT:
+      opcode = 4124;
+      break;
+   case GL_DOUBLE:
+      opcode = 4125;
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   a = get_array_entry(arrays, GL_FOG_COORD_ARRAY, 0);
+   if (a == NULL) {
+      __glXSetError(gc, GL_INVALID_OPERATION);
+      return;
+   }
+
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+void
+__indirect_glVertexAttribPointerARB(GLuint index, GLint size,
+                                    GLenum type, GLboolean normalized,
+                                    GLsizei stride, const GLvoid * pointer)
+{
+   static const uint16_t short_ops[5] = { 0, 4189, 4190, 4191, 4192 };
+   static const uint16_t float_ops[5] = { 0, 4193, 4194, 4195, 4196 };
+   static const uint16_t double_ops[5] = { 0, 4197, 4198, 4199, 4200 };
+
+   uint16_t opcode;
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+   unsigned true_immediate_count;
+   unsigned true_immediate_size;
+
+
+   if ((size < 1) || (size > 4) || (stride < 0)
+       || (index > arrays->num_vertex_program_attribs)) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+   if (normalized && (type != GL_FLOAT) && (type != GL_DOUBLE)) {
+      switch (type) {
+      case GL_BYTE:
+         opcode = X_GLrop_VertexAttrib4NbvARB;
+         break;
+      case GL_UNSIGNED_BYTE:
+         opcode = X_GLrop_VertexAttrib4NubvARB;
+         break;
+      case GL_SHORT:
+         opcode = X_GLrop_VertexAttrib4NsvARB;
+         break;
+      case GL_UNSIGNED_SHORT:
+         opcode = X_GLrop_VertexAttrib4NusvARB;
+         break;
+      case GL_INT:
+         opcode = X_GLrop_VertexAttrib4NivARB;
+         break;
+      case GL_UNSIGNED_INT:
+         opcode = X_GLrop_VertexAttrib4NuivARB;
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_ENUM);
+         return;
+      }
+
+      true_immediate_count = 4;
+   }
+   else {
+      true_immediate_count = size;
+
+      switch (type) {
+      case GL_BYTE:
+         opcode = X_GLrop_VertexAttrib4bvARB;
+         true_immediate_count = 4;
+         break;
+      case GL_UNSIGNED_BYTE:
+         opcode = X_GLrop_VertexAttrib4ubvARB;
+         true_immediate_count = 4;
+         break;
+      case GL_SHORT:
+         opcode = short_ops[size];
+         break;
+      case GL_UNSIGNED_SHORT:
+         opcode = X_GLrop_VertexAttrib4usvARB;
+         true_immediate_count = 4;
+         break;
+      case GL_INT:
+         opcode = X_GLrop_VertexAttrib4ivARB;
+         true_immediate_count = 4;
+         break;
+      case GL_UNSIGNED_INT:
+         opcode = X_GLrop_VertexAttrib4uivARB;
+         true_immediate_count = 4;
+         break;
+      case GL_FLOAT:
+         opcode = float_ops[size];
+         break;
+      case GL_DOUBLE:
+         opcode = double_ops[size];
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_ENUM);
+         return;
+      }
+   }
+
+   a = get_array_entry(arrays, GL_VERTEX_ATTRIB_ARRAY_POINTER, index);
+   if (a == NULL) {
+      __glXSetError(gc, GL_INVALID_OPERATION);
+      return;
+   }
+
+   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, normalized, 8,
+                          opcode);
+
+   true_immediate_size = __glXTypeSize(type) * true_immediate_count;
+   ((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size
+                                             + true_immediate_size);
+
+   if (a->enabled) {
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+}
+
+
+/**
+ * I don't have 100% confidence that this is correct.  The different rules
+ * about whether or not generic vertex attributes alias "classic" vertex
+ * attributes (i.e., attrib1 ?= primary color) between ARB_vertex_program,
+ * ARB_vertex_shader, and NV_vertex_program are a bit confusing.  My
+ * feeling is that the client-side doesn't have to worry about it.  The
+ * client just sends all the data to the server and lets the server deal
+ * with it.
+ */
+void
+__indirect_glVertexAttribPointerNV(GLuint index, GLint size,
+                                   GLenum type, GLsizei stride,
+                                   const GLvoid * pointer)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   GLboolean normalized = GL_FALSE;
+
+
+   switch (type) {
+   case GL_UNSIGNED_BYTE:
+      if (size != 4) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      normalized = GL_TRUE;
+
+   case GL_SHORT:
+   case GL_FLOAT:
+   case GL_DOUBLE:
+      __indirect_glVertexAttribPointerARB(index, size, type,
+                                          normalized, stride, pointer);
+      return;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+}
+
+
+void
+__indirect_glClientActiveTextureARB(GLenum texture)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+   __GLXattribute *const state =
+      (__GLXattribute *) (gc->client_state_private);
+   struct array_state_vector *const arrays = state->array_state;
+   const GLint unit = (GLint) texture - GL_TEXTURE0;
+
+
+   if ((unit < 0) || (unit >= arrays->num_texture_units)) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   arrays->active_texture_unit = unit;
+}
+
+
+/**
+ * Modify the enable state for the selected array
+ */
+GLboolean
+__glXSetArrayEnable(__GLXattribute * state, GLenum key, unsigned index,
+                    GLboolean enable)
+{
+   struct array_state_vector *arrays = state->array_state;
+   struct array_state *a;
+
+
+   /* Texture coordinate arrays have an implict index set when the
+    * application calls glClientActiveTexture.
+    */
+   if (key == GL_TEXTURE_COORD_ARRAY) {
+      index = arrays->active_texture_unit;
+   }
+
+   a = get_array_entry(arrays, key, index);
+
+   if ((a != NULL) && (a->enabled != enable)) {
+      a->enabled = enable;
+      arrays->array_info_cache_valid = GL_FALSE;
+   }
+
+   return (a != NULL);
+}
+
+
+void
+__glXArrayDisableAll(__GLXattribute * state)
+{
+   struct array_state_vector *arrays = state->array_state;
+   unsigned i;
+
+
+   for (i = 0; i < arrays->num_arrays; i++) {
+      arrays->arrays[i].enabled = GL_FALSE;
+   }
+
+   arrays->array_info_cache_valid = GL_FALSE;
+}
+
+
+/**
+ */
+GLboolean
+__glXGetArrayEnable(const __GLXattribute * const state,
+                    GLenum key, unsigned index, GLintptr * dest)
+{
+   const struct array_state_vector *arrays = state->array_state;
+   const struct array_state *a =
+      get_array_entry((struct array_state_vector *) arrays,
+                      key, index);
+
+   if (a != NULL) {
+      *dest = (GLintptr) a->enabled;
+   }
+
+   return (a != NULL);
+}
+
+
+/**
+ */
+GLboolean
+__glXGetArrayType(const __GLXattribute * const state,
+                  GLenum key, unsigned index, GLintptr * dest)
+{
+   const struct array_state_vector *arrays = state->array_state;
+   const struct array_state *a =
+      get_array_entry((struct array_state_vector *) arrays,
+                      key, index);
+
+   if (a != NULL) {
+      *dest = (GLintptr) a->data_type;
+   }
+
+   return (a != NULL);
+}
+
+
+/**
+ */
+GLboolean
+__glXGetArraySize(const __GLXattribute * const state,
+                  GLenum key, unsigned index, GLintptr * dest)
+{
+   const struct array_state_vector *arrays = state->array_state;
+   const struct array_state *a =
+      get_array_entry((struct array_state_vector *) arrays,
+                      key, index);
+
+   if (a != NULL) {
+      *dest = (GLintptr) a->count;
+   }
+
+   return (a != NULL);
+}
+
+
+/**
+ */
+GLboolean
+__glXGetArrayStride(const __GLXattribute * const state,
+                    GLenum key, unsigned index, GLintptr * dest)
+{
+   const struct array_state_vector *arrays = state->array_state;
+   const struct array_state *a =
+      get_array_entry((struct array_state_vector *) arrays,
+                      key, index);
+
+   if (a != NULL) {
+      *dest = (GLintptr) a->user_stride;
+   }
+
+   return (a != NULL);
+}
+
+
+/**
+ */
+GLboolean
+__glXGetArrayPointer(const __GLXattribute * const state,
+                     GLenum key, unsigned index, void **dest)
+{
+   const struct array_state_vector *arrays = state->array_state;
+   const struct array_state *a =
+      get_array_entry((struct array_state_vector *) arrays,
+                      key, index);
+
+
+   if (a != NULL) {
+      *dest = (void *) (a->data);
+   }
+
+   return (a != NULL);
+}
+
+
+/**
+ */
+GLboolean
+__glXGetArrayNormalized(const __GLXattribute * const state,
+                        GLenum key, unsigned index, GLintptr * dest)
+{
+   const struct array_state_vector *arrays = state->array_state;
+   const struct array_state *a =
+      get_array_entry((struct array_state_vector *) arrays,
+                      key, index);
+
+
+   if (a != NULL) {
+      *dest = (GLintptr) a->normalized;
+   }
+
+   return (a != NULL);
+}
+
+
+/**
+ */
+GLuint
+__glXGetActiveTextureUnit(const __GLXattribute * const state)
+{
+   return state->array_state->active_texture_unit;
+}
+
+
+void
+__glXPushArrayState(__GLXattribute * state)
+{
+   struct array_state_vector *arrays = state->array_state;
+   struct array_stack_state *stack =
+      &arrays->stack[(arrays->stack_index * arrays->num_arrays)];
+   unsigned i;
+
+   /* XXX are we pushing _all_ the necessary fields? */
+   for (i = 0; i < arrays->num_arrays; i++) {
+      stack[i].data = arrays->arrays[i].data;
+      stack[i].data_type = arrays->arrays[i].data_type;
+      stack[i].user_stride = arrays->arrays[i].user_stride;
+      stack[i].count = arrays->arrays[i].count;
+      stack[i].key = arrays->arrays[i].key;
+      stack[i].index = arrays->arrays[i].index;
+      stack[i].enabled = arrays->arrays[i].enabled;
+   }
+
+   arrays->active_texture_unit_stack[arrays->stack_index] =
+      arrays->active_texture_unit;
+
+   arrays->stack_index++;
+}
+
+
+void
+__glXPopArrayState(__GLXattribute * state)
+{
+   struct array_state_vector *arrays = state->array_state;
+   struct array_stack_state *stack;
+   unsigned i;
+
+
+   arrays->stack_index--;
+   stack = &arrays->stack[(arrays->stack_index * arrays->num_arrays)];
+
+   for (i = 0; i < arrays->num_arrays; i++) {
+      switch (stack[i].key) {
+      case GL_NORMAL_ARRAY:
+         __indirect_glNormalPointer(stack[i].data_type,
+                                    stack[i].user_stride, stack[i].data);
+         break;
+      case GL_COLOR_ARRAY:
+         __indirect_glColorPointer(stack[i].count,
+                                   stack[i].data_type,
+                                   stack[i].user_stride, stack[i].data);
+         break;
+      case GL_INDEX_ARRAY:
+         __indirect_glIndexPointer(stack[i].data_type,
+                                   stack[i].user_stride, stack[i].data);
+         break;
+      case GL_EDGE_FLAG_ARRAY:
+         __indirect_glEdgeFlagPointer(stack[i].user_stride, stack[i].data);
+         break;
+      case GL_TEXTURE_COORD_ARRAY:
+         arrays->active_texture_unit = stack[i].index;
+         __indirect_glTexCoordPointer(stack[i].count,
+                                      stack[i].data_type,
+                                      stack[i].user_stride, stack[i].data);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY:
+         __indirect_glSecondaryColorPointerEXT(stack[i].count,
+                                               stack[i].data_type,
+                                               stack[i].user_stride,
+                                               stack[i].data);
+         break;
+      case GL_FOG_COORDINATE_ARRAY:
+         __indirect_glFogCoordPointerEXT(stack[i].data_type,
+                                         stack[i].user_stride, stack[i].data);
+         break;
+
+      }
+
+      __glXSetArrayEnable(state, stack[i].key, stack[i].index,
+                          stack[i].enabled);
+   }
+
+   arrays->active_texture_unit =
+      arrays->active_texture_unit_stack[arrays->stack_index];
+}
diff --git a/src/glx/indirect_vertex_array.h b/src/glx/indirect_vertex_array.h
new file mode 100644 (file)
index 0000000..3738032
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright IBM Corporation 2004, 2005
+ * 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
+ * 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.
+ */
+
+#ifndef INDIRECT_VERTEX_ARRAY_H
+#define INDIRECT_VERTEX_ARRAY_H
+
+extern const GLuint __glXTypeSize_table[16];
+
+#define __glXTypeSize(e) ((((e) & ~0x0f) != 0x1400) \
+    ? 0 : __glXTypeSize_table[ (e) & 0x0f ])
+
+extern void __glXArrayDisableAll(__GLXattribute * state);
+
+extern GLboolean __glXSetArrayEnable(__GLXattribute * state,
+                                     GLenum key, unsigned index,
+                                     GLboolean enable);
+
+extern GLboolean __glXGetArrayEnable(const __GLXattribute * const state,
+                                     GLenum key, unsigned index,
+                                     GLintptr * dest);
+extern GLboolean __glXGetArraySize(const __GLXattribute * const state,
+                                   GLenum key, unsigned index,
+                                   GLintptr * dest);
+extern GLboolean __glXGetArrayType(const __GLXattribute * const state,
+                                   GLenum key, unsigned index,
+                                   GLintptr * dest);
+extern GLboolean __glXGetArrayStride(const __GLXattribute * const state,
+                                     GLenum key, unsigned index,
+                                     GLintptr * dest);
+extern GLboolean __glXGetArrayPointer(const __GLXattribute * const state,
+                                      GLenum key, unsigned index,
+                                      void **dest);
+extern GLboolean __glXGetArrayNormalized(const __GLXattribute * const state,
+                                         GLenum key, unsigned index,
+                                         GLintptr * dest);
+
+extern void __glXPushArrayState(__GLXattribute * state);
+extern void __glXPopArrayState(__GLXattribute * state);
+
+extern GLuint __glXGetActiveTextureUnit(const __GLXattribute * const state);
+
+#endif /* INDIRECT_VERTEX_ARRAY_H */
diff --git a/src/glx/indirect_vertex_array_priv.h b/src/glx/indirect_vertex_array_priv.h
new file mode 100644 (file)
index 0000000..56dac37
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * (C) Copyright IBM Corporation 2004, 2005
+ * 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
+ * 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.
+ */
+
+#ifndef _INDIRECT_VA_PRIVATE_
+#define _INDIRECT_VA_PRIVATE_
+
+/**
+ * \file indirect_va_private.h
+ *
+ * \author Ian Romanick <idr@us.ibm.com>
+ */
+
+#include <inttypes.h>
+
+#include "glxclient.h"
+#include "indirect.h"
+#include <GL/glxproto.h>
+
+
+/**
+ * State descriptor for a single array of vertex data.
+ */
+struct array_state
+{
+    /**
+     * Pointer to the application supplied data.
+     */
+   const void *data;
+
+    /**
+     * Enum representing the type of the application supplied data.
+     */
+   GLenum data_type;
+
+    /**
+     * Stride value supplied by the application.  This value is not used
+     * internally.  It is only kept so that it can be queried by the
+     * application using glGet*v.
+     */
+   GLsizei user_stride;
+
+    /**
+     * Calculated size, in bytes, of a single element in the array.  This
+     * is calculated based on \c count and the size of the data type
+     * represented by \c data_type.
+     */
+   GLsizei element_size;
+
+    /**
+     * Actual byte-stride from one element to the next.  This value will
+     * be equal to either \c user_stride or \c element_stride.
+     */
+   GLsizei true_stride;
+
+    /**
+     * Number of data values in each element.
+     */
+   GLint count;
+
+    /**
+     * "Normalized" data is on the range [0,1] (unsigned) or [-1,1] (signed).
+     * This is used for mapping integral types to floating point types.
+     */
+   GLboolean normalized;
+
+    /**
+     * Pre-calculated GLX protocol command header.
+     */
+   uint32_t header[2];
+
+    /**
+     * Size of the header data.  For simple data, like glColorPointerfv,
+     * this is 4.  For complex data that requires either a count (e.g.,
+     * glWeightfvARB), an index (e.g., glVertexAttrib1fvARB), or a
+     * selector enum (e.g., glMultiTexCoord2fv) this is 8.
+     */
+   unsigned header_size;
+
+    /**
+     * Set to \c GL_TRUE if this array is enabled.  Otherwise, it is set
+     * to \c GL_FALSE.
+     */
+   GLboolean enabled;
+
+    /**
+     * For multi-arrayed data (e.g., texture coordinates, generic vertex
+     * program attributes, etc.), this specifies which array this is.
+     */
+   unsigned index;
+
+    /**
+     * Per-array-type key.  For most arrays, this will be the GL enum for
+     * that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY
+     * for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
+     * etc.).
+     */
+   GLenum key;
+
+    /**
+     * If this array can be used with the "classic" \c glDrawArrays protocol,
+     * this is set to \c GL_TRUE.  Otherwise, it is set to \c GL_FALSE.
+     */
+   GLboolean old_DrawArrays_possible;
+};
+
+
+/**
+ * Array state that is pushed / poped by \c glPushClientAttrib and
+ * \c glPopClientAttrib.
+ */
+struct array_stack_state
+{
+    /**
+     * Pointer to the application supplied data.
+     */
+   const void *data;
+
+    /**
+     * Enum representing the type of the application supplied data.
+     */
+   GLenum data_type;
+
+    /**
+     * Stride value supplied by the application.  This value is not used
+     * internally.  It is only kept so that it can be queried by the
+     * application using glGet*v.
+     */
+   GLsizei user_stride;
+
+    /**
+     * Number of data values in each element.
+     */
+   GLint count;
+
+    /**
+     * Per-array-type key.  For most arrays, this will be the GL enum for
+     * that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY
+     * for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
+     * etc.).
+     */
+   GLenum key;
+
+    /**
+     * For multi-arrayed data (e.g., texture coordinates, generic vertex
+     * program attributes, etc.), this specifies which array this is.
+     */
+   unsigned index;
+
+    /**
+     * Set to \c GL_TRUE if this array is enabled.  Otherwise, it is set
+     * to \c GL_FALSE.
+     */
+   GLboolean enabled;
+};
+
+
+/**
+ * Collection of all the vertex array state.
+ */
+struct array_state_vector
+{
+    /**
+     * Number of arrays tracked by \c ::arrays.
+     */
+   size_t num_arrays;
+
+    /**
+     * Array of vertex array state.  This array contains all of the valid
+     * vertex arrays.  If a vertex array isn't in this array, then it isn't
+     * valid.  For example, if an implementation does not support
+     * EXT_fog_coord, there won't be a GL_FOG_COORD_ARRAY entry in this
+     * array.
+     */
+   struct array_state *arrays;
+
+    /**
+     * Number of currently enabled client-side arrays.  The value of this 
+     * field is only valid if \c array_info_cache_valid is true.
+     */
+   size_t enabled_client_array_count;
+
+    /**
+     * \name ARRAY_INFO cache.
+     * 
+     * These fields track the state of the ARRAY_INFO cache.  The
+     * \c array_info_cache_size is the size of the actual data stored in
+     * \c array_info_cache.  \c array_info_cache_buffer_size is the size of
+     * the buffer.  This will always be greater than or equal to
+     * \c array_info_cache_size.
+     *
+     * \note
+     * There are some bytes of extra data before \c array_info_cache that is
+     * used to hold the header for RenderLarge commands.  This is
+     * \b not included in \c array_info_cache_size or
+     * \c array_info_cache_buffer_size.  \c array_info_cache_base stores a
+     * pointer to the true start of the buffer (i.e., what malloc returned).
+     */
+   /*@{ */
+   size_t array_info_cache_size;
+   size_t array_info_cache_buffer_size;
+   void *array_info_cache;
+   void *array_info_cache_base;
+   /*@} */
+
+
+    /**
+     * Is the cache of ARRAY_INFO data valid?  The cache can become invalid
+     * when one of several state changes occur.  Among these chages are
+     * modifying the array settings for an enabled array and enabling /
+     * disabling an array.
+     */
+   GLboolean array_info_cache_valid;
+
+    /**
+     * Is it possible to use the GL 1.1 / EXT_vertex_arrays protocol?  Use
+     * of this protocol is disabled with really old servers (i.e., servers
+     * that don't support GL 1.1 or EXT_vertex_arrays) or when an environment
+     * variable is set.
+     * 
+     * \todo
+     * GL 1.1 and EXT_vertex_arrays use identical protocol, but have different
+     * opcodes for \c glDrawArrays.  For servers that advertise one or the
+     * other, there should be a way to select which opcode to use.
+     */
+   GLboolean old_DrawArrays_possible;
+
+    /**
+     * Is it possible to use the new GL X.X / ARB_vertex_buffer_object
+     * protocol?
+     * 
+     * \todo
+     * This protocol has not yet been defined by the ARB, but is currently a
+     * work in progress.  This field is a place-holder.
+     */
+   GLboolean new_DrawArrays_possible;
+
+    /**
+     * Active texture unit set by \c glClientActiveTexture.
+     * 
+     * \sa __glXGetActiveTextureUnit
+     */
+   unsigned active_texture_unit;
+
+    /**
+     * Number of supported texture units.  Even if ARB_multitexture /
+     * GL 1.3 are not supported, this will be at least 1.  When multitexture
+     * is supported, this will be the value queried by calling
+     * \c glGetIntegerv with \c GL_MAX_TEXTURE_UNITS.
+     * 
+     * \todo
+     * Investigate if this should be the value of \c GL_MAX_TEXTURE_COORDS
+     * instead (if GL 2.0 / ARB_fragment_shader / ARB_fragment_program /
+     * NV_fragment_program are supported).
+     */
+   unsigned num_texture_units;
+
+    /**
+     * Number of generic vertex program attribs.  If GL_ARB_vertex_program
+     * is not supported, this will be zero.  Otherwise it will be the value
+     * queries by calling \c glGetProgramiv with \c GL_VERTEX_PROGRAM_ARB
+     * and \c GL_MAX_PROGRAM_ATTRIBS_ARB.
+     */
+   unsigned num_vertex_program_attribs;
+
+    /**
+     * \n Methods for implementing various GL functions.
+     * 
+     * These method pointers are only valid \c array_info_cache_valid is set.
+     * When each function starts, it much check \c array_info_cache_valid.
+     * If it is not set, it must call \c fill_array_info_cache and call
+     * the new method.
+     * 
+     * \sa fill_array_info_cache
+     * 
+     * \todo
+     * Write code to plug these functions directly into the dispatch table.
+     */
+   /*@{ */
+   void (*DrawArrays) (GLenum, GLint, GLsizei);
+   void (*DrawElements) (GLenum mode, GLsizei count, GLenum type,
+                         const GLvoid * indices);
+   /*@} */
+
+   struct array_stack_state *stack;
+   unsigned active_texture_unit_stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
+   unsigned stack_index;
+};
+
+#endif /* _INDIRECT_VA_PRIVATE_ */
diff --git a/src/glx/indirect_vertex_program.c b/src/glx/indirect_vertex_program.c
new file mode 100644 (file)
index 0000000..3313ac0
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * (C) Copyright IBM Corporation 2005
+ * 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
+ * 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.
+ */
+
+#include <inttypes.h>
+#include <GL/gl.h>
+#include "indirect.h"
+#include "glxclient.h"
+#include "indirect_vertex_array.h"
+#include <GL/glxproto.h>
+
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
+static void
+do_vertex_attrib_enable(GLuint index, GLboolean val)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+
+   if (!__glXSetArrayEnable(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
+                            index, val)) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+   }
+}
+
+
+void
+__indirect_glEnableVertexAttribArrayARB(GLuint index)
+{
+   do_vertex_attrib_enable(index, GL_TRUE);
+}
+
+
+void
+__indirect_glDisableVertexAttribArrayARB(GLuint index)
+{
+   do_vertex_attrib_enable(index, GL_FALSE);
+}
+
+
+static void
+get_parameter(unsigned opcode, unsigned size, GLenum target, GLuint index,
+              void *params)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+   Display *const dpy = gc->currentDpy;
+   const GLuint cmdlen = 12;
+
+   if (__builtin_expect(dpy != NULL, 1)) {
+      GLubyte const *pc = __glXSetupVendorRequest(gc,
+                                                  X_GLXVendorPrivateWithReply,
+                                                  opcode, cmdlen);
+
+      *((GLenum *) (pc + 0)) = target;
+      *((GLuint *) (pc + 4)) = index;
+      *((GLuint *) (pc + 8)) = 0;
+
+      (void) __glXReadReply(dpy, size, params, GL_FALSE);
+      UnlockDisplay(dpy);
+      SyncHandle();
+   }
+   return;
+}
+
+
+void
+__indirect_glGetProgramEnvParameterfvARB(GLenum target, GLuint index,
+                                         GLfloat * params)
+{
+   get_parameter(1296, 4, target, index, params);
+}
+
+
+void
+__indirect_glGetProgramEnvParameterdvARB(GLenum target, GLuint index,
+                                         GLdouble * params)
+{
+   get_parameter(1297, 8, target, index, params);
+}
+
+
+void
+__indirect_glGetProgramLocalParameterfvARB(GLenum target, GLuint index,
+                                           GLfloat * params)
+{
+   get_parameter(1305, 4, target, index, params);
+}
+
+
+void
+__indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index,
+                                           GLdouble * params)
+{
+   get_parameter(1306, 8, target, index, params);
+}
+
+
+void
+__indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname,
+                                       GLvoid ** pointer)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+
+   if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+   }
+
+   if (!__glXGetArrayPointer(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
+                             index, pointer)) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+   }
+}
+
+
+/**
+ * Get the selected attribute from the vertex array state vector.
+ * 
+ * \returns
+ * On success \c GL_TRUE is returned.  Otherwise, \c GL_FALSE is returned.
+ */
+static GLboolean
+get_attrib_array_data(__GLXattribute * state, GLuint index, GLenum cap,
+                      GLintptr * data)
+{
+   GLboolean retval = GL_FALSE;
+   const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;
+
+   switch (cap) {
+   case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
+      retval = __glXGetArrayEnable(state, attrib, index, data);
+      break;
+
+   case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
+      retval = __glXGetArraySize(state, attrib, index, data);
+      break;
+
+   case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
+      retval = __glXGetArrayStride(state, attrib, index, data);
+      break;
+
+   case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
+      retval = __glXGetArrayType(state, attrib, index, data);
+      break;
+
+   case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
+      retval = __glXGetArrayNormalized(state, attrib, index, data);
+      break;
+   }
+
+
+   return retval;
+}
+
+
+static void
+get_vertex_attrib(__GLXcontext * gc, unsigned vop,
+                  GLuint index, GLenum pname, xReply * reply)
+{
+   Display *const dpy = gc->currentDpy;
+   GLubyte *const pc = __glXSetupVendorRequest(gc,
+                                               X_GLXVendorPrivateWithReply,
+                                               vop, 8);
+
+   *((uint32_t *) (pc + 0)) = index;
+   *((uint32_t *) (pc + 4)) = pname;
+
+   (void) _XReply(dpy, reply, 0, False);
+}
+
+
+void
+__indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+   Display *const dpy = gc->currentDpy;
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   xGLXSingleReply reply;
+
+
+   get_vertex_attrib(gc, 1303, index, pname, (xReply *) & reply);
+
+   if (reply.size != 0) {
+      GLintptr data;
+
+
+      if (get_attrib_array_data(state, index, pname, &data)) {
+         *params = (GLint) data;
+      }
+      else {
+         if (reply.size == 1) {
+            *params = (GLint) reply.pad3;
+         }
+         else {
+            _XRead(dpy, (void *) params, 4 * reply.size);
+         }
+      }
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+
+void
+__indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname,
+                                  GLfloat * params)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+   Display *const dpy = gc->currentDpy;
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   xGLXSingleReply reply;
+
+
+   get_vertex_attrib(gc, 1302, index, pname, (xReply *) & reply);
+
+   if (reply.size != 0) {
+      GLintptr data;
+
+
+      if (get_attrib_array_data(state, index, pname, &data)) {
+         *params = (GLfloat) data;
+      }
+      else {
+         if (reply.size == 1) {
+            (void) memcpy(params, &reply.pad3, sizeof(GLfloat));
+         }
+         else {
+            _XRead(dpy, (void *) params, 4 * reply.size);
+         }
+      }
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
+
+
+void
+__indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname,
+                                  GLdouble * params)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+   Display *const dpy = gc->currentDpy;
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   xGLXSingleReply reply;
+
+
+   get_vertex_attrib(gc, 1301, index, pname, (xReply *) & reply);
+
+   if (reply.size != 0) {
+      GLintptr data;
+
+
+      if (get_attrib_array_data(state, index, pname, &data)) {
+         *params = (GLdouble) data;
+      }
+      else {
+         if (reply.size == 1) {
+            (void) memcpy(params, &reply.pad3, sizeof(GLdouble));
+         }
+         else {
+            _XRead(dpy, (void *) params, 8 * reply.size);
+         }
+      }
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+}
diff --git a/src/glx/indirect_window_pos.c b/src/glx/indirect_window_pos.c
new file mode 100644 (file)
index 0000000..e97be35
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * (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
+ * 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
+ * PRECISION INSIGHT, 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.
+ */
+
+#include <GL/gl.h>
+#include "indirect.h"
+
+void
+__indirect_glWindowPos2dMESA(GLdouble x, GLdouble y)
+{
+   __indirect_glWindowPos3fMESA(x, y, 0.0);
+}
+
+void
+__indirect_glWindowPos2iMESA(GLint x, GLint y)
+{
+   __indirect_glWindowPos3fMESA(x, y, 0.0);
+}
+
+void
+__indirect_glWindowPos2fMESA(GLfloat x, GLfloat y)
+{
+   __indirect_glWindowPos3fMESA(x, y, 0.0);
+}
+
+void
+__indirect_glWindowPos2sMESA(GLshort x, GLshort y)
+{
+   __indirect_glWindowPos3fMESA(x, y, 0.0);
+}
+
+void
+__indirect_glWindowPos2dvMESA(const GLdouble * p)
+{
+   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+}
+
+void
+__indirect_glWindowPos2fvMESA(const GLfloat * p)
+{
+   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+}
+
+void
+__indirect_glWindowPos2ivMESA(const GLint * p)
+{
+   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+}
+
+void
+__indirect_glWindowPos2svMESA(const GLshort * p)
+{
+   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+}
+
+void
+__indirect_glWindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
+{
+   __indirect_glWindowPos3fMESA(x, y, z);
+}
+
+void
+__indirect_glWindowPos3iMESA(GLint x, GLint y, GLint z)
+{
+   __indirect_glWindowPos3fMESA(x, y, z);
+}
+
+void
+__indirect_glWindowPos3sMESA(GLshort x, GLshort y, GLshort z)
+{
+   __indirect_glWindowPos3fMESA(x, y, z);
+}
+
+void
+__indirect_glWindowPos3dvMESA(const GLdouble * p)
+{
+   __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
+}
+
+void
+__indirect_glWindowPos3ivMESA(const GLint * p)
+{
+   __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
+}
+
+void
+__indirect_glWindowPos3svMESA(const GLshort * p)
+{
+   __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
+}
diff --git a/src/glx/mini/Makefile b/src/glx/mini/Makefile
deleted file mode 100644 (file)
index 6b5a3c7..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-# Build the MiniGLX libGL.so library.
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-
-DEFINES += -DGLX_DIRECT_RENDERING -DIN_MINI_GLX -UIN_DRI_DRIVER
-
-C_SOURCES = \
-         $(TOP)/src/mesa/main/dispatch.c \
-         $(TOP)/src/mesa/glapi/glapi.c \
-         $(TOP)/src/mesa/glapi/glthread.c \
-         $(TOP)/src/glx/x11/glcontextmodes.c \
-         miniglx.c \
-         miniglx_events.c
-
-X86_SOURCES = $(TOP)/src/mesa/x86/glapi_x86.S
-
-OBJECTS = $(C_SOURCES:.c=.o) \
-         $(ASM_SOURCES:.S=.o)
-
-INCLUDES = -I. $(INCLUDE_DIRS)
-
-INCLUDE_DIRS = \
-       -I$(TOP)/include \
-       -I$(TOP)/src/mesa \
-       -I$(TOP)/src/mesa/main \
-       -I$(TOP)/src/mesa/glapi \
-       -I$(TOP)/src/glx/x11 \
-       -I$(TOP)/src/mesa/drivers/dri/common \
-       $(LIBDRM_CFLAGS) \
-       $(PCIACCESS_CFLAGS)
-
-
-
-##### RULES #####
-
-.c.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES)  $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/miniglx.conf
-
-
-# Make libGL
-$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME):  $(OBJECTS) Makefile
-       @ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               -major 1 -minor 2 $(MKLIB_OPTIONS) \
-               -install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) \
-               $(LIBDRM_LIB) $(PCIACCESS_LIB)
-
-
-# install sample miniglx.conf
-$(TOP)/$(LIB_DIR)/miniglx.conf:
-       $(INSTALL) example.miniglx.conf $(TOP)/$(LIB_DIR)/miniglx.conf
-
-
-drmtest: xf86drm.o drmtest.o
-       rm -f drmtest && $(CC) -o drmtest xf86drm.o drmtest.o
-
-
-depend: $(C_SOURCES) $(ASM_SOURCES)
-       rm -f depend
-       touch depend
-       $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES) \
-               > /dev/null 
-
-
-# Emacs tags
-tags:
-       etags `find . -name \*.[ch]` `find ../include`
-
-
-# Dummy install target
-install:
-
-
-# Remove .o and backup files
-clean:
-       -rm -f drmtest $(TOP)/$(LIB_DIR)/libGL.so*
-       -rm -f *.o *~
-       -rm -f depend depend.bak
-
-include depend
diff --git a/src/glx/mini/NOTES b/src/glx/mini/NOTES
deleted file mode 100644 (file)
index 1774107..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-Getting MiniGLX up and running
-------------------------------
-
-It's necessary to do a bit of work to set up an environment to run miniglx. 
-
-For the radeon driver, it's necessary to get the right set of kernel
-modules installed before attempting to run any programs:
-
-    rmmod radeon agpgart;
-    insmod agpgart;
-    insmod $(MESA)/src/kernel/radeonfb/radeonfb.o;
-    insmod $(MESA)/src/kernel/radeon/radeon.o;
-
-For all drivers, its necessary to reach the compiled libraries, and
-tell MiniGLX where to find it's configuration file:
-
-    export LD_LIBRARY_PATH=$(MESA)/lib;
-    export MINIGLX_CONF=$(MESA)/lib/miniglx.conf
-
-------------------------------------------------------------
-
-MiniGLX Example Programs
-------------------------
-
-The following programs will work with miniglx:
-       
-       $(MESA)/tests/miniglx
-       $(MESA)/xdemos/glxgears  
-
-Thanks to the miniglut stub library, most of the mesa glut demos will
-work.  In particular, the following have been tested.  (Note there is
-no keyboard or mouse interaction with these demos).
-
-       $(MESA)/demos/gears
-       $(MESA)/demos/geartrain
-       $(MESA)/demos/morph3d
-       $(MESA)/demos/isosurf
-       $(MESA)/demos/texobj
-       $(MESA)/demos/texcyl
-       $(MESA)/demos/gloss
-       $(MESA)/demos/fire
-       $(MESA)/demos/tunnel
-       $(MESA)/demos/teapot
-       $(MESA)/samples/prim
-       $(MESA)/samples/olympic
-       $(MESA)/samples/star
-       $(MESA)/samples/wave
-       ...etc
-
-In fact most of the glut demos seem to work within the constraints of
-having no keyboard/mouse interactivity.  Furthermore, the use of the
-glut wrapper means that these programs don't require recompilation to
-run under MiniGLX -- the same binary works with both regular GLX and
-MiniGLX.
-
-
-------------------------------------------------------------
-
-Porting GLX apps to MiniGLX
----------------------------
-
-A quick list of issues encountered in porting existing GLX apps to
-MiniGLX.  Listed in no particular order.
-
-1) No input events
-
-MiniGLX doesn't provide an input layer, so any X11 input event
-handling in the existing app will have to be redone for whatever
-input devices exist on the target.
-
-2) No configuration, expose events
-
-Many GLX and Xlib programs wait on an event to ensure the window has
-become visible after being mapped.  MiniGLX provides no equivalent
-facility.
-
-3) Different headers
-
-X11/Xlib.h, GL/GLX.h, etc must not be used if the program is being
-compiled against MiniGLX.
-
-The equivalent header is GL/MiniGLX.h.
-
-4) Different library
-
-It may be necessary to link directly against the minGLX libGL.so.
-
-5) Reduced number of Xlib and GLX entrypoints.
-
-By definition (MiniGLX is a subset of GLX), many Xlib and GLX
-entrypoints, structures and macros are not present in MiniGLX.  It
-will be necessary to find and eliminate all references to
-non-supported entrypoints.
-
-
----------------------------------------------------------------
-
-Bugs in radeonfb.o -- the radeon framebuffer driver.
-----------------------------------------------------
-
-Several bugs have been found in the radeonfb.o framebuffer driver.
-Most of these are resolved in the version included in the MiniGLX
-sources, but some remain:
-
-1) Occasionally, after entering graphics mode, colors appear 'shifted'
-or 'translated', particularly in higher resolution modes.  This is
-definitely a bug in radeonfb.o as this can be provoked even when using
-the software dri driver (fb_dri.so).  Importance: High.  Workaround:
-Use 800x600 as it seems to be less frequent at this resolution,
-otherwise, restart the application.
-
-
-
diff --git a/src/glx/mini/dispatch.c b/src/glx/mini/dispatch.c
deleted file mode 100644 (file)
index ac24df9..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * \file miniglx/dispatch.c
- *
- * \brief C-based dispatch of the OpenGL entry points (glAccum(), glBegin(),
- * etc).
- * 
- * \author Brian Paul <brian@precisioninsight.com>
- * 
- * \note This code IS NOT USED if we're compiling on an x86 system and using
- * the glapi_x86.S assembly code.
- */
-
-/* 
- * Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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 "glheader.h"
-#include "glapi.h"
-#include "glapitable.h"
-
-
-#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
-
-#define KEYWORD1
-
-#define KEYWORD2
-
-#define NAME(func) gl##func
-
-#define DISPATCH(func, args, msg)                                      \
-   const struct _glapi_table *dispatch;                                        \
-   dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
-   (dispatch->func) args
-
-#define RETURN_DISPATCH(func, args, msg)                               \
-   const struct _glapi_table *dispatch;                                        \
-   dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
-   return (dispatch->func) args
-
-
-#include "glapitemp.h"
-
-#endif /* USE_X86_ASM */
diff --git a/src/glx/mini/driver.h b/src/glx/mini/driver.h
deleted file mode 100644 (file)
index 39c0f9b..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * \file driver.h
- * \brief DRI utility functions definitions.
- *
- * This module acts as glue between GLX and the actual hardware driver.  A DRI
- * driver doesn't really \e have to use any of this - it's optional.  But, some
- * useful stuff is done here that otherwise would have to be duplicated in most
- * drivers.
- * 
- * Basically, these utility functions take care of some of the dirty details of
- * screen initialization, context creation, context binding, DRM setup, etc.
- *
- * These functions are compiled into each DRI driver so libGL.so knows nothing
- * about them.
- *
- * Look for more comments in the dri_util.c file.
- * 
- * \author Kevin E. Martin <kevin@precisioninsight.com>
- * \author Brian Paul <brian@precisioninsight.com>
- */
-
-/*
- * Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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.
- */
-
-#ifndef _driver_H_
-#define _driver_H_
-
-#include "GL/gl.h"
-#include "GL/internal/glcore.h"
-
-#include "drm.h"
-#include "drm_sarea.h"
-
-/**
- * \brief DRIDriverContext type.
- */
-typedef struct DRIDriverContextRec {
-   const char *pciBusID;
-   int pciBus;
-   int pciDevice;
-   int pciFunc;
-   int chipset;
-   int bpp; 
-   int cpp;  
-   int agpmode;
-   int isPCI;
-   
-   int colorTiling;        /**< \brief color tiling is enabled */
-
-   unsigned long FBStart;   /**< \brief physical address of the framebuffer */
-   unsigned long MMIOStart; /**< \brief physical address of the MMIO region */
-   
-   int FBSize;              /**< \brief size of the mmap'd framebuffer in bytes */
-   int MMIOSize;            /**< \brief size of the mmap'd MMIO region in bytes */
-
-   void *FBAddress;         /**< \brief start of the mmap'd framebuffer */
-   void *MMIOAddress;       /**< \brief start of the mmap'd MMIO region */
-   
-   /**
-    * \brief Client configuration details
-    *
-    * These are computed on the server and sent to clients as part of
-    * the initial handshaking.
-    */
-   struct {
-      drm_handle_t hSAREA;
-      int SAREASize;
-      drm_handle_t hFrameBuffer;
-      int fbOrigin;
-      int fbSize;
-      int fbStride;
-      int virtualWidth;
-      int virtualHeight;
-      int Width;
-   } shared;
-   
-   /**
-    * \name From DRIInfoRec
-    */
-   /*@{*/
-   int drmFD;  /**< \brief DRM device file descriptor */
-   drm_sarea_t *pSAREA;
-   unsigned int serverContext; /**< \brief DRM context only active on server */
-   /*@}*/
-   
-   
-   /**
-    * \name Driver private
-    *
-    * Populated by __driInitFBDev()
-    */
-   /*@{*/
-   void *driverPrivate;
-   void *driverClientMsg;
-   int driverClientMsgSize;
-   /*@}*/
-} DRIDriverContext;
-
-/**
- * \brief Interface to the DRI driver.
- *
- * This structure is retrieved from the loadable driver by the \e
- * __driDriver symbol to access the Mini GLX specific hardware
- * initialization and take down routines.
- */
-typedef struct DRIDriverRec { 
-   /**
-    * \brief Validate the framebuffer device mode
-    */
-   int (*validateMode)( const DRIDriverContext *context );
-
-   /**
-    * \brief Examine mode returned by fbdev (may differ from the one
-    * requested), restore any hw regs clobbered by fbdev.
-    */
-   int (*postValidateMode)( const DRIDriverContext *context );
-
-   /**
-    * \brief Initialize the framebuffer device.
-    */
-   int (*initFBDev)( DRIDriverContext *context );
-
-   /**
-    * \brief Halt the framebuffer device.
-    */
-   void (*haltFBDev)( DRIDriverContext *context );
-
-
-   /**
-    * \brief Idle and shutdown hardware in preparation for a VT switch.
-    */
-   int (*shutdownHardware)(  const DRIDriverContext *context );
-
-   /**
-    * \brief Restore hardware state after regaining the VT.
-    */
-   int (*restoreHardware)(  const DRIDriverContext *context );
-
-   /**
-    * \brief Notify hardware driver of gain/loose focus.  May be zero
-    * as this is of limited utility for most drivers.  
-    */
-   void (*notifyFocus)( int have_focus );
-} DRIDriver;
-
-#endif /* _driver_H_ */
diff --git a/src/glx/mini/example.miniglx.conf b/src/glx/mini/example.miniglx.conf
deleted file mode 100644 (file)
index 62dd4f6..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Example miniglx configuration file (/etc/miniglx.conf)
-#
-
-# Framebuffer device to open: Might need to change this on dual-head
-# systems.
-fbdevDevice=/dev/fb0
-
-# Which driver?  
-#    radeon_dri.so -- HW accelerated radeon driver
-#    fb_dri.so -- Software rasterizer
-clientDriverName=radeon_dri.so
-
-# The pci bus id of the video card.  Find this with scanpci, lspci or
-# look in /proc/pci.  
-pciBusID=PCI:1:0:0 
-
-# Is the card PCI or AGP ?
-isPCI=0 
-
-# Virtual screen dimensions.  Can reduce this to save videocard memory
-# at the expense of maximum window size available.
-virtualWidth=1280
-virtualHeight=1024 
-
-# Screen depth.  Only 16 & 32bpp supported.
-bpp=32
-
-# AGP Mode. Not all cards supported  (1, 2 or 4)
-agpmode=1
-
-# Rotated monitor? -- NOTE: only works with subsetted radeon driver!
-rotateMode=0
-
-# Do we want to use color tiling ?
-colorTiling=0
-
diff --git a/src/glx/mini/miniglx.c b/src/glx/mini/miniglx.c
deleted file mode 100644 (file)
index e9a10b4..0000000
+++ /dev/null
@@ -1,2580 +0,0 @@
-/**
- * \file miniglx.c
- * \brief Mini GLX interface functions.
- * \author Brian Paul
- *
- * The Mini GLX interface is a subset of the GLX interface, plus a
- * minimal set of Xlib functions.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version:  6.0.1
- *
- * 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.
- */
-
-
-/**
- * \mainpage Mini GLX
- *
- * \section miniglxIntro Introduction
- *
- * The Mini GLX interface facilitates OpenGL rendering on embedded devices. The
- * interface is a subset of the GLX interface, plus a minimal set of Xlib-like
- * functions.
- *
- * Programs written to the Mini GLX specification should run unchanged
- * on systems with the X Window System and the GLX extension (after
- * recompilation). The intention is to allow flexibility for
- * prototyping and testing.
- *
- * The files in the src/miniglx/ directory are compiled to build the
- * libGL.so library.  This is the library which applications link with.
- * libGL.so in turn, loads the hardware-specific device driver.
- *
- *
- * \section miniglxDoxygen About Doxygen
- *
- * For a list of all files, select <b>File List</b>.  Choose a file from
- * the list for a list of all functions in the file.
- *
- * For a list of all functions, types, constants, etc.
- * select <b>File Members</b>.
- *
- *
- * \section miniglxReferences References
- *
- * - <A HREF="file:../../docs/MiniGLX.html">Mini GLX Specification</A>,
- *   Tungsten Graphics, Inc.
- * - OpenGL Graphics with the X Window System, Silicon Graphics, Inc.,
- *   ftp://ftp.sgi.com/opengl/doc/opengl1.2/glx1.3.ps
- * - Xlib - C Language X Interface, X Consortium Standard, X Version 11,
- *   Release 6.4, ftp://ftp.x.org/pub/R6.4/xc/doc/hardcopy/X11/xlib.PS.gz
- * - XFree86 Man pages, The XFree86 Project, Inc.,
- *   http://www.xfree86.org/current/manindex3.html
- *   
- */
-
-/**
- * \page datatypes Notes on the XVisualInfo, Visual, and __GLXvisualConfig data types
- * 
- * -# X (unfortunately) has two (or three) data types which
- *    describe visuals.  Ideally, there would just be one.
- * -# We need the #__GLXvisualConfig type to augment #XVisualInfo and #Visual
- *    because we need to describe the GLX-specific attributes of visuals.
- * -# In this interface there is a one-to-one-to-one correspondence between
- *    the three types and they're all interconnected.
- * -# The #XVisualInfo type has a pointer to a #Visual.  The #Visual structure
- *    (aka MiniGLXVisualRec) has a pointer to the #__GLXvisualConfig.  The
- *    #Visual structure also has a pointer pointing back to the #XVisualInfo.
- * -# The #XVisualInfo structure is the only one who's contents are public.
- * -# The glXChooseVisual() and XGetVisualInfo() are the only functions that
- *    return #XVisualInfo structures.  They can be freed with XFree(), though
- *    there is a small memory leak.
- */
-
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/time.h>    /* for gettimeofday */
-#include <linux/kd.h>
-#include <linux/vt.h>
-
-#include "miniglxP.h"
-#include "dri_util.h"
-
-#include "imports.h"
-#include "glcontextmodes.h"
-#include "glapi.h"
-
-#include "pciaccess.h"
-
-static GLboolean __glXCreateContextWithConfig(__DRInativeDisplay *dpy,
-        int screen, int fbconfigID, void *contextID,
-        drm_context_t *hHWContext);
-
-static GLboolean __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
-        __DRIid draw, unsigned int * index, unsigned int * stamp,
-        int * x, int * y, int * width, int * height,
-        int * numClipRects, drm_clip_rect_t ** pClipRects,
-        int * backX, int * backY,
-        int * numBackClipRects, drm_clip_rect_t ** pBackClipRects);
-
-static __DRIscreen * __glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn);
-
-static GLboolean __glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw);
-
-static int __glXGetUST( int64_t * ust );
-
-static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable,
-    int32_t * numerator, int32_t * denominator);
-
-static GLboolean xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen,
-    __DRIid context_id );
-
-static GLboolean xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen,
-    __DRIid drawable, drm_drawable_t *hHWDrawable );
-
-static GLboolean xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen,
-    __DRIid drawable);
-
-
-/** Wrapper around either malloc() */
-void *
-_mesa_malloc(size_t bytes)
-{
-   return malloc(bytes);
-}
-
-/** Wrapper around either calloc() */
-void *
-_mesa_calloc(size_t bytes)
-{
-   return calloc(1, bytes);
-}
-
-/** Wrapper around either free() */
-void
-_mesa_free(void *ptr)
-{
-   free(ptr);
-}
-
-
-/**
- * \brief Current GLX context.
- *
- * \sa glXGetCurrentContext().
- */
-static GLXContext CurrentContext = NULL;
-
-
-
-static Display *SignalDisplay = 0;
-
-static void SwitchVT(int sig)
-{
-   fprintf(stderr, "SwitchVT %d dpy %p\n", sig, SignalDisplay);
-
-   if (SignalDisplay) {
-      SignalDisplay->vtSignalFlag = 1;
-      switch( sig )
-      {
-      case SIGUSR1:                                /* vt has been released */
-        SignalDisplay->haveVT = 0;
-        break;
-      case SIGUSR2:                                /* vt has been acquired */
-        SignalDisplay->haveVT = 1;
-        break;
-      }
-   }
-}
-
-/**********************************************************************/
-/** \name Framebuffer device functions                                */
-/**********************************************************************/
-/*@{*/
-
-/**
- * \brief Do the first part of setting up the framebuffer device.
- *
- * \param dpy the display handle.
- * \param use_vt use a VT for display or not
- *
- * \return GL_TRUE on success, or GL_FALSE on failure.
- * 
- * \sa This is called during XOpenDisplay().
- *
- * \internal
- * Gets the VT number, opens the respective console TTY device. Saves its state
- * to restore when exiting and goes into graphics mode.
- *
- * Opens the framebuffer device and make a copy of the original variable screen
- * information and gets the fixed screen information.  Maps the framebuffer and
- * MMIO region into the process address space.
- */
-static GLboolean
-OpenFBDev( Display *dpy, int use_vt )
-{
-   char ttystr[1000];
-   int fd, vtnumber, ttyfd;
-
-   assert(dpy);
-
-   if (geteuid()) {
-      fprintf(stderr, "error: you need to be root\n");
-      return GL_FALSE;
-   }
-   
-   if (use_vt) {
-       
-       /* open /dev/tty0 and get the VT number */
-       if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
-          fprintf(stderr, "error opening /dev/tty0\n");
-          return GL_FALSE;
-       }
-       if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) {
-          fprintf(stderr, "error: couldn't get a free vt\n");
-          return GL_FALSE;
-       }
-       
-       fprintf(stderr, "*** got vt nr: %d\n", vtnumber);
-       close(fd);
-       
-       /* open the console tty */
-       sprintf(ttystr, "/dev/tty%d", vtnumber);  /* /dev/tty1-64 */
-       dpy->ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0);
-       if (dpy->ConsoleFD < 0) {
-          fprintf(stderr, "error couldn't open console fd\n");
-          return GL_FALSE;
-       }
-       
-       /* save current vt number */
-       {
-          struct vt_stat vts;
-          if (ioctl(dpy->ConsoleFD, VT_GETSTATE, &vts) == 0)
-              dpy->OriginalVT = vts.v_active;
-       }
-       
-       /* disconnect from controlling tty */
-       ttyfd = open("/dev/tty", O_RDWR);
-       if (ttyfd >= 0) {
-          ioctl(ttyfd, TIOCNOTTY, 0);
-          close(ttyfd);
-       }
-       
-       /* some magic to restore the vt when we exit */
-       {
-          struct vt_mode vt;
-          struct sigaction sig_tty;
-          
-          /* Set-up tty signal handler to catch the signal we request below */
-          SignalDisplay = dpy;
-          memset( &sig_tty, 0, sizeof( sig_tty ) );
-          sig_tty.sa_handler = SwitchVT;
-          sigemptyset( &sig_tty.sa_mask );
-          if( sigaction( SIGUSR1, &sig_tty, &dpy->OrigSigUsr1 ) ||
-              sigaction( SIGUSR2, &sig_tty, &dpy->OrigSigUsr2 ) )
-          {
-              fprintf(stderr, "error: can't set up signal handler (%s)",
-                      strerror(errno) );
-              return GL_FALSE;
-          }
-          
-          
-          
-          vt.mode = VT_PROCESS;
-          vt.waitv = 0;
-          vt.relsig = SIGUSR1;
-          vt.acqsig = SIGUSR2;
-          if (ioctl(dpy->ConsoleFD, VT_SETMODE, &vt) < 0) {
-              fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n",
-                      strerror(errno));
-              return GL_FALSE;
-          }
-          
-          
-          if (ioctl(dpy->ConsoleFD, VT_ACTIVATE, vtnumber) != 0)
-              printf("ioctl VT_ACTIVATE: %s\n", strerror(errno));
-          if (ioctl(dpy->ConsoleFD, VT_WAITACTIVE, vtnumber) != 0)
-              printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno));
-          
-          if (ioctl(dpy->ConsoleFD, VT_GETMODE, &vt) < 0) {
-              fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno));
-              return GL_FALSE;
-          }
-          
-          
-          
-       }
-       
-       /* go into graphics mode */
-       if (ioctl(dpy->ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) {
-          fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n",
-                  strerror(errno));
-          return GL_FALSE;
-       }
-   }
-
-   /* open the framebuffer device */
-   dpy->FrameBufferFD = open(dpy->fbdevDevice, O_RDWR);
-   if (dpy->FrameBufferFD < 0) {
-      fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
-      return GL_FALSE;
-   }
-
-  /* get the original variable screen info */
-   if (ioctl(dpy->FrameBufferFD, FBIOGET_VSCREENINFO, &dpy->OrigVarInfo)) {
-      fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
-              strerror(errno));
-      return GL_FALSE;
-   }
-
-   /* make copy */
-   dpy->VarInfo = dpy->OrigVarInfo;  /* structure copy */
-
-   /* Turn off hw accels (otherwise mmap of mmio region will be
-    * refused)
-    */
-   dpy->VarInfo.accel_flags = 0; 
-   if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->VarInfo)) {
-      fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n",
-             strerror(errno));
-      return GL_FALSE;
-   }
-
-
-
-   /* Get the fixed screen info */
-   if (ioctl(dpy->FrameBufferFD, FBIOGET_FSCREENINFO, &dpy->FixedInfo)) {
-      fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
-              strerror(errno));
-      return GL_FALSE;
-   }
-
-
-
-   /* mmap the framebuffer into our address space */
-   dpy->driverContext.FBStart = dpy->FixedInfo.smem_start;
-   dpy->driverContext.FBSize = dpy->FixedInfo.smem_len;
-   dpy->driverContext.shared.fbSize = dpy->FixedInfo.smem_len;
-   dpy->driverContext.FBAddress = (caddr_t) mmap(0, /* start */
-                                     dpy->driverContext.shared.fbSize, /* bytes */
-                                     PROT_READ | PROT_WRITE, /* prot */
-                                     MAP_SHARED, /* flags */
-                                     dpy->FrameBufferFD, /* fd */
-                                     0 /* offset */);
-   if (dpy->driverContext.FBAddress == (caddr_t) - 1) {
-      fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
-              strerror(errno));
-      return GL_FALSE;
-   }
-           
-   /* mmap the MMIO region into our address space */
-   dpy->driverContext.MMIOStart = dpy->FixedInfo.mmio_start;
-   dpy->driverContext.MMIOSize = dpy->FixedInfo.mmio_len;
-   dpy->driverContext.MMIOAddress = (caddr_t) mmap(0, /* start */
-                                     dpy->driverContext.MMIOSize, /* bytes */
-                                     PROT_READ | PROT_WRITE, /* prot */
-                                     MAP_SHARED, /* flags */
-                                     dpy->FrameBufferFD, /* fd */
-                                     dpy->FixedInfo.smem_len /* offset */);
-   if (dpy->driverContext.MMIOAddress == (caddr_t) - 1) {
-      fprintf(stderr, "error: unable to mmap mmio region: %s\n",
-              strerror(errno));
-      return GL_FALSE;
-   }
-
-   fprintf(stderr, "got MMIOAddress %p offset %d\n",
-           dpy->driverContext.MMIOAddress,
-          dpy->FixedInfo.smem_len);
-
-   return GL_TRUE;
-}
-
-
-
-
-/**
- * \brief Setup up the desired framebuffer device mode.  
- *
- * \param dpy the display handle.
- * 
- * \return GL_TRUE on success, or GL_FALSE on failure.
- * 
- * \sa This is called during __miniglx_StartServer().
- *
- * \internal
- *
- * Bumps the size of the window the the next supported mode. Sets the
- * variable screen information according to the desired mode and asks
- * the driver to validate the mode. Certifies that a DirectColor or
- * TrueColor visual is used from the updated fixed screen information.
- * In the case of DirectColor visuals, sets up an 'identity' colormap to
- * mimic a TrueColor visual.
- *
- * Calls the driver hooks 'ValidateMode' and 'PostValidateMode' to
- * allow the driver to make modifications to the chosen mode according
- * to hardware constraints, or to save and restore videocard registers
- * that may be clobbered by the fbdev driver.
- *
- * \todo Timings are hard-coded in the source for a set of supported modes.
- */
-static GLboolean
-SetupFBDev( Display *dpy )
-{
-   int width, height;
-
-   assert(dpy);
-
-   width = dpy->driverContext.shared.virtualWidth;
-   height = dpy->driverContext.shared.virtualHeight;
-   
-   if (width==832)
-       width=800;
-#if 0
-   /* Bump size up to next supported mode.
-    */
-   if (width <= 720 && height <= 480) { 
-      width = 720; height = 480; 
-   } 
-   else if (width <= 960 && height <= 540) {
-      width = 960; height = 540; 
-   }  
-   else if (width <= 800 && height <= 600) {
-      width = 800; height = 600; 
-   }  
-   else if (width <= 1024 && height <= 768) { 
-      width = 1024; height = 768; 
-   } 
-   else if (width <= 768 && height <= 1024) {
-      width = 768; height = 1024; 
-   }  
-   else if (width <= 1280 && height <= 1024) { 
-      width = 1280; height = 1024; 
-   } 
-#endif
-
-   dpy->driverContext.shared.fbStride = width * (dpy->driverContext.bpp / 8);
-   
-   /* set the depth, resolution, etc */
-   dpy->VarInfo = dpy->OrigVarInfo;
-   dpy->VarInfo.bits_per_pixel = dpy->driverContext.bpp;
-   dpy->VarInfo.xres_virtual = dpy->driverContext.shared.virtualWidth;
-   dpy->VarInfo.yres_virtual = dpy->driverContext.shared.virtualHeight;
-   dpy->VarInfo.xres = dpy->driverContext.shared.Width;
-   dpy->VarInfo.yres = height;
-   dpy->VarInfo.xoffset = 0;
-   dpy->VarInfo.yoffset = 0;
-   dpy->VarInfo.nonstd = 0;
-   dpy->VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */
-
-   if (dpy->VarInfo.bits_per_pixel == 32) {
-      dpy->VarInfo.red.offset = 16;
-      dpy->VarInfo.green.offset = 8;
-      dpy->VarInfo.blue.offset = 0;
-      dpy->VarInfo.transp.offset = 24;
-      dpy->VarInfo.red.length = 8;
-      dpy->VarInfo.green.length = 8;
-      dpy->VarInfo.blue.length = 8;
-      dpy->VarInfo.transp.length = 8;
-   }
-   else if (dpy->VarInfo.bits_per_pixel == 16) {
-      dpy->VarInfo.red.offset = 11;
-      dpy->VarInfo.green.offset = 5;
-      dpy->VarInfo.blue.offset = 0;
-      dpy->VarInfo.red.length = 5;
-      dpy->VarInfo.green.length = 6;
-      dpy->VarInfo.blue.length = 5;
-      dpy->VarInfo.transp.offset = 0;
-      dpy->VarInfo.transp.length = 0;
-   }
-   else {
-      fprintf(stderr, "Only 32bpp and 16bpp modes supported at the moment\n");
-      return 0;
-   }
-
-   if (!dpy->driver->validateMode( &dpy->driverContext )) {
-      fprintf(stderr, "Driver validateMode() failed\n");
-      return 0;
-   }
-
-   /* These should be calculated with the gtf.c program, and then we could
-      remove all this... AlanH. */
-   if (dpy->VarInfo.xres == 1280 && 
-       dpy->VarInfo.yres == 1024) {
-      /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
-      dpy->VarInfo.pixclock = 7408;
-      dpy->VarInfo.left_margin = 248;
-      dpy->VarInfo.right_margin = 16;
-      dpy->VarInfo.upper_margin = 38;
-      dpy->VarInfo.lower_margin = 1;
-      dpy->VarInfo.hsync_len = 144;
-      dpy->VarInfo.vsync_len = 3;
-   }
-   else if (dpy->VarInfo.xres == 1024 && 
-           dpy->VarInfo.yres == 768) {
-      /* timing values taken from /etc/fb.modes (1024x768 @ 75Hz) */
-      dpy->VarInfo.pixclock = 12699;
-      dpy->VarInfo.left_margin = 176;
-      dpy->VarInfo.right_margin = 16;
-      dpy->VarInfo.upper_margin = 28;
-      dpy->VarInfo.lower_margin = 1;
-      dpy->VarInfo.hsync_len = 96;
-      dpy->VarInfo.vsync_len = 3;
-   }
-   else if (dpy->VarInfo.xres == 800 &&
-           dpy->VarInfo.yres == 600) {
-      /* timing values taken from /etc/fb.modes (800x600 @ 75Hz) */
-      dpy->VarInfo.pixclock = 27778;
-      dpy->VarInfo.left_margin = 128;
-      dpy->VarInfo.right_margin = 24;
-      dpy->VarInfo.upper_margin = 22;
-      dpy->VarInfo.lower_margin = 1;
-      dpy->VarInfo.hsync_len = 72;
-      dpy->VarInfo.vsync_len = 2;
-   }
-   else if (dpy->VarInfo.xres == 720 &&
-           dpy->VarInfo.yres == 480) {
-      dpy->VarInfo.pixclock = 37202;
-      dpy->VarInfo.left_margin = 88;
-      dpy->VarInfo.right_margin = 16;
-      dpy->VarInfo.upper_margin = 14;
-      dpy->VarInfo.lower_margin = 1;
-      dpy->VarInfo.hsync_len = 72;
-      dpy->VarInfo.vsync_len = 3;
-   }
-   else if (dpy->VarInfo.xres == 960 &&
-           dpy->VarInfo.yres == 540) {
-      dpy->VarInfo.pixclock = 24273;
-      dpy->VarInfo.left_margin = 128;
-      dpy->VarInfo.right_margin = 32;
-      dpy->VarInfo.upper_margin = 16;
-      dpy->VarInfo.lower_margin = 1;
-      dpy->VarInfo.hsync_len = 96;
-      dpy->VarInfo.vsync_len = 3;
-   }
-   else if (dpy->VarInfo.xres == 768 &&
-           dpy->VarInfo.yres == 1024) {
-      /* timing values for 768x1024 @ 75Hz */
-      dpy->VarInfo.pixclock = 11993;
-      dpy->VarInfo.left_margin = 136;
-      dpy->VarInfo.right_margin = 32;
-      dpy->VarInfo.upper_margin = 41;
-      dpy->VarInfo.lower_margin = 1;
-      dpy->VarInfo.hsync_len = 80;
-      dpy->VarInfo.vsync_len = 3;
-   }
-   else {
-      /* XXX need timings for other screen sizes */
-      fprintf(stderr, "XXXX screen size %d x %d not supported at this time!\n",
-             dpy->VarInfo.xres, dpy->VarInfo.yres);
-      return GL_FALSE;
-   }
-
-   fprintf(stderr, "[miniglx] Setting mode: visible %dx%d virtual %dx%dx%d\n",
-          dpy->VarInfo.xres, dpy->VarInfo.yres,
-          dpy->VarInfo.xres_virtual, dpy->VarInfo.yres_virtual,
-          dpy->VarInfo.bits_per_pixel);
-
-   /* set variable screen info */
-   if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->VarInfo)) {
-      fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n",
-             strerror(errno));
-      return GL_FALSE;
-   }
-
-   /* get the variable screen info, in case it has been modified */
-   if (ioctl(dpy->FrameBufferFD, FBIOGET_VSCREENINFO, &dpy->VarInfo)) {
-      fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
-              strerror(errno));
-      return GL_FALSE;
-   }
-
-
-   fprintf(stderr, "[miniglx] Readback mode: visible %dx%d virtual %dx%dx%d\n",
-          dpy->VarInfo.xres, dpy->VarInfo.yres,
-          dpy->VarInfo.xres_virtual, dpy->VarInfo.yres_virtual,
-          dpy->VarInfo.bits_per_pixel);
-
-   /* Get the fixed screen info */
-   if (ioctl(dpy->FrameBufferFD, FBIOGET_FSCREENINFO, &dpy->FixedInfo)) {
-      fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
-              strerror(errno));
-      return GL_FALSE;
-   }
-
-   if (dpy->FixedInfo.visual != FB_VISUAL_TRUECOLOR &&
-       dpy->FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) {
-      fprintf(stderr, "non-TRUECOLOR visuals not supported.\n");
-      return GL_FALSE;
-   }
-
-   if (dpy->FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
-      struct fb_cmap cmap;
-      unsigned short red[256], green[256], blue[256];
-      int rcols = 1 << dpy->VarInfo.red.length;
-      int gcols = 1 << dpy->VarInfo.green.length;
-      int bcols = 1 << dpy->VarInfo.blue.length;
-      int i;
-
-      cmap.start = 0;      
-      cmap.len = gcols;
-      cmap.red   = red;
-      cmap.green = green;
-      cmap.blue  = blue;
-      cmap.transp = NULL;
-
-      for (i = 0; i < rcols ; i++) 
-         red[i] = (65536/(rcols-1)) * i;
-
-      for (i = 0; i < gcols ; i++) 
-         green[i] = (65536/(gcols-1)) * i;
-
-      for (i = 0; i < bcols ; i++) 
-         blue[i] = (65536/(bcols-1)) * i;
-      
-      if (ioctl(dpy->FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) {
-         fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
-        exit(1);
-      }
-   }
-
-   /* May need to restore regs fbdev has clobbered:
-    */
-   if (!dpy->driver->postValidateMode( &dpy->driverContext )) {
-      fprintf(stderr, "Driver postValidateMode() failed\n");
-      return 0;
-   }
-
-   return GL_TRUE;
-}
-
-
-/**
- * \brief Restore the framebuffer device to state it was in before we started
- *
- * Undoes the work done by SetupFBDev().
- * 
- * \param dpy the display handle.
- *
- * \return GL_TRUE on success, or GL_FALSE on failure.
- * 
- * \sa Called from XDestroyWindow().
- *
- * \internal
- * Restores the original variable screen info.
- */
-static GLboolean
-RestoreFBDev( Display *dpy )
-{
-   /* restore original variable screen info */
-   if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->OrigVarInfo)) {
-      fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
-              strerror(errno));
-      return GL_FALSE;
-   }
-   dpy->VarInfo = dpy->OrigVarInfo;
-
-   return GL_TRUE;
-}
-
-
-/**
- * \brief Close the framebuffer device.  
- *
- * \param dpy the display handle.
- * 
- * \sa Called from XCloseDisplay().
- *
- * \internal
- * Unmaps the framebuffer and MMIO region.  Restores the text mode and the
- * original virtual terminal. Closes the console and framebuffer devices.
- */
-static void
-CloseFBDev( Display *dpy )
-{
-   struct vt_mode VT;
-
-   munmap(dpy->driverContext.FBAddress, dpy->driverContext.FBSize);
-   munmap(dpy->driverContext.MMIOAddress, dpy->driverContext.MMIOSize);
-
-   if (dpy->ConsoleFD) {
-       /* restore text mode */
-       ioctl(dpy->ConsoleFD, KDSETMODE, KD_TEXT);
-       
-       /* set vt */
-       if (ioctl(dpy->ConsoleFD, VT_GETMODE, &VT) != -1) {
-          VT.mode = VT_AUTO;
-          ioctl(dpy->ConsoleFD, VT_SETMODE, &VT);
-       }
-       
-       /* restore original vt */
-       if (dpy->OriginalVT >= 0) {
-          ioctl(dpy->ConsoleFD, VT_ACTIVATE, dpy->OriginalVT);
-          dpy->OriginalVT = -1;
-       }
-       
-       close(dpy->ConsoleFD);
-   }
-   close(dpy->FrameBufferFD);
-}
-
-/*@}*/
-
-
-/**********************************************************************/
-/** \name Misc functions needed for DRI drivers                       */
-/**********************************************************************/
-/*@{*/
-
-/**
- * \brief Find the DRI screen dependent methods associated with the display.
- *
- * \param dpy a display handle, as returned by XOpenDisplay().
- * \param scrn the screen number. Not referenced.
- * 
- * \returns a pointer to a __DRIscreenRec structure.
- * 
- * \internal
- * Returns the MiniGLXDisplayRec::driScreen attribute.
- */
-static __DRIscreen *
-__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn)
-{
-   (void) scrn;
-   return &((Display*)dpy)->driScreen;
-}
-
-/**
- * \brief Validate a drawable.
- *
- * \param dpy a display handle, as returned by XOpenDisplay().
- * \param draw drawable to validate.
- * 
- * \internal
- * Since Mini GLX only supports one window, compares the specified drawable with
- * the MiniGLXDisplayRec::TheWindow attribute.
- */
-static GLboolean
-__glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw)
-{
-   const Display * const display = (Display*)dpy;
-   if (display->TheWindow == (Window) draw)
-      return True;
-   else
-      return False;
-}
-
-/**
- * \brief Get current thread ID.
- *
- * \return thread ID.
- *
- * \internal
- * Always returns 0. 
- */
-/*unsigned long
-_glthread_GetID(void)
-{
-   return 0;
-}*/
-
-/*@}*/
-
-
-/**
- * \brief Scan Linux /prog/bus/pci/devices file to determine hardware
- * chipset based on supplied bus ID.
- * 
- * \return probed chipset (non-zero) on success, zero otherwise.
- * 
- * \internal 
- */
-static int get_chipset_from_busid( Display *dpy )
-{
-   char buf[0x200];
-   FILE *file;
-   const char *fname = "/proc/bus/pci/devices";
-   int retval = 0;
-
-   if (!(file = fopen(fname,"r"))) {
-      fprintf(stderr, "couldn't open %s: %s\n", fname, strerror(errno));
-      return 0;
-   }
-
-   while (fgets(buf, sizeof(buf)-1, file)) {
-      unsigned int nr, bus, dev, fn, vendor, device, encode;
-      nr = sscanf(buf, "%04x\t%04x%04x", &encode, 
-                 &vendor, &device);
-      
-      bus = encode >> 8;
-      dev = (encode & 0xFF) >> 3;
-      fn = encode & 0x7;
-
-      if (nr != 3)
-        break;
-
-      if (bus == dpy->driverContext.pciBus &&
-          dev == dpy->driverContext.pciDevice &&
-          fn  == dpy->driverContext.pciFunc) {
-        retval = device;
-        break;
-      }
-   }
-
-   fclose(file);
-
-   if (retval)
-      fprintf(stderr, "[miniglx] probed chipset 0x%x\n", retval);
-   else
-      fprintf(stderr, "[miniglx] failed to probe chipset\n");
-
-   return retval;
-}
-
-
-/**
- * \brief Read settings from a configuration file.
- * 
- * The configuration file is usually "/etc/miniglx.conf", but can be overridden
- * with the MINIGLX_CONF environment variable. 
- *
- * The format consists in \code option = value \endcode lines. The option names 
- * corresponds to the fields in MiniGLXDisplayRec.
- * 
- * \param dpy the display handle as.
- *
- * \return non-zero on success, zero otherwise.
- * 
- * \internal 
- * Sets some defaults. Opens and parses the the Mini GLX configuration file and
- * fills in the MiniGLXDisplayRec field that corresponds for each option.
- */
-static int __read_config_file( Display *dpy )
-{
-   FILE *file;
-   const char *fname;
-
-   /* Fallback/defaults
-    */
-   dpy->fbdevDevice = "/dev/fb0";
-   dpy->clientDriverName = "fb_dri.so";
-   dpy->driverContext.pciBus = 0;
-   dpy->driverContext.pciDevice = 0;
-   dpy->driverContext.pciFunc = 0;
-   dpy->driverContext.chipset = 0;   
-   dpy->driverContext.pciBusID = 0;
-   dpy->driverContext.shared.virtualWidth = 1280;
-   dpy->driverContext.shared.virtualHeight = 1024;
-   dpy->driverContext.bpp = 32;
-   dpy->driverContext.cpp = 4;
-   dpy->rotateMode = 0;
-   dpy->driverContext.agpmode = 1;
-   dpy->driverContext.isPCI = 0;
-   dpy->driverContext.colorTiling = 0;
-
-   fname = getenv("MINIGLX_CONF");
-   if (!fname) fname = "/etc/miniglx.conf";
-
-   file = fopen(fname, "r");
-   if (!file) {
-      fprintf(stderr, "couldn't open config file %s: %s\n", fname, strerror(errno));
-      return 0;
-   }
-
-
-   while (!feof(file)) {
-      char buf[81], *opt = buf, *val, *tmp1, *tmp2;
-      fgets(buf, sizeof(buf), file); 
-
-      /* Parse 'opt = val' -- must be easier ways to do this.
-       */
-      while (isspace(*opt)) opt++;
-      val = opt;
-      if (*val == '#') continue; /* comment */
-      while (!isspace(*val) && *val != '=' && *val) val++;
-      tmp1 = val;
-      while (isspace(*val)) val++;
-      if (*val != '=') continue;
-      *tmp1 = 0; 
-      val++;
-      while (isspace(*val)) val++;
-      tmp2 = val;
-      while (!isspace(*tmp2) && *tmp2 != '\n' && *tmp2) tmp2++;
-      *tmp2 = 0;
-
-
-      if (strcmp(opt, "fbdevDevice") == 0) 
-        dpy->fbdevDevice = strdup(val);
-      else if (strcmp(opt, "clientDriverName") == 0)
-        dpy->clientDriverName = strdup(val);
-      else if (strcmp(opt, "rotateMode") == 0)
-        dpy->rotateMode = atoi(val) ? 1 : 0;
-      else if (strcmp(opt, "pciBusID") == 0) {
-        if (sscanf(val, "PCI:%d:%d:%d",
-                   &dpy->driverContext.pciBus,
-                    &dpy->driverContext.pciDevice,
-                    &dpy->driverContext.pciFunc) != 3) {
-           fprintf(stderr, "malformed bus id: %s\n", val);
-           continue;
-        }
-        dpy->driverContext.pciBusID = strdup(val);
-      }
-      else if (strcmp(opt, "chipset") == 0) {
-        if (sscanf(val, "0x%x", &dpy->driverContext.chipset) != 1)
-           fprintf(stderr, "malformed chipset: %s\n", opt);
-      }
-      else if (strcmp(opt, "virtualWidth") == 0) {
-        if (sscanf(val, "%d", &dpy->driverContext.shared.virtualWidth) != 1)
-           fprintf(stderr, "malformed virtualWidth: %s\n", opt);
-      }
-      else if (strcmp(opt, "virtualHeight") == 0) {
-        if (sscanf(val, "%d", &dpy->driverContext.shared.virtualHeight) != 1)
-           fprintf(stderr, "malformed virutalHeight: %s\n", opt);
-      }
-      else if (strcmp(opt, "bpp") == 0) {
-        if (sscanf(val, "%d", &dpy->driverContext.bpp) != 1)
-           fprintf(stderr, "malformed bpp: %s\n", opt);
-        dpy->driverContext.cpp = dpy->driverContext.bpp / 8;
-      }
-      else if (strcmp(opt, "agpmode") == 0) {
-         if (sscanf(val, "%d", &dpy->driverContext.agpmode) != 1)
-            fprintf(stderr, "malformed agpmode: %s\n", opt);
-      }
-      else if (strcmp(opt, "isPCI") == 0) {
-        dpy->driverContext.isPCI = atoi(val) ? 1 : 0;
-      }
-      else if (strcmp(opt, "colorTiling") == 0) {
-        dpy->driverContext.colorTiling = atoi(val) ? 1 : 0;
-      }
-   }
-
-   fclose(file);
-
-   if (dpy->driverContext.chipset == 0 && dpy->driverContext.pciBusID != 0) 
-      dpy->driverContext.chipset = get_chipset_from_busid( dpy );
-
-   return 1;
-}
-
-/**
- * Versioned name of the expected \c __driCreateNewScreen function.
- * 
- * The version of the last incompatible loader/driver inteface change is
- * appended to the name of the \c __driCreateNewScreen function.  This
- * prevents loaders from trying to load drivers that are too old.
- * 
- * \todo
- * Create a macro or something so that this is automatically updated.
- */
-static const char createNewScreenName[] = "__driCreateNewScreen_20050727";
-
-
-static int InitDriver( Display *dpy )
-{
-   /*
-    * Begin DRI setup.
-    * We're kind of combining the per-display and per-screen information
-    * which was kept separate in XFree86/DRI's libGL.
-    */
-   dpy->dlHandle = dlopen(dpy->clientDriverName, RTLD_NOW | RTLD_GLOBAL);
-   if (!dpy->dlHandle) {
-      fprintf(stderr, "Unable to open %s: %s\n", dpy->clientDriverName,
-             dlerror());
-      goto failed;
-   }
-
-   /* Pull in Mini GLX specific hooks:
-    */
-   dpy->driver = (struct DRIDriverRec *) dlsym(dpy->dlHandle,
-                                               "__driDriver");
-   if (!dpy->driver) {
-      fprintf(stderr, "Couldn't find __driDriver in %s\n",
-              dpy->clientDriverName);
-      goto failed;
-   }
-
-   /* Pull in standard DRI client-side driver hooks:
-    */
-   dpy->createNewScreen = (PFNCREATENEWSCREENFUNC)
-           dlsym(dpy->dlHandle, createNewScreenName);
-   if (!dpy->createNewScreen) {
-      fprintf(stderr, "Couldn't find %s in %s\n", createNewScreenName,
-              dpy->clientDriverName);
-      goto failed;
-   }
-
-   return GL_TRUE;
-
-failed:
-   if (dpy->dlHandle) {
-       dlclose(dpy->dlHandle);
-       dpy->dlHandle = 0;
-   }
-   return GL_FALSE;
-}
-
-
-/**********************************************************************/
-/** \name Public API functions (Xlib and GLX)                         */
-/**********************************************************************/
-/*@{*/
-
-
-/**
- * \brief Initialize the graphics system.
- * 
- * \param display_name currently ignored. It is recommended to pass it as NULL.
- * \return a pointer to a #Display if the function is able to initialize
- * the graphics system, NULL otherwise.
- * 
- * Allocates a MiniGLXDisplayRec structure and fills in with information from a
- * configuration file. 
- *
- * Calls OpenFBDev() to open the framebuffer device and calls
- * DRIDriverRec::initFBDev to do the client-side initialization on it.
- *
- * Loads the DRI driver and pulls in Mini GLX specific hooks into a
- * DRIDriverRec structure, and the standard DRI \e __driCreateScreen hook.
- * Asks the driver for a list of supported visuals.  Performs the per-screen
- * client-side initialization.  Also setups the callbacks in the screen private
- * information.
- *
- * Does the framebuffer device setup. Calls __miniglx_open_connections() to
- * serve clients.
- */
-Display *
-__miniglx_StartServer( const char *display_name )
-{
-   Display *dpy;
-   int use_vt = 0;
-
-   pci_system_init();
-
-   dpy = (Display *)calloc(1, sizeof(Display));
-   if (!dpy)
-      return NULL;
-
-   dpy->IsClient = False;
-
-   if (!__read_config_file( dpy )) {
-      fprintf(stderr, "Couldn't get configuration details\n");
-      free(dpy);
-      return NULL;
-   }
-
-   /* Open the fbdev device
-    */
-   if (!OpenFBDev(dpy, use_vt)) {
-      fprintf(stderr, "OpenFBDev failed\n");
-      free(dpy);
-      return NULL;
-   }
-
-   if (!InitDriver(dpy)) {
-      fprintf(stderr, "InitDriver failed\n");
-      free(dpy);
-      return NULL;
-   }
-
-   /* Perform the initialization normally done in the X server 
-    */
-   if (!dpy->driver->initFBDev( &dpy->driverContext )) {
-      fprintf(stderr, "%s: __driInitFBDev failed\n", __FUNCTION__);
-      dlclose(dpy->dlHandle);
-      return GL_FALSE;
-   }
-
-   /* do fbdev setup
-    */
-   if (!SetupFBDev(dpy)) {
-      fprintf(stderr, "SetupFBDev failed\n");
-      free(dpy);
-      return NULL;
-   }
-
-   /* unlock here if not using VT -- JDS */
-   if (!use_vt) {
-       if (dpy->driver->restoreHardware)
-          dpy->driver->restoreHardware( &dpy->driverContext ); 
-       DRM_UNLOCK( dpy->driverContext.drmFD,
-                  dpy->driverContext.pSAREA,
-                  dpy->driverContext.serverContext );
-       dpy->hwActive = 1;
-   }
-
-   /* Ready for clients:
-    */
-   if (!__miniglx_open_connections(dpy)) {
-      free(dpy);
-      return NULL;
-   }
-      
-   return dpy;
-}
-
-
-/**
- * Implement \c __DRIinterfaceMethods::getProcAddress.
- */
-static __DRIfuncPtr get_proc_address( const char * proc_name )
-{
-    (void) proc_name;
-    return NULL;
-}
-
-
-/**
- * Table of functions exported by the loader to the driver.
- */
-static const __DRIinterfaceMethods interface_methods = {
-    get_proc_address,
-
-    _gl_context_modes_create,
-    _gl_context_modes_destroy,
-      
-    __glXFindDRIScreen,
-    __glXWindowExists,
-      
-    __glXCreateContextWithConfig,
-    xf86DRI_DestroyContext,
-
-    xf86DRI_CreateDrawable,
-    xf86DRI_DestroyDrawable,
-    __glXGetDrawableInfo,
-
-    __glXGetUST,
-    __glXGetMscRate,
-};
-
-
-static void *
-CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
-{
-    void *psp = NULL;
-    drm_handle_t hSAREA;
-    drmAddress pSAREA;
-    const char *BusID;
-    int   i;
-    __DRIversion   ddx_version;
-    __DRIversion   dri_version;
-    __DRIversion   drm_version;
-    __DRIframebuffer  framebuffer;
-    int   fd = -1;
-    int   status;
-    const char * err_msg;
-    const char * err_extra;
-    drmVersionPtr version;
-    drm_handle_t  hFB;
-    drm_magic_t magic;
-
-
-    hSAREA = dpy->driverContext.shared.hSAREA;
-    BusID = dpy->driverContext.pciBusID;
-
-    fd = drmOpen(NULL, BusID);
-
-    err_msg = "open DRM";
-    err_extra = strerror( -fd );
-
-    if (fd < 0) goto done;
-
-    err_msg = "drmGetMagic";
-    err_extra = NULL;
-
-    if (drmGetMagic(fd, &magic)) goto done;
-    
-    dpy->authorized = False;
-    send_char_msg( dpy, 0, _Authorize );
-    send_msg( dpy, 0, &magic, sizeof(magic));
-    
-    /* force net buffer flush */
-    while (!dpy->authorized)
-      handle_fd_events( dpy, 0 );
-
-    version = drmGetVersion(fd);
-    if (version) {
-        drm_version.major = version->version_major;
-        drm_version.minor = version->version_minor;
-        drm_version.patch = version->version_patchlevel;
-        drmFreeVersion(version);
-    }
-    else {
-        drm_version.major = -1;
-        drm_version.minor = -1;
-        drm_version.patch = -1;
-    }
-
-    /*
-     * Get device name (like "tdfx") and the ddx version numbers.
-     * We'll check the version in each DRI driver's "createScreen"
-     * function.
-     */
-    ddx_version.major = -1;
-    ddx_version.minor = 0;
-    ddx_version.patch = 0;
-
-    /*
-     * Get the DRI X extension version.
-     */
-    dri_version.major = 4;
-    dri_version.minor = 0;
-    dri_version.patch = 0;
-
-    /*
-     * Get device-specific info.  pDevPriv will point to a struct
-     * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h)
-     * that has information about the screen size, depth, pitch,
-     * ancilliary buffers, DRM mmap handles, etc.
-     */
-    hFB = dpy->driverContext.shared.hFrameBuffer;
-    framebuffer.size = dpy->driverContext.shared.fbSize;
-    framebuffer.stride = dpy->driverContext.shared.fbStride;
-    framebuffer.dev_priv_size = dpy->driverContext.driverClientMsgSize;
-    framebuffer.dev_priv = dpy->driverContext.driverClientMsg;
-    framebuffer.width = dpy->driverContext.shared.virtualWidth;
-    framebuffer.height = dpy->driverContext.shared.virtualHeight;
-
-    /*
-     * Map the framebuffer region.
-     */
-    status = drmMap(fd, hFB, framebuffer.size, 
-            (drmAddressPtr)&framebuffer.base);
-
-    err_msg = "drmMap of framebuffer";
-    err_extra = strerror( -status );
-
-    if ( status != 0 ) goto done;
-
-    /*
-     * Map the SAREA region.  Further mmap regions may be setup in
-     * each DRI driver's "createScreen" function.
-     */
-    status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
-
-    err_msg = "drmMap of sarea";
-    err_extra = strerror( -status );
-
-    if ( status == 0 ) {
-        err_msg = "InitDriver";
-        err_extra = NULL;
-        psp = dpy->createNewScreen(dpy, scrn, psc, NULL,
-                & ddx_version,
-                & dri_version,
-                & drm_version,
-                & framebuffer,
-                pSAREA,
-                fd,
-                20050727,
-               & interface_methods,
-                (__GLcontextModes **) &dpy->driver_modes);
-
-       /* fill in dummy visual ids */
-       {
-         __GLcontextModes *temp;
-         temp = (__GLcontextModes *)dpy->driver_modes;
-         i = 1;
-         while (temp)
-         {
-           temp->visualID = i++;
-           temp=temp->next;
-         }
-       }
-    }
-    
-done:
-    if ( psp == NULL ) {
-        if ( pSAREA != MAP_FAILED ) {
-            (void)drmUnmap(pSAREA, SAREA_MAX);
-        }
-
-        if ( framebuffer.base != MAP_FAILED ) {
-            (void)drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
-        }
-
-        if ( framebuffer.dev_priv != NULL ) {
-            free(framebuffer.dev_priv);
-        }
-
-        if ( fd >= 0 ) {
-            (void)drmClose(fd);
-        }
-
-        if ( err_extra != NULL ) {
-            fprintf(stderr, "libGL error: %s failed (%s)\n", err_msg,
-                    err_extra);
-        }
-        else {
-            fprintf(stderr, "libGL error: %s failed\n", err_msg );
-        }
-
-        fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n");
-    }
-
-    return psp;
-}
-
-/**
- * \brief Initialize the graphics system.
- * 
- * \param display_name currently ignored. It is recommended to pass it as NULL.
- * \return a pointer to a #Display if the function is able to initialize
- * the graphics system, NULL otherwise.
- * 
- * Allocates a MiniGLXDisplayRec structure and fills in with information from a
- * configuration file. 
- *
- * Calls __miniglx_open_connections() to connect to the server.
- * 
- * Loads the DRI driver and pulls in Mini GLX specific hooks into a
- * DRIDriverRec structure, and the standard DRI \e __driCreateScreen hook.
- * Asks the driver for a list of supported visuals.  Performs the per-screen
- * client-side initialization.  Also setups the callbacks in the screen private
- * information.
- *
- * \todo
- *   - read config file
- *      - what about virtualWidth, etc?
- *   - determine dpy->driverClientMsgSize,
- *   - allocate dpy->driverClientMsg
- */
-Display *
-XOpenDisplay( const char *display_name )
-{
-   Display *dpy;
-
-   dpy = (Display *)calloc(1, sizeof(Display));
-   if (!dpy)
-      return NULL;
-
-   dpy->IsClient = True;
-
-   /* read config file 
-    */
-   if (!__read_config_file( dpy )) {
-      fprintf(stderr, "Couldn't get configuration details\n");
-      free(dpy);
-      return NULL;
-   }
-
-   /* Connect to the server and receive driverClientMsg
-    */
-   if (!__miniglx_open_connections(dpy)) {
-      free(dpy);
-      return NULL;
-   }
-
-   /* dlopen the driver .so file
-    */
-   if (!InitDriver(dpy)) {
-      fprintf(stderr, "InitDriver failed\n");
-      free(dpy);
-      return NULL;
-   }
-
-   /* Perform the client-side initialization.  
-    *
-    * Clearly there is a limit of one on the number of windows in
-    * existence at any time.
-    *
-    * Need to shut down DRM and free DRI data in XDestroyWindow(), too.
-    */
-   dpy->driScreen.private = CallCreateNewScreen(dpy, 0, &dpy->driScreen);
-   if (!dpy->driScreen.private) {
-      fprintf(stderr, "%s: __driCreateScreen failed\n", __FUNCTION__);
-      dlclose(dpy->dlHandle);
-      free(dpy);
-      return NULL;
-   }
-   
-   /* Anything more to do?
-    */
-   return dpy;
-}
-
-
-/**
- * \brief Release display resources.
- * 
- * When the application is about to exit, the resources associated with the
- * graphics system can be released by calling this function.
- * 
- * \param dpy display handle. It becomes invalid at this point.
- * 
- * Destroys the window if any, and destroys the per-screen
- * driver private information.
- * Calls __miniglx_close_connections().
- * 
- * If a server, puts the the framebuffer back into the initial state.
- *
- * Finally frees the display structure.
- */
-void
-XCloseDisplay( Display *dpy )
-{
-   glXMakeCurrent( dpy, NULL, NULL);
-
-   if (dpy->NumWindows) 
-      XDestroyWindow( dpy, dpy->TheWindow );
-
-   /* As this is done in XOpenDisplay, need to undo it here:
-    */
-   dpy->driScreen.destroyScreen(dpy, 0, dpy->driScreen.private);
-
-   __miniglx_close_connections( dpy );
-
-   if (!dpy->IsClient) {
-      /* put framebuffer back to initial state 
-       */
-      (*dpy->driver->haltFBDev)( &dpy->driverContext );
-      RestoreFBDev(dpy);
-      CloseFBDev(dpy);
-   }
-
-   dlclose(dpy->dlHandle);
-   free(dpy);
-}
-
-
-/**
- * \brief Window creation.
- *
- * \param display a display handle, as returned by XOpenDisplay().
- * \param parent the parent window for the new window. For Mini GLX this should
- * be 
- * \code RootWindow(display, 0) \endcode
- * \param x the window abscissa. For Mini GLX, it should be zero.
- * \param y the window ordinate. For Mini GLX, it should be zero.
- * \param width the window width. For Mini GLX, this specifies the desired
- * screen width such as 1024 or 1280. 
- * \param height the window height. For Mini GLX, this specifies the desired
- * screen height such as 768 or 1024.
- * \param border_width the border width. For Mini GLX, it should be zero.
- * \param depth the window pixel depth. For Mini GLX, this should be the depth
- * found in the #XVisualInfo object returned by glXChooseVisual() 
- * \param winclass the window class. For Mini GLX this value should be
- * #InputOutput.
- * \param visual the visual type. It should be the visual field of the
- * #XVisualInfo object returned by glXChooseVisual().
- * \param valuemask which fields of the XSetWindowAttributes() are to be used.
- * For Mini GLX this is typically the bitmask 
- * \code CWBackPixel | CWBorderPixel | CWColormap \endcode
- * \param attributes initial window attributes. The
- * XSetWindowAttributes::background_pixel, XSetWindowAttributes::border_pixel
- * and XSetWindowAttributes::colormap fields should be set.
- *
- * \return a window handle if it succeeds or zero if it fails.
- * 
- * \note For Mini GLX, windows are full-screen; they cover the entire frame
- * buffer.  Also, Mini GLX imposes a limit of one window. A second window
- * cannot be created until the first one is destroyed.
- *
- * This function creates and initializes a ::MiniGLXWindowRec structure after
- * ensuring that there is no other window created.  Performs the per-drawable
- * client-side initialization calling the __DRIscreenRec::createDrawable
- * method.
- * 
- */
-Window
-XCreateWindow( Display *dpy, Window parent, int x, int y,
-               unsigned int width, unsigned int height,
-               unsigned int border_width, int depth, unsigned int winclass,
-               Visual *visual, unsigned long valuemask,
-               XSetWindowAttributes *attributes )
-{
-   const int empty_attribute_list[1] = { None };
-
-   Window win;
-
-   /* ignored */
-   (void) x;
-   (void) y;
-   (void) border_width;
-   (void) depth;
-   (void) winclass;
-   (void) valuemask;
-   (void) attributes;
-
-   if (!dpy->IsClient) {
-      fprintf(stderr, "Server process may not create windows (currently)\n");
-      return NULL;
-   }
-
-   if (dpy->NumWindows > 0)
-      return NULL;  /* only allow one window */
-
-   assert(dpy->TheWindow == NULL);
-
-   win = malloc(sizeof(struct MiniGLXWindowRec));
-   if (!win)
-      return NULL;
-
-   /* In rotated mode, translate incoming x,y,width,height into
-    * 'normal' coordinates.
-    */
-   if (dpy->rotateMode) {
-      int tmp;
-      tmp = width; width = height; height = tmp;
-      tmp = x; x = y; y = tmp;
-   }
-
-   /* init other per-window fields */
-   win->x = x;
-   win->y = y;
-   win->w = width;
-   win->h = height;
-   win->visual = visual;  /* ptr assignment */
-
-   win->bytesPerPixel = dpy->driverContext.cpp;
-   win->rowStride = dpy->driverContext.shared.virtualWidth * win->bytesPerPixel;
-   win->size = win->rowStride * height; 
-   win->frontStart = dpy->driverContext.FBAddress + (win->rowStride * win->x) + (win->y * win->bytesPerPixel);
-   win->frontBottom = (GLubyte *) win->frontStart + (height-1) * win->rowStride;
-
-   /* This is incorrect: the hardware driver could put the backbuffer
-    * just about anywhere.  These fields, including the above are
-    * hardware dependent & don't really belong here.
-    */
-   if (visual->mode->doubleBufferMode) {
-      win->backStart = (GLubyte *) win->frontStart +
-        win->rowStride * dpy->driverContext.shared.virtualHeight;
-      win->backBottom = (GLubyte *) win->backStart
-        + (height - 1) * win->rowStride;
-      win->curBottom = win->backBottom;
-   }
-   else {
-      /* single buffered */
-      win->backStart = NULL;
-      win->backBottom = NULL;
-      win->curBottom = win->frontBottom;
-   }
-
-   dpy->driScreen.createNewDrawable(dpy, visual->mode, (int) win,
-           &win->driDrawable, GLX_WINDOW_BIT, empty_attribute_list);
-
-   if (!win->driDrawable.private) {
-      fprintf(stderr, "%s: dri.createDrawable failed\n", __FUNCTION__);
-      free(win);
-      return NULL;
-   }
-
-   dpy->NumWindows++;
-   dpy->TheWindow = win;
-
-   return win; 
-}
-
-
-/**
- * \brief Destroy window.
- *
- * \param display display handle.
- * \param w window handle.
- *
- * This function calls XUnmapWindow() and frees window \p w.
- * 
- * In case of destroying the current buffer first unbinds the GLX context
- * by calling glXMakeCurrent() with no drawable.
- */
-void
-XDestroyWindow( Display *display, Window win )
-{
-   if (display && display->IsClient && win) {
-      /* check if destroying the current buffer */
-      Window curDraw = glXGetCurrentDrawable();
-      if (win == curDraw) {
-         glXMakeCurrent( display, NULL, NULL);
-      }
-
-      XUnmapWindow( display, win );
-
-      /* Destroy the drawable. */
-      win->driDrawable.destroyDrawable(display, win->driDrawable.private);
-      free(win);
-      
-      /* unlink window from display */
-      display->NumWindows--;
-      assert(display->NumWindows == 0);
-      display->TheWindow = NULL;
-   }
-}
-
-
-
-
-/**
- * \brief Create color map structure.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param w the window on whose screen you want to create a color map. This
- * parameter is ignored by Mini GLX but should be the value returned by the
- * \code RootWindow(display, 0) \endcode macro.
- * \param visual a visual type supported on the screen. This parameter is
- * ignored by Mini GLX but should be the XVisualInfo::visual returned by
- * glXChooseVisual().
- * \param alloc the color map entries to be allocated. This parameter is ignored
- * by Mini GLX but should be set to #AllocNone.
- *
- * \return the color map.
- * 
- * This function is only provided to ease porting.  Practically a no-op -
- * returns a pointer to a dynamically allocated chunk of memory (one byte).
- */
-Colormap
-XCreateColormap( Display *dpy, Window w, Visual *visual, int alloc )
-{
-   (void) dpy;
-   (void) w;
-   (void) visual;
-   (void) alloc;
-   return (Colormap) malloc(1);
-}
-
-
-/**
- * \brief Destroy color map structure.
- *
- * \param display The display handle as returned by XOpenDisplay().
- * \param colormap the color map to destroy.
- *
- * This function is only provided to ease porting.  Practically a no-op. 
- *
- * Frees the memory pointed by \p colormap.
- */
-void
-XFreeColormap( Display *display, Colormap colormap )
-{
-   (void) display;
-   (void) colormap;
-   free(colormap);
-}
-
-
-/**
- * \brief Free client data.
- *
- * \param data the data that is to be freed.
- *
- * Frees the memory pointed by \p data.
- */
-void
-XFree( void *data )
-{
-   free(data);
-}
-
-
-/**
- * \brief Query available visuals.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param vinfo_mask a bitmask indicating which fields of the \p vinfo_template
- * are to be matched.  The value must be \c VisualScreenMask.
- * \param vinfo_template a template whose fields indicate which visual
- * attributes must be matched by the results.  The XVisualInfo::screen field of
- * this structure must be zero.
- * \param nitens_return will hold the number of visuals returned.
- *
- * \return the address of an array of all available visuals.
- * 
- * An example of using XGetVisualInfo() to get all available visuals follows:
- * 
- * \code
- * XVisualInfo vinfo_template, *results;
- * int nitens_return;
- * Display *dpy = XOpenDisplay(NULL);
- * vinfo_template.screen = 0;
- * results = XGetVisualInfo(dpy, VisualScreenMask, &vinfo_template, &nitens_return);
- * \endcode
- * 
- * Returns the list of all ::XVisualInfo available, one per
- * ::__GLcontextMode stored in MiniGLXDisplayRec::modes.
- */
-XVisualInfo *
-XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int *nitens_return )
-{
-   const __GLcontextModes *mode;
-   XVisualInfo *results;
-   Visual *visResults;
-   int i, n=0;
-
-   //   ASSERT(vinfo_mask == VisualScreenMask);
-   ASSERT(vinfo_template.screen == 0);
-
-   if (vinfo_mask == VisualIDMask)
-   {
-     for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
-       if (mode->visualID == vinfo_template->visualid)
-        n=1;
-
-     if (n==0)
-       return NULL;
-     
-     results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
-     if (!results) {
-       *nitens_return = 0;
-       return NULL;
-     }
-     
-     visResults = (Visual *)calloc(1, n * sizeof(Visual));
-     if (!results) {
-       free(results);
-       *nitens_return = 0;
-       return NULL;
-     }
-
-     for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
-       if (mode->visualID == vinfo_template->visualid)
-       {
-        visResults[0].mode=mode;
-        visResults[0].visInfo = results;
-        visResults[0].dpy = dpy;
-        if (dpy->driverContext.bpp == 32)
-          visResults[0].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
-        else
-          visResults[0].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
-       
-        results[0].visual = visResults;
-        results[0].visualid = mode->visualID;
-#if defined(__cplusplus) || defined(c_plusplus)
-        results[0].c_class = TrueColor;
-#else
-        results[0].class = TrueColor;
-#endif
-        results[0].depth = mode->redBits +
-          mode->redBits +
-          mode->redBits +
-          mode->redBits;
-        results[0].bits_per_rgb = dpy->driverContext.bpp;
-        
-       }
-     
-   }
-   else // if (vinfo_mask == VisualScreenMask)
-   {
-     n = 0;
-     for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next )
-       n++;
-     
-     results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
-     if (!results) {
-       *nitens_return = 0;
-       return NULL;
-     }
-     
-     visResults = (Visual *)calloc(1, n * sizeof(Visual));
-     if (!results) {
-       free(results);
-       *nitens_return = 0;
-       return NULL;
-     }
-     
-     for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) {
-       visResults[i].mode = mode;
-       visResults[i].visInfo = results + i;
-       visResults[i].dpy = dpy;
-       
-       if (dpy->driverContext.bpp == 32)
-        visResults[i].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
-       else
-        visResults[i].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
-       
-       results[i].visual = visResults + i;
-       results[i].visualid = mode->visualID;
-#if defined(__cplusplus) || defined(c_plusplus)
-       results[i].c_class = TrueColor;
-#else
-       results[i].class = TrueColor;
-#endif
-       results[i].depth = mode->redBits +
-        mode->redBits +
-        mode->redBits +
-        mode->redBits;
-       results[i].bits_per_rgb = dpy->driverContext.bpp;
-     }
-   }
-   *nitens_return = n;
-   return results;
-}
-
-
-/**
- * \brief Return a visual that matches specified attributes.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param screen the screen number. It is currently ignored by Mini GLX and
- * should be zero.
- * \param attribList a list of GLX attributes which describe the desired pixel
- * format. It is terminated by the token \c None. 
- *
- * The attributes are as follows:
- * \arg GLX_USE_GL:
- * This attribute should always be present in order to maintain compatibility
- * with GLX.
- * \arg GLX_RGBA:
- * If present, only RGBA pixel formats will be considered. Otherwise, only
- * color index formats are considered.
- * \arg GLX_DOUBLEBUFFER:
- * if present, only double-buffered pixel formats will be chosen.
- * \arg GLX_RED_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per red pixel component that is acceptable.
- * \arg GLX_GREEN_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per green pixel component that is acceptable.
- * \arg GLX_BLUE_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per blue pixel component that is acceptable.
- * \arg GLX_ALPHA_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per alpha pixel component that is acceptable.
- * \arg GLX_STENCIL_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per stencil value that is acceptable.
- * \arg GLX_DEPTH_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per depth component that is acceptable.
- * \arg None:
- * This token is used to terminate the attribute list.
- *
- * \return a pointer to an #XVisualInfo object which most closely matches the
- * requirements of the attribute list. If there is no visual which matches the
- * request, \c NULL will be returned.
- *
- * \note Visuals with accumulation buffers are not available.
- *
- * This function searches the list of available visual configurations in
- * MiniGLXDisplayRec::configs for a configuration which best matches the GLX
- * attribute list parameter.  A new ::XVisualInfo object is created which
- * describes the visual configuration.  The match criteria is described in the
- * specification.
- */
-XVisualInfo*
-glXChooseVisual( Display *dpy, int screen, int *attribList )
-{
-   const __GLcontextModes *mode;
-   Visual *vis;
-   XVisualInfo *visInfo;
-   const int *attrib;
-   GLboolean rgbFlag = GL_FALSE, dbFlag = GL_FALSE, stereoFlag = GL_FALSE;
-   GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits = 0;
-   GLint indexBits = 0, depthBits = 0, stencilBits = 0;
-   GLint numSamples = 0;
-   int i=0;
-
-   /*
-    * XXX in the future, <screen> might be interpreted as a VT
-    */
-   ASSERT(dpy);
-   ASSERT(screen == 0);
-
-   vis = (Visual *)calloc(1, sizeof(Visual));
-   if (!vis)
-      return NULL;
-
-   visInfo = (XVisualInfo *)malloc(sizeof(XVisualInfo));
-   if (!visInfo) {
-      free(vis);
-      return NULL;
-   }
-
-   visInfo->visual = vis;
-   vis->visInfo = visInfo;
-   vis->dpy = dpy;
-
-   /* parse the attribute list */
-   for (attrib = attribList; attrib && *attrib != None; attrib++) {
-      switch (attrib[0]) {
-      case GLX_DOUBLEBUFFER:
-         dbFlag = GL_TRUE;
-         break;
-      case GLX_RGBA:
-         rgbFlag = GL_TRUE;
-         break;
-      case GLX_RED_SIZE:
-         redBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_GREEN_SIZE:
-         greenBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_BLUE_SIZE:
-         blueBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_ALPHA_SIZE:
-         alphaBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_STENCIL_SIZE:
-         stencilBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_DEPTH_SIZE:
-         depthBits = attrib[1];
-         attrib++;
-         break;
-#if 0
-      case GLX_ACCUM_RED_SIZE:
-         accumRedBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_ACCUM_GREEN_SIZE:
-         accumGreenBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_ACCUM_BLUE_SIZE:
-         accumBlueBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_ACCUM_ALPHA_SIZE:
-         accumAlphaBits = attrib[1];
-         attrib++;
-         break;
-      case GLX_LEVEL:
-         /* ignored for now */
-         break;
-#endif
-      default:
-         /* unexpected token */
-         fprintf(stderr, "unexpected token in glXChooseVisual attrib list\n");
-         free(vis);
-         free(visInfo);
-         return NULL;
-      }
-   }
-
-   /* search screen configs for suitable visual */
-   (void) numSamples;
-   (void) indexBits;
-   (void) redBits;
-   (void) greenBits;
-   (void) blueBits;
-   (void) alphaBits;
-   (void) stereoFlag;
-   for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next ) {
-     i++;
-      if (mode->rgbMode == rgbFlag &&
-          mode->doubleBufferMode == dbFlag &&
-          mode->redBits >= redBits &&
-          mode->greenBits >= greenBits &&
-          mode->blueBits >= blueBits &&
-          mode->alphaBits >= alphaBits &&
-          mode->depthBits >= depthBits &&
-          mode->stencilBits >= stencilBits) {
-         /* found it */
-         visInfo->visualid = i;
-         vis->mode = mode;
-         break;
-      }          
-   }
-   if (!vis->mode)
-       return NULL;
-
-   /* compute depth and bpp */
-   if (rgbFlag) {
-      /* XXX maybe support depth 16 someday */
-#if defined(__cplusplus) || defined(c_plusplus)
-      visInfo->c_class = TrueColor;
-#else
-      visInfo->class = TrueColor;
-#endif
-      visInfo->depth = dpy->driverContext.bpp;
-      visInfo->bits_per_rgb = dpy->driverContext.bpp;
-      if (dpy->driverContext.bpp == 32)
-        vis->pixelFormat = PF_B8G8R8A8;
-      else
-        vis->pixelFormat = PF_B5G6R5;
-   }
-   else {
-      /* color index mode */
-#if defined(__cplusplus) || defined(c_plusplus)
-      visInfo->c_class = PseudoColor;
-#else
-      visInfo->class = PseudoColor;
-#endif
-      visInfo->depth = 8;
-      visInfo->bits_per_rgb = 8;  /* bits/pixel */
-      vis->pixelFormat = PF_CI8;
-   }
-
-   return visInfo;
-}
-
-
-/**
- * \brief Return information about GLX visuals.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param vis the visual to be queried, as returned by glXChooseVisual().
- * \param attrib the visual attribute to be returned.
- * \param value pointer to an integer in which the result of the query will be
- * stored.
- * 
- * \return zero if no error occurs, \c GLX_INVALID_ATTRIBUTE if the attribute
- * parameter is invalid, or \c GLX_BAD_VISUAL if the \p vis parameter is
- * invalid.
- *
- * Returns the appropriate attribute of ::__GLXvisualConfig pointed by
- * MiniGLXVisualRec::glxConfig of XVisualInfo::visual.
- *
- * \sa data types.
- */
-int
-glXGetConfig( Display *dpy, XVisualInfo *vis, int attrib, int *value )
-{
-   const __GLcontextModes *mode = vis->visual->mode;
-   if (!mode) {
-      *value = 0;
-      return GLX_BAD_VISUAL;
-   }
-
-   switch (attrib) {
-   case GLX_USE_GL:
-      *value = True;
-      return 0;
-   case GLX_RGBA:
-      *value = mode->rgbMode;
-      return 0;
-   case GLX_DOUBLEBUFFER:
-      *value = mode->doubleBufferMode;
-      return 0;
-   case GLX_RED_SIZE:
-      *value = mode->redBits;
-      return 0;
-   case GLX_GREEN_SIZE:
-      *value = mode->greenBits;
-      return 0;
-   case GLX_BLUE_SIZE:
-      *value = mode->blueBits;
-      return 0;
-   case GLX_ALPHA_SIZE:
-      *value = mode->alphaBits;
-      return 0;
-   case GLX_DEPTH_SIZE:
-      *value = mode->depthBits;
-      return 0;
-   case GLX_STENCIL_SIZE:
-      *value = mode->stencilBits;
-      return 0;
-   default:
-      *value = 0;
-      return GLX_BAD_ATTRIBUTE;
-   }
-   return 0;
-}
-
-
-/**
- * \brief Create a new GLX rendering context.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param vis the visual that defines the frame buffer resources available to
- * the rendering context, as returned by glXChooseVisual().
- * \param shareList If non-zero, texture objects and display lists are shared
- * with the named rendering context. If zero, texture objects and display lists
- * will (initially) be private to this context. They may be shared when a
- * subsequent context is created.
- * \param direct whether direct or indirect rendering is desired. For Mini GLX
- * this value is ignored but it should be set to \c True.
- *
- * \return a ::GLXContext handle if it succeeds or zero if it fails due to
- * invalid parameter or insufficient resources.
- *
- * This function creates and initializes a ::MiniGLXContextRec structure and
- * calls the __DRIscreenRec::createContext method to initialize the client
- * private data.
- */ 
-GLXContext
-glXCreateContext( Display *dpy, XVisualInfo *vis,
-                        GLXContext shareList, Bool direct )
-{
-   GLXContext ctx;
-   void *sharePriv;
-
-   ASSERT(vis);
-
-   ctx = (struct MiniGLXContextRec *)calloc(1, sizeof(struct MiniGLXContextRec));
-   if (!ctx)
-      return NULL;
-
-   ctx->vid = vis->visualid;
-   if (shareList)
-      sharePriv = shareList->driContext.private;
-   else
-      sharePriv = NULL;
-  
-   ctx->driContext.mode = vis->visual->mode;
-   ctx->driContext.private = dpy->driScreen.createNewContext(dpy, vis->visual->mode,
-           GLX_WINDOW_BIT, sharePriv, &ctx->driContext);
-
-   if (!ctx->driContext.private) {
-      free(ctx);
-      return NULL;
-   }
-
-   return ctx;
-}
-
-
-/**
- * \brief Destroy a GLX context.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param ctx the GLX context to be destroyed.
- * 
- * This function frees the \p ctx parameter after unbinding the current context
- * by calling the __DRIcontextRec::bindContext method with zeros and calling
- * the __DRIcontextRec::destroyContext method.
- */
-void
-glXDestroyContext( Display *dpy, GLXContext ctx )
-{
-   GLXContext glxctx = glXGetCurrentContext();
-
-   if (ctx) {
-      if (glxctx == ctx) {
-         /* destroying current context */
-         ctx->driContext.bindContext(dpy, 0, 0, 0, 0);
-        CurrentContext = 0;
-      }
-      ctx->driContext.destroyContext(dpy, 0, ctx->driContext.private);
-      free(ctx);
-   }
-}
-
-
-/**
- * \brief Bind a GLX context to a window or a pixmap.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param drawable the window or drawable to bind to the rendering context.
- * This should be the value returned by XCreateWindow().
- * \param ctx the GLX context to be destroyed.
- *
- * \return \c True if it succeeds, \c False otherwise to indicate an invalid
- * display, window or context parameter.
- *
- * The current rendering context may be unbound by calling glXMakeCurrent()
- * with the window and context parameters set to zero.
- * 
- * An application may create any number of rendering contexts and bind them as
- * needed. Note that binding a rendering context is generally not a
- * light-weight operation.  Most simple OpenGL applications create only one
- * rendering context.
- *
- * This function first unbinds any old context via
- * __DRIcontextRec::unbindContext and binds the new one via
- * __DRIcontextRec::bindContext.
- *
- * If \p drawable is zero it unbinds the GLX context by calling
- * __DRIcontextRec::bindContext with zeros.
- */
-Bool
-glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx)
-{
-   if (dpy && drawable && ctx) {
-      GLXContext oldContext = glXGetCurrentContext();
-      GLXDrawable oldDrawable = glXGetCurrentDrawable();
-      /* unbind old */
-      if (oldContext) {
-         oldContext->driContext.unbindContext(dpy, 0,
-                 (__DRIid) oldDrawable, (__DRIid) oldDrawable,
-                 &oldContext->driContext);
-      }
-      /* bind new */
-      CurrentContext = ctx;
-      ctx->driContext.bindContext(dpy, 0, (__DRIid) drawable,
-              (__DRIid) drawable, &ctx->driContext);
-      ctx->drawBuffer = drawable;
-      ctx->curBuffer = drawable;
-   }
-   else if (ctx && dpy) {
-      /* unbind */
-      ctx->driContext.bindContext(dpy, 0, 0, 0, 0);
-   }
-   else if (dpy) {
-      CurrentContext = 0;      /* kw:  this seems to be intended??? */
-   }
-
-   return True;
-}
-
-
-/**
- * \brief Exchange front and back buffers.
- * 
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param drawable the drawable whose buffers are to be swapped.
- * 
- * Any pending rendering commands will be completed before the buffer swap
- * takes place.
- * 
- * Calling glXSwapBuffers() on a window which is single-buffered has no effect.
- *
- * This function just calls the __DRIdrawableRec::swapBuffers method to do the
- * work.
- */
-void
-glXSwapBuffers( Display *dpy, GLXDrawable drawable )
-{
-   if (!dpy || !drawable)
-      return;
-
-   drawable->driDrawable.swapBuffers(dpy, drawable->driDrawable.private);
-}
-
-
-/**
- * \brief Return the current context
- *
- * \return the current context, as specified by glXMakeCurrent(), or zero if no
- * context is currently bound.
- *
- * \sa glXCreateContext(), glXMakeCurrent()
- *
- * Returns the value of the ::CurrentContext global variable.
- */
-GLXContext
-glXGetCurrentContext( void )
-{
-   return CurrentContext;
-}
-
-
-/**
- * \brief Return the current drawable.
- *
- * \return the current drawable, as specified by glXMakeCurrent(), or zero if
- * no drawable is currently bound.
- *
- * This function gets the current context via glXGetCurrentContext() and
- * returns the MiniGLXContextRec::drawBuffer attribute.
- */
-GLXDrawable
-glXGetCurrentDrawable( void )
-{
-   GLXContext glxctx = glXGetCurrentContext();
-   if (glxctx)
-      return glxctx->drawBuffer;
-   else
-      return NULL;
-}
-
-
-static GLboolean
-__glXCreateContextWithConfig(__DRInativeDisplay *dpy, int screen,
-        int fbconfigID, void *contextID, drm_context_t *hHWContext)
-{
-    __DRIscreen *pDRIScreen;
-    __DRIscreen *psp;
-
-    pDRIScreen = __glXFindDRIScreen(dpy, screen);
-    if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
-        return GL_FALSE;
-    }
-
-    psp = (__DRIscreen *) pDRIScreen->private;
-
-    if (psp->fd) {
-        if (drmCreateContext(psp->fd, hHWContext)) {
-            fprintf(stderr, ">>> drmCreateContext failed\n");
-            return GL_FALSE;
-        }
-        *(void**)contextID = (void*) *hHWContext;
-    }
-
-    return GL_TRUE;
-}
-
-
-static GLboolean
-__glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
-        __DRIid draw, unsigned int * index, unsigned int * stamp,
-        int * x, int * y, int * width, int * height,
-        int * numClipRects, drm_clip_rect_t ** pClipRects,
-        int * backX, int * backY,
-        int * numBackClipRects, drm_clip_rect_t ** pBackClipRects)
-{
-    GLXDrawable drawable = (GLXDrawable) draw;
-    drm_clip_rect_t * cliprect;
-    Display* display = (Display*)dpy;
-    __DRIscreen *psp = display->driScreen.private;
-    __DRIcontext *pcp = (__DRIcontext *)CurrentContext->driContext.private;
-    __DRIdrawable *pdp = pcp->driDrawablePriv;
-    if (drawable == 0) {
-        return GL_FALSE;
-    }
-
-    cliprect = (drm_clip_rect_t*) _mesa_malloc(sizeof(drm_clip_rect_t));
-    cliprect->x1 = drawable->x;
-    cliprect->y1 = drawable->y;
-    cliprect->x2 = drawable->x + drawable->w;
-    cliprect->y2 = drawable->y + drawable->h;
-    
-    /* the drawable index is by client id */
-    *index = display->clientID;
-
-    *stamp = pcp->driScreenPriv->pSAREA->drawableTable[display->clientID].stamp;
-    drmUpdateDrawableInfo(psp->fd, pdp->hHWDrawable, DRM_DRAWABLE_CLIPRECTS, 1, cliprect);
-    *x = drawable->x;
-    *y = drawable->y;
-    *width = drawable->w;
-    *height = drawable->h;
-    *numClipRects = 1;
-    *pClipRects = cliprect;
-    
-    *backX = drawable->x;
-    *backY = drawable->y;
-    *numBackClipRects = 0;
-    *pBackClipRects = 0;
-
-    return GL_TRUE;
-}
-
-
-static GLboolean
-xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen, __DRIid context_id )
-{
-    return GL_TRUE;
-}
-
-
-static GLboolean
-xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable,
-        drm_drawable_t *hHWDrawable )
-{
-
-  Display *display = (Display *)dpy;
-  __DRIscreen *psp = display->driScreen.private;
-  int ret;
-  ret = drmCreateDrawable(psp->fd, hHWDrawable);
-  
-  fprintf(stderr, "drawable is %d %08X ret is %d\n", *hHWDrawable, drawable, -ret);
-  if (ret != 0)
-    return GL_FALSE;
-  return GL_TRUE;
-}
-
-
-static GLboolean
-xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
-{
-  return GL_TRUE;
-}
-
-
-/**
- * \brief Query function address.
- *
- * The glXGetProcAddress() function will return the address of any available
- * OpenGL or Mini GLX function.
- * 
- * \param procName name of the function to be returned.
- *
- * \return If \p procName is a valid function name, a pointer to that function
- * will be returned.  Otherwise, \c NULL will be returned.
- *
- * The purpose of glXGetProcAddress() is to facilitate using future extensions
- * to OpenGL or Mini GLX. If a future version of the library adds new extension
- * functions they'll be accessible via glXGetProcAddress(). The alternative is
- * to hard-code calls to the new functions in the application but doing so will
- * prevent linking the application with older versions of the library.
- * 
- * Returns the function address by looking up its name in a static (name,
- * address) pair list.
- */
-void (*glXGetProcAddress(const GLubyte *procname))( void ) 
-{
-   struct name_address {
-      const char *name;
-      const void *func;
-   };
-   static const struct name_address functions[] = {
-      { "glXChooseVisual", (void *) glXChooseVisual },
-      { "glXCreateContext", (void *) glXCreateContext },
-      { "glXDestroyContext", (void *) glXDestroyContext },
-      { "glXMakeCurrent", (void *) glXMakeCurrent },
-      { "glXSwapBuffers", (void *) glXSwapBuffers },
-      { "glXGetCurrentContext", (void *) glXGetCurrentContext },
-      { "glXGetCurrentDrawable", (void *) glXGetCurrentDrawable },
-      { "glXGetProcAddress", (void *) glXGetProcAddress },
-      { "XOpenDisplay", (void *) XOpenDisplay },
-      { "XCloseDisplay", (void *) XCloseDisplay },
-      { "XCreateWindow", (void *) XCreateWindow },
-      { "XDestroyWindow", (void *) XDestroyWindow },
-      { "XMapWindow", (void *) XMapWindow },
-      { "XCreateColormap", (void *) XCreateColormap },
-      { "XFreeColormap", (void *) XFreeColormap },
-      { "XFree", (void *) XFree },
-      { "XGetVisualinfo", (void *) XGetVisualInfo },
-      { "glXCreatePbuffer", (void *) glXCreatePbuffer },
-      { "glXDestroyPbuffer", (void *) glXDestroyPbuffer },
-      { "glXChooseFBConfig", (void *) glXChooseFBConfig },
-      { "glXGetVisualFromFBConfig", (void *) glXGetVisualFromFBConfig },
-      { NULL, NULL }
-   };
-   const struct name_address *entry;
-   for (entry = functions; entry->name; entry++) {
-      if (strcmp(entry->name, (const char *) procname) == 0) {
-         return entry->func;
-      }
-   }
-   return _glapi_get_proc_address((const char *) procname);
-}
-
-void (*glXGetProcAddressARB(const GLubyte *procName))( void ) __attribute__ ((alias ("glXGetProcAddress")));
-
-/**
- * \brief Query the Mini GLX version.
- *
- * \param dpy the display handle. It is currently ignored, but should be the
- * value returned by XOpenDisplay().
- * \param major receives the major version number of Mini GLX.
- * \param minor receives the minor version number of Mini GLX.
- *
- * \return \c True if the function succeeds, \c False if the function fails due
- * to invalid parameters.
- *
- * \sa #MINI_GLX_VERSION_1_0.
- * 
- * Returns the hard-coded Mini GLX version.
- */
-Bool
-glXQueryVersion( Display *dpy, int *major, int *minor )
-{
-   (void) dpy;
-   *major = 1;
-   *minor = 0;
-   return True;
-}
-
-
-/**
- * \brief Create a new pbuffer.
- */
-GLXPbuffer
-glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList )
-{
-   return NULL;
-}
-
-
-void
-glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf )
-{
-   free(pbuf);
-}
-
-
-GLXFBConfig *
-glXChooseFBConfig( Display *dpy, int screen, const int *attribList,
-                   int *nitems )
-{
-   GLXFBConfig *f = (GLXFBConfig *) malloc(sizeof(GLXFBConfig));
-   f->visInfo = glXChooseVisual( dpy, screen, (int *) attribList );
-   if (f->visInfo) { 
-      *nitems = 1;
-      return f;
-   }
-   else {
-      *nitems = 0;
-      free(f);
-      return NULL;
-   }
-}
-
-
-XVisualInfo *
-glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
-{
-   /* XVisualInfo and GLXFBConfig are the same structure */
-   (void) dpy;
-   return config.visInfo;
-}
-
-void *glXAllocateMemoryMESA(Display *dpy, int scrn,
-                            size_t size, float readFreq,
-                            float writeFreq, float priority)
-{
-    if (dpy->driScreen.private && dpy->driScreen.allocateMemory) {
-       return (*dpy->driScreen.allocateMemory)( dpy, scrn, size,
-                                                readFreq, writeFreq,
-                                                priority );
-    }
-
-    return NULL;
-}
-
-void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
-{
-    if (dpy->driScreen.private && dpy->driScreen.freeMemory) {
-       (*dpy->driScreen.freeMemory)( dpy, scrn, pointer );
-    }
-}
-
-GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
-                               const void *pointer )
-{
-    if (dpy->driScreen.private && dpy->driScreen.memoryOffset) {
-       return (*dpy->driScreen.memoryOffset)( dpy, scrn, pointer );
-    }
-
-    return 0;
-}
-
-
-/**
- * Get the unadjusted system time (UST).  Currently, the UST is measured in
- * microseconds since Epoc.  The actual resolution of the UST may vary from
- * system to system, and the units may vary from release to release.
- * Drivers should not call this function directly.  They should instead use
- * \c glXGetProcAddress to obtain a pointer to the function.
- *
- * \param ust Location to store the 64-bit UST
- * \returns Zero on success or a negative errno value on failure.
- *
- * \note
- * This function was copied directly from src/glx/x11/glxcmds.c.
- */
-static int __glXGetUST( int64_t * ust )
-{
-    struct timeval  tv;
-    
-    if ( ust == NULL ) {
-       return -EFAULT;
-    }
-
-    if ( gettimeofday( & tv, NULL ) == 0 ) {
-       ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
-       return 0;
-    } else {
-       return -errno;
-    }
-}
-
-
-/**
- * 
- * \bug
- * This needs to be implemented for miniGlx.
- */
-static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable,
-                                int32_t * numerator, int32_t * denominator)
-{
-    *numerator = 0;
-    *denominator = 0;
-    return False;
-}
-/*@}*/
diff --git a/src/glx/mini/miniglxP.h b/src/glx/mini/miniglxP.h
deleted file mode 100644 (file)
index 96ed0e8..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * \file miniglxP.h
- * \brief Define replacements for some X data types and define the DRI-related
- * data structures.
- *
- * \note Cut down version of glxclient.h.
- *
- */
-
-#ifndef _mini_GLX_client_h_
-#define _mini_GLX_client_h_
-
-#include <signal.h>
-#include <linux/fb.h>
-
-#include <GL/miniglx.h>
-#include "glheader.h"
-#include "mtypes.h"
-
-#include "driver.h"
-#include "GL/internal/dri_interface.h"
-
-/**
- * \brief Supported pixel formats.
- */
-enum PixelFormat {
-   PF_B8G8R8,    /**< \brief 24-bit BGR */
-   PF_B8G8R8A8,  /**< \brief 32-bit BGRA */
-   PF_B5G6R5,    /**< \brief 16-bit BGR */
-   PF_B5G5R5,    /**< \brief 15-bit BGR */
-   PF_CI8        /**< \brief 8-bit color index */
-};
-
-/**
- * \brief X Visual type.
- *
- * \sa ::Visual, \ref datatypes.
- */
-struct MiniGLXVisualRec {
-   /** \brief GLX visual information */
-   const __GLcontextModes *mode;
-
-   /** \brief pointer back to corresponding ::XVisualInfo */
-   XVisualInfo *visInfo;               
-
-   /** \brief display handle */
-   Display *dpy;
-
-   /** \brief pixel format */
-   enum PixelFormat pixelFormat;       
-};
-
-
-
-/**
- * \brief X Window type.
- *
- * \sa ::Window, \ref datatypes.
- */
-struct MiniGLXWindowRec {
-   Visual *visual;
-                                   /** \brief position (always 0,0) */
-   int x, y;
-                                   /** \brief size */
-   unsigned int w, h;
-   void *frontStart;               /**< \brief start of front color buffer */
-   void *backStart;                /**< \brief start of back color buffer */
-   size_t size;                    /**< \brief color buffer size, in bytes */
-   GLuint bytesPerPixel;
-   GLuint rowStride;               /**< \brief in bytes */
-   GLubyte *frontBottom;           /**< \brief pointer to last row */
-   GLubyte *backBottom;            /**< \brief pointer to last row */
-   GLubyte *curBottom;             /**<  = frontBottom or backBottom */
-   __DRIdrawable driDrawable;
-   GLuint ismapped;
-};
-
-
-/**
- * \brief GLXContext type.
- *
- * \sa ::GLXContext, \ref datatypes.
- */
-struct MiniGLXContextRec {
-   Window drawBuffer;       /**< \brief drawing buffer */
-   Window curBuffer;        /**< \brief current buffer */
-   VisualID vid;            /**< \brief visual ID */
-   __DRIcontext driContext; /**< \brief context dependent methods */
-};
-
-#define MINIGLX_BUF_SIZE 512
-#define MINIGLX_MAX_SERVER_FDS 10
-#define MINIGLX_MAX_CLIENT_FDS 1
-#define MINIGLX_EVENT_QUEUE_SZ 16
-#define MINIGLX_EVENT_QUEUE_MASK (MINIGLX_EVENT_QUEUE_SZ-1)
-
-/**
- * A connection to/from the server
- *
- * All information is to/from the server is buffered and then dispatched by 
- * __miniglx_Select() to avoid blocking the server.
- */
-struct MiniGLXConnection {
-   int fd;                             /**< \brief file descriptor */
-   char readbuf[MINIGLX_BUF_SIZE];     /**< \brief read buffer */
-   char writebuf[MINIGLX_BUF_SIZE];    /**< \brief write buffer */
-   int readbuf_count;                  /**< \brief count of bytes waiting to be read */
-   int writebuf_count;                 /**< \brief count of bytes waiting to be written */
-};
-
-
-/**
- * \brief X Display type
- *
- * \sa ::Display, \ref datatypes.
- */
-struct MiniGLXDisplayRec {
-   /** \brief fixed framebuffer screen info */
-   struct fb_fix_screeninfo FixedInfo; 
-   /** \brief original and current variable framebuffer screen info */
-   struct fb_var_screeninfo OrigVarInfo, VarInfo;
-   struct sigaction OrigSigUsr1;
-   struct sigaction OrigSigUsr2;
-   int OriginalVT;
-   int ConsoleFD;        /**< \brief console TTY device file descriptor */
-   int FrameBufferFD;    /**< \brief framebuffer device file descriptor */
-   int NumWindows;       /**< \brief number of open windows */
-   Window TheWindow;     /**< \brief open window - only allow one window for now */
-   int rotateMode;
-
-
-   volatile int vtSignalFlag;
-   volatile int haveVT;        /**< \brief whether the VT is hold */
-   int hwActive;       /**< \brief whether the hardware is active -- mimics
-                         the variations of MiniGLXDisplayRec::haveVT */
-
-
-   int IsClient;       /**< \brief whether it's a client or the server */
-   int clientID;
-   int nrFds;          /**< \brief number of connections (usually just one for the clients) */
-   struct MiniGLXConnection *fd;       /**< \brief connections */
-   int drmFd;           /**< \brief handle to drm device */
-   int authorized;      /**< \brief has server authorized this process? */
-
-   struct {
-      int nr, head, tail;
-      XEvent queue[MINIGLX_EVENT_QUEUE_SZ];
-   } eventqueue;
-   
-   /**
-    * \name Visuals 
-    *
-    * Visuals (configs) in this screen.
-    */
-   /*@{*/
-   const __GLcontextModes *driver_modes; /**< \brief Modes filtered by driver. */
-   /*@}*/
-    
-   /**
-   * \name From __GLXdisplayPrivate
-   */
-   /*@{*/
-   PFNCREATENEWSCREENFUNC createNewScreen; /**< \brief \e __driCreateScreen hook */
-   __DRIscreen driScreen;         /**< \brief Screen dependent methods */
-   void *dlHandle;                /**<
-                                  * \brief handle to the client dynamic
-                                  * library 
-                                  */
-   /*@}*/
-
-   /**
-    * \brief Mini GLX specific driver hooks
-    */
-   struct DRIDriverRec *driver;
-   struct DRIDriverContextRec driverContext;
-
-   /**
-    * \name Configuration details
-    *
-    * They are read from a configuration file by __read_config_file().
-    */
-   /*@{*/
-   const char *fbdevDevice;
-   const char *clientDriverName;
-   /*@}*/
-};
-
-/** Character messages. */
-enum msgs {
-   _CanIHaveFocus,
-   _IDontWantFocus,
-   _YouveGotFocus,
-   _YouveLostFocus,
-   _RepaintPlease,
-   _Authorize,
-};
-extern int send_msg( Display *dpy, int i, const void *msg, size_t sz );
-extern int send_char_msg( Display *dpy, int i, char msg );
-extern int blocking_read( Display *dpy, int connection, char *msg, size_t msg_size );
-extern int handle_fd_events( Display *dpy, int nonblock );
-
-extern int __miniglx_open_connections( Display *dpy );
-extern void __miniglx_close_connections( Display *dpy );
-
-#endif /* !_mini_GLX_client_h_ */
diff --git a/src/glx/mini/miniglx_events.c b/src/glx/mini/miniglx_events.c
deleted file mode 100644 (file)
index a20d584..0000000
+++ /dev/null
@@ -1,983 +0,0 @@
-/**
- * \file miniglx_events.c
- * \brief Mini GLX client/server communication functions.
- * \author Keith Whitwell
- *
- * The Mini GLX interface is a subset of the GLX interface, plus a
- * minimal set of Xlib functions.  This file adds interfaces to
- * arbitrate a single cliprect between multiple direct rendering
- * clients.
- *
- * A fairly complete client/server non-blocking communication
- * mechanism.  Probably overkill given that none of our messages
- * currently exceed 1 byte in length and take place over the
- * relatively benign channel provided by a Unix domain socket.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version:  5.0
- *
- * 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.
- */
-
-
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-
-#include <linux/kd.h>
-#include <linux/vt.h>
-
-#include "xf86drm.h"
-#include "miniglxP.h"
-
-
-#define MINIGLX_FIFO_NAME "/tmp/miniglx.fifo"
-
-/**
- * \brief Allocate an XEvent structure on the event queue.
- *
- * \param dpy the display handle.
- *
- * \return Pointer to the queued event structure or NULL on failure.
- * 
- * \internal 
- * If there is space on the XEvent queue, return a pointer
- * to the next free event and increment the eventqueue tail value.
- * Otherwise return null.
- */
-static XEvent *queue_event( Display *dpy )
-{
-   int incr = (dpy->eventqueue.tail + 1) & MINIGLX_EVENT_QUEUE_MASK;
-   if (incr == dpy->eventqueue.head) {
-      return 0;
-   }
-   else {
-      XEvent *ev = &dpy->eventqueue.queue[dpy->eventqueue.tail];
-      dpy->eventqueue.tail = incr;
-      return ev;
-   }
-}
-
-/**
- * \brief Dequeue an XEvent and copy it into provided storage.
- *
- * \param dpy the display handle.
- * \param event_return pointer to copy the queued event to.
- *
- * \return True or False depending on success.
- * 
- * \internal 
- * If there is a queued XEvent on the queue, copy it to the provided
- * pointer and increment the eventqueue head value.  Otherwise return
- * null.
- */
-static int dequeue_event( Display *dpy, XEvent *event_return )
-{
-   if (dpy->eventqueue.tail == dpy->eventqueue.head) {
-      return False;
-   }
-   else {
-      *event_return = dpy->eventqueue.queue[dpy->eventqueue.head];      
-      dpy->eventqueue.head += 1;
-      dpy->eventqueue.head &= MINIGLX_EVENT_QUEUE_MASK;
-      return True;
-   }
-}
-
-/**
- * \brief Shutdown a socket connection.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- *
- * \internal 
- * Shutdown and close the file descriptor.  If this is the special
- * connection in fd[0], issue an error message and exit - there's been
- * some sort of failure somewhere.  Otherwise, let the application
- * know about whats happened by issuing a DestroyNotify event.
- */
-static void shut_fd( Display *dpy, int i )
-{
-   if (dpy->fd[i].fd < 0) 
-      return;
-
-   shutdown (dpy->fd[i].fd, SHUT_RDWR);
-   close (dpy->fd[i].fd);
-   dpy->fd[i].fd = -1;
-   dpy->fd[i].readbuf_count = 0;
-   dpy->fd[i].writebuf_count = 0;
-
-   if (i == 0) {
-      fprintf(stderr, "server connection lost\n");
-      exit(1);
-   }
-   else {
-      /* Pass this to the application as a DestroyNotify event.
-       */
-      XEvent *er = queue_event(dpy);
-      if (!er) return;
-      er->xdestroywindow.type = DestroyNotify;
-      er->xdestroywindow.serial = 0;
-      er->xdestroywindow.send_event = 0;
-      er->xdestroywindow.display = dpy;
-      er->xdestroywindow.window = (Window)i;
-
-      drmGetLock(dpy->driverContext.drmFD, 1, 0);
-      drmUnlock(dpy->driverContext.drmFD, 1);
-   }
-}
-
-/**
- * \brief Send a message to a socket connection.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- * \param msg the message to send.
- * \param sz the size of the message
- *
- * \internal 
- * Copy the message to the write buffer for the nominated connection.
- * This will be actually sent to that file descriptor from
- * __miniglx_Select().
- */
-int send_msg( Display *dpy, int i,
-                    const void *msg, size_t sz )
-{
-   int cnt = dpy->fd[i].writebuf_count;
-   if (MINIGLX_BUF_SIZE - cnt < sz) {
-      fprintf(stderr, "client %d: writebuf overflow\n", i);
-      return False;
-   }
-   
-   memcpy( dpy->fd[i].writebuf + cnt, msg, sz ); cnt += sz;
-   dpy->fd[i].writebuf_count = cnt;
-   return True;
-}
-
-/**
- * \brief Send a message to a socket connection.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- * \param msg the message to send.
- *
- * \internal 
- * Use send_msg() to send a one-byte message to a socket.
- */
-int send_char_msg( Display *dpy, int i, char msg )
-{
-   return send_msg( dpy, i, &msg, sizeof(char));
-}
-
-
-/**
- * \brief Block and receive a message from a socket connection.
- *
- * \param dpy the display handle.
- * \param connection the index in dpy->fd of the socket connection.
- * \param msg storage for the received message.
- * \param msg_size the number of bytes to read.
- *
- * \internal 
- * Block and read from the connection's file descriptor
- * until msg_size bytes have been received.  
- *
- * Only called from welcome_message_part().
- */
-int blocking_read( Display *dpy, int connection, 
-                         char *msg, size_t msg_size )
-{
-   int i, r;
-
-   for (i = 0 ; i < msg_size ; i += r) {
-      r = read(dpy->fd[connection].fd, msg + i, msg_size - i);
-      if (r < 1) {
-        fprintf(stderr, "blocking_read: %d %s\n", r, strerror(errno));
-        shut_fd(dpy,connection);
-        return False;
-      }
-   }
-
-   return True;
-}
-
-/**
- * \brief Send/receive a part of the welcome message.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- * \param msg storage for the sent/received message.
- * \param sz the number of bytes to write/read.
- *
- * \return True on success, or False on failure.
- *
- * This function is called by welcome_message_part(), to either send or receive
- * (via blocking_read()) part of the welcome message, according to whether
- * Display::IsClient is set.
- *
- * Each part of the welcome message on the wire consists of a count and then the
- * actual message data with that number of bytes.
- */
-static int welcome_message_part( Display *dpy, int i, void **msg, int sz )
-{
-   if (dpy->IsClient) {
-      int sz;
-      if (!blocking_read( dpy, i, (char *)&sz, sizeof(sz))) return False;
-      if (!*msg) *msg = malloc(sz);
-      if (!*msg) return False;
-      if (!blocking_read( dpy, i, *msg, sz )) return False;
-      return sz;
-   }
-   else {
-      if (!send_msg( dpy, i, &sz, sizeof(sz))) return False;
-      if (!send_msg( dpy, i, *msg, sz )) return False;
-   }
-
-   return True;
-}
-
-/**
- * \brief Send/receive the welcome message.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- *
- * \return True on success, or False on failure.
- *
- * Using welcome_message_part(), sends/receives the client ID, the client
- * configuration details in DRIDriverContext::shared, and the driver private
- * message in DRIDriverContext::driverClientMsg.
- */
-static int welcome_message( Display *dpy, int i )
-{
-   void *tmp = &dpy->driverContext.shared;
-   int *clientid = dpy->IsClient ? &dpy->clientID : &i;
-   int size;
-
-   if (!welcome_message_part( dpy, i, (void **)&clientid, sizeof(*clientid)))
-      return False;
-
-   if (!welcome_message_part( dpy, i, &tmp, sizeof(dpy->driverContext.shared)))
-      return False;
-      
-   size=welcome_message_part( dpy, i,
-                              (void **)&dpy->driverContext.driverClientMsg, 
-                             dpy->driverContext.driverClientMsgSize );
-
-   if (!size)
-      return False;
-
-   if (dpy->IsClient) {
-     dpy->driverContext.driverClientMsgSize = size;
-   }
-   return True;
-}
-
-
-/**
- * \brief Handle a new client connection.
- *
- * \param dpy the display handle.
- *
- * \return True on success or False on failure.
- * 
- * Accepts the connection, sets it in non-blocking operation, and finds a free
- * slot in Display::fd for it.
- */
-static int handle_new_client( Display *dpy )
-{
-   struct sockaddr_un client_address;
-   unsigned int l = sizeof(client_address);
-   int r, i;
-
-   r = accept(dpy->fd[0].fd, (struct sockaddr *) &client_address, &l);
-   if (r < 0) {
-      perror ("accept()");
-      shut_fd(dpy,0);
-      return False;
-   } 
-
-   if (fcntl(r, F_SETFL, O_NONBLOCK) != 0) {
-      perror("fcntl");
-      close(r);
-      return False;
-   }
-
-
-   /* Some rough & ready adaption of the XEvent semantics.
-    */ 
-   for (i = 1 ; i < dpy->nrFds ; i++) {
-      if (dpy->fd[i].fd < 0) {
-        XEvent *er = queue_event(dpy);
-        if (!er) {
-           close(r);
-           return False;
-        }
-
-        dpy->fd[i].fd = r;
-        er->xcreatewindow.type = CreateNotify;
-        er->xcreatewindow.serial = 0;
-        er->xcreatewindow.send_event = 0;
-        er->xcreatewindow.display = dpy;
-        er->xcreatewindow.window = (Window)i;  /* fd slot == window, now? */
-
-        /* Send the driver client message - this is expected as the
-         * first message on a new connection.  The recpient already
-         * knows the size of the message.
-         */
-        welcome_message( dpy, i );
-        return True;
-      }            
-   }
-
-
-   fprintf(stderr, "[miniglx] %s: Max nr clients exceeded\n", __FUNCTION__);
-   close(r);
-   return False;
-}
-
-/**
- * This routine "puffs out" the very basic communications between
- * client and server to full-sized X Events that can be handled by the
- * application.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- *
- * \return True on success or False on failure.
- *
- * \internal
- * Interprets the message (see msg) into a XEvent and advances the file FIFO
- * buffer.
- */
-static int
-handle_fifo_read( Display *dpy, int i )
-{
-   drm_magic_t magic;
-   int err;
-
-   while (dpy->fd[i].readbuf_count) {
-      char id = dpy->fd[i].readbuf[0];
-      XEvent *er;
-      int count = 1;
-
-      if (dpy->IsClient) {
-        switch (id) {
-           /* The server has called XMapWindow on a client window */
-        case _YouveGotFocus:
-           er = queue_event(dpy);
-           if (!er) return False;
-           er->xmap.type = MapNotify;
-           er->xmap.serial = 0;
-           er->xmap.send_event = False;
-           er->xmap.display = dpy;
-           er->xmap.event = dpy->TheWindow;
-           er->xmap.window = dpy->TheWindow;
-           er->xmap.override_redirect = False;
-           if (dpy->driver->notifyFocus)
-              dpy->driver->notifyFocus( 1 ); 
-           break;
-
-           /* The server has called XMapWindow on a client window */
-        case _RepaintPlease:
-           er = queue_event(dpy);
-           if (!er) return False;
-           er->xexpose.type = Expose;
-           er->xexpose.serial = 0;
-           er->xexpose.send_event = False;
-           er->xexpose.display = dpy;
-           er->xexpose.window = dpy->TheWindow;
-           if (dpy->rotateMode) {
-              er->xexpose.x = dpy->TheWindow->y;
-              er->xexpose.y = dpy->TheWindow->x;
-              er->xexpose.width = dpy->TheWindow->h;
-              er->xexpose.height = dpy->TheWindow->w;
-           }
-           else {
-              er->xexpose.x = dpy->TheWindow->x;
-              er->xexpose.y = dpy->TheWindow->y;
-              er->xexpose.width = dpy->TheWindow->w;
-              er->xexpose.height = dpy->TheWindow->h;
-           }
-           er->xexpose.count = 0;
-           break;
-
-           /* The server has called 'XUnmapWindow' on a client
-            * window.
-            */
-        case _YouveLostFocus:
-           er = queue_event(dpy);
-           if (!er) return False;
-           er->xunmap.type = UnmapNotify;
-           er->xunmap.serial = 0;
-           er->xunmap.send_event = False;
-           er->xunmap.display = dpy;
-           er->xunmap.event = dpy->TheWindow;
-           er->xunmap.window = dpy->TheWindow;
-           er->xunmap.from_configure = False;
-           if (dpy->driver->notifyFocus)
-              dpy->driver->notifyFocus( 0 ); 
-           break;
-            
-         case _Authorize:
-            dpy->authorized = True;
-            break;
-        
-        default:
-           fprintf(stderr, "Client received unhandled message type %d\n", id);
-           shut_fd(dpy, i);            /* Actually shuts down the client */
-           return False;
-        }
-      }
-      else {
-        switch (id) {
-           /* Lets the server know that the client is ready to render
-            * (having called 'XMapWindow' locally).
-            */
-        case _CanIHaveFocus:    
-           er = queue_event(dpy);
-           if (!er) return False;
-           er->xmaprequest.type = MapRequest;
-           er->xmaprequest.serial = 0;
-           er->xmaprequest.send_event = False;
-           er->xmaprequest.display = dpy;
-           er->xmaprequest.parent = 0;
-           er->xmaprequest.window = (Window)i;
-           break;
-
-           /* Both _YouveLostFocus and _IDontWantFocus generate unmap
-            * events.  The idea is that _YouveLostFocus lets the client
-            * know that it has had focus revoked by the server, whereas
-            * _IDontWantFocus lets the server know that the client has
-            * unmapped its own window.
-            */
-        case _IDontWantFocus:
-           er = queue_event(dpy);
-           if (!er) return False;
-           er->xunmap.type = UnmapNotify;
-           er->xunmap.serial = 0;
-           er->xunmap.send_event = False;
-           er->xunmap.display = dpy;
-           er->xunmap.event = (Window)i;
-           er->xunmap.window = (Window)i;
-           er->xunmap.from_configure = False;
-           break;
-            
-        case _Authorize:
-            /* is full message here yet? */
-           if (dpy->fd[i].readbuf_count < count + sizeof(magic)) {
-               count = 0;
-               break;
-           }
-            memcpy(&magic, dpy->fd[i].readbuf + count, sizeof(magic));
-           fprintf(stderr, "Authorize - magic %d\n", magic);
-            
-            err = drmAuthMagic(dpy->driverContext.drmFD, magic);
-           count += sizeof(magic);
-            
-            send_char_msg( dpy, i, _Authorize );
-           break;
-
-        default:
-           fprintf(stderr, "Server received unhandled message type %d\n", id);
-           shut_fd(dpy, i);            /* Generates DestroyNotify event */
-           return False;
-        }
-      }
-
-      dpy->fd[i].readbuf_count -= count;
-
-      if (dpy->fd[i].readbuf_count) {
-        memmove(dpy->fd[i].readbuf,
-                dpy->fd[i].readbuf + count,
-                dpy->fd[i].readbuf_count);
-      }
-   }
-
-   return True;
-}
-
-/**
- * Handle a VT signal
- *
- * \param dpy display handle.
- *
- * The VT switches is detected by comparing Display::haveVT and
- * Display::hwActive. When loosing the VT the hardware lock is acquired, the
- * hardware is shutdown via a call to DRIDriverRec::shutdownHardware(), and the
- * VT released. When acquiring the VT back the hardware state is restored via a
- * call to DRIDriverRec::restoreHardware() and the hardware lock released.
- */
-static void __driHandleVtSignals( Display *dpy )
-{
-   dpy->vtSignalFlag = 0;
-
-   fprintf(stderr, "%s: haveVT %d hwActive %d\n", __FUNCTION__,
-          dpy->haveVT, dpy->hwActive);
-
-   if (!dpy->haveVT && dpy->hwActive) {
-      /* Need to get lock and shutdown hardware */
-      DRM_LIGHT_LOCK( dpy->driverContext.drmFD,
-                      dpy->driverContext.pSAREA,
-                      dpy->driverContext.serverContext ); 
-      dpy->driver->shutdownHardware( &dpy->driverContext ); 
-
-      /* Can now give up control of the VT */
-      ioctl( dpy->ConsoleFD, VT_RELDISP, 1 ); 
-      dpy->hwActive = 0;
-   }
-   else if (dpy->haveVT && !dpy->hwActive) {
-      /* Get VT (wait??) */
-      ioctl( dpy->ConsoleFD, VT_RELDISP, VT_ACTIVATE );
-
-      /* restore HW state, release lock */
-      dpy->driver->restoreHardware( &dpy->driverContext ); 
-      DRM_UNLOCK( dpy->driverContext.drmFD,
-                  dpy->driverContext.pSAREA,
-                  dpy->driverContext.serverContext ); 
-      dpy->hwActive = 1;
-   }
-}
-
-
-#undef max
-#define max(x,y) ((x) > (y) ? (x) : (y))
-
-/**
- * Logic for the select() call.
- *
- * \param dpy display handle.
- * \param n highest fd in any set plus one.
- * \param rfds fd set to be watched for reading, or NULL to create one.
- * \param wfds fd set to be watched for writing, or NULL to create one.
- * \param xfds fd set to be watched for exceptions or error, or NULL to create one.
- * \param tv timeout value, or NULL for no timeout.
- * 
- * \return number of file descriptors contained in the sets, or a negative number on failure.
- * 
- * \note
- * This all looks pretty complex, but is necessary especially on the
- * server side to prevent a poorly-behaved client from causing the
- * server to block in a read or write and hence not service the other
- * clients.
- *
- * \sa
- * See select_tut in the Linux manual pages for more discussion.
- *
- * \internal
- * Creates and initializes the file descriptor sets by inspecting Display::fd
- * if these aren't passed in the function call. Calls select() and fulfill the
- * demands by trying to fill MiniGLXConnection::readbuf and draining
- * MiniGLXConnection::writebuf. 
- * The server fd[0] is handled specially for new connections, by calling
- * handle_new_client().
- * 
- */
-int 
-__miniglx_Select( Display *dpy, int n, fd_set *rfds, fd_set *wfds, fd_set *xfds,
-                 struct timeval *tv )
-{
-   int i;
-   int retval;
-   fd_set my_rfds, my_wfds;
-   struct timeval my_tv;
-
-   if (!rfds) {
-      rfds = &my_rfds;
-      FD_ZERO(rfds);
-   }
-
-   if (!wfds) {
-      wfds = &my_wfds;
-      FD_ZERO(wfds);
-   }
-
-   /* Don't block if there are events queued.  Review this if the
-    * flush in XMapWindow is changed to blocking.  (Test case:
-    * miniglxtest).
-    */
-   if (dpy->eventqueue.head != dpy->eventqueue.tail) {
-      my_tv.tv_sec = my_tv.tv_usec = 0;
-      tv = &my_tv;
-   }
-
-   for (i = 0 ; i < dpy->nrFds; i++) {
-      if (dpy->fd[i].fd < 0)
-        continue;
-      
-      if (dpy->fd[i].writebuf_count)
-        FD_SET(dpy->fd[i].fd, wfds);
-        
-      if (dpy->fd[i].readbuf_count < MINIGLX_BUF_SIZE) 
-        FD_SET(dpy->fd[i].fd, rfds);
-      
-      n = max(n, dpy->fd[i].fd + 1);
-   }
-
-   if (dpy->vtSignalFlag) 
-      __driHandleVtSignals( dpy ); 
-
-   retval = select( n, rfds, wfds, xfds, tv );
-
-   if (dpy->vtSignalFlag) {
-      int tmp = errno;
-      __driHandleVtSignals( dpy ); 
-      errno = tmp;
-   }
-
-   if (retval < 0) {
-      FD_ZERO(rfds);
-      FD_ZERO(wfds);
-      return retval;
-   }
-
-   /* Handle server fd[0] specially on the server - accept new client
-    * connections.
-    */
-   if (!dpy->IsClient) {
-      if (FD_ISSET(dpy->fd[0].fd, rfds)) {
-        FD_CLR(dpy->fd[0].fd, rfds);
-        handle_new_client( dpy );
-      }
-   }
-
-   /* Otherwise, try and fill readbuffer and drain writebuffer:
-    */
-   for (i = 0 ; i < dpy->nrFds ; i++) {
-      if (dpy->fd[i].fd < 0) 
-        continue;
-
-      /* If there aren't any event slots left, don't examine
-       * any more file events.  This will prevent lost events.
-       */
-      if (dpy->eventqueue.head == 
-         ((dpy->eventqueue.tail + 1) & MINIGLX_EVENT_QUEUE_MASK)) {
-        fprintf(stderr, "leaving event loop as event queue is full\n");
-        return retval;
-      }
-
-      if (FD_ISSET(dpy->fd[i].fd, wfds)) {
-        int r = write(dpy->fd[i].fd,
-                      dpy->fd[i].writebuf,
-                      dpy->fd[i].writebuf_count);
-        
-        if (r < 1) 
-           shut_fd(dpy,i);
-        else {
-           dpy->fd[i].writebuf_count -= r;
-           if (dpy->fd[i].writebuf_count) {
-              memmove(dpy->fd[i].writebuf,
-                      dpy->fd[i].writebuf + r,
-                      dpy->fd[i].writebuf_count);
-           }
-        }
-      }
-
-      if (FD_ISSET(dpy->fd[i].fd, rfds)) {
-        int r = read(dpy->fd[i].fd, 
-                     dpy->fd[i].readbuf + dpy->fd[i].readbuf_count,
-                     MINIGLX_BUF_SIZE - dpy->fd[i].readbuf_count);
-        
-        if (r < 1) 
-           shut_fd(dpy,i);
-        else {
-           dpy->fd[i].readbuf_count += r;
-        
-           handle_fifo_read( dpy, i );
-        }
-      }
-   }
-
-   return retval;
-}
-
-/**
- * \brief Handle socket events.
- *
- * \param dpy the display handle.
- * \param nonblock whether to return immediately or wait for an event.
- *
- * \return True on success, False on failure. Aborts on critical error.
- *
- * \internal
- * This function is the select() main loop.
- */
-int handle_fd_events( Display *dpy, int nonblock )
-{
-   while (1) {
-      struct timeval tv = {0, 0};
-      int r = __miniglx_Select( dpy, 0, 0, 0, 0, nonblock ? &tv : 0 );
-      if (r >= 0) 
-        return True;
-      if (errno == EINTR || errno == EAGAIN)
-        continue;
-      perror ("select()");
-      exit (1);
-   }
-}
-
-/**
- * Initializes the connections.
- *
- * \param dpy the display handle.
- *
- * \return True on success or False on failure.
- *
- * Allocates and initializes the Display::fd array and create a Unix socket on
- * the first entry. For a server binds the socket to a filename and listen for
- * connections. For a client connects to the server and waits for a welcome
- * message. Sets the socket in nonblocking mode.
- */
-int __miniglx_open_connections( Display *dpy )
-{
-   struct sockaddr_un sa;
-   int i;
-
-   dpy->nrFds = dpy->IsClient ? 1 : MINIGLX_MAX_SERVER_FDS;
-   dpy->fd = calloc(1, dpy->nrFds * sizeof(struct MiniGLXConnection));
-   if (!dpy->fd)
-      return False;
-
-   for (i = 0 ; i < dpy->nrFds ; i++)
-      dpy->fd[i].fd = -1;
-
-   if (!dpy->IsClient) {
-      if (unlink(MINIGLX_FIFO_NAME) != 0 && errno != ENOENT) { 
-        perror("unlink " MINIGLX_FIFO_NAME);
-        return False; 
-      } 
-      
-   } 
-
-   /* Create a Unix socket -- Note this is *not* a network connection!
-    */
-   dpy->fd[0].fd = socket(PF_UNIX, SOCK_STREAM, 0);
-   if (dpy->fd[0].fd < 0) {
-      perror("socket " MINIGLX_FIFO_NAME);
-      return False;
-   }
-
-   memset(&sa, 0, sizeof(sa));
-   sa.sun_family = AF_UNIX;
-   strcpy(sa.sun_path, MINIGLX_FIFO_NAME);
-
-   if (dpy->IsClient) {
-      /* Connect to server
-       */
-      if (connect(dpy->fd[0].fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) {
-        perror("connect");
-        shut_fd(dpy,0);
-        return False;
-      }
-
-      /* Wait for configuration messages from the server.
-       */
-      welcome_message( dpy, 0 );
-   }
-   else {
-      mode_t tmp = umask( 0000 );              /* open to everybody ? */
-
-      /* Bind socket to our filename
-       */
-      if (bind(dpy->fd[0].fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) {
-        perror("bind");
-        shut_fd(dpy,0);
-        return False;
-      }
-      
-      umask( tmp );
-
-      /* Listen for connections
-       */
-      if (listen(dpy->fd[0].fd, 5) != 0) {
-        perror("listen");
-        shut_fd(dpy,0);
-        return False;
-      }
-   }
-
-   if (fcntl(dpy->fd[0].fd, F_SETFL, O_NONBLOCK) != 0) {
-      perror("fcntl");
-      shut_fd(dpy,0);
-      return False;
-   }
-
-
-   return True;
-}
-
-
-/**
- * Frees the connections initialized by __miniglx_open_connections().
- *
- * \param dpy the display handle.
- */
-void __miniglx_close_connections( Display *dpy )
-{
-   int i;
-
-   for (i = 0 ; i < dpy->nrFds ; i++) {
-      if (dpy->fd[i].fd >= 0) {
-        shutdown (dpy->fd[i].fd, SHUT_RDWR);
-        close (dpy->fd[i].fd);
-      }
-   }
-
-   dpy->nrFds = 0;
-   free(dpy->fd);
-}
-
-
-/**
- * Set a drawable flag.
- *
- * \param dpy the display handle.
- * \param w drawable (window).
- * \param flag flag.
- *
- * Sets the specified drawable flag in the SAREA and increment its stamp while
- * holding the light hardware lock.
- */
-static void set_drawable_flag( Display *dpy, int w, int flag )
-{
-   if (dpy->driverContext.pSAREA) {
-      if (dpy->hwActive) 
-        DRM_LIGHT_LOCK( dpy->driverContext.drmFD,
-                        dpy->driverContext.pSAREA,
-                        dpy->driverContext.serverContext ); 
-
-      dpy->driverContext.pSAREA->drawableTable[w].stamp++;
-      dpy->driverContext.pSAREA->drawableTable[w].flags = flag;
-
-      if (dpy->hwActive) 
-        DRM_UNLOCK( dpy->driverContext.drmFD,
-                    dpy->driverContext.pSAREA,
-                    dpy->driverContext.serverContext ); 
-   }
-}
-
-
-
-/**
- * \brief Map Window.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param w the window handle.
- * 
- * If called by a client, sends a request for focus to the server.  If
- * called by the server, will generate a MapNotify and Expose event at
- * the client.
- * 
- */
-void
-XMapWindow( Display *dpy, Window w )
-{
-   if (dpy->IsClient) 
-      send_char_msg( dpy, 0, _CanIHaveFocus );
-   else {
-      set_drawable_flag( dpy, (int)w, 1 );
-      send_char_msg( dpy, (int)w, _YouveGotFocus );
-      send_char_msg( dpy, (int)w, _RepaintPlease );
-      dpy->TheWindow = w;
-   }
-   handle_fd_events( dpy, 0 ); /* flush write queue */
-}
-
-/**
- * \brief Unmap Window.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param w the window handle.
- * 
- * Called from the client:  Lets the server know that the window won't
- * be updated anymore.
- *
- * Called from the server:  Tells the specified client that it no longer
- * holds the focus.
- */
-void
-XUnmapWindow( Display *dpy, Window w )
-{
-   if (dpy->IsClient) {
-      send_char_msg( dpy, 0, _IDontWantFocus );
-   } 
-   else {
-      dpy->TheWindow = 0;
-      set_drawable_flag( dpy, (int)w, 0 );
-      send_char_msg( dpy, (int)w, _YouveLostFocus );
-   }
-   handle_fd_events( dpy, 0 ); /* flush write queue */
-}
-
-
-/**
- * \brief Block and wait for next X event.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param event_return a pointer to an XEvent structure for the returned data.
- *
- * Wait until there is a new XEvent pending.
- */
-int XNextEvent(Display *dpy, XEvent *event_return)
-{
-   for (;;) {
-      if ( dpy->eventqueue.head != dpy->eventqueue.tail )
-        return dequeue_event( dpy, event_return ); 
-      
-      handle_fd_events( dpy, 0 );
-   }
-}
-
-/**
- * \brief Non-blocking check for next X event.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param event_mask ignored.
- * \param event_return a pointer to an XEvent structure for the returned data.
- *
- * Check if there is a new XEvent pending.  Note that event_mask is
- * ignored and any pending event will be returned.
- */
-Bool XCheckMaskEvent(Display *dpy, long event_mask, XEvent *event_return)
-{
-   if ( dpy->eventqueue.head != dpy->eventqueue.tail )
-      return dequeue_event( dpy, event_return ); 
-
-   handle_fd_events( dpy, 1 );
-   return dequeue_event( dpy, event_return ); 
-}
diff --git a/src/glx/packrender.h b/src/glx/packrender.h
new file mode 100644 (file)
index 0000000..30f6d44
--- /dev/null
@@ -0,0 +1,243 @@
+#ifndef __GLX_packrender_h__
+#define __GLX_packrender_h__
+
+/*
+ * 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.
+ */
+
+#include "glxclient.h"
+
+/*
+** The macros in this header convert the client machine's native data types to
+** wire protocol data types.  The header is part of the porting layer of the
+** client library, and it is intended that hardware vendors will rewrite this
+** header to suit their own machines.
+*/
+
+/*
+** Pad a count of bytes to the nearest multiple of 4.  The X protocol
+** transfers data in 4 byte quantities, so this macro is used to
+** insure the right amount of data being sent.
+*/
+#define __GLX_PAD(a) (((a)+3) & ~3)
+
+/*
+** Network size parameters
+*/
+#define sz_double 8
+
+/* Setup for all commands */
+#define __GLX_DECLARE_VARIABLES()               \
+   __GLXcontext *gc;                            \
+   GLubyte *pc, *pixelHeaderPC;                 \
+   GLuint compsize, cmdlen
+
+#define __GLX_LOAD_VARIABLES()     \
+   gc = __glXGetCurrentContext();  \
+   pc = gc->pc;                    \
+   /* Muffle compilers */                  \
+   cmdlen = 0;         (void)cmdlen;          \
+   compsize = 0;       (void)compsize;        \
+   pixelHeaderPC = 0;  (void)pixelHeaderPC
+
+/*
+** Variable sized command support macro.  This macro is used by calls
+** that are potentially larger than __GLX_SMALL_RENDER_CMD_SIZE.
+** Because of their size, they may not automatically fit in the buffer.
+** If the buffer can't hold the command then it is flushed so that
+** the command will fit in the next buffer.
+*/
+#define __GLX_BEGIN_VARIABLE(opcode,size)       \
+   if (pc + (size) > gc->bufEnd) {              \
+      pc = __glXFlushRenderBuffer(gc, pc);      \
+   }                                            \
+   __GLX_PUT_SHORT(0,size);                     \
+   __GLX_PUT_SHORT(2,opcode)
+
+#define __GLX_BEGIN_VARIABLE_LARGE(opcode,size) \
+   pc = __glXFlushRenderBuffer(gc, pc);         \
+   __GLX_PUT_LONG(0,size);                      \
+   __GLX_PUT_LONG(4,opcode)
+
+#define __GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode,size)  \
+   if (pc + (size) > gc->bufEnd) {                    \
+      pc = __glXFlushRenderBuffer(gc, pc);            \
+   }                                                  \
+   __GLX_PUT_SHORT(0,size);                           \
+   __GLX_PUT_SHORT(2,opcode);                         \
+   pc += __GLX_RENDER_HDR_SIZE;                       \
+   pixelHeaderPC = pc;                                \
+   pc += __GLX_PIXEL_HDR_SIZE
+
+#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,size)  \
+   pc = __glXFlushRenderBuffer(gc, pc);                     \
+   __GLX_PUT_LONG(0,size);                                  \
+   __GLX_PUT_LONG(4,opcode);                                \
+   pc += __GLX_RENDER_LARGE_HDR_SIZE;                       \
+   pixelHeaderPC = pc;                                      \
+   pc += __GLX_PIXEL_HDR_SIZE
+
+#define __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(opcode,size)  \
+   if (pc + (size) > gc->bufEnd) {                       \
+      pc = __glXFlushRenderBuffer(gc, pc);               \
+   }                                                     \
+   __GLX_PUT_SHORT(0,size);                              \
+   __GLX_PUT_SHORT(2,opcode);                            \
+   pc += __GLX_RENDER_HDR_SIZE;                          \
+   pixelHeaderPC = pc;                                   \
+   pc += __GLX_PIXEL_3D_HDR_SIZE
+
+#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(opcode,size)  \
+   pc = __glXFlushRenderBuffer(gc, pc);                        \
+   __GLX_PUT_LONG(0,size);                                     \
+   __GLX_PUT_LONG(4,opcode);                                   \
+   pc += __GLX_RENDER_LARGE_HDR_SIZE;                          \
+   pixelHeaderPC = pc;                                         \
+   pc += __GLX_PIXEL_3D_HDR_SIZE
+
+/*
+** Fixed size command support macro.  This macro is used by calls that
+** are never larger than __GLX_SMALL_RENDER_CMD_SIZE.  Because they
+** always fit in the buffer, and because the buffer promises to
+** maintain enough room for them, we don't need to check for space
+** before doing the storage work.
+*/
+#define __GLX_BEGIN(opcode,size) \
+   __GLX_PUT_SHORT(0,size);      \
+   __GLX_PUT_SHORT(2,opcode)
+
+/*
+** Finish a rendering command by advancing the pc.  If the pc is now past
+** the limit pointer then there is no longer room for a
+** __GLX_SMALL_RENDER_CMD_SIZE sized command, which will break the
+** assumptions present in the __GLX_BEGIN macro.  In this case the
+** rendering buffer is flushed out into the X protocol stream (which may
+** or may not do I/O).
+*/
+#define __GLX_END(size)           \
+   pc += size;                       \
+   if (pc > gc->limit) {                  \
+      (void) __glXFlushRenderBuffer(gc, pc);    \
+   } else {                                     \
+      gc->pc = pc;                              \
+   }
+
+/* Array copy macros */
+#define __GLX_MEM_COPY(dest,src,bytes)          \
+   if (src && dest)                             \
+      memcpy(dest, src, bytes)
+
+/* Single item copy macros */
+#define __GLX_PUT_CHAR(offset,a)                \
+   *((INT8 *) (pc + offset)) = a
+
+#ifndef _CRAY
+#define __GLX_PUT_SHORT(offset,a)               \
+   *((INT16 *) (pc + offset)) = a
+
+#define __GLX_PUT_LONG(offset,a)                \
+   *((INT32 *) (pc + offset)) = a
+
+#define __GLX_PUT_FLOAT(offset,a)               \
+   *((FLOAT32 *) (pc + offset)) = a
+
+#else
+#define __GLX_PUT_SHORT(offset,a)               \
+   { GLubyte *cp = (pc+offset);                 \
+      int shift = (64-16) - ((int)(cp) >> (64-6));                      \
+      *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
+
+#define __GLX_PUT_LONG(offset,a)                \
+   { GLubyte *cp = (pc+offset);                 \
+      int shift = (64-32) - ((int)(cp) >> (64-6));                      \
+      *(int *)cp = (*(int *)cp & ~(0xffffffff << shift)) | ((a & 0xffffffff) << shift); }
+
+#define __GLX_PUT_FLOAT(offset,a)               \
+   gl_put_float((pc + offset),a)
+
+#define __GLX_PUT_DOUBLE(offset,a)              \
+   gl_put_double(pc + offset, a)
+
+extern void gl_put_float( /*GLubyte *, struct cray_single */ );
+extern void gl_put_double( /*GLubyte *, struct cray_double */ );
+#endif
+
+#ifndef _CRAY
+
+#ifdef __GLX_ALIGN64
+/*
+** This can certainly be done better for a particular machine
+** architecture!
+*/
+#define __GLX_PUT_DOUBLE(offset,a)              \
+   __GLX_MEM_COPY(pc + offset, &a, 8)
+#else
+#define __GLX_PUT_DOUBLE(offset,a)              \
+   *((FLOAT64 *) (pc + offset)) = a
+#endif
+
+#endif
+
+#define __GLX_PUT_CHAR_ARRAY(offset,a,alen)                 \
+   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT8)
+
+#ifndef _CRAY
+#define __GLX_PUT_SHORT_ARRAY(offset,a,alen)                \
+   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT16)
+
+#define __GLX_PUT_LONG_ARRAY(offset,a,alen)                 \
+   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT32)
+
+#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen)                   \
+   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT32)
+
+#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen)                  \
+   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT64)
+
+#else
+#define __GLX_PUT_SHORT_ARRAY(offset,a,alen)                            \
+   gl_put_short_array((GLubyte *)(pc + offset), a, alen * __GLX_SIZE_INT16)
+
+#define __GLX_PUT_LONG_ARRAY(offset,a,alen)                             \
+   gl_put_long_array((GLubyte *)(pc + offset), (long *)a, alen * __GLX_SIZE_INT32)
+
+#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen)                            \
+   gl_put_float_array((GLubyte *)(pc + offset), (float *)a, alen * __GLX_SIZE_FLOAT32)
+
+#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen)                           \
+   gl_put_double_array((GLubyte *)(pc + offset), (double *)a, alen * __GLX_SIZE_FLOAT64)
+
+extern gl_put_short_array(GLubyte *, short *, int);
+extern gl_put_long_array(GLubyte *, long *, int);
+extern gl_put_float_array(GLubyte *, float *, int);
+extern gl_put_double_array(GLubyte *, double *, int);
+
+#endif /* _CRAY */
+
+#endif /* !__GLX_packrender_h__ */
diff --git a/src/glx/packsingle.h b/src/glx/packsingle.h
new file mode 100644 (file)
index 0000000..f33a873
--- /dev/null
@@ -0,0 +1,213 @@
+#ifndef __GLX_packsingle_h__
+#define __GLX_packsingle_h__
+
+/*
+ * 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.
+ */
+
+#include "packrender.h"
+
+/*
+** The macros in this header convert wire protocol data types to the client
+** machine's native data types.  The header is part of the porting layer of
+** the client library, and it is intended that hardware vendors will rewrite
+** this header to suit their own machines.
+*/
+
+/*
+** Dummy define to make the GetReqExtra macro happy.  The value is not
+** used, but instead the code in __GLX_SINGLE_BEGIN issues its own store
+** to req->reqType with the proper code (our extension code).
+*/
+#define X_GLXSingle 0
+
+/* Declare common variables used during a single command */
+#define __GLX_SINGLE_DECLARE_VARIABLES()         \
+   __GLXcontext *gc = __glXGetCurrentContext();  \
+   GLubyte *pc, *pixelHeaderPC;                  \
+   GLuint compsize, cmdlen;                      \
+   Display *dpy = gc->currentDpy;                \
+   xGLXSingleReq *req
+
+#define __GLX_SINGLE_LOAD_VARIABLES()           \
+   pc = gc->pc;                                 \
+   /* Muffle compilers */                       \
+   pixelHeaderPC = 0;  (void)pixelHeaderPC;     \
+   compsize = 0;       (void)compsize;          \
+   cmdlen = 0;         (void)cmdlen
+
+/* Start a single command */
+#define __GLX_SINGLE_BEGIN(opcode,bytes)        \
+   if (dpy) {                                   \
+   (void) __glXFlushRenderBuffer(gc, pc);       \
+   LockDisplay(dpy);                            \
+   GetReqExtra(GLXSingle,bytes,req);            \
+   req->reqType = gc->majorOpcode;              \
+   req->glxCode = opcode;                       \
+   req->contextTag = gc->currentContextTag;     \
+   pc = ((GLubyte *)(req) + sz_xGLXSingleReq)
+
+/* End a single command */
+#define __GLX_SINGLE_END()       \
+   UnlockDisplay(dpy);           \
+   SyncHandle();                 \
+   }
+
+/* Store data to sending for a single command */
+#define __GLX_SINGLE_PUT_CHAR(offset,a)         \
+   *((INT8 *) (pc + offset)) = a
+
+#ifndef CRAY
+#define __GLX_SINGLE_PUT_SHORT(offset,a)        \
+   *((INT16 *) (pc + offset)) = a
+
+#define __GLX_SINGLE_PUT_LONG(offset,a)         \
+   *((INT32 *) (pc + offset)) = a
+
+#define __GLX_SINGLE_PUT_FLOAT(offset,a)        \
+   *((FLOAT32 *) (pc + offset)) = a
+
+#else
+#define __GLX_SINGLE_PUT_SHORT(offset,a)        \
+   { GLubyte *cp = (pc+offset);                    \
+      int shift = (64-16) - ((int)(cp) >> (64-6));                      \
+      *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
+
+#define __GLX_SINGLE_PUT_LONG(offset,a)         \
+   { GLubyte *cp = (pc+offset);                    \
+      int shift = (64-32) - ((int)(cp) >> (64-6));                      \
+      *(int *)cp = (*(int *)cp & ~(0xffffffff << shift)) | ((a & 0xffffffff) << shift); }
+
+#define __GLX_SINGLE_PUT_FLOAT(offset,a)        \
+   gl_put_float(pc + offset, a)
+#endif
+
+/* Read support macros */
+#define __GLX_SINGLE_READ_XREPLY()                    \
+   (void) _XReply(dpy, (xReply*) &reply, 0, False)
+
+#define __GLX_SINGLE_GET_RETVAL(a,cast)         \
+   a = (cast) reply.retval
+
+#define __GLX_SINGLE_GET_SIZE(a)                \
+   a = (GLint) reply.size
+
+#ifndef _CRAY
+#define __GLX_SINGLE_GET_CHAR(p)                \
+   *p = *(GLbyte *)&reply.pad3;
+
+#define __GLX_SINGLE_GET_SHORT(p)               \
+   *p = *(GLshort *)&reply.pad3;
+
+#define __GLX_SINGLE_GET_LONG(p)                \
+   *p = *(GLint *)&reply.pad3;
+
+#define __GLX_SINGLE_GET_FLOAT(p)               \
+   *p = *(GLfloat *)&reply.pad3;
+
+#else
+#define __GLX_SINGLE_GET_CHAR(p)                \
+   *p = reply.pad3 >> 24;
+
+#define __GLX_SINGLE_GET_SHORT(p)               \
+   {int t = reply.pad3 >> 16;                            \
+      *p = (t & 0x8000) ? (t | ~0xffff) : (t & 0xffff);}
+
+#define __GLX_SINGLE_GET_LONG(p)                \
+   {int t = reply.pad3;                                              \
+      *p = (t & 0x80000000) ? (t | ~0xffffffff) : (t & 0xffffffff);}
+
+#define PAD3OFFSET 16
+#define __GLX_SINGLE_GET_FLOAT(p)                        \
+   *p = gl_ntoh_float((GLubyte *)&reply + PAD3OFFSET);
+
+#define __GLX_SINGLE_GET_DOUBLE(p)                       \
+   *p = gl_ntoh_double((GLubyte *)&reply + PAD3OFFSET);
+
+extern float gl_ntoh_float(GLubyte *);
+extern float gl_ntoh_double(GLubyte *);
+#endif
+
+#ifndef _CRAY
+
+#ifdef __GLX_ALIGN64
+#define __GLX_SINGLE_GET_DOUBLE(p)              \
+   __GLX_MEM_COPY(p, &reply.pad3, 8)
+#else
+#define __GLX_SINGLE_GET_DOUBLE(p)              \
+   *p = *(GLdouble *)&reply.pad3
+#endif
+
+#endif
+
+/* Get an array of typed data */
+#define __GLX_SINGLE_GET_VOID_ARRAY(a,alen)     \
+   {                                            \
+      GLint slop = alen*__GLX_SIZE_INT8 & 3;    \
+      _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8);  \
+      if (slop) _XEatData(dpy,4-slop);             \
+   }
+
+#define __GLX_SINGLE_GET_CHAR_ARRAY(a,alen)     \
+   {                                            \
+      GLint slop = alen*__GLX_SIZE_INT8 & 3;    \
+      _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8);  \
+      if (slop) _XEatData(dpy,4-slop);             \
+   }
+
+
+#define __GLX_SINGLE_GET_SHORT_ARRAY(a,alen)    \
+   {                                            \
+      GLint slop = (alen*__GLX_SIZE_INT16) & 3;    \
+      _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT16); \
+      if (slop) _XEatData(dpy,4-slop);             \
+   }
+
+#define __GLX_SINGLE_GET_LONG_ARRAY(a,alen)        \
+   _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT32);
+
+#ifndef _CRAY
+#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen)       \
+   _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT32);
+
+#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen)      \
+   _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT64);
+
+#else
+#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen)    \
+   gl_get_float_array(dpy,a,alen);
+
+#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen)   \
+   gl_get_double_array(dpy, a, alen);
+
+extern void gl_get_float_array(Display * dpy, float *a, int alen);
+extern void gl_get_double_array(Display * dpy, double *a, int alen);
+#endif
+
+#endif /* !__GLX_packsingle_h__ */
diff --git a/src/glx/pixel.c b/src/glx/pixel.c
new file mode 100644 (file)
index 0000000..d36ca31
--- /dev/null
@@ -0,0 +1,461 @@
+/*
+ * 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.
+ */
+
+#include "packrender.h"
+
+static const GLubyte MsbToLsbTable[256] = {
+   0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+   0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+   0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+   0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+   0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+   0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+   0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+   0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+   0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+   0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+   0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+   0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+   0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+   0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+   0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+   0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+   0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+   0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+   0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+   0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+   0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+   0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+   0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+   0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+   0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+   0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+   0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+   0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+   0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+   0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+   0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+   0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
+};
+
+static const GLubyte LowBitsMask[9] = {
+   0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
+};
+
+static const GLubyte HighBitsMask[9] = {
+   0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff,
+};
+
+
+/*
+** Copy bitmap data from clients packed memory applying unpacking modes as the
+** data is transfered into the destImage buffer.  Return in modes the
+** set of pixel modes that are to be done by the server.
+*/
+static void
+FillBitmap(__GLXcontext * gc, GLint width, GLint height,
+           GLenum format, const GLvoid * userdata, GLubyte * destImage)
+{
+   const __GLXattribute *state = gc->client_state_private;
+   GLint rowLength = state->storeUnpack.rowLength;
+   GLint alignment = state->storeUnpack.alignment;
+   GLint skipPixels = state->storeUnpack.skipPixels;
+   GLint skipRows = state->storeUnpack.skipRows;
+   GLint lsbFirst = state->storeUnpack.lsbFirst;
+   GLint elementsLeft, bitOffset, currentByte, nextByte, highBitMask;
+   GLint lowBitMask, i;
+   GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
+   const GLubyte *start, *iter;
+
+   if (rowLength > 0) {
+      groupsPerRow = rowLength;
+   }
+   else {
+      groupsPerRow = width;
+   }
+   components = __glElementsPerGroup(format, GL_BITMAP);
+   rowSize = (groupsPerRow * components + 7) >> 3;
+   padding = (rowSize % alignment);
+   if (padding) {
+      rowSize += alignment - padding;
+   }
+   start = ((const GLubyte *) userdata) + skipRows * rowSize +
+      ((skipPixels * components) >> 3);
+   bitOffset = (skipPixels * components) & 7;
+   highBitMask = LowBitsMask[8 - bitOffset];
+   lowBitMask = HighBitsMask[bitOffset];
+   elementsPerRow = width * components;
+   for (i = 0; i < height; i++) {
+      elementsLeft = elementsPerRow;
+      iter = start;
+      while (elementsLeft) {
+         /* First retrieve low bits from current byte */
+         if (lsbFirst) {
+            currentByte = MsbToLsbTable[iter[0]];
+         }
+         else {
+            currentByte = iter[0];
+         }
+         if (bitOffset) {
+            /* Need to read next byte to finish current byte */
+            if (elementsLeft > (8 - bitOffset)) {
+               if (lsbFirst) {
+                  nextByte = MsbToLsbTable[iter[1]];
+               }
+               else {
+                  nextByte = iter[1];
+               }
+               currentByte =
+                  ((currentByte & highBitMask) << bitOffset) |
+                  ((nextByte & lowBitMask) >> (8 - bitOffset));
+            }
+            else {
+               currentByte = ((currentByte & highBitMask) << bitOffset);
+            }
+         }
+         if (elementsLeft >= 8) {
+            *destImage = currentByte;
+            elementsLeft -= 8;
+         }
+         else {
+            *destImage = currentByte & HighBitsMask[elementsLeft];
+            elementsLeft = 0;
+         }
+         destImage++;
+         iter++;
+      }
+      start += rowSize;
+   }
+}
+
+/*
+** Extract array from user's data applying all pixel store modes.
+** The internal packed array format used has LSB_FIRST = FALSE and 
+** ALIGNMENT = 1.
+*/
+void
+__glFillImage(__GLXcontext * gc, GLint dim, GLint width, GLint height,
+              GLint depth, GLenum format, GLenum type,
+              const GLvoid * userdata, GLubyte * newimage, GLubyte * modes)
+{
+   const __GLXattribute *state = gc->client_state_private;
+   GLint rowLength = state->storeUnpack.rowLength;
+   GLint imageHeight = state->storeUnpack.imageHeight;
+   GLint alignment = state->storeUnpack.alignment;
+   GLint skipPixels = state->storeUnpack.skipPixels;
+   GLint skipRows = state->storeUnpack.skipRows;
+   GLint skipImages = state->storeUnpack.skipImages;
+   GLint swapBytes = state->storeUnpack.swapEndian;
+   GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
+   GLint elementsPerRow, imageSize, rowsPerImage, h, i, j, k;
+   const GLubyte *start, *iter, *itera, *iterb, *iterc;
+   GLubyte *iter2;
+
+   if (type == GL_BITMAP) {
+      FillBitmap(gc, width, height, format, userdata, newimage);
+   }
+   else {
+      components = __glElementsPerGroup(format, type);
+      if (rowLength > 0) {
+         groupsPerRow = rowLength;
+      }
+      else {
+         groupsPerRow = width;
+      }
+      if (imageHeight > 0) {
+         rowsPerImage = imageHeight;
+      }
+      else {
+         rowsPerImage = height;
+      }
+
+      elementSize = __glBytesPerElement(type);
+      groupSize = elementSize * components;
+      if (elementSize == 1)
+         swapBytes = 0;
+
+      rowSize = groupsPerRow * groupSize;
+      padding = (rowSize % alignment);
+      if (padding) {
+         rowSize += alignment - padding;
+      }
+      imageSize = rowSize * rowsPerImage;
+      start = ((const GLubyte *) userdata) + skipImages * imageSize +
+         skipRows * rowSize + skipPixels * groupSize;
+      iter2 = newimage;
+      elementsPerRow = width * components;
+
+      if (swapBytes) {
+         itera = start;
+         for (h = 0; h < depth; h++) {
+            iterb = itera;
+            for (i = 0; i < height; i++) {
+               iterc = iterb;
+               for (j = 0; j < elementsPerRow; j++) {
+                  for (k = 1; k <= elementSize; k++) {
+                     iter2[k - 1] = iterc[elementSize - k];
+                  }
+                  iter2 += elementSize;
+                  iterc += elementSize;
+               }
+               iterb += rowSize;
+            }
+            itera += imageSize;
+         }
+      }
+      else {
+         itera = start;
+         for (h = 0; h < depth; h++) {
+            if (rowSize == elementsPerRow * elementSize) {
+               /* Ha!  This is mondo easy! */
+               __GLX_MEM_COPY(iter2, itera,
+                              elementsPerRow * elementSize * height);
+               iter2 += elementsPerRow * elementSize * height;
+            }
+            else {
+               iter = itera;
+               for (i = 0; i < height; i++) {
+                  __GLX_MEM_COPY(iter2, iter, elementsPerRow * elementSize);
+                  iter2 += elementsPerRow * elementSize;
+                  iter += rowSize;
+               }
+            }
+            itera += imageSize;
+         }
+      }
+   }
+
+   /* Setup store modes that describe what we just did */
+   if (modes) {
+      if (dim < 3) {
+         (void) memcpy(modes, __glXDefaultPixelStore + 4, 20);
+      }
+      else {
+         (void) memcpy(modes, __glXDefaultPixelStore + 0, 36);
+      }
+   }
+}
+
+/*
+** Empty a bitmap in LSB_FIRST=GL_FALSE and ALIGNMENT=4 format packing it
+** into the clients memory using the pixel store PACK modes.
+*/
+static void
+EmptyBitmap(__GLXcontext * gc, GLint width, GLint height,
+            GLenum format, const GLubyte * sourceImage, GLvoid * userdata)
+{
+   const __GLXattribute *state = gc->client_state_private;
+   GLint rowLength = state->storePack.rowLength;
+   GLint alignment = state->storePack.alignment;
+   GLint skipPixels = state->storePack.skipPixels;
+   GLint skipRows = state->storePack.skipRows;
+   GLint lsbFirst = state->storePack.lsbFirst;
+   GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
+   GLint sourceRowSize, sourcePadding, sourceSkip;
+   GLubyte *start, *iter;
+   GLint elementsLeft, bitOffset, currentByte, highBitMask, lowBitMask;
+   GLint writeMask, i;
+   GLubyte writeByte;
+
+   components = __glElementsPerGroup(format, GL_BITMAP);
+   if (rowLength > 0) {
+      groupsPerRow = rowLength;
+   }
+   else {
+      groupsPerRow = width;
+   }
+
+   rowSize = (groupsPerRow * components + 7) >> 3;
+   padding = (rowSize % alignment);
+   if (padding) {
+      rowSize += alignment - padding;
+   }
+   sourceRowSize = (width * components + 7) >> 3;
+   sourcePadding = (sourceRowSize % 4);
+   if (sourcePadding) {
+      sourceSkip = 4 - sourcePadding;
+   }
+   else {
+      sourceSkip = 0;
+   }
+   start = ((GLubyte *) userdata) + skipRows * rowSize +
+      ((skipPixels * components) >> 3);
+   bitOffset = (skipPixels * components) & 7;
+   highBitMask = LowBitsMask[8 - bitOffset];
+   lowBitMask = HighBitsMask[bitOffset];
+   elementsPerRow = width * components;
+   for (i = 0; i < height; i++) {
+      elementsLeft = elementsPerRow;
+      iter = start;
+      writeMask = highBitMask;
+      writeByte = 0;
+      while (elementsLeft) {
+         /* Set up writeMask (to write to current byte) */
+         if (elementsLeft + bitOffset < 8) {
+            /* Need to trim writeMask */
+            writeMask &= HighBitsMask[bitOffset + elementsLeft];
+         }
+
+         if (lsbFirst) {
+            currentByte = MsbToLsbTable[iter[0]];
+         }
+         else {
+            currentByte = iter[0];
+         }
+
+         if (bitOffset) {
+            writeByte |= (sourceImage[0] >> bitOffset);
+            currentByte = (currentByte & ~writeMask) |
+               (writeByte & writeMask);
+            writeByte = (sourceImage[0] << (8 - bitOffset));
+         }
+         else {
+            currentByte = (currentByte & ~writeMask) |
+               (sourceImage[0] & writeMask);
+         }
+
+         if (lsbFirst) {
+            iter[0] = MsbToLsbTable[currentByte];
+         }
+         else {
+            iter[0] = currentByte;
+         }
+
+         if (elementsLeft >= 8) {
+            elementsLeft -= 8;
+         }
+         else {
+            elementsLeft = 0;
+         }
+         sourceImage++;
+         iter++;
+         writeMask = 0xff;
+      }
+      if (writeByte) {
+         /* Some data left over that still needs writing */
+         writeMask &= lowBitMask;
+         if (lsbFirst) {
+            currentByte = MsbToLsbTable[iter[0]];
+         }
+         else {
+            currentByte = iter[0];
+         }
+         currentByte = (currentByte & ~writeMask) | (writeByte & writeMask);
+         if (lsbFirst) {
+            iter[0] = MsbToLsbTable[currentByte];
+         }
+         else {
+            iter[0] = currentByte;
+         }
+      }
+      start += rowSize;
+      sourceImage += sourceSkip;
+   }
+}
+
+/*
+** Insert array into user's data applying all pixel store modes.
+** The packed array format from the server is LSB_FIRST = FALSE,
+** SWAP_BYTES = the current pixel storage pack mode, and ALIGNMENT = 4.
+** Named __glEmptyImage() because it is the opposite of __glFillImage().
+*/
+/* ARGSUSED */
+void
+__glEmptyImage(__GLXcontext * gc, GLint dim, GLint width, GLint height,
+               GLint depth, GLenum format, GLenum type,
+               const GLubyte * sourceImage, GLvoid * userdata)
+{
+   const __GLXattribute *state = gc->client_state_private;
+   GLint rowLength = state->storePack.rowLength;
+   GLint imageHeight = state->storePack.imageHeight;
+   GLint alignment = state->storePack.alignment;
+   GLint skipPixels = state->storePack.skipPixels;
+   GLint skipRows = state->storePack.skipRows;
+   GLint skipImages = state->storePack.skipImages;
+   GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
+   GLint elementsPerRow, sourceRowSize, sourcePadding, h, i;
+   GLint imageSize, rowsPerImage;
+   GLubyte *start, *iter, *itera;
+
+   if (type == GL_BITMAP) {
+      EmptyBitmap(gc, width, height, format, sourceImage, userdata);
+   }
+   else {
+      components = __glElementsPerGroup(format, type);
+      if (rowLength > 0) {
+         groupsPerRow = rowLength;
+      }
+      else {
+         groupsPerRow = width;
+      }
+      if (imageHeight > 0) {
+         rowsPerImage = imageHeight;
+      }
+      else {
+         rowsPerImage = height;
+      }
+      elementSize = __glBytesPerElement(type);
+      groupSize = elementSize * components;
+      rowSize = groupsPerRow * groupSize;
+      padding = (rowSize % alignment);
+      if (padding) {
+         rowSize += alignment - padding;
+      }
+      sourceRowSize = width * groupSize;
+      sourcePadding = (sourceRowSize % 4);
+      if (sourcePadding) {
+         sourceRowSize += 4 - sourcePadding;
+      }
+      imageSize = sourceRowSize * rowsPerImage;
+      start = ((GLubyte *) userdata) + skipImages * imageSize +
+         skipRows * rowSize + skipPixels * groupSize;
+      elementsPerRow = width * components;
+
+      itera = start;
+      for (h = 0; h < depth; h++) {
+         if ((rowSize == sourceRowSize) && (sourcePadding == 0)) {
+            /* Ha!  This is mondo easy! */
+            __GLX_MEM_COPY(itera, sourceImage,
+                           elementsPerRow * elementSize * height);
+            sourceImage += elementsPerRow * elementSize * height;
+         }
+         else {
+            iter = itera;
+            for (i = 0; i < height; i++) {
+               __GLX_MEM_COPY(iter, sourceImage,
+                              elementsPerRow * elementSize);
+               sourceImage += sourceRowSize;
+               iter += rowSize;
+            }
+         }
+         itera += imageSize;
+      }
+   }
+}
diff --git a/src/glx/pixelstore.c b/src/glx/pixelstore.c
new file mode 100644 (file)
index 0000000..8b51b5d
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * 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.
+ */
+
+#include "glxclient.h"
+#include "indirect.h"
+
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
+/**
+ * Send glPixelStore command to the server
+ * 
+ * \param gc     Current GLX context
+ * \param sop    Either \c X_GLsop_PixelStoref or \c X_GLsop_PixelStorei
+ * \param pname  Selector of which pixel parameter is to be set.
+ * \param param  Value that \c pname is set to.
+ *
+ * \sa __indirect_glPixelStorei,  __indirect_glPixelStoref
+ */
+static void
+send_PixelStore(__GLXcontext * gc, unsigned sop, GLenum pname,
+                const void *param)
+{
+   Display *const dpy = gc->currentDpy;
+   const GLuint cmdlen = 8;
+   if (__builtin_expect(dpy != NULL, 1)) {
+      GLubyte const *pc = __glXSetupSingleRequest(gc, sop, cmdlen);
+      (void) memcpy((void *) (pc + 0), (void *) (&pname), 4);
+      (void) memcpy((void *) (pc + 4), param, 4);
+      UnlockDisplay(dpy);
+      SyncHandle();
+   }
+   return;
+}
+
+/*
+** Specify parameters that control the storage format of pixel arrays.
+*/
+void
+__indirect_glPixelStoref(GLenum pname, GLfloat param)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = gc->client_state_private;
+   Display *dpy = gc->currentDpy;
+   GLuint a;
+
+   if (!dpy)
+      return;
+
+   switch (pname) {
+   case GL_PACK_ROW_LENGTH:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.rowLength = a;
+      break;
+   case GL_PACK_IMAGE_HEIGHT:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.imageHeight = a;
+      break;
+   case GL_PACK_SKIP_ROWS:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.skipRows = a;
+      break;
+   case GL_PACK_SKIP_PIXELS:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.skipPixels = a;
+      break;
+   case GL_PACK_SKIP_IMAGES:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.skipImages = a;
+      break;
+   case GL_PACK_ALIGNMENT:
+      a = (GLint) (param + 0.5);
+      switch (a) {
+      case 1:
+      case 2:
+      case 4:
+      case 8:
+         state->storePack.alignment = a;
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      break;
+   case GL_PACK_SWAP_BYTES:
+      state->storePack.swapEndian = (param != 0);
+      break;
+   case GL_PACK_LSB_FIRST:
+      state->storePack.lsbFirst = (param != 0);
+      break;
+
+   case GL_UNPACK_ROW_LENGTH:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.rowLength = a;
+      break;
+   case GL_UNPACK_IMAGE_HEIGHT:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.imageHeight = a;
+      break;
+   case GL_UNPACK_SKIP_ROWS:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.skipRows = a;
+      break;
+   case GL_UNPACK_SKIP_PIXELS:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.skipPixels = a;
+      break;
+   case GL_UNPACK_SKIP_IMAGES:
+      a = (GLuint) (param + 0.5);
+      if (((GLint) a) < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.skipImages = a;
+      break;
+   case GL_UNPACK_ALIGNMENT:
+      a = (GLint) (param + 0.5);
+      switch (a) {
+      case 1:
+      case 2:
+      case 4:
+      case 8:
+         state->storeUnpack.alignment = a;
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      break;
+   case GL_UNPACK_SWAP_BYTES:
+      state->storeUnpack.swapEndian = (param != 0);
+      break;
+   case GL_UNPACK_LSB_FIRST:
+      state->storeUnpack.lsbFirst = (param != 0);
+      break;
+
+      /* Group all of the pixel store modes that need to be sent to the
+       * server here.  Care must be used to only send modes to the server that
+       * won't affect the size of the data sent to or received from the
+       * server.  GL_PACK_INVERT_MESA is safe in this respect, but other,
+       * future modes may not be.
+       */
+   case GL_PACK_INVERT_MESA:
+      send_PixelStore(gc, X_GLsop_PixelStoref, pname, &param);
+      break;
+
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      break;
+   }
+}
+
+void
+__indirect_glPixelStorei(GLenum pname, GLint param)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = gc->client_state_private;
+   Display *dpy = gc->currentDpy;
+
+   if (!dpy)
+      return;
+
+   switch (pname) {
+   case GL_PACK_ROW_LENGTH:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.rowLength = param;
+      break;
+   case GL_PACK_IMAGE_HEIGHT:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.imageHeight = param;
+      break;
+   case GL_PACK_SKIP_ROWS:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.skipRows = param;
+      break;
+   case GL_PACK_SKIP_PIXELS:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.skipPixels = param;
+      break;
+   case GL_PACK_SKIP_IMAGES:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storePack.skipImages = param;
+      break;
+   case GL_PACK_ALIGNMENT:
+      switch (param) {
+      case 1:
+      case 2:
+      case 4:
+      case 8:
+         state->storePack.alignment = param;
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      break;
+   case GL_PACK_SWAP_BYTES:
+      state->storePack.swapEndian = (param != 0);
+      break;
+   case GL_PACK_LSB_FIRST:
+      state->storePack.lsbFirst = (param != 0);
+      break;
+
+   case GL_UNPACK_ROW_LENGTH:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.rowLength = param;
+      break;
+   case GL_UNPACK_IMAGE_HEIGHT:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.imageHeight = param;
+      break;
+   case GL_UNPACK_SKIP_ROWS:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.skipRows = param;
+      break;
+   case GL_UNPACK_SKIP_PIXELS:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.skipPixels = param;
+      break;
+   case GL_UNPACK_SKIP_IMAGES:
+      if (param < 0) {
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      state->storeUnpack.skipImages = param;
+      break;
+   case GL_UNPACK_ALIGNMENT:
+      switch (param) {
+      case 1:
+      case 2:
+      case 4:
+      case 8:
+         state->storeUnpack.alignment = param;
+         break;
+      default:
+         __glXSetError(gc, GL_INVALID_VALUE);
+         return;
+      }
+      break;
+   case GL_UNPACK_SWAP_BYTES:
+      state->storeUnpack.swapEndian = (param != 0);
+      break;
+   case GL_UNPACK_LSB_FIRST:
+      state->storeUnpack.lsbFirst = (param != 0);
+      break;
+
+      /* Group all of the pixel store modes that need to be sent to the
+       * server here.  Care must be used to only send modes to the server that
+       * won't affect the size of the data sent to or received from the
+       * server.  GL_PACK_INVERT_MESA is safe in this respect, but other,
+       * future modes may not be.
+       */
+   case GL_PACK_INVERT_MESA:
+      send_PixelStore(gc, X_GLsop_PixelStorei, pname, &param);
+      break;
+
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      break;
+   }
+}
diff --git a/src/glx/render2.c b/src/glx/render2.c
new file mode 100644 (file)
index 0000000..762950f
--- /dev/null
@@ -0,0 +1,381 @@
+/*
+ * 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.
+ */
+
+#include "packrender.h"
+#include "indirect.h"
+#include "indirect_size.h"
+
+/*
+** This file contains routines that might need to be transported as
+** GLXRender or GLXRenderLarge commands, and these commands don't
+** use the pixel header.  See renderpix.c for those routines.
+*/
+
+void
+__indirect_glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+                   GLint order, const GLdouble * pnts)
+{
+   __GLX_DECLARE_VARIABLES();
+   GLint k;
+
+   __GLX_LOAD_VARIABLES();
+   k = __glMap1d_size(target);
+   if (k == 0) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+   else if (stride < k || order <= 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+   compsize = k * order * __GLX_SIZE_FLOAT64;
+   cmdlen = 28 + compsize;
+   if (!gc->currentDpy)
+      return;
+
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      /* Use GLXRender protocol to send small command */
+      __GLX_BEGIN_VARIABLE(X_GLrop_Map1d, cmdlen);
+      __GLX_PUT_DOUBLE(4, u1);
+      __GLX_PUT_DOUBLE(12, u2);
+      __GLX_PUT_LONG(20, target);
+      __GLX_PUT_LONG(24, order);
+      /*
+       ** NOTE: the doubles that follow are not aligned because of 3
+       ** longs preceeding
+       */
+      __glFillMap1d(k, order, stride, pnts, (pc + 28));
+      __GLX_END(cmdlen);
+   }
+   else {
+      /* Use GLXRenderLarge protocol to send command */
+      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1d, cmdlen + 4);
+      __GLX_PUT_DOUBLE(8, u1);
+      __GLX_PUT_DOUBLE(16, u2);
+      __GLX_PUT_LONG(24, target);
+      __GLX_PUT_LONG(28, order);
+
+      /*
+       ** NOTE: the doubles that follow are not aligned because of 3
+       ** longs preceeding
+       */
+      if (stride != k) {
+         GLubyte *buf;
+
+         buf = (GLubyte *) Xmalloc(compsize);
+         if (!buf) {
+            __glXSetError(gc, GL_OUT_OF_MEMORY);
+            return;
+         }
+         __glFillMap1d(k, order, stride, pnts, buf);
+         __glXSendLargeCommand(gc, pc, 32, buf, compsize);
+         Xfree((char *) buf);
+      }
+      else {
+         /* Data is already packed.  Just send it out */
+         __glXSendLargeCommand(gc, pc, 32, pnts, compsize);
+      }
+   }
+}
+
+void
+__indirect_glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+                   GLint order, const GLfloat * pnts)
+{
+   __GLX_DECLARE_VARIABLES();
+   GLint k;
+
+   __GLX_LOAD_VARIABLES();
+   k = __glMap1f_size(target);
+   if (k == 0) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+   else if (stride < k || order <= 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+   compsize = k * order * __GLX_SIZE_FLOAT32;
+   cmdlen = 20 + compsize;
+   if (!gc->currentDpy)
+      return;
+
+   /*
+    ** The order that arguments are packed is different from the order
+    ** for glMap1d.
+    */
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      /* Use GLXRender protocol to send small command */
+      __GLX_BEGIN_VARIABLE(X_GLrop_Map1f, cmdlen);
+      __GLX_PUT_LONG(4, target);
+      __GLX_PUT_FLOAT(8, u1);
+      __GLX_PUT_FLOAT(12, u2);
+      __GLX_PUT_LONG(16, order);
+      __glFillMap1f(k, order, stride, pnts, (GLubyte *) (pc + 20));
+      __GLX_END(cmdlen);
+   }
+   else {
+      /* Use GLXRenderLarge protocol to send command */
+      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1f, cmdlen + 4);
+      __GLX_PUT_LONG(8, target);
+      __GLX_PUT_FLOAT(12, u1);
+      __GLX_PUT_FLOAT(16, u2);
+      __GLX_PUT_LONG(20, order);
+
+      if (stride != k) {
+         GLubyte *buf;
+
+         buf = (GLubyte *) Xmalloc(compsize);
+         if (!buf) {
+            __glXSetError(gc, GL_OUT_OF_MEMORY);
+            return;
+         }
+         __glFillMap1f(k, order, stride, pnts, buf);
+         __glXSendLargeCommand(gc, pc, 24, buf, compsize);
+         Xfree((char *) buf);
+      }
+      else {
+         /* Data is already packed.  Just send it out */
+         __glXSendLargeCommand(gc, pc, 24, pnts, compsize);
+      }
+   }
+}
+
+void
+__indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustr,
+                   GLint uord, GLdouble v1, GLdouble v2, GLint vstr,
+                   GLint vord, const GLdouble * pnts)
+{
+   __GLX_DECLARE_VARIABLES();
+   GLint k;
+
+   __GLX_LOAD_VARIABLES();
+   k = __glMap2d_size(target);
+   if (k == 0) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+   else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+   compsize = k * uord * vord * __GLX_SIZE_FLOAT64;
+   cmdlen = 48 + compsize;
+   if (!gc->currentDpy)
+      return;
+
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      /* Use GLXRender protocol to send small command */
+      __GLX_BEGIN_VARIABLE(X_GLrop_Map2d, cmdlen);
+      __GLX_PUT_DOUBLE(4, u1);
+      __GLX_PUT_DOUBLE(12, u2);
+      __GLX_PUT_DOUBLE(20, v1);
+      __GLX_PUT_DOUBLE(28, v2);
+      __GLX_PUT_LONG(36, target);
+      __GLX_PUT_LONG(40, uord);
+      __GLX_PUT_LONG(44, vord);
+      /*
+       ** Pack into a u-major ordering.
+       ** NOTE: the doubles that follow are not aligned because of 5
+       ** longs preceeding
+       */
+      __glFillMap2d(k, uord, vord, ustr, vstr, pnts, (GLdouble *) (pc + 48));
+      __GLX_END(cmdlen);
+   }
+   else {
+      /* Use GLXRenderLarge protocol to send command */
+      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2d, cmdlen + 4);
+      __GLX_PUT_DOUBLE(8, u1);
+      __GLX_PUT_DOUBLE(16, u2);
+      __GLX_PUT_DOUBLE(24, v1);
+      __GLX_PUT_DOUBLE(32, v2);
+      __GLX_PUT_LONG(40, target);
+      __GLX_PUT_LONG(44, uord);
+      __GLX_PUT_LONG(48, vord);
+
+      /*
+       ** NOTE: the doubles that follow are not aligned because of 5
+       ** longs preceeding
+       */
+      if ((vstr != k) || (ustr != k * vord)) {
+         GLdouble *buf;
+
+         buf = (GLdouble *) Xmalloc(compsize);
+         if (!buf) {
+            __glXSetError(gc, GL_OUT_OF_MEMORY);
+            return;
+         }
+         /*
+          ** Pack into a u-major ordering.
+          */
+         __glFillMap2d(k, uord, vord, ustr, vstr, pnts, buf);
+         __glXSendLargeCommand(gc, pc, 52, buf, compsize);
+         Xfree((char *) buf);
+      }
+      else {
+         /* Data is already packed.  Just send it out */
+         __glXSendLargeCommand(gc, pc, 52, pnts, compsize);
+      }
+   }
+}
+
+void
+__indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustr,
+                   GLint uord, GLfloat v1, GLfloat v2, GLint vstr, GLint vord,
+                   const GLfloat * pnts)
+{
+   __GLX_DECLARE_VARIABLES();
+   GLint k;
+
+   __GLX_LOAD_VARIABLES();
+   k = __glMap2f_size(target);
+   if (k == 0) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+   else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+   compsize = k * uord * vord * __GLX_SIZE_FLOAT32;
+   cmdlen = 32 + compsize;
+   if (!gc->currentDpy)
+      return;
+
+   /*
+    ** The order that arguments are packed is different from the order
+    ** for glMap2d.
+    */
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      /* Use GLXRender protocol to send small command */
+      __GLX_BEGIN_VARIABLE(X_GLrop_Map2f, cmdlen);
+      __GLX_PUT_LONG(4, target);
+      __GLX_PUT_FLOAT(8, u1);
+      __GLX_PUT_FLOAT(12, u2);
+      __GLX_PUT_LONG(16, uord);
+      __GLX_PUT_FLOAT(20, v1);
+      __GLX_PUT_FLOAT(24, v2);
+      __GLX_PUT_LONG(28, vord);
+      /*
+       ** Pack into a u-major ordering.
+       */
+      __glFillMap2f(k, uord, vord, ustr, vstr, pnts, (GLfloat *) (pc + 32));
+      __GLX_END(cmdlen);
+   }
+   else {
+      /* Use GLXRenderLarge protocol to send command */
+      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2f, cmdlen + 4);
+      __GLX_PUT_LONG(8, target);
+      __GLX_PUT_FLOAT(12, u1);
+      __GLX_PUT_FLOAT(16, u2);
+      __GLX_PUT_LONG(20, uord);
+      __GLX_PUT_FLOAT(24, v1);
+      __GLX_PUT_FLOAT(28, v2);
+      __GLX_PUT_LONG(32, vord);
+
+      if ((vstr != k) || (ustr != k * vord)) {
+         GLfloat *buf;
+
+         buf = (GLfloat *) Xmalloc(compsize);
+         if (!buf) {
+            __glXSetError(gc, GL_OUT_OF_MEMORY);
+            return;
+         }
+         /*
+          ** Pack into a u-major ordering.
+          */
+         __glFillMap2f(k, uord, vord, ustr, vstr, pnts, buf);
+         __glXSendLargeCommand(gc, pc, 36, buf, compsize);
+         Xfree((char *) buf);
+      }
+      else {
+         /* Data is already packed.  Just send it out */
+         __glXSendLargeCommand(gc, pc, 36, pnts, compsize);
+      }
+   }
+}
+
+void
+__indirect_glEnable(GLenum cap)
+{
+   __GLX_DECLARE_VARIABLES();
+
+   __GLX_LOAD_VARIABLES();
+   if (!gc->currentDpy)
+      return;
+
+   switch (cap) {
+   case GL_COLOR_ARRAY:
+   case GL_EDGE_FLAG_ARRAY:
+   case GL_INDEX_ARRAY:
+   case GL_NORMAL_ARRAY:
+   case GL_TEXTURE_COORD_ARRAY:
+   case GL_VERTEX_ARRAY:
+   case GL_SECONDARY_COLOR_ARRAY:
+   case GL_FOG_COORD_ARRAY:
+      __indirect_glEnableClientState(cap);
+      return;
+   default:
+      break;
+   }
+
+   __GLX_BEGIN(X_GLrop_Enable, 8);
+   __GLX_PUT_LONG(4, cap);
+   __GLX_END(8);
+}
+
+void
+__indirect_glDisable(GLenum cap)
+{
+   __GLX_DECLARE_VARIABLES();
+
+   __GLX_LOAD_VARIABLES();
+   if (!gc->currentDpy)
+      return;
+
+   switch (cap) {
+   case GL_COLOR_ARRAY:
+   case GL_EDGE_FLAG_ARRAY:
+   case GL_INDEX_ARRAY:
+   case GL_NORMAL_ARRAY:
+   case GL_TEXTURE_COORD_ARRAY:
+   case GL_VERTEX_ARRAY:
+   case GL_SECONDARY_COLOR_ARRAY:
+   case GL_FOG_COORD_ARRAY:
+      __indirect_glDisableClientState(cap);
+      return;
+   default:
+      break;
+   }
+
+   __GLX_BEGIN(X_GLrop_Disable, 8);
+   __GLX_PUT_LONG(4, cap);
+   __GLX_END(8);
+}
diff --git a/src/glx/renderpix.c b/src/glx/renderpix.c
new file mode 100644 (file)
index 0000000..9919bbc
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * 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.
+ */
+
+/*
+ * (C) Copyright IBM Corporation 2005
+ * 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
+ * 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.
+ */
+
+#include "packrender.h"
+#include "indirect.h"
+
+/**
+ * Send a large image to the server.  If necessary, a buffer is allocated
+ * to hold the unpacked data that is copied from the clients memory.
+ * 
+ * \param gc        Current GLX context
+ * \param compsize  Size, in bytes, of the image portion
+ * \param dim       Number of dimensions of the image
+ * \param width     Width of the image
+ * \param height    Height of the image, must be 1 for 1D images
+ * \param depth     Depth of the image, must be 1 for 1D or 2D images
+ * \param format    Format of the image
+ * \param type      Data type of the image
+ * \param src       Pointer to the image data
+ * \param pc        Pointer to end of the command header
+ * \param modes     Pointer to the pixel unpack data
+ *
+ * \todo
+ * Modify this function so that \c NULL images are sent using
+ * \c __glXSendLargeChunk instead of __glXSendLargeCommand.  Doing this
+ * will eliminate the need to allocate a buffer for that case.
+ *
+ * \bugs
+ * The \c fastImageUnpack path, which is thankfully never used, is completely
+ * broken.
+ */
+void
+__glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
+                    GLint width, GLint height, GLint depth,
+                    GLenum format, GLenum type, const GLvoid * src,
+                    GLubyte * pc, GLubyte * modes)
+{
+   if (!gc->fastImageUnpack || (src == NULL)) {
+      /* Allocate a temporary holding buffer */
+      GLubyte *buf = (GLubyte *) Xmalloc(compsize);
+      if (!buf) {
+         __glXSetError(gc, GL_OUT_OF_MEMORY);
+         return;
+      }
+
+      /* Apply pixel store unpack modes to copy data into buf */
+      if (src != NULL) {
+         (*gc->fillImage) (gc, dim, width, height, depth, format, type,
+                           src, buf, modes);
+      }
+      else {
+         if (dim < 3) {
+            (void) memcpy(modes, __glXDefaultPixelStore + 4, 20);
+         }
+         else {
+            (void) memcpy(modes, __glXDefaultPixelStore + 0, 36);
+         }
+      }
+
+      /* Send large command */
+      __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize);
+
+      /* Free buffer */
+      Xfree((char *) buf);
+   }
+   else {
+      /* Just send the data straight as is */
+      __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, pc, compsize);
+   }
+}
+
+/************************************************************************/
+
+/**
+ * Implement GLX protocol for \c glSeparableFilter2D.
+ *
+ * \bugs
+ * The \c fastImageUnpack path, which is thankfully never used, is completely
+ * broken.
+ */
+void
+__indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
+                               GLsizei width, GLsizei height, GLenum format,
+                               GLenum type, const GLvoid * row,
+                               const GLvoid * column)
+{
+   __GLX_DECLARE_VARIABLES();
+   GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len;
+
+   __GLX_LOAD_VARIABLES();
+   compsize = __glImageSize(width, 1, 1, format, type, 0);
+   compsize2 = __glImageSize(height, 1, 1, format, type, 0);
+   totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
+   hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE);
+   image1len = __GLX_PAD(compsize);
+   image2len = __GLX_PAD(compsize2);
+   cmdlen = totalhdrlen + image1len + image2len;
+   if (!gc->currentDpy)
+      return;
+
+   if (cmdlen <= gc->maxSmallRenderCommandSize) {
+      /* Use GLXRender protocol to send small command */
+      __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_SeparableFilter2D, cmdlen);
+      __GLX_PUT_LONG(0, target);
+      __GLX_PUT_LONG(4, internalformat);
+      __GLX_PUT_LONG(8, width);
+      __GLX_PUT_LONG(12, height);
+      __GLX_PUT_LONG(16, format);
+      __GLX_PUT_LONG(20, type);
+      pc += hdrlen;
+      if (compsize > 0) {
+         (*gc->fillImage) (gc, 1, width, 1, 1, format, type,
+                           row, pc, pixelHeaderPC);
+         pc += image1len;
+      }
+      if (compsize2 > 0) {
+         (*gc->fillImage) (gc, 1, height, 1, 1, format, type,
+                           column, pc, NULL);
+         pc += image2len;
+      }
+      if ((compsize == 0) && (compsize2 == 0)) {
+         /* Setup default store modes */
+         (void) memcpy(pixelHeaderPC, __glXDefaultPixelStore + 4, 20);
+      }
+      __GLX_END(0);
+   }
+   else {
+      const GLint bufsize = image1len + image2len;
+
+      /* Use GLXRenderLarge protocol to send command */
+      __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,
+                                            cmdlen + 4);
+      __GLX_PUT_LONG(0, target);
+      __GLX_PUT_LONG(4, internalformat);
+      __GLX_PUT_LONG(8, width);
+      __GLX_PUT_LONG(12, height);
+      __GLX_PUT_LONG(16, format);
+      __GLX_PUT_LONG(20, type);
+      pc += hdrlen;
+
+      if (!gc->fastImageUnpack) {
+         /* Allocate a temporary holding buffer */
+         GLubyte *buf = (GLubyte *) Xmalloc(bufsize);
+         if (!buf) {
+            __glXSetError(gc, GL_OUT_OF_MEMORY);
+            return;
+         }
+         (*gc->fillImage) (gc, 1, width, 1, 1, format, type, row, buf,
+                           pixelHeaderPC);
+
+         (*gc->fillImage) (gc, 1, height, 1, 1, format, type, column,
+                           buf + image1len, pixelHeaderPC);
+
+         /* Send large command */
+         __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf,
+                               bufsize);
+         /* Free buffer */
+         Xfree((char *) buf);
+      }
+      else {
+         /* Just send the data straight as is */
+         __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), pc,
+                               bufsize);
+      }
+   }
+}
diff --git a/src/glx/single2.c b/src/glx/single2.c
new file mode 100644 (file)
index 0000000..9ecf589
--- /dev/null
@@ -0,0 +1,974 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <assert.h>
+#include "glxclient.h"
+#include "packsingle.h"
+#include "glxextensions.h"
+#include "indirect.h"
+#include "indirect_vertex_array.h"
+#include "glapitable.h"
+#include "glapidispatch.h"
+#include "glapi.h"
+#ifdef USE_XCB
+#include <xcb/xcb.h>
+#include <xcb/glx.h>
+#include <X11/Xlib-xcb.h>
+#endif /* USE_XCB */
+
+
+/* Used for GL_ARB_transpose_matrix */
+static void
+TransposeMatrixf(GLfloat m[16])
+{
+   int i, j;
+   for (i = 0; i < 4; i++) {
+      for (j = 0; j < i; j++) {
+         GLfloat tmp = m[i * 4 + j];
+         m[i * 4 + j] = m[j * 4 + i];
+         m[j * 4 + i] = tmp;
+      }
+   }
+}
+
+/* Used for GL_ARB_transpose_matrix */
+static void
+TransposeMatrixb(GLboolean m[16])
+{
+   int i, j;
+   for (i = 0; i < 4; i++) {
+      for (j = 0; j < i; j++) {
+         GLboolean tmp = m[i * 4 + j];
+         m[i * 4 + j] = m[j * 4 + i];
+         m[j * 4 + i] = tmp;
+      }
+   }
+}
+
+/* Used for GL_ARB_transpose_matrix */
+static void
+TransposeMatrixd(GLdouble m[16])
+{
+   int i, j;
+   for (i = 0; i < 4; i++) {
+      for (j = 0; j < i; j++) {
+         GLdouble tmp = m[i * 4 + j];
+         m[i * 4 + j] = m[j * 4 + i];
+         m[j * 4 + i] = tmp;
+      }
+   }
+}
+
+/* Used for GL_ARB_transpose_matrix */
+static void
+TransposeMatrixi(GLint m[16])
+{
+   int i, j;
+   for (i = 0; i < 4; i++) {
+      for (j = 0; j < i; j++) {
+         GLint tmp = m[i * 4 + j];
+         m[i * 4 + j] = m[j * 4 + i];
+         m[j * 4 + i] = tmp;
+      }
+   }
+}
+
+
+/**
+ * Remap a transpose-matrix enum to a non-transpose-matrix enum.  Enums
+ * that are not transpose-matrix enums are unaffected.
+ */
+static GLenum
+RemapTransposeEnum(GLenum e)
+{
+   switch (e) {
+   case GL_TRANSPOSE_MODELVIEW_MATRIX:
+   case GL_TRANSPOSE_PROJECTION_MATRIX:
+   case GL_TRANSPOSE_TEXTURE_MATRIX:
+      return e - (GL_TRANSPOSE_MODELVIEW_MATRIX - GL_MODELVIEW_MATRIX);
+   case GL_TRANSPOSE_COLOR_MATRIX:
+      return GL_COLOR_MATRIX;
+   default:
+      return e;
+   };
+}
+
+
+GLenum
+__indirect_glGetError(void)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   GLuint retval = GL_NO_ERROR;
+   xGLXGetErrorReply reply;
+
+   if (gc->error) {
+      /* Use internal error first */
+      retval = gc->error;
+      gc->error = GL_NO_ERROR;
+      return retval;
+   }
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_GetError, 0);
+   __GLX_SINGLE_READ_XREPLY();
+   retval = reply.error;
+   __GLX_SINGLE_END();
+
+   return retval;
+}
+
+
+/**
+ * Get the selected attribute from the client state.
+ *
+ * \returns
+ * On success \c GL_TRUE is returned.  Otherwise, \c GL_FALSE is returned.
+ */
+static GLboolean
+get_client_data(__GLXcontext * gc, GLenum cap, GLintptr * data)
+{
+   GLboolean retval = GL_TRUE;
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   const GLint tex_unit = __glXGetActiveTextureUnit(state);
+
+
+   switch (cap) {
+   case GL_VERTEX_ARRAY:
+   case GL_NORMAL_ARRAY:
+   case GL_COLOR_ARRAY:
+   case GL_INDEX_ARRAY:
+   case GL_EDGE_FLAG_ARRAY:
+   case GL_SECONDARY_COLOR_ARRAY:
+   case GL_FOG_COORD_ARRAY:
+      retval = __glXGetArrayEnable(state, cap, 0, data);
+      break;
+
+   case GL_VERTEX_ARRAY_SIZE:
+      retval = __glXGetArraySize(state, GL_VERTEX_ARRAY, 0, data);
+      break;
+   case GL_COLOR_ARRAY_SIZE:
+      retval = __glXGetArraySize(state, GL_COLOR_ARRAY, 0, data);
+      break;
+   case GL_SECONDARY_COLOR_ARRAY_SIZE:
+      retval = __glXGetArraySize(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
+      break;
+
+   case GL_VERTEX_ARRAY_TYPE:
+      retval = __glXGetArrayType(state, GL_VERTEX_ARRAY, 0, data);
+      break;
+   case GL_NORMAL_ARRAY_TYPE:
+      retval = __glXGetArrayType(state, GL_NORMAL_ARRAY, 0, data);
+      break;
+   case GL_INDEX_ARRAY_TYPE:
+      retval = __glXGetArrayType(state, GL_INDEX_ARRAY, 0, data);
+      break;
+   case GL_COLOR_ARRAY_TYPE:
+      retval = __glXGetArrayType(state, GL_COLOR_ARRAY, 0, data);
+      break;
+   case GL_SECONDARY_COLOR_ARRAY_TYPE:
+      retval = __glXGetArrayType(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
+      break;
+   case GL_FOG_COORD_ARRAY_TYPE:
+      retval = __glXGetArrayType(state, GL_FOG_COORD_ARRAY, 0, data);
+      break;
+
+   case GL_VERTEX_ARRAY_STRIDE:
+      retval = __glXGetArrayStride(state, GL_VERTEX_ARRAY, 0, data);
+      break;
+   case GL_NORMAL_ARRAY_STRIDE:
+      retval = __glXGetArrayStride(state, GL_NORMAL_ARRAY, 0, data);
+      break;
+   case GL_INDEX_ARRAY_STRIDE:
+      retval = __glXGetArrayStride(state, GL_INDEX_ARRAY, 0, data);
+      break;
+   case GL_EDGE_FLAG_ARRAY_STRIDE:
+      retval = __glXGetArrayStride(state, GL_EDGE_FLAG_ARRAY, 0, data);
+      break;
+   case GL_COLOR_ARRAY_STRIDE:
+      retval = __glXGetArrayStride(state, GL_COLOR_ARRAY, 0, data);
+      break;
+   case GL_SECONDARY_COLOR_ARRAY_STRIDE:
+      retval = __glXGetArrayStride(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
+      break;
+   case GL_FOG_COORD_ARRAY_STRIDE:
+      retval = __glXGetArrayStride(state, GL_FOG_COORD_ARRAY, 0, data);
+      break;
+
+   case GL_TEXTURE_COORD_ARRAY:
+      retval =
+         __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+      break;
+   case GL_TEXTURE_COORD_ARRAY_SIZE:
+      retval =
+         __glXGetArraySize(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+      break;
+   case GL_TEXTURE_COORD_ARRAY_TYPE:
+      retval =
+         __glXGetArrayType(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+      break;
+   case GL_TEXTURE_COORD_ARRAY_STRIDE:
+      retval =
+         __glXGetArrayStride(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+      break;
+
+   case GL_MAX_ELEMENTS_VERTICES:
+   case GL_MAX_ELEMENTS_INDICES:
+      retval = GL_TRUE;
+      *data = ~0UL;
+      break;
+
+
+   case GL_PACK_ROW_LENGTH:
+      *data = (GLintptr) state->storePack.rowLength;
+      break;
+   case GL_PACK_IMAGE_HEIGHT:
+      *data = (GLintptr) state->storePack.imageHeight;
+      break;
+   case GL_PACK_SKIP_ROWS:
+      *data = (GLintptr) state->storePack.skipRows;
+      break;
+   case GL_PACK_SKIP_PIXELS:
+      *data = (GLintptr) state->storePack.skipPixels;
+      break;
+   case GL_PACK_SKIP_IMAGES:
+      *data = (GLintptr) state->storePack.skipImages;
+      break;
+   case GL_PACK_ALIGNMENT:
+      *data = (GLintptr) state->storePack.alignment;
+      break;
+   case GL_PACK_SWAP_BYTES:
+      *data = (GLintptr) state->storePack.swapEndian;
+      break;
+   case GL_PACK_LSB_FIRST:
+      *data = (GLintptr) state->storePack.lsbFirst;
+      break;
+   case GL_UNPACK_ROW_LENGTH:
+      *data = (GLintptr) state->storeUnpack.rowLength;
+      break;
+   case GL_UNPACK_IMAGE_HEIGHT:
+      *data = (GLintptr) state->storeUnpack.imageHeight;
+      break;
+   case GL_UNPACK_SKIP_ROWS:
+      *data = (GLintptr) state->storeUnpack.skipRows;
+      break;
+   case GL_UNPACK_SKIP_PIXELS:
+      *data = (GLintptr) state->storeUnpack.skipPixels;
+      break;
+   case GL_UNPACK_SKIP_IMAGES:
+      *data = (GLintptr) state->storeUnpack.skipImages;
+      break;
+   case GL_UNPACK_ALIGNMENT:
+      *data = (GLintptr) state->storeUnpack.alignment;
+      break;
+   case GL_UNPACK_SWAP_BYTES:
+      *data = (GLintptr) state->storeUnpack.swapEndian;
+      break;
+   case GL_UNPACK_LSB_FIRST:
+      *data = (GLintptr) state->storeUnpack.lsbFirst;
+      break;
+   case GL_CLIENT_ATTRIB_STACK_DEPTH:
+      *data = (GLintptr) (gc->attributes.stackPointer - gc->attributes.stack);
+      break;
+   case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+      *data = (GLintptr) __GL_CLIENT_ATTRIB_STACK_DEPTH;
+      break;
+   case GL_CLIENT_ACTIVE_TEXTURE:
+      *data = (GLintptr) (tex_unit + GL_TEXTURE0);
+      break;
+
+   default:
+      retval = GL_FALSE;
+      break;
+   }
+
+
+   return retval;
+}
+
+
+void
+__indirect_glGetBooleanv(GLenum val, GLboolean * b)
+{
+   const GLenum origVal = val;
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   xGLXSingleReply reply;
+
+   val = RemapTransposeEnum(val);
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_GetBooleanv, 4);
+   __GLX_SINGLE_PUT_LONG(0, val);
+   __GLX_SINGLE_READ_XREPLY();
+   __GLX_SINGLE_GET_SIZE(compsize);
+
+   if (compsize == 0) {
+      /*
+       ** Error occured; don't modify user's buffer.
+       */
+   }
+   else {
+      GLintptr data;
+
+      /*
+       ** We still needed to send the request to the server in order to
+       ** find out whether it was legal to make a query (it's illegal,
+       ** for example, to call a query between glBegin() and glEnd()).
+       */
+
+      if (get_client_data(gc, val, &data)) {
+         *b = (GLboolean) data;
+      }
+      else {
+         /*
+          ** Not a local value, so use what we got from the server.
+          */
+         if (compsize == 1) {
+            __GLX_SINGLE_GET_CHAR(b);
+         }
+         else {
+            __GLX_SINGLE_GET_CHAR_ARRAY(b, compsize);
+            if (val != origVal) {
+               /* matrix transpose */
+               TransposeMatrixb(b);
+            }
+         }
+      }
+   }
+   __GLX_SINGLE_END();
+}
+
+void
+__indirect_glGetDoublev(GLenum val, GLdouble * d)
+{
+   const GLenum origVal = val;
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   xGLXSingleReply reply;
+
+   val = RemapTransposeEnum(val);
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_GetDoublev, 4);
+   __GLX_SINGLE_PUT_LONG(0, val);
+   __GLX_SINGLE_READ_XREPLY();
+   __GLX_SINGLE_GET_SIZE(compsize);
+
+   if (compsize == 0) {
+      /*
+       ** Error occured; don't modify user's buffer.
+       */
+   }
+   else {
+      GLintptr data;
+
+      /*
+       ** We still needed to send the request to the server in order to
+       ** find out whether it was legal to make a query (it's illegal,
+       ** for example, to call a query between glBegin() and glEnd()).
+       */
+
+      if (get_client_data(gc, val, &data)) {
+         *d = (GLdouble) data;
+      }
+      else {
+         /*
+          ** Not a local value, so use what we got from the server.
+          */
+         if (compsize == 1) {
+            __GLX_SINGLE_GET_DOUBLE(d);
+         }
+         else {
+            __GLX_SINGLE_GET_DOUBLE_ARRAY(d, compsize);
+            if (val != origVal) {
+               /* matrix transpose */
+               TransposeMatrixd(d);
+            }
+         }
+      }
+   }
+   __GLX_SINGLE_END();
+}
+
+void
+__indirect_glGetFloatv(GLenum val, GLfloat * f)
+{
+   const GLenum origVal = val;
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   xGLXSingleReply reply;
+
+   val = RemapTransposeEnum(val);
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_GetFloatv, 4);
+   __GLX_SINGLE_PUT_LONG(0, val);
+   __GLX_SINGLE_READ_XREPLY();
+   __GLX_SINGLE_GET_SIZE(compsize);
+
+   if (compsize == 0) {
+      /*
+       ** Error occured; don't modify user's buffer.
+       */
+   }
+   else {
+      GLintptr data;
+
+      /*
+       ** We still needed to send the request to the server in order to
+       ** find out whether it was legal to make a query (it's illegal,
+       ** for example, to call a query between glBegin() and glEnd()).
+       */
+
+      if (get_client_data(gc, val, &data)) {
+         *f = (GLfloat) data;
+      }
+      else {
+         /*
+          ** Not a local value, so use what we got from the server.
+          */
+         if (compsize == 1) {
+            __GLX_SINGLE_GET_FLOAT(f);
+         }
+         else {
+            __GLX_SINGLE_GET_FLOAT_ARRAY(f, compsize);
+            if (val != origVal) {
+               /* matrix transpose */
+               TransposeMatrixf(f);
+            }
+         }
+      }
+   }
+   __GLX_SINGLE_END();
+}
+
+void
+__indirect_glGetIntegerv(GLenum val, GLint * i)
+{
+   const GLenum origVal = val;
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   xGLXSingleReply reply;
+
+   val = RemapTransposeEnum(val);
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv, 4);
+   __GLX_SINGLE_PUT_LONG(0, val);
+   __GLX_SINGLE_READ_XREPLY();
+   __GLX_SINGLE_GET_SIZE(compsize);
+
+   if (compsize == 0) {
+      /*
+       ** Error occured; don't modify user's buffer.
+       */
+   }
+   else {
+      GLintptr data;
+
+      /*
+       ** We still needed to send the request to the server in order to
+       ** find out whether it was legal to make a query (it's illegal,
+       ** for example, to call a query between glBegin() and glEnd()).
+       */
+
+      if (get_client_data(gc, val, &data)) {
+         *i = (GLint) data;
+      }
+      else {
+         /*
+          ** Not a local value, so use what we got from the server.
+          */
+         if (compsize == 1) {
+            __GLX_SINGLE_GET_LONG(i);
+         }
+         else {
+            __GLX_SINGLE_GET_LONG_ARRAY(i, compsize);
+            if (val != origVal) {
+               /* matrix transpose */
+               TransposeMatrixi(i);
+            }
+         }
+      }
+   }
+   __GLX_SINGLE_END();
+}
+
+/*
+** Send all pending commands to server.
+*/
+void
+__indirect_glFlush(void)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+
+   if (!dpy)
+      return;
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_Flush, 0);
+   __GLX_SINGLE_END();
+
+   /* And finally flush the X protocol data */
+   XFlush(dpy);
+}
+
+void
+__indirect_glFeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+
+   if (!dpy)
+      return;
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_FeedbackBuffer, 8);
+   __GLX_SINGLE_PUT_LONG(0, size);
+   __GLX_SINGLE_PUT_LONG(4, type);
+   __GLX_SINGLE_END();
+
+   gc->feedbackBuf = buffer;
+}
+
+void
+__indirect_glSelectBuffer(GLsizei numnames, GLuint * buffer)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+
+   if (!dpy)
+      return;
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_SelectBuffer, 4);
+   __GLX_SINGLE_PUT_LONG(0, numnames);
+   __GLX_SINGLE_END();
+
+   gc->selectBuf = buffer;
+}
+
+GLint
+__indirect_glRenderMode(GLenum mode)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   GLint retval = 0;
+   xGLXRenderModeReply reply;
+
+   if (!dpy)
+      return -1;
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_RenderMode, 4);
+   __GLX_SINGLE_PUT_LONG(0, mode);
+   __GLX_SINGLE_READ_XREPLY();
+   __GLX_SINGLE_GET_RETVAL(retval, GLint);
+
+   if (reply.newMode != mode) {
+      /*
+       ** Switch to new mode did not take effect, therefore an error
+       ** occured.  When an error happens the server won't send us any
+       ** other data.
+       */
+   }
+   else {
+      /* Read the feedback or selection data */
+      if (gc->renderMode == GL_FEEDBACK) {
+         __GLX_SINGLE_GET_SIZE(compsize);
+         __GLX_SINGLE_GET_FLOAT_ARRAY(gc->feedbackBuf, compsize);
+      }
+      else if (gc->renderMode == GL_SELECT) {
+         __GLX_SINGLE_GET_SIZE(compsize);
+         __GLX_SINGLE_GET_LONG_ARRAY(gc->selectBuf, compsize);
+      }
+      gc->renderMode = mode;
+   }
+   __GLX_SINGLE_END();
+
+   return retval;
+}
+
+void
+__indirect_glFinish(void)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   xGLXSingleReply reply;
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_Finish, 0);
+   __GLX_SINGLE_READ_XREPLY();
+   __GLX_SINGLE_END();
+}
+
+
+/**
+ * Extract the major and minor version numbers from a version string.
+ */
+static void
+version_from_string(const char *ver, int *major_version, int *minor_version)
+{
+   const char *end;
+   long major;
+   long minor;
+
+   major = strtol(ver, (char **) &end, 10);
+   minor = strtol(end + 1, NULL, 10);
+   *major_version = major;
+   *minor_version = minor;
+}
+
+
+const GLubyte *
+__indirect_glGetString(GLenum name)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   Display *dpy = gc->currentDpy;
+   GLubyte *s = NULL;
+
+   if (!dpy)
+      return 0;
+
+   /*
+    ** Return the cached copy if the string has already been fetched
+    */
+   switch (name) {
+   case GL_VENDOR:
+      if (gc->vendor)
+         return gc->vendor;
+      break;
+   case GL_RENDERER:
+      if (gc->renderer)
+         return gc->renderer;
+      break;
+   case GL_VERSION:
+      if (gc->version)
+         return gc->version;
+      break;
+   case GL_EXTENSIONS:
+      if (gc->extensions)
+         return gc->extensions;
+      break;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return 0;
+   }
+
+   /*
+    ** Get requested string from server
+    */
+
+   (void) __glXFlushRenderBuffer(gc, gc->pc);
+   s = (GLubyte *) __glXGetString(dpy, gc->majorOpcode, gc->currentContextTag,
+                                  name);
+   if (!s) {
+      /* Throw data on the floor */
+      __glXSetError(gc, GL_OUT_OF_MEMORY);
+   }
+   else {
+      /*
+       ** Update local cache
+       */
+      switch (name) {
+      case GL_VENDOR:
+         gc->vendor = s;
+         break;
+
+      case GL_RENDERER:
+         gc->renderer = s;
+         break;
+
+      case GL_VERSION:{
+            int client_major;
+            int client_minor;
+
+            version_from_string((char *) s,
+                                &gc->server_major, &gc->server_minor);
+            __glXGetGLVersion(&client_major, &client_minor);
+
+            if ((gc->server_major < client_major)
+                || ((gc->server_major == client_major)
+                    && (gc->server_minor <= client_minor))) {
+               gc->version = s;
+            }
+            else {
+               /* Allow 7 bytes for the client-side GL version.  This allows
+                * for upto version 999.999.  I'm not holding my breath for
+                * that one!  The extra 4 is for the ' ()\0' that will be
+                * added.
+                */
+               const size_t size = 7 + strlen((char *) s) + 4;
+
+               gc->version = Xmalloc(size);
+               if (gc->version == NULL) {
+                  /* If we couldn't allocate memory for the new string,
+                   * make a best-effort and just copy the client-side version
+                   * to the string and use that.  It probably doesn't
+                   * matter what is done here.  If there not memory available
+                   * for a short string, the system is probably going to die
+                   * soon anyway.
+                   */
+                  snprintf((char *) s, strlen((char *) s) + 1, "%u.%u",
+                           client_major, client_minor);
+                  gc->version = s;
+               }
+               else {
+                  snprintf((char *) gc->version, size, "%u.%u (%s)",
+                           client_major, client_minor, s);
+                  Xfree(s);
+                  s = gc->version;
+               }
+            }
+            break;
+         }
+
+      case GL_EXTENSIONS:{
+            int major = 1;
+            int minor = 0;
+
+            /* This code is currently disabled.  I was reminded that some
+             * vendors intentionally exclude some extensions from their
+             * extension string that are part of the core version they
+             * advertise.  In particular, on Nvidia drivers this means that
+             * the functionality is supported by the driver, but is not
+             * hardware accelerated.  For example, a TNT will show core
+             * version 1.5, but most of the post-1.2 functionality is a
+             * software fallback.
+             *
+             * I don't want to break applications that rely on this odd
+             * behavior.  At the same time, the code is written and tested,
+             * so I didn't want to throw it away.  Therefore, the code is here
+             * but disabled.  In the future, we may wish to and an environment
+             * variable to enable it.
+             */
+
+#if 0
+            /* Call glGetString just to make sure that gc->server_major and
+             * gc->server_minor are set.  This version may be higher than we
+             * can completely support, but it may imply support for some
+             * extensions that we can support.
+             *
+             * For example, at the time of this writing, the client-side
+             * library only supports upto core GL version 1.2.  However, cubic
+             * textures, multitexture, multisampling, and some other 1.3
+             * features are supported.  If the server reports back version
+             * 1.3, but does not report all of those extensions, we will
+             * enable them.
+             */
+            (void *) glGetString(GL_VERSION);
+            major = gc->server_major, minor = gc->server_minor;
+#endif
+
+            __glXCalculateUsableGLExtensions(gc, (char *) s, major, minor);
+            XFree(s);
+            s = gc->extensions;
+            break;
+         }
+      }
+   }
+   return s;
+}
+
+GLboolean
+__indirect_glIsEnabled(GLenum cap)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   xGLXSingleReply reply;
+   GLboolean retval = 0;
+   GLintptr enable;
+
+   if (!dpy)
+      return 0;
+
+   switch (cap) {
+   case GL_VERTEX_ARRAY:
+   case GL_NORMAL_ARRAY:
+   case GL_COLOR_ARRAY:
+   case GL_INDEX_ARRAY:
+   case GL_EDGE_FLAG_ARRAY:
+   case GL_SECONDARY_COLOR_ARRAY:
+   case GL_FOG_COORD_ARRAY:
+      retval = __glXGetArrayEnable(state, cap, 0, &enable);
+      assert(retval);
+      return (GLboolean) enable;
+      break;
+   case GL_TEXTURE_COORD_ARRAY:
+      retval = __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY,
+                                   __glXGetActiveTextureUnit(state), &enable);
+      assert(retval);
+      return (GLboolean) enable;
+      break;
+   }
+
+   __GLX_SINGLE_LOAD_VARIABLES();
+   __GLX_SINGLE_BEGIN(X_GLsop_IsEnabled, 4);
+   __GLX_SINGLE_PUT_LONG(0, cap);
+   __GLX_SINGLE_READ_XREPLY();
+   __GLX_SINGLE_GET_RETVAL(retval, GLboolean);
+   __GLX_SINGLE_END();
+   return retval;
+}
+
+void
+__indirect_glGetPointerv(GLenum pname, void **params)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+   Display *dpy = gc->currentDpy;
+
+   if (!dpy)
+      return;
+
+   switch (pname) {
+   case GL_VERTEX_ARRAY_POINTER:
+   case GL_NORMAL_ARRAY_POINTER:
+   case GL_COLOR_ARRAY_POINTER:
+   case GL_INDEX_ARRAY_POINTER:
+   case GL_EDGE_FLAG_ARRAY_POINTER:
+      __glXGetArrayPointer(state, pname - GL_VERTEX_ARRAY_POINTER
+                           + GL_VERTEX_ARRAY, 0, params);
+      return;
+   case GL_TEXTURE_COORD_ARRAY_POINTER:
+      __glXGetArrayPointer(state, GL_TEXTURE_COORD_ARRAY,
+                           __glXGetActiveTextureUnit(state), params);
+      return;
+   case GL_SECONDARY_COLOR_ARRAY_POINTER:
+   case GL_FOG_COORD_ARRAY_POINTER:
+      __glXGetArrayPointer(state, pname - GL_FOG_COORD_ARRAY_POINTER
+                           + GL_FOG_COORD_ARRAY, 0, params);
+      return;
+   case GL_FEEDBACK_BUFFER_POINTER:
+      *params = (void *) gc->feedbackBuf;
+      return;
+   case GL_SELECTION_BUFFER_POINTER:
+      *params = (void *) gc->selectBuf;
+      return;
+   default:
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+}
+
+
+
+/**
+ * This was previously auto-generated, but we need to special-case
+ * how we handle writing into the 'residences' buffer when n%4!=0.
+ */
+#define X_GLsop_AreTexturesResident 143
+GLboolean
+__indirect_glAreTexturesResident(GLsizei n, const GLuint * textures,
+                                 GLboolean * residences)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+   Display *const dpy = gc->currentDpy;
+   GLboolean retval = (GLboolean) 0;
+   const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+   if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+#ifdef USE_XCB
+      xcb_connection_t *c = XGetXCBConnection(dpy);
+      (void) __glXFlushRenderBuffer(gc, gc->pc);
+      xcb_glx_are_textures_resident_reply_t *reply =
+         xcb_glx_are_textures_resident_reply(c,
+                                             xcb_glx_are_textures_resident
+                                             (c, gc->currentContextTag, n,
+                                              textures), NULL);
+      (void) memcpy(residences, xcb_glx_are_textures_resident_data(reply),
+                    xcb_glx_are_textures_resident_data_length(reply) *
+                    sizeof(GLboolean));
+      retval = reply->ret_val;
+      free(reply);
+#else
+      GLubyte const *pc =
+         __glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
+      (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+      (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
+      if (n & 3) {
+         /* n is not a multiple of four.
+          * When reply_is_always_array is TRUE, __glXReadReply() will
+          * put a multiple of four bytes into the dest buffer.  If the
+          * caller's buffer is not a multiple of four in size, we'll write
+          * out of bounds.  So use a temporary buffer that's a few bytes
+          * larger.
+          */
+         GLboolean *res4 = malloc((n + 3) & ~3);
+         retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
+         memcpy(residences, res4, n);
+         free(res4);
+      }
+      else {
+         retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
+      }
+      UnlockDisplay(dpy);
+      SyncHandle();
+#endif /* USE_XCB */
+   }
+   return retval;
+}
+
+
+/**
+ * This was previously auto-generated, but we need to special-case
+ * how we handle writing into the 'residences' buffer when n%4!=0.
+ */
+#define X_GLvop_AreTexturesResidentEXT 11
+GLboolean
+glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,
+                         GLboolean * residences)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+
+   if (gc->isDirect) {
+      return CALL_AreTexturesResident(GET_DISPATCH(),
+                                      (n, textures, residences));
+   }
+   else {
+      __GLXcontext *const gc = __glXGetCurrentContext();
+      Display *const dpy = gc->currentDpy;
+      GLboolean retval = (GLboolean) 0;
+      const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+      if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+         GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_AreTexturesResidentEXT,
+                                    cmdlen);
+         (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+         (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
+         if (n & 3) {
+            /* see comments in __indirect_glAreTexturesResident() */
+            GLboolean *res4 = malloc((n + 3) & ~3);
+            retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
+            memcpy(residences, res4, n);
+            free(res4);
+         }
+         else {
+            retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
+         }
+         UnlockDisplay(dpy);
+         SyncHandle();
+      }
+      return retval;
+   }
+}
diff --git a/src/glx/singlepix.c b/src/glx/singlepix.c
new file mode 100644 (file)
index 0000000..f5ebf4d
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+
+#include "packsingle.h"
+#include "indirect.h"
+#include "glapitable.h"
+#include "glapidispatch.h"
+#include "glapi.h"
+#include "glthread.h"
+#include "glapioffsets.h"
+#include <GL/glxproto.h>
+
+void
+__indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
+                                GLvoid * row, GLvoid * column, GLvoid * span)
+{
+   __GLX_SINGLE_DECLARE_VARIABLES();
+   const __GLXattribute *state;
+   xGLXGetSeparableFilterReply reply;
+   GLubyte *rowBuf, *colBuf;
+
+   if (!dpy)
+      return;
+   __GLX_SINGLE_LOAD_VARIABLES();
+   state = gc->client_state_private;
+
+   /* Send request */
+   __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13));
+   __GLX_SINGLE_PUT_LONG(0, target);
+   __GLX_SINGLE_PUT_LONG(4, format);
+   __GLX_SINGLE_PUT_LONG(8, type);
+   __GLX_SINGLE_PUT_CHAR(12, state->storePack.swapEndian);
+   __GLX_SINGLE_READ_XREPLY();
+   compsize = reply.length << 2;
+
+   if (compsize != 0) {
+      GLint width, height;
+      GLint widthsize, heightsize;
+
+      width = reply.width;
+      height = reply.height;
+
+      widthsize = __glImageSize(width, 1, 1, format, type, 0);
+      heightsize = __glImageSize(height, 1, 1, format, type, 0);
+
+      /* Allocate a holding buffer to transform the data from */
+      rowBuf = (GLubyte *) Xmalloc(widthsize);
+      if (!rowBuf) {
+         /* Throw data away */
+         _XEatData(dpy, compsize);
+         __glXSetError(gc, GL_OUT_OF_MEMORY);
+         UnlockDisplay(dpy);
+         SyncHandle();
+         return;
+      }
+      else {
+         __GLX_SINGLE_GET_CHAR_ARRAY(((char *) rowBuf), widthsize);
+         __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row);
+         Xfree((char *) rowBuf);
+      }
+      colBuf = (GLubyte *) Xmalloc(heightsize);
+      if (!colBuf) {
+         /* Throw data away */
+         _XEatData(dpy, compsize - __GLX_PAD(widthsize));
+         __glXSetError(gc, GL_OUT_OF_MEMORY);
+         UnlockDisplay(dpy);
+         SyncHandle();
+         return;
+      }
+      else {
+         __GLX_SINGLE_GET_CHAR_ARRAY(((char *) colBuf), heightsize);
+         __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column);
+         Xfree((char *) colBuf);
+      }
+   }
+   else {
+      /*
+       ** don't modify user's buffer.
+       */
+   }
+   __GLX_SINGLE_END();
+
+}
+
+
+#define CONCAT(a,b) a ## b
+#define NAME(o) CONCAT(gl_dispatch_stub_, o)
+
+void NAME(_gloffset_GetSeparableFilter) (GLenum target, GLenum format,
+                                         GLenum type, GLvoid * row,
+                                         GLvoid * column, GLvoid * span)
+{
+   __GLXcontext *const gc = __glXGetCurrentContext();
+
+#ifdef GLX_DIRECT_RENDERING
+   if (gc->driContext) {
+      CALL_GetSeparableFilter(GET_DISPATCH(),
+                              (target, format, type, row, column, span));
+      return;
+   }
+   else
+#endif
+   {
+      Display *const dpy = gc->currentDpy;
+      const GLuint cmdlen = __GLX_PAD(13);
+
+      if (dpy != NULL) {
+         const __GLXattribute *const state = gc->client_state_private;
+         xGLXGetSeparableFilterReply reply;
+         GLubyte const *pc =
+            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                    X_GLvop_GetSeparableFilterEXT, cmdlen);
+         unsigned compsize;
+
+
+         (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+         (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+         (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+         *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+
+         (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+         compsize = reply.length << 2;
+
+         if (compsize != 0) {
+            const GLint width = reply.width;
+            const GLint height = reply.height;
+            const GLint widthsize =
+               __glImageSize(width, 1, 1, format, type, 0);
+            const GLint heightsize =
+               __glImageSize(height, 1, 1, format, type, 0);
+            GLubyte *const buf =
+               (GLubyte *) Xmalloc((widthsize > heightsize) ? widthsize :
+                                   heightsize);
+
+            if (buf == NULL) {
+               /* Throw data away */
+               _XEatData(dpy, compsize);
+               __glXSetError(gc, GL_OUT_OF_MEMORY);
+
+               UnlockDisplay(dpy);
+               SyncHandle();
+               return;
+            }
+            else {
+               int extra;
+
+               extra = 4 - (widthsize & 3);
+               _XRead(dpy, (char *) buf, widthsize);
+               if (extra < 4) {
+                  _XEatData(dpy, extra);
+               }
+
+               __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, row);
+
+               extra = 4 - (heightsize & 3);
+               _XRead(dpy, (char *) buf, heightsize);
+               if (extra < 4) {
+                  _XEatData(dpy, extra);
+               }
+
+               __glEmptyImage(gc, 1, height, 1, 1, format, type, buf, column);
+
+               Xfree((char *) buf);
+            }
+         }
+      }
+   }
+}
diff --git a/src/glx/vertarr.c b/src/glx/vertarr.c
new file mode 100644 (file)
index 0000000..398cfb1
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * 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.
+ */
+
+#include "glxclient.h"
+#include "indirect.h"
+#include "indirect_vertex_array.h"
+
+
+/*****************************************************************************/
+
+/**
+ * \name Vertex array pointer bridge functions
+ *
+ * When EXT_vertex_array was moved into the core GL spec, the \c count
+ * parameter was lost.  This libGL really only wants to implement the GL 1.1
+ * version, but we need to support applications that were written to the old
+ * interface.  These bridge functions are part of the glue that makes this
+ * happen.
+ */
+/*@{*/
+void
+__indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride,
+                             GLsizei count, const GLvoid * pointer)
+{
+   (void) count;
+   __indirect_glColorPointer(size, type, stride, pointer);
+}
+
+void
+__indirect_glEdgeFlagPointerEXT(GLsizei stride,
+                                GLsizei count, const GLboolean * pointer)
+{
+   (void) count;
+   __indirect_glEdgeFlagPointer(stride, pointer);
+}
+
+void
+__indirect_glIndexPointerEXT(GLenum type, GLsizei stride,
+                             GLsizei count, const GLvoid * pointer)
+{
+   (void) count;
+   __indirect_glIndexPointer(type, stride, pointer);
+}
+
+void
+__indirect_glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+                              const GLvoid * pointer)
+{
+   (void) count;
+   __indirect_glNormalPointer(type, stride, pointer);
+}
+
+void
+__indirect_glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+                                GLsizei count, const GLvoid * pointer)
+{
+   (void) count;
+   __indirect_glTexCoordPointer(size, type, stride, pointer);
+}
+
+void
+__indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+                              GLsizei count, const GLvoid * pointer)
+{
+   (void) count;
+   __indirect_glVertexPointer(size, type, stride, pointer);
+}
+
+/*@}*/
+
+/*****************************************************************************/
+
+void
+__indirect_glInterleavedArrays(GLenum format, GLsizei stride,
+                               const GLvoid * pointer)
+{
+   __GLXcontext *gc = __glXGetCurrentContext();
+   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+
+#define NONE  {0, 0, 0}
+#define F(x)  {GL_FLOAT, x, x * sizeof(GLfloat)}
+#define UB4   {GL_UNSIGNED_BYTE, 4, 4 * sizeof(GLubyte)}
+
+   /* Each row in this array describes the elements of a particular
+    * interleaved array mode.  Each column describes, in the order in which
+    * they appear in the interleaved arrays, one of the four possible types
+    * of vertex data that can appear in an interleaved array.
+    */
+   struct
+   {
+        /**
+        * The enum describing the GL type, as would be passed to the
+        * appropriate gl*Pointer function.
+        */
+      GLushort type;
+
+        /**
+        * Number of elements in the subarray, as would be passed (as the
+        * \c size parameter) to the appropriate gl*Pointer function.
+        */
+      GLubyte count;
+
+        /**
+        * True size of a single element in the subarray, as would be passed
+        * (as the \c stride parameter) to the appropriate gl*Pointer
+        * function.
+        */
+      GLubyte size;
+   }
+   static const modes[14][4] = {
+      /* texture color normal vertex */
+      {NONE, NONE, NONE, F(2)}, /* GL_V2F */
+      {NONE, NONE, NONE, F(3)}, /* GL_V3F */
+      {NONE, UB4, NONE, F(2)},  /* GL_C4UB_V2F */
+      {NONE, UB4, NONE, F(3)},  /* GL_C4UB_V3F */
+      {NONE, F(3), NONE, F(3)}, /* GL_C3F_V3F */
+      {NONE, NONE, F(3), F(3)}, /* GL_N3F_V3F */
+      {NONE, F(4), F(3), F(3)}, /* GL_C4F_N3F_V3F */
+      {F(2), NONE, NONE, F(3)}, /* GL_T2F_V3F */
+      {F(4), NONE, NONE, F(4)}, /* GL_T4F_V4F */
+      {F(2), UB4, NONE, F(3)},  /* GL_T2F_C4UB_V3F */
+      {F(2), F(3), NONE, F(3)}, /* GL_T2F_C3F_V3F */
+      {F(2), NONE, F(3), F(3)}, /* GL_T2F_N3F_V3F */
+      {F(2), F(4), F(3), F(3)}, /* GL_T2F_C4F_N3F_V3F */
+      {F(4), F(4), F(3), F(4)}, /* GL_T4F_C4F_N3F_V4F */
+   };
+#undef NONE
+#undef F
+#undef UB4
+
+   GLint trueStride, size;
+   int offsets[4];
+   unsigned i;
+   const int idx = format - GL_V2F;
+
+
+   /* All valid formats are on the range [GL_V2F, GL_V2F+0x0D].  Since idx
+    * is just the format biased by -GL_V2F, all valid idx values are on the
+    * range [0, 0x0D].
+    */
+   if ((idx < 0) || (idx > 0x0D)) {
+      __glXSetError(gc, GL_INVALID_ENUM);
+      return;
+   }
+
+   if (stride < 0) {
+      __glXSetError(gc, GL_INVALID_VALUE);
+      return;
+   }
+
+
+   /* If the 'count' for a subarray is non-zero, then the offset of its
+    * first element is at the currently accumulated 'size'.
+    */
+   size = 0;
+   for (i = 0; i < 4; i++) {
+      offsets[i] = (modes[idx][i].count != 0) ? size : -1;
+      size += modes[idx][i].size;
+   }
+
+   trueStride = (stride == 0) ? size : stride;
+
+   __glXArrayDisableAll(state);
+
+   if (offsets[0] >= 0) {
+      __indirect_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+      __indirect_glTexCoordPointer(modes[idx][0].count, GL_FLOAT,
+                                   trueStride, (const char *) pointer);
+   }
+   if (offsets[1] >= 0) {
+      __indirect_glEnableClientState(GL_COLOR_ARRAY);
+      __indirect_glColorPointer(modes[idx][1].count, modes[idx][1].type,
+                                trueStride,
+                                (const char *) pointer + offsets[1]);
+   }
+   if (offsets[2] >= 0) {
+      __indirect_glEnableClientState(GL_NORMAL_ARRAY);
+      __indirect_glNormalPointer(GL_FLOAT, trueStride,
+                                 (const char *) pointer + offsets[2]);
+   }
+   __indirect_glEnableClientState(GL_VERTEX_ARRAY);
+   __indirect_glVertexPointer(modes[idx][3].count, GL_FLOAT,
+                              trueStride,
+                              (const char *) pointer + offsets[3]);
+}
diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile
deleted file mode 100644 (file)
index e681be8..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-TOP = ../../..
-include $(TOP)/configs/current
-
-EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \
-                -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
-
-SOURCES = \
-         glcontextmodes.c \
-         clientattrib.c \
-         compsize.c \
-         eval.c \
-         glxcmds.c \
-         glxcurrent.c \
-         glxext.c \
-         glxextensions.c \
-         indirect.c \
-         indirect_init.c \
-         indirect_size.c \
-         indirect_window_pos.c \
-         indirect_texture_compression.c \
-         indirect_transpose_matrix.c \
-         indirect_vertex_array.c \
-         indirect_vertex_program.c \
-         pixel.c \
-         pixelstore.c \
-         render2.c \
-         renderpix.c \
-         single2.c \
-         singlepix.c \
-         vertarr.c \
-         xfont.c \
-         glx_pbuffer.c \
-         glx_query.c \
-         drisw_glx.c \
-         dri_common.c \
-         dri_glx.c \
-         XF86dri.c \
-         glxhash.c \
-         dri2_glx.c \
-         dri2.c
-
-GLAPI_LIB = $(TOP)/src/mesa/libglapi.a
-
-OBJECTS = $(SOURCES:.c=.o)
-
-INCLUDES = -I. \
-       -I$(TOP)/include \
-       -I$(TOP)/include/GL/internal \
-       -I$(TOP)/src/mesa \
-       -I$(TOP)/src/mesa/glapi \
-       $(LIBDRM_CFLAGS) \
-       $(DRI2PROTO_CFLAGS) \
-       $(X11_INCLUDES)
-
-
-##### RULES #####
-
-.c.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
-
-.S.o:
-       $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES)  $< -o $@
-
-##### TARGETS #####
-
-default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
-
-# Make libGL
-$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(GLAPI_LIB) Makefile
-       $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               -major 1 -minor 2 $(MKLIB_OPTIONS) \
-               -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
-               $(GL_LIB_DEPS) $(OBJECTS) $(GLAPI_LIB)
-
-$(GLAPI_LIB):
-       @$(MAKE) -C $(TOP)/src/mesa libglapi.a
-
-depend: $(SOURCES) Makefile
-       rm -f depend
-       touch depend
-       $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES)
-
-
-# Emacs tags
-tags:
-       etags `find . -name \*.[ch]` `find $(TOP)/include`
-
-install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
-       $(MAKE) -C $(TOP)/src/mesa install-libgl
-
-# Remove .o and backup files
-clean:
-       -rm -f $(TOP)/$(LIB_DIR)/libGL.so*
-       -rm -f *.o *~
-       -rm -f depend depend.bak
-
--include depend
diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c
deleted file mode 100644 (file)
index 248d96a..0000000
+++ /dev/null
@@ -1,637 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- *   Kevin E. Martin <martin@valinux.com>
- *   Jens Owen <jens@tungstengraphics.com>
- *   Rickard E. (Rik) Faith <faith@valinux.com>
- *
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include "xf86dristr.h"
-
-
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
-#  define PUBLIC __attribute__((visibility("default")))
-#  define USED __attribute__((used))
-#else
-#  define PUBLIC
-#  define USED
-#endif
-
-
-
-static XExtensionInfo _xf86dri_info_data;
-static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
-static char xf86dri_extension_name[] = XF86DRINAME;
-
-#define XF86DRICheckExtension(dpy,i,val) \
-  XextCheckExtension (dpy, i, xf86dri_extension_name, val)
-
-/*****************************************************************************
- *                                                                           *
- *                        private utility routines                          *
- *                                                                           *
- *****************************************************************************/
-
-static int close_display(Display * dpy, XExtCodes * extCodes);
-static /* const */ XExtensionHooks xf86dri_extension_hooks = {
-   NULL,                        /* create_gc */
-   NULL,                        /* copy_gc */
-   NULL,                        /* flush_gc */
-   NULL,                        /* free_gc */
-   NULL,                        /* create_font */
-   NULL,                        /* free_font */
-   close_display,               /* close_display */
-   NULL,                        /* wire_to_event */
-   NULL,                        /* event_to_wire */
-   NULL,                        /* error */
-   NULL,                        /* error_string */
-};
-
-static
-XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
-                           xf86dri_extension_name,
-                           &xf86dri_extension_hooks, 0, NULL)
-
-static
-XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
-
-
-/*****************************************************************************
- *                                                                           *
- *                 public XFree86-DRI Extension routines                    *
- *                                                                           *
- *****************************************************************************/
-#if 0
-#include <stdio.h>
-#define TRACE(msg)  fprintf(stderr,"XF86DRI%s\n", msg);
-#else
-#define TRACE(msg)
-#endif
-
-Bool
-XF86DRIQueryExtension(Display * dpy, int *event_basep,
-                      int *error_basep)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-
-   TRACE("QueryExtension...");
-   if (XextHasExtension(info)) {
-      *event_basep = info->codes->first_event;
-      *error_basep = info->codes->first_error;
-      TRACE("QueryExtension... return True");
-      return True;
-   }
-   else {
-      TRACE("QueryExtension... return False");
-      return False;
-   }
-}
-
-Bool
-XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
-                    int *patchVersion)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIQueryVersionReply rep;
-   xXF86DRIQueryVersionReq *req;
-
-   TRACE("QueryVersion...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIQueryVersion, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIQueryVersion;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("QueryVersion... return False");
-      return False;
-   }
-   *majorVersion = rep.majorVersion;
-   *minorVersion = rep.minorVersion;
-   *patchVersion = rep.patchVersion;
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("QueryVersion... return True");
-   return True;
-}
-
-Bool
-XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
-                                   Bool * isCapable)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIQueryDirectRenderingCapableReply rep;
-   xXF86DRIQueryDirectRenderingCapableReq *req;
-
-   TRACE("QueryDirectRenderingCapable...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIQueryDirectRenderingCapable, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
-   req->screen = screen;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("QueryDirectRenderingCapable... return False");
-      return False;
-   }
-   *isCapable = rep.isCapable;
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("QueryDirectRenderingCapable... return True");
-   return True;
-}
-
-Bool
-XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
-                      char **busIdString)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIOpenConnectionReply rep;
-   xXF86DRIOpenConnectionReq *req;
-
-   TRACE("OpenConnection...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIOpenConnection, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIOpenConnection;
-   req->screen = screen;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("OpenConnection... return False");
-      return False;
-   }
-
-   *hSAREA = rep.hSAREALow;
-   if (sizeof(drm_handle_t) == 8) {
-      int shift = 32;           /* var to prevent warning on next line */
-      *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
-   }
-
-   if (rep.length) {
-      if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) {
-         _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
-         UnlockDisplay(dpy);
-         SyncHandle();
-         TRACE("OpenConnection... return False");
-         return False;
-      }
-      _XReadPad(dpy, *busIdString, rep.busIdStringLength);
-   }
-   else {
-      *busIdString = NULL;
-   }
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("OpenConnection... return True");
-   return True;
-}
-
-Bool
-XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIAuthConnectionReq *req;
-   xXF86DRIAuthConnectionReply rep;
-
-   TRACE("AuthConnection...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIAuthConnection, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIAuthConnection;
-   req->screen = screen;
-   req->magic = magic;
-   rep.authenticated = 0;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("AuthConnection... return False");
-      return False;
-   }
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("AuthConnection... return True");
-   return True;
-}
-
-Bool
-XF86DRICloseConnection(Display * dpy, int screen)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRICloseConnectionReq *req;
-
-   TRACE("CloseConnection...");
-
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRICloseConnection, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRICloseConnection;
-   req->screen = screen;
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("CloseConnection... return True");
-   return True;
-}
-
-Bool
-XF86DRIGetClientDriverName(Display * dpy, int screen,
-                           int *ddxDriverMajorVersion,
-                           int *ddxDriverMinorVersion,
-                           int *ddxDriverPatchVersion,
-                           char **clientDriverName)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIGetClientDriverNameReply rep;
-   xXF86DRIGetClientDriverNameReq *req;
-
-   TRACE("GetClientDriverName...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIGetClientDriverName, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIGetClientDriverName;
-   req->screen = screen;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("GetClientDriverName... return False");
-      return False;
-   }
-
-   *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
-   *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
-   *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
-   if (rep.length) {
-      if (!
-          (*clientDriverName =
-           (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) {
-         _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
-         UnlockDisplay(dpy);
-         SyncHandle();
-         TRACE("GetClientDriverName... return False");
-         return False;
-      }
-      _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
-   }
-   else {
-      *clientDriverName = NULL;
-   }
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("GetClientDriverName... return True");
-   return True;
-}
-
-Bool
-XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
-                               XID * context, drm_context_t * hHWContext)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRICreateContextReply rep;
-   xXF86DRICreateContextReq *req;
-
-   TRACE("CreateContext...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRICreateContext, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRICreateContext;
-   req->visual = configID;
-   req->screen = screen;
-   *context = XAllocID(dpy);
-   req->context = *context;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("CreateContext... return False");
-      return False;
-   }
-   *hHWContext = rep.hHWContext;
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("CreateContext... return True");
-   return True;
-}
-
-Bool
-XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
-                     XID * context, drm_context_t * hHWContext)
-{
-   return XF86DRICreateContextWithConfig(dpy, screen, visual->visualid,
-                                         context, hHWContext);
-}
-
-Bool
-XF86DRIDestroyContext(Display * dpy, int screen, XID context)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIDestroyContextReq *req;
-
-   TRACE("DestroyContext...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIDestroyContext, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIDestroyContext;
-   req->screen = screen;
-   req->context = context;
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("DestroyContext... return True");
-   return True;
-}
-
-Bool
-XF86DRICreateDrawable(Display * dpy, int screen,
-                      XID drawable, drm_drawable_t * hHWDrawable)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRICreateDrawableReply rep;
-   xXF86DRICreateDrawableReq *req;
-
-   TRACE("CreateDrawable...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRICreateDrawable, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRICreateDrawable;
-   req->screen = screen;
-   req->drawable = drawable;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("CreateDrawable... return False");
-      return False;
-   }
-   *hHWDrawable = rep.hHWDrawable;
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("CreateDrawable... return True");
-   return True;
-}
-
-static int
-noopErrorHandler(Display * dpy, XErrorEvent * xerr)
-{
-   return 0;
-}
-
-Bool
-XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIDestroyDrawableReq *req;
-   int (*oldXErrorHandler) (Display *, XErrorEvent *);
-
-   TRACE("DestroyDrawable...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   /* This is called from the DRI driver, which used call it like this
-    *
-    *   if (windowExists(drawable))
-    *     destroyDrawable(drawable);
-    *
-    * which is a textbook race condition - the window may disappear
-    * from the server between checking for its existance and
-    * destroying it.  Instead we change the semantics of
-    * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
-    * the windows is gone, by wrapping the destroy call in an error
-    * handler. */
-
-   XSync(dpy, False);
-   oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIDestroyDrawable, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIDestroyDrawable;
-   req->screen = screen;
-   req->drawable = drawable;
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   XSetErrorHandler(oldXErrorHandler);
-
-   TRACE("DestroyDrawable... return True");
-   return True;
-}
-
-Bool
-XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
-                       unsigned int *index, unsigned int *stamp,
-                       int *X, int *Y, int *W, int *H,
-                       int *numClipRects, drm_clip_rect_t ** pClipRects,
-                       int *backX, int *backY,
-                       int *numBackClipRects,
-                       drm_clip_rect_t ** pBackClipRects)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIGetDrawableInfoReply rep;
-   xXF86DRIGetDrawableInfoReq *req;
-   int total_rects;
-
-   TRACE("GetDrawableInfo...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIGetDrawableInfo, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIGetDrawableInfo;
-   req->screen = screen;
-   req->drawable = drawable;
-
-   if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("GetDrawableInfo... return False");
-      return False;
-   }
-   *index = rep.drawableTableIndex;
-   *stamp = rep.drawableTableStamp;
-   *X = (int) rep.drawableX;
-   *Y = (int) rep.drawableY;
-   *W = (int) rep.drawableWidth;
-   *H = (int) rep.drawableHeight;
-   *numClipRects = rep.numClipRects;
-   total_rects = *numClipRects;
-
-   *backX = rep.backX;
-   *backY = rep.backY;
-   *numBackClipRects = rep.numBackClipRects;
-   total_rects += *numBackClipRects;
-
-#if 0
-   /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
-    * backwards compatibility (Because of the >> 2 shift) but the fix
-    * enables multi-threaded apps to work.
-    */
-   if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
-                         SIZEOF(xGenericReply) +
-                         total_rects * sizeof(drm_clip_rect_t)) +
-                        3) & ~3) >> 2)) {
-      _XEatData(dpy, rep.length);
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("GetDrawableInfo... return False");
-      return False;
-   }
-#endif
-
-   if (*numClipRects) {
-      int len = sizeof(drm_clip_rect_t) * (*numClipRects);
-
-      *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
-      if (*pClipRects)
-         _XRead(dpy, (char *) *pClipRects, len);
-   }
-   else {
-      *pClipRects = NULL;
-   }
-
-   if (*numBackClipRects) {
-      int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
-
-      *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
-      if (*pBackClipRects)
-         _XRead(dpy, (char *) *pBackClipRects, len);
-   }
-   else {
-      *pBackClipRects = NULL;
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("GetDrawableInfo... return True");
-   return True;
-}
-
-Bool
-XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer,
-                     int *fbOrigin, int *fbSize, int *fbStride,
-                     int *devPrivateSize, void **pDevPrivate)
-{
-   XExtDisplayInfo *info = find_display(dpy);
-   xXF86DRIGetDeviceInfoReply rep;
-   xXF86DRIGetDeviceInfoReq *req;
-
-   TRACE("GetDeviceInfo...");
-   XF86DRICheckExtension(dpy, info, False);
-
-   LockDisplay(dpy);
-   GetReq(XF86DRIGetDeviceInfo, req);
-   req->reqType = info->codes->major_opcode;
-   req->driReqType = X_XF86DRIGetDeviceInfo;
-   req->screen = screen;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      TRACE("GetDeviceInfo... return False");
-      return False;
-   }
-
-   *hFrameBuffer = rep.hFrameBufferLow;
-   if (sizeof(drm_handle_t) == 8) {
-      int shift = 32;           /* var to prevent warning on next line */
-      *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
-   }
-
-   *fbOrigin = rep.framebufferOrigin;
-   *fbSize = rep.framebufferSize;
-   *fbStride = rep.framebufferStride;
-   *devPrivateSize = rep.devPrivateSize;
-
-   if (rep.length) {
-      if (!(*pDevPrivate = (void *) Xcalloc(rep.devPrivateSize, 1))) {
-         _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
-         UnlockDisplay(dpy);
-         SyncHandle();
-         TRACE("GetDeviceInfo... return False");
-         return False;
-      }
-      _XRead(dpy, (char *) *pDevPrivate, rep.devPrivateSize);
-   }
-   else {
-      *pDevPrivate = NULL;
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-   TRACE("GetDeviceInfo... return True");
-   return True;
-}
-
-Bool
-XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable)
-{
-   /* This function and the underlying X protocol are deprecated.
-    */
-   (void) dpy;
-   (void) screen;
-   (void) drawable;
-   return False;
-}
-
-Bool
-XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable)
-{
-   /* This function and the underlying X protocol are deprecated.
-    */
-   (void) dpy;
-   (void) screen;
-   (void) drawable;
-   return True;
-}
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/clientattrib.c b/src/glx/x11/clientattrib.c
deleted file mode 100644 (file)
index a7dfb53..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.
- */
-
-#include <assert.h>
-#include "glxclient.h"
-#include "indirect.h"
-#include "indirect_vertex_array.h"
-
-/*****************************************************************************/
-
-static void
-do_enable_disable(GLenum array, GLboolean val)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   unsigned index = 0;
-
-   if (array == GL_TEXTURE_COORD_ARRAY) {
-      index = __glXGetActiveTextureUnit(state);
-   }
-
-   if (!__glXSetArrayEnable(state, array, index, val)) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-   }
-}
-
-void
-__indirect_glEnableClientState(GLenum array)
-{
-   do_enable_disable(array, GL_TRUE);
-}
-
-void
-__indirect_glDisableClientState(GLenum array)
-{
-   do_enable_disable(array, GL_FALSE);
-}
-
-/************************************************************************/
-
-void
-__indirect_glPushClientAttrib(GLuint mask)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   __GLXattribute **spp = gc->attributes.stackPointer, *sp;
-
-   if (spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]) {
-      if (!(sp = *spp)) {
-         sp = (__GLXattribute *) Xmalloc(sizeof(__GLXattribute));
-         *spp = sp;
-      }
-      sp->mask = mask;
-      gc->attributes.stackPointer = spp + 1;
-      if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
-         sp->storePack = state->storePack;
-         sp->storeUnpack = state->storeUnpack;
-      }
-      if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
-         __glXPushArrayState(state);
-      }
-   }
-   else {
-      __glXSetError(gc, GL_STACK_OVERFLOW);
-      return;
-   }
-}
-
-void
-__indirect_glPopClientAttrib(void)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   __GLXattribute **spp = gc->attributes.stackPointer, *sp;
-   GLuint mask;
-
-   if (spp > &gc->attributes.stack[0]) {
-      --spp;
-      sp = *spp;
-      assert(sp != 0);
-      mask = sp->mask;
-      gc->attributes.stackPointer = spp;
-
-      if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
-         state->storePack = sp->storePack;
-         state->storeUnpack = sp->storeUnpack;
-      }
-      if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
-         __glXPopArrayState(state);
-      }
-
-      sp->mask = 0;
-   }
-   else {
-      __glXSetError(gc, GL_STACK_UNDERFLOW);
-      return;
-   }
-}
-
-void
-__glFreeAttributeState(__GLXcontext * gc)
-{
-   __GLXattribute *sp, **spp;
-
-   for (spp = &gc->attributes.stack[0];
-        spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; spp++) {
-      sp = *spp;
-      if (sp) {
-         XFree((char *) sp);
-      }
-      else {
-         break;
-      }
-   }
-}
diff --git a/src/glx/x11/compsize.c b/src/glx/x11/compsize.c
deleted file mode 100644 (file)
index 5ba6dc9..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.
- */
-
-#include <GL/gl.h>
-#include "glxclient.h"
-
-/*
-** Return the number of elements per group of a specified format
-*/
-GLint
-__glElementsPerGroup(GLenum format, GLenum type)
-{
-   /*
-    ** To make row length computation valid for image extraction,
-    ** packed pixel types assume elements per group equals one.
-    */
-   switch (type) {
-   case GL_UNSIGNED_BYTE_3_3_2:
-   case GL_UNSIGNED_BYTE_2_3_3_REV:
-   case GL_UNSIGNED_SHORT_5_6_5:
-   case GL_UNSIGNED_SHORT_5_6_5_REV:
-   case GL_UNSIGNED_SHORT_4_4_4_4:
-   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-   case GL_UNSIGNED_SHORT_5_5_5_1:
-   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-   case GL_UNSIGNED_SHORT_8_8_APPLE:
-   case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
-   case GL_UNSIGNED_SHORT_15_1_MESA:
-   case GL_UNSIGNED_SHORT_1_15_REV_MESA:
-   case GL_UNSIGNED_INT_8_8_8_8:
-   case GL_UNSIGNED_INT_8_8_8_8_REV:
-   case GL_UNSIGNED_INT_10_10_10_2:
-   case GL_UNSIGNED_INT_2_10_10_10_REV:
-   case GL_UNSIGNED_INT_24_8_NV:
-   case GL_UNSIGNED_INT_24_8_MESA:
-   case GL_UNSIGNED_INT_8_24_REV_MESA:
-      return 1;
-   default:
-      break;
-   }
-
-   switch (format) {
-   case GL_RGB:
-   case GL_BGR:
-      return 3;
-   case GL_422_EXT:
-   case GL_422_REV_EXT:
-   case GL_422_AVERAGE_EXT:
-   case GL_422_REV_AVERAGE_EXT:
-   case GL_YCBCR_422_APPLE:
-   case GL_LUMINANCE_ALPHA:
-      return 2;
-   case GL_RGBA:
-   case GL_BGRA:
-   case GL_ABGR_EXT:
-      return 4;
-   case GL_COLOR_INDEX:
-   case GL_STENCIL_INDEX:
-   case GL_DEPTH_COMPONENT:
-   case GL_RED:
-   case GL_GREEN:
-   case GL_BLUE:
-   case GL_ALPHA:
-   case GL_LUMINANCE:
-   case GL_INTENSITY:
-      return 1;
-   default:
-      return 0;
-   }
-}
-
-/*
-** Return the number of bytes per element, based on the element type (other
-** than GL_BITMAP).
-*/
-GLint
-__glBytesPerElement(GLenum type)
-{
-   switch (type) {
-   case GL_UNSIGNED_SHORT:
-   case GL_SHORT:
-   case GL_UNSIGNED_SHORT_5_6_5:
-   case GL_UNSIGNED_SHORT_5_6_5_REV:
-   case GL_UNSIGNED_SHORT_4_4_4_4:
-   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-   case GL_UNSIGNED_SHORT_5_5_5_1:
-   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-   case GL_UNSIGNED_SHORT_8_8_APPLE:
-   case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
-   case GL_UNSIGNED_SHORT_15_1_MESA:
-   case GL_UNSIGNED_SHORT_1_15_REV_MESA:
-      return 2;
-   case GL_UNSIGNED_BYTE:
-   case GL_BYTE:
-   case GL_UNSIGNED_BYTE_3_3_2:
-   case GL_UNSIGNED_BYTE_2_3_3_REV:
-      return 1;
-   case GL_INT:
-   case GL_UNSIGNED_INT:
-   case GL_FLOAT:
-   case GL_UNSIGNED_INT_8_8_8_8:
-   case GL_UNSIGNED_INT_8_8_8_8_REV:
-   case GL_UNSIGNED_INT_10_10_10_2:
-   case GL_UNSIGNED_INT_2_10_10_10_REV:
-   case GL_UNSIGNED_INT_24_8_NV:
-   case GL_UNSIGNED_INT_24_8_MESA:
-   case GL_UNSIGNED_INT_8_24_REV_MESA:
-      return 4;
-   default:
-      return 0;
-   }
-}
-
-/*
-** Compute memory required for internal packed array of data of given type
-** and format.
-*/
-GLint
-__glImageSize(GLsizei width, GLsizei height, GLsizei depth,
-              GLenum format, GLenum type, GLenum target)
-{
-   int bytes_per_row;
-   int components;
-
-   switch (target) {
-   case GL_PROXY_TEXTURE_1D:
-   case GL_PROXY_TEXTURE_2D:
-   case GL_PROXY_TEXTURE_3D:
-   case GL_PROXY_TEXTURE_4D_SGIS:
-   case GL_PROXY_TEXTURE_CUBE_MAP:
-   case GL_PROXY_TEXTURE_RECTANGLE_ARB:
-   case GL_PROXY_HISTOGRAM:
-   case GL_PROXY_COLOR_TABLE:
-   case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
-   case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
-   case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
-   case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
-      return 0;
-   }
-
-   if (width < 0 || height < 0 || depth < 0) {
-      return 0;
-   }
-
-   /*
-    ** Zero is returned if either format or type are invalid.
-    */
-   components = __glElementsPerGroup(format, type);
-   if (type == GL_BITMAP) {
-      if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
-         bytes_per_row = (width + 7) >> 3;
-      }
-      else {
-         return 0;
-      }
-   }
-   else {
-      bytes_per_row = __glBytesPerElement(type) * width;
-   }
-
-   return bytes_per_row * height * depth * components;
-}
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
deleted file mode 100644 (file)
index 91053d3..0000000
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Soft-
- * ware"), to deal in the Software without restriction, including without
- * limitation the rights to use, copy, modify, merge, publish, distribute,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, provided that the above copyright
- * notice(s) and this permission notice appear in all copies of the Soft-
- * ware and that both the above copyright notice(s) and this permission
- * notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
- * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
- * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
- * QUENTIAL 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 PERFOR-
- * MANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder shall
- * not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization of
- * the copyright holder.
- *
- * Authors:
- *   Kristian Høgsberg (krh@redhat.com)
- */
-
-
-#ifdef GLX_DIRECT_RENDERING
-
-#define NEED_REPLIES
-#include <stdio.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/dri2proto.h>
-#include "xf86drm.h"
-#include "dri2.h"
-#include "glxclient.h"
-#include "GL/glxext.h"
-
-/* Allow the build to work with an older versions of dri2proto.h and
- * dri2tokens.h.
- */
-#if DRI2_MINOR < 1
-#undef DRI2_MINOR
-#define DRI2_MINOR 1
-#define X_DRI2GetBuffersWithFormat 7
-#endif
-
-
-static char dri2ExtensionName[] = DRI2_NAME;
-static XExtensionInfo *dri2Info;
-static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
-
-static Bool
-DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire);
-static Status
-DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire);
-
-static /* const */ XExtensionHooks dri2ExtensionHooks = {
-  NULL,                   /* create_gc */
-  NULL,                   /* copy_gc */
-  NULL,                   /* flush_gc */
-  NULL,                   /* free_gc */
-  NULL,                   /* create_font */
-  NULL,                   /* free_font */
-  DRI2CloseDisplay,       /* close_display */
-  DRI2WireToEvent,        /* wire_to_event */
-  DRI2EventToWire,        /* event_to_wire */
-  NULL,                   /* error */
-  NULL,                   /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
-                                   dri2Info,
-                                   dri2ExtensionName,
-                                   &dri2ExtensionHooks,
-                                   1, NULL)
-
-static Bool
-DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   XExtDisplayInfo *glx_info = __glXFindDisplay(dpy);
-   static int glx_event_base;
-   static Bool found_glx_info = False;
-
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
-
-   switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
-
-#ifdef X_DRI2SwapBuffers
-   case DRI2_BufferSwapComplete:
-   {
-      GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-      xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
-      aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
-      aevent->type =
-         (glx_info->codes->first_event + GLX_BufferSwapComplete) & 0x75;
-      aevent->send_event = (awire->type & 0x80) != 0;
-      aevent->display = dpy;
-      aevent->drawable = awire->drawable;
-      switch (awire->event_type) {
-      case DRI2_EXCHANGE_COMPLETE:
-        aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-        break;
-      case DRI2_BLIT_COMPLETE:
-        aevent->event_type = GLX_BLIT_COMPLETE_INTEL;
-        break;
-      case DRI2_FLIP_COMPLETE:
-        aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
-        break;
-      default:
-        /* unknown swap completion type */
-        return False;
-      }
-      aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
-      aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-      aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
-      return True;
-   }
-#endif
-
-   default:
-      /* client doesn't support server event */
-      break;
-   }
-
-   return False;
-}
-
-/* We don't actually support this.  It doesn't make sense for clients to
- * send each other DRI2 events.
- */
-static Status
-DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
-
-   switch (event->type) {
-   default:
-      /* client doesn't support server event */
-      break;
-   }
-
-   return Success;
-}
-
-Bool
-DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-
-   if (XextHasExtension(info)) {
-      *eventBase = info->codes->first_event;
-      *errorBase = info->codes->first_error;
-      return True;
-   }
-
-   return False;
-}
-
-Bool
-DRI2QueryVersion(Display * dpy, int *major, int *minor)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2QueryVersionReply rep;
-   xDRI2QueryVersionReq *req;
-
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
-
-   LockDisplay(dpy);
-   GetReq(DRI2QueryVersion, req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2QueryVersion;
-   req->majorVersion = DRI2_MAJOR;
-   req->minorVersion = DRI2_MINOR;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return False;
-   }
-   *major = rep.majorVersion;
-   *minor = rep.minorVersion;
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return True;
-}
-
-Bool
-DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2ConnectReply rep;
-   xDRI2ConnectReq *req;
-
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
-
-   LockDisplay(dpy);
-   GetReq(DRI2Connect, req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2Connect;
-   req->window = window;
-   req->driverType = DRI2DriverDRI;
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return False;
-   }
-
-   if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return False;
-   }
-
-   *driverName = Xmalloc(rep.driverNameLength + 1);
-   if (*driverName == NULL) {
-      _XEatData(dpy,
-                ((rep.driverNameLength + 3) & ~3) +
-                ((rep.deviceNameLength + 3) & ~3));
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return False;
-   }
-   _XReadPad(dpy, *driverName, rep.driverNameLength);
-   (*driverName)[rep.driverNameLength] = '\0';
-
-   *deviceName = Xmalloc(rep.deviceNameLength + 1);
-   if (*deviceName == NULL) {
-      Xfree(*driverName);
-      _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return False;
-   }
-   _XReadPad(dpy, *deviceName, rep.deviceNameLength);
-   (*deviceName)[rep.deviceNameLength] = '\0';
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return True;
-}
-
-Bool
-DRI2Authenticate(Display * dpy, XID window, drm_magic_t magic)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2AuthenticateReq *req;
-   xDRI2AuthenticateReply rep;
-
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
-
-   LockDisplay(dpy);
-   GetReq(DRI2Authenticate, req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2Authenticate;
-   req->window = window;
-   req->magic = magic;
-
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return False;
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return rep.authenticated;
-}
-
-void
-DRI2CreateDrawable(Display * dpy, XID drawable)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2CreateDrawableReq *req;
-
-   XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
-
-   LockDisplay(dpy);
-   GetReq(DRI2CreateDrawable, req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2CreateDrawable;
-   req->drawable = drawable;
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-void
-DRI2DestroyDrawable(Display * dpy, XID drawable)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2DestroyDrawableReq *req;
-
-   XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
-
-   XSync(dpy, False);
-
-   LockDisplay(dpy);
-   GetReq(DRI2DestroyDrawable, req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2DestroyDrawable;
-   req->drawable = drawable;
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-DRI2Buffer *
-DRI2GetBuffers(Display * dpy, XID drawable,
-               int *width, int *height,
-               unsigned int *attachments, int count, int *outCount)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2GetBuffersReply rep;
-   xDRI2GetBuffersReq *req;
-   DRI2Buffer *buffers;
-   xDRI2Buffer repBuffer;
-   CARD32 *p;
-   int i;
-
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
-
-   LockDisplay(dpy);
-   GetReqExtra(DRI2GetBuffers, count * 4, req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2GetBuffers;
-   req->drawable = drawable;
-   req->count = count;
-   p = (CARD32 *) & req[1];
-   for (i = 0; i < count; i++)
-      p[i] = attachments[i];
-
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return NULL;
-   }
-
-   *width = rep.width;
-   *height = rep.height;
-   *outCount = rep.count;
-
-   buffers = Xmalloc(rep.count * sizeof buffers[0]);
-   if (buffers == NULL) {
-      _XEatData(dpy, rep.count * sizeof repBuffer);
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return NULL;
-   }
-
-   for (i = 0; i < rep.count; i++) {
-      _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
-      buffers[i].attachment = repBuffer.attachment;
-      buffers[i].name = repBuffer.name;
-      buffers[i].pitch = repBuffer.pitch;
-      buffers[i].cpp = repBuffer.cpp;
-      buffers[i].flags = repBuffer.flags;
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return buffers;
-}
-
-
-DRI2Buffer *
-DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
-                         int *width, int *height,
-                         unsigned int *attachments, int count, int *outCount)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2GetBuffersReply rep;
-   xDRI2GetBuffersReq *req;
-   DRI2Buffer *buffers;
-   xDRI2Buffer repBuffer;
-   CARD32 *p;
-   int i;
-
-   XextCheckExtension(dpy, info, dri2ExtensionName, False);
-
-   LockDisplay(dpy);
-   GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2GetBuffersWithFormat;
-   req->drawable = drawable;
-   req->count = count;
-   p = (CARD32 *) & req[1];
-   for (i = 0; i < (count * 2); i++)
-      p[i] = attachments[i];
-
-   if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return NULL;
-   }
-
-   *width = rep.width;
-   *height = rep.height;
-   *outCount = rep.count;
-
-   buffers = Xmalloc(rep.count * sizeof buffers[0]);
-   if (buffers == NULL) {
-      _XEatData(dpy, rep.count * sizeof repBuffer);
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return NULL;
-   }
-
-   for (i = 0; i < rep.count; i++) {
-      _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
-      buffers[i].attachment = repBuffer.attachment;
-      buffers[i].name = repBuffer.name;
-      buffers[i].pitch = repBuffer.pitch;
-      buffers[i].cpp = repBuffer.cpp;
-      buffers[i].flags = repBuffer.flags;
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return buffers;
-}
-
-
-void
-DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region,
-               CARD32 dest, CARD32 src)
-{
-   XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-   xDRI2CopyRegionReq *req;
-   xDRI2CopyRegionReply rep;
-
-   XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
-
-   LockDisplay(dpy);
-   GetReq(DRI2CopyRegion, req);
-   req->reqType = info->codes->major_opcode;
-   req->dri2ReqType = X_DRI2CopyRegion;
-   req->drawable = drawable;
-   req->region = region;
-   req->dest = dest;
-   req->src = src;
-
-   _XReply(dpy, (xReply *) & rep, 0, xFalse);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-#ifdef X_DRI2SwapBuffers
-static void
-load_swap_req(xDRI2SwapBuffersReq *req, CARD64 target, CARD64 divisor,
-            CARD64 remainder)
-{
-    req->target_msc_hi = target >> 32;
-    req->target_msc_lo = target & 0xffffffff;
-    req->divisor_hi = divisor >> 32;
-    req->divisor_lo = divisor & 0xffffffff;
-    req->remainder_hi = remainder >> 32;
-    req->remainder_lo = remainder & 0xffffffff;
-}
-
-static CARD64
-vals_to_card64(CARD32 lo, CARD32 hi)
-{
-    return (CARD64)hi << 32 | lo;
-}
-
-void DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc,
-                    CARD64 divisor, CARD64 remainder, CARD64 *count)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2SwapBuffersReq *req;
-    xDRI2SwapBuffersReply rep;
-
-    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
-
-    LockDisplay(dpy);
-    GetReq(DRI2SwapBuffers, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2SwapBuffers;
-    req->drawable = drawable;
-    load_swap_req(req, target_msc, divisor, remainder);
-
-    _XReply(dpy, (xReply *)&rep, 0, xFalse);
-
-    *count = vals_to_card64(rep.swap_lo, rep.swap_hi);
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-}
-#endif
-
-#ifdef X_DRI2GetMSC
-Bool DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc,
-               CARD64 *sbc)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2GetMSCReq *req;
-    xDRI2MSCReply rep;
-
-    XextCheckExtension (dpy, info, dri2ExtensionName, False);
-
-    LockDisplay(dpy);
-    GetReq(DRI2GetMSC, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2GetMSC;
-    req->drawable = drawable;
-
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-
-    *ust = vals_to_card64(rep.ust_lo, rep.ust_hi);
-    *msc = vals_to_card64(rep.msc_lo, rep.msc_hi);
-    *sbc = vals_to_card64(rep.sbc_lo, rep.sbc_hi);
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    return True;
-}
-#endif
-
-#ifdef X_DRI2WaitMSC
-static void
-load_msc_req(xDRI2WaitMSCReq *req, CARD64 target, CARD64 divisor,
-            CARD64 remainder)
-{
-    req->target_msc_hi = target >> 32;
-    req->target_msc_lo = target & 0xffffffff;
-    req->divisor_hi = divisor >> 32;
-    req->divisor_lo = divisor & 0xffffffff;
-    req->remainder_hi = remainder >> 32;
-    req->remainder_lo = remainder & 0xffffffff;
-}
-
-Bool DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
-                CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2WaitMSCReq *req;
-    xDRI2MSCReply rep;
-
-    XextCheckExtension (dpy, info, dri2ExtensionName, False);
-
-    LockDisplay(dpy);
-    GetReq(DRI2WaitMSC, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2WaitMSC;
-    req->drawable = drawable;
-    load_msc_req(req, target_msc, divisor, remainder);
-
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-
-    *ust = ((CARD64)rep.ust_hi << 32) | (CARD64)rep.ust_lo;
-    *msc = ((CARD64)rep.msc_hi << 32) | (CARD64)rep.msc_lo;
-    *sbc = ((CARD64)rep.sbc_hi << 32) | (CARD64)rep.sbc_lo;
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    return True;
-}
-#endif
-
-#ifdef X_DRI2WaitSBC
-static void
-load_sbc_req(xDRI2WaitSBCReq *req, CARD64 target)
-{
-    req->target_sbc_hi = target >> 32;
-    req->target_sbc_lo = target & 0xffffffff;
-}
-
-Bool DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust,
-                CARD64 *msc, CARD64 *sbc)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2WaitSBCReq *req;
-    xDRI2MSCReply rep;
-
-    XextCheckExtension (dpy, info, dri2ExtensionName, False);
-
-    LockDisplay(dpy);
-    GetReq(DRI2WaitSBC, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2WaitSBC;
-    req->drawable = drawable;
-    load_sbc_req(req, target_sbc);
-
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-       return False;
-    }
-
-    *ust = ((CARD64)rep.ust_hi << 32) | rep.ust_lo;
-    *msc = ((CARD64)rep.msc_hi << 32) | rep.msc_lo;
-    *sbc = ((CARD64)rep.sbc_hi << 32) | rep.sbc_lo;
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    return True;
-}
-#endif
-
-#ifdef X_DRI2SwapInterval
-void DRI2SwapInterval(Display *dpy, XID drawable, int interval)
-{
-    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
-    xDRI2SwapIntervalReq *req;
-
-    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
-
-    LockDisplay(dpy);
-    GetReq(DRI2SwapInterval, req);
-    req->reqType = info->codes->major_opcode;
-    req->dri2ReqType = X_DRI2SwapInterval;
-    req->drawable = drawable;
-    req->interval = interval;
-    UnlockDisplay(dpy);
-    SyncHandle();
-}
-#endif
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h
deleted file mode 100644 (file)
index 114e9f8..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright © 2007,2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Soft-
- * ware"), to deal in the Software without restriction, including without
- * limitation the rights to use, copy, modify, merge, publish, distribute,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, provided that the above copyright
- * notice(s) and this permission notice appear in all copies of the Soft-
- * ware and that both the above copyright notice(s) and this permission
- * notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
- * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
- * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
- * QUENTIAL 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 PERFOR-
- * MANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder shall
- * not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization of
- * the copyright holder.
- *
- * Authors:
- *   Kristian Høgsberg (krh@redhat.com)
- */
-
-#ifndef _DRI2_H_
-#define _DRI2_H_
-
-#include <X11/extensions/Xfixes.h>
-#include <X11/extensions/dri2tokens.h>
-
-typedef struct
-{
-   unsigned int attachment;
-   unsigned int name;
-   unsigned int pitch;
-   unsigned int cpp;
-   unsigned int flags;
-} DRI2Buffer;
-
-extern Bool
-DRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
-
-extern Bool
-DRI2QueryVersion(Display * display, int *major, int *minor);
-
-extern Bool
-DRI2Connect(Display * display, XID window,
-            char **driverName, char **deviceName);
-
-extern Bool
-DRI2Authenticate(Display * display, XID window, drm_magic_t magic);
-
-extern void
-DRI2CreateDrawable(Display * display, XID drawable);
-
-extern void
-DRI2DestroyDrawable(Display * display, XID handle);
-
-extern DRI2Buffer*
-DRI2GetBuffers(Display * dpy, XID drawable,
-               int *width, int *height,
-               unsigned int *attachments, int count,
-               int *outCount);
-
-/**
- * \note
- * This function is only supported with DRI2 version 1.1 or later.
- */
-extern DRI2Buffer*
-DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
-                         int *width, int *height,
-                         unsigned int *attachments,
-                         int count, int *outCount);
-
-extern void
-DRI2CopyRegion(Display * dpy, XID drawable,
-               XserverRegion region,
-               CARD32 dest, CARD32 src);
-
-extern void
-DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
-               CARD64 remainder, CARD64 *count);
-
-extern Bool
-DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
-
-extern Bool
-DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
-           CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
-
-extern Bool
-DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust,
-           CARD64 *msc, CARD64 *sbc);
-
-extern void
-DRI2SwapInterval(Display *dpy, XID drawable, int interval);
-
-#endif
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
deleted file mode 100644 (file)
index 15a3ea5..0000000
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Soft-
- * ware"), to deal in the Software without restriction, including without
- * limitation the rights to use, copy, modify, merge, publish, distribute,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, provided that the above copyright
- * notice(s) and this permission notice appear in all copies of the Soft-
- * ware and that both the above copyright notice(s) and this permission
- * notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
- * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
- * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
- * QUENTIAL 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 PERFOR-
- * MANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder shall
- * not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization of
- * the copyright holder.
- *
- * Authors:
- *   Kristian Høgsberg (krh@redhat.com)
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xfixes.h>
-#include <X11/extensions/Xdamage.h>
-#include "glapi.h"
-#include "glxclient.h"
-#include <X11/extensions/dri2proto.h>
-#include "xf86dri.h"
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include "xf86drm.h"
-#include "dri2.h"
-#include "dri_common.h"
-#include "../../mesa/drivers/dri/common/dri_util.h"
-
-#undef DRI2_MINOR
-#define DRI2_MINOR 1
-
-typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
-typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
-typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
-
-struct __GLXDRIdisplayPrivateRec
-{
-   __GLXDRIdisplay base;
-
-   /*
-    ** XFree86-DRI version information
-    */
-   int driMajor;
-   int driMinor;
-   int driPatch;
-   int swapAvailable;
-};
-
-struct __GLXDRIcontextPrivateRec
-{
-   __GLXDRIcontext base;
-   __DRIcontext *driContext;
-   __GLXscreenConfigs *psc;
-};
-
-struct __GLXDRIdrawablePrivateRec
-{
-   __GLXDRIdrawable base;
-   __DRIbuffer buffers[5];
-   int bufferCount;
-   int width, height;
-   int have_back;
-   int have_fake_front;
-   int swap_interval;
-};
-
-static void dri2WaitX(__GLXDRIdrawable * pdraw);
-
-static void
-dri2DestroyContext(__GLXDRIcontext * context,
-                   __GLXscreenConfigs * psc, Display * dpy)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   (*core->destroyContext) (pcp->driContext);
-
-   Xfree(pcp);
-}
-
-static Bool
-dri2BindContext(__GLXDRIcontext * context,
-                __GLXDRIdrawable * draw, __GLXDRIdrawable * read)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   return (*core->bindContext) (pcp->driContext,
-                                draw->driDrawable, read->driDrawable);
-}
-
-static void
-dri2UnbindContext(__GLXDRIcontext * context)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   (*core->unbindContext) (pcp->driContext);
-}
-
-static __GLXDRIcontext *
-dri2CreateContext(__GLXscreenConfigs * psc,
-                  const __GLcontextModes * mode,
-                  GLXContext gc, GLXContext shareList, int renderType)
-{
-   __GLXDRIcontextPrivate *pcp, *pcp_shared;
-   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
-   __DRIcontext *shared = NULL;
-
-   if (shareList) {
-      pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
-      shared = pcp_shared->driContext;
-   }
-
-   pcp = Xmalloc(sizeof *pcp);
-   if (pcp == NULL)
-      return NULL;
-
-   pcp->psc = psc;
-   pcp->driContext =
-      (*psc->dri2->createNewContext) (psc->__driScreen,
-                                      config->driConfig, shared, pcp);
-   gc->__driContext = pcp->driContext;
-
-   if (pcp->driContext == NULL) {
-      Xfree(pcp);
-      return NULL;
-   }
-
-   pcp->base.destroyContext = dri2DestroyContext;
-   pcp->base.bindContext = dri2BindContext;
-   pcp->base.unbindContext = dri2UnbindContext;
-
-   return &pcp->base;
-}
-
-static void
-dri2DestroyDrawable(__GLXDRIdrawable * pdraw)
-{
-   const __DRIcoreExtension *core = pdraw->psc->core;
-
-   (*core->destroyDrawable) (pdraw->driDrawable);
-   DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->xDrawable);
-   Xfree(pdraw);
-}
-
-static __GLXDRIdrawable *
-dri2CreateDrawable(__GLXscreenConfigs * psc,
-                   XID xDrawable,
-                   GLXDrawable drawable, const __GLcontextModes * modes)
-{
-   __GLXDRIdrawablePrivate *pdraw;
-   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
-
-   pdraw = Xmalloc(sizeof(*pdraw));
-   if (!pdraw)
-      return NULL;
-
-   pdraw->base.destroyDrawable = dri2DestroyDrawable;
-   pdraw->base.xDrawable = xDrawable;
-   pdraw->base.drawable = drawable;
-   pdraw->base.psc = psc;
-   pdraw->bufferCount = 0;
-
-   DRI2CreateDrawable(psc->dpy, xDrawable);
-
-   /* Create a new drawable */
-   pdraw->base.driDrawable =
-      (*psc->dri2->createNewDrawable) (psc->__driScreen,
-                                       config->driConfig, pdraw);
-
-   if (!pdraw->base.driDrawable) {
-      DRI2DestroyDrawable(psc->dpy, xDrawable);
-      Xfree(pdraw);
-      return NULL;
-   }
-
-   return &pdraw->base;
-}
-
-static int
-dri2DrawableGetMSC(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
-                  int64_t *ust, int64_t *msc, int64_t *sbc)
-{
-   return DRI2GetMSC(psc->dpy, pdraw->xDrawable, ust, msc, sbc);
-}
-
-static int
-dri2WaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
-              int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
-{
-   return DRI2WaitMSC(pdraw->psc->dpy, pdraw->xDrawable, target_msc, divisor,
-                     remainder, ust, msc, sbc);
-}
-
-static int
-dri2WaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
-              int64_t *msc, int64_t *sbc)
-{
-   return DRI2WaitSBC(pdraw->psc->dpy, pdraw->xDrawable, target_sbc, ust, msc,
-                     sbc);
-}
-
-static void
-dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y, int width, int height)
-{
-   __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
-   XRectangle xrect;
-   XserverRegion region;
-
-   /* Check we have the right attachments */
-   if (!priv->have_back)
-      return;
-
-   xrect.x = x;
-   xrect.y = priv->height - y - height;
-   xrect.width = width;
-   xrect.height = height;
-
-#ifdef __DRI2_FLUSH
-   if (pdraw->psc->f)
-      (*pdraw->psc->f->flush) (pdraw->driDrawable);
-#endif
-
-   region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
-   /* should get a fence ID back from here at some point */
-   DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
-                  DRI2BufferFrontLeft, DRI2BufferBackLeft);
-   XFixesDestroyRegion(pdraw->psc->dpy, region);
-
-   /* Refresh the fake front (if present) after we just damaged the real
-    * front.
-    */
-   dri2WaitX(pdraw);
-}
-
-static void
-dri2WaitX(__GLXDRIdrawable *pdraw)
-{
-   __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
-   XRectangle xrect;
-   XserverRegion region;
-
-   /* Check we have the right attachments */
-   if (!priv->have_fake_front)
-      return;
-
-   xrect.x = 0;
-   xrect.y = 0;
-   xrect.width = priv->width;
-   xrect.height = priv->height;
-
-#ifdef __DRI2_FLUSH
-   if (pdraw->psc->f)
-      (*pdraw->psc->f->flush) (pdraw->driDrawable);
-#endif
-
-   region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
-   DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
-                  DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
-   XFixesDestroyRegion(pdraw->psc->dpy, region);
-}
-
-static void
-dri2WaitGL(__GLXDRIdrawable * pdraw)
-{
-   __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
-   XRectangle xrect;
-   XserverRegion region;
-
-   if (!priv->have_fake_front)
-      return;
-
-   xrect.x = 0;
-   xrect.y = 0;
-   xrect.width = priv->width;
-   xrect.height = priv->height;
-
-#ifdef __DRI2_FLUSH
-   if (pdraw->psc->f)
-      (*pdraw->psc->f->flush) (pdraw->driDrawable);
-#endif
-
-   region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
-   DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
-                  DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
-   XFixesDestroyRegion(pdraw->psc->dpy, region);
-}
-
-
-static void
-dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
-{
-   (void) driDrawable;
-   dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
-}
-
-
-static void
-dri2DestroyScreen(__GLXscreenConfigs * psc)
-{
-   /* Free the direct rendering per screen data */
-   (*psc->core->destroyScreen) (psc->__driScreen);
-   close(psc->fd);
-   psc->__driScreen = NULL;
-}
-
-/**
- * Process list of buffer received from the server
- *
- * Processes the list of buffers received in a reply from the server to either
- * \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat.
- */
-static void
-process_buffers(__GLXDRIdrawablePrivate * pdraw, DRI2Buffer * buffers,
-                unsigned count)
-{
-   int i;
-
-   pdraw->bufferCount = count;
-   pdraw->have_fake_front = 0;
-   pdraw->have_back = 0;
-
-   /* This assumes the DRI2 buffer attachment tokens matches the
-    * __DRIbuffer tokens. */
-   for (i = 0; i < count; i++) {
-      pdraw->buffers[i].attachment = buffers[i].attachment;
-      pdraw->buffers[i].name = buffers[i].name;
-      pdraw->buffers[i].pitch = buffers[i].pitch;
-      pdraw->buffers[i].cpp = buffers[i].cpp;
-      pdraw->buffers[i].flags = buffers[i].flags;
-      if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
-         pdraw->have_fake_front = 1;
-      if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
-         pdraw->have_back = 1;
-   }
-
-}
-
-static int64_t
-dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
-               int64_t remainder)
-{
-    __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
-    __GLXdisplayPrivate *dpyPriv = __glXInitialize(priv->base.psc->dpy);
-    __GLXDRIdisplayPrivate *pdp =
-       (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;
-    int64_t ret;
-
-#ifdef __DRI2_FLUSH
-    if (pdraw->psc->f)
-       (*pdraw->psc->f->flush)(pdraw->driDrawable);
-#endif
-
-    /* Old servers can't handle swapbuffers */
-    if (!pdp->swapAvailable) {
-       dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
-       return 0;
-    }
-
-#ifdef X_DRI2SwapBuffers
-    DRI2SwapBuffers(pdraw->psc->dpy, pdraw->xDrawable, target_msc, divisor,
-                   remainder, &ret);
-#endif
-
-#if __DRI2_FLUSH_VERSION >= 2
-    if (pdraw->psc->f)
-       (*pdraw->psc->f->flushInvalidate)(pdraw->driDrawable);
-#endif
-
-    return ret;
-}
-
-static __DRIbuffer *
-dri2GetBuffers(__DRIdrawable * driDrawable,
-               int *width, int *height,
-               unsigned int *attachments, int count,
-               int *out_count, void *loaderPrivate)
-{
-   __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
-   DRI2Buffer *buffers;
-
-   buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
-                            width, height, attachments, count, out_count);
-   if (buffers == NULL)
-      return NULL;
-
-   pdraw->width = *width;
-   pdraw->height = *height;
-   process_buffers(pdraw, buffers, *out_count);
-
-   Xfree(buffers);
-
-   return pdraw->buffers;
-}
-
-static __DRIbuffer *
-dri2GetBuffersWithFormat(__DRIdrawable * driDrawable,
-                         int *width, int *height,
-                         unsigned int *attachments, int count,
-                         int *out_count, void *loaderPrivate)
-{
-   __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
-   DRI2Buffer *buffers;
-
-   buffers = DRI2GetBuffersWithFormat(pdraw->base.psc->dpy,
-                                      pdraw->base.xDrawable,
-                                      width, height, attachments,
-                                      count, out_count);
-   if (buffers == NULL)
-      return NULL;
-
-   pdraw->width = *width;
-   pdraw->height = *height;
-   process_buffers(pdraw, buffers, *out_count);
-
-   Xfree(buffers);
-
-   return pdraw->buffers;
-}
-
-static void
-dri2SetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
-{
-   __GLXDRIdrawablePrivate *priv =  (__GLXDRIdrawablePrivate *) pdraw;
-
-   DRI2SwapInterval(priv->base.psc->dpy, pdraw->xDrawable, interval);
-   priv->swap_interval = interval;
-}
-
-static unsigned int
-dri2GetSwapInterval(__GLXDRIdrawable *pdraw)
-{
-   __GLXDRIdrawablePrivate *priv =  (__GLXDRIdrawablePrivate *) pdraw;
-
-  return priv->swap_interval;
-}
-
-static const __DRIdri2LoaderExtension dri2LoaderExtension = {
-   {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
-   dri2GetBuffers,
-   dri2FlushFrontBuffer,
-   dri2GetBuffersWithFormat,
-};
-
-static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
-   {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
-   dri2GetBuffers,
-   dri2FlushFrontBuffer,
-   NULL,
-};
-
-static const __DRIextension *loader_extensions[] = {
-   &dri2LoaderExtension.base,
-   &systemTimeExtension.base,
-   NULL
-};
-
-static const __DRIextension *loader_extensions_old[] = {
-   &dri2LoaderExtension_old.base,
-   &systemTimeExtension.base,
-   NULL
-};
-
-static __GLXDRIscreen *
-dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
-                 __GLXdisplayPrivate * priv)
-{
-   const __DRIconfig **driver_configs;
-   const __DRIextension **extensions;
-   const __GLXDRIdisplayPrivate *const pdp = (__GLXDRIdisplayPrivate *)
-      priv->dri2Display;
-   __GLXDRIscreen *psp;
-   char *driverName, *deviceName;
-   drm_magic_t magic;
-   int i;
-
-   psp = Xmalloc(sizeof *psp);
-   if (psp == NULL)
-      return NULL;
-
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
-   if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
-                   &driverName, &deviceName)) {
-      XFree(psp);
-      return NULL;
-   }
-
-   psc->driver = driOpenDriver(driverName);
-   if (psc->driver == NULL) {
-      ErrorMessageF("driver pointer missing\n");
-      goto handle_error;
-   }
-
-   extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
-   if (extensions == NULL) {
-      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
-      goto handle_error;
-   }
-
-   for (i = 0; extensions[i]; i++) {
-      if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
-        psc->core = (__DRIcoreExtension *) extensions[i];
-      if (strcmp(extensions[i]->name, __DRI_DRI2) == 0)
-        psc->dri2 = (__DRIdri2Extension *) extensions[i];
-   }
-
-   if (psc->core == NULL || psc->dri2 == NULL) {
-      ErrorMessageF("core dri or dri2 extension not found\n");
-      goto handle_error;
-   }
-
-   psc->fd = open(deviceName, O_RDWR);
-   if (psc->fd < 0) {
-      ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
-      goto handle_error;
-   }
-
-   if (drmGetMagic(psc->fd, &magic)) {
-      ErrorMessageF("failed to get magic\n");
-      goto handle_error;
-   }
-
-   if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
-      ErrorMessageF("failed to authenticate magic %d\n", magic);
-      goto handle_error;
-   }
-
-   /* If the server does not support the protocol for
-    * DRI2GetBuffersWithFormat, don't supply that interface to the driver.
-    */
-   psc->__driScreen =
-      psc->dri2->createNewScreen(screen, psc->fd, ((pdp->driMinor < 1)
-                                                  ? loader_extensions_old
-                                                  : loader_extensions),
-                                &driver_configs, psc);
-
-   if (psc->__driScreen == NULL) {
-      ErrorMessageF("failed to create dri screen\n");
-      goto handle_error;
-   }
-
-   driBindCommonExtensions(psc);
-   dri2BindExtensions(psc);
-
-   psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
-   psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
-
-   psc->driver_configs = driver_configs;
-
-   psp->destroyScreen = dri2DestroyScreen;
-   psp->createContext = dri2CreateContext;
-   psp->createDrawable = dri2CreateDrawable;
-   psp->swapBuffers = dri2SwapBuffers;
-   psp->waitGL = dri2WaitGL;
-   psp->waitX = dri2WaitX;
-   psp->getDrawableMSC = NULL;
-   psp->waitForMSC = NULL;
-   psp->waitForSBC = NULL;
-   psp->setSwapInterval = NULL;
-   psp->getSwapInterval = NULL;
-
-   if (pdp->driMinor >= 2) {
-#ifdef X_DRI2GetMSC
-      psp->getDrawableMSC = dri2DrawableGetMSC;
-#endif
-#ifdef X_DRI2WaitMSC
-      psp->waitForMSC = dri2WaitForMSC;
-      psp->waitForSBC = dri2WaitForSBC;
-#endif
-#ifdef X_DRI2SwapInterval
-      psp->setSwapInterval = dri2SetSwapInterval;
-      psp->getSwapInterval = dri2GetSwapInterval;
-#endif
-   }
-
-   /* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
-    * available.*/
-   psp->copySubBuffer = dri2CopySubBuffer;
-   __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
-
-   Xfree(driverName);
-   Xfree(deviceName);
-
-   return psp;
-
-handle_error:
-   Xfree(driverName);
-   Xfree(deviceName);
-   XFree(psp);
-
-   /* FIXME: clean up here */
-
-   return NULL;
-}
-
-/* Called from __glXFreeDisplayPrivate.
- */
-static void
-dri2DestroyDisplay(__GLXDRIdisplay * dpy)
-{
-   Xfree(dpy);
-}
-
-/*
- * Allocate, initialize and return a __DRIdisplayPrivate object.
- * This is called from __glXInitialize() when we are given a new
- * display pointer.
- */
-_X_HIDDEN __GLXDRIdisplay *
-dri2CreateDisplay(Display * dpy)
-{
-   __GLXDRIdisplayPrivate *pdp;
-   int eventBase, errorBase;
-
-   if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
-      return NULL;
-
-   pdp = Xmalloc(sizeof *pdp);
-   if (pdp == NULL)
-      return NULL;
-
-   if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) {
-      Xfree(pdp);
-      return NULL;
-   }
-
-   pdp->driPatch = 0;
-   pdp->swapAvailable = 0;
-#ifdef X_DRI2SwapBuffers
-   if (pdp->driMinor >= 2)
-      pdp->swapAvailable = 1;
-#endif
-
-   pdp->base.destroyDisplay = dri2DestroyDisplay;
-   pdp->base.createScreen = dri2CreateScreen;
-
-   return &pdp->base;
-}
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/dri_common.c b/src/glx/x11/dri_common.c
deleted file mode 100644 (file)
index e403416..0000000
+++ /dev/null
@@ -1,450 +0,0 @@
-/*
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Soft-
- * ware"), to deal in the Software without restriction, including without
- * limitation the rights to use, copy, modify, merge, publish, distribute,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, provided that the above copyright
- * notice(s) and this permission notice appear in all copies of the Soft-
- * ware and that both the above copyright notice(s) and this permission
- * notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
- * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
- * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
- * QUENTIAL 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 PERFOR-
- * MANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder shall
- * not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization of
- * the copyright holder.
- *
- * Authors:
- *   Kevin E. Martin <kevin@precisioninsight.com>
- *   Brian Paul <brian@precisioninsight.com>
- *   Kristian Høgsberg (krh@redhat.com)
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <unistd.h>
-#include <dlfcn.h>
-#include <stdarg.h>
-#include "glxclient.h"
-#include "glcontextmodes.h"
-#include "dri_common.h"
-
-#ifndef RTLD_NOW
-#define RTLD_NOW 0
-#endif
-#ifndef RTLD_GLOBAL
-#define RTLD_GLOBAL 0
-#endif
-
-_X_HIDDEN void
-InfoMessageF(const char *f, ...)
-{
-   va_list args;
-   const char *env;
-
-   if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
-      fprintf(stderr, "libGL: ");
-      va_start(args, f);
-      vfprintf(stderr, f, args);
-      va_end(args);
-   }
-}
-
-/**
- * Print error to stderr, unless LIBGL_DEBUG=="quiet".
- */
-_X_HIDDEN void
-ErrorMessageF(const char *f, ...)
-{
-   va_list args;
-   const char *env;
-
-   if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) {
-      fprintf(stderr, "libGL error: ");
-      va_start(args, f);
-      vfprintf(stderr, f, args);
-      va_end(args);
-   }
-}
-
-#ifndef DEFAULT_DRIVER_DIR
-/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
-#define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
-#endif
-
-/**
- * Try to \c dlopen the named driver.
- *
- * This function adds the "_dri.so" suffix to the driver name and searches the
- * directories specified by the \c LIBGL_DRIVERS_PATH environment variable in
- * order to find the driver.
- *
- * \param driverName - a name like "tdfx", "i810", "mga", etc.
- *
- * \returns
- * A handle from \c dlopen, or \c NULL if driver file not found.
- */
-_X_HIDDEN void *
-driOpenDriver(const char *driverName)
-{
-   void *glhandle, *handle;
-   const char *libPaths, *p, *next;
-   char realDriverName[200];
-   int len;
-
-   /* Attempt to make sure libGL symbols will be visible to the driver */
-   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
-
-   libPaths = NULL;
-   if (geteuid() == getuid()) {
-      /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
-      libPaths = getenv("LIBGL_DRIVERS_PATH");
-      if (!libPaths)
-         libPaths = getenv("LIBGL_DRIVERS_DIR");        /* deprecated */
-   }
-   if (libPaths == NULL)
-      libPaths = DEFAULT_DRIVER_DIR;
-
-   handle = NULL;
-   for (p = libPaths; *p; p = next) {
-      next = strchr(p, ':');
-      if (next == NULL) {
-         len = strlen(p);
-         next = p + len;
-      }
-      else {
-         len = next - p;
-         next++;
-      }
-
-#ifdef GLX_USE_TLS
-      snprintf(realDriverName, sizeof realDriverName,
-               "%.*s/tls/%s_dri.so", len, p, driverName);
-      InfoMessageF("OpenDriver: trying %s\n", realDriverName);
-      handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
-#endif
-
-      if (handle == NULL) {
-         snprintf(realDriverName, sizeof realDriverName,
-                  "%.*s/%s_dri.so", len, p, driverName);
-         InfoMessageF("OpenDriver: trying %s\n", realDriverName);
-         handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
-      }
-
-      if (handle != NULL)
-         break;
-      else
-         ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
-   }
-
-   if (!handle)
-      ErrorMessageF("unable to load driver: %s_dri.so\n", driverName);
-
-   if (glhandle)
-      dlclose(glhandle);
-
-   return handle;
-}
-
-_X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
-   {__DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION},
-   __glXGetUST,
-   __driGetMscRateOML
-};
-
-#define __ATTRIB(attrib, field) \
-    { attrib, offsetof(__GLcontextModes, field) }
-
-static const struct
-{
-   unsigned int attrib, offset;
-} attribMap[] = {
-   __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
-      __ATTRIB(__DRI_ATTRIB_LEVEL, level),
-      __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
-      __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
-      __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
-      __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
-      __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
-      __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
-      __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
-      __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
-      __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
-      __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
-      __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
-      __ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
-      __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
-      __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
-      __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
-#if 0
-      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
-      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentIndex),
-      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
-      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
-      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
-      __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
-      __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
-      __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
-      __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
-      __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
-#endif
-      __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
-      __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
-      __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
-      __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
-      __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
-#if 0
-      __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
-#endif
-__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
-      __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
-      __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,
-                     bindToMipmapTexture),
-      __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),};
-
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
-static int
-scalarEqual(__GLcontextModes * mode, unsigned int attrib, unsigned int value)
-{
-   unsigned int glxValue;
-   int i;
-
-   for (i = 0; i < ARRAY_SIZE(attribMap); i++)
-      if (attribMap[i].attrib == attrib) {
-         glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
-         return glxValue == GLX_DONT_CARE || glxValue == value;
-      }
-
-   return GL_TRUE;              /* Is a non-existing attribute equal to value? */
-}
-
-static int
-driConfigEqual(const __DRIcoreExtension * core,
-               __GLcontextModes * modes, const __DRIconfig * driConfig)
-{
-   unsigned int attrib, value, glxValue;
-   int i;
-
-   i = 0;
-   while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
-      switch (attrib) {
-      case __DRI_ATTRIB_RENDER_TYPE:
-         glxValue = 0;
-         if (value & __DRI_ATTRIB_RGBA_BIT) {
-            glxValue |= GLX_RGBA_BIT;
-         }
-         else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
-            glxValue |= GLX_COLOR_INDEX_BIT;
-         }
-         if (glxValue != modes->renderType)
-            return GL_FALSE;
-         break;
-
-      case __DRI_ATTRIB_CONFIG_CAVEAT:
-         if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
-            glxValue = GLX_NON_CONFORMANT_CONFIG;
-         else if (value & __DRI_ATTRIB_SLOW_BIT)
-            glxValue = GLX_SLOW_CONFIG;
-         else
-            glxValue = GLX_NONE;
-         if (glxValue != modes->visualRating)
-            return GL_FALSE;
-         break;
-
-      case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
-         glxValue = 0;
-         if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
-            glxValue |= GLX_TEXTURE_1D_BIT_EXT;
-         if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
-            glxValue |= GLX_TEXTURE_2D_BIT_EXT;
-         if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
-            glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
-         if (modes->bindToTextureTargets != GLX_DONT_CARE &&
-             glxValue != modes->bindToTextureTargets)
-            return GL_FALSE;
-         break;
-
-      default:
-         if (!scalarEqual(modes, attrib, value))
-            return GL_FALSE;
-      }
-   }
-
-   return GL_TRUE;
-}
-
-static __GLcontextModes *
-createDriMode(const __DRIcoreExtension * core,
-              __GLcontextModes * modes, const __DRIconfig ** driConfigs)
-{
-   __GLXDRIconfigPrivate *config;
-   int i;
-
-   for (i = 0; driConfigs[i]; i++) {
-      if (driConfigEqual(core, modes, driConfigs[i]))
-         break;
-   }
-
-   if (driConfigs[i] == NULL)
-      return NULL;
-
-   config = Xmalloc(sizeof *config);
-   if (config == NULL)
-      return NULL;
-
-   config->modes = *modes;
-   config->driConfig = driConfigs[i];
-
-   return &config->modes;
-}
-
-_X_HIDDEN __GLcontextModes *
-driConvertConfigs(const __DRIcoreExtension * core,
-                  __GLcontextModes * modes, const __DRIconfig ** configs)
-{
-   __GLcontextModes head, *tail, *m;
-
-   tail = &head;
-   head.next = NULL;
-   for (m = modes; m; m = m->next) {
-      tail->next = createDriMode(core, m, configs);
-      if (tail->next == NULL) {
-         /* no matching dri config for m */
-         continue;
-      }
-
-
-      tail = tail->next;
-   }
-
-   _gl_context_modes_destroy(modes);
-
-   return head.next;
-}
-
-/* Bind DRI1 specific extensions */
-_X_HIDDEN void
-driBindExtensions(__GLXscreenConfigs *psc)
-{
-   const __DRIextension **extensions;
-   int i;
-
-   extensions = psc->core->getExtensions(psc->__driScreen);
-
-   for (i = 0; extensions[i]; i++) {
-#ifdef __DRI_SWAP_CONTROL
-      /* No DRI2 support for swap_control at the moment, since SwapBuffers
-       * is done by the X server */
-      if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
-        psc->swapControl = (__DRIswapControlExtension *) extensions[i];
-        __glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
-        __glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
-      }
-#endif
-
-#ifdef __DRI_MEDIA_STREAM_COUNTER
-      if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) {
-         psc->msc = (__DRImediaStreamCounterExtension *) extensions[i];
-         __glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
-      }
-#endif
-
-#ifdef __DRI_SWAP_BUFFER_COUNTER
-      /* No driver supports this at this time and the extension is
-       * not defined in dri_interface.h.  Will enable
-       * GLX_OML_sync_control if implemented. */
-#endif
-
-      /* Ignore unknown extensions */
-   }
-}
-
-/* Bind DRI2 specific extensions */
-_X_HIDDEN void
-dri2BindExtensions(__GLXscreenConfigs *psc)
-{
-   const __DRIextension **extensions;
-   int i;
-
-   extensions = psc->core->getExtensions(psc->__driScreen);
-
-   for (i = 0; extensions[i]; i++) {
-#ifdef __DRI_TEX_BUFFER
-      if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0)) {
-        psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
-        __glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap");
-      }
-#endif
-
-      __glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
-      __glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
-      __glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
-
-      /* FIXME: if DRI2 version supports it... */
-      __glXEnableDirectExtension(psc, "INTEL_swap_event");
-
-#ifdef __DRI2_FLUSH
-      if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0)) {
-        psc->f = (__DRI2flushExtension *) extensions[i];
-        /* internal driver extension, no GL extension exposed */
-      }
-#endif
-   }
-}
-
-/* Bind extensions common to DRI1 and DRI2 */
-_X_HIDDEN void
-driBindCommonExtensions(__GLXscreenConfigs *psc)
-{
-   const __DRIextension **extensions;
-   int i;
-
-   extensions = psc->core->getExtensions(psc->__driScreen);
-
-   for (i = 0; extensions[i]; i++) {
-#ifdef __DRI_COPY_SUB_BUFFER
-      if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
-        psc->driCopySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
-        __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
-      }
-#endif
-
-#ifdef __DRI_ALLOCATE
-      if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) {
-        psc->allocate = (__DRIallocateExtension *) extensions[i];
-        __glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory");
-      }
-#endif
-
-#ifdef __DRI_FRAME_TRACKING
-      if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
-        psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
-        __glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage");
-      }
-#endif
-
-#ifdef __DRI_READ_DRAWABLE
-      if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
-        __glXEnableDirectExtension(psc, "GLX_SGI_make_current_read");
-      }
-#endif
-
-      /* Ignore unknown extensions */
-   }
-}
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/dri_common.h b/src/glx/x11/dri_common.h
deleted file mode 100644 (file)
index bb178db..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Soft-
- * ware"), to deal in the Software without restriction, including without
- * limitation the rights to use, copy, modify, merge, publish, distribute,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, provided that the above copyright
- * notice(s) and this permission notice appear in all copies of the Soft-
- * ware and that both the above copyright notice(s) and this permission
- * notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
- * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
- * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
- * QUENTIAL 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 PERFOR-
- * MANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder shall
- * not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization of
- * the copyright holder.
- *
- * Authors:
- *   Kevin E. Martin <kevin@precisioninsight.com>
- *   Brian Paul <brian@precisioninsight.com>
- *   Kristian Høgsberg (krh@redhat.com)
- */
-
-#ifndef _DRI_COMMON_H
-#define _DRI_COMMON_H
-
-typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
-
-struct __GLXDRIconfigPrivateRec
-{
-   __GLcontextModes modes;
-   const __DRIconfig *driConfig;
-};
-
-extern __GLcontextModes *driConvertConfigs(const __DRIcoreExtension * core,
-                                           __GLcontextModes * modes,
-                                           const __DRIconfig ** configs);
-
-extern const __DRIsystemTimeExtension systemTimeExtension;
-
-extern void InfoMessageF(const char *f, ...);
-
-extern void ErrorMessageF(const char *f, ...);
-
-extern void *driOpenDriver(const char *driverName);
-
-extern void driBindExtensions(__GLXscreenConfigs * psc);
-extern void dri2BindExtensions(__GLXscreenConfigs * psc);
-extern void driBindCommonExtensions(__GLXscreenConfigs * psc);
-
-#endif /* _DRI_COMMON_H */
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
deleted file mode 100644 (file)
index 0ff53c3..0000000
+++ /dev/null
@@ -1,751 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- *   Kevin E. Martin <kevin@precisioninsight.com>
- *   Brian Paul <brian@precisioninsight.com>
- *
- */
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xfixes.h>
-#include <X11/extensions/Xdamage.h>
-#include "glxclient.h"
-#include "xf86dri.h"
-#include "dri2.h"
-#include "sarea.h"
-#include <dlfcn.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include "xf86drm.h"
-#include "dri_common.h"
-
-typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
-typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
-
-struct __GLXDRIdisplayPrivateRec
-{
-   __GLXDRIdisplay base;
-
-   /*
-    ** XFree86-DRI version information
-    */
-   int driMajor;
-   int driMinor;
-   int driPatch;
-};
-
-struct __GLXDRIcontextPrivateRec
-{
-   __GLXDRIcontext base;
-   __DRIcontext *driContext;
-   XID hwContextID;
-   __GLXscreenConfigs *psc;
-};
-
-/*
- * Given a display pointer and screen number, determine the name of
- * the DRI driver for the screen. (I.e. "r128", "tdfx", etc).
- * Return True for success, False for failure.
- */
-static Bool
-driGetDriverName(Display * dpy, int scrNum, char **driverName)
-{
-   int directCapable;
-   Bool b;
-   int event, error;
-   int driverMajor, driverMinor, driverPatch;
-
-   *driverName = NULL;
-
-   if (XF86DRIQueryExtension(dpy, &event, &error)) {    /* DRI1 */
-      if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) {
-         ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n");
-         return False;
-      }
-      if (!directCapable) {
-         ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n");
-         return False;
-      }
-
-      b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor,
-                                     &driverPatch, driverName);
-      if (!b) {
-         ErrorMessageF("Cannot determine driver name for screen %d\n",
-                       scrNum);
-         return False;
-      }
-
-      InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
-                   driverMajor, driverMinor, driverPatch, *driverName,
-                   scrNum);
-
-      return True;
-   }
-   else if (DRI2QueryExtension(dpy, &event, &error)) {  /* DRI2 */
-      char *dev;
-      Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev);
-
-      if (ret)
-         Xfree(dev);
-
-      return ret;
-   }
-
-   return False;
-}
-
-/*
- * Exported function for querying the DRI driver for a given screen.
- *
- * The returned char pointer points to a static array that will be
- * overwritten by subsequent calls.
- */
-PUBLIC const char *
-glXGetScreenDriver(Display * dpy, int scrNum)
-{
-   static char ret[32];
-   char *driverName;
-   if (driGetDriverName(dpy, scrNum, &driverName)) {
-      int len;
-      if (!driverName)
-         return NULL;
-      len = strlen(driverName);
-      if (len >= 31)
-         return NULL;
-      memcpy(ret, driverName, len + 1);
-      Xfree(driverName);
-      return ret;
-   }
-   return NULL;
-}
-
-/*
- * Exported function for obtaining a driver's option list (UTF-8 encoded XML).
- *
- * The returned char pointer points directly into the driver. Therefore
- * it should be treated as a constant.
- *
- * If the driver was not found or does not support configuration NULL is
- * returned.
- *
- * Note: The driver remains opened after this function returns.
- */
-PUBLIC const char *
-glXGetDriverConfig(const char *driverName)
-{
-   void *handle = driOpenDriver(driverName);
-   if (handle)
-      return dlsym(handle, "__driConfigOptions");
-   else
-      return NULL;
-}
-
-#ifdef XDAMAGE_1_1_INTERFACE
-
-static GLboolean
-has_damage_post(Display * dpy)
-{
-   static GLboolean inited = GL_FALSE;
-   static GLboolean has_damage;
-
-   if (!inited) {
-      int major, minor;
-
-      if (XDamageQueryVersion(dpy, &major, &minor) &&
-          major == 1 && minor >= 1) {
-         has_damage = GL_TRUE;
-      }
-      else {
-         has_damage = GL_FALSE;
-      }
-      inited = GL_TRUE;
-   }
-
-   return has_damage;
-}
-
-static void
-__glXReportDamage(__DRIdrawable * driDraw,
-                  int x, int y,
-                  drm_clip_rect_t * rects, int num_rects,
-                  GLboolean front_buffer, void *loaderPrivate)
-{
-   XRectangle *xrects;
-   XserverRegion region;
-   int i;
-   int x_off, y_off;
-   __GLXDRIdrawable *glxDraw = loaderPrivate;
-   __GLXscreenConfigs *psc = glxDraw->psc;
-   Display *dpy = psc->dpy;
-   Drawable drawable;
-
-   if (!has_damage_post(dpy))
-      return;
-
-   if (front_buffer) {
-      x_off = x;
-      y_off = y;
-      drawable = RootWindow(dpy, psc->scr);
-   }
-   else {
-      x_off = 0;
-      y_off = 0;
-      drawable = glxDraw->xDrawable;
-   }
-
-   xrects = malloc(sizeof(XRectangle) * num_rects);
-   if (xrects == NULL)
-      return;
-
-   for (i = 0; i < num_rects; i++) {
-      xrects[i].x = rects[i].x1 + x_off;
-      xrects[i].y = rects[i].y1 + y_off;
-      xrects[i].width = rects[i].x2 - rects[i].x1;
-      xrects[i].height = rects[i].y2 - rects[i].y1;
-   }
-   region = XFixesCreateRegion(dpy, xrects, num_rects);
-   free(xrects);
-   XDamageAdd(dpy, drawable, region);
-   XFixesDestroyRegion(dpy, region);
-}
-
-static const __DRIdamageExtension damageExtension = {
-   {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
-   __glXReportDamage,
-};
-
-#endif
-
-static GLboolean
-__glXDRIGetDrawableInfo(__DRIdrawable * drawable,
-                        unsigned int *index, unsigned int *stamp,
-                        int *X, int *Y, int *W, int *H,
-                        int *numClipRects, drm_clip_rect_t ** pClipRects,
-                        int *backX, int *backY,
-                        int *numBackClipRects,
-                        drm_clip_rect_t ** pBackClipRects,
-                        void *loaderPrivate)
-{
-   __GLXDRIdrawable *glxDraw = loaderPrivate;
-   __GLXscreenConfigs *psc = glxDraw->psc;
-   Display *dpy = psc->dpy;
-
-   return XF86DRIGetDrawableInfo(dpy, psc->scr, glxDraw->drawable,
-                                 index, stamp, X, Y, W, H,
-                                 numClipRects, pClipRects,
-                                 backX, backY,
-                                 numBackClipRects, pBackClipRects);
-}
-
-static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
-   {__DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION},
-   __glXDRIGetDrawableInfo
-};
-
-static const __DRIextension *loader_extensions[] = {
-   &systemTimeExtension.base,
-   &getDrawableInfoExtension.base,
-#ifdef XDAMAGE_1_1_INTERFACE
-   &damageExtension.base,
-#endif
-   NULL
-};
-
-/**
- * Perform the required libGL-side initialization and call the client-side
- * driver's \c __driCreateNewScreen function.
- * 
- * \param dpy    Display pointer.
- * \param scrn   Screen number on the display.
- * \param psc    DRI screen information.
- * \param driDpy DRI display information.
- * \param createNewScreen  Pointer to the client-side driver's
- *               \c __driCreateNewScreen function.
- * \returns A pointer to the \c __DRIscreen structure returned by
- *          the client-side driver on success, or \c NULL on failure.
- */
-static void *
-CallCreateNewScreen(Display * dpy, int scrn, __GLXscreenConfigs * psc,
-                    __GLXDRIdisplayPrivate * driDpy)
-{
-   void *psp = NULL;
-   drm_handle_t hSAREA;
-   drmAddress pSAREA = MAP_FAILED;
-   char *BusID;
-   __DRIversion ddx_version;
-   __DRIversion dri_version;
-   __DRIversion drm_version;
-   __DRIframebuffer framebuffer;
-   int fd = -1;
-   int status;
-
-   drm_magic_t magic;
-   drmVersionPtr version;
-   int newlyopened;
-   char *driverName;
-   drm_handle_t hFB;
-   int junk;
-   const __DRIconfig **driver_configs;
-   __GLcontextModes *visual;
-
-   /* DRI protocol version. */
-   dri_version.major = driDpy->driMajor;
-   dri_version.minor = driDpy->driMinor;
-   dri_version.patch = driDpy->driPatch;
-
-   framebuffer.base = MAP_FAILED;
-   framebuffer.dev_priv = NULL;
-
-   if (!XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) {
-      ErrorMessageF("XF86DRIOpenConnection failed\n");
-      goto handle_error;
-   }
-
-   fd = drmOpenOnce(NULL, BusID, &newlyopened);
-
-   Xfree(BusID);                /* No longer needed */
-
-   if (fd < 0) {
-      ErrorMessageF("drmOpenOnce failed (%s)\n", strerror(-fd));
-      goto handle_error;
-   }
-
-   if (drmGetMagic(fd, &magic)) {
-      ErrorMessageF("drmGetMagic failed\n");
-      goto handle_error;
-   }
-
-   version = drmGetVersion(fd);
-   if (version) {
-      drm_version.major = version->version_major;
-      drm_version.minor = version->version_minor;
-      drm_version.patch = version->version_patchlevel;
-      drmFreeVersion(version);
-   }
-   else {
-      drm_version.major = -1;
-      drm_version.minor = -1;
-      drm_version.patch = -1;
-   }
-
-   if (newlyopened && !XF86DRIAuthConnection(dpy, scrn, magic)) {
-      ErrorMessageF("XF86DRIAuthConnection failed\n");
-      goto handle_error;
-   }
-
-   /* Get device name (like "tdfx") and the ddx version numbers.
-    * We'll check the version in each DRI driver's "createNewScreen"
-    * function. */
-   if (!XF86DRIGetClientDriverName(dpy, scrn,
-                                   &ddx_version.major,
-                                   &ddx_version.minor,
-                                   &ddx_version.patch, &driverName)) {
-      ErrorMessageF("XF86DRIGetClientDriverName failed\n");
-      goto handle_error;
-   }
-
-   Xfree(driverName);           /* No longer needed. */
-
-   /*
-    * Get device-specific info.  pDevPriv will point to a struct
-    * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
-    * has information about the screen size, depth, pitch, ancilliary
-    * buffers, DRM mmap handles, etc.
-    */
-   if (!XF86DRIGetDeviceInfo(dpy, scrn, &hFB, &junk,
-                             &framebuffer.size, &framebuffer.stride,
-                             &framebuffer.dev_priv_size,
-                             &framebuffer.dev_priv)) {
-      ErrorMessageF("XF86DRIGetDeviceInfo failed");
-      goto handle_error;
-   }
-
-   framebuffer.width = DisplayWidth(dpy, scrn);
-   framebuffer.height = DisplayHeight(dpy, scrn);
-
-   /* Map the framebuffer region. */
-   status = drmMap(fd, hFB, framebuffer.size,
-                   (drmAddressPtr) & framebuffer.base);
-   if (status != 0) {
-      ErrorMessageF("drmMap of framebuffer failed (%s)", strerror(-status));
-      goto handle_error;
-   }
-
-   /* Map the SAREA region.  Further mmap regions may be setup in
-    * each DRI driver's "createNewScreen" function.
-    */
-   status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
-   if (status != 0) {
-      ErrorMessageF("drmMap of SAREA failed (%s)", strerror(-status));
-      goto handle_error;
-   }
-
-   psp = (*psc->legacy->createNewScreen) (scrn,
-                                          &ddx_version,
-                                          &dri_version,
-                                          &drm_version,
-                                          &framebuffer,
-                                          pSAREA,
-                                          fd,
-                                          loader_extensions,
-                                          &driver_configs, psc);
-
-   if (psp == NULL) {
-      ErrorMessageF("Calling driver entry point failed");
-      goto handle_error;
-   }
-
-   psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
-   psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
-
-   psc->driver_configs = driver_configs;
-
-   /* Visuals with depth != screen depth are subject to automatic compositing
-    * in the X server, so DRI1 can't render to them properly. Mark them as
-    * non-conformant to prevent apps from picking them up accidentally.
-    */
-   for (visual = psc->visuals; visual; visual = visual->next) {
-      XVisualInfo template;
-      XVisualInfo *visuals;
-      int num_visuals;
-      long mask;
-
-      template.visualid = visual->visualID;
-      mask = VisualIDMask;
-      visuals = XGetVisualInfo(dpy, mask, &template, &num_visuals);
-
-      if (visuals) {
-         if (num_visuals > 0 && visuals->depth != DefaultDepth(dpy, scrn))
-            visual->visualRating = GLX_NON_CONFORMANT_CONFIG;
-
-         XFree(visuals);
-      }
-   }
-
-   return psp;
-
- handle_error:
-   if (pSAREA != MAP_FAILED)
-      drmUnmap(pSAREA, SAREA_MAX);
-
-   if (framebuffer.base != MAP_FAILED)
-      drmUnmap((drmAddress) framebuffer.base, framebuffer.size);
-
-   if (framebuffer.dev_priv != NULL)
-      Xfree(framebuffer.dev_priv);
-
-   if (fd >= 0)
-      drmCloseOnce(fd);
-
-   XF86DRICloseConnection(dpy, scrn);
-
-   ErrorMessageF("reverting to software direct rendering\n");
-
-   return NULL;
-}
-
-static void
-driDestroyContext(__GLXDRIcontext * context,
-                  __GLXscreenConfigs * psc, Display * dpy)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-
-   (*psc->core->destroyContext) (pcp->driContext);
-
-   XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
-   Xfree(pcp);
-}
-
-static Bool
-driBindContext(__GLXDRIcontext * context,
-               __GLXDRIdrawable * draw, __GLXDRIdrawable * read)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   return (*core->bindContext) (pcp->driContext,
-                                draw->driDrawable, read->driDrawable);
-}
-
-static void
-driUnbindContext(__GLXDRIcontext * context)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   (*core->unbindContext) (pcp->driContext);
-}
-
-static __GLXDRIcontext *
-driCreateContext(__GLXscreenConfigs * psc,
-                 const __GLcontextModes * mode,
-                 GLXContext gc, GLXContext shareList, int renderType)
-{
-   __GLXDRIcontextPrivate *pcp, *pcp_shared;
-   drm_context_t hwContext;
-   __DRIcontext *shared = NULL;
-   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
-
-   if (!psc || !psc->driScreen)
-      return NULL;
-
-   if (shareList) {
-      pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
-      shared = pcp_shared->driContext;
-   }
-
-   pcp = Xmalloc(sizeof *pcp);
-   if (pcp == NULL)
-      return NULL;
-
-   pcp->psc = psc;
-   if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr,
-                                       mode->visualID,
-                                       &pcp->hwContextID, &hwContext)) {
-      Xfree(pcp);
-      return NULL;
-   }
-
-   pcp->driContext =
-      (*psc->legacy->createNewContext) (psc->__driScreen,
-                                        config->driConfig,
-                                        renderType, shared, hwContext, pcp);
-   if (pcp->driContext == NULL) {
-      XF86DRIDestroyContext(psc->dpy, psc->scr, pcp->hwContextID);
-      Xfree(pcp);
-      return NULL;
-   }
-
-   pcp->base.destroyContext = driDestroyContext;
-   pcp->base.bindContext = driBindContext;
-   pcp->base.unbindContext = driUnbindContext;
-
-   return &pcp->base;
-}
-
-static void
-driDestroyDrawable(__GLXDRIdrawable * pdraw)
-{
-   __GLXscreenConfigs *psc = pdraw->psc;
-
-   (*psc->core->destroyDrawable) (pdraw->driDrawable);
-   XF86DRIDestroyDrawable(psc->dpy, psc->scr, pdraw->drawable);
-   Xfree(pdraw);
-}
-
-static __GLXDRIdrawable *
-driCreateDrawable(__GLXscreenConfigs * psc,
-                  XID xDrawable,
-                  GLXDrawable drawable, const __GLcontextModes * modes)
-{
-   __GLXDRIdrawable *pdraw;
-   drm_drawable_t hwDrawable;
-   void *empty_attribute_list = NULL;
-   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
-
-   /* Old dri can't handle GLX 1.3+ drawable constructors. */
-   if (xDrawable != drawable)
-      return NULL;
-
-   pdraw = Xmalloc(sizeof(*pdraw));
-   if (!pdraw)
-      return NULL;
-
-   pdraw->drawable = drawable;
-   pdraw->psc = psc;
-
-   if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) {
-      Xfree(pdraw);
-      return NULL;
-   }
-
-   /* Create a new drawable */
-   pdraw->driDrawable =
-      (*psc->legacy->createNewDrawable) (psc->__driScreen,
-                                         config->driConfig,
-                                         hwDrawable,
-                                         GLX_WINDOW_BIT,
-                                         empty_attribute_list, pdraw);
-
-   if (!pdraw->driDrawable) {
-      XF86DRIDestroyDrawable(psc->dpy, psc->scr, drawable);
-      Xfree(pdraw);
-      return NULL;
-   }
-
-   pdraw->destroyDrawable = driDestroyDrawable;
-
-   return pdraw;
-}
-
-static int64_t
-driSwapBuffers(__GLXDRIdrawable * pdraw, int64_t unused1, int64_t unused2,
-              int64_t unused3)
-{
-   (*pdraw->psc->core->swapBuffers) (pdraw->driDrawable);
-   return 0;
-}
-
-static void
-driCopySubBuffer(__GLXDRIdrawable * pdraw,
-                 int x, int y, int width, int height)
-{
-   (*pdraw->psc->driCopySubBuffer->copySubBuffer) (pdraw->driDrawable,
-                                                   x, y, width, height);
-}
-
-static void
-driDestroyScreen(__GLXscreenConfigs * psc)
-{
-   /* Free the direct rendering per screen data */
-   if (psc->__driScreen)
-      (*psc->core->destroyScreen) (psc->__driScreen);
-   psc->__driScreen = NULL;
-   if (psc->driver)
-      dlclose(psc->driver);
-}
-
-static __GLXDRIscreen *
-driCreateScreen(__GLXscreenConfigs * psc, int screen,
-                __GLXdisplayPrivate * priv)
-{
-   __GLXDRIdisplayPrivate *pdp;
-   __GLXDRIscreen *psp;
-   const __DRIextension **extensions;
-   char *driverName;
-   int i;
-
-   psp = Xcalloc(1, sizeof *psp);
-   if (psp == NULL)
-      return NULL;
-
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
-   if (!driGetDriverName(priv->dpy, screen, &driverName)) {
-      Xfree(psp);
-      return NULL;
-   }
-
-   psc->driver = driOpenDriver(driverName);
-   Xfree(driverName);
-   if (psc->driver == NULL) {
-      Xfree(psp);
-      return NULL;
-   }
-
-   extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
-   if (extensions == NULL) {
-      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
-      Xfree(psp);
-      return NULL;
-   }
-
-   for (i = 0; extensions[i]; i++) {
-      if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
-        psc->core = (__DRIcoreExtension *) extensions[i];
-      if (strcmp(extensions[i]->name, __DRI_LEGACY) == 0)
-        psc->legacy = (__DRIlegacyExtension *) extensions[i];
-   }
-
-   if (psc->core == NULL || psc->legacy == NULL) {
-      Xfree(psp);
-      return NULL;
-   }
-
-   pdp = (__GLXDRIdisplayPrivate *) priv->driDisplay;
-   psc->__driScreen = CallCreateNewScreen(psc->dpy, screen, psc, pdp);
-   if (psc->__driScreen == NULL) {
-      dlclose(psc->driver);
-      Xfree(psp);
-      return NULL;
-   }
-
-   driBindExtensions(psc);
-   driBindCommonExtensions(psc);
-
-   if (psc->driCopySubBuffer)
-      psp->copySubBuffer = driCopySubBuffer;
-
-   psp->destroyScreen = driDestroyScreen;
-   psp->createContext = driCreateContext;
-   psp->createDrawable = driCreateDrawable;
-   psp->swapBuffers = driSwapBuffers;
-   psp->waitX = NULL;
-   psp->waitGL = NULL;
-
-   return psp;
-}
-
-/* Called from __glXFreeDisplayPrivate.
- */
-static void
-driDestroyDisplay(__GLXDRIdisplay * dpy)
-{
-   Xfree(dpy);
-}
-
-/*
- * Allocate, initialize and return a __DRIdisplayPrivate object.
- * This is called from __glXInitialize() when we are given a new
- * display pointer.
- */
-_X_HIDDEN __GLXDRIdisplay *
-driCreateDisplay(Display * dpy)
-{
-   __GLXDRIdisplayPrivate *pdpyp;
-   int eventBase, errorBase;
-   int major, minor, patch;
-
-   if (!XF86DRIQueryExtension(dpy, &eventBase, &errorBase)) {
-      return NULL;
-   }
-
-   if (!XF86DRIQueryVersion(dpy, &major, &minor, &patch)) {
-      return NULL;
-   }
-
-   pdpyp = Xmalloc(sizeof *pdpyp);
-   if (!pdpyp) {
-      return NULL;
-   }
-
-   pdpyp->driMajor = major;
-   pdpyp->driMinor = minor;
-   pdpyp->driPatch = patch;
-
-   pdpyp->base.destroyDisplay = driDestroyDisplay;
-   pdpyp->base.createScreen = driCreateScreen;
-
-   return &pdpyp->base;
-}
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c
deleted file mode 100644 (file)
index eed9a8c..0000000
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Copyright 2008 George Sapountzis
- *
- * 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 GLX_DIRECT_RENDERING
-
-#include <X11/Xlib.h>
-#include "glxclient.h"
-#include <dlfcn.h>
-#include "dri_common.h"
-
-typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
-typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
-typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
-
-struct __GLXDRIdisplayPrivateRec
-{
-   __GLXDRIdisplay base;
-};
-
-struct __GLXDRIcontextPrivateRec
-{
-   __GLXDRIcontext base;
-   __DRIcontext *driContext;
-   __GLXscreenConfigs *psc;
-};
-
-struct __GLXDRIdrawablePrivateRec
-{
-   __GLXDRIdrawable base;
-
-   GC gc;
-   GC swapgc;
-
-   XVisualInfo *visinfo;
-   XImage *ximage;
-   int bpp;
-};
-
-/**
- * swrast loader functions
- */
-
-static Bool
-XCreateDrawable(__GLXDRIdrawablePrivate * pdp,
-                Display * dpy, XID drawable, int visualid)
-{
-   XGCValues gcvalues;
-   long visMask;
-   XVisualInfo visTemp;
-   int num_visuals;
-
-   /* create GC's */
-   pdp->gc = XCreateGC(dpy, drawable, 0, NULL);
-   pdp->swapgc = XCreateGC(dpy, drawable, 0, NULL);
-
-   gcvalues.function = GXcopy;
-   gcvalues.graphics_exposures = False;
-   XChangeGC(dpy, pdp->gc, GCFunction, &gcvalues);
-   XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues);
-   XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues);
-
-   /* create XImage  */
-   visTemp.screen = DefaultScreen(dpy);
-   visTemp.visualid = visualid;
-   visMask = (VisualScreenMask | VisualIDMask);
-   pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
-
-   pdp->ximage = XCreateImage(dpy, pdp->visinfo->visual, pdp->visinfo->depth, ZPixmap, 0,       /* format, offset */
-                              NULL,     /* data */
-                              0, 0,     /* size */
-                              32,       /* bitmap_pad */
-                              0);       /* bytes_per_line */
-
-   /* get the true number of bits per pixel */
-   pdp->bpp = pdp->ximage->bits_per_pixel;
-
-   return True;
-}
-
-static void
-XDestroyDrawable(__GLXDRIdrawablePrivate * pdp, Display * dpy, XID drawable)
-{
-   XDestroyImage(pdp->ximage);
-   XFree(pdp->visinfo);
-
-   XFreeGC(dpy, pdp->gc);
-   XFreeGC(dpy, pdp->swapgc);
-}
-
-static void
-swrastGetDrawableInfo(__DRIdrawable * draw,
-                      int *x, int *y, int *w, int *h, void *loaderPrivate)
-{
-   __GLXDRIdrawablePrivate *pdp = loaderPrivate;
-   __GLXDRIdrawable *pdraw = &(pdp->base);
-   Display *dpy = pdraw->psc->dpy;
-   Drawable drawable;
-
-   Window root;
-   Status stat;
-   unsigned int bw, depth;
-
-   drawable = pdraw->xDrawable;
-
-   stat = XGetGeometry(dpy, drawable, &root,
-                       x, y, (unsigned int *) w, (unsigned int *) h,
-                       &bw, &depth);
-}
-
-static inline int
-bytes_per_line(int w, int bpp, unsigned mul)
-{
-   unsigned mask = mul - 1;
-
-   return ((w * bpp + mask) & ~mask) / 8;
-}
-
-static void
-swrastPutImage(__DRIdrawable * draw, int op,
-               int x, int y, int w, int h, char *data, void *loaderPrivate)
-{
-   __GLXDRIdrawablePrivate *pdp = loaderPrivate;
-   __GLXDRIdrawable *pdraw = &(pdp->base);
-   Display *dpy = pdraw->psc->dpy;
-   Drawable drawable;
-   XImage *ximage;
-   GC gc;
-
-   switch (op) {
-   case __DRI_SWRAST_IMAGE_OP_DRAW:
-      gc = pdp->gc;
-      break;
-   case __DRI_SWRAST_IMAGE_OP_SWAP:
-      gc = pdp->swapgc;
-      break;
-   default:
-      return;
-   }
-
-   drawable = pdraw->xDrawable;
-
-   ximage = pdp->ximage;
-   ximage->data = data;
-   ximage->width = w;
-   ximage->height = h;
-   ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
-
-   XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
-
-   ximage->data = NULL;
-}
-
-static void
-swrastGetImage(__DRIdrawable * draw,
-               int x, int y, int w, int h, char *data, void *loaderPrivate)
-{
-   __GLXDRIdrawablePrivate *pdp = loaderPrivate;
-   __GLXDRIdrawable *pdraw = &(pdp->base);
-   Display *dpy = pdraw->psc->dpy;
-   Drawable drawable;
-   XImage *ximage;
-
-   drawable = pdraw->xDrawable;
-
-   ximage = pdp->ximage;
-   ximage->data = data;
-   ximage->width = w;
-   ximage->height = h;
-   ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
-
-   XGetSubImage(dpy, drawable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
-
-   ximage->data = NULL;
-}
-
-static const __DRIswrastLoaderExtension swrastLoaderExtension = {
-   {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
-   swrastGetDrawableInfo,
-   swrastPutImage,
-   swrastGetImage
-};
-
-static const __DRIextension *loader_extensions[] = {
-   &systemTimeExtension.base,
-   &swrastLoaderExtension.base,
-   NULL
-};
-
-/**
- * GLXDRI functions
- */
-
-static void
-driDestroyContext(__GLXDRIcontext * context,
-                  __GLXscreenConfigs * psc, Display * dpy)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   (*core->destroyContext) (pcp->driContext);
-
-   Xfree(pcp);
-}
-
-static Bool
-driBindContext(__GLXDRIcontext * context,
-               __GLXDRIdrawable * draw, __GLXDRIdrawable * read)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   return (*core->bindContext) (pcp->driContext,
-                                draw->driDrawable, read->driDrawable);
-}
-
-static void
-driUnbindContext(__GLXDRIcontext * context)
-{
-   __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
-   const __DRIcoreExtension *core = pcp->psc->core;
-
-   (*core->unbindContext) (pcp->driContext);
-}
-
-static __GLXDRIcontext *
-driCreateContext(__GLXscreenConfigs * psc,
-                 const __GLcontextModes * mode,
-                 GLXContext gc, GLXContext shareList, int renderType)
-{
-   __GLXDRIcontextPrivate *pcp, *pcp_shared;
-   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
-   const __DRIcoreExtension *core;
-   __DRIcontext *shared = NULL;
-
-   if (!psc || !psc->driScreen)
-      return NULL;
-
-   core = psc->core;
-
-   if (shareList) {
-      pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
-      shared = pcp_shared->driContext;
-   }
-
-   pcp = Xmalloc(sizeof *pcp);
-   if (pcp == NULL)
-      return NULL;
-
-   pcp->psc = psc;
-   pcp->driContext =
-      (*core->createNewContext) (psc->__driScreen,
-                                 config->driConfig, shared, pcp);
-   if (pcp->driContext == NULL) {
-      Xfree(pcp);
-      return NULL;
-   }
-
-   pcp->base.destroyContext = driDestroyContext;
-   pcp->base.bindContext = driBindContext;
-   pcp->base.unbindContext = driUnbindContext;
-
-   return &pcp->base;
-}
-
-static void
-driDestroyDrawable(__GLXDRIdrawable * pdraw)
-{
-   __GLXDRIdrawablePrivate *pdp = (__GLXDRIdrawablePrivate *) pdraw;
-   const __DRIcoreExtension *core = pdraw->psc->core;
-
-   (*core->destroyDrawable) (pdraw->driDrawable);
-
-   XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
-   Xfree(pdp);
-}
-
-static __GLXDRIdrawable *
-driCreateDrawable(__GLXscreenConfigs * psc,
-                  XID xDrawable,
-                  GLXDrawable drawable, const __GLcontextModes * modes)
-{
-   __GLXDRIdrawable *pdraw;
-   __GLXDRIdrawablePrivate *pdp;
-   __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
-   const __DRIswrastExtension *swrast = psc->swrast;
-
-   /* Old dri can't handle GLX 1.3+ drawable constructors. */
-   if (xDrawable != drawable)
-      return NULL;
-
-   pdp = Xmalloc(sizeof(*pdp));
-   if (!pdp)
-      return NULL;
-
-   pdraw = &(pdp->base);
-   pdraw->xDrawable = xDrawable;
-   pdraw->drawable = drawable;
-   pdraw->psc = psc;
-
-   XCreateDrawable(pdp, psc->dpy, xDrawable, modes->visualID);
-
-   /* Create a new drawable */
-   pdraw->driDrawable =
-      (*swrast->createNewDrawable) (psc->__driScreen, config->driConfig, pdp);
-
-   if (!pdraw->driDrawable) {
-      XDestroyDrawable(pdp, psc->dpy, xDrawable);
-      Xfree(pdp);
-      return NULL;
-   }
-
-   pdraw->destroyDrawable = driDestroyDrawable;
-
-   return pdraw;
-}
-
-static void
-driSwapBuffers(__GLXDRIdrawable * pdraw)
-{
-   (*pdraw->psc->core->swapBuffers) (pdraw->driDrawable);
-}
-
-static void
-driDestroyScreen(__GLXscreenConfigs * psc)
-{
-   /* Free the direct rendering per screen data */
-   (*psc->core->destroyScreen) (psc->__driScreen);
-   psc->__driScreen = NULL;
-   if (psc->driver)
-      dlclose(psc->driver);
-}
-
-static __GLXDRIscreen *
-driCreateScreen(__GLXscreenConfigs * psc, int screen,
-                __GLXdisplayPrivate * priv)
-{
-   __GLXDRIscreen *psp;
-   const __DRIconfig **driver_configs;
-   const __DRIextension **extensions;
-   const char *driverName = "swrast";
-   int i;
-
-   psp = Xcalloc(1, sizeof *psp);
-   if (psp == NULL)
-      return NULL;
-
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
-   psc->driver = driOpenDriver(driverName);
-   if (psc->driver == NULL)
-      goto handle_error;
-
-   extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
-   if (extensions == NULL) {
-      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
-      goto handle_error;
-   }
-
-   for (i = 0; extensions[i]; i++) {
-      if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
-         psc->core = (__DRIcoreExtension *) extensions[i];
-      if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0)
-         psc->swrast = (__DRIswrastExtension *) extensions[i];
-   }
-
-   if (psc->core == NULL || psc->swrast == NULL) {
-      ErrorMessageF("core dri extension not found\n");
-      goto handle_error;
-   }
-
-   psc->__driScreen =
-      psc->swrast->createNewScreen(screen,
-                                   loader_extensions, &driver_configs, psc);
-   if (psc->__driScreen == NULL) {
-      ErrorMessageF("failed to create dri screen\n");
-      goto handle_error;
-   }
-
-   driBindExtensions(psc);
-   driBindCommonExtensions(psc);
-
-   psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
-   psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
-
-   psc->driver_configs = driver_configs;
-
-   psp->destroyScreen = driDestroyScreen;
-   psp->createContext = driCreateContext;
-   psp->createDrawable = driCreateDrawable;
-   psp->swapBuffers = driSwapBuffers;
-   psp->waitX = NULL;
-   psp->waitGL = NULL;
-
-   return psp;
-
- handle_error:
-   Xfree(psp);
-
-   if (psc->driver)
-      dlclose(psc->driver);
-
-   ErrorMessageF("reverting to indirect rendering\n");
-
-   return NULL;
-}
-
-/* Called from __glXFreeDisplayPrivate.
- */
-static void
-driDestroyDisplay(__GLXDRIdisplay * dpy)
-{
-   Xfree(dpy);
-}
-
-/*
- * Allocate, initialize and return a __DRIdisplayPrivate object.
- * This is called from __glXInitialize() when we are given a new
- * display pointer.
- */
-_X_HIDDEN __GLXDRIdisplay *
-driswCreateDisplay(Display * dpy)
-{
-   __GLXDRIdisplayPrivate *pdpyp;
-
-   pdpyp = Xmalloc(sizeof *pdpyp);
-   if (pdpyp == NULL)
-      return NULL;
-
-   pdpyp->base.destroyDisplay = driDestroyDisplay;
-   pdpyp->base.createScreen = driCreateScreen;
-
-   return &pdpyp->base;
-}
-
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/eval.c b/src/glx/x11/eval.c
deleted file mode 100644 (file)
index 226fb7d..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-
-#include "packrender.h"
-
-/*
-** Routines to pack evaluator maps into the transport buffer.  Maps are
-** allowed to have extra arbitrary data, so these routines extract just
-** the information that the GL needs.
-*/
-
-void
-__glFillMap1f(GLint k, GLint order, GLint stride,
-              const GLfloat * points, GLubyte * pc)
-{
-   if (stride == k) {
-      /* Just copy the data */
-      __GLX_PUT_FLOAT_ARRAY(0, points, order * k);
-   }
-   else {
-      GLint i;
-
-      for (i = 0; i < order; i++) {
-         __GLX_PUT_FLOAT_ARRAY(0, points, k);
-         points += stride;
-         pc += k * __GLX_SIZE_FLOAT32;
-      }
-   }
-}
-
-void
-__glFillMap1d(GLint k, GLint order, GLint stride,
-              const GLdouble * points, GLubyte * pc)
-{
-   if (stride == k) {
-      /* Just copy the data */
-      __GLX_PUT_DOUBLE_ARRAY(0, points, order * k);
-   }
-   else {
-      GLint i;
-      for (i = 0; i < order; i++) {
-         __GLX_PUT_DOUBLE_ARRAY(0, points, k);
-         points += stride;
-         pc += k * __GLX_SIZE_FLOAT64;
-      }
-   }
-}
-
-void
-__glFillMap2f(GLint k, GLint majorOrder, GLint minorOrder,
-              GLint majorStride, GLint minorStride,
-              const GLfloat * points, GLfloat * data)
-{
-   GLint i, j, x;
-
-   if ((minorStride == k) && (majorStride == minorOrder * k)) {
-      /* Just copy the data */
-      __GLX_MEM_COPY(data, points, majorOrder * majorStride *
-                     __GLX_SIZE_FLOAT32);
-      return;
-   }
-   for (i = 0; i < majorOrder; i++) {
-      for (j = 0; j < minorOrder; j++) {
-         for (x = 0; x < k; x++) {
-            data[x] = points[x];
-         }
-         points += minorStride;
-         data += k;
-      }
-      points += majorStride - minorStride * minorOrder;
-   }
-}
-
-void
-__glFillMap2d(GLint k, GLint majorOrder, GLint minorOrder,
-              GLint majorStride, GLint minorStride,
-              const GLdouble * points, GLdouble * data)
-{
-   int i, j, x;
-
-   if ((minorStride == k) && (majorStride == minorOrder * k)) {
-      /* Just copy the data */
-      __GLX_MEM_COPY(data, points, majorOrder * majorStride *
-                     __GLX_SIZE_FLOAT64);
-      return;
-   }
-
-#ifdef __GLX_ALIGN64
-   x = k * __GLX_SIZE_FLOAT64;
-#endif
-   for (i = 0; i < majorOrder; i++) {
-      for (j = 0; j < minorOrder; j++) {
-#ifdef __GLX_ALIGN64
-         __GLX_MEM_COPY(data, points, x);
-#else
-         for (x = 0; x < k; x++) {
-            data[x] = points[x];
-         }
-#endif
-         points += minorStride;
-         data += k;
-      }
-      points += majorStride - minorStride * minorOrder;
-   }
-}
diff --git a/src/glx/x11/glcontextmodes.c b/src/glx/x11/glcontextmodes.c
deleted file mode 100644 (file)
index 232031c..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2003
- * 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 glcontextmodes.c
- * Utility routines for working with \c __GLcontextModes structures.  At
- * some point most or all of these functions will be moved to the Mesa
- * code base.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#if defined(IN_MINI_GLX)
-#include <GL/gl.h>
-#else
-#if defined(HAVE_DIX_CONFIG_H)
-# include <dix-config.h>
-#endif
-#include <X11/X.h>
-#include <GL/glx.h>
-#include "GL/glxint.h"
-#endif
-
-/* Memory macros */
-#if defined(IN_MINI_GLX)
-# include <stdlib.h>
-# include <string.h>
-# define _mesa_malloc(b) malloc(b)
-# define _mesa_free(m) free(m)
-# define _mesa_memset  memset
-#else
-# ifdef XFree86Server
-# include <os.h>
-# include <string.h>
-#  define _mesa_malloc(b) xalloc(b)
-#  define _mesa_free(m)   xfree(m)
-#  define _mesa_memset   memset
-# else
-#  include <X11/Xlibint.h>
-#  define _mesa_memset memset
-#  define _mesa_malloc(b) Xmalloc(b)
-#  define _mesa_free(m) Xfree(m)
-# endif /* XFree86Server */
-#endif /* !defined(IN_MINI_GLX) */
-
-#include "glcontextmodes.h"
-
-#if !defined(IN_MINI_GLX)
-#define NUM_VISUAL_TYPES   6
-
-/**
- * Convert an X visual type to a GLX visual type.
- * 
- * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.)
- *        to be converted.
- * \return If \c visualType is a valid X visual type, a GLX visual type will
- *         be returned.  Otherwise \c GLX_NONE will be returned.
- */
-GLint
-_gl_convert_from_x_visual_type(int visualType)
-{
-   static const int glx_visual_types[NUM_VISUAL_TYPES] = {
-      GLX_STATIC_GRAY, GLX_GRAY_SCALE,
-      GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
-      GLX_TRUE_COLOR, GLX_DIRECT_COLOR
-   };
-
-   return ((unsigned) visualType < NUM_VISUAL_TYPES)
-      ? glx_visual_types[visualType] : GLX_NONE;
-}
-
-
-/**
- * Convert a GLX visual type to an X visual type.
- * 
- * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, 
- *                   \c GLX_STATIC_GRAY, etc.) to be converted.
- * \return If \c visualType is a valid GLX visual type, an X visual type will
- *         be returned.  Otherwise -1 will be returned.
- */
-GLint
-_gl_convert_to_x_visual_type(int visualType)
-{
-   static const int x_visual_types[NUM_VISUAL_TYPES] = {
-      TrueColor, DirectColor,
-      PseudoColor, StaticColor,
-      GrayScale, StaticGray
-   };
-
-   return ((unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES)
-      ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1;
-}
-
-
-/**
- * Copy a GLX visual config structure to a GL context mode structure.  All
- * of the fields in \c config are copied to \c mode.  Additional fields in
- * \c mode that can be derrived from the fields of \c config (i.e.,
- * \c haveDepthBuffer) are also filled in.  The remaining fields in \c mode
- * that cannot be derived are set to default values.
- * 
- * \param mode   Destination GL context mode.
- * \param config Source GLX visual config.
- * 
- * \note
- * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes
- * structure will be set to the \c vid of the \c __GLXvisualConfig structure.
- */
-void
-_gl_copy_visual_to_context_mode(__GLcontextModes * mode,
-                                const __GLXvisualConfig * config)
-{
-   __GLcontextModes *const next = mode->next;
-
-   (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes));
-   mode->next = next;
-
-   mode->visualID = config->vid;
-   mode->visualType = _gl_convert_from_x_visual_type(config->class);
-   mode->xRenderable = GL_TRUE;
-   mode->fbconfigID = config->vid;
-   mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
-
-   mode->rgbMode = (config->rgba != 0);
-   mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
-   mode->colorIndexMode = !(mode->rgbMode);
-   mode->doubleBufferMode = (config->doubleBuffer != 0);
-   mode->stereoMode = (config->stereo != 0);
-
-   mode->haveAccumBuffer = ((config->accumRedSize +
-                             config->accumGreenSize +
-                             config->accumBlueSize +
-                             config->accumAlphaSize) > 0);
-   mode->haveDepthBuffer = (config->depthSize > 0);
-   mode->haveStencilBuffer = (config->stencilSize > 0);
-
-   mode->redBits = config->redSize;
-   mode->greenBits = config->greenSize;
-   mode->blueBits = config->blueSize;
-   mode->alphaBits = config->alphaSize;
-   mode->redMask = config->redMask;
-   mode->greenMask = config->greenMask;
-   mode->blueMask = config->blueMask;
-   mode->alphaMask = config->alphaMask;
-   mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
-   mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
-
-   mode->accumRedBits = config->accumRedSize;
-   mode->accumGreenBits = config->accumGreenSize;
-   mode->accumBlueBits = config->accumBlueSize;
-   mode->accumAlphaBits = config->accumAlphaSize;
-   mode->depthBits = config->depthSize;
-   mode->stencilBits = config->stencilSize;
-
-   mode->numAuxBuffers = config->auxBuffers;
-   mode->level = config->level;
-
-   mode->visualRating = config->visualRating;
-   mode->transparentPixel = config->transparentPixel;
-   mode->transparentRed = config->transparentRed;
-   mode->transparentGreen = config->transparentGreen;
-   mode->transparentBlue = config->transparentBlue;
-   mode->transparentAlpha = config->transparentAlpha;
-   mode->transparentIndex = config->transparentIndex;
-   mode->samples = config->multiSampleSize;
-   mode->sampleBuffers = config->nMultiSampleBuffers;
-   /* mode->visualSelectGroup = config->visualSelectGroup; ? */
-
-   mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
-   mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
-   mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
-      GL_TRUE : GL_FALSE;
-   mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
-   mode->bindToTextureTargets = mode->rgbMode ?
-      GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
-      GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
-   mode->yInverted = GL_FALSE;
-}
-
-
-/**
- * Get data from a GL context mode.
- * 
- * \param mode         GL context mode whose data is to be returned.
- * \param attribute    Attribute of \c mode that is to be returned.
- * \param value_return Location to store the data member of \c mode.
- * \return  If \c attribute is a valid attribute of \c mode, zero is
- *          returned.  Otherwise \c GLX_BAD_ATTRIBUTE is returned.
- */
-int
-_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
-                          int *value_return)
-{
-   switch (attribute) {
-   case GLX_USE_GL:
-      *value_return = GL_TRUE;
-      return 0;
-   case GLX_BUFFER_SIZE:
-      *value_return = mode->rgbBits;
-      return 0;
-   case GLX_RGBA:
-      *value_return = mode->rgbMode;
-      return 0;
-   case GLX_RED_SIZE:
-      *value_return = mode->redBits;
-      return 0;
-   case GLX_GREEN_SIZE:
-      *value_return = mode->greenBits;
-      return 0;
-   case GLX_BLUE_SIZE:
-      *value_return = mode->blueBits;
-      return 0;
-   case GLX_ALPHA_SIZE:
-      *value_return = mode->alphaBits;
-      return 0;
-   case GLX_DOUBLEBUFFER:
-      *value_return = mode->doubleBufferMode;
-      return 0;
-   case GLX_STEREO:
-      *value_return = mode->stereoMode;
-      return 0;
-   case GLX_AUX_BUFFERS:
-      *value_return = mode->numAuxBuffers;
-      return 0;
-   case GLX_DEPTH_SIZE:
-      *value_return = mode->depthBits;
-      return 0;
-   case GLX_STENCIL_SIZE:
-      *value_return = mode->stencilBits;
-      return 0;
-   case GLX_ACCUM_RED_SIZE:
-      *value_return = mode->accumRedBits;
-      return 0;
-   case GLX_ACCUM_GREEN_SIZE:
-      *value_return = mode->accumGreenBits;
-      return 0;
-   case GLX_ACCUM_BLUE_SIZE:
-      *value_return = mode->accumBlueBits;
-      return 0;
-   case GLX_ACCUM_ALPHA_SIZE:
-      *value_return = mode->accumAlphaBits;
-      return 0;
-   case GLX_LEVEL:
-      *value_return = mode->level;
-      return 0;
-   case GLX_TRANSPARENT_TYPE_EXT:
-      *value_return = mode->transparentPixel;
-      return 0;
-   case GLX_TRANSPARENT_RED_VALUE:
-      *value_return = mode->transparentRed;
-      return 0;
-   case GLX_TRANSPARENT_GREEN_VALUE:
-      *value_return = mode->transparentGreen;
-      return 0;
-   case GLX_TRANSPARENT_BLUE_VALUE:
-      *value_return = mode->transparentBlue;
-      return 0;
-   case GLX_TRANSPARENT_ALPHA_VALUE:
-      *value_return = mode->transparentAlpha;
-      return 0;
-   case GLX_TRANSPARENT_INDEX_VALUE:
-      *value_return = mode->transparentIndex;
-      return 0;
-   case GLX_X_VISUAL_TYPE:
-      *value_return = mode->visualType;
-      return 0;
-   case GLX_CONFIG_CAVEAT:
-      *value_return = mode->visualRating;
-      return 0;
-   case GLX_VISUAL_ID:
-      *value_return = mode->visualID;
-      return 0;
-   case GLX_DRAWABLE_TYPE:
-      *value_return = mode->drawableType;
-      return 0;
-   case GLX_RENDER_TYPE:
-      *value_return = mode->renderType;
-      return 0;
-   case GLX_X_RENDERABLE:
-      *value_return = mode->xRenderable;
-      return 0;
-   case GLX_FBCONFIG_ID:
-      *value_return = mode->fbconfigID;
-      return 0;
-   case GLX_MAX_PBUFFER_WIDTH:
-      *value_return = mode->maxPbufferWidth;
-      return 0;
-   case GLX_MAX_PBUFFER_HEIGHT:
-      *value_return = mode->maxPbufferHeight;
-      return 0;
-   case GLX_MAX_PBUFFER_PIXELS:
-      *value_return = mode->maxPbufferPixels;
-      return 0;
-   case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
-      *value_return = mode->optimalPbufferWidth;
-      return 0;
-   case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
-      *value_return = mode->optimalPbufferHeight;
-      return 0;
-   case GLX_SWAP_METHOD_OML:
-      *value_return = mode->swapMethod;
-      return 0;
-   case GLX_SAMPLE_BUFFERS_SGIS:
-      *value_return = mode->sampleBuffers;
-      return 0;
-   case GLX_SAMPLES_SGIS:
-      *value_return = mode->samples;
-      return 0;
-   case GLX_BIND_TO_TEXTURE_RGB_EXT:
-      *value_return = mode->bindToTextureRgb;
-      return 0;
-   case GLX_BIND_TO_TEXTURE_RGBA_EXT:
-      *value_return = mode->bindToTextureRgba;
-      return 0;
-   case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
-      *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
-         GL_FALSE;
-      return 0;
-   case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
-      *value_return = mode->bindToTextureTargets;
-      return 0;
-   case GLX_Y_INVERTED_EXT:
-      *value_return = mode->yInverted;
-      return 0;
-
-      /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
-       * It is ONLY for communication between the GLX client and the GLX
-       * server.
-       */
-   case GLX_VISUAL_SELECT_GROUP_SGIX:
-   default:
-      return GLX_BAD_ATTRIBUTE;
-   }
-}
-#endif /* !defined(IN_MINI_GLX) */
-
-
-/**
- * Allocate a linked list of \c __GLcontextModes structures.  The fields of
- * each structure will be initialized to "reasonable" default values.  In
- * most cases this is the default value defined by table 3.4 of the GLX
- * 1.3 specification.  This means that most values are either initialized to
- * zero or \c GLX_DONT_CARE (which is -1).  As support for additional
- * extensions is added, the new values will be initialized to appropriate
- * values from the extension specification.
- * 
- * \param count         Number of structures to allocate.
- * \param minimum_size  Minimum size of a structure to allocate.  This allows
- *                      for differences in the version of the
- *                      \c __GLcontextModes stucture used in libGL and in a
- *                      DRI-based driver.
- * \returns A pointer to the first element in a linked list of \c count
- *          stuctures on success, or \c NULL on failure.
- * 
- * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
- *          The fundamental assumption is that if the \c minimum_size
- *          specified by the driver and the size of the \c __GLcontextModes
- *          structure in libGL is the same, then the meaning of each byte in
- *          the structure is the same in both places.  \b Be \b careful!
- *          Basically this means that fields have to be added in libGL and
- *          then propagated to drivers.  Drivers should \b never arbitrarilly
- *          extend the \c __GLcontextModes data-structure.
- */
-__GLcontextModes *
-_gl_context_modes_create(unsigned count, size_t minimum_size)
-{
-   const size_t size = (minimum_size > sizeof(__GLcontextModes))
-      ? minimum_size : sizeof(__GLcontextModes);
-   __GLcontextModes *base = NULL;
-   __GLcontextModes **next;
-   unsigned i;
-
-   next = &base;
-   for (i = 0; i < count; i++) {
-      *next = (__GLcontextModes *) _mesa_malloc(size);
-      if (*next == NULL) {
-         _gl_context_modes_destroy(base);
-         base = NULL;
-         break;
-      }
-
-      (void) _mesa_memset(*next, 0, size);
-      (*next)->visualID = GLX_DONT_CARE;
-      (*next)->visualType = GLX_DONT_CARE;
-      (*next)->visualRating = GLX_NONE;
-      (*next)->transparentPixel = GLX_NONE;
-      (*next)->transparentRed = GLX_DONT_CARE;
-      (*next)->transparentGreen = GLX_DONT_CARE;
-      (*next)->transparentBlue = GLX_DONT_CARE;
-      (*next)->transparentAlpha = GLX_DONT_CARE;
-      (*next)->transparentIndex = GLX_DONT_CARE;
-      (*next)->xRenderable = GLX_DONT_CARE;
-      (*next)->fbconfigID = GLX_DONT_CARE;
-      (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
-      (*next)->bindToTextureRgb = GLX_DONT_CARE;
-      (*next)->bindToTextureRgba = GLX_DONT_CARE;
-      (*next)->bindToMipmapTexture = GLX_DONT_CARE;
-      (*next)->bindToTextureTargets = GLX_DONT_CARE;
-      (*next)->yInverted = GLX_DONT_CARE;
-
-      next = &((*next)->next);
-   }
-
-   return base;
-}
-
-
-/**
- * Destroy a linked list of \c __GLcontextModes structures created by
- * \c _gl_context_modes_create.
- * 
- * \param modes  Linked list of structures to be destroyed.  All structres
- *               in the list will be freed.
- */
-void
-_gl_context_modes_destroy(__GLcontextModes * modes)
-{
-   while (modes != NULL) {
-      __GLcontextModes *const next = modes->next;
-
-      _mesa_free(modes);
-      modes = next;
-   }
-}
-
-
-/**
- * Find a context mode matching a Visual ID.
- *
- * \param modes  List list of context-mode structures to be searched.
- * \param vid    Visual ID to be found.
- * \returns A pointer to a context-mode in \c modes if \c vid was found in
- *          the list, or \c NULL if it was not.
- */
-
-__GLcontextModes *
-_gl_context_modes_find_visual(__GLcontextModes * modes, int vid)
-{
-   __GLcontextModes *m;
-
-   for (m = modes; m != NULL; m = m->next)
-      if (m->visualID == vid)
-         return m;
-
-   return NULL;
-}
-
-__GLcontextModes *
-_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid)
-{
-   __GLcontextModes *m;
-
-   for (m = modes; m != NULL; m = m->next)
-      if (m->fbconfigID == fbid)
-         return m;
-
-   return NULL;
-}
-
-/**
- * Determine if two context-modes are the same.  This is intended to be used
- * by libGL implementations to compare to sets of driver generated FBconfigs.
- * 
- * \param a  Context-mode to be compared.
- * \param b  Context-mode to be compared.
- * \returns \c GL_TRUE if the two context-modes are the same.  \c GL_FALSE is
- *          returned otherwise.
- */
-GLboolean
-_gl_context_modes_are_same(const __GLcontextModes * a,
-                           const __GLcontextModes * b)
-{
-   return ((a->rgbMode == b->rgbMode) &&
-           (a->floatMode == b->floatMode) &&
-           (a->colorIndexMode == b->colorIndexMode) &&
-           (a->doubleBufferMode == b->doubleBufferMode) &&
-           (a->stereoMode == b->stereoMode) &&
-           (a->redBits == b->redBits) &&
-           (a->greenBits == b->greenBits) &&
-           (a->blueBits == b->blueBits) && (a->alphaBits == b->alphaBits) &&
-#if 0                           /* For some reason these don't get set on the client-side in libGL. */
-           (a->redMask == b->redMask) &&
-           (a->greenMask == b->greenMask) &&
-           (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) &&
-#endif
-           (a->rgbBits == b->rgbBits) &&
-           (a->indexBits == b->indexBits) &&
-           (a->accumRedBits == b->accumRedBits) &&
-           (a->accumGreenBits == b->accumGreenBits) &&
-           (a->accumBlueBits == b->accumBlueBits) &&
-           (a->accumAlphaBits == b->accumAlphaBits) &&
-           (a->depthBits == b->depthBits) &&
-           (a->stencilBits == b->stencilBits) &&
-           (a->numAuxBuffers == b->numAuxBuffers) &&
-           (a->level == b->level) &&
-           (a->pixmapMode == b->pixmapMode) &&
-           (a->visualRating == b->visualRating) &&
-           (a->transparentPixel == b->transparentPixel) &&
-           ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
-            ((a->transparentRed == b->transparentRed) &&
-             (a->transparentGreen == b->transparentGreen) &&
-             (a->transparentBlue == b->transparentBlue) &&
-             (a->transparentAlpha == b->transparentAlpha))) &&
-           ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
-            (a->transparentIndex == b->transparentIndex)) &&
-           (a->sampleBuffers == b->sampleBuffers) &&
-           (a->samples == b->samples) &&
-           ((a->drawableType & b->drawableType) != 0) &&
-           (a->renderType == b->renderType) &&
-           (a->maxPbufferWidth == b->maxPbufferWidth) &&
-           (a->maxPbufferHeight == b->maxPbufferHeight) &&
-           (a->maxPbufferPixels == b->maxPbufferPixels) &&
-           (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
-           (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
-           (a->swapMethod == b->swapMethod) &&
-           (a->bindToTextureRgb == b->bindToTextureRgb) &&
-           (a->bindToTextureRgba == b->bindToTextureRgba) &&
-           (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
-           (a->bindToTextureTargets == b->bindToTextureTargets) &&
-           (a->yInverted == b->yInverted));
-}
diff --git a/src/glx/x11/glcontextmodes.h b/src/glx/x11/glcontextmodes.h
deleted file mode 100644 (file)
index 6676ae3..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2003
- * 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 glcontextmodes.h
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#ifndef GLCONTEXTMODES_H
-#define GLCONTEXTMODES_H
-
-#include "GL/internal/glcore.h"
-
-#if !defined(IN_MINI_GLX)
-extern GLint _gl_convert_from_x_visual_type(int visualType);
-extern GLint _gl_convert_to_x_visual_type(int visualType);
-extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode,
-                                            const __GLXvisualConfig * config);
-extern int _gl_get_context_mode_data(const __GLcontextModes * mode,
-                                     int attribute, int *value_return);
-#endif /* !defined(IN_MINI_GLX) */
-
-extern __GLcontextModes *_gl_context_modes_create(unsigned count,
-                                                  size_t minimum_size);
-extern void _gl_context_modes_destroy(__GLcontextModes * modes);
-extern __GLcontextModes *_gl_context_modes_find_visual(__GLcontextModes *
-                                                       modes, int vid);
-extern __GLcontextModes *_gl_context_modes_find_fbconfig(__GLcontextModes *
-                                                         modes, int fbid);
-extern GLboolean _gl_context_modes_are_same(const __GLcontextModes * a,
-                                            const __GLcontextModes * b);
-
-#endif /* GLCONTEXTMODES_H */
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
deleted file mode 100644 (file)
index a0a0223..0000000
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
- * (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
- * 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 glx_pbuffer.c
- * Implementation of pbuffer related functions.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <inttypes.h>
-#include "glxclient.h"
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/Xext.h>
-#include <assert.h>
-#include <string.h>
-#include "glxextensions.h"
-
-#define WARN_ONCE_GLX_1_3(a, b) {              \
-               static int warned=1;            \
-               if(warned) {                    \
-                       warn_GLX_1_3((a), b );  \
-                       warned=0;               \
-               }                               \
-       }
-
-/**
- * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
- */
-static void
-warn_GLX_1_3(Display *dpy, const char *function_name)
-{
-   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-
-   if (priv->minorVersion < 3) {
-      fprintf(stderr, 
-             "WARNING: Application calling GLX 1.3 function \"%s\" "
-             "when GLX 1.3 is not supported!  This is an application bug!\n",
-             function_name);
-   }
-}
-
-
-/**
- * Change a drawable's attribute.
- *
- * This function is used to implement \c glXSelectEvent and
- * \c glXSelectEventSGIX.
- *
- * \note
- * This function dynamically determines whether to use the SGIX_pbuffer
- * version of the protocol or the GLX 1.3 version of the protocol.
- *
- * \todo
- * This function needs to be modified to work with direct-rendering drivers.
- */
-static void
-ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
-                        const CARD32 * attribs, size_t num_attribs)
-{
-   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-   CARD32 *output;
-   CARD8 opcode;
-
-   if ((dpy == NULL) || (drawable == 0)) {
-      return;
-   }
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return;
-
-   LockDisplay(dpy);
-
-   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
-      xGLXChangeDrawableAttributesReq *req;
-
-      GetReqExtra(GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req);
-      output = (CARD32 *) (req + 1);
-
-      req->reqType = opcode;
-      req->glxCode = X_GLXChangeDrawableAttributes;
-      req->drawable = drawable;
-      req->numAttribs = (CARD32) num_attribs;
-   }
-   else {
-      xGLXVendorPrivateWithReplyReq *vpreq;
-
-      GetReqExtra(GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq);
-      output = (CARD32 *) (vpreq + 1);
-
-      vpreq->reqType = opcode;
-      vpreq->glxCode = X_GLXVendorPrivateWithReply;
-      vpreq->vendorCode = X_GLXvop_ChangeDrawableAttributesSGIX;
-
-      output[0] = (CARD32) drawable;
-      output++;
-   }
-
-   (void) memcpy(output, attribs, sizeof(CARD32) * 2 * num_attribs);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return;
-}
-
-
-/**
- * Destroy a pbuffer.
- *
- * This function is used to implement \c glXDestroyPbuffer and
- * \c glXDestroyGLXPbufferSGIX.
- *
- * \note
- * This function dynamically determines whether to use the SGIX_pbuffer
- * version of the protocol or the GLX 1.3 version of the protocol.
- *
- * \todo
- * This function needs to be modified to work with direct-rendering drivers.
- */
-static void
-DestroyPbuffer(Display * dpy, GLXDrawable drawable)
-{
-   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-   CARD8 opcode;
-
-   if ((dpy == NULL) || (drawable == 0)) {
-      return;
-   }
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return;
-
-   LockDisplay(dpy);
-
-   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
-      xGLXDestroyPbufferReq *req;
-
-      GetReq(GLXDestroyPbuffer, req);
-      req->reqType = opcode;
-      req->glxCode = X_GLXDestroyPbuffer;
-      req->pbuffer = (GLXPbuffer) drawable;
-   }
-   else {
-      xGLXVendorPrivateWithReplyReq *vpreq;
-      CARD32 *data;
-
-      GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
-      data = (CARD32 *) (vpreq + 1);
-
-      data[0] = (CARD32) drawable;
-
-      vpreq->reqType = opcode;
-      vpreq->glxCode = X_GLXVendorPrivateWithReply;
-      vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX;
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return;
-}
-
-
-#ifdef GLX_DIRECT_RENDERING
-extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
-                                           GLXDrawable drawable,
-                                           int *const scrn_num);
-
-static GLenum
-determineTextureTarget(const int *attribs, int numAttribs)
-{
-   GLenum target = 0;
-   int i;
-
-   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;
-         }
-      }
-   }
-
-   return target;
-}
-
-
-static GLenum
-determineTextureFormat(const int *attribs, int numAttribs)
-{
-   int i;
-
-   for (i = 0; i < numAttribs; i++) {
-      if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
-         return attribs[2 * i + 1];
-   }
-
-   return 0;
-}
-#endif
-
-/**
- * Get a drawable's attribute.
- *
- * This function is used to implement \c glXGetSelectedEvent and
- * \c glXGetSelectedEventSGIX.
- *
- * \note
- * This function dynamically determines whether to use the SGIX_pbuffer
- * version of the protocol or the GLX 1.3 version of the protocol.
- *
- * \todo
- * The number of attributes returned is likely to be small, probably less than
- * 10.  Given that, this routine should try to use an array on the stack to
- * capture the reply rather than always calling Xmalloc.
- *
- * \todo
- * This function needs to be modified to work with direct-rendering drivers.
- */
-static int
-GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
-                     int attribute, unsigned int *value)
-{
-   __GLXdisplayPrivate *priv;
-   xGLXGetDrawableAttributesReply reply;
-   CARD32 *data;
-   CARD8 opcode;
-   unsigned int length;
-   unsigned int i;
-   unsigned int num_attributes;
-   GLboolean use_glx_1_3;
-
-   if ((dpy == NULL) || (drawable == 0)) {
-      return 0;
-   }
-
-   priv = __glXInitialize(dpy);
-   use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
-
-   *value = 0;
-
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return 0;
-
-   LockDisplay(dpy);
-
-   if (use_glx_1_3) {
-      xGLXGetDrawableAttributesReq *req;
-
-      GetReqExtra(GLXGetDrawableAttributes, 4, req);
-      req->reqType = opcode;
-      req->glxCode = X_GLXGetDrawableAttributes;
-      req->drawable = drawable;
-   }
-   else {
-      xGLXVendorPrivateWithReplyReq *vpreq;
-
-      GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
-      data = (CARD32 *) (vpreq + 1);
-      data[0] = (CARD32) drawable;
-
-      vpreq->reqType = opcode;
-      vpreq->glxCode = X_GLXVendorPrivateWithReply;
-      vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
-   }
-
-   _XReply(dpy, (xReply *) & reply, 0, False);
-
-   if (reply.type == X_Error) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return 0;
-   }
-
-   length = reply.length;
-   if (length) {
-      num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
-      data = (CARD32 *) Xmalloc(length * sizeof(CARD32));
-      if (data == NULL) {
-         /* Throw data on the floor */
-         _XEatData(dpy, length);
-      }
-      else {
-         _XRead(dpy, (char *) data, length * sizeof(CARD32));
-
-         /* Search the set of returned attributes for the attribute requested by
-          * the caller.
-          */
-         for (i = 0; i < num_attributes; i++) {
-            if (data[i * 2] == attribute) {
-               *value = data[(i * 2) + 1];
-               break;
-            }
-         }
-
-#ifdef GLX_DIRECT_RENDERING
-         {
-            __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
-
-            if (pdraw != NULL && !pdraw->textureTarget)
-               pdraw->textureTarget =
-                  determineTextureTarget((const int *) data, num_attributes);
-            if (pdraw != NULL && !pdraw->textureFormat)
-               pdraw->textureFormat =
-                  determineTextureFormat((const int *) data, num_attributes);
-         }
-#endif
-
-         Xfree(data);
-      }
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return 0;
-}
-
-/**
- * Create a non-pbuffer GLX drawable.
- *
- * \todo
- * This function needs to be modified to work with direct-rendering drivers.
- */
-static GLXDrawable
-CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig,
-               Drawable drawable, const int *attrib_list, CARD8 glxCode)
-{
-   xGLXCreateWindowReq *req;
-   CARD32 *data;
-   unsigned int i;
-   CARD8 opcode;
-
-   i = 0;
-   if (attrib_list) {
-      while (attrib_list[i * 2] != None)
-         i++;
-   }
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return None;
-
-   LockDisplay(dpy);
-   GetReqExtra(GLXCreateWindow, 8 * i, req);
-   data = (CARD32 *) (req + 1);
-
-   req->reqType = opcode;
-   req->glxCode = glxCode;
-   req->screen = (CARD32) fbconfig->screen;
-   req->fbconfig = fbconfig->fbconfigID;
-   req->window = (CARD32) drawable;
-   req->glxwindow = (GLXWindow) XAllocID(dpy);
-   req->numAttribs = (CARD32) i;
-
-   memcpy(data, attrib_list, 8 * i);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-#ifdef GLX_DIRECT_RENDERING
-   do {
-      /* FIXME: Maybe delay __DRIdrawable creation until the drawable
-       * is actually bound to a context... */
-
-      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
-      __GLXDRIdrawable *pdraw;
-      __GLXscreenConfigs *psc;
-
-      psc = &priv->screenConfigs[fbconfig->screen];
-      if (psc->driScreen == NULL)
-         break;
-      pdraw = psc->driScreen->createDrawable(psc, drawable,
-                                             req->glxwindow, fbconfig);
-      if (pdraw == NULL) {
-         fprintf(stderr, "failed to create drawable\n");
-         break;
-      }
-
-      if (__glxHashInsert(psc->drawHash, req->glxwindow, pdraw)) {
-         (*pdraw->destroyDrawable) (pdraw);
-         return None;           /* FIXME: Check what we're supposed to do here... */
-      }
-
-      pdraw->textureTarget = determineTextureTarget(attrib_list, i);
-      pdraw->textureFormat = determineTextureFormat(attrib_list, i);
-   } while (0);
-#endif
-
-   return (GLXDrawable) req->glxwindow;
-}
-
-
-/**
- * Destroy a non-pbuffer GLX drawable.
- *
- * \todo
- * This function needs to be modified to work with direct-rendering drivers.
- */
-static void
-DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode)
-{
-   xGLXDestroyPbufferReq *req;
-   CARD8 opcode;
-
-   if ((dpy == NULL) || (drawable == 0)) {
-      return;
-   }
-
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return;
-
-   LockDisplay(dpy);
-
-   GetReqExtra(GLXDestroyPbuffer, 4, req);
-   req->reqType = opcode;
-   req->glxCode = glxCode;
-   req->pbuffer = (GLXPbuffer) drawable;
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-#ifdef GLX_DIRECT_RENDERING
-   {
-      int screen;
-      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
-      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-      __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
-
-      if (pdraw != NULL) {
-         (*pdraw->destroyDrawable) (pdraw);
-         __glxHashDelete(psc->drawHash, drawable);
-      }
-   }
-#endif
-
-   return;
-}
-
-
-/**
- * Create a pbuffer.
- *
- * This function is used to implement \c glXCreatePbuffer and
- * \c glXCreateGLXPbufferSGIX.
- *
- * \note
- * This function dynamically determines whether to use the SGIX_pbuffer
- * version of the protocol or the GLX 1.3 version of the protocol.
- *
- * \todo
- * This function needs to be modified to work with direct-rendering drivers.
- */
-static GLXDrawable
-CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig,
-              unsigned int width, unsigned int height,
-              const int *attrib_list, GLboolean size_in_attribs)
-{
-   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-   GLXDrawable id = 0;
-   CARD32 *data;
-   CARD8 opcode;
-   unsigned int i;
-
-   i = 0;
-   if (attrib_list) {
-      while (attrib_list[i * 2])
-         i++;
-   }
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return None;
-
-   LockDisplay(dpy);
-   id = XAllocID(dpy);
-
-   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
-      xGLXCreatePbufferReq *req;
-      unsigned int extra = (size_in_attribs) ? 0 : 2;
-
-      GetReqExtra(GLXCreatePbuffer, (8 * (i + extra)), req);
-      data = (CARD32 *) (req + 1);
-
-      req->reqType = opcode;
-      req->glxCode = X_GLXCreatePbuffer;
-      req->screen = (CARD32) fbconfig->screen;
-      req->fbconfig = fbconfig->fbconfigID;
-      req->pbuffer = (GLXPbuffer) id;
-      req->numAttribs = (CARD32) (i + extra);
-
-      if (!size_in_attribs) {
-         data[(2 * i) + 0] = GLX_PBUFFER_WIDTH;
-         data[(2 * i) + 1] = width;
-         data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT;
-         data[(2 * i) + 3] = height;
-         data += 4;
-      }
-   }
-   else {
-      xGLXVendorPrivateReq *vpreq;
-
-      GetReqExtra(GLXVendorPrivate, 20 + (8 * i), vpreq);
-      data = (CARD32 *) (vpreq + 1);
-
-      vpreq->reqType = opcode;
-      vpreq->glxCode = X_GLXVendorPrivate;
-      vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX;
-
-      data[0] = (CARD32) fbconfig->screen;
-      data[1] = (CARD32) fbconfig->fbconfigID;
-      data[2] = (CARD32) id;
-      data[3] = (CARD32) width;
-      data[4] = (CARD32) height;
-      data += 5;
-   }
-
-   (void) memcpy(data, attrib_list, sizeof(CARD32) * 2 * i);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return id;
-}
-
-
-/**
- * Create a new pbuffer.
- */
-PUBLIC GLXPbufferSGIX
-glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
-                        unsigned int width, unsigned int height,
-                        int *attrib_list)
-{
-   return (GLXPbufferSGIX) CreatePbuffer(dpy, (__GLcontextModes *) config,
-                                         width, height,
-                                         attrib_list, GL_FALSE);
-}
-
-
-/**
- * Create a new pbuffer.
- */
-PUBLIC GLXPbuffer
-glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
-{
-   int i, width, height;
-
-   width = 0;
-   height = 0;
-
-   WARN_ONCE_GLX_1_3(dpy, __func__);
-
-   for (i = 0; attrib_list[i * 2]; i++) {
-      switch (attrib_list[i * 2]) {
-      case GLX_PBUFFER_WIDTH:
-         width = attrib_list[i * 2 + 1];
-         break;
-      case GLX_PBUFFER_HEIGHT:
-         height = attrib_list[i * 2 + 1];
-         break;
-      }
-   }
-
-   return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config,
-                                     width, height, attrib_list, GL_TRUE);
-}
-
-
-/**
- * Destroy an existing pbuffer.
- */
-PUBLIC void
-glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf)
-{
-   DestroyPbuffer(dpy, pbuf);
-}
-
-
-/**
- * Query an attribute of a drawable.
- */
-PUBLIC void
-glXQueryDrawable(Display * dpy, GLXDrawable drawable,
-                 int attribute, unsigned int *value)
-{
-   WARN_ONCE_GLX_1_3(dpy, __func__);
-   GetDrawableAttribute(dpy, drawable, attribute, value);
-}
-
-
-/**
- * Query an attribute of a pbuffer.
- */
-PUBLIC int
-glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
-                       int attribute, unsigned int *value)
-{
-   return GetDrawableAttribute(dpy, drawable, attribute, value);
-}
-
-
-/**
- * Select the event mask for a drawable.
- */
-PUBLIC void
-glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
-{
-   CARD32 attribs[2];
-
-   attribs[0] = (CARD32) GLX_EVENT_MASK;
-   attribs[1] = (CARD32) mask;
-
-   ChangeDrawableAttribute(dpy, drawable, attribs, 1);
-}
-
-
-/**
- * Get the selected event mask for a drawable.
- */
-PUBLIC void
-glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
-{
-   unsigned int value;
-
-
-   /* The non-sense with value is required because on LP64 platforms
-    * sizeof(unsigned int) != sizeof(unsigned long).  On little-endian
-    * we could just type-cast the pointer, but why?
-    */
-
-   GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
-   *mask = value;
-}
-
-
-PUBLIC GLXPixmap
-glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
-                const int *attrib_list)
-{
-   WARN_ONCE_GLX_1_3(dpy, __func__);
-
-   return CreateDrawable(dpy, (__GLcontextModes *) config,
-                         (Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
-}
-
-
-PUBLIC GLXWindow
-glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
-                const int *attrib_list)
-{
-   WARN_ONCE_GLX_1_3(dpy, __func__);
-
-   return CreateDrawable(dpy, (__GLcontextModes *) config,
-                         (Drawable) win, attrib_list, X_GLXCreateWindow);
-}
-
-
-PUBLIC void
-glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
-{
-   WARN_ONCE_GLX_1_3(dpy, __func__);
-
-   DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
-}
-
-
-PUBLIC void
-glXDestroyWindow(Display * dpy, GLXWindow win)
-{
-   WARN_ONCE_GLX_1_3(dpy, __func__);
-
-   DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
-}
-
-
-PUBLIC
-GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
-               (Display * dpy, GLXPbufferSGIX pbuf),
-               (dpy, pbuf), glXDestroyPbuffer)
-
-PUBLIC
-GLX_ALIAS_VOID(glXSelectEventSGIX,
-               (Display * dpy, GLXDrawable drawable,
-                unsigned long mask), (dpy, drawable, mask), glXSelectEvent)
-
-PUBLIC
-GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
-               (Display * dpy, GLXDrawable drawable,
-                unsigned long *mask), (dpy, drawable, mask),
-               glXGetSelectedEvent)
-
diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c
deleted file mode 100644 (file)
index efad13d..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * (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
- * 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 glx_query.c
- * Generic utility functions to query internal data from the server.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "glxclient.h"
-
-#if defined(USE_XCB)
-# include <X11/Xlib-xcb.h>
-# include <xcb/xcb.h>
-# include <xcb/glx.h>
-#endif
-
-#ifdef USE_XCB
-
-/**
- * Exchange a protocol request for glXQueryServerString.
- */
-char *
-__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
-{
-   xcb_connection_t *c = XGetXCBConnection(dpy);
-   xcb_glx_query_server_string_reply_t *reply =
-      xcb_glx_query_server_string_reply(c,
-                                        xcb_glx_query_server_string(c,
-                                                                    screen,
-                                                                    name),
-                                        NULL);
-
-   /* The spec doesn't mention this, but the Xorg server replies with
-    * a string already terminated with '\0'. */
-   uint32_t len = xcb_glx_query_server_string_string_length(reply);
-   char *buf = Xmalloc(len);
-   memcpy(buf, xcb_glx_query_server_string_string(reply), len);
-   free(reply);
-
-   return buf;
-}
-
-/**
- * Exchange a protocol request for glGetString.
- */
-char *
-__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
-{
-   xcb_connection_t *c = XGetXCBConnection(dpy);
-   xcb_glx_get_string_reply_t *reply = xcb_glx_get_string_reply(c,
-                                                                xcb_glx_get_string
-                                                                (c,
-                                                                 contextTag,
-                                                                 name),
-                                                                NULL);
-
-   /* The spec doesn't mention this, but the Xorg server replies with
-    * a string already terminated with '\0'. */
-   uint32_t len = xcb_glx_get_string_string_length(reply);
-   char *buf = Xmalloc(len);
-   memcpy(buf, xcb_glx_get_string_string(reply), len);
-   free(reply);
-
-   return buf;
-}
-
-#else
-
-/**
- * GLX protocol structure for the ficticious "GXLGenericGetString" request.
- *
- * This is a non-existant protocol packet.  It just so happens that all of
- * the real protocol packets used to request a string from the server have
- * an identical binary layout.  The only difference between them is the
- * meaning of the \c for_whom field and the value of the \c glxCode.
- */
-typedef struct GLXGenericGetString
-{
-   CARD8 reqType;
-   CARD8 glxCode;
-   CARD16 length B16;
-   CARD32 for_whom B32;
-   CARD32 name B32;
-} xGLXGenericGetStringReq;
-
-/* These defines are only needed to make the GetReq macro happy.
- */
-#define sz_xGLXGenericGetStringReq 12
-#define X_GLXGenericGetString 0
-
-/**
- * Query the Server GLX string.
- * This routine will allocate the necessay space for the string.
- */
-static char *
-__glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
-                         CARD32 for_whom, CARD32 name)
-{
-   xGLXGenericGetStringReq *req;
-   xGLXSingleReply reply;
-   int length;
-   int numbytes;
-   char *buf;
-
-
-   LockDisplay(dpy);
-
-
-   /* All of the GLX protocol requests for getting a string from the server
-    * look the same.  The exact meaning of the for_whom field is usually
-    * either the screen number (for glXQueryServerString) or the context tag
-    * (for GLXSingle).
-    */
-
-   GetReq(GLXGenericGetString, req);
-   req->reqType = opcode;
-   req->glxCode = glxCode;
-   req->for_whom = for_whom;
-   req->name = name;
-
-   _XReply(dpy, (xReply *) & reply, 0, False);
-
-   length = reply.length * 4;
-   numbytes = reply.size;
-
-   buf = (char *) Xmalloc(numbytes);
-   if (buf != NULL) {
-      _XRead(dpy, buf, numbytes);
-      length -= numbytes;
-   }
-
-   _XEatData(dpy, length);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return buf;
-}
-
-char *
-__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
-{
-   return __glXGetStringFromServer(dpy, opcode,
-                                   X_GLXQueryServerString, screen, name);
-}
-
-char *
-__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
-{
-   return __glXGetStringFromServer(dpy, opcode, X_GLsop_GetString,
-                                   contextTag, name);
-}
-
-#endif /* USE_XCB */
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
deleted file mode 100644 (file)
index e0b286b..0000000
+++ /dev/null
@@ -1,803 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file glxclient.h
- * Direct rendering support added by Precision Insight, Inc.
- *
- * \author Kevin E. Martin <kevin@precisioninsight.com>
- */
-
-#ifndef _GLX_client_h_
-#define _GLX_client_h_
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/extutil.h>
-#define GLX_GLXEXT_PROTOTYPES
-#include <GL/glx.h>
-#include <GL/glxext.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#ifdef WIN32
-#include <stdint.h>
-#endif
-#include "GL/glxint.h"
-#include "GL/glxproto.h"
-#include "GL/internal/glcore.h"
-#include "glapi/glapitable.h"
-#include "glxhash.h"
-#if defined( PTHREADS )
-# include <pthread.h>
-#endif
-
-#include "glxextensions.h"
-
-
-/* If we build the library with gcc's -fvisibility=hidden flag, we'll
- * use the PUBLIC macro to mark functions that are to be exported.
- *
- * We also need to define a USED attribute, so the optimizer doesn't
- * inline a static function that we later use in an alias. - ajax
- */
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
-#  define PUBLIC __attribute__((visibility("default")))
-#  define USED __attribute__((used))
-#else
-#  define PUBLIC
-#  define USED
-#endif
-
-
-
-#define GLX_MAJOR_VERSION 1       /* current version numbers */
-#define GLX_MINOR_VERSION 4
-
-#define __GLX_MAX_TEXTURE_UNITS 32
-
-typedef struct __GLXscreenConfigsRec __GLXscreenConfigs;
-typedef struct __GLXcontextRec __GLXcontext;
-typedef struct __GLXdrawableRec __GLXdrawable;
-typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
-typedef struct _glapi_table __GLapi;
-
-/************************************************************************/
-
-#ifdef GLX_DIRECT_RENDERING
-
-#define containerOf(ptr, type, member)              \
-    (type *)( (char *)ptr - offsetof(type,member) )
-
-#include <GL/internal/dri_interface.h>
-
-
-/**
- * Display dependent methods.  This structure is initialized during the
- * \c driCreateDisplay call.
- */
-typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
-typedef struct __GLXDRIscreenRec __GLXDRIscreen;
-typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
-typedef struct __GLXDRIcontextRec __GLXDRIcontext;
-
-#include "glxextensions.h"
-
-struct __GLXDRIdisplayRec
-{
-    /**
-     * Method to destroy the private DRI display data.
-     */
-   void (*destroyDisplay) (__GLXDRIdisplay * display);
-
-   __GLXDRIscreen *(*createScreen) (__GLXscreenConfigs * psc, int screen,
-                                    __GLXdisplayPrivate * priv);
-};
-
-struct __GLXDRIscreenRec {
-
-   void (*destroyScreen)(__GLXscreenConfigs *psc);
-
-   __GLXDRIcontext *(*createContext)(__GLXscreenConfigs *psc,
-                                    const __GLcontextModes *mode,
-                                    GLXContext gc,
-                                    GLXContext shareList, int renderType);
-
-   __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
-                                      XID drawable,
-                                      GLXDrawable glxDrawable,
-                                      const __GLcontextModes *modes);
-
-   int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc,
-                         int64_t divisor, int64_t remainder);
-   void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
-                        int x, int y, int width, int height);
-   void (*waitX)(__GLXDRIdrawable *pdraw);
-   void (*waitGL)(__GLXDRIdrawable *pdraw);
-   int (*getDrawableMSC)(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
-                        int64_t *ust, int64_t *msc, int64_t *sbc);
-   int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc,
-                    int64_t divisor, int64_t remainder, int64_t *ust,
-                    int64_t *msc, int64_t *sbc);
-   int (*waitForSBC)(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
-                    int64_t *msc, int64_t *sbc);
-   void (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval);
-   int (*getSwapInterval)(__GLXDRIdrawable *pdraw);
-};
-
-struct __GLXDRIcontextRec
-{
-   void (*destroyContext) (__GLXDRIcontext * context,
-                           __GLXscreenConfigs * psc, Display * dpy);
-     Bool(*bindContext) (__GLXDRIcontext * context, __GLXDRIdrawable * pdraw,
-                         __GLXDRIdrawable * pread);
-
-   void (*unbindContext) (__GLXDRIcontext * context);
-};
-
-struct __GLXDRIdrawableRec
-{
-   void (*destroyDrawable) (__GLXDRIdrawable * drawable);
-
-   XID xDrawable;
-   XID drawable;
-   __GLXscreenConfigs *psc;
-   GLenum textureTarget;
-   __DRIdrawable *driDrawable;
-   GLenum textureFormat;        /* EXT_texture_from_pixmap support */
-};
-
-/*
-** Function to create and DRI display data and initialize the display
-** dependent methods.
-*/
-extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
-extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
-extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
-
-extern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
-
-/*
-** Functions to obtain driver configuration information from a direct
-** rendering client application
-*/
-extern const char *glXGetScreenDriver(Display * dpy, int scrNum);
-
-extern const char *glXGetDriverConfig(const char *driverName);
-
-#endif
-
-/************************************************************************/
-
-#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
-
-typedef struct __GLXpixelStoreModeRec
-{
-   GLboolean swapEndian;
-   GLboolean lsbFirst;
-   GLuint rowLength;
-   GLuint imageHeight;
-   GLuint imageDepth;
-   GLuint skipRows;
-   GLuint skipPixels;
-   GLuint skipImages;
-   GLuint alignment;
-} __GLXpixelStoreMode;
-
-
-typedef struct __GLXattributeRec
-{
-   GLuint mask;
-
-    /**
-     * Pixel storage state.  Most of the pixel store mode state is kept
-     * here and used by the client code to manage the packing and
-     * unpacking of data sent to/received from the server.
-     */
-   __GLXpixelStoreMode storePack, storeUnpack;
-
-    /**
-     * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
-     * disabled?
-     */
-   GLboolean NoDrawArraysProtocol;
-
-    /**
-     * Vertex Array storage state.  The vertex array component
-     * state is stored here and is used to manage the packing of
-     * DrawArrays data sent to the server.
-     */
-   struct array_state_vector *array_state;
-} __GLXattribute;
-
-typedef struct __GLXattributeMachineRec
-{
-   __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
-   __GLXattribute **stackPointer;
-} __GLXattributeMachine;
-
-/**
- * GLX state that needs to be kept on the client.  One of these records
- * exist for each context that has been made current by this client.
- */
-struct __GLXcontextRec
-{
-    /**
-     * \name Drawing command buffer.
-     *
-     * Drawing commands are packed into this buffer before being sent as a
-     * single GLX protocol request.  The buffer is sent when it overflows or
-     * is flushed by \c __glXFlushRenderBuffer.  \c pc is the next location
-     * in the buffer to be filled.  \c limit is described above in the buffer
-     * slop discussion.
-     *
-     * Commands that require large amounts of data to be transfered will
-     * also use this buffer to hold a header that describes the large
-     * command.
-     *
-     * These must be the first 6 fields since they are static initialized
-     * in the dummy context in glxext.c
-     */
-   /*@{ */
-   GLubyte *buf;
-   GLubyte *pc;
-   GLubyte *limit;
-   GLubyte *bufEnd;
-   GLint bufSize;
-   /*@} */
-
-    /**
-     * The XID of this rendering context.  When the context is created a
-     * new XID is allocated.  This is set to None when the context is
-     * destroyed but is still current to some thread. In this case the
-     * context will be freed on next MakeCurrent.
-     */
-   XID xid;
-
-    /**
-     * The XID of the \c shareList context.
-     */
-   XID share_xid;
-
-    /**
-     * Screen number.
-     */
-   GLint screen;
-   __GLXscreenConfigs *psc;
-
-    /**
-     * \c GL_TRUE if the context was created with ImportContext, which
-     * means the server-side context was created by another X client.
-     */
-   GLboolean imported;
-
-    /**
-     * The context tag returned by MakeCurrent when this context is made
-     * current. This tag is used to identify the context that a thread has
-     * current so that proper server context management can be done.  It is
-     * used for all context specific commands (i.e., \c Render, \c RenderLarge,
-     * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
-     * context)).
-     */
-   GLXContextTag currentContextTag;
-
-    /**
-     * \name Rendering mode
-     *
-     * The rendering mode is kept on the client as well as the server.
-     * When \c glRenderMode is called, the buffer associated with the
-     * previous rendering mode (feedback or select) is filled.
-     */
-   /*@{ */
-   GLenum renderMode;
-   GLfloat *feedbackBuf;
-   GLuint *selectBuf;
-   /*@} */
-
-    /**
-     * This is \c GL_TRUE if the pixel unpack modes are such that an image
-     * can be unpacked from the clients memory by just copying.  It may
-     * still be true that the server will have to do some work.  This
-     * just promises that a straight copy will fetch the correct bytes.
-     */
-   GLboolean fastImageUnpack;
-
-    /**
-     * Fill newImage with the unpacked form of \c oldImage getting it
-     * ready for transport to the server.
-     */
-   void (*fillImage) (__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
-                      GLenum, const GLvoid *, GLubyte *, GLubyte *);
-
-    /**
-     * Client side attribs.
-     */
-   __GLXattributeMachine attributes;
-
-    /**
-     * Client side error code.  This is set when client side gl API
-     * routines need to set an error because of a bad enumerant or
-     * running out of memory, etc.
-     */
-   GLenum error;
-
-    /**
-     * Whether this context does direct rendering.
-     */
-   Bool isDirect;
-
-    /**
-     * \c dpy of current display for this context.  Will be \c NULL if not
-     * current to any display, or if this is the "dummy context".
-     */
-   Display *currentDpy;
-
-    /**
-     * The current drawable for this context.  Will be None if this
-     * context is not current to any drawable.  currentReadable is below.
-     */
-   GLXDrawable currentDrawable;
-
-    /**
-     * \name GL Constant Strings
-     *
-     * Constant strings that describe the server implementation
-     * These pertain to GL attributes, not to be confused with
-     * GLX versioning attributes.
-     */
-   /*@{ */
-   GLubyte *vendor;
-   GLubyte *renderer;
-   GLubyte *version;
-   GLubyte *extensions;
-   /*@} */
-
-    /**
-     * Record the dpy this context was created on for later freeing
-     */
-   Display *createDpy;
-
-    /**
-     * Maximum small render command size.  This is the smaller of 64k and
-     * the size of the above buffer.
-     */
-   GLint maxSmallRenderCommandSize;
-
-    /**
-     * Major opcode for the extension.  Copied here so a lookup isn't
-     * needed.
-     */
-   GLint majorOpcode;
-
-    /**
-     * Pointer to the mode used to create this context.
-     */
-   const __GLcontextModes *mode;
-
-#ifdef GLX_DIRECT_RENDERING
-   __GLXDRIcontext *driContext;
-   __DRIcontext *__driContext;
-#endif
-
-    /**
-     * The current read-drawable for this context.  Will be None if this
-     * context is not current to any drawable.
-     *
-     * \since Internal API version 20030606.
-     */
-   GLXDrawable currentReadable;
-
-   /**
-    * Pointer to client-state data that is private to libGL.  This is only
-    * used for indirect rendering contexts.
-    *
-    * No internal API version change was made for this change.  Client-side
-    * drivers should NEVER use this data or even care that it exists.
-    */
-   void *client_state_private;
-
-   /**
-    * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
-    */
-   int renderType;
-
-   /**
-    * \name Raw server GL version
-    *
-    * True core GL version supported by the server.  This is the raw value
-    * returned by the server, and it may not reflect what is actually
-    * supported (or reported) by the client-side library.
-    */
-   /*@{ */
-   int server_major;        /**< Major version number. */
-   int server_minor;        /**< Minor version number. */
-   /*@} */
-
-   /**
-    * Thread ID we're currently current in. Zero if none.
-    */
-   unsigned long thread_id;
-
-   char gl_extension_bits[__GL_EXT_BYTES];
-};
-
-#define __glXSetError(gc,code)  \
-   if (!(gc)->error) {          \
-      (gc)->error = code;       \
-   }
-
-extern void __glFreeAttributeState(__GLXcontext *);
-
-/************************************************************************/
-
-/**
- * The size of the largest drawing command known to the implementation
- * that will use the GLXRender GLX command.  In this case it is
- * \c glPolygonStipple.
- */
-#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
-
-/**
- * To keep the implementation fast, the code uses a "limit" pointer
- * to determine when the drawing command buffer is too full to hold
- * another fixed size command.  This constant defines the amount of
- * space that must always be available in the drawing command buffer
- * at all times for the implementation to work.  It is important that
- * the number be just large enough, but not so large as to reduce the
- * efficacy of the buffer.  The "+32" is just to keep the code working
- * in case somebody counts wrong.
- */
-#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
-
-/**
- * This implementation uses a smaller threshold for switching
- * to the RenderLarge protocol than the protcol requires so that
- * large copies don't occur.
- */
-#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
-
-/**
- * One of these records exists per screen of the display.  It contains
- * a pointer to the config data for that screen (if the screen supports GL).
- */
-struct __GLXscreenConfigsRec
-{
-    /**
-     * GLX extension string reported by the X-server.
-     */
-   const char *serverGLXexts;
-
-    /**
-     * GLX extension string to be reported to applications.  This is the
-     * set of extensions that the application can actually use.
-     */
-   char *effectiveGLXexts;
-
-#ifdef GLX_DIRECT_RENDERING
-    /**
-     * Per screen direct rendering interface functions and data.
-     */
-   __DRIscreen *__driScreen;
-   const __DRIcoreExtension *core;
-   const __DRIlegacyExtension *legacy;
-   const __DRIswrastExtension *swrast;
-   const __DRIdri2Extension *dri2;
-   __glxHashTable *drawHash;
-   Display *dpy;
-   int scr, fd;
-   void *driver;
-
-   __GLXDRIscreen *driScreen;
-
-   const __DRIconfig **driver_configs;
-
-#ifdef __DRI_COPY_SUB_BUFFER
-   const __DRIcopySubBufferExtension *driCopySubBuffer;
-#endif
-
-#ifdef __DRI_SWAP_CONTROL
-   const __DRIswapControlExtension *swapControl;
-#endif
-
-#ifdef __DRI_ALLOCATE
-   const __DRIallocateExtension *allocate;
-#endif
-
-#ifdef __DRI_FRAME_TRACKING
-   const __DRIframeTrackingExtension *frameTracking;
-#endif
-
-#ifdef __DRI_MEDIA_STREAM_COUNTER
-   const __DRImediaStreamCounterExtension *msc;
-#endif
-
-#ifdef __DRI_TEX_BUFFER
-   const __DRItexBufferExtension *texBuffer;
-#endif
-
-#ifdef __DRI2_FLUSH
-   const __DRI2flushExtension *f;
-#endif
-
-#endif
-
-    /**
-     * Linked list of glx visuals and  fbconfigs for this screen.
-     */
-   __GLcontextModes *visuals, *configs;
-
-    /**
-     * Per-screen dynamic GLX extension tracking.  The \c direct_support
-     * field only contains enough bits for 64 extensions.  Should libGL
-     * ever need to track more than 64 GLX extensions, we can safely grow
-     * this field.  The \c __GLXscreenConfigs structure is not used outside
-     * libGL.
-     */
-   /*@{ */
-   unsigned char direct_support[8];
-   GLboolean ext_list_first_time;
-   /*@} */
-
-};
-
-/**
- * Per display private data.  One of these records exists for each display
- * that is using the OpenGL (GLX) extension.
- */
-struct __GLXdisplayPrivateRec
-{
-    /**
-     * Back pointer to the display
-     */
-   Display *dpy;
-
-    /**
-     * The \c majorOpcode is common to all connections to the same server.
-     * It is also copied into the context structure.
-     */
-   int majorOpcode;
-
-    /**
-     * \name Server Version
-     *
-     * Major and minor version returned by the server during initialization.
-     */
-   /*@{ */
-   int majorVersion, minorVersion;
-   /*@} */
-
-    /**
-     * \name Storage for the servers GLX vendor and versions strings.
-     *
-     * These are the same for all screens on this display. These fields will
-     * be filled in on demand.
-     */
-   /*@{ */
-   const char *serverGLXvendor;
-   const char *serverGLXversion;
-   /*@} */
-
-    /**
-     * Configurations of visuals for all screens on this display.
-     * Also, per screen data which now includes the server \c GLX_EXTENSION
-     * string.
-     */
-   __GLXscreenConfigs *screenConfigs;
-
-#ifdef GLX_DIRECT_RENDERING
-    /**
-     * Per display direct rendering interface functions and data.
-     */
-   __GLXDRIdisplay *driswDisplay;
-   __GLXDRIdisplay *driDisplay;
-   __GLXDRIdisplay *dri2Display;
-#endif
-};
-
-
-extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);
-
-extern void __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
-                                GLint totalRequests,
-                                const GLvoid * data, GLint dataLen);
-
-extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
-                                  const GLvoid *, GLint);
-
-/* Initialize the GLX extension for dpy */
-extern __GLXdisplayPrivate *__glXInitialize(Display *);
-
-extern void __glXPreferEGL(int state);
-
-/************************************************************************/
-
-extern int __glXDebug;
-
-/* This is per-thread storage in an MT environment */
-#if defined( PTHREADS )
-
-extern void __glXSetCurrentContext(__GLXcontext * c);
-
-# if defined( GLX_USE_TLS )
-
-extern __thread void *__glX_tls_Context
-   __attribute__ ((tls_model("initial-exec")));
-
-#  define __glXGetCurrentContext() __glX_tls_Context
-
-# else
-
-extern __GLXcontext *__glXGetCurrentContext(void);
-
-# endif /* defined( GLX_USE_TLS ) */
-
-#else
-
-extern __GLXcontext *__glXcurrentContext;
-#define __glXGetCurrentContext() __glXcurrentContext
-#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
-
-#endif /* defined( PTHREADS ) */
-
-extern void __glXSetCurrentContextNull(void);
-
-extern void __glXFreeContext(__GLXcontext *);
-
-
-/*
-** Global lock for all threads in this address space using the GLX
-** extension
-*/
-#if defined( PTHREADS )
-extern pthread_mutex_t __glXmutex;
-#define __glXLock()    pthread_mutex_lock(&__glXmutex)
-#define __glXUnlock()  pthread_mutex_unlock(&__glXmutex)
-#else
-#define __glXLock()
-#define __glXUnlock()
-#endif
-
-/*
-** Setup for a command.  Initialize the extension for dpy if necessary.
-*/
-extern CARD8 __glXSetupForCommand(Display * dpy);
-
-/************************************************************************/
-
-/*
-** Data conversion and packing support.
-*/
-
-extern const GLuint __glXDefaultPixelStore[9];
-
-/* Send an image to the server using RenderLarge. */
-extern void __glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
-                                GLint width, GLint height, GLint depth,
-                                GLenum format, GLenum type,
-                                const GLvoid * src, GLubyte * pc,
-                                GLubyte * modes);
-
-/* Return the size, in bytes, of some pixel data */
-extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
-
-/* Return the number of elements per group of a specified format*/
-extern GLint __glElementsPerGroup(GLenum format, GLenum type);
-
-/* Return the number of bytes per element, based on the element type (other
-** than GL_BITMAP).
-*/
-extern GLint __glBytesPerElement(GLenum type);
-
-/*
-** Fill the transport buffer with the data from the users buffer,
-** applying some of the pixel store modes (unpack modes) to the data
-** first.  As a side effect of this call, the "modes" field is
-** updated to contain the modes needed by the server to decode the
-** sent data.
-*/
-extern void __glFillImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
-                          GLenum, const GLvoid *, GLubyte *, GLubyte *);
-
-/* Copy map data with a stride into a packed buffer */
-extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
-extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
-extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
-                          const GLfloat *, GLfloat *);
-extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
-                          const GLdouble *, GLdouble *);
-
-/*
-** Empty an image out of the reply buffer into the clients memory applying
-** the pack modes to pack back into the clients requested format.
-*/
-extern void __glEmptyImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
-                           GLenum, const GLubyte *, GLvoid *);
-
-
-/*
-** Allocate and Initialize Vertex Array client state, and free.
-*/
-extern void __glXInitVertexArrayState(__GLXcontext *);
-extern void __glXFreeVertexArrayState(__GLXcontext *);
-
-/*
-** Inform the Server of the major and minor numbers and of the client
-** libraries extension string.
-*/
-extern void __glXClientInfo(Display * dpy, int opcode);
-
-/************************************************************************/
-
-/*
-** Declarations that should be in Xlib
-*/
-#ifdef __GL_USE_OUR_PROTOTYPES
-extern void _XFlush(Display *);
-extern Status _XReply(Display *, xReply *, int, Bool);
-extern void _XRead(Display *, void *, long);
-extern void _XSend(Display *, const void *, long);
-#endif
-
-
-extern void __glXInitializeVisualConfigFromTags(__GLcontextModes * config,
-                                                int count, const INT32 * bp,
-                                                Bool tagged_only,
-                                                Bool fbconfig_style_tags);
-
-extern char *__glXQueryServerString(Display * dpy, int opcode,
-                                    CARD32 screen, CARD32 name);
-extern char *__glXGetString(Display * dpy, int opcode,
-                            CARD32 screen, CARD32 name);
-
-extern char *__glXstrdup(const char *str);
-
-
-extern const char __glXGLClientVersion[];
-extern const char __glXGLClientExtensions[];
-
-/* Get the unadjusted system time */
-extern int __glXGetUST(int64_t * ust);
-
-extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
-                                    int32_t * numerator,
-                                    int32_t * denominator);
-
-#ifdef GLX_DIRECT_RENDERING
-GLboolean
-__driGetMscRateOML(__DRIdrawable * draw,
-                   int32_t * numerator, int32_t * denominator, void *private);
-
-/* So that dri2.c:DRI2WireToEvent() can access
- * glx_info->codes->first_event */
-XExtDisplayInfo *__glXFindDisplay (Display *dpy);
-#endif
-
-#endif /* !__GLX_client_h__ */
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
deleted file mode 100644 (file)
index c3be974..0000000
+++ /dev/null
@@ -1,3173 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file glxcmds.c
- * Client-side GLX interface.
- */
-
-#include "glxclient.h"
-#include "glapi.h"
-#include "glxextensions.h"
-#include "glcontextmodes.h"
-
-#ifdef GLX_DIRECT_RENDERING
-#include <sys/time.h>
-#include <X11/extensions/xf86vmode.h>
-#include "xf86dri.h"
-#endif
-
-#if defined(USE_XCB)
-#include <X11/Xlib-xcb.h>
-#include <xcb/xcb.h>
-#include <xcb/glx.h>
-#endif
-
-static const char __glXGLXClientVendorName[] = "Mesa Project and SGI";
-static const char __glXGLXClientVersion[] = "1.4";
-
-
-/****************************************************************************/
-
-#ifdef GLX_DIRECT_RENDERING
-
-static Bool windowExistsFlag;
-static int
-windowExistsErrorHandler(Display * dpy, XErrorEvent * xerr)
-{
-   if (xerr->error_code == BadWindow) {
-      windowExistsFlag = GL_FALSE;
-   }
-   return 0;
-}
-
-/**
- * Find drawables in the local hash that have been destroyed on the
- * server.
- *
- * \param dpy    Display to destroy drawables for
- * \param screen Screen number to destroy drawables for
- */
-static void
-GarbageCollectDRIDrawables(Display * dpy, __GLXscreenConfigs * sc)
-{
-   XID draw;
-   __GLXDRIdrawable *pdraw;
-   XWindowAttributes xwa;
-   int (*oldXErrorHandler) (Display *, XErrorEvent *);
-
-   /* Set no-op error handler so Xlib doesn't bail out if the windows
-    * has alreay been destroyed on the server. */
-   XSync(dpy, GL_FALSE);
-   oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler);
-
-   if (__glxHashFirst(sc->drawHash, &draw, (void *) &pdraw) == 1) {
-      do {
-         windowExistsFlag = GL_TRUE;
-         XGetWindowAttributes(dpy, draw, &xwa); /* dummy request */
-         if (!windowExistsFlag) {
-            /* Destroy the local drawable data, if the drawable no
-               longer exists in the Xserver */
-            (*pdraw->destroyDrawable) (pdraw);
-            __glxHashDelete(sc->drawHash, draw);
-         }
-      } while (__glxHashNext(sc->drawHash, &draw, (void *) &pdraw) == 1);
-   }
-
-   XSync(dpy, GL_FALSE);
-   XSetErrorHandler(oldXErrorHandler);
-}
-
-extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
-                                           GLXDrawable drawable,
-                                           int *const scrn_num);
-
-/**
- * Get the __DRIdrawable for the drawable associated with a GLXContext
- *
- * \param dpy       The display associated with \c drawable.
- * \param drawable  GLXDrawable whose __DRIdrawable part is to be retrieved.
- * \param scrn_num  If non-NULL, the drawables screen is stored there
- * \returns  A pointer to the context's __DRIdrawable on success, or NULL if
- *           the drawable is not associated with a direct-rendering context.
- */
-_X_HIDDEN __GLXDRIdrawable *
-GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable, int *const scrn_num)
-{
-   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-   __GLXDRIdrawable *pdraw;
-   const unsigned screen_count = ScreenCount(dpy);
-   unsigned i;
-   __GLXscreenConfigs *psc;
-
-   if (priv == NULL)
-      return NULL;
-
-   for (i = 0; i < screen_count; i++) {
-      psc = &priv->screenConfigs[i];
-      if (psc->drawHash == NULL)
-         continue;
-
-      if (__glxHashLookup(psc->drawHash, drawable, (void *) &pdraw) == 0) {
-         if (scrn_num != NULL)
-            *scrn_num = i;
-         return pdraw;
-      }
-   }
-
-   return NULL;
-}
-
-#endif
-
-
-/**
- * Get the GLX per-screen data structure associated with a GLX context.
- *
- * \param dpy   Display for which the GLX per-screen information is to be
- *              retrieved.
- * \param scrn  Screen on \c dpy for which the GLX per-screen information is
- *              to be retrieved.
- * \returns A pointer to the GLX per-screen data if \c dpy and \c scrn
- *          specify a valid GLX screen, or NULL otherwise.
- *
- * \todo Should this function validate that \c scrn is within the screen
- *       number range for \c dpy?
- */
-
-static __GLXscreenConfigs *
-GetGLXScreenConfigs(Display * dpy, int scrn)
-{
-   __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
-
-   return (priv
-           && priv->screenConfigs !=
-           NULL) ? &priv->screenConfigs[scrn] : NULL;
-}
-
-
-static int
-GetGLXPrivScreenConfig(Display * dpy, int scrn, __GLXdisplayPrivate ** ppriv,
-                       __GLXscreenConfigs ** ppsc)
-{
-   /* Initialize the extension, if needed .  This has the added value
-    * of initializing/allocating the display private
-    */
-
-   if (dpy == NULL) {
-      return GLX_NO_EXTENSION;
-   }
-
-   *ppriv = __glXInitialize(dpy);
-   if (*ppriv == NULL) {
-      return GLX_NO_EXTENSION;
-   }
-
-   /* Check screen number to see if its valid */
-   if ((scrn < 0) || (scrn >= ScreenCount(dpy))) {
-      return GLX_BAD_SCREEN;
-   }
-
-   /* Check to see if the GL is supported on this screen */
-   *ppsc = &((*ppriv)->screenConfigs[scrn]);
-   if ((*ppsc)->configs == NULL) {
-      /* No support for GL on this screen regardless of visual */
-      return GLX_BAD_VISUAL;
-   }
-
-   return Success;
-}
-
-
-/**
- * Determine if a \c GLXFBConfig supplied by the application is valid.
- *
- * \param dpy     Application supplied \c Display pointer.
- * \param config  Application supplied \c GLXFBConfig.
- *
- * \returns If the \c GLXFBConfig is valid, the a pointer to the matching
- *          \c __GLcontextModes structure is returned.  Otherwise, \c NULL
- *          is returned.
- */
-static __GLcontextModes *
-ValidateGLXFBConfig(Display * dpy, GLXFBConfig config)
-{
-   __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
-   const unsigned num_screens = ScreenCount(dpy);
-   unsigned i;
-   const __GLcontextModes *modes;
-
-
-   if (priv != NULL) {
-      for (i = 0; i < num_screens; i++) {
-         for (modes = priv->screenConfigs[i].configs; modes != NULL;
-              modes = modes->next) {
-            if (modes == (__GLcontextModes *) config) {
-               return (__GLcontextModes *) config;
-            }
-         }
-      }
-   }
-
-   return NULL;
-}
-
-
-/**
- * \todo It should be possible to move the allocate of \c client_state_private
- * later in the function for direct-rendering contexts.  Direct-rendering
- * contexts don't need to track client state, so they don't need that memory
- * at all.
- *
- * \todo Eliminate \c __glXInitVertexArrayState.  Replace it with a new
- * function called \c __glXAllocateClientState that allocates the memory and
- * does all the initialization (including the pixel pack / unpack).
- */
-static GLXContext
-AllocateGLXContext(Display * dpy)
-{
-   GLXContext gc;
-   int bufSize;
-   CARD8 opcode;
-   __GLXattribute *state;
-
-   if (!dpy)
-      return NULL;
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return NULL;
-   }
-
-   /* Allocate our context record */
-   gc = (GLXContext) Xmalloc(sizeof(struct __GLXcontextRec));
-   if (!gc) {
-      /* Out of memory */
-      return NULL;
-   }
-   memset(gc, 0, sizeof(struct __GLXcontextRec));
-
-   state = Xmalloc(sizeof(struct __GLXattributeRec));
-   if (state == NULL) {
-      /* Out of memory */
-      Xfree(gc);
-      return NULL;
-   }
-   gc->client_state_private = state;
-   memset(gc->client_state_private, 0, sizeof(struct __GLXattributeRec));
-   state->NoDrawArraysProtocol = (getenv("LIBGL_NO_DRAWARRAYS") != NULL);
-
-   /*
-    ** Create a temporary buffer to hold GLX rendering commands.  The size
-    ** of the buffer is selected so that the maximum number of GLX rendering
-    ** commands can fit in a single X packet and still have room in the X
-    ** packet for the GLXRenderReq header.
-    */
-
-   bufSize = (XMaxRequestSize(dpy) * 4) - sz_xGLXRenderReq;
-   gc->buf = (GLubyte *) Xmalloc(bufSize);
-   if (!gc->buf) {
-      Xfree(gc->client_state_private);
-      Xfree(gc);
-      return NULL;
-   }
-   gc->bufSize = bufSize;
-
-   /* Fill in the new context */
-   gc->renderMode = GL_RENDER;
-
-   state->storePack.alignment = 4;
-   state->storeUnpack.alignment = 4;
-
-   gc->attributes.stackPointer = &gc->attributes.stack[0];
-
-   /*
-    ** PERFORMANCE NOTE: A mode dependent fill image can speed things up.
-    ** Other code uses the fastImageUnpack bit, but it is never set
-    ** to GL_TRUE.
-    */
-   gc->fastImageUnpack = GL_FALSE;
-   gc->fillImage = __glFillImage;
-   gc->pc = gc->buf;
-   gc->bufEnd = gc->buf + bufSize;
-   gc->isDirect = GL_FALSE;
-   if (__glXDebug) {
-      /*
-       ** Set limit register so that there will be one command per packet
-       */
-      gc->limit = gc->buf;
-   }
-   else {
-      gc->limit = gc->buf + bufSize - __GLX_BUFFER_LIMIT_SIZE;
-   }
-   gc->createDpy = dpy;
-   gc->majorOpcode = opcode;
-
-   /*
-    ** Constrain the maximum drawing command size allowed to be
-    ** transfered using the X_GLXRender protocol request.  First
-    ** constrain by a software limit, then constrain by the protocl
-    ** limit.
-    */
-   if (bufSize > __GLX_RENDER_CMD_SIZE_LIMIT) {
-      bufSize = __GLX_RENDER_CMD_SIZE_LIMIT;
-   }
-   if (bufSize > __GLX_MAX_RENDER_CMD_SIZE) {
-      bufSize = __GLX_MAX_RENDER_CMD_SIZE;
-   }
-   gc->maxSmallRenderCommandSize = bufSize;
-   return gc;
-}
-
-
-/**
- * Create a new context.  Exactly one of \c vis and \c fbconfig should be
- * non-NULL.
- *
- * \param use_glx_1_3  For FBConfigs, should GLX 1.3 protocol or
- *                     SGIX_fbconfig protocol be used?
- * \param renderType   For FBConfigs, what is the rendering type?
- */
-
-static GLXContext
-CreateContext(Display * dpy, XVisualInfo * vis,
-              const __GLcontextModes * const fbconfig,
-              GLXContext shareList,
-              Bool allowDirect, GLXContextID contextID,
-              Bool use_glx_1_3, int renderType)
-{
-   GLXContext gc;
-#ifdef GLX_DIRECT_RENDERING
-   int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen;
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-#endif
-
-   if (dpy == NULL)
-      return NULL;
-
-   gc = AllocateGLXContext(dpy);
-   if (!gc)
-      return NULL;
-
-   if (None == contextID) {
-      if ((vis == NULL) && (fbconfig == NULL))
-         return NULL;
-
-#ifdef GLX_DIRECT_RENDERING
-      if (allowDirect && psc->driScreen) {
-         const __GLcontextModes *mode;
-
-         if (fbconfig == NULL) {
-            mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
-            if (mode == NULL) {
-               xError error;
-
-               error.errorCode = BadValue;
-               error.resourceID = vis->visualid;
-               error.sequenceNumber = dpy->request;
-               error.type = X_Error;
-               error.majorCode = gc->majorOpcode;
-               error.minorCode = X_GLXCreateContext;
-               _XError(dpy, &error);
-               return None;
-            }
-            if (renderType == 0) {
-               /* Initialize renderType now */
-               renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE;
-            }
-         }
-         else {
-            mode = fbconfig;
-         }
-
-         gc->driContext = psc->driScreen->createContext(psc, mode, gc,
-                                                        shareList,
-                                                        renderType);
-         if (gc->driContext != NULL) {
-            gc->screen = mode->screen;
-            gc->psc = psc;
-            gc->mode = mode;
-            gc->isDirect = GL_TRUE;
-         }
-      }
-#endif
-
-      LockDisplay(dpy);
-      if (fbconfig == NULL) {
-         xGLXCreateContextReq *req;
-
-         /* Send the glXCreateContext request */
-         GetReq(GLXCreateContext, req);
-         req->reqType = gc->majorOpcode;
-         req->glxCode = X_GLXCreateContext;
-         req->context = gc->xid = XAllocID(dpy);
-         req->visual = vis->visualid;
-         req->screen = vis->screen;
-         req->shareList = shareList ? shareList->xid : None;
-#ifdef GLX_DIRECT_RENDERING
-         req->isDirect = gc->driContext != NULL;
-#else
-         req->isDirect = 0;
-#endif
-      }
-      else if (use_glx_1_3) {
-         xGLXCreateNewContextReq *req;
-
-         /* Send the glXCreateNewContext request */
-         GetReq(GLXCreateNewContext, req);
-         req->reqType = gc->majorOpcode;
-         req->glxCode = X_GLXCreateNewContext;
-         req->context = gc->xid = XAllocID(dpy);
-         req->fbconfig = fbconfig->fbconfigID;
-         req->screen = fbconfig->screen;
-         req->renderType = renderType;
-         req->shareList = shareList ? shareList->xid : None;
-#ifdef GLX_DIRECT_RENDERING
-         req->isDirect = gc->driContext != NULL;
-#else
-         req->isDirect = 0;
-#endif
-      }
-      else {
-         xGLXVendorPrivateWithReplyReq *vpreq;
-         xGLXCreateContextWithConfigSGIXReq *req;
-
-         /* Send the glXCreateNewContext request */
-         GetReqExtra(GLXVendorPrivateWithReply,
-                     sz_xGLXCreateContextWithConfigSGIXReq -
-                     sz_xGLXVendorPrivateWithReplyReq, vpreq);
-         req = (xGLXCreateContextWithConfigSGIXReq *) vpreq;
-         req->reqType = gc->majorOpcode;
-         req->glxCode = X_GLXVendorPrivateWithReply;
-         req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
-         req->context = gc->xid = XAllocID(dpy);
-         req->fbconfig = fbconfig->fbconfigID;
-         req->screen = fbconfig->screen;
-         req->renderType = renderType;
-         req->shareList = shareList ? shareList->xid : None;
-#ifdef GLX_DIRECT_RENDERING
-         req->isDirect = gc->driContext != NULL;
-#else
-         req->isDirect = 0;
-#endif
-      }
-
-      UnlockDisplay(dpy);
-      SyncHandle();
-      gc->imported = GL_FALSE;
-   }
-   else {
-      gc->xid = contextID;
-      gc->imported = GL_TRUE;
-   }
-
-   gc->renderType = renderType;
-
-   return gc;
-}
-
-PUBLIC GLXContext
-glXCreateContext(Display * dpy, XVisualInfo * vis,
-                 GLXContext shareList, Bool allowDirect)
-{
-   return CreateContext(dpy, vis, NULL, shareList, allowDirect, None,
-                        False, 0);
-}
-
-_X_HIDDEN void
-__glXFreeContext(__GLXcontext * gc)
-{
-   if (gc->vendor)
-      XFree((char *) gc->vendor);
-   if (gc->renderer)
-      XFree((char *) gc->renderer);
-   if (gc->version)
-      XFree((char *) gc->version);
-   if (gc->extensions)
-      XFree((char *) gc->extensions);
-   __glFreeAttributeState(gc);
-   XFree((char *) gc->buf);
-   Xfree((char *) gc->client_state_private);
-   XFree((char *) gc);
-
-}
-
-/*
-** Destroy the named context
-*/
-static void
-DestroyContext(Display * dpy, GLXContext gc)
-{
-   xGLXDestroyContextReq *req;
-   GLXContextID xid;
-   CARD8 opcode;
-   GLboolean imported;
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode || !gc) {
-      return;
-   }
-
-   __glXLock();
-   xid = gc->xid;
-   imported = gc->imported;
-   gc->xid = None;
-
-   if (gc->currentDpy) {
-      /* This context is bound to some thread.  According to the man page,
-       * we should not actually delete the context until it's unbound.
-       * Note that we set gc->xid = None above.  In MakeContextCurrent()
-       * we check for that and delete the context there.
-       */
-      __glXUnlock();
-      return;
-   }
-
-#ifdef GLX_DIRECT_RENDERING
-   /* Destroy the direct rendering context */
-   if (gc->driContext) {
-      (*gc->driContext->destroyContext) (gc->driContext, gc->psc, dpy);
-      gc->driContext = NULL;
-      GarbageCollectDRIDrawables(dpy, gc->psc);
-   }
-#endif
-
-   __glXFreeVertexArrayState(gc);
-
-   if (gc->currentDpy) {
-      /* Have to free later cuz it's in use now */
-      __glXUnlock();
-   }
-   else {
-      /* Destroy the handle if not current to anybody */
-      __glXUnlock();
-      __glXFreeContext(gc);
-   }
-
-   if (!imported) {
-      /*
-       ** This dpy also created the server side part of the context.
-       ** Send the glXDestroyContext request.
-       */
-      LockDisplay(dpy);
-      GetReq(GLXDestroyContext, req);
-      req->reqType = opcode;
-      req->glxCode = X_GLXDestroyContext;
-      req->context = xid;
-      UnlockDisplay(dpy);
-      SyncHandle();
-   }
-}
-
-PUBLIC void
-glXDestroyContext(Display * dpy, GLXContext gc)
-{
-   DestroyContext(dpy, gc);
-}
-
-/*
-** Return the major and minor version #s for the GLX extension
-*/
-PUBLIC Bool
-glXQueryVersion(Display * dpy, int *major, int *minor)
-{
-   __GLXdisplayPrivate *priv;
-
-   /* Init the extension.  This fetches the major and minor version. */
-   priv = __glXInitialize(dpy);
-   if (!priv)
-      return GL_FALSE;
-
-   if (major)
-      *major = priv->majorVersion;
-   if (minor)
-      *minor = priv->minorVersion;
-   return GL_TRUE;
-}
-
-/*
-** Query the existance of the GLX extension
-*/
-PUBLIC Bool
-glXQueryExtension(Display * dpy, int *errorBase, int *eventBase)
-{
-   int major_op, erb, evb;
-   Bool rv;
-
-   rv = XQueryExtension(dpy, GLX_EXTENSION_NAME, &major_op, &evb, &erb);
-   if (rv) {
-      if (errorBase)
-         *errorBase = erb;
-      if (eventBase)
-         *eventBase = evb;
-   }
-   return rv;
-}
-
-/*
-** Put a barrier in the token stream that forces the GL to finish its
-** work before X can proceed.
-*/
-PUBLIC void
-glXWaitGL(void)
-{
-   xGLXWaitGLReq *req;
-   GLXContext gc = __glXGetCurrentContext();
-   Display *dpy = gc->currentDpy;
-
-   if (!dpy)
-      return;
-
-   /* Flush any pending commands out */
-   __glXFlushRenderBuffer(gc, gc->pc);
-
-#ifdef GLX_DIRECT_RENDERING
-   if (gc->driContext) {
-      int screen;
-      __GLXDRIdrawable *pdraw =
-         GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
-
-      if (pdraw != NULL) {
-         __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-         glFlush();
-         if (psc->driScreen->waitGL != NULL)
-            (*psc->driScreen->waitGL) (pdraw);
-      }
-      return;
-   }
-#endif
-
-   /* Send the glXWaitGL request */
-   LockDisplay(dpy);
-   GetReq(GLXWaitGL, req);
-   req->reqType = gc->majorOpcode;
-   req->glxCode = X_GLXWaitGL;
-   req->contextTag = gc->currentContextTag;
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-/*
-** Put a barrier in the token stream that forces X to finish its
-** work before GL can proceed.
-*/
-PUBLIC void
-glXWaitX(void)
-{
-   xGLXWaitXReq *req;
-   GLXContext gc = __glXGetCurrentContext();
-   Display *dpy = gc->currentDpy;
-
-   if (!dpy)
-      return;
-
-   /* Flush any pending commands out */
-   __glXFlushRenderBuffer(gc, gc->pc);
-
-#ifdef GLX_DIRECT_RENDERING
-   if (gc->driContext) {
-      int screen;
-      __GLXDRIdrawable *pdraw =
-         GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
-
-      if (pdraw != NULL) {
-         __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-         if (psc->driScreen->waitX != NULL)
-            (*psc->driScreen->waitX) (pdraw);
-      }
-      else
-         XSync(dpy, False);
-      return;
-   }
-#endif
-
-   /*
-    ** Send the glXWaitX request.
-    */
-   LockDisplay(dpy);
-   GetReq(GLXWaitX, req);
-   req->reqType = gc->majorOpcode;
-   req->glxCode = X_GLXWaitX;
-   req->contextTag = gc->currentContextTag;
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-PUBLIC void
-glXUseXFont(Font font, int first, int count, int listBase)
-{
-   xGLXUseXFontReq *req;
-   GLXContext gc = __glXGetCurrentContext();
-   Display *dpy = gc->currentDpy;
-
-   if (!dpy)
-      return;
-
-   /* Flush any pending commands out */
-   (void) __glXFlushRenderBuffer(gc, gc->pc);
-
-#ifdef GLX_DIRECT_RENDERING
-   if (gc->driContext) {
-      DRI_glXUseXFont(font, first, count, listBase);
-      return;
-   }
-#endif
-
-   /* Send the glXUseFont request */
-   LockDisplay(dpy);
-   GetReq(GLXUseXFont, req);
-   req->reqType = gc->majorOpcode;
-   req->glxCode = X_GLXUseXFont;
-   req->contextTag = gc->currentContextTag;
-   req->font = font;
-   req->first = first;
-   req->count = count;
-   req->listBase = listBase;
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-/************************************************************************/
-
-/*
-** Copy the source context to the destination context using the
-** attribute "mask".
-*/
-PUBLIC void
-glXCopyContext(Display * dpy, GLXContext source,
-               GLXContext dest, unsigned long mask)
-{
-   xGLXCopyContextReq *req;
-   GLXContext gc = __glXGetCurrentContext();
-   GLXContextTag tag;
-   CARD8 opcode;
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return;
-   }
-
-#ifdef GLX_DIRECT_RENDERING
-   if (gc->driContext) {
-      /* NOT_DONE: This does not work yet */
-   }
-#endif
-
-   /*
-    ** If the source is the current context, send its tag so that the context
-    ** can be flushed before the copy.
-    */
-   if (source == gc && dpy == gc->currentDpy) {
-      tag = gc->currentContextTag;
-   }
-   else {
-      tag = 0;
-   }
-
-   /* Send the glXCopyContext request */
-   LockDisplay(dpy);
-   GetReq(GLXCopyContext, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXCopyContext;
-   req->source = source ? source->xid : None;
-   req->dest = dest ? dest->xid : None;
-   req->mask = mask;
-   req->contextTag = tag;
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-
-/**
- * Determine if a context uses direct rendering.
- *
- * \param dpy        Display where the context was created.
- * \param contextID  ID of the context to be tested.
- *
- * \returns \c GL_TRUE if the context is direct rendering or not.
- */
-static Bool
-__glXIsDirect(Display * dpy, GLXContextID contextID)
-{
-#if !defined(USE_XCB)
-   xGLXIsDirectReq *req;
-   xGLXIsDirectReply reply;
-#endif
-   CARD8 opcode;
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return GL_FALSE;
-   }
-
-#ifdef USE_XCB
-   xcb_connection_t *c = XGetXCBConnection(dpy);
-   xcb_glx_is_direct_reply_t *reply = xcb_glx_is_direct_reply(c,
-                                                              xcb_glx_is_direct
-                                                              (c, contextID),
-                                                              NULL);
-
-   const Bool is_direct = reply->is_direct ? True : False;
-   free(reply);
-
-   return is_direct;
-#else
-   /* Send the glXIsDirect request */
-   LockDisplay(dpy);
-   GetReq(GLXIsDirect, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXIsDirect;
-   req->context = contextID;
-   _XReply(dpy, (xReply *) & reply, 0, False);
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return reply.isDirect;
-#endif /* USE_XCB */
-}
-
-/**
- * \todo
- * Shouldn't this function \b always return \c GL_FALSE when
- * \c GLX_DIRECT_RENDERING is not defined?  Do we really need to bother with
- * the GLX protocol here at all?
- */
-PUBLIC Bool
-glXIsDirect(Display * dpy, GLXContext gc)
-{
-   if (!gc) {
-      return GL_FALSE;
-#ifdef GLX_DIRECT_RENDERING
-   }
-   else if (gc->driContext) {
-      return GL_TRUE;
-#endif
-   }
-   return __glXIsDirect(dpy, gc->xid);
-}
-
-PUBLIC GLXPixmap
-glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
-{
-   xGLXCreateGLXPixmapReq *req;
-   GLXPixmap xid;
-   CARD8 opcode;
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return None;
-   }
-
-   /* Send the glXCreateGLXPixmap request */
-   LockDisplay(dpy);
-   GetReq(GLXCreateGLXPixmap, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXCreateGLXPixmap;
-   req->screen = vis->screen;
-   req->visual = vis->visualid;
-   req->pixmap = pixmap;
-   req->glxpixmap = xid = XAllocID(dpy);
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-#ifdef GLX_DIRECT_RENDERING
-   do {
-      /* FIXME: Maybe delay __DRIdrawable creation until the drawable
-       * is actually bound to a context... */
-
-      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
-      __GLXDRIdrawable *pdraw;
-      __GLXscreenConfigs *psc;
-      __GLcontextModes *modes;
-
-      psc = &priv->screenConfigs[vis->screen];
-      if (psc->driScreen == NULL)
-         break;
-      modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
-      pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, modes);
-      if (pdraw == NULL) {
-         fprintf(stderr, "failed to create pixmap\n");
-         break;
-      }
-
-      if (__glxHashInsert(psc->drawHash, req->glxpixmap, pdraw)) {
-         (*pdraw->destroyDrawable) (pdraw);
-         return None;           /* FIXME: Check what we're supposed to do here... */
-      }
-   } while (0);
-#endif
-
-   return xid;
-}
-
-/*
-** Destroy the named pixmap
-*/
-PUBLIC void
-glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
-{
-   xGLXDestroyGLXPixmapReq *req;
-   CARD8 opcode;
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return;
-   }
-
-   /* Send the glXDestroyGLXPixmap request */
-   LockDisplay(dpy);
-   GetReq(GLXDestroyGLXPixmap, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXDestroyGLXPixmap;
-   req->glxpixmap = glxpixmap;
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-#ifdef GLX_DIRECT_RENDERING
-   {
-      int screen;
-      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
-      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap, &screen);
-      __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
-
-      if (pdraw != NULL) {
-         (*pdraw->destroyDrawable) (pdraw);
-         __glxHashDelete(psc->drawHash, glxpixmap);
-      }
-   }
-#endif
-}
-
-PUBLIC void
-glXSwapBuffers(Display * dpy, GLXDrawable drawable)
-{
-   GLXContext gc;
-   GLXContextTag tag;
-   CARD8 opcode;
-#ifdef USE_XCB
-   xcb_connection_t *c;
-#else
-   xGLXSwapBuffersReq *req;
-#endif
-
-#ifdef GLX_DIRECT_RENDERING
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
-
-   if (pdraw != NULL) {
-      glFlush();
-      (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0);
-      return;
-   }
-#endif
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return;
-   }
-
-   /*
-    ** The calling thread may or may not have a current context.  If it
-    ** does, send the context tag so the server can do a flush.
-    */
-   gc = __glXGetCurrentContext();
-   if ((gc != NULL) && (dpy == gc->currentDpy) &&
-       ((drawable == gc->currentDrawable)
-        || (drawable == gc->currentReadable))) {
-      tag = gc->currentContextTag;
-   }
-   else {
-      tag = 0;
-   }
-
-#ifdef USE_XCB
-   c = XGetXCBConnection(dpy);
-   xcb_glx_swap_buffers(c, tag, drawable);
-   xcb_flush(c);
-#else
-   /* Send the glXSwapBuffers request */
-   LockDisplay(dpy);
-   GetReq(GLXSwapBuffers, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXSwapBuffers;
-   req->drawable = drawable;
-   req->contextTag = tag;
-   UnlockDisplay(dpy);
-   SyncHandle();
-   XFlush(dpy);
-#endif /* USE_XCB */
-}
-
-
-/*
-** Return configuration information for the given display, screen and
-** visual combination.
-*/
-PUBLIC int
-glXGetConfig(Display * dpy, XVisualInfo * vis, int attribute,
-             int *value_return)
-{
-   __GLXdisplayPrivate *priv;
-   __GLXscreenConfigs *psc;
-   __GLcontextModes *modes;
-   int status;
-
-   status = GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc);
-   if (status == Success) {
-      modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
-
-      /* Lookup attribute after first finding a match on the visual */
-      if (modes != NULL) {
-         return _gl_get_context_mode_data(modes, attribute, value_return);
-      }
-
-      status = GLX_BAD_VISUAL;
-   }
-
-   /*
-    ** If we can't find the config for this visual, this visual is not
-    ** supported by the OpenGL implementation on the server.
-    */
-   if ((status == GLX_BAD_VISUAL) && (attribute == GLX_USE_GL)) {
-      *value_return = GL_FALSE;
-      status = Success;
-   }
-
-   return status;
-}
-
-/************************************************************************/
-
-static void
-init_fbconfig_for_chooser(__GLcontextModes * config,
-                          GLboolean fbconfig_style_tags)
-{
-   memset(config, 0, sizeof(__GLcontextModes));
-   config->visualID = (XID) GLX_DONT_CARE;
-   config->visualType = GLX_DONT_CARE;
-
-   /* glXChooseFBConfig specifies different defaults for these two than
-    * glXChooseVisual.
-    */
-   if (fbconfig_style_tags) {
-      config->rgbMode = GL_TRUE;
-      config->doubleBufferMode = GLX_DONT_CARE;
-   }
-
-   config->visualRating = GLX_DONT_CARE;
-   config->transparentPixel = GLX_NONE;
-   config->transparentRed = GLX_DONT_CARE;
-   config->transparentGreen = GLX_DONT_CARE;
-   config->transparentBlue = GLX_DONT_CARE;
-   config->transparentAlpha = GLX_DONT_CARE;
-   config->transparentIndex = GLX_DONT_CARE;
-
-   config->drawableType = GLX_WINDOW_BIT;
-   config->renderType =
-      (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-   config->xRenderable = GLX_DONT_CARE;
-   config->fbconfigID = (GLXFBConfigID) (GLX_DONT_CARE);
-
-   config->swapMethod = GLX_DONT_CARE;
-}
-
-#define MATCH_DONT_CARE( param )        \
-  do {                                  \
-    if ( (a-> param != GLX_DONT_CARE)   \
-         && (a-> param != b-> param) ) {        \
-      return False;                             \
-    }                                           \
-  } while ( 0 )
-
-#define MATCH_MINIMUM( param )                  \
-  do {                                          \
-    if ( (a-> param != GLX_DONT_CARE)           \
-         && (a-> param > b-> param) ) {         \
-      return False;                             \
-    }                                           \
-  } while ( 0 )
-
-#define MATCH_EXACT( param )                    \
-  do {                                          \
-    if ( a-> param != b-> param) {              \
-      return False;                             \
-    }                                           \
-  } while ( 0 )
-
-/**
- * Determine if two GLXFBConfigs are compatible.
- *
- * \param a  Application specified config to test.
- * \param b  Server specified config to test against \c a.
- */
-static Bool
-fbconfigs_compatible(const __GLcontextModes * const a,
-                     const __GLcontextModes * const b)
-{
-   MATCH_DONT_CARE(doubleBufferMode);
-   MATCH_DONT_CARE(visualType);
-   MATCH_DONT_CARE(visualRating);
-   MATCH_DONT_CARE(xRenderable);
-   MATCH_DONT_CARE(fbconfigID);
-   MATCH_DONT_CARE(swapMethod);
-
-   MATCH_MINIMUM(rgbBits);
-   MATCH_MINIMUM(numAuxBuffers);
-   MATCH_MINIMUM(redBits);
-   MATCH_MINIMUM(greenBits);
-   MATCH_MINIMUM(blueBits);
-   MATCH_MINIMUM(alphaBits);
-   MATCH_MINIMUM(depthBits);
-   MATCH_MINIMUM(stencilBits);
-   MATCH_MINIMUM(accumRedBits);
-   MATCH_MINIMUM(accumGreenBits);
-   MATCH_MINIMUM(accumBlueBits);
-   MATCH_MINIMUM(accumAlphaBits);
-   MATCH_MINIMUM(sampleBuffers);
-   MATCH_MINIMUM(maxPbufferWidth);
-   MATCH_MINIMUM(maxPbufferHeight);
-   MATCH_MINIMUM(maxPbufferPixels);
-   MATCH_MINIMUM(samples);
-
-   MATCH_DONT_CARE(stereoMode);
-   MATCH_EXACT(level);
-
-   if (((a->drawableType & b->drawableType) == 0)
-       || ((a->renderType & b->renderType) == 0)) {
-      return False;
-   }
-
-
-   /* There is a bug in a few of the XFree86 DDX drivers.  They contain
-    * visuals with a "transparent type" of 0 when they really mean GLX_NONE.
-    * Technically speaking, it is a bug in the DDX driver, but there is
-    * enough of an installed base to work around the problem here.  In any
-    * case, 0 is not a valid value of the transparent type, so we'll treat 0
-    * from the app as GLX_DONT_CARE. We'll consider GLX_NONE from the app and
-    * 0 from the server to be a match to maintain backward compatibility with
-    * the (broken) drivers.
-    */
-
-   if (a->transparentPixel != GLX_DONT_CARE && a->transparentPixel != 0) {
-      if (a->transparentPixel == GLX_NONE) {
-         if (b->transparentPixel != GLX_NONE && b->transparentPixel != 0)
-            return False;
-      }
-      else {
-         MATCH_EXACT(transparentPixel);
-      }
-
-      switch (a->transparentPixel) {
-      case GLX_TRANSPARENT_RGB:
-         MATCH_DONT_CARE(transparentRed);
-         MATCH_DONT_CARE(transparentGreen);
-         MATCH_DONT_CARE(transparentBlue);
-         MATCH_DONT_CARE(transparentAlpha);
-         break;
-
-      case GLX_TRANSPARENT_INDEX:
-         MATCH_DONT_CARE(transparentIndex);
-         break;
-
-      default:
-         break;
-      }
-   }
-
-   return True;
-}
-
-
-/* There's some trickly language in the GLX spec about how this is supposed
- * to work.  Basically, if a given component size is either not specified
- * or the requested size is zero, it is supposed to act like PERFER_SMALLER.
- * Well, that's really hard to do with the code as-is.  This behavior is
- * closer to correct, but still not technically right.
- */
-#define PREFER_LARGER_OR_ZERO(comp)             \
-  do {                                          \
-    if ( ((*a)-> comp) != ((*b)-> comp) ) {     \
-      if ( ((*a)-> comp) == 0 ) {               \
-        return -1;                              \
-      }                                         \
-      else if ( ((*b)-> comp) == 0 ) {          \
-        return 1;                               \
-      }                                         \
-      else {                                    \
-        return ((*b)-> comp) - ((*a)-> comp) ;  \
-      }                                         \
-    }                                           \
-  } while( 0 )
-
-#define PREFER_LARGER(comp)                     \
-  do {                                          \
-    if ( ((*a)-> comp) != ((*b)-> comp) ) {     \
-      return ((*b)-> comp) - ((*a)-> comp) ;    \
-    }                                           \
-  } while( 0 )
-
-#define PREFER_SMALLER(comp)                    \
-  do {                                          \
-    if ( ((*a)-> comp) != ((*b)-> comp) ) {     \
-      return ((*a)-> comp) - ((*b)-> comp) ;    \
-    }                                           \
-  } while( 0 )
-
-/**
- * Compare two GLXFBConfigs.  This function is intended to be used as the
- * compare function passed in to qsort.
- *
- * \returns If \c a is a "better" config, according to the specification of
- *          SGIX_fbconfig, a number less than zero is returned.  If \c b is
- *          better, then a number greater than zero is return.  If both are
- *          equal, zero is returned.
- * \sa qsort, glXChooseVisual, glXChooseFBConfig, glXChooseFBConfigSGIX
- */
-static int
-fbconfig_compare(const __GLcontextModes * const *const a,
-                 const __GLcontextModes * const *const b)
-{
-   /* The order of these comparisons must NOT change.  It is defined by
-    * the GLX 1.3 spec and ARB_multisample.
-    */
-
-   PREFER_SMALLER(visualSelectGroup);
-
-   /* The sort order for the visualRating is GLX_NONE, GLX_SLOW, and
-    * GLX_NON_CONFORMANT_CONFIG.  It just so happens that this is the
-    * numerical sort order of the enums (0x8000, 0x8001, and 0x800D).
-    */
-   PREFER_SMALLER(visualRating);
-
-   /* This isn't quite right.  It is supposed to compare the sum of the
-    * components the user specifically set minimums for.
-    */
-   PREFER_LARGER_OR_ZERO(redBits);
-   PREFER_LARGER_OR_ZERO(greenBits);
-   PREFER_LARGER_OR_ZERO(blueBits);
-   PREFER_LARGER_OR_ZERO(alphaBits);
-
-   PREFER_SMALLER(rgbBits);
-
-   if (((*a)->doubleBufferMode != (*b)->doubleBufferMode)) {
-      /* Prefer single-buffer.
-       */
-      return (!(*a)->doubleBufferMode) ? -1 : 1;
-   }
-
-   PREFER_SMALLER(numAuxBuffers);
-
-   PREFER_LARGER_OR_ZERO(depthBits);
-   PREFER_SMALLER(stencilBits);
-
-   /* This isn't quite right.  It is supposed to compare the sum of the
-    * components the user specifically set minimums for.
-    */
-   PREFER_LARGER_OR_ZERO(accumRedBits);
-   PREFER_LARGER_OR_ZERO(accumGreenBits);
-   PREFER_LARGER_OR_ZERO(accumBlueBits);
-   PREFER_LARGER_OR_ZERO(accumAlphaBits);
-
-   PREFER_SMALLER(visualType);
-
-   /* None of the multisample specs say where this comparison should happen,
-    * so I put it near the end.
-    */
-   PREFER_SMALLER(sampleBuffers);
-   PREFER_SMALLER(samples);
-
-   /* None of the pbuffer or fbconfig specs say that this comparison needs
-    * to happen at all, but it seems like it should.
-    */
-   PREFER_LARGER(maxPbufferWidth);
-   PREFER_LARGER(maxPbufferHeight);
-   PREFER_LARGER(maxPbufferPixels);
-
-   return 0;
-}
-
-
-/**
- * Selects and sorts a subset of the supplied configs based on the attributes.
- * This function forms to basis of \c glXChooseVisual, \c glXChooseFBConfig,
- * and \c glXChooseFBConfigSGIX.
- *
- * \param configs   Array of pointers to possible configs.  The elements of
- *                  this array that do not meet the criteria will be set to
- *                  NULL.  The remaining elements will be sorted according to
- *                  the various visual / FBConfig selection rules.
- * \param num_configs  Number of elements in the \c configs array.
- * \param attribList   Attributes used select from \c configs.  This array is
- *                     terminated by a \c None tag.  The array can either take
- *                     the form expected by \c glXChooseVisual (where boolean
- *                     tags do not have a value) or by \c glXChooseFBConfig
- *                     (where every tag has a value).
- * \param fbconfig_style_tags  Selects whether \c attribList is in
- *                             \c glXChooseVisual style or
- *                             \c glXChooseFBConfig style.
- * \returns The number of valid elements left in \c configs.
- *
- * \sa glXChooseVisual, glXChooseFBConfig, glXChooseFBConfigSGIX
- */
-static int
-choose_visual(__GLcontextModes ** configs, int num_configs,
-              const int *attribList, GLboolean fbconfig_style_tags)
-{
-   __GLcontextModes test_config;
-   int base;
-   int i;
-
-   /* This is a fairly direct implementation of the selection method
-    * described by GLX_SGIX_fbconfig.  Start by culling out all the
-    * configs that are not compatible with the selected parameter
-    * list.
-    */
-
-   init_fbconfig_for_chooser(&test_config, fbconfig_style_tags);
-   __glXInitializeVisualConfigFromTags(&test_config, 512,
-                                       (const INT32 *) attribList,
-                                       GL_TRUE, fbconfig_style_tags);
-
-   base = 0;
-   for (i = 0; i < num_configs; i++) {
-      if (fbconfigs_compatible(&test_config, configs[i])) {
-         configs[base] = configs[i];
-         base++;
-      }
-   }
-
-   if (base == 0) {
-      return 0;
-   }
-
-   if (base < num_configs) {
-      (void) memset(&configs[base], 0, sizeof(void *) * (num_configs - base));
-   }
-
-   /* After the incompatible configs are removed, the resulting
-    * list is sorted according to the rules set out in the various
-    * specifications.
-    */
-
-   qsort(configs, base, sizeof(__GLcontextModes *),
-         (int (*)(const void *, const void *)) fbconfig_compare);
-   return base;
-}
-
-
-
-
-/*
-** Return the visual that best matches the template.  Return None if no
-** visual matches the template.
-*/
-PUBLIC XVisualInfo *
-glXChooseVisual(Display * dpy, int screen, int *attribList)
-{
-   XVisualInfo *visualList = NULL;
-   __GLXdisplayPrivate *priv;
-   __GLXscreenConfigs *psc;
-   __GLcontextModes test_config;
-   __GLcontextModes *modes;
-   const __GLcontextModes *best_config = NULL;
-
-   /*
-    ** Get a list of all visuals, return if list is empty
-    */
-   if (GetGLXPrivScreenConfig(dpy, screen, &priv, &psc) != Success) {
-      return None;
-   }
-
-
-   /*
-    ** Build a template from the defaults and the attribute list
-    ** Free visual list and return if an unexpected token is encountered
-    */
-   init_fbconfig_for_chooser(&test_config, GL_FALSE);
-   __glXInitializeVisualConfigFromTags(&test_config, 512,
-                                       (const INT32 *) attribList,
-                                       GL_TRUE, GL_FALSE);
-
-   /*
-    ** Eliminate visuals that don't meet minimum requirements
-    ** Compute a score for those that do
-    ** Remember which visual, if any, got the highest score
-    ** If no visual is acceptable, return None
-    ** Otherwise, create an XVisualInfo list with just the selected X visual
-    ** and return this.
-    */
-   for (modes = psc->visuals; modes != NULL; modes = modes->next) {
-      if (fbconfigs_compatible(&test_config, modes)
-          && ((best_config == NULL)
-              ||
-              (fbconfig_compare
-               ((const __GLcontextModes * const *const) &modes,
-                &best_config) < 0))) {
-         XVisualInfo visualTemplate;
-         XVisualInfo *newList;
-         int i;
-
-         visualTemplate.screen = screen;
-         visualTemplate.visualid = modes->visualID;
-         newList = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask,
-                                  &visualTemplate, &i);
-
-         if (newList) {
-            Xfree(visualList);
-            visualList = newList;
-            best_config = modes;
-         }
-      }
-   }
-
-   return visualList;
-}
-
-
-PUBLIC const char *
-glXQueryExtensionsString(Display * dpy, int screen)
-{
-   __GLXscreenConfigs *psc;
-   __GLXdisplayPrivate *priv;
-
-   if (GetGLXPrivScreenConfig(dpy, screen, &priv, &psc) != Success) {
-      return NULL;
-   }
-
-   if (!psc->effectiveGLXexts) {
-      if (!psc->serverGLXexts) {
-         psc->serverGLXexts =
-            __glXQueryServerString(dpy, priv->majorOpcode, screen,
-                                   GLX_EXTENSIONS);
-      }
-
-      __glXCalculateUsableExtensions(psc,
-#ifdef GLX_DIRECT_RENDERING
-                                     (psc->driScreen != NULL),
-#else
-                                     GL_FALSE,
-#endif
-                                     priv->minorVersion);
-   }
-
-   return psc->effectiveGLXexts;
-}
-
-PUBLIC const char *
-glXGetClientString(Display * dpy, int name)
-{
-   switch (name) {
-   case GLX_VENDOR:
-      return (__glXGLXClientVendorName);
-   case GLX_VERSION:
-      return (__glXGLXClientVersion);
-   case GLX_EXTENSIONS:
-      return (__glXGetClientExtensions());
-   default:
-      return NULL;
-   }
-}
-
-PUBLIC const char *
-glXQueryServerString(Display * dpy, int screen, int name)
-{
-   __GLXscreenConfigs *psc;
-   __GLXdisplayPrivate *priv;
-   const char **str;
-
-
-   if (GetGLXPrivScreenConfig(dpy, screen, &priv, &psc) != Success) {
-      return NULL;
-   }
-
-   switch (name) {
-   case GLX_VENDOR:
-      str = &priv->serverGLXvendor;
-      break;
-   case GLX_VERSION:
-      str = &priv->serverGLXversion;
-      break;
-   case GLX_EXTENSIONS:
-      str = &psc->serverGLXexts;
-      break;
-   default:
-      return NULL;
-   }
-
-   if (*str == NULL) {
-      *str = __glXQueryServerString(dpy, priv->majorOpcode, screen, name);
-   }
-
-   return *str;
-}
-
-void
-__glXClientInfo(Display * dpy, int opcode)
-{
-   char *ext_str = __glXGetClientGLExtensionString();
-   int size = strlen(ext_str) + 1;
-
-#ifdef USE_XCB
-   xcb_connection_t *c = XGetXCBConnection(dpy);
-   xcb_glx_client_info(c,
-                       GLX_MAJOR_VERSION, GLX_MINOR_VERSION, size, ext_str);
-#else
-   xGLXClientInfoReq *req;
-
-   /* Send the glXClientInfo request */
-   LockDisplay(dpy);
-   GetReq(GLXClientInfo, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXClientInfo;
-   req->major = GLX_MAJOR_VERSION;
-   req->minor = GLX_MINOR_VERSION;
-
-   req->length += (size + 3) >> 2;
-   req->numbytes = size;
-   Data(dpy, ext_str, size);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-#endif /* USE_XCB */
-
-   Xfree(ext_str);
-}
-
-
-/*
-** EXT_import_context
-*/
-
-PUBLIC Display *
-glXGetCurrentDisplay(void)
-{
-   GLXContext gc = __glXGetCurrentContext();
-   if (NULL == gc)
-      return NULL;
-   return gc->currentDpy;
-}
-
-PUBLIC
-GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (),
-          glXGetCurrentDisplay)
-
-/**
- * Used internally by libGL to send \c xGLXQueryContextinfoExtReq requests
- * to the X-server.
- *
- * \param dpy  Display where \c ctx was created.
- * \param ctx  Context to query.
- * \returns  \c Success on success.  \c GLX_BAD_CONTEXT if \c ctx is invalid,
- *           or zero if the request failed due to internal problems (i.e.,
- *           unable to allocate temporary memory, etc.)
- *
- * \note
- * This function dynamically determines whether to use the EXT_import_context
- * version of the protocol or the GLX 1.3 version of the protocol.
- */
-static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
-{
-   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-   xGLXQueryContextReply reply;
-   CARD8 opcode;
-   GLuint numValues;
-   int retval;
-
-   if (ctx == NULL) {
-      return GLX_BAD_CONTEXT;
-   }
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return 0;
-   }
-
-   /* Send the glXQueryContextInfoEXT request */
-   LockDisplay(dpy);
-
-   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
-      xGLXQueryContextReq *req;
-
-      GetReq(GLXQueryContext, req);
-
-      req->reqType = opcode;
-      req->glxCode = X_GLXQueryContext;
-      req->context = (unsigned int) (ctx->xid);
-   }
-   else {
-      xGLXVendorPrivateReq *vpreq;
-      xGLXQueryContextInfoEXTReq *req;
-
-      GetReqExtra(GLXVendorPrivate,
-                  sz_xGLXQueryContextInfoEXTReq - sz_xGLXVendorPrivateReq,
-                  vpreq);
-      req = (xGLXQueryContextInfoEXTReq *) vpreq;
-      req->reqType = opcode;
-      req->glxCode = X_GLXVendorPrivateWithReply;
-      req->vendorCode = X_GLXvop_QueryContextInfoEXT;
-      req->context = (unsigned int) (ctx->xid);
-   }
-
-   _XReply(dpy, (xReply *) & reply, 0, False);
-
-   numValues = reply.n;
-   if (numValues == 0)
-      retval = Success;
-   else if (numValues > __GLX_MAX_CONTEXT_PROPS)
-      retval = 0;
-   else {
-      int *propList, *pProp;
-      int nPropListBytes;
-      int i;
-
-      nPropListBytes = numValues << 3;
-      propList = (int *) Xmalloc(nPropListBytes);
-      if (NULL == propList) {
-         retval = 0;
-      }
-      else {
-         _XRead(dpy, (char *) propList, nPropListBytes);
-         pProp = propList;
-         for (i = 0; i < numValues; i++) {
-            switch (*pProp++) {
-            case GLX_SHARE_CONTEXT_EXT:
-               ctx->share_xid = *pProp++;
-               break;
-            case GLX_VISUAL_ID_EXT:
-               ctx->mode =
-                  _gl_context_modes_find_visual(ctx->psc->visuals, *pProp++);
-               break;
-            case GLX_SCREEN:
-               ctx->screen = *pProp++;
-               break;
-            case GLX_FBCONFIG_ID:
-               ctx->mode =
-                  _gl_context_modes_find_fbconfig(ctx->psc->configs,
-                                                  *pProp++);
-               break;
-            case GLX_RENDER_TYPE:
-               ctx->renderType = *pProp++;
-               break;
-            default:
-               pProp++;
-               continue;
-            }
-         }
-         Xfree((char *) propList);
-         retval = Success;
-      }
-   }
-   UnlockDisplay(dpy);
-   SyncHandle();
-   return retval;
-}
-
-PUBLIC int
-glXQueryContext(Display * dpy, GLXContext ctx, int attribute, int *value)
-{
-   int retVal;
-
-   /* get the information from the server if we don't have it already */
-#ifdef GLX_DIRECT_RENDERING
-   if (!ctx->driContext && (ctx->mode == NULL)) {
-#else
-   if (ctx->mode == NULL) {
-#endif
-      retVal = __glXQueryContextInfo(dpy, ctx);
-      if (Success != retVal)
-         return retVal;
-   }
-   switch (attribute) {
-   case GLX_SHARE_CONTEXT_EXT:
-      *value = (int) (ctx->share_xid);
-      break;
-   case GLX_VISUAL_ID_EXT:
-      *value = ctx->mode ? ctx->mode->visualID : None;
-      break;
-   case GLX_SCREEN:
-      *value = (int) (ctx->screen);
-      break;
-   case GLX_FBCONFIG_ID:
-      *value = ctx->mode ? ctx->mode->fbconfigID : None;
-      break;
-   case GLX_RENDER_TYPE:
-      *value = (int) (ctx->renderType);
-      break;
-   default:
-      return GLX_BAD_ATTRIBUTE;
-   }
-   return Success;
-}
-
-PUBLIC
-GLX_ALIAS(int, glXQueryContextInfoEXT,
-          (Display * dpy, GLXContext ctx, int attribute, int *value),
-          (dpy, ctx, attribute, value), glXQueryContext)
-
-PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx)
-{
-   return ctx->xid;
-}
-
-PUBLIC GLXContext
-glXImportContextEXT(Display * dpy, GLXContextID contextID)
-{
-   GLXContext ctx;
-
-   if (contextID == None) {
-      return NULL;
-   }
-   if (__glXIsDirect(dpy, contextID)) {
-      return NULL;
-   }
-
-   ctx = CreateContext(dpy, NULL, NULL, NULL, False, contextID, False, 0);
-   if (NULL != ctx) {
-      if (Success != __glXQueryContextInfo(dpy, ctx)) {
-         return NULL;
-      }
-   }
-   return ctx;
-}
-
-PUBLIC void
-glXFreeContextEXT(Display * dpy, GLXContext ctx)
-{
-   DestroyContext(dpy, ctx);
-}
-
-
-
-/*
- * GLX 1.3 functions - these are just stubs for now!
- */
-
-PUBLIC GLXFBConfig *
-glXChooseFBConfig(Display * dpy, int screen,
-                  const int *attribList, int *nitems)
-{
-   __GLcontextModes **config_list;
-   int list_size;
-
-
-   config_list = (__GLcontextModes **)
-      glXGetFBConfigs(dpy, screen, &list_size);
-
-   if ((config_list != NULL) && (list_size > 0) && (attribList != NULL)) {
-      list_size = choose_visual(config_list, list_size, attribList, GL_TRUE);
-      if (list_size == 0) {
-         XFree(config_list);
-         config_list = NULL;
-      }
-   }
-
-   *nitems = list_size;
-   return (GLXFBConfig *) config_list;
-}
-
-
-PUBLIC GLXContext
-glXCreateNewContext(Display * dpy, GLXFBConfig config,
-                    int renderType, GLXContext shareList, Bool allowDirect)
-{
-   return CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList,
-                        allowDirect, None, True, renderType);
-}
-
-
-PUBLIC GLXDrawable
-glXGetCurrentReadDrawable(void)
-{
-   GLXContext gc = __glXGetCurrentContext();
-   return gc->currentReadable;
-}
-
-
-PUBLIC GLXFBConfig *
-glXGetFBConfigs(Display * dpy, int screen, int *nelements)
-{
-   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-   __GLcontextModes **config = NULL;
-   int i;
-
-   *nelements = 0;
-   if (priv && (priv->screenConfigs != NULL)
-       && (screen >= 0) && (screen <= ScreenCount(dpy))
-       && (priv->screenConfigs[screen].configs != NULL)
-       && (priv->screenConfigs[screen].configs->fbconfigID != GLX_DONT_CARE)) {
-      unsigned num_configs = 0;
-      __GLcontextModes *modes;
-
-
-      for (modes = priv->screenConfigs[screen].configs; modes != NULL;
-           modes = modes->next) {
-         if (modes->fbconfigID != GLX_DONT_CARE) {
-            num_configs++;
-         }
-      }
-
-      config = (__GLcontextModes **) Xmalloc(sizeof(__GLcontextModes *)
-                                             * num_configs);
-      if (config != NULL) {
-         *nelements = num_configs;
-         i = 0;
-         for (modes = priv->screenConfigs[screen].configs; modes != NULL;
-              modes = modes->next) {
-            if (modes->fbconfigID != GLX_DONT_CARE) {
-               config[i] = modes;
-               i++;
-            }
-         }
-      }
-   }
-   return (GLXFBConfig *) config;
-}
-
-
-PUBLIC int
-glXGetFBConfigAttrib(Display * dpy, GLXFBConfig config,
-                     int attribute, int *value)
-{
-   __GLcontextModes *const modes = ValidateGLXFBConfig(dpy, config);
-
-   return (modes != NULL)
-      ? _gl_get_context_mode_data(modes, attribute, value)
-      : GLXBadFBConfig;
-}
-
-
-PUBLIC XVisualInfo *
-glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config)
-{
-   XVisualInfo visualTemplate;
-   __GLcontextModes *fbconfig = (__GLcontextModes *) config;
-   int count;
-
-   /*
-    ** Get a list of all visuals, return if list is empty
-    */
-   visualTemplate.visualid = fbconfig->visualID;
-   return XGetVisualInfo(dpy, VisualIDMask, &visualTemplate, &count);
-}
-
-
-/*
-** GLX_SGI_swap_control
-*/
-static int
-__glXSwapIntervalSGI(int interval)
-{
-   xGLXVendorPrivateReq *req;
-   GLXContext gc = __glXGetCurrentContext();
-   __GLXscreenConfigs *psc;
-   Display *dpy;
-   CARD32 *interval_ptr;
-   CARD8 opcode;
-
-   if (gc == NULL) {
-      return GLX_BAD_CONTEXT;
-   }
-
-   if (interval <= 0) {
-      return GLX_BAD_VALUE;
-   }
-
-#ifdef __DRI_SWAP_CONTROL
-   if (gc->driContext) {
-      __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
-                                                           gc->screen );
-      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
-                                                 gc->currentDrawable,
-                                                 NULL);
-      if (psc->swapControl != NULL && pdraw != NULL) {
-        psc->swapControl->setSwapInterval(pdraw->driDrawable, interval);
-        return 0;
-      }
-      else if (pdraw == NULL) {
-        return GLX_BAD_CONTEXT;
-      }
-   }
-#endif
-   psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
-
-   if (gc->driContext && psc->driScreen && psc->driScreen->setSwapInterval) {
-      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
-                                                 gc->currentDrawable,
-                                                 NULL);
-      psc->driScreen->setSwapInterval(pdraw, interval);
-      return 0;
-   }
-
-   dpy = gc->currentDpy;
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-      return 0;
-   }
-
-   /* Send the glXSwapIntervalSGI request */
-   LockDisplay(dpy);
-   GetReqExtra(GLXVendorPrivate, sizeof(CARD32), req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXVendorPrivate;
-   req->vendorCode = X_GLXvop_SwapIntervalSGI;
-   req->contextTag = gc->currentContextTag;
-
-   interval_ptr = (CARD32 *) (req + 1);
-   *interval_ptr = interval;
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-   XFlush(dpy);
-
-   return 0;
-}
-
-
-/*
-** GLX_MESA_swap_control
-*/
-static int
-__glXSwapIntervalMESA(unsigned int interval)
-{
-   GLXContext gc = __glXGetCurrentContext();
-
-   if (interval < 0) {
-      return GLX_BAD_VALUE;
-   }
-
-#ifdef __DRI_SWAP_CONTROL
-   if (gc != NULL && gc->driContext) {
-      __GLXscreenConfigs *const psc = GetGLXScreenConfigs(gc->currentDpy,
-                                                          gc->screen);
-
-      if ((psc != NULL) && (psc->driScreen != NULL)) {
-         __GLXDRIdrawable *pdraw =
-            GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
-         if (psc->swapControl != NULL && pdraw != NULL) {
-            psc->swapControl->setSwapInterval(pdraw->driDrawable, interval);
-            return 0;
-         }
-      }
-   }
-#endif
-
-   if (gc != NULL && gc->driContext) {
-      __GLXscreenConfigs *psc;
-
-      psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
-      if (psc->driScreen && psc->driScreen->setSwapInterval) {
-         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
-                                                    gc->currentDrawable, NULL);
-        psc->driScreen->setSwapInterval(pdraw, interval);
-        return 0;
-      }
-   }
-
-   return GLX_BAD_CONTEXT;
-}
-
-
-static int
-__glXGetSwapIntervalMESA(void)
-{
-#ifdef __DRI_SWAP_CONTROL
-   GLXContext gc = __glXGetCurrentContext();
-
-   if (gc != NULL && gc->driContext) {
-      __GLXscreenConfigs *const psc = GetGLXScreenConfigs(gc->currentDpy,
-                                                          gc->screen);
-
-      if ((psc != NULL) && (psc->driScreen != NULL)) {
-         __GLXDRIdrawable *pdraw =
-            GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
-         if (psc->swapControl != NULL && pdraw != NULL) {
-            return psc->swapControl->getSwapInterval(pdraw->driDrawable);
-         }
-      }
-   }
-#endif
-   if (gc != NULL && gc->driContext) {
-      __GLXscreenConfigs *psc;
-
-      psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
-      if (psc->driScreen && psc->driScreen->getSwapInterval) {
-         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy,
-                                                    gc->currentDrawable, NULL);
-        return psc->driScreen->getSwapInterval(pdraw);
-      }
-   }
-
-   return 0;
-}
-
-
-/*
-** GLX_MESA_swap_frame_usage
-*/
-
-static GLint
-__glXBeginFrameTrackingMESA(Display * dpy, GLXDrawable drawable)
-{
-   int status = GLX_BAD_CONTEXT;
-#ifdef __DRI_FRAME_TRACKING
-   int screen = 0;
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-
-   if (pdraw != NULL && psc->frameTracking != NULL)
-      status = psc->frameTracking->frameTracking(pdraw->driDrawable, GL_TRUE);
-#else
-   (void) dpy;
-   (void) drawable;
-#endif
-   return status;
-}
-
-
-static GLint
-__glXEndFrameTrackingMESA(Display * dpy, GLXDrawable drawable)
-{
-   int status = GLX_BAD_CONTEXT;
-#ifdef __DRI_FRAME_TRACKING
-   int screen = 0;
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   __GLXscreenConfigs *psc = GetGLXScreenConfigs(dpy, screen);
-
-   if (pdraw != NULL && psc->frameTracking != NULL)
-      status = psc->frameTracking->frameTracking(pdraw->driDrawable,
-                                                 GL_FALSE);
-#else
-   (void) dpy;
-   (void) drawable;
-#endif
-   return status;
-}
-
-
-static GLint
-__glXGetFrameUsageMESA(Display * dpy, GLXDrawable drawable, GLfloat * usage)
-{
-   int status = GLX_BAD_CONTEXT;
-#ifdef __DRI_FRAME_TRACKING
-   int screen = 0;
-   __GLXDRIdrawable *const pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-
-   if (pdraw != NULL && psc->frameTracking != NULL) {
-      int64_t sbc, missedFrames;
-      float lastMissedUsage;
-
-      status = psc->frameTracking->queryFrameTracking(pdraw->driDrawable,
-                                                      &sbc,
-                                                      &missedFrames,
-                                                      &lastMissedUsage,
-                                                      usage);
-   }
-#else
-   (void) dpy;
-   (void) drawable;
-   (void) usage;
-#endif
-   return status;
-}
-
-
-static GLint
-__glXQueryFrameTrackingMESA(Display * dpy, GLXDrawable drawable,
-                            int64_t * sbc, int64_t * missedFrames,
-                            GLfloat * lastMissedUsage)
-{
-   int status = GLX_BAD_CONTEXT;
-#ifdef __DRI_FRAME_TRACKING
-   int screen = 0;
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-
-   if (pdraw != NULL && psc->frameTracking != NULL) {
-      float usage;
-
-      status = psc->frameTracking->queryFrameTracking(pdraw->driDrawable,
-                                                      sbc, missedFrames,
-                                                      lastMissedUsage,
-                                                      &usage);
-   }
-#else
-   (void) dpy;
-   (void) drawable;
-   (void) sbc;
-   (void) missedFrames;
-   (void) lastMissedUsage;
-#endif
-   return status;
-}
-
-
-/*
-** GLX_SGI_video_sync
-*/
-static int
-__glXGetVideoSyncSGI(unsigned int *count)
-{
-   int64_t ust, msc, sbc;
-   int ret;
-   GLXContext gc = __glXGetCurrentContext();
-   __GLXscreenConfigs *psc;
-   __GLXDRIdrawable *pdraw;
-
-   if (!gc || !gc->driContext)
-      return GLX_BAD_CONTEXT;
-
-   psc = GetGLXScreenConfigs(gc->currentDpy, gc->screen);
-   pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
-
-   /* FIXME: Looking at the GLX_SGI_video_sync spec in the extension registry,
-    * FIXME: there should be a GLX encoding for this call.  I can find no
-    * FIXME: documentation for the GLX encoding.
-    */
-#ifdef __DRI_MEDIA_STREAM_COUNTER
-   if ( psc->msc && psc->driScreen ) {
-      ret = (*psc->msc->getDrawableMSC)(psc->__driScreen,
-                                       pdraw->driDrawable, &msc);
-      *count = (unsigned) msc;
-
-      return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
-   }
-#endif
-   if (psc->driScreen && psc->driScreen->getDrawableMSC) {
-      ret = psc->driScreen->getDrawableMSC(psc, pdraw, &ust, &msc, &sbc);
-      *count = (unsigned) msc;
-      return (ret == True) ? 0 : GLX_BAD_CONTEXT;
-   }
-
-   return GLX_BAD_CONTEXT;
-}
-
-static int
-__glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
-{
-   GLXContext gc = __glXGetCurrentContext();
-   __GLXscreenConfigs *psc;
-   __GLXDRIdrawable *pdraw;
-   int64_t ust, msc, sbc;
-   int ret;
-
-   if (divisor <= 0 || remainder < 0)
-      return GLX_BAD_VALUE;
-
-   if (!gc || !gc->driContext)
-      return GLX_BAD_CONTEXT;
-
-   psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
-   pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
-
-#ifdef __DRI_MEDIA_STREAM_COUNTER
-   if (psc->msc != NULL && psc->driScreen ) {
-      ret = (*psc->msc->waitForMSC)(pdraw->driDrawable, 0,
-                                   divisor, remainder, &msc, &sbc);
-      *count = (unsigned) msc;
-      return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
-   }
-#endif
-   if (psc->driScreen && psc->driScreen->waitForMSC) {
-      ret = psc->driScreen->waitForMSC(pdraw, 0, divisor, remainder, &ust, &msc,
-                                      &sbc);
-      *count = (unsigned) msc;
-      return (ret == True) ? 0 : GLX_BAD_CONTEXT;
-   }
-
-   return GLX_BAD_CONTEXT;
-}
-
-
-/*
-** GLX_SGIX_fbconfig
-** Many of these functions are aliased to GLX 1.3 entry points in the 
-** GLX_functions table.
-*/
-
-PUBLIC
-GLX_ALIAS(int, glXGetFBConfigAttribSGIX,
-          (Display * dpy, GLXFBConfigSGIX config, int attribute, int *value),
-          (dpy, config, attribute, value), glXGetFBConfigAttrib)
-
-PUBLIC GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX,
-                 (Display * dpy, int screen, int *attrib_list,
-                  int *nelements), (dpy, screen, attrib_list, nelements),
-                 glXChooseFBConfig)
-
-PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX,
-                 (Display * dpy, GLXFBConfigSGIX config),
-                 (dpy, config), glXGetVisualFromFBConfig)
-
-PUBLIC GLXPixmap
-glXCreateGLXPixmapWithConfigSGIX(Display * dpy,
-                                 GLXFBConfigSGIX config,
-                                 Pixmap pixmap)
-{
-   xGLXVendorPrivateWithReplyReq *vpreq;
-   xGLXCreateGLXPixmapWithConfigSGIXReq *req;
-   GLXPixmap xid = None;
-   CARD8 opcode;
-   const __GLcontextModes *const fbconfig = (__GLcontextModes *) config;
-   __GLXscreenConfigs *psc;
-
-
-   if ((dpy == NULL) || (config == NULL)) {
-      return None;
-   }
-
-   psc = GetGLXScreenConfigs(dpy, fbconfig->screen);
-   if ((psc != NULL)
-       && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) {
-      opcode = __glXSetupForCommand(dpy);
-      if (!opcode) {
-         return None;
-      }
-
-      /* Send the glXCreateGLXPixmapWithConfigSGIX request */
-      LockDisplay(dpy);
-      GetReqExtra(GLXVendorPrivateWithReply,
-                  sz_xGLXCreateGLXPixmapWithConfigSGIXReq -
-                  sz_xGLXVendorPrivateWithReplyReq, vpreq);
-      req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) vpreq;
-      req->reqType = opcode;
-      req->glxCode = X_GLXVendorPrivateWithReply;
-      req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
-      req->screen = fbconfig->screen;
-      req->fbconfig = fbconfig->fbconfigID;
-      req->pixmap = pixmap;
-      req->glxpixmap = xid = XAllocID(dpy);
-      UnlockDisplay(dpy);
-      SyncHandle();
-   }
-
-   return xid;
-}
-
-PUBLIC GLXContext
-glXCreateContextWithConfigSGIX(Display * dpy,
-                               GLXFBConfigSGIX config, int renderType,
-                               GLXContext shareList, Bool allowDirect)
-{
-   GLXContext gc = NULL;
-   const __GLcontextModes *const fbconfig = (__GLcontextModes *) config;
-   __GLXscreenConfigs *psc;
-
-
-   if ((dpy == NULL) || (config == NULL)) {
-      return None;
-   }
-
-   psc = GetGLXScreenConfigs(dpy, fbconfig->screen);
-   if ((psc != NULL)
-       && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) {
-      gc = CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList,
-                         allowDirect, None, False, renderType);
-   }
-
-   return gc;
-}
-
-
-PUBLIC GLXFBConfigSGIX
-glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis)
-{
-   __GLXdisplayPrivate *priv;
-   __GLXscreenConfigs *psc = NULL;
-
-   if ((GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc) != Success)
-       && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)
-       && (psc->configs->fbconfigID != GLX_DONT_CARE)) {
-      return (GLXFBConfigSGIX) _gl_context_modes_find_visual(psc->configs,
-                                                             vis->visualid);
-   }
-
-   return NULL;
-}
-
-
-/*
-** GLX_SGIX_swap_group
-*/
-static void
-__glXJoinSwapGroupSGIX(Display * dpy, GLXDrawable drawable,
-                       GLXDrawable member)
-{
-   (void) dpy;
-   (void) drawable;
-   (void) member;
-}
-
-
-/*
-** GLX_SGIX_swap_barrier
-*/
-static void
-__glXBindSwapBarrierSGIX(Display * dpy, GLXDrawable drawable, int barrier)
-{
-   (void) dpy;
-   (void) drawable;
-   (void) barrier;
-}
-
-static Bool
-__glXQueryMaxSwapBarriersSGIX(Display * dpy, int screen, int *max)
-{
-   (void) dpy;
-   (void) screen;
-   (void) max;
-   return False;
-}
-
-
-/*
-** GLX_OML_sync_control
-*/
-static Bool
-__glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
-                      int64_t * ust, int64_t * msc, int64_t * sbc)
-{
-   __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
-   int i, ret;
-   __GLXDRIdrawable *pdraw;
-   __GLXscreenConfigs *psc;
-
-   if (!priv)
-      return False;
-
-   pdraw = GetGLXDRIDrawable(dpy, drawable, &i);
-   psc = &priv->screenConfigs[i];
-
-#if defined(__DRI_SWAP_BUFFER_COUNTER) && defined(__DRI_MEDIA_STREAM_COUNTER)
-   if (pdraw && psc->sbc && psc->sbc)
-      return ( (pdraw && psc->sbc && psc->msc)
-              && ((*psc->msc->getMSC)(psc->driScreen, msc) == 0)
-              && ((*psc->sbc->getSBC)(pdraw->driDrawable, sbc) == 0)
-              && (__glXGetUST(ust) == 0) );
-#endif
-   if (pdraw && psc && psc->driScreen && psc->driScreen->getDrawableMSC) {
-      ret = psc->driScreen->getDrawableMSC(psc, pdraw, ust, msc, sbc);
-      return ret;
-   }
-
-   return False;
-}
-
-#ifdef GLX_DIRECT_RENDERING
-_X_HIDDEN GLboolean
-__driGetMscRateOML(__DRIdrawable * draw,
-                   int32_t * numerator, int32_t * denominator, void *private)
-{
-#ifdef XF86VIDMODE
-   __GLXscreenConfigs *psc;
-   XF86VidModeModeLine mode_line;
-   int dot_clock;
-   int i;
-   __GLXDRIdrawable *glxDraw = private;
-
-   psc = glxDraw->psc;
-   if (XF86VidModeQueryVersion(psc->dpy, &i, &i) &&
-       XF86VidModeGetModeLine(psc->dpy, psc->scr, &dot_clock, &mode_line)) {
-      unsigned n = dot_clock * 1000;
-      unsigned d = mode_line.vtotal * mode_line.htotal;
-
-# define V_INTERLACE 0x010
-# define V_DBLSCAN   0x020
-
-      if (mode_line.flags & V_INTERLACE)
-         n *= 2;
-      else if (mode_line.flags & V_DBLSCAN)
-         d *= 2;
-
-      /* The OML_sync_control spec requires that if the refresh rate is a
-       * whole number, that the returned numerator be equal to the refresh
-       * rate and the denominator be 1.
-       */
-
-      if (n % d == 0) {
-         n /= d;
-         d = 1;
-      }
-      else {
-         static const unsigned f[] = { 13, 11, 7, 5, 3, 2, 0 };
-
-         /* This is a poor man's way to reduce a fraction.  It's far from
-          * perfect, but it will work well enough for this situation.
-          */
-
-         for (i = 0; f[i] != 0; i++) {
-            while (n % f[i] == 0 && d % f[i] == 0) {
-               d /= f[i];
-               n /= f[i];
-            }
-         }
-      }
-
-      *numerator = n;
-      *denominator = d;
-
-      return True;
-   }
-   else
-      return False;
-#else
-   return False;
-#endif
-}
-#endif
-
-/**
- * Determine the refresh rate of the specified drawable and display.
- *
- * \param dpy          Display whose refresh rate is to be determined.
- * \param drawable     Drawable whose refresh rate is to be determined.
- * \param numerator    Numerator of the refresh rate.
- * \param demoninator  Denominator of the refresh rate.
- * \return  If the refresh rate for the specified display and drawable could
- *          be calculated, True is returned.  Otherwise False is returned.
- *
- * \note This function is implemented entirely client-side.  A lot of other
- *       functionality is required to export GLX_OML_sync_control, so on
- *       XFree86 this function can be called for direct-rendering contexts
- *       when GLX_OML_sync_control appears in the client extension string.
- */
-
-_X_HIDDEN GLboolean
-__glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
-                   int32_t * numerator, int32_t * denominator)
-{
-#if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
-   __GLXDRIdrawable *draw = GetGLXDRIDrawable(dpy, drawable, NULL);
-
-   if (draw == NULL)
-      return False;
-
-   return __driGetMscRateOML(draw->driDrawable, numerator, denominator, draw);
-#else
-   (void) dpy;
-   (void) drawable;
-   (void) numerator;
-   (void) denominator;
-#endif
-   return False;
-}
-
-
-static int64_t
-__glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
-                       int64_t target_msc, int64_t divisor, int64_t remainder)
-{
-   GLXContext gc = __glXGetCurrentContext();
-   int screen;
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-
-   if (!pdraw || !gc->driContext) /* no GLX for this */
-      return -1;
-
-   /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
-    * error", but it also says "It [glXSwapBuffersMscOML] will return a value
-    * of -1 if the function failed because of errors detected in the input
-    * parameters"
-    */
-   if (divisor < 0 || remainder < 0 || target_msc < 0)
-      return -1;
-   if (divisor > 0 && remainder >= divisor)
-      return -1;
-
-#ifdef __DRI_SWAP_BUFFER_COUNTER
-   if (psc->counters != NULL)
-      return (*psc->sbc->swapBuffersMSC)(pdraw->driDrawable, target_msc,
-                                        divisor, remainder);
-#endif
-
-#ifdef GLX_DIRECT_RENDERING
-   if (psc->driScreen && psc->driScreen->swapBuffers)
-      return (*psc->driScreen->swapBuffers)(pdraw, target_msc, divisor,
-                                           remainder);
-#endif
-
-   return -1;
-}
-
-
-static Bool
-__glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
-                   int64_t target_msc, int64_t divisor,
-                   int64_t remainder, int64_t * ust,
-                   int64_t * msc, int64_t * sbc)
-{
-   int screen;
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
-   int ret;
-
-   fprintf(stderr, "waitmsc: %lld, %lld, %lld\n", target_msc, divisor,
-          remainder);
-
-   /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
-    * error", but the return type in the spec is Bool.
-    */
-   if (divisor < 0 || remainder < 0 || target_msc < 0)
-      return False;
-   if (divisor > 0 && remainder >= divisor)
-      return False;
-
-#ifdef __DRI_MEDIA_STREAM_COUNTER
-   if (pdraw != NULL && psc->msc != NULL) {
-      fprintf(stderr, "dri1 msc\n");
-      ret = (*psc->msc->waitForMSC) (pdraw->driDrawable, target_msc,
-                                     divisor, remainder, msc, sbc);
-
-      /* __glXGetUST returns zero on success and non-zero on failure.
-       * This function returns True on success and False on failure.
-       */
-      return ((ret == 0) && (__glXGetUST(ust) == 0));
-   }
-#endif
-   if (pdraw && psc->driScreen && psc->driScreen->waitForMSC) {
-      ret = psc->driScreen->waitForMSC(pdraw, target_msc, divisor, remainder,
-                                      ust, msc, sbc);
-      return ret;
-   }
-
-   fprintf(stderr, "no drawable??\n");
-   return False;
-}
-
-
-static Bool
-__glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
-                   int64_t target_sbc, int64_t * ust,
-                   int64_t * msc, int64_t * sbc)
-{
-   int screen;
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-   int ret;
-
-   /* The OML_sync_control spec says this should "generate a GLX_BAD_VALUE
-    * error", but the return type in the spec is Bool.
-    */
-   if (target_sbc < 0)
-      return False;
-#ifdef __DRI_SWAP_BUFFER_COUNTER
-   if (pdraw != NULL && psc->sbc != NULL) {
-      ret =
-         (*psc->sbc->waitForSBC) (pdraw->driDrawable, target_sbc, msc, sbc);
-
-      /* __glXGetUST returns zero on success and non-zero on failure.
-       * This function returns True on success and False on failure.
-       */
-      return ((ret == 0) && (__glXGetUST(ust) == 0));
-   }
-#endif
-   if (pdraw && psc->driScreen && psc->driScreen->waitForMSC) {
-      ret = psc->driScreen->waitForSBC(pdraw, target_sbc, ust, msc, sbc);
-      return ret;
-   }
-   return False;
-}
-
-
-/**
- * GLX_MESA_allocate_memory
- */
-/*@{*/
-
-PUBLIC void *
-glXAllocateMemoryMESA(Display * dpy, int scrn,
-                      size_t size, float readFreq,
-                      float writeFreq, float priority)
-{
-#ifdef __DRI_ALLOCATE
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
-
-   if (psc && psc->allocate)
-      return (*psc->allocate->allocateMemory) (psc->__driScreen, size,
-                                               readFreq, writeFreq, priority);
-
-#else
-   (void) dpy;
-   (void) scrn;
-   (void) size;
-   (void) readFreq;
-   (void) writeFreq;
-   (void) priority;
-#endif /* __DRI_ALLOCATE */
-
-   return NULL;
-}
-
-
-PUBLIC void
-glXFreeMemoryMESA(Display * dpy, int scrn, void *pointer)
-{
-#ifdef __DRI_ALLOCATE
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
-
-   if (psc && psc->allocate)
-      (*psc->allocate->freeMemory) (psc->__driScreen, pointer);
-
-#else
-   (void) dpy;
-   (void) scrn;
-   (void) pointer;
-#endif /* __DRI_ALLOCATE */
-}
-
-
-PUBLIC GLuint
-glXGetMemoryOffsetMESA(Display * dpy, int scrn, const void *pointer)
-{
-#ifdef __DRI_ALLOCATE
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
-
-   if (psc && psc->allocate)
-      return (*psc->allocate->memoryOffset) (psc->__driScreen, pointer);
-
-#else
-   (void) dpy;
-   (void) scrn;
-   (void) pointer;
-#endif /* GLX_DIRECT_RENDERING */
-
-   return ~0L;
-}
-
-/*@}*/
-
-
-/**
- * Mesa extension stubs.  These will help reduce portability problems.
- */
-/*@{*/
-
-/**
- * Release all buffers associated with the specified GLX drawable.
- *
- * \todo
- * This function was intended for stand-alone Mesa.  The issue there is that
- * the library doesn't get any notification when a window is closed.  In
- * DRI there is a similar but slightly different issue.  When GLX 1.3 is
- * supported, there are 3 different functions to destroy a drawable.  It
- * should be possible to create GLX protocol (or have it determine which
- * protocol to use based on the type of the drawable) to have one function
- * do the work of 3.  For the direct-rendering case, this function could
- * just call the driver's \c __DRIdrawableRec::destroyDrawable function.
- * This would reduce the frequency with which \c __driGarbageCollectDrawables
- * would need to be used.  This really should be done as part of the new DRI
- * interface work.
- *
- * \sa http://oss.sgi.com/projects/ogl-sample/registry/MESA/release_buffers.txt
- *     __driGarbageCollectDrawables
- *     glXDestroyGLXPixmap
- *     glXDestroyPbuffer glXDestroyPixmap glXDestroyWindow
- *     glXDestroyGLXPbufferSGIX glXDestroyGLXVideoSourceSGIX
- */
-static Bool
-__glXReleaseBuffersMESA(Display * dpy, GLXDrawable d)
-{
-   (void) dpy;
-   (void) d;
-   return False;
-}
-
-
-PUBLIC GLXPixmap
-glXCreateGLXPixmapMESA(Display * dpy, XVisualInfo * visual,
-                       Pixmap pixmap, Colormap cmap)
-{
-   (void) dpy;
-   (void) visual;
-   (void) pixmap;
-   (void) cmap;
-   return 0;
-}
-
-/*@}*/
-
-
-/**
- * GLX_MESA_copy_sub_buffer
- */
-#define X_GLXvop_CopySubBufferMESA 5154 /* temporary */
-static void
-__glXCopySubBufferMESA(Display * dpy, GLXDrawable drawable,
-                       int x, int y, int width, int height)
-{
-   xGLXVendorPrivateReq *req;
-   GLXContext gc;
-   GLXContextTag tag;
-   CARD32 *drawable_ptr;
-   INT32 *x_ptr, *y_ptr, *w_ptr, *h_ptr;
-   CARD8 opcode;
-
-#ifdef __DRI_COPY_SUB_BUFFER
-   int screen;
-   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
-   if (pdraw != NULL) {
-      __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-      if (psc->driScreen->copySubBuffer != NULL) {
-         glFlush();
-         (*psc->driScreen->copySubBuffer) (pdraw, x, y, width, height);
-      }
-
-      return;
-   }
-#endif
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return;
-
-   /*
-    ** The calling thread may or may not have a current context.  If it
-    ** does, send the context tag so the server can do a flush.
-    */
-   gc = __glXGetCurrentContext();
-   if ((gc != NULL) && (dpy == gc->currentDpy) &&
-       ((drawable == gc->currentDrawable) ||
-        (drawable == gc->currentReadable))) {
-      tag = gc->currentContextTag;
-   }
-   else {
-      tag = 0;
-   }
-
-   LockDisplay(dpy);
-   GetReqExtra(GLXVendorPrivate, sizeof(CARD32) + sizeof(INT32) * 4, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXVendorPrivate;
-   req->vendorCode = X_GLXvop_CopySubBufferMESA;
-   req->contextTag = tag;
-
-   drawable_ptr = (CARD32 *) (req + 1);
-   x_ptr = (INT32 *) (drawable_ptr + 1);
-   y_ptr = (INT32 *) (drawable_ptr + 2);
-   w_ptr = (INT32 *) (drawable_ptr + 3);
-   h_ptr = (INT32 *) (drawable_ptr + 4);
-
-   *drawable_ptr = drawable;
-   *x_ptr = x;
-   *y_ptr = y;
-   *w_ptr = width;
-   *h_ptr = height;
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-
-/**
- * GLX_EXT_texture_from_pixmap
- */
-/*@{*/
-static void
-__glXBindTexImageEXT(Display * dpy,
-                     GLXDrawable drawable, int buffer, const int *attrib_list)
-{
-   xGLXVendorPrivateReq *req;
-   GLXContext gc = __glXGetCurrentContext();
-   CARD32 *drawable_ptr;
-   INT32 *buffer_ptr;
-   CARD32 *num_attrib_ptr;
-   CARD32 *attrib_ptr;
-   CARD8 opcode;
-   unsigned int i;
-
-   if (gc == NULL)
-      return;
-
-   i = 0;
-   if (attrib_list) {
-      while (attrib_list[i * 2] != None)
-         i++;
-   }
-
-#ifdef GLX_DIRECT_RENDERING
-   if (gc->driContext) {
-      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
-
-      if (pdraw != NULL) {
-         if (pdraw->psc->texBuffer->base.version >= 2 &&
-             pdraw->psc->texBuffer->setTexBuffer2 != NULL) {
-            (*pdraw->psc->texBuffer->setTexBuffer2) (gc->__driContext,
-                                                     pdraw->textureTarget,
-                                                     pdraw->textureFormat,
-                                                     pdraw->driDrawable);
-         }
-         else {
-            (*pdraw->psc->texBuffer->setTexBuffer) (gc->__driContext,
-                                                    pdraw->textureTarget,
-                                                    pdraw->driDrawable);
-         }
-      }
-      return;
-   }
-#endif
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return;
-
-   LockDisplay(dpy);
-   GetReqExtra(GLXVendorPrivate, 12 + 8 * i, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXVendorPrivate;
-   req->vendorCode = X_GLXvop_BindTexImageEXT;
-   req->contextTag = gc->currentContextTag;
-
-   drawable_ptr = (CARD32 *) (req + 1);
-   buffer_ptr = (INT32 *) (drawable_ptr + 1);
-   num_attrib_ptr = (CARD32 *) (buffer_ptr + 1);
-   attrib_ptr = (CARD32 *) (num_attrib_ptr + 1);
-
-   *drawable_ptr = drawable;
-   *buffer_ptr = buffer;
-   *num_attrib_ptr = (CARD32) i;
-
-   i = 0;
-   if (attrib_list) {
-      while (attrib_list[i * 2] != None) {
-         *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 0];
-         *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 1];
-         i++;
-      }
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-static void
-__glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
-{
-   xGLXVendorPrivateReq *req;
-   GLXContext gc = __glXGetCurrentContext();
-   CARD32 *drawable_ptr;
-   INT32 *buffer_ptr;
-   CARD8 opcode;
-
-   if (gc == NULL)
-      return;
-
-#ifdef GLX_DIRECT_RENDERING
-   if (gc->driContext)
-      return;
-#endif
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode)
-      return;
-
-   LockDisplay(dpy);
-   GetReqExtra(GLXVendorPrivate, sizeof(CARD32) + sizeof(INT32), req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXVendorPrivate;
-   req->vendorCode = X_GLXvop_ReleaseTexImageEXT;
-   req->contextTag = gc->currentContextTag;
-
-   drawable_ptr = (CARD32 *) (req + 1);
-   buffer_ptr = (INT32 *) (drawable_ptr + 1);
-
-   *drawable_ptr = drawable;
-   *buffer_ptr = buffer;
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-/*@}*/
-
-/**
- * \c strdup is actually not a standard ANSI C or POSIX routine.
- * Irix will not define it if ANSI mode is in effect.
- *
- * \sa strdup
- */
-_X_HIDDEN char *
-__glXstrdup(const char *str)
-{
-   char *copy;
-   copy = (char *) Xmalloc(strlen(str) + 1);
-   if (!copy)
-      return NULL;
-   strcpy(copy, str);
-   return copy;
-}
-
-/*
-** glXGetProcAddress support
-*/
-
-struct name_address_pair
-{
-   const char *Name;
-   GLvoid *Address;
-};
-
-#define GLX_FUNCTION(f) { # f, (GLvoid *) f }
-#define GLX_FUNCTION2(n,f) { # n, (GLvoid *) f }
-
-static const struct name_address_pair GLX_functions[] = {
-   /*** GLX_VERSION_1_0 ***/
-   GLX_FUNCTION(glXChooseVisual),
-   GLX_FUNCTION(glXCopyContext),
-   GLX_FUNCTION(glXCreateContext),
-   GLX_FUNCTION(glXCreateGLXPixmap),
-   GLX_FUNCTION(glXDestroyContext),
-   GLX_FUNCTION(glXDestroyGLXPixmap),
-   GLX_FUNCTION(glXGetConfig),
-   GLX_FUNCTION(glXGetCurrentContext),
-   GLX_FUNCTION(glXGetCurrentDrawable),
-   GLX_FUNCTION(glXIsDirect),
-   GLX_FUNCTION(glXMakeCurrent),
-   GLX_FUNCTION(glXQueryExtension),
-   GLX_FUNCTION(glXQueryVersion),
-   GLX_FUNCTION(glXSwapBuffers),
-   GLX_FUNCTION(glXUseXFont),
-   GLX_FUNCTION(glXWaitGL),
-   GLX_FUNCTION(glXWaitX),
-
-   /*** GLX_VERSION_1_1 ***/
-   GLX_FUNCTION(glXGetClientString),
-   GLX_FUNCTION(glXQueryExtensionsString),
-   GLX_FUNCTION(glXQueryServerString),
-
-   /*** GLX_VERSION_1_2 ***/
-   GLX_FUNCTION(glXGetCurrentDisplay),
-
-   /*** GLX_VERSION_1_3 ***/
-   GLX_FUNCTION(glXChooseFBConfig),
-   GLX_FUNCTION(glXCreateNewContext),
-   GLX_FUNCTION(glXCreatePbuffer),
-   GLX_FUNCTION(glXCreatePixmap),
-   GLX_FUNCTION(glXCreateWindow),
-   GLX_FUNCTION(glXDestroyPbuffer),
-   GLX_FUNCTION(glXDestroyPixmap),
-   GLX_FUNCTION(glXDestroyWindow),
-   GLX_FUNCTION(glXGetCurrentReadDrawable),
-   GLX_FUNCTION(glXGetFBConfigAttrib),
-   GLX_FUNCTION(glXGetFBConfigs),
-   GLX_FUNCTION(glXGetSelectedEvent),
-   GLX_FUNCTION(glXGetVisualFromFBConfig),
-   GLX_FUNCTION(glXMakeContextCurrent),
-   GLX_FUNCTION(glXQueryContext),
-   GLX_FUNCTION(glXQueryDrawable),
-   GLX_FUNCTION(glXSelectEvent),
-
-   /*** GLX_SGI_swap_control ***/
-   GLX_FUNCTION2(glXSwapIntervalSGI, __glXSwapIntervalSGI),
-
-   /*** GLX_SGI_video_sync ***/
-   GLX_FUNCTION2(glXGetVideoSyncSGI, __glXGetVideoSyncSGI),
-   GLX_FUNCTION2(glXWaitVideoSyncSGI, __glXWaitVideoSyncSGI),
-
-   /*** GLX_SGI_make_current_read ***/
-   GLX_FUNCTION2(glXMakeCurrentReadSGI, glXMakeContextCurrent),
-   GLX_FUNCTION2(glXGetCurrentReadDrawableSGI, glXGetCurrentReadDrawable),
-
-   /*** GLX_EXT_import_context ***/
-   GLX_FUNCTION(glXFreeContextEXT),
-   GLX_FUNCTION(glXGetContextIDEXT),
-   GLX_FUNCTION2(glXGetCurrentDisplayEXT, glXGetCurrentDisplay),
-   GLX_FUNCTION(glXImportContextEXT),
-   GLX_FUNCTION2(glXQueryContextInfoEXT, glXQueryContext),
-
-   /*** GLX_SGIX_fbconfig ***/
-   GLX_FUNCTION2(glXGetFBConfigAttribSGIX, glXGetFBConfigAttrib),
-   GLX_FUNCTION2(glXChooseFBConfigSGIX, glXChooseFBConfig),
-   GLX_FUNCTION(glXCreateGLXPixmapWithConfigSGIX),
-   GLX_FUNCTION(glXCreateContextWithConfigSGIX),
-   GLX_FUNCTION2(glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig),
-   GLX_FUNCTION(glXGetFBConfigFromVisualSGIX),
-
-   /*** GLX_SGIX_pbuffer ***/
-   GLX_FUNCTION(glXCreateGLXPbufferSGIX),
-   GLX_FUNCTION(glXDestroyGLXPbufferSGIX),
-   GLX_FUNCTION(glXQueryGLXPbufferSGIX),
-   GLX_FUNCTION(glXSelectEventSGIX),
-   GLX_FUNCTION(glXGetSelectedEventSGIX),
-
-   /*** GLX_SGIX_swap_group ***/
-   GLX_FUNCTION2(glXJoinSwapGroupSGIX, __glXJoinSwapGroupSGIX),
-
-   /*** GLX_SGIX_swap_barrier ***/
-   GLX_FUNCTION2(glXBindSwapBarrierSGIX, __glXBindSwapBarrierSGIX),
-   GLX_FUNCTION2(glXQueryMaxSwapBarriersSGIX, __glXQueryMaxSwapBarriersSGIX),
-
-   /*** GLX_MESA_allocate_memory ***/
-   GLX_FUNCTION(glXAllocateMemoryMESA),
-   GLX_FUNCTION(glXFreeMemoryMESA),
-   GLX_FUNCTION(glXGetMemoryOffsetMESA),
-
-   /*** GLX_MESA_copy_sub_buffer ***/
-   GLX_FUNCTION2(glXCopySubBufferMESA, __glXCopySubBufferMESA),
-
-   /*** GLX_MESA_pixmap_colormap ***/
-   GLX_FUNCTION(glXCreateGLXPixmapMESA),
-
-   /*** GLX_MESA_release_buffers ***/
-   GLX_FUNCTION2(glXReleaseBuffersMESA, __glXReleaseBuffersMESA),
-
-   /*** GLX_MESA_swap_control ***/
-   GLX_FUNCTION2(glXSwapIntervalMESA, __glXSwapIntervalMESA),
-   GLX_FUNCTION2(glXGetSwapIntervalMESA, __glXGetSwapIntervalMESA),
-
-   /*** GLX_MESA_swap_frame_usage ***/
-   GLX_FUNCTION2(glXBeginFrameTrackingMESA, __glXBeginFrameTrackingMESA),
-   GLX_FUNCTION2(glXEndFrameTrackingMESA, __glXEndFrameTrackingMESA),
-   GLX_FUNCTION2(glXGetFrameUsageMESA, __glXGetFrameUsageMESA),
-   GLX_FUNCTION2(glXQueryFrameTrackingMESA, __glXQueryFrameTrackingMESA),
-
-   /*** GLX_ARB_get_proc_address ***/
-   GLX_FUNCTION(glXGetProcAddressARB),
-
-   /*** GLX 1.4 ***/
-   GLX_FUNCTION2(glXGetProcAddress, glXGetProcAddressARB),
-
-   /*** GLX_OML_sync_control ***/
-   GLX_FUNCTION2(glXWaitForSbcOML, __glXWaitForSbcOML),
-   GLX_FUNCTION2(glXWaitForMscOML, __glXWaitForMscOML),
-   GLX_FUNCTION2(glXSwapBuffersMscOML, __glXSwapBuffersMscOML),
-   GLX_FUNCTION2(glXGetMscRateOML, __glXGetMscRateOML),
-   GLX_FUNCTION2(glXGetSyncValuesOML, __glXGetSyncValuesOML),
-
-   /*** GLX_EXT_texture_from_pixmap ***/
-   GLX_FUNCTION2(glXBindTexImageEXT, __glXBindTexImageEXT),
-   GLX_FUNCTION2(glXReleaseTexImageEXT, __glXReleaseTexImageEXT),
-
-#ifdef GLX_DIRECT_RENDERING
-   /*** DRI configuration ***/
-   GLX_FUNCTION(glXGetScreenDriver),
-   GLX_FUNCTION(glXGetDriverConfig),
-#endif
-
-   {NULL, NULL}                 /* end of list */
-};
-
-
-static const GLvoid *
-get_glx_proc_address(const char *funcName)
-{
-   GLuint i;
-
-   /* try static functions */
-   for (i = 0; GLX_functions[i].Name; i++) {
-      if (strcmp(GLX_functions[i].Name, funcName) == 0)
-         return GLX_functions[i].Address;
-   }
-
-   return NULL;
-}
-
-
-/**
- * Get the address of a named GL function.  This is the pre-GLX 1.4 name for
- * \c glXGetProcAddress.
- *
- * \param procName  Name of a GL or GLX function.
- * \returns         A pointer to the named function
- *
- * \sa glXGetProcAddress
- */
-PUBLIC void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
-{
-   typedef void (*gl_function) (void);
-   gl_function f;
-
-
-   /* Search the table of GLX and internal functions first.  If that
-    * fails and the supplied name could be a valid core GL name, try
-    * searching the core GL function table.  This check is done to prevent
-    * DRI based drivers from searching the core GL function table for
-    * internal API functions.
-    */
-
-   f = (gl_function) get_glx_proc_address((const char *) procName);
-   if ((f == NULL) && (procName[0] == 'g') && (procName[1] == 'l')
-       && (procName[2] != 'X')) {
-      f = (gl_function) _glapi_get_proc_address((const char *) procName);
-   }
-
-   return f;
-}
-
-/**
- * Get the address of a named GL function.  This is the GLX 1.4 name for
- * \c glXGetProcAddressARB.
- *
- * \param procName  Name of a GL or GLX function.
- * \returns         A pointer to the named function
- *
- * \sa glXGetProcAddressARB
- */
-PUBLIC void (*glXGetProcAddress(const GLubyte * procName)) (void)
-#if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
-   __attribute__ ((alias("glXGetProcAddressARB")));
-#else
-{
-   return glXGetProcAddressARB(procName);
-}
-#endif /* __GNUC__ */
-
-
-#ifdef GLX_DIRECT_RENDERING
-/**
- * Get the unadjusted system time (UST).  Currently, the UST is measured in
- * microseconds since Epoc.  The actual resolution of the UST may vary from
- * system to system, and the units may vary from release to release.
- * Drivers should not call this function directly.  They should instead use
- * \c glXGetProcAddress to obtain a pointer to the function.
- *
- * \param ust Location to store the 64-bit UST
- * \returns Zero on success or a negative errno value on failure.
- *
- * \sa glXGetProcAddress, PFNGLXGETUSTPROC
- *
- * \since Internal API version 20030317.
- */
-_X_HIDDEN int
-__glXGetUST(int64_t * ust)
-{
-   struct timeval tv;
-
-   if (ust == NULL) {
-      return -EFAULT;
-   }
-
-   if (gettimeofday(&tv, NULL) == 0) {
-      ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
-      return 0;
-   }
-   else {
-      return -errno;
-   }
-}
-#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c
deleted file mode 100644 (file)
index c28360b..0000000
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file glxcurrent.c
- * Client-side GLX interface for current context management.
- */
-
-#include "glxclient.h"
-#include "glapi.h"
-#include "indirect_init.h"
-
-/*
-** We setup some dummy structures here so that the API can be used
-** even if no context is current.
-*/
-
-static GLubyte dummyBuffer[__GLX_BUFFER_LIMIT_SIZE];
-
-/*
-** Dummy context used by small commands when there is no current context.
-** All the
-** gl and glx entry points are designed to operate as nop's when using
-** the dummy context structure.
-*/
-static __GLXcontext dummyContext = {
-   &dummyBuffer[0],
-   &dummyBuffer[0],
-   &dummyBuffer[0],
-   &dummyBuffer[__GLX_BUFFER_LIMIT_SIZE],
-   sizeof(dummyBuffer),
-};
-
-
-/*
-** All indirect rendering contexts will share the same indirect dispatch table.
-*/
-static __GLapi *IndirectAPI = NULL;
-
-
-/*
- * Current context management and locking
- */
-
-#if defined( PTHREADS )
-
-_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
-
-# if defined( GLX_USE_TLS )
-
-/**
- * Per-thread GLX context pointer.
- *
- * \c __glXSetCurrentContext is written is such a way that this pointer can
- * \b never be \c NULL.  This is important!  Because of this
- * \c __glXGetCurrentContext can be implemented as trivial macro.
- */
-__thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec")))
-   = &dummyContext;
-
-_X_HIDDEN void
-__glXSetCurrentContext(__GLXcontext * c)
-{
-   __glX_tls_Context = (c != NULL) ? c : &dummyContext;
-}
-
-# else
-
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
-/**
- * Per-thread data key.
- *
- * Once \c init_thread_data has been called, the per-thread data key will
- * take a value of \c NULL.  As each new thread is created the default
- * value, in that thread, will be \c NULL.
- */
-static pthread_key_t ContextTSD;
-
-/**
- * Initialize the per-thread data key.
- *
- * This function is called \b exactly once per-process (not per-thread!) to
- * initialize the per-thread data key.  This is ideally done using the
- * \c pthread_once mechanism.
- */
-static void
-init_thread_data(void)
-{
-   if (pthread_key_create(&ContextTSD, NULL) != 0) {
-      perror("pthread_key_create");
-      exit(-1);
-   }
-}
-
-_X_HIDDEN void
-__glXSetCurrentContext(__GLXcontext * c)
-{
-   pthread_once(&once_control, init_thread_data);
-   pthread_setspecific(ContextTSD, c);
-}
-
-_X_HIDDEN __GLXcontext *
-__glXGetCurrentContext(void)
-{
-   void *v;
-
-   pthread_once(&once_control, init_thread_data);
-
-   v = pthread_getspecific(ContextTSD);
-   return (v == NULL) ? &dummyContext : (__GLXcontext *) v;
-}
-
-# endif /* defined( GLX_USE_TLS ) */
-
-#elif defined( THREADS )
-
-#error Unknown threading method specified.
-
-#else
-
-/* not thread safe */
-_X_HIDDEN __GLXcontext *__glXcurrentContext = &dummyContext;
-
-#endif
-
-
-_X_HIDDEN void
-__glXSetCurrentContextNull(void)
-{
-   __glXSetCurrentContext(&dummyContext);
-#ifdef GLX_DIRECT_RENDERING
-   _glapi_set_dispatch(NULL);   /* no-op functions */
-   _glapi_set_context(NULL);
-#endif
-}
-
-
-/************************************************************************/
-
-PUBLIC GLXContext
-glXGetCurrentContext(void)
-{
-   GLXContext cx = __glXGetCurrentContext();
-
-   if (cx == &dummyContext) {
-      return NULL;
-   }
-   else {
-      return cx;
-   }
-}
-
-PUBLIC GLXDrawable
-glXGetCurrentDrawable(void)
-{
-   GLXContext gc = __glXGetCurrentContext();
-   return gc->currentDrawable;
-}
-
-
-/************************************************************************/
-
-/**
- * Sends a GLX protocol message to the specified display to make the context
- * and the drawables current.
- *
- * \param dpy     Display to send the message to.
- * \param opcode  Major opcode value for the display.
- * \param gc_id   Context tag for the context to be made current.
- * \param draw    Drawable ID for the "draw" drawable.
- * \param read    Drawable ID for the "read" drawable.
- * \param reply   Space to store the X-server's reply.
- *
- * \warning
- * This function assumes that \c dpy is locked with \c LockDisplay on entry.
- */
-static Bool
-SendMakeCurrentRequest(Display * dpy, CARD8 opcode,
-                       GLXContextID gc_id, GLXContextTag gc_tag,
-                       GLXDrawable draw, GLXDrawable read,
-                       xGLXMakeCurrentReply * reply)
-{
-   Bool ret;
-
-
-   LockDisplay(dpy);
-
-   if (draw == read) {
-      xGLXMakeCurrentReq *req;
-
-      GetReq(GLXMakeCurrent, req);
-      req->reqType = opcode;
-      req->glxCode = X_GLXMakeCurrent;
-      req->drawable = draw;
-      req->context = gc_id;
-      req->oldContextTag = gc_tag;
-   }
-   else {
-      __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-
-      /* If the server can support the GLX 1.3 version, we should
-       * perfer that.  Not only that, some servers support GLX 1.3 but
-       * not the SGI extension.
-       */
-
-      if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
-         xGLXMakeContextCurrentReq *req;
-
-         GetReq(GLXMakeContextCurrent, req);
-         req->reqType = opcode;
-         req->glxCode = X_GLXMakeContextCurrent;
-         req->drawable = draw;
-         req->readdrawable = read;
-         req->context = gc_id;
-         req->oldContextTag = gc_tag;
-      }
-      else {
-         xGLXVendorPrivateWithReplyReq *vpreq;
-         xGLXMakeCurrentReadSGIReq *req;
-
-         GetReqExtra(GLXVendorPrivateWithReply,
-                     sz_xGLXMakeCurrentReadSGIReq -
-                     sz_xGLXVendorPrivateWithReplyReq, vpreq);
-         req = (xGLXMakeCurrentReadSGIReq *) vpreq;
-         req->reqType = opcode;
-         req->glxCode = X_GLXVendorPrivateWithReply;
-         req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
-         req->drawable = draw;
-         req->readable = read;
-         req->context = gc_id;
-         req->oldContextTag = gc_tag;
-      }
-   }
-
-   ret = _XReply(dpy, (xReply *) reply, 0, False);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return ret;
-}
-
-
-#ifdef GLX_DIRECT_RENDERING
-static __GLXDRIdrawable *
-FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc)
-{
-   __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
-   __GLXDRIdrawable *pdraw;
-   __GLXscreenConfigs *psc;
-
-   if (priv == NULL)
-      return NULL;
-
-   psc = &priv->screenConfigs[gc->screen];
-   if (psc->drawHash == NULL)
-      return NULL;
-
-   if (__glxHashLookup(psc->drawHash, glxDrawable, (void *) &pdraw) == 0)
-      return pdraw;
-
-   pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
-                                          glxDrawable, gc->mode);
-   if (__glxHashInsert(psc->drawHash, glxDrawable, pdraw)) {
-      (*pdraw->destroyDrawable) (pdraw);
-      return NULL;
-   }
-
-   return pdraw;
-}
-#endif /* GLX_DIRECT_RENDERING */
-
-static void
-__glXGenerateError(Display * dpy, GLXContext gc, XID resource,
-                   BYTE errorCode, CARD16 minorCode)
-{
-   xError error;
-
-   error.errorCode = errorCode;
-   error.resourceID = resource;
-   error.sequenceNumber = dpy->request;
-   error.type = X_Error;
-   error.majorCode = gc->majorOpcode;
-   error.minorCode = minorCode;
-   _XError(dpy, &error);
-}
-
-/**
- * Make a particular context current.
- *
- * \note This is in this file so that it can access dummyContext.
- */
-static Bool
-MakeContextCurrent(Display * dpy, GLXDrawable draw,
-                   GLXDrawable read, GLXContext gc)
-{
-   xGLXMakeCurrentReply reply;
-   const GLXContext oldGC = __glXGetCurrentContext();
-   const CARD8 opcode = __glXSetupForCommand(dpy);
-   const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
-      ? opcode : __glXSetupForCommand(oldGC->currentDpy);
-   Bool bindReturnValue;
-   __GLXattribute *state;
-
-   if (!opcode || !oldOpcode) {
-      return GL_FALSE;
-   }
-
-   /* Make sure that the new context has a nonzero ID.  In the request,
-    * a zero context ID is used only to mean that we bind to no current
-    * context.
-    */
-   if ((gc != NULL) && (gc->xid == None)) {
-      return GL_FALSE;
-   }
-
-   if (gc == NULL && (draw != None || read != None)) {
-      __glXGenerateError(dpy, gc, (draw != None) ? draw : read,
-                         BadMatch, X_GLXMakeContextCurrent);
-      return False;
-   }
-   if (gc != NULL && (draw == None || read == None)) {
-      __glXGenerateError(dpy, gc, None, BadMatch, X_GLXMakeContextCurrent);
-      return False;
-   }
-
-   _glapi_check_multithread();
-
-   if (gc != NULL && gc->thread_id != 0 && gc->thread_id != _glthread_GetID()) {
-      __glXGenerateError(dpy, gc, gc->xid,
-                         BadAccess, X_GLXMakeContextCurrent);
-      return False;
-   }
-
-#ifdef GLX_DIRECT_RENDERING
-   /* Bind the direct rendering context to the drawable */
-   if (gc && gc->driContext) {
-      __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
-      __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc);
-
-      if ((pdraw == NULL) || (pread == NULL)) {
-         __glXGenerateError(dpy, gc, (pdraw == NULL) ? draw : read,
-                            GLXBadDrawable, X_GLXMakeContextCurrent);
-         return False;
-      }
-
-      bindReturnValue =
-         (gc->driContext->bindContext) (gc->driContext, pdraw, pread);
-   }
-   else if (!gc && oldGC && oldGC->driContext) {
-      bindReturnValue = True;
-   }
-   else
-#endif
-   {
-      /* Send a glXMakeCurrent request to bind the new context. */
-      bindReturnValue =
-         SendMakeCurrentRequest(dpy, opcode, gc ? gc->xid : None,
-                                ((dpy != oldGC->currentDpy)
-                                 || oldGC->isDirect)
-                                ? None : oldGC->currentContextTag, draw, read,
-                                &reply);
-   }
-
-
-   if (!bindReturnValue) {
-      return False;
-   }
-
-#ifdef GLX_DIRECT_RENDERING
-   if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) &&
-       !oldGC->isDirect && oldGC != &dummyContext) {
-#else
-   if ((dpy != oldGC->currentDpy) && oldGC != &dummyContext) {
-#endif
-      xGLXMakeCurrentReply dummy_reply;
-
-      /* We are either switching from one dpy to another and have to
-       * send a request to the previous dpy to unbind the previous
-       * context, or we are switching away from a indirect context to
-       * a direct context and have to send a request to the dpy to
-       * unbind the previous context.
-       */
-      (void) SendMakeCurrentRequest(oldGC->currentDpy, oldOpcode, None,
-                                    oldGC->currentContextTag, None, None,
-                                    &dummy_reply);
-   }
-#ifdef GLX_DIRECT_RENDERING
-   else if (oldGC->driContext && oldGC != gc) {
-      oldGC->driContext->unbindContext(oldGC->driContext);
-   }
-#endif
-
-
-   /* Update our notion of what is current */
-   __glXLock();
-   if (gc == oldGC) {
-      /* Even though the contexts are the same the drawable might have
-       * changed.  Note that gc cannot be the dummy, and that oldGC
-       * cannot be NULL, therefore if they are the same, gc is not
-       * NULL and not the dummy.
-       */
-      gc->currentDrawable = draw;
-      gc->currentReadable = read;
-   }
-   else {
-      if (oldGC != &dummyContext) {
-         /* Old current context is no longer current to anybody */
-         oldGC->currentDpy = 0;
-         oldGC->currentDrawable = None;
-         oldGC->currentReadable = None;
-         oldGC->currentContextTag = 0;
-         oldGC->thread_id = 0;
-
-         if (oldGC->xid == None) {
-            /* We are switching away from a context that was
-             * previously destroyed, so we need to free the memory
-             * for the old handle.
-             */
-#ifdef GLX_DIRECT_RENDERING
-            /* Destroy the old direct rendering context */
-            if (oldGC->driContext) {
-               oldGC->driContext->destroyContext(oldGC->driContext,
-                                                 oldGC->psc,
-                                                 oldGC->createDpy);
-               oldGC->driContext = NULL;
-            }
-#endif
-            __glXFreeContext(oldGC);
-         }
-      }
-      if (gc) {
-         __glXSetCurrentContext(gc);
-
-         gc->currentDpy = dpy;
-         gc->currentDrawable = draw;
-         gc->currentReadable = read;
-         gc->thread_id = _glthread_GetID();
-
-#ifdef GLX_DIRECT_RENDERING
-         if (!gc->driContext) {
-#endif
-            if (!IndirectAPI)
-               IndirectAPI = __glXNewIndirectAPI();
-            _glapi_set_dispatch(IndirectAPI);
-
-            state = (__GLXattribute *) (gc->client_state_private);
-
-            gc->currentContextTag = reply.contextTag;
-            if (state->array_state == NULL) {
-               (void) glGetString(GL_EXTENSIONS);
-               (void) glGetString(GL_VERSION);
-               __glXInitVertexArrayState(gc);
-            }
-#ifdef GLX_DIRECT_RENDERING
-         }
-         else {
-            gc->currentContextTag = -1;
-         }
-#endif
-      }
-      else {
-         __glXSetCurrentContextNull();
-      }
-   }
-   __glXUnlock();
-   return GL_TRUE;
-}
-
-
-PUBLIC Bool
-glXMakeCurrent(Display * dpy, GLXDrawable draw, GLXContext gc)
-{
-   return MakeContextCurrent(dpy, draw, draw, gc);
-}
-
-PUBLIC
-GLX_ALIAS(Bool, glXMakeCurrentReadSGI,
-          (Display * dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx),
-          (dpy, d, r, ctx), MakeContextCurrent)
-
-PUBLIC
-GLX_ALIAS(Bool, glXMakeContextCurrent,
-          (Display * dpy, GLXDrawable d, GLXDrawable r,
-           GLXContext ctx), (dpy, d, r, ctx), MakeContextCurrent)
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
deleted file mode 100644 (file)
index c2de1a3..0000000
+++ /dev/null
@@ -1,1060 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \file glxext.c
- * GLX protocol interface boot-strap code.
- *
- * Direct rendering support added by Precision Insight, Inc.
- *
- * \author Kevin E. Martin <kevin@precisioninsight.com>
- */
-
-#include <assert.h>
-#include "glxclient.h"
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/dri2proto.h>
-#include "glxextensions.h"
-#include "glcontextmodes.h"
-
-#ifdef USE_XCB
-#include <X11/Xlib-xcb.h>
-#include <xcb/xcb.h>
-#include <xcb/glx.h>
-#endif
-
-
-#ifdef DEBUG
-void __glXDumpDrawBuffer(__GLXcontext * ctx);
-#endif
-
-/*
-** You can set this cell to 1 to force the gl drawing stuff to be
-** one command per packet
-*/
-_X_HIDDEN int __glXDebug = 0;
-
-/* Extension required boiler plate */
-
-static char *__glXExtensionName = GLX_EXTENSION_NAME;
-XExtensionInfo *__glXExtensionInfo = NULL;
-
-static /* const */ char *error_list[] = {
-   "GLXBadContext",
-   "GLXBadContextState",
-   "GLXBadDrawable",
-   "GLXBadPixmap",
-   "GLXBadContextTag",
-   "GLXBadCurrentWindow",
-   "GLXBadRenderRequest",
-   "GLXBadLargeRequest",
-   "GLXUnsupportedPrivateRequest",
-   "GLXBadFBConfig",
-   "GLXBadPbuffer",
-   "GLXBadCurrentDrawable",
-   "GLXBadWindow",
-};
-
-static int
-__glXCloseDisplay(Display * dpy, XExtCodes * codes)
-{
-   GLXContext gc;
-
-   gc = __glXGetCurrentContext();
-   if (dpy == gc->currentDpy) {
-      __glXSetCurrentContextNull();
-      __glXFreeContext(gc);
-   }
-
-   return XextRemoveDisplay(__glXExtensionInfo, dpy);
-}
-
-
-static
-XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
-                           __GLX_NUMBER_ERRORS, error_list)
-static Bool
-__glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire);
-static Status
-__glXEventToWire(Display *dpy, XEvent *event, xEvent *wire);
-
-static /* const */ XExtensionHooks __glXExtensionHooks = {
-  NULL,                   /* create_gc */
-  NULL,                   /* copy_gc */
-  NULL,                   /* flush_gc */
-  NULL,                   /* free_gc */
-  NULL,                   /* create_font */
-  NULL,                   /* free_font */
-  __glXCloseDisplay,      /* close_display */
-  __glXWireToEvent,       /* wire_to_event */
-  __glXEventToWire,       /* event_to_wire */
-  NULL,                   /* error */
-  __glXErrorString,       /* error_string */
-};
-
-XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
-                           __glXExtensionName, &__glXExtensionHooks,
-                           __GLX_NUMBER_EVENTS, NULL)
-
-/*
- * GLX events are a bit funky.  We don't stuff the X event code into
- * our user exposed (via XNextEvent) structure.  Instead we use the GLX
- * private event code namespace (and hope it doesn't conflict).  Clients
- * have to know that bit 15 in the event type field means they're getting
- * a GLX event, and then handle the various sub-event types there, rather
- * than simply checking the event code and handling it directly.
- */
-
-static Bool
-__glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
-{
-   XExtDisplayInfo *info = __glXFindDisplay(dpy);
-
-   XextCheckExtension(dpy, info, __glXExtensionName, False);
-
-   switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
-   case GLX_PbufferClobber:
-   {
-      GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event;
-      xGLXPbufferClobberEvent *awire = (xGLXPbufferClobberEvent *)wire;
-      aevent->event_type = awire->type;
-      aevent->serial = awire->sequenceNumber;
-      aevent->event_type = awire->event_type;
-      aevent->draw_type = awire->draw_type;
-      aevent->drawable = awire->drawable;
-      aevent->buffer_mask = awire->buffer_mask;
-      aevent->aux_buffer = awire->aux_buffer;
-      aevent->x = awire->x;
-      aevent->y = awire->y;
-      aevent->width = awire->width;
-      aevent->height = awire->height;
-      aevent->count = awire->count;
-      return True;
-   }
-   /* No easy symbol to test for this, as GLX_BufferSwapComplete is
-    * defined in the local glx.h header, but the
-    * xGLXBufferSwapComplete typedef is only available in new versions
-    * of the external glxproto.h header, which doesn't have any
-    * testable versioning define.
-    *
-    * I'll use the related DRI2 define, in the hope that we won't
-    * receive these events unless we know how to ask for them:
-    */
-#ifdef X_DRI2SwapBuffers
-   case GLX_BufferSwapComplete:
-   {
-      GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-      xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
-      aevent->event_type = awire->event_type;
-      aevent->drawable = awire->drawable;
-      aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
-      aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-      aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
-      return True;
-   }
-#endif
-   default:
-      /* client doesn't support server event */
-      break;
-   }
-
-   return False;
-}
-
-/* We don't actually support this.  It doesn't make sense for clients to
- * send each other GLX events.
- */
-static Status
-__glXEventToWire(Display *dpy, XEvent *event, xEvent *wire)
-{
-   XExtDisplayInfo *info = __glXFindDisplay(dpy);
-
-   XextCheckExtension(dpy, info, __glXExtensionName, False);
-
-   switch (event->type) {
-   case GLX_DAMAGED:
-      break;
-   case GLX_SAVED:
-      break;
-   case GLX_EXCHANGE_COMPLETE_INTEL:
-      break;
-   case GLX_BLIT_COMPLETE_INTEL:
-      break;
-   case GLX_FLIP_COMPLETE_INTEL:
-      break;
-   default:
-      /* client doesn't support server event */
-      break;
-   }
-
-   return Success;
-}
-
-/************************************************************************/
-/*
-** Free the per screen configs data as well as the array of
-** __glXScreenConfigs.
-*/
-static void
-FreeScreenConfigs(__GLXdisplayPrivate * priv)
-{
-   __GLXscreenConfigs *psc;
-   GLint i, screens;
-
-   /* Free screen configuration information */
-   psc = priv->screenConfigs;
-   screens = ScreenCount(priv->dpy);
-   for (i = 0; i < screens; i++, psc++) {
-      if (psc->configs) {
-         _gl_context_modes_destroy(psc->configs);
-         if (psc->effectiveGLXexts)
-            Xfree(psc->effectiveGLXexts);
-         psc->configs = NULL;   /* NOTE: just for paranoia */
-      }
-      if (psc->visuals) {
-         _gl_context_modes_destroy(psc->visuals);
-         psc->visuals = NULL;   /* NOTE: just for paranoia */
-      }
-      Xfree((char *) psc->serverGLXexts);
-
-#ifdef GLX_DIRECT_RENDERING
-      if (psc->driver_configs) {
-         unsigned int j;
-         for (j = 0; psc->driver_configs[j]; j++)
-            free((__DRIconfig *) psc->driver_configs[j]);
-         free(psc->driver_configs);
-         psc->driver_configs = NULL;
-      }
-      if (psc->driScreen) {
-         psc->driScreen->destroyScreen(psc);
-         __glxHashDestroy(psc->drawHash);
-         XFree(psc->driScreen);
-         psc->driScreen = NULL;
-      }
-#endif
-   }
-   XFree((char *) priv->screenConfigs);
-   priv->screenConfigs = NULL;
-}
-
-/*
-** Release the private memory referred to in a display private
-** structure.  The caller will free the extension structure.
-*/
-static int
-__glXFreeDisplayPrivate(XExtData * extension)
-{
-   __GLXdisplayPrivate *priv;
-
-   priv = (__GLXdisplayPrivate *) extension->private_data;
-   FreeScreenConfigs(priv);
-   if (priv->serverGLXvendor) {
-      Xfree((char *) priv->serverGLXvendor);
-      priv->serverGLXvendor = 0x0;      /* to protect against double free's */
-   }
-   if (priv->serverGLXversion) {
-      Xfree((char *) priv->serverGLXversion);
-      priv->serverGLXversion = 0x0;     /* to protect against double free's */
-   }
-
-#ifdef GLX_DIRECT_RENDERING
-   /* Free the direct rendering per display data */
-   if (priv->driswDisplay)
-      (*priv->driswDisplay->destroyDisplay) (priv->driswDisplay);
-   priv->driswDisplay = NULL;
-
-   if (priv->driDisplay)
-      (*priv->driDisplay->destroyDisplay) (priv->driDisplay);
-   priv->driDisplay = NULL;
-
-   if (priv->dri2Display)
-      (*priv->dri2Display->destroyDisplay) (priv->dri2Display);
-   priv->dri2Display = NULL;
-#endif
-
-   Xfree((char *) priv);
-   return 0;
-}
-
-/************************************************************************/
-
-/*
-** Query the version of the GLX extension.  This procedure works even if
-** the client extension is not completely set up.
-*/
-static Bool
-QueryVersion(Display * dpy, int opcode, int *major, int *minor)
-{
-#ifdef USE_XCB
-   xcb_connection_t *c = XGetXCBConnection(dpy);
-   xcb_glx_query_version_reply_t *reply = xcb_glx_query_version_reply(c,
-                                                                      xcb_glx_query_version
-                                                                      (c,
-                                                                       GLX_MAJOR_VERSION,
-                                                                       GLX_MINOR_VERSION),
-                                                                      NULL);
-
-   if (reply->major_version != GLX_MAJOR_VERSION) {
-      free(reply);
-      return GL_FALSE;
-   }
-   *major = reply->major_version;
-   *minor = min(reply->minor_version, GLX_MINOR_VERSION);
-   free(reply);
-   return GL_TRUE;
-#else
-   xGLXQueryVersionReq *req;
-   xGLXQueryVersionReply reply;
-
-   /* Send the glXQueryVersion request */
-   LockDisplay(dpy);
-   GetReq(GLXQueryVersion, req);
-   req->reqType = opcode;
-   req->glxCode = X_GLXQueryVersion;
-   req->majorVersion = GLX_MAJOR_VERSION;
-   req->minorVersion = GLX_MINOR_VERSION;
-   _XReply(dpy, (xReply *) & reply, 0, False);
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   if (reply.majorVersion != GLX_MAJOR_VERSION) {
-      /*
-       ** The server does not support the same major release as this
-       ** client.
-       */
-      return GL_FALSE;
-   }
-   *major = reply.majorVersion;
-   *minor = min(reply.minorVersion, GLX_MINOR_VERSION);
-   return GL_TRUE;
-#endif /* USE_XCB */
-}
-
-
-_X_HIDDEN void
-__glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
-                                    const INT32 * bp, Bool tagged_only,
-                                    Bool fbconfig_style_tags)
-{
-   int i;
-
-   if (!tagged_only) {
-      /* Copy in the first set of properties */
-      config->visualID = *bp++;
-
-      config->visualType = _gl_convert_from_x_visual_type(*bp++);
-
-      config->rgbMode = *bp++;
-
-      config->redBits = *bp++;
-      config->greenBits = *bp++;
-      config->blueBits = *bp++;
-      config->alphaBits = *bp++;
-      config->accumRedBits = *bp++;
-      config->accumGreenBits = *bp++;
-      config->accumBlueBits = *bp++;
-      config->accumAlphaBits = *bp++;
-
-      config->doubleBufferMode = *bp++;
-      config->stereoMode = *bp++;
-
-      config->rgbBits = *bp++;
-      config->depthBits = *bp++;
-      config->stencilBits = *bp++;
-      config->numAuxBuffers = *bp++;
-      config->level = *bp++;
-
-      count -= __GLX_MIN_CONFIG_PROPS;
-   }
-
-   /*
-    ** Additional properties may be in a list at the end
-    ** of the reply.  They are in pairs of property type
-    ** and property value.
-    */
-
-#define FETCH_OR_SET(tag) \
-    config-> tag = ( fbconfig_style_tags ) ? *bp++ : 1
-
-   for (i = 0; i < count; i += 2) {
-      switch (*bp++) {
-      case GLX_RGBA:
-         FETCH_OR_SET(rgbMode);
-         break;
-      case GLX_BUFFER_SIZE:
-         config->rgbBits = *bp++;
-         break;
-      case GLX_LEVEL:
-         config->level = *bp++;
-         break;
-      case GLX_DOUBLEBUFFER:
-         FETCH_OR_SET(doubleBufferMode);
-         break;
-      case GLX_STEREO:
-         FETCH_OR_SET(stereoMode);
-         break;
-      case GLX_AUX_BUFFERS:
-         config->numAuxBuffers = *bp++;
-         break;
-      case GLX_RED_SIZE:
-         config->redBits = *bp++;
-         break;
-      case GLX_GREEN_SIZE:
-         config->greenBits = *bp++;
-         break;
-      case GLX_BLUE_SIZE:
-         config->blueBits = *bp++;
-         break;
-      case GLX_ALPHA_SIZE:
-         config->alphaBits = *bp++;
-         break;
-      case GLX_DEPTH_SIZE:
-         config->depthBits = *bp++;
-         break;
-      case GLX_STENCIL_SIZE:
-         config->stencilBits = *bp++;
-         break;
-      case GLX_ACCUM_RED_SIZE:
-         config->accumRedBits = *bp++;
-         break;
-      case GLX_ACCUM_GREEN_SIZE:
-         config->accumGreenBits = *bp++;
-         break;
-      case GLX_ACCUM_BLUE_SIZE:
-         config->accumBlueBits = *bp++;
-         break;
-      case GLX_ACCUM_ALPHA_SIZE:
-         config->accumAlphaBits = *bp++;
-         break;
-      case GLX_VISUAL_CAVEAT_EXT:
-         config->visualRating = *bp++;
-         break;
-      case GLX_X_VISUAL_TYPE:
-         config->visualType = *bp++;
-         break;
-      case GLX_TRANSPARENT_TYPE:
-         config->transparentPixel = *bp++;
-         break;
-      case GLX_TRANSPARENT_INDEX_VALUE:
-         config->transparentIndex = *bp++;
-         break;
-      case GLX_TRANSPARENT_RED_VALUE:
-         config->transparentRed = *bp++;
-         break;
-      case GLX_TRANSPARENT_GREEN_VALUE:
-         config->transparentGreen = *bp++;
-         break;
-      case GLX_TRANSPARENT_BLUE_VALUE:
-         config->transparentBlue = *bp++;
-         break;
-      case GLX_TRANSPARENT_ALPHA_VALUE:
-         config->transparentAlpha = *bp++;
-         break;
-      case GLX_VISUAL_ID:
-         config->visualID = *bp++;
-         break;
-      case GLX_DRAWABLE_TYPE:
-         config->drawableType = *bp++;
-         break;
-      case GLX_RENDER_TYPE:
-         config->renderType = *bp++;
-         break;
-      case GLX_X_RENDERABLE:
-         config->xRenderable = *bp++;
-         break;
-      case GLX_FBCONFIG_ID:
-         config->fbconfigID = *bp++;
-         break;
-      case GLX_MAX_PBUFFER_WIDTH:
-         config->maxPbufferWidth = *bp++;
-         break;
-      case GLX_MAX_PBUFFER_HEIGHT:
-         config->maxPbufferHeight = *bp++;
-         break;
-      case GLX_MAX_PBUFFER_PIXELS:
-         config->maxPbufferPixels = *bp++;
-         break;
-      case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
-         config->optimalPbufferWidth = *bp++;
-         break;
-      case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
-         config->optimalPbufferHeight = *bp++;
-         break;
-      case GLX_VISUAL_SELECT_GROUP_SGIX:
-         config->visualSelectGroup = *bp++;
-         break;
-      case GLX_SWAP_METHOD_OML:
-         config->swapMethod = *bp++;
-         break;
-      case GLX_SAMPLE_BUFFERS_SGIS:
-         config->sampleBuffers = *bp++;
-         break;
-      case GLX_SAMPLES_SGIS:
-         config->samples = *bp++;
-         break;
-      case GLX_BIND_TO_TEXTURE_RGB_EXT:
-         config->bindToTextureRgb = *bp++;
-         break;
-      case GLX_BIND_TO_TEXTURE_RGBA_EXT:
-         config->bindToTextureRgba = *bp++;
-         break;
-      case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
-         config->bindToMipmapTexture = *bp++;
-         break;
-      case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
-         config->bindToTextureTargets = *bp++;
-         break;
-      case GLX_Y_INVERTED_EXT:
-         config->yInverted = *bp++;
-         break;
-      case None:
-         i = count;
-         break;
-      default:
-         break;
-      }
-   }
-
-   config->renderType =
-      (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
-   config->haveAccumBuffer = ((config->accumRedBits +
-                               config->accumGreenBits +
-                               config->accumBlueBits +
-                               config->accumAlphaBits) > 0);
-   config->haveDepthBuffer = (config->depthBits > 0);
-   config->haveStencilBuffer = (config->stencilBits > 0);
-}
-
-static __GLcontextModes *
-createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
-                            int screen, GLboolean tagged_only)
-{
-   INT32 buf[__GLX_TOTAL_CONFIG], *props;
-   unsigned prop_size;
-   __GLcontextModes *modes, *m;
-   int i;
-
-   if (nprops == 0)
-      return NULL;
-
-   /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for FBconfigs? */
-
-   /* Check number of properties */
-   if (nprops < __GLX_MIN_CONFIG_PROPS || nprops > __GLX_MAX_CONFIG_PROPS)
-      return NULL;
-
-   /* Allocate memory for our config structure */
-   modes = _gl_context_modes_create(nvisuals, sizeof(__GLcontextModes));
-   if (!modes)
-      return NULL;
-
-   prop_size = nprops * __GLX_SIZE_INT32;
-   if (prop_size <= sizeof(buf))
-      props = buf;
-   else
-      props = Xmalloc(prop_size);
-
-   /* Read each config structure and convert it into our format */
-   m = modes;
-   for (i = 0; i < nvisuals; i++) {
-      _XRead(dpy, (char *) props, prop_size);
-      /* Older X servers don't send this so we default it here. */
-      m->drawableType = GLX_WINDOW_BIT;
-      __glXInitializeVisualConfigFromTags(m, nprops, props,
-                                          tagged_only, GL_TRUE);
-      m->screen = screen;
-      m = m->next;
-   }
-
-   if (props != buf)
-      Xfree(props);
-
-   return modes;
-}
-
-static GLboolean
-getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
-{
-   xGLXGetVisualConfigsReq *req;
-   __GLXscreenConfigs *psc;
-   xGLXGetVisualConfigsReply reply;
-
-   LockDisplay(dpy);
-
-   psc = priv->screenConfigs + screen;
-   psc->visuals = NULL;
-   GetReq(GLXGetVisualConfigs, req);
-   req->reqType = priv->majorOpcode;
-   req->glxCode = X_GLXGetVisualConfigs;
-   req->screen = screen;
-
-   if (!_XReply(dpy, (xReply *) & reply, 0, False))
-      goto out;
-
-   psc->visuals = createConfigsFromProperties(dpy,
-                                              reply.numVisuals,
-                                              reply.numProps,
-                                              screen, GL_FALSE);
-
- out:
-   UnlockDisplay(dpy);
-   return psc->visuals != NULL;
-}
-
-static GLboolean
-getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
-{
-   xGLXGetFBConfigsReq *fb_req;
-   xGLXGetFBConfigsSGIXReq *sgi_req;
-   xGLXVendorPrivateWithReplyReq *vpreq;
-   xGLXGetFBConfigsReply reply;
-   __GLXscreenConfigs *psc;
-
-   psc = priv->screenConfigs + screen;
-   psc->serverGLXexts =
-      __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
-
-   LockDisplay(dpy);
-
-   psc->configs = NULL;
-   if (atof(priv->serverGLXversion) >= 1.3) {
-      GetReq(GLXGetFBConfigs, fb_req);
-      fb_req->reqType = priv->majorOpcode;
-      fb_req->glxCode = X_GLXGetFBConfigs;
-      fb_req->screen = screen;
-   }
-   else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) {
-      GetReqExtra(GLXVendorPrivateWithReply,
-                  sz_xGLXGetFBConfigsSGIXReq +
-                  sz_xGLXVendorPrivateWithReplyReq, vpreq);
-      sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
-      sgi_req->reqType = priv->majorOpcode;
-      sgi_req->glxCode = X_GLXVendorPrivateWithReply;
-      sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
-      sgi_req->screen = screen;
-   }
-   else
-      goto out;
-
-   if (!_XReply(dpy, (xReply *) & reply, 0, False))
-      goto out;
-
-   psc->configs = createConfigsFromProperties(dpy,
-                                              reply.numFBConfigs,
-                                              reply.numAttribs * 2,
-                                              screen, GL_TRUE);
-
- out:
-   UnlockDisplay(dpy);
-   return psc->configs != NULL;
-}
-
-/*
-** Allocate the memory for the per screen configs for each screen.
-** If that works then fetch the per screen configs data.
-*/
-static Bool
-AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
-{
-   __GLXscreenConfigs *psc;
-   GLint i, screens;
-
-   /*
-    ** First allocate memory for the array of per screen configs.
-    */
-   screens = ScreenCount(dpy);
-   psc = (__GLXscreenConfigs *) Xmalloc(screens * sizeof(__GLXscreenConfigs));
-   if (!psc) {
-      return GL_FALSE;
-   }
-   memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
-   priv->screenConfigs = psc;
-
-   priv->serverGLXversion =
-      __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
-   if (priv->serverGLXversion == NULL) {
-      FreeScreenConfigs(priv);
-      return GL_FALSE;
-   }
-
-   for (i = 0; i < screens; i++, psc++) {
-      getVisualConfigs(dpy, priv, i);
-      getFBConfigs(dpy, priv, i);
-
-#ifdef GLX_DIRECT_RENDERING
-      psc->scr = i;
-      psc->dpy = dpy;
-      psc->drawHash = __glxHashCreate();
-      if (psc->drawHash == NULL)
-         continue;
-
-      if (priv->dri2Display)
-         psc->driScreen = (*priv->dri2Display->createScreen) (psc, i, priv);
-
-      if (psc->driScreen == NULL && priv->driDisplay)
-         psc->driScreen = (*priv->driDisplay->createScreen) (psc, i, priv);
-
-      if (psc->driScreen == NULL && priv->driswDisplay)
-         psc->driScreen = (*priv->driswDisplay->createScreen) (psc, i, priv);
-
-      if (psc->driScreen == NULL) {
-         __glxHashDestroy(psc->drawHash);
-         psc->drawHash = NULL;
-      }
-#endif
-   }
-   SyncHandle();
-   return GL_TRUE;
-}
-
-/*
-** Initialize the client side extension code.
-*/
-_X_HIDDEN __GLXdisplayPrivate *
-__glXInitialize(Display * dpy)
-{
-   XExtDisplayInfo *info = __glXFindDisplay(dpy);
-   XExtData **privList, *private, *found;
-   __GLXdisplayPrivate *dpyPriv;
-   XEDataObject dataObj;
-   int major, minor;
-#ifdef GLX_DIRECT_RENDERING
-   Bool glx_direct, glx_accel;
-#endif
-
-   /* The one and only long long lock */
-   __glXLock();
-
-   if (!XextHasExtension(info)) {
-      /* No GLX extension supported by this server. Oh well. */
-      __glXUnlock();
-      XMissingExtension(dpy, __glXExtensionName);
-      return 0;
-   }
-
-   /* See if a display private already exists.  If so, return it */
-   dataObj.display = dpy;
-   privList = XEHeadOfExtensionList(dataObj);
-   found = XFindOnExtensionList(privList, info->codes->extension);
-   if (found) {
-      __glXUnlock();
-      return (__GLXdisplayPrivate *) found->private_data;
-   }
-
-   /* See if the versions are compatible */
-   if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) {
-      /* The client and server do not agree on versions.  Punt. */
-      __glXUnlock();
-      return 0;
-   }
-
-   /*
-    ** Allocate memory for all the pieces needed for this buffer.
-    */
-   private = (XExtData *) Xmalloc(sizeof(XExtData));
-   if (!private) {
-      __glXUnlock();
-      return 0;
-   }
-   dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
-   if (!dpyPriv) {
-      __glXUnlock();
-      Xfree((char *) private);
-      return 0;
-   }
-
-   /*
-    ** Init the display private and then read in the screen config
-    ** structures from the server.
-    */
-   dpyPriv->majorOpcode = info->codes->major_opcode;
-   dpyPriv->majorVersion = major;
-   dpyPriv->minorVersion = minor;
-   dpyPriv->dpy = dpy;
-
-   dpyPriv->serverGLXvendor = 0x0;
-   dpyPriv->serverGLXversion = 0x0;
-
-#ifdef GLX_DIRECT_RENDERING
-   glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
-   glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
-
-   /*
-    ** Initialize the direct rendering per display data and functions.
-    ** Note: This _must_ be done before calling any other DRI routines
-    ** (e.g., those called in AllocAndFetchScreenConfigs).
-    */
-   if (glx_direct && glx_accel) {
-      dpyPriv->dri2Display = dri2CreateDisplay(dpy);
-      dpyPriv->driDisplay = driCreateDisplay(dpy);
-   }
-   if (glx_direct)
-      dpyPriv->driswDisplay = driswCreateDisplay(dpy);
-#endif
-
-   if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
-      __glXUnlock();
-      Xfree((char *) dpyPriv);
-      Xfree((char *) private);
-      return 0;
-   }
-
-   /*
-    ** Fill in the private structure.  This is the actual structure that
-    ** hangs off of the Display structure.  Our private structure is
-    ** referred to by this structure.  Got that?
-    */
-   private->number = info->codes->extension;
-   private->next = 0;
-   private->free_private = __glXFreeDisplayPrivate;
-   private->private_data = (char *) dpyPriv;
-   XAddToExtensionList(privList, private);
-
-   if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) {
-      __glXClientInfo(dpy, dpyPriv->majorOpcode);
-   }
-   __glXUnlock();
-
-   return dpyPriv;
-}
-
-/*
-** Setup for sending a GLX command on dpy.  Make sure the extension is
-** initialized.  Try to avoid calling __glXInitialize as its kinda slow.
-*/
-_X_HIDDEN CARD8
-__glXSetupForCommand(Display * dpy)
-{
-   GLXContext gc;
-   __GLXdisplayPrivate *priv;
-
-   /* If this thread has a current context, flush its rendering commands */
-   gc = __glXGetCurrentContext();
-   if (gc->currentDpy) {
-      /* Flush rendering buffer of the current context, if any */
-      (void) __glXFlushRenderBuffer(gc, gc->pc);
-
-      if (gc->currentDpy == dpy) {
-         /* Use opcode from gc because its right */
-         return gc->majorOpcode;
-      }
-      else {
-         /*
-          ** Have to get info about argument dpy because it might be to
-          ** a different server
-          */
-      }
-   }
-
-   /* Forced to lookup extension via the slow initialize route */
-   priv = __glXInitialize(dpy);
-   if (!priv) {
-      return 0;
-   }
-   return priv->majorOpcode;
-}
-
-/**
- * Flush the drawing command transport buffer.
- *
- * \param ctx  Context whose transport buffer is to be flushed.
- * \param pc   Pointer to first unused buffer location.
- *
- * \todo
- * Modify this function to use \c ctx->pc instead of the explicit
- * \c pc parameter.
- */
-_X_HIDDEN GLubyte *
-__glXFlushRenderBuffer(__GLXcontext * ctx, GLubyte * pc)
-{
-   Display *const dpy = ctx->currentDpy;
-#ifdef USE_XCB
-   xcb_connection_t *c = XGetXCBConnection(dpy);
-#else
-   xGLXRenderReq *req;
-#endif /* USE_XCB */
-   const GLint size = pc - ctx->buf;
-
-   if ((dpy != NULL) && (size > 0)) {
-#ifdef USE_XCB
-      xcb_glx_render(c, ctx->currentContextTag, size,
-                     (const uint8_t *) ctx->buf);
-#else
-      /* Send the entire buffer as an X request */
-      LockDisplay(dpy);
-      GetReq(GLXRender, req);
-      req->reqType = ctx->majorOpcode;
-      req->glxCode = X_GLXRender;
-      req->contextTag = ctx->currentContextTag;
-      req->length += (size + 3) >> 2;
-      _XSend(dpy, (char *) ctx->buf, size);
-      UnlockDisplay(dpy);
-      SyncHandle();
-#endif
-   }
-
-   /* Reset pointer and return it */
-   ctx->pc = ctx->buf;
-   return ctx->pc;
-}
-
-
-/**
- * Send a portion of a GLXRenderLarge command to the server.  The advantage of
- * this function over \c __glXSendLargeCommand is that callers can use the
- * data buffer in the GLX context and may be able to avoid allocating an
- * extra buffer.  The disadvantage is the clients will have to do more
- * GLX protocol work (i.e., calculating \c totalRequests, etc.).
- *
- * \sa __glXSendLargeCommand
- *
- * \param gc             GLX context
- * \param requestNumber  Which part of the whole command is this?  The first
- *                       request is 1.
- * \param totalRequests  How many requests will there be?
- * \param data           Command data.
- * \param dataLen        Size, in bytes, of the command data.
- */
-_X_HIDDEN void
-__glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
-                    GLint totalRequests, const GLvoid * data, GLint dataLen)
-{
-   Display *dpy = gc->currentDpy;
-#ifdef USE_XCB
-   xcb_connection_t *c = XGetXCBConnection(dpy);
-   xcb_glx_render_large(c, gc->currentContextTag, requestNumber,
-                        totalRequests, dataLen, data);
-#else
-   xGLXRenderLargeReq *req;
-
-   if (requestNumber == 1) {
-      LockDisplay(dpy);
-   }
-
-   GetReq(GLXRenderLarge, req);
-   req->reqType = gc->majorOpcode;
-   req->glxCode = X_GLXRenderLarge;
-   req->contextTag = gc->currentContextTag;
-   req->length += (dataLen + 3) >> 2;
-   req->requestNumber = requestNumber;
-   req->requestTotal = totalRequests;
-   req->dataBytes = dataLen;
-   Data(dpy, data, dataLen);
-
-   if (requestNumber == totalRequests) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-   }
-#endif /* USE_XCB */
-}
-
-
-/**
- * Send a command that is too large for the GLXRender protocol request.
- *
- * Send a large command, one that is too large for some reason to
- * send using the GLXRender protocol request.  One reason to send
- * a large command is to avoid copying the data.
- *
- * \param ctx        GLX context
- * \param header     Header data.
- * \param headerLen  Size, in bytes, of the header data.  It is assumed that
- *                   the header data will always be small enough to fit in
- *                   a single X protocol packet.
- * \param data       Command data.
- * \param dataLen    Size, in bytes, of the command data.
- */
-_X_HIDDEN void
-__glXSendLargeCommand(__GLXcontext * ctx,
-                      const GLvoid * header, GLint headerLen,
-                      const GLvoid * data, GLint dataLen)
-{
-   GLint maxSize;
-   GLint totalRequests, requestNumber;
-
-   /*
-    ** Calculate the maximum amount of data can be stuffed into a single
-    ** packet.  sz_xGLXRenderReq is added because bufSize is the maximum
-    ** packet size minus sz_xGLXRenderReq.
-    */
-   maxSize = (ctx->bufSize + sz_xGLXRenderReq) - sz_xGLXRenderLargeReq;
-   totalRequests = 1 + (dataLen / maxSize);
-   if (dataLen % maxSize)
-      totalRequests++;
-
-   /*
-    ** Send all of the command, except the large array, as one request.
-    */
-   assert(headerLen <= maxSize);
-   __glXSendLargeChunk(ctx, 1, totalRequests, header, headerLen);
-
-   /*
-    ** Send enough requests until the whole array is sent.
-    */
-   for (requestNumber = 2; requestNumber <= (totalRequests - 1);
-        requestNumber++) {
-      __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, maxSize);
-      data = (const GLvoid *) (((const GLubyte *) data) + maxSize);
-      dataLen -= maxSize;
-      assert(dataLen > 0);
-   }
-
-   assert(dataLen <= maxSize);
-   __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, dataLen);
-}
-
-/************************************************************************/
-
-#ifdef DEBUG
-_X_HIDDEN void
-__glXDumpDrawBuffer(__GLXcontext * ctx)
-{
-   GLubyte *p = ctx->buf;
-   GLubyte *end = ctx->pc;
-   GLushort opcode, length;
-
-   while (p < end) {
-      /* Fetch opcode */
-      opcode = *((GLushort *) p);
-      length = *((GLushort *) (p + 2));
-      printf("%2x: %5d: ", opcode, length);
-      length -= 4;
-      p += 4;
-      while (length > 0) {
-         printf("%08x ", *((unsigned *) p));
-         p += 4;
-         length -= 4;
-      }
-      printf("\n");
-   }
-}
-#endif
diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c
deleted file mode 100644 (file)
index 56c69cb..0000000
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2002, 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
- * THE COPYRIGHT HOLDERS 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 glxextensions.c
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "glxclient.h"
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/Xext.h>
-#include <string.h>
-#include "glxextensions.h"
-
-
-#define SET_BIT(m,b)   (m[ (b) / 8 ] |=  (1U << ((b) % 8)))
-#define CLR_BIT(m,b)   (m[ (b) / 8 ] &= ~(1U << ((b) % 8)))
-#define IS_SET(m,b)    ((m[ (b) / 8 ] & (1U << ((b) % 8))) != 0)
-#define CONCAT(a,b) a ## b
-#define GLX(n) "GLX_" # n, 4 + sizeof( # n ) - 1, CONCAT(n,_bit)
-#define GL(n)  "GL_" # n,  3 + sizeof( # n ) - 1, GL_ ## n ## _bit
-#define VER(a,b)  a, b
-#define Y  1
-#define N  0
-#define EXT_ENABLED(bit,supported) (IS_SET( supported, bit ))
-
-
-struct extension_info
-{
-   const char *const name;
-   unsigned name_len;
-
-   unsigned char bit;
-
-   /* This is the lowest version of GLX that "requires" this extension.
-    * For example, GLX 1.3 requires SGIX_fbconfig, SGIX_pbuffer, and
-    * SGI_make_current_read.  If the extension is not required by any known
-    * version of GLX, use 0, 0.
-    */
-   unsigned char version_major;
-   unsigned char version_minor;
-   unsigned char client_support;
-   unsigned char direct_support;
-   unsigned char client_only;        /** Is the extension client-side only? */
-   unsigned char direct_only;        /** Is the extension for direct
-                                     * contexts only?
-                                     */
-};
-
-/* *INDENT-OFF* */
-static const struct extension_info known_glx_extensions[] = {
-   { GLX(ARB_get_proc_address),        VER(1,4), Y, N, Y, N },
-   { GLX(ARB_multisample),             VER(1,4), Y, Y, N, N },
-   { GLX(ARB_render_texture),          VER(0,0), N, N, N, N },
-   { GLX(ATI_pixel_format_float),      VER(0,0), N, N, N, N },
-   { GLX(EXT_import_context),          VER(0,0), Y, Y, N, N },
-   { GLX(EXT_visual_info),             VER(0,0), Y, Y, N, N },
-   { GLX(EXT_visual_rating),           VER(0,0), Y, Y, N, N },
-   { GLX(MESA_agp_offset),             VER(0,0), N, N, N, Y }, /* Deprecated */
-   { GLX(MESA_allocate_memory),        VER(0,0), Y, N, N, Y },
-   { GLX(MESA_copy_sub_buffer),        VER(0,0), Y, N, N, N },
-   { GLX(MESA_pixmap_colormap),        VER(0,0), N, N, N, N }, /* Deprecated */
-   { GLX(MESA_release_buffers),        VER(0,0), N, N, N, N }, /* Deprecated */
-   { GLX(MESA_swap_control),           VER(0,0), Y, N, N, Y },
-   { GLX(MESA_swap_frame_usage),       VER(0,0), Y, N, N, Y },
-   { GLX(NV_float_buffer),             VER(0,0), N, N, N, N },
-   { GLX(NV_render_depth_texture),     VER(0,0), N, N, N, N },
-   { GLX(NV_render_texture_rectangle), VER(0,0), N, N, N, N },
-   { GLX(NV_vertex_array_range),       VER(0,0), N, N, N, Y }, /* Deprecated */
-   { GLX(OML_swap_method),             VER(0,0), Y, Y, N, N },
-   { GLX(OML_sync_control),            VER(0,0), Y, N, N, Y },
-   { GLX(SGI_make_current_read),       VER(1,3), Y, N, N, N },
-   { GLX(SGI_swap_control),            VER(0,0), Y, N, N, N },
-   { GLX(SGI_video_sync),              VER(0,0), Y, N, N, Y },
-   { GLX(SGIS_blended_overlay),        VER(0,0), N, N, N, N },
-   { GLX(SGIS_color_range),            VER(0,0), N, N, N, N },
-   { GLX(SGIS_multisample),            VER(0,0), Y, Y, N, N },
-   { GLX(SGIX_fbconfig),               VER(1,3), Y, Y, N, N },
-   { GLX(SGIX_pbuffer),                VER(1,3), Y, Y, N, N },
-   { GLX(SGIX_swap_barrier),           VER(0,0), N, N, N, N },
-   { GLX(SGIX_swap_group),             VER(0,0), N, N, N, N },
-   { GLX(SGIX_visual_select_group),    VER(0,0), Y, Y, N, N },
-   { GLX(EXT_texture_from_pixmap),     VER(0,0), Y, N, N, N },
-   { GLX(INTEL_swap_event),            VER(1,4), Y, Y, N, N },
-   { NULL }
-};
-
-static const struct extension_info known_gl_extensions[] = {
-   { GL(ARB_depth_texture),              VER(1,4), Y, N, N, N },
-   { GL(ARB_draw_buffers),               VER(0,0), Y, N, N, N },
-   { GL(ARB_fragment_program),           VER(0,0), Y, N, N, N },
-   { GL(ARB_fragment_program_shadow),    VER(0,0), Y, N, N, N },
-   { GL(ARB_framebuffer_object),         VER(0,0), Y, N, N, N },
-   { GL(ARB_imaging),                    VER(0,0), Y, N, N, N },
-   { GL(ARB_multisample),                VER(1,3), Y, N, N, N },
-   { GL(ARB_multitexture),               VER(1,3), Y, N, N, N },
-   { GL(ARB_occlusion_query),            VER(1,5), Y, N, N, N },
-   { GL(ARB_point_parameters),           VER(1,4), Y, N, N, N },
-   { GL(ARB_point_sprite),               VER(0,0), Y, N, N, N },
-   { GL(ARB_shadow),                     VER(1,4), Y, N, N, N },
-   { GL(ARB_shadow_ambient),             VER(0,0), Y, N, N, N },
-   { GL(ARB_texture_border_clamp),       VER(1,3), Y, N, N, N },
-   { GL(ARB_texture_compression),        VER(1,3), Y, N, N, N },
-   { GL(ARB_texture_cube_map),           VER(1,3), Y, N, N, N },
-   { GL(ARB_texture_env_add),            VER(1,3), Y, N, N, N },
-   { GL(ARB_texture_env_combine),        VER(1,3), Y, N, N, N },
-   { GL(ARB_texture_env_crossbar),       VER(1,4), Y, N, N, N },
-   { GL(ARB_texture_env_dot3),           VER(1,3), Y, N, N, N },
-   { GL(ARB_texture_mirrored_repeat),    VER(1,4), Y, N, N, N },
-   { GL(ARB_texture_non_power_of_two),   VER(1,5), Y, N, N, N },
-   { GL(ARB_texture_rectangle),          VER(0,0), Y, N, N, N },
-   { GL(ARB_transpose_matrix),           VER(1,3), Y, N, Y, N },
-   { GL(ARB_vertex_buffer_object),       VER(1,5), N, N, N, N },
-   { GL(ARB_vertex_program),             VER(0,0), Y, N, N, N },
-   { GL(ARB_window_pos),                 VER(1,4), Y, N, N, N },
-   { GL(EXT_abgr),                       VER(0,0), Y, N, N, N },
-   { GL(EXT_bgra),                       VER(1,2), Y, N, N, N },
-   { GL(EXT_blend_color),                VER(1,4), Y, N, N, N },
-   { GL(EXT_blend_equation_separate),    VER(0,0), Y, N, N, N },
-   { GL(EXT_blend_func_separate),        VER(1,4), Y, N, N, N },
-   { GL(EXT_blend_logic_op),             VER(1,4), Y, N, N, N },
-   { GL(EXT_blend_minmax),               VER(1,4), Y, N, N, N },
-   { GL(EXT_blend_subtract),             VER(1,4), Y, N, N, N },
-   { GL(EXT_clip_volume_hint),           VER(0,0), Y, N, N, N },
-   { GL(EXT_compiled_vertex_array),      VER(0,0), N, N, N, N },
-   { GL(EXT_convolution),                VER(0,0), N, N, N, N },
-   { GL(EXT_copy_texture),               VER(1,1), Y, N, N, N },
-   { GL(EXT_cull_vertex),                VER(0,0), N, N, N, N },
-   { GL(EXT_depth_bounds_test),          VER(0,0), N, N, N, N },
-   { GL(EXT_draw_range_elements),        VER(1,2), Y, N, Y, N },
-   { GL(EXT_fog_coord),                  VER(1,4), Y, N, N, N },
-   { GL(EXT_framebuffer_blit),           VER(0,0), Y, N, N, N },
-   { GL(EXT_framebuffer_multisample),    VER(0,0), Y, N, N, N },
-   { GL(EXT_framebuffer_object),         VER(0,0), Y, N, N, N },
-   { GL(EXT_multi_draw_arrays),          VER(1,4), Y, N, Y, N },
-   { GL(EXT_packed_depth_stencil),       VER(0,0), Y, N, N, N },
-   { GL(EXT_packed_pixels),              VER(1,2), Y, N, N, N },
-   { GL(EXT_paletted_texture),           VER(0,0), Y, N, N, N },
-   { GL(EXT_pixel_buffer_object),        VER(0,0), N, N, N, N },
-   { GL(EXT_point_parameters),           VER(1,4), Y, N, N, N },
-   { GL(EXT_polygon_offset),             VER(1,1), Y, N, N, N },
-   { GL(EXT_rescale_normal),             VER(1,2), Y, N, N, N },
-   { GL(EXT_secondary_color),            VER(1,4), Y, N, N, N },
-   { GL(EXT_separate_specular_color),    VER(1,2), Y, N, N, N },
-   { GL(EXT_shadow_funcs),               VER(1,5), Y, N, N, N },
-   { GL(EXT_shared_texture_palette),     VER(0,0), Y, N, N, N },
-   { GL(EXT_stencil_two_side),           VER(0,0), Y, N, N, N },
-   { GL(EXT_stencil_wrap),               VER(1,4), Y, N, N, N },
-   { GL(EXT_subtexture),                 VER(1,1), Y, N, N, N },
-   { GL(EXT_texture),                    VER(1,1), Y, N, N, N },
-   { GL(EXT_texture3D),                  VER(1,2), Y, N, N, N },
-   { GL(EXT_texture_compression_dxt1),   VER(0,0), Y, N, N, N },
-   { GL(EXT_texture_compression_s3tc),   VER(0,0), Y, N, N, N },
-   { GL(EXT_texture_edge_clamp),         VER(1,2), Y, N, N, N },
-   { GL(EXT_texture_env_add),            VER(1,3), Y, N, N, N },
-   { GL(EXT_texture_env_combine),        VER(1,3), Y, N, N, N },
-   { GL(EXT_texture_env_dot3),           VER(0,0), Y, N, N, N },
-   { GL(EXT_texture_filter_anisotropic), VER(0,0), Y, N, N, N },
-   { GL(EXT_texture_lod),                VER(1,2), Y, N, N, N },
-   { GL(EXT_texture_lod_bias),           VER(1,4), Y, N, N, N },
-   { GL(EXT_texture_mirror_clamp),       VER(0,0), Y, N, N, N },
-   { GL(EXT_texture_object),             VER(1,1), Y, N, N, N },
-   { GL(EXT_texture_rectangle),          VER(0,0), Y, N, N, N },
-   { GL(EXT_vertex_array),               VER(0,0), Y, N, N, N },
-   { GL(3DFX_texture_compression_FXT1),  VER(0,0), Y, N, N, N },
-   { GL(APPLE_packed_pixels),            VER(1,2), Y, N, N, N },
-   { GL(APPLE_ycbcr_422),                VER(0,0), Y, N, N, N },
-   { GL(ATI_draw_buffers),               VER(0,0), Y, N, N, N },
-   { GL(ATI_text_fragment_shader),       VER(0,0), Y, N, N, N },
-   { GL(ATI_texture_env_combine3),       VER(0,0), Y, N, N, N },
-   { GL(ATI_texture_float),              VER(0,0), Y, N, N, N },
-   { GL(ATI_texture_mirror_once),        VER(0,0), Y, N, N, N },
-   { GL(ATIX_texture_env_combine3),      VER(0,0), Y, N, N, N },
-   { GL(HP_convolution_border_modes),    VER(0,0), Y, N, N, N },
-   { GL(HP_occlusion_test),              VER(0,0), Y, N, N, N },
-   { GL(IBM_cull_vertex),                VER(0,0), Y, N, N, N },
-   { GL(IBM_pixel_filter_hint),          VER(0,0), Y, N, N, N },
-   { GL(IBM_rasterpos_clip),             VER(0,0), Y, N, N, N },
-   { GL(IBM_texture_clamp_nodraw),       VER(0,0), Y, N, N, N },
-   { GL(IBM_texture_mirrored_repeat),    VER(0,0), Y, N, N, N },
-   { GL(INGR_blend_func_separate),       VER(0,0), Y, N, N, N },
-   { GL(INGR_interlace_read),            VER(0,0), Y, N, N, N },
-   { GL(MESA_pack_invert),               VER(0,0), Y, N, N, N },
-   { GL(MESA_ycbcr_texture),             VER(0,0), Y, N, N, N },
-   { GL(NV_blend_square),                VER(1,4), Y, N, N, N },
-   { GL(NV_copy_depth_to_color),         VER(0,0), Y, N, N, N },
-   { GL(NV_depth_clamp),                 VER(0,0), Y, N, N, N },
-   { GL(NV_fog_distance),                VER(0,0), Y, N, N, N },
-   { GL(NV_fragment_program),            VER(0,0), Y, N, N, N },
-   { GL(NV_fragment_program_option),     VER(0,0), Y, N, N, N },
-   { GL(NV_fragment_program2),           VER(0,0), Y, N, N, N },
-   { GL(NV_light_max_exponent),          VER(0,0), Y, N, N, N },
-   { GL(NV_multisample_filter_hint),     VER(0,0), Y, N, N, N },
-   { GL(NV_packed_depth_stencil),        VER(0,0), Y, N, N, N },
-   { GL(NV_point_sprite),                VER(0,0), Y, N, N, N },
-   { GL(NV_texgen_reflection),           VER(0,0), Y, N, N, N },
-   { GL(NV_texture_compression_vtc),     VER(0,0), Y, N, N, N },
-   { GL(NV_texture_env_combine4),        VER(0,0), Y, N, N, N },
-   { GL(NV_texture_rectangle),           VER(0,0), Y, N, N, N },
-   { GL(NV_vertex_program),              VER(0,0), Y, N, N, N },
-   { GL(NV_vertex_program1_1),           VER(0,0), Y, N, N, N },
-   { GL(NV_vertex_program2),             VER(0,0), Y, N, N, N },
-   { GL(NV_vertex_program2_option),      VER(0,0), Y, N, N, N },
-   { GL(NV_vertex_program3),             VER(0,0), Y, N, N, N },
-   { GL(OES_read_format),                VER(0,0), Y, N, N, N },
-   { GL(OES_compressed_paletted_texture),VER(0,0), Y, N, N, N },
-   { GL(SGI_color_matrix),               VER(0,0), Y, N, N, N },
-   { GL(SGI_color_table),                VER(0,0), Y, N, N, N },
-   { GL(SGI_texture_color_table),        VER(0,0), Y, N, N, N },
-   { GL(SGIS_generate_mipmap),           VER(1,4), Y, N, N, N },
-   { GL(SGIS_multisample),               VER(0,0), Y, N, N, N },
-   { GL(SGIS_texture_border_clamp),      VER(1,3), Y, N, N, N },
-   { GL(SGIS_texture_edge_clamp),        VER(1,2), Y, N, N, N },
-   { GL(SGIS_texture_lod),               VER(1,2), Y, N, N, N },
-   { GL(SGIX_blend_alpha_minmax),        VER(0,0), Y, N, N, N },
-   { GL(SGIX_clipmap),                   VER(0,0), Y, N, N, N },
-   { GL(SGIX_depth_texture),             VER(0,0), Y, N, N, N },
-   { GL(SGIX_fog_offset),                VER(0,0), Y, N, N, N },
-   { GL(SGIX_shadow),                    VER(0,0), Y, N, N, N },
-   { GL(SGIX_shadow_ambient),            VER(0,0), Y, N, N, N },
-   { GL(SGIX_texture_coordinate_clamp),  VER(0,0), Y, N, N, N },
-   { GL(SGIX_texture_lod_bias),          VER(0,0), Y, N, N, N },
-   { GL(SGIX_texture_range),             VER(0,0), Y, N, N, N },
-   { GL(SGIX_texture_scale_bias),        VER(0,0), Y, N, N, N },
-   { GL(SGIX_vertex_preclip),            VER(0,0), Y, N, N, N },
-   { GL(SGIX_vertex_preclip_hint),       VER(0,0), Y, N, N, N },
-   { GL(SGIX_ycrcb),                     VER(0,0), Y, N, N, N },
-   { GL(SUN_convolution_border_modes),   VER(0,0), Y, N, N, N },
-   { GL(SUN_multi_draw_arrays),          VER(0,0), Y, N, Y, N },
-   { GL(SUN_slice_accum),                VER(0,0), Y, N, N, N },
-   { NULL }
-};
-/* *INDENT-ON* */
-
-
-/* global bit-fields of available extensions and their characteristics */
-static unsigned char client_glx_support[8];
-static unsigned char client_glx_only[8];
-static unsigned char direct_glx_only[8];
-static unsigned char client_gl_support[__GL_EXT_BYTES];
-static unsigned char client_gl_only[__GL_EXT_BYTES];
-
-/**
- * Bits representing the set of extensions that are enabled by default in all
- * direct rendering drivers.
- */
-static unsigned char direct_glx_support[8];
-
-/**
- * Highest core GL version that can be supported for indirect rendering.
- */
-static const unsigned gl_major = 1;
-static const unsigned gl_minor = 4;
-
-/* client extensions string */
-static const char *__glXGLXClientExtensions = NULL;
-
-static void __glXExtensionsCtr(void);
-static void __glXExtensionsCtrScreen(__GLXscreenConfigs * psc);
-static void __glXProcessServerString(const struct extension_info *ext,
-                                     const char *server_string,
-                                     unsigned char *server_support);
-
-/**
- * Set the state of a GLX extension.
- *
- * \param name      Name of the extension.
- * \param name_len  Length, in characters, of the extension name.
- * \param state     New state (either enabled or disabled) of the extension.
- * \param supported Table in which the state of the extension is to be set.
- */
-static void
-set_glx_extension(const struct extension_info *ext,
-                  const char *name, unsigned name_len, GLboolean state,
-                  unsigned char *supported)
-{
-   unsigned i;
-
-
-   for (i = 0; ext[i].name != NULL; i++) {
-      if ((name_len == ext[i].name_len)
-          && (strncmp(ext[i].name, name, name_len) == 0)) {
-         if (state) {
-            SET_BIT(supported, ext[i].bit);
-         }
-         else {
-            CLR_BIT(supported, ext[i].bit);
-         }
-
-         return;
-      }
-   }
-}
-
-
-#define NUL '\0'
-#define SEPARATOR ' '
-
-/**
- * Convert the server's extension string to a bit-field.
- *
- * \param server_string   GLX extension string from the server.
- * \param server_support  Bit-field of supported extensions.
- *
- * \note
- * This function is used to process both GLX and GL extension strings.  The
- * bit-fields used to track each of these have different sizes.  Therefore,
- * the data pointed by \c server_support must be preinitialized to zero.
- */
-static void
-__glXProcessServerString(const struct extension_info *ext,
-                         const char *server_string,
-                         unsigned char *server_support)
-{
-   unsigned base;
-   unsigned len;
-
-   for (base = 0; server_string[base] != NUL; /* empty */ ) {
-      /* Determine the length of the next extension name.
-       */
-      for (len = 0; (server_string[base + len] != SEPARATOR)
-           && (server_string[base + len] != NUL); len++) {
-         /* empty */
-      }
-
-      /* Set the bit for the extension in the server_support table.
-       */
-      set_glx_extension(ext, &server_string[base], len, GL_TRUE,
-                        server_support);
-
-
-      /* Advance to the next extension string.  This means that we skip
-       * over the previous string and any trialing white-space.
-       */
-      for (base += len; (server_string[base] == SEPARATOR)
-           && (server_string[base] != NUL); base++) {
-         /* empty */
-      }
-   }
-}
-
-void
-__glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name)
-{
-   __glXExtensionsCtr();
-   __glXExtensionsCtrScreen(psc);
-
-   set_glx_extension(known_glx_extensions,
-                     name, strlen(name), GL_TRUE, psc->direct_support);
-}
-
-/**
- * Initialize global extension support tables.
- */
-
-static void
-__glXExtensionsCtr(void)
-{
-   unsigned i;
-   static GLboolean ext_list_first_time = GL_TRUE;
-
-
-   if (ext_list_first_time) {
-      ext_list_first_time = GL_FALSE;
-
-      (void) memset(client_glx_support, 0, sizeof(client_glx_support));
-      (void) memset(direct_glx_support, 0, sizeof(direct_glx_support));
-      (void) memset(client_glx_only, 0, sizeof(client_glx_only));
-      (void) memset(direct_glx_only, 0, sizeof(direct_glx_only));
-
-      (void) memset(client_gl_support, 0, sizeof(client_gl_support));
-      (void) memset(client_gl_only, 0, sizeof(client_gl_only));
-
-      for (i = 0; known_glx_extensions[i].name != NULL; i++) {
-         const unsigned bit = known_glx_extensions[i].bit;
-
-         if (known_glx_extensions[i].client_support) {
-            SET_BIT(client_glx_support, bit);
-         }
-
-         if (known_glx_extensions[i].direct_support) {
-            SET_BIT(direct_glx_support, bit);
-         }
-
-         if (known_glx_extensions[i].client_only) {
-            SET_BIT(client_glx_only, bit);
-         }
-
-         if (known_glx_extensions[i].direct_only) {
-            SET_BIT(direct_glx_only, bit);
-         }
-      }
-
-      for (i = 0; known_gl_extensions[i].name != NULL; i++) {
-         const unsigned bit = known_gl_extensions[i].bit;
-
-         if (known_gl_extensions[i].client_support) {
-            SET_BIT(client_gl_support, bit);
-         }
-
-         if (known_gl_extensions[i].client_only) {
-            SET_BIT(client_gl_only, bit);
-         }
-      }
-
-#if 0
-      fprintf(stderr, "[%s:%u] Maximum client library version: %u.%u\n",
-              __func__, __LINE__, gl_major, gl_minor);
-#endif
-   }
-}
-
-
-/**
- * Make sure that per-screen direct-support table is initialized.
- *
- * \param psc  Pointer to GLX per-screen record.
- */
-
-static void
-__glXExtensionsCtrScreen(__GLXscreenConfigs * psc)
-{
-   if (psc->ext_list_first_time) {
-      psc->ext_list_first_time = GL_FALSE;
-      (void) memcpy(psc->direct_support, direct_glx_support,
-                    sizeof(direct_glx_support));
-   }
-}
-
-
-/**
- * Check if a certain extension is enabled on a given screen.
- *
- * \param psc  Pointer to GLX per-screen record.
- * \param bit  Bit index in the direct-support table.
- * \returns If the extension bit is enabled for the screen, \c GL_TRUE is
- *          returned.  If the extension bit is not enabled or if \c psc is
- *          \c NULL, then \c GL_FALSE is returned.
- */
-GLboolean
-__glXExtensionBitIsEnabled(__GLXscreenConfigs * psc, unsigned bit)
-{
-   GLboolean enabled = GL_FALSE;
-
-   if (psc != NULL) {
-      __glXExtensionsCtr();
-      __glXExtensionsCtrScreen(psc);
-      enabled = EXT_ENABLED(bit, psc->direct_support);
-   }
-
-   return enabled;
-}
-
-
-/**
- * Check if a certain extension is enabled in a given context.
- *
- */
-GLboolean
-__glExtensionBitIsEnabled(const __GLXcontext * gc, unsigned bit)
-{
-   GLboolean enabled = GL_FALSE;
-
-   if (gc != NULL) {
-      enabled = EXT_ENABLED(bit, gc->gl_extension_bits);
-   }
-
-   return enabled;
-}
-
-
-
-/**
- * Convert a bit-field to a string of supported extensions.
- */
-static char *
-__glXGetStringFromTable(const struct extension_info *ext,
-                        const unsigned char *supported)
-{
-   unsigned i;
-   unsigned ext_str_len;
-   char *ext_str;
-   char *point;
-
-
-   ext_str_len = 0;
-   for (i = 0; ext[i].name != NULL; i++) {
-      if (EXT_ENABLED(ext[i].bit, supported)) {
-         ext_str_len += ext[i].name_len + 1;
-      }
-   }
-
-   ext_str = Xmalloc(ext_str_len + 1);
-   if (ext_str != NULL) {
-      point = ext_str;
-
-      for (i = 0; ext[i].name != NULL; i++) {
-         if (EXT_ENABLED(ext[i].bit, supported)) {
-            (void) memcpy(point, ext[i].name, ext[i].name_len);
-            point += ext[i].name_len;
-
-            *point = ' ';
-            point++;
-         }
-      }
-
-      *point = '\0';
-   }
-
-   return ext_str;
-}
-
-
-/**
- * Get the string of client library supported extensions.
- */
-const char *
-__glXGetClientExtensions(void)
-{
-   if (__glXGLXClientExtensions == NULL) {
-      __glXExtensionsCtr();
-      __glXGLXClientExtensions = __glXGetStringFromTable(known_glx_extensions,
-                                                         client_glx_support);
-   }
-
-   return __glXGLXClientExtensions;
-}
-
-
-/**
- * Calculate the list of application usable extensions.  The resulting
- * string is stored in \c psc->effectiveGLXexts.
- *
- * \param psc                        Pointer to GLX per-screen record.
- * \param display_is_direct_capable  True if the display is capable of
- *                                   direct rendering.
- * \param minor_version              GLX minor version from the server.
- */
-
-void
-__glXCalculateUsableExtensions(__GLXscreenConfigs * psc,
-                               GLboolean display_is_direct_capable,
-                               int minor_version)
-{
-   unsigned char server_support[8];
-   unsigned char usable[8];
-   unsigned i;
-
-   __glXExtensionsCtr();
-   __glXExtensionsCtrScreen(psc);
-
-   (void) memset(server_support, 0, sizeof(server_support));
-   __glXProcessServerString(known_glx_extensions,
-                            psc->serverGLXexts, server_support);
-
-
-   /* This is a hack.  Some servers support GLX 1.3 but don't export
-    * all of the extensions implied by GLX 1.3.  If the server claims
-    * support for GLX 1.3, enable support for the extensions that can be
-    * "emulated" as well.
-    */
-
-   if (minor_version >= 3) {
-      SET_BIT(server_support, EXT_visual_info_bit);
-      SET_BIT(server_support, EXT_visual_rating_bit);
-      SET_BIT(server_support, SGI_make_current_read_bit);
-      SET_BIT(server_support, SGIX_fbconfig_bit);
-      SET_BIT(server_support, SGIX_pbuffer_bit);
-
-      /* This one is a little iffy.  GLX 1.3 doesn't incorporate all of this
-       * extension.  However, the only part that is not strictly client-side
-       * is shared.  That's the glXQueryContext / glXQueryContextInfoEXT
-       * function.
-       */
-
-      SET_BIT(server_support, EXT_import_context_bit);
-   }
-
-
-   /* An extension is supported if the client-side (i.e., libGL) supports
-    * it and the "server" supports it.  In this case that means that either
-    * the true server supports it or it is only for direct-rendering and
-    * the direct rendering driver supports it.
-    *
-    * If the display is not capable of direct rendering, then the extension
-    * is enabled if and only if the client-side library and the server
-    * support it.
-    */
-
-   if (display_is_direct_capable) {
-      for (i = 0; i < 8; i++) {
-         usable[i] = (client_glx_support[i] & client_glx_only[i])
-            | (client_glx_support[i] & psc->direct_support[i] &
-               server_support[i])
-            | (client_glx_support[i] & psc->direct_support[i] &
-               direct_glx_only[i]);
-      }
-   }
-   else {
-      for (i = 0; i < 8; i++) {
-         usable[i] = (client_glx_support[i] & client_glx_only[i])
-            | (client_glx_support[i] & server_support[i]);
-      }
-   }
-
-   psc->effectiveGLXexts = __glXGetStringFromTable(known_glx_extensions,
-                                                   usable);
-}
-
-
-/**
- * Calculate the list of application usable extensions.  The resulting
- * string is stored in \c gc->extensions.
- *
- * \param gc             Pointer to GLX context.
- * \param server_string  Extension string from the server.
- * \param major_version  GL major version from the server.
- * \param minor_version  GL minor version from the server.
- */
-
-void
-__glXCalculateUsableGLExtensions(__GLXcontext * gc,
-                                 const char *server_string,
-                                 int major_version, int minor_version)
-{
-   unsigned char server_support[__GL_EXT_BYTES];
-   unsigned char usable[__GL_EXT_BYTES];
-   unsigned i;
-
-
-   __glXExtensionsCtr();
-
-   (void) memset(server_support, 0, sizeof(server_support));
-   __glXProcessServerString(known_gl_extensions, server_string,
-                            server_support);
-
-
-   /* Handle lazy servers that don't export all the extensions strings that
-    * are part of the GL core version that they support.
-    */
-
-   for (i = 0; i < __GL_EXT_BYTES; i++) {
-      if ((known_gl_extensions[i].version_major != 0)
-          && ((major_version > known_gl_extensions[i].version_major)
-              || ((major_version == known_gl_extensions[i].version_major)
-                  && (minor_version >=
-                      known_gl_extensions[i].version_minor)))) {
-         SET_BIT(server_support, known_gl_extensions[i].bit);
-      }
-   }
-
-
-   /* An extension is supported if the client-side (i.e., libGL) supports
-    * it and the server supports it or the client-side library supports it
-    * and it only needs client-side support.
-    */
-
-   for (i = 0; i < __GL_EXT_BYTES; i++) {
-      usable[i] = (client_gl_support[i] & client_gl_only[i])
-         | (client_gl_support[i] & server_support[i]);
-   }
-
-   gc->extensions = (unsigned char *)
-      __glXGetStringFromTable(known_gl_extensions, usable);
-   (void) memcpy(gc->gl_extension_bits, usable, sizeof(usable));
-}
-
-
-/**
- * Calculates the maximum core GL version that can be supported for indirect
- * rendering.
- */
-void
-__glXGetGLVersion(int *major_version, int *minor_version)
-{
-   __glXExtensionsCtr();
-   *major_version = gl_major;
-   *minor_version = gl_minor;
-}
-
-
-/**
- * Get a string representing the set of extensions supported by the client
- * library.  This is currently only used to send the list of extensions
- * supported by the client to the server.
- */
-char *
-__glXGetClientGLExtensionString(void)
-{
-   __glXExtensionsCtr();
-   return __glXGetStringFromTable(known_gl_extensions, client_gl_support);
-}
diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h
deleted file mode 100644 (file)
index f556b12..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2002, 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
- * THE COPYRIGHT HOLDERS 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 glxextensions.h
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#ifndef GLX_GLXEXTENSIONS_H
-#define GLX_GLXEXTENSIONS_H
-
-enum
-{
-   ARB_get_proc_address_bit = 0,
-   ARB_multisample_bit,
-   ARB_render_texture_bit,
-   ATI_pixel_format_float_bit,
-   EXT_visual_info_bit,
-   EXT_visual_rating_bit,
-   EXT_import_context_bit,
-   MESA_agp_offset_bit,
-   MESA_allocate_memory_bit,    /* Replaces MESA_agp_offset & NV_vertex_array_range */
-   MESA_copy_sub_buffer_bit,
-   MESA_depth_float_bit,
-   MESA_pixmap_colormap_bit,
-   MESA_release_buffers_bit,
-   MESA_swap_control_bit,
-   MESA_swap_frame_usage_bit,
-   NV_float_buffer_bit,
-   NV_render_depth_texture_bit,
-   NV_render_texture_rectangle_bit,
-   NV_vertex_array_range_bit,
-   OML_swap_method_bit,
-   OML_sync_control_bit,
-   SGI_make_current_read_bit,
-   SGI_swap_control_bit,
-   SGI_video_sync_bit,
-   SGIS_blended_overlay_bit,
-   SGIS_color_range_bit,
-   SGIS_multisample_bit,
-   SGIX_fbconfig_bit,
-   SGIX_pbuffer_bit,
-   SGIX_swap_barrier_bit,
-   SGIX_swap_group_bit,
-   SGIX_visual_select_group_bit,
-   EXT_texture_from_pixmap_bit,
-   INTEL_swap_event_bit,
-};
-
-enum
-{
-   GL_ARB_depth_texture_bit = 0,
-   GL_ARB_draw_buffers_bit,
-   GL_ARB_fragment_program_bit,
-   GL_ARB_fragment_program_shadow_bit,
-   GL_ARB_framebuffer_object_bit,
-   GL_ARB_imaging_bit,
-   GL_ARB_multisample_bit,
-   GL_ARB_multitexture_bit,
-   GL_ARB_occlusion_query_bit,
-   GL_ARB_point_parameters_bit,
-   GL_ARB_point_sprite_bit,
-   GL_ARB_shadow_bit,
-   GL_ARB_shadow_ambient_bit,
-   GL_ARB_texture_border_clamp_bit,
-   GL_ARB_texture_cube_map_bit,
-   GL_ARB_texture_compression_bit,
-   GL_ARB_texture_env_add_bit,
-   GL_ARB_texture_env_combine_bit,
-   GL_ARB_texture_env_crossbar_bit,
-   GL_ARB_texture_env_dot3_bit,
-   GL_ARB_texture_mirrored_repeat_bit,
-   GL_ARB_texture_non_power_of_two_bit,
-   GL_ARB_texture_rectangle_bit,
-   GL_ARB_transpose_matrix_bit,
-   GL_ARB_vertex_buffer_object_bit,
-   GL_ARB_vertex_program_bit,
-   GL_ARB_window_pos_bit,
-   GL_EXT_abgr_bit,
-   GL_EXT_bgra_bit,
-   GL_EXT_blend_color_bit,
-   GL_EXT_blend_equation_separate_bit,
-   GL_EXT_blend_func_separate_bit,
-   GL_EXT_blend_logic_op_bit,
-   GL_EXT_blend_minmax_bit,
-   GL_EXT_blend_subtract_bit,
-   GL_EXT_clip_volume_hint_bit,
-   GL_EXT_compiled_vertex_array_bit,
-   GL_EXT_convolution_bit,
-   GL_EXT_copy_texture_bit,
-   GL_EXT_cull_vertex_bit,
-   GL_EXT_depth_bounds_test_bit,
-   GL_EXT_draw_range_elements_bit,
-   GL_EXT_fog_coord_bit,
-   GL_EXT_framebuffer_blit_bit,
-   GL_EXT_framebuffer_multisample_bit,
-   GL_EXT_framebuffer_object_bit,
-   GL_EXT_multi_draw_arrays_bit,
-   GL_EXT_packed_depth_stencil_bit,
-   GL_EXT_packed_pixels_bit,
-   GL_EXT_paletted_texture_bit,
-   GL_EXT_pixel_buffer_object_bit,
-   GL_EXT_polygon_offset_bit,
-   GL_EXT_rescale_normal_bit,
-   GL_EXT_secondary_color_bit,
-   GL_EXT_separate_specular_color_bit,
-   GL_EXT_shadow_funcs_bit,
-   GL_EXT_shared_texture_palette_bit,
-   GL_EXT_stencil_two_side_bit,
-   GL_EXT_stencil_wrap_bit,
-   GL_EXT_subtexture_bit,
-   GL_EXT_texture_bit,
-   GL_EXT_texture3D_bit,
-   GL_EXT_texture_compression_dxt1_bit,
-   GL_EXT_texture_compression_s3tc_bit,
-   GL_EXT_texture_edge_clamp_bit,
-   GL_EXT_texture_env_combine_bit,
-   GL_EXT_texture_env_dot3_bit,
-   GL_EXT_texture_filter_anisotropic_bit,
-   GL_EXT_texture_lod_bit,
-   GL_EXT_texture_lod_bias_bit,
-   GL_EXT_texture_mirror_clamp_bit,
-   GL_EXT_texture_object_bit,
-   GL_EXT_vertex_array_bit,
-   GL_3DFX_texture_compression_FXT1_bit,
-   GL_APPLE_packed_pixels_bit,
-   GL_APPLE_ycbcr_422_bit,
-   GL_ATI_text_fragment_shader_bit,
-   GL_ATI_texture_env_combine3_bit,
-   GL_ATI_texture_float_bit,
-   GL_ATI_texture_mirror_once_bit,
-   GL_HP_convolution_border_modes_bit,
-   GL_HP_occlusion_test_bit,
-   GL_IBM_cull_vertex_bit,
-   GL_IBM_pixel_filter_hint_bit,
-   GL_IBM_rasterpos_clip_bit,
-   GL_IBM_texture_clamp_nodraw_bit,
-   GL_INGR_interlace_read_bit,
-   GL_MESA_pack_invert_bit,
-   GL_MESA_ycbcr_texture_bit,
-   GL_NV_blend_square_bit,
-   GL_NV_copy_depth_to_color_bit,
-   GL_NV_depth_clamp_bit,
-   GL_NV_fog_distance_bit,
-   GL_NV_fragment_program_bit,
-   GL_NV_fragment_program_option_bit,
-   GL_NV_fragment_program2_bit,
-   GL_NV_light_max_exponent_bit,
-   GL_NV_multisample_filter_hint_bit,
-   GL_NV_packed_depth_stencil_bit,
-   GL_NV_point_sprite_bit,
-   GL_NV_texgen_reflection_bit,
-   GL_NV_texture_compression_vtc_bit,
-   GL_NV_texture_env_combine4_bit,
-   GL_NV_vertex_program_bit,
-   GL_NV_vertex_program1_1_bit,
-   GL_NV_vertex_program2_bit,
-   GL_NV_vertex_program2_option_bit,
-   GL_NV_vertex_program3_bit,
-   GL_OES_compressed_paletted_texture_bit,
-   GL_OES_read_format_bit,
-   GL_SGI_color_matrix_bit,
-   GL_SGI_color_table_bit,
-   GL_SGI_texture_color_table_bit,
-   GL_SGIS_generate_mipmap_bit,
-   GL_SGIS_multisample_bit,
-   GL_SGIS_texture_lod_bit,
-   GL_SGIX_blend_alpha_minmax_bit,
-   GL_SGIX_clipmap_bit,
-   GL_SGIX_depth_texture_bit,
-   GL_SGIX_fog_offset_bit,
-   GL_SGIX_shadow_bit,
-   GL_SGIX_texture_coordinate_clamp_bit,
-   GL_SGIX_texture_lod_bias_bit,
-   GL_SGIX_texture_range_bit,
-   GL_SGIX_texture_scale_bias_bit,
-   GL_SGIX_vertex_preclip_bit,
-   GL_SGIX_vertex_preclip_hint_bit,
-   GL_SGIX_ycrcb_bit,
-   GL_SUN_convolution_border_modes_bit,
-   GL_SUN_slice_accum_bit,
-
-   /* This *MUST* go here.  If it gets put after the duplicate values it will
-    * get the value after the last duplicate.
-    */
-   __NUM_GL_EXTS,
-
-
-   /* Alias extension bits.  These extensions exist in either vendor-specific
-    * or EXT form and were later promoted to either EXT or ARB form.  In all
-    * cases, the meaning is *exactly* the same.  That's why
-    * EXT_texture_env_combine is *NOT* an alias of ARB_texture_env_combine and
-    * EXT_texture_env_dot3 is *NOT* an alias of ARB_texture_env_dot3.  Be
-    * careful!  When in doubt, src/mesa/main/extensions.c in the Mesa tree
-    * is a great reference.
-    */
-
-   GL_ATI_blend_equation_separate_bit = GL_EXT_blend_equation_separate_bit,
-   GL_ATI_draw_buffers_bit = GL_ARB_draw_buffers_bit,
-   GL_ATIX_texture_env_combine3_bit = GL_ATI_texture_env_combine3_bit,
-   GL_EXT_point_parameters_bit = GL_ARB_point_parameters_bit,
-   GL_EXT_texture_env_add_bit = GL_ARB_texture_env_add_bit,
-   GL_EXT_texture_rectangle_bit = GL_ARB_texture_rectangle_bit,
-   GL_IBM_texture_mirrored_repeat_bit = GL_ARB_texture_mirrored_repeat_bit,
-   GL_INGR_blend_func_separate_bit = GL_EXT_blend_func_separate_bit,
-   GL_MESA_window_pos_bit = GL_ARB_window_pos_bit,
-   GL_NV_texture_rectangle_bit = GL_ARB_texture_rectangle_bit,
-   GL_SGIS_texture_border_clamp_bit = GL_ARB_texture_border_clamp_bit,
-   GL_SGIS_texture_edge_clamp_bit = GL_EXT_texture_edge_clamp_bit,
-   GL_SGIX_shadow_ambient_bit = GL_ARB_shadow_ambient_bit,
-   GL_SUN_multi_draw_arrays_bit = GL_EXT_multi_draw_arrays_bit
-};
-
-#define __GL_EXT_BYTES   ((__NUM_GL_EXTS + 7) / 8)
-
-struct __GLXscreenConfigsRec;
-struct __GLXcontextRec;
-
-extern GLboolean __glXExtensionBitIsEnabled(struct __GLXscreenConfigsRec *psc,
-                                            unsigned bit);
-extern const char *__glXGetClientExtensions(void);
-extern void __glXCalculateUsableExtensions(struct __GLXscreenConfigsRec *psc,
-                                           GLboolean
-                                           display_is_direct_capable,
-                                           int server_minor_version);
-
-extern void __glXCalculateUsableGLExtensions(struct __GLXcontextRec *gc,
-                                             const char *server_string,
-                                             int major_version,
-                                             int minor_version);
-extern void __glXGetGLVersion(int *major_version, int *minor_version);
-extern char *__glXGetClientGLExtensionString(void);
-
-extern GLboolean __glExtensionBitIsEnabled(const struct __GLXcontextRec *gc,
-                                           unsigned bit);
-
-extern void
-__glXEnableDirectExtension(struct __GLXscreenConfigsRec *psc,
-                           const char *name);
-
-/* Source-level backwards compatibility with old drivers. They won't
- * find the respective functions, though. 
- */
-typedef void (*PFNGLXENABLEEXTENSIONPROC) (const char *name,
-                                           GLboolean force_client);
-typedef void (*PFNGLXDISABLEEXTENSIONPROC) (const char *name);
-
-/* GLX_ALIAS should be used for functions with a non-void return type.
-   GLX_ALIAS_VOID is for functions with a void return type. */
-#ifdef GLX_NO_STATIC_EXTENSION_FUNCTIONS
-# define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func)
-# define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func)
-#else
-# if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
-#  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
-   return_type  real_func  proto_args                                   \
-   __attribute__ ((alias( # aliased_func ) ));
-#  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
-   GLX_ALIAS(void, real_func, proto_args, args, aliased_func)
-# else
-#  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
-   return_type  real_func  proto_args                                   \
-   { return aliased_func args ; }
-#  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
-   void  real_func  proto_args                                      \
-   { aliased_func args ; }
-# endif /* __GNUC__ */
-#endif /* GLX_NO_STATIC_EXTENSION_FUNCTIONS */
-
-#endif /* GLX_GLXEXTENSIONS_H */
diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c
deleted file mode 100644 (file)
index b76ec32..0000000
+++ /dev/null
@@ -1,473 +0,0 @@
-/* glxhash.c -- Small hash table support for integer -> integer mapping
- * Taken from libdrm.
- *
- * Created: Sun Apr 18 09:35:45 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, 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, 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
- * PRECISION INSIGHT 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.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- *
- * DESCRIPTION
- *
- * This file contains a straightforward implementation of a fixed-sized
- * hash table using self-organizing linked lists [Knuth73, pp. 398-399] for
- * collision resolution.  There are two potentially interesting things
- * about this implementation:
- *
- * 1) The table is power-of-two sized.  Prime sized tables are more
- * traditional, but do not have a significant advantage over power-of-two
- * sized table, especially when double hashing is not used for collision
- * resolution.
- *
- * 2) The hash computation uses a table of random integers [Hanson97,
- * pp. 39-41].
- *
- * FUTURE ENHANCEMENTS
- *
- * With a table size of 512, the current implementation is sufficient for a
- * few hundred keys.  Since this is well above the expected size of the
- * tables for which this implementation was designed, the implementation of
- * dynamic hash tables was postponed until the need arises.  A common (and
- * naive) approach to dynamic hash table implementation simply creates a
- * new hash table when necessary, rehashes all the data into the new table,
- * and destroys the old table.  The approach in [Larson88] is superior in
- * two ways: 1) only a portion of the table is expanded when needed,
- * distributing the expansion cost over several insertions, and 2) portions
- * of the table can be locked, enabling a scalable thread-safe
- * implementation.
- *
- * REFERENCES
- *
- * [Hanson97] David R. Hanson.  C Interfaces and Implementations:
- * Techniques for Creating Reusable Software.  Reading, Massachusetts:
- * Addison-Wesley, 1997.
- *
- * [Knuth73] Donald E. Knuth. The Art of Computer Programming.  Volume 3:
- * Sorting and Searching.  Reading, Massachusetts: Addison-Wesley, 1973.
- *
- * [Larson88] Per-Ake Larson. "Dynamic Hash Tables".  CACM 31(4), April
- * 1988, pp. 446-457.
- *
- */
-
-#include "glxhash.h"
-#include <X11/Xfuncproto.h>
-
-#define HASH_MAIN 0
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define HASH_MAGIC 0xdeadbeef
-#define HASH_DEBUG 0
-#define HASH_SIZE  512          /* Good for about 100 entries */
-                                /* If you change this value, you probably
-                                   have to change the HashHash hashing
-                                   function! */
-
-#define HASH_ALLOC malloc
-#define HASH_FREE  free
-#ifndef __GLIBC__
-#define HASH_RANDOM_DECL       char *ps, rs[256]
-#define HASH_RANDOM_INIT(seed) ps = initstate(seed, rs, sizeof(rs))
-#define HASH_RANDOM            random()
-#define HASH_RANDOM_DESTROY    setstate(ps)
-#else
-#define HASH_RANDOM_DECL       struct random_data rd; int32_t rv; char rs[256]
-#define HASH_RANDOM_INIT(seed)                                 \
-   do {                                                                \
-      (void) memset(&rd, 0, sizeof(rd));                       \
-      (void) initstate_r(seed, rs, sizeof(rs), &rd);           \
-   } while(0)
-#define HASH_RANDOM             ((void) random_r(&rd, &rv), rv)
-#define HASH_RANDOM_DESTROY
-#endif
-
-typedef struct __glxHashBucket
-{
-   unsigned long key;
-   void *value;
-   struct __glxHashBucket *next;
-} __glxHashBucket, *__glxHashBucketPtr;
-
-typedef struct __glxHashTable *__glxHashTablePtr;
-struct __glxHashTable
-{
-   unsigned long magic;
-   unsigned long hits;          /* At top of linked list */
-   unsigned long partials;      /* Not at top of linked list */
-   unsigned long misses;        /* Not in table */
-   __glxHashBucketPtr buckets[HASH_SIZE];
-   int p0;
-   __glxHashBucketPtr p1;
-};
-
-static unsigned long
-HashHash(unsigned long key)
-{
-   unsigned long hash = 0;
-   unsigned long tmp = key;
-   static int init = 0;
-   static unsigned long scatter[256];
-   int i;
-
-   if (!init) {
-      HASH_RANDOM_DECL;
-      HASH_RANDOM_INIT(37);
-      for (i = 0; i < 256; i++)
-         scatter[i] = HASH_RANDOM;
-      HASH_RANDOM_DESTROY;
-      ++init;
-   }
-
-   while (tmp) {
-      hash = (hash << 1) + scatter[tmp & 0xff];
-      tmp >>= 8;
-   }
-
-   hash %= HASH_SIZE;
-#if HASH_DEBUG
-   printf("Hash(%d) = %d\n", key, hash);
-#endif
-   return hash;
-}
-
-_X_HIDDEN __glxHashTable *
-__glxHashCreate(void)
-{
-   __glxHashTablePtr table;
-   int i;
-
-   table = HASH_ALLOC(sizeof(*table));
-   if (!table)
-      return NULL;
-   table->magic = HASH_MAGIC;
-   table->hits = 0;
-   table->partials = 0;
-   table->misses = 0;
-
-   for (i = 0; i < HASH_SIZE; i++)
-      table->buckets[i] = NULL;
-   return table;
-}
-
-_X_HIDDEN int
-__glxHashDestroy(__glxHashTable * t)
-{
-   __glxHashTablePtr table = (__glxHashTablePtr) t;
-   __glxHashBucketPtr bucket;
-   __glxHashBucketPtr next;
-   int i;
-
-   if (table->magic != HASH_MAGIC)
-      return -1;                /* Bad magic */
-
-   for (i = 0; i < HASH_SIZE; i++) {
-      for (bucket = table->buckets[i]; bucket;) {
-         next = bucket->next;
-         HASH_FREE(bucket);
-         bucket = next;
-      }
-   }
-   HASH_FREE(table);
-   return 0;
-}
-
-/* Find the bucket and organize the list so that this bucket is at the
-   top. */
-
-static __glxHashBucketPtr
-HashFind(__glxHashTablePtr table, unsigned long key, unsigned long *h)
-{
-   unsigned long hash = HashHash(key);
-   __glxHashBucketPtr prev = NULL;
-   __glxHashBucketPtr bucket;
-
-   if (h)
-      *h = hash;
-
-   for (bucket = table->buckets[hash]; bucket; bucket = bucket->next) {
-      if (bucket->key == key) {
-         if (prev) {
-            /* Organize */
-            prev->next = bucket->next;
-            bucket->next = table->buckets[hash];
-            table->buckets[hash] = bucket;
-            ++table->partials;
-         }
-         else {
-            ++table->hits;
-         }
-         return bucket;
-      }
-      prev = bucket;
-   }
-   ++table->misses;
-   return NULL;
-}
-
-_X_HIDDEN int
-__glxHashLookup(__glxHashTable * t, unsigned long key, void **value)
-{
-   __glxHashTablePtr table = (__glxHashTablePtr) t;
-   __glxHashBucketPtr bucket;
-
-   if (!table || table->magic != HASH_MAGIC)
-      return -1;                /* Bad magic */
-
-   bucket = HashFind(table, key, NULL);
-   if (!bucket)
-      return 1;                 /* Not found */
-   *value = bucket->value;
-   return 0;                    /* Found */
-}
-
-_X_HIDDEN int
-__glxHashInsert(__glxHashTable * t, unsigned long key, void *value)
-{
-   __glxHashTablePtr table = (__glxHashTablePtr) t;
-   __glxHashBucketPtr bucket;
-   unsigned long hash;
-
-   if (table->magic != HASH_MAGIC)
-      return -1;                /* Bad magic */
-
-   if (HashFind(table, key, &hash))
-      return 1;                 /* Already in table */
-
-   bucket = HASH_ALLOC(sizeof(*bucket));
-   if (!bucket)
-      return -1;                /* Error */
-   bucket->key = key;
-   bucket->value = value;
-   bucket->next = table->buckets[hash];
-   table->buckets[hash] = bucket;
-#if HASH_DEBUG
-   printf("Inserted %d at %d/%p\n", key, hash, bucket);
-#endif
-   return 0;                    /* Added to table */
-}
-
-_X_HIDDEN int
-__glxHashDelete(__glxHashTable * t, unsigned long key)
-{
-   __glxHashTablePtr table = (__glxHashTablePtr) t;
-   unsigned long hash;
-   __glxHashBucketPtr bucket;
-
-   if (table->magic != HASH_MAGIC)
-      return -1;                /* Bad magic */
-
-   bucket = HashFind(table, key, &hash);
-
-   if (!bucket)
-      return 1;                 /* Not found */
-
-   table->buckets[hash] = bucket->next;
-   HASH_FREE(bucket);
-   return 0;
-}
-
-_X_HIDDEN int
-__glxHashNext(__glxHashTable * t, unsigned long *key, void **value)
-{
-   __glxHashTablePtr table = (__glxHashTablePtr) t;
-
-   while (table->p0 < HASH_SIZE) {
-      if (table->p1) {
-         *key = table->p1->key;
-         *value = table->p1->value;
-         table->p1 = table->p1->next;
-         return 1;
-      }
-      table->p1 = table->buckets[table->p0];
-      ++table->p0;
-   }
-   return 0;
-}
-
-_X_HIDDEN int
-__glxHashFirst(__glxHashTable * t, unsigned long *key, void **value)
-{
-   __glxHashTablePtr table = (__glxHashTablePtr) t;
-
-   if (table->magic != HASH_MAGIC)
-      return -1;                /* Bad magic */
-
-   table->p0 = 0;
-   table->p1 = table->buckets[0];
-   return __glxHashNext(table, key, value);
-}
-
-#if HASH_MAIN
-#define DIST_LIMIT 10
-static int dist[DIST_LIMIT];
-
-static void
-clear_dist(void)
-{
-   int i;
-
-   for (i = 0; i < DIST_LIMIT; i++)
-      dist[i] = 0;
-}
-
-static int
-count_entries(__glxHashBucketPtr bucket)
-{
-   int count = 0;
-
-   for (; bucket; bucket = bucket->next)
-      ++count;
-   return count;
-}
-
-static void
-update_dist(int count)
-{
-   if (count >= DIST_LIMIT)
-      ++dist[DIST_LIMIT - 1];
-   else
-      ++dist[count];
-}
-
-static void
-compute_dist(__glxHashTablePtr table)
-{
-   int i;
-   __glxHashBucketPtr bucket;
-
-   printf("Hits = %ld, partials = %ld, misses = %ld\n",
-          table->hits, table->partials, table->misses);
-   clear_dist();
-   for (i = 0; i < HASH_SIZE; i++) {
-      bucket = table->buckets[i];
-      update_dist(count_entries(bucket));
-   }
-   for (i = 0; i < DIST_LIMIT; i++) {
-      if (i != DIST_LIMIT - 1)
-         printf("%5d %10d\n", i, dist[i]);
-      else
-         printf("other %10d\n", dist[i]);
-   }
-}
-
-static void
-check_table(__glxHashTablePtr table, unsigned long key, unsigned long value)
-{
-   unsigned long retval = 0;
-   int retcode = __glxHashLookup(table, key, &retval);
-
-   switch (retcode) {
-   case -1:
-      printf("Bad magic = 0x%08lx:"
-             " key = %lu, expected = %lu, returned = %lu\n",
-             table->magic, key, value, retval);
-      break;
-   case 1:
-      printf("Not found: key = %lu, expected = %lu returned = %lu\n",
-             key, value, retval);
-      break;
-   case 0:
-      if (value != retval)
-         printf("Bad value: key = %lu, expected = %lu, returned = %lu\n",
-                key, value, retval);
-      break;
-   default:
-      printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n",
-             retcode, key, value, retval);
-      break;
-   }
-}
-
-int
-main(void)
-{
-   __glxHashTablePtr table;
-   int i;
-
-   printf("\n***** 256 consecutive integers ****\n");
-   table = __glxHashCreate();
-   for (i = 0; i < 256; i++)
-      __glxHashInsert(table, i, i);
-   for (i = 0; i < 256; i++)
-      check_table(table, i, i);
-   for (i = 256; i >= 0; i--)
-      check_table(table, i, i);
-   compute_dist(table);
-   __glxHashDestroy(table);
-
-   printf("\n***** 1024 consecutive integers ****\n");
-   table = __glxHashCreate();
-   for (i = 0; i < 1024; i++)
-      __glxHashInsert(table, i, i);
-   for (i = 0; i < 1024; i++)
-      check_table(table, i, i);
-   for (i = 1024; i >= 0; i--)
-      check_table(table, i, i);
-   compute_dist(table);
-   __glxHashDestroy(table);
-
-   printf("\n***** 1024 consecutive page addresses (4k pages) ****\n");
-   table = __glxHashCreate();
-   for (i = 0; i < 1024; i++)
-      __glxHashInsert(table, i * 4096, i);
-   for (i = 0; i < 1024; i++)
-      check_table(table, i * 4096, i);
-   for (i = 1024; i >= 0; i--)
-      check_table(table, i * 4096, i);
-   compute_dist(table);
-   __glxHashDestroy(table);
-
-   printf("\n***** 1024 random integers ****\n");
-   table = __glxHashCreate();
-   srandom(0xbeefbeef);
-   for (i = 0; i < 1024; i++)
-      __glxHashInsert(table, random(), i);
-   srandom(0xbeefbeef);
-   for (i = 0; i < 1024; i++)
-      check_table(table, random(), i);
-   srandom(0xbeefbeef);
-   for (i = 0; i < 1024; i++)
-      check_table(table, random(), i);
-   compute_dist(table);
-   __glxHashDestroy(table);
-
-   printf("\n***** 5000 random integers ****\n");
-   table = __glxHashCreate();
-   srandom(0xbeefbeef);
-   for (i = 0; i < 5000; i++)
-      __glxHashInsert(table, random(), i);
-   srandom(0xbeefbeef);
-   for (i = 0; i < 5000; i++)
-      check_table(table, random(), i);
-   srandom(0xbeefbeef);
-   for (i = 0; i < 5000; i++)
-      check_table(table, random(), i);
-   compute_dist(table);
-   __glxHashDestroy(table);
-
-   return 0;
-}
-#endif
diff --git a/src/glx/x11/glxhash.h b/src/glx/x11/glxhash.h
deleted file mode 100644 (file)
index 710712d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _GLX_HASH_H_
-#define _GLX_HASH_H_
-
-
-typedef struct __glxHashTable __glxHashTable;
-
-/* Hash table routines */
-extern __glxHashTable *__glxHashCreate(void);
-extern int __glxHashDestroy(__glxHashTable * t);
-extern int __glxHashLookup(__glxHashTable * t, unsigned long key,
-                           void **value);
-extern int __glxHashInsert(__glxHashTable * t, unsigned long key,
-                           void *value);
-extern int __glxHashDelete(__glxHashTable * t, unsigned long key);
-extern int __glxHashFirst(__glxHashTable * t, unsigned long *key,
-                          void **value);
-extern int __glxHashNext(__glxHashTable * t, unsigned long *key,
-                         void **value);
-
-#endif /* _GLX_HASH_H_ */
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
deleted file mode 100644 (file)
index 48bae14..0000000
+++ /dev/null
@@ -1,10669 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_send.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2004, 2005
- * 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
- * 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.
- */
-
-
-#include <GL/gl.h>
-#include "indirect.h"
-#include "glxclient.h"
-#include "indirect_size.h"
-#include "glapitable.h"
-#include "glapidispatch.h"
-#include "glapi.h"
-#include "glthread.h"
-#include <GL/glxproto.h>
-#ifdef USE_XCB
-#include <X11/Xlib-xcb.h>
-#include <xcb/xcb.h>
-#include <xcb/glx.h>
-#endif /* USE_XCB */
-
-#define __GLX_PAD(n) (((n) + 3) & ~3)
-
-#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#    define FASTCALL __attribute__((fastcall))
-#  else
-#    define FASTCALL
-#  endif
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define NOINLINE __attribute__((noinline))
-#  else
-#    define NOINLINE
-#  endif
-
-#if !defined __GNUC__ || __GNUC__ < 3
-#  define __builtin_expect(x, y) x
-#endif
-
-/* If the size and opcode values are known at compile-time, this will, on
- * x86 at least, emit them with a single instruction.
- */
-#define emit_header(dest, op, size)            \
-    do { union { short s[2]; int i; } temp;    \
-         temp.s[0] = (size); temp.s[1] = (op); \
-         *((int *)(dest)) = temp.i; } while(0)
-
-NOINLINE CARD32
-__glXReadReply(Display * dpy, size_t size, void *dest,
-               GLboolean reply_is_always_array)
-{
-    xGLXSingleReply reply;
-
-    (void) _XReply(dpy, (xReply *) & reply, 0, False);
-    if (size != 0) {
-        if ((reply.length > 0) || reply_is_always_array) {
-            const GLint bytes = (reply_is_always_array)
-                ? (4 * reply.length) : (reply.size * size);
-            const GLint extra = 4 - (bytes & 3);
-
-            _XRead(dpy, dest, bytes);
-            if (extra < 4) {
-                _XEatData(dpy, extra);
-            }
-        } else {
-            (void) memcpy(dest, &(reply.pad3), size);
-        }
-    }
-
-    return reply.retval;
-}
-
-NOINLINE void
-__glXReadPixelReply(Display * dpy, __GLXcontext * gc, unsigned max_dim,
-                    GLint width, GLint height, GLint depth, GLenum format,
-                    GLenum type, void *dest, GLboolean dimensions_in_reply)
-{
-    xGLXSingleReply reply;
-    GLint size;
-
-    (void) _XReply(dpy, (xReply *) & reply, 0, False);
-
-    if (dimensions_in_reply) {
-        width = reply.pad3;
-        height = reply.pad4;
-        depth = reply.pad5;
-
-        if ((height == 0) || (max_dim < 2)) {
-            height = 1;
-        }
-        if ((depth == 0) || (max_dim < 3)) {
-            depth = 1;
-        }
-    }
-
-    size = reply.length * 4;
-    if (size != 0) {
-        void *buf = Xmalloc(size);
-
-        if (buf == NULL) {
-            _XEatData(dpy, size);
-            __glXSetError(gc, GL_OUT_OF_MEMORY);
-        } else {
-            const GLint extra = 4 - (size & 3);
-
-            _XRead(dpy, buf, size);
-            if (extra < 4) {
-                _XEatData(dpy, extra);
-            }
-
-            __glEmptyImage(gc, 3, width, height, depth, format, type,
-                           buf, dest);
-            Xfree(buf);
-        }
-    }
-}
-
-#define X_GLXSingle 0
-
-NOINLINE FASTCALL GLubyte *
-__glXSetupSingleRequest(__GLXcontext * gc, GLint sop, GLint cmdlen)
-{
-    xGLXSingleReq *req;
-    Display *const dpy = gc->currentDpy;
-
-    (void) __glXFlushRenderBuffer(gc, gc->pc);
-    LockDisplay(dpy);
-    GetReqExtra(GLXSingle, cmdlen, req);
-    req->reqType = gc->majorOpcode;
-    req->contextTag = gc->currentContextTag;
-    req->glxCode = sop;
-    return (GLubyte *) (req) + sz_xGLXSingleReq;
-}
-
-NOINLINE FASTCALL GLubyte *
-__glXSetupVendorRequest(__GLXcontext * gc, GLint code, GLint vop,
-                        GLint cmdlen)
-{
-    xGLXVendorPrivateReq *req;
-    Display *const dpy = gc->currentDpy;
-
-    (void) __glXFlushRenderBuffer(gc, gc->pc);
-    LockDisplay(dpy);
-    GetReqExtra(GLXVendorPrivate, cmdlen, req);
-    req->reqType = gc->majorOpcode;
-    req->glxCode = code;
-    req->vendorCode = vop;
-    req->contextTag = gc->currentContextTag;
-    return (GLubyte *) (req) + sz_xGLXVendorPrivateReq;
-}
-
-const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
-
-#define zero                        (__glXDefaultPixelStore+0)
-#define one                         (__glXDefaultPixelStore+8)
-#define default_pixel_store_1D      (__glXDefaultPixelStore+4)
-#define default_pixel_store_1D_size 20
-#define default_pixel_store_2D      (__glXDefaultPixelStore+4)
-#define default_pixel_store_2D_size 20
-#define default_pixel_store_3D      (__glXDefaultPixelStore+0)
-#define default_pixel_store_3D_size 36
-#define default_pixel_store_4D      (__glXDefaultPixelStore+0)
-#define default_pixel_store_4D_size 36
-
-static FASTCALL NOINLINE void
-generic_3_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static FASTCALL NOINLINE void
-generic_4_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static FASTCALL NOINLINE void
-generic_6_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static FASTCALL NOINLINE void
-generic_8_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static FASTCALL NOINLINE void
-generic_12_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 12);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static FASTCALL NOINLINE void
-generic_16_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static FASTCALL NOINLINE void
-generic_24_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 24);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static FASTCALL NOINLINE void
-generic_32_byte(GLint rop, const void *ptr)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-
-    emit_header(gc->pc, rop, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), ptr, 32);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLsop_NewList 101
-void
-__indirect_glNewList(GLuint list, GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_new_list(c, gc->currentContextTag, list, mode);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_NewList, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&list), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&mode), 4);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_EndList 102
-void
-__indirect_glEndList(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 0;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_end_list(c, gc->currentContextTag);
-#else
-        (void) __glXSetupSingleRequest(gc, X_GLsop_EndList, cmdlen);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLrop_CallList 1
-void
-__indirect_glCallList(GLuint list)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_CallList, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&list), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CallLists 2
-void
-__indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glCallLists_size(type);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * n));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_CallLists, cmdlen);
-            (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
-            (void) memcpy((void *) (gc->pc + 8), (void *) (&type), 4);
-            (void) memcpy((void *) (gc->pc + 12), (void *) (lists),
-                          (compsize * n));
-            gc->pc += cmdlen;
-            if (__builtin_expect(gc->pc > gc->limit, 0)) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_CallLists;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&n), 4);
-            (void) memcpy((void *) (pc + 12), (void *) (&type), 4);
-            __glXSendLargeCommand(gc, pc, 16, lists, (compsize * n));
-        }
-    }
-}
-
-#define X_GLsop_DeleteLists 103
-void
-__indirect_glDeleteLists(GLuint list, GLsizei range)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_delete_lists(c, gc->currentContextTag, list, range);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_DeleteLists, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&list), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&range), 4);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GenLists 104
-GLuint
-__indirect_glGenLists(GLsizei range)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLuint retval = (GLuint) 0;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_gen_lists_reply_t *reply =
-            xcb_glx_gen_lists_reply(c,
-                                    xcb_glx_gen_lists(c,
-                                                      gc->currentContextTag,
-                                                      range), NULL);
-        retval = reply->ret_val;
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GenLists, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&range), 4);
-        retval = (GLuint) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return retval;
-}
-
-#define X_GLrop_ListBase 3
-void
-__indirect_glListBase(GLuint base)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ListBase, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&base), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Begin 4
-void
-__indirect_glBegin(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Begin, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Bitmap 5
-void
-__indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
-                    GLfloat yorig, GLfloat xmove, GLfloat ymove,
-                    const GLubyte *bitmap)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (bitmap != NULL) ? __glImageSize(width, height, 1, GL_COLOR_INDEX,
-                                         GL_BITMAP, 0) : 0;
-    const GLuint cmdlen = 48 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_Bitmap, cmdlen);
-            (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 28), (void *) (&height), 4);
-            (void) memcpy((void *) (gc->pc + 32), (void *) (&xorig), 4);
-            (void) memcpy((void *) (gc->pc + 36), (void *) (&yorig), 4);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&xmove), 4);
-            (void) memcpy((void *) (gc->pc + 44), (void *) (&ymove), 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, 2, width, height, 1, GL_COLOR_INDEX,
-                                  GL_BITMAP, bitmap, gc->pc + 48, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
-                              default_pixel_store_2D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_Bitmap;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 28), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 32), (void *) (&height), 4);
-            (void) memcpy((void *) (pc + 36), (void *) (&xorig), 4);
-            (void) memcpy((void *) (pc + 40), (void *) (&yorig), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&xmove), 4);
-            (void) memcpy((void *) (pc + 48), (void *) (&ymove), 4);
-            __glXSendLargeImage(gc, compsize, 2, width, height, 1,
-                                GL_COLOR_INDEX, GL_BITMAP, bitmap, pc + 52,
-                                pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_Color3bv 6
-void
-__indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Color3bv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3bv 6
-void
-__indirect_glColor3bv(const GLbyte *v)
-{
-    generic_3_byte(X_GLrop_Color3bv, v);
-}
-
-#define X_GLrop_Color3dv 7
-void
-__indirect_glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_Color3dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&green), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&blue), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3dv 7
-void
-__indirect_glColor3dv(const GLdouble * v)
-{
-    generic_24_byte(X_GLrop_Color3dv, v);
-}
-
-#define X_GLrop_Color3fv 8
-void
-__indirect_glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Color3fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3fv 8
-void
-__indirect_glColor3fv(const GLfloat * v)
-{
-    generic_12_byte(X_GLrop_Color3fv, v);
-}
-
-#define X_GLrop_Color3iv 9
-void
-__indirect_glColor3i(GLint red, GLint green, GLint blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Color3iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3iv 9
-void
-__indirect_glColor3iv(const GLint * v)
-{
-    generic_12_byte(X_GLrop_Color3iv, v);
-}
-
-#define X_GLrop_Color3sv 10
-void
-__indirect_glColor3s(GLshort red, GLshort green, GLshort blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Color3sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3sv 10
-void
-__indirect_glColor3sv(const GLshort * v)
-{
-    generic_6_byte(X_GLrop_Color3sv, v);
-}
-
-#define X_GLrop_Color3ubv 11
-void
-__indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Color3ubv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3ubv 11
-void
-__indirect_glColor3ubv(const GLubyte *v)
-{
-    generic_3_byte(X_GLrop_Color3ubv, v);
-}
-
-#define X_GLrop_Color3uiv 12
-void
-__indirect_glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Color3uiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3uiv 12
-void
-__indirect_glColor3uiv(const GLuint * v)
-{
-    generic_12_byte(X_GLrop_Color3uiv, v);
-}
-
-#define X_GLrop_Color3usv 13
-void
-__indirect_glColor3us(GLushort red, GLushort green, GLushort blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Color3usv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color3usv 13
-void
-__indirect_glColor3usv(const GLushort * v)
-{
-    generic_6_byte(X_GLrop_Color3usv, v);
-}
-
-#define X_GLrop_Color4bv 14
-void
-__indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Color4bv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
-    (void) memcpy((void *) (gc->pc + 7), (void *) (&alpha), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4bv 14
-void
-__indirect_glColor4bv(const GLbyte *v)
-{
-    generic_4_byte(X_GLrop_Color4bv, v);
-}
-
-#define X_GLrop_Color4dv 15
-void
-__indirect_glColor4d(GLdouble red, GLdouble green, GLdouble blue,
-                     GLdouble alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_Color4dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&green), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&blue), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&alpha), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4dv 15
-void
-__indirect_glColor4dv(const GLdouble * v)
-{
-    generic_32_byte(X_GLrop_Color4dv, v);
-}
-
-#define X_GLrop_Color4fv 16
-void
-__indirect_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Color4fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4fv 16
-void
-__indirect_glColor4fv(const GLfloat * v)
-{
-    generic_16_byte(X_GLrop_Color4fv, v);
-}
-
-#define X_GLrop_Color4iv 17
-void
-__indirect_glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Color4iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4iv 17
-void
-__indirect_glColor4iv(const GLint * v)
-{
-    generic_16_byte(X_GLrop_Color4iv, v);
-}
-
-#define X_GLrop_Color4sv 18
-void
-__indirect_glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Color4sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&alpha), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4sv 18
-void
-__indirect_glColor4sv(const GLshort * v)
-{
-    generic_8_byte(X_GLrop_Color4sv, v);
-}
-
-#define X_GLrop_Color4ubv 19
-void
-__indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Color4ubv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
-    (void) memcpy((void *) (gc->pc + 7), (void *) (&alpha), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4ubv 19
-void
-__indirect_glColor4ubv(const GLubyte *v)
-{
-    generic_4_byte(X_GLrop_Color4ubv, v);
-}
-
-#define X_GLrop_Color4uiv 20
-void
-__indirect_glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Color4uiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4uiv 20
-void
-__indirect_glColor4uiv(const GLuint * v)
-{
-    generic_16_byte(X_GLrop_Color4uiv, v);
-}
-
-#define X_GLrop_Color4usv 21
-void
-__indirect_glColor4us(GLushort red, GLushort green, GLushort blue,
-                      GLushort alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Color4usv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&alpha), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Color4usv 21
-void
-__indirect_glColor4usv(const GLushort * v)
-{
-    generic_8_byte(X_GLrop_Color4usv, v);
-}
-
-#define X_GLrop_EdgeFlagv 22
-void
-__indirect_glEdgeFlag(GLboolean flag)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_EdgeFlagv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&flag), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EdgeFlagv 22
-void
-__indirect_glEdgeFlagv(const GLboolean * flag)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_EdgeFlagv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (flag), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_End 23
-void
-__indirect_glEnd(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 4;
-    emit_header(gc->pc, X_GLrop_End, cmdlen);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Indexdv 24
-void
-__indirect_glIndexd(GLdouble c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Indexdv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Indexdv 24
-void
-__indirect_glIndexdv(const GLdouble * c)
-{
-    generic_8_byte(X_GLrop_Indexdv, c);
-}
-
-#define X_GLrop_Indexfv 25
-void
-__indirect_glIndexf(GLfloat c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Indexfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Indexfv 25
-void
-__indirect_glIndexfv(const GLfloat * c)
-{
-    generic_4_byte(X_GLrop_Indexfv, c);
-}
-
-#define X_GLrop_Indexiv 26
-void
-__indirect_glIndexi(GLint c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Indexiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Indexiv 26
-void
-__indirect_glIndexiv(const GLint * c)
-{
-    generic_4_byte(X_GLrop_Indexiv, c);
-}
-
-#define X_GLrop_Indexsv 27
-void
-__indirect_glIndexs(GLshort c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Indexsv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Indexsv 27
-void
-__indirect_glIndexsv(const GLshort * c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Indexsv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (c), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Normal3bv 28
-void
-__indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Normal3bv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&ny), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&nz), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Normal3bv 28
-void
-__indirect_glNormal3bv(const GLbyte *v)
-{
-    generic_3_byte(X_GLrop_Normal3bv, v);
-}
-
-#define X_GLrop_Normal3dv 29
-void
-__indirect_glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_Normal3dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&ny), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&nz), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Normal3dv 29
-void
-__indirect_glNormal3dv(const GLdouble * v)
-{
-    generic_24_byte(X_GLrop_Normal3dv, v);
-}
-
-#define X_GLrop_Normal3fv 30
-void
-__indirect_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Normal3fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&ny), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&nz), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Normal3fv 30
-void
-__indirect_glNormal3fv(const GLfloat * v)
-{
-    generic_12_byte(X_GLrop_Normal3fv, v);
-}
-
-#define X_GLrop_Normal3iv 31
-void
-__indirect_glNormal3i(GLint nx, GLint ny, GLint nz)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Normal3iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&ny), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&nz), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Normal3iv 31
-void
-__indirect_glNormal3iv(const GLint * v)
-{
-    generic_12_byte(X_GLrop_Normal3iv, v);
-}
-
-#define X_GLrop_Normal3sv 32
-void
-__indirect_glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Normal3sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&nx), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&ny), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&nz), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Normal3sv 32
-void
-__indirect_glNormal3sv(const GLshort * v)
-{
-    generic_6_byte(X_GLrop_Normal3sv, v);
-}
-
-#define X_GLrop_RasterPos2dv 33
-void
-__indirect_glRasterPos2d(GLdouble x, GLdouble y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_RasterPos2dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos2dv 33
-void
-__indirect_glRasterPos2dv(const GLdouble * v)
-{
-    generic_16_byte(X_GLrop_RasterPos2dv, v);
-}
-
-#define X_GLrop_RasterPos2fv 34
-void
-__indirect_glRasterPos2f(GLfloat x, GLfloat y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_RasterPos2fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos2fv 34
-void
-__indirect_glRasterPos2fv(const GLfloat * v)
-{
-    generic_8_byte(X_GLrop_RasterPos2fv, v);
-}
-
-#define X_GLrop_RasterPos2iv 35
-void
-__indirect_glRasterPos2i(GLint x, GLint y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_RasterPos2iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos2iv 35
-void
-__indirect_glRasterPos2iv(const GLint * v)
-{
-    generic_8_byte(X_GLrop_RasterPos2iv, v);
-}
-
-#define X_GLrop_RasterPos2sv 36
-void
-__indirect_glRasterPos2s(GLshort x, GLshort y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_RasterPos2sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos2sv 36
-void
-__indirect_glRasterPos2sv(const GLshort * v)
-{
-    generic_4_byte(X_GLrop_RasterPos2sv, v);
-}
-
-#define X_GLrop_RasterPos3dv 37
-void
-__indirect_glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_RasterPos3dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos3dv 37
-void
-__indirect_glRasterPos3dv(const GLdouble * v)
-{
-    generic_24_byte(X_GLrop_RasterPos3dv, v);
-}
-
-#define X_GLrop_RasterPos3fv 38
-void
-__indirect_glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_RasterPos3fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos3fv 38
-void
-__indirect_glRasterPos3fv(const GLfloat * v)
-{
-    generic_12_byte(X_GLrop_RasterPos3fv, v);
-}
-
-#define X_GLrop_RasterPos3iv 39
-void
-__indirect_glRasterPos3i(GLint x, GLint y, GLint z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_RasterPos3iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos3iv 39
-void
-__indirect_glRasterPos3iv(const GLint * v)
-{
-    generic_12_byte(X_GLrop_RasterPos3iv, v);
-}
-
-#define X_GLrop_RasterPos3sv 40
-void
-__indirect_glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_RasterPos3sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos3sv 40
-void
-__indirect_glRasterPos3sv(const GLshort * v)
-{
-    generic_6_byte(X_GLrop_RasterPos3sv, v);
-}
-
-#define X_GLrop_RasterPos4dv 41
-void
-__indirect_glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_RasterPos4dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos4dv 41
-void
-__indirect_glRasterPos4dv(const GLdouble * v)
-{
-    generic_32_byte(X_GLrop_RasterPos4dv, v);
-}
-
-#define X_GLrop_RasterPos4fv 42
-void
-__indirect_glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_RasterPos4fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos4fv 42
-void
-__indirect_glRasterPos4fv(const GLfloat * v)
-{
-    generic_16_byte(X_GLrop_RasterPos4fv, v);
-}
-
-#define X_GLrop_RasterPos4iv 43
-void
-__indirect_glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_RasterPos4iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos4iv 43
-void
-__indirect_glRasterPos4iv(const GLint * v)
-{
-    generic_16_byte(X_GLrop_RasterPos4iv, v);
-}
-
-#define X_GLrop_RasterPos4sv 44
-void
-__indirect_glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_RasterPos4sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&w), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_RasterPos4sv 44
-void
-__indirect_glRasterPos4sv(const GLshort * v)
-{
-    generic_8_byte(X_GLrop_RasterPos4sv, v);
-}
-
-#define X_GLrop_Rectdv 45
-void
-__indirect_glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_Rectdv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y1), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&x2), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&y2), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rectdv 45
-void
-__indirect_glRectdv(const GLdouble * v1, const GLdouble * v2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_Rectdv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 16);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (v2), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rectfv 46
-void
-__indirect_glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Rectfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y1), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x2), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y2), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rectfv 46
-void
-__indirect_glRectfv(const GLfloat * v1, const GLfloat * v2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Rectfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (v2), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rectiv 47
-void
-__indirect_glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Rectiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y1), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x2), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y2), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rectiv 47
-void
-__indirect_glRectiv(const GLint * v1, const GLint * v2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Rectiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (v2), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rectsv 48
-void
-__indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Rectsv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x1), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&y1), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x2), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&y2), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rectsv 48
-void
-__indirect_glRectsv(const GLshort * v1, const GLshort * v2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Rectsv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v1), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v2), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord1dv 49
-void
-__indirect_glTexCoord1d(GLdouble s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_TexCoord1dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord1dv 49
-void
-__indirect_glTexCoord1dv(const GLdouble * v)
-{
-    generic_8_byte(X_GLrop_TexCoord1dv, v);
-}
-
-#define X_GLrop_TexCoord1fv 50
-void
-__indirect_glTexCoord1f(GLfloat s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_TexCoord1fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord1fv 50
-void
-__indirect_glTexCoord1fv(const GLfloat * v)
-{
-    generic_4_byte(X_GLrop_TexCoord1fv, v);
-}
-
-#define X_GLrop_TexCoord1iv 51
-void
-__indirect_glTexCoord1i(GLint s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_TexCoord1iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord1iv 51
-void
-__indirect_glTexCoord1iv(const GLint * v)
-{
-    generic_4_byte(X_GLrop_TexCoord1iv, v);
-}
-
-#define X_GLrop_TexCoord1sv 52
-void
-__indirect_glTexCoord1s(GLshort s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_TexCoord1sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord1sv 52
-void
-__indirect_glTexCoord1sv(const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_TexCoord1sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord2dv 53
-void
-__indirect_glTexCoord2d(GLdouble s, GLdouble t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_TexCoord2dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord2dv 53
-void
-__indirect_glTexCoord2dv(const GLdouble * v)
-{
-    generic_16_byte(X_GLrop_TexCoord2dv, v);
-}
-
-#define X_GLrop_TexCoord2fv 54
-void
-__indirect_glTexCoord2f(GLfloat s, GLfloat t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_TexCoord2fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord2fv 54
-void
-__indirect_glTexCoord2fv(const GLfloat * v)
-{
-    generic_8_byte(X_GLrop_TexCoord2fv, v);
-}
-
-#define X_GLrop_TexCoord2iv 55
-void
-__indirect_glTexCoord2i(GLint s, GLint t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_TexCoord2iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord2iv 55
-void
-__indirect_glTexCoord2iv(const GLint * v)
-{
-    generic_8_byte(X_GLrop_TexCoord2iv, v);
-}
-
-#define X_GLrop_TexCoord2sv 56
-void
-__indirect_glTexCoord2s(GLshort s, GLshort t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_TexCoord2sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&t), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord2sv 56
-void
-__indirect_glTexCoord2sv(const GLshort * v)
-{
-    generic_4_byte(X_GLrop_TexCoord2sv, v);
-}
-
-#define X_GLrop_TexCoord3dv 57
-void
-__indirect_glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_TexCoord3dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord3dv 57
-void
-__indirect_glTexCoord3dv(const GLdouble * v)
-{
-    generic_24_byte(X_GLrop_TexCoord3dv, v);
-}
-
-#define X_GLrop_TexCoord3fv 58
-void
-__indirect_glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexCoord3fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord3fv 58
-void
-__indirect_glTexCoord3fv(const GLfloat * v)
-{
-    generic_12_byte(X_GLrop_TexCoord3fv, v);
-}
-
-#define X_GLrop_TexCoord3iv 59
-void
-__indirect_glTexCoord3i(GLint s, GLint t, GLint r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexCoord3iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord3iv 59
-void
-__indirect_glTexCoord3iv(const GLint * v)
-{
-    generic_12_byte(X_GLrop_TexCoord3iv, v);
-}
-
-#define X_GLrop_TexCoord3sv 60
-void
-__indirect_glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_TexCoord3sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&t), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&r), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord3sv 60
-void
-__indirect_glTexCoord3sv(const GLshort * v)
-{
-    generic_6_byte(X_GLrop_TexCoord3sv, v);
-}
-
-#define X_GLrop_TexCoord4dv 61
-void
-__indirect_glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_TexCoord4dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&q), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord4dv 61
-void
-__indirect_glTexCoord4dv(const GLdouble * v)
-{
-    generic_32_byte(X_GLrop_TexCoord4dv, v);
-}
-
-#define X_GLrop_TexCoord4fv 62
-void
-__indirect_glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_TexCoord4fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&q), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord4fv 62
-void
-__indirect_glTexCoord4fv(const GLfloat * v)
-{
-    generic_16_byte(X_GLrop_TexCoord4fv, v);
-}
-
-#define X_GLrop_TexCoord4iv 63
-void
-__indirect_glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_TexCoord4iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&q), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord4iv 63
-void
-__indirect_glTexCoord4iv(const GLint * v)
-{
-    generic_16_byte(X_GLrop_TexCoord4iv, v);
-}
-
-#define X_GLrop_TexCoord4sv 64
-void
-__indirect_glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_TexCoord4sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&t), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&r), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&q), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexCoord4sv 64
-void
-__indirect_glTexCoord4sv(const GLshort * v)
-{
-    generic_8_byte(X_GLrop_TexCoord4sv, v);
-}
-
-#define X_GLrop_Vertex2dv 65
-void
-__indirect_glVertex2d(GLdouble x, GLdouble y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Vertex2dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex2dv 65
-void
-__indirect_glVertex2dv(const GLdouble * v)
-{
-    generic_16_byte(X_GLrop_Vertex2dv, v);
-}
-
-#define X_GLrop_Vertex2fv 66
-void
-__indirect_glVertex2f(GLfloat x, GLfloat y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Vertex2fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex2fv 66
-void
-__indirect_glVertex2fv(const GLfloat * v)
-{
-    generic_8_byte(X_GLrop_Vertex2fv, v);
-}
-
-#define X_GLrop_Vertex2iv 67
-void
-__indirect_glVertex2i(GLint x, GLint y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Vertex2iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex2iv 67
-void
-__indirect_glVertex2iv(const GLint * v)
-{
-    generic_8_byte(X_GLrop_Vertex2iv, v);
-}
-
-#define X_GLrop_Vertex2sv 68
-void
-__indirect_glVertex2s(GLshort x, GLshort y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Vertex2sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex2sv 68
-void
-__indirect_glVertex2sv(const GLshort * v)
-{
-    generic_4_byte(X_GLrop_Vertex2sv, v);
-}
-
-#define X_GLrop_Vertex3dv 69
-void
-__indirect_glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_Vertex3dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex3dv 69
-void
-__indirect_glVertex3dv(const GLdouble * v)
-{
-    generic_24_byte(X_GLrop_Vertex3dv, v);
-}
-
-#define X_GLrop_Vertex3fv 70
-void
-__indirect_glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Vertex3fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex3fv 70
-void
-__indirect_glVertex3fv(const GLfloat * v)
-{
-    generic_12_byte(X_GLrop_Vertex3fv, v);
-}
-
-#define X_GLrop_Vertex3iv 71
-void
-__indirect_glVertex3i(GLint x, GLint y, GLint z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Vertex3iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex3iv 71
-void
-__indirect_glVertex3iv(const GLint * v)
-{
-    generic_12_byte(X_GLrop_Vertex3iv, v);
-}
-
-#define X_GLrop_Vertex3sv 72
-void
-__indirect_glVertex3s(GLshort x, GLshort y, GLshort z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Vertex3sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex3sv 72
-void
-__indirect_glVertex3sv(const GLshort * v)
-{
-    generic_6_byte(X_GLrop_Vertex3sv, v);
-}
-
-#define X_GLrop_Vertex4dv 73
-void
-__indirect_glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_Vertex4dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex4dv 73
-void
-__indirect_glVertex4dv(const GLdouble * v)
-{
-    generic_32_byte(X_GLrop_Vertex4dv, v);
-}
-
-#define X_GLrop_Vertex4fv 74
-void
-__indirect_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Vertex4fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex4fv 74
-void
-__indirect_glVertex4fv(const GLfloat * v)
-{
-    generic_16_byte(X_GLrop_Vertex4fv, v);
-}
-
-#define X_GLrop_Vertex4iv 75
-void
-__indirect_glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Vertex4iv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex4iv 75
-void
-__indirect_glVertex4iv(const GLint * v)
-{
-    generic_16_byte(X_GLrop_Vertex4iv, v);
-}
-
-#define X_GLrop_Vertex4sv 76
-void
-__indirect_glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Vertex4sv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&z), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&w), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Vertex4sv 76
-void
-__indirect_glVertex4sv(const GLshort * v)
-{
-    generic_8_byte(X_GLrop_Vertex4sv, v);
-}
-
-#define X_GLrop_ClipPlane 77
-void
-__indirect_glClipPlane(GLenum plane, const GLdouble * equation)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_ClipPlane, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (equation), 32);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&plane), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ColorMaterial 78
-void
-__indirect_glColorMaterial(GLenum face, GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_ColorMaterial, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CullFace 79
-void
-__indirect_glCullFace(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_CullFace, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Fogf 80
-void
-__indirect_glFogf(GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Fogf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Fogfv 81
-void
-__indirect_glFogfv(GLenum pname, const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glFogfv_size(pname);
-    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_Fogfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Fogi 82
-void
-__indirect_glFogi(GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Fogi, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Fogiv 83
-void
-__indirect_glFogiv(GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glFogiv_size(pname);
-    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_Fogiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_FrontFace 84
-void
-__indirect_glFrontFace(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_FrontFace, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Hint 85
-void
-__indirect_glHint(GLenum target, GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Hint, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Lightf 86
-void
-__indirect_glLightf(GLenum light, GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Lightf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Lightfv 87
-void
-__indirect_glLightfv(GLenum light, GLenum pname, const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glLightfv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_Lightfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Lighti 88
-void
-__indirect_glLighti(GLenum light, GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Lighti, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Lightiv 89
-void
-__indirect_glLightiv(GLenum light, GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glLightiv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_Lightiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LightModelf 90
-void
-__indirect_glLightModelf(GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_LightModelf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LightModelfv 91
-void
-__indirect_glLightModelfv(GLenum pname, const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glLightModelfv_size(pname);
-    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_LightModelfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LightModeli 92
-void
-__indirect_glLightModeli(GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_LightModeli, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LightModeliv 93
-void
-__indirect_glLightModeliv(GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glLightModeliv_size(pname);
-    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_LightModeliv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LineStipple 94
-void
-__indirect_glLineStipple(GLint factor, GLushort pattern)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_LineStipple, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&factor), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pattern), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LineWidth 95
-void
-__indirect_glLineWidth(GLfloat width)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_LineWidth, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&width), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Materialf 96
-void
-__indirect_glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Materialf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Materialfv 97
-void
-__indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glMaterialfv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_Materialfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Materiali 98
-void
-__indirect_glMateriali(GLenum face, GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Materiali, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Materialiv 99
-void
-__indirect_glMaterialiv(GLenum face, GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glMaterialiv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_Materialiv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PointSize 100
-void
-__indirect_glPointSize(GLfloat size)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_PointSize, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&size), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PolygonMode 101
-void
-__indirect_glPolygonMode(GLenum face, GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_PolygonMode, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PolygonStipple 102
-void
-__indirect_glPolygonStipple(const GLubyte *mask)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (mask != NULL) ? __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
-                                       0) : 0;
-    const GLuint cmdlen = 24 + __GLX_PAD(compsize);
-    emit_header(gc->pc, X_GLrop_PolygonStipple, cmdlen);
-    if (compsize > 0) {
-        (*gc->fillImage) (gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask,
-                          gc->pc + 24, gc->pc + 4);
-    } else {
-        (void) memcpy(gc->pc + 4, default_pixel_store_2D,
-                      default_pixel_store_2D_size);
-    }
-    gc->pc += cmdlen;
-    if (gc->pc > gc->limit) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Scissor 103
-void
-__indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Scissor, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ShadeModel 104
-void
-__indirect_glShadeModel(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ShadeModel, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexParameterf 105
-void
-__indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexParameterf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexParameterfv 106
-void
-__indirect_glTexParameterfv(GLenum target, GLenum pname,
-                            const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glTexParameterfv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_TexParameterfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexParameteri 107
-void
-__indirect_glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexParameteri, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexParameteriv 108
-void
-__indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glTexParameteriv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_TexParameteriv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static void
-__glx_TexImage_1D2D(unsigned opcode, unsigned dim, GLenum target, GLint level,
-                    GLint internalformat, GLsizei width, GLsizei height,
-                    GLint border, GLenum format, GLenum type,
-                    const GLvoid * pixels)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        __glImageSize(width, height, 1, format, type, target);
-    const GLuint cmdlen = 56 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, opcode, cmdlen);
-            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 28), (void *) (&level), 4);
-            (void) memcpy((void *) (gc->pc + 32), (void *) (&internalformat),
-                          4);
-            (void) memcpy((void *) (gc->pc + 36), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&height), 4);
-            (void) memcpy((void *) (gc->pc + 44), (void *) (&border), 4);
-            (void) memcpy((void *) (gc->pc + 48), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 52), (void *) (&type), 4);
-            if ((compsize > 0) && (pixels != NULL)) {
-                (*gc->fillImage) (gc, dim, width, height, 1, format, type,
-                                  pixels, gc->pc + 56, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
-                              default_pixel_store_2D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = opcode;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 32), (void *) (&level), 4);
-            (void) memcpy((void *) (pc + 36), (void *) (&internalformat), 4);
-            (void) memcpy((void *) (pc + 40), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&height), 4);
-            (void) memcpy((void *) (pc + 48), (void *) (&border), 4);
-            (void) memcpy((void *) (pc + 52), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 56), (void *) (&type), 4);
-            __glXSendLargeImage(gc, compsize, dim, width, height, 1, format,
-                                type, pixels, pc + 60, pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_TexImage1D 109
-void
-__indirect_glTexImage1D(GLenum target, GLint level, GLint internalformat,
-                        GLsizei width, GLint border, GLenum format,
-                        GLenum type, const GLvoid * pixels)
-{
-    __glx_TexImage_1D2D(X_GLrop_TexImage1D, 1, target, level, internalformat,
-                        width, 1, border, format, type, pixels);
-}
-
-#define X_GLrop_TexImage2D 110
-void
-__indirect_glTexImage2D(GLenum target, GLint level, GLint internalformat,
-                        GLsizei width, GLsizei height, GLint border,
-                        GLenum format, GLenum type, const GLvoid * pixels)
-{
-    __glx_TexImage_1D2D(X_GLrop_TexImage2D, 2, target, level, internalformat,
-                        width, height, border, format, type, pixels);
-}
-
-#define X_GLrop_TexEnvf 111
-void
-__indirect_glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexEnvf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexEnvfv 112
-void
-__indirect_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glTexEnvfv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_TexEnvfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexEnvi 113
-void
-__indirect_glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexEnvi, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexEnviv 114
-void
-__indirect_glTexEnviv(GLenum target, GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glTexEnviv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_TexEnviv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexGend 115
-void
-__indirect_glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_TexGend, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&param), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&coord), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&pname), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexGendv 116
-void
-__indirect_glTexGendv(GLenum coord, GLenum pname, const GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glTexGendv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8));
-    emit_header(gc->pc, X_GLrop_TexGendv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 8));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexGenf 117
-void
-__indirect_glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexGenf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexGenfv 118
-void
-__indirect_glTexGenfv(GLenum coord, GLenum pname, const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glTexGenfv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_TexGenfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexGeni 119
-void
-__indirect_glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_TexGeni, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_TexGeniv 120
-void
-__indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glTexGeniv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_TexGeniv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_InitNames 121
-void
-__indirect_glInitNames(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 4;
-    emit_header(gc->pc, X_GLrop_InitNames, cmdlen);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LoadName 122
-void
-__indirect_glLoadName(GLuint name)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_LoadName, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&name), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PassThrough 123
-void
-__indirect_glPassThrough(GLfloat token)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_PassThrough, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&token), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PopName 124
-void
-__indirect_glPopName(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 4;
-    emit_header(gc->pc, X_GLrop_PopName, cmdlen);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PushName 125
-void
-__indirect_glPushName(GLuint name)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_PushName, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&name), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_DrawBuffer 126
-void
-__indirect_glDrawBuffer(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_DrawBuffer, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Clear 127
-void
-__indirect_glClear(GLbitfield mask)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Clear, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ClearAccum 128
-void
-__indirect_glClearAccum(GLfloat red, GLfloat green, GLfloat blue,
-                        GLfloat alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_ClearAccum, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ClearIndex 129
-void
-__indirect_glClearIndex(GLfloat c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ClearIndex, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ClearColor 130
-void
-__indirect_glClearColor(GLclampf red, GLclampf green, GLclampf blue,
-                        GLclampf alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_ClearColor, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ClearStencil 131
-void
-__indirect_glClearStencil(GLint s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ClearStencil, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ClearDepth 132
-void
-__indirect_glClearDepth(GLclampd depth)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_ClearDepth, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&depth), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_StencilMask 133
-void
-__indirect_glStencilMask(GLuint mask)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_StencilMask, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ColorMask 134
-void
-__indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue,
-                       GLboolean alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ColorMask, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
-    (void) memcpy((void *) (gc->pc + 7), (void *) (&alpha), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_DepthMask 135
-void
-__indirect_glDepthMask(GLboolean flag)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_DepthMask, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&flag), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_IndexMask 136
-void
-__indirect_glIndexMask(GLuint mask)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_IndexMask, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Accum 137
-void
-__indirect_glAccum(GLenum op, GLfloat value)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_Accum, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&op), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&value), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PopAttrib 141
-void
-__indirect_glPopAttrib(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 4;
-    emit_header(gc->pc, X_GLrop_PopAttrib, cmdlen);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PushAttrib 142
-void
-__indirect_glPushAttrib(GLbitfield mask)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_PushAttrib, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mask), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MapGrid1d 147
-void
-__indirect_glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_MapGrid1d, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&u1), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&un), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MapGrid1f 148
-void
-__indirect_glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MapGrid1f, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&un), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&u1), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MapGrid2d 149
-void
-__indirect_glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn,
-                       GLdouble v1, GLdouble v2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_MapGrid2d, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&u1), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&v1), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&v2), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&un), 4);
-    (void) memcpy((void *) (gc->pc + 40), (void *) (&vn), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MapGrid2f 150
-void
-__indirect_glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1,
-                       GLfloat v2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_MapGrid2f, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&un), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&u1), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&u2), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&vn), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&v1), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&v2), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalCoord1dv 151
-void
-__indirect_glEvalCoord1d(GLdouble u)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_EvalCoord1dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalCoord1dv 151
-void
-__indirect_glEvalCoord1dv(const GLdouble * u)
-{
-    generic_8_byte(X_GLrop_EvalCoord1dv, u);
-}
-
-#define X_GLrop_EvalCoord1fv 152
-void
-__indirect_glEvalCoord1f(GLfloat u)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_EvalCoord1fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalCoord1fv 152
-void
-__indirect_glEvalCoord1fv(const GLfloat * u)
-{
-    generic_4_byte(X_GLrop_EvalCoord1fv, u);
-}
-
-#define X_GLrop_EvalCoord2dv 153
-void
-__indirect_glEvalCoord2d(GLdouble u, GLdouble v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_EvalCoord2dv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalCoord2dv 153
-void
-__indirect_glEvalCoord2dv(const GLdouble * u)
-{
-    generic_16_byte(X_GLrop_EvalCoord2dv, u);
-}
-
-#define X_GLrop_EvalCoord2fv 154
-void
-__indirect_glEvalCoord2f(GLfloat u, GLfloat v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_EvalCoord2fv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&u), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalCoord2fv 154
-void
-__indirect_glEvalCoord2fv(const GLfloat * u)
-{
-    generic_8_byte(X_GLrop_EvalCoord2fv, u);
-}
-
-#define X_GLrop_EvalMesh1 155
-void
-__indirect_glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_EvalMesh1, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&i1), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&i2), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalPoint1 156
-void
-__indirect_glEvalPoint1(GLint i)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_EvalPoint1, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&i), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalMesh2 157
-void
-__indirect_glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_EvalMesh2, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&i1), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&i2), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&j1), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&j2), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_EvalPoint2 158
-void
-__indirect_glEvalPoint2(GLint i, GLint j)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_EvalPoint2, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&i), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&j), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_AlphaFunc 159
-void
-__indirect_glAlphaFunc(GLenum func, GLclampf ref)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_AlphaFunc, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&func), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&ref), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_BlendFunc 160
-void
-__indirect_glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_BlendFunc, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&sfactor), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&dfactor), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LogicOp 161
-void
-__indirect_glLogicOp(GLenum opcode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_LogicOp, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&opcode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_StencilFunc 162
-void
-__indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_StencilFunc, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&func), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&ref), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&mask), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_StencilOp 163
-void
-__indirect_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_StencilOp, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&fail), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&zfail), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&zpass), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_DepthFunc 164
-void
-__indirect_glDepthFunc(GLenum func)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_DepthFunc, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&func), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PixelZoom 165
-void
-__indirect_glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_PixelZoom, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&xfactor), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&yfactor), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PixelTransferf 166
-void
-__indirect_glPixelTransferf(GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_PixelTransferf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PixelTransferi 167
-void
-__indirect_glPixelTransferi(GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_PixelTransferi, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PixelMapfv 168
-void
-__indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
-    if (mapsize < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_PixelMapfv, cmdlen);
-            (void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
-            (void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
-            (void) memcpy((void *) (gc->pc + 12), (void *) (values),
-                          (mapsize * 4));
-            gc->pc += cmdlen;
-            if (__builtin_expect(gc->pc > gc->limit, 0)) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_PixelMapfv;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&map), 4);
-            (void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
-            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
-        }
-    }
-}
-
-#define X_GLrop_PixelMapuiv 169
-void
-__indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
-    if (mapsize < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_PixelMapuiv, cmdlen);
-            (void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
-            (void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
-            (void) memcpy((void *) (gc->pc + 12), (void *) (values),
-                          (mapsize * 4));
-            gc->pc += cmdlen;
-            if (__builtin_expect(gc->pc > gc->limit, 0)) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_PixelMapuiv;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&map), 4);
-            (void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
-            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
-        }
-    }
-}
-
-#define X_GLrop_PixelMapusv 170
-void
-__indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 2));
-    if (mapsize < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_PixelMapusv, cmdlen);
-            (void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
-            (void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
-            (void) memcpy((void *) (gc->pc + 12), (void *) (values),
-                          (mapsize * 2));
-            gc->pc += cmdlen;
-            if (__builtin_expect(gc->pc > gc->limit, 0)) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_PixelMapusv;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&map), 4);
-            (void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
-            __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 2));
-        }
-    }
-}
-
-#define X_GLrop_ReadBuffer 171
-void
-__indirect_glReadBuffer(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ReadBuffer, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyPixels 172
-void
-__indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height,
-                        GLenum type)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_CopyPixels, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&type), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLsop_ReadPixels 111
-void
-__indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
-                        GLenum format, GLenum type, GLvoid * pixels)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 28;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_read_pixels_reply_t *reply =
-            xcb_glx_read_pixels_reply(c,
-                                      xcb_glx_read_pixels(c,
-                                                          gc->
-                                                          currentContextTag,
-                                                          x, y, width, height,
-                                                          format, type,
-                                                          state->storePack.
-                                                          swapEndian, 0),
-                                      NULL);
-        (void) memcpy(pixels, xcb_glx_read_pixels_data(reply),
-                      xcb_glx_read_pixels_data_length(reply) *
-                      sizeof(GLvoid));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_ReadPixels, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&x), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&y), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&width), 4);
-        (void) memcpy((void *) (pc + 12), (void *) (&height), 4);
-        (void) memcpy((void *) (pc + 16), (void *) (&format), 4);
-        (void) memcpy((void *) (pc + 20), (void *) (&type), 4);
-        *(int32_t *) (pc + 24) = 0;
-        *(int8_t *) (pc + 24) = state->storePack.swapEndian;
-        __glXReadPixelReply(dpy, gc, 2, width, height, 1, format, type,
-                            pixels, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLrop_DrawPixels 173
-void
-__indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format,
-                        GLenum type, const GLvoid * pixels)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (pixels != NULL) ? __glImageSize(width, height, 1, format, type,
-                                         0) : 0;
-    const GLuint cmdlen = 40 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_DrawPixels, cmdlen);
-            (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 28), (void *) (&height), 4);
-            (void) memcpy((void *) (gc->pc + 32), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 36), (void *) (&type), 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, 2, width, height, 1, format, type,
-                                  pixels, gc->pc + 40, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
-                              default_pixel_store_2D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_DrawPixels;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 28), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 32), (void *) (&height), 4);
-            (void) memcpy((void *) (pc + 36), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 40), (void *) (&type), 4);
-            __glXSendLargeImage(gc, compsize, 2, width, height, 1, format,
-                                type, pixels, pc + 44, pc + 8);
-        }
-    }
-}
-
-#define X_GLsop_GetClipPlane 113
-void
-__indirect_glGetClipPlane(GLenum plane, GLdouble * equation)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_clip_plane_reply_t *reply =
-            xcb_glx_get_clip_plane_reply(c,
-                                         xcb_glx_get_clip_plane(c,
-                                                                gc->
-                                                                currentContextTag,
-                                                                plane), NULL);
-        (void) memcpy(equation, xcb_glx_get_clip_plane_data(reply),
-                      xcb_glx_get_clip_plane_data_length(reply) *
-                      sizeof(GLdouble));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetClipPlane, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&plane), 4);
-        (void) __glXReadReply(dpy, 8, equation, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetLightfv 118
-void
-__indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_lightfv_reply_t *reply =
-            xcb_glx_get_lightfv_reply(c,
-                                      xcb_glx_get_lightfv(c,
-                                                          gc->
-                                                          currentContextTag,
-                                                          light, pname),
-                                      NULL);
-        if (xcb_glx_get_lightfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_lightfv_data(reply),
-                          xcb_glx_get_lightfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetLightfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&light), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetLightiv 119
-void
-__indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_lightiv_reply_t *reply =
-            xcb_glx_get_lightiv_reply(c,
-                                      xcb_glx_get_lightiv(c,
-                                                          gc->
-                                                          currentContextTag,
-                                                          light, pname),
-                                      NULL);
-        if (xcb_glx_get_lightiv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_lightiv_data(reply),
-                          xcb_glx_get_lightiv_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetLightiv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&light), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetMapdv 120
-void
-__indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_mapdv_reply_t *reply =
-            xcb_glx_get_mapdv_reply(c,
-                                    xcb_glx_get_mapdv(c,
-                                                      gc->currentContextTag,
-                                                      target, query), NULL);
-        if (xcb_glx_get_mapdv_data_length(reply) == 0)
-            (void) memcpy(v, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(v, xcb_glx_get_mapdv_data(reply),
-                          xcb_glx_get_mapdv_data_length(reply) *
-                          sizeof(GLdouble));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMapdv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&query), 4);
-        (void) __glXReadReply(dpy, 8, v, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetMapfv 121
-void
-__indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_mapfv_reply_t *reply =
-            xcb_glx_get_mapfv_reply(c,
-                                    xcb_glx_get_mapfv(c,
-                                                      gc->currentContextTag,
-                                                      target, query), NULL);
-        if (xcb_glx_get_mapfv_data_length(reply) == 0)
-            (void) memcpy(v, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(v, xcb_glx_get_mapfv_data(reply),
-                          xcb_glx_get_mapfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMapfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&query), 4);
-        (void) __glXReadReply(dpy, 4, v, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetMapiv 122
-void
-__indirect_glGetMapiv(GLenum target, GLenum query, GLint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_mapiv_reply_t *reply =
-            xcb_glx_get_mapiv_reply(c,
-                                    xcb_glx_get_mapiv(c,
-                                                      gc->currentContextTag,
-                                                      target, query), NULL);
-        if (xcb_glx_get_mapiv_data_length(reply) == 0)
-            (void) memcpy(v, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(v, xcb_glx_get_mapiv_data(reply),
-                          xcb_glx_get_mapiv_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMapiv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&query), 4);
-        (void) __glXReadReply(dpy, 4, v, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetMaterialfv 123
-void
-__indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_materialfv_reply_t *reply =
-            xcb_glx_get_materialfv_reply(c,
-                                         xcb_glx_get_materialfv(c,
-                                                                gc->
-                                                                currentContextTag,
-                                                                face, pname),
-                                         NULL);
-        if (xcb_glx_get_materialfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_materialfv_data(reply),
-                          xcb_glx_get_materialfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMaterialfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&face), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetMaterialiv 124
-void
-__indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_materialiv_reply_t *reply =
-            xcb_glx_get_materialiv_reply(c,
-                                         xcb_glx_get_materialiv(c,
-                                                                gc->
-                                                                currentContextTag,
-                                                                face, pname),
-                                         NULL);
-        if (xcb_glx_get_materialiv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_materialiv_data(reply),
-                          xcb_glx_get_materialiv_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMaterialiv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&face), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetPixelMapfv 125
-void
-__indirect_glGetPixelMapfv(GLenum map, GLfloat * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_pixel_mapfv_reply_t *reply =
-            xcb_glx_get_pixel_mapfv_reply(c,
-                                          xcb_glx_get_pixel_mapfv(c,
-                                                                  gc->
-                                                                  currentContextTag,
-                                                                  map), NULL);
-        if (xcb_glx_get_pixel_mapfv_data_length(reply) == 0)
-            (void) memcpy(values, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(values, xcb_glx_get_pixel_mapfv_data(reply),
-                          xcb_glx_get_pixel_mapfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetPixelMapfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&map), 4);
-        (void) __glXReadReply(dpy, 4, values, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetPixelMapuiv 126
-void
-__indirect_glGetPixelMapuiv(GLenum map, GLuint * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_pixel_mapuiv_reply_t *reply =
-            xcb_glx_get_pixel_mapuiv_reply(c,
-                                           xcb_glx_get_pixel_mapuiv(c,
-                                                                    gc->
-                                                                    currentContextTag,
-                                                                    map),
-                                           NULL);
-        if (xcb_glx_get_pixel_mapuiv_data_length(reply) == 0)
-            (void) memcpy(values, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(values, xcb_glx_get_pixel_mapuiv_data(reply),
-                          xcb_glx_get_pixel_mapuiv_data_length(reply) *
-                          sizeof(GLuint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetPixelMapuiv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&map), 4);
-        (void) __glXReadReply(dpy, 4, values, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetPixelMapusv 127
-void
-__indirect_glGetPixelMapusv(GLenum map, GLushort * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_pixel_mapusv_reply_t *reply =
-            xcb_glx_get_pixel_mapusv_reply(c,
-                                           xcb_glx_get_pixel_mapusv(c,
-                                                                    gc->
-                                                                    currentContextTag,
-                                                                    map),
-                                           NULL);
-        if (xcb_glx_get_pixel_mapusv_data_length(reply) == 0)
-            (void) memcpy(values, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(values, xcb_glx_get_pixel_mapusv_data(reply),
-                          xcb_glx_get_pixel_mapusv_data_length(reply) *
-                          sizeof(GLushort));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetPixelMapusv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&map), 4);
-        (void) __glXReadReply(dpy, 2, values, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetPolygonStipple 128
-void
-__indirect_glGetPolygonStipple(GLubyte *mask)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_polygon_stipple_reply_t *reply =
-            xcb_glx_get_polygon_stipple_reply(c,
-                                              xcb_glx_get_polygon_stipple(c,
-                                                                          gc->
-                                                                          currentContextTag,
-                                                                          0),
-                                              NULL);
-        (void) memcpy(mask, xcb_glx_get_polygon_stipple_data(reply),
-                      xcb_glx_get_polygon_stipple_data_length(reply) *
-                      sizeof(GLubyte));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetPolygonStipple, cmdlen);
-        *(int32_t *) (pc + 0) = 0;
-        __glXReadPixelReply(dpy, gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
-                            mask, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexEnvfv 130
-void
-__indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_envfv_reply_t *reply =
-            xcb_glx_get_tex_envfv_reply(c,
-                                        xcb_glx_get_tex_envfv(c,
-                                                              gc->
-                                                              currentContextTag,
-                                                              target, pname),
-                                        NULL);
-        if (xcb_glx_get_tex_envfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_tex_envfv_data(reply),
-                          xcb_glx_get_tex_envfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexEnvfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexEnviv 131
-void
-__indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_enviv_reply_t *reply =
-            xcb_glx_get_tex_enviv_reply(c,
-                                        xcb_glx_get_tex_enviv(c,
-                                                              gc->
-                                                              currentContextTag,
-                                                              target, pname),
-                                        NULL);
-        if (xcb_glx_get_tex_enviv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_tex_enviv_data(reply),
-                          xcb_glx_get_tex_enviv_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexEnviv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexGendv 132
-void
-__indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_gendv_reply_t *reply =
-            xcb_glx_get_tex_gendv_reply(c,
-                                        xcb_glx_get_tex_gendv(c,
-                                                              gc->
-                                                              currentContextTag,
-                                                              coord, pname),
-                                        NULL);
-        if (xcb_glx_get_tex_gendv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_tex_gendv_data(reply),
-                          xcb_glx_get_tex_gendv_data_length(reply) *
-                          sizeof(GLdouble));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexGendv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&coord), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 8, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexGenfv 133
-void
-__indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_genfv_reply_t *reply =
-            xcb_glx_get_tex_genfv_reply(c,
-                                        xcb_glx_get_tex_genfv(c,
-                                                              gc->
-                                                              currentContextTag,
-                                                              coord, pname),
-                                        NULL);
-        if (xcb_glx_get_tex_genfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_tex_genfv_data(reply),
-                          xcb_glx_get_tex_genfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexGenfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&coord), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexGeniv 134
-void
-__indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_geniv_reply_t *reply =
-            xcb_glx_get_tex_geniv_reply(c,
-                                        xcb_glx_get_tex_geniv(c,
-                                                              gc->
-                                                              currentContextTag,
-                                                              coord, pname),
-                                        NULL);
-        if (xcb_glx_get_tex_geniv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_tex_geniv_data(reply),
-                          xcb_glx_get_tex_geniv_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexGeniv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&coord), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexImage 135
-void
-__indirect_glGetTexImage(GLenum target, GLint level, GLenum format,
-                         GLenum type, GLvoid * pixels)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 20;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_image_reply_t *reply =
-            xcb_glx_get_tex_image_reply(c,
-                                        xcb_glx_get_tex_image(c,
-                                                              gc->
-                                                              currentContextTag,
-                                                              target, level,
-                                                              format, type,
-                                                              state->
-                                                              storePack.
-                                                              swapEndian),
-                                        NULL);
-        (void) memcpy(pixels, xcb_glx_get_tex_image_data(reply),
-                      xcb_glx_get_tex_image_data_length(reply) *
-                      sizeof(GLvoid));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexImage, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&level), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&format), 4);
-        (void) memcpy((void *) (pc + 12), (void *) (&type), 4);
-        *(int32_t *) (pc + 16) = 0;
-        *(int8_t *) (pc + 16) = state->storePack.swapEndian;
-        __glXReadPixelReply(dpy, gc, 3, 0, 0, 0, format, type, pixels,
-                            GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexParameterfv 136
-void
-__indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_parameterfv_reply_t *reply =
-            xcb_glx_get_tex_parameterfv_reply(c,
-                                              xcb_glx_get_tex_parameterfv(c,
-                                                                          gc->
-                                                                          currentContextTag,
-                                                                          target,
-                                                                          pname),
-                                              NULL);
-        if (xcb_glx_get_tex_parameterfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_tex_parameterfv_data(reply),
-                          xcb_glx_get_tex_parameterfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexParameterfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexParameteriv 137
-void
-__indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_parameteriv_reply_t *reply =
-            xcb_glx_get_tex_parameteriv_reply(c,
-                                              xcb_glx_get_tex_parameteriv(c,
-                                                                          gc->
-                                                                          currentContextTag,
-                                                                          target,
-                                                                          pname),
-                                              NULL);
-        if (xcb_glx_get_tex_parameteriv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_tex_parameteriv_data(reply),
-                          xcb_glx_get_tex_parameteriv_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexParameteriv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexLevelParameterfv 138
-void
-__indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname,
-                                    GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 12;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_level_parameterfv_reply_t *reply =
-            xcb_glx_get_tex_level_parameterfv_reply(c,
-                                                    xcb_glx_get_tex_level_parameterfv
-                                                    (c, gc->currentContextTag,
-                                                     target, level, pname),
-                                                    NULL);
-        if (xcb_glx_get_tex_level_parameterfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_tex_level_parameterfv_data(reply),
-                          xcb_glx_get_tex_level_parameterfv_data_length(reply)
-                          * sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexLevelParameterfv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&level), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetTexLevelParameteriv 139
-void
-__indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname,
-                                    GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 12;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_tex_level_parameteriv_reply_t *reply =
-            xcb_glx_get_tex_level_parameteriv_reply(c,
-                                                    xcb_glx_get_tex_level_parameteriv
-                                                    (c, gc->currentContextTag,
-                                                     target, level, pname),
-                                                    NULL);
-        if (xcb_glx_get_tex_level_parameteriv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_tex_level_parameteriv_data(reply),
-                          xcb_glx_get_tex_level_parameteriv_data_length(reply)
-                          * sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetTexLevelParameteriv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&level), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_IsList 141
-GLboolean
-__indirect_glIsList(GLuint list)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_is_list_reply_t *reply =
-            xcb_glx_is_list_reply(c,
-                                  xcb_glx_is_list(c, gc->currentContextTag,
-                                                  list), NULL);
-        retval = reply->ret_val;
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_IsList, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&list), 4);
-        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return retval;
-}
-
-#define X_GLrop_DepthRange 174
-void
-__indirect_glDepthRange(GLclampd zNear, GLclampd zFar)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_DepthRange, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&zNear), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&zFar), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Frustum 175
-void
-__indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom,
-                     GLdouble top, GLdouble zNear, GLdouble zFar)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 52;
-    emit_header(gc->pc, X_GLrop_Frustum, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&left), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&right), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&bottom), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&top), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&zNear), 8);
-    (void) memcpy((void *) (gc->pc + 44), (void *) (&zFar), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LoadIdentity 176
-void
-__indirect_glLoadIdentity(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 4;
-    emit_header(gc->pc, X_GLrop_LoadIdentity, cmdlen);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LoadMatrixf 177
-void
-__indirect_glLoadMatrixf(const GLfloat * m)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 68;
-    emit_header(gc->pc, X_GLrop_LoadMatrixf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 64);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_LoadMatrixd 178
-void
-__indirect_glLoadMatrixd(const GLdouble * m)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 132;
-    emit_header(gc->pc, X_GLrop_LoadMatrixd, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 128);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MatrixMode 179
-void
-__indirect_glMatrixMode(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_MatrixMode, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultMatrixf 180
-void
-__indirect_glMultMatrixf(const GLfloat * m)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 68;
-    emit_header(gc->pc, X_GLrop_MultMatrixf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 64);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultMatrixd 181
-void
-__indirect_glMultMatrixd(const GLdouble * m)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 132;
-    emit_header(gc->pc, X_GLrop_MultMatrixd, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (m), 128);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Ortho 182
-void
-__indirect_glOrtho(GLdouble left, GLdouble right, GLdouble bottom,
-                   GLdouble top, GLdouble zNear, GLdouble zFar)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 52;
-    emit_header(gc->pc, X_GLrop_Ortho, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&left), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&right), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&bottom), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&top), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&zNear), 8);
-    (void) memcpy((void *) (gc->pc + 44), (void *) (&zFar), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PopMatrix 183
-void
-__indirect_glPopMatrix(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 4;
-    emit_header(gc->pc, X_GLrop_PopMatrix, cmdlen);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PushMatrix 184
-void
-__indirect_glPushMatrix(void)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 4;
-    emit_header(gc->pc, X_GLrop_PushMatrix, cmdlen);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rotated 185
-void
-__indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_Rotated, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&angle), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Rotatef 186
-void
-__indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Rotatef, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&angle), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Scaled 187
-void
-__indirect_glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_Scaled, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Scalef 188
-void
-__indirect_glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Scalef, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Translated 189
-void
-__indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_Translated, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Translatef 190
-void
-__indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Translatef, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Viewport 191
-void
-__indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Viewport, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_BindTexture 4117
-void
-__indirect_glBindTexture(GLenum target, GLuint texture)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_BindTexture, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&texture), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Indexubv 194
-void
-__indirect_glIndexub(GLubyte c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Indexubv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&c), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Indexubv 194
-void
-__indirect_glIndexubv(const GLubyte *c)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_Indexubv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (c), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PolygonOffset 192
-void
-__indirect_glPolygonOffset(GLfloat factor, GLfloat units)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_PolygonOffset, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&factor), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&units), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyTexImage1D 4119
-void
-__indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
-                            GLint x, GLint y, GLsizei width, GLint border)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 32;
-    emit_header(gc->pc, X_GLrop_CopyTexImage1D, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&border), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyTexImage2D 4120
-void
-__indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat,
-                            GLint x, GLint y, GLsizei width, GLsizei height,
-                            GLint border)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_CopyTexImage2D, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&height), 4);
-    (void) memcpy((void *) (gc->pc + 32), (void *) (&border), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyTexSubImage1D 4121
-void
-__indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset,
-                               GLint x, GLint y, GLsizei width)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_CopyTexSubImage1D, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&xoffset), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&width), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyTexSubImage2D 4122
-void
-__indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset,
-                               GLint yoffset, GLint x, GLint y, GLsizei width,
-                               GLsizei height)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 36;
-    emit_header(gc->pc, X_GLrop_CopyTexSubImage2D, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&xoffset), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&yoffset), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 32), (void *) (&height), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLsop_DeleteTextures 144
-void
-__indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-#endif
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_delete_textures(c, gc->currentContextTag, n, textures);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_DeleteTextures, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_DeleteTexturesEXT 12
-void
-glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-        if (n < 0) {
-            __glXSetError(gc, GL_INVALID_VALUE);
-            return;
-        }
-        if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivate,
-                                        X_GLvop_DeleteTexturesEXT, cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GenTextures 145
-void
-__indirect_glGenTextures(GLsizei n, GLuint * textures)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_gen_textures_reply_t *reply =
-            xcb_glx_gen_textures_reply(c,
-                                       xcb_glx_gen_textures(c,
-                                                            gc->
-                                                            currentContextTag,
-                                                            n), NULL);
-        (void) memcpy(textures, xcb_glx_gen_textures_data(reply),
-                      xcb_glx_gen_textures_data_length(reply) *
-                      sizeof(GLuint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GenTextures, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) __glXReadReply(dpy, 4, textures, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GenTexturesEXT 13
-void
-glGenTexturesEXT(GLsizei n, GLuint * textures)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GenTextures(GET_DISPATCH(), (n, textures));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 4;
-        if (n < 0) {
-            __glXSetError(gc, GL_INVALID_VALUE);
-            return;
-        }
-        if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GenTexturesEXT, cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-            (void) __glXReadReply(dpy, 4, textures, GL_TRUE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_IsTexture 146
-GLboolean
-__indirect_glIsTexture(GLuint texture)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_is_texture_reply_t *reply =
-            xcb_glx_is_texture_reply(c,
-                                     xcb_glx_is_texture(c,
-                                                        gc->currentContextTag,
-                                                        texture), NULL);
-        retval = reply->ret_val;
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_IsTexture, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&texture), 4);
-        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return retval;
-}
-
-#define X_GLvop_IsTextureEXT 14
-GLboolean
-glIsTextureEXT(GLuint texture)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        return CALL_IsTexture(GET_DISPATCH(), (texture));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        GLboolean retval = (GLboolean) 0;
-        const GLuint cmdlen = 4;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_IsTextureEXT, cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&texture), 4);
-            retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return retval;
-    }
-}
-
-#define X_GLrop_PrioritizeTextures 4118
-void
-__indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures,
-                                const GLclampf * priorities)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8 + __GLX_PAD((n * 4)) + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_PrioritizeTextures, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (textures), (n * 4));
-        (void) memcpy((void *) (gc->pc + 8 + (n * 4)), (void *) (priorities),
-                      (n * 4));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-static void
-__glx_TexSubImage_1D2D(unsigned opcode, unsigned dim, GLenum target,
-                       GLint level, GLint xoffset, GLint yoffset,
-                       GLsizei width, GLsizei height, GLenum format,
-                       GLenum type, const GLvoid * pixels)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (pixels != NULL) ? __glImageSize(width, height, 1, format, type,
-                                         target) : 0;
-    const GLuint cmdlen = 60 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, opcode, cmdlen);
-            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 28), (void *) (&level), 4);
-            (void) memcpy((void *) (gc->pc + 32), (void *) (&xoffset), 4);
-            (void) memcpy((void *) (gc->pc + 36), (void *) (&yoffset), 4);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 44), (void *) (&height), 4);
-            (void) memcpy((void *) (gc->pc + 48), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 52), (void *) (&type), 4);
-            (void) memset((void *) (gc->pc + 56), 0, 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, dim, width, height, 1, format, type,
-                                  pixels, gc->pc + 60, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
-                              default_pixel_store_2D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = opcode;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 32), (void *) (&level), 4);
-            (void) memcpy((void *) (pc + 36), (void *) (&xoffset), 4);
-            (void) memcpy((void *) (pc + 40), (void *) (&yoffset), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 48), (void *) (&height), 4);
-            (void) memcpy((void *) (pc + 52), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 56), (void *) (&type), 4);
-            (void) memset((void *) (pc + 60), 0, 4);
-            __glXSendLargeImage(gc, compsize, dim, width, height, 1, format,
-                                type, pixels, pc + 64, pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_TexSubImage1D 4099
-void
-__indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset,
-                           GLsizei width, GLenum format, GLenum type,
-                           const GLvoid * pixels)
-{
-    __glx_TexSubImage_1D2D(X_GLrop_TexSubImage1D, 1, target, level, xoffset,
-                           1, width, 1, format, type, pixels);
-}
-
-#define X_GLrop_TexSubImage2D 4100
-void
-__indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset,
-                           GLint yoffset, GLsizei width, GLsizei height,
-                           GLenum format, GLenum type, const GLvoid * pixels)
-{
-    __glx_TexSubImage_1D2D(X_GLrop_TexSubImage2D, 2, target, level, xoffset,
-                           yoffset, width, height, format, type, pixels);
-}
-
-#define X_GLrop_BlendColor 4096
-void
-__indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue,
-                        GLclampf alpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_BlendColor, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&alpha), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_BlendEquation 4097
-void
-__indirect_glBlendEquation(GLenum mode)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_BlendEquation, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&mode), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ColorTable 2053
-void
-__indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width,
-                        GLenum format, GLenum type, const GLvoid * table)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (table != NULL) ? __glImageSize(width, 1, 1, format, type,
-                                        target) : 0;
-    const GLuint cmdlen = 44 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_ColorTable, cmdlen);
-            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 28), (void *) (&internalformat),
-                          4);
-            (void) memcpy((void *) (gc->pc + 32), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 36), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&type), 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, 1, width, 1, 1, format, type, table,
-                                  gc->pc + 44, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_1D,
-                              default_pixel_store_1D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_ColorTable;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 32), (void *) (&internalformat), 4);
-            (void) memcpy((void *) (pc + 36), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 40), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&type), 4);
-            __glXSendLargeImage(gc, compsize, 1, width, 1, 1, format, type,
-                                table, pc + 48, pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_ColorTableParameterfv 2054
-void
-__indirect_glColorTableParameterfv(GLenum target, GLenum pname,
-                                   const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glColorTableParameterfv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_ColorTableParameterfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ColorTableParameteriv 2055
-void
-__indirect_glColorTableParameteriv(GLenum target, GLenum pname,
-                                   const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glColorTableParameteriv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_ColorTableParameteriv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyColorTable 2056
-void
-__indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x,
-                            GLint y, GLsizei width)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_CopyColorTable, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLsop_GetColorTable 147
-void
-__indirect_glGetColorTable(GLenum target, GLenum format, GLenum type,
-                           GLvoid * table)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 16;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_color_table_reply_t *reply =
-            xcb_glx_get_color_table_reply(c,
-                                          xcb_glx_get_color_table(c,
-                                                                  gc->
-                                                                  currentContextTag,
-                                                                  target,
-                                                                  format,
-                                                                  type,
-                                                                  state->
-                                                                  storePack.
-                                                                  swapEndian),
-                                          NULL);
-        (void) memcpy(table, xcb_glx_get_color_table_data(reply),
-                      xcb_glx_get_color_table_data_length(reply) *
-                      sizeof(GLvoid));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetColorTable, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-        *(int32_t *) (pc + 12) = 0;
-        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-        __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, table,
-                            GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetColorTableSGI 4098
-void
-glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        const __GLXattribute *const state = gc->client_state_private;
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 16;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetColorTableSGI, cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-            *(int32_t *) (pc + 12) = 0;
-            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-            __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, table,
-                                GL_TRUE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetColorTableParameterfv 148
-void
-__indirect_glGetColorTableParameterfv(GLenum target, GLenum pname,
-                                      GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_color_table_parameterfv_reply_t *reply =
-            xcb_glx_get_color_table_parameterfv_reply(c,
-                                                      xcb_glx_get_color_table_parameterfv
-                                                      (c,
-                                                       gc->currentContextTag,
-                                                       target, pname), NULL);
-        if (xcb_glx_get_color_table_parameterfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_color_table_parameterfv_data(reply),
-                          xcb_glx_get_color_table_parameterfv_data_length
-                          (reply) * sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetColorTableParameterfv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetColorTableParameterfvSGI 4099
-void
-glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetColorTableParameterfv(GET_DISPATCH(),
-                                      (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetColorTableParameterfvSGI,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetColorTableParameteriv 149
-void
-__indirect_glGetColorTableParameteriv(GLenum target, GLenum pname,
-                                      GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_color_table_parameteriv_reply_t *reply =
-            xcb_glx_get_color_table_parameteriv_reply(c,
-                                                      xcb_glx_get_color_table_parameteriv
-                                                      (c,
-                                                       gc->currentContextTag,
-                                                       target, pname), NULL);
-        if (xcb_glx_get_color_table_parameteriv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_color_table_parameteriv_data(reply),
-                          xcb_glx_get_color_table_parameteriv_data_length
-                          (reply) * sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetColorTableParameteriv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetColorTableParameterivSGI 4100
-void
-glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetColorTableParameteriv(GET_DISPATCH(),
-                                      (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetColorTableParameterivSGI,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLrop_ColorSubTable 195
-void
-__indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count,
-                           GLenum format, GLenum type, const GLvoid * data)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (data != NULL) ? __glImageSize(count, 1, 1, format, type, target) : 0;
-    const GLuint cmdlen = 44 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_ColorSubTable, cmdlen);
-            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 28), (void *) (&start), 4);
-            (void) memcpy((void *) (gc->pc + 32), (void *) (&count), 4);
-            (void) memcpy((void *) (gc->pc + 36), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&type), 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, 1, count, 1, 1, format, type, data,
-                                  gc->pc + 44, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_1D,
-                              default_pixel_store_1D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_ColorSubTable;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 32), (void *) (&start), 4);
-            (void) memcpy((void *) (pc + 36), (void *) (&count), 4);
-            (void) memcpy((void *) (pc + 40), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&type), 4);
-            __glXSendLargeImage(gc, compsize, 1, count, 1, 1, format, type,
-                                data, pc + 48, pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_CopyColorSubTable 196
-void
-__indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y,
-                               GLsizei width)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_CopyColorSubTable, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&start), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static void
-__glx_ConvolutionFilter_1D2D(unsigned opcode, unsigned dim, GLenum target,
-                             GLenum internalformat, GLsizei width,
-                             GLsizei height, GLenum format, GLenum type,
-                             const GLvoid * image)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (image != NULL) ? __glImageSize(width, height, 1, format, type,
-                                        target) : 0;
-    const GLuint cmdlen = 48 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, opcode, cmdlen);
-            (void) memcpy((void *) (gc->pc + 24), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 28), (void *) (&internalformat),
-                          4);
-            (void) memcpy((void *) (gc->pc + 32), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 36), (void *) (&height), 4);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 44), (void *) (&type), 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, dim, width, height, 1, format, type,
-                                  image, gc->pc + 48, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_2D,
-                              default_pixel_store_2D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = opcode;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 28), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 32), (void *) (&internalformat), 4);
-            (void) memcpy((void *) (pc + 36), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 40), (void *) (&height), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 48), (void *) (&type), 4);
-            __glXSendLargeImage(gc, compsize, dim, width, height, 1, format,
-                                type, image, pc + 52, pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_ConvolutionFilter1D 4101
-void
-__indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat,
-                                 GLsizei width, GLenum format, GLenum type,
-                                 const GLvoid * image)
-{
-    __glx_ConvolutionFilter_1D2D(X_GLrop_ConvolutionFilter1D, 1, target,
-                                 internalformat, width, 1, format, type,
-                                 image);
-}
-
-#define X_GLrop_ConvolutionFilter2D 4102
-void
-__indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat,
-                                 GLsizei width, GLsizei height, GLenum format,
-                                 GLenum type, const GLvoid * image)
-{
-    __glx_ConvolutionFilter_1D2D(X_GLrop_ConvolutionFilter2D, 2, target,
-                                 internalformat, width, height, format, type,
-                                 image);
-}
-
-#define X_GLrop_ConvolutionParameterf 4103
-void
-__indirect_glConvolutionParameterf(GLenum target, GLenum pname,
-                                   GLfloat params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_ConvolutionParameterf, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&params), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ConvolutionParameterfv 4104
-void
-__indirect_glConvolutionParameterfv(GLenum target, GLenum pname,
-                                    const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glConvolutionParameterfv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_ConvolutionParameterfv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ConvolutionParameteri 4105
-void
-__indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_ConvolutionParameteri, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&params), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ConvolutionParameteriv 4106
-void
-__indirect_glConvolutionParameteriv(GLenum target, GLenum pname,
-                                    const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glConvolutionParameteriv_size(pname);
-    const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_ConvolutionParameteriv, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyConvolutionFilter1D 4107
-void
-__indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat,
-                                     GLint x, GLint y, GLsizei width)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_CopyConvolutionFilter1D, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_CopyConvolutionFilter2D 4108
-void
-__indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat,
-                                     GLint x, GLint y, GLsizei width,
-                                     GLsizei height)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_CopyConvolutionFilter2D, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&height), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLsop_GetConvolutionFilter 150
-void
-__indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
-                                  GLvoid * image)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 16;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_convolution_filter_reply_t *reply =
-            xcb_glx_get_convolution_filter_reply(c,
-                                                 xcb_glx_get_convolution_filter
-                                                 (c, gc->currentContextTag,
-                                                  target, format, type,
-                                                  state->storePack.
-                                                  swapEndian), NULL);
-        (void) memcpy(image, xcb_glx_get_convolution_filter_data(reply),
-                      xcb_glx_get_convolution_filter_data_length(reply) *
-                      sizeof(GLvoid));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetConvolutionFilter, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-        *(int32_t *) (pc + 12) = 0;
-        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-        __glXReadPixelReply(dpy, gc, 2, 0, 0, 0, format, type, image,
-                            GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetConvolutionFilterEXT 1
-void
-gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
-                     GLvoid * image)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetConvolutionFilter(GET_DISPATCH(),
-                                  (target, format, type, image));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        const __GLXattribute *const state = gc->client_state_private;
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 16;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetConvolutionFilterEXT,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-            *(int32_t *) (pc + 12) = 0;
-            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-            __glXReadPixelReply(dpy, gc, 2, 0, 0, 0, format, type, image,
-                                GL_TRUE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetConvolutionParameterfv 151
-void
-__indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname,
-                                       GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_convolution_parameterfv_reply_t *reply =
-            xcb_glx_get_convolution_parameterfv_reply(c,
-                                                      xcb_glx_get_convolution_parameterfv
-                                                      (c,
-                                                       gc->currentContextTag,
-                                                       target, pname), NULL);
-        if (xcb_glx_get_convolution_parameterfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_convolution_parameterfv_data(reply),
-                          xcb_glx_get_convolution_parameterfv_data_length
-                          (reply) * sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetConvolutionParameterfv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetConvolutionParameterfvEXT 2
-void
-gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetConvolutionParameterfv(GET_DISPATCH(),
-                                       (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetConvolutionParameterfvEXT,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetConvolutionParameteriv 152
-void
-__indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname,
-                                       GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_convolution_parameteriv_reply_t *reply =
-            xcb_glx_get_convolution_parameteriv_reply(c,
-                                                      xcb_glx_get_convolution_parameteriv
-                                                      (c,
-                                                       gc->currentContextTag,
-                                                       target, pname), NULL);
-        if (xcb_glx_get_convolution_parameteriv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_convolution_parameteriv_data(reply),
-                          xcb_glx_get_convolution_parameteriv_data_length
-                          (reply) * sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetConvolutionParameteriv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetConvolutionParameterivEXT 3
-void
-gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                       (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetConvolutionParameterivEXT,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetHistogram 154
-void
-__indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
-                          GLenum type, GLvoid * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 16;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_histogram_reply_t *reply =
-            xcb_glx_get_histogram_reply(c,
-                                        xcb_glx_get_histogram(c,
-                                                              gc->
-                                                              currentContextTag,
-                                                              target, reset,
-                                                              format, type,
-                                                              state->
-                                                              storePack.
-                                                              swapEndian),
-                                        NULL);
-        (void) memcpy(values, xcb_glx_get_histogram_data(reply),
-                      xcb_glx_get_histogram_data_length(reply) *
-                      sizeof(GLvoid));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetHistogram, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-        *(int32_t *) (pc + 12) = 0;
-        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-        *(int8_t *) (pc + 13) = reset;
-        __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, values,
-                            GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetHistogramEXT 5
-void
-gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
-                     GLenum type, GLvoid * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetHistogram(GET_DISPATCH(),
-                          (target, reset, format, type, values));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        const __GLXattribute *const state = gc->client_state_private;
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 16;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetHistogramEXT, cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-            *(int32_t *) (pc + 12) = 0;
-            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-            *(int8_t *) (pc + 13) = reset;
-            __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, values,
-                                GL_TRUE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetHistogramParameterfv 155
-void
-__indirect_glGetHistogramParameterfv(GLenum target, GLenum pname,
-                                     GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_histogram_parameterfv_reply_t *reply =
-            xcb_glx_get_histogram_parameterfv_reply(c,
-                                                    xcb_glx_get_histogram_parameterfv
-                                                    (c, gc->currentContextTag,
-                                                     target, pname), NULL);
-        if (xcb_glx_get_histogram_parameterfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_histogram_parameterfv_data(reply),
-                          xcb_glx_get_histogram_parameterfv_data_length(reply)
-                          * sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetHistogramParameterfv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetHistogramParameterfvEXT 6
-void
-gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetHistogramParameterfvEXT,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetHistogramParameteriv 156
-void
-__indirect_glGetHistogramParameteriv(GLenum target, GLenum pname,
-                                     GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_histogram_parameteriv_reply_t *reply =
-            xcb_glx_get_histogram_parameteriv_reply(c,
-                                                    xcb_glx_get_histogram_parameteriv
-                                                    (c, gc->currentContextTag,
-                                                     target, pname), NULL);
-        if (xcb_glx_get_histogram_parameteriv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params,
-                          xcb_glx_get_histogram_parameteriv_data(reply),
-                          xcb_glx_get_histogram_parameteriv_data_length(reply)
-                          * sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetHistogramParameteriv,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetHistogramParameterivEXT 7
-void
-gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetHistogramParameterivEXT,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetMinmax 157
-void
-__indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format,
-                       GLenum type, GLvoid * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 16;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_minmax_reply_t *reply =
-            xcb_glx_get_minmax_reply(c,
-                                     xcb_glx_get_minmax(c,
-                                                        gc->currentContextTag,
-                                                        target, reset, format,
-                                                        type,
-                                                        state->storePack.
-                                                        swapEndian), NULL);
-        (void) memcpy(values, xcb_glx_get_minmax_data(reply),
-                      xcb_glx_get_minmax_data_length(reply) * sizeof(GLvoid));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMinmax, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-        *(int32_t *) (pc + 12) = 0;
-        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-        *(int8_t *) (pc + 13) = reset;
-        __glXReadPixelReply(dpy, gc, 1, 2, 1, 1, format, type, values,
-                            GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetMinmaxEXT 8
-void
-gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
-                     GLenum type, GLvoid * values)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        const __GLXattribute *const state = gc->client_state_private;
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 16;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetMinmaxEXT, cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-            *(int32_t *) (pc + 12) = 0;
-            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-            *(int8_t *) (pc + 13) = reset;
-            __glXReadPixelReply(dpy, gc, 1, 2, 1, 1, format, type, values,
-                                GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetMinmaxParameterfv 158
-void
-__indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname,
-                                  GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_minmax_parameterfv_reply_t *reply =
-            xcb_glx_get_minmax_parameterfv_reply(c,
-                                                 xcb_glx_get_minmax_parameterfv
-                                                 (c, gc->currentContextTag,
-                                                  target, pname), NULL);
-        if (xcb_glx_get_minmax_parameterfv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_minmax_parameterfv_data(reply),
-                          xcb_glx_get_minmax_parameterfv_data_length(reply) *
-                          sizeof(GLfloat));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMinmaxParameterfv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetMinmaxParameterfvEXT 9
-void
-gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetMinmaxParameterfvEXT,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLsop_GetMinmaxParameteriv 159
-void
-__indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_minmax_parameteriv_reply_t *reply =
-            xcb_glx_get_minmax_parameteriv_reply(c,
-                                                 xcb_glx_get_minmax_parameteriv
-                                                 (c, gc->currentContextTag,
-                                                  target, pname), NULL);
-        if (xcb_glx_get_minmax_parameteriv_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_minmax_parameteriv_data(reply),
-                          xcb_glx_get_minmax_parameteriv_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetMinmaxParameteriv, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLvop_GetMinmaxParameterivEXT 10
-void
-gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-    if (gc->driContext) {
-        CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
-    } else
-#endif
-    {
-        __GLXcontext *const gc = __glXGetCurrentContext();
-        Display *const dpy = gc->currentDpy;
-        const GLuint cmdlen = 8;
-        if (__builtin_expect(dpy != NULL, 1)) {
-            GLubyte const *pc =
-                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                        X_GLvop_GetMinmaxParameterivEXT,
-                                        cmdlen);
-            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-            UnlockDisplay(dpy);
-            SyncHandle();
-        }
-        return;
-    }
-}
-
-#define X_GLrop_Histogram 4110
-void
-__indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat,
-                       GLboolean sink)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_Histogram, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&sink), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_Minmax 4111
-void
-__indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_Minmax, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&sink), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ResetHistogram 4112
-void
-__indirect_glResetHistogram(GLenum target)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ResetHistogram, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ResetMinmax 4113
-void
-__indirect_glResetMinmax(GLenum target)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ResetMinmax, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-static void
-__glx_TexImage_3D4D(unsigned opcode, unsigned dim, GLenum target, GLint level,
-                    GLint internalformat, GLsizei width, GLsizei height,
-                    GLsizei depth, GLsizei extent, GLint border,
-                    GLenum format, GLenum type, const GLvoid * pixels)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (pixels != NULL) ? __glImageSize(width, height, depth, format, type,
-                                         target) : 0;
-    const GLuint cmdlen = 84 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, opcode, cmdlen);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 44), (void *) (&level), 4);
-            (void) memcpy((void *) (gc->pc + 48), (void *) (&internalformat),
-                          4);
-            (void) memcpy((void *) (gc->pc + 52), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 56), (void *) (&height), 4);
-            (void) memcpy((void *) (gc->pc + 60), (void *) (&depth), 4);
-            (void) memcpy((void *) (gc->pc + 64), (void *) (&extent), 4);
-            (void) memcpy((void *) (gc->pc + 68), (void *) (&border), 4);
-            (void) memcpy((void *) (gc->pc + 72), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 76), (void *) (&type), 4);
-            (void) memcpy((void *) (gc->pc + 80),
-                          (void *) ((pixels == NULL) ? one : zero), 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, dim, width, height, depth, format, type,
-                                  pixels, gc->pc + 84, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_4D,
-                              default_pixel_store_4D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = opcode;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 48), (void *) (&level), 4);
-            (void) memcpy((void *) (pc + 52), (void *) (&internalformat), 4);
-            (void) memcpy((void *) (pc + 56), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 60), (void *) (&height), 4);
-            (void) memcpy((void *) (pc + 64), (void *) (&depth), 4);
-            (void) memcpy((void *) (pc + 68), (void *) (&extent), 4);
-            (void) memcpy((void *) (pc + 72), (void *) (&border), 4);
-            (void) memcpy((void *) (pc + 76), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 80), (void *) (&type), 4);
-            (void) memcpy((void *) (pc + 84), zero, 4);
-            __glXSendLargeImage(gc, compsize, dim, width, height, depth,
-                                format, type, pixels, pc + 88, pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_TexImage3D 4114
-void
-__indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat,
-                        GLsizei width, GLsizei height, GLsizei depth,
-                        GLint border, GLenum format, GLenum type,
-                        const GLvoid * pixels)
-{
-    __glx_TexImage_3D4D(X_GLrop_TexImage3D, 3, target, level, internalformat,
-                        width, height, depth, 1, border, format, type,
-                        pixels);
-}
-
-static void
-__glx_TexSubImage_3D4D(unsigned opcode, unsigned dim, GLenum target,
-                       GLint level, GLint xoffset, GLint yoffset,
-                       GLint zoffset, GLint woffset, GLsizei width,
-                       GLsizei height, GLsizei depth, GLsizei extent,
-                       GLenum format, GLenum type, const GLvoid * pixels)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize =
-        (pixels != NULL) ? __glImageSize(width, height, depth, format, type,
-                                         target) : 0;
-    const GLuint cmdlen = 92 + __GLX_PAD(compsize);
-    if (__builtin_expect(gc->currentDpy != NULL, 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, opcode, cmdlen);
-            (void) memcpy((void *) (gc->pc + 40), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 44), (void *) (&level), 4);
-            (void) memcpy((void *) (gc->pc + 48), (void *) (&xoffset), 4);
-            (void) memcpy((void *) (gc->pc + 52), (void *) (&yoffset), 4);
-            (void) memcpy((void *) (gc->pc + 56), (void *) (&zoffset), 4);
-            (void) memcpy((void *) (gc->pc + 60), (void *) (&woffset), 4);
-            (void) memcpy((void *) (gc->pc + 64), (void *) (&width), 4);
-            (void) memcpy((void *) (gc->pc + 68), (void *) (&height), 4);
-            (void) memcpy((void *) (gc->pc + 72), (void *) (&depth), 4);
-            (void) memcpy((void *) (gc->pc + 76), (void *) (&extent), 4);
-            (void) memcpy((void *) (gc->pc + 80), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 84), (void *) (&type), 4);
-            (void) memset((void *) (gc->pc + 88), 0, 4);
-            if (compsize > 0) {
-                (*gc->fillImage) (gc, dim, width, height, depth, format, type,
-                                  pixels, gc->pc + 92, gc->pc + 4);
-            } else {
-                (void) memcpy(gc->pc + 4, default_pixel_store_4D,
-                              default_pixel_store_4D_size);
-            }
-            gc->pc += cmdlen;
-            if (gc->pc > gc->limit) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = opcode;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 44), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 48), (void *) (&level), 4);
-            (void) memcpy((void *) (pc + 52), (void *) (&xoffset), 4);
-            (void) memcpy((void *) (pc + 56), (void *) (&yoffset), 4);
-            (void) memcpy((void *) (pc + 60), (void *) (&zoffset), 4);
-            (void) memcpy((void *) (pc + 64), (void *) (&woffset), 4);
-            (void) memcpy((void *) (pc + 68), (void *) (&width), 4);
-            (void) memcpy((void *) (pc + 72), (void *) (&height), 4);
-            (void) memcpy((void *) (pc + 76), (void *) (&depth), 4);
-            (void) memcpy((void *) (pc + 80), (void *) (&extent), 4);
-            (void) memcpy((void *) (pc + 84), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 88), (void *) (&type), 4);
-            (void) memset((void *) (pc + 92), 0, 4);
-            __glXSendLargeImage(gc, compsize, dim, width, height, depth,
-                                format, type, pixels, pc + 96, pc + 8);
-        }
-    }
-}
-
-#define X_GLrop_TexSubImage3D 4115
-void
-__indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset,
-                           GLint yoffset, GLint zoffset, GLsizei width,
-                           GLsizei height, GLsizei depth, GLenum format,
-                           GLenum type, const GLvoid * pixels)
-{
-    __glx_TexSubImage_3D4D(X_GLrop_TexSubImage3D, 3, target, level, xoffset,
-                           yoffset, zoffset, 1, width, height, depth, 1,
-                           format, type, pixels);
-}
-
-#define X_GLrop_CopyTexSubImage3D 4123
-void
-__indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset,
-                               GLint yoffset, GLint zoffset, GLint x, GLint y,
-                               GLsizei width, GLsizei height)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_CopyTexSubImage3D, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&level), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&xoffset), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&yoffset), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&zoffset), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 32), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&height), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ActiveTextureARB 197
-void
-__indirect_glActiveTextureARB(GLenum texture)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ActiveTextureARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&texture), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1dvARB 198
-void
-__indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1dvARB 198
-void
-__indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1fvARB 199
-void
-__indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1fvARB 199
-void
-__indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1ivARB 200
-void
-__indirect_glMultiTexCoord1iARB(GLenum target, GLint s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1ivARB 200
-void
-__indirect_glMultiTexCoord1ivARB(GLenum target, const GLint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1svARB 201
-void
-__indirect_glMultiTexCoord1sARB(GLenum target, GLshort s)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord1svARB 201
-void
-__indirect_glMultiTexCoord1svARB(GLenum target, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord1svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2dvARB 202
-void
-__indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2dvARB 202
-void
-__indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 16);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2fvARB 203
-void
-__indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2fvARB 203
-void
-__indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2ivARB 204
-void
-__indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2ivARB 204
-void
-__indirect_glMultiTexCoord2ivARB(GLenum target, const GLint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2svARB 205
-void
-__indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&t), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord2svARB 205
-void
-__indirect_glMultiTexCoord2svARB(GLenum target, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord2svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3dvARB 206
-void
-__indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t,
-                                GLdouble r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 32;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3dvARB 206
-void
-__indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 32;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 24);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3fvARB 207
-void
-__indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t,
-                                GLfloat r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3fvARB 207
-void
-__indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3ivARB 208
-void
-__indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3ivARB 208
-void
-__indirect_glMultiTexCoord3ivARB(GLenum target, const GLint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3svARB 209
-void
-__indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t,
-                                GLshort r)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&t), 2);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord3svARB 209
-void
-__indirect_glMultiTexCoord3svARB(GLenum target, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord3svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 6);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4dvARB 210
-void
-__indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t,
-                                GLdouble r, GLdouble q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&s), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&r), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&q), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4dvARB 210
-void
-__indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (v), 32);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4fvARB 211
-void
-__indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t,
-                                GLfloat r, GLfloat q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&q), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4fvARB 211
-void
-__indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4ivARB 212
-void
-__indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r,
-                                GLint q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&t), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&r), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&q), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4ivARB 212
-void
-__indirect_glMultiTexCoord4ivARB(GLenum target, const GLint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4svARB 213
-void
-__indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t,
-                                GLshort r, GLshort q)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&s), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&t), 2);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&r), 2);
-    (void) memcpy((void *) (gc->pc + 14), (void *) (&q), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_MultiTexCoord4svARB 213
-void
-__indirect_glMultiTexCoord4svARB(GLenum target, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_MultiTexCoord4svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SampleCoverageARB 229
-void
-__indirect_glSampleCoverageARB(GLclampf value, GLboolean invert)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_SampleCoverageARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&value), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&invert), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLvop_GetProgramStringARB 1308
-void
-__indirect_glGetProgramStringARB(GLenum target, GLenum pname, GLvoid * string)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramStringARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 1, string, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetProgramivARB 1307
-void
-__indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramivARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLrop_ProgramEnvParameter4dvARB 4185
-void
-__indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x,
-                                      GLdouble y, GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramEnvParameter4dvARB 4185
-void
-__indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
-                                       const GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 32);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramEnvParameter4fvARB 4184
-void
-__indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x,
-                                      GLfloat y, GLfloat z, GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramEnvParameter4fvARB 4184
-void
-__indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index,
-                                       const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramLocalParameter4dvARB 4216
-void
-__indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index,
-                                        GLdouble x, GLdouble y, GLdouble z,
-                                        GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramLocalParameter4dvARB 4216
-void
-__indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index,
-                                         const GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 32);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramLocalParameter4fvARB 4215
-void
-__indirect_glProgramLocalParameter4fARB(GLenum target, GLuint index,
-                                        GLfloat x, GLfloat y, GLfloat z,
-                                        GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramLocalParameter4fvARB 4215
-void
-__indirect_glProgramLocalParameter4fvARB(GLenum target, GLuint index,
-                                         const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ProgramLocalParameter4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramStringARB 4217
-void
-__indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len,
-                              const GLvoid * string)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((len >= 0) && (gc->currentDpy != NULL), 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_ProgramStringARB, cmdlen);
-            (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-            (void) memcpy((void *) (gc->pc + 8), (void *) (&format), 4);
-            (void) memcpy((void *) (gc->pc + 12), (void *) (&len), 4);
-            (void) memcpy((void *) (gc->pc + 16), (void *) (string), len);
-            gc->pc += cmdlen;
-            if (__builtin_expect(gc->pc > gc->limit, 0)) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_ProgramStringARB;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&target), 4);
-            (void) memcpy((void *) (pc + 12), (void *) (&format), 4);
-            (void) memcpy((void *) (pc + 16), (void *) (&len), 4);
-            __glXSendLargeCommand(gc, pc, 20, string, len);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttrib1dvARB 4197
-void
-__indirect_glVertexAttrib1dARB(GLuint index, GLdouble x)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1dvARB 4197
-void
-__indirect_glVertexAttrib1dvARB(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1fvARB 4193
-void
-__indirect_glVertexAttrib1fARB(GLuint index, GLfloat x)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1fvARB 4193
-void
-__indirect_glVertexAttrib1fvARB(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1svARB 4189
-void
-__indirect_glVertexAttrib1sARB(GLuint index, GLshort x)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1svARB 4189
-void
-__indirect_glVertexAttrib1svARB(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2dvARB 4198
-void
-__indirect_glVertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2dvARB 4198
-void
-__indirect_glVertexAttrib2dvARB(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2fvARB 4194
-void
-__indirect_glVertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2fvARB 4194
-void
-__indirect_glVertexAttrib2fvARB(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2svARB 4190
-void
-__indirect_glVertexAttrib2sARB(GLuint index, GLshort x, GLshort y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2svARB 4190
-void
-__indirect_glVertexAttrib2svARB(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3dvARB 4199
-void
-__indirect_glVertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y,
-                               GLdouble z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 32;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3dvARB 4199
-void
-__indirect_glVertexAttrib3dvARB(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 32;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 24);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3fvARB 4195
-void
-__indirect_glVertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3fvARB 4195
-void
-__indirect_glVertexAttrib3fvARB(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3svARB 4191
-void
-__indirect_glVertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3svARB 4191
-void
-__indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 6);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4NbvARB 4235
-void
-__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte *v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4NbvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4NivARB 4237
-void
-__indirect_glVertexAttrib4NivARB(GLuint index, const GLint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4NivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4NsvARB 4236
-void
-__indirect_glVertexAttrib4NsvARB(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4NsvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4NubvARB 4201
-void
-__indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y,
-                                 GLubyte z, GLubyte w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4NubvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 1);
-    (void) memcpy((void *) (gc->pc + 9), (void *) (&y), 1);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&z), 1);
-    (void) memcpy((void *) (gc->pc + 11), (void *) (&w), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4NubvARB 4201
-void
-__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte *v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4NubvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4NuivARB 4239
-void
-__indirect_glVertexAttrib4NuivARB(GLuint index, const GLuint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4NuivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4NusvARB 4238
-void
-__indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4NusvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4bvARB 4230
-void
-__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte *v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4bvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4dvARB 4200
-void
-__indirect_glVertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y,
-                               GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 32), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4dvARB 4200
-void
-__indirect_glVertexAttrib4dvARB(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 32);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4fvARB 4196
-void
-__indirect_glVertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
-                               GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4fvARB 4196
-void
-__indirect_glVertexAttrib4fvARB(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4ivARB 4231
-void
-__indirect_glVertexAttrib4ivARB(GLuint index, const GLint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4ivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4svARB 4192
-void
-__indirect_glVertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z,
-                               GLshort w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
-    (void) memcpy((void *) (gc->pc + 14), (void *) (&w), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4svARB 4192
-void
-__indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4svARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4ubvARB 4232
-void
-__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte *v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4ubvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4uivARB 4234
-void
-__indirect_glVertexAttrib4uivARB(GLuint index, const GLuint * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4uivARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4usvARB 4233
-void
-__indirect_glVertexAttrib4usvARB(GLuint index, const GLushort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4usvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_BeginQueryARB 231
-void
-__indirect_glBeginQueryARB(GLenum target, GLuint id)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_BeginQueryARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&id), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLsop_DeleteQueriesARB 161
-void
-__indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-#endif
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_delete_queries_arb(c, gc->currentContextTag, n, ids);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_DeleteQueriesARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (ids), (n * 4));
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLrop_EndQueryARB 232
-void
-__indirect_glEndQueryARB(GLenum target)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_EndQueryARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLsop_GenQueriesARB 162
-void
-__indirect_glGenQueriesARB(GLsizei n, GLuint * ids)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_gen_queries_arb_reply_t *reply =
-            xcb_glx_gen_queries_arb_reply(c,
-                                          xcb_glx_gen_queries_arb(c,
-                                                                  gc->
-                                                                  currentContextTag,
-                                                                  n), NULL);
-        (void) memcpy(ids, xcb_glx_gen_queries_arb_data(reply),
-                      xcb_glx_gen_queries_arb_data_length(reply) *
-                      sizeof(GLuint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GenQueriesARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) __glXReadReply(dpy, 4, ids, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetQueryObjectivARB 165
-void
-__indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_query_objectiv_arb_reply_t *reply =
-            xcb_glx_get_query_objectiv_arb_reply(c,
-                                                 xcb_glx_get_query_objectiv_arb
-                                                 (c, gc->currentContextTag,
-                                                  id, pname), NULL);
-        if (xcb_glx_get_query_objectiv_arb_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_query_objectiv_arb_data(reply),
-                          xcb_glx_get_query_objectiv_arb_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectivARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetQueryObjectuivARB 166
-void
-__indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_query_objectuiv_arb_reply_t *reply =
-            xcb_glx_get_query_objectuiv_arb_reply(c,
-                                                  xcb_glx_get_query_objectuiv_arb
-                                                  (c, gc->currentContextTag,
-                                                   id, pname), NULL);
-        if (xcb_glx_get_query_objectuiv_arb_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_query_objectuiv_arb_data(reply),
-                          xcb_glx_get_query_objectuiv_arb_data_length(reply) *
-                          sizeof(GLuint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectuivARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_GetQueryivARB 164
-void
-__indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-#ifndef USE_XCB
-    const GLuint cmdlen = 8;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_get_queryiv_arb_reply_t *reply =
-            xcb_glx_get_queryiv_arb_reply(c,
-                                          xcb_glx_get_queryiv_arb(c,
-                                                                  gc->
-                                                                  currentContextTag,
-                                                                  target,
-                                                                  pname),
-                                          NULL);
-        if (xcb_glx_get_queryiv_arb_data_length(reply) == 0)
-            (void) memcpy(params, &reply->datum, sizeof(reply->datum));
-        else
-            (void) memcpy(params, xcb_glx_get_queryiv_arb_data(reply),
-                          xcb_glx_get_queryiv_arb_data_length(reply) *
-                          sizeof(GLint));
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_GetQueryivARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return;
-}
-
-#define X_GLsop_IsQueryARB 163
-GLboolean
-__indirect_glIsQueryARB(GLuint id)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-#ifndef USE_XCB
-    const GLuint cmdlen = 4;
-#endif
-    if (__builtin_expect(dpy != NULL, 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_is_query_arb_reply_t *reply =
-            xcb_glx_is_query_arb_reply(c,
-                                       xcb_glx_is_query_arb(c,
-                                                            gc->
-                                                            currentContextTag,
-                                                            id), NULL);
-        retval = reply->ret_val;
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_IsQueryARB, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
-        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return retval;
-}
-
-#define X_GLrop_DrawBuffersARB 233
-void
-__indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
-        if (cmdlen <= gc->maxSmallRenderCommandSize) {
-            if ((gc->pc + cmdlen) > gc->bufEnd) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-            emit_header(gc->pc, X_GLrop_DrawBuffersARB, cmdlen);
-            (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
-            (void) memcpy((void *) (gc->pc + 8), (void *) (bufs), (n * 4));
-            gc->pc += cmdlen;
-            if (__builtin_expect(gc->pc > gc->limit, 0)) {
-                (void) __glXFlushRenderBuffer(gc, gc->pc);
-            }
-        } else {
-            const GLint op = X_GLrop_DrawBuffersARB;
-            const GLuint cmdlenLarge = cmdlen + 4;
-            GLubyte *const pc = __glXFlushRenderBuffer(gc, gc->pc);
-            (void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
-            (void) memcpy((void *) (pc + 4), (void *) (&op), 4);
-            (void) memcpy((void *) (pc + 8), (void *) (&n), 4);
-            __glXSendLargeCommand(gc, pc, 12, bufs, (n * 4));
-        }
-    }
-}
-
-#define X_GLrop_RenderbufferStorageMultisample 4331
-void
-__indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples,
-                                            GLenum internalformat,
-                                            GLsizei width, GLsizei height)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_RenderbufferStorageMultisample, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&samples), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&height), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SampleMaskSGIS 2048
-void
-__indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_SampleMaskSGIS, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&value), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&invert), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SamplePatternSGIS 2049
-void
-__indirect_glSamplePatternSGIS(GLenum pattern)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_SamplePatternSGIS, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pattern), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PointParameterfEXT 2065
-void
-__indirect_glPointParameterfEXT(GLenum pname, GLfloat param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_PointParameterfEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PointParameterfvEXT 2066
-void
-__indirect_glPointParameterfvEXT(GLenum pname, const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glPointParameterfvEXT_size(pname);
-    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_PointParameterfvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3bvEXT 4126
-void
-__indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3bvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3bvEXT 4126
-void
-__indirect_glSecondaryColor3bvEXT(const GLbyte *v)
-{
-    generic_3_byte(X_GLrop_SecondaryColor3bvEXT, v);
-}
-
-#define X_GLrop_SecondaryColor3dvEXT 4130
-void
-__indirect_glSecondaryColor3dEXT(GLdouble red, GLdouble green, GLdouble blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3dvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 8);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&green), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&blue), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3dvEXT 4130
-void
-__indirect_glSecondaryColor3dvEXT(const GLdouble * v)
-{
-    generic_24_byte(X_GLrop_SecondaryColor3dvEXT, v);
-}
-
-#define X_GLrop_SecondaryColor3fvEXT 4129
-void
-__indirect_glSecondaryColor3fEXT(GLfloat red, GLfloat green, GLfloat blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3fvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3fvEXT 4129
-void
-__indirect_glSecondaryColor3fvEXT(const GLfloat * v)
-{
-    generic_12_byte(X_GLrop_SecondaryColor3fvEXT, v);
-}
-
-#define X_GLrop_SecondaryColor3ivEXT 4128
-void
-__indirect_glSecondaryColor3iEXT(GLint red, GLint green, GLint blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3ivEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3ivEXT 4128
-void
-__indirect_glSecondaryColor3ivEXT(const GLint * v)
-{
-    generic_12_byte(X_GLrop_SecondaryColor3ivEXT, v);
-}
-
-#define X_GLrop_SecondaryColor3svEXT 4127
-void
-__indirect_glSecondaryColor3sEXT(GLshort red, GLshort green, GLshort blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3svEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3svEXT 4127
-void
-__indirect_glSecondaryColor3svEXT(const GLshort * v)
-{
-    generic_6_byte(X_GLrop_SecondaryColor3svEXT, v);
-}
-
-#define X_GLrop_SecondaryColor3ubvEXT 4131
-void
-__indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3ubvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 1);
-    (void) memcpy((void *) (gc->pc + 5), (void *) (&green), 1);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&blue), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3ubvEXT 4131
-void
-__indirect_glSecondaryColor3ubvEXT(const GLubyte *v)
-{
-    generic_3_byte(X_GLrop_SecondaryColor3ubvEXT, v);
-}
-
-#define X_GLrop_SecondaryColor3uivEXT 4133
-void
-__indirect_glSecondaryColor3uiEXT(GLuint red, GLuint green, GLuint blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3uivEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&green), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&blue), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3uivEXT 4133
-void
-__indirect_glSecondaryColor3uivEXT(const GLuint * v)
-{
-    generic_12_byte(X_GLrop_SecondaryColor3uivEXT, v);
-}
-
-#define X_GLrop_SecondaryColor3usvEXT 4132
-void
-__indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_SecondaryColor3usvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&red), 2);
-    (void) memcpy((void *) (gc->pc + 6), (void *) (&green), 2);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&blue), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_SecondaryColor3usvEXT 4132
-void
-__indirect_glSecondaryColor3usvEXT(const GLushort * v)
-{
-    generic_6_byte(X_GLrop_SecondaryColor3usvEXT, v);
-}
-
-#define X_GLrop_FogCoorddvEXT 4125
-void
-__indirect_glFogCoorddEXT(GLdouble coord)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_FogCoorddvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_FogCoorddvEXT 4125
-void
-__indirect_glFogCoorddvEXT(const GLdouble * coord)
-{
-    generic_8_byte(X_GLrop_FogCoorddvEXT, coord);
-}
-
-#define X_GLrop_FogCoordfvEXT 4124
-void
-__indirect_glFogCoordfEXT(GLfloat coord)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_FogCoordfvEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_FogCoordfvEXT 4124
-void
-__indirect_glFogCoordfvEXT(const GLfloat * coord)
-{
-    generic_4_byte(X_GLrop_FogCoordfvEXT, coord);
-}
-
-#define X_GLrop_BlendFuncSeparateEXT 4134
-void
-__indirect_glBlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
-                                  GLenum sfactorAlpha, GLenum dfactorAlpha)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_BlendFuncSeparateEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&sfactorRGB), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&dfactorRGB), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&sfactorAlpha), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&dfactorAlpha), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_WindowPos3fvMESA 230
-void
-__indirect_glWindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_WindowPos3fvMESA, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_WindowPos3fvMESA 230
-void
-__indirect_glWindowPos3fvMESA(const GLfloat * v)
-{
-    generic_12_byte(X_GLrop_WindowPos3fvMESA, v);
-}
-
-#define X_GLvop_AreProgramsResidentNV 1293
-GLboolean
-__indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids,
-                                   GLboolean * residences)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return 0;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_AreProgramsResidentNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (ids), (n * 4));
-        retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return retval;
-}
-
-#define X_GLrop_BindProgramNV 4180
-void
-__indirect_glBindProgramNV(GLenum target, GLuint program)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_BindProgramNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&program), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLvop_DeleteProgramsNV 1294
-void
-__indirect_glDeleteProgramsNV(GLsizei n, const GLuint * programs)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivate,
-                                    X_GLvop_DeleteProgramsNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (programs), (n * 4));
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLrop_ExecuteProgramNV 4181
-void
-__indirect_glExecuteProgramNV(GLenum target, GLuint id,
-                              const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ExecuteProgramNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&id), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLvop_GenProgramsNV 1295
-void
-__indirect_glGenProgramsNV(GLsizei n, GLuint * programs)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 4;
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GenProgramsNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) __glXReadReply(dpy, 4, programs, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetProgramParameterdvNV 1297
-void
-__indirect_glGetProgramParameterdvNV(GLenum target, GLuint index,
-                                     GLenum pname, GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 12;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramParameterdvNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 8, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetProgramParameterfvNV 1296
-void
-__indirect_glGetProgramParameterfvNV(GLenum target, GLuint index,
-                                     GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 12;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramParameterfvNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetProgramStringNV 1299
-void
-__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramStringNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 1, program, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetProgramivNV 1298
-void
-__indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramivNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetTrackMatrixivNV 1300
-void
-__indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname,
-                                GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 12;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetTrackMatrixivNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&address), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetVertexAttribdvNV 1301
-void
-__indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname,
-                                 GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetVertexAttribdvNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&index), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 8, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetVertexAttribfvNV 1302
-void
-__indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetVertexAttribfvNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&index), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetVertexAttribivNV 1303
-void
-__indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetVertexAttribivNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&index), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_IsProgramNV 1304
-GLboolean
-__indirect_glIsProgramNV(GLuint program)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-    const GLuint cmdlen = 4;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_IsProgramNV, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&program), 4);
-        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return retval;
-}
-
-#define X_GLrop_LoadProgramNV 4183
-void
-__indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
-                           const GLubyte *program)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(len >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_LoadProgramNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&id), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (&len), 4);
-        (void) memcpy((void *) (gc->pc + 16), (void *) (program), len);
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_ProgramParameters4dvNV 4187
-void
-__indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num,
-                                    const GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16 + __GLX_PAD((num * 32));
-    if (num < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(num >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_ProgramParameters4dvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (&num), 4);
-        (void) memcpy((void *) (gc->pc + 16), (void *) (params), (num * 32));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_ProgramParameters4fvNV 4186
-void
-__indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num,
-                                    const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16 + __GLX_PAD((num * 16));
-    if (num < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(num >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_ProgramParameters4fvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (&num), 4);
-        (void) memcpy((void *) (gc->pc + 16), (void *) (params), (num * 16));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_RequestResidentProgramsNV 4182
-void
-__indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_RequestResidentProgramsNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (ids), (n * 4));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_TrackMatrixNV 4188
-void
-__indirect_glTrackMatrixNV(GLenum target, GLuint address, GLenum matrix,
-                           GLenum transform)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_TrackMatrixNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&address), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&matrix), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&transform), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1dvNV 4273
-void
-__indirect_glVertexAttrib1dNV(GLuint index, GLdouble x)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1dvNV 4273
-void
-__indirect_glVertexAttrib1dvNV(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1fvNV 4269
-void
-__indirect_glVertexAttrib1fNV(GLuint index, GLfloat x)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1fvNV 4269
-void
-__indirect_glVertexAttrib1fvNV(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1svNV 4265
-void
-__indirect_glVertexAttrib1sNV(GLuint index, GLshort x)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib1svNV 4265
-void
-__indirect_glVertexAttrib1svNV(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib1svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2dvNV 4274
-void
-__indirect_glVertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2dvNV 4274
-void
-__indirect_glVertexAttrib2dvNV(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2fvNV 4270
-void
-__indirect_glVertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2fvNV 4270
-void
-__indirect_glVertexAttrib2fvNV(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2svNV 4266
-void
-__indirect_glVertexAttrib2sNV(GLuint index, GLshort x, GLshort y)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib2svNV 4266
-void
-__indirect_glVertexAttrib2svNV(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib2svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3dvNV 4275
-void
-__indirect_glVertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y,
-                              GLdouble z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 32;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3dvNV 4275
-void
-__indirect_glVertexAttrib3dvNV(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 32;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 24);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3fvNV 4271
-void
-__indirect_glVertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3fvNV 4271
-void
-__indirect_glVertexAttrib3fvNV(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 12);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3svNV 4267
-void
-__indirect_glVertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib3svNV 4267
-void
-__indirect_glVertexAttrib3svNV(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib3svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 6);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4dvNV 4276
-void
-__indirect_glVertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y,
-                              GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 32), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4dvNV 4276
-void
-__indirect_glVertexAttrib4dvNV(GLuint index, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 40;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 32);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4fvNV 4272
-void
-__indirect_glVertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z,
-                              GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4fvNV 4272
-void
-__indirect_glVertexAttrib4fvNV(GLuint index, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4svNV 4268
-void
-__indirect_glVertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z,
-                              GLshort w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 2);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&y), 2);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&z), 2);
-    (void) memcpy((void *) (gc->pc + 14), (void *) (&w), 2);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4svNV 4268
-void
-__indirect_glVertexAttrib4svNV(GLuint index, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 16;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4svNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4ubvNV 4277
-void
-__indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z,
-                               GLubyte w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4ubvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&x), 1);
-    (void) memcpy((void *) (gc->pc + 9), (void *) (&y), 1);
-    (void) memcpy((void *) (gc->pc + 10), (void *) (&z), 1);
-    (void) memcpy((void *) (gc->pc + 11), (void *) (&w), 1);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttrib4ubvNV 4277
-void
-__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte *v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_VertexAttrib4ubvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (v), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_VertexAttribs1dvNV 4210
-void
-__indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs1dvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs1fvNV 4206
-void
-__indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs1fvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs1svNV 4202
-void
-__indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 2));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs1svNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 2));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs2dvNV 4211
-void
-__indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs2dvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 16));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs2fvNV 4207
-void
-__indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs2fvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs2svNV 4203
-void
-__indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs2svNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs3dvNV 4212
-void
-__indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 24));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs3dvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 24));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs3fvNV 4208
-void
-__indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 12));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs3fvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 12));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs3svNV 4204
-void
-__indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 6));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs3svNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 6));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs4dvNV 4213
-void
-__indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 32));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs4dvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 32));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs4fvNV 4209
-void
-__indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs4fvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 16));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs4svNV 4205
-void
-__indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs4svNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_VertexAttribs4ubvNV 4214
-void
-__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_VertexAttribs4ubvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_PointParameteriNV 4221
-void
-__indirect_glPointParameteriNV(GLenum pname, GLint param)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_PointParameteriNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&param), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_PointParameterivNV 4222
-void
-__indirect_glPointParameterivNV(GLenum pname, const GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint compsize = __glPointParameterivNV_size(pname);
-    const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
-    emit_header(gc->pc, X_GLrop_PointParameterivNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ActiveStencilFaceEXT 4220
-void
-__indirect_glActiveStencilFaceEXT(GLenum face)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_ActiveStencilFaceEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLvop_GetProgramNamedParameterdvNV 1311
-void
-__indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
-                                          const GLubyte *name,
-                                          GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramNamedParameterdvNV,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&len), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (name), len);
-        (void) __glXReadReply(dpy, 8, params, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetProgramNamedParameterfvNV 1310
-void
-__indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
-                                          const GLubyte *name,
-                                          GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetProgramNamedParameterfvNV,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&id), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&len), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (name), len);
-        (void) __glXReadReply(dpy, 4, params, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLrop_ProgramNamedParameter4dvNV 4219
-void
-__indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
-                                       const GLubyte *name, GLdouble x,
-                                       GLdouble y, GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(len >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (&y), 8);
-        (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 8);
-        (void) memcpy((void *) (gc->pc + 28), (void *) (&w), 8);
-        (void) memcpy((void *) (gc->pc + 36), (void *) (&id), 4);
-        (void) memcpy((void *) (gc->pc + 40), (void *) (&len), 4);
-        (void) memcpy((void *) (gc->pc + 44), (void *) (name), len);
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_ProgramNamedParameter4dvNV 4219
-void
-__indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
-                                        const GLubyte *name,
-                                        const GLdouble * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(len >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (v), 32);
-        (void) memcpy((void *) (gc->pc + 36), (void *) (&id), 4);
-        (void) memcpy((void *) (gc->pc + 40), (void *) (&len), 4);
-        (void) memcpy((void *) (gc->pc + 44), (void *) (name), len);
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_ProgramNamedParameter4fvNV 4218
-void
-__indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
-                                       const GLubyte *name, GLfloat x,
-                                       GLfloat y, GLfloat z, GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(len >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&len), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-        (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-        (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
-        (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
-        (void) memcpy((void *) (gc->pc + 28), (void *) (name), len);
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_ProgramNamedParameter4fvNV 4218
-void
-__indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len,
-                                        const GLubyte *name,
-                                        const GLfloat * v)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28 + __GLX_PAD(len);
-    if (len < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(len >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (&len), 4);
-        (void) memcpy((void *) (gc->pc + 12), (void *) (v), 16);
-        (void) memcpy((void *) (gc->pc + 28), (void *) (name), len);
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_BlendEquationSeparateEXT 4228
-void
-__indirect_glBlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_BlendEquationSeparateEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&modeRGB), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&modeA), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_BindFramebufferEXT 4319
-void
-__indirect_glBindFramebufferEXT(GLenum target, GLuint framebuffer)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_BindFramebufferEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&framebuffer), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_BindRenderbufferEXT 4316
-void
-__indirect_glBindRenderbufferEXT(GLenum target, GLuint renderbuffer)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 12;
-    emit_header(gc->pc, X_GLrop_BindRenderbufferEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&renderbuffer), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLvop_CheckFramebufferStatusEXT 1427
-GLenum
-__indirect_glCheckFramebufferStatusEXT(GLenum target)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLenum retval = (GLenum) 0;
-    const GLuint cmdlen = 4;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_CheckFramebufferStatusEXT,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        retval = (GLenum) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return retval;
-}
-
-#define X_GLrop_DeleteFramebuffersEXT 4320
-void
-__indirect_glDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_DeleteFramebuffersEXT, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (framebuffers),
-                      (n * 4));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_DeleteRenderbuffersEXT 4317
-void
-__indirect_glDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect(n >= 0, 1)) {
-        emit_header(gc->pc, X_GLrop_DeleteRenderbuffersEXT, cmdlen);
-        (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
-        (void) memcpy((void *) (gc->pc + 8), (void *) (renderbuffers),
-                      (n * 4));
-        gc->pc += cmdlen;
-        if (__builtin_expect(gc->pc > gc->limit, 0)) {
-            (void) __glXFlushRenderBuffer(gc, gc->pc);
-        }
-    }
-}
-
-#define X_GLrop_FramebufferRenderbufferEXT 4324
-void
-__indirect_glFramebufferRenderbufferEXT(GLenum target, GLenum attachment,
-                                        GLenum renderbuffertarget,
-                                        GLuint renderbuffer)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_FramebufferRenderbufferEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&renderbuffertarget), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&renderbuffer), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_FramebufferTexture1DEXT 4321
-void
-__indirect_glFramebufferTexture1DEXT(GLenum target, GLenum attachment,
-                                     GLenum textarget, GLuint texture,
-                                     GLint level)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_FramebufferTexture1DEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&textarget), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&texture), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&level), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_FramebufferTexture2DEXT 4322
-void
-__indirect_glFramebufferTexture2DEXT(GLenum target, GLenum attachment,
-                                     GLenum textarget, GLuint texture,
-                                     GLint level)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_FramebufferTexture2DEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&textarget), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&texture), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&level), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_FramebufferTexture3DEXT 4323
-void
-__indirect_glFramebufferTexture3DEXT(GLenum target, GLenum attachment,
-                                     GLenum textarget, GLuint texture,
-                                     GLint level, GLint zoffset)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_FramebufferTexture3DEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&textarget), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&texture), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&level), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&zoffset), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLvop_GenFramebuffersEXT 1426
-void
-__indirect_glGenFramebuffersEXT(GLsizei n, GLuint * framebuffers)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 4;
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GenFramebuffersEXT, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) __glXReadReply(dpy, 4, framebuffers, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GenRenderbuffersEXT 1423
-void
-__indirect_glGenRenderbuffersEXT(GLsizei n, GLuint * renderbuffers)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 4;
-    if (n < 0) {
-        __glXSetError(gc, GL_INVALID_VALUE);
-        return;
-    }
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GenRenderbuffersEXT, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) __glXReadReply(dpy, 4, renderbuffers, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLrop_GenerateMipmapEXT 4325
-void
-__indirect_glGenerateMipmapEXT(GLenum target)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 8;
-    emit_header(gc->pc, X_GLrop_GenerateMipmapEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLvop_GetFramebufferAttachmentParameterivEXT 1428
-void
-__indirect_glGetFramebufferAttachmentParameterivEXT(GLenum target,
-                                                    GLenum attachment,
-                                                    GLenum pname,
-                                                    GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 12;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetFramebufferAttachmentParameterivEXT,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&attachment), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetRenderbufferParameterivEXT 1424
-void
-__indirect_glGetRenderbufferParameterivEXT(GLenum target, GLenum pname,
-                                           GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetRenderbufferParameterivEXT,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_IsFramebufferEXT 1425
-GLboolean
-__indirect_glIsFramebufferEXT(GLuint framebuffer)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-    const GLuint cmdlen = 4;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_IsFramebufferEXT, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&framebuffer), 4);
-        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return retval;
-}
-
-#define X_GLvop_IsRenderbufferEXT 1422
-GLboolean
-__indirect_glIsRenderbufferEXT(GLuint renderbuffer)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-    const GLuint cmdlen = 4;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_IsRenderbufferEXT, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&renderbuffer), 4);
-        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return retval;
-}
-
-#define X_GLrop_RenderbufferStorageEXT 4318
-void
-__indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat,
-                                    GLsizei width, GLsizei height)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 20;
-    emit_header(gc->pc, X_GLrop_RenderbufferStorageEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&internalformat), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&width), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&height), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_BlitFramebufferEXT 4330
-void
-__indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1,
-                                GLint srcY1, GLint dstX0, GLint dstY0,
-                                GLint dstX1, GLint dstY1, GLbitfield mask,
-                                GLenum filter)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_BlitFramebufferEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&srcX0), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&srcY0), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&srcX1), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&srcY1), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&dstX0), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&dstY0), 4);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&dstX1), 4);
-    (void) memcpy((void *) (gc->pc + 32), (void *) (&dstY1), 4);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&mask), 4);
-    (void) memcpy((void *) (gc->pc + 40), (void *) (&filter), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_FramebufferTextureLayerEXT 237
-void
-__indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment,
-                                        GLuint texture, GLint level,
-                                        GLint layer)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 24;
-    emit_header(gc->pc, X_GLrop_FramebufferTextureLayerEXT, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&texture), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&level), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&layer), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-
-#  undef FASTCALL
-#  undef NOINLINE
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
deleted file mode 100644 (file)
index 9e73b33..0000000
+++ /dev/null
@@ -1,721 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_send.py (from Mesa) script */
-
-/*
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * (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
- * 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
- * PRECISION INSIGHT, 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.
- */
-
-#if !defined( _INDIRECT_H_ )
-#  define _INDIRECT_H_
-
-/**
- * \file
- * Prototypes for indirect rendering functions.
- *
- * \author Kevin E. Martin <kevin@precisioninsight.com>
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
-#    define HIDDEN  __attribute__((visibility("hidden")))
-#  else
-#    define HIDDEN
-#  endif
-#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#    define FASTCALL __attribute__((fastcall))
-#  else
-#    define FASTCALL
-#  endif
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define NOINLINE __attribute__((noinline))
-#  else
-#    define NOINLINE
-#  endif
-
-#include "glxclient.h"
-
-extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size,
-    void * dest, GLboolean reply_is_always_array );
-
-extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy,
-    __GLXcontext * gc, unsigned max_dim, GLint width, GLint height,
-    GLint depth, GLenum format, GLenum type, void * dest,
-    GLboolean dimensions_in_reply );
-
-extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest(
-    __GLXcontext * gc, GLint sop, GLint cmdlen );
-
-extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest(
-    __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen );
-
-extern HIDDEN void __indirect_glNewList(GLuint list, GLenum mode);
-extern HIDDEN void __indirect_glEndList(void);
-extern HIDDEN void __indirect_glCallList(GLuint list);
-extern HIDDEN void __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists);
-extern HIDDEN void __indirect_glDeleteLists(GLuint list, GLsizei range);
-extern HIDDEN GLuint __indirect_glGenLists(GLsizei range);
-extern HIDDEN void __indirect_glListBase(GLuint base);
-extern HIDDEN void __indirect_glBegin(GLenum mode);
-extern HIDDEN void __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap);
-extern HIDDEN void __indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue);
-extern HIDDEN void __indirect_glColor3bv(const GLbyte * v);
-extern HIDDEN void __indirect_glColor3d(GLdouble red, GLdouble green, GLdouble blue);
-extern HIDDEN void __indirect_glColor3dv(const GLdouble * v);
-extern HIDDEN void __indirect_glColor3f(GLfloat red, GLfloat green, GLfloat blue);
-extern HIDDEN void __indirect_glColor3fv(const GLfloat * v);
-extern HIDDEN void __indirect_glColor3i(GLint red, GLint green, GLint blue);
-extern HIDDEN void __indirect_glColor3iv(const GLint * v);
-extern HIDDEN void __indirect_glColor3s(GLshort red, GLshort green, GLshort blue);
-extern HIDDEN void __indirect_glColor3sv(const GLshort * v);
-extern HIDDEN void __indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
-extern HIDDEN void __indirect_glColor3ubv(const GLubyte * v);
-extern HIDDEN void __indirect_glColor3ui(GLuint red, GLuint green, GLuint blue);
-extern HIDDEN void __indirect_glColor3uiv(const GLuint * v);
-extern HIDDEN void __indirect_glColor3us(GLushort red, GLushort green, GLushort blue);
-extern HIDDEN void __indirect_glColor3usv(const GLushort * v);
-extern HIDDEN void __indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
-extern HIDDEN void __indirect_glColor4bv(const GLbyte * v);
-extern HIDDEN void __indirect_glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
-extern HIDDEN void __indirect_glColor4dv(const GLdouble * v);
-extern HIDDEN void __indirect_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-extern HIDDEN void __indirect_glColor4fv(const GLfloat * v);
-extern HIDDEN void __indirect_glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
-extern HIDDEN void __indirect_glColor4iv(const GLint * v);
-extern HIDDEN void __indirect_glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
-extern HIDDEN void __indirect_glColor4sv(const GLshort * v);
-extern HIDDEN void __indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-extern HIDDEN void __indirect_glColor4ubv(const GLubyte * v);
-extern HIDDEN void __indirect_glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
-extern HIDDEN void __indirect_glColor4uiv(const GLuint * v);
-extern HIDDEN void __indirect_glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
-extern HIDDEN void __indirect_glColor4usv(const GLushort * v);
-extern HIDDEN void __indirect_glEdgeFlag(GLboolean flag);
-extern HIDDEN void __indirect_glEdgeFlagv(const GLboolean * flag);
-extern HIDDEN void __indirect_glEnd(void);
-extern HIDDEN void __indirect_glIndexd(GLdouble c);
-extern HIDDEN void __indirect_glIndexdv(const GLdouble * c);
-extern HIDDEN void __indirect_glIndexf(GLfloat c);
-extern HIDDEN void __indirect_glIndexfv(const GLfloat * c);
-extern HIDDEN void __indirect_glIndexi(GLint c);
-extern HIDDEN void __indirect_glIndexiv(const GLint * c);
-extern HIDDEN void __indirect_glIndexs(GLshort c);
-extern HIDDEN void __indirect_glIndexsv(const GLshort * c);
-extern HIDDEN void __indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
-extern HIDDEN void __indirect_glNormal3bv(const GLbyte * v);
-extern HIDDEN void __indirect_glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
-extern HIDDEN void __indirect_glNormal3dv(const GLdouble * v);
-extern HIDDEN void __indirect_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
-extern HIDDEN void __indirect_glNormal3fv(const GLfloat * v);
-extern HIDDEN void __indirect_glNormal3i(GLint nx, GLint ny, GLint nz);
-extern HIDDEN void __indirect_glNormal3iv(const GLint * v);
-extern HIDDEN void __indirect_glNormal3s(GLshort nx, GLshort ny, GLshort nz);
-extern HIDDEN void __indirect_glNormal3sv(const GLshort * v);
-extern HIDDEN void __indirect_glRasterPos2d(GLdouble x, GLdouble y);
-extern HIDDEN void __indirect_glRasterPos2dv(const GLdouble * v);
-extern HIDDEN void __indirect_glRasterPos2f(GLfloat x, GLfloat y);
-extern HIDDEN void __indirect_glRasterPos2fv(const GLfloat * v);
-extern HIDDEN void __indirect_glRasterPos2i(GLint x, GLint y);
-extern HIDDEN void __indirect_glRasterPos2iv(const GLint * v);
-extern HIDDEN void __indirect_glRasterPos2s(GLshort x, GLshort y);
-extern HIDDEN void __indirect_glRasterPos2sv(const GLshort * v);
-extern HIDDEN void __indirect_glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glRasterPos3dv(const GLdouble * v);
-extern HIDDEN void __indirect_glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glRasterPos3fv(const GLfloat * v);
-extern HIDDEN void __indirect_glRasterPos3i(GLint x, GLint y, GLint z);
-extern HIDDEN void __indirect_glRasterPos3iv(const GLint * v);
-extern HIDDEN void __indirect_glRasterPos3s(GLshort x, GLshort y, GLshort z);
-extern HIDDEN void __indirect_glRasterPos3sv(const GLshort * v);
-extern HIDDEN void __indirect_glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glRasterPos4dv(const GLdouble * v);
-extern HIDDEN void __indirect_glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glRasterPos4fv(const GLfloat * v);
-extern HIDDEN void __indirect_glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
-extern HIDDEN void __indirect_glRasterPos4iv(const GLint * v);
-extern HIDDEN void __indirect_glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
-extern HIDDEN void __indirect_glRasterPos4sv(const GLshort * v);
-extern HIDDEN void __indirect_glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
-extern HIDDEN void __indirect_glRectdv(const GLdouble * v1, const GLdouble * v2);
-extern HIDDEN void __indirect_glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
-extern HIDDEN void __indirect_glRectfv(const GLfloat * v1, const GLfloat * v2);
-extern HIDDEN void __indirect_glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
-extern HIDDEN void __indirect_glRectiv(const GLint * v1, const GLint * v2);
-extern HIDDEN void __indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
-extern HIDDEN void __indirect_glRectsv(const GLshort * v1, const GLshort * v2);
-extern HIDDEN void __indirect_glTexCoord1d(GLdouble s);
-extern HIDDEN void __indirect_glTexCoord1dv(const GLdouble * v);
-extern HIDDEN void __indirect_glTexCoord1f(GLfloat s);
-extern HIDDEN void __indirect_glTexCoord1fv(const GLfloat * v);
-extern HIDDEN void __indirect_glTexCoord1i(GLint s);
-extern HIDDEN void __indirect_glTexCoord1iv(const GLint * v);
-extern HIDDEN void __indirect_glTexCoord1s(GLshort s);
-extern HIDDEN void __indirect_glTexCoord1sv(const GLshort * v);
-extern HIDDEN void __indirect_glTexCoord2d(GLdouble s, GLdouble t);
-extern HIDDEN void __indirect_glTexCoord2dv(const GLdouble * v);
-extern HIDDEN void __indirect_glTexCoord2f(GLfloat s, GLfloat t);
-extern HIDDEN void __indirect_glTexCoord2fv(const GLfloat * v);
-extern HIDDEN void __indirect_glTexCoord2i(GLint s, GLint t);
-extern HIDDEN void __indirect_glTexCoord2iv(const GLint * v);
-extern HIDDEN void __indirect_glTexCoord2s(GLshort s, GLshort t);
-extern HIDDEN void __indirect_glTexCoord2sv(const GLshort * v);
-extern HIDDEN void __indirect_glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
-extern HIDDEN void __indirect_glTexCoord3dv(const GLdouble * v);
-extern HIDDEN void __indirect_glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
-extern HIDDEN void __indirect_glTexCoord3fv(const GLfloat * v);
-extern HIDDEN void __indirect_glTexCoord3i(GLint s, GLint t, GLint r);
-extern HIDDEN void __indirect_glTexCoord3iv(const GLint * v);
-extern HIDDEN void __indirect_glTexCoord3s(GLshort s, GLshort t, GLshort r);
-extern HIDDEN void __indirect_glTexCoord3sv(const GLshort * v);
-extern HIDDEN void __indirect_glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-extern HIDDEN void __indirect_glTexCoord4dv(const GLdouble * v);
-extern HIDDEN void __indirect_glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-extern HIDDEN void __indirect_glTexCoord4fv(const GLfloat * v);
-extern HIDDEN void __indirect_glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
-extern HIDDEN void __indirect_glTexCoord4iv(const GLint * v);
-extern HIDDEN void __indirect_glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
-extern HIDDEN void __indirect_glTexCoord4sv(const GLshort * v);
-extern HIDDEN void __indirect_glVertex2d(GLdouble x, GLdouble y);
-extern HIDDEN void __indirect_glVertex2dv(const GLdouble * v);
-extern HIDDEN void __indirect_glVertex2f(GLfloat x, GLfloat y);
-extern HIDDEN void __indirect_glVertex2fv(const GLfloat * v);
-extern HIDDEN void __indirect_glVertex2i(GLint x, GLint y);
-extern HIDDEN void __indirect_glVertex2iv(const GLint * v);
-extern HIDDEN void __indirect_glVertex2s(GLshort x, GLshort y);
-extern HIDDEN void __indirect_glVertex2sv(const GLshort * v);
-extern HIDDEN void __indirect_glVertex3d(GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glVertex3dv(const GLdouble * v);
-extern HIDDEN void __indirect_glVertex3f(GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glVertex3fv(const GLfloat * v);
-extern HIDDEN void __indirect_glVertex3i(GLint x, GLint y, GLint z);
-extern HIDDEN void __indirect_glVertex3iv(const GLint * v);
-extern HIDDEN void __indirect_glVertex3s(GLshort x, GLshort y, GLshort z);
-extern HIDDEN void __indirect_glVertex3sv(const GLshort * v);
-extern HIDDEN void __indirect_glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glVertex4dv(const GLdouble * v);
-extern HIDDEN void __indirect_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glVertex4fv(const GLfloat * v);
-extern HIDDEN void __indirect_glVertex4i(GLint x, GLint y, GLint z, GLint w);
-extern HIDDEN void __indirect_glVertex4iv(const GLint * v);
-extern HIDDEN void __indirect_glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
-extern HIDDEN void __indirect_glVertex4sv(const GLshort * v);
-extern HIDDEN void __indirect_glClipPlane(GLenum plane, const GLdouble * equation);
-extern HIDDEN void __indirect_glColorMaterial(GLenum face, GLenum mode);
-extern HIDDEN void __indirect_glCullFace(GLenum mode);
-extern HIDDEN void __indirect_glFogf(GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glFogfv(GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glFogi(GLenum pname, GLint param);
-extern HIDDEN void __indirect_glFogiv(GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glFrontFace(GLenum mode);
-extern HIDDEN void __indirect_glHint(GLenum target, GLenum mode);
-extern HIDDEN void __indirect_glLightf(GLenum light, GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glLightfv(GLenum light, GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glLighti(GLenum light, GLenum pname, GLint param);
-extern HIDDEN void __indirect_glLightiv(GLenum light, GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glLightModelf(GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glLightModelfv(GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glLightModeli(GLenum pname, GLint param);
-extern HIDDEN void __indirect_glLightModeliv(GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glLineStipple(GLint factor, GLushort pattern);
-extern HIDDEN void __indirect_glLineWidth(GLfloat width);
-extern HIDDEN void __indirect_glMaterialf(GLenum face, GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glMateriali(GLenum face, GLenum pname, GLint param);
-extern HIDDEN void __indirect_glMaterialiv(GLenum face, GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glPointSize(GLfloat size);
-extern HIDDEN void __indirect_glPolygonMode(GLenum face, GLenum mode);
-extern HIDDEN void __indirect_glPolygonStipple(const GLubyte * mask);
-extern HIDDEN void __indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
-extern HIDDEN void __indirect_glShadeModel(GLenum mode);
-extern HIDDEN void __indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glTexParameterfv(GLenum target, GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glTexParameteri(GLenum target, GLenum pname, GLint param);
-extern HIDDEN void __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
-extern HIDDEN void __indirect_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
-extern HIDDEN void __indirect_glTexEnvf(GLenum target, GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glTexEnvi(GLenum target, GLenum pname, GLint param);
-extern HIDDEN void __indirect_glTexEnviv(GLenum target, GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glTexGend(GLenum coord, GLenum pname, GLdouble param);
-extern HIDDEN void __indirect_glTexGendv(GLenum coord, GLenum pname, const GLdouble * params);
-extern HIDDEN void __indirect_glTexGenf(GLenum coord, GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glTexGenfv(GLenum coord, GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glTexGeni(GLenum coord, GLenum pname, GLint param);
-extern HIDDEN void __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glFeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer);
-extern HIDDEN void __indirect_glSelectBuffer(GLsizei size, GLuint * buffer);
-extern HIDDEN GLint __indirect_glRenderMode(GLenum mode);
-extern HIDDEN void __indirect_glInitNames(void);
-extern HIDDEN void __indirect_glLoadName(GLuint name);
-extern HIDDEN void __indirect_glPassThrough(GLfloat token);
-extern HIDDEN void __indirect_glPopName(void);
-extern HIDDEN void __indirect_glPushName(GLuint name);
-extern HIDDEN void __indirect_glDrawBuffer(GLenum mode);
-extern HIDDEN void __indirect_glClear(GLbitfield mask);
-extern HIDDEN void __indirect_glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-extern HIDDEN void __indirect_glClearIndex(GLfloat c);
-extern HIDDEN void __indirect_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-extern HIDDEN void __indirect_glClearStencil(GLint s);
-extern HIDDEN void __indirect_glClearDepth(GLclampd depth);
-extern HIDDEN void __indirect_glStencilMask(GLuint mask);
-extern HIDDEN void __indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-extern HIDDEN void __indirect_glDepthMask(GLboolean flag);
-extern HIDDEN void __indirect_glIndexMask(GLuint mask);
-extern HIDDEN void __indirect_glAccum(GLenum op, GLfloat value);
-extern HIDDEN void __indirect_glDisable(GLenum cap);
-extern HIDDEN void __indirect_glEnable(GLenum cap);
-extern HIDDEN void __indirect_glFinish(void);
-extern HIDDEN void __indirect_glFlush(void);
-extern HIDDEN void __indirect_glPopAttrib(void);
-extern HIDDEN void __indirect_glPushAttrib(GLbitfield mask);
-extern HIDDEN void __indirect_glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points);
-extern HIDDEN void __indirect_glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points);
-extern HIDDEN void __indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points);
-extern HIDDEN void __indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points);
-extern HIDDEN void __indirect_glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
-extern HIDDEN void __indirect_glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
-extern HIDDEN void __indirect_glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
-extern HIDDEN void __indirect_glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
-extern HIDDEN void __indirect_glEvalCoord1d(GLdouble u);
-extern HIDDEN void __indirect_glEvalCoord1dv(const GLdouble * u);
-extern HIDDEN void __indirect_glEvalCoord1f(GLfloat u);
-extern HIDDEN void __indirect_glEvalCoord1fv(const GLfloat * u);
-extern HIDDEN void __indirect_glEvalCoord2d(GLdouble u, GLdouble v);
-extern HIDDEN void __indirect_glEvalCoord2dv(const GLdouble * u);
-extern HIDDEN void __indirect_glEvalCoord2f(GLfloat u, GLfloat v);
-extern HIDDEN void __indirect_glEvalCoord2fv(const GLfloat * u);
-extern HIDDEN void __indirect_glEvalMesh1(GLenum mode, GLint i1, GLint i2);
-extern HIDDEN void __indirect_glEvalPoint1(GLint i);
-extern HIDDEN void __indirect_glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
-extern HIDDEN void __indirect_glEvalPoint2(GLint i, GLint j);
-extern HIDDEN void __indirect_glAlphaFunc(GLenum func, GLclampf ref);
-extern HIDDEN void __indirect_glBlendFunc(GLenum sfactor, GLenum dfactor);
-extern HIDDEN void __indirect_glLogicOp(GLenum opcode);
-extern HIDDEN void __indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask);
-extern HIDDEN void __indirect_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
-extern HIDDEN void __indirect_glDepthFunc(GLenum func);
-extern HIDDEN void __indirect_glPixelZoom(GLfloat xfactor, GLfloat yfactor);
-extern HIDDEN void __indirect_glPixelTransferf(GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glPixelTransferi(GLenum pname, GLint param);
-extern HIDDEN void __indirect_glPixelStoref(GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glPixelStorei(GLenum pname, GLint param);
-extern HIDDEN void __indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values);
-extern HIDDEN void __indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values);
-extern HIDDEN void __indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values);
-extern HIDDEN void __indirect_glReadBuffer(GLenum mode);
-extern HIDDEN void __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
-extern HIDDEN void __indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels);
-extern HIDDEN void __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels);
-extern HIDDEN void __indirect_glGetBooleanv(GLenum pname, GLboolean * params);
-extern HIDDEN void __indirect_glGetClipPlane(GLenum plane, GLdouble * equation);
-extern HIDDEN void __indirect_glGetDoublev(GLenum pname, GLdouble * params);
-extern HIDDEN GLenum __indirect_glGetError(void);
-extern HIDDEN void __indirect_glGetFloatv(GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetIntegerv(GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v);
-extern HIDDEN void __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v);
-extern HIDDEN void __indirect_glGetMapiv(GLenum target, GLenum query, GLint * v);
-extern HIDDEN void __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetPixelMapfv(GLenum map, GLfloat * values);
-extern HIDDEN void __indirect_glGetPixelMapuiv(GLenum map, GLuint * values);
-extern HIDDEN void __indirect_glGetPixelMapusv(GLenum map, GLushort * values);
-extern HIDDEN void __indirect_glGetPolygonStipple(GLubyte * mask);
-extern HIDDEN const GLubyte * __indirect_glGetString(GLenum name);
-extern HIDDEN void __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params);
-extern HIDDEN void __indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels);
-extern HIDDEN void __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint * params);
-extern HIDDEN GLboolean __indirect_glIsEnabled(GLenum cap);
-extern HIDDEN GLboolean __indirect_glIsList(GLuint list);
-extern HIDDEN void __indirect_glDepthRange(GLclampd zNear, GLclampd zFar);
-extern HIDDEN void __indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-extern HIDDEN void __indirect_glLoadIdentity(void);
-extern HIDDEN void __indirect_glLoadMatrixf(const GLfloat * m);
-extern HIDDEN void __indirect_glLoadMatrixd(const GLdouble * m);
-extern HIDDEN void __indirect_glMatrixMode(GLenum mode);
-extern HIDDEN void __indirect_glMultMatrixf(const GLfloat * m);
-extern HIDDEN void __indirect_glMultMatrixd(const GLdouble * m);
-extern HIDDEN void __indirect_glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-extern HIDDEN void __indirect_glPopMatrix(void);
-extern HIDDEN void __indirect_glPushMatrix(void);
-extern HIDDEN void __indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glScaled(GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glScalef(GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
-extern HIDDEN void __indirect_glArrayElement(GLint i);
-extern HIDDEN void __indirect_glBindTexture(GLenum target, GLuint texture);
-extern HIDDEN void __indirect_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glDisableClientState(GLenum array);
-extern HIDDEN void __indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count);
-extern HIDDEN void __indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices);
-extern HIDDEN void __indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glEnableClientState(GLenum array);
-extern HIDDEN void __indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glIndexub(GLubyte c);
-extern HIDDEN void __indirect_glIndexubv(const GLubyte * c);
-extern HIDDEN void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glNormalPointer(GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glPolygonOffset(GLfloat factor, GLfloat units);
-extern HIDDEN void __indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN GLboolean __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures, GLboolean * residences);
-GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolean * residences);
-extern HIDDEN void __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-extern HIDDEN void __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-extern HIDDEN void __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-extern HIDDEN void __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-extern HIDDEN void __indirect_glDeleteTextures(GLsizei n, const GLuint * textures);
-GLAPI void GLAPIENTRY glDeleteTexturesEXT(GLsizei n, const GLuint * textures);
-extern HIDDEN void __indirect_glGenTextures(GLsizei n, GLuint * textures);
-GLAPI void GLAPIENTRY glGenTexturesEXT(GLsizei n, GLuint * textures);
-extern HIDDEN void __indirect_glGetPointerv(GLenum pname, GLvoid ** params);
-extern HIDDEN GLboolean __indirect_glIsTexture(GLuint texture);
-GLAPI GLboolean GLAPIENTRY glIsTextureEXT(GLuint texture);
-extern HIDDEN void __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures, const GLclampf * priorities);
-extern HIDDEN void __indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels);
-extern HIDDEN void __indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels);
-extern HIDDEN void __indirect_glPopClientAttrib(void);
-extern HIDDEN void __indirect_glPushClientAttrib(GLbitfield mask);
-extern HIDDEN void __indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-extern HIDDEN void __indirect_glBlendEquation(GLenum mode);
-extern HIDDEN void __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices);
-extern HIDDEN void __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table);
-extern HIDDEN void __indirect_glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glColorTableParameteriv(GLenum target, GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-extern HIDDEN void __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * table);
-GLAPI void GLAPIENTRY glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table);
-extern HIDDEN void __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat * params);
-GLAPI void GLAPIENTRY glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, GLint * params);
-GLAPI void GLAPIENTRY glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data);
-extern HIDDEN void __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-extern HIDDEN void __indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image);
-extern HIDDEN void __indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image);
-extern HIDDEN void __indirect_glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
-extern HIDDEN void __indirect_glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params);
-extern HIDDEN void __indirect_glConvolutionParameteriv(GLenum target, GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-extern HIDDEN void __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-extern HIDDEN void __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid * image);
-extern HIDDEN void gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, GLvoid * image);
-extern HIDDEN void __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span);
-extern HIDDEN void gl_dispatch_stub_359(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span);
-extern HIDDEN void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column);
-extern HIDDEN void __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
-extern HIDDEN void gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
-extern HIDDEN void __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
-extern HIDDEN void gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
-extern HIDDEN void __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-extern HIDDEN void __indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink);
-extern HIDDEN void __indirect_glResetHistogram(GLenum target);
-extern HIDDEN void __indirect_glResetMinmax(GLenum target);
-extern HIDDEN void __indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels);
-extern HIDDEN void __indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels);
-extern HIDDEN void __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-extern HIDDEN void __indirect_glActiveTextureARB(GLenum texture);
-extern HIDDEN void __indirect_glClientActiveTextureARB(GLenum texture);
-extern HIDDEN void __indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s);
-extern HIDDEN void __indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble * v);
-extern HIDDEN void __indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s);
-extern HIDDEN void __indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat * v);
-extern HIDDEN void __indirect_glMultiTexCoord1iARB(GLenum target, GLint s);
-extern HIDDEN void __indirect_glMultiTexCoord1ivARB(GLenum target, const GLint * v);
-extern HIDDEN void __indirect_glMultiTexCoord1sARB(GLenum target, GLshort s);
-extern HIDDEN void __indirect_glMultiTexCoord1svARB(GLenum target, const GLshort * v);
-extern HIDDEN void __indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
-extern HIDDEN void __indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble * v);
-extern HIDDEN void __indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
-extern HIDDEN void __indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat * v);
-extern HIDDEN void __indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
-extern HIDDEN void __indirect_glMultiTexCoord2ivARB(GLenum target, const GLint * v);
-extern HIDDEN void __indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
-extern HIDDEN void __indirect_glMultiTexCoord2svARB(GLenum target, const GLshort * v);
-extern HIDDEN void __indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
-extern HIDDEN void __indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble * v);
-extern HIDDEN void __indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
-extern HIDDEN void __indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat * v);
-extern HIDDEN void __indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
-extern HIDDEN void __indirect_glMultiTexCoord3ivARB(GLenum target, const GLint * v);
-extern HIDDEN void __indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
-extern HIDDEN void __indirect_glMultiTexCoord3svARB(GLenum target, const GLshort * v);
-extern HIDDEN void __indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-extern HIDDEN void __indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble * v);
-extern HIDDEN void __indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-extern HIDDEN void __indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat * v);
-extern HIDDEN void __indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
-extern HIDDEN void __indirect_glMultiTexCoord4ivARB(GLenum target, const GLint * v);
-extern HIDDEN void __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-extern HIDDEN void __indirect_glMultiTexCoord4svARB(GLenum target, const GLshort * v);
-extern HIDDEN void __indirect_glLoadTransposeMatrixdARB(const GLdouble * m);
-extern HIDDEN void __indirect_glLoadTransposeMatrixfARB(const GLfloat * m);
-extern HIDDEN void __indirect_glMultTransposeMatrixdARB(const GLdouble * m);
-extern HIDDEN void __indirect_glMultTransposeMatrixfARB(const GLfloat * m);
-extern HIDDEN void __indirect_glSampleCoverageARB(GLclampf value, GLboolean invert);
-extern HIDDEN void __indirect_glCompressedTexImage1DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data);
-extern HIDDEN void __indirect_glCompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data);
-extern HIDDEN void __indirect_glCompressedTexImage3DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data);
-extern HIDDEN void __indirect_glCompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data);
-extern HIDDEN void __indirect_glCompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data);
-extern HIDDEN void __indirect_glCompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data);
-extern HIDDEN void __indirect_glGetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img);
-extern HIDDEN void __indirect_glDisableVertexAttribArrayARB(GLuint index);
-extern HIDDEN void __indirect_glEnableVertexAttribArrayARB(GLuint index);
-extern HIDDEN void __indirect_glGetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble * params);
-extern HIDDEN void __indirect_glGetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat * params);
-extern HIDDEN void __indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble * params);
-extern HIDDEN void __indirect_glGetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat * params);
-extern HIDDEN void __indirect_glGetProgramStringARB(GLenum target, GLenum pname, GLvoid * string);
-extern HIDDEN void __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble * params);
-extern HIDDEN void __indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
-extern HIDDEN void __indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
-extern HIDDEN void __indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
-extern HIDDEN void __indirect_glProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
-extern HIDDEN void __indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid * string);
-extern HIDDEN void __indirect_glVertexAttrib1dARB(GLuint index, GLdouble x);
-extern HIDDEN void __indirect_glVertexAttrib1dvARB(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib1fARB(GLuint index, GLfloat x);
-extern HIDDEN void __indirect_glVertexAttrib1fvARB(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib1sARB(GLuint index, GLshort x);
-extern HIDDEN void __indirect_glVertexAttrib1svARB(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y);
-extern HIDDEN void __indirect_glVertexAttrib2dvARB(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y);
-extern HIDDEN void __indirect_glVertexAttrib2fvARB(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib2sARB(GLuint index, GLshort x, GLshort y);
-extern HIDDEN void __indirect_glVertexAttrib2svARB(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glVertexAttrib3dvARB(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glVertexAttrib3fvARB(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z);
-extern HIDDEN void __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v);
-extern HIDDEN void __indirect_glVertexAttrib4NivARB(GLuint index, const GLint * v);
-extern HIDDEN void __indirect_glVertexAttrib4NsvARB(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-extern HIDDEN void __indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v);
-extern HIDDEN void __indirect_glVertexAttrib4NuivARB(GLuint index, const GLuint * v);
-extern HIDDEN void __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v);
-extern HIDDEN void __indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte * v);
-extern HIDDEN void __indirect_glVertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glVertexAttrib4dvARB(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glVertexAttrib4fvARB(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib4ivARB(GLuint index, const GLint * v);
-extern HIDDEN void __indirect_glVertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-extern HIDDEN void __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v);
-extern HIDDEN void __indirect_glVertexAttrib4uivARB(GLuint index, const GLuint * v);
-extern HIDDEN void __indirect_glVertexAttrib4usvARB(GLuint index, const GLushort * v);
-extern HIDDEN void __indirect_glVertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glBeginQueryARB(GLenum target, GLuint id);
-extern HIDDEN void __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids);
-extern HIDDEN void __indirect_glEndQueryARB(GLenum target);
-extern HIDDEN void __indirect_glGenQueriesARB(GLsizei n, GLuint * ids);
-extern HIDDEN void __indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params);
-extern HIDDEN void __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN GLboolean __indirect_glIsQueryARB(GLuint id);
-extern HIDDEN void __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs);
-extern HIDDEN void __indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-extern HIDDEN void __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert);
-extern HIDDEN void __indirect_glSamplePatternSGIS(GLenum pattern);
-extern HIDDEN void __indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
-extern HIDDEN void __indirect_glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean * pointer);
-extern HIDDEN void __indirect_glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
-extern HIDDEN void __indirect_glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
-extern HIDDEN void __indirect_glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
-extern HIDDEN void __indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);
-extern HIDDEN void __indirect_glPointParameterfEXT(GLenum pname, GLfloat param);
-extern HIDDEN void __indirect_glPointParameterfvEXT(GLenum pname, const GLfloat * params);
-extern HIDDEN void __indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue);
-extern HIDDEN void __indirect_glSecondaryColor3bvEXT(const GLbyte * v);
-extern HIDDEN void __indirect_glSecondaryColor3dEXT(GLdouble red, GLdouble green, GLdouble blue);
-extern HIDDEN void __indirect_glSecondaryColor3dvEXT(const GLdouble * v);
-extern HIDDEN void __indirect_glSecondaryColor3fEXT(GLfloat red, GLfloat green, GLfloat blue);
-extern HIDDEN void __indirect_glSecondaryColor3fvEXT(const GLfloat * v);
-extern HIDDEN void __indirect_glSecondaryColor3iEXT(GLint red, GLint green, GLint blue);
-extern HIDDEN void __indirect_glSecondaryColor3ivEXT(const GLint * v);
-extern HIDDEN void __indirect_glSecondaryColor3sEXT(GLshort red, GLshort green, GLshort blue);
-extern HIDDEN void __indirect_glSecondaryColor3svEXT(const GLshort * v);
-extern HIDDEN void __indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue);
-extern HIDDEN void __indirect_glSecondaryColor3ubvEXT(const GLubyte * v);
-extern HIDDEN void __indirect_glSecondaryColor3uiEXT(GLuint red, GLuint green, GLuint blue);
-extern HIDDEN void __indirect_glSecondaryColor3uivEXT(const GLuint * v);
-extern HIDDEN void __indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue);
-extern HIDDEN void __indirect_glSecondaryColor3usvEXT(const GLushort * v);
-extern HIDDEN void __indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
-extern HIDDEN void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount);
-extern HIDDEN void __indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glFogCoorddEXT(GLdouble coord);
-extern HIDDEN void __indirect_glFogCoorddvEXT(const GLdouble * coord);
-extern HIDDEN void __indirect_glFogCoordfEXT(GLfloat coord);
-extern HIDDEN void __indirect_glFogCoordfvEXT(const GLfloat * coord);
-extern HIDDEN void __indirect_glBlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-extern HIDDEN void __indirect_glWindowPos2dMESA(GLdouble x, GLdouble y);
-extern HIDDEN void __indirect_glWindowPos2dvMESA(const GLdouble * v);
-extern HIDDEN void __indirect_glWindowPos2fMESA(GLfloat x, GLfloat y);
-extern HIDDEN void __indirect_glWindowPos2fvMESA(const GLfloat * v);
-extern HIDDEN void __indirect_glWindowPos2iMESA(GLint x, GLint y);
-extern HIDDEN void __indirect_glWindowPos2ivMESA(const GLint * v);
-extern HIDDEN void __indirect_glWindowPos2sMESA(GLshort x, GLshort y);
-extern HIDDEN void __indirect_glWindowPos2svMESA(const GLshort * v);
-extern HIDDEN void __indirect_glWindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glWindowPos3dvMESA(const GLdouble * v);
-extern HIDDEN void __indirect_glWindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glWindowPos3fvMESA(const GLfloat * v);
-extern HIDDEN void __indirect_glWindowPos3iMESA(GLint x, GLint y, GLint z);
-extern HIDDEN void __indirect_glWindowPos3ivMESA(const GLint * v);
-extern HIDDEN void __indirect_glWindowPos3sMESA(GLshort x, GLshort y, GLshort z);
-extern HIDDEN void __indirect_glWindowPos3svMESA(const GLshort * v);
-extern HIDDEN GLboolean __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids, GLboolean * residences);
-extern HIDDEN void __indirect_glBindProgramNV(GLenum target, GLuint program);
-extern HIDDEN void __indirect_glDeleteProgramsNV(GLsizei n, const GLuint * programs);
-extern HIDDEN void __indirect_glExecuteProgramNV(GLenum target, GLuint id, const GLfloat * params);
-extern HIDDEN void __indirect_glGenProgramsNV(GLsizei n, GLuint * programs);
-extern HIDDEN void __indirect_glGetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble * params);
-extern HIDDEN void __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program);
-extern HIDDEN void __indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** pointer);
-extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params);
-extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params);
-extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);
-extern HIDDEN GLboolean __indirect_glIsProgramNV(GLuint program);
-extern HIDDEN void __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte * program);
-extern HIDDEN void __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble * params);
-extern HIDDEN void __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat * params);
-extern HIDDEN void __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids);
-extern HIDDEN void __indirect_glTrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform);
-extern HIDDEN void __indirect_glVertexAttrib1dNV(GLuint index, GLdouble x);
-extern HIDDEN void __indirect_glVertexAttrib1dvNV(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib1fNV(GLuint index, GLfloat x);
-extern HIDDEN void __indirect_glVertexAttrib1fvNV(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib1sNV(GLuint index, GLshort x);
-extern HIDDEN void __indirect_glVertexAttrib1svNV(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y);
-extern HIDDEN void __indirect_glVertexAttrib2dvNV(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y);
-extern HIDDEN void __indirect_glVertexAttrib2fvNV(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib2sNV(GLuint index, GLshort x, GLshort y);
-extern HIDDEN void __indirect_glVertexAttrib2svNV(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z);
-extern HIDDEN void __indirect_glVertexAttrib3dvNV(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z);
-extern HIDDEN void __indirect_glVertexAttrib3fvNV(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z);
-extern HIDDEN void __indirect_glVertexAttrib3svNV(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glVertexAttrib4dvNV(GLuint index, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glVertexAttrib4fvNV(GLuint index, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-extern HIDDEN void __indirect_glVertexAttrib4svNV(GLuint index, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-extern HIDDEN void __indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v);
-extern HIDDEN void __indirect_glVertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v);
-extern HIDDEN void __indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v);
-extern HIDDEN void __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v);
-extern HIDDEN void __indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v);
-extern HIDDEN void __indirect_glPointParameteriNV(GLenum pname, GLint param);
-extern HIDDEN void __indirect_glPointParameterivNV(GLenum pname, const GLint * params);
-extern HIDDEN void __indirect_glActiveStencilFaceEXT(GLenum face);
-extern HIDDEN void __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params);
-extern HIDDEN void __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params);
-extern HIDDEN void __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v);
-extern HIDDEN void __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v);
-extern HIDDEN void __indirect_glBlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA);
-extern HIDDEN void __indirect_glBindFramebufferEXT(GLenum target, GLuint framebuffer);
-extern HIDDEN void __indirect_glBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
-extern HIDDEN GLenum __indirect_glCheckFramebufferStatusEXT(GLenum target);
-extern HIDDEN void __indirect_glDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers);
-extern HIDDEN void __indirect_glDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers);
-extern HIDDEN void __indirect_glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-extern HIDDEN void __indirect_glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-extern HIDDEN void __indirect_glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-extern HIDDEN void __indirect_glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-extern HIDDEN void __indirect_glGenFramebuffersEXT(GLsizei n, GLuint * framebuffers);
-extern HIDDEN void __indirect_glGenRenderbuffersEXT(GLsizei n, GLuint * renderbuffers);
-extern HIDDEN void __indirect_glGenerateMipmapEXT(GLenum target);
-extern HIDDEN void __indirect_glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint * params);
-extern HIDDEN void __indirect_glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint * params);
-extern HIDDEN GLboolean __indirect_glIsFramebufferEXT(GLuint framebuffer);
-extern HIDDEN GLboolean __indirect_glIsRenderbufferEXT(GLuint renderbuffer);
-extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-extern HIDDEN void __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-
-#  undef HIDDEN
-#  undef FASTCALL
-#  undef NOINLINE
-
-#endif /* !defined( _INDIRECT_H_ ) */
diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c
deleted file mode 100644 (file)
index 73ca993..0000000
+++ /dev/null
@@ -1,785 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_send.py (from Mesa) script */
-
-/*
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * (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
- * 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
- * PRECISION INSIGHT, 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 indirect_init.c
- * Initialize indirect rendering dispatch table.
- *
- * \author Kevin E. Martin <kevin@precisioninsight.com>
- * \author Brian Paul <brian@precisioninsight.com>
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "indirect_init.h"
-#include "indirect.h"
-#include "glapi.h"
-
-
-/**
- * No-op function used to initialize functions that have no GLX protocol
- * support.
- */
-static int NoOp(void)
-{
-    return 0;
-}
-
-/**
- * Create and initialize a new GL dispatch table.  The table is initialized
- * with GLX indirect rendering protocol functions.
- */
-__GLapi * __glXNewIndirectAPI( void )
-{
-    __GLapi *glAPI;
-    GLuint entries;
-
-    entries = _glapi_get_dispatch_table_size();
-    glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *));
-
-    /* first, set all entries to point to no-op functions */
-    {
-       int i;
-       void **dispatch = (void **) glAPI;
-       for (i = 0; i < entries; i++) {
-          dispatch[i] = (void *) NoOp;
-       }
-    }
-
-    /* now, initialize the entries we understand */
-
-    /* 1.0 */
-
-    glAPI->Accum = __indirect_glAccum;
-    glAPI->AlphaFunc = __indirect_glAlphaFunc;
-    glAPI->Begin = __indirect_glBegin;
-    glAPI->Bitmap = __indirect_glBitmap;
-    glAPI->BlendFunc = __indirect_glBlendFunc;
-    glAPI->CallList = __indirect_glCallList;
-    glAPI->CallLists = __indirect_glCallLists;
-    glAPI->Clear = __indirect_glClear;
-    glAPI->ClearAccum = __indirect_glClearAccum;
-    glAPI->ClearColor = __indirect_glClearColor;
-    glAPI->ClearDepth = __indirect_glClearDepth;
-    glAPI->ClearIndex = __indirect_glClearIndex;
-    glAPI->ClearStencil = __indirect_glClearStencil;
-    glAPI->ClipPlane = __indirect_glClipPlane;
-    glAPI->Color3b = __indirect_glColor3b;
-    glAPI->Color3bv = __indirect_glColor3bv;
-    glAPI->Color3d = __indirect_glColor3d;
-    glAPI->Color3dv = __indirect_glColor3dv;
-    glAPI->Color3f = __indirect_glColor3f;
-    glAPI->Color3fv = __indirect_glColor3fv;
-    glAPI->Color3i = __indirect_glColor3i;
-    glAPI->Color3iv = __indirect_glColor3iv;
-    glAPI->Color3s = __indirect_glColor3s;
-    glAPI->Color3sv = __indirect_glColor3sv;
-    glAPI->Color3ub = __indirect_glColor3ub;
-    glAPI->Color3ubv = __indirect_glColor3ubv;
-    glAPI->Color3ui = __indirect_glColor3ui;
-    glAPI->Color3uiv = __indirect_glColor3uiv;
-    glAPI->Color3us = __indirect_glColor3us;
-    glAPI->Color3usv = __indirect_glColor3usv;
-    glAPI->Color4b = __indirect_glColor4b;
-    glAPI->Color4bv = __indirect_glColor4bv;
-    glAPI->Color4d = __indirect_glColor4d;
-    glAPI->Color4dv = __indirect_glColor4dv;
-    glAPI->Color4f = __indirect_glColor4f;
-    glAPI->Color4fv = __indirect_glColor4fv;
-    glAPI->Color4i = __indirect_glColor4i;
-    glAPI->Color4iv = __indirect_glColor4iv;
-    glAPI->Color4s = __indirect_glColor4s;
-    glAPI->Color4sv = __indirect_glColor4sv;
-    glAPI->Color4ub = __indirect_glColor4ub;
-    glAPI->Color4ubv = __indirect_glColor4ubv;
-    glAPI->Color4ui = __indirect_glColor4ui;
-    glAPI->Color4uiv = __indirect_glColor4uiv;
-    glAPI->Color4us = __indirect_glColor4us;
-    glAPI->Color4usv = __indirect_glColor4usv;
-    glAPI->ColorMask = __indirect_glColorMask;
-    glAPI->ColorMaterial = __indirect_glColorMaterial;
-    glAPI->CopyPixels = __indirect_glCopyPixels;
-    glAPI->CullFace = __indirect_glCullFace;
-    glAPI->DeleteLists = __indirect_glDeleteLists;
-    glAPI->DepthFunc = __indirect_glDepthFunc;
-    glAPI->DepthMask = __indirect_glDepthMask;
-    glAPI->DepthRange = __indirect_glDepthRange;
-    glAPI->Disable = __indirect_glDisable;
-    glAPI->DrawBuffer = __indirect_glDrawBuffer;
-    glAPI->DrawPixels = __indirect_glDrawPixels;
-    glAPI->EdgeFlag = __indirect_glEdgeFlag;
-    glAPI->EdgeFlagv = __indirect_glEdgeFlagv;
-    glAPI->Enable = __indirect_glEnable;
-    glAPI->End = __indirect_glEnd;
-    glAPI->EndList = __indirect_glEndList;
-    glAPI->EvalCoord1d = __indirect_glEvalCoord1d;
-    glAPI->EvalCoord1dv = __indirect_glEvalCoord1dv;
-    glAPI->EvalCoord1f = __indirect_glEvalCoord1f;
-    glAPI->EvalCoord1fv = __indirect_glEvalCoord1fv;
-    glAPI->EvalCoord2d = __indirect_glEvalCoord2d;
-    glAPI->EvalCoord2dv = __indirect_glEvalCoord2dv;
-    glAPI->EvalCoord2f = __indirect_glEvalCoord2f;
-    glAPI->EvalCoord2fv = __indirect_glEvalCoord2fv;
-    glAPI->EvalMesh1 = __indirect_glEvalMesh1;
-    glAPI->EvalMesh2 = __indirect_glEvalMesh2;
-    glAPI->EvalPoint1 = __indirect_glEvalPoint1;
-    glAPI->EvalPoint2 = __indirect_glEvalPoint2;
-    glAPI->FeedbackBuffer = __indirect_glFeedbackBuffer;
-    glAPI->Finish = __indirect_glFinish;
-    glAPI->Flush = __indirect_glFlush;
-    glAPI->Fogf = __indirect_glFogf;
-    glAPI->Fogfv = __indirect_glFogfv;
-    glAPI->Fogi = __indirect_glFogi;
-    glAPI->Fogiv = __indirect_glFogiv;
-    glAPI->FrontFace = __indirect_glFrontFace;
-    glAPI->Frustum = __indirect_glFrustum;
-    glAPI->GenLists = __indirect_glGenLists;
-    glAPI->GetBooleanv = __indirect_glGetBooleanv;
-    glAPI->GetClipPlane = __indirect_glGetClipPlane;
-    glAPI->GetDoublev = __indirect_glGetDoublev;
-    glAPI->GetError = __indirect_glGetError;
-    glAPI->GetFloatv = __indirect_glGetFloatv;
-    glAPI->GetIntegerv = __indirect_glGetIntegerv;
-    glAPI->GetLightfv = __indirect_glGetLightfv;
-    glAPI->GetLightiv = __indirect_glGetLightiv;
-    glAPI->GetMapdv = __indirect_glGetMapdv;
-    glAPI->GetMapfv = __indirect_glGetMapfv;
-    glAPI->GetMapiv = __indirect_glGetMapiv;
-    glAPI->GetMaterialfv = __indirect_glGetMaterialfv;
-    glAPI->GetMaterialiv = __indirect_glGetMaterialiv;
-    glAPI->GetPixelMapfv = __indirect_glGetPixelMapfv;
-    glAPI->GetPixelMapuiv = __indirect_glGetPixelMapuiv;
-    glAPI->GetPixelMapusv = __indirect_glGetPixelMapusv;
-    glAPI->GetPolygonStipple = __indirect_glGetPolygonStipple;
-    glAPI->GetString = __indirect_glGetString;
-    glAPI->GetTexEnvfv = __indirect_glGetTexEnvfv;
-    glAPI->GetTexEnviv = __indirect_glGetTexEnviv;
-    glAPI->GetTexGendv = __indirect_glGetTexGendv;
-    glAPI->GetTexGenfv = __indirect_glGetTexGenfv;
-    glAPI->GetTexGeniv = __indirect_glGetTexGeniv;
-    glAPI->GetTexImage = __indirect_glGetTexImage;
-    glAPI->GetTexLevelParameterfv = __indirect_glGetTexLevelParameterfv;
-    glAPI->GetTexLevelParameteriv = __indirect_glGetTexLevelParameteriv;
-    glAPI->GetTexParameterfv = __indirect_glGetTexParameterfv;
-    glAPI->GetTexParameteriv = __indirect_glGetTexParameteriv;
-    glAPI->Hint = __indirect_glHint;
-    glAPI->IndexMask = __indirect_glIndexMask;
-    glAPI->Indexd = __indirect_glIndexd;
-    glAPI->Indexdv = __indirect_glIndexdv;
-    glAPI->Indexf = __indirect_glIndexf;
-    glAPI->Indexfv = __indirect_glIndexfv;
-    glAPI->Indexi = __indirect_glIndexi;
-    glAPI->Indexiv = __indirect_glIndexiv;
-    glAPI->Indexs = __indirect_glIndexs;
-    glAPI->Indexsv = __indirect_glIndexsv;
-    glAPI->InitNames = __indirect_glInitNames;
-    glAPI->IsEnabled = __indirect_glIsEnabled;
-    glAPI->IsList = __indirect_glIsList;
-    glAPI->LightModelf = __indirect_glLightModelf;
-    glAPI->LightModelfv = __indirect_glLightModelfv;
-    glAPI->LightModeli = __indirect_glLightModeli;
-    glAPI->LightModeliv = __indirect_glLightModeliv;
-    glAPI->Lightf = __indirect_glLightf;
-    glAPI->Lightfv = __indirect_glLightfv;
-    glAPI->Lighti = __indirect_glLighti;
-    glAPI->Lightiv = __indirect_glLightiv;
-    glAPI->LineStipple = __indirect_glLineStipple;
-    glAPI->LineWidth = __indirect_glLineWidth;
-    glAPI->ListBase = __indirect_glListBase;
-    glAPI->LoadIdentity = __indirect_glLoadIdentity;
-    glAPI->LoadMatrixd = __indirect_glLoadMatrixd;
-    glAPI->LoadMatrixf = __indirect_glLoadMatrixf;
-    glAPI->LoadName = __indirect_glLoadName;
-    glAPI->LogicOp = __indirect_glLogicOp;
-    glAPI->Map1d = __indirect_glMap1d;
-    glAPI->Map1f = __indirect_glMap1f;
-    glAPI->Map2d = __indirect_glMap2d;
-    glAPI->Map2f = __indirect_glMap2f;
-    glAPI->MapGrid1d = __indirect_glMapGrid1d;
-    glAPI->MapGrid1f = __indirect_glMapGrid1f;
-    glAPI->MapGrid2d = __indirect_glMapGrid2d;
-    glAPI->MapGrid2f = __indirect_glMapGrid2f;
-    glAPI->Materialf = __indirect_glMaterialf;
-    glAPI->Materialfv = __indirect_glMaterialfv;
-    glAPI->Materiali = __indirect_glMateriali;
-    glAPI->Materialiv = __indirect_glMaterialiv;
-    glAPI->MatrixMode = __indirect_glMatrixMode;
-    glAPI->MultMatrixd = __indirect_glMultMatrixd;
-    glAPI->MultMatrixf = __indirect_glMultMatrixf;
-    glAPI->NewList = __indirect_glNewList;
-    glAPI->Normal3b = __indirect_glNormal3b;
-    glAPI->Normal3bv = __indirect_glNormal3bv;
-    glAPI->Normal3d = __indirect_glNormal3d;
-    glAPI->Normal3dv = __indirect_glNormal3dv;
-    glAPI->Normal3f = __indirect_glNormal3f;
-    glAPI->Normal3fv = __indirect_glNormal3fv;
-    glAPI->Normal3i = __indirect_glNormal3i;
-    glAPI->Normal3iv = __indirect_glNormal3iv;
-    glAPI->Normal3s = __indirect_glNormal3s;
-    glAPI->Normal3sv = __indirect_glNormal3sv;
-    glAPI->Ortho = __indirect_glOrtho;
-    glAPI->PassThrough = __indirect_glPassThrough;
-    glAPI->PixelMapfv = __indirect_glPixelMapfv;
-    glAPI->PixelMapuiv = __indirect_glPixelMapuiv;
-    glAPI->PixelMapusv = __indirect_glPixelMapusv;
-    glAPI->PixelStoref = __indirect_glPixelStoref;
-    glAPI->PixelStorei = __indirect_glPixelStorei;
-    glAPI->PixelTransferf = __indirect_glPixelTransferf;
-    glAPI->PixelTransferi = __indirect_glPixelTransferi;
-    glAPI->PixelZoom = __indirect_glPixelZoom;
-    glAPI->PointSize = __indirect_glPointSize;
-    glAPI->PolygonMode = __indirect_glPolygonMode;
-    glAPI->PolygonStipple = __indirect_glPolygonStipple;
-    glAPI->PopAttrib = __indirect_glPopAttrib;
-    glAPI->PopMatrix = __indirect_glPopMatrix;
-    glAPI->PopName = __indirect_glPopName;
-    glAPI->PushAttrib = __indirect_glPushAttrib;
-    glAPI->PushMatrix = __indirect_glPushMatrix;
-    glAPI->PushName = __indirect_glPushName;
-    glAPI->RasterPos2d = __indirect_glRasterPos2d;
-    glAPI->RasterPos2dv = __indirect_glRasterPos2dv;
-    glAPI->RasterPos2f = __indirect_glRasterPos2f;
-    glAPI->RasterPos2fv = __indirect_glRasterPos2fv;
-    glAPI->RasterPos2i = __indirect_glRasterPos2i;
-    glAPI->RasterPos2iv = __indirect_glRasterPos2iv;
-    glAPI->RasterPos2s = __indirect_glRasterPos2s;
-    glAPI->RasterPos2sv = __indirect_glRasterPos2sv;
-    glAPI->RasterPos3d = __indirect_glRasterPos3d;
-    glAPI->RasterPos3dv = __indirect_glRasterPos3dv;
-    glAPI->RasterPos3f = __indirect_glRasterPos3f;
-    glAPI->RasterPos3fv = __indirect_glRasterPos3fv;
-    glAPI->RasterPos3i = __indirect_glRasterPos3i;
-    glAPI->RasterPos3iv = __indirect_glRasterPos3iv;
-    glAPI->RasterPos3s = __indirect_glRasterPos3s;
-    glAPI->RasterPos3sv = __indirect_glRasterPos3sv;
-    glAPI->RasterPos4d = __indirect_glRasterPos4d;
-    glAPI->RasterPos4dv = __indirect_glRasterPos4dv;
-    glAPI->RasterPos4f = __indirect_glRasterPos4f;
-    glAPI->RasterPos4fv = __indirect_glRasterPos4fv;
-    glAPI->RasterPos4i = __indirect_glRasterPos4i;
-    glAPI->RasterPos4iv = __indirect_glRasterPos4iv;
-    glAPI->RasterPos4s = __indirect_glRasterPos4s;
-    glAPI->RasterPos4sv = __indirect_glRasterPos4sv;
-    glAPI->ReadBuffer = __indirect_glReadBuffer;
-    glAPI->ReadPixels = __indirect_glReadPixels;
-    glAPI->Rectd = __indirect_glRectd;
-    glAPI->Rectdv = __indirect_glRectdv;
-    glAPI->Rectf = __indirect_glRectf;
-    glAPI->Rectfv = __indirect_glRectfv;
-    glAPI->Recti = __indirect_glRecti;
-    glAPI->Rectiv = __indirect_glRectiv;
-    glAPI->Rects = __indirect_glRects;
-    glAPI->Rectsv = __indirect_glRectsv;
-    glAPI->RenderMode = __indirect_glRenderMode;
-    glAPI->Rotated = __indirect_glRotated;
-    glAPI->Rotatef = __indirect_glRotatef;
-    glAPI->Scaled = __indirect_glScaled;
-    glAPI->Scalef = __indirect_glScalef;
-    glAPI->Scissor = __indirect_glScissor;
-    glAPI->SelectBuffer = __indirect_glSelectBuffer;
-    glAPI->ShadeModel = __indirect_glShadeModel;
-    glAPI->StencilFunc = __indirect_glStencilFunc;
-    glAPI->StencilMask = __indirect_glStencilMask;
-    glAPI->StencilOp = __indirect_glStencilOp;
-    glAPI->TexCoord1d = __indirect_glTexCoord1d;
-    glAPI->TexCoord1dv = __indirect_glTexCoord1dv;
-    glAPI->TexCoord1f = __indirect_glTexCoord1f;
-    glAPI->TexCoord1fv = __indirect_glTexCoord1fv;
-    glAPI->TexCoord1i = __indirect_glTexCoord1i;
-    glAPI->TexCoord1iv = __indirect_glTexCoord1iv;
-    glAPI->TexCoord1s = __indirect_glTexCoord1s;
-    glAPI->TexCoord1sv = __indirect_glTexCoord1sv;
-    glAPI->TexCoord2d = __indirect_glTexCoord2d;
-    glAPI->TexCoord2dv = __indirect_glTexCoord2dv;
-    glAPI->TexCoord2f = __indirect_glTexCoord2f;
-    glAPI->TexCoord2fv = __indirect_glTexCoord2fv;
-    glAPI->TexCoord2i = __indirect_glTexCoord2i;
-    glAPI->TexCoord2iv = __indirect_glTexCoord2iv;
-    glAPI->TexCoord2s = __indirect_glTexCoord2s;
-    glAPI->TexCoord2sv = __indirect_glTexCoord2sv;
-    glAPI->TexCoord3d = __indirect_glTexCoord3d;
-    glAPI->TexCoord3dv = __indirect_glTexCoord3dv;
-    glAPI->TexCoord3f = __indirect_glTexCoord3f;
-    glAPI->TexCoord3fv = __indirect_glTexCoord3fv;
-    glAPI->TexCoord3i = __indirect_glTexCoord3i;
-    glAPI->TexCoord3iv = __indirect_glTexCoord3iv;
-    glAPI->TexCoord3s = __indirect_glTexCoord3s;
-    glAPI->TexCoord3sv = __indirect_glTexCoord3sv;
-    glAPI->TexCoord4d = __indirect_glTexCoord4d;
-    glAPI->TexCoord4dv = __indirect_glTexCoord4dv;
-    glAPI->TexCoord4f = __indirect_glTexCoord4f;
-    glAPI->TexCoord4fv = __indirect_glTexCoord4fv;
-    glAPI->TexCoord4i = __indirect_glTexCoord4i;
-    glAPI->TexCoord4iv = __indirect_glTexCoord4iv;
-    glAPI->TexCoord4s = __indirect_glTexCoord4s;
-    glAPI->TexCoord4sv = __indirect_glTexCoord4sv;
-    glAPI->TexEnvf = __indirect_glTexEnvf;
-    glAPI->TexEnvfv = __indirect_glTexEnvfv;
-    glAPI->TexEnvi = __indirect_glTexEnvi;
-    glAPI->TexEnviv = __indirect_glTexEnviv;
-    glAPI->TexGend = __indirect_glTexGend;
-    glAPI->TexGendv = __indirect_glTexGendv;
-    glAPI->TexGenf = __indirect_glTexGenf;
-    glAPI->TexGenfv = __indirect_glTexGenfv;
-    glAPI->TexGeni = __indirect_glTexGeni;
-    glAPI->TexGeniv = __indirect_glTexGeniv;
-    glAPI->TexImage1D = __indirect_glTexImage1D;
-    glAPI->TexImage2D = __indirect_glTexImage2D;
-    glAPI->TexParameterf = __indirect_glTexParameterf;
-    glAPI->TexParameterfv = __indirect_glTexParameterfv;
-    glAPI->TexParameteri = __indirect_glTexParameteri;
-    glAPI->TexParameteriv = __indirect_glTexParameteriv;
-    glAPI->Translated = __indirect_glTranslated;
-    glAPI->Translatef = __indirect_glTranslatef;
-    glAPI->Vertex2d = __indirect_glVertex2d;
-    glAPI->Vertex2dv = __indirect_glVertex2dv;
-    glAPI->Vertex2f = __indirect_glVertex2f;
-    glAPI->Vertex2fv = __indirect_glVertex2fv;
-    glAPI->Vertex2i = __indirect_glVertex2i;
-    glAPI->Vertex2iv = __indirect_glVertex2iv;
-    glAPI->Vertex2s = __indirect_glVertex2s;
-    glAPI->Vertex2sv = __indirect_glVertex2sv;
-    glAPI->Vertex3d = __indirect_glVertex3d;
-    glAPI->Vertex3dv = __indirect_glVertex3dv;
-    glAPI->Vertex3f = __indirect_glVertex3f;
-    glAPI->Vertex3fv = __indirect_glVertex3fv;
-    glAPI->Vertex3i = __indirect_glVertex3i;
-    glAPI->Vertex3iv = __indirect_glVertex3iv;
-    glAPI->Vertex3s = __indirect_glVertex3s;
-    glAPI->Vertex3sv = __indirect_glVertex3sv;
-    glAPI->Vertex4d = __indirect_glVertex4d;
-    glAPI->Vertex4dv = __indirect_glVertex4dv;
-    glAPI->Vertex4f = __indirect_glVertex4f;
-    glAPI->Vertex4fv = __indirect_glVertex4fv;
-    glAPI->Vertex4i = __indirect_glVertex4i;
-    glAPI->Vertex4iv = __indirect_glVertex4iv;
-    glAPI->Vertex4s = __indirect_glVertex4s;
-    glAPI->Vertex4sv = __indirect_glVertex4sv;
-    glAPI->Viewport = __indirect_glViewport;
-
-    /* 1.1 */
-
-    glAPI->AreTexturesResident = __indirect_glAreTexturesResident;
-    glAPI->ArrayElement = __indirect_glArrayElement;
-    glAPI->BindTexture = __indirect_glBindTexture;
-    glAPI->ColorPointer = __indirect_glColorPointer;
-    glAPI->CopyTexImage1D = __indirect_glCopyTexImage1D;
-    glAPI->CopyTexImage2D = __indirect_glCopyTexImage2D;
-    glAPI->CopyTexSubImage1D = __indirect_glCopyTexSubImage1D;
-    glAPI->CopyTexSubImage2D = __indirect_glCopyTexSubImage2D;
-    glAPI->DeleteTextures = __indirect_glDeleteTextures;
-    glAPI->DisableClientState = __indirect_glDisableClientState;
-    glAPI->DrawArrays = __indirect_glDrawArrays;
-    glAPI->DrawElements = __indirect_glDrawElements;
-    glAPI->EdgeFlagPointer = __indirect_glEdgeFlagPointer;
-    glAPI->EnableClientState = __indirect_glEnableClientState;
-    glAPI->GenTextures = __indirect_glGenTextures;
-    glAPI->GetPointerv = __indirect_glGetPointerv;
-    glAPI->IndexPointer = __indirect_glIndexPointer;
-    glAPI->Indexub = __indirect_glIndexub;
-    glAPI->Indexubv = __indirect_glIndexubv;
-    glAPI->InterleavedArrays = __indirect_glInterleavedArrays;
-    glAPI->IsTexture = __indirect_glIsTexture;
-    glAPI->NormalPointer = __indirect_glNormalPointer;
-    glAPI->PolygonOffset = __indirect_glPolygonOffset;
-    glAPI->PopClientAttrib = __indirect_glPopClientAttrib;
-    glAPI->PrioritizeTextures = __indirect_glPrioritizeTextures;
-    glAPI->PushClientAttrib = __indirect_glPushClientAttrib;
-    glAPI->TexCoordPointer = __indirect_glTexCoordPointer;
-    glAPI->TexSubImage1D = __indirect_glTexSubImage1D;
-    glAPI->TexSubImage2D = __indirect_glTexSubImage2D;
-    glAPI->VertexPointer = __indirect_glVertexPointer;
-
-    /* 1.2 */
-
-    glAPI->BlendColor = __indirect_glBlendColor;
-    glAPI->BlendEquation = __indirect_glBlendEquation;
-    glAPI->ColorSubTable = __indirect_glColorSubTable;
-    glAPI->ColorTable = __indirect_glColorTable;
-    glAPI->ColorTableParameterfv = __indirect_glColorTableParameterfv;
-    glAPI->ColorTableParameteriv = __indirect_glColorTableParameteriv;
-    glAPI->ConvolutionFilter1D = __indirect_glConvolutionFilter1D;
-    glAPI->ConvolutionFilter2D = __indirect_glConvolutionFilter2D;
-    glAPI->ConvolutionParameterf = __indirect_glConvolutionParameterf;
-    glAPI->ConvolutionParameterfv = __indirect_glConvolutionParameterfv;
-    glAPI->ConvolutionParameteri = __indirect_glConvolutionParameteri;
-    glAPI->ConvolutionParameteriv = __indirect_glConvolutionParameteriv;
-    glAPI->CopyColorSubTable = __indirect_glCopyColorSubTable;
-    glAPI->CopyColorTable = __indirect_glCopyColorTable;
-    glAPI->CopyConvolutionFilter1D = __indirect_glCopyConvolutionFilter1D;
-    glAPI->CopyConvolutionFilter2D = __indirect_glCopyConvolutionFilter2D;
-    glAPI->CopyTexSubImage3D = __indirect_glCopyTexSubImage3D;
-    glAPI->DrawRangeElements = __indirect_glDrawRangeElements;
-    glAPI->GetColorTable = __indirect_glGetColorTable;
-    glAPI->GetColorTableParameterfv = __indirect_glGetColorTableParameterfv;
-    glAPI->GetColorTableParameteriv = __indirect_glGetColorTableParameteriv;
-    glAPI->GetConvolutionFilter = __indirect_glGetConvolutionFilter;
-    glAPI->GetConvolutionParameterfv = __indirect_glGetConvolutionParameterfv;
-    glAPI->GetConvolutionParameteriv = __indirect_glGetConvolutionParameteriv;
-    glAPI->GetHistogram = __indirect_glGetHistogram;
-    glAPI->GetHistogramParameterfv = __indirect_glGetHistogramParameterfv;
-    glAPI->GetHistogramParameteriv = __indirect_glGetHistogramParameteriv;
-    glAPI->GetMinmax = __indirect_glGetMinmax;
-    glAPI->GetMinmaxParameterfv = __indirect_glGetMinmaxParameterfv;
-    glAPI->GetMinmaxParameteriv = __indirect_glGetMinmaxParameteriv;
-    glAPI->GetSeparableFilter = __indirect_glGetSeparableFilter;
-    glAPI->Histogram = __indirect_glHistogram;
-    glAPI->Minmax = __indirect_glMinmax;
-    glAPI->ResetHistogram = __indirect_glResetHistogram;
-    glAPI->ResetMinmax = __indirect_glResetMinmax;
-    glAPI->SeparableFilter2D = __indirect_glSeparableFilter2D;
-    glAPI->TexImage3D = __indirect_glTexImage3D;
-    glAPI->TexSubImage3D = __indirect_glTexSubImage3D;
-
-    /*   1. GL_ARB_multitexture */
-
-    glAPI->ActiveTextureARB = __indirect_glActiveTextureARB;
-    glAPI->ClientActiveTextureARB = __indirect_glClientActiveTextureARB;
-    glAPI->MultiTexCoord1dARB = __indirect_glMultiTexCoord1dARB;
-    glAPI->MultiTexCoord1dvARB = __indirect_glMultiTexCoord1dvARB;
-    glAPI->MultiTexCoord1fARB = __indirect_glMultiTexCoord1fARB;
-    glAPI->MultiTexCoord1fvARB = __indirect_glMultiTexCoord1fvARB;
-    glAPI->MultiTexCoord1iARB = __indirect_glMultiTexCoord1iARB;
-    glAPI->MultiTexCoord1ivARB = __indirect_glMultiTexCoord1ivARB;
-    glAPI->MultiTexCoord1sARB = __indirect_glMultiTexCoord1sARB;
-    glAPI->MultiTexCoord1svARB = __indirect_glMultiTexCoord1svARB;
-    glAPI->MultiTexCoord2dARB = __indirect_glMultiTexCoord2dARB;
-    glAPI->MultiTexCoord2dvARB = __indirect_glMultiTexCoord2dvARB;
-    glAPI->MultiTexCoord2fARB = __indirect_glMultiTexCoord2fARB;
-    glAPI->MultiTexCoord2fvARB = __indirect_glMultiTexCoord2fvARB;
-    glAPI->MultiTexCoord2iARB = __indirect_glMultiTexCoord2iARB;
-    glAPI->MultiTexCoord2ivARB = __indirect_glMultiTexCoord2ivARB;
-    glAPI->MultiTexCoord2sARB = __indirect_glMultiTexCoord2sARB;
-    glAPI->MultiTexCoord2svARB = __indirect_glMultiTexCoord2svARB;
-    glAPI->MultiTexCoord3dARB = __indirect_glMultiTexCoord3dARB;
-    glAPI->MultiTexCoord3dvARB = __indirect_glMultiTexCoord3dvARB;
-    glAPI->MultiTexCoord3fARB = __indirect_glMultiTexCoord3fARB;
-    glAPI->MultiTexCoord3fvARB = __indirect_glMultiTexCoord3fvARB;
-    glAPI->MultiTexCoord3iARB = __indirect_glMultiTexCoord3iARB;
-    glAPI->MultiTexCoord3ivARB = __indirect_glMultiTexCoord3ivARB;
-    glAPI->MultiTexCoord3sARB = __indirect_glMultiTexCoord3sARB;
-    glAPI->MultiTexCoord3svARB = __indirect_glMultiTexCoord3svARB;
-    glAPI->MultiTexCoord4dARB = __indirect_glMultiTexCoord4dARB;
-    glAPI->MultiTexCoord4dvARB = __indirect_glMultiTexCoord4dvARB;
-    glAPI->MultiTexCoord4fARB = __indirect_glMultiTexCoord4fARB;
-    glAPI->MultiTexCoord4fvARB = __indirect_glMultiTexCoord4fvARB;
-    glAPI->MultiTexCoord4iARB = __indirect_glMultiTexCoord4iARB;
-    glAPI->MultiTexCoord4ivARB = __indirect_glMultiTexCoord4ivARB;
-    glAPI->MultiTexCoord4sARB = __indirect_glMultiTexCoord4sARB;
-    glAPI->MultiTexCoord4svARB = __indirect_glMultiTexCoord4svARB;
-
-    /*   3. GL_ARB_transpose_matrix */
-
-    glAPI->LoadTransposeMatrixdARB = __indirect_glLoadTransposeMatrixdARB;
-    glAPI->LoadTransposeMatrixfARB = __indirect_glLoadTransposeMatrixfARB;
-    glAPI->MultTransposeMatrixdARB = __indirect_glMultTransposeMatrixdARB;
-    glAPI->MultTransposeMatrixfARB = __indirect_glMultTransposeMatrixfARB;
-
-    /*   5. GL_ARB_multisample */
-
-    glAPI->SampleCoverageARB = __indirect_glSampleCoverageARB;
-
-    /*  12. GL_ARB_texture_compression */
-
-    glAPI->CompressedTexImage1DARB = __indirect_glCompressedTexImage1DARB;
-    glAPI->CompressedTexImage2DARB = __indirect_glCompressedTexImage2DARB;
-    glAPI->CompressedTexImage3DARB = __indirect_glCompressedTexImage3DARB;
-    glAPI->CompressedTexSubImage1DARB = __indirect_glCompressedTexSubImage1DARB;
-    glAPI->CompressedTexSubImage2DARB = __indirect_glCompressedTexSubImage2DARB;
-    glAPI->CompressedTexSubImage3DARB = __indirect_glCompressedTexSubImage3DARB;
-    glAPI->GetCompressedTexImageARB = __indirect_glGetCompressedTexImageARB;
-
-    /*  26. GL_ARB_vertex_program */
-
-    glAPI->DisableVertexAttribArrayARB = __indirect_glDisableVertexAttribArrayARB;
-    glAPI->EnableVertexAttribArrayARB = __indirect_glEnableVertexAttribArrayARB;
-    glAPI->GetProgramEnvParameterdvARB = __indirect_glGetProgramEnvParameterdvARB;
-    glAPI->GetProgramEnvParameterfvARB = __indirect_glGetProgramEnvParameterfvARB;
-    glAPI->GetProgramLocalParameterdvARB = __indirect_glGetProgramLocalParameterdvARB;
-    glAPI->GetProgramLocalParameterfvARB = __indirect_glGetProgramLocalParameterfvARB;
-    glAPI->GetProgramStringARB = __indirect_glGetProgramStringARB;
-    glAPI->GetProgramivARB = __indirect_glGetProgramivARB;
-    glAPI->GetVertexAttribdvARB = __indirect_glGetVertexAttribdvARB;
-    glAPI->GetVertexAttribfvARB = __indirect_glGetVertexAttribfvARB;
-    glAPI->GetVertexAttribivARB = __indirect_glGetVertexAttribivARB;
-    glAPI->ProgramEnvParameter4dARB = __indirect_glProgramEnvParameter4dARB;
-    glAPI->ProgramEnvParameter4dvARB = __indirect_glProgramEnvParameter4dvARB;
-    glAPI->ProgramEnvParameter4fARB = __indirect_glProgramEnvParameter4fARB;
-    glAPI->ProgramEnvParameter4fvARB = __indirect_glProgramEnvParameter4fvARB;
-    glAPI->ProgramLocalParameter4dARB = __indirect_glProgramLocalParameter4dARB;
-    glAPI->ProgramLocalParameter4dvARB = __indirect_glProgramLocalParameter4dvARB;
-    glAPI->ProgramLocalParameter4fARB = __indirect_glProgramLocalParameter4fARB;
-    glAPI->ProgramLocalParameter4fvARB = __indirect_glProgramLocalParameter4fvARB;
-    glAPI->ProgramStringARB = __indirect_glProgramStringARB;
-    glAPI->VertexAttrib1dARB = __indirect_glVertexAttrib1dARB;
-    glAPI->VertexAttrib1dvARB = __indirect_glVertexAttrib1dvARB;
-    glAPI->VertexAttrib1fARB = __indirect_glVertexAttrib1fARB;
-    glAPI->VertexAttrib1fvARB = __indirect_glVertexAttrib1fvARB;
-    glAPI->VertexAttrib1sARB = __indirect_glVertexAttrib1sARB;
-    glAPI->VertexAttrib1svARB = __indirect_glVertexAttrib1svARB;
-    glAPI->VertexAttrib2dARB = __indirect_glVertexAttrib2dARB;
-    glAPI->VertexAttrib2dvARB = __indirect_glVertexAttrib2dvARB;
-    glAPI->VertexAttrib2fARB = __indirect_glVertexAttrib2fARB;
-    glAPI->VertexAttrib2fvARB = __indirect_glVertexAttrib2fvARB;
-    glAPI->VertexAttrib2sARB = __indirect_glVertexAttrib2sARB;
-    glAPI->VertexAttrib2svARB = __indirect_glVertexAttrib2svARB;
-    glAPI->VertexAttrib3dARB = __indirect_glVertexAttrib3dARB;
-    glAPI->VertexAttrib3dvARB = __indirect_glVertexAttrib3dvARB;
-    glAPI->VertexAttrib3fARB = __indirect_glVertexAttrib3fARB;
-    glAPI->VertexAttrib3fvARB = __indirect_glVertexAttrib3fvARB;
-    glAPI->VertexAttrib3sARB = __indirect_glVertexAttrib3sARB;
-    glAPI->VertexAttrib3svARB = __indirect_glVertexAttrib3svARB;
-    glAPI->VertexAttrib4NbvARB = __indirect_glVertexAttrib4NbvARB;
-    glAPI->VertexAttrib4NivARB = __indirect_glVertexAttrib4NivARB;
-    glAPI->VertexAttrib4NsvARB = __indirect_glVertexAttrib4NsvARB;
-    glAPI->VertexAttrib4NubARB = __indirect_glVertexAttrib4NubARB;
-    glAPI->VertexAttrib4NubvARB = __indirect_glVertexAttrib4NubvARB;
-    glAPI->VertexAttrib4NuivARB = __indirect_glVertexAttrib4NuivARB;
-    glAPI->VertexAttrib4NusvARB = __indirect_glVertexAttrib4NusvARB;
-    glAPI->VertexAttrib4bvARB = __indirect_glVertexAttrib4bvARB;
-    glAPI->VertexAttrib4dARB = __indirect_glVertexAttrib4dARB;
-    glAPI->VertexAttrib4dvARB = __indirect_glVertexAttrib4dvARB;
-    glAPI->VertexAttrib4fARB = __indirect_glVertexAttrib4fARB;
-    glAPI->VertexAttrib4fvARB = __indirect_glVertexAttrib4fvARB;
-    glAPI->VertexAttrib4ivARB = __indirect_glVertexAttrib4ivARB;
-    glAPI->VertexAttrib4sARB = __indirect_glVertexAttrib4sARB;
-    glAPI->VertexAttrib4svARB = __indirect_glVertexAttrib4svARB;
-    glAPI->VertexAttrib4ubvARB = __indirect_glVertexAttrib4ubvARB;
-    glAPI->VertexAttrib4uivARB = __indirect_glVertexAttrib4uivARB;
-    glAPI->VertexAttrib4usvARB = __indirect_glVertexAttrib4usvARB;
-    glAPI->VertexAttribPointerARB = __indirect_glVertexAttribPointerARB;
-
-    /*  29. GL_ARB_occlusion_query */
-
-    glAPI->BeginQueryARB = __indirect_glBeginQueryARB;
-    glAPI->DeleteQueriesARB = __indirect_glDeleteQueriesARB;
-    glAPI->EndQueryARB = __indirect_glEndQueryARB;
-    glAPI->GenQueriesARB = __indirect_glGenQueriesARB;
-    glAPI->GetQueryObjectivARB = __indirect_glGetQueryObjectivARB;
-    glAPI->GetQueryObjectuivARB = __indirect_glGetQueryObjectuivARB;
-    glAPI->GetQueryivARB = __indirect_glGetQueryivARB;
-    glAPI->IsQueryARB = __indirect_glIsQueryARB;
-
-    /*  37. GL_ARB_draw_buffers */
-
-    glAPI->DrawBuffersARB = __indirect_glDrawBuffersARB;
-
-    /*  45. GL_ARB_framebuffer_object */
-
-    glAPI->RenderbufferStorageMultisample = __indirect_glRenderbufferStorageMultisample;
-
-    /*  25. GL_SGIS_multisample */
-
-    glAPI->SampleMaskSGIS = __indirect_glSampleMaskSGIS;
-    glAPI->SamplePatternSGIS = __indirect_glSamplePatternSGIS;
-
-    /*  30. GL_EXT_vertex_array */
-
-    glAPI->ColorPointerEXT = __indirect_glColorPointerEXT;
-    glAPI->EdgeFlagPointerEXT = __indirect_glEdgeFlagPointerEXT;
-    glAPI->IndexPointerEXT = __indirect_glIndexPointerEXT;
-    glAPI->NormalPointerEXT = __indirect_glNormalPointerEXT;
-    glAPI->TexCoordPointerEXT = __indirect_glTexCoordPointerEXT;
-    glAPI->VertexPointerEXT = __indirect_glVertexPointerEXT;
-
-    /*  54. GL_EXT_point_parameters */
-
-    glAPI->PointParameterfEXT = __indirect_glPointParameterfEXT;
-    glAPI->PointParameterfvEXT = __indirect_glPointParameterfvEXT;
-
-    /* 145. GL_EXT_secondary_color */
-
-    glAPI->SecondaryColor3bEXT = __indirect_glSecondaryColor3bEXT;
-    glAPI->SecondaryColor3bvEXT = __indirect_glSecondaryColor3bvEXT;
-    glAPI->SecondaryColor3dEXT = __indirect_glSecondaryColor3dEXT;
-    glAPI->SecondaryColor3dvEXT = __indirect_glSecondaryColor3dvEXT;
-    glAPI->SecondaryColor3fEXT = __indirect_glSecondaryColor3fEXT;
-    glAPI->SecondaryColor3fvEXT = __indirect_glSecondaryColor3fvEXT;
-    glAPI->SecondaryColor3iEXT = __indirect_glSecondaryColor3iEXT;
-    glAPI->SecondaryColor3ivEXT = __indirect_glSecondaryColor3ivEXT;
-    glAPI->SecondaryColor3sEXT = __indirect_glSecondaryColor3sEXT;
-    glAPI->SecondaryColor3svEXT = __indirect_glSecondaryColor3svEXT;
-    glAPI->SecondaryColor3ubEXT = __indirect_glSecondaryColor3ubEXT;
-    glAPI->SecondaryColor3ubvEXT = __indirect_glSecondaryColor3ubvEXT;
-    glAPI->SecondaryColor3uiEXT = __indirect_glSecondaryColor3uiEXT;
-    glAPI->SecondaryColor3uivEXT = __indirect_glSecondaryColor3uivEXT;
-    glAPI->SecondaryColor3usEXT = __indirect_glSecondaryColor3usEXT;
-    glAPI->SecondaryColor3usvEXT = __indirect_glSecondaryColor3usvEXT;
-    glAPI->SecondaryColorPointerEXT = __indirect_glSecondaryColorPointerEXT;
-
-    /* 148. GL_EXT_multi_draw_arrays */
-
-    glAPI->MultiDrawArraysEXT = __indirect_glMultiDrawArraysEXT;
-    glAPI->MultiDrawElementsEXT = __indirect_glMultiDrawElementsEXT;
-
-    /* 149. GL_EXT_fog_coord */
-
-    glAPI->FogCoordPointerEXT = __indirect_glFogCoordPointerEXT;
-    glAPI->FogCoorddEXT = __indirect_glFogCoorddEXT;
-    glAPI->FogCoorddvEXT = __indirect_glFogCoorddvEXT;
-    glAPI->FogCoordfEXT = __indirect_glFogCoordfEXT;
-    glAPI->FogCoordfvEXT = __indirect_glFogCoordfvEXT;
-
-    /* 173. GL_EXT_blend_func_separate */
-
-    glAPI->BlendFuncSeparateEXT = __indirect_glBlendFuncSeparateEXT;
-
-    /* 197. GL_MESA_window_pos */
-
-    glAPI->WindowPos2dMESA = __indirect_glWindowPos2dMESA;
-    glAPI->WindowPos2dvMESA = __indirect_glWindowPos2dvMESA;
-    glAPI->WindowPos2fMESA = __indirect_glWindowPos2fMESA;
-    glAPI->WindowPos2fvMESA = __indirect_glWindowPos2fvMESA;
-    glAPI->WindowPos2iMESA = __indirect_glWindowPos2iMESA;
-    glAPI->WindowPos2ivMESA = __indirect_glWindowPos2ivMESA;
-    glAPI->WindowPos2sMESA = __indirect_glWindowPos2sMESA;
-    glAPI->WindowPos2svMESA = __indirect_glWindowPos2svMESA;
-    glAPI->WindowPos3dMESA = __indirect_glWindowPos3dMESA;
-    glAPI->WindowPos3dvMESA = __indirect_glWindowPos3dvMESA;
-    glAPI->WindowPos3fMESA = __indirect_glWindowPos3fMESA;
-    glAPI->WindowPos3fvMESA = __indirect_glWindowPos3fvMESA;
-    glAPI->WindowPos3iMESA = __indirect_glWindowPos3iMESA;
-    glAPI->WindowPos3ivMESA = __indirect_glWindowPos3ivMESA;
-    glAPI->WindowPos3sMESA = __indirect_glWindowPos3sMESA;
-    glAPI->WindowPos3svMESA = __indirect_glWindowPos3svMESA;
-
-    /* 233. GL_NV_vertex_program */
-
-    glAPI->AreProgramsResidentNV = __indirect_glAreProgramsResidentNV;
-    glAPI->BindProgramNV = __indirect_glBindProgramNV;
-    glAPI->DeleteProgramsNV = __indirect_glDeleteProgramsNV;
-    glAPI->ExecuteProgramNV = __indirect_glExecuteProgramNV;
-    glAPI->GenProgramsNV = __indirect_glGenProgramsNV;
-    glAPI->GetProgramParameterdvNV = __indirect_glGetProgramParameterdvNV;
-    glAPI->GetProgramParameterfvNV = __indirect_glGetProgramParameterfvNV;
-    glAPI->GetProgramStringNV = __indirect_glGetProgramStringNV;
-    glAPI->GetProgramivNV = __indirect_glGetProgramivNV;
-    glAPI->GetTrackMatrixivNV = __indirect_glGetTrackMatrixivNV;
-    glAPI->GetVertexAttribPointervNV = __indirect_glGetVertexAttribPointervNV;
-    glAPI->GetVertexAttribdvNV = __indirect_glGetVertexAttribdvNV;
-    glAPI->GetVertexAttribfvNV = __indirect_glGetVertexAttribfvNV;
-    glAPI->GetVertexAttribivNV = __indirect_glGetVertexAttribivNV;
-    glAPI->IsProgramNV = __indirect_glIsProgramNV;
-    glAPI->LoadProgramNV = __indirect_glLoadProgramNV;
-    glAPI->ProgramParameters4dvNV = __indirect_glProgramParameters4dvNV;
-    glAPI->ProgramParameters4fvNV = __indirect_glProgramParameters4fvNV;
-    glAPI->RequestResidentProgramsNV = __indirect_glRequestResidentProgramsNV;
-    glAPI->TrackMatrixNV = __indirect_glTrackMatrixNV;
-    glAPI->VertexAttrib1dNV = __indirect_glVertexAttrib1dNV;
-    glAPI->VertexAttrib1dvNV = __indirect_glVertexAttrib1dvNV;
-    glAPI->VertexAttrib1fNV = __indirect_glVertexAttrib1fNV;
-    glAPI->VertexAttrib1fvNV = __indirect_glVertexAttrib1fvNV;
-    glAPI->VertexAttrib1sNV = __indirect_glVertexAttrib1sNV;
-    glAPI->VertexAttrib1svNV = __indirect_glVertexAttrib1svNV;
-    glAPI->VertexAttrib2dNV = __indirect_glVertexAttrib2dNV;
-    glAPI->VertexAttrib2dvNV = __indirect_glVertexAttrib2dvNV;
-    glAPI->VertexAttrib2fNV = __indirect_glVertexAttrib2fNV;
-    glAPI->VertexAttrib2fvNV = __indirect_glVertexAttrib2fvNV;
-    glAPI->VertexAttrib2sNV = __indirect_glVertexAttrib2sNV;
-    glAPI->VertexAttrib2svNV = __indirect_glVertexAttrib2svNV;
-    glAPI->VertexAttrib3dNV = __indirect_glVertexAttrib3dNV;
-    glAPI->VertexAttrib3dvNV = __indirect_glVertexAttrib3dvNV;
-    glAPI->VertexAttrib3fNV = __indirect_glVertexAttrib3fNV;
-    glAPI->VertexAttrib3fvNV = __indirect_glVertexAttrib3fvNV;
-    glAPI->VertexAttrib3sNV = __indirect_glVertexAttrib3sNV;
-    glAPI->VertexAttrib3svNV = __indirect_glVertexAttrib3svNV;
-    glAPI->VertexAttrib4dNV = __indirect_glVertexAttrib4dNV;
-    glAPI->VertexAttrib4dvNV = __indirect_glVertexAttrib4dvNV;
-    glAPI->VertexAttrib4fNV = __indirect_glVertexAttrib4fNV;
-    glAPI->VertexAttrib4fvNV = __indirect_glVertexAttrib4fvNV;
-    glAPI->VertexAttrib4sNV = __indirect_glVertexAttrib4sNV;
-    glAPI->VertexAttrib4svNV = __indirect_glVertexAttrib4svNV;
-    glAPI->VertexAttrib4ubNV = __indirect_glVertexAttrib4ubNV;
-    glAPI->VertexAttrib4ubvNV = __indirect_glVertexAttrib4ubvNV;
-    glAPI->VertexAttribPointerNV = __indirect_glVertexAttribPointerNV;
-    glAPI->VertexAttribs1dvNV = __indirect_glVertexAttribs1dvNV;
-    glAPI->VertexAttribs1fvNV = __indirect_glVertexAttribs1fvNV;
-    glAPI->VertexAttribs1svNV = __indirect_glVertexAttribs1svNV;
-    glAPI->VertexAttribs2dvNV = __indirect_glVertexAttribs2dvNV;
-    glAPI->VertexAttribs2fvNV = __indirect_glVertexAttribs2fvNV;
-    glAPI->VertexAttribs2svNV = __indirect_glVertexAttribs2svNV;
-    glAPI->VertexAttribs3dvNV = __indirect_glVertexAttribs3dvNV;
-    glAPI->VertexAttribs3fvNV = __indirect_glVertexAttribs3fvNV;
-    glAPI->VertexAttribs3svNV = __indirect_glVertexAttribs3svNV;
-    glAPI->VertexAttribs4dvNV = __indirect_glVertexAttribs4dvNV;
-    glAPI->VertexAttribs4fvNV = __indirect_glVertexAttribs4fvNV;
-    glAPI->VertexAttribs4svNV = __indirect_glVertexAttribs4svNV;
-    glAPI->VertexAttribs4ubvNV = __indirect_glVertexAttribs4ubvNV;
-
-    /* 262. GL_NV_point_sprite */
-
-    glAPI->PointParameteriNV = __indirect_glPointParameteriNV;
-    glAPI->PointParameterivNV = __indirect_glPointParameterivNV;
-
-    /* 268. GL_EXT_stencil_two_side */
-
-    glAPI->ActiveStencilFaceEXT = __indirect_glActiveStencilFaceEXT;
-
-    /* 282. GL_NV_fragment_program */
-
-    glAPI->GetProgramNamedParameterdvNV = __indirect_glGetProgramNamedParameterdvNV;
-    glAPI->GetProgramNamedParameterfvNV = __indirect_glGetProgramNamedParameterfvNV;
-    glAPI->ProgramNamedParameter4dNV = __indirect_glProgramNamedParameter4dNV;
-    glAPI->ProgramNamedParameter4dvNV = __indirect_glProgramNamedParameter4dvNV;
-    glAPI->ProgramNamedParameter4fNV = __indirect_glProgramNamedParameter4fNV;
-    glAPI->ProgramNamedParameter4fvNV = __indirect_glProgramNamedParameter4fvNV;
-
-    /* 299. GL_EXT_blend_equation_separate */
-
-    glAPI->BlendEquationSeparateEXT = __indirect_glBlendEquationSeparateEXT;
-
-    /* 310. GL_EXT_framebuffer_object */
-
-    glAPI->BindFramebufferEXT = __indirect_glBindFramebufferEXT;
-    glAPI->BindRenderbufferEXT = __indirect_glBindRenderbufferEXT;
-    glAPI->CheckFramebufferStatusEXT = __indirect_glCheckFramebufferStatusEXT;
-    glAPI->DeleteFramebuffersEXT = __indirect_glDeleteFramebuffersEXT;
-    glAPI->DeleteRenderbuffersEXT = __indirect_glDeleteRenderbuffersEXT;
-    glAPI->FramebufferRenderbufferEXT = __indirect_glFramebufferRenderbufferEXT;
-    glAPI->FramebufferTexture1DEXT = __indirect_glFramebufferTexture1DEXT;
-    glAPI->FramebufferTexture2DEXT = __indirect_glFramebufferTexture2DEXT;
-    glAPI->FramebufferTexture3DEXT = __indirect_glFramebufferTexture3DEXT;
-    glAPI->GenFramebuffersEXT = __indirect_glGenFramebuffersEXT;
-    glAPI->GenRenderbuffersEXT = __indirect_glGenRenderbuffersEXT;
-    glAPI->GenerateMipmapEXT = __indirect_glGenerateMipmapEXT;
-    glAPI->GetFramebufferAttachmentParameterivEXT = __indirect_glGetFramebufferAttachmentParameterivEXT;
-    glAPI->GetRenderbufferParameterivEXT = __indirect_glGetRenderbufferParameterivEXT;
-    glAPI->IsFramebufferEXT = __indirect_glIsFramebufferEXT;
-    glAPI->IsRenderbufferEXT = __indirect_glIsRenderbufferEXT;
-    glAPI->RenderbufferStorageEXT = __indirect_glRenderbufferStorageEXT;
-
-    /* 316. GL_EXT_framebuffer_blit */
-
-    glAPI->BlitFramebufferEXT = __indirect_glBlitFramebufferEXT;
-
-    /* 329. GL_EXT_texture_array */
-
-    glAPI->FramebufferTextureLayerEXT = __indirect_glFramebufferTextureLayerEXT;
-
-    return glAPI;
-}
-
diff --git a/src/glx/x11/indirect_init.h b/src/glx/x11/indirect_init.h
deleted file mode 100644 (file)
index 72255f1..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- *   Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#ifndef _INDIRECT_INIT_H_
-#define _INDIRECT_INIT_H_
-
-#include "glxclient.h"
-
-extern __GLapi *__glXNewIndirectAPI(void);
-
-#endif /* _INDIRECT_INIT_H_ */
diff --git a/src/glx/x11/indirect_size.c b/src/glx/x11/indirect_size.c
deleted file mode 100644 (file)
index 6356ddd..0000000
+++ /dev/null
@@ -1,388 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
-
-/*
- * (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
- * 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
- * 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.
- */
-
-
-#include <GL/gl.h>
-#include "indirect_size.h"
-
-#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define PURE __attribute__((pure))
-#  else
-#    define PURE
-#  endif
-
-#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#    define FASTCALL __attribute__((fastcall))
-#  else
-#    define FASTCALL
-#  endif
-
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
-#    define INTERNAL  __attribute__((visibility("internal")))
-#  else
-#    define INTERNAL
-#  endif
-
-
-#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)
-#  undef HAVE_ALIAS
-#endif
-#ifdef HAVE_ALIAS
-#  define ALIAS2(from,to) \
-    INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \
-        __attribute__ ((alias( # to )));
-#  define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )
-#else
-#  define ALIAS(from,to) \
-    INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \
-    { return __gl ## to ## _size( e ); }
-#endif
-
-
-INTERNAL PURE FASTCALL GLint
-__glCallLists_size(GLenum e)
-{
-    switch (e) {
-    case GL_BYTE:
-    case GL_UNSIGNED_BYTE:
-        return 1;
-    case GL_SHORT:
-    case GL_UNSIGNED_SHORT:
-    case GL_2_BYTES:
-    case GL_HALF_FLOAT:
-        return 2;
-    case GL_3_BYTES:
-        return 3;
-    case GL_INT:
-    case GL_UNSIGNED_INT:
-    case GL_FLOAT:
-    case GL_4_BYTES:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glFogfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_FOG_INDEX:
-    case GL_FOG_DENSITY:
-    case GL_FOG_START:
-    case GL_FOG_END:
-    case GL_FOG_MODE:
-    case GL_FOG_OFFSET_VALUE_SGIX:
-    case GL_FOG_DISTANCE_MODE_NV:
-        return 1;
-    case GL_FOG_COLOR:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glLightfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_SPOT_EXPONENT:
-    case GL_SPOT_CUTOFF:
-    case GL_CONSTANT_ATTENUATION:
-    case GL_LINEAR_ATTENUATION:
-    case GL_QUADRATIC_ATTENUATION:
-        return 1;
-    case GL_SPOT_DIRECTION:
-        return 3;
-    case GL_AMBIENT:
-    case GL_DIFFUSE:
-    case GL_SPECULAR:
-    case GL_POSITION:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glLightModelfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_LIGHT_MODEL_LOCAL_VIEWER:
-    case GL_LIGHT_MODEL_TWO_SIDE:
-    case GL_LIGHT_MODEL_COLOR_CONTROL:
-/*      case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/
-        return 1;
-    case GL_LIGHT_MODEL_AMBIENT:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glMaterialfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_SHININESS:
-        return 1;
-    case GL_COLOR_INDEXES:
-        return 3;
-    case GL_AMBIENT:
-    case GL_DIFFUSE:
-    case GL_SPECULAR:
-    case GL_EMISSION:
-    case GL_AMBIENT_AND_DIFFUSE:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glTexParameterfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_TEXTURE_MAG_FILTER:
-    case GL_TEXTURE_MIN_FILTER:
-    case GL_TEXTURE_WRAP_S:
-    case GL_TEXTURE_WRAP_T:
-    case GL_TEXTURE_PRIORITY:
-    case GL_TEXTURE_WRAP_R:
-    case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
-/*      case GL_SHADOW_AMBIENT_SGIX:*/
-    case GL_TEXTURE_MIN_LOD:
-    case GL_TEXTURE_MAX_LOD:
-    case GL_TEXTURE_BASE_LEVEL:
-    case GL_TEXTURE_MAX_LEVEL:
-    case GL_TEXTURE_CLIPMAP_FRAME_SGIX:
-    case GL_TEXTURE_LOD_BIAS_S_SGIX:
-    case GL_TEXTURE_LOD_BIAS_T_SGIX:
-    case GL_TEXTURE_LOD_BIAS_R_SGIX:
-    case GL_GENERATE_MIPMAP:
-/*      case GL_GENERATE_MIPMAP_SGIS:*/
-    case GL_TEXTURE_COMPARE_SGIX:
-    case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
-    case GL_TEXTURE_MAX_CLAMP_S_SGIX:
-    case GL_TEXTURE_MAX_CLAMP_T_SGIX:
-    case GL_TEXTURE_MAX_CLAMP_R_SGIX:
-    case GL_TEXTURE_MAX_ANISOTROPY_EXT:
-    case GL_TEXTURE_LOD_BIAS:
-/*      case GL_TEXTURE_LOD_BIAS_EXT:*/
-    case GL_TEXTURE_STORAGE_HINT_APPLE:
-    case GL_STORAGE_PRIVATE_APPLE:
-    case GL_STORAGE_CACHED_APPLE:
-    case GL_STORAGE_SHARED_APPLE:
-    case GL_DEPTH_TEXTURE_MODE:
-/*      case GL_DEPTH_TEXTURE_MODE_ARB:*/
-    case GL_TEXTURE_COMPARE_MODE:
-/*      case GL_TEXTURE_COMPARE_MODE_ARB:*/
-    case GL_TEXTURE_COMPARE_FUNC:
-/*      case GL_TEXTURE_COMPARE_FUNC_ARB:*/
-    case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV:
-        return 1;
-    case GL_TEXTURE_CLIPMAP_CENTER_SGIX:
-    case GL_TEXTURE_CLIPMAP_OFFSET_SGIX:
-        return 2;
-    case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX:
-        return 3;
-    case GL_TEXTURE_BORDER_COLOR:
-    case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
-    case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glTexEnvfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_ALPHA_SCALE:
-    case GL_TEXTURE_ENV_MODE:
-    case GL_TEXTURE_LOD_BIAS:
-    case GL_COMBINE_RGB:
-    case GL_COMBINE_ALPHA:
-    case GL_RGB_SCALE:
-    case GL_SOURCE0_RGB:
-    case GL_SOURCE1_RGB:
-    case GL_SOURCE2_RGB:
-    case GL_SOURCE3_RGB_NV:
-    case GL_SOURCE0_ALPHA:
-    case GL_SOURCE1_ALPHA:
-    case GL_SOURCE2_ALPHA:
-    case GL_SOURCE3_ALPHA_NV:
-    case GL_OPERAND0_RGB:
-    case GL_OPERAND1_RGB:
-    case GL_OPERAND2_RGB:
-    case GL_OPERAND3_RGB_NV:
-    case GL_OPERAND0_ALPHA:
-    case GL_OPERAND1_ALPHA:
-    case GL_OPERAND2_ALPHA:
-    case GL_OPERAND3_ALPHA_NV:
-    case GL_BUMP_TARGET_ATI:
-    case GL_COORD_REPLACE_ARB:
-/*      case GL_COORD_REPLACE_NV:*/
-        return 1;
-    case GL_TEXTURE_ENV_COLOR:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glTexGendv_size(GLenum e)
-{
-    switch (e) {
-    case GL_TEXTURE_GEN_MODE:
-        return 1;
-    case GL_OBJECT_PLANE:
-    case GL_EYE_PLANE:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glMap1d_size(GLenum e)
-{
-    switch (e) {
-    case GL_MAP1_INDEX:
-    case GL_MAP1_TEXTURE_COORD_1:
-        return 1;
-    case GL_MAP1_TEXTURE_COORD_2:
-        return 2;
-    case GL_MAP1_NORMAL:
-    case GL_MAP1_TEXTURE_COORD_3:
-    case GL_MAP1_VERTEX_3:
-        return 3;
-    case GL_MAP1_COLOR_4:
-    case GL_MAP1_TEXTURE_COORD_4:
-    case GL_MAP1_VERTEX_4:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glMap2d_size(GLenum e)
-{
-    switch (e) {
-    case GL_MAP2_INDEX:
-    case GL_MAP2_TEXTURE_COORD_1:
-        return 1;
-    case GL_MAP2_TEXTURE_COORD_2:
-        return 2;
-    case GL_MAP2_NORMAL:
-    case GL_MAP2_TEXTURE_COORD_3:
-    case GL_MAP2_VERTEX_3:
-        return 3;
-    case GL_MAP2_COLOR_4:
-    case GL_MAP2_TEXTURE_COORD_4:
-    case GL_MAP2_VERTEX_4:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glColorTableParameterfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_COLOR_TABLE_SCALE:
-    case GL_COLOR_TABLE_BIAS:
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glConvolutionParameterfv_size(GLenum e)
-{
-    switch (e) {
-    case GL_CONVOLUTION_BORDER_MODE:
-/*      case GL_CONVOLUTION_BORDER_MODE_EXT:*/
-        return 1;
-    case GL_CONVOLUTION_FILTER_SCALE:
-/*      case GL_CONVOLUTION_FILTER_SCALE_EXT:*/
-    case GL_CONVOLUTION_FILTER_BIAS:
-/*      case GL_CONVOLUTION_FILTER_BIAS_EXT:*/
-    case GL_CONVOLUTION_BORDER_COLOR:
-/*      case GL_CONVOLUTION_BORDER_COLOR_HP:*/
-        return 4;
-    default:
-        return 0;
-    }
-}
-
-INTERNAL PURE FASTCALL GLint
-__glPointParameterfvEXT_size(GLenum e)
-{
-    switch (e) {
-    case GL_POINT_SIZE_MIN:
-/*      case GL_POINT_SIZE_MIN_ARB:*/
-/*      case GL_POINT_SIZE_MIN_SGIS:*/
-    case GL_POINT_SIZE_MAX:
-/*      case GL_POINT_SIZE_MAX_ARB:*/
-/*      case GL_POINT_SIZE_MAX_SGIS:*/
-    case GL_POINT_FADE_THRESHOLD_SIZE:
-/*      case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/
-/*      case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/
-    case GL_POINT_SPRITE_R_MODE_NV:
-    case GL_POINT_SPRITE_COORD_ORIGIN:
-        return 1;
-    case GL_POINT_DISTANCE_ATTENUATION:
-/*      case GL_POINT_DISTANCE_ATTENUATION_ARB:*/
-/*      case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/
-        return 3;
-    default:
-        return 0;
-    }
-}
-
-ALIAS(Fogiv, Fogfv)
-    ALIAS(Lightiv, Lightfv)
-    ALIAS(LightModeliv, LightModelfv)
-    ALIAS(Materialiv, Materialfv)
-    ALIAS(TexParameteriv, TexParameterfv)
-    ALIAS(TexEnviv, TexEnvfv)
-    ALIAS(TexGenfv, TexGendv)
-    ALIAS(TexGeniv, TexGendv)
-    ALIAS(Map1f, Map1d)
-    ALIAS(Map2f, Map2d)
-    ALIAS(ColorTableParameteriv, ColorTableParameterfv)
-    ALIAS(ConvolutionParameteriv, ConvolutionParameterfv)
-    ALIAS(PointParameterivNV, PointParameterfvEXT)
-#  undef PURE
-#  undef FASTCALL
-#  undef INTERNAL
diff --git a/src/glx/x11/indirect_size.h b/src/glx/x11/indirect_size.h
deleted file mode 100644 (file)
index af0919f..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
-
-/*
- * (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
- * 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
- * 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.
- */
-
-#if !defined( _INDIRECT_SIZE_H_ )
-#  define _INDIRECT_SIZE_H_
-
-/**
- * \file
- * Prototypes for functions used to determine the number of data elements in
- * various GLX protocol messages.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define PURE __attribute__((pure))
-#  else
-#    define PURE
-#  endif
-
-#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#    define FASTCALL __attribute__((fastcall))
-#  else
-#    define FASTCALL
-#  endif
-
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
-#    define INTERNAL  __attribute__((visibility("internal")))
-#  else
-#    define INTERNAL
-#  endif
-
-extern INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glFogiv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glLightfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glLightiv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glLightModelfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glLightModeliv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glMaterialfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glMaterialiv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glTexParameterfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glTexParameteriv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glTexEnvfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glTexEnviv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glTexGendv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glTexGenfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glTexGeniv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glMap1d_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glMap1f_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glMap2f_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glColorTableParameteriv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size(GLenum);
-extern INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum);
-
-#  undef PURE
-#  undef FASTCALL
-#  undef INTERNAL
-
-#endif /* !defined( _INDIRECT_SIZE_H_ ) */
diff --git a/src/glx/x11/indirect_texture_compression.c b/src/glx/x11/indirect_texture_compression.c
deleted file mode 100644 (file)
index fa927eb..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * (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
- * THE COPYRIGHT HOLDERS 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 glx_texture_compression.c
- * Contains the routines required to implement GLX protocol for
- * ARB_texture_compression and related extensions.
- *
- * \sa http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_compression.txt
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "packrender.h"
-#include "packsingle.h"
-#include "indirect.h"
-
-#include <assert.h>
-
-
-void
-__indirect_glGetCompressedTexImageARB(GLenum target, GLint level,
-                                      GLvoid * img)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   xGLXGetTexImageReply reply;
-   size_t image_bytes;
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_GetCompressedTexImage, 8);
-   __GLX_SINGLE_PUT_LONG(0, target);
-   __GLX_SINGLE_PUT_LONG(4, level);
-   __GLX_SINGLE_READ_XREPLY();
-
-   image_bytes = reply.width;
-   assert(image_bytes <= ((4 * reply.length) - 0));
-   assert(image_bytes >= ((4 * reply.length) - 3));
-
-   if (image_bytes != 0) {
-      _XRead(dpy, (char *) img, image_bytes);
-      if (image_bytes < (4 * reply.length)) {
-         _XEatData(dpy, (4 * reply.length) - image_bytes);
-      }
-   }
-
-   __GLX_SINGLE_END();
-}
-
-
-/**
- * Internal function used for \c glCompressedTexImage1D and
- * \c glCompressedTexImage2D.
- */
-static void
-CompressedTexImage1D2D(GLenum target, GLint level,
-                       GLenum internal_format,
-                       GLsizei width, GLsizei height,
-                       GLint border, GLsizei image_size,
-                       const GLvoid * data, CARD32 rop)
-{
-   __GLX_DECLARE_VARIABLES();
-
-   __GLX_LOAD_VARIABLES();
-   if (gc->currentDpy == NULL) {
-      return;
-   }
-
-   if ((target == GL_PROXY_TEXTURE_1D)
-       || (target == GL_PROXY_TEXTURE_2D)
-       || (target == GL_PROXY_TEXTURE_CUBE_MAP)) {
-      compsize = 0;
-   }
-   else {
-      compsize = image_size;
-   }
-
-   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + compsize);
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      __GLX_BEGIN_VARIABLE(rop, cmdlen);
-      __GLX_PUT_LONG(4, target);
-      __GLX_PUT_LONG(8, level);
-      __GLX_PUT_LONG(12, internal_format);
-      __GLX_PUT_LONG(16, width);
-      __GLX_PUT_LONG(20, height);
-      __GLX_PUT_LONG(24, border);
-      __GLX_PUT_LONG(28, image_size);
-      if (compsize != 0) {
-         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE,
-                              data, image_size);
-      }
-      __GLX_END(cmdlen);
-   }
-   else {
-      assert(compsize != 0);
-
-      __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4);
-      __GLX_PUT_LONG(8, target);
-      __GLX_PUT_LONG(12, level);
-      __GLX_PUT_LONG(16, internal_format);
-      __GLX_PUT_LONG(20, width);
-      __GLX_PUT_LONG(24, height);
-      __GLX_PUT_LONG(28, border);
-      __GLX_PUT_LONG(32, image_size);
-      __glXSendLargeCommand(gc, gc->pc,
-                            __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + 4,
-                            data, image_size);
-   }
-}
-
-
-/**
- * Internal function used for \c glCompressedTexSubImage1D and
- * \c glCompressedTexSubImage2D.
- */
-static void
-CompressedTexSubImage1D2D(GLenum target, GLint level,
-                          GLsizei xoffset, GLsizei yoffset,
-                          GLsizei width, GLsizei height,
-                          GLenum format, GLsizei image_size,
-                          const GLvoid * data, CARD32 rop)
-{
-   __GLX_DECLARE_VARIABLES();
-
-   __GLX_LOAD_VARIABLES();
-   if (gc->currentDpy == NULL) {
-      return;
-   }
-
-   if (target == GL_PROXY_TEXTURE_3D) {
-      compsize = 0;
-   }
-   else {
-      compsize = image_size;
-   }
-
-   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + compsize);
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      __GLX_BEGIN_VARIABLE(rop, cmdlen);
-      __GLX_PUT_LONG(4, target);
-      __GLX_PUT_LONG(8, level);
-      __GLX_PUT_LONG(12, xoffset);
-      __GLX_PUT_LONG(16, yoffset);
-      __GLX_PUT_LONG(20, width);
-      __GLX_PUT_LONG(24, height);
-      __GLX_PUT_LONG(28, format);
-      __GLX_PUT_LONG(32, image_size);
-      if (compsize != 0) {
-         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE,
-                              data, image_size);
-      }
-      __GLX_END(cmdlen);
-   }
-   else {
-      assert(compsize != 0);
-
-      __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4);
-      __GLX_PUT_LONG(8, target);
-      __GLX_PUT_LONG(12, level);
-      __GLX_PUT_LONG(16, xoffset);
-      __GLX_PUT_LONG(20, yoffset);
-      __GLX_PUT_LONG(24, width);
-      __GLX_PUT_LONG(28, height);
-      __GLX_PUT_LONG(32, format);
-      __GLX_PUT_LONG(36, image_size);
-      __glXSendLargeCommand(gc, gc->pc,
-                            __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + 4,
-                            data, image_size);
-   }
-}
-
-
-void
-__indirect_glCompressedTexImage1DARB(GLenum target, GLint level,
-                                     GLenum internal_format, GLsizei width,
-                                     GLint border, GLsizei image_size,
-                                     const GLvoid * data)
-{
-   CompressedTexImage1D2D(target, level, internal_format, width, 0,
-                          border, image_size, data,
-                          X_GLrop_CompressedTexImage1D);
-}
-
-
-void
-__indirect_glCompressedTexImage2DARB(GLenum target, GLint level,
-                                     GLenum internal_format,
-                                     GLsizei width, GLsizei height,
-                                     GLint border, GLsizei image_size,
-                                     const GLvoid * data)
-{
-   CompressedTexImage1D2D(target, level, internal_format, width, height,
-                          border, image_size, data,
-                          X_GLrop_CompressedTexImage2D);
-}
-
-
-void
-__indirect_glCompressedTexImage3DARB(GLenum target, GLint level,
-                                     GLenum internal_format,
-                                     GLsizei width, GLsizei height,
-                                     GLsizei depth, GLint border,
-                                     GLsizei image_size, const GLvoid * data)
-{
-   __GLX_DECLARE_VARIABLES();
-
-   __GLX_LOAD_VARIABLES();
-   if (gc->currentDpy == NULL) {
-      return;
-   }
-
-   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + image_size);
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexImage3D, cmdlen);
-      __GLX_PUT_LONG(4, target);
-      __GLX_PUT_LONG(8, level);
-      __GLX_PUT_LONG(12, internal_format);
-      __GLX_PUT_LONG(16, width);
-      __GLX_PUT_LONG(20, height);
-      __GLX_PUT_LONG(24, depth);
-      __GLX_PUT_LONG(28, border);
-      __GLX_PUT_LONG(32, image_size);
-      if (image_size != 0) {
-         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE,
-                              data, image_size);
-      }
-      __GLX_END(cmdlen);
-   }
-   else {
-      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexImage3D, cmdlen + 4);
-      __GLX_PUT_LONG(8, target);
-      __GLX_PUT_LONG(12, level);
-      __GLX_PUT_LONG(16, internal_format);
-      __GLX_PUT_LONG(20, width);
-      __GLX_PUT_LONG(24, height);
-      __GLX_PUT_LONG(28, depth);
-      __GLX_PUT_LONG(32, border);
-      __GLX_PUT_LONG(36, image_size);
-      __glXSendLargeCommand(gc, gc->pc,
-                            __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + 4,
-                            data, image_size);
-   }
-}
-
-
-void
-__indirect_glCompressedTexSubImage1DARB(GLenum target, GLint level,
-                                        GLint xoffset,
-                                        GLsizei width,
-                                        GLenum format, GLsizei image_size,
-                                        const GLvoid * data)
-{
-   CompressedTexSubImage1D2D(target, level, xoffset, 0, width, 0,
-                             format, image_size, data,
-                             X_GLrop_CompressedTexSubImage1D);
-}
-
-
-void
-__indirect_glCompressedTexSubImage2DARB(GLenum target, GLint level,
-                                        GLint xoffset, GLint yoffset,
-                                        GLsizei width, GLsizei height,
-                                        GLenum format, GLsizei image_size,
-                                        const GLvoid * data)
-{
-   CompressedTexSubImage1D2D(target, level, xoffset, yoffset, width, height,
-                             format, image_size, data,
-                             X_GLrop_CompressedTexSubImage2D);
-}
-
-
-void
-__indirect_glCompressedTexSubImage3DARB(GLenum target, GLint level,
-                                        GLint xoffset, GLint yoffset,
-                                        GLint zoffset, GLsizei width,
-                                        GLsizei height, GLsizei depth,
-                                        GLenum format, GLsizei image_size,
-                                        const GLvoid * data)
-{
-   __GLX_DECLARE_VARIABLES();
-
-   __GLX_LOAD_VARIABLES();
-   if (gc->currentDpy == NULL) {
-      return;
-   }
-
-   cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE
-                      + image_size);
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexSubImage3D, cmdlen);
-      __GLX_PUT_LONG(4, target);
-      __GLX_PUT_LONG(8, level);
-      __GLX_PUT_LONG(12, xoffset);
-      __GLX_PUT_LONG(16, yoffset);
-      __GLX_PUT_LONG(20, zoffset);
-      __GLX_PUT_LONG(24, width);
-      __GLX_PUT_LONG(28, height);
-      __GLX_PUT_LONG(32, depth);
-      __GLX_PUT_LONG(36, format);
-      __GLX_PUT_LONG(40, image_size);
-      if (image_size != 0) {
-         __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE,
-                              data, image_size);
-      }
-      __GLX_END(cmdlen);
-   }
-   else {
-      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexSubImage3D, cmdlen + 4);
-      __GLX_PUT_LONG(8, target);
-      __GLX_PUT_LONG(12, level);
-      __GLX_PUT_LONG(16, xoffset);
-      __GLX_PUT_LONG(20, yoffset);
-      __GLX_PUT_LONG(24, zoffset);
-      __GLX_PUT_LONG(28, width);
-      __GLX_PUT_LONG(32, height);
-      __GLX_PUT_LONG(36, depth);
-      __GLX_PUT_LONG(40, format);
-      __GLX_PUT_LONG(44, image_size);
-      __glXSendLargeCommand(gc, gc->pc,
-                            __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE + 4,
-                            data, image_size);
-   }
-}
diff --git a/src/glx/x11/indirect_transpose_matrix.c b/src/glx/x11/indirect_transpose_matrix.c
deleted file mode 100644 (file)
index 618db9f..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * (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
- * THE COPYRIGHT HOLDERS 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.
- */
-
-#include <GL/gl.h>
-#include "indirect.h"
-
-static void
-TransposeMatrixf(const GLfloat s[16], GLfloat d[16])
-{
-   int i, j;
-   for (i = 0; i < 4; i++) {
-      for (j = 0; j < 4; j++) {
-         d[i * 4 + j] = s[j * 4 + i];
-      }
-   }
-}
-
-static void
-TransposeMatrixd(const GLdouble s[16], GLdouble d[16])
-{
-   int i, j;
-   for (i = 0; i < 4; i++) {
-      for (j = 0; j < 4; j++) {
-         d[i * 4 + j] = s[j * 4 + i];
-      }
-   }
-}
-
-
-void
-__indirect_glLoadTransposeMatrixdARB(const GLdouble * m)
-{
-   GLdouble mt[16];
-
-   TransposeMatrixd(m, mt);
-   __indirect_glLoadMatrixd(mt);
-}
-
-void
-__indirect_glLoadTransposeMatrixfARB(const GLfloat * m)
-{
-   GLfloat mt[16];
-
-   TransposeMatrixf(m, mt);
-   __indirect_glLoadMatrixf(mt);
-}
-
-void
-__indirect_glMultTransposeMatrixdARB(const GLdouble * m)
-{
-   GLdouble mt[16];
-
-   TransposeMatrixd(m, mt);
-   __indirect_glMultMatrixd(mt);
-}
-
-void
-__indirect_glMultTransposeMatrixfARB(const GLfloat * m)
-{
-   GLfloat mt[16];
-
-   TransposeMatrixf(m, mt);
-   __indirect_glMultMatrixf(mt);
-}
diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c
deleted file mode 100644 (file)
index ad98825..0000000
+++ /dev/null
@@ -1,1985 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004, 2005
- * 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
- * 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.
- */
-
-#include <inttypes.h>
-#include <assert.h>
-#include <string.h>
-
-#include "glxclient.h"
-#include "indirect.h"
-#include <GL/glxproto.h>
-#include "glxextensions.h"
-#include "indirect_vertex_array.h"
-#include "indirect_vertex_array_priv.h"
-
-#define __GLX_PAD(n) (((n)+3) & ~3)
-
-/**
- * \file indirect_vertex_array.c
- * Implement GLX protocol for vertex arrays and vertex buffer objects.
- *
- * The most important function in this fill is \c fill_array_info_cache.
- * The \c array_state_vector contains a cache of the ARRAY_INFO data sent
- * in the DrawArrays protocol.  Certain operations, such as enabling or
- * disabling an array, can invalidate this cache.  \c fill_array_info_cache
- * fills-in this data.  Additionally, it examines the enabled state and
- * other factors to determine what "version" of DrawArrays protocoal can be
- * used.
- *
- * Current, only two versions of DrawArrays protocol are implemented.  The
- * first version is the "none" protocol.  This is the fallback when the
- * server does not support GL 1.1 / EXT_vertex_arrays.  It is implemented
- * by sending batches of immediate mode commands that are equivalent to the
- * DrawArrays protocol.
- *
- * The other protocol that is currently implemented is the "old" protocol.
- * This is the GL 1.1 DrawArrays protocol.  The only difference between GL
- * 1.1 and EXT_vertex_arrays is the opcode used for the DrawArrays command.
- * This protocol is called "old" because the ARB is in the process of
- * defining a new protocol, which will probably be called wither "new" or
- * "vbo", to support multiple texture coordinate arrays, generic attributes,
- * and vertex buffer objects.
- *
- * \author Ian Romanick <ian.d.romanick@intel.com>
- */
-
-static void emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count);
-static void emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count);
-
-static void emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
-                                   const GLvoid * indices);
-static void emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
-                                  const GLvoid * indices);
-
-
-static GLubyte *emit_element_none(GLubyte * dst,
-                                  const struct array_state_vector *arrays,
-                                  unsigned index);
-static GLubyte *emit_element_old(GLubyte * dst,
-                                 const struct array_state_vector *arrays,
-                                 unsigned index);
-static struct array_state *get_array_entry(const struct array_state_vector
-                                           *arrays, GLenum key,
-                                           unsigned index);
-static void fill_array_info_cache(struct array_state_vector *arrays);
-static GLboolean validate_mode(__GLXcontext * gc, GLenum mode);
-static GLboolean validate_count(__GLXcontext * gc, GLsizei count);
-static GLboolean validate_type(__GLXcontext * gc, GLenum type);
-
-
-/**
- * Table of sizes, in bytes, of a GL types.  All of the type enums are be in
- * the range 0x1400 - 0x140F.  That includes types added by extensions (i.e.,
- * \c GL_HALF_FLOAT_NV).  This elements of this table correspond to the
- * type enums masked with 0x0f.
- *
- * \notes
- * \c GL_HALF_FLOAT_NV is not included.  Neither are \c GL_2_BYTES,
- * \c GL_3_BYTES, or \c GL_4_BYTES.
- */
-const GLuint __glXTypeSize_table[16] = {
-   1, 1, 2, 2, 4, 4, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0
-};
-
-
-/**
- * Free the per-context array state that was allocated with
- * __glXInitVertexArrayState().
- */
-void
-__glXFreeVertexArrayState(__GLXcontext * gc)
-{
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-   if (arrays) {
-      if (arrays->stack) {
-         free(arrays->stack);
-         arrays->stack = NULL;
-      }
-      if (arrays->arrays) {
-         free(arrays->arrays);
-         arrays->arrays = NULL;
-      }
-      free(arrays);
-      state->array_state = NULL;
-   }
-}
-
-
-/**
- * Initialize vertex array state of a GLX context.
- *
- * \param gc  GLX context whose vertex array state is to be initialized.
- *
- * \warning
- * This function may only be called after __GLXcontext::gl_extension_bits,
- * __GLXcontext::server_minor, and __GLXcontext::server_major have been
- * initialized.  These values are used to determine what vertex arrays are
- * supported.
- *
- * \bug
- * Return values from malloc are not properly tested.
- */
-void
-__glXInitVertexArrayState(__GLXcontext * gc)
-{
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays;
-
-   unsigned array_count;
-   int texture_units = 1, vertex_program_attribs = 0;
-   unsigned i, j;
-
-   GLboolean got_fog = GL_FALSE;
-   GLboolean got_secondary_color = GL_FALSE;
-
-
-   arrays = calloc(1, sizeof(struct array_state_vector));
-   state->array_state = arrays;
-
-   arrays->old_DrawArrays_possible = !state->NoDrawArraysProtocol;
-   arrays->new_DrawArrays_possible = GL_FALSE;
-   arrays->DrawArrays = NULL;
-
-   arrays->active_texture_unit = 0;
-
-
-   /* Determine how many arrays are actually needed.  Only arrays that
-    * are supported by the server are create.  For example, if the server
-    * supports only 2 texture units, then only 2 texture coordinate arrays
-    * are created.
-    *
-    * At the very least, GL_VERTEX_ARRAY, GL_NORMAL_ARRAY,
-    * GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY, and
-    * GL_EDGE_FLAG_ARRAY are supported.
-    */
-
-   array_count = 5;
-
-   if (__glExtensionBitIsEnabled(gc, GL_EXT_fog_coord_bit)
-       || (gc->server_major > 1) || (gc->server_minor >= 4)) {
-      got_fog = GL_TRUE;
-      array_count++;
-   }
-
-   if (__glExtensionBitIsEnabled(gc, GL_EXT_secondary_color_bit)
-       || (gc->server_major > 1) || (gc->server_minor >= 4)) {
-      got_secondary_color = GL_TRUE;
-      array_count++;
-   }
-
-   if (__glExtensionBitIsEnabled(gc, GL_ARB_multitexture_bit)
-       || (gc->server_major > 1) || (gc->server_minor >= 3)) {
-      __indirect_glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units);
-   }
-
-   if (__glExtensionBitIsEnabled(gc, GL_ARB_vertex_program_bit)) {
-      __indirect_glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,
-                                   GL_MAX_PROGRAM_ATTRIBS_ARB,
-                                   &vertex_program_attribs);
-   }
-
-   arrays->num_texture_units = texture_units;
-   arrays->num_vertex_program_attribs = vertex_program_attribs;
-   array_count += texture_units + vertex_program_attribs;
-   arrays->num_arrays = array_count;
-   arrays->arrays = calloc(array_count, sizeof(struct array_state));
-
-   arrays->arrays[0].data_type = GL_FLOAT;
-   arrays->arrays[0].count = 3;
-   arrays->arrays[0].key = GL_NORMAL_ARRAY;
-   arrays->arrays[0].normalized = GL_TRUE;
-   arrays->arrays[0].old_DrawArrays_possible = GL_TRUE;
-
-   arrays->arrays[1].data_type = GL_FLOAT;
-   arrays->arrays[1].count = 4;
-   arrays->arrays[1].key = GL_COLOR_ARRAY;
-   arrays->arrays[1].normalized = GL_TRUE;
-   arrays->arrays[1].old_DrawArrays_possible = GL_TRUE;
-
-   arrays->arrays[2].data_type = GL_FLOAT;
-   arrays->arrays[2].count = 1;
-   arrays->arrays[2].key = GL_INDEX_ARRAY;
-   arrays->arrays[2].old_DrawArrays_possible = GL_TRUE;
-
-   arrays->arrays[3].data_type = GL_UNSIGNED_BYTE;
-   arrays->arrays[3].count = 1;
-   arrays->arrays[3].key = GL_EDGE_FLAG_ARRAY;
-   arrays->arrays[3].old_DrawArrays_possible = GL_TRUE;
-
-   for (i = 0; i < texture_units; i++) {
-      arrays->arrays[4 + i].data_type = GL_FLOAT;
-      arrays->arrays[4 + i].count = 4;
-      arrays->arrays[4 + i].key = GL_TEXTURE_COORD_ARRAY;
-
-      arrays->arrays[4 + i].old_DrawArrays_possible = (i == 0);
-      arrays->arrays[4 + i].index = i;
-
-      arrays->arrays[4 + i].header[1] = i + GL_TEXTURE0;
-   }
-
-   i = 4 + texture_units;
-
-   if (got_fog) {
-      arrays->arrays[i].data_type = GL_FLOAT;
-      arrays->arrays[i].count = 1;
-      arrays->arrays[i].key = GL_FOG_COORDINATE_ARRAY;
-      arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
-      i++;
-   }
-
-   if (got_secondary_color) {
-      arrays->arrays[i].data_type = GL_FLOAT;
-      arrays->arrays[i].count = 3;
-      arrays->arrays[i].key = GL_SECONDARY_COLOR_ARRAY;
-      arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
-      arrays->arrays[i].normalized = GL_TRUE;
-      i++;
-   }
-
-
-   for (j = 0; j < vertex_program_attribs; j++) {
-      const unsigned idx = (vertex_program_attribs - (j + 1));
-
-
-      arrays->arrays[idx + i].data_type = GL_FLOAT;
-      arrays->arrays[idx + i].count = 4;
-      arrays->arrays[idx + i].key = GL_VERTEX_ATTRIB_ARRAY_POINTER;
-
-      arrays->arrays[idx + i].old_DrawArrays_possible = 0;
-      arrays->arrays[idx + i].index = idx;
-
-      arrays->arrays[idx + i].header[1] = idx;
-   }
-
-   i += vertex_program_attribs;
-
-
-   /* Vertex array *must* be last becuase of the way that
-    * emit_DrawArrays_none works.
-    */
-
-   arrays->arrays[i].data_type = GL_FLOAT;
-   arrays->arrays[i].count = 4;
-   arrays->arrays[i].key = GL_VERTEX_ARRAY;
-   arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
-
-   assert((i + 1) == arrays->num_arrays);
-
-   arrays->stack_index = 0;
-   arrays->stack = malloc(sizeof(struct array_stack_state)
-                          * arrays->num_arrays);
-}
-
-
-/**
- * Calculate the size of a single vertex for the "none" protocol.  This is
- * essentially the size of all the immediate-mode commands required to
- * implement the enabled vertex arrays.
- */
-static size_t
-calculate_single_vertex_size_none(const struct array_state_vector *arrays)
-{
-   size_t single_vertex_size = 0;
-   unsigned i;
-
-
-   for (i = 0; i < arrays->num_arrays; i++) {
-      if (arrays->arrays[i].enabled) {
-         single_vertex_size += ((uint16_t *) arrays->arrays[i].header)[0];
-      }
-   }
-
-   return single_vertex_size;
-}
-
-
-/**
- * Emit a single element using non-DrawArrays protocol.
- */
-GLubyte *
-emit_element_none(GLubyte * dst,
-                  const struct array_state_vector * arrays, unsigned index)
-{
-   unsigned i;
-
-
-   for (i = 0; i < arrays->num_arrays; i++) {
-      if (arrays->arrays[i].enabled) {
-         const size_t offset = index * arrays->arrays[i].true_stride;
-
-         /* The generic attributes can have more data than is in the
-          * elements.  This is because a vertex array can be a 2 element,
-          * normalized, unsigned short, but the "closest" immediate mode
-          * protocol is for a 4Nus.  Since the sizes are small, the
-          * performance impact on modern processors should be negligible.
-          */
-         (void) memset(dst, 0, ((uint16_t *) arrays->arrays[i].header)[0]);
-
-         (void) memcpy(dst, arrays->arrays[i].header,
-                       arrays->arrays[i].header_size);
-
-         dst += arrays->arrays[i].header_size;
-
-         (void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
-                       arrays->arrays[i].element_size);
-
-         dst += __GLX_PAD(arrays->arrays[i].element_size);
-      }
-   }
-
-   return dst;
-}
-
-
-/**
- * Emit a single element using "old" DrawArrays protocol from
- * EXT_vertex_arrays / OpenGL 1.1.
- */
-GLubyte *
-emit_element_old(GLubyte * dst,
-                 const struct array_state_vector * arrays, unsigned index)
-{
-   unsigned i;
-
-
-   for (i = 0; i < arrays->num_arrays; i++) {
-      if (arrays->arrays[i].enabled) {
-         const size_t offset = index * arrays->arrays[i].true_stride;
-
-         (void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
-                       arrays->arrays[i].element_size);
-
-         dst += __GLX_PAD(arrays->arrays[i].element_size);
-      }
-   }
-
-   return dst;
-}
-
-
-struct array_state *
-get_array_entry(const struct array_state_vector *arrays,
-                GLenum key, unsigned index)
-{
-   unsigned i;
-
-   for (i = 0; i < arrays->num_arrays; i++) {
-      if ((arrays->arrays[i].key == key)
-          && (arrays->arrays[i].index == index)) {
-         return &arrays->arrays[i];
-      }
-   }
-
-   return NULL;
-}
-
-
-static GLboolean
-allocate_array_info_cache(struct array_state_vector *arrays,
-                          size_t required_size)
-{
-#define MAX_HEADER_SIZE 20
-   if (arrays->array_info_cache_buffer_size < required_size) {
-      GLubyte *temp = realloc(arrays->array_info_cache_base,
-                              required_size + MAX_HEADER_SIZE);
-
-      if (temp == NULL) {
-         return GL_FALSE;
-      }
-
-      arrays->array_info_cache_base = temp;
-      arrays->array_info_cache = temp + MAX_HEADER_SIZE;
-      arrays->array_info_cache_buffer_size = required_size;
-   }
-
-   arrays->array_info_cache_size = required_size;
-   return GL_TRUE;
-}
-
-
-/**
- */
-void
-fill_array_info_cache(struct array_state_vector *arrays)
-{
-   GLboolean old_DrawArrays_possible;
-   unsigned i;
-
-
-   /* Determine how many arrays are enabled.
-    */
-
-   arrays->enabled_client_array_count = 0;
-   old_DrawArrays_possible = arrays->old_DrawArrays_possible;
-   for (i = 0; i < arrays->num_arrays; i++) {
-      if (arrays->arrays[i].enabled) {
-         arrays->enabled_client_array_count++;
-         old_DrawArrays_possible &= arrays->arrays[i].old_DrawArrays_possible;
-      }
-   }
-
-   if (arrays->new_DrawArrays_possible) {
-      assert(!arrays->new_DrawArrays_possible);
-   }
-   else if (old_DrawArrays_possible) {
-      const size_t required_size = arrays->enabled_client_array_count * 12;
-      uint32_t *info;
-
-
-      if (!allocate_array_info_cache(arrays, required_size)) {
-         return;
-      }
-
-
-      info = (uint32_t *) arrays->array_info_cache;
-      for (i = 0; i < arrays->num_arrays; i++) {
-         if (arrays->arrays[i].enabled) {
-            *(info++) = arrays->arrays[i].data_type;
-            *(info++) = arrays->arrays[i].count;
-            *(info++) = arrays->arrays[i].key;
-         }
-      }
-
-      arrays->DrawArrays = emit_DrawArrays_old;
-      arrays->DrawElements = emit_DrawElements_old;
-   }
-   else {
-      arrays->DrawArrays = emit_DrawArrays_none;
-      arrays->DrawElements = emit_DrawElements_none;
-   }
-
-   arrays->array_info_cache_valid = GL_TRUE;
-}
-
-
-/**
- * Emit a \c glDrawArrays command using the "none" protocol.  That is,
- * emit immediate-mode commands that are equivalent to the requiested
- * \c glDrawArrays command.  This is used with servers that don't support
- * the OpenGL 1.1 / EXT_vertex_arrays DrawArrays protocol or in cases where
- * vertex state is enabled that is not compatible with that protocol.
- */
-void
-emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-   size_t single_vertex_size;
-   GLubyte *pc;
-   unsigned i;
-   static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
-   static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
-
-
-   single_vertex_size = calculate_single_vertex_size_none(arrays);
-
-   pc = gc->pc;
-
-   (void) memcpy(pc, begin_cmd, 4);
-   *(int *) (pc + 4) = mode;
-
-   pc += 8;
-
-   for (i = 0; i < count; i++) {
-      if ((pc + single_vertex_size) >= gc->bufEnd) {
-         pc = __glXFlushRenderBuffer(gc, pc);
-      }
-
-      pc = emit_element_none(pc, arrays, first + i);
-   }
-
-   if ((pc + 4) >= gc->bufEnd) {
-      pc = __glXFlushRenderBuffer(gc, pc);
-   }
-
-   (void) memcpy(pc, end_cmd, 4);
-   pc += 4;
-
-   gc->pc = pc;
-   if (gc->pc > gc->limit) {
-      (void) __glXFlushRenderBuffer(gc, gc->pc);
-   }
-}
-
-
-/**
- * Emit the header data for the GL 1.1 / EXT_vertex_arrays DrawArrays
- * protocol.
- *
- * \param gc                    GLX context.
- * \param arrays                Array state.
- * \param elements_per_request  Location to store the number of elements that
- *                              can fit in a single Render / RenderLarge
- *                              command.
- * \param total_request         Total number of requests for a RenderLarge
- *                              command.  If a Render command is used, this
- *                              will be zero.
- * \param mode                  Drawing mode.
- * \param count                 Number of vertices.
- *
- * \returns
- * A pointer to the buffer for array data.
- */
-static GLubyte *
-emit_DrawArrays_header_old(__GLXcontext * gc,
-                           struct array_state_vector *arrays,
-                           size_t * elements_per_request,
-                           unsigned int *total_requests,
-                           GLenum mode, GLsizei count)
-{
-   size_t command_size;
-   size_t single_vertex_size;
-   const unsigned header_size = 16;
-   unsigned i;
-   GLubyte *pc;
-
-
-   /* Determine the size of the whole command.  This includes the header,
-    * the ARRAY_INFO data and the array data.  Once this size is calculated,
-    * it will be known whether a Render or RenderLarge command is needed.
-    */
-
-   single_vertex_size = 0;
-   for (i = 0; i < arrays->num_arrays; i++) {
-      if (arrays->arrays[i].enabled) {
-         single_vertex_size += __GLX_PAD(arrays->arrays[i].element_size);
-      }
-   }
-
-   command_size = arrays->array_info_cache_size + header_size
-      + (single_vertex_size * count);
-
-
-   /* Write the header for either a Render command or a RenderLarge
-    * command.  After the header is written, write the ARRAY_INFO data.
-    */
-
-   if (command_size > gc->maxSmallRenderCommandSize) {
-      /* maxSize is the maximum amount of data can be stuffed into a single
-       * packet.  sz_xGLXRenderReq is added because bufSize is the maximum
-       * packet size minus sz_xGLXRenderReq.
-       */
-      const size_t maxSize = (gc->bufSize + sz_xGLXRenderReq)
-         - sz_xGLXRenderLargeReq;
-      unsigned vertex_requests;
-
-
-      /* Calculate the number of data packets that will be required to send
-       * the whole command.  To do this, the number of verticies that
-       * will fit in a single buffer must be calculated.
-       *
-       * The important value here is elements_per_request.  This is the
-       * number of complete array elements that will fit in a single
-       * buffer.  There may be some wasted space at the end of the buffer,
-       * but splitting elements across buffer boundries would be painful.
-       */
-
-      elements_per_request[0] = maxSize / single_vertex_size;
-
-      vertex_requests = (count + elements_per_request[0] - 1)
-         / elements_per_request[0];
-
-      *total_requests = vertex_requests + 1;
-
-
-      __glXFlushRenderBuffer(gc, gc->pc);
-
-      command_size += 4;
-
-      pc = ((GLubyte *) arrays->array_info_cache) - (header_size + 4);
-      *(uint32_t *) (pc + 0) = command_size;
-      *(uint32_t *) (pc + 4) = X_GLrop_DrawArrays;
-      *(uint32_t *) (pc + 8) = count;
-      *(uint32_t *) (pc + 12) = arrays->enabled_client_array_count;
-      *(uint32_t *) (pc + 16) = mode;
-
-      __glXSendLargeChunk(gc, 1, *total_requests, pc,
-                          header_size + 4 + arrays->array_info_cache_size);
-
-      pc = gc->pc;
-   }
-   else {
-      if ((gc->pc + command_size) >= gc->bufEnd) {
-         (void) __glXFlushRenderBuffer(gc, gc->pc);
-      }
-
-      pc = gc->pc;
-      *(uint16_t *) (pc + 0) = command_size;
-      *(uint16_t *) (pc + 2) = X_GLrop_DrawArrays;
-      *(uint32_t *) (pc + 4) = count;
-      *(uint32_t *) (pc + 8) = arrays->enabled_client_array_count;
-      *(uint32_t *) (pc + 12) = mode;
-
-      pc += header_size;
-
-      (void) memcpy(pc, arrays->array_info_cache,
-                    arrays->array_info_cache_size);
-      pc += arrays->array_info_cache_size;
-
-      *elements_per_request = count;
-      *total_requests = 0;
-   }
-
-
-   return pc;
-}
-
-
-/**
- */
-void
-emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-   GLubyte *pc;
-   size_t elements_per_request;
-   unsigned total_requests = 0;
-   unsigned i;
-   size_t total_sent = 0;
-
-
-   pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
-                                   &total_requests, mode, count);
-
-
-   /* Write the arrays.
-    */
-
-   if (total_requests == 0) {
-      assert(elements_per_request >= count);
-
-      for (i = 0; i < count; i++) {
-         pc = emit_element_old(pc, arrays, i + first);
-      }
-
-      assert(pc <= gc->bufEnd);
-
-      gc->pc = pc;
-      if (gc->pc > gc->limit) {
-         (void) __glXFlushRenderBuffer(gc, gc->pc);
-      }
-   }
-   else {
-      unsigned req;
-
-
-      for (req = 2; req <= total_requests; req++) {
-         if (count < elements_per_request) {
-            elements_per_request = count;
-         }
-
-         pc = gc->pc;
-         for (i = 0; i < elements_per_request; i++) {
-            pc = emit_element_old(pc, arrays, i + first);
-         }
-
-         first += elements_per_request;
-
-         total_sent += (size_t) (pc - gc->pc);
-         __glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
-
-         count -= elements_per_request;
-      }
-   }
-}
-
-
-void
-emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
-                       const GLvoid * indices)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
-   static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
-
-   GLubyte *pc;
-   size_t single_vertex_size;
-   unsigned i;
-
-
-   single_vertex_size = calculate_single_vertex_size_none(arrays);
-
-
-   if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
-      gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
-   }
-
-   pc = gc->pc;
-
-   (void) memcpy(pc, begin_cmd, 4);
-   *(int *) (pc + 4) = mode;
-
-   pc += 8;
-
-   for (i = 0; i < count; i++) {
-      unsigned index = 0;
-
-      if ((pc + single_vertex_size) >= gc->bufEnd) {
-         pc = __glXFlushRenderBuffer(gc, pc);
-      }
-
-      switch (type) {
-      case GL_UNSIGNED_INT:
-         index = (unsigned) (((GLuint *) indices)[i]);
-         break;
-      case GL_UNSIGNED_SHORT:
-         index = (unsigned) (((GLushort *) indices)[i]);
-         break;
-      case GL_UNSIGNED_BYTE:
-         index = (unsigned) (((GLubyte *) indices)[i]);
-         break;
-      }
-      pc = emit_element_none(pc, arrays, index);
-   }
-
-   if ((pc + 4) >= gc->bufEnd) {
-      pc = __glXFlushRenderBuffer(gc, pc);
-   }
-
-   (void) memcpy(pc, end_cmd, 4);
-   pc += 4;
-
-   gc->pc = pc;
-   if (gc->pc > gc->limit) {
-      (void) __glXFlushRenderBuffer(gc, gc->pc);
-   }
-}
-
-
-/**
- */
-void
-emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
-                      const GLvoid * indices)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-   GLubyte *pc;
-   size_t elements_per_request;
-   unsigned total_requests = 0;
-   unsigned i;
-   unsigned req;
-   unsigned req_element = 0;
-
-
-   pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
-                                   &total_requests, mode, count);
-
-
-   /* Write the arrays.
-    */
-
-   req = 2;
-   while (count > 0) {
-      if (count < elements_per_request) {
-         elements_per_request = count;
-      }
-
-      switch (type) {
-      case GL_UNSIGNED_INT:{
-            const GLuint *ui_ptr = (const GLuint *) indices + req_element;
-
-            for (i = 0; i < elements_per_request; i++) {
-               const GLint index = (GLint) * (ui_ptr++);
-               pc = emit_element_old(pc, arrays, index);
-            }
-            break;
-         }
-      case GL_UNSIGNED_SHORT:{
-            const GLushort *us_ptr = (const GLushort *) indices + req_element;
-
-            for (i = 0; i < elements_per_request; i++) {
-               const GLint index = (GLint) * (us_ptr++);
-               pc = emit_element_old(pc, arrays, index);
-            }
-            break;
-         }
-      case GL_UNSIGNED_BYTE:{
-            const GLubyte *ub_ptr = (const GLubyte *) indices + req_element;
-
-            for (i = 0; i < elements_per_request; i++) {
-               const GLint index = (GLint) * (ub_ptr++);
-               pc = emit_element_old(pc, arrays, index);
-            }
-            break;
-         }
-      }
-
-      if (total_requests != 0) {
-         __glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
-         pc = gc->pc;
-         req++;
-      }
-
-      count -= elements_per_request;
-      req_element += elements_per_request;
-   }
-
-
-   assert((total_requests == 0) || ((req - 1) == total_requests));
-
-   if (total_requests == 0) {
-      assert(pc <= gc->bufEnd);
-
-      gc->pc = pc;
-      if (gc->pc > gc->limit) {
-         (void) __glXFlushRenderBuffer(gc, gc->pc);
-      }
-   }
-}
-
-
-/**
- * Validate that the \c mode parameter to \c glDrawArrays, et. al. is valid.
- * If it is not valid, then an error code is set in the GLX context.
- *
- * \returns
- * \c GL_TRUE if the argument is valid, \c GL_FALSE if is not.
- */
-static GLboolean
-validate_mode(__GLXcontext * gc, GLenum mode)
-{
-   switch (mode) {
-   case GL_POINTS:
-   case GL_LINE_STRIP:
-   case GL_LINE_LOOP:
-   case GL_LINES:
-   case GL_TRIANGLE_STRIP:
-   case GL_TRIANGLE_FAN:
-   case GL_TRIANGLES:
-   case GL_QUAD_STRIP:
-   case GL_QUADS:
-   case GL_POLYGON:
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return GL_FALSE;
-   }
-
-   return GL_TRUE;
-}
-
-
-/**
- * Validate that the \c count parameter to \c glDrawArrays, et. al. is valid.
- * A value less than zero is invalid and will result in \c GL_INVALID_VALUE
- * being set.  A value of zero will not result in an error being set, but
- * will result in \c GL_FALSE being returned.
- *
- * \returns
- * \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
- */
-static GLboolean
-validate_count(__GLXcontext * gc, GLsizei count)
-{
-   if (count < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-   }
-
-   return (count > 0);
-}
-
-
-/**
- * Validate that the \c type parameter to \c glDrawElements, et. al. is
- * valid.  Only \c GL_UNSIGNED_BYTE, \c GL_UNSIGNED_SHORT, and
- * \c GL_UNSIGNED_INT are valid.
- *
- * \returns
- * \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
- */
-static GLboolean
-validate_type(__GLXcontext * gc, GLenum type)
-{
-   switch (type) {
-   case GL_UNSIGNED_INT:
-   case GL_UNSIGNED_SHORT:
-   case GL_UNSIGNED_BYTE:
-      return GL_TRUE;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-
-   if (validate_mode(gc, mode) && validate_count(gc, count)) {
-      if (!arrays->array_info_cache_valid) {
-         fill_array_info_cache(arrays);
-      }
-
-      arrays->DrawArrays(mode, first, count);
-   }
-}
-
-
-void
-__indirect_glArrayElement(GLint index)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-   size_t single_vertex_size;
-
-
-   single_vertex_size = calculate_single_vertex_size_none(arrays);
-
-   if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
-      gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
-   }
-
-   gc->pc = emit_element_none(gc->pc, arrays, index);
-
-   if (gc->pc > gc->limit) {
-      (void) __glXFlushRenderBuffer(gc, gc->pc);
-   }
-}
-
-
-void
-__indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type,
-                          const GLvoid * indices)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-
-   if (validate_mode(gc, mode) && validate_count(gc, count)
-       && validate_type(gc, type)) {
-      if (!arrays->array_info_cache_valid) {
-         fill_array_info_cache(arrays);
-      }
-
-      arrays->DrawElements(mode, count, type, indices);
-   }
-}
-
-
-void
-__indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
-                               GLsizei count, GLenum type,
-                               const GLvoid * indices)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-
-
-   if (validate_mode(gc, mode) && validate_count(gc, count)
-       && validate_type(gc, type)) {
-      if (end < start) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-
-      if (!arrays->array_info_cache_valid) {
-         fill_array_info_cache(arrays);
-      }
-
-      arrays->DrawElements(mode, count, type, indices);
-   }
-}
-
-
-void
-__indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count,
-                                GLsizei primcount)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   GLsizei i;
-
-
-   if (validate_mode(gc, mode)) {
-      if (!arrays->array_info_cache_valid) {
-         fill_array_info_cache(arrays);
-      }
-
-      for (i = 0; i < primcount; i++) {
-         if (validate_count(gc, count[i])) {
-            arrays->DrawArrays(mode, first[i], count[i]);
-         }
-      }
-   }
-}
-
-
-void
-__indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count,
-                                  GLenum type, const GLvoid ** indices,
-                                  GLsizei primcount)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   const __GLXattribute *state =
-      (const __GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   GLsizei i;
-
-
-   if (validate_mode(gc, mode) && validate_type(gc, type)) {
-      if (!arrays->array_info_cache_valid) {
-         fill_array_info_cache(arrays);
-      }
-
-      for (i = 0; i < primcount; i++) {
-         if (validate_count(gc, count[i])) {
-            arrays->DrawElements(mode, count[i], type, indices[i]);
-         }
-      }
-   }
-}
-
-
-#define COMMON_ARRAY_DATA_INIT(a, PTR, TYPE, STRIDE, COUNT, NORMALIZED, HDR_SIZE, OPCODE) \
-  do {                                                                  \
-    (a)->data = PTR;                                                    \
-    (a)->data_type = TYPE;                                              \
-    (a)->user_stride = STRIDE;                                          \
-    (a)->count = COUNT;                                                 \
-    (a)->normalized = NORMALIZED;                                       \
-                                                                        \
-    (a)->element_size = __glXTypeSize( TYPE ) * COUNT;                  \
-    (a)->true_stride = (STRIDE == 0)                                    \
-      ? (a)->element_size : STRIDE;                                     \
-                                                                        \
-    (a)->header_size = HDR_SIZE;                                        \
-    ((uint16_t *) (a)->header)[0] = __GLX_PAD((a)->header_size + (a)->element_size); \
-    ((uint16_t *) (a)->header)[1] = OPCODE;                             \
-  } while(0)
-
-
-void
-__indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride,
-                           const GLvoid * pointer)
-{
-   static const uint16_t short_ops[5] = {
-      0, 0, X_GLrop_Vertex2sv, X_GLrop_Vertex3sv, X_GLrop_Vertex4sv
-   };
-   static const uint16_t int_ops[5] = {
-      0, 0, X_GLrop_Vertex2iv, X_GLrop_Vertex3iv, X_GLrop_Vertex4iv
-   };
-   static const uint16_t float_ops[5] = {
-      0, 0, X_GLrop_Vertex2fv, X_GLrop_Vertex3fv, X_GLrop_Vertex4fv
-   };
-   static const uint16_t double_ops[5] = {
-      0, 0, X_GLrop_Vertex2dv, X_GLrop_Vertex3dv, X_GLrop_Vertex4dv
-   };
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   if (size < 2 || size > 4 || stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   switch (type) {
-   case GL_SHORT:
-      opcode = short_ops[size];
-      break;
-   case GL_INT:
-      opcode = int_ops[size];
-      break;
-   case GL_FLOAT:
-      opcode = float_ops[size];
-      break;
-   case GL_DOUBLE:
-      opcode = double_ops[size];
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   a = get_array_entry(arrays, GL_VERTEX_ARRAY, 0);
-   assert(a != NULL);
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE, 4,
-                          opcode);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glNormalPointer(GLenum type, GLsizei stride,
-                           const GLvoid * pointer)
-{
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   if (stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   switch (type) {
-   case GL_BYTE:
-      opcode = X_GLrop_Normal3bv;
-      break;
-   case GL_SHORT:
-      opcode = X_GLrop_Normal3sv;
-      break;
-   case GL_INT:
-      opcode = X_GLrop_Normal3iv;
-      break;
-   case GL_FLOAT:
-      opcode = X_GLrop_Normal3fv;
-      break;
-   case GL_DOUBLE:
-      opcode = X_GLrop_Normal3dv;
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   a = get_array_entry(arrays, GL_NORMAL_ARRAY, 0);
-   assert(a != NULL);
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 3, GL_TRUE, 4, opcode);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glColorPointer(GLint size, GLenum type, GLsizei stride,
-                          const GLvoid * pointer)
-{
-   static const uint16_t byte_ops[5] = {
-      0, 0, 0, X_GLrop_Color3bv, X_GLrop_Color4bv
-   };
-   static const uint16_t ubyte_ops[5] = {
-      0, 0, 0, X_GLrop_Color3ubv, X_GLrop_Color4ubv
-   };
-   static const uint16_t short_ops[5] = {
-      0, 0, 0, X_GLrop_Color3sv, X_GLrop_Color4sv
-   };
-   static const uint16_t ushort_ops[5] = {
-      0, 0, 0, X_GLrop_Color3usv, X_GLrop_Color4usv
-   };
-   static const uint16_t int_ops[5] = {
-      0, 0, 0, X_GLrop_Color3iv, X_GLrop_Color4iv
-   };
-   static const uint16_t uint_ops[5] = {
-      0, 0, 0, X_GLrop_Color3uiv, X_GLrop_Color4uiv
-   };
-   static const uint16_t float_ops[5] = {
-      0, 0, 0, X_GLrop_Color3fv, X_GLrop_Color4fv
-   };
-   static const uint16_t double_ops[5] = {
-      0, 0, 0, X_GLrop_Color3dv, X_GLrop_Color4dv
-   };
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   if (size < 3 || size > 4 || stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   switch (type) {
-   case GL_BYTE:
-      opcode = byte_ops[size];
-      break;
-   case GL_UNSIGNED_BYTE:
-      opcode = ubyte_ops[size];
-      break;
-   case GL_SHORT:
-      opcode = short_ops[size];
-      break;
-   case GL_UNSIGNED_SHORT:
-      opcode = ushort_ops[size];
-      break;
-   case GL_INT:
-      opcode = int_ops[size];
-      break;
-   case GL_UNSIGNED_INT:
-      opcode = uint_ops[size];
-      break;
-   case GL_FLOAT:
-      opcode = float_ops[size];
-      break;
-   case GL_DOUBLE:
-      opcode = double_ops[size];
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   a = get_array_entry(arrays, GL_COLOR_ARRAY, 0);
-   assert(a != NULL);
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid * pointer)
-{
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   if (stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   switch (type) {
-   case GL_UNSIGNED_BYTE:
-      opcode = X_GLrop_Indexubv;
-      break;
-   case GL_SHORT:
-      opcode = X_GLrop_Indexsv;
-      break;
-   case GL_INT:
-      opcode = X_GLrop_Indexiv;
-      break;
-   case GL_FLOAT:
-      opcode = X_GLrop_Indexfv;
-      break;
-   case GL_DOUBLE:
-      opcode = X_GLrop_Indexdv;
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   a = get_array_entry(arrays, GL_INDEX_ARRAY, 0);
-   assert(a != NULL);
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid * pointer)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   if (stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-
-   a = get_array_entry(arrays, GL_EDGE_FLAG_ARRAY, 0);
-   assert(a != NULL);
-   COMMON_ARRAY_DATA_INIT(a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE,
-                          4, X_GLrop_EdgeFlagv);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
-                             const GLvoid * pointer)
-{
-   static const uint16_t short_ops[5] = {
-      0, X_GLrop_TexCoord1sv, X_GLrop_TexCoord2sv, X_GLrop_TexCoord3sv,
-      X_GLrop_TexCoord4sv
-   };
-   static const uint16_t int_ops[5] = {
-      0, X_GLrop_TexCoord1iv, X_GLrop_TexCoord2iv, X_GLrop_TexCoord3iv,
-      X_GLrop_TexCoord4iv
-   };
-   static const uint16_t float_ops[5] = {
-      0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2fv, X_GLrop_TexCoord3fv,
-      X_GLrop_TexCoord4fv
-   };
-   static const uint16_t double_ops[5] = {
-      0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2dv, X_GLrop_TexCoord3dv,
-      X_GLrop_TexCoord4dv
-   };
-
-   static const uint16_t mshort_ops[5] = {
-      0, X_GLrop_MultiTexCoord1svARB, X_GLrop_MultiTexCoord2svARB,
-      X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
-   };
-   static const uint16_t mint_ops[5] = {
-      0, X_GLrop_MultiTexCoord1ivARB, X_GLrop_MultiTexCoord2ivARB,
-      X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
-   };
-   static const uint16_t mfloat_ops[5] = {
-      0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2fvARB,
-      X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
-   };
-   static const uint16_t mdouble_ops[5] = {
-      0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2dvARB,
-      X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
-   };
-
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-   unsigned header_size;
-   unsigned index;
-
-
-   if (size < 1 || size > 4 || stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   index = arrays->active_texture_unit;
-   if (index == 0) {
-      switch (type) {
-      case GL_SHORT:
-         opcode = short_ops[size];
-         break;
-      case GL_INT:
-         opcode = int_ops[size];
-         break;
-      case GL_FLOAT:
-         opcode = float_ops[size];
-         break;
-      case GL_DOUBLE:
-         opcode = double_ops[size];
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_ENUM);
-         return;
-      }
-
-      header_size = 4;
-   }
-   else {
-      switch (type) {
-      case GL_SHORT:
-         opcode = mshort_ops[size];
-         break;
-      case GL_INT:
-         opcode = mint_ops[size];
-         break;
-      case GL_FLOAT:
-         opcode = mfloat_ops[size];
-         break;
-      case GL_DOUBLE:
-         opcode = mdouble_ops[size];
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_ENUM);
-         return;
-      }
-
-      header_size = 8;
-   }
-
-   a = get_array_entry(arrays, GL_TEXTURE_COORD_ARRAY, index);
-   assert(a != NULL);
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE,
-                          header_size, opcode);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride,
-                                      const GLvoid * pointer)
-{
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   if (size != 3 || stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   switch (type) {
-   case GL_BYTE:
-      opcode = 4126;
-      break;
-   case GL_UNSIGNED_BYTE:
-      opcode = 4131;
-      break;
-   case GL_SHORT:
-      opcode = 4127;
-      break;
-   case GL_UNSIGNED_SHORT:
-      opcode = 4132;
-      break;
-   case GL_INT:
-      opcode = 4128;
-      break;
-   case GL_UNSIGNED_INT:
-      opcode = 4133;
-      break;
-   case GL_FLOAT:
-      opcode = 4129;
-      break;
-   case GL_DOUBLE:
-      opcode = 4130;
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   a = get_array_entry(arrays, GL_SECONDARY_COLOR_ARRAY, 0);
-   if (a == NULL) {
-      __glXSetError(gc, GL_INVALID_OPERATION);
-      return;
-   }
-
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride,
-                                const GLvoid * pointer)
-{
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   if (stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   switch (type) {
-   case GL_FLOAT:
-      opcode = 4124;
-      break;
-   case GL_DOUBLE:
-      opcode = 4125;
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   a = get_array_entry(arrays, GL_FOG_COORD_ARRAY, 0);
-   if (a == NULL) {
-      __glXSetError(gc, GL_INVALID_OPERATION);
-      return;
-   }
-
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-void
-__indirect_glVertexAttribPointerARB(GLuint index, GLint size,
-                                    GLenum type, GLboolean normalized,
-                                    GLsizei stride, const GLvoid * pointer)
-{
-   static const uint16_t short_ops[5] = { 0, 4189, 4190, 4191, 4192 };
-   static const uint16_t float_ops[5] = { 0, 4193, 4194, 4195, 4196 };
-   static const uint16_t double_ops[5] = { 0, 4197, 4198, 4199, 4200 };
-
-   uint16_t opcode;
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-   unsigned true_immediate_count;
-   unsigned true_immediate_size;
-
-
-   if ((size < 1) || (size > 4) || (stride < 0)
-       || (index > arrays->num_vertex_program_attribs)) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-   if (normalized && (type != GL_FLOAT) && (type != GL_DOUBLE)) {
-      switch (type) {
-      case GL_BYTE:
-         opcode = X_GLrop_VertexAttrib4NbvARB;
-         break;
-      case GL_UNSIGNED_BYTE:
-         opcode = X_GLrop_VertexAttrib4NubvARB;
-         break;
-      case GL_SHORT:
-         opcode = X_GLrop_VertexAttrib4NsvARB;
-         break;
-      case GL_UNSIGNED_SHORT:
-         opcode = X_GLrop_VertexAttrib4NusvARB;
-         break;
-      case GL_INT:
-         opcode = X_GLrop_VertexAttrib4NivARB;
-         break;
-      case GL_UNSIGNED_INT:
-         opcode = X_GLrop_VertexAttrib4NuivARB;
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_ENUM);
-         return;
-      }
-
-      true_immediate_count = 4;
-   }
-   else {
-      true_immediate_count = size;
-
-      switch (type) {
-      case GL_BYTE:
-         opcode = X_GLrop_VertexAttrib4bvARB;
-         true_immediate_count = 4;
-         break;
-      case GL_UNSIGNED_BYTE:
-         opcode = X_GLrop_VertexAttrib4ubvARB;
-         true_immediate_count = 4;
-         break;
-      case GL_SHORT:
-         opcode = short_ops[size];
-         break;
-      case GL_UNSIGNED_SHORT:
-         opcode = X_GLrop_VertexAttrib4usvARB;
-         true_immediate_count = 4;
-         break;
-      case GL_INT:
-         opcode = X_GLrop_VertexAttrib4ivARB;
-         true_immediate_count = 4;
-         break;
-      case GL_UNSIGNED_INT:
-         opcode = X_GLrop_VertexAttrib4uivARB;
-         true_immediate_count = 4;
-         break;
-      case GL_FLOAT:
-         opcode = float_ops[size];
-         break;
-      case GL_DOUBLE:
-         opcode = double_ops[size];
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_ENUM);
-         return;
-      }
-   }
-
-   a = get_array_entry(arrays, GL_VERTEX_ATTRIB_ARRAY_POINTER, index);
-   if (a == NULL) {
-      __glXSetError(gc, GL_INVALID_OPERATION);
-      return;
-   }
-
-   COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, normalized, 8,
-                          opcode);
-
-   true_immediate_size = __glXTypeSize(type) * true_immediate_count;
-   ((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size
-                                             + true_immediate_size);
-
-   if (a->enabled) {
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-}
-
-
-/**
- * I don't have 100% confidence that this is correct.  The different rules
- * about whether or not generic vertex attributes alias "classic" vertex
- * attributes (i.e., attrib1 ?= primary color) between ARB_vertex_program,
- * ARB_vertex_shader, and NV_vertex_program are a bit confusing.  My
- * feeling is that the client-side doesn't have to worry about it.  The
- * client just sends all the data to the server and lets the server deal
- * with it.
- */
-void
-__indirect_glVertexAttribPointerNV(GLuint index, GLint size,
-                                   GLenum type, GLsizei stride,
-                                   const GLvoid * pointer)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   GLboolean normalized = GL_FALSE;
-
-
-   switch (type) {
-   case GL_UNSIGNED_BYTE:
-      if (size != 4) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      normalized = GL_TRUE;
-
-   case GL_SHORT:
-   case GL_FLOAT:
-   case GL_DOUBLE:
-      __indirect_glVertexAttribPointerARB(index, size, type,
-                                          normalized, stride, pointer);
-      return;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-}
-
-
-void
-__indirect_glClientActiveTextureARB(GLenum texture)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-   __GLXattribute *const state =
-      (__GLXattribute *) (gc->client_state_private);
-   struct array_state_vector *const arrays = state->array_state;
-   const GLint unit = (GLint) texture - GL_TEXTURE0;
-
-
-   if ((unit < 0) || (unit >= arrays->num_texture_units)) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   arrays->active_texture_unit = unit;
-}
-
-
-/**
- * Modify the enable state for the selected array
- */
-GLboolean
-__glXSetArrayEnable(__GLXattribute * state, GLenum key, unsigned index,
-                    GLboolean enable)
-{
-   struct array_state_vector *arrays = state->array_state;
-   struct array_state *a;
-
-
-   /* Texture coordinate arrays have an implict index set when the
-    * application calls glClientActiveTexture.
-    */
-   if (key == GL_TEXTURE_COORD_ARRAY) {
-      index = arrays->active_texture_unit;
-   }
-
-   a = get_array_entry(arrays, key, index);
-
-   if ((a != NULL) && (a->enabled != enable)) {
-      a->enabled = enable;
-      arrays->array_info_cache_valid = GL_FALSE;
-   }
-
-   return (a != NULL);
-}
-
-
-void
-__glXArrayDisableAll(__GLXattribute * state)
-{
-   struct array_state_vector *arrays = state->array_state;
-   unsigned i;
-
-
-   for (i = 0; i < arrays->num_arrays; i++) {
-      arrays->arrays[i].enabled = GL_FALSE;
-   }
-
-   arrays->array_info_cache_valid = GL_FALSE;
-}
-
-
-/**
- */
-GLboolean
-__glXGetArrayEnable(const __GLXattribute * const state,
-                    GLenum key, unsigned index, GLintptr * dest)
-{
-   const struct array_state_vector *arrays = state->array_state;
-   const struct array_state *a =
-      get_array_entry((struct array_state_vector *) arrays,
-                      key, index);
-
-   if (a != NULL) {
-      *dest = (GLintptr) a->enabled;
-   }
-
-   return (a != NULL);
-}
-
-
-/**
- */
-GLboolean
-__glXGetArrayType(const __GLXattribute * const state,
-                  GLenum key, unsigned index, GLintptr * dest)
-{
-   const struct array_state_vector *arrays = state->array_state;
-   const struct array_state *a =
-      get_array_entry((struct array_state_vector *) arrays,
-                      key, index);
-
-   if (a != NULL) {
-      *dest = (GLintptr) a->data_type;
-   }
-
-   return (a != NULL);
-}
-
-
-/**
- */
-GLboolean
-__glXGetArraySize(const __GLXattribute * const state,
-                  GLenum key, unsigned index, GLintptr * dest)
-{
-   const struct array_state_vector *arrays = state->array_state;
-   const struct array_state *a =
-      get_array_entry((struct array_state_vector *) arrays,
-                      key, index);
-
-   if (a != NULL) {
-      *dest = (GLintptr) a->count;
-   }
-
-   return (a != NULL);
-}
-
-
-/**
- */
-GLboolean
-__glXGetArrayStride(const __GLXattribute * const state,
-                    GLenum key, unsigned index, GLintptr * dest)
-{
-   const struct array_state_vector *arrays = state->array_state;
-   const struct array_state *a =
-      get_array_entry((struct array_state_vector *) arrays,
-                      key, index);
-
-   if (a != NULL) {
-      *dest = (GLintptr) a->user_stride;
-   }
-
-   return (a != NULL);
-}
-
-
-/**
- */
-GLboolean
-__glXGetArrayPointer(const __GLXattribute * const state,
-                     GLenum key, unsigned index, void **dest)
-{
-   const struct array_state_vector *arrays = state->array_state;
-   const struct array_state *a =
-      get_array_entry((struct array_state_vector *) arrays,
-                      key, index);
-
-
-   if (a != NULL) {
-      *dest = (void *) (a->data);
-   }
-
-   return (a != NULL);
-}
-
-
-/**
- */
-GLboolean
-__glXGetArrayNormalized(const __GLXattribute * const state,
-                        GLenum key, unsigned index, GLintptr * dest)
-{
-   const struct array_state_vector *arrays = state->array_state;
-   const struct array_state *a =
-      get_array_entry((struct array_state_vector *) arrays,
-                      key, index);
-
-
-   if (a != NULL) {
-      *dest = (GLintptr) a->normalized;
-   }
-
-   return (a != NULL);
-}
-
-
-/**
- */
-GLuint
-__glXGetActiveTextureUnit(const __GLXattribute * const state)
-{
-   return state->array_state->active_texture_unit;
-}
-
-
-void
-__glXPushArrayState(__GLXattribute * state)
-{
-   struct array_state_vector *arrays = state->array_state;
-   struct array_stack_state *stack =
-      &arrays->stack[(arrays->stack_index * arrays->num_arrays)];
-   unsigned i;
-
-   /* XXX are we pushing _all_ the necessary fields? */
-   for (i = 0; i < arrays->num_arrays; i++) {
-      stack[i].data = arrays->arrays[i].data;
-      stack[i].data_type = arrays->arrays[i].data_type;
-      stack[i].user_stride = arrays->arrays[i].user_stride;
-      stack[i].count = arrays->arrays[i].count;
-      stack[i].key = arrays->arrays[i].key;
-      stack[i].index = arrays->arrays[i].index;
-      stack[i].enabled = arrays->arrays[i].enabled;
-   }
-
-   arrays->active_texture_unit_stack[arrays->stack_index] =
-      arrays->active_texture_unit;
-
-   arrays->stack_index++;
-}
-
-
-void
-__glXPopArrayState(__GLXattribute * state)
-{
-   struct array_state_vector *arrays = state->array_state;
-   struct array_stack_state *stack;
-   unsigned i;
-
-
-   arrays->stack_index--;
-   stack = &arrays->stack[(arrays->stack_index * arrays->num_arrays)];
-
-   for (i = 0; i < arrays->num_arrays; i++) {
-      switch (stack[i].key) {
-      case GL_NORMAL_ARRAY:
-         __indirect_glNormalPointer(stack[i].data_type,
-                                    stack[i].user_stride, stack[i].data);
-         break;
-      case GL_COLOR_ARRAY:
-         __indirect_glColorPointer(stack[i].count,
-                                   stack[i].data_type,
-                                   stack[i].user_stride, stack[i].data);
-         break;
-      case GL_INDEX_ARRAY:
-         __indirect_glIndexPointer(stack[i].data_type,
-                                   stack[i].user_stride, stack[i].data);
-         break;
-      case GL_EDGE_FLAG_ARRAY:
-         __indirect_glEdgeFlagPointer(stack[i].user_stride, stack[i].data);
-         break;
-      case GL_TEXTURE_COORD_ARRAY:
-         arrays->active_texture_unit = stack[i].index;
-         __indirect_glTexCoordPointer(stack[i].count,
-                                      stack[i].data_type,
-                                      stack[i].user_stride, stack[i].data);
-         break;
-      case GL_SECONDARY_COLOR_ARRAY:
-         __indirect_glSecondaryColorPointerEXT(stack[i].count,
-                                               stack[i].data_type,
-                                               stack[i].user_stride,
-                                               stack[i].data);
-         break;
-      case GL_FOG_COORDINATE_ARRAY:
-         __indirect_glFogCoordPointerEXT(stack[i].data_type,
-                                         stack[i].user_stride, stack[i].data);
-         break;
-
-      }
-
-      __glXSetArrayEnable(state, stack[i].key, stack[i].index,
-                          stack[i].enabled);
-   }
-
-   arrays->active_texture_unit =
-      arrays->active_texture_unit_stack[arrays->stack_index];
-}
diff --git a/src/glx/x11/indirect_vertex_array.h b/src/glx/x11/indirect_vertex_array.h
deleted file mode 100644 (file)
index 3738032..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004, 2005
- * 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
- * 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.
- */
-
-#ifndef INDIRECT_VERTEX_ARRAY_H
-#define INDIRECT_VERTEX_ARRAY_H
-
-extern const GLuint __glXTypeSize_table[16];
-
-#define __glXTypeSize(e) ((((e) & ~0x0f) != 0x1400) \
-    ? 0 : __glXTypeSize_table[ (e) & 0x0f ])
-
-extern void __glXArrayDisableAll(__GLXattribute * state);
-
-extern GLboolean __glXSetArrayEnable(__GLXattribute * state,
-                                     GLenum key, unsigned index,
-                                     GLboolean enable);
-
-extern GLboolean __glXGetArrayEnable(const __GLXattribute * const state,
-                                     GLenum key, unsigned index,
-                                     GLintptr * dest);
-extern GLboolean __glXGetArraySize(const __GLXattribute * const state,
-                                   GLenum key, unsigned index,
-                                   GLintptr * dest);
-extern GLboolean __glXGetArrayType(const __GLXattribute * const state,
-                                   GLenum key, unsigned index,
-                                   GLintptr * dest);
-extern GLboolean __glXGetArrayStride(const __GLXattribute * const state,
-                                     GLenum key, unsigned index,
-                                     GLintptr * dest);
-extern GLboolean __glXGetArrayPointer(const __GLXattribute * const state,
-                                      GLenum key, unsigned index,
-                                      void **dest);
-extern GLboolean __glXGetArrayNormalized(const __GLXattribute * const state,
-                                         GLenum key, unsigned index,
-                                         GLintptr * dest);
-
-extern void __glXPushArrayState(__GLXattribute * state);
-extern void __glXPopArrayState(__GLXattribute * state);
-
-extern GLuint __glXGetActiveTextureUnit(const __GLXattribute * const state);
-
-#endif /* INDIRECT_VERTEX_ARRAY_H */
diff --git a/src/glx/x11/indirect_vertex_array_priv.h b/src/glx/x11/indirect_vertex_array_priv.h
deleted file mode 100644 (file)
index 56dac37..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004, 2005
- * 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
- * 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.
- */
-
-#ifndef _INDIRECT_VA_PRIVATE_
-#define _INDIRECT_VA_PRIVATE_
-
-/**
- * \file indirect_va_private.h
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <inttypes.h>
-
-#include "glxclient.h"
-#include "indirect.h"
-#include <GL/glxproto.h>
-
-
-/**
- * State descriptor for a single array of vertex data.
- */
-struct array_state
-{
-    /**
-     * Pointer to the application supplied data.
-     */
-   const void *data;
-
-    /**
-     * Enum representing the type of the application supplied data.
-     */
-   GLenum data_type;
-
-    /**
-     * Stride value supplied by the application.  This value is not used
-     * internally.  It is only kept so that it can be queried by the
-     * application using glGet*v.
-     */
-   GLsizei user_stride;
-
-    /**
-     * Calculated size, in bytes, of a single element in the array.  This
-     * is calculated based on \c count and the size of the data type
-     * represented by \c data_type.
-     */
-   GLsizei element_size;
-
-    /**
-     * Actual byte-stride from one element to the next.  This value will
-     * be equal to either \c user_stride or \c element_stride.
-     */
-   GLsizei true_stride;
-
-    /**
-     * Number of data values in each element.
-     */
-   GLint count;
-
-    /**
-     * "Normalized" data is on the range [0,1] (unsigned) or [-1,1] (signed).
-     * This is used for mapping integral types to floating point types.
-     */
-   GLboolean normalized;
-
-    /**
-     * Pre-calculated GLX protocol command header.
-     */
-   uint32_t header[2];
-
-    /**
-     * Size of the header data.  For simple data, like glColorPointerfv,
-     * this is 4.  For complex data that requires either a count (e.g.,
-     * glWeightfvARB), an index (e.g., glVertexAttrib1fvARB), or a
-     * selector enum (e.g., glMultiTexCoord2fv) this is 8.
-     */
-   unsigned header_size;
-
-    /**
-     * Set to \c GL_TRUE if this array is enabled.  Otherwise, it is set
-     * to \c GL_FALSE.
-     */
-   GLboolean enabled;
-
-    /**
-     * For multi-arrayed data (e.g., texture coordinates, generic vertex
-     * program attributes, etc.), this specifies which array this is.
-     */
-   unsigned index;
-
-    /**
-     * Per-array-type key.  For most arrays, this will be the GL enum for
-     * that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY
-     * for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
-     * etc.).
-     */
-   GLenum key;
-
-    /**
-     * If this array can be used with the "classic" \c glDrawArrays protocol,
-     * this is set to \c GL_TRUE.  Otherwise, it is set to \c GL_FALSE.
-     */
-   GLboolean old_DrawArrays_possible;
-};
-
-
-/**
- * Array state that is pushed / poped by \c glPushClientAttrib and
- * \c glPopClientAttrib.
- */
-struct array_stack_state
-{
-    /**
-     * Pointer to the application supplied data.
-     */
-   const void *data;
-
-    /**
-     * Enum representing the type of the application supplied data.
-     */
-   GLenum data_type;
-
-    /**
-     * Stride value supplied by the application.  This value is not used
-     * internally.  It is only kept so that it can be queried by the
-     * application using glGet*v.
-     */
-   GLsizei user_stride;
-
-    /**
-     * Number of data values in each element.
-     */
-   GLint count;
-
-    /**
-     * Per-array-type key.  For most arrays, this will be the GL enum for
-     * that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY
-     * for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
-     * etc.).
-     */
-   GLenum key;
-
-    /**
-     * For multi-arrayed data (e.g., texture coordinates, generic vertex
-     * program attributes, etc.), this specifies which array this is.
-     */
-   unsigned index;
-
-    /**
-     * Set to \c GL_TRUE if this array is enabled.  Otherwise, it is set
-     * to \c GL_FALSE.
-     */
-   GLboolean enabled;
-};
-
-
-/**
- * Collection of all the vertex array state.
- */
-struct array_state_vector
-{
-    /**
-     * Number of arrays tracked by \c ::arrays.
-     */
-   size_t num_arrays;
-
-    /**
-     * Array of vertex array state.  This array contains all of the valid
-     * vertex arrays.  If a vertex array isn't in this array, then it isn't
-     * valid.  For example, if an implementation does not support
-     * EXT_fog_coord, there won't be a GL_FOG_COORD_ARRAY entry in this
-     * array.
-     */
-   struct array_state *arrays;
-
-    /**
-     * Number of currently enabled client-side arrays.  The value of this 
-     * field is only valid if \c array_info_cache_valid is true.
-     */
-   size_t enabled_client_array_count;
-
-    /**
-     * \name ARRAY_INFO cache.
-     * 
-     * These fields track the state of the ARRAY_INFO cache.  The
-     * \c array_info_cache_size is the size of the actual data stored in
-     * \c array_info_cache.  \c array_info_cache_buffer_size is the size of
-     * the buffer.  This will always be greater than or equal to
-     * \c array_info_cache_size.
-     *
-     * \note
-     * There are some bytes of extra data before \c array_info_cache that is
-     * used to hold the header for RenderLarge commands.  This is
-     * \b not included in \c array_info_cache_size or
-     * \c array_info_cache_buffer_size.  \c array_info_cache_base stores a
-     * pointer to the true start of the buffer (i.e., what malloc returned).
-     */
-   /*@{ */
-   size_t array_info_cache_size;
-   size_t array_info_cache_buffer_size;
-   void *array_info_cache;
-   void *array_info_cache_base;
-   /*@} */
-
-
-    /**
-     * Is the cache of ARRAY_INFO data valid?  The cache can become invalid
-     * when one of several state changes occur.  Among these chages are
-     * modifying the array settings for an enabled array and enabling /
-     * disabling an array.
-     */
-   GLboolean array_info_cache_valid;
-
-    /**
-     * Is it possible to use the GL 1.1 / EXT_vertex_arrays protocol?  Use
-     * of this protocol is disabled with really old servers (i.e., servers
-     * that don't support GL 1.1 or EXT_vertex_arrays) or when an environment
-     * variable is set.
-     * 
-     * \todo
-     * GL 1.1 and EXT_vertex_arrays use identical protocol, but have different
-     * opcodes for \c glDrawArrays.  For servers that advertise one or the
-     * other, there should be a way to select which opcode to use.
-     */
-   GLboolean old_DrawArrays_possible;
-
-    /**
-     * Is it possible to use the new GL X.X / ARB_vertex_buffer_object
-     * protocol?
-     * 
-     * \todo
-     * This protocol has not yet been defined by the ARB, but is currently a
-     * work in progress.  This field is a place-holder.
-     */
-   GLboolean new_DrawArrays_possible;
-
-    /**
-     * Active texture unit set by \c glClientActiveTexture.
-     * 
-     * \sa __glXGetActiveTextureUnit
-     */
-   unsigned active_texture_unit;
-
-    /**
-     * Number of supported texture units.  Even if ARB_multitexture /
-     * GL 1.3 are not supported, this will be at least 1.  When multitexture
-     * is supported, this will be the value queried by calling
-     * \c glGetIntegerv with \c GL_MAX_TEXTURE_UNITS.
-     * 
-     * \todo
-     * Investigate if this should be the value of \c GL_MAX_TEXTURE_COORDS
-     * instead (if GL 2.0 / ARB_fragment_shader / ARB_fragment_program /
-     * NV_fragment_program are supported).
-     */
-   unsigned num_texture_units;
-
-    /**
-     * Number of generic vertex program attribs.  If GL_ARB_vertex_program
-     * is not supported, this will be zero.  Otherwise it will be the value
-     * queries by calling \c glGetProgramiv with \c GL_VERTEX_PROGRAM_ARB
-     * and \c GL_MAX_PROGRAM_ATTRIBS_ARB.
-     */
-   unsigned num_vertex_program_attribs;
-
-    /**
-     * \n Methods for implementing various GL functions.
-     * 
-     * These method pointers are only valid \c array_info_cache_valid is set.
-     * When each function starts, it much check \c array_info_cache_valid.
-     * If it is not set, it must call \c fill_array_info_cache and call
-     * the new method.
-     * 
-     * \sa fill_array_info_cache
-     * 
-     * \todo
-     * Write code to plug these functions directly into the dispatch table.
-     */
-   /*@{ */
-   void (*DrawArrays) (GLenum, GLint, GLsizei);
-   void (*DrawElements) (GLenum mode, GLsizei count, GLenum type,
-                         const GLvoid * indices);
-   /*@} */
-
-   struct array_stack_state *stack;
-   unsigned active_texture_unit_stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
-   unsigned stack_index;
-};
-
-#endif /* _INDIRECT_VA_PRIVATE_ */
diff --git a/src/glx/x11/indirect_vertex_program.c b/src/glx/x11/indirect_vertex_program.c
deleted file mode 100644 (file)
index 3313ac0..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * 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.
- */
-
-#include <inttypes.h>
-#include <GL/gl.h>
-#include "indirect.h"
-#include "glxclient.h"
-#include "indirect_vertex_array.h"
-#include <GL/glxproto.h>
-
-#if !defined __GNUC__ || __GNUC__ < 3
-#  define __builtin_expect(x, y) x
-#endif
-
-static void
-do_vertex_attrib_enable(GLuint index, GLboolean val)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-
-   if (!__glXSetArrayEnable(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
-                            index, val)) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-   }
-}
-
-
-void
-__indirect_glEnableVertexAttribArrayARB(GLuint index)
-{
-   do_vertex_attrib_enable(index, GL_TRUE);
-}
-
-
-void
-__indirect_glDisableVertexAttribArrayARB(GLuint index)
-{
-   do_vertex_attrib_enable(index, GL_FALSE);
-}
-
-
-static void
-get_parameter(unsigned opcode, unsigned size, GLenum target, GLuint index,
-              void *params)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-   Display *const dpy = gc->currentDpy;
-   const GLuint cmdlen = 12;
-
-   if (__builtin_expect(dpy != NULL, 1)) {
-      GLubyte const *pc = __glXSetupVendorRequest(gc,
-                                                  X_GLXVendorPrivateWithReply,
-                                                  opcode, cmdlen);
-
-      *((GLenum *) (pc + 0)) = target;
-      *((GLuint *) (pc + 4)) = index;
-      *((GLuint *) (pc + 8)) = 0;
-
-      (void) __glXReadReply(dpy, size, params, GL_FALSE);
-      UnlockDisplay(dpy);
-      SyncHandle();
-   }
-   return;
-}
-
-
-void
-__indirect_glGetProgramEnvParameterfvARB(GLenum target, GLuint index,
-                                         GLfloat * params)
-{
-   get_parameter(1296, 4, target, index, params);
-}
-
-
-void
-__indirect_glGetProgramEnvParameterdvARB(GLenum target, GLuint index,
-                                         GLdouble * params)
-{
-   get_parameter(1297, 8, target, index, params);
-}
-
-
-void
-__indirect_glGetProgramLocalParameterfvARB(GLenum target, GLuint index,
-                                           GLfloat * params)
-{
-   get_parameter(1305, 4, target, index, params);
-}
-
-
-void
-__indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index,
-                                           GLdouble * params)
-{
-   get_parameter(1306, 8, target, index, params);
-}
-
-
-void
-__indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname,
-                                       GLvoid ** pointer)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-
-   if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-   }
-
-   if (!__glXGetArrayPointer(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
-                             index, pointer)) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-   }
-}
-
-
-/**
- * Get the selected attribute from the vertex array state vector.
- * 
- * \returns
- * On success \c GL_TRUE is returned.  Otherwise, \c GL_FALSE is returned.
- */
-static GLboolean
-get_attrib_array_data(__GLXattribute * state, GLuint index, GLenum cap,
-                      GLintptr * data)
-{
-   GLboolean retval = GL_FALSE;
-   const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;
-
-   switch (cap) {
-   case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
-      retval = __glXGetArrayEnable(state, attrib, index, data);
-      break;
-
-   case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
-      retval = __glXGetArraySize(state, attrib, index, data);
-      break;
-
-   case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
-      retval = __glXGetArrayStride(state, attrib, index, data);
-      break;
-
-   case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
-      retval = __glXGetArrayType(state, attrib, index, data);
-      break;
-
-   case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
-      retval = __glXGetArrayNormalized(state, attrib, index, data);
-      break;
-   }
-
-
-   return retval;
-}
-
-
-static void
-get_vertex_attrib(__GLXcontext * gc, unsigned vop,
-                  GLuint index, GLenum pname, xReply * reply)
-{
-   Display *const dpy = gc->currentDpy;
-   GLubyte *const pc = __glXSetupVendorRequest(gc,
-                                               X_GLXVendorPrivateWithReply,
-                                               vop, 8);
-
-   *((uint32_t *) (pc + 0)) = index;
-   *((uint32_t *) (pc + 4)) = pname;
-
-   (void) _XReply(dpy, reply, 0, False);
-}
-
-
-void
-__indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-   Display *const dpy = gc->currentDpy;
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   xGLXSingleReply reply;
-
-
-   get_vertex_attrib(gc, 1303, index, pname, (xReply *) & reply);
-
-   if (reply.size != 0) {
-      GLintptr data;
-
-
-      if (get_attrib_array_data(state, index, pname, &data)) {
-         *params = (GLint) data;
-      }
-      else {
-         if (reply.size == 1) {
-            *params = (GLint) reply.pad3;
-         }
-         else {
-            _XRead(dpy, (void *) params, 4 * reply.size);
-         }
-      }
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-
-void
-__indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname,
-                                  GLfloat * params)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-   Display *const dpy = gc->currentDpy;
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   xGLXSingleReply reply;
-
-
-   get_vertex_attrib(gc, 1302, index, pname, (xReply *) & reply);
-
-   if (reply.size != 0) {
-      GLintptr data;
-
-
-      if (get_attrib_array_data(state, index, pname, &data)) {
-         *params = (GLfloat) data;
-      }
-      else {
-         if (reply.size == 1) {
-            (void) memcpy(params, &reply.pad3, sizeof(GLfloat));
-         }
-         else {
-            _XRead(dpy, (void *) params, 4 * reply.size);
-         }
-      }
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
-
-
-void
-__indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname,
-                                  GLdouble * params)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-   Display *const dpy = gc->currentDpy;
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   xGLXSingleReply reply;
-
-
-   get_vertex_attrib(gc, 1301, index, pname, (xReply *) & reply);
-
-   if (reply.size != 0) {
-      GLintptr data;
-
-
-      if (get_attrib_array_data(state, index, pname, &data)) {
-         *params = (GLdouble) data;
-      }
-      else {
-         if (reply.size == 1) {
-            (void) memcpy(params, &reply.pad3, sizeof(GLdouble));
-         }
-         else {
-            _XRead(dpy, (void *) params, 8 * reply.size);
-         }
-      }
-   }
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-}
diff --git a/src/glx/x11/indirect_window_pos.c b/src/glx/x11/indirect_window_pos.c
deleted file mode 100644 (file)
index e97be35..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * (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
- * 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
- * PRECISION INSIGHT, 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.
- */
-
-#include <GL/gl.h>
-#include "indirect.h"
-
-void
-__indirect_glWindowPos2dMESA(GLdouble x, GLdouble y)
-{
-   __indirect_glWindowPos3fMESA(x, y, 0.0);
-}
-
-void
-__indirect_glWindowPos2iMESA(GLint x, GLint y)
-{
-   __indirect_glWindowPos3fMESA(x, y, 0.0);
-}
-
-void
-__indirect_glWindowPos2fMESA(GLfloat x, GLfloat y)
-{
-   __indirect_glWindowPos3fMESA(x, y, 0.0);
-}
-
-void
-__indirect_glWindowPos2sMESA(GLshort x, GLshort y)
-{
-   __indirect_glWindowPos3fMESA(x, y, 0.0);
-}
-
-void
-__indirect_glWindowPos2dvMESA(const GLdouble * p)
-{
-   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
-}
-
-void
-__indirect_glWindowPos2fvMESA(const GLfloat * p)
-{
-   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
-}
-
-void
-__indirect_glWindowPos2ivMESA(const GLint * p)
-{
-   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
-}
-
-void
-__indirect_glWindowPos2svMESA(const GLshort * p)
-{
-   __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
-}
-
-void
-__indirect_glWindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
-{
-   __indirect_glWindowPos3fMESA(x, y, z);
-}
-
-void
-__indirect_glWindowPos3iMESA(GLint x, GLint y, GLint z)
-{
-   __indirect_glWindowPos3fMESA(x, y, z);
-}
-
-void
-__indirect_glWindowPos3sMESA(GLshort x, GLshort y, GLshort z)
-{
-   __indirect_glWindowPos3fMESA(x, y, z);
-}
-
-void
-__indirect_glWindowPos3dvMESA(const GLdouble * p)
-{
-   __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
-}
-
-void
-__indirect_glWindowPos3ivMESA(const GLint * p)
-{
-   __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
-}
-
-void
-__indirect_glWindowPos3svMESA(const GLshort * p)
-{
-   __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
-}
diff --git a/src/glx/x11/packrender.h b/src/glx/x11/packrender.h
deleted file mode 100644 (file)
index 30f6d44..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-#ifndef __GLX_packrender_h__
-#define __GLX_packrender_h__
-
-/*
- * 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.
- */
-
-#include "glxclient.h"
-
-/*
-** The macros in this header convert the client machine's native data types to
-** wire protocol data types.  The header is part of the porting layer of the
-** client library, and it is intended that hardware vendors will rewrite this
-** header to suit their own machines.
-*/
-
-/*
-** Pad a count of bytes to the nearest multiple of 4.  The X protocol
-** transfers data in 4 byte quantities, so this macro is used to
-** insure the right amount of data being sent.
-*/
-#define __GLX_PAD(a) (((a)+3) & ~3)
-
-/*
-** Network size parameters
-*/
-#define sz_double 8
-
-/* Setup for all commands */
-#define __GLX_DECLARE_VARIABLES()               \
-   __GLXcontext *gc;                            \
-   GLubyte *pc, *pixelHeaderPC;                 \
-   GLuint compsize, cmdlen
-
-#define __GLX_LOAD_VARIABLES()     \
-   gc = __glXGetCurrentContext();  \
-   pc = gc->pc;                    \
-   /* Muffle compilers */                  \
-   cmdlen = 0;         (void)cmdlen;          \
-   compsize = 0;       (void)compsize;        \
-   pixelHeaderPC = 0;  (void)pixelHeaderPC
-
-/*
-** Variable sized command support macro.  This macro is used by calls
-** that are potentially larger than __GLX_SMALL_RENDER_CMD_SIZE.
-** Because of their size, they may not automatically fit in the buffer.
-** If the buffer can't hold the command then it is flushed so that
-** the command will fit in the next buffer.
-*/
-#define __GLX_BEGIN_VARIABLE(opcode,size)       \
-   if (pc + (size) > gc->bufEnd) {              \
-      pc = __glXFlushRenderBuffer(gc, pc);      \
-   }                                            \
-   __GLX_PUT_SHORT(0,size);                     \
-   __GLX_PUT_SHORT(2,opcode)
-
-#define __GLX_BEGIN_VARIABLE_LARGE(opcode,size) \
-   pc = __glXFlushRenderBuffer(gc, pc);         \
-   __GLX_PUT_LONG(0,size);                      \
-   __GLX_PUT_LONG(4,opcode)
-
-#define __GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode,size)  \
-   if (pc + (size) > gc->bufEnd) {                    \
-      pc = __glXFlushRenderBuffer(gc, pc);            \
-   }                                                  \
-   __GLX_PUT_SHORT(0,size);                           \
-   __GLX_PUT_SHORT(2,opcode);                         \
-   pc += __GLX_RENDER_HDR_SIZE;                       \
-   pixelHeaderPC = pc;                                \
-   pc += __GLX_PIXEL_HDR_SIZE
-
-#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,size)  \
-   pc = __glXFlushRenderBuffer(gc, pc);                     \
-   __GLX_PUT_LONG(0,size);                                  \
-   __GLX_PUT_LONG(4,opcode);                                \
-   pc += __GLX_RENDER_LARGE_HDR_SIZE;                       \
-   pixelHeaderPC = pc;                                      \
-   pc += __GLX_PIXEL_HDR_SIZE
-
-#define __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(opcode,size)  \
-   if (pc + (size) > gc->bufEnd) {                       \
-      pc = __glXFlushRenderBuffer(gc, pc);               \
-   }                                                     \
-   __GLX_PUT_SHORT(0,size);                              \
-   __GLX_PUT_SHORT(2,opcode);                            \
-   pc += __GLX_RENDER_HDR_SIZE;                          \
-   pixelHeaderPC = pc;                                   \
-   pc += __GLX_PIXEL_3D_HDR_SIZE
-
-#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(opcode,size)  \
-   pc = __glXFlushRenderBuffer(gc, pc);                        \
-   __GLX_PUT_LONG(0,size);                                     \
-   __GLX_PUT_LONG(4,opcode);                                   \
-   pc += __GLX_RENDER_LARGE_HDR_SIZE;                          \
-   pixelHeaderPC = pc;                                         \
-   pc += __GLX_PIXEL_3D_HDR_SIZE
-
-/*
-** Fixed size command support macro.  This macro is used by calls that
-** are never larger than __GLX_SMALL_RENDER_CMD_SIZE.  Because they
-** always fit in the buffer, and because the buffer promises to
-** maintain enough room for them, we don't need to check for space
-** before doing the storage work.
-*/
-#define __GLX_BEGIN(opcode,size) \
-   __GLX_PUT_SHORT(0,size);      \
-   __GLX_PUT_SHORT(2,opcode)
-
-/*
-** Finish a rendering command by advancing the pc.  If the pc is now past
-** the limit pointer then there is no longer room for a
-** __GLX_SMALL_RENDER_CMD_SIZE sized command, which will break the
-** assumptions present in the __GLX_BEGIN macro.  In this case the
-** rendering buffer is flushed out into the X protocol stream (which may
-** or may not do I/O).
-*/
-#define __GLX_END(size)           \
-   pc += size;                       \
-   if (pc > gc->limit) {                  \
-      (void) __glXFlushRenderBuffer(gc, pc);    \
-   } else {                                     \
-      gc->pc = pc;                              \
-   }
-
-/* Array copy macros */
-#define __GLX_MEM_COPY(dest,src,bytes)          \
-   if (src && dest)                             \
-      memcpy(dest, src, bytes)
-
-/* Single item copy macros */
-#define __GLX_PUT_CHAR(offset,a)                \
-   *((INT8 *) (pc + offset)) = a
-
-#ifndef _CRAY
-#define __GLX_PUT_SHORT(offset,a)               \
-   *((INT16 *) (pc + offset)) = a
-
-#define __GLX_PUT_LONG(offset,a)                \
-   *((INT32 *) (pc + offset)) = a
-
-#define __GLX_PUT_FLOAT(offset,a)               \
-   *((FLOAT32 *) (pc + offset)) = a
-
-#else
-#define __GLX_PUT_SHORT(offset,a)               \
-   { GLubyte *cp = (pc+offset);                 \
-      int shift = (64-16) - ((int)(cp) >> (64-6));                      \
-      *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
-
-#define __GLX_PUT_LONG(offset,a)                \
-   { GLubyte *cp = (pc+offset);                 \
-      int shift = (64-32) - ((int)(cp) >> (64-6));                      \
-      *(int *)cp = (*(int *)cp & ~(0xffffffff << shift)) | ((a & 0xffffffff) << shift); }
-
-#define __GLX_PUT_FLOAT(offset,a)               \
-   gl_put_float((pc + offset),a)
-
-#define __GLX_PUT_DOUBLE(offset,a)              \
-   gl_put_double(pc + offset, a)
-
-extern void gl_put_float( /*GLubyte *, struct cray_single */ );
-extern void gl_put_double( /*GLubyte *, struct cray_double */ );
-#endif
-
-#ifndef _CRAY
-
-#ifdef __GLX_ALIGN64
-/*
-** This can certainly be done better for a particular machine
-** architecture!
-*/
-#define __GLX_PUT_DOUBLE(offset,a)              \
-   __GLX_MEM_COPY(pc + offset, &a, 8)
-#else
-#define __GLX_PUT_DOUBLE(offset,a)              \
-   *((FLOAT64 *) (pc + offset)) = a
-#endif
-
-#endif
-
-#define __GLX_PUT_CHAR_ARRAY(offset,a,alen)                 \
-   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT8)
-
-#ifndef _CRAY
-#define __GLX_PUT_SHORT_ARRAY(offset,a,alen)                \
-   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT16)
-
-#define __GLX_PUT_LONG_ARRAY(offset,a,alen)                 \
-   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT32)
-
-#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen)                   \
-   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT32)
-
-#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen)                  \
-   __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT64)
-
-#else
-#define __GLX_PUT_SHORT_ARRAY(offset,a,alen)                            \
-   gl_put_short_array((GLubyte *)(pc + offset), a, alen * __GLX_SIZE_INT16)
-
-#define __GLX_PUT_LONG_ARRAY(offset,a,alen)                             \
-   gl_put_long_array((GLubyte *)(pc + offset), (long *)a, alen * __GLX_SIZE_INT32)
-
-#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen)                            \
-   gl_put_float_array((GLubyte *)(pc + offset), (float *)a, alen * __GLX_SIZE_FLOAT32)
-
-#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen)                           \
-   gl_put_double_array((GLubyte *)(pc + offset), (double *)a, alen * __GLX_SIZE_FLOAT64)
-
-extern gl_put_short_array(GLubyte *, short *, int);
-extern gl_put_long_array(GLubyte *, long *, int);
-extern gl_put_float_array(GLubyte *, float *, int);
-extern gl_put_double_array(GLubyte *, double *, int);
-
-#endif /* _CRAY */
-
-#endif /* !__GLX_packrender_h__ */
diff --git a/src/glx/x11/packsingle.h b/src/glx/x11/packsingle.h
deleted file mode 100644 (file)
index f33a873..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-#ifndef __GLX_packsingle_h__
-#define __GLX_packsingle_h__
-
-/*
- * 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.
- */
-
-#include "packrender.h"
-
-/*
-** The macros in this header convert wire protocol data types to the client
-** machine's native data types.  The header is part of the porting layer of
-** the client library, and it is intended that hardware vendors will rewrite
-** this header to suit their own machines.
-*/
-
-/*
-** Dummy define to make the GetReqExtra macro happy.  The value is not
-** used, but instead the code in __GLX_SINGLE_BEGIN issues its own store
-** to req->reqType with the proper code (our extension code).
-*/
-#define X_GLXSingle 0
-
-/* Declare common variables used during a single command */
-#define __GLX_SINGLE_DECLARE_VARIABLES()         \
-   __GLXcontext *gc = __glXGetCurrentContext();  \
-   GLubyte *pc, *pixelHeaderPC;                  \
-   GLuint compsize, cmdlen;                      \
-   Display *dpy = gc->currentDpy;                \
-   xGLXSingleReq *req
-
-#define __GLX_SINGLE_LOAD_VARIABLES()           \
-   pc = gc->pc;                                 \
-   /* Muffle compilers */                       \
-   pixelHeaderPC = 0;  (void)pixelHeaderPC;     \
-   compsize = 0;       (void)compsize;          \
-   cmdlen = 0;         (void)cmdlen
-
-/* Start a single command */
-#define __GLX_SINGLE_BEGIN(opcode,bytes)        \
-   if (dpy) {                                   \
-   (void) __glXFlushRenderBuffer(gc, pc);       \
-   LockDisplay(dpy);                            \
-   GetReqExtra(GLXSingle,bytes,req);            \
-   req->reqType = gc->majorOpcode;              \
-   req->glxCode = opcode;                       \
-   req->contextTag = gc->currentContextTag;     \
-   pc = ((GLubyte *)(req) + sz_xGLXSingleReq)
-
-/* End a single command */
-#define __GLX_SINGLE_END()       \
-   UnlockDisplay(dpy);           \
-   SyncHandle();                 \
-   }
-
-/* Store data to sending for a single command */
-#define __GLX_SINGLE_PUT_CHAR(offset,a)         \
-   *((INT8 *) (pc + offset)) = a
-
-#ifndef CRAY
-#define __GLX_SINGLE_PUT_SHORT(offset,a)        \
-   *((INT16 *) (pc + offset)) = a
-
-#define __GLX_SINGLE_PUT_LONG(offset,a)         \
-   *((INT32 *) (pc + offset)) = a
-
-#define __GLX_SINGLE_PUT_FLOAT(offset,a)        \
-   *((FLOAT32 *) (pc + offset)) = a
-
-#else
-#define __GLX_SINGLE_PUT_SHORT(offset,a)        \
-   { GLubyte *cp = (pc+offset);                    \
-      int shift = (64-16) - ((int)(cp) >> (64-6));                      \
-      *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
-
-#define __GLX_SINGLE_PUT_LONG(offset,a)         \
-   { GLubyte *cp = (pc+offset);                    \
-      int shift = (64-32) - ((int)(cp) >> (64-6));                      \
-      *(int *)cp = (*(int *)cp & ~(0xffffffff << shift)) | ((a & 0xffffffff) << shift); }
-
-#define __GLX_SINGLE_PUT_FLOAT(offset,a)        \
-   gl_put_float(pc + offset, a)
-#endif
-
-/* Read support macros */
-#define __GLX_SINGLE_READ_XREPLY()                    \
-   (void) _XReply(dpy, (xReply*) &reply, 0, False)
-
-#define __GLX_SINGLE_GET_RETVAL(a,cast)         \
-   a = (cast) reply.retval
-
-#define __GLX_SINGLE_GET_SIZE(a)                \
-   a = (GLint) reply.size
-
-#ifndef _CRAY
-#define __GLX_SINGLE_GET_CHAR(p)                \
-   *p = *(GLbyte *)&reply.pad3;
-
-#define __GLX_SINGLE_GET_SHORT(p)               \
-   *p = *(GLshort *)&reply.pad3;
-
-#define __GLX_SINGLE_GET_LONG(p)                \
-   *p = *(GLint *)&reply.pad3;
-
-#define __GLX_SINGLE_GET_FLOAT(p)               \
-   *p = *(GLfloat *)&reply.pad3;
-
-#else
-#define __GLX_SINGLE_GET_CHAR(p)                \
-   *p = reply.pad3 >> 24;
-
-#define __GLX_SINGLE_GET_SHORT(p)               \
-   {int t = reply.pad3 >> 16;                            \
-      *p = (t & 0x8000) ? (t | ~0xffff) : (t & 0xffff);}
-
-#define __GLX_SINGLE_GET_LONG(p)                \
-   {int t = reply.pad3;                                              \
-      *p = (t & 0x80000000) ? (t | ~0xffffffff) : (t & 0xffffffff);}
-
-#define PAD3OFFSET 16
-#define __GLX_SINGLE_GET_FLOAT(p)                        \
-   *p = gl_ntoh_float((GLubyte *)&reply + PAD3OFFSET);
-
-#define __GLX_SINGLE_GET_DOUBLE(p)                       \
-   *p = gl_ntoh_double((GLubyte *)&reply + PAD3OFFSET);
-
-extern float gl_ntoh_float(GLubyte *);
-extern float gl_ntoh_double(GLubyte *);
-#endif
-
-#ifndef _CRAY
-
-#ifdef __GLX_ALIGN64
-#define __GLX_SINGLE_GET_DOUBLE(p)              \
-   __GLX_MEM_COPY(p, &reply.pad3, 8)
-#else
-#define __GLX_SINGLE_GET_DOUBLE(p)              \
-   *p = *(GLdouble *)&reply.pad3
-#endif
-
-#endif
-
-/* Get an array of typed data */
-#define __GLX_SINGLE_GET_VOID_ARRAY(a,alen)     \
-   {                                            \
-      GLint slop = alen*__GLX_SIZE_INT8 & 3;    \
-      _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8);  \
-      if (slop) _XEatData(dpy,4-slop);             \
-   }
-
-#define __GLX_SINGLE_GET_CHAR_ARRAY(a,alen)     \
-   {                                            \
-      GLint slop = alen*__GLX_SIZE_INT8 & 3;    \
-      _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8);  \
-      if (slop) _XEatData(dpy,4-slop);             \
-   }
-
-
-#define __GLX_SINGLE_GET_SHORT_ARRAY(a,alen)    \
-   {                                            \
-      GLint slop = (alen*__GLX_SIZE_INT16) & 3;    \
-      _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT16); \
-      if (slop) _XEatData(dpy,4-slop);             \
-   }
-
-#define __GLX_SINGLE_GET_LONG_ARRAY(a,alen)        \
-   _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT32);
-
-#ifndef _CRAY
-#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen)       \
-   _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT32);
-
-#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen)      \
-   _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT64);
-
-#else
-#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen)    \
-   gl_get_float_array(dpy,a,alen);
-
-#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen)   \
-   gl_get_double_array(dpy, a, alen);
-
-extern void gl_get_float_array(Display * dpy, float *a, int alen);
-extern void gl_get_double_array(Display * dpy, double *a, int alen);
-#endif
-
-#endif /* !__GLX_packsingle_h__ */
diff --git a/src/glx/x11/pixel.c b/src/glx/x11/pixel.c
deleted file mode 100644 (file)
index d36ca31..0000000
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * 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.
- */
-
-#include "packrender.h"
-
-static const GLubyte MsbToLsbTable[256] = {
-   0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
-   0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
-   0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
-   0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
-   0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
-   0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
-   0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
-   0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
-   0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
-   0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
-   0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
-   0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
-   0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
-   0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
-   0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
-   0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
-   0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
-   0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
-   0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
-   0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
-   0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
-   0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
-   0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
-   0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
-   0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
-   0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
-   0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
-   0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
-   0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
-   0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
-   0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
-   0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
-};
-
-static const GLubyte LowBitsMask[9] = {
-   0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
-};
-
-static const GLubyte HighBitsMask[9] = {
-   0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff,
-};
-
-
-/*
-** Copy bitmap data from clients packed memory applying unpacking modes as the
-** data is transfered into the destImage buffer.  Return in modes the
-** set of pixel modes that are to be done by the server.
-*/
-static void
-FillBitmap(__GLXcontext * gc, GLint width, GLint height,
-           GLenum format, const GLvoid * userdata, GLubyte * destImage)
-{
-   const __GLXattribute *state = gc->client_state_private;
-   GLint rowLength = state->storeUnpack.rowLength;
-   GLint alignment = state->storeUnpack.alignment;
-   GLint skipPixels = state->storeUnpack.skipPixels;
-   GLint skipRows = state->storeUnpack.skipRows;
-   GLint lsbFirst = state->storeUnpack.lsbFirst;
-   GLint elementsLeft, bitOffset, currentByte, nextByte, highBitMask;
-   GLint lowBitMask, i;
-   GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
-   const GLubyte *start, *iter;
-
-   if (rowLength > 0) {
-      groupsPerRow = rowLength;
-   }
-   else {
-      groupsPerRow = width;
-   }
-   components = __glElementsPerGroup(format, GL_BITMAP);
-   rowSize = (groupsPerRow * components + 7) >> 3;
-   padding = (rowSize % alignment);
-   if (padding) {
-      rowSize += alignment - padding;
-   }
-   start = ((const GLubyte *) userdata) + skipRows * rowSize +
-      ((skipPixels * components) >> 3);
-   bitOffset = (skipPixels * components) & 7;
-   highBitMask = LowBitsMask[8 - bitOffset];
-   lowBitMask = HighBitsMask[bitOffset];
-   elementsPerRow = width * components;
-   for (i = 0; i < height; i++) {
-      elementsLeft = elementsPerRow;
-      iter = start;
-      while (elementsLeft) {
-         /* First retrieve low bits from current byte */
-         if (lsbFirst) {
-            currentByte = MsbToLsbTable[iter[0]];
-         }
-         else {
-            currentByte = iter[0];
-         }
-         if (bitOffset) {
-            /* Need to read next byte to finish current byte */
-            if (elementsLeft > (8 - bitOffset)) {
-               if (lsbFirst) {
-                  nextByte = MsbToLsbTable[iter[1]];
-               }
-               else {
-                  nextByte = iter[1];
-               }
-               currentByte =
-                  ((currentByte & highBitMask) << bitOffset) |
-                  ((nextByte & lowBitMask) >> (8 - bitOffset));
-            }
-            else {
-               currentByte = ((currentByte & highBitMask) << bitOffset);
-            }
-         }
-         if (elementsLeft >= 8) {
-            *destImage = currentByte;
-            elementsLeft -= 8;
-         }
-         else {
-            *destImage = currentByte & HighBitsMask[elementsLeft];
-            elementsLeft = 0;
-         }
-         destImage++;
-         iter++;
-      }
-      start += rowSize;
-   }
-}
-
-/*
-** Extract array from user's data applying all pixel store modes.
-** The internal packed array format used has LSB_FIRST = FALSE and 
-** ALIGNMENT = 1.
-*/
-void
-__glFillImage(__GLXcontext * gc, GLint dim, GLint width, GLint height,
-              GLint depth, GLenum format, GLenum type,
-              const GLvoid * userdata, GLubyte * newimage, GLubyte * modes)
-{
-   const __GLXattribute *state = gc->client_state_private;
-   GLint rowLength = state->storeUnpack.rowLength;
-   GLint imageHeight = state->storeUnpack.imageHeight;
-   GLint alignment = state->storeUnpack.alignment;
-   GLint skipPixels = state->storeUnpack.skipPixels;
-   GLint skipRows = state->storeUnpack.skipRows;
-   GLint skipImages = state->storeUnpack.skipImages;
-   GLint swapBytes = state->storeUnpack.swapEndian;
-   GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
-   GLint elementsPerRow, imageSize, rowsPerImage, h, i, j, k;
-   const GLubyte *start, *iter, *itera, *iterb, *iterc;
-   GLubyte *iter2;
-
-   if (type == GL_BITMAP) {
-      FillBitmap(gc, width, height, format, userdata, newimage);
-   }
-   else {
-      components = __glElementsPerGroup(format, type);
-      if (rowLength > 0) {
-         groupsPerRow = rowLength;
-      }
-      else {
-         groupsPerRow = width;
-      }
-      if (imageHeight > 0) {
-         rowsPerImage = imageHeight;
-      }
-      else {
-         rowsPerImage = height;
-      }
-
-      elementSize = __glBytesPerElement(type);
-      groupSize = elementSize * components;
-      if (elementSize == 1)
-         swapBytes = 0;
-
-      rowSize = groupsPerRow * groupSize;
-      padding = (rowSize % alignment);
-      if (padding) {
-         rowSize += alignment - padding;
-      }
-      imageSize = rowSize * rowsPerImage;
-      start = ((const GLubyte *) userdata) + skipImages * imageSize +
-         skipRows * rowSize + skipPixels * groupSize;
-      iter2 = newimage;
-      elementsPerRow = width * components;
-
-      if (swapBytes) {
-         itera = start;
-         for (h = 0; h < depth; h++) {
-            iterb = itera;
-            for (i = 0; i < height; i++) {
-               iterc = iterb;
-               for (j = 0; j < elementsPerRow; j++) {
-                  for (k = 1; k <= elementSize; k++) {
-                     iter2[k - 1] = iterc[elementSize - k];
-                  }
-                  iter2 += elementSize;
-                  iterc += elementSize;
-               }
-               iterb += rowSize;
-            }
-            itera += imageSize;
-         }
-      }
-      else {
-         itera = start;
-         for (h = 0; h < depth; h++) {
-            if (rowSize == elementsPerRow * elementSize) {
-               /* Ha!  This is mondo easy! */
-               __GLX_MEM_COPY(iter2, itera,
-                              elementsPerRow * elementSize * height);
-               iter2 += elementsPerRow * elementSize * height;
-            }
-            else {
-               iter = itera;
-               for (i = 0; i < height; i++) {
-                  __GLX_MEM_COPY(iter2, iter, elementsPerRow * elementSize);
-                  iter2 += elementsPerRow * elementSize;
-                  iter += rowSize;
-               }
-            }
-            itera += imageSize;
-         }
-      }
-   }
-
-   /* Setup store modes that describe what we just did */
-   if (modes) {
-      if (dim < 3) {
-         (void) memcpy(modes, __glXDefaultPixelStore + 4, 20);
-      }
-      else {
-         (void) memcpy(modes, __glXDefaultPixelStore + 0, 36);
-      }
-   }
-}
-
-/*
-** Empty a bitmap in LSB_FIRST=GL_FALSE and ALIGNMENT=4 format packing it
-** into the clients memory using the pixel store PACK modes.
-*/
-static void
-EmptyBitmap(__GLXcontext * gc, GLint width, GLint height,
-            GLenum format, const GLubyte * sourceImage, GLvoid * userdata)
-{
-   const __GLXattribute *state = gc->client_state_private;
-   GLint rowLength = state->storePack.rowLength;
-   GLint alignment = state->storePack.alignment;
-   GLint skipPixels = state->storePack.skipPixels;
-   GLint skipRows = state->storePack.skipRows;
-   GLint lsbFirst = state->storePack.lsbFirst;
-   GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
-   GLint sourceRowSize, sourcePadding, sourceSkip;
-   GLubyte *start, *iter;
-   GLint elementsLeft, bitOffset, currentByte, highBitMask, lowBitMask;
-   GLint writeMask, i;
-   GLubyte writeByte;
-
-   components = __glElementsPerGroup(format, GL_BITMAP);
-   if (rowLength > 0) {
-      groupsPerRow = rowLength;
-   }
-   else {
-      groupsPerRow = width;
-   }
-
-   rowSize = (groupsPerRow * components + 7) >> 3;
-   padding = (rowSize % alignment);
-   if (padding) {
-      rowSize += alignment - padding;
-   }
-   sourceRowSize = (width * components + 7) >> 3;
-   sourcePadding = (sourceRowSize % 4);
-   if (sourcePadding) {
-      sourceSkip = 4 - sourcePadding;
-   }
-   else {
-      sourceSkip = 0;
-   }
-   start = ((GLubyte *) userdata) + skipRows * rowSize +
-      ((skipPixels * components) >> 3);
-   bitOffset = (skipPixels * components) & 7;
-   highBitMask = LowBitsMask[8 - bitOffset];
-   lowBitMask = HighBitsMask[bitOffset];
-   elementsPerRow = width * components;
-   for (i = 0; i < height; i++) {
-      elementsLeft = elementsPerRow;
-      iter = start;
-      writeMask = highBitMask;
-      writeByte = 0;
-      while (elementsLeft) {
-         /* Set up writeMask (to write to current byte) */
-         if (elementsLeft + bitOffset < 8) {
-            /* Need to trim writeMask */
-            writeMask &= HighBitsMask[bitOffset + elementsLeft];
-         }
-
-         if (lsbFirst) {
-            currentByte = MsbToLsbTable[iter[0]];
-         }
-         else {
-            currentByte = iter[0];
-         }
-
-         if (bitOffset) {
-            writeByte |= (sourceImage[0] >> bitOffset);
-            currentByte = (currentByte & ~writeMask) |
-               (writeByte & writeMask);
-            writeByte = (sourceImage[0] << (8 - bitOffset));
-         }
-         else {
-            currentByte = (currentByte & ~writeMask) |
-               (sourceImage[0] & writeMask);
-         }
-
-         if (lsbFirst) {
-            iter[0] = MsbToLsbTable[currentByte];
-         }
-         else {
-            iter[0] = currentByte;
-         }
-
-         if (elementsLeft >= 8) {
-            elementsLeft -= 8;
-         }
-         else {
-            elementsLeft = 0;
-         }
-         sourceImage++;
-         iter++;
-         writeMask = 0xff;
-      }
-      if (writeByte) {
-         /* Some data left over that still needs writing */
-         writeMask &= lowBitMask;
-         if (lsbFirst) {
-            currentByte = MsbToLsbTable[iter[0]];
-         }
-         else {
-            currentByte = iter[0];
-         }
-         currentByte = (currentByte & ~writeMask) | (writeByte & writeMask);
-         if (lsbFirst) {
-            iter[0] = MsbToLsbTable[currentByte];
-         }
-         else {
-            iter[0] = currentByte;
-         }
-      }
-      start += rowSize;
-      sourceImage += sourceSkip;
-   }
-}
-
-/*
-** Insert array into user's data applying all pixel store modes.
-** The packed array format from the server is LSB_FIRST = FALSE,
-** SWAP_BYTES = the current pixel storage pack mode, and ALIGNMENT = 4.
-** Named __glEmptyImage() because it is the opposite of __glFillImage().
-*/
-/* ARGSUSED */
-void
-__glEmptyImage(__GLXcontext * gc, GLint dim, GLint width, GLint height,
-               GLint depth, GLenum format, GLenum type,
-               const GLubyte * sourceImage, GLvoid * userdata)
-{
-   const __GLXattribute *state = gc->client_state_private;
-   GLint rowLength = state->storePack.rowLength;
-   GLint imageHeight = state->storePack.imageHeight;
-   GLint alignment = state->storePack.alignment;
-   GLint skipPixels = state->storePack.skipPixels;
-   GLint skipRows = state->storePack.skipRows;
-   GLint skipImages = state->storePack.skipImages;
-   GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
-   GLint elementsPerRow, sourceRowSize, sourcePadding, h, i;
-   GLint imageSize, rowsPerImage;
-   GLubyte *start, *iter, *itera;
-
-   if (type == GL_BITMAP) {
-      EmptyBitmap(gc, width, height, format, sourceImage, userdata);
-   }
-   else {
-      components = __glElementsPerGroup(format, type);
-      if (rowLength > 0) {
-         groupsPerRow = rowLength;
-      }
-      else {
-         groupsPerRow = width;
-      }
-      if (imageHeight > 0) {
-         rowsPerImage = imageHeight;
-      }
-      else {
-         rowsPerImage = height;
-      }
-      elementSize = __glBytesPerElement(type);
-      groupSize = elementSize * components;
-      rowSize = groupsPerRow * groupSize;
-      padding = (rowSize % alignment);
-      if (padding) {
-         rowSize += alignment - padding;
-      }
-      sourceRowSize = width * groupSize;
-      sourcePadding = (sourceRowSize % 4);
-      if (sourcePadding) {
-         sourceRowSize += 4 - sourcePadding;
-      }
-      imageSize = sourceRowSize * rowsPerImage;
-      start = ((GLubyte *) userdata) + skipImages * imageSize +
-         skipRows * rowSize + skipPixels * groupSize;
-      elementsPerRow = width * components;
-
-      itera = start;
-      for (h = 0; h < depth; h++) {
-         if ((rowSize == sourceRowSize) && (sourcePadding == 0)) {
-            /* Ha!  This is mondo easy! */
-            __GLX_MEM_COPY(itera, sourceImage,
-                           elementsPerRow * elementSize * height);
-            sourceImage += elementsPerRow * elementSize * height;
-         }
-         else {
-            iter = itera;
-            for (i = 0; i < height; i++) {
-               __GLX_MEM_COPY(iter, sourceImage,
-                              elementsPerRow * elementSize);
-               sourceImage += sourceRowSize;
-               iter += rowSize;
-            }
-         }
-         itera += imageSize;
-      }
-   }
-}
diff --git a/src/glx/x11/pixelstore.c b/src/glx/x11/pixelstore.c
deleted file mode 100644 (file)
index 8b51b5d..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * 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.
- */
-
-#include "glxclient.h"
-#include "indirect.h"
-
-#if !defined __GNUC__ || __GNUC__ < 3
-#  define __builtin_expect(x, y) x
-#endif
-
-/**
- * Send glPixelStore command to the server
- * 
- * \param gc     Current GLX context
- * \param sop    Either \c X_GLsop_PixelStoref or \c X_GLsop_PixelStorei
- * \param pname  Selector of which pixel parameter is to be set.
- * \param param  Value that \c pname is set to.
- *
- * \sa __indirect_glPixelStorei,  __indirect_glPixelStoref
- */
-static void
-send_PixelStore(__GLXcontext * gc, unsigned sop, GLenum pname,
-                const void *param)
-{
-   Display *const dpy = gc->currentDpy;
-   const GLuint cmdlen = 8;
-   if (__builtin_expect(dpy != NULL, 1)) {
-      GLubyte const *pc = __glXSetupSingleRequest(gc, sop, cmdlen);
-      (void) memcpy((void *) (pc + 0), (void *) (&pname), 4);
-      (void) memcpy((void *) (pc + 4), param, 4);
-      UnlockDisplay(dpy);
-      SyncHandle();
-   }
-   return;
-}
-
-/*
-** Specify parameters that control the storage format of pixel arrays.
-*/
-void
-__indirect_glPixelStoref(GLenum pname, GLfloat param)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = gc->client_state_private;
-   Display *dpy = gc->currentDpy;
-   GLuint a;
-
-   if (!dpy)
-      return;
-
-   switch (pname) {
-   case GL_PACK_ROW_LENGTH:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.rowLength = a;
-      break;
-   case GL_PACK_IMAGE_HEIGHT:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.imageHeight = a;
-      break;
-   case GL_PACK_SKIP_ROWS:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.skipRows = a;
-      break;
-   case GL_PACK_SKIP_PIXELS:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.skipPixels = a;
-      break;
-   case GL_PACK_SKIP_IMAGES:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.skipImages = a;
-      break;
-   case GL_PACK_ALIGNMENT:
-      a = (GLint) (param + 0.5);
-      switch (a) {
-      case 1:
-      case 2:
-      case 4:
-      case 8:
-         state->storePack.alignment = a;
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      break;
-   case GL_PACK_SWAP_BYTES:
-      state->storePack.swapEndian = (param != 0);
-      break;
-   case GL_PACK_LSB_FIRST:
-      state->storePack.lsbFirst = (param != 0);
-      break;
-
-   case GL_UNPACK_ROW_LENGTH:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.rowLength = a;
-      break;
-   case GL_UNPACK_IMAGE_HEIGHT:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.imageHeight = a;
-      break;
-   case GL_UNPACK_SKIP_ROWS:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.skipRows = a;
-      break;
-   case GL_UNPACK_SKIP_PIXELS:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.skipPixels = a;
-      break;
-   case GL_UNPACK_SKIP_IMAGES:
-      a = (GLuint) (param + 0.5);
-      if (((GLint) a) < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.skipImages = a;
-      break;
-   case GL_UNPACK_ALIGNMENT:
-      a = (GLint) (param + 0.5);
-      switch (a) {
-      case 1:
-      case 2:
-      case 4:
-      case 8:
-         state->storeUnpack.alignment = a;
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      break;
-   case GL_UNPACK_SWAP_BYTES:
-      state->storeUnpack.swapEndian = (param != 0);
-      break;
-   case GL_UNPACK_LSB_FIRST:
-      state->storeUnpack.lsbFirst = (param != 0);
-      break;
-
-      /* Group all of the pixel store modes that need to be sent to the
-       * server here.  Care must be used to only send modes to the server that
-       * won't affect the size of the data sent to or received from the
-       * server.  GL_PACK_INVERT_MESA is safe in this respect, but other,
-       * future modes may not be.
-       */
-   case GL_PACK_INVERT_MESA:
-      send_PixelStore(gc, X_GLsop_PixelStoref, pname, &param);
-      break;
-
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      break;
-   }
-}
-
-void
-__indirect_glPixelStorei(GLenum pname, GLint param)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = gc->client_state_private;
-   Display *dpy = gc->currentDpy;
-
-   if (!dpy)
-      return;
-
-   switch (pname) {
-   case GL_PACK_ROW_LENGTH:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.rowLength = param;
-      break;
-   case GL_PACK_IMAGE_HEIGHT:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.imageHeight = param;
-      break;
-   case GL_PACK_SKIP_ROWS:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.skipRows = param;
-      break;
-   case GL_PACK_SKIP_PIXELS:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.skipPixels = param;
-      break;
-   case GL_PACK_SKIP_IMAGES:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storePack.skipImages = param;
-      break;
-   case GL_PACK_ALIGNMENT:
-      switch (param) {
-      case 1:
-      case 2:
-      case 4:
-      case 8:
-         state->storePack.alignment = param;
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      break;
-   case GL_PACK_SWAP_BYTES:
-      state->storePack.swapEndian = (param != 0);
-      break;
-   case GL_PACK_LSB_FIRST:
-      state->storePack.lsbFirst = (param != 0);
-      break;
-
-   case GL_UNPACK_ROW_LENGTH:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.rowLength = param;
-      break;
-   case GL_UNPACK_IMAGE_HEIGHT:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.imageHeight = param;
-      break;
-   case GL_UNPACK_SKIP_ROWS:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.skipRows = param;
-      break;
-   case GL_UNPACK_SKIP_PIXELS:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.skipPixels = param;
-      break;
-   case GL_UNPACK_SKIP_IMAGES:
-      if (param < 0) {
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      state->storeUnpack.skipImages = param;
-      break;
-   case GL_UNPACK_ALIGNMENT:
-      switch (param) {
-      case 1:
-      case 2:
-      case 4:
-      case 8:
-         state->storeUnpack.alignment = param;
-         break;
-      default:
-         __glXSetError(gc, GL_INVALID_VALUE);
-         return;
-      }
-      break;
-   case GL_UNPACK_SWAP_BYTES:
-      state->storeUnpack.swapEndian = (param != 0);
-      break;
-   case GL_UNPACK_LSB_FIRST:
-      state->storeUnpack.lsbFirst = (param != 0);
-      break;
-
-      /* Group all of the pixel store modes that need to be sent to the
-       * server here.  Care must be used to only send modes to the server that
-       * won't affect the size of the data sent to or received from the
-       * server.  GL_PACK_INVERT_MESA is safe in this respect, but other,
-       * future modes may not be.
-       */
-   case GL_PACK_INVERT_MESA:
-      send_PixelStore(gc, X_GLsop_PixelStorei, pname, &param);
-      break;
-
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      break;
-   }
-}
diff --git a/src/glx/x11/render2.c b/src/glx/x11/render2.c
deleted file mode 100644 (file)
index 762950f..0000000
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * 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.
- */
-
-#include "packrender.h"
-#include "indirect.h"
-#include "indirect_size.h"
-
-/*
-** This file contains routines that might need to be transported as
-** GLXRender or GLXRenderLarge commands, and these commands don't
-** use the pixel header.  See renderpix.c for those routines.
-*/
-
-void
-__indirect_glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
-                   GLint order, const GLdouble * pnts)
-{
-   __GLX_DECLARE_VARIABLES();
-   GLint k;
-
-   __GLX_LOAD_VARIABLES();
-   k = __glMap1d_size(target);
-   if (k == 0) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-   else if (stride < k || order <= 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-   compsize = k * order * __GLX_SIZE_FLOAT64;
-   cmdlen = 28 + compsize;
-   if (!gc->currentDpy)
-      return;
-
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      /* Use GLXRender protocol to send small command */
-      __GLX_BEGIN_VARIABLE(X_GLrop_Map1d, cmdlen);
-      __GLX_PUT_DOUBLE(4, u1);
-      __GLX_PUT_DOUBLE(12, u2);
-      __GLX_PUT_LONG(20, target);
-      __GLX_PUT_LONG(24, order);
-      /*
-       ** NOTE: the doubles that follow are not aligned because of 3
-       ** longs preceeding
-       */
-      __glFillMap1d(k, order, stride, pnts, (pc + 28));
-      __GLX_END(cmdlen);
-   }
-   else {
-      /* Use GLXRenderLarge protocol to send command */
-      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1d, cmdlen + 4);
-      __GLX_PUT_DOUBLE(8, u1);
-      __GLX_PUT_DOUBLE(16, u2);
-      __GLX_PUT_LONG(24, target);
-      __GLX_PUT_LONG(28, order);
-
-      /*
-       ** NOTE: the doubles that follow are not aligned because of 3
-       ** longs preceeding
-       */
-      if (stride != k) {
-         GLubyte *buf;
-
-         buf = (GLubyte *) Xmalloc(compsize);
-         if (!buf) {
-            __glXSetError(gc, GL_OUT_OF_MEMORY);
-            return;
-         }
-         __glFillMap1d(k, order, stride, pnts, buf);
-         __glXSendLargeCommand(gc, pc, 32, buf, compsize);
-         Xfree((char *) buf);
-      }
-      else {
-         /* Data is already packed.  Just send it out */
-         __glXSendLargeCommand(gc, pc, 32, pnts, compsize);
-      }
-   }
-}
-
-void
-__indirect_glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
-                   GLint order, const GLfloat * pnts)
-{
-   __GLX_DECLARE_VARIABLES();
-   GLint k;
-
-   __GLX_LOAD_VARIABLES();
-   k = __glMap1f_size(target);
-   if (k == 0) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-   else if (stride < k || order <= 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-   compsize = k * order * __GLX_SIZE_FLOAT32;
-   cmdlen = 20 + compsize;
-   if (!gc->currentDpy)
-      return;
-
-   /*
-    ** The order that arguments are packed is different from the order
-    ** for glMap1d.
-    */
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      /* Use GLXRender protocol to send small command */
-      __GLX_BEGIN_VARIABLE(X_GLrop_Map1f, cmdlen);
-      __GLX_PUT_LONG(4, target);
-      __GLX_PUT_FLOAT(8, u1);
-      __GLX_PUT_FLOAT(12, u2);
-      __GLX_PUT_LONG(16, order);
-      __glFillMap1f(k, order, stride, pnts, (GLubyte *) (pc + 20));
-      __GLX_END(cmdlen);
-   }
-   else {
-      /* Use GLXRenderLarge protocol to send command */
-      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1f, cmdlen + 4);
-      __GLX_PUT_LONG(8, target);
-      __GLX_PUT_FLOAT(12, u1);
-      __GLX_PUT_FLOAT(16, u2);
-      __GLX_PUT_LONG(20, order);
-
-      if (stride != k) {
-         GLubyte *buf;
-
-         buf = (GLubyte *) Xmalloc(compsize);
-         if (!buf) {
-            __glXSetError(gc, GL_OUT_OF_MEMORY);
-            return;
-         }
-         __glFillMap1f(k, order, stride, pnts, buf);
-         __glXSendLargeCommand(gc, pc, 24, buf, compsize);
-         Xfree((char *) buf);
-      }
-      else {
-         /* Data is already packed.  Just send it out */
-         __glXSendLargeCommand(gc, pc, 24, pnts, compsize);
-      }
-   }
-}
-
-void
-__indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustr,
-                   GLint uord, GLdouble v1, GLdouble v2, GLint vstr,
-                   GLint vord, const GLdouble * pnts)
-{
-   __GLX_DECLARE_VARIABLES();
-   GLint k;
-
-   __GLX_LOAD_VARIABLES();
-   k = __glMap2d_size(target);
-   if (k == 0) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-   else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-   compsize = k * uord * vord * __GLX_SIZE_FLOAT64;
-   cmdlen = 48 + compsize;
-   if (!gc->currentDpy)
-      return;
-
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      /* Use GLXRender protocol to send small command */
-      __GLX_BEGIN_VARIABLE(X_GLrop_Map2d, cmdlen);
-      __GLX_PUT_DOUBLE(4, u1);
-      __GLX_PUT_DOUBLE(12, u2);
-      __GLX_PUT_DOUBLE(20, v1);
-      __GLX_PUT_DOUBLE(28, v2);
-      __GLX_PUT_LONG(36, target);
-      __GLX_PUT_LONG(40, uord);
-      __GLX_PUT_LONG(44, vord);
-      /*
-       ** Pack into a u-major ordering.
-       ** NOTE: the doubles that follow are not aligned because of 5
-       ** longs preceeding
-       */
-      __glFillMap2d(k, uord, vord, ustr, vstr, pnts, (GLdouble *) (pc + 48));
-      __GLX_END(cmdlen);
-   }
-   else {
-      /* Use GLXRenderLarge protocol to send command */
-      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2d, cmdlen + 4);
-      __GLX_PUT_DOUBLE(8, u1);
-      __GLX_PUT_DOUBLE(16, u2);
-      __GLX_PUT_DOUBLE(24, v1);
-      __GLX_PUT_DOUBLE(32, v2);
-      __GLX_PUT_LONG(40, target);
-      __GLX_PUT_LONG(44, uord);
-      __GLX_PUT_LONG(48, vord);
-
-      /*
-       ** NOTE: the doubles that follow are not aligned because of 5
-       ** longs preceeding
-       */
-      if ((vstr != k) || (ustr != k * vord)) {
-         GLdouble *buf;
-
-         buf = (GLdouble *) Xmalloc(compsize);
-         if (!buf) {
-            __glXSetError(gc, GL_OUT_OF_MEMORY);
-            return;
-         }
-         /*
-          ** Pack into a u-major ordering.
-          */
-         __glFillMap2d(k, uord, vord, ustr, vstr, pnts, buf);
-         __glXSendLargeCommand(gc, pc, 52, buf, compsize);
-         Xfree((char *) buf);
-      }
-      else {
-         /* Data is already packed.  Just send it out */
-         __glXSendLargeCommand(gc, pc, 52, pnts, compsize);
-      }
-   }
-}
-
-void
-__indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustr,
-                   GLint uord, GLfloat v1, GLfloat v2, GLint vstr, GLint vord,
-                   const GLfloat * pnts)
-{
-   __GLX_DECLARE_VARIABLES();
-   GLint k;
-
-   __GLX_LOAD_VARIABLES();
-   k = __glMap2f_size(target);
-   if (k == 0) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-   else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-   compsize = k * uord * vord * __GLX_SIZE_FLOAT32;
-   cmdlen = 32 + compsize;
-   if (!gc->currentDpy)
-      return;
-
-   /*
-    ** The order that arguments are packed is different from the order
-    ** for glMap2d.
-    */
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      /* Use GLXRender protocol to send small command */
-      __GLX_BEGIN_VARIABLE(X_GLrop_Map2f, cmdlen);
-      __GLX_PUT_LONG(4, target);
-      __GLX_PUT_FLOAT(8, u1);
-      __GLX_PUT_FLOAT(12, u2);
-      __GLX_PUT_LONG(16, uord);
-      __GLX_PUT_FLOAT(20, v1);
-      __GLX_PUT_FLOAT(24, v2);
-      __GLX_PUT_LONG(28, vord);
-      /*
-       ** Pack into a u-major ordering.
-       */
-      __glFillMap2f(k, uord, vord, ustr, vstr, pnts, (GLfloat *) (pc + 32));
-      __GLX_END(cmdlen);
-   }
-   else {
-      /* Use GLXRenderLarge protocol to send command */
-      __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2f, cmdlen + 4);
-      __GLX_PUT_LONG(8, target);
-      __GLX_PUT_FLOAT(12, u1);
-      __GLX_PUT_FLOAT(16, u2);
-      __GLX_PUT_LONG(20, uord);
-      __GLX_PUT_FLOAT(24, v1);
-      __GLX_PUT_FLOAT(28, v2);
-      __GLX_PUT_LONG(32, vord);
-
-      if ((vstr != k) || (ustr != k * vord)) {
-         GLfloat *buf;
-
-         buf = (GLfloat *) Xmalloc(compsize);
-         if (!buf) {
-            __glXSetError(gc, GL_OUT_OF_MEMORY);
-            return;
-         }
-         /*
-          ** Pack into a u-major ordering.
-          */
-         __glFillMap2f(k, uord, vord, ustr, vstr, pnts, buf);
-         __glXSendLargeCommand(gc, pc, 36, buf, compsize);
-         Xfree((char *) buf);
-      }
-      else {
-         /* Data is already packed.  Just send it out */
-         __glXSendLargeCommand(gc, pc, 36, pnts, compsize);
-      }
-   }
-}
-
-void
-__indirect_glEnable(GLenum cap)
-{
-   __GLX_DECLARE_VARIABLES();
-
-   __GLX_LOAD_VARIABLES();
-   if (!gc->currentDpy)
-      return;
-
-   switch (cap) {
-   case GL_COLOR_ARRAY:
-   case GL_EDGE_FLAG_ARRAY:
-   case GL_INDEX_ARRAY:
-   case GL_NORMAL_ARRAY:
-   case GL_TEXTURE_COORD_ARRAY:
-   case GL_VERTEX_ARRAY:
-   case GL_SECONDARY_COLOR_ARRAY:
-   case GL_FOG_COORD_ARRAY:
-      __indirect_glEnableClientState(cap);
-      return;
-   default:
-      break;
-   }
-
-   __GLX_BEGIN(X_GLrop_Enable, 8);
-   __GLX_PUT_LONG(4, cap);
-   __GLX_END(8);
-}
-
-void
-__indirect_glDisable(GLenum cap)
-{
-   __GLX_DECLARE_VARIABLES();
-
-   __GLX_LOAD_VARIABLES();
-   if (!gc->currentDpy)
-      return;
-
-   switch (cap) {
-   case GL_COLOR_ARRAY:
-   case GL_EDGE_FLAG_ARRAY:
-   case GL_INDEX_ARRAY:
-   case GL_NORMAL_ARRAY:
-   case GL_TEXTURE_COORD_ARRAY:
-   case GL_VERTEX_ARRAY:
-   case GL_SECONDARY_COLOR_ARRAY:
-   case GL_FOG_COORD_ARRAY:
-      __indirect_glDisableClientState(cap);
-      return;
-   default:
-      break;
-   }
-
-   __GLX_BEGIN(X_GLrop_Disable, 8);
-   __GLX_PUT_LONG(4, cap);
-   __GLX_END(8);
-}
diff --git a/src/glx/x11/renderpix.c b/src/glx/x11/renderpix.c
deleted file mode 100644 (file)
index 9919bbc..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * 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.
- */
-
-#include "packrender.h"
-#include "indirect.h"
-
-/**
- * Send a large image to the server.  If necessary, a buffer is allocated
- * to hold the unpacked data that is copied from the clients memory.
- * 
- * \param gc        Current GLX context
- * \param compsize  Size, in bytes, of the image portion
- * \param dim       Number of dimensions of the image
- * \param width     Width of the image
- * \param height    Height of the image, must be 1 for 1D images
- * \param depth     Depth of the image, must be 1 for 1D or 2D images
- * \param format    Format of the image
- * \param type      Data type of the image
- * \param src       Pointer to the image data
- * \param pc        Pointer to end of the command header
- * \param modes     Pointer to the pixel unpack data
- *
- * \todo
- * Modify this function so that \c NULL images are sent using
- * \c __glXSendLargeChunk instead of __glXSendLargeCommand.  Doing this
- * will eliminate the need to allocate a buffer for that case.
- *
- * \bugs
- * The \c fastImageUnpack path, which is thankfully never used, is completely
- * broken.
- */
-void
-__glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
-                    GLint width, GLint height, GLint depth,
-                    GLenum format, GLenum type, const GLvoid * src,
-                    GLubyte * pc, GLubyte * modes)
-{
-   if (!gc->fastImageUnpack || (src == NULL)) {
-      /* Allocate a temporary holding buffer */
-      GLubyte *buf = (GLubyte *) Xmalloc(compsize);
-      if (!buf) {
-         __glXSetError(gc, GL_OUT_OF_MEMORY);
-         return;
-      }
-
-      /* Apply pixel store unpack modes to copy data into buf */
-      if (src != NULL) {
-         (*gc->fillImage) (gc, dim, width, height, depth, format, type,
-                           src, buf, modes);
-      }
-      else {
-         if (dim < 3) {
-            (void) memcpy(modes, __glXDefaultPixelStore + 4, 20);
-         }
-         else {
-            (void) memcpy(modes, __glXDefaultPixelStore + 0, 36);
-         }
-      }
-
-      /* Send large command */
-      __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize);
-
-      /* Free buffer */
-      Xfree((char *) buf);
-   }
-   else {
-      /* Just send the data straight as is */
-      __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, pc, compsize);
-   }
-}
-
-/************************************************************************/
-
-/**
- * Implement GLX protocol for \c glSeparableFilter2D.
- *
- * \bugs
- * The \c fastImageUnpack path, which is thankfully never used, is completely
- * broken.
- */
-void
-__indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
-                               GLsizei width, GLsizei height, GLenum format,
-                               GLenum type, const GLvoid * row,
-                               const GLvoid * column)
-{
-   __GLX_DECLARE_VARIABLES();
-   GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len;
-
-   __GLX_LOAD_VARIABLES();
-   compsize = __glImageSize(width, 1, 1, format, type, 0);
-   compsize2 = __glImageSize(height, 1, 1, format, type, 0);
-   totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
-   hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE);
-   image1len = __GLX_PAD(compsize);
-   image2len = __GLX_PAD(compsize2);
-   cmdlen = totalhdrlen + image1len + image2len;
-   if (!gc->currentDpy)
-      return;
-
-   if (cmdlen <= gc->maxSmallRenderCommandSize) {
-      /* Use GLXRender protocol to send small command */
-      __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_SeparableFilter2D, cmdlen);
-      __GLX_PUT_LONG(0, target);
-      __GLX_PUT_LONG(4, internalformat);
-      __GLX_PUT_LONG(8, width);
-      __GLX_PUT_LONG(12, height);
-      __GLX_PUT_LONG(16, format);
-      __GLX_PUT_LONG(20, type);
-      pc += hdrlen;
-      if (compsize > 0) {
-         (*gc->fillImage) (gc, 1, width, 1, 1, format, type,
-                           row, pc, pixelHeaderPC);
-         pc += image1len;
-      }
-      if (compsize2 > 0) {
-         (*gc->fillImage) (gc, 1, height, 1, 1, format, type,
-                           column, pc, NULL);
-         pc += image2len;
-      }
-      if ((compsize == 0) && (compsize2 == 0)) {
-         /* Setup default store modes */
-         (void) memcpy(pixelHeaderPC, __glXDefaultPixelStore + 4, 20);
-      }
-      __GLX_END(0);
-   }
-   else {
-      const GLint bufsize = image1len + image2len;
-
-      /* Use GLXRenderLarge protocol to send command */
-      __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,
-                                            cmdlen + 4);
-      __GLX_PUT_LONG(0, target);
-      __GLX_PUT_LONG(4, internalformat);
-      __GLX_PUT_LONG(8, width);
-      __GLX_PUT_LONG(12, height);
-      __GLX_PUT_LONG(16, format);
-      __GLX_PUT_LONG(20, type);
-      pc += hdrlen;
-
-      if (!gc->fastImageUnpack) {
-         /* Allocate a temporary holding buffer */
-         GLubyte *buf = (GLubyte *) Xmalloc(bufsize);
-         if (!buf) {
-            __glXSetError(gc, GL_OUT_OF_MEMORY);
-            return;
-         }
-         (*gc->fillImage) (gc, 1, width, 1, 1, format, type, row, buf,
-                           pixelHeaderPC);
-
-         (*gc->fillImage) (gc, 1, height, 1, 1, format, type, column,
-                           buf + image1len, pixelHeaderPC);
-
-         /* Send large command */
-         __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf,
-                               bufsize);
-         /* Free buffer */
-         Xfree((char *) buf);
-      }
-      else {
-         /* Just send the data straight as is */
-         __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), pc,
-                               bufsize);
-      }
-   }
-}
diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c
deleted file mode 100644 (file)
index 9ecf589..0000000
+++ /dev/null
@@ -1,974 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdio.h>
-#include <assert.h>
-#include "glxclient.h"
-#include "packsingle.h"
-#include "glxextensions.h"
-#include "indirect.h"
-#include "indirect_vertex_array.h"
-#include "glapitable.h"
-#include "glapidispatch.h"
-#include "glapi.h"
-#ifdef USE_XCB
-#include <xcb/xcb.h>
-#include <xcb/glx.h>
-#include <X11/Xlib-xcb.h>
-#endif /* USE_XCB */
-
-
-/* Used for GL_ARB_transpose_matrix */
-static void
-TransposeMatrixf(GLfloat m[16])
-{
-   int i, j;
-   for (i = 0; i < 4; i++) {
-      for (j = 0; j < i; j++) {
-         GLfloat tmp = m[i * 4 + j];
-         m[i * 4 + j] = m[j * 4 + i];
-         m[j * 4 + i] = tmp;
-      }
-   }
-}
-
-/* Used for GL_ARB_transpose_matrix */
-static void
-TransposeMatrixb(GLboolean m[16])
-{
-   int i, j;
-   for (i = 0; i < 4; i++) {
-      for (j = 0; j < i; j++) {
-         GLboolean tmp = m[i * 4 + j];
-         m[i * 4 + j] = m[j * 4 + i];
-         m[j * 4 + i] = tmp;
-      }
-   }
-}
-
-/* Used for GL_ARB_transpose_matrix */
-static void
-TransposeMatrixd(GLdouble m[16])
-{
-   int i, j;
-   for (i = 0; i < 4; i++) {
-      for (j = 0; j < i; j++) {
-         GLdouble tmp = m[i * 4 + j];
-         m[i * 4 + j] = m[j * 4 + i];
-         m[j * 4 + i] = tmp;
-      }
-   }
-}
-
-/* Used for GL_ARB_transpose_matrix */
-static void
-TransposeMatrixi(GLint m[16])
-{
-   int i, j;
-   for (i = 0; i < 4; i++) {
-      for (j = 0; j < i; j++) {
-         GLint tmp = m[i * 4 + j];
-         m[i * 4 + j] = m[j * 4 + i];
-         m[j * 4 + i] = tmp;
-      }
-   }
-}
-
-
-/**
- * Remap a transpose-matrix enum to a non-transpose-matrix enum.  Enums
- * that are not transpose-matrix enums are unaffected.
- */
-static GLenum
-RemapTransposeEnum(GLenum e)
-{
-   switch (e) {
-   case GL_TRANSPOSE_MODELVIEW_MATRIX:
-   case GL_TRANSPOSE_PROJECTION_MATRIX:
-   case GL_TRANSPOSE_TEXTURE_MATRIX:
-      return e - (GL_TRANSPOSE_MODELVIEW_MATRIX - GL_MODELVIEW_MATRIX);
-   case GL_TRANSPOSE_COLOR_MATRIX:
-      return GL_COLOR_MATRIX;
-   default:
-      return e;
-   };
-}
-
-
-GLenum
-__indirect_glGetError(void)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   GLuint retval = GL_NO_ERROR;
-   xGLXGetErrorReply reply;
-
-   if (gc->error) {
-      /* Use internal error first */
-      retval = gc->error;
-      gc->error = GL_NO_ERROR;
-      return retval;
-   }
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_GetError, 0);
-   __GLX_SINGLE_READ_XREPLY();
-   retval = reply.error;
-   __GLX_SINGLE_END();
-
-   return retval;
-}
-
-
-/**
- * Get the selected attribute from the client state.
- *
- * \returns
- * On success \c GL_TRUE is returned.  Otherwise, \c GL_FALSE is returned.
- */
-static GLboolean
-get_client_data(__GLXcontext * gc, GLenum cap, GLintptr * data)
-{
-   GLboolean retval = GL_TRUE;
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   const GLint tex_unit = __glXGetActiveTextureUnit(state);
-
-
-   switch (cap) {
-   case GL_VERTEX_ARRAY:
-   case GL_NORMAL_ARRAY:
-   case GL_COLOR_ARRAY:
-   case GL_INDEX_ARRAY:
-   case GL_EDGE_FLAG_ARRAY:
-   case GL_SECONDARY_COLOR_ARRAY:
-   case GL_FOG_COORD_ARRAY:
-      retval = __glXGetArrayEnable(state, cap, 0, data);
-      break;
-
-   case GL_VERTEX_ARRAY_SIZE:
-      retval = __glXGetArraySize(state, GL_VERTEX_ARRAY, 0, data);
-      break;
-   case GL_COLOR_ARRAY_SIZE:
-      retval = __glXGetArraySize(state, GL_COLOR_ARRAY, 0, data);
-      break;
-   case GL_SECONDARY_COLOR_ARRAY_SIZE:
-      retval = __glXGetArraySize(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
-      break;
-
-   case GL_VERTEX_ARRAY_TYPE:
-      retval = __glXGetArrayType(state, GL_VERTEX_ARRAY, 0, data);
-      break;
-   case GL_NORMAL_ARRAY_TYPE:
-      retval = __glXGetArrayType(state, GL_NORMAL_ARRAY, 0, data);
-      break;
-   case GL_INDEX_ARRAY_TYPE:
-      retval = __glXGetArrayType(state, GL_INDEX_ARRAY, 0, data);
-      break;
-   case GL_COLOR_ARRAY_TYPE:
-      retval = __glXGetArrayType(state, GL_COLOR_ARRAY, 0, data);
-      break;
-   case GL_SECONDARY_COLOR_ARRAY_TYPE:
-      retval = __glXGetArrayType(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
-      break;
-   case GL_FOG_COORD_ARRAY_TYPE:
-      retval = __glXGetArrayType(state, GL_FOG_COORD_ARRAY, 0, data);
-      break;
-
-   case GL_VERTEX_ARRAY_STRIDE:
-      retval = __glXGetArrayStride(state, GL_VERTEX_ARRAY, 0, data);
-      break;
-   case GL_NORMAL_ARRAY_STRIDE:
-      retval = __glXGetArrayStride(state, GL_NORMAL_ARRAY, 0, data);
-      break;
-   case GL_INDEX_ARRAY_STRIDE:
-      retval = __glXGetArrayStride(state, GL_INDEX_ARRAY, 0, data);
-      break;
-   case GL_EDGE_FLAG_ARRAY_STRIDE:
-      retval = __glXGetArrayStride(state, GL_EDGE_FLAG_ARRAY, 0, data);
-      break;
-   case GL_COLOR_ARRAY_STRIDE:
-      retval = __glXGetArrayStride(state, GL_COLOR_ARRAY, 0, data);
-      break;
-   case GL_SECONDARY_COLOR_ARRAY_STRIDE:
-      retval = __glXGetArrayStride(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
-      break;
-   case GL_FOG_COORD_ARRAY_STRIDE:
-      retval = __glXGetArrayStride(state, GL_FOG_COORD_ARRAY, 0, data);
-      break;
-
-   case GL_TEXTURE_COORD_ARRAY:
-      retval =
-         __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
-      break;
-   case GL_TEXTURE_COORD_ARRAY_SIZE:
-      retval =
-         __glXGetArraySize(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
-      break;
-   case GL_TEXTURE_COORD_ARRAY_TYPE:
-      retval =
-         __glXGetArrayType(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
-      break;
-   case GL_TEXTURE_COORD_ARRAY_STRIDE:
-      retval =
-         __glXGetArrayStride(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
-      break;
-
-   case GL_MAX_ELEMENTS_VERTICES:
-   case GL_MAX_ELEMENTS_INDICES:
-      retval = GL_TRUE;
-      *data = ~0UL;
-      break;
-
-
-   case GL_PACK_ROW_LENGTH:
-      *data = (GLintptr) state->storePack.rowLength;
-      break;
-   case GL_PACK_IMAGE_HEIGHT:
-      *data = (GLintptr) state->storePack.imageHeight;
-      break;
-   case GL_PACK_SKIP_ROWS:
-      *data = (GLintptr) state->storePack.skipRows;
-      break;
-   case GL_PACK_SKIP_PIXELS:
-      *data = (GLintptr) state->storePack.skipPixels;
-      break;
-   case GL_PACK_SKIP_IMAGES:
-      *data = (GLintptr) state->storePack.skipImages;
-      break;
-   case GL_PACK_ALIGNMENT:
-      *data = (GLintptr) state->storePack.alignment;
-      break;
-   case GL_PACK_SWAP_BYTES:
-      *data = (GLintptr) state->storePack.swapEndian;
-      break;
-   case GL_PACK_LSB_FIRST:
-      *data = (GLintptr) state->storePack.lsbFirst;
-      break;
-   case GL_UNPACK_ROW_LENGTH:
-      *data = (GLintptr) state->storeUnpack.rowLength;
-      break;
-   case GL_UNPACK_IMAGE_HEIGHT:
-      *data = (GLintptr) state->storeUnpack.imageHeight;
-      break;
-   case GL_UNPACK_SKIP_ROWS:
-      *data = (GLintptr) state->storeUnpack.skipRows;
-      break;
-   case GL_UNPACK_SKIP_PIXELS:
-      *data = (GLintptr) state->storeUnpack.skipPixels;
-      break;
-   case GL_UNPACK_SKIP_IMAGES:
-      *data = (GLintptr) state->storeUnpack.skipImages;
-      break;
-   case GL_UNPACK_ALIGNMENT:
-      *data = (GLintptr) state->storeUnpack.alignment;
-      break;
-   case GL_UNPACK_SWAP_BYTES:
-      *data = (GLintptr) state->storeUnpack.swapEndian;
-      break;
-   case GL_UNPACK_LSB_FIRST:
-      *data = (GLintptr) state->storeUnpack.lsbFirst;
-      break;
-   case GL_CLIENT_ATTRIB_STACK_DEPTH:
-      *data = (GLintptr) (gc->attributes.stackPointer - gc->attributes.stack);
-      break;
-   case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
-      *data = (GLintptr) __GL_CLIENT_ATTRIB_STACK_DEPTH;
-      break;
-   case GL_CLIENT_ACTIVE_TEXTURE:
-      *data = (GLintptr) (tex_unit + GL_TEXTURE0);
-      break;
-
-   default:
-      retval = GL_FALSE;
-      break;
-   }
-
-
-   return retval;
-}
-
-
-void
-__indirect_glGetBooleanv(GLenum val, GLboolean * b)
-{
-   const GLenum origVal = val;
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   xGLXSingleReply reply;
-
-   val = RemapTransposeEnum(val);
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_GetBooleanv, 4);
-   __GLX_SINGLE_PUT_LONG(0, val);
-   __GLX_SINGLE_READ_XREPLY();
-   __GLX_SINGLE_GET_SIZE(compsize);
-
-   if (compsize == 0) {
-      /*
-       ** Error occured; don't modify user's buffer.
-       */
-   }
-   else {
-      GLintptr data;
-
-      /*
-       ** We still needed to send the request to the server in order to
-       ** find out whether it was legal to make a query (it's illegal,
-       ** for example, to call a query between glBegin() and glEnd()).
-       */
-
-      if (get_client_data(gc, val, &data)) {
-         *b = (GLboolean) data;
-      }
-      else {
-         /*
-          ** Not a local value, so use what we got from the server.
-          */
-         if (compsize == 1) {
-            __GLX_SINGLE_GET_CHAR(b);
-         }
-         else {
-            __GLX_SINGLE_GET_CHAR_ARRAY(b, compsize);
-            if (val != origVal) {
-               /* matrix transpose */
-               TransposeMatrixb(b);
-            }
-         }
-      }
-   }
-   __GLX_SINGLE_END();
-}
-
-void
-__indirect_glGetDoublev(GLenum val, GLdouble * d)
-{
-   const GLenum origVal = val;
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   xGLXSingleReply reply;
-
-   val = RemapTransposeEnum(val);
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_GetDoublev, 4);
-   __GLX_SINGLE_PUT_LONG(0, val);
-   __GLX_SINGLE_READ_XREPLY();
-   __GLX_SINGLE_GET_SIZE(compsize);
-
-   if (compsize == 0) {
-      /*
-       ** Error occured; don't modify user's buffer.
-       */
-   }
-   else {
-      GLintptr data;
-
-      /*
-       ** We still needed to send the request to the server in order to
-       ** find out whether it was legal to make a query (it's illegal,
-       ** for example, to call a query between glBegin() and glEnd()).
-       */
-
-      if (get_client_data(gc, val, &data)) {
-         *d = (GLdouble) data;
-      }
-      else {
-         /*
-          ** Not a local value, so use what we got from the server.
-          */
-         if (compsize == 1) {
-            __GLX_SINGLE_GET_DOUBLE(d);
-         }
-         else {
-            __GLX_SINGLE_GET_DOUBLE_ARRAY(d, compsize);
-            if (val != origVal) {
-               /* matrix transpose */
-               TransposeMatrixd(d);
-            }
-         }
-      }
-   }
-   __GLX_SINGLE_END();
-}
-
-void
-__indirect_glGetFloatv(GLenum val, GLfloat * f)
-{
-   const GLenum origVal = val;
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   xGLXSingleReply reply;
-
-   val = RemapTransposeEnum(val);
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_GetFloatv, 4);
-   __GLX_SINGLE_PUT_LONG(0, val);
-   __GLX_SINGLE_READ_XREPLY();
-   __GLX_SINGLE_GET_SIZE(compsize);
-
-   if (compsize == 0) {
-      /*
-       ** Error occured; don't modify user's buffer.
-       */
-   }
-   else {
-      GLintptr data;
-
-      /*
-       ** We still needed to send the request to the server in order to
-       ** find out whether it was legal to make a query (it's illegal,
-       ** for example, to call a query between glBegin() and glEnd()).
-       */
-
-      if (get_client_data(gc, val, &data)) {
-         *f = (GLfloat) data;
-      }
-      else {
-         /*
-          ** Not a local value, so use what we got from the server.
-          */
-         if (compsize == 1) {
-            __GLX_SINGLE_GET_FLOAT(f);
-         }
-         else {
-            __GLX_SINGLE_GET_FLOAT_ARRAY(f, compsize);
-            if (val != origVal) {
-               /* matrix transpose */
-               TransposeMatrixf(f);
-            }
-         }
-      }
-   }
-   __GLX_SINGLE_END();
-}
-
-void
-__indirect_glGetIntegerv(GLenum val, GLint * i)
-{
-   const GLenum origVal = val;
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   xGLXSingleReply reply;
-
-   val = RemapTransposeEnum(val);
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv, 4);
-   __GLX_SINGLE_PUT_LONG(0, val);
-   __GLX_SINGLE_READ_XREPLY();
-   __GLX_SINGLE_GET_SIZE(compsize);
-
-   if (compsize == 0) {
-      /*
-       ** Error occured; don't modify user's buffer.
-       */
-   }
-   else {
-      GLintptr data;
-
-      /*
-       ** We still needed to send the request to the server in order to
-       ** find out whether it was legal to make a query (it's illegal,
-       ** for example, to call a query between glBegin() and glEnd()).
-       */
-
-      if (get_client_data(gc, val, &data)) {
-         *i = (GLint) data;
-      }
-      else {
-         /*
-          ** Not a local value, so use what we got from the server.
-          */
-         if (compsize == 1) {
-            __GLX_SINGLE_GET_LONG(i);
-         }
-         else {
-            __GLX_SINGLE_GET_LONG_ARRAY(i, compsize);
-            if (val != origVal) {
-               /* matrix transpose */
-               TransposeMatrixi(i);
-            }
-         }
-      }
-   }
-   __GLX_SINGLE_END();
-}
-
-/*
-** Send all pending commands to server.
-*/
-void
-__indirect_glFlush(void)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-
-   if (!dpy)
-      return;
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_Flush, 0);
-   __GLX_SINGLE_END();
-
-   /* And finally flush the X protocol data */
-   XFlush(dpy);
-}
-
-void
-__indirect_glFeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-
-   if (!dpy)
-      return;
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_FeedbackBuffer, 8);
-   __GLX_SINGLE_PUT_LONG(0, size);
-   __GLX_SINGLE_PUT_LONG(4, type);
-   __GLX_SINGLE_END();
-
-   gc->feedbackBuf = buffer;
-}
-
-void
-__indirect_glSelectBuffer(GLsizei numnames, GLuint * buffer)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-
-   if (!dpy)
-      return;
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_SelectBuffer, 4);
-   __GLX_SINGLE_PUT_LONG(0, numnames);
-   __GLX_SINGLE_END();
-
-   gc->selectBuf = buffer;
-}
-
-GLint
-__indirect_glRenderMode(GLenum mode)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   GLint retval = 0;
-   xGLXRenderModeReply reply;
-
-   if (!dpy)
-      return -1;
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_RenderMode, 4);
-   __GLX_SINGLE_PUT_LONG(0, mode);
-   __GLX_SINGLE_READ_XREPLY();
-   __GLX_SINGLE_GET_RETVAL(retval, GLint);
-
-   if (reply.newMode != mode) {
-      /*
-       ** Switch to new mode did not take effect, therefore an error
-       ** occured.  When an error happens the server won't send us any
-       ** other data.
-       */
-   }
-   else {
-      /* Read the feedback or selection data */
-      if (gc->renderMode == GL_FEEDBACK) {
-         __GLX_SINGLE_GET_SIZE(compsize);
-         __GLX_SINGLE_GET_FLOAT_ARRAY(gc->feedbackBuf, compsize);
-      }
-      else if (gc->renderMode == GL_SELECT) {
-         __GLX_SINGLE_GET_SIZE(compsize);
-         __GLX_SINGLE_GET_LONG_ARRAY(gc->selectBuf, compsize);
-      }
-      gc->renderMode = mode;
-   }
-   __GLX_SINGLE_END();
-
-   return retval;
-}
-
-void
-__indirect_glFinish(void)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   xGLXSingleReply reply;
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_Finish, 0);
-   __GLX_SINGLE_READ_XREPLY();
-   __GLX_SINGLE_END();
-}
-
-
-/**
- * Extract the major and minor version numbers from a version string.
- */
-static void
-version_from_string(const char *ver, int *major_version, int *minor_version)
-{
-   const char *end;
-   long major;
-   long minor;
-
-   major = strtol(ver, (char **) &end, 10);
-   minor = strtol(end + 1, NULL, 10);
-   *major_version = major;
-   *minor_version = minor;
-}
-
-
-const GLubyte *
-__indirect_glGetString(GLenum name)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   Display *dpy = gc->currentDpy;
-   GLubyte *s = NULL;
-
-   if (!dpy)
-      return 0;
-
-   /*
-    ** Return the cached copy if the string has already been fetched
-    */
-   switch (name) {
-   case GL_VENDOR:
-      if (gc->vendor)
-         return gc->vendor;
-      break;
-   case GL_RENDERER:
-      if (gc->renderer)
-         return gc->renderer;
-      break;
-   case GL_VERSION:
-      if (gc->version)
-         return gc->version;
-      break;
-   case GL_EXTENSIONS:
-      if (gc->extensions)
-         return gc->extensions;
-      break;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return 0;
-   }
-
-   /*
-    ** Get requested string from server
-    */
-
-   (void) __glXFlushRenderBuffer(gc, gc->pc);
-   s = (GLubyte *) __glXGetString(dpy, gc->majorOpcode, gc->currentContextTag,
-                                  name);
-   if (!s) {
-      /* Throw data on the floor */
-      __glXSetError(gc, GL_OUT_OF_MEMORY);
-   }
-   else {
-      /*
-       ** Update local cache
-       */
-      switch (name) {
-      case GL_VENDOR:
-         gc->vendor = s;
-         break;
-
-      case GL_RENDERER:
-         gc->renderer = s;
-         break;
-
-      case GL_VERSION:{
-            int client_major;
-            int client_minor;
-
-            version_from_string((char *) s,
-                                &gc->server_major, &gc->server_minor);
-            __glXGetGLVersion(&client_major, &client_minor);
-
-            if ((gc->server_major < client_major)
-                || ((gc->server_major == client_major)
-                    && (gc->server_minor <= client_minor))) {
-               gc->version = s;
-            }
-            else {
-               /* Allow 7 bytes for the client-side GL version.  This allows
-                * for upto version 999.999.  I'm not holding my breath for
-                * that one!  The extra 4 is for the ' ()\0' that will be
-                * added.
-                */
-               const size_t size = 7 + strlen((char *) s) + 4;
-
-               gc->version = Xmalloc(size);
-               if (gc->version == NULL) {
-                  /* If we couldn't allocate memory for the new string,
-                   * make a best-effort and just copy the client-side version
-                   * to the string and use that.  It probably doesn't
-                   * matter what is done here.  If there not memory available
-                   * for a short string, the system is probably going to die
-                   * soon anyway.
-                   */
-                  snprintf((char *) s, strlen((char *) s) + 1, "%u.%u",
-                           client_major, client_minor);
-                  gc->version = s;
-               }
-               else {
-                  snprintf((char *) gc->version, size, "%u.%u (%s)",
-                           client_major, client_minor, s);
-                  Xfree(s);
-                  s = gc->version;
-               }
-            }
-            break;
-         }
-
-      case GL_EXTENSIONS:{
-            int major = 1;
-            int minor = 0;
-
-            /* This code is currently disabled.  I was reminded that some
-             * vendors intentionally exclude some extensions from their
-             * extension string that are part of the core version they
-             * advertise.  In particular, on Nvidia drivers this means that
-             * the functionality is supported by the driver, but is not
-             * hardware accelerated.  For example, a TNT will show core
-             * version 1.5, but most of the post-1.2 functionality is a
-             * software fallback.
-             *
-             * I don't want to break applications that rely on this odd
-             * behavior.  At the same time, the code is written and tested,
-             * so I didn't want to throw it away.  Therefore, the code is here
-             * but disabled.  In the future, we may wish to and an environment
-             * variable to enable it.
-             */
-
-#if 0
-            /* Call glGetString just to make sure that gc->server_major and
-             * gc->server_minor are set.  This version may be higher than we
-             * can completely support, but it may imply support for some
-             * extensions that we can support.
-             *
-             * For example, at the time of this writing, the client-side
-             * library only supports upto core GL version 1.2.  However, cubic
-             * textures, multitexture, multisampling, and some other 1.3
-             * features are supported.  If the server reports back version
-             * 1.3, but does not report all of those extensions, we will
-             * enable them.
-             */
-            (void *) glGetString(GL_VERSION);
-            major = gc->server_major, minor = gc->server_minor;
-#endif
-
-            __glXCalculateUsableGLExtensions(gc, (char *) s, major, minor);
-            XFree(s);
-            s = gc->extensions;
-            break;
-         }
-      }
-   }
-   return s;
-}
-
-GLboolean
-__indirect_glIsEnabled(GLenum cap)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   xGLXSingleReply reply;
-   GLboolean retval = 0;
-   GLintptr enable;
-
-   if (!dpy)
-      return 0;
-
-   switch (cap) {
-   case GL_VERTEX_ARRAY:
-   case GL_NORMAL_ARRAY:
-   case GL_COLOR_ARRAY:
-   case GL_INDEX_ARRAY:
-   case GL_EDGE_FLAG_ARRAY:
-   case GL_SECONDARY_COLOR_ARRAY:
-   case GL_FOG_COORD_ARRAY:
-      retval = __glXGetArrayEnable(state, cap, 0, &enable);
-      assert(retval);
-      return (GLboolean) enable;
-      break;
-   case GL_TEXTURE_COORD_ARRAY:
-      retval = __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY,
-                                   __glXGetActiveTextureUnit(state), &enable);
-      assert(retval);
-      return (GLboolean) enable;
-      break;
-   }
-
-   __GLX_SINGLE_LOAD_VARIABLES();
-   __GLX_SINGLE_BEGIN(X_GLsop_IsEnabled, 4);
-   __GLX_SINGLE_PUT_LONG(0, cap);
-   __GLX_SINGLE_READ_XREPLY();
-   __GLX_SINGLE_GET_RETVAL(retval, GLboolean);
-   __GLX_SINGLE_END();
-   return retval;
-}
-
-void
-__indirect_glGetPointerv(GLenum pname, void **params)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-   Display *dpy = gc->currentDpy;
-
-   if (!dpy)
-      return;
-
-   switch (pname) {
-   case GL_VERTEX_ARRAY_POINTER:
-   case GL_NORMAL_ARRAY_POINTER:
-   case GL_COLOR_ARRAY_POINTER:
-   case GL_INDEX_ARRAY_POINTER:
-   case GL_EDGE_FLAG_ARRAY_POINTER:
-      __glXGetArrayPointer(state, pname - GL_VERTEX_ARRAY_POINTER
-                           + GL_VERTEX_ARRAY, 0, params);
-      return;
-   case GL_TEXTURE_COORD_ARRAY_POINTER:
-      __glXGetArrayPointer(state, GL_TEXTURE_COORD_ARRAY,
-                           __glXGetActiveTextureUnit(state), params);
-      return;
-   case GL_SECONDARY_COLOR_ARRAY_POINTER:
-   case GL_FOG_COORD_ARRAY_POINTER:
-      __glXGetArrayPointer(state, pname - GL_FOG_COORD_ARRAY_POINTER
-                           + GL_FOG_COORD_ARRAY, 0, params);
-      return;
-   case GL_FEEDBACK_BUFFER_POINTER:
-      *params = (void *) gc->feedbackBuf;
-      return;
-   case GL_SELECTION_BUFFER_POINTER:
-      *params = (void *) gc->selectBuf;
-      return;
-   default:
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-}
-
-
-
-/**
- * This was previously auto-generated, but we need to special-case
- * how we handle writing into the 'residences' buffer when n%4!=0.
- */
-#define X_GLsop_AreTexturesResident 143
-GLboolean
-__indirect_glAreTexturesResident(GLsizei n, const GLuint * textures,
-                                 GLboolean * residences)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-   Display *const dpy = gc->currentDpy;
-   GLboolean retval = (GLboolean) 0;
-   const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-   if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-#ifdef USE_XCB
-      xcb_connection_t *c = XGetXCBConnection(dpy);
-      (void) __glXFlushRenderBuffer(gc, gc->pc);
-      xcb_glx_are_textures_resident_reply_t *reply =
-         xcb_glx_are_textures_resident_reply(c,
-                                             xcb_glx_are_textures_resident
-                                             (c, gc->currentContextTag, n,
-                                              textures), NULL);
-      (void) memcpy(residences, xcb_glx_are_textures_resident_data(reply),
-                    xcb_glx_are_textures_resident_data_length(reply) *
-                    sizeof(GLboolean));
-      retval = reply->ret_val;
-      free(reply);
-#else
-      GLubyte const *pc =
-         __glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
-      (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-      (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
-      if (n & 3) {
-         /* n is not a multiple of four.
-          * When reply_is_always_array is TRUE, __glXReadReply() will
-          * put a multiple of four bytes into the dest buffer.  If the
-          * caller's buffer is not a multiple of four in size, we'll write
-          * out of bounds.  So use a temporary buffer that's a few bytes
-          * larger.
-          */
-         GLboolean *res4 = malloc((n + 3) & ~3);
-         retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
-         memcpy(residences, res4, n);
-         free(res4);
-      }
-      else {
-         retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
-      }
-      UnlockDisplay(dpy);
-      SyncHandle();
-#endif /* USE_XCB */
-   }
-   return retval;
-}
-
-
-/**
- * This was previously auto-generated, but we need to special-case
- * how we handle writing into the 'residences' buffer when n%4!=0.
- */
-#define X_GLvop_AreTexturesResidentEXT 11
-GLboolean
-glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,
-                         GLboolean * residences)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-
-   if (gc->isDirect) {
-      return CALL_AreTexturesResident(GET_DISPATCH(),
-                                      (n, textures, residences));
-   }
-   else {
-      __GLXcontext *const gc = __glXGetCurrentContext();
-      Display *const dpy = gc->currentDpy;
-      GLboolean retval = (GLboolean) 0;
-      const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-      if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-         GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_AreTexturesResidentEXT,
-                                    cmdlen);
-         (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-         (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
-         if (n & 3) {
-            /* see comments in __indirect_glAreTexturesResident() */
-            GLboolean *res4 = malloc((n + 3) & ~3);
-            retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
-            memcpy(residences, res4, n);
-            free(res4);
-         }
-         else {
-            retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
-         }
-         UnlockDisplay(dpy);
-         SyncHandle();
-      }
-      return retval;
-   }
-}
diff --git a/src/glx/x11/singlepix.c b/src/glx/x11/singlepix.c
deleted file mode 100644 (file)
index f5ebf4d..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.
- */
-
-#include "packsingle.h"
-#include "indirect.h"
-#include "glapitable.h"
-#include "glapidispatch.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "glapioffsets.h"
-#include <GL/glxproto.h>
-
-void
-__indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
-                                GLvoid * row, GLvoid * column, GLvoid * span)
-{
-   __GLX_SINGLE_DECLARE_VARIABLES();
-   const __GLXattribute *state;
-   xGLXGetSeparableFilterReply reply;
-   GLubyte *rowBuf, *colBuf;
-
-   if (!dpy)
-      return;
-   __GLX_SINGLE_LOAD_VARIABLES();
-   state = gc->client_state_private;
-
-   /* Send request */
-   __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13));
-   __GLX_SINGLE_PUT_LONG(0, target);
-   __GLX_SINGLE_PUT_LONG(4, format);
-   __GLX_SINGLE_PUT_LONG(8, type);
-   __GLX_SINGLE_PUT_CHAR(12, state->storePack.swapEndian);
-   __GLX_SINGLE_READ_XREPLY();
-   compsize = reply.length << 2;
-
-   if (compsize != 0) {
-      GLint width, height;
-      GLint widthsize, heightsize;
-
-      width = reply.width;
-      height = reply.height;
-
-      widthsize = __glImageSize(width, 1, 1, format, type, 0);
-      heightsize = __glImageSize(height, 1, 1, format, type, 0);
-
-      /* Allocate a holding buffer to transform the data from */
-      rowBuf = (GLubyte *) Xmalloc(widthsize);
-      if (!rowBuf) {
-         /* Throw data away */
-         _XEatData(dpy, compsize);
-         __glXSetError(gc, GL_OUT_OF_MEMORY);
-         UnlockDisplay(dpy);
-         SyncHandle();
-         return;
-      }
-      else {
-         __GLX_SINGLE_GET_CHAR_ARRAY(((char *) rowBuf), widthsize);
-         __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row);
-         Xfree((char *) rowBuf);
-      }
-      colBuf = (GLubyte *) Xmalloc(heightsize);
-      if (!colBuf) {
-         /* Throw data away */
-         _XEatData(dpy, compsize - __GLX_PAD(widthsize));
-         __glXSetError(gc, GL_OUT_OF_MEMORY);
-         UnlockDisplay(dpy);
-         SyncHandle();
-         return;
-      }
-      else {
-         __GLX_SINGLE_GET_CHAR_ARRAY(((char *) colBuf), heightsize);
-         __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column);
-         Xfree((char *) colBuf);
-      }
-   }
-   else {
-      /*
-       ** don't modify user's buffer.
-       */
-   }
-   __GLX_SINGLE_END();
-
-}
-
-
-#define CONCAT(a,b) a ## b
-#define NAME(o) CONCAT(gl_dispatch_stub_, o)
-
-void NAME(_gloffset_GetSeparableFilter) (GLenum target, GLenum format,
-                                         GLenum type, GLvoid * row,
-                                         GLvoid * column, GLvoid * span)
-{
-   __GLXcontext *const gc = __glXGetCurrentContext();
-
-#ifdef GLX_DIRECT_RENDERING
-   if (gc->driContext) {
-      CALL_GetSeparableFilter(GET_DISPATCH(),
-                              (target, format, type, row, column, span));
-      return;
-   }
-   else
-#endif
-   {
-      Display *const dpy = gc->currentDpy;
-      const GLuint cmdlen = __GLX_PAD(13);
-
-      if (dpy != NULL) {
-         const __GLXattribute *const state = gc->client_state_private;
-         xGLXGetSeparableFilterReply reply;
-         GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetSeparableFilterEXT, cmdlen);
-         unsigned compsize;
-
-
-         (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-         (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-         (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-         *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-
-         (void) _XReply(dpy, (xReply *) & reply, 0, False);
-
-         compsize = reply.length << 2;
-
-         if (compsize != 0) {
-            const GLint width = reply.width;
-            const GLint height = reply.height;
-            const GLint widthsize =
-               __glImageSize(width, 1, 1, format, type, 0);
-            const GLint heightsize =
-               __glImageSize(height, 1, 1, format, type, 0);
-            GLubyte *const buf =
-               (GLubyte *) Xmalloc((widthsize > heightsize) ? widthsize :
-                                   heightsize);
-
-            if (buf == NULL) {
-               /* Throw data away */
-               _XEatData(dpy, compsize);
-               __glXSetError(gc, GL_OUT_OF_MEMORY);
-
-               UnlockDisplay(dpy);
-               SyncHandle();
-               return;
-            }
-            else {
-               int extra;
-
-               extra = 4 - (widthsize & 3);
-               _XRead(dpy, (char *) buf, widthsize);
-               if (extra < 4) {
-                  _XEatData(dpy, extra);
-               }
-
-               __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, row);
-
-               extra = 4 - (heightsize & 3);
-               _XRead(dpy, (char *) buf, heightsize);
-               if (extra < 4) {
-                  _XEatData(dpy, extra);
-               }
-
-               __glEmptyImage(gc, 1, height, 1, 1, format, type, buf, column);
-
-               Xfree((char *) buf);
-            }
-         }
-      }
-   }
-}
diff --git a/src/glx/x11/vertarr.c b/src/glx/x11/vertarr.c
deleted file mode 100644 (file)
index 398cfb1..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * 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.
- */
-
-#include "glxclient.h"
-#include "indirect.h"
-#include "indirect_vertex_array.h"
-
-
-/*****************************************************************************/
-
-/**
- * \name Vertex array pointer bridge functions
- *
- * When EXT_vertex_array was moved into the core GL spec, the \c count
- * parameter was lost.  This libGL really only wants to implement the GL 1.1
- * version, but we need to support applications that were written to the old
- * interface.  These bridge functions are part of the glue that makes this
- * happen.
- */
-/*@{*/
-void
-__indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride,
-                             GLsizei count, const GLvoid * pointer)
-{
-   (void) count;
-   __indirect_glColorPointer(size, type, stride, pointer);
-}
-
-void
-__indirect_glEdgeFlagPointerEXT(GLsizei stride,
-                                GLsizei count, const GLboolean * pointer)
-{
-   (void) count;
-   __indirect_glEdgeFlagPointer(stride, pointer);
-}
-
-void
-__indirect_glIndexPointerEXT(GLenum type, GLsizei stride,
-                             GLsizei count, const GLvoid * pointer)
-{
-   (void) count;
-   __indirect_glIndexPointer(type, stride, pointer);
-}
-
-void
-__indirect_glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
-                              const GLvoid * pointer)
-{
-   (void) count;
-   __indirect_glNormalPointer(type, stride, pointer);
-}
-
-void
-__indirect_glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
-                                GLsizei count, const GLvoid * pointer)
-{
-   (void) count;
-   __indirect_glTexCoordPointer(size, type, stride, pointer);
-}
-
-void
-__indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride,
-                              GLsizei count, const GLvoid * pointer)
-{
-   (void) count;
-   __indirect_glVertexPointer(size, type, stride, pointer);
-}
-
-/*@}*/
-
-/*****************************************************************************/
-
-void
-__indirect_glInterleavedArrays(GLenum format, GLsizei stride,
-                               const GLvoid * pointer)
-{
-   __GLXcontext *gc = __glXGetCurrentContext();
-   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
-
-#define NONE  {0, 0, 0}
-#define F(x)  {GL_FLOAT, x, x * sizeof(GLfloat)}
-#define UB4   {GL_UNSIGNED_BYTE, 4, 4 * sizeof(GLubyte)}
-
-   /* Each row in this array describes the elements of a particular
-    * interleaved array mode.  Each column describes, in the order in which
-    * they appear in the interleaved arrays, one of the four possible types
-    * of vertex data that can appear in an interleaved array.
-    */
-   struct
-   {
-        /**
-        * The enum describing the GL type, as would be passed to the
-        * appropriate gl*Pointer function.
-        */
-      GLushort type;
-
-        /**
-        * Number of elements in the subarray, as would be passed (as the
-        * \c size parameter) to the appropriate gl*Pointer function.
-        */
-      GLubyte count;
-
-        /**
-        * True size of a single element in the subarray, as would be passed
-        * (as the \c stride parameter) to the appropriate gl*Pointer
-        * function.
-        */
-      GLubyte size;
-   }
-   static const modes[14][4] = {
-      /* texture color normal vertex */
-      {NONE, NONE, NONE, F(2)}, /* GL_V2F */
-      {NONE, NONE, NONE, F(3)}, /* GL_V3F */
-      {NONE, UB4, NONE, F(2)},  /* GL_C4UB_V2F */
-      {NONE, UB4, NONE, F(3)},  /* GL_C4UB_V3F */
-      {NONE, F(3), NONE, F(3)}, /* GL_C3F_V3F */
-      {NONE, NONE, F(3), F(3)}, /* GL_N3F_V3F */
-      {NONE, F(4), F(3), F(3)}, /* GL_C4F_N3F_V3F */
-      {F(2), NONE, NONE, F(3)}, /* GL_T2F_V3F */
-      {F(4), NONE, NONE, F(4)}, /* GL_T4F_V4F */
-      {F(2), UB4, NONE, F(3)},  /* GL_T2F_C4UB_V3F */
-      {F(2), F(3), NONE, F(3)}, /* GL_T2F_C3F_V3F */
-      {F(2), NONE, F(3), F(3)}, /* GL_T2F_N3F_V3F */
-      {F(2), F(4), F(3), F(3)}, /* GL_T2F_C4F_N3F_V3F */
-      {F(4), F(4), F(3), F(4)}, /* GL_T4F_C4F_N3F_V4F */
-   };
-#undef NONE
-#undef F
-#undef UB4
-
-   GLint trueStride, size;
-   int offsets[4];
-   unsigned i;
-   const int idx = format - GL_V2F;
-
-
-   /* All valid formats are on the range [GL_V2F, GL_V2F+0x0D].  Since idx
-    * is just the format biased by -GL_V2F, all valid idx values are on the
-    * range [0, 0x0D].
-    */
-   if ((idx < 0) || (idx > 0x0D)) {
-      __glXSetError(gc, GL_INVALID_ENUM);
-      return;
-   }
-
-   if (stride < 0) {
-      __glXSetError(gc, GL_INVALID_VALUE);
-      return;
-   }
-
-
-   /* If the 'count' for a subarray is non-zero, then the offset of its
-    * first element is at the currently accumulated 'size'.
-    */
-   size = 0;
-   for (i = 0; i < 4; i++) {
-      offsets[i] = (modes[idx][i].count != 0) ? size : -1;
-      size += modes[idx][i].size;
-   }
-
-   trueStride = (stride == 0) ? size : stride;
-
-   __glXArrayDisableAll(state);
-
-   if (offsets[0] >= 0) {
-      __indirect_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-      __indirect_glTexCoordPointer(modes[idx][0].count, GL_FLOAT,
-                                   trueStride, (const char *) pointer);
-   }
-   if (offsets[1] >= 0) {
-      __indirect_glEnableClientState(GL_COLOR_ARRAY);
-      __indirect_glColorPointer(modes[idx][1].count, modes[idx][1].type,
-                                trueStride,
-                                (const char *) pointer + offsets[1]);
-   }
-   if (offsets[2] >= 0) {
-      __indirect_glEnableClientState(GL_NORMAL_ARRAY);
-      __indirect_glNormalPointer(GL_FLOAT, trueStride,
-                                 (const char *) pointer + offsets[2]);
-   }
-   __indirect_glEnableClientState(GL_VERTEX_ARRAY);
-   __indirect_glVertexPointer(modes[idx][3].count, GL_FLOAT,
-                              trueStride,
-                              (const char *) pointer + offsets[3]);
-}
diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h
deleted file mode 100644 (file)
index ba26600..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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.
-
-**************************************************************************/
-
-/**
- * \file xf86dri.h
- * Protocol numbers and function prototypes for DRI X protocol.
- *
- * \author Kevin E. Martin <martin@valinux.com>
- * \author Jens Owen <jens@tungstengraphics.com>
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- */
-
-#ifndef _XF86DRI_H_
-#define _XF86DRI_H_
-
-#include <X11/Xfuncproto.h>
-#include <xf86drm.h>
-
-#define X_XF86DRIQueryVersion                   0
-#define X_XF86DRIQueryDirectRenderingCapable    1
-#define X_XF86DRIOpenConnection                 2
-#define X_XF86DRICloseConnection                3
-#define X_XF86DRIGetClientDriverName            4
-#define X_XF86DRICreateContext                  5
-#define X_XF86DRIDestroyContext                 6
-#define X_XF86DRICreateDrawable                 7
-#define X_XF86DRIDestroyDrawable                8
-#define X_XF86DRIGetDrawableInfo                9
-#define X_XF86DRIGetDeviceInfo                  10
-#define X_XF86DRIAuthConnection                 11
-#define X_XF86DRIOpenFullScreen                 12      /* Deprecated */
-#define X_XF86DRICloseFullScreen                13      /* Deprecated */
-
-#define XF86DRINumberEvents            0
-
-#define XF86DRIClientNotLocal          0
-#define XF86DRIOperationNotSupported   1
-#define XF86DRINumberErrors            (XF86DRIOperationNotSupported + 1)
-
-#ifndef _XF86DRI_SERVER_
-
-_XFUNCPROTOBEGIN
-   Bool XF86DRIQueryExtension(Display * dpy, int *event_base,
-                              int *error_base);
-
-Bool XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
-                         int *patchVersion);
-
-Bool XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
-                                        Bool * isCapable);
-
-Bool XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
-                           char **busIDString);
-
-Bool XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
-
-Bool XF86DRICloseConnection(Display * dpy, int screen);
-
-Bool XF86DRIGetClientDriverName(Display * dpy, int screen,
-                                int *ddxDriverMajorVersion,
-                                int *ddxDriverMinorVersion,
-                                int *ddxDriverPatchVersion,
-                                char **clientDriverName);
-
-Bool XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
-                          XID * ptr_to_returned_context_id,
-                          drm_context_t * hHWContext);
-
-Bool XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
-                                    XID * ptr_to_returned_context_id,
-                                    drm_context_t * hHWContext);
-
-extern Bool XF86DRIDestroyContext(Display * dpy, int screen, XID context_id);
-
-extern Bool XF86DRICreateDrawable(Display * dpy, int screen,
-                                  XID drawable, drm_drawable_t * hHWDrawable);
-
-extern Bool XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable);
-
-Bool XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
-                            unsigned int *index, unsigned int *stamp,
-                            int *X, int *Y, int *W, int *H,
-                            int *numClipRects, drm_clip_rect_t ** pClipRects,
-                            int *backX, int *backY,
-                            int *numBackClipRects,
-                            drm_clip_rect_t ** pBackClipRects);
-
-Bool XF86DRIGetDeviceInfo(Display * dpy, int screen,
-                          drm_handle_t * hFrameBuffer, int *fbOrigin,
-                          int *fbSize, int *fbStride, int *devPrivateSize,
-                          void **pDevPrivate);
-
-Bool XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable);
-
-Bool XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable);
-
-_XFUNCPROTOEND
-#endif /* _XF86DRI_SERVER_ */
-#endif /* _XF86DRI_H_ */
diff --git a/src/glx/x11/xf86dristr.h b/src/glx/x11/xf86dristr.h
deleted file mode 100644 (file)
index c8fbe9d..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- *   Kevin E. Martin <martin@valinux.com>
- *   Jens Owen <jens@tungstengraphics.com>
- *   Rickard E. (Rik) Fiath <faith@valinux.com>
- *
- */
-
-#ifndef _XF86DRISTR_H_
-#define _XF86DRISTR_H_
-
-#include "xf86dri.h"
-
-#define XF86DRINAME "XFree86-DRI"
-
-/* The DRI version number.  This was originally set to be the same of the
- * XFree86 version number.  However, this version is really indepedent of
- * the XFree86 version.
- *
- * Version History:
- *    4.0.0: Original
- *    4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
- *    4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
- */
-#define XF86DRI_MAJOR_VERSION  4
-#define XF86DRI_MINOR_VERSION  1
-#define XF86DRI_PATCH_VERSION  0
-
-typedef struct _XF86DRIQueryVersion
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIQueryVersion */
-   CARD16 length B16;
-} xXF86DRIQueryVersionReq;
-#define sz_xXF86DRIQueryVersionReq     4
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD16 majorVersion B16;     /* major version of DRI protocol */
-   CARD16 minorVersion B16;     /* minor version of DRI protocol */
-   CARD32 patchVersion B32;     /* patch version of DRI protocol */
-   CARD32 pad3 B32;
-   CARD32 pad4 B32;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-} xXF86DRIQueryVersionReply;
-#define sz_xXF86DRIQueryVersionReply   32
-
-typedef struct _XF86DRIQueryDirectRenderingCapable
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* X_DRIQueryDirectRenderingCapable */
-   CARD16 length B16;
-   CARD32 screen B32;
-} xXF86DRIQueryDirectRenderingCapableReq;
-#define sz_xXF86DRIQueryDirectRenderingCapableReq      8
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   BOOL isCapable;
-   BOOL pad2;
-   BOOL pad3;
-   BOOL pad4;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-   CARD32 pad7 B32;
-   CARD32 pad8 B32;
-   CARD32 pad9 B32;
-} xXF86DRIQueryDirectRenderingCapableReply;
-#define sz_xXF86DRIQueryDirectRenderingCapableReply    32
-
-typedef struct _XF86DRIOpenConnection
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIOpenConnection */
-   CARD16 length B16;
-   CARD32 screen B32;
-} xXF86DRIOpenConnectionReq;
-#define sz_xXF86DRIOpenConnectionReq   8
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 hSAREALow B32;
-   CARD32 hSAREAHigh B32;
-   CARD32 busIdStringLength B32;
-   CARD32 pad6 B32;
-   CARD32 pad7 B32;
-   CARD32 pad8 B32;
-} xXF86DRIOpenConnectionReply;
-#define sz_xXF86DRIOpenConnectionReply 32
-
-typedef struct _XF86DRIAuthConnection
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRICloseConnection */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 magic B32;
-} xXF86DRIAuthConnectionReq;
-#define sz_xXF86DRIAuthConnectionReq   12
-
-typedef struct
-{
-   BYTE type;
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 authenticated B32;
-   CARD32 pad2 B32;
-   CARD32 pad3 B32;
-   CARD32 pad4 B32;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-} xXF86DRIAuthConnectionReply;
-#define zx_xXF86DRIAuthConnectionReply  32
-
-typedef struct _XF86DRICloseConnection
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRICloseConnection */
-   CARD16 length B16;
-   CARD32 screen B32;
-} xXF86DRICloseConnectionReq;
-#define sz_xXF86DRICloseConnectionReq  8
-
-typedef struct _XF86DRIGetClientDriverName
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIGetClientDriverName */
-   CARD16 length B16;
-   CARD32 screen B32;
-} xXF86DRIGetClientDriverNameReq;
-#define sz_xXF86DRIGetClientDriverNameReq      8
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 ddxDriverMajorVersion B32;
-   CARD32 ddxDriverMinorVersion B32;
-   CARD32 ddxDriverPatchVersion B32;
-   CARD32 clientDriverNameLength B32;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-} xXF86DRIGetClientDriverNameReply;
-#define sz_xXF86DRIGetClientDriverNameReply    32
-
-typedef struct _XF86DRICreateContext
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRICreateContext */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 visual B32;
-   CARD32 context B32;
-} xXF86DRICreateContextReq;
-#define sz_xXF86DRICreateContextReq    16
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 hHWContext B32;
-   CARD32 pad2 B32;
-   CARD32 pad3 B32;
-   CARD32 pad4 B32;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-} xXF86DRICreateContextReply;
-#define sz_xXF86DRICreateContextReply  32
-
-typedef struct _XF86DRIDestroyContext
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIDestroyContext */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 context B32;
-} xXF86DRIDestroyContextReq;
-#define sz_xXF86DRIDestroyContextReq   12
-
-typedef struct _XF86DRICreateDrawable
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRICreateDrawable */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 drawable B32;
-} xXF86DRICreateDrawableReq;
-#define sz_xXF86DRICreateDrawableReq   12
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 hHWDrawable B32;
-   CARD32 pad2 B32;
-   CARD32 pad3 B32;
-   CARD32 pad4 B32;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-} xXF86DRICreateDrawableReply;
-#define sz_xXF86DRICreateDrawableReply 32
-
-typedef struct _XF86DRIDestroyDrawable
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIDestroyDrawable */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 drawable B32;
-} xXF86DRIDestroyDrawableReq;
-#define sz_xXF86DRIDestroyDrawableReq  12
-
-typedef struct _XF86DRIGetDrawableInfo
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIGetDrawableInfo */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 drawable B32;
-} xXF86DRIGetDrawableInfoReq;
-#define sz_xXF86DRIGetDrawableInfoReq  12
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 drawableTableIndex B32;
-   CARD32 drawableTableStamp B32;
-   INT16 drawableX B16;
-   INT16 drawableY B16;
-   INT16 drawableWidth B16;
-   INT16 drawableHeight B16;
-   CARD32 numClipRects B32;
-   INT16 backX B16;
-   INT16 backY B16;
-   CARD32 numBackClipRects B32;
-} xXF86DRIGetDrawableInfoReply;
-
-#define sz_xXF86DRIGetDrawableInfoReply        36
-
-
-typedef struct _XF86DRIGetDeviceInfo
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIGetDeviceInfo */
-   CARD16 length B16;
-   CARD32 screen B32;
-} xXF86DRIGetDeviceInfoReq;
-#define sz_xXF86DRIGetDeviceInfoReq    8
-
-typedef struct
-{
-   BYTE type;                   /* X_Reply */
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 hFrameBufferLow B32;
-   CARD32 hFrameBufferHigh B32;
-   CARD32 framebufferOrigin B32;
-   CARD32 framebufferSize B32;
-   CARD32 framebufferStride B32;
-   CARD32 devPrivateSize B32;
-} xXF86DRIGetDeviceInfoReply;
-#define sz_xXF86DRIGetDeviceInfoReply  32
-
-typedef struct _XF86DRIOpenFullScreen
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRIOpenFullScreen */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 drawable B32;
-} xXF86DRIOpenFullScreenReq;
-#define sz_xXF86DRIOpenFullScreenReq    12
-
-typedef struct
-{
-   BYTE type;
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 isFullScreen B32;
-   CARD32 pad2 B32;
-   CARD32 pad3 B32;
-   CARD32 pad4 B32;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-} xXF86DRIOpenFullScreenReply;
-#define sz_xXF86DRIOpenFullScreenReply  32
-
-typedef struct _XF86DRICloseFullScreen
-{
-   CARD8 reqType;               /* always DRIReqCode */
-   CARD8 driReqType;            /* always X_DRICloseFullScreen */
-   CARD16 length B16;
-   CARD32 screen B32;
-   CARD32 drawable B32;
-} xXF86DRICloseFullScreenReq;
-#define sz_xXF86DRICloseFullScreenReq   12
-
-typedef struct
-{
-   BYTE type;
-   BOOL pad1;
-   CARD16 sequenceNumber B16;
-   CARD32 length B32;
-   CARD32 pad2 B32;
-   CARD32 pad3 B32;
-   CARD32 pad4 B32;
-   CARD32 pad5 B32;
-   CARD32 pad6 B32;
-   CARD32 pad7 B32;
-} xXF86DRICloseFullScreenReply;
-#define sz_xXF86DRICloseFullScreenReply  32
-
-
-#endif /* _XF86DRISTR_H_ */
diff --git a/src/glx/x11/xfont.c b/src/glx/x11/xfont.c
deleted file mode 100644 (file)
index 797fd7a..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  3.1
- *
- * Copyright (C) 1999  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.
- */
-
-
-/* xfonts.c -- glXUseXFont() for Mesa written by
- * Copyright (C) 1995 Thorsten.Ohl @ Physik.TH-Darmstadt.de
- */
-
-/*
-  This was take from Mesa and modified to work in the real GLX structure.
-  It provides a fully client side implementation of glXUseXFont and is
-  called by that routine when direct rendering is enabled.
-*/
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "glxclient.h"
-
-/* Some debugging info.  */
-
-#ifdef DEBUG
-#undef _R
-#undef _G
-#undef _B
-#include <ctype.h>
-
-int debug_xfonts = 0;
-
-static void
-dump_char_struct(XCharStruct * ch, char *prefix)
-{
-   printf("%slbearing = %d, rbearing = %d, width = %d\n",
-          prefix, ch->lbearing, ch->rbearing, ch->width);
-   printf("%sascent = %d, descent = %d, attributes = %u\n",
-          prefix, ch->ascent, ch->descent, (unsigned int) ch->attributes);
-}
-
-static void
-dump_font_struct(XFontStruct * font)
-{
-   printf("ascent = %d, descent = %d\n", font->ascent, font->descent);
-   printf("char_or_byte2 = (%u,%u)\n",
-          font->min_char_or_byte2, font->max_char_or_byte2);
-   printf("byte1 = (%u,%u)\n", font->min_byte1, font->max_byte1);
-   printf("all_chars_exist = %s\n", font->all_chars_exist ? "True" : "False");
-   printf("default_char = %c (\\%03o)\n",
-          (char) (isprint(font->default_char) ? font->default_char : ' '),
-          font->default_char);
-   dump_char_struct(&font->min_bounds, "min> ");
-   dump_char_struct(&font->max_bounds, "max> ");
-#if 0
-   for (c = font->min_char_or_byte2; c <= font->max_char_or_byte2; c++) {
-      char prefix[8];
-      sprintf(prefix, "%d> ", c);
-      dump_char_struct(&font->per_char[c], prefix);
-   }
-#endif
-}
-
-static void
-dump_bitmap(unsigned int width, unsigned int height, GLubyte * bitmap)
-{
-   unsigned int x, y;
-
-   printf("    ");
-   for (x = 0; x < 8 * width; x++)
-      printf("%o", 7 - (x % 8));
-   putchar('\n');
-   for (y = 0; y < height; y++) {
-      printf("%3o:", y);
-      for (x = 0; x < 8 * width; x++)
-         putchar((bitmap[width * (height - y - 1) + x / 8] & (1 << (7 - (x %
-                                                                         8))))
-                 ? '*' : '.');
-      printf("   ");
-      for (x = 0; x < width; x++)
-         printf("0x%02x, ", bitmap[width * (height - y - 1) + x]);
-      putchar('\n');
-   }
-}
-#endif /* DEBUG */
-
-
-/* Implementation.  */
-
-/* Fill a BITMAP with a character C from thew current font
-   in the graphics context GC.  WIDTH is the width in bytes
-   and HEIGHT is the height in bits.
-
-   Note that the generated bitmaps must be used with
-
-        glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
-        glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
-        glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
-        glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
-        glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
-        glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
-
-   Possible optimizations:
-
-     * use only one reusable pixmap with the maximum dimensions.
-     * draw the entire font into a single pixmap (careful with
-       proportional fonts!).
-*/
-
-
-/*
- * Generate OpenGL-compatible bitmap.
- */
-static void
-fill_bitmap(Display * dpy, Window win, GC gc,
-            unsigned int width, unsigned int height,
-            int x0, int y0, unsigned int c, GLubyte * bitmap)
-{
-   XImage *image;
-   unsigned int x, y;
-   Pixmap pixmap;
-   XChar2b char2b;
-
-   pixmap = XCreatePixmap(dpy, win, 8 * width, height, 1);
-   XSetForeground(dpy, gc, 0);
-   XFillRectangle(dpy, pixmap, gc, 0, 0, 8 * width, height);
-   XSetForeground(dpy, gc, 1);
-
-   char2b.byte1 = (c >> 8) & 0xff;
-   char2b.byte2 = (c & 0xff);
-
-   XDrawString16(dpy, pixmap, gc, x0, y0, &char2b, 1);
-
-   image = XGetImage(dpy, pixmap, 0, 0, 8 * width, height, 1, XYPixmap);
-   if (image) {
-      /* Fill the bitmap (X11 and OpenGL are upside down wrt each other).  */
-      for (y = 0; y < height; y++)
-         for (x = 0; x < 8 * width; x++)
-            if (XGetPixel(image, x, y))
-               bitmap[width * (height - y - 1) + x / 8] |=
-                  (1 << (7 - (x % 8)));
-      XDestroyImage(image);
-   }
-
-   XFreePixmap(dpy, pixmap);
-}
-
-/*
- * determine if a given glyph is valid and return the
- * corresponding XCharStruct.
- */
-static XCharStruct *
-isvalid(XFontStruct * fs, int which)
-{
-   unsigned int rows, pages;
-   int byte1 = 0, byte2 = 0;
-   int i, valid = 1;
-
-   rows = fs->max_byte1 - fs->min_byte1 + 1;
-   pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
-
-   if (rows == 1) {
-      /* "linear" fonts */
-      if ((fs->min_char_or_byte2 > which) || (fs->max_char_or_byte2 < which))
-         valid = 0;
-   }
-   else {
-      /* "matrix" fonts */
-      byte2 = which & 0xff;
-      byte1 = which >> 8;
-      if ((fs->min_char_or_byte2 > byte2) ||
-          (fs->max_char_or_byte2 < byte2) ||
-          (fs->min_byte1 > byte1) || (fs->max_byte1 < byte1))
-         valid = 0;
-   }
-
-   if (valid) {
-      if (fs->per_char) {
-         if (rows == 1) {
-            /* "linear" fonts */
-            return (fs->per_char + (which - fs->min_char_or_byte2));
-         }
-         else {
-            /* "matrix" fonts */
-            i = ((byte1 - fs->min_byte1) * pages) +
-               (byte2 - fs->min_char_or_byte2);
-            return (fs->per_char + i);
-         }
-      }
-      else {
-         return (&fs->min_bounds);
-      }
-   }
-   return (NULL);
-}
-
-_X_HIDDEN void
-DRI_glXUseXFont(Font font, int first, int count, int listbase)
-{
-   GLXContext CC;
-   Display *dpy;
-   Window win;
-   Pixmap pixmap;
-   GC gc;
-   XGCValues values;
-   unsigned long valuemask;
-   XFontStruct *fs;
-
-   GLint swapbytes, lsbfirst, rowlength;
-   GLint skiprows, skippixels, alignment;
-
-   unsigned int max_width, max_height, max_bm_width, max_bm_height;
-   GLubyte *bm;
-
-   int i;
-
-   CC = __glXGetCurrentContext();
-   dpy = CC->currentDpy;
-   win = CC->currentDrawable;
-
-   fs = XQueryFont(dpy, font);
-   if (!fs) {
-      __glXSetError(CC, GL_INVALID_VALUE);
-      return;
-   }
-
-   /* Allocate a bitmap that can fit all characters.  */
-   max_width = fs->max_bounds.rbearing - fs->min_bounds.lbearing;
-   max_height = fs->max_bounds.ascent + fs->max_bounds.descent;
-   max_bm_width = (max_width + 7) / 8;
-   max_bm_height = max_height;
-
-   bm = (GLubyte *) Xmalloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
-   if (!bm) {
-      XFreeFontInfo(NULL, fs, 1);
-      __glXSetError(CC, GL_OUT_OF_MEMORY);
-      return;
-   }
-
-#if 0
-   /* get the page info */
-   pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
-   firstchar = (fs->min_byte1 << 8) + fs->min_char_or_byte2;
-   lastchar = (fs->max_byte1 << 8) + fs->max_char_or_byte2;
-   rows = fs->max_byte1 - fs->min_byte1 + 1;
-   unsigned int first_char, last_char, pages, rows;
-#endif
-
-   /* Save the current packing mode for bitmaps.  */
-   glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
-   glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
-   glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
-   glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
-   glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
-   glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
-
-   /* Enforce a standard packing mode which is compatible with
-      fill_bitmap() from above.  This is actually the default mode,
-      except for the (non)alignment.  */
-   glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
-   glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
-   glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-   glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
-   glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
-   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
-   pixmap = XCreatePixmap(dpy, win, 10, 10, 1);
-   values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
-   values.background = WhitePixel(dpy, DefaultScreen(dpy));
-   values.font = fs->fid;
-   valuemask = GCForeground | GCBackground | GCFont;
-   gc = XCreateGC(dpy, pixmap, valuemask, &values);
-   XFreePixmap(dpy, pixmap);
-
-#ifdef DEBUG
-   if (debug_xfonts)
-      dump_font_struct(fs);
-#endif
-
-   for (i = 0; i < count; i++) {
-      unsigned int width, height, bm_width, bm_height;
-      GLfloat x0, y0, dx, dy;
-      XCharStruct *ch;
-      int x, y;
-      unsigned int c = first + i;
-      int list = listbase + i;
-      int valid;
-
-      /* check on index validity and get the bounds */
-      ch = isvalid(fs, c);
-      if (!ch) {
-         ch = &fs->max_bounds;
-         valid = 0;
-      }
-      else {
-         valid = 1;
-      }
-
-#ifdef DEBUG
-      if (debug_xfonts) {
-         char s[7];
-         sprintf(s, isprint(c) ? "%c> " : "\\%03o> ", c);
-         dump_char_struct(ch, s);
-      }
-#endif
-
-      /* glBitmap()' parameters:
-         straight from the glXUseXFont(3) manpage.  */
-      width = ch->rbearing - ch->lbearing;
-      height = ch->ascent + ch->descent;
-      x0 = -ch->lbearing;
-      y0 = ch->descent - 1;
-      dx = ch->width;
-      dy = 0;
-
-      /* X11's starting point.  */
-      x = -ch->lbearing;
-      y = ch->ascent;
-
-      /* Round the width to a multiple of eight.  We will use this also
-         for the pixmap for capturing the X11 font.  This is slightly
-         inefficient, but it makes the OpenGL part real easy.  */
-      bm_width = (width + 7) / 8;
-      bm_height = height;
-
-      glNewList(list, GL_COMPILE);
-      if (valid && (bm_width > 0) && (bm_height > 0)) {
-
-         memset(bm, '\0', bm_width * bm_height);
-         fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm);
-
-         glBitmap(width, height, x0, y0, dx, dy, bm);
-#ifdef DEBUG
-         if (debug_xfonts) {
-            printf("width/height = %u/%u\n", width, height);
-            printf("bm_width/bm_height = %u/%u\n", bm_width, bm_height);
-            dump_bitmap(bm_width, bm_height, bm);
-         }
-#endif
-      }
-      else {
-         glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL);
-      }
-      glEndList();
-   }
-
-   Xfree(bm);
-   XFreeFontInfo(NULL, fs, 1);
-   XFreeGC(dpy, gc);
-
-   /* Restore saved packing modes.  */
-   glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
-   glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
-   glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
-   glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
-   glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
-   glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
-}
-
-#endif
diff --git a/src/glx/xf86dri.h b/src/glx/xf86dri.h
new file mode 100644 (file)
index 0000000..ba26600
--- /dev/null
@@ -0,0 +1,124 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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.
+
+**************************************************************************/
+
+/**
+ * \file xf86dri.h
+ * Protocol numbers and function prototypes for DRI X protocol.
+ *
+ * \author Kevin E. Martin <martin@valinux.com>
+ * \author Jens Owen <jens@tungstengraphics.com>
+ * \author Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+
+#ifndef _XF86DRI_H_
+#define _XF86DRI_H_
+
+#include <X11/Xfuncproto.h>
+#include <xf86drm.h>
+
+#define X_XF86DRIQueryVersion                   0
+#define X_XF86DRIQueryDirectRenderingCapable    1
+#define X_XF86DRIOpenConnection                 2
+#define X_XF86DRICloseConnection                3
+#define X_XF86DRIGetClientDriverName            4
+#define X_XF86DRICreateContext                  5
+#define X_XF86DRIDestroyContext                 6
+#define X_XF86DRICreateDrawable                 7
+#define X_XF86DRIDestroyDrawable                8
+#define X_XF86DRIGetDrawableInfo                9
+#define X_XF86DRIGetDeviceInfo                  10
+#define X_XF86DRIAuthConnection                 11
+#define X_XF86DRIOpenFullScreen                 12      /* Deprecated */
+#define X_XF86DRICloseFullScreen                13      /* Deprecated */
+
+#define XF86DRINumberEvents            0
+
+#define XF86DRIClientNotLocal          0
+#define XF86DRIOperationNotSupported   1
+#define XF86DRINumberErrors            (XF86DRIOperationNotSupported + 1)
+
+#ifndef _XF86DRI_SERVER_
+
+_XFUNCPROTOBEGIN
+   Bool XF86DRIQueryExtension(Display * dpy, int *event_base,
+                              int *error_base);
+
+Bool XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
+                         int *patchVersion);
+
+Bool XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
+                                        Bool * isCapable);
+
+Bool XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
+                           char **busIDString);
+
+Bool XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
+
+Bool XF86DRICloseConnection(Display * dpy, int screen);
+
+Bool XF86DRIGetClientDriverName(Display * dpy, int screen,
+                                int *ddxDriverMajorVersion,
+                                int *ddxDriverMinorVersion,
+                                int *ddxDriverPatchVersion,
+                                char **clientDriverName);
+
+Bool XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
+                          XID * ptr_to_returned_context_id,
+                          drm_context_t * hHWContext);
+
+Bool XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
+                                    XID * ptr_to_returned_context_id,
+                                    drm_context_t * hHWContext);
+
+extern Bool XF86DRIDestroyContext(Display * dpy, int screen, XID context_id);
+
+extern Bool XF86DRICreateDrawable(Display * dpy, int screen,
+                                  XID drawable, drm_drawable_t * hHWDrawable);
+
+extern Bool XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable);
+
+Bool XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+                            unsigned int *index, unsigned int *stamp,
+                            int *X, int *Y, int *W, int *H,
+                            int *numClipRects, drm_clip_rect_t ** pClipRects,
+                            int *backX, int *backY,
+                            int *numBackClipRects,
+                            drm_clip_rect_t ** pBackClipRects);
+
+Bool XF86DRIGetDeviceInfo(Display * dpy, int screen,
+                          drm_handle_t * hFrameBuffer, int *fbOrigin,
+                          int *fbSize, int *fbStride, int *devPrivateSize,
+                          void **pDevPrivate);
+
+Bool XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable);
+
+Bool XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable);
+
+_XFUNCPROTOEND
+#endif /* _XF86DRI_SERVER_ */
+#endif /* _XF86DRI_H_ */
diff --git a/src/glx/xf86dristr.h b/src/glx/xf86dristr.h
new file mode 100644 (file)
index 0000000..c8fbe9d
--- /dev/null
@@ -0,0 +1,367 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <martin@valinux.com>
+ *   Jens Owen <jens@tungstengraphics.com>
+ *   Rickard E. (Rik) Fiath <faith@valinux.com>
+ *
+ */
+
+#ifndef _XF86DRISTR_H_
+#define _XF86DRISTR_H_
+
+#include "xf86dri.h"
+
+#define XF86DRINAME "XFree86-DRI"
+
+/* The DRI version number.  This was originally set to be the same of the
+ * XFree86 version number.  However, this version is really indepedent of
+ * the XFree86 version.
+ *
+ * Version History:
+ *    4.0.0: Original
+ *    4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
+ *    4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
+ */
+#define XF86DRI_MAJOR_VERSION  4
+#define XF86DRI_MINOR_VERSION  1
+#define XF86DRI_PATCH_VERSION  0
+
+typedef struct _XF86DRIQueryVersion
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIQueryVersion */
+   CARD16 length B16;
+} xXF86DRIQueryVersionReq;
+#define sz_xXF86DRIQueryVersionReq     4
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD16 majorVersion B16;     /* major version of DRI protocol */
+   CARD16 minorVersion B16;     /* minor version of DRI protocol */
+   CARD32 patchVersion B32;     /* patch version of DRI protocol */
+   CARD32 pad3 B32;
+   CARD32 pad4 B32;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+} xXF86DRIQueryVersionReply;
+#define sz_xXF86DRIQueryVersionReply   32
+
+typedef struct _XF86DRIQueryDirectRenderingCapable
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* X_DRIQueryDirectRenderingCapable */
+   CARD16 length B16;
+   CARD32 screen B32;
+} xXF86DRIQueryDirectRenderingCapableReq;
+#define sz_xXF86DRIQueryDirectRenderingCapableReq      8
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   BOOL isCapable;
+   BOOL pad2;
+   BOOL pad3;
+   BOOL pad4;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+   CARD32 pad7 B32;
+   CARD32 pad8 B32;
+   CARD32 pad9 B32;
+} xXF86DRIQueryDirectRenderingCapableReply;
+#define sz_xXF86DRIQueryDirectRenderingCapableReply    32
+
+typedef struct _XF86DRIOpenConnection
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIOpenConnection */
+   CARD16 length B16;
+   CARD32 screen B32;
+} xXF86DRIOpenConnectionReq;
+#define sz_xXF86DRIOpenConnectionReq   8
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 hSAREALow B32;
+   CARD32 hSAREAHigh B32;
+   CARD32 busIdStringLength B32;
+   CARD32 pad6 B32;
+   CARD32 pad7 B32;
+   CARD32 pad8 B32;
+} xXF86DRIOpenConnectionReply;
+#define sz_xXF86DRIOpenConnectionReply 32
+
+typedef struct _XF86DRIAuthConnection
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRICloseConnection */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 magic B32;
+} xXF86DRIAuthConnectionReq;
+#define sz_xXF86DRIAuthConnectionReq   12
+
+typedef struct
+{
+   BYTE type;
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 authenticated B32;
+   CARD32 pad2 B32;
+   CARD32 pad3 B32;
+   CARD32 pad4 B32;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+} xXF86DRIAuthConnectionReply;
+#define zx_xXF86DRIAuthConnectionReply  32
+
+typedef struct _XF86DRICloseConnection
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRICloseConnection */
+   CARD16 length B16;
+   CARD32 screen B32;
+} xXF86DRICloseConnectionReq;
+#define sz_xXF86DRICloseConnectionReq  8
+
+typedef struct _XF86DRIGetClientDriverName
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIGetClientDriverName */
+   CARD16 length B16;
+   CARD32 screen B32;
+} xXF86DRIGetClientDriverNameReq;
+#define sz_xXF86DRIGetClientDriverNameReq      8
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 ddxDriverMajorVersion B32;
+   CARD32 ddxDriverMinorVersion B32;
+   CARD32 ddxDriverPatchVersion B32;
+   CARD32 clientDriverNameLength B32;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+} xXF86DRIGetClientDriverNameReply;
+#define sz_xXF86DRIGetClientDriverNameReply    32
+
+typedef struct _XF86DRICreateContext
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRICreateContext */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 visual B32;
+   CARD32 context B32;
+} xXF86DRICreateContextReq;
+#define sz_xXF86DRICreateContextReq    16
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 hHWContext B32;
+   CARD32 pad2 B32;
+   CARD32 pad3 B32;
+   CARD32 pad4 B32;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+} xXF86DRICreateContextReply;
+#define sz_xXF86DRICreateContextReply  32
+
+typedef struct _XF86DRIDestroyContext
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIDestroyContext */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 context B32;
+} xXF86DRIDestroyContextReq;
+#define sz_xXF86DRIDestroyContextReq   12
+
+typedef struct _XF86DRICreateDrawable
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRICreateDrawable */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 drawable B32;
+} xXF86DRICreateDrawableReq;
+#define sz_xXF86DRICreateDrawableReq   12
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 hHWDrawable B32;
+   CARD32 pad2 B32;
+   CARD32 pad3 B32;
+   CARD32 pad4 B32;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+} xXF86DRICreateDrawableReply;
+#define sz_xXF86DRICreateDrawableReply 32
+
+typedef struct _XF86DRIDestroyDrawable
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIDestroyDrawable */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 drawable B32;
+} xXF86DRIDestroyDrawableReq;
+#define sz_xXF86DRIDestroyDrawableReq  12
+
+typedef struct _XF86DRIGetDrawableInfo
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIGetDrawableInfo */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 drawable B32;
+} xXF86DRIGetDrawableInfoReq;
+#define sz_xXF86DRIGetDrawableInfoReq  12
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 drawableTableIndex B32;
+   CARD32 drawableTableStamp B32;
+   INT16 drawableX B16;
+   INT16 drawableY B16;
+   INT16 drawableWidth B16;
+   INT16 drawableHeight B16;
+   CARD32 numClipRects B32;
+   INT16 backX B16;
+   INT16 backY B16;
+   CARD32 numBackClipRects B32;
+} xXF86DRIGetDrawableInfoReply;
+
+#define sz_xXF86DRIGetDrawableInfoReply        36
+
+
+typedef struct _XF86DRIGetDeviceInfo
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIGetDeviceInfo */
+   CARD16 length B16;
+   CARD32 screen B32;
+} xXF86DRIGetDeviceInfoReq;
+#define sz_xXF86DRIGetDeviceInfoReq    8
+
+typedef struct
+{
+   BYTE type;                   /* X_Reply */
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 hFrameBufferLow B32;
+   CARD32 hFrameBufferHigh B32;
+   CARD32 framebufferOrigin B32;
+   CARD32 framebufferSize B32;
+   CARD32 framebufferStride B32;
+   CARD32 devPrivateSize B32;
+} xXF86DRIGetDeviceInfoReply;
+#define sz_xXF86DRIGetDeviceInfoReply  32
+
+typedef struct _XF86DRIOpenFullScreen
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRIOpenFullScreen */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 drawable B32;
+} xXF86DRIOpenFullScreenReq;
+#define sz_xXF86DRIOpenFullScreenReq    12
+
+typedef struct
+{
+   BYTE type;
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 isFullScreen B32;
+   CARD32 pad2 B32;
+   CARD32 pad3 B32;
+   CARD32 pad4 B32;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+} xXF86DRIOpenFullScreenReply;
+#define sz_xXF86DRIOpenFullScreenReply  32
+
+typedef struct _XF86DRICloseFullScreen
+{
+   CARD8 reqType;               /* always DRIReqCode */
+   CARD8 driReqType;            /* always X_DRICloseFullScreen */
+   CARD16 length B16;
+   CARD32 screen B32;
+   CARD32 drawable B32;
+} xXF86DRICloseFullScreenReq;
+#define sz_xXF86DRICloseFullScreenReq   12
+
+typedef struct
+{
+   BYTE type;
+   BOOL pad1;
+   CARD16 sequenceNumber B16;
+   CARD32 length B32;
+   CARD32 pad2 B32;
+   CARD32 pad3 B32;
+   CARD32 pad4 B32;
+   CARD32 pad5 B32;
+   CARD32 pad6 B32;
+   CARD32 pad7 B32;
+} xXF86DRICloseFullScreenReply;
+#define sz_xXF86DRICloseFullScreenReply  32
+
+
+#endif /* _XF86DRISTR_H_ */
diff --git a/src/glx/xfont.c b/src/glx/xfont.c
new file mode 100644 (file)
index 0000000..797fd7a
--- /dev/null
@@ -0,0 +1,377 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  3.1
+ *
+ * Copyright (C) 1999  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.
+ */
+
+
+/* xfonts.c -- glXUseXFont() for Mesa written by
+ * Copyright (C) 1995 Thorsten.Ohl @ Physik.TH-Darmstadt.de
+ */
+
+/*
+  This was take from Mesa and modified to work in the real GLX structure.
+  It provides a fully client side implementation of glXUseXFont and is
+  called by that routine when direct rendering is enabled.
+*/
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include "glxclient.h"
+
+/* Some debugging info.  */
+
+#ifdef DEBUG
+#undef _R
+#undef _G
+#undef _B
+#include <ctype.h>
+
+int debug_xfonts = 0;
+
+static void
+dump_char_struct(XCharStruct * ch, char *prefix)
+{
+   printf("%slbearing = %d, rbearing = %d, width = %d\n",
+          prefix, ch->lbearing, ch->rbearing, ch->width);
+   printf("%sascent = %d, descent = %d, attributes = %u\n",
+          prefix, ch->ascent, ch->descent, (unsigned int) ch->attributes);
+}
+
+static void
+dump_font_struct(XFontStruct * font)
+{
+   printf("ascent = %d, descent = %d\n", font->ascent, font->descent);
+   printf("char_or_byte2 = (%u,%u)\n",
+          font->min_char_or_byte2, font->max_char_or_byte2);
+   printf("byte1 = (%u,%u)\n", font->min_byte1, font->max_byte1);
+   printf("all_chars_exist = %s\n", font->all_chars_exist ? "True" : "False");
+   printf("default_char = %c (\\%03o)\n",
+          (char) (isprint(font->default_char) ? font->default_char : ' '),
+          font->default_char);
+   dump_char_struct(&font->min_bounds, "min> ");
+   dump_char_struct(&font->max_bounds, "max> ");
+#if 0
+   for (c = font->min_char_or_byte2; c <= font->max_char_or_byte2; c++) {
+      char prefix[8];
+      sprintf(prefix, "%d> ", c);
+      dump_char_struct(&font->per_char[c], prefix);
+   }
+#endif
+}
+
+static void
+dump_bitmap(unsigned int width, unsigned int height, GLubyte * bitmap)
+{
+   unsigned int x, y;
+
+   printf("    ");
+   for (x = 0; x < 8 * width; x++)
+      printf("%o", 7 - (x % 8));
+   putchar('\n');
+   for (y = 0; y < height; y++) {
+      printf("%3o:", y);
+      for (x = 0; x < 8 * width; x++)
+         putchar((bitmap[width * (height - y - 1) + x / 8] & (1 << (7 - (x %
+                                                                         8))))
+                 ? '*' : '.');
+      printf("   ");
+      for (x = 0; x < width; x++)
+         printf("0x%02x, ", bitmap[width * (height - y - 1) + x]);
+      putchar('\n');
+   }
+}
+#endif /* DEBUG */
+
+
+/* Implementation.  */
+
+/* Fill a BITMAP with a character C from thew current font
+   in the graphics context GC.  WIDTH is the width in bytes
+   and HEIGHT is the height in bits.
+
+   Note that the generated bitmaps must be used with
+
+        glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
+        glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
+        glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+        glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
+        glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
+        glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+
+   Possible optimizations:
+
+     * use only one reusable pixmap with the maximum dimensions.
+     * draw the entire font into a single pixmap (careful with
+       proportional fonts!).
+*/
+
+
+/*
+ * Generate OpenGL-compatible bitmap.
+ */
+static void
+fill_bitmap(Display * dpy, Window win, GC gc,
+            unsigned int width, unsigned int height,
+            int x0, int y0, unsigned int c, GLubyte * bitmap)
+{
+   XImage *image;
+   unsigned int x, y;
+   Pixmap pixmap;
+   XChar2b char2b;
+
+   pixmap = XCreatePixmap(dpy, win, 8 * width, height, 1);
+   XSetForeground(dpy, gc, 0);
+   XFillRectangle(dpy, pixmap, gc, 0, 0, 8 * width, height);
+   XSetForeground(dpy, gc, 1);
+
+   char2b.byte1 = (c >> 8) & 0xff;
+   char2b.byte2 = (c & 0xff);
+
+   XDrawString16(dpy, pixmap, gc, x0, y0, &char2b, 1);
+
+   image = XGetImage(dpy, pixmap, 0, 0, 8 * width, height, 1, XYPixmap);
+   if (image) {
+      /* Fill the bitmap (X11 and OpenGL are upside down wrt each other).  */
+      for (y = 0; y < height; y++)
+         for (x = 0; x < 8 * width; x++)
+            if (XGetPixel(image, x, y))
+               bitmap[width * (height - y - 1) + x / 8] |=
+                  (1 << (7 - (x % 8)));
+      XDestroyImage(image);
+   }
+
+   XFreePixmap(dpy, pixmap);
+}
+
+/*
+ * determine if a given glyph is valid and return the
+ * corresponding XCharStruct.
+ */
+static XCharStruct *
+isvalid(XFontStruct * fs, int which)
+{
+   unsigned int rows, pages;
+   int byte1 = 0, byte2 = 0;
+   int i, valid = 1;
+
+   rows = fs->max_byte1 - fs->min_byte1 + 1;
+   pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
+
+   if (rows == 1) {
+      /* "linear" fonts */
+      if ((fs->min_char_or_byte2 > which) || (fs->max_char_or_byte2 < which))
+         valid = 0;
+   }
+   else {
+      /* "matrix" fonts */
+      byte2 = which & 0xff;
+      byte1 = which >> 8;
+      if ((fs->min_char_or_byte2 > byte2) ||
+          (fs->max_char_or_byte2 < byte2) ||
+          (fs->min_byte1 > byte1) || (fs->max_byte1 < byte1))
+         valid = 0;
+   }
+
+   if (valid) {
+      if (fs->per_char) {
+         if (rows == 1) {
+            /* "linear" fonts */
+            return (fs->per_char + (which - fs->min_char_or_byte2));
+         }
+         else {
+            /* "matrix" fonts */
+            i = ((byte1 - fs->min_byte1) * pages) +
+               (byte2 - fs->min_char_or_byte2);
+            return (fs->per_char + i);
+         }
+      }
+      else {
+         return (&fs->min_bounds);
+      }
+   }
+   return (NULL);
+}
+
+_X_HIDDEN void
+DRI_glXUseXFont(Font font, int first, int count, int listbase)
+{
+   GLXContext CC;
+   Display *dpy;
+   Window win;
+   Pixmap pixmap;
+   GC gc;
+   XGCValues values;
+   unsigned long valuemask;
+   XFontStruct *fs;
+
+   GLint swapbytes, lsbfirst, rowlength;
+   GLint skiprows, skippixels, alignment;
+
+   unsigned int max_width, max_height, max_bm_width, max_bm_height;
+   GLubyte *bm;
+
+   int i;
+
+   CC = __glXGetCurrentContext();
+   dpy = CC->currentDpy;
+   win = CC->currentDrawable;
+
+   fs = XQueryFont(dpy, font);
+   if (!fs) {
+      __glXSetError(CC, GL_INVALID_VALUE);
+      return;
+   }
+
+   /* Allocate a bitmap that can fit all characters.  */
+   max_width = fs->max_bounds.rbearing - fs->min_bounds.lbearing;
+   max_height = fs->max_bounds.ascent + fs->max_bounds.descent;
+   max_bm_width = (max_width + 7) / 8;
+   max_bm_height = max_height;
+
+   bm = (GLubyte *) Xmalloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
+   if (!bm) {
+      XFreeFontInfo(NULL, fs, 1);
+      __glXSetError(CC, GL_OUT_OF_MEMORY);
+      return;
+   }
+
+#if 0
+   /* get the page info */
+   pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
+   firstchar = (fs->min_byte1 << 8) + fs->min_char_or_byte2;
+   lastchar = (fs->max_byte1 << 8) + fs->max_char_or_byte2;
+   rows = fs->max_byte1 - fs->min_byte1 + 1;
+   unsigned int first_char, last_char, pages, rows;
+#endif
+
+   /* Save the current packing mode for bitmaps.  */
+   glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
+   glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
+   glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
+   glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
+   glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
+   glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
+
+   /* Enforce a standard packing mode which is compatible with
+      fill_bitmap() from above.  This is actually the default mode,
+      except for the (non)alignment.  */
+   glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
+   glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
+   glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+   glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+   glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+   pixmap = XCreatePixmap(dpy, win, 10, 10, 1);
+   values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
+   values.background = WhitePixel(dpy, DefaultScreen(dpy));
+   values.font = fs->fid;
+   valuemask = GCForeground | GCBackground | GCFont;
+   gc = XCreateGC(dpy, pixmap, valuemask, &values);
+   XFreePixmap(dpy, pixmap);
+
+#ifdef DEBUG
+   if (debug_xfonts)
+      dump_font_struct(fs);
+#endif
+
+   for (i = 0; i < count; i++) {
+      unsigned int width, height, bm_width, bm_height;
+      GLfloat x0, y0, dx, dy;
+      XCharStruct *ch;
+      int x, y;
+      unsigned int c = first + i;
+      int list = listbase + i;
+      int valid;
+
+      /* check on index validity and get the bounds */
+      ch = isvalid(fs, c);
+      if (!ch) {
+         ch = &fs->max_bounds;
+         valid = 0;
+      }
+      else {
+         valid = 1;
+      }
+
+#ifdef DEBUG
+      if (debug_xfonts) {
+         char s[7];
+         sprintf(s, isprint(c) ? "%c> " : "\\%03o> ", c);
+         dump_char_struct(ch, s);
+      }
+#endif
+
+      /* glBitmap()' parameters:
+         straight from the glXUseXFont(3) manpage.  */
+      width = ch->rbearing - ch->lbearing;
+      height = ch->ascent + ch->descent;
+      x0 = -ch->lbearing;
+      y0 = ch->descent - 1;
+      dx = ch->width;
+      dy = 0;
+
+      /* X11's starting point.  */
+      x = -ch->lbearing;
+      y = ch->ascent;
+
+      /* Round the width to a multiple of eight.  We will use this also
+         for the pixmap for capturing the X11 font.  This is slightly
+         inefficient, but it makes the OpenGL part real easy.  */
+      bm_width = (width + 7) / 8;
+      bm_height = height;
+
+      glNewList(list, GL_COMPILE);
+      if (valid && (bm_width > 0) && (bm_height > 0)) {
+
+         memset(bm, '\0', bm_width * bm_height);
+         fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm);
+
+         glBitmap(width, height, x0, y0, dx, dy, bm);
+#ifdef DEBUG
+         if (debug_xfonts) {
+            printf("width/height = %u/%u\n", width, height);
+            printf("bm_width/bm_height = %u/%u\n", bm_width, bm_height);
+            dump_bitmap(bm_width, bm_height, bm);
+         }
+#endif
+      }
+      else {
+         glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL);
+      }
+      glEndList();
+   }
+
+   Xfree(bm);
+   XFreeFontInfo(NULL, fs, 1);
+   XFreeGC(dpy, gc);
+
+   /* Restore saved packing modes.  */
+   glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
+   glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
+   glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
+   glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
+   glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
+}
+
+#endif
index bfc3db4313c2b115dff055d07b405323772c060c..da679607d7b3657253dd40ca630056ebfdc6e9f2 100644 (file)
@@ -13,11 +13,11 @@ OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h glapidispatch.h \
        ../x86/glapi_x86.S \
        ../x86-64/glapi_x86-64.S \
        ../sparc/glapi_sparc.S \
-       ../../glx/x11/indirect.c \
-       ../../glx/x11/indirect.h \
-       ../../glx/x11/indirect_init.c \
-       ../../glx/x11/indirect_size.h \
-       ../../glx/x11/indirect_size.c
+       ../../glx/indirect.c \
+       ../../glx/indirect.h \
+       ../../glx/indirect_init.c \
+       ../../glx/indirect_size.h \
+       ../../glx/indirect_size.c
 
 
 GLX_DIR = $(XORG_BASE)/glx
@@ -110,20 +110,20 @@ glapidispatch.h $(GLX_DIR)/glapidispatch.h: gl_table.py $(COMMON)
 ../sparc/glapi_sparc.S: gl_SPARC_asm.py $(COMMON)
        $(PYTHON2) $(PYTHON_FLAGS) $< > $@
 
-../../glx/x11/indirect.c: glX_proto_send.py $(COMMON_GLX)
+../../glx/indirect.c: glX_proto_send.py $(COMMON_GLX)
        $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@
 
-../../glx/x11/indirect.h: glX_proto_send.py $(COMMON_GLX)
+../../glx/indirect.h: glX_proto_send.py $(COMMON_GLX)
        $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@
 
-../../glx/x11/indirect_init.c: glX_proto_send.py $(COMMON_GLX)
+../../glx/indirect_init.c: glX_proto_send.py $(COMMON_GLX)
        $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@
 
-../../glx/x11/indirect_size.h $(GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX)
+../../glx/indirect_size.h $(GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX)
        $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \
          | $(INDENT) $(INDENT_FLAGS) > $@
 
-../../glx/x11/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
+../../glx/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
        $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \
          | $(INDENT) $(INDENT_FLAGS) > $@
 
index a6a57020cc7d707e5c5c9a131688c2b2360cb9db..b9b726b00172ad62d0bcb039ea6fd940b410aa62 100644 (file)
@@ -32,7 +32,7 @@
  *
  * \note
  * This file is also used to build the client-side libGL that loads DRI-based
- * device drivers.  At build-time it is symlinked to src/glx/x11.
+ * device drivers.  At build-time it is symlinked to src/glx.
  *
  * \author Brian Paul <brian@precisioninsight.com>
  */