summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile40
-rw-r--r--src/glx/Makefile12
-rw-r--r--src/glx/x11/Makefile96
-rw-r--r--src/glx/x11/XF86dri.c623
-rw-r--r--src/glx/x11/clientattrib.c141
-rw-r--r--src/glx/x11/compsize.c191
-rw-r--r--src/glx/x11/depend.bak0
-rw-r--r--src/glx/x11/dri_glx.c472
-rw-r--r--src/glx/x11/dri_glx.h61
-rw-r--r--src/glx/x11/eval.c132
-rw-r--r--src/glx/x11/glcontextmodes.c533
-rw-r--r--src/glx/x11/glx_pbuffer.c594
-rw-r--r--src/glx/x11/glx_query.c102
-rw-r--r--src/glx/x11/glx_texture_compression.c347
-rw-r--r--src/glx/x11/glxclient.h690
-rw-r--r--src/glx/x11/glxcmds.c3125
-rw-r--r--src/glx/x11/glxext.c1884
-rw-r--r--src/glx/x11/glxextensions.c724
-rw-r--r--src/glx/x11/glxextensions.h281
-rw-r--r--src/glx/x11/indirect.c8472
-rw-r--r--src/glx/x11/indirect.h707
-rw-r--r--src/glx/x11/indirect_init.c779
-rw-r--r--src/glx/x11/indirect_init.h42
-rw-r--r--src/glx/x11/indirect_size.c370
-rw-r--r--src/glx/x11/indirect_size.h88
-rw-r--r--src/glx/x11/indirect_transpose_matrix.c83
-rw-r--r--src/glx/x11/indirect_va_private.h308
-rw-r--r--src/glx/x11/indirect_vertex_array.c1847
-rw-r--r--src/glx/x11/indirect_vertex_array.h57
-rw-r--r--src/glx/x11/indirect_vertex_program.c273
-rw-r--r--src/glx/x11/indirect_window_pos.c98
-rw-r--r--src/glx/x11/packrender.h249
-rw-r--r--src/glx/x11/packsingle.h219
-rw-r--r--src/glx/x11/pixel.c443
-rw-r--r--src/glx/x11/pixelstore.c337
-rw-r--r--src/glx/x11/render2.c363
-rw-r--r--src/glx/x11/renderpix.c215
-rw-r--r--src/glx/x11/single2.c833
-rw-r--r--src/glx/x11/singlepix.c105
-rw-r--r--src/glx/x11/vertarr.c203
-rw-r--r--src/glx/x11/xf86dri.h122
-rw-r--r--src/glx/x11/xf86dristr.h343
-rw-r--r--src/glx/x11/xfont.c377
-rw-r--r--src/mesa/Makefile179
-rw-r--r--src/mesa/drivers/dri/common/depthtmp.h269
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c1093
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h557
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.c215
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.h75
-rw-r--r--src/mesa/drivers/dri/common/extension_helper.h6021
-rw-r--r--src/mesa/drivers/dri/common/glcontextmodes.c533
-rw-r--r--src/mesa/drivers/dri/common/glcontextmodes.h52
-rw-r--r--src/mesa/drivers/dri/common/memops.h17
-rw-r--r--src/mesa/drivers/dri/common/mmio.h62
-rw-r--r--src/mesa/drivers/dri/common/mmx.h560
-rw-r--r--src/mesa/drivers/dri/common/spantmp.h338
-rw-r--r--src/mesa/drivers/dri/common/spantmp2.h615
-rw-r--r--src/mesa/drivers/dri/common/spantmp_common.h81
-rw-r--r--src/mesa/drivers/dri/common/stenciltmp.h246
-rw-r--r--src/mesa/drivers/dri/common/texmem.c1347
-rw-r--r--src/mesa/drivers/dri/common/texmem.h334
-rw-r--r--src/mesa/drivers/dri/common/utils.c698
-rw-r--r--src/mesa/drivers/dri/common/utils.h119
-rw-r--r--src/mesa/drivers/dri/common/vblank.c347
-rw-r--r--src/mesa/drivers/dri/common/vblank.h69
-rw-r--r--src/mesa/drivers/dri/common/xmlconfig.c1002
-rw-r--r--src/mesa/drivers/dri/common/xmlconfig.h124
-rw-r--r--src/mesa/drivers/dri/common/xmlpool.h94
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/Makefile96
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/de.po240
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/es.po219
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/fr.po225
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py191
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/nl.po230
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/options.h482
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/t_options.h234
-rw-r--r--src/mesa/glapi/APPLE_vertex_array_object.xml27
-rw-r--r--src/mesa/glapi/EXT_framebuffer_object.xml188
-rw-r--r--src/mesa/glapi/Makefile102
-rw-r--r--src/mesa/glapi/descrip.mms37
-rw-r--r--src/mesa/glapi/dispatch.h4214
-rw-r--r--src/mesa/glapi/extension_helper.py321
-rw-r--r--src/mesa/glapi/glX_XML.py531
-rw-r--r--src/mesa/glapi/glX_doc.py280
-rw-r--r--src/mesa/glapi/glX_proto_common.py95
-rw-r--r--src/mesa/glapi/glX_proto_recv.py563
-rw-r--r--src/mesa/glapi/glX_proto_send.py1044
-rw-r--r--src/mesa/glapi/glX_proto_size.py707
-rw-r--r--src/mesa/glapi/gl_API.dtd134
-rw-r--r--src/mesa/glapi/gl_API.xml11570
-rw-r--r--src/mesa/glapi/gl_SPARC_asm.py135
-rw-r--r--src/mesa/glapi/gl_XML.py813
-rw-r--r--src/mesa/glapi/gl_apitemp.py216
-rw-r--r--src/mesa/glapi/gl_enums.py217
-rw-r--r--src/mesa/glapi/gl_offsets.py105
-rw-r--r--src/mesa/glapi/gl_procs.py155
-rw-r--r--src/mesa/glapi/gl_table.py194
-rw-r--r--src/mesa/glapi/gl_x86-64_asm.py320
-rw-r--r--src/mesa/glapi/gl_x86_asm.py244
-rw-r--r--src/mesa/glapi/glapi.c1048
-rw-r--r--src/mesa/glapi/glapi.h160
-rw-r--r--src/mesa/glapi/glapioffsets.h1284
-rw-r--r--src/mesa/glapi/glapitable.h867
-rw-r--r--src/mesa/glapi/glapitemp.h6229
-rw-r--r--src/mesa/glapi/glprocs.h2061
-rw-r--r--src/mesa/glapi/glthread.c374
-rw-r--r--src/mesa/glapi/glthread.h313
-rw-r--r--src/mesa/glapi/license.py47
-rw-r--r--src/mesa/glapi/mesadef.py223
-rwxr-xr-xsrc/mesa/glapi/next_available_offset.sh39
-rw-r--r--src/mesa/glapi/typeexpr.py292
-rw-r--r--src/mesa/main/Imakefile129
-rw-r--r--src/mesa/main/KNOWN_BUGS21
-rw-r--r--src/mesa/main/Makefile.ugl364
-rw-r--r--src/mesa/main/Makefile.win208
-rw-r--r--src/mesa/main/accum.c112
-rw-r--r--src/mesa/main/accum.h62
-rw-r--r--src/mesa/main/api_arrayelt.c1218
-rw-r--r--src/mesa/main/api_arrayelt.h37
-rw-r--r--src/mesa/main/api_eval.h42
-rw-r--r--src/mesa/main/api_loopback.c1658
-rw-r--r--src/mesa/main/api_loopback.h37
-rw-r--r--src/mesa/main/api_noop.c976
-rw-r--r--src/mesa/main/api_noop.h46
-rw-r--r--src/mesa/main/api_validate.c238
-rw-r--r--src/mesa/main/api_validate.h49
-rw-r--r--src/mesa/main/arrayobj.c419
-rw-r--r--src/mesa/main/arrayobj.h70
-rw-r--r--src/mesa/main/attrib.c1388
-rw-r--r--src/mesa/main/attrib.h68
-rw-r--r--src/mesa/main/bitset.h122
-rw-r--r--src/mesa/main/blend.c569
-rw-r--r--src/mesa/main/blend.h78
-rw-r--r--src/mesa/main/bufferobj.c943
-rw-r--r--src/mesa/main/bufferobj.h126
-rw-r--r--src/mesa/main/buffers.c752
-rw-r--r--src/mesa/main/buffers.h81
-rw-r--r--src/mesa/main/clip.c160
-rw-r--r--src/mesa/main/clip.h49
-rw-r--r--src/mesa/main/colormac.h227
-rw-r--r--src/mesa/main/colortab.c1481
-rw-r--r--src/mesa/main/colortab.h110
-rw-r--r--src/mesa/main/config.h326
-rw-r--r--src/mesa/main/context.c1868
-rw-r--r--src/mesa/main/context.h320
-rw-r--r--src/mesa/main/convolve.c1527
-rw-r--r--src/mesa/main/convolve.h114
-rw-r--r--src/mesa/main/dd.h1084
-rw-r--r--src/mesa/main/debug.c227
-rw-r--r--src/mesa/main/debug.h60
-rw-r--r--src/mesa/main/depth.c188
-rw-r--r--src/mesa/main/depth.h62
-rw-r--r--src/mesa/main/depthstencil.c661
-rw-r--r--src/mesa/main/depthstencil.h56
-rw-r--r--src/mesa/main/descrip.mms218
-rw-r--r--src/mesa/main/dispatch.c95
-rw-r--r--src/mesa/main/dlist.c8637
-rw-r--r--src/mesa/main/dlist.h96
-rw-r--r--src/mesa/main/drawpix.c435
-rw-r--r--src/mesa/main/drawpix.h55
-rw-r--r--src/mesa/main/enable.c1414
-rw-r--r--src/mesa/main/enable.h57
-rw-r--r--src/mesa/main/enums.c4596
-rw-r--r--src/mesa/main/enums.h55
-rw-r--r--src/mesa/main/eval.c962
-rw-r--r--src/mesa/main/eval.h128
-rw-r--r--src/mesa/main/execmem.c133
-rw-r--r--src/mesa/main/extensions.c544
-rw-r--r--src/mesa/main/extensions.h86
-rw-r--r--src/mesa/main/fbobject.c1606
-rw-r--r--src/mesa/main/fbobject.h134
-rw-r--r--src/mesa/main/feedback.c541
-rw-r--r--src/mesa/main/feedback.h82
-rw-r--r--src/mesa/main/fog.c188
-rw-r--r--src/mesa/main/fog.h66
-rw-r--r--src/mesa/main/framebuffer.c802
-rw-r--r--src/mesa/main/framebuffer.h76
-rw-r--r--src/mesa/main/get.c5545
-rw-r--r--src/mesa/main/get.h59
-rw-r--r--src/mesa/main/get_gen.py1194
-rw-r--r--src/mesa/main/getstring.c274
-rw-r--r--src/mesa/main/glheader.h261
-rw-r--r--src/mesa/main/hash.c520
-rw-r--r--src/mesa/main/hash.h69
-rw-r--r--src/mesa/main/hint.c153
-rw-r--r--src/mesa/main/hint.h57
-rw-r--r--src/mesa/main/histogram.c1187
-rw-r--r--src/mesa/main/histogram.h89
-rw-r--r--src/mesa/main/image.c4371
-rw-r--r--src/mesa/main/image.h225
-rw-r--r--src/mesa/main/imports.c1366
-rw-r--r--src/mesa/main/imports.h771
-rw-r--r--src/mesa/main/light.c1375
-rw-r--r--src/mesa/main/light.h145
-rw-r--r--src/mesa/main/lines.c134
-rw-r--r--src/mesa/main/lines.h48
-rw-r--r--src/mesa/main/macros.h658
-rw-r--r--src/mesa/main/matrix.c933
-rw-r--r--src/mesa/main/matrix.h131
-rw-r--r--src/mesa/main/mm.c272
-rw-r--r--src/mesa/main/mm.h92
-rw-r--r--src/mesa/main/mtypes.h3045
-rw-r--r--src/mesa/main/occlude.c538
-rw-r--r--src/mesa/main/occlude.h70
-rw-r--r--src/mesa/main/pixel.c2129
-rw-r--r--src/mesa/main/pixel.h158
-rw-r--r--src/mesa/main/points.c294
-rw-r--r--src/mesa/main/points.h60
-rw-r--r--src/mesa/main/polygon.c383
-rw-r--r--src/mesa/main/polygon.h69
-rw-r--r--src/mesa/main/rastpos.c1003
-rw-r--r--src/mesa/main/rastpos.h193
-rw-r--r--src/mesa/main/rbadaptors.c577
-rw-r--r--src/mesa/main/rbadaptors.h40
-rw-r--r--src/mesa/main/renderbuffer.c2146
-rw-r--r--src/mesa/main/renderbuffer.h108
-rw-r--r--src/mesa/main/simple_list.h197
-rw-r--r--src/mesa/main/state.c1105
-rw-r--r--src/mesa/main/state.h43
-rw-r--r--src/mesa/main/stencil.c552
-rw-r--r--src/mesa/main/stencil.h77
-rw-r--r--src/mesa/main/texcompress.c313
-rw-r--r--src/mesa/main/texcompress.h74
-rw-r--r--src/mesa/main/texcompress_fxt1.c1712
-rw-r--r--src/mesa/main/texcompress_s3tc.c648
-rw-r--r--src/mesa/main/texenvprogram.c1264
-rw-r--r--src/mesa/main/texenvprogram.h41
-rw-r--r--src/mesa/main/texformat.c1571
-rw-r--r--src/mesa/main/texformat.h242
-rw-r--r--src/mesa/main/texformat_tmp.h1398
-rw-r--r--src/mesa/main/teximage.c3563
-rw-r--r--src/mesa/main/teximage.h242
-rw-r--r--src/mesa/main/texobj.c1055
-rw-r--r--src/mesa/main/texobj.h98
-rw-r--r--src/mesa/main/texrender.c434
-rw-r--r--src/mesa/main/texrender.h15
-rw-r--r--src/mesa/main/texstate.c3238
-rw-r--r--src/mesa/main/texstate.h152
-rw-r--r--src/mesa/main/texstore.c4432
-rw-r--r--src/mesa/main/texstore.h255
-rw-r--r--src/mesa/main/varray.c941
-rw-r--r--src/mesa/main/varray.h160
-rw-r--r--src/mesa/main/version.h52
-rw-r--r--src/mesa/main/vsnprintf.c165
-rw-r--r--src/mesa/main/vtxfmt.c191
-rw-r--r--src/mesa/main/vtxfmt.h43
-rw-r--r--src/mesa/main/vtxfmt_tmp.h530
-rw-r--r--src/mesa/sources357
248 files changed, 174335 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..f52a06a
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,40 @@
+# src/Makefile
+
+TOP = ..
+
+include $(TOP)/configs/current
+
+SUBDIRS = $(SRC_DIRS)
+
+
+default: message $(TOP)/$(LIB_DIR) subdirs
+
+
+message:
+ @echo "Making sources for" $(CONFIG_NAME)
+
+
+subdirs:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir ; $(MAKE)) || exit 1 ; \
+ fi \
+ done
+
+install:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir ; $(MAKE) install) || exit 1 ; \
+ fi \
+ done
+
+$(TOP)/$(LIB_DIR):
+ -mkdir $(TOP)/$(LIB_DIR)
+
+
+clean:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir ; $(MAKE) clean) ; \
+ fi \
+ done
diff --git a/src/glx/Makefile b/src/glx/Makefile
new file mode 100644
index 0000000..bd486cf
--- /dev/null
+++ b/src/glx/Makefile
@@ -0,0 +1,12 @@
+
+TOP = ../..
+include $(TOP)/configs/current
+
+
+default:
+ cd mini ; $(MAKE)
+
+
+clean:
+ cd mini ; $(MAKE) clean
+
diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile
new file mode 100644
index 0000000..4931dfe
--- /dev/null
+++ b/src/glx/x11/Makefile
@@ -0,0 +1,96 @@
+TOP = ../../..
+include $(TOP)/configs/current
+
+EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER \
+ -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
+
+SOURCES = \
+ glcontextmodes.c \
+ clientattrib.c \
+ compsize.c \
+ eval.c \
+ glxcmds.c \
+ glxext.c \
+ glxextensions.c \
+ indirect.c \
+ indirect_init.c \
+ indirect_size.c \
+ indirect_window_pos.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 \
+ glx_texture_compression.c \
+ dri_glx.c \
+ XF86dri.c
+
+include $(TOP)/src/mesa/sources
+
+MESA_ASM_API = $(addprefix $(TOP)/src/mesa/, $(ASM_API))
+MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES))
+MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS))
+
+OBJECTS = $(SOURCES:.c=.o) $(MESA_GLAPI_OBJECTS)
+
+INCLUDES = -I. \
+ -I$(TOP)/include \
+ -I$(TOP)/include/GL/internal \
+ -I$(TOP)/src/mesa/main \
+ -I$(TOP)/src/mesa/glapi \
+ -I$(TOP)/src/mesa/drivers/dri/common \
+ $(LIBDRM_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)
+
+glcontextmodes.c:
+ ln -s $(TOP)/src/mesa/drivers/dri/common/glcontextmodes.c .
+
+# Make libGL
+$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
+ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
+ -major 1 -minor 2 $(MKLIB_OPTIONS) \
+ -install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS)
+
+
+depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_ASM_API) Makefile
+ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
+ $(MESA_GLAPI_SOURCES) $(MESA_ASM_API)
+
+
+# Emacs tags
+tags:
+ etags `find . -name \*.[ch]` `find ../include`
+
+# Dummy install target
+install:
+
+# Remove .o and backup files
+clean:
+ -rm -f $(TOP)/$(LIB_DIR)/libGL.so*
+ -rm -f $(TOP)/$(LIB_DIR)/libGL.a*
+ -rm -f *.o *~
+ -rm -f depend
+
+include depend
diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c
new file mode 100644
index 0000000..0ce5882
--- /dev/null
+++ b/src/glx/x11/XF86dri.c
@@ -0,0 +1,623 @@
+/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
+/**************************************************************************
+
+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 "glheader.h"
+#include "xf86dristr.h"
+
+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
+
+
+PUBLIC Bool XF86DRIQueryExtension (dpy, event_basep, error_basep)
+ Display *dpy;
+ int *event_basep, *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;
+ }
+}
+
+PUBLIC Bool XF86DRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
+ 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;
+}
+
+PUBLIC Bool XF86DRIQueryDirectRenderingCapable(dpy, screen, isCapable)
+ 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;
+}
+
+PUBLIC Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString)
+ 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) {
+ const 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;
+}
+
+PUBLIC Bool XF86DRIAuthConnection(dpy, screen, magic)
+ 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;
+}
+
+PUBLIC Bool XF86DRICloseConnection(dpy, screen)
+ 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;
+}
+
+PUBLIC Bool XF86DRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
+ ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName)
+ 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;
+}
+
+PUBLIC Bool XF86DRICreateContextWithConfig(dpy, screen, configID, context,
+ hHWContext)
+ 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;
+}
+
+PUBLIC Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
+ Display* dpy;
+ int screen;
+ Visual* visual;
+ XID* context;
+ drm_context_t * hHWContext;
+{
+ return XF86DRICreateContextWithConfig( dpy, screen, visual->visualid,
+ context, hHWContext );
+}
+
+PUBLIC GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen,
+ __DRIid context )
+{
+ Display * const dpy = (Display *) ndpy;
+ 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;
+}
+
+PUBLIC GLboolean XF86DRICreateDrawable( __DRInativeDisplay * ndpy, int screen,
+ __DRIid drawable, drm_drawable_t * hHWDrawable )
+{
+ Display * const dpy = (Display *) ndpy;
+ 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;
+}
+
+PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
+ __DRIid drawable )
+{
+ Display * const dpy = (Display *) ndpy;
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIDestroyDrawableReq *req;
+
+ TRACE("DestroyDrawable...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIDestroyDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIDestroyDrawable;
+ req->screen = screen;
+ req->drawable = drawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("DestroyDrawable... return True");
+ return True;
+}
+
+PUBLIC 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;
+}
+
+PUBLIC Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer,
+ fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate)
+ 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) {
+ const 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;
+}
+
+PUBLIC Bool XF86DRIOpenFullScreen(dpy, screen, drawable)
+ Display* dpy;
+ int screen;
+ Drawable drawable;
+{
+ /* This function and the underlying X protocol are deprecated.
+ */
+ (void) dpy;
+ (void) screen;
+ (void) drawable;
+ return False;
+}
+
+PUBLIC Bool XF86DRICloseFullScreen(dpy, screen, drawable)
+ 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
new file mode 100644
index 0000000..bfb263c
--- /dev/null
+++ b/src/glx/x11/clientattrib.c
@@ -0,0 +1,141 @@
+/* $XFree86: xc/lib/GL/glx/clientattrib.c,v 1.5 2001/03/21 16:04:39 dawes Exp $ */
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#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
new file mode 100644
index 0000000..b8c162e
--- /dev/null
+++ b/src/glx/x11/compsize.c
@@ -0,0 +1,191 @@
+/* $XFree86: xc/lib/GL/glx/compsize.c,v 1.6 2004/01/28 18:11:38 alanh Exp $ */
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#include <GL/gl.h>
+#include "indirect_size.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/depend.bak b/src/glx/x11/depend.bak
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/glx/x11/depend.bak
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
new file mode 100644
index 0000000..0875361
--- /dev/null
+++ b/src/glx/x11/dri_glx.c
@@ -0,0 +1,472 @@
+/**************************************************************************
+
+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.
+
+**************************************************************************/
+/* $XFree86: xc/lib/GL/dri/dri_glx.c,v 1.14 2003/07/16 00:54:00 dawes Exp $ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ * Brian Paul <brian@precisioninsight.com>
+ *
+ */
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include <unistd.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include "glxclient.h"
+#include "xf86dri.h"
+#include "sarea.h"
+#include <stdio.h>
+#include <dlfcn.h>
+#include "dri_glx.h"
+#include <sys/types.h>
+#include <stdarg.h>
+
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+
+#ifndef DEFAULT_DRIVER_DIR
+/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
+#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
+#endif
+
+static __DRIdriver *Drivers = NULL;
+
+
+/*
+ * printf wrappers
+ */
+
+static 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);
+ }
+}
+
+static void ErrorMessageF(const char *f, ...)
+{
+ va_list args;
+
+ if (getenv("LIBGL_DEBUG")) {
+ fprintf(stderr, "libGL error: ");
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+ }
+}
+
+
+/**
+ * Extract the ith directory path out of a colon-separated list of paths. No
+ * more than \c dirLen characters, including the terminating \c NUL, will be
+ * written to \c dir.
+ *
+ * \param index Index of path to extract (starting at zero)
+ * \param paths The colon-separated list of paths
+ * \param dirLen Maximum length of result to store in \c dir
+ * \param dir Buffer to hold the extracted directory path
+ *
+ * \returns
+ * The number of characters that would have been written to \c dir had there
+ * been enough room. This does not include the terminating \c NUL. When
+ * extraction fails, zero will be returned.
+ *
+ * \todo
+ * It seems like this function could be rewritten to use \c strchr.
+ */
+static size_t
+ExtractDir(int index, const char *paths, int dirLen, char *dir)
+{
+ int i, len;
+ const char *start, *end;
+
+ /* find ith colon */
+ start = paths;
+ i = 0;
+ while (i < index) {
+ if (*start == ':') {
+ i++;
+ start++;
+ }
+ else if (*start == 0) {
+ /* end of string and couldn't find ith colon */
+ dir[0] = 0;
+ return 0;
+ }
+ else {
+ start++;
+ }
+ }
+
+ while (*start == ':')
+ start++;
+
+ /* find next colon, or end of string */
+ end = start + 1;
+ while (*end != ':' && *end != 0) {
+ end++;
+ }
+
+ /* copy string between <start> and <end> into result string */
+ len = end - start;
+ if (len > dirLen - 1)
+ len = dirLen - 1;
+ strncpy(dir, start, len);
+ dir[len] = 0;
+
+ return( end - start );
+}
+
+
+/**
+ * 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";
+
+
+/**
+ * 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.
+ */
+static __DRIdriver *OpenDriver(const char *driverName)
+{
+ void *glhandle = NULL;
+ char *libPaths = NULL;
+ char libDir[1000];
+ int i;
+ __DRIdriver *driver;
+
+ /* First, search Drivers list to see if we've already opened this driver */
+ for (driver = Drivers; driver; driver = driver->next) {
+ if (strcmp(driver->name, driverName) == 0) {
+ /* found it */
+ return driver;
+ }
+ }
+
+ /* Attempt to make sure libGL symbols will be visible to the driver */
+ glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+
+ 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)
+ libPaths = DEFAULT_DRIVER_DIR;
+
+ for ( i = 0 ; ExtractDir(i, libPaths, 1000, libDir) != 0 ; i++ ) {
+ char realDriverName[200];
+ void *handle = NULL;
+
+
+ /* If TLS support is enabled, try to open the TLS version of the driver
+ * binary first. If that fails, try the non-TLS version.
+ */
+#ifdef GLX_USE_TLS
+ snprintf(realDriverName, 200, "%s/tls/%s_dri.so", libDir, driverName);
+ InfoMessageF("OpenDriver: trying %s\n", realDriverName);
+ handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
+#endif
+
+ if ( handle == NULL ) {
+ snprintf(realDriverName, 200, "%s/%s_dri.so", libDir, driverName);
+ InfoMessageF("OpenDriver: trying %s\n", realDriverName);
+ handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
+ }
+
+ if ( handle != NULL ) {
+ /* allocate __DRIdriver struct */
+ driver = (__DRIdriver *) Xmalloc(sizeof(__DRIdriver));
+ if (!driver)
+ break; /* out of memory! */
+ /* init the struct */
+ driver->name = __glXstrdup(driverName);
+ if (!driver->name) {
+ Xfree(driver);
+ driver = NULL;
+ break; /* out of memory! */
+ }
+
+ driver->createNewScreenFunc = (PFNCREATENEWSCREENFUNC)
+ dlsym(handle, createNewScreenName);
+
+ if ( driver->createNewScreenFunc == NULL ) {
+ /* If the driver doesn't have this symbol then something's
+ * really, really wrong.
+ */
+ ErrorMessageF("%s not defined in %s_dri.so!\n"
+ "Your driver may be too old for this libGL.\n",
+ createNewScreenName, driverName);
+ Xfree(driver);
+ driver = NULL;
+ dlclose(handle);
+ continue;
+ }
+ driver->handle = handle;
+ /* put at head of linked list */
+ driver->next = Drivers;
+ Drivers = driver;
+ break;
+ }
+ else {
+ ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
+ }
+ }
+
+ if (!driver)
+ ErrorMessageF("unable to load driver: %s_dri.so\n", driverName);
+
+ if (glhandle)
+ dlclose(glhandle);
+
+ return driver;
+}
+
+
+/*
+ * 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 GetDriverName(Display *dpy, int scrNum, char **driverName)
+{
+ int directCapable;
+ Bool b;
+ int driverMajor, driverMinor, driverPatch;
+
+ *driverName = NULL;
+
+ 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;
+}
+
+
+/*
+ * Given a display pointer and screen number, return a __DRIdriver handle.
+ * Return NULL if anything goes wrong.
+ */
+__DRIdriver *driGetDriver(Display *dpy, int scrNum)
+{
+ char *driverName;
+ if (GetDriverName(dpy, scrNum, &driverName)) {
+ __DRIdriver *ret;
+ ret = OpenDriver(driverName);
+ if (driverName)
+ Xfree(driverName);
+ return ret;
+ }
+ return NULL;
+}
+
+
+/*
+ * 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.
+ */
+const char *glXGetScreenDriver (Display *dpy, int scrNum) {
+ static char ret[32];
+ char *driverName;
+ if (GetDriverName(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.
+ */
+const char *glXGetDriverConfig (const char *driverName) {
+ __DRIdriver *driver = OpenDriver (driverName);
+ if (driver)
+ return dlsym (driver->handle, "__driConfigOptions");
+ else
+ return NULL;
+}
+
+
+/* This function isn't currently used.
+ */
+static void driDestroyDisplay(Display *dpy, void *private)
+{
+ __DRIdisplayPrivate *pdpyp = (__DRIdisplayPrivate *)private;
+
+ if (pdpyp) {
+ const int numScreens = ScreenCount(dpy);
+ int i;
+ for (i = 0; i < numScreens; i++) {
+ if (pdpyp->libraryHandles[i])
+ dlclose(pdpyp->libraryHandles[i]);
+ }
+ Xfree(pdpyp->libraryHandles);
+ Xfree(pdpyp);
+ }
+}
+
+
+/*
+ * Allocate, initialize and return a __DRIdisplayPrivate object.
+ * This is called from __glXInitialize() when we are given a new
+ * display pointer.
+ */
+void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp)
+{
+ const int numScreens = ScreenCount(dpy);
+ __DRIdisplayPrivate *pdpyp;
+ int eventBase, errorBase;
+ int major, minor, patch;
+ int scrn;
+
+ /* Initialize these fields to NULL in case we fail.
+ * If we don't do this we may later get segfaults trying to free random
+ * addresses when the display is closed.
+ */
+ pdisp->private = NULL;
+ pdisp->destroyDisplay = NULL;
+
+ if (!XF86DRIQueryExtension(dpy, &eventBase, &errorBase)) {
+ return NULL;
+ }
+
+ if (!XF86DRIQueryVersion(dpy, &major, &minor, &patch)) {
+ return NULL;
+ }
+
+ pdpyp = (__DRIdisplayPrivate *)Xmalloc(sizeof(__DRIdisplayPrivate));
+ if (!pdpyp) {
+ return NULL;
+ }
+
+ pdpyp->driMajor = major;
+ pdpyp->driMinor = minor;
+ pdpyp->driPatch = patch;
+
+ pdisp->destroyDisplay = driDestroyDisplay;
+
+ /* allocate array of pointers to createNewScreen funcs */
+ pdisp->createNewScreen = (PFNCREATENEWSCREENFUNC *)
+ Xmalloc(numScreens * sizeof(void *));
+ if (!pdisp->createNewScreen) {
+ Xfree(pdpyp);
+ return NULL;
+ }
+
+ /* allocate array of library handles */
+ pdpyp->libraryHandles = (void **) Xmalloc(numScreens * sizeof(void*));
+ if (!pdpyp->libraryHandles) {
+ Xfree(pdisp->createNewScreen);
+ Xfree(pdpyp);
+ return NULL;
+ }
+
+ /* dynamically discover DRI drivers for all screens, saving each
+ * driver's "__driCreateScreen" function pointer. That's the bootstrap
+ * entrypoint for all DRI drivers.
+ */
+ for (scrn = 0; scrn < numScreens; scrn++) {
+ __DRIdriver *driver = driGetDriver(dpy, scrn);
+ if (driver) {
+ pdisp->createNewScreen[scrn] = driver->createNewScreenFunc;
+ pdpyp->libraryHandles[scrn] = driver->handle;
+ }
+ else {
+ pdisp->createNewScreen[scrn] = NULL;
+ pdpyp->libraryHandles[scrn] = NULL;
+ }
+ }
+
+ return (void *)pdpyp;
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/dri_glx.h b/src/glx/x11/dri_glx.h
new file mode 100644
index 0000000..7556168
--- /dev/null
+++ b/src/glx/x11/dri_glx.h
@@ -0,0 +1,61 @@
+/**************************************************************************
+
+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>
+ *
+ */
+
+#ifndef _DRI_GLX_H_
+#define _DRI_GLX_H_
+
+#ifdef GLX_DIRECT_RENDERING
+
+struct __DRIdisplayPrivateRec {
+ /*
+ ** XFree86-DRI version information
+ */
+ int driMajor;
+ int driMinor;
+ int driPatch;
+
+ /*
+ ** Array of library handles [indexed by screen number]
+ */
+ void **libraryHandles;
+};
+
+typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate;
+typedef struct __DRIscreenPrivateRec __DRIscreenPrivate;
+typedef struct __DRIvisualPrivateRec __DRIvisualPrivate;
+typedef struct __DRIcontextPrivateRec __DRIcontextPrivate;
+typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate;
+
+#endif
+#endif /* _DRI_GLX_H_ */
diff --git a/src/glx/x11/eval.c b/src/glx/x11/eval.c
new file mode 100644
index 0000000..0f94e6d
--- /dev/null
+++ b/src/glx/x11/eval.c
@@ -0,0 +1,132 @@
+/* $XFree86$ */
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#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
new file mode 100644
index 0000000..edb0446
--- /dev/null
+++ b/src/glx/x11/glcontextmodes.c
@@ -0,0 +1,533 @@
+/*
+ * (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 <stdlib.h>
+# include <string.h>
+# include <GL/gl.h>
+# include "GL/internal/dri_interface.h"
+# include "imports.h"
+# define _mesa_memset memset
+#else
+# if defined(HAVE_DIX_CONFIG_H)
+# include <dix-config.h>
+# endif
+# include <X11/X.h>
+# include <GL/glx.h>
+# include "GL/glxint.h"
+
+# 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 derrived 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->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;
+ 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 = 0;
+ (*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 )
+{
+ while ( modes != NULL ) {
+ if ( modes->visualID == vid ) {
+ break;
+ }
+
+ modes = modes->next;
+ }
+
+ return modes;
+}
+
+
+/**
+ * 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/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
new file mode 100644
index 0000000..472045e
--- /dev/null
+++ b/src/glx/x11/glx_pbuffer.c
@@ -0,0 +1,594 @@
+/*
+ * (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 "glapi.h"
+#include "glxextensions.h"
+#include "glcontextmodes.h"
+#include "glheader.h"
+
+static void ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
+ const CARD32 * attribs, size_t num_attribs );
+
+static void DestroyPbuffer( Display * dpy, GLXDrawable drawable );
+
+static GLXDrawable CreatePbuffer( Display *dpy,
+ const __GLcontextModes * fbconfig, unsigned int width, unsigned int height,
+ const int *attrib_list, GLboolean size_in_attribs );
+
+static int GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
+ int attribute, unsigned int *value );
+
+
+/**
+ * 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;
+
+ GetReqExtra( GLXDestroyPbuffer, 4, 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;
+}
+
+
+/**
+ * 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;
+
+ if ( (dpy == NULL) || (drawable == 0) ) {
+ return 0;
+ }
+
+ priv = __glXInitialize(dpy);
+ GLboolean 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;
+ }
+ }
+
+ 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 = (GLXPbuffer) drawable;
+ req->glxwindow = (GLXWindow) XAllocID(dpy);
+ req->numAttribs = (CARD32) i;
+
+ memcpy( data, attrib_list, 8 * i );
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ 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();
+
+ 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)
+{
+ return (GLXPbuffer) CreatePbuffer( dpy, (__GLcontextModes *) config,
+ 0, 0,
+ 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)
+{
+ 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 )
+{
+ return CreateDrawable( dpy, (__GLcontextModes *) config,
+ (Drawable) pixmap, attrib_list,
+ X_GLXCreatePixmap );
+}
+
+
+PUBLIC GLXWindow
+glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
+ const int *attrib_list )
+{
+ return CreateDrawable( dpy, (__GLcontextModes *) config,
+ (Drawable) win, attrib_list,
+ X_GLXCreateWindow );
+}
+
+
+PUBLIC void
+glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
+{
+ DestroyDrawable( dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap );
+}
+
+
+PUBLIC void
+glXDestroyWindow(Display *dpy, GLXWindow win)
+{
+ 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
new file mode 100644
index 0000000..e93cd2a
--- /dev/null
+++ b/src/glx/x11/glx_query.c
@@ -0,0 +1,102 @@
+/*
+ * (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"
+
+/**
+ * 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 and cache it in the display private.
+ * This routine will allocate the necessay space for the string.
+ */
+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;
+}
diff --git a/src/glx/x11/glx_texture_compression.c b/src/glx/x11/glx_texture_compression.c
new file mode 100644
index 0000000..5676858
--- /dev/null
+++ b/src/glx/x11/glx_texture_compression.c
@@ -0,0 +1,347 @@
+/*
+ * (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/glxclient.h b/src/glx/x11/glxclient.h
new file mode 100644
index 0000000..bc9a94c
--- /dev/null
+++ b/src/glx/x11/glxclient.h
@@ -0,0 +1,690 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+*/
+/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.21 2004/02/09 23:46:31 alanh Exp $ */
+
+/**
+ * \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>
+#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 "glapitable.h"
+#include "glxextensions.h"
+#if defined( USE_XTHREADS )
+# include <X11/Xthreads.h>
+#elif defined( PTHREADS )
+# include <pthread.h>
+#endif
+
+#define GLX_MAJOR_VERSION 1 /* current version numbers */
+#define GLX_MINOR_VERSION 4
+
+#define __GLX_MAX_TEXTURE_UNITS 32
+
+typedef struct __GLXcontextRec __GLXcontext;
+typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
+typedef struct _glapi_table __GLapi;
+
+/************************************************************************/
+
+#ifdef GLX_DIRECT_RENDERING
+
+#include <GL/internal/dri_interface.h>
+
+
+/**
+ * Display dependent methods. This structure is initialized during the
+ * \c driCreateDisplay call.
+ */
+struct __DRIdisplayRec {
+ /**
+ * Method to destroy the private DRI display data.
+ */
+ void (*destroyDisplay)(Display *dpy, void *displayPrivate);
+
+ /**
+ * Opaque pointer to private per display direct rendering data.
+ * \c NULL if direct rendering is not supported on this display.
+ */
+ struct __DRIdisplayPrivateRec *private;
+
+ /**
+ * Array of pointers to methods to create and initialize the private DRI
+ * screen data.
+ */
+ PFNCREATENEWSCREENFUNC * createNewScreen;
+};
+
+
+/*
+** We keep a linked list of these structures, one per DRI device driver.
+*/
+struct __DRIdriverRec {
+ const char *name;
+ void *handle;
+ PFNCREATENEWSCREENFUNC createNewScreenFunc;
+ struct __DRIdriverRec *next;
+};
+
+/*
+** Function to create and DRI display data and initialize the display
+** dependent methods.
+*/
+extern void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp);
+
+extern __DRIdriver *driGetDriver(Display *dpy, int scrNum);
+
+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);
+
+extern Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
+
+#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;
+
+ /**
+ * Visual id.
+ *
+ * \deprecated
+ * This filed has been largely been replaced by the \c mode field, but
+ * the work is not quite done.
+ */
+ VisualID vid;
+
+ /**
+ * Screen number.
+ */
+ GLint screen;
+
+ /**
+ * \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;
+
+#ifdef GLX_DIRECT_RENDERING
+ /**
+ * Per context direct rendering interface functions and data.
+ */
+ __DRIcontext driContext;
+#endif
+
+ /**
+ * \c GLXFBConfigID used to create this context. May be \c None. This
+ * field has been replaced by the \c mode field.
+ *
+ * \since Internal API version 20030317.
+ *
+ * \deprecated
+ * This filed has been largely been replaced by the \c mode field, but
+ * the work is not quite done.
+ */
+ GLXFBConfigID fbconfigID;
+
+ /**
+ * 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. */
+ /*@}*/
+
+ 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).
+ */
+typedef 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;
+#endif
+
+ /**
+ * Linked list of configurations for this screen.
+ */
+ __GLcontextModes *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;
+ /*@}*/
+
+} __GLXscreenConfigs;
+
+/**
+ * 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.
+ */
+ __DRIdisplay driDisplay;
+#endif
+};
+
+void __glXFreeContext(__GLXcontext*);
+
+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 int __glXDebug;
+
+/* This is per-thread storage in an MT environment */
+#if defined( USE_XTHREADS ) || 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( USE_XTHREADS ) || defined( PTHREADS ) */
+
+
+/*
+** Global lock for all threads in this address space using the GLX
+** extension
+*/
+#if defined( USE_XTHREADS )
+extern xmutex_rec __glXmutex;
+#define __glXLock() xmutex_lock(&__glXmutex)
+#define __glXUnlock() xmutex_unlock(&__glXmutex)
+#elif 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
+*/
+extern void __glXInitVertexArrayState(__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 * __glXGetStringFromServer( Display * dpy, int opcode,
+ CARD32 glxCode, CARD32 for_whom, CARD32 name );
+
+extern char *__glXstrdup(const char *str);
+
+
+extern const char __glXGLClientVersion[];
+extern const char __glXGLClientExtensions[];
+
+/* Determine the internal API version */
+extern int __glXGetInternalVersion(void);
+
+/* Get the unadjusted system time */
+extern int __glXGetUST( int64_t * ust );
+
+#endif /* !__GLX_client_h__ */
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
new file mode 100644
index 0000000..d0f5e9a
--- /dev/null
+++ b/src/glx/x11/glxcmds.c
@@ -0,0 +1,3125 @@
+/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.30 2004/01/30 20:33:06 alanh Exp $ */
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/**
+ * \file glxcmds.c
+ * Client-side GLX interface.
+ */
+
+#include <inttypes.h>
+#include "glxclient.h"
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xext.h>
+#include <assert.h>
+#include <string.h>
+#include "glapi.h"
+#ifdef GLX_DIRECT_RENDERING
+#include "indirect_init.h"
+#include <X11/extensions/xf86vmode.h>
+#include "xf86dri.h"
+#endif
+#include "glxextensions.h"
+#include "glcontextmodes.h"
+#include "glheader.h"
+#include <sys/time.h>
+
+static const char __glXGLXClientVendorName[] = "SGI";
+static const char __glXGLXClientVersion[] = "1.4";
+
+
+/****************************************************************************/
+/**
+ * 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.
+ * \returns A pointer to the context's __DRIdrawable on success, or NULL if
+ * the drawable is not associated with a direct-rendering context.
+ */
+
+#ifdef GLX_DIRECT_RENDERING
+static __DRIdrawable *
+GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num )
+{
+ __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
+
+ if ( (priv != NULL) && (priv->driDisplay.private != NULL) ) {
+ const unsigned screen_count = ScreenCount(dpy);
+ unsigned i;
+
+ for ( i = 0 ; i < screen_count ; i++ ) {
+ __DRIscreen * const psc = &priv->screenConfigs[i].driScreen;
+ __DRIdrawable * const pdraw = (psc->private != NULL)
+ ? (*psc->getDrawable)(dpy, drawable, psc->private) : NULL;
+
+ if ( pdraw != NULL ) {
+ 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->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->isDirect = GL_FALSE;
+ gc->pc = gc->buf;
+ gc->bufEnd = gc->buf + bufSize;
+ 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;
+
+ 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) {
+ int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen;
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+ const __GLcontextModes * mode;
+
+ /* The value of fbconfig cannot change because it is tested
+ * later in the function.
+ */
+ if ( fbconfig == NULL ) {
+ /* FIXME: Is it possible for the __GLcontextModes structure
+ * FIXME: to not be found?
+ */
+ mode = _gl_context_modes_find_visual( psc->configs,
+ vis->visualid );
+ assert( mode != NULL );
+ assert( mode->screen == screen );
+ }
+ else {
+ mode = fbconfig;
+ }
+
+ if (psc && psc->driScreen.private) {
+ void * const shared = (shareList != NULL)
+ ? shareList->driContext.private : NULL;
+ gc->driContext.private =
+ (*psc->driScreen.createNewContext)( dpy, mode, renderType,
+ shared,
+ &gc->driContext );
+ if (gc->driContext.private) {
+ gc->isDirect = GL_TRUE;
+ gc->screen = mode->screen;
+ gc->vid = mode->visualID;
+ gc->fbconfigID = mode->fbconfigID;
+ gc->driContext.mode = mode;
+ }
+ }
+ }
+#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;
+ req->isDirect = gc->isDirect;
+ }
+ 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;
+ req->isDirect = gc->isDirect;
+ }
+ 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;
+ req->isDirect = gc->isDirect;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ gc->imported = GL_FALSE;
+ }
+ else {
+ gc->xid = contextID;
+ gc->imported = GL_TRUE;
+ }
+
+ return gc;
+}
+
+PUBLIC GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis,
+ GLXContext shareList, Bool allowDirect)
+{
+ return CreateContext(dpy, vis, NULL, shareList, allowDirect, None,
+ False, 0);
+}
+
+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;
+
+#ifdef GLX_DIRECT_RENDERING
+ /* Destroy the direct rendering context */
+ if (gc->isDirect) {
+ if (gc->driContext.private) {
+ (*gc->driContext.destroyContext)(dpy, gc->screen,
+ gc->driContext.private);
+ gc->driContext.private = NULL;
+ }
+ }
+#endif
+
+ 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->isDirect) {
+/* This bit of ugliness unwraps the glFinish function */
+#ifdef glFinish
+#undef glFinish
+#endif
+ glFinish();
+ 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->isDirect) {
+ 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->isDirect) {
+ 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->isDirect) {
+ /* 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)
+{
+ xGLXIsDirectReq *req;
+ xGLXIsDirectReply reply;
+ CARD8 opcode;
+
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode) {
+ return GL_FALSE;
+ }
+
+ /* 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;
+}
+
+/**
+ * \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->isDirect) {
+ 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();
+ 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();
+}
+
+PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
+{
+ xGLXSwapBuffersReq *req;
+ GLXContext gc;
+ GLXContextTag tag;
+ CARD8 opcode;
+#ifdef GLX_DIRECT_RENDERING
+ __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, NULL );
+
+ if ( pdraw != NULL ) {
+ (*pdraw->swapBuffers)(dpy, pdraw->private);
+ 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;
+ }
+
+ /* 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);
+}
+
+
+/*
+** 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;
+ int status;
+
+ status = GetGLXPrivScreenConfig( dpy, vis->screen, & priv, & psc );
+ if ( status == Success ) {
+ const __GLcontextModes * const modes = _gl_context_modes_find_visual(
+ psc->configs, 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
+ */
+ for ( modes = psc->configs ; modes != NULL ; modes = modes->next ) {
+ if ( fbconfigs_compatible( & test_config, modes )
+ && ((best_config == NULL)
+ || (fbconfig_compare( (const __GLcontextModes * const * const)&modes, &best_config ) < 0)) ) {
+ best_config = modes;
+ }
+ }
+
+ /*
+ ** If no visual is acceptable, return None
+ ** Otherwise, create an XVisualInfo list with just the selected X visual
+ ** and return this.
+ */
+ if (best_config != NULL) {
+ XVisualInfo visualTemplate;
+ int i;
+
+ visualTemplate.screen = screen;
+ visualTemplate.visualid = best_config->visualID;
+ visualList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask,
+ &visualTemplate, &i );
+ }
+
+ 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 = __glXGetStringFromServer(dpy, priv->majorOpcode,
+ X_GLXQueryServerString,
+ screen, GLX_EXTENSIONS);
+ }
+
+ __glXCalculateUsableExtensions(psc,
+#ifdef GLX_DIRECT_RENDERING
+ (psc->driScreen.private != 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 = __glXGetStringFromServer(dpy, priv->majorOpcode,
+ X_GLXQueryServerString, screen, name);
+ }
+
+ return *str;
+}
+
+void __glXClientInfo ( Display *dpy, int opcode )
+{
+ xGLXClientInfoReq *req;
+ int size;
+ char * ext_str = __glXGetClientGLExtensionString();
+
+ /* 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;
+
+ size = strlen( ext_str ) + 1;
+ req->length += (size + 3) >> 2;
+ req->numbytes = size;
+ Data(dpy, ext_str, size);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ 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->vid = *pProp++;
+ break;
+ case GLX_SCREEN:
+ ctx->screen = *pProp++;
+ break;
+ case GLX_FBCONFIG_ID:
+ ctx->fbconfigID = *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 */
+ if (!ctx->isDirect && (ctx->vid == None)) {
+ 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 = (int)(ctx->vid);
+ break;
+ case GLX_SCREEN:
+ *value = (int)(ctx->screen);
+ break;
+ case GLX_FBCONFIG_ID:
+ *value = (int)(ctx->fbconfigID);
+ 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;
+
+ if ( (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 ) {
+ 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_make_current_read
+*/
+
+PUBLIC GLX_ALIAS(GLXDrawable, glXGetCurrentReadDrawableSGI, (void), (),
+ glXGetCurrentReadDrawable)
+
+
+/*
+** GLX_SGI_swap_control
+*/
+PUBLIC int glXSwapIntervalSGI(int interval)
+{
+ xGLXVendorPrivateReq *req;
+ GLXContext gc = __glXGetCurrentContext();
+ Display * dpy;
+ CARD32 * interval_ptr;
+ CARD8 opcode;
+
+ if ( gc == NULL ) {
+ return GLX_BAD_CONTEXT;
+ }
+
+ if ( interval <= 0 ) {
+ return GLX_BAD_VALUE;
+ }
+
+#ifdef GLX_DIRECT_RENDERING
+ if ( gc->isDirect ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
+ gc->screen );
+ __DRIdrawable * const pdraw = GetDRIDrawable( gc->currentDpy,
+ gc->currentDrawable,
+ NULL );
+ if ( __glXExtensionBitIsEnabled( psc, SGI_swap_control_bit )
+ && (pdraw != NULL) ) {
+ pdraw->swap_interval = interval;
+ return 0;
+ }
+ else {
+ return GLX_BAD_CONTEXT;
+ }
+ }
+#endif
+ 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
+*/
+PUBLIC int glXSwapIntervalMESA(unsigned int interval)
+{
+#ifdef GLX_DIRECT_RENDERING
+ GLXContext gc = __glXGetCurrentContext();
+
+ if ( interval < 0 ) {
+ return GLX_BAD_VALUE;
+ }
+
+ if ( (gc != NULL) && gc->isDirect ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
+ gc->screen );
+
+ if ( (psc != NULL) && (psc->driScreen.private != NULL)
+ && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) {
+ __DRIdrawable * const pdraw =
+ (*psc->driScreen.getDrawable)(gc->currentDpy,
+ gc->currentDrawable,
+ psc->driScreen.private);
+ if ( pdraw != NULL ) {
+ pdraw->swap_interval = interval;
+ return 0;
+ }
+ }
+ }
+#else
+ (void) interval;
+#endif
+
+ return GLX_BAD_CONTEXT;
+}
+
+
+PUBLIC int glXGetSwapIntervalMESA(void)
+{
+#ifdef GLX_DIRECT_RENDERING
+ GLXContext gc = __glXGetCurrentContext();
+
+ if ( (gc != NULL) && gc->isDirect ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
+ gc->screen );
+
+ if ( (psc != NULL) && (psc->driScreen.private != NULL)
+ && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) {
+ __DRIdrawable * const pdraw =
+ (*psc->driScreen.getDrawable)(gc->currentDpy,
+ gc->currentDrawable,
+ psc->driScreen.private);
+ if ( pdraw != NULL ) {
+ return pdraw->swap_interval;
+ }
+ }
+ }
+#endif
+
+ return 0;
+}
+
+
+/*
+** GLX_MESA_swap_frame_usage
+*/
+
+PUBLIC GLint glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
+{
+ int status = GLX_BAD_CONTEXT;
+#ifdef GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+
+ if ( (pdraw != NULL) && (pdraw->frameTracking != NULL)
+ && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
+ status = pdraw->frameTracking( dpy, pdraw->private, GL_TRUE );
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+#endif
+ return status;
+}
+
+
+PUBLIC GLint glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
+{
+ int status = GLX_BAD_CONTEXT;
+#ifdef GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+
+ if ( (pdraw != NULL) && (pdraw->frameTracking != NULL)
+ && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
+ status = pdraw->frameTracking( dpy, pdraw->private, GL_FALSE );
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+#endif
+ return status;
+}
+
+
+PUBLIC GLint glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable,
+ GLfloat *usage)
+{
+ int status = GLX_BAD_CONTEXT;
+#ifdef GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+
+ if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
+ && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
+ int64_t sbc, missedFrames;
+ float lastMissedUsage;
+
+ status = pdraw->queryFrameTracking( dpy, pdraw->private, &sbc,
+ &missedFrames, &lastMissedUsage,
+ usage );
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+ (void) usage;
+#endif
+ return status;
+}
+
+
+PUBLIC GLint glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable,
+ int64_t *sbc, int64_t *missedFrames,
+ GLfloat *lastMissedUsage)
+{
+ int status = GLX_BAD_CONTEXT;
+#ifdef GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+
+ if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
+ && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
+ float usage;
+
+ status = pdraw->queryFrameTracking( dpy, pdraw->private, sbc,
+ missedFrames, lastMissedUsage,
+ & usage );
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+ (void) sbc;
+ (void) missedFrames;
+ (void) lastMissedUsage;
+#endif
+ return status;
+}
+
+
+/*
+** GLX_SGI_video_sync
+*/
+PUBLIC int glXGetVideoSyncSGI(unsigned int *count)
+{
+ /* 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 GLX_DIRECT_RENDERING
+ GLXContext gc = __glXGetCurrentContext();
+
+
+ if ( (gc != NULL) && gc->isDirect ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
+ gc->screen );
+ if ( __glXExtensionBitIsEnabled( psc, SGI_video_sync_bit )
+ && psc->driScreen.private && psc->driScreen.getMSC) {
+ int ret;
+ int64_t temp;
+
+ ret = psc->driScreen.getMSC( psc->driScreen.private, & temp );
+ *count = (unsigned) temp;
+ return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
+ }
+ }
+#else
+ (void) count;
+#endif
+ return GLX_BAD_CONTEXT;
+}
+
+PUBLIC int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
+{
+#ifdef GLX_DIRECT_RENDERING
+ GLXContext gc = __glXGetCurrentContext();
+
+ if ( divisor <= 0 || remainder < 0 )
+ return GLX_BAD_VALUE;
+
+ if ( (gc != NULL) && gc->isDirect ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy,
+ gc->screen );
+ if ( __glXExtensionBitIsEnabled( psc, SGI_video_sync_bit )
+ && psc->driScreen.private ) {
+ __DRIdrawable * const pdraw =
+ (*psc->driScreen.getDrawable)(gc->currentDpy,
+ gc->currentDrawable,
+ psc->driScreen.private);
+ if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL) ) {
+ int ret;
+ int64_t msc;
+ int64_t sbc;
+
+ ret = (*pdraw->waitForMSC)( gc->currentDpy, pdraw->private,
+ 0, divisor, remainder,
+ & msc, & sbc );
+ *count = (unsigned) msc;
+ return (ret == 0) ? 0 : GLX_BAD_CONTEXT;
+ }
+ }
+ }
+#else
+ (void) count;
+#endif
+ return GLX_BAD_CONTEXT;
+}
+
+
+/*
+** GLX_SGIS_video_source
+*/
+#if defined(_VL_H)
+
+PUBLIC GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX(Display *dpy,
+ int screen, VLServer server, VLPath path,
+ int nodeClass, VLNode drainNode)
+{
+ (void) dpy;
+ (void) screen;
+ (void) server;
+ (void) path;
+ (void) nodeClass;
+ (void) drainNode;
+ return 0;
+}
+
+PUBLIC void glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
+{
+ (void) dpy;
+ (void) src;
+}
+
+#endif
+
+
+/*
+** 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;
+
+ 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_SGI_cushion
+*/
+PUBLIC void glXCushionSGI(Display *dpy, Window win, float cushion)
+{
+ (void) dpy;
+ (void) win;
+ (void) cushion;
+}
+
+
+/*
+** GLX_SGIX_video_resize
+*/
+PUBLIC int glXBindChannelToWindowSGIX(Display *dpy, int screen,
+ int channel , Window window)
+{
+ (void) dpy;
+ (void) screen;
+ (void) channel;
+ (void) window;
+ return 0;
+}
+
+PUBLIC int glXChannelRectSGIX(Display *dpy, int screen, int channel,
+ int x, int y, int w, int h)
+{
+ (void) dpy;
+ (void) screen;
+ (void) channel;
+ (void) x;
+ (void) y;
+ (void) w;
+ (void) h;
+ return 0;
+}
+
+PUBLIC int glXQueryChannelRectSGIX(Display *dpy, int screen, int channel,
+ int *x, int *y, int *w, int *h)
+{
+ (void) dpy;
+ (void) screen;
+ (void) channel;
+ (void) x;
+ (void) y;
+ (void) w;
+ (void) h;
+ return 0;
+}
+
+int glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel,
+ int *dx, int *dy, int *dw, int *dh)
+{
+ (void) dpy;
+ (void) screen;
+ (void) channel;
+ (void) dx;
+ (void) dy;
+ (void) dw;
+ (void) dh;
+ return 0;
+}
+
+PUBLIC int glXChannelRectSyncSGIX(Display *dpy, int screen,
+ int channel, GLenum synctype)
+{
+ (void) dpy;
+ (void) screen;
+ (void) channel;
+ (void) synctype;
+ return 0;
+}
+
+
+#if defined(_DM_BUFFER_H_)
+
+PUBLIC Bool glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer,
+ DMparams *params, DMbuffer dmbuffer)
+{
+ (void) dpy;
+ (void) pbuffer;
+ (void) params;
+ (void) dmbuffer;
+ return False;
+}
+
+#endif
+
+
+/*
+** GLX_SGIX_swap_group
+*/
+PUBLIC void glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable,
+ GLXDrawable member)
+{
+ (void) dpy;
+ (void) drawable;
+ (void) member;
+}
+
+
+/*
+** GLX_SGIX_swap_barrier
+*/
+PUBLIC void glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable,
+ int barrier)
+{
+ (void) dpy;
+ (void) drawable;
+ (void) barrier;
+}
+
+PUBLIC Bool glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
+{
+ (void) dpy;
+ (void) screen;
+ (void) max;
+ return False;
+}
+
+
+/*
+** GLX_SUN_get_transparent_index
+*/
+PUBLIC Status glXGetTransparentIndexSUN(Display *dpy, Window overlay,
+ Window underlay, long *pTransparent)
+{
+ (void) dpy;
+ (void) overlay;
+ (void) underlay;
+ (void) pTransparent;
+ return 0;
+}
+
+
+/*
+** GLX_OML_sync_control
+*/
+PUBLIC Bool glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
+ int64_t *ust, int64_t *msc, int64_t *sbc)
+{
+#ifdef GLX_DIRECT_RENDERING
+ __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
+
+ if ( priv != NULL ) {
+ int i;
+ __DRIdrawable * const pdraw = GetDRIDrawable( dpy, drawable, & i );
+ __GLXscreenConfigs * const psc = &priv->screenConfigs[i];
+
+ assert( (pdraw == NULL) || (i != -1) );
+ return ( (pdraw && pdraw->getSBC && psc->driScreen.getMSC)
+ && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )
+ && ((*psc->driScreen.getMSC)( psc->driScreen.private, msc ) == 0)
+ && ((*pdraw->getSBC)( dpy, psc->driScreen.private, sbc ) == 0)
+ && (__glXGetUST( ust ) == 0) );
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+ (void) ust;
+ (void) msc;
+ (void) sbc;
+#endif
+ return False;
+}
+
+
+/**
+ * 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.
+ */
+
+PUBLIC Bool glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
+ int32_t * numerator, int32_t * denominator)
+{
+#if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
+ __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
+
+
+ if ( priv != NULL ) {
+ XF86VidModeModeLine mode_line;
+ int dot_clock;
+ int screen_num;
+ int i;
+
+
+ GetDRIDrawable( dpy, drawable, & screen_num );
+ if ( (screen_num != -1)
+ && XF86VidModeQueryVersion( dpy, & i, & i )
+ && XF86VidModeGetModeLine( dpy, screen_num, & 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;
+
+ (void) drawable;
+ return True;
+ }
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+ (void) numerator;
+ (void) denominator;
+#endif
+ return False;
+}
+
+
+PUBLIC int64_t glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable,
+ int64_t target_msc, int64_t divisor,
+ int64_t remainder)
+{
+#ifdef GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen );
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
+
+ /* 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;
+
+ if ( (pdraw != NULL) && (pdraw->swapBuffersMSC != NULL)
+ && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) {
+ return (*pdraw->swapBuffersMSC)(dpy, pdraw->private, target_msc,
+ divisor, remainder);
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+ (void) target_msc;
+ (void) divisor;
+ (void) remainder;
+#endif
+ return 0;
+}
+
+
+PUBLIC 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)
+{
+#ifdef GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen );
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
+ int ret;
+
+ /* 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;
+
+ if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL)
+ && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) {
+ ret = (*pdraw->waitForMSC)( dpy, pdraw->private, 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) );
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+ (void) target_msc;
+ (void) divisor;
+ (void) remainder;
+ (void) ust;
+ (void) msc;
+ (void) sbc;
+#endif
+ return False;
+}
+
+
+PUBLIC Bool glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
+ int64_t target_sbc, int64_t *ust,
+ int64_t *msc, int64_t *sbc )
+{
+#ifdef GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable *pdraw = GetDRIDrawable( 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;
+
+ if ( (pdraw != NULL) && (pdraw->waitForSBC != NULL)
+ && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )) {
+ ret = (*pdraw->waitForSBC)( dpy, pdraw->private, 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) );
+ }
+#else
+ (void) dpy;
+ (void) drawable;
+ (void) target_sbc;
+ (void) ust;
+ (void) msc;
+ (void) sbc;
+#endif
+ return False;
+}
+
+
+/**
+ * GLX_MESA_allocate_memory
+ */
+/*@{*/
+
+PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn,
+ size_t size, float readFreq,
+ float writeFreq, float priority)
+{
+#ifdef GLX_DIRECT_RENDERING
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
+
+ if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
+ if (psc && psc->driScreen.private && psc->driScreen.allocateMemory) {
+ return (*psc->driScreen.allocateMemory)( dpy, scrn, size,
+ readFreq, writeFreq,
+ priority );
+ }
+ }
+#else
+ (void) dpy;
+ (void) scrn;
+ (void) size;
+ (void) readFreq;
+ (void) writeFreq;
+ (void) priority;
+#endif /* GLX_DIRECT_RENDERING */
+
+ return NULL;
+}
+
+
+PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
+{
+#ifdef GLX_DIRECT_RENDERING
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
+
+ if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
+ if (psc && psc->driScreen.private && psc->driScreen.freeMemory) {
+ (*psc->driScreen.freeMemory)( dpy, scrn, pointer );
+ }
+ }
+#else
+ (void) dpy;
+ (void) scrn;
+ (void) pointer;
+#endif /* GLX_DIRECT_RENDERING */
+}
+
+
+PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
+ const void *pointer )
+{
+#ifdef GLX_DIRECT_RENDERING
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn );
+
+ if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
+ if (psc && psc->driScreen.private && psc->driScreen.memoryOffset) {
+ return (*psc->driScreen.memoryOffset)( dpy, scrn, 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
+ */
+PUBLIC 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;
+}
+
+#define X_GLXvop_CopySubBufferMESA 5154 /* temporary */
+PUBLIC 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 GLX_DIRECT_RENDERING
+ int screen;
+ __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen );
+ if ( pdraw != NULL ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
+ if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) {
+ (*pdraw->copySubBuffer)(dpy, pdraw->private, 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();
+}
+
+PUBLIC Bool glXSet3DfxModeMESA( int mode )
+{
+ (void) mode;
+ return GL_FALSE;
+}
+/*@}*/
+
+PUBLIC 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->isDirect)
+ 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();
+}
+
+PUBLIC 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->isDirect)
+ 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
+ */
+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_FUNCTION( glXSwapIntervalSGI ),
+
+ /*** GLX_SGI_video_sync ***/
+ GLX_FUNCTION( glXGetVideoSyncSGI ),
+ GLX_FUNCTION( glXWaitVideoSyncSGI ),
+
+ /*** GLX_SGI_make_current_read ***/
+ GLX_FUNCTION2( glXMakeCurrentReadSGI, glXMakeContextCurrent ),
+ GLX_FUNCTION2( glXGetCurrentReadDrawableSGI, glXGetCurrentReadDrawable ),
+
+ /*** GLX_SGIX_video_source ***/
+#if defined(_VL_H)
+ GLX_FUNCTION( glXCreateGLXVideoSourceSGIX ),
+ GLX_FUNCTION( glXDestroyGLXVideoSourceSGIX ),
+#endif
+
+ /*** 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_SGI_cushion ***/
+ GLX_FUNCTION( glXCushionSGI ),
+
+ /*** GLX_SGIX_video_resize ***/
+ GLX_FUNCTION( glXBindChannelToWindowSGIX ),
+ GLX_FUNCTION( glXChannelRectSGIX ),
+ GLX_FUNCTION( glXQueryChannelRectSGIX ),
+ GLX_FUNCTION( glXQueryChannelDeltasSGIX ),
+ GLX_FUNCTION( glXChannelRectSyncSGIX ),
+
+ /*** GLX_SGIX_dmbuffer **/
+#if defined(_DM_BUFFER_H_)
+ GLX_FUNCTION( glXAssociateDMPbufferSGIX ),
+#endif
+
+ /*** GLX_SGIX_swap_group ***/
+ GLX_FUNCTION( glXJoinSwapGroupSGIX ),
+
+ /*** GLX_SGIX_swap_barrier ***/
+ GLX_FUNCTION( glXBindSwapBarrierSGIX ),
+ GLX_FUNCTION( glXQueryMaxSwapBarriersSGIX ),
+
+ /*** GLX_SUN_get_transparent_index ***/
+ GLX_FUNCTION( glXGetTransparentIndexSUN ),
+
+ /*** GLX_MESA_allocate_memory ***/
+ GLX_FUNCTION( glXAllocateMemoryMESA ),
+ GLX_FUNCTION( glXFreeMemoryMESA ),
+ GLX_FUNCTION( glXGetMemoryOffsetMESA ),
+
+ /*** GLX_MESA_copy_sub_buffer ***/
+ GLX_FUNCTION( glXCopySubBufferMESA ),
+
+ /*** GLX_MESA_pixmap_colormap ***/
+ GLX_FUNCTION( glXCreateGLXPixmapMESA ),
+
+ /*** GLX_MESA_release_buffers ***/
+ GLX_FUNCTION( glXReleaseBuffersMESA ),
+
+ /*** GLX_MESA_set_3dfx_mode ***/
+ GLX_FUNCTION( glXSet3DfxModeMESA ),
+
+ /*** GLX_MESA_swap_control ***/
+ GLX_FUNCTION( glXSwapIntervalMESA ),
+ GLX_FUNCTION( glXGetSwapIntervalMESA ),
+
+ /*** GLX_MESA_swap_frame_usage ***/
+ GLX_FUNCTION( glXBeginFrameTrackingMESA ),
+ GLX_FUNCTION( glXEndFrameTrackingMESA ),
+ GLX_FUNCTION( glXGetFrameUsageMESA ),
+ GLX_FUNCTION( glXQueryFrameTrackingMESA ),
+
+ /*** GLX_ARB_get_proc_address ***/
+ GLX_FUNCTION( glXGetProcAddressARB ),
+
+ /*** GLX 1.4 ***/
+ GLX_FUNCTION2( glXGetProcAddress, glXGetProcAddressARB ),
+
+ /*** GLX_OML_sync_control ***/
+ GLX_FUNCTION( glXWaitForSbcOML ),
+ GLX_FUNCTION( glXWaitForMscOML ),
+ GLX_FUNCTION( glXSwapBuffersMscOML ),
+ GLX_FUNCTION( glXGetMscRateOML ),
+ GLX_FUNCTION( glXGetSyncValuesOML ),
+
+ /*** GLX_EXT_texture_from_pixmap ***/
+ GLX_FUNCTION( glXBindTexImageEXT ),
+ GLX_FUNCTION( 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
+/**
+ * Retrieves the verion of the internal libGL API in YYYYMMDD format. This
+ * might be used by the DRI drivers to determine how new libGL is at runtime.
+ * Drivers should not call this function directly. They should instead use
+ * \c glXGetProcAddress to obtain a pointer to the function.
+ *
+ * \returns An 8-digit decimal number representing the internal libGL API in
+ * YYYYMMDD format.
+ *
+ * \sa glXGetProcAddress, PFNGLXGETINTERNALVERSIONPROC
+ *
+ * \since Internal API version 20021121.
+ */
+int __glXGetInternalVersion(void)
+{
+ /* History:
+ * 20021121 - Initial version
+ * 20021128 - Added __glXWindowExists() function
+ * 20021207 - Added support for dynamic GLX extensions,
+ * GLX_SGI_swap_control, GLX_SGI_video_sync,
+ * GLX_OML_sync_control, and GLX_MESA_swap_control.
+ * Never officially released. Do NOT test against
+ * this version. Use 20030317 instead.
+ * 20030317 - Added support GLX_SGIX_fbconfig,
+ * GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
+ * GLX_{ARB,SGIS}_multisample, and
+ * GLX_SGIX_visual_select_group.
+ * 20030606 - Added support for GLX_SGI_make_current_read.
+ * 20030813 - Made support for dynamic extensions multi-head aware.
+ * 20030818 - Added support for GLX_MESA_allocate_memory in place of the
+ * deprecated GLX_NV_vertex_array_range & GLX_MESA_agp_offset
+ * interfaces.
+ * 20031201 - Added support for the first round of DRI interface changes.
+ * Do NOT test against this version! It has binary
+ * compatibility bugs, use 20040317 instead.
+ * 20040317 - Added the 'mode' field to __DRIcontextRec.
+ * 20040415 - Added support for bindContext3 and unbindContext3.
+ * 20040602 - Add __glXGetDrawableInfo. I though that was there
+ * months ago. :(
+ * 20050727 - Gut all the old interfaces. This breaks compatability with
+ * any DRI driver built to any previous version.
+ * 20060314 - Added support for GLX_MESA_copy_sub_buffer.
+ */
+ return 20060314;
+}
+
+
+
+static Bool windowExistsFlag;
+
+static int windowExistsErrorHandler(Display *dpy, XErrorEvent *xerr)
+{
+ if (xerr->error_code == BadWindow) {
+ windowExistsFlag = GL_FALSE;
+ }
+ return 0;
+}
+
+/**
+ * Determine if a window associated with a \c GLXDrawable exists on the
+ * X-server. This function is not used internally by libGL. It is provided
+ * as a utility function for DRI drivers.
+ * Drivers should not call this function directly. They should instead use
+ * \c glXGetProcAddress to obtain a pointer to the function.
+ *
+ * \param dpy Display associated with the drawable to be queried.
+ * \param draw \c GLXDrawable to test.
+ *
+ * \returns \c GL_TRUE if a window exists that is associated with \c draw,
+ * otherwise \c GL_FALSE is returned.
+ *
+ * \warning This function is not currently thread-safe.
+ *
+ * \sa glXGetProcAddress
+ *
+ * \since Internal API version 20021128.
+ */
+Bool __glXWindowExists(Display *dpy, GLXDrawable draw)
+{
+ XWindowAttributes xwa;
+ int (*oldXErrorHandler)(Display *, XErrorEvent *);
+
+ XSync(dpy, GL_FALSE);
+ windowExistsFlag = GL_TRUE;
+ oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler);
+ XGetWindowAttributes(dpy, draw, &xwa); /* dummy request */
+ XSetErrorHandler(oldXErrorHandler);
+ return windowExistsFlag;
+}
+
+
+/**
+ * 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.
+ */
+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/glxext.c b/src/glx/x11/glxext.c
new file mode 100644
index 0000000..7ceed42
--- /dev/null
+++ b/src/glx/x11/glxext.c
@@ -0,0 +1,1884 @@
+/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.22 2003/12/08 17:35:28 dawes Exp $ */
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/**
+ * \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 "glxclient.h"
+#include <stdio.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <assert.h>
+#include "indirect_init.h"
+#include "glapi.h"
+#include "glxextensions.h"
+#include "glcontextmodes.h"
+#include "glheader.h"
+
+#ifdef GLX_DIRECT_RENDERING
+#include <inttypes.h>
+#include <sys/mman.h>
+#include "xf86dri.h"
+#include "sarea.h"
+#include "dri_glx.h"
+#endif
+
+#ifdef USE_XCB
+#include <X11/xcl.h>
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/glx.h>
+#endif
+
+#include <assert.h>
+
+#ifdef DEBUG
+void __glXDumpDrawBuffer(__GLXcontext *ctx);
+#endif
+
+#ifdef USE_SPARC_ASM
+/*
+ * This is where our dispatch table's bounds are.
+ * And the static mesa_init is taken directly from
+ * Mesa's 'sparc.c' initializer.
+ *
+ * We need something like this here, because this version
+ * of openGL/glx never initializes a Mesa context, and so
+ * the address of the dispatch table pointer never gets stuffed
+ * into the dispatch jump table otherwise.
+ *
+ * It matters only on SPARC, and only if you are using assembler
+ * code instead of C-code indirect dispatch.
+ *
+ * -- FEM, 04.xii.03
+ */
+extern unsigned int _mesa_sparc_glapi_begin;
+extern unsigned int _mesa_sparc_glapi_end;
+extern void __glapi_sparc_icache_flush(unsigned int *);
+static void _glx_mesa_init_sparc_glapi_relocs(void);
+static int _mesa_sparc_needs_init = 1;
+#define INIT_MESA_SPARC { \
+ if(_mesa_sparc_needs_init) { \
+ _glx_mesa_init_sparc_glapi_relocs(); \
+ _mesa_sparc_needs_init = 0; \
+ } \
+}
+#else
+#define INIT_MESA_SPARC
+#endif
+
+#ifdef GLX_DIRECT_RENDERING
+static __DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn);
+#endif /* GLX_DIRECT_RENDERING */
+
+static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
+ GLXDrawable read, GLXContext gc);
+
+/*
+** 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( USE_XTHREADS )
+
+/* thread safe */
+static GLboolean TSDinitialized = GL_FALSE;
+static xthread_key_t ContextTSD;
+
+__GLXcontext *__glXGetCurrentContext(void)
+{
+ if (!TSDinitialized) {
+ xthread_key_create(&ContextTSD, NULL);
+ TSDinitialized = GL_TRUE;
+ return &dummyContext;
+ }
+ else {
+ void *p;
+ xthread_get_specific(ContextTSD, &p);
+ if (!p)
+ return &dummyContext;
+ else
+ return (__GLXcontext *) p;
+ }
+}
+
+void __glXSetCurrentContext(__GLXcontext *c)
+{
+ if (!TSDinitialized) {
+ xthread_key_create(&ContextTSD, NULL);
+ TSDinitialized = GL_TRUE;
+ }
+ xthread_set_specific(ContextTSD, c);
+}
+
+
+/* Used by the __glXLock() and __glXUnlock() macros */
+xmutex_rec __glXmutex;
+
+#elif defined( PTHREADS )
+
+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;
+
+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 );
+ }
+}
+
+void __glXSetCurrentContext( __GLXcontext * c )
+{
+ pthread_once( & once_control, init_thread_data );
+ pthread_setspecific( ContextTSD, c );
+}
+
+__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 */
+__GLXcontext *__glXcurrentContext = &dummyContext;
+
+#endif
+
+
+/*
+** You can set this cell to 1 to force the gl drawing stuff to be
+** one command per packet
+*/
+int __glXDebug = 0;
+
+/*
+** forward prototype declarations
+*/
+int __glXCloseDisplay(Display *dpy, XExtCodes *codes);
+
+
+/************************************************************************/
+
+/* 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",
+};
+
+int __glXCloseDisplay(Display *dpy, XExtCodes *codes)
+{
+ GLXContext gc;
+
+ gc = __glXGetCurrentContext();
+ if (dpy == gc->currentDpy) {
+ __glXSetCurrentContext(&dummyContext);
+#ifdef GLX_DIRECT_RENDERING
+ _glapi_set_dispatch(NULL); /* no-op functions */
+#endif
+ __glXFreeContext(gc);
+ }
+
+ return XextRemoveDisplay(__glXExtensionInfo, dpy);
+}
+
+
+static XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
+ __GLX_NUMBER_ERRORS, error_list)
+
+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 */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ __glXErrorString, /* error_string */
+};
+
+static
+XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
+ __glXExtensionName, &__glXExtensionHooks,
+ __GLX_NUMBER_EVENTS, NULL)
+
+/************************************************************************/
+
+/*
+** 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 */
+ }
+ Xfree((char*) psc->serverGLXexts);
+
+#ifdef GLX_DIRECT_RENDERING
+ /* Free the direct rendering per screen data */
+ if (psc->driScreen.private)
+ (*psc->driScreen.destroyScreen)(priv->dpy, i,
+ psc->driScreen.private);
+ psc->driScreen.private = NULL;
+#endif
+ }
+ XFree((char*) priv->screenConfigs);
+}
+
+/*
+** 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->driDisplay.private)
+ (*priv->driDisplay.destroyDisplay)(priv->dpy,
+ priv->driDisplay.private);
+ priv->driDisplay.private = 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)
+{
+ 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;
+}
+
+
+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);
+}
+
+
+#ifdef GLX_DIRECT_RENDERING
+static unsigned
+filter_modes( __GLcontextModes ** server_modes,
+ const __GLcontextModes * driver_modes )
+{
+ __GLcontextModes * m;
+ __GLcontextModes ** prev_next;
+ const __GLcontextModes * check;
+ unsigned modes_count = 0;
+
+ if ( driver_modes == NULL ) {
+ fprintf(stderr, "libGL warning: 3D driver returned no fbconfigs.\n");
+ return 0;
+ }
+
+ /* For each mode in server_modes, check to see if a matching mode exists
+ * in driver_modes. If not, then the mode is not available.
+ */
+
+ prev_next = server_modes;
+ for ( m = *prev_next ; m != NULL ; m = *prev_next ) {
+ GLboolean do_delete = GL_TRUE;
+
+ for ( check = driver_modes ; check != NULL ; check = check->next ) {
+ if ( _gl_context_modes_are_same( m, check ) ) {
+ do_delete = GL_FALSE;
+ break;
+ }
+ }
+
+ /* The 3D has to support all the modes that match the GLX visuals
+ * sent from the X server.
+ */
+ if ( do_delete && (m->visualID != 0) ) {
+ do_delete = GL_FALSE;
+
+ fprintf(stderr, "libGL warning: 3D driver claims to not support "
+ "visual 0x%02x\n", m->visualID);
+ }
+
+ if ( do_delete ) {
+ *prev_next = m->next;
+
+ m->next = NULL;
+ _gl_context_modes_destroy( m );
+ }
+ else {
+ modes_count++;
+ prev_next = & m->next;
+ }
+ }
+
+ return modes_count;
+}
+
+
+/**
+ * Implement \c __DRIinterfaceMethods::getProcAddress.
+ */
+static __DRIfuncPtr get_proc_address( const char * proc_name )
+{
+ if (strcmp( proc_name, "glxEnableExtension" ) == 0) {
+ return (__DRIfuncPtr) __glXScrEnableExtension;
+ }
+
+ 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,
+
+ XF86DRICreateContextWithConfig,
+ XF86DRIDestroyContext,
+
+ XF86DRICreateDrawable,
+ XF86DRIDestroyDrawable,
+ XF86DRIGetDrawableInfo,
+
+ __glXGetUST,
+ glXGetMscRateOML,
+};
+
+
+/**
+ * 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 __DRIscreenPrivate structure returned by
+ * the client-side driver on success, or \c NULL on failure.
+ *
+ * \todo This function needs to be modified to remove context-modes from the
+ * list stored in the \c __GLXscreenConfigsRec to match the list
+ * returned by the client-side driver.
+ */
+static void *
+CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc,
+ __DRIdisplay * driDpy,
+ PFNCREATENEWSCREENFUNC createNewScreen)
+{
+ __DRIscreenPrivate *psp = NULL;
+#ifndef GLX_USE_APPLEGL
+ 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;
+ const char * err_msg;
+ const char * err_extra;
+ int api_ver = __glXGetInternalVersion();
+
+
+ dri_version.major = driDpy->private->driMajor;
+ dri_version.minor = driDpy->private->driMinor;
+ dri_version.patch = driDpy->private->driPatch;
+
+
+ err_msg = "XF86DRIOpenConnection";
+ err_extra = NULL;
+
+ framebuffer.base = MAP_FAILED;
+ framebuffer.dev_priv = NULL;
+
+ if (XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) {
+ fd = drmOpen(NULL,BusID);
+ Xfree(BusID); /* No longer needed */
+
+ err_msg = "open DRM";
+ err_extra = strerror( -fd );
+
+ if (fd >= 0) {
+ drm_magic_t magic;
+
+ err_msg = "drmGetMagic";
+ err_extra = NULL;
+
+ if (!drmGetMagic(fd, &magic)) {
+ drmVersionPtr 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;
+ }
+
+ err_msg = "XF86DRIAuthConnection";
+ if (XF86DRIAuthConnection(dpy, scrn, magic)) {
+ char *driverName;
+
+ /*
+ * Get device name (like "tdfx") and the ddx version
+ * numbers. We'll check the version in each DRI driver's
+ * "createNewScreen" function.
+ */
+ err_msg = "XF86DRIGetClientDriverName";
+ if (XF86DRIGetClientDriverName(dpy, scrn,
+ &ddx_version.major,
+ &ddx_version.minor,
+ &ddx_version.patch,
+ &driverName)) {
+ drm_handle_t hFB;
+ int junk;
+
+ /* No longer needed. */
+ Xfree( driverName );
+
+
+ /*
+ * 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.
+ */
+ err_msg = "XF86DRIGetDeviceInfo";
+ if (XF86DRIGetDeviceInfo(dpy, scrn,
+ &hFB,
+ &junk,
+ &framebuffer.size,
+ &framebuffer.stride,
+ &framebuffer.dev_priv_size,
+ &framebuffer.dev_priv)) {
+ framebuffer.width = DisplayWidth(dpy, scrn);
+ framebuffer.height = DisplayHeight(dpy, scrn);
+
+ /*
+ * 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 ) {
+ /*
+ * Map the SAREA region. Further mmap regions
+ * may be setup in each DRI driver's
+ * "createNewScreen" function.
+ */
+ status = drmMap(fd, hSAREA, SAREA_MAX,
+ &pSAREA);
+
+ err_msg = "drmMap of sarea";
+ err_extra = strerror( -status );
+
+ if ( status == 0 ) {
+ __GLcontextModes * driver_modes = NULL;
+ __GLXscreenConfigs *configs = psc->screenConfigs;
+
+ err_msg = "InitDriver";
+ err_extra = NULL;
+ psp = (*createNewScreen)(dpy, scrn,
+ psc,
+ configs->configs,
+ & ddx_version,
+ & dri_version,
+ & drm_version,
+ & framebuffer,
+ pSAREA,
+ fd,
+ api_ver,
+ & interface_methods,
+ & driver_modes );
+
+ filter_modes( & configs->configs,
+ driver_modes );
+ _gl_context_modes_destroy( driver_modes );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ 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 ) {
+ Xfree(framebuffer.dev_priv);
+ }
+
+ if ( fd >= 0 ) {
+ (void)drmClose(fd);
+ }
+
+ (void)XF86DRICloseConnection(dpy, scrn);
+
+ 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");
+ }
+#endif /* !GLX_USE_APPLEGL */
+
+ return psp;
+}
+#endif /* GLX_DIRECT_RENDERING */
+
+
+/*
+** 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)
+{
+ xGLXGetVisualConfigsReq *req;
+ xGLXGetFBConfigsReq *fb_req;
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXGetFBConfigsSGIXReq *sgi_req;
+ xGLXGetVisualConfigsReply reply;
+ __GLXscreenConfigs *psc;
+ __GLcontextModes *config;
+ GLint i, j, nprops, screens;
+ INT32 buf[__GLX_TOTAL_CONFIG], *props;
+ unsigned supported_request = 0;
+ unsigned prop_size;
+
+ /*
+ ** 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 = __glXGetStringFromServer(dpy, priv->majorOpcode,
+ X_GLXQueryServerString,
+ 0, GLX_VERSION);
+ if ( priv->serverGLXversion == NULL ) {
+ FreeScreenConfigs(priv);
+ return GL_FALSE;
+ }
+
+ if ( atof( priv->serverGLXversion ) >= 1.3 ) {
+ supported_request = 1;
+ }
+
+ /*
+ ** Now fetch each screens configs structures. If a screen supports
+ ** GL (by returning a numVisuals > 0) then allocate memory for our
+ ** config structure and then fill it in.
+ */
+ for (i = 0; i < screens; i++, psc++) {
+ if ( supported_request != 1 ) {
+ psc->serverGLXexts = __glXGetStringFromServer(dpy, priv->majorOpcode,
+ X_GLXQueryServerString,
+ i, GLX_EXTENSIONS);
+ if ( strstr( psc->serverGLXexts, "GLX_SGIX_fbconfig" ) != NULL ) {
+ supported_request = 2;
+ }
+ else {
+ supported_request = 3;
+ }
+ }
+
+
+ LockDisplay(dpy);
+ switch( supported_request ) {
+ case 1:
+ GetReq(GLXGetFBConfigs,fb_req);
+ fb_req->reqType = priv->majorOpcode;
+ fb_req->glxCode = X_GLXGetFBConfigs;
+ fb_req->screen = i;
+ break;
+
+ case 2:
+ 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 = i;
+ break;
+
+ case 3:
+ GetReq(GLXGetVisualConfigs,req);
+ req->reqType = priv->majorOpcode;
+ req->glxCode = X_GLXGetVisualConfigs;
+ req->screen = i;
+ break;
+ }
+
+ if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+ /* Something is busted. Punt. */
+ UnlockDisplay(dpy);
+ FreeScreenConfigs(priv);
+ return GL_FALSE;
+ }
+
+ UnlockDisplay(dpy);
+ if (!reply.numVisuals) {
+ /* This screen does not support GL rendering */
+ UnlockDisplay(dpy);
+ continue;
+ }
+
+ /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for
+ * FIXME: FBconfigs?
+ */
+ /* Check number of properties */
+ nprops = reply.numProps;
+ if ((nprops < __GLX_MIN_CONFIG_PROPS) ||
+ (nprops > __GLX_MAX_CONFIG_PROPS)) {
+ /* Huh? Not in protocol defined limits. Punt */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ FreeScreenConfigs(priv);
+ return GL_FALSE;
+ }
+
+ /* Allocate memory for our config structure */
+ psc->configs = _gl_context_modes_create(reply.numVisuals,
+ sizeof(__GLcontextModes));
+ if (!psc->configs) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ FreeScreenConfigs(priv);
+ return GL_FALSE;
+ }
+
+ /* Allocate memory for the properties, if needed */
+ if ( supported_request != 3 ) {
+ nprops *= 2;
+ }
+
+ prop_size = nprops * __GLX_SIZE_INT32;
+
+ if (prop_size <= sizeof(buf)) {
+ props = buf;
+ } else {
+ props = (INT32 *) Xmalloc(prop_size);
+ }
+
+ /* Read each config structure and convert it into our format */
+ config = psc->configs;
+ for (j = 0; j < reply.numVisuals; j++) {
+ assert( config != NULL );
+ _XRead(dpy, (char *)props, prop_size);
+
+ if ( supported_request != 3 ) {
+ config->rgbMode = GL_TRUE;
+ config->drawableType = GLX_WINDOW_BIT;
+ }
+ else {
+ config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+ }
+
+ __glXInitializeVisualConfigFromTags( config, nprops, props,
+ (supported_request != 3),
+ GL_TRUE );
+ if ( config->fbconfigID == GLX_DONT_CARE ) {
+ config->fbconfigID = config->visualID;
+ }
+ config->screen = i;
+ config = config->next;
+ }
+ if (props != buf) {
+ Xfree((char *)props);
+ }
+ UnlockDisplay(dpy);
+
+#ifdef GLX_DIRECT_RENDERING
+ /* Initialize per screen dynamic client GLX extensions */
+ psc->ext_list_first_time = GL_TRUE;
+ /* Initialize the direct rendering per screen data and functions */
+ if (priv->driDisplay.private != NULL) {
+ /* FIXME: Should it be some sort of an error if createNewScreen[i]
+ * FIXME: is NULL?
+ */
+ if (priv->driDisplay.createNewScreen &&
+ priv->driDisplay.createNewScreen[i]) {
+
+ psc->driScreen.screenConfigs = (void *)psc;
+ psc->driScreen.private =
+ CallCreateNewScreen(dpy, i, & psc->driScreen,
+ & priv->driDisplay,
+ priv->driDisplay.createNewScreen[i] );
+ }
+ }
+#endif
+ }
+ SyncHandle();
+ return GL_TRUE;
+}
+
+/*
+** Initialize the client side extension code.
+*/
+__GLXdisplayPrivate *__glXInitialize(Display* dpy)
+{
+ XExtDisplayInfo *info = __glXFindDisplay(dpy);
+ XExtData **privList, *private, *found;
+ __GLXdisplayPrivate *dpyPriv;
+ XEDataObject dataObj;
+ int major, minor;
+
+#if defined(USE_XTHREADS)
+ {
+ static int firstCall = 1;
+ if (firstCall) {
+ /* initialize the GLX mutexes */
+ xmutex_init(&__glXmutex);
+ firstCall = 0;
+ }
+ }
+#endif
+
+ INIT_MESA_SPARC
+ /* 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 *) Xmalloc(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
+ /*
+ ** 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 (getenv("LIBGL_ALWAYS_INDIRECT")) {
+ /* Assinging zero here assures we'll never go direct */
+ dpyPriv->driDisplay.private = 0;
+ dpyPriv->driDisplay.destroyDisplay = 0;
+ }
+ else {
+ dpyPriv->driDisplay.private =
+ driCreateDisplay(dpy, &dpyPriv->driDisplay);
+ }
+#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.
+*/
+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 */
+ INIT_MESA_SPARC
+ 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.
+ */
+GLubyte *__glXFlushRenderBuffer(__GLXcontext *ctx, GLubyte *pc)
+{
+ Display * const dpy = ctx->currentDpy;
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+#else
+ xGLXRenderReq *req;
+#endif /* USE_XCB */
+ const GLint size = pc - ctx->buf;
+
+ if ( (dpy != NULL) && (size > 0) ) {
+#ifdef USE_XCB
+ XCBGlxRender(c, ctx->currentContextTag, size, (char *)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.
+ */
+void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber,
+ GLint totalRequests,
+ const GLvoid * data, GLint dataLen)
+{
+ Display *dpy = gc->currentDpy;
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ XCBGlxRenderLarge(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.
+ */
+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);
+}
+
+/************************************************************************/
+
+GLXContext glXGetCurrentContext(void)
+{
+ GLXContext cx = __glXGetCurrentContext();
+
+ if (cx == &dummyContext) {
+ return NULL;
+ } else {
+ return cx;
+ }
+}
+
+GLXDrawable glXGetCurrentDrawable(void)
+{
+ GLXContext gc = __glXGetCurrentContext();
+ return gc->currentDrawable;
+}
+
+
+/************************************************************************/
+
+#ifdef GLX_DIRECT_RENDERING
+/* Return the DRI per screen structure */
+__DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn)
+{
+ __DRIscreen *pDRIScreen = NULL;
+ XExtDisplayInfo *info = __glXFindDisplay(dpy);
+ XExtData **privList, *found;
+ __GLXdisplayPrivate *dpyPriv;
+ XEDataObject dataObj;
+
+ __glXLock();
+ dataObj.display = dpy;
+ privList = XEHeadOfExtensionList(dataObj);
+ found = XFindOnExtensionList(privList, info->codes->extension);
+ __glXUnlock();
+
+ if (found) {
+ dpyPriv = (__GLXdisplayPrivate *)found->private_data;
+ pDRIScreen = &dpyPriv->screenConfigs[scrn].driScreen;
+ }
+
+ return pDRIScreen;
+}
+#endif
+
+/************************************************************************/
+
+static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode,
+ GLXContextID gc, GLXContextTag old_gc, GLXDrawable draw, GLXDrawable read,
+ xGLXMakeCurrentReply * reply );
+
+/**
+ * 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 )
+{
+ 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;
+ }
+ }
+
+ return _XReply(dpy, (xReply*) reply, 0, False);
+}
+
+
+#ifdef GLX_DIRECT_RENDERING
+static Bool BindContextWrapper( Display *dpy, GLXContext gc,
+ GLXDrawable draw, GLXDrawable read )
+{
+ return (*gc->driContext.bindContext)(dpy, gc->screen, draw, read,
+ & gc->driContext);
+}
+
+
+static Bool UnbindContextWrapper( GLXContext gc )
+{
+ return (*gc->driContext.unbindContext)(gc->currentDpy, gc->screen,
+ gc->currentDrawable,
+ gc->currentReadable,
+ & gc->driContext );
+}
+#endif /* GLX_DIRECT_RENDERING */
+
+
+/*
+** Make a particular context current.
+** NOTE: this is in this file so that it can access dummyContext.
+*/
+USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
+ GLXDrawable read, GLXContext gc)
+{
+ xGLXMakeCurrentReply reply;
+ GLXContext oldGC;
+ CARD8 opcode, oldOpcode;
+ Bool sentRequestToOldDpy = False;
+ Bool bindReturnValue = True;
+
+ opcode = __glXSetupForCommand(dpy);
+ if (!opcode) {
+ 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;
+ }
+
+ oldGC = __glXGetCurrentContext();
+ oldOpcode = (gc == oldGC) ? opcode : __glXSetupForCommand(dpy);
+ if (!oldOpcode) {
+ return GL_FALSE;
+ }
+
+ if ((dpy != oldGC->currentDpy || (gc && gc->isDirect)) &&
+ !oldGC->isDirect && oldGC != &dummyContext) {
+ /*
+ ** 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.
+ */
+ sentRequestToOldDpy = True;
+ LockDisplay(oldGC->currentDpy);
+ if ( ! SendMakeCurrentRequest( oldGC->currentDpy, oldOpcode, None,
+ oldGC->currentContextTag, None, None,
+ &reply ) ) {
+ /* The make current failed. Just return GL_FALSE. */
+ UnlockDisplay(oldGC->currentDpy);
+ SyncHandle();
+ return GL_FALSE;
+ }
+
+ oldGC->currentContextTag = 0;
+ }
+
+ _glapi_check_multithread();
+
+#ifdef GLX_DIRECT_RENDERING
+ /* Unbind the old direct rendering context */
+ if (oldGC->isDirect) {
+ if (oldGC->driContext.private) {
+ if (! UnbindContextWrapper( oldGC )) {
+ /* The make current failed. Just return GL_FALSE. */
+ return GL_FALSE;
+ }
+ }
+ oldGC->currentContextTag = 0;
+ }
+
+ /* Bind the direct rendering context to the drawable */
+ if (gc && gc->isDirect) {
+ if (gc->driContext.private) {
+ bindReturnValue = BindContextWrapper( dpy, gc, draw, read );
+ }
+ } else {
+#endif
+ /* Send a glXMakeCurrent request to bind the new context. */
+ LockDisplay(dpy);
+
+ bindReturnValue = SendMakeCurrentRequest( dpy, opcode,
+ gc ? gc->xid : None,
+ oldGC->currentContextTag,
+ draw, read, &reply );
+ UnlockDisplay(dpy);
+#ifdef GLX_DIRECT_RENDERING
+ }
+#endif
+
+
+ if (!bindReturnValue) {
+ /* The make current failed. */
+ if (gc && !gc->isDirect) {
+ SyncHandle();
+ }
+
+#ifdef GLX_DIRECT_RENDERING
+ /* If the old context was direct rendering, then re-bind to it. */
+ if (oldGC->isDirect) {
+ if (oldGC->driContext.private) {
+ if (! BindContextWrapper( oldGC->currentDpy, oldGC,
+ oldGC->currentDrawable,
+ oldGC->currentReadable )) {
+ /*
+ ** The request failed; this cannot happen with the
+ ** current API. If in the future the API is
+ ** extended to allow context sharing between
+ ** clients, then this may fail (because another
+ ** client may have grabbed the context); in that
+ ** case, we cannot undo the previous request, and
+ ** cannot adhere to the "no-op" behavior.
+ */
+ }
+ }
+ } else
+#endif
+ /*
+ ** If we had just sent a request to a previous dpy, we have to
+ ** undo that request (because if a command fails, it should act
+ ** like a no-op) by making current to the previous context and
+ ** drawable.
+ */
+ if (sentRequestToOldDpy) {
+ if ( !SendMakeCurrentRequest( oldGC->currentDpy, oldOpcode,
+ oldGC->xid, 0,
+ oldGC->currentDrawable,
+ oldGC->currentReadable, &reply ) ) {
+ UnlockDisplay(oldGC->currentDpy);
+ SyncHandle();
+ /*
+ ** The request failed; this cannot happen with the
+ ** current API. If in the future the API is extended to
+ ** allow context sharing between clients, then this may
+ ** fail (because another client may have grabbed the
+ ** context); in that case, we cannot undo the previous
+ ** request, and cannot adhere to the "no-op" behavior.
+ */
+ }
+ else {
+ UnlockDisplay(oldGC->currentDpy);
+ }
+ oldGC->currentContextTag = reply.contextTag;
+ }
+ return GL_FALSE;
+ }
+
+ /* 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;
+
+ 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->isDirect) {
+ if (oldGC->driContext.private) {
+ (*oldGC->driContext.destroyContext)
+ (dpy, oldGC->screen, oldGC->driContext.private);
+ oldGC->driContext.private = NULL;
+ }
+ }
+#endif
+ __glXFreeContext(oldGC);
+ }
+ }
+ if (gc) {
+ __glXSetCurrentContext(gc);
+#ifdef GLX_DIRECT_RENDERING
+ if (!gc->isDirect) {
+ if (!IndirectAPI)
+ IndirectAPI = __glXNewIndirectAPI();
+ _glapi_set_dispatch(IndirectAPI);
+# ifdef GLX_USE_APPLEGL
+ do {
+ extern void XAppleDRIUseIndirectDispatch(void);
+ XAppleDRIUseIndirectDispatch();
+ } while (0);
+# endif
+ }
+#else
+ /* if not direct rendering, always need indirect dispatch */
+ if (!IndirectAPI)
+ IndirectAPI = __glXNewIndirectAPI();
+ _glapi_set_dispatch(IndirectAPI);
+#endif
+ gc->currentDpy = dpy;
+ gc->currentDrawable = draw;
+ gc->currentReadable = read;
+
+ if ( ! gc->isDirect ) {
+ __GLXattribute * 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);
+ }
+ }
+ else {
+ gc->currentContextTag = -1;
+ }
+ } else {
+ __glXSetCurrentContext(&dummyContext);
+#ifdef GLX_DIRECT_RENDERING
+ _glapi_set_dispatch(NULL); /* no-op functions */
+#endif
+ }
+ }
+ __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)
+
+
+#ifdef DEBUG
+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
+
+#ifdef USE_SPARC_ASM
+/*
+ * Used only when we are sparc, using sparc assembler.
+ *
+ */
+
+static void
+_glx_mesa_init_sparc_glapi_relocs(void)
+{
+ unsigned int *insn_ptr, *end_ptr;
+ unsigned long disp_addr;
+
+ insn_ptr = &_mesa_sparc_glapi_begin;
+ end_ptr = &_mesa_sparc_glapi_end;
+ disp_addr = (unsigned long) &_glapi_Dispatch;
+
+ /*
+ * Verbatim from Mesa sparc.c. It's needed because there doesn't
+ * seem to be a better way to do this:
+ *
+ * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
+ *
+ * This code is patching in the ADDRESS of the pointer to the
+ * dispatch table. Hence, it must be called exactly once, because
+ * that address is not going to change.
+ *
+ * What it points to can change, but Mesa (and hence, we) assume
+ * that there is only one pointer.
+ *
+ */
+ while (insn_ptr < end_ptr) {
+#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )
+/*
+ This code patches for 64-bit addresses. This had better
+ not happen for Sparc/Linux, no matter what architecture we
+ are building for. So, don't do this.
+
+ The 'defined(__linux_64__)' is used here as a placeholder for
+ when we do do 64-bit usermode on sparc linux.
+ */
+ insn_ptr[0] |= (disp_addr >> (32 + 10));
+ insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
+ __glapi_sparc_icache_flush(&insn_ptr[0]);
+ insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
+ insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&insn_ptr[2]);
+ insn_ptr += 11;
+#else
+ insn_ptr[0] |= (disp_addr >> 10);
+ insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&insn_ptr[0]);
+ insn_ptr += 5;
+#endif
+ }
+}
+#endif /* sparc ASM in use */
+
diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c
new file mode 100644
index 0000000..d00bdbb
--- /dev/null
+++ b/src/glx/x11/glxextensions.c
@@ -0,0 +1,724 @@
+/*
+ * (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 "glapi.h"
+#include "glxextensions.h"
+#include "simple_list.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?
+ */
+};
+
+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_set_3dfx_mode), 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_cushion), VER(0,0), N, N, N, N },
+ { 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_dm_buffer), VER(0,0), N, N, N, N },
+ { GLX(SGIX_fbconfig), VER(1,3), Y, Y, N, N },
+ { GLX(SGIX_pbuffer), VER(1,3), Y, N, 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_video_resize), VER(0,0), N, N, N, N },
+ { GLX(SGIX_video_source), VER(0,0), N, N, N, N },
+ { GLX(SGIX_visual_select_group), VER(0,0), Y, Y, N, N },
+ { GLX(SUN_get_transparent_index), VER(0,0), N, N, N, N },
+ { GLX(EXT_texture_from_pixmap), VER(0,0), Y, N, 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_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), N, 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_object), VER(0,0), Y, N, N, N },
+ { GL(EXT_multi_draw_arrays), VER(1,4), Y, N, Y, 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_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_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 }
+};
+
+
+/* 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 */
+ }
+ }
+}
+
+
+/**
+ * Enable a named GLX extension on a given screen.
+ * Drivers should not call this function directly. They should instead use
+ * \c glXGetProcAddress to obtain a pointer to the function.
+ *
+ * \param psc Pointer to GLX per-screen record.
+ * \param name Name of the extension to enable.
+ *
+ * \sa glXGetProcAddress
+ *
+ * \since Internal API version 20030813.
+ */
+void
+__glXScrEnableExtension( __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
new file mode 100644
index 0000000..e253325
--- /dev/null
+++ b/src/glx/x11/glxextensions.h
@@ -0,0 +1,281 @@
+/*
+ * (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_set_3dfx_mode_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_cushion_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_dm_buffer_bit,
+ SGIX_fbconfig_bit,
+ SGIX_pbuffer_bit,
+ SGIX_swap_barrier_bit,
+ SGIX_swap_group_bit,
+ SGIX_video_resize_bit,
+ SGIX_video_source_bit,
+ SGIX_visual_select_group_bit,
+ SUN_get_transparent_index_bit,
+ EXT_texture_from_pixmap_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_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_object_bit,
+ GL_EXT_multi_draw_arrays_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_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_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 __glXScrEnableExtension( struct __GLXscreenConfigsRec *psc, const char * name );
+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 );
+
+
+/* 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/indirect.c b/src/glx/x11/indirect.c
new file mode 100644
index 0000000..8242ee1
--- /dev/null
+++ b/src/glx/x11/indirect.c
@@ -0,0 +1,8472 @@
+/* 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 <GL/glxproto.h>
+#ifdef USE_XCB
+#include <X11/xcl.h>
+#include <X11/XCB/xcb.h>
+#include <X11/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__)
+# 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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxNewList(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;
+ const GLuint cmdlen = 0;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxEndList(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 (__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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxDeleteLists(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;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGenListsRep *reply = XCBGlxGenListsReply(c, XCBGlxGenLists(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 (__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 (__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 (__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;
+ const GLuint cmdlen = 28;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxReadPixelsRep *reply = XCBGlxReadPixelsReply(c, XCBGlxReadPixels(c, gc->currentContextTag, x, y, width, height, format, type, state->storePack.swapEndian, 0), NULL);
+ (void)memcpy(pixels, XCBGlxReadPixelsData(reply), XCBGlxReadPixelsDataLength(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;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetClipPlaneRep *reply = XCBGlxGetClipPlaneReply(c, XCBGlxGetClipPlane(c, gc->currentContextTag, plane), NULL);
+ (void)memcpy(equation, XCBGlxGetClipPlaneData(reply), XCBGlxGetClipPlaneDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetLightfvRep *reply = XCBGlxGetLightfvReply(c, XCBGlxGetLightfv(c, gc->currentContextTag, light, pname), NULL);
+ if (XCBGlxGetLightfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetLightfvData(reply), XCBGlxGetLightfvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetLightivRep *reply = XCBGlxGetLightivReply(c, XCBGlxGetLightiv(c, gc->currentContextTag, light, pname), NULL);
+ if (XCBGlxGetLightivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetLightivData(reply), XCBGlxGetLightivDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMapdvRep *reply = XCBGlxGetMapdvReply(c, XCBGlxGetMapdv(c, gc->currentContextTag, target, query), NULL);
+ if (XCBGlxGetMapdvDataLength(reply) == 0)
+ (void)memcpy(v, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(v, XCBGlxGetMapdvData(reply), XCBGlxGetMapdvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMapfvRep *reply = XCBGlxGetMapfvReply(c, XCBGlxGetMapfv(c, gc->currentContextTag, target, query), NULL);
+ if (XCBGlxGetMapfvDataLength(reply) == 0)
+ (void)memcpy(v, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(v, XCBGlxGetMapfvData(reply), XCBGlxGetMapfvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMapivRep *reply = XCBGlxGetMapivReply(c, XCBGlxGetMapiv(c, gc->currentContextTag, target, query), NULL);
+ if (XCBGlxGetMapivDataLength(reply) == 0)
+ (void)memcpy(v, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(v, XCBGlxGetMapivData(reply), XCBGlxGetMapivDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMaterialfvRep *reply = XCBGlxGetMaterialfvReply(c, XCBGlxGetMaterialfv(c, gc->currentContextTag, face, pname), NULL);
+ if (XCBGlxGetMaterialfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetMaterialfvData(reply), XCBGlxGetMaterialfvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMaterialivRep *reply = XCBGlxGetMaterialivReply(c, XCBGlxGetMaterialiv(c, gc->currentContextTag, face, pname), NULL);
+ if (XCBGlxGetMaterialivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetMaterialivData(reply), XCBGlxGetMaterialivDataLength(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;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetPixelMapfvRep *reply = XCBGlxGetPixelMapfvReply(c, XCBGlxGetPixelMapfv(c, gc->currentContextTag, map), NULL);
+ if (XCBGlxGetPixelMapfvDataLength(reply) == 0)
+ (void)memcpy(values, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(values, XCBGlxGetPixelMapfvData(reply), XCBGlxGetPixelMapfvDataLength(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;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetPixelMapuivRep *reply = XCBGlxGetPixelMapuivReply(c, XCBGlxGetPixelMapuiv(c, gc->currentContextTag, map), NULL);
+ if (XCBGlxGetPixelMapuivDataLength(reply) == 0)
+ (void)memcpy(values, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(values, XCBGlxGetPixelMapuivData(reply), XCBGlxGetPixelMapuivDataLength(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;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetPixelMapusvRep *reply = XCBGlxGetPixelMapusvReply(c, XCBGlxGetPixelMapusv(c, gc->currentContextTag, map), NULL);
+ if (XCBGlxGetPixelMapusvDataLength(reply) == 0)
+ (void)memcpy(values, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(values, XCBGlxGetPixelMapusvData(reply), XCBGlxGetPixelMapusvDataLength(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();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetPolygonStippleRep *reply = XCBGlxGetPolygonStippleReply(c, XCBGlxGetPolygonStipple(c, gc->currentContextTag, 0), NULL);
+ (void)memcpy(mask, XCBGlxGetPolygonStippleData(reply), XCBGlxGetPolygonStippleDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexEnvfvRep *reply = XCBGlxGetTexEnvfvReply(c, XCBGlxGetTexEnvfv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetTexEnvfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexEnvfvData(reply), XCBGlxGetTexEnvfvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexEnvivRep *reply = XCBGlxGetTexEnvivReply(c, XCBGlxGetTexEnviv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetTexEnvivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexEnvivData(reply), XCBGlxGetTexEnvivDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexGendvRep *reply = XCBGlxGetTexGendvReply(c, XCBGlxGetTexGendv(c, gc->currentContextTag, coord, pname), NULL);
+ if (XCBGlxGetTexGendvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexGendvData(reply), XCBGlxGetTexGendvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexGenfvRep *reply = XCBGlxGetTexGenfvReply(c, XCBGlxGetTexGenfv(c, gc->currentContextTag, coord, pname), NULL);
+ if (XCBGlxGetTexGenfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexGenfvData(reply), XCBGlxGetTexGenfvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexGenivRep *reply = XCBGlxGetTexGenivReply(c, XCBGlxGetTexGeniv(c, gc->currentContextTag, coord, pname), NULL);
+ if (XCBGlxGetTexGenivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexGenivData(reply), XCBGlxGetTexGenivDataLength(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;
+ const GLuint cmdlen = 20;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexImageRep *reply = XCBGlxGetTexImageReply(c, XCBGlxGetTexImage(c, gc->currentContextTag, target, level, format, type, state->storePack.swapEndian), NULL);
+ (void)memcpy(pixels, XCBGlxGetTexImageData(reply), XCBGlxGetTexImageDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexParameterfvRep *reply = XCBGlxGetTexParameterfvReply(c, XCBGlxGetTexParameterfv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetTexParameterfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexParameterfvData(reply), XCBGlxGetTexParameterfvDataLength(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;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexParameterivRep *reply = XCBGlxGetTexParameterivReply(c, XCBGlxGetTexParameteriv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetTexParameterivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexParameterivData(reply), XCBGlxGetTexParameterivDataLength(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;
+ const GLuint cmdlen = 12;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexLevelParameterfvRep *reply = XCBGlxGetTexLevelParameterfvReply(c, XCBGlxGetTexLevelParameterfv(c, gc->currentContextTag, target, level, pname), NULL);
+ if (XCBGlxGetTexLevelParameterfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexLevelParameterfvData(reply), XCBGlxGetTexLevelParameterfvDataLength(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;
+ const GLuint cmdlen = 12;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetTexLevelParameterivRep *reply = XCBGlxGetTexLevelParameterivReply(c, XCBGlxGetTexLevelParameteriv(c, gc->currentContextTag, target, level, pname), NULL);
+ if (XCBGlxGetTexLevelParameterivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetTexLevelParameterivData(reply), XCBGlxGetTexLevelParameterivDataLength(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;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxIsListRep *reply = XCBGlxIsListReply(c, XCBGlxIsList(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_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
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxAreTexturesResidentRep *reply = XCBGlxAreTexturesResidentReply(c, XCBGlxAreTexturesResident(c, gc->currentContextTag, n, textures), NULL);
+ (void)memcpy(residences, XCBGlxAreTexturesResidentData(reply), XCBGlxAreTexturesResidentDataLength(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));
+ retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
+ UnlockDisplay(dpy); SyncHandle();
+#endif /* USE_XCB */
+ }
+ return retval;
+}
+
+#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_GLvop_DeleteTextures 12
+void
+__indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+ if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+ GLubyte const * pc = __glXSetupVendorRequest(gc, X_GLXVendorPrivate, X_GLvop_DeleteTextures, 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;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGenTexturesRep *reply = XCBGlxGenTexturesReply(c, XCBGlxGenTextures(c, gc->currentContextTag, n), NULL);
+ (void)memcpy(textures, XCBGlxGenTexturesData(reply), XCBGlxGenTexturesDataLength(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_GLsop_IsTexture 146
+GLboolean
+__indirect_glIsTexture(GLuint texture)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ Display * const dpy = gc->currentDpy;
+ GLboolean retval = (GLboolean) 0;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxIsTextureRep *reply = XCBGlxIsTextureReply(c, XCBGlxIsTexture(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_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 (__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) memcpy((void *)(gc->pc + 56), (void *)((pixels == NULL) ? one : zero), 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) memcpy((void *)(pc + 60), zero, 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;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetColorTableRep *reply = XCBGlxGetColorTableReply(c, XCBGlxGetColorTable(c, gc->currentContextTag, target, format, type, state->storePack.swapEndian), NULL);
+ (void)memcpy(table, XCBGlxGetColorTableData(reply), XCBGlxGetColorTableDataLength(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_GLsop_GetColorTableParameterfv 148
+void
+__indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat * params)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetColorTableParameterfvRep *reply = XCBGlxGetColorTableParameterfvReply(c, XCBGlxGetColorTableParameterfv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetColorTableParameterfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetColorTableParameterfvData(reply), XCBGlxGetColorTableParameterfvDataLength(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_GLsop_GetColorTableParameteriv 149
+void
+__indirect_glGetColorTableParameteriv(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)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetColorTableParameterivRep *reply = XCBGlxGetColorTableParameterivReply(c, XCBGlxGetColorTableParameteriv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetColorTableParameterivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetColorTableParameterivData(reply), XCBGlxGetColorTableParameterivDataLength(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_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;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetConvolutionFilterRep *reply = XCBGlxGetConvolutionFilterReply(c, XCBGlxGetConvolutionFilter(c, gc->currentContextTag, target, format, type, state->storePack.swapEndian), NULL);
+ (void)memcpy(image, XCBGlxGetConvolutionFilterData(reply), XCBGlxGetConvolutionFilterDataLength(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_GLsop_GetConvolutionParameterfv 151
+void
+__indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat * params)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetConvolutionParameterfvRep *reply = XCBGlxGetConvolutionParameterfvReply(c, XCBGlxGetConvolutionParameterfv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetConvolutionParameterfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetConvolutionParameterfvData(reply), XCBGlxGetConvolutionParameterfvDataLength(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_GLsop_GetConvolutionParameteriv 152
+void
+__indirect_glGetConvolutionParameteriv(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)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetConvolutionParameterivRep *reply = XCBGlxGetConvolutionParameterivReply(c, XCBGlxGetConvolutionParameteriv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetConvolutionParameterivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetConvolutionParameterivData(reply), XCBGlxGetConvolutionParameterivDataLength(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_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;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetHistogramRep *reply = XCBGlxGetHistogramReply(c, XCBGlxGetHistogram(c, gc->currentContextTag, target, reset, format, type, state->storePack.swapEndian), NULL);
+ (void)memcpy(values, XCBGlxGetHistogramData(reply), XCBGlxGetHistogramDataLength(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_GLsop_GetHistogramParameterfv 155
+void
+__indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat * params)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetHistogramParameterfvRep *reply = XCBGlxGetHistogramParameterfvReply(c, XCBGlxGetHistogramParameterfv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetHistogramParameterfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetHistogramParameterfvData(reply), XCBGlxGetHistogramParameterfvDataLength(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_GLsop_GetHistogramParameteriv 156
+void
+__indirect_glGetHistogramParameteriv(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)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetHistogramParameterivRep *reply = XCBGlxGetHistogramParameterivReply(c, XCBGlxGetHistogramParameteriv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetHistogramParameterivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetHistogramParameterivData(reply), XCBGlxGetHistogramParameterivDataLength(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_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;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMinmaxRep *reply = XCBGlxGetMinmaxReply(c, XCBGlxGetMinmax(c, gc->currentContextTag, target, reset, format, type, state->storePack.swapEndian), NULL);
+ (void)memcpy(values, XCBGlxGetMinmaxData(reply), XCBGlxGetMinmaxDataLength(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_GLsop_GetMinmaxParameterfv 158
+void
+__indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat * params)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMinmaxParameterfvRep *reply = XCBGlxGetMinmaxParameterfvReply(c, XCBGlxGetMinmaxParameterfv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetMinmaxParameterfvDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetMinmaxParameterfvData(reply), XCBGlxGetMinmaxParameterfvDataLength(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_GLsop_GetMinmaxParameteriv 159
+void
+__indirect_glGetMinmaxParameteriv(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)) {
+#ifdef USE_XCB
+ XCBConnection *c = XCBConnectionOfDisplay(dpy);
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ XCBGlxGetMinmaxParameterivRep *reply = XCBGlxGetMinmaxParameterivReply(c, XCBGlxGetMinmaxParameteriv(c, gc->currentContextTag, target, pname), NULL);
+ if (XCBGlxGetMinmaxParameterivDataLength(reply) == 0)
+ (void)memcpy(params, &reply->datum, sizeof(reply->datum));
+ else
+ (void)memcpy(params, XCBGlxGetMinmaxParameterivData(reply), XCBGlxGetMinmaxParameterivDataLength(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_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) memcpy((void *)(gc->pc + 88), (void *)((pixels == NULL) ? one : zero), 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) memcpy((void *)(pc + 92), zero, 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_GLrop_DrawBuffersARB 233
+void
+__indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+ 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_GLvop_AreTexturesResidentEXT 11
+GLboolean
+__indirect_glAreTexturesResidentEXT(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)) {
+ 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));
+ retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return retval;
+}
+
+#define X_GLvop_GenTexturesEXT 13
+void
+__indirect_glGenTexturesEXT(GLsizei n, GLuint * textures)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 4;
+ 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_GLvop_IsTextureEXT 14
+GLboolean
+__indirect_glIsTextureEXT(GLuint texture)
+{
+ __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_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_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_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_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_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_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_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 (__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 (__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 (__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, prog