From 14b1cb8d5a27ec9716d3f790fce95f0469e35605 Mon Sep 17 00:00:00 2001
From: marha <marha@users.sourceforge.net>
Date: Sun, 7 Mar 2010 13:28:57 +0000
Subject: Updated to Mesa 7.7

---
 mesalib/src/mesa/main/Makefile.ugl       |  364 --
 mesalib/src/mesa/main/Makefile.win       |  208 --
 mesalib/src/mesa/main/accum.c            |   16 +-
 mesalib/src/mesa/main/accum.h            |   39 +-
 mesalib/src/mesa/main/api_arrayelt.c     |   19 +-
 mesalib/src/mesa/main/api_arrayelt.h     |   47 +-
 mesalib/src/mesa/main/api_exec.c         |  224 +-
 mesalib/src/mesa/main/api_loopback.c     |    7 +
 mesalib/src/mesa/main/api_loopback.h     |   16 +-
 mesalib/src/mesa/main/api_noop.c         |  110 +-
 mesalib/src/mesa/main/api_noop.h         |   16 +-
 mesalib/src/mesa/main/api_validate.c     |   63 +-
 mesalib/src/mesa/main/api_validate.h     |    4 +-
 mesalib/src/mesa/main/attrib.c           |   24 +
 mesalib/src/mesa/main/attrib.h           |   38 +-
 mesalib/src/mesa/main/blend.c            |    6 +-
 mesalib/src/mesa/main/bufferobj.c        |  111 +-
 mesalib/src/mesa/main/buffers.c          |   55 +-
 mesalib/src/mesa/main/colormac.h         |   20 +-
 mesalib/src/mesa/main/colortab.c         |   57 +-
 mesalib/src/mesa/main/colortab.h         |   71 +-
 mesalib/src/mesa/main/compiler.h         |   10 +-
 mesalib/src/mesa/main/config.h           |    2 +-
 mesalib/src/mesa/main/context.c          |   82 +-
 mesalib/src/mesa/main/convolve.c         |   56 +-
 mesalib/src/mesa/main/convolve.h         |  118 +-
 mesalib/src/mesa/main/dd.h               |   63 +-
 mesalib/src/mesa/main/debug.c            |  243 +-
 mesalib/src/mesa/main/debug.h            |   11 +-
 mesalib/src/mesa/main/depth.c            |    4 +-
 mesalib/src/mesa/main/depthstencil.c     |  344 +-
 mesalib/src/mesa/main/dispatch.c         |    2 +-
 mesalib/src/mesa/main/dlist.c            |  677 ++--
 mesalib/src/mesa/main/dlist.h            |   84 +-
 mesalib/src/mesa/main/dlopen.c           |   14 +-
 mesalib/src/mesa/main/drawpix.c          |   26 +-
 mesalib/src/mesa/main/drawpix.h          |   35 +-
 mesalib/src/mesa/main/enable.c           |   39 +-
 mesalib/src/mesa/main/enums.c            | 5282 ++++++++++++++-------------
 mesalib/src/mesa/main/eval.c             |   61 +-
 mesalib/src/mesa/main/eval.h             |   84 +-
 mesalib/src/mesa/main/execmem.c          |    7 +-
 mesalib/src/mesa/main/extensions.c       |   19 +-
 mesalib/src/mesa/main/fbobject.c         |  480 ++-
 mesalib/src/mesa/main/feedback.c         |   39 +-
 mesalib/src/mesa/main/feedback.h         |   62 +-
 mesalib/src/mesa/main/ffvertex_prog.c    |    2 +-
 mesalib/src/mesa/main/fog.c              |   11 +-
 mesalib/src/mesa/main/formats.c          | 1158 ++++++
 mesalib/src/mesa/main/formats.h          |  185 +
 mesalib/src/mesa/main/framebuffer.c      |   96 +-
 mesalib/src/mesa/main/framebuffer.h      |    5 +
 mesalib/src/mesa/main/get.c              |   33 +-
 mesalib/src/mesa/main/get_gen.py         | 1252 -------
 mesalib/src/mesa/main/histogram.c        |   45 +-
 mesalib/src/mesa/main/histogram.h        |   48 +-
 mesalib/src/mesa/main/light.c            |   22 +-
 mesalib/src/mesa/main/mfeatures.h        |   48 +-
 mesalib/src/mesa/main/mipmap.c           |   78 +-
 mesalib/src/mesa/main/mtypes.h           |  191 +-
 mesalib/src/mesa/main/pixel.c            |   40 +-
 mesalib/src/mesa/main/pixel.h            |   47 +-
 mesalib/src/mesa/main/points.c           |   18 +-
 mesalib/src/mesa/main/queryobj.c         |   48 +-
 mesalib/src/mesa/main/queryobj.h         |   59 +-
 mesalib/src/mesa/main/rastpos.c          |  162 +-
 mesalib/src/mesa/main/rastpos.h          |  163 +-
 mesalib/src/mesa/main/rbadaptors.c       |   18 +-
 mesalib/src/mesa/main/remap.c            |  216 ++
 mesalib/src/mesa/main/remap.h            |   87 +
 mesalib/src/mesa/main/remap_helper.h     | 5891 ++++++++++++++++++++++++++++++
 mesalib/src/mesa/main/renderbuffer.c     |  255 +-
 mesalib/src/mesa/main/shaders.c          |   41 +-
 mesalib/src/mesa/main/shared.c           |    4 -
 mesalib/src/mesa/main/sources            |  158 -
 mesalib/src/mesa/main/state.c            |    4 -
 mesalib/src/mesa/main/texcompress.c      |  275 +-
 mesalib/src/mesa/main/texcompress.h      |   34 +-
 mesalib/src/mesa/main/texcompress_fxt1.c |  122 +-
 mesalib/src/mesa/main/texcompress_fxt1.h |   59 +
 mesalib/src/mesa/main/texcompress_s3tc.c |  297 +-
 mesalib/src/mesa/main/texcompress_s3tc.h |  106 +
 mesalib/src/mesa/main/texenv.c           |    5 +-
 mesalib/src/mesa/main/texenvprogram.c    |    2 +-
 mesalib/src/mesa/main/texfetch.c         |  693 ++++
 mesalib/src/mesa/main/texfetch.h         |   40 +
 mesalib/src/mesa/main/texfetch_tmp.h     | 1394 +++++++
 mesalib/src/mesa/main/texformat.c        | 1783 +--------
 mesalib/src/mesa/main/texformat.h        |  264 +-
 mesalib/src/mesa/main/texformat_tmp.h    | 1474 --------
 mesalib/src/mesa/main/texgen.c           |   59 +-
 mesalib/src/mesa/main/texgen.h           |   43 +-
 mesalib/src/mesa/main/texgetimage.c      |  807 ++--
 mesalib/src/mesa/main/teximage.c         | 1137 +++---
 mesalib/src/mesa/main/teximage.h         |    3 +
 mesalib/src/mesa/main/texobj.c           |   15 +-
 mesalib/src/mesa/main/texparam.c         |  132 +-
 mesalib/src/mesa/main/texrender.c        |   47 +-
 mesalib/src/mesa/main/texstate.c         |   20 +-
 mesalib/src/mesa/main/texstore.c         | 1402 ++++---
 mesalib/src/mesa/main/texstore.h         |   77 +-
 mesalib/src/mesa/main/varray.c           |  102 +-
 mesalib/src/mesa/main/varray.h           |   15 +
 mesalib/src/mesa/main/version.h          |    8 +-
 mesalib/src/mesa/main/vtxfmt.c           |   32 +-
 mesalib/src/mesa/main/vtxfmt.h           |   28 +-
 mesalib/src/mesa/main/vtxfmt_tmp.h       |   42 +-
 107 files changed, 17684 insertions(+), 12577 deletions(-)
 delete mode 100644 mesalib/src/mesa/main/Makefile.ugl
 delete mode 100644 mesalib/src/mesa/main/Makefile.win
 create mode 100644 mesalib/src/mesa/main/formats.c
 create mode 100644 mesalib/src/mesa/main/formats.h
 delete mode 100644 mesalib/src/mesa/main/get_gen.py
 create mode 100644 mesalib/src/mesa/main/remap.c
 create mode 100644 mesalib/src/mesa/main/remap.h
 create mode 100644 mesalib/src/mesa/main/remap_helper.h
 delete mode 100644 mesalib/src/mesa/main/sources
 create mode 100644 mesalib/src/mesa/main/texcompress_fxt1.h
 create mode 100644 mesalib/src/mesa/main/texcompress_s3tc.h
 create mode 100644 mesalib/src/mesa/main/texfetch.c
 create mode 100644 mesalib/src/mesa/main/texfetch.h
 create mode 100644 mesalib/src/mesa/main/texfetch_tmp.h
 delete mode 100644 mesalib/src/mesa/main/texformat_tmp.h

(limited to 'mesalib/src/mesa/main')

diff --git a/mesalib/src/mesa/main/Makefile.ugl b/mesalib/src/mesa/main/Makefile.ugl
deleted file mode 100644
index b440e1364..000000000
--- a/mesalib/src/mesa/main/Makefile.ugl
+++ /dev/null
@@ -1,364 +0,0 @@
-# Mesa 3-D graphics library
-# Version:  4.1
-#
-# Copyright (C) 2001 Wind River Systems, Inc
-
-# The MIT License
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-# 
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
-# DEALINGS IN THE SOFTWARE.
-
-# Makefile for core library
-
-# This makefile can moved all objects files in MESA_OBJ for use with
-# ld in windShell or create a library from objects files in their
-# associated .c folder.
-#
-# For an easy inclusion of lib$(CPU)$(TOOL)GL.a in vxworks image, this
-# makefile collects together all .o in an only file
-# (obj$(CPU)$(TOOL)GL.o). This operation is unnecessary for
-# lib$(CPU)$(TOOL)OSMesa.a and lib$(CPU)$(TOOL)UglMesa.a because they
-# already contain only one file.
-#
-##### MACROS #####
-MESA_MAJOR=4
-MESA_MINOR=1
-MESA_TINY=0
-VERSION=$(MESA_MAJOR).$(MESA_MINOR)
-
-GL_MAJOR = 1
-GL_MINOR = 2
-GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
-
-##### RULES #####
-
-include ..\rules.windml
-
-#### GL #####
-
-GL_SOURCES = \
-	api_arrayelt.c \
-	api_loopback.c \
-	api_noop.c \
-	api_validate.c \
-	accum.c \
-	arbprogram.c \
-	attrib.c \
-	blend.c \
-	bufferobj.c \
-	buffers.c \
-	clip.c \
-	colortab.c \
-	context.c \
-	convolve.c \
-	debug.c \
-	depth.c \
-	dispatch.c \
-	dlist.c \
-	drawpix.c \
-	enable.c \
-	enums.c \
-	eval.c \
-	extensions.c \
-	feedback.c \
-	fog.c \
-	get.c \
-	glapi.c \
-	glthread.c \
-	hash.c \
-	hint.c \
-	histogram.c \
-	image.c \
-	imports.c \
-	light.c \
-	lines.c \
-	matrix.c \
-	pixel.c \
-	points.c \
-	polygon.c \
-	rastpos.c \
-	state.c \
-	stencil.c \
-	texcompress.c \
-	texformat.c \
-	teximage.c \
-	texobj.c \
-	texstate.c \
-	texstore.c \
-	texutil.c \
-	varray.c \
-	vtxfmt.c \
-	X86/x86.c \
-	X86/common_x86.c \
-	X86/3dnow.c \
-	X86/sse.c \
-	math/m_debug_clip.c \
-	math/m_debug_norm.c \
-	math/m_debug_vertex.c \
-	math/m_debug_xform.c \
-	math/m_eval.c \
-	math/m_matrix.c \
-	math/m_translate.c \
-	math/m_vector.c \
-	math/m_vertices.c \
-	math/m_xform.c \
-	array_cache/ac_context.c \
-	array_cache/ac_import.c \
-	swrast/s_aaline.c \
-	swrast/s_aatriangle.c \
-	swrast/s_accum.c \
-	swrast/s_alpha.c \
-	swrast/s_alphabuf.c \
-	swrast/s_bitmap.c \
-	swrast/s_blend.c \
-	swrast/s_buffers.c \
-	swrast/s_copypix.c \
-	swrast/s_context.c \
-	swrast/s_depth.c \
-	swrast/s_drawpix.c \
-	swrast/s_feedback.c \
-	swrast/s_fog.c \
-	swrast/s_imaging.c \
-	swrast/s_lines.c \
-	swrast/s_logic.c \
-	swrast/s_masking.c \
-	swrast/s_pixeltex.c \
-	swrast/s_points.c \
-	swrast/s_readpix.c \
-	swrast/s_span.c \
-	swrast/s_stencil.c \
-	swrast/s_texture.c \
-	swrast/s_texstore.c \
-	swrast/s_triangle.c \
-	swrast/s_zoom.c \
-	swrast_setup/ss_context.c \
-	swrast_setup/ss_triangle.c \
-	swrast_setup/ss_vb.c \
-	tnl/t_array_api.c \
-	tnl/t_array_import.c \
-	tnl/t_context.c \
-	tnl/t_eval_api.c \
-	tnl/t_imm_alloc.c \
-	tnl/t_imm_api.c \
-	tnl/t_imm_debug.c \
-	tnl/t_imm_dlist.c \
-	tnl/t_imm_elt.c \
-	tnl/t_imm_eval.c \
-	tnl/t_imm_exec.c \
-	tnl/t_imm_fixup.c \
-	tnl/t_pipeline.c \
-	tnl/t_vb_fog.c \
-	tnl/t_vb_light.c \
-	tnl/t_vb_normals.c \
-	tnl/t_vb_points.c \
-	tnl/t_vb_render.c \
-	tnl/t_vb_texgen.c \
-	tnl/t_vb_texmat.c \
-	tnl/t_vb_vertex.c
-
-GL_OBJECTS = $(GL_SOURCES:.c=.o)
-GL_OBJNAME = $(MESA_LIBDIR)/objMesaGL.o
-
-#### X86 #####
-
-x86_files = \
-	X86/common_x86_asm.S \
-	X86/glapi_x86.S \
-	X86/x86_cliptest.S \
-	X86/x86_vertex.S \
-	X86/x86_xform2.S \
-	X86/x86_xform3.S \
-	X86/x86_xform4.S \
-
-x3dnow_files = \
-	X86/3dnow_normal.S \
-	X86/3dnow_vertex.S \
-	X86/3dnow_xform1.S \
-	X86/3dnow_xform2.S \
-	X86/3dnow_xform3.S \
-	X86/3dnow_xform4.S
-
-sse_files = \
-	X86/sse_normal.S \
-	X86/sse_vertex.S \
-	X86/sse_xform1.S \
-	X86/sse_xform2.S \
-	X86/sse_xform3.S \
-	X86/sse_xform4.S
-
-mmx_files = X86/mmx_blend.S
-
-X86_OBJNAME = $(MESA_LIBDIR)/objMesaX86.o
-
-##### UGL #####
-
-UGL_SOURCES = \
-	windml/ugl_api.c \
-	windml/ugl_dd.c \
-	windml/ugl_span.c \
-	windml/ugl_line.c \
-	windml/ugl_tri.c \
-	windml/tornado/torMesaUGLInit.c
-
-UGL_OBJECTS = $(UGL_SOURCES:.c=.o)
-UGL_OBJNAME = $(MESA_LIBDIR)/objMesaUGL.o
-
-##### OS #####
-
-OS_SOURCES = OSmesa/osmesa.c windml/tornado/torMesaOSInit.c
-OS_OBJECTS = $(OS_SOURCES:.c=.o)
-OS_OBJNAME = $(MESA_LIBDIR)/objMesaOS.o
-
-##### GLUTSHAPES #####
-
-GLUTSHAPES_SOURCES = \
-	windml/ugl_glutshapes.c \
-	windml/tornado/torGLUTShapesInit.c
-
-GLUTSHAPES_OBJECTS = $(GLUTSHAPES_SOURCES:.c=.o)
-GLUTSHAPES_OBJNAME = $(MESA_LIBDIR)/objGLUTShapes.o
-
-SOURCES = $(GL_SOURCES) $(UGL_SOURCES) $(OS_SOURCES) \
-	$(GLUTSHAPES_SOURCES)
-
-##### TARGETS #####
-
-all: depend.$(CPU)$(TOOL) cfgX86 $(X86_OBJNAME) $(GL_OBJNAME)\
-$(UGL_OBJNAME) $(OS_OBJNAME) $(GLUTSHAPES_OBJNAME)
-
-#histogram.o:
-#	$(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $<
-
-#image.o:
-#	$(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $<
-
-cfgX86:
-ifdef HAVE_3DNOW
-x3dnow_sources = $(x3dnow_files)
-CFLAGS_3DNOW = -DUSE_3DNOW_ASM
-HAVE_X86 = 1
-endif
-ifdef HAVE_SSE
-sse_sources = $(sse_files)
-CFLAGS_SSE = -DUSE_SSE_ASM
-HAVE_X86 = 1
-endif
-ifdef HAVE_MMX
-mmx_sources = $(mmx_files)
-CFLAGS_MMX = -DUSE_MMX_ASM
-HAVE_X86 = 1
-endif
-ifdef HAVE_X86
-x86_sources = $(x86_files)
-CFLAGS_X86 = -DUSE_X86_ASM
-endif
-X86_SOURCES = $(x86_sources) $(mmx_sources) \
-	$(x3dnow_sources) $(sse_sources)
-X86_OBJECTS = $(X86_SOURCES:.S=.o)
-CFLAGS_USE_X86 = $(CFLAGS_3DNOW) $(CFLAGS_SSE) $(CFLAGS_MMX) $(CFLAGS_X86)
-
-#X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c
-#	$(CC) -I ./ X86/gen_matypes.c -o X86/gen_matypes
-#	./X86/gen_matypes > X86/matypes.h
-#	$(RM) X86/gen_matypes
-#	$(RM) X86/gen_matypes.o
-
-# Make the Mesax86 library
-$(X86_OBJNAME): $(X86_OBJECTS)
-ifdef HAVE_X86
-#	$(LD) -r $(X86_OBJECTS) -o $(MESA_OBJNAME)
-	$(LD) -r $(X86_OBJECTS) -o $(X86_OBJNAME)
-#	$(AR) rus $(MESA_LIBNAME) $(X86_OBJNAME)
-#	$(RM) $(X86_OBJNAME)
-endif
-
-# Make the GL library
-$(GL_OBJNAME): $(GL_OBJECTS)
-#	$(LD) -r $(GL_OBJECTS) -o $(MESA_OBJNAME)
-	$(LD) -r $(GL_OBJECTS) -o $(GL_OBJNAME)
-#	$(AR) rus $(MESA_LIBNAME) $(GL_OBJNAME)
-#	$(AR) rus $(VX_LIBNAME) $(GL_OBJNAME)
-#	$(RM) $(GL_OBJNAME)
-
-# Make the UGLMesa library
-$(UGL_OBJNAME): $(UGL_OBJECTS)
-#	$(LD) -r $(UGL_OBJECTS) -o $(MESA_OBJNAME)
-	$(LD) -r $(UGL_OBJECTS) -o $(UGL_OBJNAME)
-#	$(AR) rus $(MESA_LIBNAME) $(UGL_OBJNAME)
-#	$(AR) rus $(VX_LIBNAME) $(UGL_OBJNAME)
-#	$(RM) $(UGL_OBJNAME)
-
-# Make the OSMesa library
-$(OS_OBJNAME): $(OS_OBJECTS)
-#	$(LD) -r $(OS_OBJECTS) -o $(MESA_OBJNAME)
-	$(LD) -r $(OS_OBJECTS) -o $(OS_OBJNAME)
-#	$(AR) rus $(MESA_LIBNAME) $(OS_OBJNAME)
-#	$(AR) rus $(VX_LIBNAME) $(OS_OBJNAME)
-#	$(RM) $(OS_OBJNAME)
-
-# Make the GLUT Shapes library
-$(GLUTSHAPES_OBJNAME): $(GLUTSHAPES_OBJECTS)
-#	$(LD) -r $(GLUTSHAPES_OBJECTS) -o $(MESA_OBJNAME)
-	$(LD) -r $(GLUTSHAPES_OBJECTS) -o $(GLUTSHAPES_OBJNAME)
-#	$(AR) rus $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME)
-#	$(AR) rus $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME)
-#	$(RM) $(GLUTSHAPES_OBJNAME)
-
-depend.$(CPU)$(TOOL):
-ifeq ($(WIND_HOST_TYPE),x86-win32)
-	@ $(RM) $@
-	@ $(ECHO) Creating depend.$(CPU)$(TOOL)
-ifneq ($(SOURCES),)
-	@ for %f in ($(SOURCES)) do \
-	$(CC) -MM $(CFLAGS) %f >>$@ 
-endif
-else
-Makefile
-	@ $(RM) $@
-	@ $(ECHO) "Creating depend.$(CPU)$(TOOL)"
-ifneq ($(SOURCES),)
-	@ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \
-	do \
-	$(CC) -MM $(CFLAGS) $$FILE  \
-	| $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \
-	done	
-endif
-endif
-
-.PHONY = clean
-
-clean:
-# 	$(AR) d $(MESA_LIBNAME) $(GL_OBJNAME)
-# 	$(AR) d $(MESA_LIBNAME) $(UGL_OBJNAME)
-# 	$(AR) d $(MESA_LIBNAME) $(OS_OBJNAME)
-# 	$(AR) d $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME)
-# 	$(AR) d $(VX_LIBNAME) $(GL_OBJNAME)
-# 	$(AR) d $(VX_LIBNAME) $(UGL_OBJNAME)
-# 	$(AR) d $(VX_LIBNAME) $(OS_OBJNAME)
-# 	$(AR) d $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME)
-	$(RM) $(GL_OBJECTS)
-	$(RM) $(UGL_OBJECTS)
-	$(RM) $(OS_OBJECTS)
-	$(RM) $(GLUTSHAPES_OBJECTS)
-	$(RM) $(GL_OBJNAME)
-	$(RM) $(UGL_OBJNAME)
-	$(RM) $(OS_OBJNAME)
-	$(RM) $(GLUTSHAPES_OBJNAME)
-	$(RM) depend.$(CPU)$(TOOL)
-
-include depend.$(CPU)$(TOOL)
-
diff --git a/mesalib/src/mesa/main/Makefile.win b/mesalib/src/mesa/main/Makefile.win
deleted file mode 100644
index a27f44c11..000000000
--- a/mesalib/src/mesa/main/Makefile.win
+++ /dev/null
@@ -1,208 +0,0 @@
-# Makefile for Win32
-#
-#  NOTE: the install target may overwrite important files in the system dirs
-#  Check first, before making the install target.
-#
-#  This builds both the osmesa and Windows drivers.
-#
-
-!include <win32.mak>
-
-TOP = ..
-SUBDIRS = osmesa.dir
-
-CORE_SRCS = \
-	api_loopback.c \
-	api_noop.c \
-	api_validate.c \
-	accum.c \
-	arbprogram.c \
-	attrib.c \
-	blend.c \
-	bufferobj.c \
-	buffers.c \
-	clip.c \
-	colortab.c \
-	context.c \
-	convolve.c \
-	debug.c \
-	depth.c \
-	dispatch.c \
-	dlist.c \
-	drawpix.c \
-	enable.c \
-	enums.c \
-	eval.c \
-	extensions.c \
-	feedback.c \
-	fog.c \
-	get.c \
-	glapi.c \
-	glthread.c \
-	hash.c \
-	hint.c \
-	histogram.c \
-	image.c \
-	imports.c \
-	light.c \
-	lines.c \
-	matrix.c \
-	nvprogram.c \
-	nvfragparse.c \
-	nvvertexec.c \
-	nvvertparse.c \
-	pixel.c \
-	points.c \
-	polygon.c \
-	rastpos.c \
-	state.c \
-	stencil.c \
-	texcompress.c \
-	texcompress_fxt1.c \
-	texcompress_s3tc.c \
-	teximage.c \
-	texformat.c \
-	texobj.c \
-	texstate.c \
-	texstore.c \
-	varray.c \
-	vtxfmt.c \
-#	X86\x86.c \
-#	X86\common_x86.c \
-#	X86\3dnow.c \
-#	X86\sse.c \
-	math\m_debug_norm.c \
-	math\m_debug_xform.c \
-	math\m_eval.c \
-	math\m_matrix.c \
-	math\m_translate.c \
-	math\m_vector.c \
-	math\m_xform.c \
-	array_cache\ac_context.c \
-	array_cache\ac_import.c \
-	swrast\s_aaline.c \
-	swrast\s_aatriangle.c \
-	swrast\s_accum.c \
-	swrast\s_alpha.c \
-	swrast\s_alphabuf.c \
-	swrast\s_bitmap.c \
-	swrast\s_blend.c \
-	swrast\s_buffers.c \
-	swrast\s_copypix.c \
-	swrast\s_context.c \
-	swrast\s_depth.c \
-	swrast\s_drawpix.c \
-	swrast\s_feedback.c \
-	swrast\s_fog.c \
-	swrast\s_imaging.c \
-	swrast\s_lines.c \
-	swrast\s_logic.c \
-	swrast\s_masking.c \
-	swrast\s_nvfragprog.c \
-	swrast\s_pixeltex.c \
-	swrast\s_points.c \
-	swrast\s_readpix.c \
-	swrast\s_span.c \
-	swrast\s_stencil.c \
-	swrast\s_texstore.c \
-	swrast\s_texture.c \
-	swrast\s_triangle.c \
-	swrast\s_zoom.c \
-	swrast_setup\ss_context.c \
-	swrast_setup\ss_triangle.c \
-	swrast_setup\ss_vb.c \
-	tnl\t_array_api.c \
-	tnl\t_array_import.c \
-	tnl\t_context.c \
-	tnl\t_eval_api.c \
-	tnl\t_imm_alloc.c \
-	tnl\t_imm_api.c \
-	tnl\t_imm_debug.c \
-	tnl\t_imm_dlist.c \
-	tnl\t_imm_elt.c \
-	tnl\t_imm_eval.c \
-	tnl\t_imm_exec.c \
-	tnl\t_imm_fixup.c \
-	tnl\t_pipeline.c \
-	tnl\t_vb_fog.c \
-	tnl\t_vb_light.c \
-	tnl\t_vb_normals.c \
-	tnl\t_vb_points.c \
-	tnl\t_vb_program.c \
-	tnl\t_vb_render.c \
-	tnl\t_vb_texgen.c \
-	tnl\t_vb_texmat.c \
-	tnl\t_vb_vertex.c
-
-DRIVER_SRCS = \
-	Trace\tr_context.c \
-	Trace\tr_control.c \
-	Trace\tr_error.c \
-	Trace\tr_support.c \
-	Trace\tr_wrapper.c \
-	Trace\tr_write.c \
-	Windows\wgl.c \
-	Windows\wmesa.c
-
-ASM_SRCS =
-
-SRCS	= $(CORE_SRCS) $(DRIVER_SRCS)
-
-all	: mesadll $(SUBDIRS)
-
-!include "$(TOP)/mesawin32.mak"
-
-mesadll	: $(MESADLL)
-
-CFLAGS	= $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -DBUILD_GL32 -DNO_PARALLEL -DNO_STEREO
-!IFNDEF NODEBUG
-CFLAGS = $(CFLAGS) -DMESA_DEBUG
-!ENDIF
-LFLAGS	= $(dlllflags) $(lcommon) $(LFLAGS)
-
-OBJS	= $(ASM_SRCS:.S=.obj) $(CORE_SRCS:.c=.obj) $(DRIVER_SRCS:.c=.obj)
-LIBS	= winmm.lib $(guilibsdll)
-
-$(MESADLL)	: $(OBJS) mesa.def
-	$(link) $(LFLAGS) -out:$(MESADLL) -def:mesa.def $(OBJS) $(LIBS)
-	@echo "copying Mesa dynamic link library to lib directory..."
-	-copy $(MESADLL) ..\lib
-	@echo "copying Mesa import library to lib directory..."
-	-copy $(MESALIB) ..\lib
-
-$(SUBDIRS)	:
-	@echo.
-	@echo Making in $* directory
-	@cd $*
-	@nmake -f Makefile.win -nologo
-	@cd ..
-
-install	: $(MESADLL)
-	@echo.
-	@echo "copying Mesa dynamic link library to system directory..."
-	-copy $(MESADLL) $(DLLINSTALL)
-	@echo "copying Mesa header files to include directory..."
-	-copy ..\..\include\GL\gl.h $(INCLUDEINSTALL)
-	-copy ..\..\include\GL\glext.h $(INCLUDEINSTALL)
-	@echo "copying Mesa import library to library directory..."
-	-copy $(MESALIB) $(LIBINSTALL)
-
-clean	::
-	@del /f tnl\*.obj
-	@del /f swrast_setup\*.obj
-	@del /f math\*.obj
-	@del /f array_cache\*.obj
-	@del /f swrast\*.obj
-	@del /f Trace\*.obj
-	@del /f osmesa\*.obj
-	@del /f Windows\*.obj
-
-clobber	::
-	@del /f OSmesa\*.lib
-	@del /f OSmesa\*.exp
-	@del /f OSmesa\*.dll
-
-# override default inference rule with one that writes the object to
-# the same subdir that the c file is in.
-.c.obj	:
-	$(cc) $(CFLAGS) -I. $< /Fo$*.obj
diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c
index 2345695f3..032e13b96 100644
--- a/mesalib/src/mesa/main/accum.c
+++ b/mesalib/src/mesa/main/accum.c
@@ -29,6 +29,10 @@
 #include "macros.h"
 #include "state.h"
 #include "mtypes.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_accum
 
 
 void GLAPIENTRY
@@ -51,7 +55,7 @@ _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Accum( GLenum op, GLfloat value )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -99,6 +103,16 @@ _mesa_Accum( GLenum op, GLfloat value )
 }
 
 
+void
+_mesa_init_accum_dispatch(struct _glapi_table *disp)
+{
+   SET_Accum(disp, _mesa_Accum);
+   SET_ClearAccum(disp, _mesa_ClearAccum);
+}
+
+
+#endif /* FEATURE_accum */
+
 
 void 
 _mesa_init_accum( GLcontext *ctx )
diff --git a/mesalib/src/mesa/main/accum.h b/mesalib/src/mesa/main/accum.h
index ce92688a5..63740f07e 100644
--- a/mesalib/src/mesa/main/accum.h
+++ b/mesalib/src/mesa/main/accum.h
@@ -38,25 +38,40 @@
 #define ACCUM_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
-#if _HAVE_FULL_GL
-
-extern void GLAPIENTRY
-_mesa_Accum( GLenum op, GLfloat value );
+#if FEATURE_accum
 
+#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) \
+   do {                                          \
+      (driver)->Accum = impl ## Accum;           \
+   } while (0)
 
 extern void GLAPIENTRY
 _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
 
-extern void 
-_mesa_init_accum( GLcontext *ctx );
+extern void
+_mesa_init_accum_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_accum */
 
-#else
+#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) do { } while (0)
 
-/** No-op */
-#define _mesa_init_accum( c ) ((void)0)
+static INLINE void
+_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
+{
+   /* this is used in _mesa_PopAttrib */
+   ASSERT_NO_FEATURE();
+}
 
-#endif
+static INLINE void
+_mesa_init_accum_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_accum */
+
+extern void
+_mesa_init_accum( GLcontext *ctx );
 
-#endif
+#endif /* ACCUM_H */
diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c
index 2462a1b00..469b4529f 100644
--- a/mesalib/src/mesa/main/api_arrayelt.c
+++ b/mesalib/src/mesa/main/api_arrayelt.c
@@ -32,7 +32,6 @@
 #include "context.h"
 #include "imports.h"
 #include "macros.h"
-#include "glapi/glapioffsets.h"
 #include "glapi/dispatch.h"
 
 typedef void (GLAPIENTRY *array_func)( const void * );
@@ -71,6 +70,10 @@ typedef struct {
  */
 #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 )
 
+
+#if FEATURE_arrayelt
+
+
 static const int ColorFuncs[2][8] = {
    {
       _gloffset_Color3bv,
@@ -1160,7 +1163,7 @@ static void _ae_update_state( GLcontext *ctx )
          at->array = attribArray;
          /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
           * function pointer here (for float arrays) since the pointer may
-          * change from one execution of _ae_loopback_array_elt() to
+          * change from one execution of _ae_ArrayElement() to
           * the next.  Doing so caused UT to break.
           */
          if (ctx->VertexProgram._Enabled
@@ -1254,7 +1257,7 @@ void _ae_unmap_vbos( GLcontext *ctx )
  * for all enabled vertex arrays (for elt-th element).
  * Note: this may be called during display list construction.
  */
-void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
+void GLAPIENTRY _ae_ArrayElement( GLint elt )
 {
    GET_CURRENT_CONTEXT(ctx);
    const AEcontext *actx = AE_CONTEXT(ctx);
@@ -1317,3 +1320,13 @@ void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
       actx->NewState |= new_state;
    }
 }
+
+
+void _mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
+                                   const GLvertexformat *vfmt)
+{
+   SET_ArrayElement(disp, vfmt->ArrayElement);
+}
+
+
+#endif /* FEATURE_arrayelt */
diff --git a/mesalib/src/mesa/main/api_arrayelt.h b/mesalib/src/mesa/main/api_arrayelt.h
index e621724fb..d18c0792c 100644
--- a/mesalib/src/mesa/main/api_arrayelt.h
+++ b/mesalib/src/mesa/main/api_arrayelt.h
@@ -27,16 +27,57 @@
 #ifndef API_ARRAYELT_H
 #define API_ARRAYELT_H
 
-#include "mtypes.h"
+
+#include "main/mtypes.h"
+
+#if FEATURE_arrayelt
+
+#define _MESA_INIT_ARRAYELT_VTXFMT(vfmt, impl)     \
+   do {                                            \
+      (vfmt)->ArrayElement = impl ## ArrayElement; \
+   } while (0)
 
 extern GLboolean _ae_create_context( GLcontext *ctx );
 extern void _ae_destroy_context( GLcontext *ctx );
 extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state );
-extern void GLAPIENTRY _ae_loopback_array_elt( GLint elt );
+extern void GLAPIENTRY _ae_ArrayElement( GLint elt );
 
 /* May optionally be called before a batch of element calls:
  */
 extern void _ae_map_vbos( GLcontext *ctx );
 extern void _ae_unmap_vbos( GLcontext *ctx );
 
-#endif
+extern void
+_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
+                              const GLvertexformat *vfmt);
+
+#else /* FEATURE_arrayelt */
+
+#define _MESA_INIT_ARRAYELT_VTXFMT(vfmt, impl) do { } while (0)
+
+static INLINE GLboolean
+_ae_create_context( GLcontext *ctx )
+{
+   return GL_TRUE;
+}
+
+static INLINE void
+_ae_destroy_context( GLcontext *ctx )
+{
+}
+
+static INLINE void
+_ae_invalidate_state( GLcontext *ctx, GLuint new_state )
+{
+}
+
+static INLINE void
+_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
+                              const GLvertexformat *vfmt)
+{
+}
+
+#endif /* FEATURE_arrayelt */
+
+
+#endif /* API_ARRAYELT_H */
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index 02550ae10..1559984f4 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -30,9 +30,7 @@
 
 
 #include "mfeatures.h"
-#if FEATURE_accum
 #include "accum.h"
-#endif
 #include "api_loopback.h"
 #include "api_exec.h"
 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
@@ -41,9 +39,7 @@
 #if FEATURE_ATI_fragment_shader
 #include "shader/atifragshader.h"
 #endif
-#if FEATURE_attrib_stack
 #include "attrib.h"
-#endif
 #include "blend.h"
 #if FEATURE_ARB_vertex_buffer_object
 #include "bufferobj.h"
@@ -54,29 +50,17 @@
 #endif
 #include "clear.h"
 #include "clip.h"
-#if FEATURE_colortable
 #include "colortab.h"
-#endif
 #include "context.h"
-#if FEATURE_convolve
 #include "convolve.h"
-#endif
 #include "depth.h"
-#if FEATURE_dlist
 #include "dlist.h"
-#endif
-#if FEATURE_drawpix
 #include "drawpix.h"
 #include "rastpos.h"
-#endif
 #include "enable.h"
-#if FEATURE_evaluators
 #include "eval.h"
-#endif
 #include "get.h"
-#if FEATURE_feedback
 #include "feedback.h"
-#endif
 #include "fog.h"
 #if FEATURE_EXT_framebuffer_object
 #include "fbobject.h"
@@ -84,24 +68,18 @@
 #include "ffvertex_prog.h"
 #include "framebuffer.h"
 #include "hint.h"
-#if FEATURE_histogram
 #include "histogram.h"
-#endif
 #include "imports.h"
 #include "light.h"
 #include "lines.h"
 #include "macros.h"
 #include "matrix.h"
 #include "multisample.h"
-#if FEATURE_pixel_transfer
 #include "pixel.h"
-#endif
 #include "pixelstore.h"
 #include "points.h"
 #include "polygon.h"
-#if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query
 #include "queryobj.h"
-#endif
 #include "readpix.h"
 #include "scissor.h"
 #include "state.h"
@@ -109,9 +87,7 @@
 #include "texenv.h"
 #include "texgetimage.h"
 #include "teximage.h"
-#if FEATURE_texgen
 #include "texgen.h"
-#endif
 #include "texobj.h"
 #include "texparam.h"
 #include "texstate.h"
@@ -199,20 +175,10 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_TexParameteri(exec, _mesa_TexParameteri);
    SET_Translatef(exec, _mesa_Translatef);
    SET_Viewport(exec, _mesa_Viewport);
-#if FEATURE_accum
-   SET_Accum(exec, _mesa_Accum);
-   SET_ClearAccum(exec, _mesa_ClearAccum);
-#endif
-#if FEATURE_dlist
-   SET_CallList(exec, _mesa_CallList);
-   SET_CallLists(exec, _mesa_CallLists);
-   SET_DeleteLists(exec, _mesa_DeleteLists);
-   SET_EndList(exec, _mesa_EndList);
-   SET_GenLists(exec, _mesa_GenLists);
-   SET_IsList(exec, _mesa_IsList);
-   SET_ListBase(exec, _mesa_ListBase);
-   SET_NewList(exec, _mesa_NewList);
-#endif
+
+   _mesa_init_accum_dispatch(exec);
+   _mesa_init_dlist_dispatch(exec);
+
    SET_ClearDepth(exec, _mesa_ClearDepth);
    SET_ClearIndex(exec, _mesa_ClearIndex);
    SET_ClipPlane(exec, _mesa_ClipPlane);
@@ -222,21 +188,10 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_DepthFunc(exec, _mesa_DepthFunc);
    SET_DepthMask(exec, _mesa_DepthMask);
    SET_DepthRange(exec, _mesa_DepthRange);
-#if FEATURE_drawpix
-   SET_Bitmap(exec, _mesa_Bitmap);
-   SET_CopyPixels(exec, _mesa_CopyPixels);
-   SET_DrawPixels(exec, _mesa_DrawPixels);
-#endif
-#if FEATURE_feedback
-   SET_InitNames(exec, _mesa_InitNames);
-   SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
-   SET_LoadName(exec, _mesa_LoadName);
-   SET_PassThrough(exec, _mesa_PassThrough);
-   SET_PopName(exec, _mesa_PopName);
-   SET_PushName(exec, _mesa_PushName);
-   SET_SelectBuffer(exec, _mesa_SelectBuffer);
-   SET_RenderMode(exec, _mesa_RenderMode);
-#endif
+
+   _mesa_init_drawpix_dispatch(exec);
+   _mesa_init_feedback_dispatch(exec);
+
    SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
    SET_Fogf(exec, _mesa_Fogf);
    SET_Fogfv(exec, _mesa_Fogfv);
@@ -270,68 +225,22 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_Lighti(exec, _mesa_Lighti);
    SET_Lightiv(exec, _mesa_Lightiv);
    SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
-#if FEATURE_evaluators
-   SET_GetMapdv(exec, _mesa_GetMapdv);
-   SET_GetMapfv(exec, _mesa_GetMapfv);
-   SET_GetMapiv(exec, _mesa_GetMapiv);
-   SET_Map1d(exec, _mesa_Map1d);
-   SET_Map1f(exec, _mesa_Map1f);
-   SET_Map2d(exec, _mesa_Map2d);
-   SET_Map2f(exec, _mesa_Map2f);
-   SET_MapGrid1d(exec, _mesa_MapGrid1d);
-   SET_MapGrid1f(exec, _mesa_MapGrid1f);
-   SET_MapGrid2d(exec, _mesa_MapGrid2d);
-   SET_MapGrid2f(exec, _mesa_MapGrid2f);
-#endif
+
+   _mesa_init_eval_dispatch(exec);
+
    SET_MultMatrixd(exec, _mesa_MultMatrixd);
-#if FEATURE_pixel_transfer
-   SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv);
-   SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv);
-   SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv);
-   SET_PixelMapfv(exec, _mesa_PixelMapfv);
-   SET_PixelMapuiv(exec, _mesa_PixelMapuiv);
-   SET_PixelMapusv(exec, _mesa_PixelMapusv);
-   SET_PixelTransferf(exec, _mesa_PixelTransferf);
-   SET_PixelTransferi(exec, _mesa_PixelTransferi);
-   SET_PixelZoom(exec, _mesa_PixelZoom);
-#endif
+
+   _mesa_init_pixel_dispatch(exec);
+
    SET_PixelStoref(exec, _mesa_PixelStoref);
    SET_PointSize(exec, _mesa_PointSize);
    SET_PolygonMode(exec, _mesa_PolygonMode);
    SET_PolygonOffset(exec, _mesa_PolygonOffset);
    SET_PolygonStipple(exec, _mesa_PolygonStipple);
-#if FEATURE_attrib_stack
-   SET_PopAttrib(exec, _mesa_PopAttrib);
-   SET_PushAttrib(exec, _mesa_PushAttrib);
-   SET_PopClientAttrib(exec, _mesa_PopClientAttrib);
-   SET_PushClientAttrib(exec, _mesa_PushClientAttrib);
-#endif
-#if FEATURE_drawpix
-   SET_RasterPos2f(exec, _mesa_RasterPos2f);
-   SET_RasterPos2fv(exec, _mesa_RasterPos2fv);
-   SET_RasterPos2i(exec, _mesa_RasterPos2i);
-   SET_RasterPos2iv(exec, _mesa_RasterPos2iv);
-   SET_RasterPos2d(exec, _mesa_RasterPos2d);
-   SET_RasterPos2dv(exec, _mesa_RasterPos2dv);
-   SET_RasterPos2s(exec, _mesa_RasterPos2s);
-   SET_RasterPos2sv(exec, _mesa_RasterPos2sv);
-   SET_RasterPos3d(exec, _mesa_RasterPos3d);
-   SET_RasterPos3dv(exec, _mesa_RasterPos3dv);
-   SET_RasterPos3f(exec, _mesa_RasterPos3f);
-   SET_RasterPos3fv(exec, _mesa_RasterPos3fv);
-   SET_RasterPos3i(exec, _mesa_RasterPos3i);
-   SET_RasterPos3iv(exec, _mesa_RasterPos3iv);
-   SET_RasterPos3s(exec, _mesa_RasterPos3s);
-   SET_RasterPos3sv(exec, _mesa_RasterPos3sv);
-   SET_RasterPos4d(exec, _mesa_RasterPos4d);
-   SET_RasterPos4dv(exec, _mesa_RasterPos4dv);
-   SET_RasterPos4f(exec, _mesa_RasterPos4f);
-   SET_RasterPos4fv(exec, _mesa_RasterPos4fv);
-   SET_RasterPos4i(exec, _mesa_RasterPos4i);
-   SET_RasterPos4iv(exec, _mesa_RasterPos4iv);
-   SET_RasterPos4s(exec, _mesa_RasterPos4s);
-   SET_RasterPos4sv(exec, _mesa_RasterPos4sv);
-#endif
+
+   _mesa_init_attrib_dispatch(exec);
+   _mesa_init_rastpos_dispatch(exec);
+
    SET_ReadPixels(exec, _mesa_ReadPixels);
    SET_Rotated(exec, _mesa_Rotated);
    SET_Scaled(exec, _mesa_Scaled);
@@ -339,17 +248,7 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_TexEnvf(exec, _mesa_TexEnvf);
    SET_TexEnviv(exec, _mesa_TexEnviv);
 
-#if FEATURE_texgen
-   SET_GetTexGendv(exec, _mesa_GetTexGendv);
-   SET_GetTexGenfv(exec, _mesa_GetTexGenfv);
-   SET_GetTexGeniv(exec, _mesa_GetTexGeniv);
-   SET_TexGend(exec, _mesa_TexGend);
-   SET_TexGendv(exec, _mesa_TexGendv);
-   SET_TexGenf(exec, _mesa_TexGenf);
-   SET_TexGenfv(exec, _mesa_TexGenfv);
-   SET_TexGeni(exec, _mesa_TexGeni);
-   SET_TexGeniv(exec, _mesa_TexGeniv);
-#endif
+   _mesa_init_texgen_dispatch(exec);
 
    SET_TexImage1D(exec, _mesa_TexImage1D);
    SET_TexParameterf(exec, _mesa_TexParameterf);
@@ -395,45 +294,9 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_BlendEquation(exec, _mesa_BlendEquation);
    SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
 
-#if FEATURE_colortable
-   SET_ColorSubTable(exec, _mesa_ColorSubTable);
-   SET_ColorTable(exec, _mesa_ColorTable);
-   SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv);
-   SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv);
-   SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable);
-   SET_CopyColorTable(exec, _mesa_CopyColorTable);
-   SET_GetColorTable(exec, _mesa_GetColorTable);
-   SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv);
-   SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv);
-#endif
-
-#if FEATURE_convolve
-   SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D);
-   SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D);
-   SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf);
-   SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv);
-   SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri);
-   SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv);
-   SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D);
-   SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D);
-   SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter);
-   SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv);
-   SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv);
-   SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D);
-#endif
-#if FEATURE_histogram
-   SET_GetHistogram(exec, _mesa_GetHistogram);
-   SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv);
-   SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv);
-   SET_GetMinmax(exec, _mesa_GetMinmax);
-   SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv);
-   SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv);
-   SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter);
-   SET_Histogram(exec, _mesa_Histogram);
-   SET_Minmax(exec, _mesa_Minmax);
-   SET_ResetHistogram(exec, _mesa_ResetHistogram);
-   SET_ResetMinmax(exec, _mesa_ResetMinmax);
-#endif
+   _mesa_init_colortable_dispatch(exec);
+   _mesa_init_convolve_dispatch(exec);
+   _mesa_init_histogram_dispatch(exec);
 
    /* OpenGL 2.0 */
    SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
@@ -545,32 +408,7 @@ _mesa_init_exec_table(struct _glapi_table *exec)
 #endif
 
    /* 197. GL_MESA_window_pos */
-#if FEATURE_drawpix
-   SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA);
-   SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA);
-   SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA);
-   SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA);
-   SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA);
-   SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA);
-   SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA);
-   SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA);
-   SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA);
-   SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA);
-   SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA);
-   SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA);
-   SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA);
-   SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA);
-   SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA);
-   SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA);
-   SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA);
-   SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA);
-   SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA);
-   SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA);
-   SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA);
-   SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA);
-   SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA);
-   SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA);
-#endif
+   /* part of _mesa_init_rastpos_dispatch(exec); */
 
    /* 200. GL_IBM_multimode_draw_arrays */
 #if _HAVE_FULL_GL
@@ -762,16 +600,7 @@ _mesa_init_exec_table(struct _glapi_table *exec)
 #endif
 
    /* ARB 29. GL_ARB_occlusion_query */
-#if FEATURE_ARB_occlusion_query
-   SET_GenQueriesARB(exec, _mesa_GenQueriesARB);
-   SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB);
-   SET_IsQueryARB(exec, _mesa_IsQueryARB);
-   SET_BeginQueryARB(exec, _mesa_BeginQueryARB);
-   SET_EndQueryARB(exec, _mesa_EndQueryARB);
-   SET_GetQueryivARB(exec, _mesa_GetQueryivARB);
-   SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB);
-   SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB);
-#endif
+   _mesa_init_queryobj_dispatch(exec);
 
    /* ARB 37. GL_ARB_draw_buffers */
 #if FEATURE_draw_read_buffer
@@ -881,11 +710,6 @@ _mesa_init_exec_table(struct _glapi_table *exec)
    SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);
 #endif
 
-#if FEATURE_EXT_timer_query
-   SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT);
-   SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT);
-#endif
-
 #if FEATURE_EXT_framebuffer_blit
    SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
 #endif
diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c
index 0e3f5ff95..3d466ac44 100644
--- a/mesalib/src/mesa/main/api_loopback.c
+++ b/mesalib/src/mesa/main/api_loopback.c
@@ -77,6 +77,10 @@
 #define FOGCOORDF(x)                CALL_FogCoordfEXT(GET_DISPATCH(), (x))
 #define SECONDARYCOLORF(a,b,c)      CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c))
 
+
+#if FEATURE_beginend
+
+
 static void GLAPIENTRY
 loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue )
 {
@@ -1655,3 +1659,6 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
    SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB);
    SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB);
 }
+
+
+#endif /* FEATURE_beginend */
diff --git a/mesalib/src/mesa/main/api_loopback.h b/mesalib/src/mesa/main/api_loopback.h
index 6f85bbc1d..3140eb515 100644
--- a/mesalib/src/mesa/main/api_loopback.h
+++ b/mesalib/src/mesa/main/api_loopback.h
@@ -27,11 +27,19 @@
 #ifndef API_LOOPBACK_H
 #define API_LOOPBACK_H
 
-#include "glheader.h"
+#include "main/mtypes.h"
 
-
-struct _glapi_table;
+#if FEATURE_beginend
 
 extern void _mesa_loopback_init_api_table( struct _glapi_table *dest );
 
-#endif
+#else /* FEATURE_beginend */
+
+static INLINE void
+_mesa_loopback_init_api_table( struct _glapi_table *dest )
+{
+}
+
+#endif /* FEATURE_beginend */
+
+#endif /* API_LOOPBACK_H */
diff --git a/mesalib/src/mesa/main/api_noop.c b/mesalib/src/mesa/main/api_noop.c
index 09ba7e506..f72f95730 100644
--- a/mesalib/src/mesa/main/api_noop.c
+++ b/mesalib/src/mesa/main/api_noop.c
@@ -30,9 +30,8 @@
 #include "context.h"
 #include "light.h"
 #include "macros.h"
-#if FEATURE_dlist
 #include "dlist.h"
-#endif
+#include "eval.h"
 #include "glapi/dispatch.h"
 
 
@@ -44,6 +43,9 @@
  */
 
 
+#if FEATURE_beginend
+
+
 static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -731,7 +733,7 @@ _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
    GET_CURRENT_CONTEXT(ctx);
    GLint i;
 
-   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
+   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
       return;
 
    CALL_Begin(GET_DISPATCH(), (mode));
@@ -757,6 +759,43 @@ _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
    CALL_End(GET_DISPATCH(), ());
 }
 
+static void GLAPIENTRY
+_mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
+				  const GLvoid *indices, GLint basevertex)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLint i;
+
+   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
+				     basevertex ))
+      return;
+
+   CALL_Begin(GET_DISPATCH(), (mode));
+
+   switch (type) {
+   case GL_UNSIGNED_BYTE:
+      for (i = 0 ; i < count ; i++)
+	  CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] +
+					      basevertex));
+      break;
+   case GL_UNSIGNED_SHORT:
+      for (i = 0 ; i < count ; i++)
+	  CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] +
+					      basevertex ));
+      break;
+   case GL_UNSIGNED_INT:
+      for (i = 0 ; i < count ; i++)
+	  CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] +
+					      basevertex ));
+      break;
+   default:
+      _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElementsBaseVertex(type)" );
+      break;
+   }
+
+   CALL_End(GET_DISPATCH(), ());
+}
+
 
 static void GLAPIENTRY
 _mesa_noop_DrawRangeElements(GLenum mode,
@@ -768,7 +807,7 @@ _mesa_noop_DrawRangeElements(GLenum mode,
 
    if (_mesa_validate_DrawRangeElements( ctx, mode,
 					 start, end,
-					 count, type, indices ))
+					 count, type, indices, 0 ))
        CALL_DrawElements(GET_DISPATCH(), (mode, count, type, indices));
 }
 
@@ -786,6 +825,40 @@ _mesa_noop_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
    }
 }
 
+static void GLAPIENTRY
+_mesa_noop_DrawRangeElementsBaseVertex(GLenum mode,
+				       GLuint start, GLuint end,
+				       GLsizei count, GLenum type,
+				       const GLvoid *indices, GLint basevertex)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (_mesa_validate_DrawRangeElements( ctx, mode,
+					 start, end,
+					 count, type, indices, basevertex ))
+      CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode, count, type, indices,
+						   basevertex));
+}
+
+/* GL_EXT_multi_draw_arrays */
+void GLAPIENTRY
+_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
+				       GLenum type,
+				       const GLvoid **indices,
+				       GLsizei primcount,
+				       const GLint *basevertex)
+{
+   GLsizei i;
+
+   for (i = 0; i < primcount; i++) {
+      if (count[i] > 0) {
+	 CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode, count[i], type,
+						      indices[i],
+						      basevertex[i]));
+      }
+   }
+}
+
 /*
  * Eval Mesh
  */
@@ -921,26 +994,21 @@ _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
 void
 _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
 {
-   vfmt->ArrayElement = _ae_loopback_array_elt;	        /* generic helper */
+   _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
+
    vfmt->Begin = _mesa_noop_Begin;
-#if FEATURE_dlist
-   vfmt->CallList = _mesa_CallList;
-   vfmt->CallLists = _mesa_CallLists;
-#endif
+
+   _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_);
+
    vfmt->Color3f = _mesa_noop_Color3f;
    vfmt->Color3fv = _mesa_noop_Color3fv;
    vfmt->Color4f = _mesa_noop_Color4f;
    vfmt->Color4fv = _mesa_noop_Color4fv;
    vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
    vfmt->End = _mesa_noop_End;
-#if FEATURE_evaluators
-   vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
-   vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
-   vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f;
-   vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv;
-   vfmt->EvalPoint1 = _mesa_noop_EvalPoint1;
-   vfmt->EvalPoint2 = _mesa_noop_EvalPoint2;
-#endif
+
+   _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_);
+
    vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
    vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
    vfmt->Indexf = _mesa_noop_Indexf;
@@ -995,6 +1063,10 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
    vfmt->DrawElements = _mesa_noop_DrawElements;
    vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements;
    vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements;
-   vfmt->EvalMesh1 = _mesa_noop_EvalMesh1;
-   vfmt->EvalMesh2 = _mesa_noop_EvalMesh2;
+   vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex;
+   vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex;
+   vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex;
 }
+
+
+#endif /* FEATURE_beginend */
diff --git a/mesalib/src/mesa/main/api_noop.h b/mesalib/src/mesa/main/api_noop.h
index a7956d00b..e7fd49baf 100644
--- a/mesalib/src/mesa/main/api_noop.h
+++ b/mesalib/src/mesa/main/api_noop.h
@@ -25,8 +25,9 @@
 #ifndef _API_NOOP_H
 #define _API_NOOP_H
 
-#include "mtypes.h"
-#include "context.h"
+#include "main/mtypes.h"
+
+#if FEATURE_beginend
 
 extern void GLAPIENTRY
 _mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
@@ -44,7 +45,16 @@ extern void GLAPIENTRY
 _mesa_noop_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
 			     const GLvoid **indices, GLsizei primcount);
 
+extern void GLAPIENTRY
+_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
+				       GLenum type,
+				       const GLvoid **indices,
+				       GLsizei primcount,
+				       const GLint *basevertex);
+
 extern void
 _mesa_noop_vtxfmt_init(GLvertexformat *vfmt);
 
-#endif
+#endif /* FEATURE_beginend */
+
+#endif /* _API_NOOP_H */
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 507e21fe8..e71e5a6ce 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -29,7 +29,7 @@
 #include "imports.h"
 #include "mtypes.h"
 #include "state.h"
-
+#include "vbo/vbo.h"
 
 
 /**
@@ -124,6 +124,40 @@ check_valid_to_render(GLcontext *ctx, const char *function)
    return GL_TRUE;
 }
 
+static GLboolean
+check_index_bounds(GLcontext *ctx, GLsizei count, GLenum type,
+		   const GLvoid *indices, GLint basevertex)
+{
+   struct _mesa_prim prim;
+   struct _mesa_index_buffer ib;
+   GLuint min, max;
+
+   /* Only the X Server needs to do this -- otherwise, accessing outside
+    * array/BO bounds allows application termination.
+    */
+   if (!ctx->Const.CheckArrayBounds)
+      return GL_TRUE;
+
+   memset(&prim, 0, sizeof(prim));
+   prim.count = count;
+
+   memset(&ib, 0, sizeof(ib));
+   ib.type = type;
+   ib.ptr = indices;
+   ib.obj = ctx->Array.ElementArrayBufferObj;
+
+   vbo_get_minmax_index(ctx, &prim, &ib, &min, &max);
+
+   if (min + basevertex < 0 ||
+       max + basevertex > ctx->Array.ArrayObj->_MaxElement) {
+      /* the max element is out of bounds of one or more enabled arrays */
+      _mesa_warning(ctx, "glDrawElements() index=%u is "
+		    "out of bounds (max=%u)", max, ctx->Array.ArrayObj->_MaxElement);
+      return GL_FALSE;
+   }
+
+   return GL_TRUE;
+}
 
 /**
  * Error checking for glDrawElements().  Includes parameter checking
@@ -133,7 +167,7 @@ check_valid_to_render(GLcontext *ctx, const char *function)
 GLboolean
 _mesa_validate_DrawElements(GLcontext *ctx,
 			    GLenum mode, GLsizei count, GLenum type,
-			    const GLvoid *indices)
+			    const GLvoid *indices, GLint basevertex)
 {
    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx,  GL_FALSE);
 
@@ -177,17 +211,8 @@ _mesa_validate_DrawElements(GLcontext *ctx,
          return GL_FALSE;
    }
 
-   if (ctx->Const.CheckArrayBounds) {
-      /* find max array index */
-      GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
-                                          ctx->Array.ElementArrayBufferObj);
-      if (max >= ctx->Array.ArrayObj->_MaxElement) {
-         /* the max element is out of bounds of one or more enabled arrays */
-         _mesa_warning(ctx, "glDrawElements() index=%u is "
-                       "out of bounds (max=%u)", max, ctx->Array.ArrayObj->_MaxElement);
-         return GL_FALSE;
-      }
-   }
+   if (!check_index_bounds(ctx, count, type, indices, basevertex))
+      return GL_FALSE;
 
    return GL_TRUE;
 }
@@ -202,7 +227,7 @@ GLboolean
 _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
 				 GLuint start, GLuint end,
 				 GLsizei count, GLenum type,
-				 const GLvoid *indices)
+				 const GLvoid *indices, GLint basevertex)
 {
    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
 
@@ -250,14 +275,8 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
          return GL_FALSE;
    }
 
-   if (ctx->Const.CheckArrayBounds) {
-      GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
-                                          ctx->Array.ElementArrayBufferObj);
-      if (max >= ctx->Array.ArrayObj->_MaxElement) {
-         /* the max element is out of bounds of one or more enabled arrays */
-         return GL_FALSE;
-      }
-   }
+   if (!check_index_bounds(ctx, count, type, indices, basevertex))
+      return GL_FALSE;
 
    return GL_TRUE;
 }
diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h
index ff82a2966..6064d15fe 100644
--- a/mesalib/src/mesa/main/api_validate.h
+++ b/mesalib/src/mesa/main/api_validate.h
@@ -43,13 +43,13 @@ _mesa_validate_DrawArrays(GLcontext *ctx,
 extern GLboolean
 _mesa_validate_DrawElements(GLcontext *ctx,
 			    GLenum mode, GLsizei count, GLenum type,
-			    const GLvoid *indices);
+			    const GLvoid *indices, GLint basevertex);
 
 extern GLboolean
 _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
 				 GLuint start, GLuint end,
 				 GLsizei count, GLenum type,
-				 const GLvoid *indices);
+				 const GLvoid *indices, GLint basevertex);
 
 
 #endif
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index ab99ca1c6..246c5521b 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -57,6 +57,7 @@
 #include "varray.h"
 #include "viewport.h"
 #include "mtypes.h"
+#include "glapi/dispatch.h"
 
 
 /**
@@ -74,6 +75,7 @@ struct gl_enable_attrib
    GLboolean Convolution2D;
    GLboolean Separable2D;
    GLboolean CullFace;
+   GLboolean DepthClamp;
    GLboolean DepthTest;
    GLboolean Dither;
    GLboolean Fog;
@@ -173,6 +175,9 @@ struct texture_state
 };
 
 
+#if FEATURE_attrib_stack
+
+
 /**
  * Allocate new attribute node of given type/kind.  Attach payload data.
  * Insert it into the linked list named by 'head'.
@@ -265,6 +270,7 @@ _mesa_PushAttrib(GLbitfield mask)
       attr->Convolution2D = ctx->Pixel.Convolution2DEnabled;
       attr->Separable2D = ctx->Pixel.Separable2DEnabled;
       attr->CullFace = ctx->Polygon.CullFlag;
+      attr->DepthClamp = ctx->Transform.DepthClamp;
       attr->DepthTest = ctx->Depth.Test;
       attr->Dither = ctx->Color.DitherFlag;
       attr->Fog = ctx->Fog.Enabled;
@@ -514,6 +520,8 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
                    enable->ColorTable[COLORTABLE_POSTCOLORMATRIX],
                    GL_POST_COLOR_MATRIX_COLOR_TABLE);
    TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
+   TEST_AND_UPDATE(ctx->Transform.DepthClamp, enable->DepthClamp,
+		   GL_DEPTH_CLAMP);
    TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
    TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
    TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D,
@@ -1221,6 +1229,9 @@ _mesa_PopAttrib(void)
                if (xform->RescaleNormals != ctx->Transform.RescaleNormals)
                   _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT,
                                    ctx->Transform.RescaleNormals);
+               if (xform->DepthClamp != ctx->Transform.DepthClamp)
+                  _mesa_set_enable(ctx, GL_DEPTH_CLAMP,
+                                   ctx->Transform.DepthClamp);
             }
             break;
          case GL_TEXTURE_BIT:
@@ -1457,6 +1468,19 @@ _mesa_PopClientAttrib(void)
 }
 
 
+void
+_mesa_init_attrib_dispatch(struct _glapi_table *disp)
+{
+   SET_PopAttrib(disp, _mesa_PopAttrib);
+   SET_PushAttrib(disp, _mesa_PushAttrib);
+   SET_PopClientAttrib(disp, _mesa_PopClientAttrib);
+   SET_PushClientAttrib(disp, _mesa_PushClientAttrib);
+}
+
+
+#endif /* FEATURE_attrib_stack */
+
+
 /**
  * Free any attribute state data that might be attached to the context.
  */
diff --git a/mesalib/src/mesa/main/attrib.h b/mesalib/src/mesa/main/attrib.h
index 2cf8fe693..6b48a1766 100644
--- a/mesalib/src/mesa/main/attrib.h
+++ b/mesalib/src/mesa/main/attrib.h
@@ -26,10 +26,10 @@
 #define ATTRIB_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
 
-#if _HAVE_FULL_GL
+#if FEATURE_attrib_stack
 
 extern void GLAPIENTRY
 _mesa_PushAttrib( GLbitfield mask );
@@ -43,18 +43,34 @@ _mesa_PushClientAttrib( GLbitfield mask );
 extern void GLAPIENTRY
 _mesa_PopClientAttrib( void );
 
+extern void
+_mesa_init_attrib_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_attrib_stack */
+
+static INLINE void
+_mesa_PushClientAttrib( GLbitfield mask )
+{
+   ASSERT_NO_FEATURE();
+}
+
+static INLINE void
+_mesa_PopClientAttrib( void )
+{
+   ASSERT_NO_FEATURE();
+}
+
+static INLINE void
+_mesa_init_attrib_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_attrib_stack */
+
 extern void 
 _mesa_init_attrib( GLcontext *ctx );
 
 extern void 
 _mesa_free_attrib_data( GLcontext *ctx );
 
-#else
-
-/** No-op */
-#define _mesa_init_attrib( c ) ((void)0)
-#define _mesa_free_attrib_data( c ) ((void)0)
-
-#endif
-
-#endif
+#endif /* ATTRIB_H */
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index 39cf6153e..830e3b2e5 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -72,7 +72,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+   if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n",
                   _mesa_lookup_enum_by_nr(sfactorRGB),
                   _mesa_lookup_enum_by_nr(dfactorRGB),
@@ -250,7 +250,7 @@ _mesa_BlendEquation( GLenum mode )
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+   if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glBlendEquation %s\n",
                   _mesa_lookup_enum_by_nr(mode));
 
@@ -278,7 +278,7 @@ _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+   if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glBlendEquationSeparateEXT %s %s\n",
                   _mesa_lookup_enum_by_nr(modeRGB),
                   _mesa_lookup_enum_by_nr(modeA));
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 189b5e165..52c4995b0 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -52,51 +52,55 @@
 
 
 /**
- * Get the buffer object bound to the specified target in a GL context.
- *
- * \param ctx     GL context
- * \param target  Buffer object target to be retrieved.  Currently this must
- *                be either \c GL_ARRAY_BUFFER or \c GL_ELEMENT_ARRAY_BUFFER.
- * \return   A pointer to the buffer object bound to \c target in the
+ * Return pointer to address of a buffer object target.
+ * \param ctx  the GL context
+ * \param target  the buffer object target to be retrieved.
+ * \return   pointer to pointer to the buffer object bound to \c target in the
  *           specified context or \c NULL if \c target is invalid.
  */
-static INLINE struct gl_buffer_object *
-get_buffer(GLcontext *ctx, GLenum target)
+static INLINE struct gl_buffer_object **
+get_buffer_target(GLcontext *ctx, GLenum target)
 {
-   struct gl_buffer_object * bufObj = NULL;
-
    switch (target) {
-      case GL_ARRAY_BUFFER_ARB:
-         bufObj = ctx->Array.ArrayBufferObj;
-         break;
-      case GL_ELEMENT_ARRAY_BUFFER_ARB:
-         bufObj = ctx->Array.ElementArrayBufferObj;
-         break;
-      case GL_PIXEL_PACK_BUFFER_EXT:
-         bufObj = ctx->Pack.BufferObj;
-         break;
-      case GL_PIXEL_UNPACK_BUFFER_EXT:
-         bufObj = ctx->Unpack.BufferObj;
-         break;
-      case GL_COPY_READ_BUFFER:
-         if (ctx->Extensions.ARB_copy_buffer) {
-            bufObj = ctx->CopyReadBuffer;
-         }
-         break;
-      case GL_COPY_WRITE_BUFFER:
-         if (ctx->Extensions.ARB_copy_buffer) {
-            bufObj = ctx->CopyWriteBuffer;
-         }
-         break;
-      default:
-         /* error must be recorded by caller */
-         return NULL;
+   case GL_ARRAY_BUFFER_ARB:
+      return &ctx->Array.ArrayBufferObj;
+   case GL_ELEMENT_ARRAY_BUFFER_ARB:
+      return &ctx->Array.ElementArrayBufferObj;
+   case GL_PIXEL_PACK_BUFFER_EXT:
+      return &ctx->Pack.BufferObj;
+   case GL_PIXEL_UNPACK_BUFFER_EXT:
+      return &ctx->Unpack.BufferObj;
+   case GL_COPY_READ_BUFFER:
+      if (ctx->Extensions.ARB_copy_buffer) {
+         return &ctx->CopyReadBuffer;
+      }
+      break;
+   case GL_COPY_WRITE_BUFFER:
+      if (ctx->Extensions.ARB_copy_buffer) {
+         return &ctx->CopyWriteBuffer;
+      }
+      break;
+   default:
+      return NULL;
    }
+   return NULL;
+}
 
-   /* bufObj should point to NullBufferObj or a user-created buffer object */
-   ASSERT(bufObj);
 
-   return bufObj;
+/**
+ * Get the buffer object bound to the specified target in a GL context.
+ * \param ctx  the GL context
+ * \param target  the buffer object target to be retrieved.
+ * \return   pointer to the buffer object bound to \c target in the
+ *           specified context or \c NULL if \c target is invalid.
+ */
+static INLINE struct gl_buffer_object *
+get_buffer(GLcontext *ctx, GLenum target)
+{
+   struct gl_buffer_object **bufObj = get_buffer_target(ctx, target);
+   if (bufObj)
+      return *bufObj;
+   return NULL;
 }
 
 
@@ -552,6 +556,7 @@ _mesa_init_buffer_objects( GLcontext *ctx )
 
 /**
  * Bind the specified target to buffer for the specified context.
+ * Called by glBindBuffer() and other functions.
  */
 static void
 bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer)
@@ -560,40 +565,14 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer)
    struct gl_buffer_object *newBufObj = NULL;
    struct gl_buffer_object **bindTarget = NULL;
 
-   switch (target) {
-   case GL_ARRAY_BUFFER_ARB:
-      bindTarget = &ctx->Array.ArrayBufferObj;
-      break;
-   case GL_ELEMENT_ARRAY_BUFFER_ARB:
-      bindTarget = &ctx->Array.ElementArrayBufferObj;
-      break;
-   case GL_PIXEL_PACK_BUFFER_EXT:
-      bindTarget = &ctx->Pack.BufferObj;
-      break;
-   case GL_PIXEL_UNPACK_BUFFER_EXT:
-      bindTarget = &ctx->Unpack.BufferObj;
-      break;
-   case GL_COPY_READ_BUFFER:
-      if (ctx->Extensions.ARB_copy_buffer) {
-         bindTarget = &ctx->CopyReadBuffer;
-      }
-      break;
-   case GL_COPY_WRITE_BUFFER:
-      if (ctx->Extensions.ARB_copy_buffer) {
-         bindTarget = &ctx->CopyWriteBuffer;
-      }
-      break;
-   default:
-      ; /* no-op / we'll hit the follow error test next */
-   }
-
+   bindTarget = get_buffer_target(ctx, target);
    if (!bindTarget) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)");
       return;
    }
 
    /* Get pointer to old buffer object (to be unbound) */
-   oldBufObj = get_buffer(ctx, target);
+   oldBufObj = *bindTarget;
    if (oldBufObj && oldBufObj->Name == buffer)
       return;   /* rebinding the same buffer object- no change */
 
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index d8b5f3b1f..97f065975 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -338,13 +338,13 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
    if (ctx->Driver.DrawBuffers)
       ctx->Driver.DrawBuffers(ctx, n, buffers);
    else if (ctx->Driver.DrawBuffer)
-      ctx->Driver.DrawBuffer(ctx, n>0? buffers[0]:GL_NONE);
+      ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
 }
 
 
 /**
  * Helper function to set the GL_DRAW_BUFFER state in the context and
- * current FBO.
+ * current FBO.  Called via glDrawBuffer(), glDrawBuffersARB()
  *
  * All error checking will have been done prior to calling this function
  * so nothing should go wrong at this point.
@@ -362,6 +362,7 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
    GLbitfield mask[MAX_DRAW_BUFFERS];
+   GLboolean newState = GL_FALSE;
 
    if (!destMask) {
       /* compute destMask values now */
@@ -375,34 +376,54 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
       destMask = mask;
    }
 
+   /*
+    * If n==1, destMask[0] may have up to four bits set.
+    * Otherwise, destMask[x] can only have one bit set.
+    */
    if (n == 1) {
-      GLuint buf, count = 0;
-      /* init to -1 to help catch errors */
-      fb->_ColorDrawBufferIndexes[0] = -1;
-      for (buf = 0; buf < BUFFER_COUNT; buf++) {
-         if (destMask[0] & (1 << buf)) {
-            fb->_ColorDrawBufferIndexes[count] = buf;
-            count++;
+      GLuint count = 0, destMask0 = destMask[0];
+      while (destMask0) {
+         GLint bufIndex = _mesa_ffs(destMask0) - 1;
+         if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
+            fb->_ColorDrawBufferIndexes[count] = bufIndex;
+            newState = GL_TRUE;
          }
+         count++;
+         destMask0 &= ~(1 << bufIndex);
       }
       fb->ColorDrawBuffer[0] = buffers[0];
-      fb->_NumColorDrawBuffers = count;
+      if (fb->_NumColorDrawBuffers != count) {
+         fb->_NumColorDrawBuffers = count;
+         newState = GL_TRUE;
+      }
    }
    else {
       GLuint buf, count = 0;
       for (buf = 0; buf < n; buf++ ) {
          if (destMask[buf]) {
-            fb->_ColorDrawBufferIndexes[buf] = _mesa_ffs(destMask[buf]) - 1;
+            GLint bufIndex = _mesa_ffs(destMask[buf]) - 1;
+            /* only one bit should be set in the destMask[buf] field */
+            ASSERT(_mesa_bitcount(destMask[buf]) == 1);
+            if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {
+               fb->_ColorDrawBufferIndexes[buf] = bufIndex;
+               newState = GL_TRUE;
+            }
             fb->ColorDrawBuffer[buf] = buffers[buf];
             count = buf + 1;
          }
          else {
-            fb->_ColorDrawBufferIndexes[buf] = -1;
+            if (fb->_ColorDrawBufferIndexes[buf] != -1) {
+               fb->_ColorDrawBufferIndexes[buf] = -1;
+               newState = GL_TRUE;
+            }
          }
       }
       /* set remaining outputs to -1 (GL_NONE) */
       while (buf < ctx->Const.MaxDrawBuffers) {
-         fb->_ColorDrawBufferIndexes[buf] = -1;
+         if (fb->_ColorDrawBufferIndexes[buf] != -1) {
+            fb->_ColorDrawBufferIndexes[buf] = -1;
+            newState = GL_TRUE;
+         }
          fb->ColorDrawBuffer[buf] = GL_NONE;
          buf++;
       }
@@ -413,11 +434,15 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
       /* also set context drawbuffer state */
       GLuint buf;
       for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
-         ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf];
+         if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {
+            ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf];
+            newState = GL_TRUE;
+         }
       }
    }
 
-   ctx->NewState |= _NEW_BUFFERS;
+   if (newState)
+      FLUSH_VERTICES(ctx, _NEW_BUFFERS);
 }
 
 
diff --git a/mesalib/src/mesa/main/colormac.h b/mesalib/src/mesa/main/colormac.h
index 815624ee5..905f4e228 100644
--- a/mesalib/src/mesa/main/colormac.h
+++ b/mesalib/src/mesa/main/colormac.h
@@ -140,9 +140,9 @@
  */
 #define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f)	\
 do {						\
-   UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]);	\
-   UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]);	\
-   UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]);	\
+   UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]);	\
+   UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]);	\
+   UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]);	\
 } while (0)
 
 
@@ -156,10 +156,10 @@ do {						\
  */
 #define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f)	\
 do {						\
-   UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]);	\
-   UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]);	\
-   UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]);	\
-   UNCLAMPED_FLOAT_TO_CHAN(dst[3], f[3]);	\
+   UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]);	\
+   UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]);	\
+   UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]);	\
+   UNCLAMPED_FLOAT_TO_CHAN((dst)[3], (f)[3]);	\
 } while (0)
 
 
@@ -210,6 +210,12 @@ do {						\
 #define PACK_COLOR_88_REV( L, A )					\
    (((A) << 8) | (L))
 
+#define PACK_COLOR_1616( L, A )						\
+   (((L) << 16) | (A))
+
+#define PACK_COLOR_1616_REV( L, A )					\
+   (((A) << 16) | (L))
+
 #define PACK_COLOR_332( R, G, B )					\
    (((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6))
 
diff --git a/mesalib/src/mesa/main/colortab.c b/mesalib/src/mesa/main/colortab.c
index 5a7de5f20..5ede76c1f 100644
--- a/mesalib/src/mesa/main/colortab.c
+++ b/mesalib/src/mesa/main/colortab.c
@@ -31,6 +31,11 @@
 #include "macros.h"
 #include "state.h"
 #include "teximage.h"
+#include "texstate.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_colortable
 
 
 /**
@@ -278,7 +283,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
    static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 };
    static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 };
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
    struct gl_texture_object *texObj = NULL;
    struct gl_color_table *table = NULL;
    GLboolean proxy = GL_FALSE;
@@ -443,7 +448,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
    static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 };
    static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 };
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
    struct gl_texture_object *texObj = NULL;
    struct gl_color_table *table = NULL;
    const GLfloat *scale = one, *bias = zero;
@@ -535,37 +540,44 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_CopyColorTable(GLenum target, GLenum internalformat,
                      GLint x, GLint y, GLsizei width)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   /* Select buffer to read from */
+   if (!ctx->ReadBuffer->_ColorReadBuffer) {
+      return;      /* no readbuffer - OK */
+   }
+
    ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width );
 }
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_CopyColorSubTable(GLenum target, GLsizei start,
                         GLint x, GLint y, GLsizei width)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
+   if (!ctx->ReadBuffer->_ColorReadBuffer) {
+      return;      /* no readbuffer - OK */
+   }
+
    ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width );
 }
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetColorTable( GLenum target, GLenum format,
                      GLenum type, GLvoid *data )
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
    struct gl_color_table *table = NULL;
    GLfloat rgba[MAX_COLOR_TABLE_SIZE][4];
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -694,7 +706,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 {
    GLfloat *scale, *bias;
@@ -739,7 +751,7 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
 {
    GLfloat fparams[4];
@@ -762,11 +774,11 @@ _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
    struct gl_color_table *table = NULL;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -889,11 +901,11 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
    struct gl_color_table *table = NULL;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -1044,6 +1056,25 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
    }
 }
 
+
+void
+_mesa_init_colortable_dispatch(struct _glapi_table *disp)
+{
+   SET_ColorSubTable(disp, _mesa_ColorSubTable);
+   SET_ColorTable(disp, _mesa_ColorTable);
+   SET_ColorTableParameterfv(disp, _mesa_ColorTableParameterfv);
+   SET_ColorTableParameteriv(disp, _mesa_ColorTableParameteriv);
+   SET_CopyColorSubTable(disp, _mesa_CopyColorSubTable);
+   SET_CopyColorTable(disp, _mesa_CopyColorTable);
+   SET_GetColorTable(disp, _mesa_GetColorTable);
+   SET_GetColorTableParameterfv(disp, _mesa_GetColorTableParameterfv);
+   SET_GetColorTableParameteriv(disp, _mesa_GetColorTableParameteriv);
+}
+
+
+#endif /* FEATURE_colortable */
+
+
 /**********************************************************************/
 /*****                      Initialization                        *****/
 /**********************************************************************/
diff --git a/mesalib/src/mesa/main/colortab.h b/mesalib/src/mesa/main/colortab.h
index b6ff737a6..652fb5824 100644
--- a/mesalib/src/mesa/main/colortab.h
+++ b/mesalib/src/mesa/main/colortab.h
@@ -27,9 +27,16 @@
 #define COLORTAB_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
-#if _HAVE_FULL_GL
+#if FEATURE_colortable
+
+#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl)                \
+   do {                                                              \
+      (driver)->CopyColorTable       = impl ## CopyColorTable;       \
+      (driver)->CopyColorSubTable    = impl ## CopyColorSubTable;    \
+      (driver)->UpdateTexturePalette = impl ## UpdateTexturePalette; \
+   } while (0)
 
 extern void GLAPIENTRY
 _mesa_ColorTable( GLenum target, GLenum internalformat,
@@ -41,32 +48,35 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
                      GLsizei count, GLenum format, GLenum type,
                      const GLvoid *table );
 
-extern void GLAPIENTRY
-_mesa_CopyColorSubTable(GLenum target, GLsizei start,
-                        GLint x, GLint y, GLsizei width);
-
-extern void GLAPIENTRY
-_mesa_CopyColorTable(GLenum target, GLenum internalformat,
-                     GLint x, GLint y, GLsizei width);
+extern void
+_mesa_init_colortable_dispatch(struct _glapi_table *disp);
 
-extern void GLAPIENTRY
-_mesa_GetColorTable( GLenum target, GLenum format,
-                     GLenum type, GLvoid *table );
+#else /* FEATURE_colortable */
 
-extern void GLAPIENTRY
-_mesa_ColorTableParameterfv(GLenum target, GLenum pname,
-                            const GLfloat *params);
+#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) do { } while (0)
 
-extern void GLAPIENTRY
-_mesa_ColorTableParameteriv(GLenum target, GLenum pname,
-                            const GLint *params);
+static INLINE void GLAPIENTRY
+_mesa_ColorTable( GLenum target, GLenum internalformat,
+                  GLsizei width, GLenum format, GLenum type,
+                  const GLvoid *table )
+{
+   ASSERT_NO_FEATURE();
+}
 
-extern void GLAPIENTRY
-_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params );
+static INLINE void GLAPIENTRY
+_mesa_ColorSubTable( GLenum target, GLsizei start,
+                     GLsizei count, GLenum format, GLenum type,
+                     const GLvoid *table )
+{
+   ASSERT_NO_FEATURE();
+}
 
-extern void GLAPIENTRY
-_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params );
+static INLINE void
+_mesa_init_colortable_dispatch(struct _glapi_table *disp)
+{
+}
 
+#endif /* FEATURE_colortable */
 
 
 extern void
@@ -81,20 +91,5 @@ _mesa_init_colortables( GLcontext *ctx );
 extern void 
 _mesa_free_colortables_data( GLcontext *ctx );
 
-#else
-
-/** No-op */
-#define _mesa_init_colortable( p ) ((void) 0)
-
-/** No-op */
-#define _mesa_free_colortable_data( p ) ((void) 0)
-
-/** No-op */
-#define _mesa_init_colortables( p ) ((void)0)
-
-/** No-op */
-#define _mesa_free_colortables_data( p ) ((void)0)
-
-#endif
 
-#endif
+#endif /* COLORTAB_H */
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index 9319505a7..4eb249b4a 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -107,8 +107,7 @@ extern "C" {
 /**
  * finite macro.
  */
-#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
-#  define __WIN32__
+#if defined(_MSC_VER)
 #  define finite _finite
 #elif defined(__WATCOMC__)
 #  define finite _finite
@@ -235,7 +234,12 @@ extern "C" {
 #elif defined(__APPLE__)
 #include <CoreFoundation/CFByteOrder.h>
 #define CPU_TO_LE32( x )	CFSwapInt32HostToLittle( x )
-#else /*__linux__ __APPLE__*/
+#elif (defined(_AIX) || defined(__blrts))
+#define CPU_TO_LE32( x )        x = ((x & 0x000000ff) << 24) | \
+                                    ((x & 0x0000ff00) <<  8) | \
+                                    ((x & 0x00ff0000) >>  8) | \
+                                    ((x & 0xff000000) >> 24);
+#else /*__linux__ */
 #include <sys/endian.h>
 #define CPU_TO_LE32( x )	bswap32( x )
 #endif /*__linux__*/
diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h
index 8a09efdb5..c5048970c 100644
--- a/mesalib/src/mesa/main/config.h
+++ b/mesalib/src/mesa/main/config.h
@@ -205,7 +205,7 @@
 #define MAX_VARYING                    16    /**< number of float[4] vectors */
 #define MAX_SAMPLERS                   MAX_TEXTURE_IMAGE_UNITS
 #define MAX_PROGRAM_INPUTS             32
-#define MAX_PROGRAM_OUTPUTS            32
+#define MAX_PROGRAM_OUTPUTS            64
 /*@}*/
 
 /** For GL_ARB_vertex_program */
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index e844a7432..87eae9663 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -79,42 +79,28 @@
 #include "glheader.h"
 #include "mfeatures.h"
 #include "imports.h"
-#if FEATURE_accum
 #include "accum.h"
-#endif
 #include "api_exec.h"
 #include "arrayobj.h"
-#if FEATURE_attrib_stack
 #include "attrib.h"
-#endif
 #include "blend.h"
 #include "buffers.h"
 #include "bufferobj.h"
-#if FEATURE_colortable
 #include "colortab.h"
-#endif
 #include "context.h"
 #include "cpuinfo.h"
 #include "debug.h"
 #include "depth.h"
-#if FEATURE_dlist
 #include "dlist.h"
-#endif
-#if FEATURE_evaluators
 #include "eval.h"
-#endif
 #include "enums.h"
 #include "extensions.h"
 #include "fbobject.h"
-#if FEATURE_feedback
 #include "feedback.h"
-#endif
 #include "fog.h"
 #include "framebuffer.h"
 #include "get.h"
-#if FEATURE_histogram
 #include "histogram.h"
-#endif
 #include "hint.h"
 #include "hash.h"
 #include "light.h"
@@ -126,21 +112,18 @@
 #include "pixelstore.h"
 #include "points.h"
 #include "polygon.h"
-#if FEATURE_ARB_occlusion_query
 #include "queryobj.h"
-#endif
 #if FEATURE_ARB_sync
 #include "syncobj.h"
 #endif
-#if FEATURE_drawpix
 #include "rastpos.h"
-#endif
+#include "remap.h"
 #include "scissor.h"
 #include "shared.h"
 #include "simple_list.h"
 #include "state.h"
 #include "stencil.h"
-#include "texcompress.h"
+#include "texcompress_s3tc.h"
 #include "teximage.h"
 #include "texobj.h"
 #include "texstate.h"
@@ -150,7 +133,6 @@
 #include "viewport.h"
 #include "vtxfmt.h"
 #include "glapi/glthread.h"
-#include "glapi/glapioffsets.h"
 #include "glapi/glapitable.h"
 #include "shader/program.h"
 #include "shader/prog_print.h"
@@ -191,6 +173,8 @@ GLfloat _mesa_ubyte_to_float_color_tab[256];
 void
 _mesa_notifySwapBuffers(__GLcontext *ctx)
 {
+   if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS)
+      _mesa_debug(ctx, "SwapBuffers\n");
    FLUSH_CURRENT( ctx, 0 );
    if (ctx->Driver.Flush) {
       ctx->Driver.Flush(ctx);
@@ -423,6 +407,8 @@ one_time_init( GLcontext *ctx )
 
       _mesa_get_cpu_features();
 
+      _mesa_init_remap_table();
+
       _mesa_init_sqrt_table();
 
       for (i = 0; i < 256; i++) {
@@ -578,10 +564,6 @@ _mesa_init_constants(GLcontext *ctx)
    /* GL_ARB_draw_buffers */
    ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
 
-   /* GL_OES_read_format */
-   ctx->Const.ColorReadFormat = GL_RGBA;
-   ctx->Const.ColorReadType = GL_UNSIGNED_BYTE;
-
 #if FEATURE_EXT_framebuffer_object
    ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
    ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
@@ -615,9 +597,11 @@ _mesa_init_constants(GLcontext *ctx)
    ASSERT(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX);
    ASSERT(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX);
 
-   /* check that we don't exceed various 32-bit bitfields */
-   ASSERT(VERT_RESULT_MAX <= 32);
-   ASSERT(FRAG_ATTRIB_MAX <= 32);
+   /* check that we don't exceed the size of various bitfields */
+   ASSERT(VERT_RESULT_MAX <=
+	  (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
+   ASSERT(FRAG_ATTRIB_MAX <=
+	  (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
 }
 
 
@@ -678,36 +662,20 @@ init_attrib_groups(GLcontext *ctx)
    _mesa_init_extensions( ctx );
 
    /* Attribute Groups */
-#if FEATURE_accum
    _mesa_init_accum( ctx );
-#endif
-#if FEATURE_attrib_stack
    _mesa_init_attrib( ctx );
-#endif
    _mesa_init_buffer_objects( ctx );
    _mesa_init_color( ctx );
-#if FEATURE_colortable
    _mesa_init_colortables( ctx );
-#endif
    _mesa_init_current( ctx );
    _mesa_init_depth( ctx );
    _mesa_init_debug( ctx );
-#if FEATURE_dlist
    _mesa_init_display_list( ctx );
-#endif
-#if FEATURE_evaluators
    _mesa_init_eval( ctx );
-#endif
    _mesa_init_fbobjects( ctx );
-#if FEATURE_feedback
    _mesa_init_feedback( ctx );
-#else
-   ctx->RenderMode = GL_RENDER;
-#endif
    _mesa_init_fog( ctx );
-#if FEATURE_histogram
    _mesa_init_histogram( ctx );
-#endif
    _mesa_init_hint( ctx );
    _mesa_init_line( ctx );
    _mesa_init_lighting( ctx );
@@ -718,15 +686,11 @@ init_attrib_groups(GLcontext *ctx)
    _mesa_init_point( ctx );
    _mesa_init_polygon( ctx );
    _mesa_init_program( ctx );
-#if FEATURE_ARB_occlusion_query
-   _mesa_init_query( ctx );
-#endif
+   _mesa_init_queryobj( ctx );
 #if FEATURE_ARB_sync
    _mesa_init_sync( ctx );
 #endif
-#if FEATURE_drawpix
    _mesa_init_rastpos( ctx );
-#endif
    _mesa_init_scissor( ctx );
    _mesa_init_shader_state( ctx );
    _mesa_init_stencil( ctx );
@@ -737,12 +701,7 @@ init_attrib_groups(GLcontext *ctx)
    if (!_mesa_init_texture( ctx ))
       return GL_FALSE;
 
-#if FEATURE_texture_s3tc
    _mesa_init_texture_s3tc( ctx );
-#endif
-#if FEATURE_texture_fxt1
-   _mesa_init_texture_fxt1( ctx );
-#endif
 
    /* Miscellaneous */
    ctx->NewState = _NEW_ALL;
@@ -904,10 +863,12 @@ _mesa_initialize_context(GLcontext *ctx,
    _mesa_init_exec_table(ctx->Exec);
 #endif
    ctx->CurrentDispatch = ctx->Exec;
+
 #if FEATURE_dlist
-   _mesa_init_dlist_table(ctx->Save);
+   _mesa_init_save_table(ctx->Save);
    _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
 #endif
+
    /* Neutral tnl module stuff */
    _mesa_init_exec_vtxfmt( ctx ); 
    ctx->TnlModule.Current = NULL;
@@ -1006,24 +967,16 @@ _mesa_free_context_data( GLcontext *ctx )
    _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
    _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
 
-#if FEATURE_attrib_stack
    _mesa_free_attrib_data(ctx);
-#endif
    _mesa_free_lighting_data( ctx );
-#if FEATURE_evaluators
    _mesa_free_eval_data( ctx );
-#endif
    _mesa_free_texture_data( ctx );
    _mesa_free_matrix_data( ctx );
    _mesa_free_viewport_data( ctx );
-#if FEATURE_colortable
    _mesa_free_colortables_data( ctx );
-#endif
    _mesa_free_program_data(ctx);
    _mesa_free_shader_state(ctx);
-#if FEATURE_ARB_occlusion_query
-   _mesa_free_query_data(ctx);
-#endif
+   _mesa_free_queryobj_data(ctx);
 #if FEATURE_ARB_sync
    _mesa_free_sync_data(ctx);
 #endif
@@ -1055,6 +1008,9 @@ _mesa_free_context_data( GLcontext *ctx )
       _mesa_free_shared_state( ctx, ctx->Shared );
    }
 
+   /* needs to be after freeing shared state */
+   _mesa_free_display_list_data(ctx);
+
    if (ctx->Extensions.String)
       _mesa_free((void *) ctx->Extensions.String);
 
diff --git a/mesalib/src/mesa/main/convolve.c b/mesalib/src/mesa/main/convolve.c
index 70951112a..8db3e79d3 100644
--- a/mesalib/src/mesa/main/convolve.c
+++ b/mesalib/src/mesa/main/convolve.c
@@ -40,6 +40,10 @@
 #include "mtypes.h"
 #include "pixel.h"
 #include "state.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_convolve
 
 
 /*
@@ -256,7 +260,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -299,7 +303,7 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -351,7 +355,7 @@ _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -394,7 +398,7 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -459,7 +463,7 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
 {
    GLint baseFormat;
@@ -482,12 +486,16 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi
       return;
    }
 
+   if (!ctx->ReadBuffer->_ColorReadBuffer) {
+      return;      /* no readbuffer - OK */
+   }
+
    ctx->Driver.CopyConvolutionFilter1D( ctx, target, 
 					internalFormat, x, y, width);
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
 {
    GLint baseFormat;
@@ -514,12 +522,16 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi
       return;
    }
 
+   if (!ctx->ReadBuffer->_ColorReadBuffer) {
+      return;      /* no readbuffer - OK */
+   }
+
    ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y, 
 					width, height );
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
                            GLvoid *image)
 {
@@ -578,7 +590,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -639,7 +651,7 @@ _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -709,7 +721,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
                          GLvoid *row, GLvoid *column, GLvoid *span)
 {
@@ -776,7 +788,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
 {
    const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
@@ -1425,3 +1437,25 @@ _mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
       *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1);
    }
 }
+
+
+void
+_mesa_init_convolve_dispatch(struct _glapi_table *disp)
+{
+   SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D);
+   SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D);
+   SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf);
+   SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv);
+   SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri);
+   SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv);
+   SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D);
+   SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D);
+   SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter);
+   SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv);
+   SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv);
+   SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D);
+   SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter);
+}
+
+
+#endif /* FEATURE_convolve */
diff --git a/mesalib/src/mesa/main/convolve.h b/mesalib/src/mesa/main/convolve.h
index 4505cdae0..59492bc7c 100644
--- a/mesalib/src/mesa/main/convolve.h
+++ b/mesalib/src/mesa/main/convolve.h
@@ -28,10 +28,17 @@
 #define CONVOLVE_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
 
-#if _HAVE_FULL_GL
+#if FEATURE_convolve
+
+#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl)                        \
+   do {                                                                    \
+      (driver)->CopyConvolutionFilter1D = impl ## CopyConvolutionFilter1D; \
+      (driver)->CopyConvolutionFilter2D = impl ## CopyConvolutionFilter2D; \
+   } while (0)
+
 extern void GLAPIENTRY
 _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
                           GLenum format, GLenum type, const GLvoid *image);
@@ -41,74 +48,79 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width,
                           GLsizei height, GLenum format, GLenum type,
                           const GLvoid *image);
 
-extern void GLAPIENTRY
-_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
-
-extern void GLAPIENTRY
-_mesa_ConvolutionParameterfv(GLenum target, GLenum pname,
-                             const GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params);
-
-extern void GLAPIENTRY
-_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
-
-extern void GLAPIENTRY
-_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat,
-                              GLint x, GLint y, GLsizei width);
+extern void
+_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
+                        const GLfloat *srcImage, GLfloat *dstImage);
 
-extern void GLAPIENTRY
-_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat,
-                              GLint x, GLint y, GLsizei width, GLsizei height);
+extern void
+_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
+                        const GLfloat *srcImage, GLfloat *dstImage);
 
-extern void GLAPIENTRY
-_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
-                           GLvoid *image);
+extern void
+_mesa_convolve_sep_image(const GLcontext *ctx,
+                         GLsizei *width, GLsizei *height,
+                         const GLfloat *srcImage, GLfloat *dstImage);
 
-extern void GLAPIENTRY
-_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
+extern void
+_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
+                                   GLsizei *width, GLsizei *height);
 
-extern void GLAPIENTRY
-_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
+extern void
+_mesa_init_convolve_dispatch(struct _glapi_table *disp);
 
-extern void GLAPIENTRY
-_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
-                         GLvoid *row, GLvoid *column, GLvoid *span);
+#else /* FEATURE_convolve */
 
-extern void GLAPIENTRY
-_mesa_SeparableFilter2D(GLenum target, GLenum internalformat,
-                        GLsizei width, GLsizei height,
-                        GLenum format, GLenum type,
-                        const GLvoid *row, const GLvoid *column);
+#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) do { } while (0)
 
+static INLINE void GLAPIENTRY
+_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
+                          GLenum format, GLenum type, const GLvoid *image)
+{
+   ASSERT_NO_FEATURE();
+}
 
+static INLINE void GLAPIENTRY
+_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width,
+                          GLsizei height, GLenum format, GLenum type,
+                          const GLvoid *image)
+{
+   ASSERT_NO_FEATURE();
+}
 
-extern void
+static INLINE void
 _mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
-                        const GLfloat *srcImage, GLfloat *dstImage);
-
+                        const GLfloat *srcImage, GLfloat *dstImage)
+{
+   ASSERT_NO_FEATURE();
+}
 
-extern void
+static INLINE void
 _mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
-                        const GLfloat *srcImage, GLfloat *dstImage);
+                        const GLfloat *srcImage, GLfloat *dstImage)
+{
+   ASSERT_NO_FEATURE();
+}
 
 
-extern void
+static INLINE void
 _mesa_convolve_sep_image(const GLcontext *ctx,
                          GLsizei *width, GLsizei *height,
-                         const GLfloat *srcImage, GLfloat *dstImage);
-
+                         const GLfloat *srcImage, GLfloat *dstImage)
+{
+   ASSERT_NO_FEATURE();
+}
 
-extern void
+static INLINE void
 _mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
-                                   GLsizei *width, GLsizei *height);
+                                   GLsizei *width, GLsizei *height)
+{
+}
+
+static INLINE void
+_mesa_init_convolve_dispatch(struct _glapi_table *disp)
+{
+}
 
-#else
-#define _mesa_adjust_image_for_convolution(c, d, w, h) ((void)0)
-#define _mesa_convolve_1d_image(c,w,s,d) ((void)0)
-#define _mesa_convolve_2d_image(c,w,h,s,d) ((void)0)
-#define _mesa_convolve_sep_image(c,w,h,s,d) ((void)0)
-#endif
+#endif /* FEATURE_convolve */
 
-#endif
+#endif /* CONVOLVE_H */
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 4a700b5cb..27ed92176 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -184,8 +184,8 @@ struct dd_function_table {
     * functions.  The driver should examine \p internalFormat and return a
     * pointer to an appropriate gl_texture_format.
     */
-   const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx,
-                      GLint internalFormat, GLenum srcFormat, GLenum srcType );
+   GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat,
+                                     GLenum srcFormat, GLenum srcType );
 
    /**
     * Called by glTexImage1D().
@@ -475,13 +475,6 @@ struct dd_function_table {
                                  struct gl_texture_object *texObj,
                                  struct gl_texture_image *texImage);
 
-   /**
-    * Called to query number of bytes of storage needed to store the
-    * specified compressed texture.
-    */
-   GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width,
-                                    GLsizei height, GLsizei depth,
-                                    GLenum format );
    /*@}*/
 
    /**
@@ -544,12 +537,6 @@ struct dd_function_table {
    GLboolean (*IsTextureResident)( GLcontext *ctx,
                                    struct gl_texture_object *t );
 
-   /**
-    * Called by glPrioritizeTextures().
-    */
-   void (*PrioritizeTexture)( GLcontext *ctx,  struct gl_texture_object *t,
-                              GLclampf priority );
-
    /**
     * Called by glActiveTextureARB() to set current texture unit.
     */
@@ -717,40 +704,11 @@ struct dd_function_table {
    void (*TexParameter)(GLcontext *ctx, GLenum target,
                         struct gl_texture_object *texObj,
                         GLenum pname, const GLfloat *params);
-   void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
    /** Set the viewport */
    void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
    /*@}*/
 
 
-   /**
-    * \name Vertex array functions
-    *
-    * Called by the corresponding OpenGL functions.
-    */
-   /*@{*/
-   void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
-			 GLsizei stride, const GLvoid *ptr);
-   void (*NormalPointer)(GLcontext *ctx, GLenum type,
-			 GLsizei stride, const GLvoid *ptr);
-   void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
-			GLsizei stride, const GLvoid *ptr);
-   void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
-			   GLsizei stride, const GLvoid *ptr);
-   void (*IndexPointer)(GLcontext *ctx, GLenum type,
-			GLsizei stride, const GLvoid *ptr);
-   void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
-				 GLsizei stride, const GLvoid *ptr);
-   void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
-			   GLsizei stride, const GLvoid *ptr);
-   void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
-   void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size,
-                               GLenum type, GLsizei stride, const GLvoid *ptr);
-   void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
-   void (*UnlockArraysEXT)( GLcontext *ctx );
-   /*@}*/
-
-
    /** 
     * \name State-query functions
     *
@@ -1172,7 +1130,22 @@ typedef struct {
 					    GLenum type,
 					    const GLvoid **indices,
 					    GLsizei primcount);
-  /*@}*/
+   void (GLAPIENTRYP DrawElementsBaseVertex)( GLenum mode, GLsizei count,
+					      GLenum type,
+					      const GLvoid *indices,
+					      GLint basevertex );
+   void (GLAPIENTRYP DrawRangeElementsBaseVertex)( GLenum mode, GLuint start,
+						   GLuint end, GLsizei count,
+						   GLenum type,
+						   const GLvoid *indices,
+						   GLint basevertex);
+   void (GLAPIENTRYP MultiDrawElementsBaseVertex)( GLenum mode,
+						   const GLsizei *count,
+						   GLenum type,
+						   const GLvoid **indices,
+						   GLsizei primcount,
+						   const GLint *basevertex);
+   /*@}*/
 
    /**
     * \name Eval
diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c
index 8492c8561..a42113edc 100644
--- a/mesalib/src/mesa/main/debug.c
+++ b/mesalib/src/mesa/main/debug.c
@@ -27,6 +27,8 @@
 #include "attrib.h"
 #include "colormac.h"
 #include "context.h"
+#include "enums.h"
+#include "formats.h"
 #include "hash.h"
 #include "imports.h"
 #include "debug.h"
@@ -35,7 +37,6 @@
 #include "readpix.h"
 #include "texgetimage.h"
 #include "texobj.h"
-#include "texformat.h"
 
 
 /**
@@ -57,6 +58,31 @@ const char *_mesa_prim_name[GL_POLYGON+4] = {
    "unknown state"
 };
 
+
+static const char *
+tex_target_name(GLenum tgt)
+{
+   static const struct {
+      GLenum target;
+      const char *name;
+   } tex_targets[] = {
+      { GL_TEXTURE_1D, "GL_TEXTURE_1D" },
+      { GL_TEXTURE_2D, "GL_TEXTURE_2D" },
+      { GL_TEXTURE_3D, "GL_TEXTURE_3D" },
+      { GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" },
+      { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" },
+      { GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" },
+      { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" }
+   };
+   GLuint i;
+   for (i = 0; i < Elements(tex_targets); i++) {
+      if (tex_targets[i].target == tgt)
+         return tex_targets[i].name;
+   }
+   return "UNKNOWN TEX TARGET";
+}
+
+
 void
 _mesa_print_state( const char *msg, GLuint state )
 {
@@ -167,14 +193,16 @@ static void add_debug_flags( const char *debug )
    static const struct debug_option debug_opt[] = {
       { "varray",    VERBOSE_VARRAY },
       { "tex",       VERBOSE_TEXTURE },
-      { "imm",       VERBOSE_IMMEDIATE },
+      { "mat",       VERBOSE_MATERIAL },
       { "pipe",      VERBOSE_PIPELINE },
       { "driver",    VERBOSE_DRIVER },
       { "state",     VERBOSE_STATE },
       { "api",       VERBOSE_API },
       { "list",      VERBOSE_DISPLAY_LIST },
       { "lighting",  VERBOSE_LIGHTING },
-      { "disassem",  VERBOSE_DISASSEM }
+      { "disassem",  VERBOSE_DISASSEM },
+      { "draw",      VERBOSE_DRAW },
+      { "swap",      VERBOSE_SWAPBUFFERS }
    };
    GLuint i;
 
@@ -262,10 +290,13 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height,
 
 
 /**
- * Write level[0] image to a ppm file.
+ * Write a texture image to a ppm file.
+ * \param face  cube face in [0,5]
+ * \param level  mipmap level
  */
 static void
-write_texture_image(struct gl_texture_object *texObj, GLuint face, GLuint level)
+write_texture_image(struct gl_texture_object *texObj,
+                    GLuint face, GLuint level)
 {
    struct gl_texture_image *img = texObj->Image[face][level];
    if (img) {
@@ -285,7 +316,7 @@ write_texture_image(struct gl_texture_object *texObj, GLuint face, GLuint level)
                               buffer, texObj, img);
 
       /* make filename */
-      _mesa_sprintf(s, "/tmp/teximage%u.ppm", texObj->Name);
+      _mesa_sprintf(s, "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face);
 
       _mesa_printf("  Writing image level %u to %s\n", level, s);
       write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE);
@@ -297,48 +328,153 @@ write_texture_image(struct gl_texture_object *texObj, GLuint face, GLuint level)
 }
 
 
-static GLboolean DumpImages;
+/**
+ * Write renderbuffer image to a ppm file.
+ */
+static void
+write_renderbuffer_image(const struct gl_renderbuffer *rb)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   GLubyte *buffer;
+   char s[100];
+   GLenum format, type;
+
+   if (rb->_BaseFormat == GL_RGB || 
+       rb->_BaseFormat == GL_RGBA) {
+      format = GL_RGBA;
+      type = GL_UNSIGNED_BYTE;
+   }
+   else if (rb->_BaseFormat == GL_DEPTH_STENCIL) {
+      format = GL_DEPTH_STENCIL;
+      type = GL_UNSIGNED_INT_24_8;
+   }
+   else {
+      return;
+   }
+
+   buffer = (GLubyte *) _mesa_malloc(rb->Width * rb->Height * 4);
+
+   ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
+                          format, type, &ctx->DefaultPacking, buffer);
+
+   /* make filename */
+   _mesa_sprintf(s, "/tmp/renderbuffer%u.ppm", rb->Name);
+
+   _mesa_printf("  Writing renderbuffer image to %s\n", s);
+   write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE);
+
+   _mesa_free(buffer);
+}
+
+
+/** How many texture images (mipmap levels, faces) to write to files */
+#define WRITE_NONE 0
+#define WRITE_ONE  1
+#define WRITE_ALL  2
+
+static GLuint WriteImages;
 
 
 static void
-dump_texture_cb(GLuint id, void *data, void *userData)
+dump_texture(struct gl_texture_object *texObj, GLuint writeImages)
 {
-   struct gl_texture_object *texObj = (struct gl_texture_object *) data;
-   int i;
+   const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
    GLboolean written = GL_FALSE;
-   (void) userData;
+   GLuint i, j;
 
    _mesa_printf("Texture %u\n", texObj->Name);
-   _mesa_printf("  Target 0x%x\n", texObj->Target);
+   _mesa_printf("  Target %s\n", tex_target_name(texObj->Target));
    for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
-      struct gl_texture_image *texImg = texObj->Image[0][i];
-      if (texImg) {
-         _mesa_printf("  Image %u: %d x %d x %d, format %u at %p\n", i,
-                      texImg->Width, texImg->Height, texImg->Depth,
-                      texImg->TexFormat->MesaFormat, texImg->Data);
-         if (DumpImages && !written) {
-            GLuint face = 0;
-            write_texture_image(texObj, face, i);
-            written = GL_TRUE;
+      for (j = 0; j < numFaces; j++) {
+         struct gl_texture_image *texImg = texObj->Image[j][i];
+         if (texImg) {
+            _mesa_printf("  Face %u level %u: %d x %d x %d, format %s at %p\n",
+                         j, i,
+                         texImg->Width, texImg->Height, texImg->Depth,
+                         _mesa_get_format_name(texImg->TexFormat),
+                         texImg->Data);
+            if (writeImages == WRITE_ALL ||
+                (writeImages == WRITE_ONE && !written)) {
+               write_texture_image(texObj, j, i);
+               written = GL_TRUE;
+            }
          }
       }
    }
 }
 
 
+/**
+ * Dump a single texture.
+ */
+void
+_mesa_dump_texture(GLuint texture, GLuint writeImages)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture);
+   if (texObj) {
+      dump_texture(texObj, writeImages);
+   }
+}
+
+
+static void
+dump_texture_cb(GLuint id, void *data, void *userData)
+{
+   struct gl_texture_object *texObj = (struct gl_texture_object *) data;
+   (void) userData;
+   dump_texture(texObj, WriteImages);
+}
+
+
 /**
  * Print basic info about all texture objext to stdout.
  * If dumpImages is true, write PPM of level[0] image to a file.
  */
 void
-_mesa_dump_textures(GLboolean dumpImages)
+_mesa_dump_textures(GLuint writeImages)
 {
    GET_CURRENT_CONTEXT(ctx);
-   DumpImages = dumpImages;
+   WriteImages = writeImages;
    _mesa_HashWalk(ctx->Shared->TexObjects, dump_texture_cb, ctx);
 }
 
 
+static void
+dump_renderbuffer(const struct gl_renderbuffer *rb, GLboolean writeImage)
+{
+   _mesa_printf("Renderbuffer %u: %u x %u  IntFormat = %s\n",
+                rb->Name, rb->Width, rb->Height,
+                _mesa_lookup_enum_by_nr(rb->InternalFormat));
+   if (writeImage) {
+      write_renderbuffer_image(rb);
+   }
+}
+
+
+static void
+dump_renderbuffer_cb(GLuint id, void *data, void *userData)
+{
+   const struct gl_renderbuffer *rb = (const struct gl_renderbuffer *) data;
+   (void) userData;
+   dump_renderbuffer(rb, WriteImages);
+}
+
+
+/**
+ * Print basic info about all renderbuffers to stdout.
+ * If dumpImages is true, write PPM of level[0] image to a file.
+ */
+void
+_mesa_dump_renderbuffers(GLboolean writeImages)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   WriteImages = writeImages;
+   _mesa_HashWalk(ctx->Shared->RenderBuffers, dump_renderbuffer_cb, ctx);
+}
+
+
+
 void
 _mesa_dump_color_buffer(const char *filename)
 {
@@ -438,3 +574,64 @@ _mesa_dump_stencil_buffer(const char *filename)
    _mesa_free(buf);
    _mesa_free(buf2);
 }
+
+
+/**
+ * Quick and dirty function to "print" a texture to stdout.
+ */
+void
+_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img)
+{
+#if CHAN_TYPE != GL_UNSIGNED_BYTE
+   _mesa_problem(NULL, "PrintTexture not supported");
+#else
+   GLuint i, j, c;
+   const GLubyte *data = (const GLubyte *) img->Data;
+
+   if (!data) {
+      _mesa_printf("No texture data\n");
+      return;
+   }
+
+   /* XXX add more formats or make into a new format utility function */
+   switch (img->TexFormat) {
+      case MESA_FORMAT_A8:
+      case MESA_FORMAT_L8:
+      case MESA_FORMAT_I8:
+      case MESA_FORMAT_CI8:
+         c = 1;
+         break;
+      case MESA_FORMAT_AL88:
+      case MESA_FORMAT_AL88_REV:
+         c = 2;
+         break;
+      case MESA_FORMAT_RGB888:
+      case MESA_FORMAT_BGR888:
+         c = 3;
+         break;
+      case MESA_FORMAT_RGBA8888:
+      case MESA_FORMAT_ARGB8888:
+         c = 4;
+         break;
+      default:
+         _mesa_problem(NULL, "error in PrintTexture\n");
+         return;
+   }
+
+   for (i = 0; i < img->Height; i++) {
+      for (j = 0; j < img->Width; j++) {
+         if (c==1)
+            _mesa_printf("%02x  ", data[0]);
+         else if (c==2)
+            _mesa_printf("%02x%02x  ", data[0], data[1]);
+         else if (c==3)
+            _mesa_printf("%02x%02x%02x  ", data[0], data[1], data[2]);
+         else if (c==4)
+            _mesa_printf("%02x%02x%02x%02x  ", data[0], data[1], data[2], data[3]);
+         data += (img->RowStride - img->Width) * c;
+      }
+      /* XXX use img->ImageStride here */
+      _mesa_printf("\n");
+   }
+#endif
+}
diff --git a/mesalib/src/mesa/main/debug.h b/mesalib/src/mesa/main/debug.h
index bb384c432..0449cb179 100644
--- a/mesalib/src/mesa/main/debug.h
+++ b/mesalib/src/mesa/main/debug.h
@@ -58,7 +58,13 @@ extern void _mesa_init_debug( GLcontext *ctx );
 #endif
 
 extern void
-_mesa_dump_textures(GLboolean dumpImages);
+_mesa_dump_texture(GLuint texture, GLuint writeImages);
+
+extern void
+_mesa_dump_textures(GLuint writeImages);
+
+extern void
+_mesa_dump_renderbuffers(GLboolean writeImages);
 
 extern void
 _mesa_dump_color_buffer(const char *filename);
@@ -69,4 +75,7 @@ _mesa_dump_depth_buffer(const char *filename);
 extern void
 _mesa_dump_stencil_buffer(const char *filename);
 
+extern void
+_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img);
+
 #endif
diff --git a/mesalib/src/mesa/main/depth.c b/mesalib/src/mesa/main/depth.c
index 91c036ef9..f187205b9 100644
--- a/mesalib/src/mesa/main/depth.c
+++ b/mesalib/src/mesa/main/depth.c
@@ -63,7 +63,7 @@ _mesa_DepthFunc( GLenum func )
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+   if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func));
 
    switch (func) {
@@ -99,7 +99,7 @@ _mesa_DepthMask( GLboolean flag )
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+   if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glDepthMask %d\n", flag);
 
    /*
diff --git a/mesalib/src/mesa/main/depthstencil.c b/mesalib/src/mesa/main/depthstencil.c
index 7be2aacaf..193c7f825 100644
--- a/mesalib/src/mesa/main/depthstencil.c
+++ b/mesalib/src/mesa/main/depthstencil.c
@@ -26,6 +26,7 @@
 #include "imports.h"
 #include "context.h"
 #include "fbobject.h"
+#include "formats.h"
 #include "mtypes.h"
 #include "depthstencil.h"
 #include "renderbuffer.h"
@@ -40,8 +41,8 @@
  * a combined Z+stencil buffer!  That implies we need three different sets
  * of Get/Put functions.
  *
- * We solve this by wrapping the Z24_S8 renderbuffer with depth and stencil
- * adaptors, each with the right kind of depth/stencil Get/Put functions.
+ * We solve this by wrapping the Z24_S8 or S8_Z24 renderbuffer with depth and
+ * stencil adaptors, each with the right kind of depth/stencil Get/Put functions.
  */
 
 
@@ -62,8 +63,8 @@ nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
 static void
 delete_wrapper(struct gl_renderbuffer *rb)
 {
-   ASSERT(rb->_ActualFormat == GL_DEPTH_COMPONENT24 ||
-          rb->_ActualFormat == GL_STENCIL_INDEX8_EXT);
+   ASSERT(rb->Format == MESA_FORMAT_Z24_S8 ||
+          rb->Format == MESA_FORMAT_S8_Z24);
    _mesa_reference_renderbuffer(&rb->Wrapped, NULL);
    _mesa_free(rb);
 }
@@ -82,7 +83,8 @@ alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
 
    (void) internalFormat;
 
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
+          dsrb->Format == MESA_FORMAT_S8_Z24);
 
    retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height);
    if (retVal) {
@@ -108,14 +110,21 @@ get_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
    GLuint *dst = (GLuint *) values;
    const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
    ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (!src) {
       dsrb->GetRow(ctx, dsrb, count, x, y, temp);
       src = temp;
    }
-   for (i = 0; i < count; i++) {
-      dst[i] = src[i] >> 8;
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] >> 8;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] & 0xffffff;
+      }
    }
 }
 
@@ -127,13 +136,20 @@ get_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
    GLuint temp[MAX_WIDTH], i;
    GLuint *dst = (GLuint *) values;
    ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    ASSERT(count <= MAX_WIDTH);
    /* don't bother trying direct access */
    dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   for (i = 0; i < count; i++) {
-      dst[i] = temp[i] >> 8;
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] >> 8;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] & 0xffffff;
+      }
    }
 }
 
@@ -145,14 +161,23 @@ put_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
    const GLuint *src = (const GLuint *) values;
    GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
    ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (dst) {
       /* direct access */
       GLuint i;
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            dst[i] = (src[i] << 8) | (dst[i] & 0xff);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (src[i] << 8) | (dst[i] & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (src[i] & 0xffffff) | (dst[i] & 0xff000000);
+            }
          }
       }
    }
@@ -160,9 +185,19 @@ put_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
       /* get, modify, put */
       GLuint temp[MAX_WIDTH], i;
       dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = (src[i] << 8) | (temp[i] & 0xff);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] << 8) | (temp[i] & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
+            }
          }
       }
       dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
@@ -174,17 +209,27 @@ put_mono_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
                  GLint x, GLint y, const void *value, const GLubyte *mask)
 {
    struct gl_renderbuffer *dsrb = z24rb->Wrapped;
-   const GLuint shiftedVal = *((GLuint *) value) << 8;
    GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
    ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (dst) {
       /* direct access */
       GLuint i;
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            dst[i] = shiftedVal | (dst[i] & 0xff);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         const GLuint shiftedVal = *((GLuint *) value) << 8;
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = shiftedVal | (dst[i] & 0xff);
+            }
+         }
+      }
+      else {
+         const GLuint shiftedVal = *((GLuint *) value);
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = shiftedVal | (dst[i] & 0xff000000);
+            }
          }
       }
    }
@@ -192,9 +237,21 @@ put_mono_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
       /* get, modify, put */
       GLuint temp[MAX_WIDTH], i;
       dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = shiftedVal | (temp[i] & 0xff);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         const GLuint shiftedVal = *((GLuint *) value) << 8;
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = shiftedVal | (temp[i] & 0xff);
+            }
+         }
+      }
+      else {
+         const GLuint shiftedVal = *((GLuint *) value);
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = shiftedVal | (temp[i] & 0xff000000);
+            }
          }
       }
       dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
@@ -209,15 +266,25 @@ put_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
    struct gl_renderbuffer *dsrb = z24rb->Wrapped;
    const GLuint *src = (const GLuint *) values;
    ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
       /* direct access */
       GLuint i;
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
-            *dst = (src[i] << 8) | (*dst & 0xff);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (src[i] << 8) | (*dst & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (src[i] & 0xffffff) | (*dst & 0xff000000);
+            }
          }
       }
    }
@@ -225,9 +292,19 @@ put_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
       /* get, modify, put */
       GLuint temp[MAX_WIDTH], i;
       dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = (src[i] << 8) | (temp[i] & 0xff);
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] << 8) | (temp[i] & 0xff);
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
+            }
          }
       }
       dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
@@ -241,12 +318,23 @@ put_mono_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb,
 {
    struct gl_renderbuffer *dsrb = z24rb->Wrapped;
    GLuint temp[MAX_WIDTH], i;
-   const GLuint shiftedVal = *((GLuint *) value) << 8;
    /* get, modify, put */
    dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   for (i = 0; i < count; i++) {
-      if (!mask || mask[i]) {
-         temp[i] = shiftedVal | (temp[i] & 0xff);
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      const GLuint shiftedVal = *((GLuint *) value) << 8;
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = shiftedVal | (temp[i] & 0xff);
+         }
+      }
+   }
+   else {
+      const GLuint shiftedVal = *((GLuint *) value);
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = shiftedVal | (temp[i] & 0xff000000);
+         }
       }
    }
    dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
@@ -264,7 +352,8 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx,
 {
    struct gl_renderbuffer *z24rb;
 
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
+          dsrb->Format == MESA_FORMAT_S8_Z24);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
 
    z24rb = _mesa_new_renderbuffer(ctx, 0);
@@ -277,10 +366,9 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx,
    z24rb->Width = dsrb->Width;
    z24rb->Height = dsrb->Height;
    z24rb->InternalFormat = GL_DEPTH_COMPONENT24;
-   z24rb->_ActualFormat = GL_DEPTH_COMPONENT24;
+   z24rb->Format = MESA_FORMAT_X8_Z24;
    z24rb->_BaseFormat = GL_DEPTH_COMPONENT;
    z24rb->DataType = GL_UNSIGNED_INT;
-   z24rb->DepthBits = 24;
    z24rb->Data = NULL;
    z24rb->Delete = delete_wrapper;
    z24rb->AllocStorage = alloc_wrapper_storage;
@@ -310,14 +398,21 @@ get_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
    GLubyte *dst = (GLubyte *) values;
    const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
    ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (!src) {
       dsrb->GetRow(ctx, dsrb, count, x, y, temp);
       src = temp;
    }
-   for (i = 0; i < count; i++) {
-      dst[i] = src[i] & 0xff;
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] & 0xff;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = src[i] >> 24;
+      }
    }
 }
 
@@ -329,13 +424,20 @@ get_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
    GLuint temp[MAX_WIDTH], i;
    GLubyte *dst = (GLubyte *) values;
    ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    ASSERT(count <= MAX_WIDTH);
    /* don't bother trying direct access */
    dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   for (i = 0; i < count; i++) {
-      dst[i] = temp[i] & 0xff;
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] & 0xff;
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         dst[i] = temp[i] >> 24;
+      }
    }
 }
 
@@ -347,14 +449,23 @@ put_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
    const GLubyte *src = (const GLubyte *) values;
    GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
    ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (dst) {
       /* direct access */
       GLuint i;
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            dst[i] = (dst[i] & 0xffffff00) | src[i];
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff) | (src[i] << 24);
+            }
          }
       }
    }
@@ -362,9 +473,19 @@ put_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
       /* get, modify, put */
       GLuint temp[MAX_WIDTH], i;
       dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = (temp[i] & 0xffffff00) | src[i];
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
+            }
          }
       }
       dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
@@ -379,14 +500,23 @@ put_mono_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
    const GLubyte val = *((GLubyte *) value);
    GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
    ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (dst) {
       /* direct access */
       GLuint i;
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            dst[i] = (dst[i] & 0xffffff00) | val;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff00) | val;
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               dst[i] = (dst[i] & 0xffffff) | (val << 24);
+            }
          }
       }
    }
@@ -394,9 +524,19 @@ put_mono_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
       /* get, modify, put */
       GLuint temp[MAX_WIDTH], i;
       dsrb->GetRow(ctx, dsrb, count, x, y, temp);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = (temp[i] & 0xffffff00) | val;
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff00) | val;
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff) | (val << 24);
+            }
          }
       }
       dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
@@ -411,15 +551,25 @@ put_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
    struct gl_renderbuffer *dsrb = s8rb->Wrapped;
    const GLubyte *src = (const GLubyte *) values;
    ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
    if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
       /* direct access */
       GLuint i;
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
-            *dst = (*dst & 0xffffff00) | src[i];
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (*dst & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
+               *dst = (*dst & 0xffffff) | (src[i] << 24);
+            }
          }
       }
    }
@@ -427,9 +577,19 @@ put_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
       /* get, modify, put */
       GLuint temp[MAX_WIDTH], i;
       dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-      for (i = 0; i < count; i++) {
-         if (!mask || mask[i]) {
-            temp[i] = (temp[i] & 0xffffff00) | src[i];
+      if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff00) | src[i];
+            }
+         }
+      }
+      else {
+         assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+         for (i = 0; i < count; i++) {
+            if (!mask || mask[i]) {
+               temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
+            }
          }
       }
       dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
@@ -446,9 +606,19 @@ put_mono_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
    const GLubyte val = *((GLubyte *) value);
    /* get, modify, put */
    dsrb->GetValues(ctx, dsrb, count, x, y, temp);
-   for (i = 0; i < count; i++) {
-      if (!mask || mask[i]) {
-         temp[i] = (temp[i] & 0xffffff) | val;
+   if (dsrb->Format == MESA_FORMAT_Z24_S8) {
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = (temp[i] & 0xffffff00) | val;
+         }
+      }
+   }
+   else {
+      assert(dsrb->Format == MESA_FORMAT_S8_Z24);
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            temp[i] = (temp[i] & 0xffffff) | (val << 24);
+         }
       }
    }
    dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
@@ -465,7 +635,8 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb)
 {
    struct gl_renderbuffer *s8rb;
 
-   ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+   ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
+          dsrb->Format == MESA_FORMAT_S8_Z24);
    ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
 
    s8rb = _mesa_new_renderbuffer(ctx, 0);
@@ -478,10 +649,9 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb)
    s8rb->Width = dsrb->Width;
    s8rb->Height = dsrb->Height;
    s8rb->InternalFormat = GL_STENCIL_INDEX8_EXT;
-   s8rb->_ActualFormat = GL_STENCIL_INDEX8_EXT;
+   s8rb->Format = MESA_FORMAT_S8;
    s8rb->_BaseFormat = GL_STENCIL_INDEX;
    s8rb->DataType = GL_UNSIGNED_BYTE;
-   s8rb->StencilBits = 8;
    s8rb->Data = NULL;
    s8rb->Delete = delete_wrapper;
    s8rb->AllocStorage = alloc_wrapper_storage;
@@ -528,10 +698,10 @@ _mesa_extract_stencil(GLcontext *ctx,
    ASSERT(dsRb);
    ASSERT(stencilRb);
 
-   ASSERT(dsRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+   ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8);
    ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT ||
-          stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT);
+   ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 ||
+          stencilRb->Format == MESA_FORMAT_S8);
    ASSERT(dsRb->Width == stencilRb->Width);
    ASSERT(dsRb->Height == stencilRb->Height);
 
@@ -541,7 +711,7 @@ _mesa_extract_stencil(GLcontext *ctx,
    for (row = 0; row < height; row++) {
       GLuint depthStencil[MAX_WIDTH];
       dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil);
-      if (stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT) {
+      if (stencilRb->Format == MESA_FORMAT_S8) {
          /* 8bpp stencil */
          GLubyte stencil[MAX_WIDTH];
          GLuint i;
@@ -553,7 +723,7 @@ _mesa_extract_stencil(GLcontext *ctx,
       else {
          /* 32bpp stencil */
          /* the 24 depth bits will be ignored */
-         ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+         ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8);
          ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
          stencilRb->PutRow(ctx, stencilRb, width, 0, row, depthStencil, NULL);
       }
@@ -577,10 +747,10 @@ _mesa_insert_stencil(GLcontext *ctx,
    ASSERT(dsRb);
    ASSERT(stencilRb);
 
-   ASSERT(dsRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+   ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8);
    ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-   ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT ||
-          stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT);
+   ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 ||
+          stencilRb->Format == MESA_FORMAT_S8);
 
    ASSERT(dsRb->Width == stencilRb->Width);
    ASSERT(dsRb->Height == stencilRb->Height);
@@ -593,7 +763,7 @@ _mesa_insert_stencil(GLcontext *ctx,
 
       dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil);
 
-      if (stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT) {
+      if (stencilRb->Format == MESA_FORMAT_S8) {
          /* 8bpp stencil */
          GLubyte stencil[MAX_WIDTH];
          GLuint i;
@@ -605,7 +775,7 @@ _mesa_insert_stencil(GLcontext *ctx,
       else {
          /* 32bpp stencil buffer */
          GLuint stencil[MAX_WIDTH], i;
-         ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+         ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8);
          ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT);
          stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil);
          for (i = 0; i < width; i++) {
@@ -631,7 +801,7 @@ _mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb)
    GLubyte *data;
    GLint i, j, k;
 
-   ASSERT(stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT);
+   ASSERT(stencilRb->Format == MESA_FORMAT_S8);
    ASSERT(stencilRb->Data);
 
    data = (GLubyte *) stencilRb->Data;
@@ -650,6 +820,4 @@ _mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb)
       stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL);
    }
    _mesa_free(data);
-
-   stencilRb->_BaseFormat = GL_DEPTH_STENCIL_EXT;
 }
diff --git a/mesalib/src/mesa/main/dispatch.c b/mesalib/src/mesa/main/dispatch.c
index bf1a01378..97d213e8e 100644
--- a/mesalib/src/mesa/main/dispatch.c
+++ b/mesalib/src/mesa/main/dispatch.c
@@ -43,6 +43,7 @@
 #include "main/compiler.h"
 #include "glapi/glapi.h"
 #include "glapi/glapitable.h"
+#include "glapi/glapidispatch.h"
 #include "glapi/glthread.h"
 
 
@@ -88,7 +89,6 @@
 #define GLAPIENTRY
 #endif
 
-#include "glapi/dispatch.h"
 #include "glapi/glapitemp.h"
 
 #endif /* USE_X86_ASM */
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 41a5b6140..b692c335a 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -1,8 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.1
+ * Version:  7.7
  *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -73,6 +74,7 @@
 #include "texstate.h"
 #include "mtypes.h"
 #include "varray.h"
+#include "vtxfmt.h"
 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
 #include "shader/arbprogram.h"
 #include "shader/program.h"
@@ -90,6 +92,33 @@
 #include "glapi/dispatch.h"
 
 
+
+/**
+ * Other parts of Mesa (such as the VBO module) can plug into the display
+ * list system.  This structure describes new display list instructions.
+ */
+struct gl_list_instruction
+{
+   GLuint Size;
+   void (*Execute)( GLcontext *ctx, void *data );
+   void (*Destroy)( GLcontext *ctx, void *data );
+   void (*Print)( GLcontext *ctx, void *data );
+};
+
+
+#define MAX_DLIST_EXT_OPCODES 16
+
+/**
+ * Used by device drivers to hook new commands into display lists.
+ */
+struct gl_list_extensions
+{
+   struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
+   GLuint NumOpcodes;
+};
+
+
+
 /**
  * Flush vertices.
  *
@@ -438,6 +467,10 @@ typedef union gl_dlist_node Node;
  */
 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
 
+
+#if FEATURE_dlist
+
+
 void mesa_print_display_list(GLuint list);
 
 
@@ -472,6 +505,49 @@ lookup_list(GLcontext *ctx, GLuint list)
 }
 
 
+/** Is the given opcode an extension code? */
+static INLINE GLboolean
+is_ext_opcode(OpCode opcode)
+{
+   return (opcode >= OPCODE_EXT_0);
+}
+
+
+/** Destroy an extended opcode instruction */
+static GLint
+ext_opcode_destroy(GLcontext *ctx, Node *node)
+{
+   const GLint i = node[0].opcode - OPCODE_EXT_0;
+   GLint step;
+   ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
+   step = ctx->ListExt->Opcode[i].Size;
+   return step;
+}
+
+
+/** Execute an extended opcode instruction */
+static GLint
+ext_opcode_execute(GLcontext *ctx, Node *node)
+{
+   const GLint i = node[0].opcode - OPCODE_EXT_0;
+   GLint step;
+   ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
+   step = ctx->ListExt->Opcode[i].Size;
+   return step;
+}
+
+
+/** Print an extended opcode instruction */
+static GLint
+ext_opcode_print(GLcontext *ctx, Node *node)
+{
+   const GLint i = node[0].opcode - OPCODE_EXT_0;
+   GLint step;
+   ctx->ListExt->Opcode[i].Print(ctx, &node[1]);
+   step = ctx->ListExt->Opcode[i].Size;
+   return step;
+}
+
 
 /**
  * Delete the named display list, but don't remove from hash table.
@@ -487,16 +563,14 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
 
    done = block ? GL_FALSE : GL_TRUE;
    while (!done) {
+      const OpCode opcode = n[0].opcode;
 
       /* check for extension opcodes first */
-
-      GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
-      if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
-         ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]);
-         n += ctx->ListExt.Opcode[i].Size;
+      if (is_ext_opcode(opcode)) {
+         n += ext_opcode_destroy(ctx, n);
       }
       else {
-         switch (n[0].opcode) {
+         switch (opcode) {
             /* for some commands, we need to free malloc'd memory */
          case OPCODE_MAP1:
             _mesa_free(n[6].data);
@@ -784,14 +858,13 @@ unpack_image(GLcontext *ctx, GLuint dimensions,
 
 
 /**
- * Allocate space for a display list instruction.
+ * Allocate space for a display list instruction (opcode + payload space).
  * \param opcode  the instruction opcode (OPCODE_* value)
- * \param bytes   instruction size in bytes, not counting opcode.
- * \return pointer to the usable data area (not including the internal
- *         opcode).
+ * \param bytes   instruction payload size (not counting opcode)
+ * \return pointer to allocated memory (the opcode space)
  */
-void *
-_mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint bytes)
+static Node *
+dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes)
 {
    const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
    Node *n;
@@ -825,9 +898,30 @@ _mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint bytes)
    n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
    ctx->ListState.CurrentPos += numNodes;
 
-   n[0].opcode = (OpCode) opcode;
+   n[0].opcode = opcode;
 
-   return (void *) (n + 1);     /* return ptr to node following opcode */
+   return n;
+}
+
+
+
+/**
+ * Allocate space for a display list instruction.  Used by callers outside
+ * this file for things like VBO vertex data.
+ *
+ * \param opcode  the instruction opcode (OPCODE_* value)
+ * \param bytes   instruction size in bytes, not counting opcode.
+ * \return pointer to the usable data area (not including the internal
+ *         opcode).
+ */
+void *
+_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes)
+{
+   Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes);
+   if (n)
+      return n + 1;  /* return pointer to payload area, after opcode */
+   else
+      return NULL;
 }
 
 
@@ -842,35 +936,39 @@ _mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint bytes)
  * \return  the new opcode number or -1 if error
  */
 GLint
-_mesa_alloc_opcode(GLcontext *ctx,
-                   GLuint size,
-                   void (*execute) (GLcontext *, void *),
-                   void (*destroy) (GLcontext *, void *),
-                   void (*print) (GLcontext *, void *))
-{
-   if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) {
-      const GLuint i = ctx->ListExt.NumOpcodes++;
-      ctx->ListExt.Opcode[i].Size =
+_mesa_dlist_alloc_opcode(GLcontext *ctx,
+                         GLuint size,
+                         void (*execute) (GLcontext *, void *),
+                         void (*destroy) (GLcontext *, void *),
+                         void (*print) (GLcontext *, void *))
+{
+   if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
+      const GLuint i = ctx->ListExt->NumOpcodes++;
+      ctx->ListExt->Opcode[i].Size =
          1 + (size + sizeof(Node) - 1) / sizeof(Node);
-      ctx->ListExt.Opcode[i].Execute = execute;
-      ctx->ListExt.Opcode[i].Destroy = destroy;
-      ctx->ListExt.Opcode[i].Print = print;
+      ctx->ListExt->Opcode[i].Execute = execute;
+      ctx->ListExt->Opcode[i].Destroy = destroy;
+      ctx->ListExt->Opcode[i].Print = print;
       return i + OPCODE_EXT_0;
    }
    return -1;
 }
 
 
-
 /**
- * Allocate display list instruction.  Returns Node ptr to where the opcode
- * is stored.
- *   - nParams is the number of function parameters
- *   - return value a pointer to sizeof(Node) before the actual
- *     usable data area.
+ * Allocate space for a display list instruction.  The space is basically
+ * an array of Nodes where node[0] holds the opcode, node[1] is the first
+ * function parameter, node[2] is the second parameter, etc.
+ *
+ * \param opcode  one of OPCODE_x
+ * \param nparams  number of function parameters
+ * \return  pointer to start of instruction space
  */
-#define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \
-    ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1)
+static INLINE Node *
+alloc_instruction(GLcontext *ctx, OpCode opcode, GLuint nparams)
+{
+   return dlist_alloc(ctx, opcode, nparams * sizeof(Node));
+}
 
 
 
@@ -883,7 +981,7 @@ save_Accum(GLenum op, GLfloat value)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ACCUM, 2);
+   n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
    if (n) {
       n[1].e = op;
       n[2].f = value;
@@ -900,7 +998,7 @@ save_AlphaFunc(GLenum func, GLclampf ref)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ALPHA_FUNC, 2);
+   n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
    if (n) {
       n[1].e = func;
       n[2].f = (GLfloat) ref;
@@ -917,7 +1015,7 @@ save_BindTexture(GLenum target, GLuint texture)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_TEXTURE, 2);
+   n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
    if (n) {
       n[1].e = target;
       n[2].ui = texture;
@@ -936,7 +1034,7 @@ save_Bitmap(GLsizei width, GLsizei height,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BITMAP, 7);
+   n = alloc_instruction(ctx, OPCODE_BITMAP, 7);
    if (n) {
       n[1].i = (GLint) width;
       n[2].i = (GLint) height;
@@ -959,7 +1057,7 @@ save_BlendEquation(GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION, 1);
+   n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -975,7 +1073,7 @@ save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
+   n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
    if (n) {
       n[1].e = modeRGB;
       n[2].e = modeA;
@@ -993,7 +1091,7 @@ save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
+   n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
    if (n) {
       n[1].e = sfactorRGB;
       n[2].e = dfactorRGB;
@@ -1020,7 +1118,7 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_COLOR, 4);
+   n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
    if (n) {
       n[1].f = red;
       n[2].f = green;
@@ -1047,14 +1145,14 @@ static void invalidate_saved_current_state( GLcontext *ctx )
    ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
 }
 
-void GLAPIENTRY
-_mesa_save_CallList(GLuint list)
+static void GLAPIENTRY
+save_CallList(GLuint list)
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST, 1);
+   n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
    if (n) {
       n[1].ui = list;
    }
@@ -1070,8 +1168,8 @@ _mesa_save_CallList(GLuint list)
 }
 
 
-void GLAPIENTRY
-_mesa_save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
+static void GLAPIENTRY
+save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
 {
    GET_CURRENT_CONTEXT(ctx);
    GLint i;
@@ -1098,7 +1196,7 @@ _mesa_save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
 
    for (i = 0; i < num; i++) {
       GLint list = translate_id(i, type, lists);
-      Node *n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST_OFFSET, 2);
+      Node *n = alloc_instruction(ctx, OPCODE_CALL_LIST_OFFSET, 2);
       if (n) {
          n[1].i = list;
          n[2].b = typeErrorFlag;
@@ -1122,7 +1220,7 @@ save_Clear(GLbitfield mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR, 1);
+   n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
    if (n) {
       n[1].bf = mask;
    }
@@ -1138,7 +1236,7 @@ save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_ACCUM, 4);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
    if (n) {
       n[1].f = red;
       n[2].f = green;
@@ -1157,7 +1255,7 @@ save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_COLOR, 4);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
    if (n) {
       n[1].f = red;
       n[2].f = green;
@@ -1176,7 +1274,7 @@ save_ClearDepth(GLclampd depth)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_DEPTH, 1);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
    if (n) {
       n[1].f = (GLfloat) depth;
    }
@@ -1192,7 +1290,7 @@ save_ClearIndex(GLfloat c)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_INDEX, 1);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
    if (n) {
       n[1].f = c;
    }
@@ -1208,7 +1306,7 @@ save_ClearStencil(GLint s)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_STENCIL, 1);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
    if (n) {
       n[1].i = s;
    }
@@ -1224,7 +1322,7 @@ save_ClipPlane(GLenum plane, const GLdouble * equ)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CLIP_PLANE, 5);
+   n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
    if (n) {
       n[1].e = plane;
       n[2].f = (GLfloat) equ[0];
@@ -1246,7 +1344,7 @@ save_ColorMask(GLboolean red, GLboolean green,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MASK, 4);
+   n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
    if (n) {
       n[1].b = red;
       n[2].b = green;
@@ -1266,7 +1364,7 @@ save_ColorMaterial(GLenum face, GLenum mode)
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MATERIAL, 2);
+   n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
    if (n) {
       n[1].e = face;
       n[2].e = mode;
@@ -1291,7 +1389,7 @@ save_ColorTable(GLenum target, GLenum internalFormat,
    else {
       Node *n;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE, 6);
+      n = alloc_instruction(ctx, OPCODE_COLOR_TABLE, 6);
       if (n) {
          n[1].e = target;
          n[2].e = internalFormat;
@@ -1319,7 +1417,7 @@ save_ColorTableParameterfv(GLenum target, GLenum pname,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6);
+   n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -1348,7 +1446,7 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6);
+   n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -1377,7 +1475,7 @@ save_ColorSubTable(GLenum target, GLsizei start, GLsizei count,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_SUB_TABLE, 6);
+   n = alloc_instruction(ctx, OPCODE_COLOR_SUB_TABLE, 6);
    if (n) {
       n[1].e = target;
       n[2].i = start;
@@ -1402,7 +1500,7 @@ save_CopyColorSubTable(GLenum target, GLsizei start,
    Node *n;
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5);
+   n = alloc_instruction(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5);
    if (n) {
       n[1].e = target;
       n[2].i = start;
@@ -1424,7 +1522,7 @@ save_CopyColorTable(GLenum target, GLenum internalformat,
    Node *n;
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_TABLE, 5);
+   n = alloc_instruction(ctx, OPCODE_COPY_COLOR_TABLE, 5);
    if (n) {
       n[1].e = target;
       n[2].e = internalformat;
@@ -1447,7 +1545,7 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6);
+   n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6);
    if (n) {
       n[1].e = target;
       n[2].e = internalFormat;
@@ -1474,7 +1572,7 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7);
+   n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7);
    if (n) {
       n[1].e = target;
       n[2].e = internalFormat;
@@ -1499,7 +1597,7 @@ save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3);
+   n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -1517,7 +1615,7 @@ save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6);
+   n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -1545,7 +1643,7 @@ save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3);
+   n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -1564,7 +1662,7 @@ save_ConvolutionParameterfv(GLenum target, GLenum pname,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6);
+   n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -1592,7 +1690,7 @@ save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_PIXELS, 5);
+   n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
    if (n) {
       n[1].i = x;
       n[2].i = y;
@@ -1614,7 +1712,7 @@ save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
+   n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -1640,7 +1738,7 @@ save_CopyTexImage2D(GLenum target, GLint level,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
+   n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -1666,7 +1764,7 @@ save_CopyTexSubImage1D(GLenum target, GLint level,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
+   n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -1690,7 +1788,7 @@ save_CopyTexSubImage2D(GLenum target, GLint level,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
+   n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -1716,7 +1814,7 @@ save_CopyTexSubImage3D(GLenum target, GLint level,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
+   n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -1742,7 +1840,7 @@ save_CullFace(GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_CULL_FACE, 1);
+   n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -1758,7 +1856,7 @@ save_DepthFunc(GLenum func)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_FUNC, 1);
+   n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
    if (n) {
       n[1].e = func;
    }
@@ -1774,7 +1872,7 @@ save_DepthMask(GLboolean mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_MASK, 1);
+   n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
    if (n) {
       n[1].b = mask;
    }
@@ -1790,7 +1888,7 @@ save_DepthRange(GLclampd nearval, GLclampd farval)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_RANGE, 2);
+   n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
    if (n) {
       n[1].f = (GLfloat) nearval;
       n[2].f = (GLfloat) farval;
@@ -1807,7 +1905,7 @@ save_Disable(GLenum cap)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DISABLE, 1);
+   n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
    if (n) {
       n[1].e = cap;
    }
@@ -1823,7 +1921,7 @@ save_DrawBuffer(GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFER, 1);
+   n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -1842,7 +1940,7 @@ save_DrawPixels(GLsizei width, GLsizei height,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_PIXELS, 5);
+   n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 5);
    if (n) {
       n[1].i = width;
       n[2].i = height;
@@ -1864,7 +1962,7 @@ save_Enable(GLenum cap)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ENABLE, 1);
+   n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
    if (n) {
       n[1].e = cap;
    }
@@ -1876,12 +1974,12 @@ save_Enable(GLenum cap)
 
 
 static void GLAPIENTRY
-_mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
+save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH1, 3);
+   n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
    if (n) {
       n[1].e = mode;
       n[2].i = i1;
@@ -1894,12 +1992,12 @@ _mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
 
 
 static void GLAPIENTRY
-_mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
+save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH2, 5);
+   n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
    if (n) {
       n[1].e = mode;
       n[2].i = i1;
@@ -1921,7 +2019,7 @@ save_Fogfv(GLenum pname, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_FOG, 5);
+   n = alloc_instruction(ctx, OPCODE_FOG, 5);
    if (n) {
       n[1].e = pname;
       n[2].f = params[0];
@@ -1990,7 +2088,7 @@ save_FrontFace(GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_FRONT_FACE, 1);
+   n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -2007,7 +2105,7 @@ save_Frustum(GLdouble left, GLdouble right,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_FRUSTUM, 6);
+   n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
    if (n) {
       n[1].f = (GLfloat) left;
       n[2].f = (GLfloat) right;
@@ -2028,7 +2126,7 @@ save_Hint(GLenum target, GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_HINT, 2);
+   n = alloc_instruction(ctx, OPCODE_HINT, 2);
    if (n) {
       n[1].e = target;
       n[2].e = mode;
@@ -2047,7 +2145,7 @@ save_Histogram(GLenum target, GLsizei width, GLenum internalFormat,
    Node *n;
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_HISTOGRAM, 4);
+   n = alloc_instruction(ctx, OPCODE_HISTOGRAM, 4);
    if (n) {
       n[1].e = target;
       n[2].i = width;
@@ -2066,7 +2164,7 @@ save_IndexMask(GLuint mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_INDEX_MASK, 1);
+   n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
    if (n) {
       n[1].ui = mask;
    }
@@ -2081,7 +2179,7 @@ save_InitNames(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_INIT_NAMES, 0);
+   (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
    if (ctx->ExecuteFlag) {
       CALL_InitNames(ctx->Exec, ());
    }
@@ -2094,7 +2192,7 @@ save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT, 6);
+   n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
    if (n) {
       GLint i, nParams;
       n[1].e = light;
@@ -2208,7 +2306,7 @@ save_LightModelfv(GLenum pname, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT_MODEL, 5);
+   n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
    if (n) {
       n[1].e = pname;
       n[2].f = params[0];
@@ -2275,7 +2373,7 @@ save_LineStipple(GLint factor, GLushort pattern)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_STIPPLE, 2);
+   n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
    if (n) {
       n[1].i = factor;
       n[2].us = pattern;
@@ -2292,7 +2390,7 @@ save_LineWidth(GLfloat width)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_WIDTH, 1);
+   n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
    if (n) {
       n[1].f = width;
    }
@@ -2308,7 +2406,7 @@ save_ListBase(GLuint base)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LIST_BASE, 1);
+   n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
    if (n) {
       n[1].ui = base;
    }
@@ -2323,7 +2421,7 @@ save_LoadIdentity(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_IDENTITY, 0);
+   (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
    if (ctx->ExecuteFlag) {
       CALL_LoadIdentity(ctx->Exec, ());
    }
@@ -2336,7 +2434,7 @@ save_LoadMatrixf(const GLfloat * m)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_MATRIX, 16);
+   n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
    if (n) {
       GLuint i;
       for (i = 0; i < 16; i++) {
@@ -2367,7 +2465,7 @@ save_LoadName(GLuint name)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_NAME, 1);
+   n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
    if (n) {
       n[1].ui = name;
    }
@@ -2383,7 +2481,7 @@ save_LogicOp(GLenum opcode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LOGIC_OP, 1);
+   n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
    if (n) {
       n[1].e = opcode;
    }
@@ -2400,7 +2498,7 @@ save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6);
+   n = alloc_instruction(ctx, OPCODE_MAP1, 6);
    if (n) {
       GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
       n[1].e = target;
@@ -2422,7 +2520,7 @@ save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6);
+   n = alloc_instruction(ctx, OPCODE_MAP1, 6);
    if (n) {
       GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
       n[1].e = target;
@@ -2447,7 +2545,7 @@ save_Map2d(GLenum target,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10);
+   n = alloc_instruction(ctx, OPCODE_MAP2, 10);
    if (n) {
       GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
                                               vstride, vorder, points);
@@ -2480,7 +2578,7 @@ save_Map2f(GLenum target,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10);
+   n = alloc_instruction(ctx, OPCODE_MAP2, 10);
    if (n) {
       GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
                                               vstride, vorder, points);
@@ -2509,7 +2607,7 @@ save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID1, 3);
+   n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
    if (n) {
       n[1].i = un;
       n[2].f = u1;
@@ -2535,7 +2633,7 @@ save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID2, 6);
+   n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
    if (n) {
       n[1].i = un;
       n[2].f = u1;
@@ -2566,7 +2664,7 @@ save_MatrixMode(GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MATRIX_MODE, 1);
+   n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -2583,7 +2681,7 @@ save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
    Node *n;
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MIN_MAX, 3);
+   n = alloc_instruction(ctx, OPCODE_MIN_MAX, 3);
    if (n) {
       n[1].e = target;
       n[2].e = internalFormat;
@@ -2601,7 +2699,7 @@ save_MultMatrixf(const GLfloat * m)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MULT_MATRIX, 16);
+   n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
    if (n) {
       GLuint i;
       for (i = 0; i < 16; i++) {
@@ -2645,7 +2743,7 @@ save_Ortho(GLdouble left, GLdouble right,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ORTHO, 6);
+   n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
    if (n) {
       n[1].f = (GLfloat) left;
       n[2].f = (GLfloat) right;
@@ -2666,7 +2764,7 @@ save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_MAP, 3);
+   n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 3);
    if (n) {
       n[1].e = map;
       n[2].i = mapsize;
@@ -2723,7 +2821,7 @@ save_PixelTransferf(GLenum pname, GLfloat param)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_TRANSFER, 2);
+   n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
    if (n) {
       n[1].e = pname;
       n[2].f = param;
@@ -2747,7 +2845,7 @@ save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_ZOOM, 2);
+   n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
    if (n) {
       n[1].f = xfactor;
       n[2].f = yfactor;
@@ -2764,7 +2862,7 @@ save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_PARAMETERS, 4);
+   n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
    if (n) {
       n[1].e = pname;
       n[2].f = params[0];
@@ -2811,7 +2909,7 @@ save_PointSize(GLfloat size)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_SIZE, 1);
+   n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
    if (n) {
       n[1].f = size;
    }
@@ -2827,7 +2925,7 @@ save_PolygonMode(GLenum face, GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_MODE, 2);
+   n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
    if (n) {
       n[1].e = face;
       n[2].e = mode;
@@ -2846,7 +2944,7 @@ save_PolygonStipple(const GLubyte * pattern)
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1);
+   n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, 1);
    if (n) {
       n[1].data = unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
                                pattern, &ctx->Unpack);
@@ -2863,7 +2961,7 @@ save_PolygonOffset(GLfloat factor, GLfloat units)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_OFFSET, 2);
+   n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
    if (n) {
       n[1].f = factor;
       n[2].f = units;
@@ -2888,7 +2986,7 @@ save_PopAttrib(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_ATTRIB, 0);
+   (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
    if (ctx->ExecuteFlag) {
       CALL_PopAttrib(ctx->Exec, ());
    }
@@ -2900,7 +2998,7 @@ save_PopMatrix(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_MATRIX, 0);
+   (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
    if (ctx->ExecuteFlag) {
       CALL_PopMatrix(ctx->Exec, ());
    }
@@ -2912,7 +3010,7 @@ save_PopName(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_NAME, 0);
+   (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
    if (ctx->ExecuteFlag) {
       CALL_PopName(ctx->Exec, ());
    }
@@ -2929,7 +3027,7 @@ save_PrioritizeTextures(GLsizei num, const GLuint * textures,
 
    for (i = 0; i < num; i++) {
       Node *n;
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
+      n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
       if (n) {
          n[1].ui = textures[i];
          n[2].f = priorities[i];
@@ -2947,7 +3045,7 @@ save_PushAttrib(GLbitfield mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_ATTRIB, 1);
+   n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
    if (n) {
       n[1].bf = mask;
    }
@@ -2962,7 +3060,7 @@ save_PushMatrix(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_MATRIX, 0);
+   (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
    if (ctx->ExecuteFlag) {
       CALL_PushMatrix(ctx->Exec, ());
    }
@@ -2975,7 +3073,7 @@ save_PushName(GLuint name)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_NAME, 1);
+   n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
    if (n) {
       n[1].ui = name;
    }
@@ -2991,7 +3089,7 @@ save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_RASTER_POS, 4);
+   n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
    if (n) {
       n[1].f = x;
       n[2].f = y;
@@ -3150,7 +3248,7 @@ save_PassThrough(GLfloat token)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PASSTHROUGH, 1);
+   n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
    if (n) {
       n[1].f = token;
    }
@@ -3166,7 +3264,7 @@ save_ReadBuffer(GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_READ_BUFFER, 1);
+   n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -3182,7 +3280,7 @@ save_ResetHistogram(GLenum target)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_HISTOGRAM, 1);
+   n = alloc_instruction(ctx, OPCODE_RESET_HISTOGRAM, 1);
    if (n) {
       n[1].e = target;
    }
@@ -3198,7 +3296,7 @@ save_ResetMinmax(GLenum target)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_MIN_MAX, 1);
+   n = alloc_instruction(ctx, OPCODE_RESET_MIN_MAX, 1);
    if (n) {
       n[1].e = target;
    }
@@ -3214,7 +3312,7 @@ save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ROTATE, 4);
+   n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
    if (n) {
       n[1].f = angle;
       n[2].f = x;
@@ -3240,7 +3338,7 @@ save_Scalef(GLfloat x, GLfloat y, GLfloat z)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_SCALE, 3);
+   n = alloc_instruction(ctx, OPCODE_SCALE, 3);
    if (n) {
       n[1].f = x;
       n[2].f = y;
@@ -3265,7 +3363,7 @@ save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_SCISSOR, 4);
+   n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
    if (n) {
       n[1].i = x;
       n[2].i = y;
@@ -3299,7 +3397,7 @@ save_ShadeModel(GLenum mode)
    if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END)
       ctx->ListState.Current.ShadeModel = mode;
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1);
+   n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -3312,7 +3410,7 @@ save_StencilFunc(GLenum func, GLint ref, GLuint mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC, 3);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
    if (n) {
       n[1].e = func;
       n[2].i = ref;
@@ -3330,7 +3428,7 @@ save_StencilMask(GLuint mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK, 1);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
    if (n) {
       n[1].ui = mask;
    }
@@ -3346,7 +3444,7 @@ save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP, 3);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
    if (n) {
       n[1].e = fail;
       n[2].e = zfail;
@@ -3364,7 +3462,7 @@ save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
    if (n) {
       n[1].e = face;
       n[2].e = func;
@@ -3385,7 +3483,7 @@ save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    /* GL_FRONT */
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
    if (n) {
       n[1].e = GL_FRONT;
       n[2].e = frontfunc;
@@ -3393,7 +3491,7 @@ save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
       n[4].ui = mask;
    }
    /* GL_BACK */
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
    if (n) {
       n[1].e = GL_BACK;
       n[2].e = backfunc;
@@ -3413,7 +3511,7 @@ save_StencilMaskSeparate(GLenum face, GLuint mask)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
    if (n) {
       n[1].e = face;
       n[2].ui = mask;
@@ -3430,7 +3528,7 @@ save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
+   n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
    if (n) {
       n[1].e = face;
       n[2].e = fail;
@@ -3449,7 +3547,7 @@ save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXENV, 6);
+   n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -3514,7 +3612,7 @@ save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXGEN, 6);
+   n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
    if (n) {
       n[1].e = coord;
       n[2].e = pname;
@@ -3589,7 +3687,7 @@ save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXPARAMETER, 6);
+   n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
    if (n) {
       n[1].e = target;
       n[2].e = pname;
@@ -3649,7 +3747,7 @@ save_TexImage1D(GLenum target,
    else {
       Node *n;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE1D, 8);
+      n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 8);
       if (n) {
          n[1].e = target;
          n[2].i = level;
@@ -3684,7 +3782,7 @@ save_TexImage2D(GLenum target,
    else {
       Node *n;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE2D, 9);
+      n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 9);
       if (n) {
          n[1].e = target;
          n[2].i = level;
@@ -3722,7 +3820,7 @@ save_TexImage3D(GLenum target,
    else {
       Node *n;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE3D, 10);
+      n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 10);
       if (n) {
          n[1].e = target;
          n[2].i = level;
@@ -3755,7 +3853,7 @@ save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE1D, 7);
+   n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 7);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -3784,7 +3882,7 @@ save_TexSubImage2D(GLenum target, GLint level,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE2D, 9);
+   n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 9);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -3815,7 +3913,7 @@ save_TexSubImage3D(GLenum target, GLint level,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
+   n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -3845,7 +3943,7 @@ save_Translatef(GLfloat x, GLfloat y, GLfloat z)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TRANSLATE, 3);
+   n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
    if (n) {
       n[1].f = x;
       n[2].f = y;
@@ -3871,7 +3969,7 @@ save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_VIEWPORT, 4);
+   n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
    if (n) {
       n[1].i = x;
       n[2].i = y;
@@ -3890,7 +3988,7 @@ save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_WINDOW_POS, 4);
+   n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
    if (n) {
       n[1].f = x;
       n[2].f = y;
@@ -4051,7 +4149,7 @@ save_ActiveTextureARB(GLenum target)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_TEXTURE, 1);
+   n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
    if (n) {
       n[1].e = target;
    }
@@ -4124,7 +4222,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
          return;
       }
       MEMCPY(image, data, imageSize);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7);
+      n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7);
       if (n) {
          n[1].e = target;
          n[2].i = level;
@@ -4170,7 +4268,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
          return;
       }
       MEMCPY(image, data, imageSize);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8);
+      n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8);
       if (n) {
          n[1].e = target;
          n[2].i = level;
@@ -4217,7 +4315,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
          return;
       }
       MEMCPY(image, data, imageSize);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9);
+      n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9);
       if (n) {
          n[1].e = target;
          n[2].i = level;
@@ -4260,7 +4358,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
       return;
    }
    MEMCPY(image, data, imageSize);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7);
+   n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -4300,7 +4398,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
       return;
    }
    MEMCPY(image, data, imageSize);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9);
+   n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -4342,7 +4440,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
       return;
    }
    MEMCPY(image, data, imageSize);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11);
+   n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11);
    if (n) {
       n[1].e = target;
       n[2].i = level;
@@ -4375,7 +4473,7 @@ save_SampleCoverageARB(GLclampf value, GLboolean invert)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_SAMPLE_COVERAGE, 2);
+   n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
    if (n) {
       n[1].f = value;
       n[2].b = invert;
@@ -4396,7 +4494,7 @@ save_BindProgramNV(GLenum target, GLuint id)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_PROGRAM_NV, 2);
+   n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_NV, 2);
    if (n) {
       n[1].e = target;
       n[2].ui = id;
@@ -4413,7 +4511,7 @@ save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
+   n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
    if (n) {
       n[1].e = target;
       n[2].ui = index;
@@ -4450,7 +4548,7 @@ save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
       const GLfloat * p = params;
 
       for (i = 0 ; i < count ; i++) {
-	 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
+	 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
 	 if (n) {
 	    n[1].e = target;
 	    n[2].ui = index;
@@ -4498,7 +4596,7 @@ save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
+   n = alloc_instruction(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
    if (n) {
       n[1].e = target;
       n[2].ui = id;
@@ -4544,7 +4642,7 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
+   n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
    if (n) {
       GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
       if (!programCopy) {
@@ -4571,7 +4669,7 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 2);
+   n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2);
    if (n) {
       GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
       if (!idCopy) {
@@ -4595,7 +4693,7 @@ save_TrackMatrixNV(GLenum target, GLuint address,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 4);
+   n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 4);
    if (n) {
       n[1].e = target;
       n[2].ui = address;
@@ -4620,7 +4718,7 @@ save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
+   n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
    if (n) {
       n[1].e = target;
       n[2].ui = index;
@@ -4642,7 +4740,7 @@ save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
+   n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
    if (n) {
       n[1].e = target;
       n[2].ui = index;
@@ -4670,7 +4768,7 @@ save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
       const GLfloat * p = params;
 
       for (i = 0 ; i < count ; i++) {
-	 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
+	 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
 	 if (n) {
 	    n[1].e = target;
 	    n[2].ui = index;
@@ -4697,7 +4795,7 @@ save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
+   n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
    if (n) {
       n[1].e = target;
       n[2].ui = index;
@@ -4719,7 +4817,7 @@ save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
+   n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
    if (n) {
       n[1].e = target;
       n[2].ui = index;
@@ -4742,7 +4840,7 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
+   n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
    if (n) {
       GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
       if (!nameCopy) {
@@ -4801,7 +4899,7 @@ save_ActiveStencilFaceEXT(GLenum face)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
+   n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
    if (n) {
       n[1].e = face;
    }
@@ -4818,7 +4916,7 @@ save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
+   n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
    if (n) {
       n[1].f = (GLfloat) zmin;
       n[2].f = (GLfloat) zmax;
@@ -4841,7 +4939,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
 
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
+   n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
    if (n) {
       GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
       if (!programCopy) {
@@ -4862,7 +4960,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
 
 
-#if FEATURE_ARB_occlusion_query
+#if FEATURE_queryobj
 
 static void GLAPIENTRY
 save_BeginQueryARB(GLenum target, GLuint id)
@@ -4870,7 +4968,7 @@ save_BeginQueryARB(GLenum target, GLuint id)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
+   n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
    if (n) {
       n[1].e = target;
       n[2].ui = id;
@@ -4887,7 +4985,7 @@ save_EndQueryARB(GLenum target)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_END_QUERY_ARB, 1);
+   n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
    if (n) {
       n[1].e = target;
    }
@@ -4896,7 +4994,7 @@ save_EndQueryARB(GLenum target)
    }
 }
 
-#endif /* FEATURE_ARB_occlusion_query */
+#endif /* FEATURE_queryobj */
 
 
 static void GLAPIENTRY
@@ -4905,7 +5003,7 @@ save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
+   n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
    if (n) {
       GLint i;
       n[1].i = count;
@@ -4926,7 +5024,7 @@ save_TexBumpParameterfvATI(GLenum pname, const GLfloat *param)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5);
+   n = alloc_instruction(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5);
    if (n) {
       n[1].ui = pname;
       n[2].f = param[0];
@@ -4957,7 +5055,7 @@ save_BindFragmentShaderATI(GLuint id)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
+   n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
    if (n) {
       n[1].ui = id;
    }
@@ -4972,7 +5070,7 @@ save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
+   n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
    if (n) {
       n[1].ui = dst;
       n[2].f = value[0];
@@ -4992,7 +5090,7 @@ save_Attr1fNV(GLenum attr, GLfloat x)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_NV, 2);
+   n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5013,7 +5111,7 @@ save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_NV, 3);
+   n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5035,7 +5133,7 @@ save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_NV, 4);
+   n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5058,7 +5156,7 @@ save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_NV, 5);
+   n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5083,7 +5181,7 @@ save_Attr1fARB(GLenum attr, GLfloat x)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_ARB, 2);
+   n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5104,7 +5202,7 @@ save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_ARB, 3);
+   n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5126,7 +5224,7 @@ save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_ARB, 4);
+   n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5149,7 +5247,7 @@ save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_ARB, 5);
+   n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5);
    if (n) {
       n[1].e = attr;
       n[2].f = x;
@@ -5174,7 +5272,7 @@ save_EvalCoord1f(GLfloat x)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C1, 1);
+   n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
    if (n) {
       n[1].f = x;
    }
@@ -5195,7 +5293,7 @@ save_EvalCoord2f(GLfloat x, GLfloat y)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C2, 2);
+   n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
    if (n) {
       n[1].f = x;
       n[2].f = y;
@@ -5218,7 +5316,7 @@ save_EvalPoint1(GLint x)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P1, 1);
+   n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
    if (n) {
       n[1].i = x;
    }
@@ -5233,7 +5331,7 @@ save_EvalPoint2(GLint x, GLint y)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P2, 2);
+   n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
    if (n) {
       n[1].i = x;
       n[2].i = y;
@@ -5336,7 +5434,7 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
 
    SAVE_FLUSH_VERTICES(ctx);
 
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6);
+   n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
    if (n) {
       n[1].e = face;
       n[2].e = pname;
@@ -5379,7 +5477,7 @@ save_Begin(GLenum mode)
          return;
 
       SAVE_FLUSH_VERTICES(ctx);
-      n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN, 1);
+      n = alloc_instruction(ctx, OPCODE_BEGIN, 1);
       if (n) {
          n[1].e = mode;
       }
@@ -5395,7 +5493,7 @@ save_End(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    SAVE_FLUSH_VERTICES(ctx);
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_END, 0);
+   (void) alloc_instruction(ctx, OPCODE_END, 0);
    ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
    if (ctx->ExecuteFlag) {
       CALL_End(ctx->Exec, ());
@@ -5408,7 +5506,7 @@ save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    SAVE_FLUSH_VERTICES(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_RECTF, 4);
+   n = alloc_instruction(ctx, OPCODE_RECTF, 4);
    if (n) {
       n[1].f = a;
       n[2].f = b;
@@ -5822,7 +5920,7 @@ save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
+   n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
    if (n) {
       n[1].i = srcX0;
       n[2].i = srcY0;
@@ -5851,7 +5949,7 @@ save_ProvokingVertexEXT(GLenum mode)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_PROVOKING_VERTEX, 1);
+   n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
    if (n) {
       n[1].e = mode;
    }
@@ -5869,7 +5967,7 @@ save_UseProgramObjectARB(GLhandleARB program)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_USE_PROGRAM, 1);
+   n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
    if (n) {
       n[1].ui = program;
    }
@@ -5885,7 +5983,7 @@ save_Uniform1fARB(GLint location, GLfloat x)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1F, 2);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
    if (n) {
       n[1].i = location;
       n[2].f = x;
@@ -5902,7 +6000,7 @@ save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2F, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
    if (n) {
       n[1].i = location;
       n[2].f = x;
@@ -5920,7 +6018,7 @@ save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3F, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
    if (n) {
       n[1].i = location;
       n[2].f = x;
@@ -5939,7 +6037,7 @@ save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4F, 5);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
    if (n) {
       n[1].i = location;
       n[2].f = x;
@@ -5970,7 +6068,7 @@ save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1FV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -5987,7 +6085,7 @@ save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2FV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6004,7 +6102,7 @@ save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3FV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6021,7 +6119,7 @@ save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4FV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6039,7 +6137,7 @@ save_Uniform1iARB(GLint location, GLint x)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1I, 2);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
    if (n) {
       n[1].i = location;
       n[2].i = x;
@@ -6055,7 +6153,7 @@ save_Uniform2iARB(GLint location, GLint x, GLint y)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2I, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
    if (n) {
       n[1].i = location;
       n[2].i = x;
@@ -6072,7 +6170,7 @@ save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3I, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
    if (n) {
       n[1].i = location;
       n[2].i = x;
@@ -6090,7 +6188,7 @@ save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4I, 5);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
    if (n) {
       n[1].i = location;
       n[2].i = x;
@@ -6111,7 +6209,7 @@ save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1IV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6128,7 +6226,7 @@ save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2IV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6145,7 +6243,7 @@ save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3IV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6162,7 +6260,7 @@ save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4IV, 3);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 3);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6181,7 +6279,7 @@ save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX22, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6200,7 +6298,7 @@ save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX33, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6219,7 +6317,7 @@ save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX44, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6239,7 +6337,7 @@ save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX23, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6258,7 +6356,7 @@ save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX32, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6278,7 +6376,7 @@ save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX24, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6297,7 +6395,7 @@ save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX42, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6317,7 +6415,7 @@ save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX34, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6336,7 +6434,7 @@ save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX43, 4);
+   n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 4);
    if (n) {
       n[1].i = location;
       n[2].i = count;
@@ -6360,7 +6458,7 @@ static void
 save_error(GLcontext *ctx, GLenum error, const char *s)
 {
    Node *n;
-   n = ALLOC_INSTRUCTION(ctx, OPCODE_ERROR, 2);
+   n = alloc_instruction(ctx, OPCODE_ERROR, 2);
    if (n) {
       n[1].e = error;
       n[2].data = (void *) s;
@@ -6436,13 +6534,10 @@ execute_list(GLcontext *ctx, GLuint list)
 
    done = GL_FALSE;
    while (!done) {
-      OpCode opcode = n[0].opcode;
-      int i = (int) n[0].opcode - (int) OPCODE_EXT_0;
+      const OpCode opcode = n[0].opcode;
 
-      if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
-         /* this is a driver-extended opcode */
-         ctx->ListExt.Opcode[i].Execute(ctx, &n[1]);
-         n += ctx->ListExt.Opcode[i].Size;
+      if (is_ext_opcode(opcode)) {
+         n += ext_opcode_execute(ctx, n);
       }
       else {
          switch (opcode) {
@@ -7161,7 +7256,7 @@ execute_list(GLcontext *ctx, GLuint list)
                                                       n[6].f));
             break;
 #endif
-#if FEATURE_ARB_occlusion_query
+#if FEATURE_queryobj
          case OPCODE_BEGIN_QUERY_ARB:
             CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui));
             break;
@@ -7432,7 +7527,7 @@ execute_list(GLcontext *ctx, GLuint list)
 /**
  * Test if a display list number is valid.
  */
-GLboolean GLAPIENTRY
+static GLboolean GLAPIENTRY
 _mesa_IsList(GLuint list)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -7445,7 +7540,7 @@ _mesa_IsList(GLuint list)
 /**
  * Delete a sequence of consecutive display lists.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_DeleteLists(GLuint list, GLsizei range)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -7467,7 +7562,7 @@ _mesa_DeleteLists(GLuint list, GLsizei range)
  * Return a display list number, n, such that lists n through n+range-1
  * are free.
  */
-GLuint GLAPIENTRY
+static GLuint GLAPIENTRY
 _mesa_GenLists(GLsizei range)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -7507,7 +7602,7 @@ _mesa_GenLists(GLsizei range)
 /**
  * Begin a new display list.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_NewList(GLuint name, GLenum mode)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -7557,7 +7652,7 @@ _mesa_NewList(GLuint name, GLenum mode)
 /**
  * End definition of current display list. 
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_EndList(void)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -7578,7 +7673,7 @@ _mesa_EndList(void)
     */
    ctx->Driver.EndList(ctx);
 
-   (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0);
+   (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
 
    /* Destroy old list, if any */
    destroy_list(ctx, ctx->ListState.CurrentList->Name);
@@ -7691,7 +7786,7 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
 /**
  * Set the offset added to list numbers in glCallLists.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ListBase(GLuint base)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -8426,7 +8521,7 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode,
  * struct.
  */
 void
-_mesa_init_dlist_table(struct _glapi_table *table)
+_mesa_init_save_table(struct _glapi_table *table)
 {
    _mesa_loopback_init_api_table(table);
 
@@ -8435,8 +8530,8 @@ _mesa_init_dlist_table(struct _glapi_table *table)
    SET_AlphaFunc(table, save_AlphaFunc);
    SET_Bitmap(table, save_Bitmap);
    SET_BlendFunc(table, save_BlendFunc);
-   SET_CallList(table, _mesa_save_CallList);
-   SET_CallLists(table, _mesa_save_CallLists);
+   SET_CallList(table, save_CallList);
+   SET_CallLists(table, save_CallLists);
    SET_Clear(table, save_Clear);
    SET_ClearAccum(table, save_ClearAccum);
    SET_ClearColor(table, save_ClearColor);
@@ -8457,8 +8552,8 @@ _mesa_init_dlist_table(struct _glapi_table *table)
    SET_DrawPixels(table, save_DrawPixels);
    SET_Enable(table, save_Enable);
    SET_EndList(table, _mesa_EndList);
-   SET_EvalMesh1(table, _mesa_save_EvalMesh1);
-   SET_EvalMesh2(table, _mesa_save_EvalMesh2);
+   SET_EvalMesh1(table, save_EvalMesh1);
+   SET_EvalMesh2(table, save_EvalMesh2);
    SET_Finish(table, exec_Finish);
    SET_Flush(table, exec_Flush);
    SET_Fogf(table, save_Fogf);
@@ -8930,7 +9025,7 @@ _mesa_init_dlist_table(struct _glapi_table *table)
    SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
 #endif
 
-#if FEATURE_ARB_occlusion_query
+#if FEATURE_queryobj
    SET_BeginQueryARB(table, save_BeginQueryARB);
    SET_EndQueryARB(table, save_EndQueryARB);
    SET_GenQueriesARB(table, _mesa_GenQueriesARB);
@@ -9036,13 +9131,10 @@ print_list(GLcontext *ctx, GLuint list)
 
    done = n ? GL_FALSE : GL_TRUE;
    while (!done) {
-      OpCode opcode = n[0].opcode;
-      GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
+      const OpCode opcode = n[0].opcode;
 
-      if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
-         /* this is a driver-extended opcode */
-         ctx->ListExt.Opcode[i].Print(ctx, &n[1]);
-         n += ctx->ListExt.Opcode[i].Size;
+      if (is_ext_opcode(opcode)) {
+         n += ext_opcode_print(ctx, n);
       }
       else {
          switch (opcode) {
@@ -9297,22 +9389,21 @@ mesa_print_display_list(GLuint list)
 void
 _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
 {
-   vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
+   _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
+
    vfmt->Begin = save_Begin;
-   vfmt->CallList = _mesa_save_CallList;
-   vfmt->CallLists = _mesa_save_CallLists;
+
+   _MESA_INIT_DLIST_VTXFMT(vfmt, save_);
+
    vfmt->Color3f = save_Color3f;
    vfmt->Color3fv = save_Color3fv;
    vfmt->Color4f = save_Color4f;
    vfmt->Color4fv = save_Color4fv;
    vfmt->EdgeFlag = save_EdgeFlag;
    vfmt->End = save_End;
-   vfmt->EvalCoord1f = save_EvalCoord1f;
-   vfmt->EvalCoord1fv = save_EvalCoord1fv;
-   vfmt->EvalCoord2f = save_EvalCoord2f;
-   vfmt->EvalCoord2fv = save_EvalCoord2fv;
-   vfmt->EvalPoint1 = save_EvalPoint1;
-   vfmt->EvalPoint2 = save_EvalPoint2;
+
+   _MESA_INIT_EVAL_VTXFMT(vfmt, save_);
+
    vfmt->FogCoordfEXT = save_FogCoordfEXT;
    vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
    vfmt->Indexf = save_Indexf;
@@ -9361,8 +9452,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
    vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
    vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
 
-   vfmt->EvalMesh1 = _mesa_save_EvalMesh1;
-   vfmt->EvalMesh2 = _mesa_save_EvalMesh2;
    vfmt->Rectf = save_Rectf;
 
    /* The driver is required to implement these as
@@ -9376,10 +9465,39 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
    vfmt->DrawElements = 0;
    vfmt->DrawRangeElements = 0;
    vfmt->MultiDrawElemementsEXT = 0;
+   vfmt->DrawElementsBaseVertex = 0;
+   vfmt->DrawRangeElementsBaseVertex = 0;
+   vfmt->MultiDrawElemementsBaseVertex = 0;
 #endif
 }
 
 
+void
+_mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
+                           const GLvertexformat *vfmt)
+{
+   SET_CallList(disp, vfmt->CallList);
+   SET_CallLists(disp, vfmt->CallLists);
+}
+
+
+void _mesa_init_dlist_dispatch(struct _glapi_table *disp)
+{
+   SET_CallList(disp, _mesa_CallList);
+   SET_CallLists(disp, _mesa_CallLists);
+
+   SET_DeleteLists(disp, _mesa_DeleteLists);
+   SET_EndList(disp, _mesa_EndList);
+   SET_GenLists(disp, _mesa_GenLists);
+   SET_IsList(disp, _mesa_IsList);
+   SET_ListBase(disp, _mesa_ListBase);
+   SET_NewList(disp, _mesa_NewList);
+}
+
+
+#endif /* FEATURE_dlist */
+
+
 /**
  * Initialize display list state for given context.
  */
@@ -9394,6 +9512,9 @@ _mesa_init_display_list(GLcontext *ctx)
       tableInitialized = GL_TRUE;
    }
 
+   /* extension info */
+   ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
+
    /* Display list */
    ctx->ListState.CallDepth = 0;
    ctx->ExecuteFlag = GL_TRUE;
@@ -9404,5 +9525,15 @@ _mesa_init_display_list(GLcontext *ctx)
    /* Display List group */
    ctx->List.ListBase = 0;
 
+#if FEATURE_dlist
    _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
+#endif
+}
+
+
+void
+_mesa_free_display_list_data(GLcontext *ctx)
+{
+   free(ctx->ListExt);
+   ctx->ListExt = NULL;
 }
diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h
index ab7ec2c8d..f37a93a7f 100644
--- a/mesalib/src/mesa/main/dlist.h
+++ b/mesalib/src/mesa/main/dlist.h
@@ -33,64 +33,80 @@
 #define DLIST_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
 
-#if _HAVE_FULL_GL
+#if FEATURE_dlist
 
-extern void
-_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist);
+#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl)               \
+   do {                                                        \
+      (driver)->NewList           = impl ## NewList;           \
+      (driver)->EndList           = impl ## EndList;           \
+      (driver)->BeginCallList     = impl ## BeginCallList;     \
+      (driver)->EndCallList       = impl ## EndCallList;       \
+      (driver)->SaveFlushVertices = impl ## SaveFlushVertices; \
+      (driver)->NotifySaveBegin   = impl ## NotifyBegin;       \
+   } while (0)
+
+#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl)  \
+   do {                                      \
+      (vfmt)->CallList  = impl ## CallList;  \
+      (vfmt)->CallLists = impl ## CallLists; \
+   } while (0)
 
 extern void GLAPIENTRY _mesa_CallList( GLuint list );
 
 extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
 
-extern void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range );
 
-extern void GLAPIENTRY _mesa_EndList( void );
+extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s );
 
-extern GLuint GLAPIENTRY _mesa_GenLists( GLsizei range );
+extern void *_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint sz);
 
-extern GLboolean GLAPIENTRY _mesa_IsList( GLuint list );
+extern GLint _mesa_dlist_alloc_opcode( GLcontext *ctx, GLuint sz,
+                                       void (*execute)( GLcontext *, void * ),
+                                       void (*destroy)( GLcontext *, void * ),
+                                       void (*print)( GLcontext *, void * ) );
 
-extern void GLAPIENTRY _mesa_ListBase( GLuint base );
+extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist);
 
-extern void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode );
+extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
 
-extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
+extern void _mesa_init_save_table( struct _glapi_table *table );
 
-extern void GLAPIENTRY _mesa_save_CallList( GLuint list );
+extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
+                                       const GLvertexformat *vfmt);
 
+extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp);
 
+#else /* FEATURE_dlist */
 
-extern void _mesa_init_dlist_table( struct _glapi_table *table );
+#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) do { } while (0)
+#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0)
 
-extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s );
+static INLINE void
+_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
+{
+   /* there should be no list to delete */
+   ASSERT_NO_FEATURE();
+}
 
+static INLINE void
+_mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
+                           const GLvertexformat *vfmt)
+{
+}
 
-extern void *_mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint sz);
+static INLINE void
+_mesa_init_dlist_dispatch(struct _glapi_table *disp)
+{
+}
 
-extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz,
-                                 void (*execute)( GLcontext *, void * ),
-                                 void (*destroy)( GLcontext *, void * ),
-                                 void (*print)( GLcontext *, void * ) );
+#endif /* FEATURE_dlist */
 
 extern void _mesa_init_display_list( GLcontext * ctx );
 
-extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
-
-
-#else
-
-/** No-op */
-#define _mesa_init_dlist_table(t,ts) ((void)0)
-
-/** No-op */
-#define _mesa_init_display_list(c) ((void)0)
-
-/** No-op */
-#define _mesa_save_vtxfmt_init(v) ((void)0)
+extern void _mesa_free_display_list_data(GLcontext *ctx);
 
-#endif
 
-#endif
+#endif /* DLIST_H */
diff --git a/mesalib/src/mesa/main/dlopen.c b/mesalib/src/mesa/main/dlopen.c
index 414cfad8e..81e032081 100644
--- a/mesalib/src/mesa/main/dlopen.c
+++ b/mesalib/src/mesa/main/dlopen.c
@@ -31,7 +31,7 @@
 #include "compiler.h"
 #include "dlopen.h"
 
-#if defined(_GNU_SOURCE) && !defined(__MINGW32__)
+#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts)
 #include <dlfcn.h>
 #endif
 #if defined(_WIN32)
@@ -46,7 +46,9 @@
 void *
 _mesa_dlopen(const char *libname, int flags)
 {
-#if defined(_GNU_SOURCE)
+#if defined(__blrts)
+   return NULL;
+#elif defined(_GNU_SOURCE)
    flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
    return dlopen(libname, flags);
 #elif defined(__MINGW32__)
@@ -65,7 +67,9 @@ _mesa_dlopen(const char *libname, int flags)
 GenericFunc
 _mesa_dlsym(void *handle, const char *fname)
 {
-#if defined(__DJGPP__)
+#if defined(__blrts)
+   return (GenericFunc) NULL;
+#elif defined(__DJGPP__)
    /* need '_' prefix on symbol names */
    char fname2[1000];
    fname2[0] = '_';
@@ -88,7 +92,9 @@ _mesa_dlsym(void *handle, const char *fname)
 void
 _mesa_dlclose(void *handle)
 {
-#if defined(_GNU_SOURCE)
+#if defined(__blrts)
+   (void) handle;
+#elif defined(_GNU_SOURCE)
    dlclose(handle);
 #elif defined(__MINGW32__)
    FreeLibrary(handle);
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index aef658564..5d4b53af4 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -33,8 +33,11 @@
 #include "image.h"
 #include "readpix.h"
 #include "state.h"
+#include "glapi/dispatch.h"
 
 
+#if FEATURE_drawpix
+
 
 /**
  * If a fragment program is enabled, check that it's valid.
@@ -47,12 +50,10 @@ valid_fragment_program(GLcontext *ctx)
 }
 
 
-#if _HAVE_FULL_GL
-
 /*
  * Execute glDrawPixels
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_DrawPixels( GLsizei width, GLsizei height,
                   GLenum format, GLenum type, const GLvoid *pixels )
 {
@@ -140,7 +141,7 @@ end:
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
                   GLenum type )
 {
@@ -225,11 +226,8 @@ end:
    _mesa_set_vp_override(ctx, GL_FALSE);
 }
 
-#endif /* _HAVE_FULL_GL */
 
-
-
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Bitmap( GLsizei width, GLsizei height,
               GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
               const GLubyte *bitmap )
@@ -309,3 +307,15 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
    ctx->Current.RasterPos[0] += xmove;
    ctx->Current.RasterPos[1] += ymove;
 }
+
+
+void
+_mesa_init_drawpix_dispatch(struct _glapi_table *disp)
+{
+   SET_Bitmap(disp, _mesa_Bitmap);
+   SET_CopyPixels(disp, _mesa_CopyPixels);
+   SET_DrawPixels(disp, _mesa_DrawPixels);
+}
+
+
+#endif /* FEATURE_drawpix */
diff --git a/mesalib/src/mesa/main/drawpix.h b/mesalib/src/mesa/main/drawpix.h
index 6177adad6..8ffb1a6d8 100644
--- a/mesalib/src/mesa/main/drawpix.h
+++ b/mesalib/src/mesa/main/drawpix.h
@@ -22,28 +22,35 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#ifndef DRAWPIX_H
+#define DRAWPIX_H
 
-#ifndef DRAWPIXELS_H
-#define DRAWPIXELS_H
 
+#include "main/mtypes.h"
 
-#include "main/glheader.h"
 
+#if FEATURE_drawpix
 
-extern void GLAPIENTRY
-_mesa_DrawPixels( GLsizei width, GLsizei height,
-                  GLenum format, GLenum type, const GLvoid *pixels );
+#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) \
+   do {                                            \
+      (driver)->DrawPixels = impl ## DrawPixels;   \
+      (driver)->CopyPixels = impl ## CopyPixels;   \
+      (driver)->Bitmap     = impl ## Bitmap;       \
+   } while (0)
 
+extern void
+_mesa_init_drawpix_dispatch(struct _glapi_table *disp);
 
-extern void GLAPIENTRY
-_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
-                  GLenum type );
+#else /* FEATURE_drawpix */
 
+#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) do { } while (0)
 
-extern void GLAPIENTRY
-_mesa_Bitmap( GLsizei width, GLsizei height,
-              GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
-              const GLubyte *bitmap );
+static INLINE void
+_mesa_init_drawpix_dispatch(struct _glapi_table *disp)
+{
+}
 
+#endif /* FEATURE_drawpix */
 
-#endif
+
+#endif /* DRAWPIX_H */
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 4a00440ab..12ce14c5d 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -36,8 +36,8 @@
 #include "simple_list.h"
 #include "mtypes.h"
 #include "enums.h"
-#include "math/m_matrix.h"
 #include "api_arrayelt.h"
+#include "texstate.h"
 
 
 
@@ -55,46 +55,47 @@
 static void
 client_state(GLcontext *ctx, GLenum cap, GLboolean state)
 {
+   struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
    GLuint flag;
    GLboolean *var;
 
    switch (cap) {
       case GL_VERTEX_ARRAY:
-         var = &ctx->Array.ArrayObj->Vertex.Enabled;
+         var = &arrayObj->Vertex.Enabled;
          flag = _NEW_ARRAY_VERTEX;
          break;
       case GL_NORMAL_ARRAY:
-         var = &ctx->Array.ArrayObj->Normal.Enabled;
+         var = &arrayObj->Normal.Enabled;
          flag = _NEW_ARRAY_NORMAL;
          break;
       case GL_COLOR_ARRAY:
-         var = &ctx->Array.ArrayObj->Color.Enabled;
+         var = &arrayObj->Color.Enabled;
          flag = _NEW_ARRAY_COLOR0;
          break;
       case GL_INDEX_ARRAY:
-         var = &ctx->Array.ArrayObj->Index.Enabled;
+         var = &arrayObj->Index.Enabled;
          flag = _NEW_ARRAY_INDEX;
          break;
       case GL_TEXTURE_COORD_ARRAY:
-         var = &ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled;
+         var = &arrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled;
          flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
          break;
       case GL_EDGE_FLAG_ARRAY:
-         var = &ctx->Array.ArrayObj->EdgeFlag.Enabled;
+         var = &arrayObj->EdgeFlag.Enabled;
          flag = _NEW_ARRAY_EDGEFLAG;
          break;
       case GL_FOG_COORDINATE_ARRAY_EXT:
-         var = &ctx->Array.ArrayObj->FogCoord.Enabled;
+         var = &arrayObj->FogCoord.Enabled;
          flag = _NEW_ARRAY_FOGCOORD;
          break;
       case GL_SECONDARY_COLOR_ARRAY_EXT:
-         var = &ctx->Array.ArrayObj->SecondaryColor.Enabled;
+         var = &arrayObj->SecondaryColor.Enabled;
          flag = _NEW_ARRAY_COLOR1;
          break;
 
 #if FEATURE_point_size_array
       case GL_POINT_SIZE_ARRAY_OES:
-         var = &ctx->Array.ArrayObj->PointSize.Enabled;
+         var = &arrayObj->PointSize.Enabled;
          flag = _NEW_ARRAY_POINT_SIZE;
          break;
 #endif
@@ -120,7 +121,7 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state)
          {
             GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
             ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
-            var = &ctx->Array.ArrayObj->VertexAttrib[n].Enabled;
+            var = &arrayObj->VertexAttrib[n].Enabled;
             flag = _NEW_ARRAY_ATTRIB(n);
          }
          break;
@@ -229,8 +230,7 @@ get_texcoord_unit(GLcontext *ctx)
 static GLboolean
 enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit)
 {
-   const GLuint curr = ctx->Texture.CurrentUnit;
-   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
    const GLbitfield newenabled = state
       ? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit);
 
@@ -942,6 +942,14 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
          ctx->Depth.BoundsTest = state;
          break;
 
+      case GL_DEPTH_CLAMP:
+         if (ctx->Transform.DepthClamp == state)
+            return;
+	 CHECK_EXTENSION(ARB_depth_clamp, cap);
+         FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+	 ctx->Transform.DepthClamp = state;
+	 break;
+
 #if FEATURE_ATI_fragment_shader
       case GL_FRAGMENT_SHADER_ATI:
         CHECK_EXTENSION(ATI_fragment_shader, cap);
@@ -1390,6 +1398,11 @@ _mesa_IsEnabled( GLenum cap )
          CHECK_EXTENSION(EXT_depth_bounds_test);
          return ctx->Depth.BoundsTest;
 
+      /* GL_ARB_depth_clamp */
+      case GL_DEPTH_CLAMP:
+         CHECK_EXTENSION(ARB_depth_clamp);
+         return ctx->Transform.DepthClamp;
+
 #if FEATURE_ATI_fragment_shader
       case GL_FRAGMENT_SHADER_ATI:
 	 CHECK_EXTENSION(ATI_fragment_shader);
diff --git a/mesalib/src/mesa/main/enums.c b/mesalib/src/mesa/main/enums.c
index 9f650dadd..f9f4bc785 100644
--- a/mesalib/src/mesa/main/enums.c
+++ b/mesalib/src/mesa/main/enums.c
@@ -384,6 +384,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_DELETE_STATUS\0"
    "GL_DEPTH\0"
    "GL_DEPTH24_STENCIL8\0"
+   "GL_DEPTH24_STENCIL8_EXT\0"
    "GL_DEPTH_ATTACHMENT\0"
    "GL_DEPTH_ATTACHMENT_EXT\0"
    "GL_DEPTH_BIAS\0"
@@ -391,6 +392,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_DEPTH_BOUNDS_EXT\0"
    "GL_DEPTH_BOUNDS_TEST_EXT\0"
    "GL_DEPTH_BUFFER_BIT\0"
+   "GL_DEPTH_CLAMP\0"
    "GL_DEPTH_CLAMP_NV\0"
    "GL_DEPTH_CLEAR_VALUE\0"
    "GL_DEPTH_COMPONENT\0"
@@ -408,6 +410,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_DEPTH_SCALE\0"
    "GL_DEPTH_STENCIL\0"
    "GL_DEPTH_STENCIL_ATTACHMENT\0"
+   "GL_DEPTH_STENCIL_EXT\0"
    "GL_DEPTH_STENCIL_NV\0"
    "GL_DEPTH_STENCIL_TO_BGRA_NV\0"
    "GL_DEPTH_STENCIL_TO_RGBA_NV\0"
@@ -477,6 +480,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_DRAW_BUFFER9_ARB\0"
    "GL_DRAW_BUFFER9_ATI\0"
    "GL_DRAW_FRAMEBUFFER\0"
+   "GL_DRAW_FRAMEBUFFER_BINDING\0"
    "GL_DRAW_FRAMEBUFFER_BINDING_EXT\0"
    "GL_DRAW_FRAMEBUFFER_EXT\0"
    "GL_DRAW_PIXEL_TOKEN\0"
@@ -518,6 +522,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_FEEDBACK_BUFFER_SIZE\0"
    "GL_FEEDBACK_BUFFER_TYPE\0"
    "GL_FILL\0"
+   "GL_FIRST_VERTEX_CONVENTION\0"
    "GL_FIRST_VERTEX_CONVENTION_EXT\0"
    "GL_FLAT\0"
    "GL_FLOAT\0"
@@ -591,6 +596,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT\0"
    "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL\0"
    "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0"
+   "GL_FRAMEBUFFER_BINDING\0"
    "GL_FRAMEBUFFER_BINDING_EXT\0"
    "GL_FRAMEBUFFER_COMPLETE\0"
    "GL_FRAMEBUFFER_COMPLETE_EXT\0"
@@ -599,12 +605,15 @@ LONGSTRING static const char enum_string_table[] =
    "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\0"
    "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0"
    "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0"
+   "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\0"
    "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0"
    "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0"
    "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0"
    "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\0"
    "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0"
    "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\0"
+   "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\0"
+   "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\0"
    "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0"
    "GL_FRAMEBUFFER_STATUS_ERROR_EXT\0"
    "GL_FRAMEBUFFER_UNDEFINED\0"
@@ -701,6 +710,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_INVERSE_TRANSPOSE_NV\0"
    "GL_INVERT\0"
    "GL_KEEP\0"
+   "GL_LAST_VERTEX_CONVENTION\0"
    "GL_LAST_VERTEX_CONVENTION_EXT\0"
    "GL_LEFT\0"
    "GL_LEQUAL\0"
@@ -889,6 +899,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_MAX_CLIPMAP_DEPTH_SGIX\0"
    "GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX\0"
    "GL_MAX_CLIP_PLANES\0"
+   "GL_MAX_COLOR_ATTACHMENTS\0"
    "GL_MAX_COLOR_ATTACHMENTS_EXT\0"
    "GL_MAX_COLOR_MATRIX_STACK_DEPTH\0"
    "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI\0"
@@ -944,8 +955,10 @@ LONGSTRING static const char enum_string_table[] =
    "GL_MAX_PROJECTION_STACK_DEPTH\0"
    "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0"
    "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0"
+   "GL_MAX_RENDERBUFFER_SIZE\0"
    "GL_MAX_RENDERBUFFER_SIZE_EXT\0"
    "GL_MAX_SAMPLES\0"
+   "GL_MAX_SAMPLES_EXT\0"
    "GL_MAX_SERVER_WAIT_TIMEOUT\0"
    "GL_MAX_SHININESS_NV\0"
    "GL_MAX_SPOT_EXPONENT_NV\0"
@@ -1287,6 +1300,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_PROJECTION\0"
    "GL_PROJECTION_MATRIX\0"
    "GL_PROJECTION_STACK_DEPTH\0"
+   "GL_PROVOKING_VERTEX\0"
    "GL_PROVOKING_VERTEX_EXT\0"
    "GL_PROXY_COLOR_TABLE\0"
    "GL_PROXY_HISTOGRAM\0"
@@ -1308,6 +1322,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_Q\0"
    "GL_QUADRATIC_ATTENUATION\0"
    "GL_QUADS\0"
+   "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION\0"
    "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT\0"
    "GL_QUAD_MESH_SUN\0"
    "GL_QUAD_STRIP\0"
@@ -1322,6 +1337,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_RASTER_POSITION_UNCLIPPED_IBM\0"
    "GL_READ_BUFFER\0"
    "GL_READ_FRAMEBUFFER\0"
+   "GL_READ_FRAMEBUFFER_BINDING\0"
    "GL_READ_FRAMEBUFFER_BINDING_EXT\0"
    "GL_READ_FRAMEBUFFER_EXT\0"
    "GL_READ_ONLY\0"
@@ -1340,6 +1356,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_RENDER\0"
    "GL_RENDERBUFFER\0"
    "GL_RENDERBUFFER_ALPHA_SIZE\0"
+   "GL_RENDERBUFFER_BINDING\0"
    "GL_RENDERBUFFER_BINDING_EXT\0"
    "GL_RENDERBUFFER_BLUE_SIZE\0"
    "GL_RENDERBUFFER_DEPTH_SIZE\0"
@@ -1351,6 +1368,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0"
    "GL_RENDERBUFFER_RED_SIZE\0"
    "GL_RENDERBUFFER_SAMPLES\0"
+   "GL_RENDERBUFFER_SAMPLES_EXT\0"
    "GL_RENDERBUFFER_STENCIL_SIZE\0"
    "GL_RENDERBUFFER_WIDTH\0"
    "GL_RENDERBUFFER_WIDTH_EXT\0"
@@ -1536,9 +1554,13 @@ LONGSTRING static const char enum_string_table[] =
    "GL_STENCIL_FAIL\0"
    "GL_STENCIL_FUNC\0"
    "GL_STENCIL_INDEX\0"
+   "GL_STENCIL_INDEX1\0"
+   "GL_STENCIL_INDEX16\0"
    "GL_STENCIL_INDEX16_EXT\0"
    "GL_STENCIL_INDEX1_EXT\0"
+   "GL_STENCIL_INDEX4\0"
    "GL_STENCIL_INDEX4_EXT\0"
+   "GL_STENCIL_INDEX8\0"
    "GL_STENCIL_INDEX8_EXT\0"
    "GL_STENCIL_INDEX_EXT\0"
    "GL_STENCIL_PASS_DEPTH_FAIL\0"
@@ -1756,6 +1778,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_TEXTURE_RESIDENT\0"
    "GL_TEXTURE_STACK_DEPTH\0"
    "GL_TEXTURE_STENCIL_SIZE\0"
+   "GL_TEXTURE_STENCIL_SIZE_EXT\0"
    "GL_TEXTURE_STORAGE_HINT_APPLE\0"
    "GL_TEXTURE_TOO_LARGE_EXT\0"
    "GL_TEXTURE_UNSIGNED_REMAP_MODE_NV\0"
@@ -1799,6 +1822,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_UNSIGNED_INT\0"
    "GL_UNSIGNED_INT_10_10_10_2\0"
    "GL_UNSIGNED_INT_24_8\0"
+   "GL_UNSIGNED_INT_24_8_EXT\0"
    "GL_UNSIGNED_INT_24_8_NV\0"
    "GL_UNSIGNED_INT_2_10_10_10_REV\0"
    "GL_UNSIGNED_INT_8_8_8_8\0"
@@ -1895,7 +1919,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_ZOOM_Y\0"
    ;
 
-static const enum_elt all_enums[1857] =
+static const enum_elt all_enums[1881] =
 {
    {     0, 0x00000600 }, /* GL_2D */
    {     6, 0x00001407 }, /* GL_2_BYTES */
@@ -2245,1595 +2269,1619 @@ static const enum_elt all_enums[1857] =
    {  7144, 0x00008B80 }, /* GL_DELETE_STATUS */
    {  7161, 0x00001801 }, /* GL_DEPTH */
    {  7170, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
-   {  7190, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
-   {  7210, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
-   {  7234, 0x00000D1F }, /* GL_DEPTH_BIAS */
-   {  7248, 0x00000D56 }, /* GL_DEPTH_BITS */
-   {  7262, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
-   {  7282, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
-   {  7307, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
-   {  7327, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
-   {  7345, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
-   {  7366, 0x00001902 }, /* GL_DEPTH_COMPONENT */
-   {  7385, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
-   {  7406, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
-   {  7431, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
-   {  7457, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
-   {  7478, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
-   {  7503, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
-   {  7529, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
-   {  7550, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
-   {  7575, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
-   {  7601, 0x00000B74 }, /* GL_DEPTH_FUNC */
-   {  7615, 0x00000B70 }, /* GL_DEPTH_RANGE */
-   {  7630, 0x00000D1E }, /* GL_DEPTH_SCALE */
-   {  7645, 0x000084F9 }, /* GL_DEPTH_STENCIL */
-   {  7662, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
-   {  7690, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
-   {  7710, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-   {  7738, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-   {  7766, 0x00000B71 }, /* GL_DEPTH_TEST */
-   {  7780, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
-   {  7802, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
-   {  7828, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
-   {  7847, 0x00001201 }, /* GL_DIFFUSE */
-   {  7858, 0x00000BD0 }, /* GL_DITHER */
-   {  7868, 0x00000A02 }, /* GL_DOMAIN */
-   {  7878, 0x00001100 }, /* GL_DONT_CARE */
-   {  7891, 0x000086AE }, /* GL_DOT3_RGB */
-   {  7903, 0x000086AF }, /* GL_DOT3_RGBA */
-   {  7916, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
-   {  7933, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
-   {  7950, 0x000086AE }, /* GL_DOT3_RGB_ARB */
-   {  7966, 0x00008740 }, /* GL_DOT3_RGB_EXT */
-   {  7982, 0x0000140A }, /* GL_DOUBLE */
-   {  7992, 0x00000C32 }, /* GL_DOUBLEBUFFER */
-   {  8008, 0x00000C01 }, /* GL_DRAW_BUFFER */
-   {  8023, 0x00008825 }, /* GL_DRAW_BUFFER0 */
-   {  8039, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
-   {  8059, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
-   {  8079, 0x00008826 }, /* GL_DRAW_BUFFER1 */
-   {  8095, 0x0000882F }, /* GL_DRAW_BUFFER10 */
-   {  8112, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
-   {  8133, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
-   {  8154, 0x00008830 }, /* GL_DRAW_BUFFER11 */
-   {  8171, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
-   {  8192, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
-   {  8213, 0x00008831 }, /* GL_DRAW_BUFFER12 */
-   {  8230, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
-   {  8251, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
-   {  8272, 0x00008832 }, /* GL_DRAW_BUFFER13 */
-   {  8289, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
-   {  8310, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
-   {  8331, 0x00008833 }, /* GL_DRAW_BUFFER14 */
-   {  8348, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
-   {  8369, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
-   {  8390, 0x00008834 }, /* GL_DRAW_BUFFER15 */
-   {  8407, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
-   {  8428, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
-   {  8449, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
-   {  8469, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
-   {  8489, 0x00008827 }, /* GL_DRAW_BUFFER2 */
-   {  8505, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
-   {  8525, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
-   {  8545, 0x00008828 }, /* GL_DRAW_BUFFER3 */
-   {  8561, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
-   {  8581, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
-   {  8601, 0x00008829 }, /* GL_DRAW_BUFFER4 */
-   {  8617, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
-   {  8637, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
-   {  8657, 0x0000882A }, /* GL_DRAW_BUFFER5 */
-   {  8673, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
-   {  8693, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
-   {  8713, 0x0000882B }, /* GL_DRAW_BUFFER6 */
-   {  8729, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
-   {  8749, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
-   {  8769, 0x0000882C }, /* GL_DRAW_BUFFER7 */
-   {  8785, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
-   {  8805, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
-   {  8825, 0x0000882D }, /* GL_DRAW_BUFFER8 */
-   {  8841, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
-   {  8861, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
-   {  8881, 0x0000882E }, /* GL_DRAW_BUFFER9 */
-   {  8897, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
-   {  8917, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
-   {  8937, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
-   {  8957, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
-   {  8989, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
-   {  9013, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
-   {  9033, 0x00000304 }, /* GL_DST_ALPHA */
-   {  9046, 0x00000306 }, /* GL_DST_COLOR */
-   {  9059, 0x0000877A }, /* GL_DU8DV8_ATI */
-   {  9073, 0x00008779 }, /* GL_DUDV_ATI */
-   {  9085, 0x000088EA }, /* GL_DYNAMIC_COPY */
-   {  9101, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
-   {  9121, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
-   {  9137, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
-   {  9157, 0x000088E9 }, /* GL_DYNAMIC_READ */
-   {  9173, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
-   {  9193, 0x00000B43 }, /* GL_EDGE_FLAG */
-   {  9206, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
-   {  9225, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-   {  9259, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
-   {  9297, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
-   {  9324, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-   {  9350, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
-   {  9374, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-   {  9406, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
-   {  9442, 0x00001600 }, /* GL_EMISSION */
-   {  9454, 0x00002000 }, /* GL_ENABLE_BIT */
-   {  9468, 0x00000202 }, /* GL_EQUAL */
-   {  9477, 0x00001509 }, /* GL_EQUIV */
-   {  9486, 0x00010000 }, /* GL_EVAL_BIT */
-   {  9498, 0x00000800 }, /* GL_EXP */
-   {  9505, 0x00000801 }, /* GL_EXP2 */
-   {  9513, 0x00001F03 }, /* GL_EXTENSIONS */
-   {  9527, 0x00002400 }, /* GL_EYE_LINEAR */
-   {  9541, 0x00002502 }, /* GL_EYE_PLANE */
-   {  9554, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
-   {  9579, 0x0000855B }, /* GL_EYE_RADIAL_NV */
-   {  9596, 0x00000000 }, /* GL_FALSE */
-   {  9605, 0x00001101 }, /* GL_FASTEST */
-   {  9616, 0x00001C01 }, /* GL_FEEDBACK */
-   {  9628, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
-   {  9655, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
-   {  9679, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
-   {  9703, 0x00001B02 }, /* GL_FILL */
-   {  9711, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */
-   {  9742, 0x00001D00 }, /* GL_FLAT */
-   {  9750, 0x00001406 }, /* GL_FLOAT */
-   {  9759, 0x00008B5A }, /* GL_FLOAT_MAT2 */
-   {  9773, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
-   {  9791, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
-   {  9807, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
-   {  9823, 0x00008B5B }, /* GL_FLOAT_MAT3 */
-   {  9837, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
-   {  9855, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
-   {  9871, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
-   {  9887, 0x00008B5C }, /* GL_FLOAT_MAT4 */
-   {  9901, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
-   {  9919, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
-   {  9935, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
-   {  9951, 0x00008B50 }, /* GL_FLOAT_VEC2 */
-   {  9965, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
-   {  9983, 0x00008B51 }, /* GL_FLOAT_VEC3 */
-   {  9997, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
-   { 10015, 0x00008B52 }, /* GL_FLOAT_VEC4 */
-   { 10029, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
-   { 10047, 0x00000B60 }, /* GL_FOG */
-   { 10054, 0x00000080 }, /* GL_FOG_BIT */
-   { 10065, 0x00000B66 }, /* GL_FOG_COLOR */
-   { 10078, 0x00008451 }, /* GL_FOG_COORD */
-   { 10091, 0x00008451 }, /* GL_FOG_COORDINATE */
-   { 10109, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
-   { 10133, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-   { 10172, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
-   { 10215, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-   { 10247, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-   { 10278, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-   { 10307, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
-   { 10332, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
-   { 10351, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
-   { 10385, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
-   { 10412, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
-   { 10438, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
-   { 10462, 0x00008450 }, /* GL_FOG_COORD_SRC */
-   { 10479, 0x00000B62 }, /* GL_FOG_DENSITY */
-   { 10494, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
-   { 10518, 0x00000B64 }, /* GL_FOG_END */
-   { 10529, 0x00000C54 }, /* GL_FOG_HINT */
-   { 10541, 0x00000B61 }, /* GL_FOG_INDEX */
-   { 10554, 0x00000B65 }, /* GL_FOG_MODE */
-   { 10566, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
-   { 10585, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
-   { 10610, 0x00000B63 }, /* GL_FOG_START */
-   { 10623, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
-   { 10641, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
-   { 10665, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
-   { 10684, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
-   { 10707, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-   { 10742, 0x00008D40 }, /* GL_FRAMEBUFFER */
-   { 10757, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-   { 10794, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-   { 10830, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-   { 10871, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-   { 10912, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-   { 10949, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-   { 10986, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-   { 11024, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
-   { 11066, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-   { 11104, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
-   { 11146, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-   { 11181, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-   { 11220, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
-   { 11269, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-   { 11317, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
-   { 11369, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-   { 11409, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
-   { 11453, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-   { 11493, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
-   { 11537, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
-   { 11564, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
-   { 11588, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
-   { 11616, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
-   { 11639, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
-   { 11658, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-   { 11695, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
-   { 11736, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-   { 11777, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
-   { 11819, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-   { 11870, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-   { 11908, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-   { 11953, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
-   { 12002, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-   { 12040, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
-   { 12082, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-   { 12114, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
-   { 12139, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
-   { 12166, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
-   { 12197, 0x00000404 }, /* GL_FRONT */
-   { 12206, 0x00000408 }, /* GL_FRONT_AND_BACK */
-   { 12224, 0x00000B46 }, /* GL_FRONT_FACE */
-   { 12238, 0x00000400 }, /* GL_FRONT_LEFT */
-   { 12252, 0x00000401 }, /* GL_FRONT_RIGHT */
-   { 12267, 0x00008006 }, /* GL_FUNC_ADD */
-   { 12279, 0x00008006 }, /* GL_FUNC_ADD_EXT */
-   { 12295, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
-   { 12320, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
-   { 12349, 0x0000800A }, /* GL_FUNC_SUBTRACT */
-   { 12366, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
-   { 12387, 0x00008191 }, /* GL_GENERATE_MIPMAP */
-   { 12406, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
-   { 12430, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
-   { 12459, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
-   { 12483, 0x00000206 }, /* GL_GEQUAL */
-   { 12493, 0x00000204 }, /* GL_GREATER */
-   { 12504, 0x00001904 }, /* GL_GREEN */
-   { 12513, 0x00000D19 }, /* GL_GREEN_BIAS */
-   { 12527, 0x00000D53 }, /* GL_GREEN_BITS */
-   { 12541, 0x00000D18 }, /* GL_GREEN_SCALE */
-   { 12556, 0x00008000 }, /* GL_HINT_BIT */
-   { 12568, 0x00008024 }, /* GL_HISTOGRAM */
-   { 12581, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
-   { 12605, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
-   { 12633, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
-   { 12656, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
-   { 12683, 0x00008024 }, /* GL_HISTOGRAM_EXT */
-   { 12700, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
-   { 12720, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
-   { 12744, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
-   { 12768, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
-   { 12796, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-   { 12824, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
-   { 12856, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
-   { 12878, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
-   { 12904, 0x0000802D }, /* GL_HISTOGRAM_SINK */
-   { 12922, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
-   { 12944, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
-   { 12963, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
-   { 12986, 0x0000862A }, /* GL_IDENTITY_NV */
-   { 13001, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
-   { 13021, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
-   { 13061, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-   { 13099, 0x00001E02 }, /* GL_INCR */
-   { 13107, 0x00008507 }, /* GL_INCR_WRAP */
-   { 13120, 0x00008507 }, /* GL_INCR_WRAP_EXT */
-   { 13137, 0x00008222 }, /* GL_INDEX */
-   { 13146, 0x00008077 }, /* GL_INDEX_ARRAY */
-   { 13161, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-   { 13191, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
-   { 13225, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
-   { 13248, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
-   { 13270, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
-   { 13290, 0x00000D51 }, /* GL_INDEX_BITS */
-   { 13304, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
-   { 13325, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
-   { 13343, 0x00000C30 }, /* GL_INDEX_MODE */
-   { 13357, 0x00000D13 }, /* GL_INDEX_OFFSET */
-   { 13373, 0x00000D12 }, /* GL_INDEX_SHIFT */
-   { 13388, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
-   { 13407, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
-   { 13426, 0x00001404 }, /* GL_INT */
-   { 13433, 0x00008049 }, /* GL_INTENSITY */
-   { 13446, 0x0000804C }, /* GL_INTENSITY12 */
-   { 13461, 0x0000804C }, /* GL_INTENSITY12_EXT */
-   { 13480, 0x0000804D }, /* GL_INTENSITY16 */
-   { 13495, 0x0000804D }, /* GL_INTENSITY16_EXT */
-   { 13514, 0x0000804A }, /* GL_INTENSITY4 */
-   { 13528, 0x0000804A }, /* GL_INTENSITY4_EXT */
-   { 13546, 0x0000804B }, /* GL_INTENSITY8 */
-   { 13560, 0x0000804B }, /* GL_INTENSITY8_EXT */
-   { 13578, 0x00008049 }, /* GL_INTENSITY_EXT */
-   { 13595, 0x00008575 }, /* GL_INTERPOLATE */
-   { 13610, 0x00008575 }, /* GL_INTERPOLATE_ARB */
-   { 13629, 0x00008575 }, /* GL_INTERPOLATE_EXT */
-   { 13648, 0x00008B53 }, /* GL_INT_VEC2 */
-   { 13660, 0x00008B53 }, /* GL_INT_VEC2_ARB */
-   { 13676, 0x00008B54 }, /* GL_INT_VEC3 */
-   { 13688, 0x00008B54 }, /* GL_INT_VEC3_ARB */
-   { 13704, 0x00008B55 }, /* GL_INT_VEC4 */
-   { 13716, 0x00008B55 }, /* GL_INT_VEC4_ARB */
-   { 13732, 0x00000500 }, /* GL_INVALID_ENUM */
-   { 13748, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
-   { 13781, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
-   { 13818, 0x00000502 }, /* GL_INVALID_OPERATION */
-   { 13839, 0x00000501 }, /* GL_INVALID_VALUE */
-   { 13856, 0x0000862B }, /* GL_INVERSE_NV */
-   { 13870, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
-   { 13894, 0x0000150A }, /* GL_INVERT */
-   { 13904, 0x00001E00 }, /* GL_KEEP */
-   { 13912, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
-   { 13942, 0x00000406 }, /* GL_LEFT */
-   { 13950, 0x00000203 }, /* GL_LEQUAL */
-   { 13960, 0x00000201 }, /* GL_LESS */
-   { 13968, 0x00004000 }, /* GL_LIGHT0 */
-   { 13978, 0x00004001 }, /* GL_LIGHT1 */
-   { 13988, 0x00004002 }, /* GL_LIGHT2 */
-   { 13998, 0x00004003 }, /* GL_LIGHT3 */
-   { 14008, 0x00004004 }, /* GL_LIGHT4 */
-   { 14018, 0x00004005 }, /* GL_LIGHT5 */
-   { 14028, 0x00004006 }, /* GL_LIGHT6 */
-   { 14038, 0x00004007 }, /* GL_LIGHT7 */
-   { 14048, 0x00000B50 }, /* GL_LIGHTING */
-   { 14060, 0x00000040 }, /* GL_LIGHTING_BIT */
-   { 14076, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
-   { 14099, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-   { 14128, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
-   { 14161, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-   { 14189, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
-   { 14213, 0x00001B01 }, /* GL_LINE */
-   { 14221, 0x00002601 }, /* GL_LINEAR */
-   { 14231, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
-   { 14253, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-   { 14283, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-   { 14314, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
-   { 14338, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
-   { 14363, 0x00000001 }, /* GL_LINES */
-   { 14372, 0x00000004 }, /* GL_LINE_BIT */
-   { 14384, 0x00000002 }, /* GL_LINE_LOOP */
-   { 14397, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
-   { 14417, 0x00000B20 }, /* GL_LINE_SMOOTH */
-   { 14432, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
-   { 14452, 0x00000B24 }, /* GL_LINE_STIPPLE */
-   { 14468, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
-   { 14492, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
-   { 14515, 0x00000003 }, /* GL_LINE_STRIP */
-   { 14529, 0x00000702 }, /* GL_LINE_TOKEN */
-   { 14543, 0x00000B21 }, /* GL_LINE_WIDTH */
-   { 14557, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
-   { 14583, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
-   { 14603, 0x00008B82 }, /* GL_LINK_STATUS */
-   { 14618, 0x00000B32 }, /* GL_LIST_BASE */
-   { 14631, 0x00020000 }, /* GL_LIST_BIT */
-   { 14643, 0x00000B33 }, /* GL_LIST_INDEX */
-   { 14657, 0x00000B30 }, /* GL_LIST_MODE */
-   { 14670, 0x00000101 }, /* GL_LOAD */
-   { 14678, 0x00000BF1 }, /* GL_LOGIC_OP */
-   { 14690, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
-   { 14707, 0x00008CA1 }, /* GL_LOWER_LEFT */
-   { 14721, 0x00001909 }, /* GL_LUMINANCE */
-   { 14734, 0x00008041 }, /* GL_LUMINANCE12 */
-   { 14749, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
-   { 14772, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
-   { 14799, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
-   { 14821, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
-   { 14847, 0x00008041 }, /* GL_LUMINANCE12_EXT */
-   { 14866, 0x00008042 }, /* GL_LUMINANCE16 */
-   { 14881, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
-   { 14904, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
-   { 14931, 0x00008042 }, /* GL_LUMINANCE16_EXT */
-   { 14950, 0x0000803F }, /* GL_LUMINANCE4 */
-   { 14964, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
-   { 14985, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
-   { 15010, 0x0000803F }, /* GL_LUMINANCE4_EXT */
-   { 15028, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
-   { 15049, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
-   { 15074, 0x00008040 }, /* GL_LUMINANCE8 */
-   { 15088, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
-   { 15109, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
-   { 15134, 0x00008040 }, /* GL_LUMINANCE8_EXT */
-   { 15152, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
-   { 15171, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
-   { 15187, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
-   { 15207, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
-   { 15229, 0x00000D91 }, /* GL_MAP1_INDEX */
-   { 15243, 0x00000D92 }, /* GL_MAP1_NORMAL */
-   { 15258, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
-   { 15282, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
-   { 15306, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
-   { 15330, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
-   { 15354, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
-   { 15371, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
-   { 15388, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-   { 15416, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-   { 15445, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-   { 15474, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-   { 15503, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-   { 15532, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-   { 15561, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-   { 15590, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-   { 15618, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-   { 15646, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-   { 15674, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-   { 15702, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-   { 15730, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-   { 15758, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-   { 15786, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-   { 15814, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-   { 15842, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
-   { 15858, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
-   { 15878, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
-   { 15900, 0x00000DB1 }, /* GL_MAP2_INDEX */
-   { 15914, 0x00000DB2 }, /* GL_MAP2_NORMAL */
-   { 15929, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
-   { 15953, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
-   { 15977, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
-   { 16001, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
-   { 16025, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
-   { 16042, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
-   { 16059, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-   { 16087, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-   { 16116, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-   { 16145, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-   { 16174, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-   { 16203, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-   { 16232, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-   { 16261, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-   { 16289, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-   { 16317, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-   { 16345, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-   { 16373, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-   { 16401, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-   { 16429, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
-   { 16457, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-   { 16485, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-   { 16513, 0x00000D10 }, /* GL_MAP_COLOR */
-   { 16526, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
-   { 16552, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
-   { 16581, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
-   { 16609, 0x00000001 }, /* GL_MAP_READ_BIT */
-   { 16625, 0x00000D11 }, /* GL_MAP_STENCIL */
-   { 16640, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
-   { 16666, 0x00000002 }, /* GL_MAP_WRITE_BIT */
-   { 16683, 0x000088C0 }, /* GL_MATRIX0_ARB */
-   { 16698, 0x00008630 }, /* GL_MATRIX0_NV */
-   { 16712, 0x000088CA }, /* GL_MATRIX10_ARB */
-   { 16728, 0x000088CB }, /* GL_MATRIX11_ARB */
-   { 16744, 0x000088CC }, /* GL_MATRIX12_ARB */
-   { 16760, 0x000088CD }, /* GL_MATRIX13_ARB */
-   { 16776, 0x000088CE }, /* GL_MATRIX14_ARB */
-   { 16792, 0x000088CF }, /* GL_MATRIX15_ARB */
-   { 16808, 0x000088D0 }, /* GL_MATRIX16_ARB */
-   { 16824, 0x000088D1 }, /* GL_MATRIX17_ARB */
-   { 16840, 0x000088D2 }, /* GL_MATRIX18_ARB */
-   { 16856, 0x000088D3 }, /* GL_MATRIX19_ARB */
-   { 16872, 0x000088C1 }, /* GL_MATRIX1_ARB */
-   { 16887, 0x00008631 }, /* GL_MATRIX1_NV */
-   { 16901, 0x000088D4 }, /* GL_MATRIX20_ARB */
-   { 16917, 0x000088D5 }, /* GL_MATRIX21_ARB */
-   { 16933, 0x000088D6 }, /* GL_MATRIX22_ARB */
-   { 16949, 0x000088D7 }, /* GL_MATRIX23_ARB */
-   { 16965, 0x000088D8 }, /* GL_MATRIX24_ARB */
-   { 16981, 0x000088D9 }, /* GL_MATRIX25_ARB */
-   { 16997, 0x000088DA }, /* GL_MATRIX26_ARB */
-   { 17013, 0x000088DB }, /* GL_MATRIX27_ARB */
-   { 17029, 0x000088DC }, /* GL_MATRIX28_ARB */
-   { 17045, 0x000088DD }, /* GL_MATRIX29_ARB */
-   { 17061, 0x000088C2 }, /* GL_MATRIX2_ARB */
-   { 17076, 0x00008632 }, /* GL_MATRIX2_NV */
-   { 17090, 0x000088DE }, /* GL_MATRIX30_ARB */
-   { 17106, 0x000088DF }, /* GL_MATRIX31_ARB */
-   { 17122, 0x000088C3 }, /* GL_MATRIX3_ARB */
-   { 17137, 0x00008633 }, /* GL_MATRIX3_NV */
-   { 17151, 0x000088C4 }, /* GL_MATRIX4_ARB */
-   { 17166, 0x00008634 }, /* GL_MATRIX4_NV */
-   { 17180, 0x000088C5 }, /* GL_MATRIX5_ARB */
-   { 17195, 0x00008635 }, /* GL_MATRIX5_NV */
-   { 17209, 0x000088C6 }, /* GL_MATRIX6_ARB */
-   { 17224, 0x00008636 }, /* GL_MATRIX6_NV */
-   { 17238, 0x000088C7 }, /* GL_MATRIX7_ARB */
-   { 17253, 0x00008637 }, /* GL_MATRIX7_NV */
-   { 17267, 0x000088C8 }, /* GL_MATRIX8_ARB */
-   { 17282, 0x000088C9 }, /* GL_MATRIX9_ARB */
-   { 17297, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
-   { 17323, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-   { 17357, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-   { 17388, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-   { 17421, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-   { 17452, 0x00000BA0 }, /* GL_MATRIX_MODE */
-   { 17467, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
-   { 17489, 0x00008008 }, /* GL_MAX */
-   { 17496, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
-   { 17519, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
-   { 17551, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
-   { 17577, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-   { 17610, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-   { 17636, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 17670, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
-   { 17689, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
-   { 17718, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-   { 17750, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
-   { 17786, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-   { 17822, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
-   { 17862, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
-   { 17888, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
-   { 17918, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
-   { 17943, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
-   { 17972, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-   { 18001, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
-   { 18034, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
-   { 18054, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
-   { 18078, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
-   { 18102, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
-   { 18126, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
-   { 18151, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
-   { 18169, 0x00008008 }, /* GL_MAX_EXT */
-   { 18180, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-   { 18215, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
-   { 18254, 0x00000D31 }, /* GL_MAX_LIGHTS */
-   { 18268, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
-   { 18288, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-   { 18326, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-   { 18355, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
-   { 18379, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
-   { 18407, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
-   { 18430, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 18467, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 18503, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-   { 18530, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-   { 18559, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-   { 18593, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
-   { 18629, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-   { 18656, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-   { 18688, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-   { 18724, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-   { 18753, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-   { 18782, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
-   { 18810, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-   { 18848, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 18892, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 18935, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 18969, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 19008, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 19045, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 19083, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 19126, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 19169, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-   { 19199, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-   { 19230, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 19266, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 19302, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
-   { 19332, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
-   { 19366, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
-   { 19399, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
-   { 19428, 0x00008D57 }, /* GL_MAX_SAMPLES */
-   { 19443, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
-   { 19470, 0x00008504 }, /* GL_MAX_SHININESS_NV */
-   { 19490, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
-   { 19514, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
-   { 19536, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
-   { 19562, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-   { 19589, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
-   { 19620, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
-   { 19644, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 19678, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
-   { 19698, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
-   { 19725, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
-   { 19746, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
-   { 19771, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
-   { 19796, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
-   { 19831, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
-   { 19853, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
-   { 19879, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
-   { 19901, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
-   { 19927, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-   { 19961, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
-   { 19999, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-   { 20032, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
-   { 20069, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
-   { 20093, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
-   { 20114, 0x00008007 }, /* GL_MIN */
-   { 20121, 0x0000802E }, /* GL_MINMAX */
-   { 20131, 0x0000802E }, /* GL_MINMAX_EXT */
-   { 20145, 0x0000802F }, /* GL_MINMAX_FORMAT */
-   { 20162, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
-   { 20183, 0x00008030 }, /* GL_MINMAX_SINK */
-   { 20198, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
-   { 20217, 0x00008007 }, /* GL_MIN_EXT */
-   { 20228, 0x00008370 }, /* GL_MIRRORED_REPEAT */
-   { 20247, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
-   { 20270, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
-   { 20293, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
-   { 20313, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
-   { 20333, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-   { 20363, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
-   { 20391, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-   { 20419, 0x00001700 }, /* GL_MODELVIEW */
-   { 20432, 0x00001700 }, /* GL_MODELVIEW0_ARB */
-   { 20450, 0x0000872A }, /* GL_MODELVIEW10_ARB */
-   { 20469, 0x0000872B }, /* GL_MODELVIEW11_ARB */
-   { 20488, 0x0000872C }, /* GL_MODELVIEW12_ARB */
-   { 20507, 0x0000872D }, /* GL_MODELVIEW13_ARB */
-   { 20526, 0x0000872E }, /* GL_MODELVIEW14_ARB */
-   { 20545, 0x0000872F }, /* GL_MODELVIEW15_ARB */
-   { 20564, 0x00008730 }, /* GL_MODELVIEW16_ARB */
-   { 20583, 0x00008731 }, /* GL_MODELVIEW17_ARB */
-   { 20602, 0x00008732 }, /* GL_MODELVIEW18_ARB */
-   { 20621, 0x00008733 }, /* GL_MODELVIEW19_ARB */
-   { 20640, 0x0000850A }, /* GL_MODELVIEW1_ARB */
-   { 20658, 0x00008734 }, /* GL_MODELVIEW20_ARB */
-   { 20677, 0x00008735 }, /* GL_MODELVIEW21_ARB */
-   { 20696, 0x00008736 }, /* GL_MODELVIEW22_ARB */
-   { 20715, 0x00008737 }, /* GL_MODELVIEW23_ARB */
-   { 20734, 0x00008738 }, /* GL_MODELVIEW24_ARB */
-   { 20753, 0x00008739 }, /* GL_MODELVIEW25_ARB */
-   { 20772, 0x0000873A }, /* GL_MODELVIEW26_ARB */
-   { 20791, 0x0000873B }, /* GL_MODELVIEW27_ARB */
-   { 20810, 0x0000873C }, /* GL_MODELVIEW28_ARB */
-   { 20829, 0x0000873D }, /* GL_MODELVIEW29_ARB */
-   { 20848, 0x00008722 }, /* GL_MODELVIEW2_ARB */
-   { 20866, 0x0000873E }, /* GL_MODELVIEW30_ARB */
-   { 20885, 0x0000873F }, /* GL_MODELVIEW31_ARB */
-   { 20904, 0x00008723 }, /* GL_MODELVIEW3_ARB */
-   { 20922, 0x00008724 }, /* GL_MODELVIEW4_ARB */
-   { 20940, 0x00008725 }, /* GL_MODELVIEW5_ARB */
-   { 20958, 0x00008726 }, /* GL_MODELVIEW6_ARB */
-   { 20976, 0x00008727 }, /* GL_MODELVIEW7_ARB */
-   { 20994, 0x00008728 }, /* GL_MODELVIEW8_ARB */
-   { 21012, 0x00008729 }, /* GL_MODELVIEW9_ARB */
-   { 21030, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
-   { 21050, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
-   { 21077, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
-   { 21102, 0x00002100 }, /* GL_MODULATE */
-   { 21114, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
-   { 21134, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
-   { 21161, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
-   { 21186, 0x00000103 }, /* GL_MULT */
-   { 21194, 0x0000809D }, /* GL_MULTISAMPLE */
-   { 21209, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
-   { 21229, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
-   { 21248, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
-   { 21267, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
-   { 21291, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
-   { 21314, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-   { 21344, 0x00002A25 }, /* GL_N3F_V3F */
-   { 21355, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
-   { 21375, 0x0000150E }, /* GL_NAND */
-   { 21383, 0x00002600 }, /* GL_NEAREST */
-   { 21394, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-   { 21425, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-   { 21457, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
-   { 21482, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
-   { 21508, 0x00000200 }, /* GL_NEVER */
-   { 21517, 0x00001102 }, /* GL_NICEST */
-   { 21527, 0x00000000 }, /* GL_NONE */
-   { 21535, 0x00001505 }, /* GL_NOOP */
-   { 21543, 0x00001508 }, /* GL_NOR */
-   { 21550, 0x00000BA1 }, /* GL_NORMALIZE */
-   { 21563, 0x00008075 }, /* GL_NORMAL_ARRAY */
-   { 21579, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
-   { 21610, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
-   { 21645, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
-   { 21669, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
-   { 21692, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
-   { 21713, 0x00008511 }, /* GL_NORMAL_MAP */
-   { 21727, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
-   { 21745, 0x00008511 }, /* GL_NORMAL_MAP_NV */
-   { 21762, 0x00000205 }, /* GL_NOTEQUAL */
-   { 21774, 0x00000000 }, /* GL_NO_ERROR */
-   { 21786, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
-   { 21820, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
-   { 21858, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
-   { 21890, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
-   { 21932, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
-   { 21962, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
-   { 22002, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
-   { 22033, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
-   { 22062, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
-   { 22090, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
-   { 22120, 0x00002401 }, /* GL_OBJECT_LINEAR */
-   { 22137, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
-   { 22163, 0x00002501 }, /* GL_OBJECT_PLANE */
-   { 22179, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
-   { 22214, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
-   { 22236, 0x00009112 }, /* GL_OBJECT_TYPE */
-   { 22251, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
-   { 22270, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
-   { 22300, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
-   { 22321, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
-   { 22349, 0x00000001 }, /* GL_ONE */
-   { 22356, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
-   { 22384, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
-   { 22416, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
-   { 22444, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
-   { 22476, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
-   { 22499, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
-   { 22522, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
-   { 22545, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
-   { 22568, 0x00008598 }, /* GL_OPERAND0_ALPHA */
-   { 22586, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
-   { 22608, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
-   { 22630, 0x00008590 }, /* GL_OPERAND0_RGB */
-   { 22646, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
-   { 22666, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
-   { 22686, 0x00008599 }, /* GL_OPERAND1_ALPHA */
-   { 22704, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
-   { 22726, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
-   { 22748, 0x00008591 }, /* GL_OPERAND1_RGB */
-   { 22764, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
-   { 22784, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
-   { 22804, 0x0000859A }, /* GL_OPERAND2_ALPHA */
-   { 22822, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
-   { 22844, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
-   { 22866, 0x00008592 }, /* GL_OPERAND2_RGB */
-   { 22882, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
-   { 22902, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
-   { 22922, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
-   { 22943, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
-   { 22962, 0x00001507 }, /* GL_OR */
-   { 22968, 0x00000A01 }, /* GL_ORDER */
-   { 22977, 0x0000150D }, /* GL_OR_INVERTED */
-   { 22992, 0x0000150B }, /* GL_OR_REVERSE */
-   { 23006, 0x00000505 }, /* GL_OUT_OF_MEMORY */
-   { 23023, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
-   { 23041, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
-   { 23062, 0x00008758 }, /* GL_PACK_INVERT_MESA */
-   { 23082, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
-   { 23100, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
-   { 23119, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
-   { 23139, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
-   { 23159, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
-   { 23177, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
-   { 23196, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
-   { 23221, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
-   { 23245, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
-   { 23266, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
-   { 23288, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
-   { 23310, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
-   { 23335, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
-   { 23359, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
-   { 23380, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
-   { 23402, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
-   { 23424, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
-   { 23446, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
-   { 23477, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
-   { 23497, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-   { 23522, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
-   { 23542, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-   { 23567, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
-   { 23587, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-   { 23612, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
-   { 23632, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-   { 23657, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
-   { 23677, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-   { 23702, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
-   { 23722, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-   { 23747, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
-   { 23767, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-   { 23792, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
-   { 23812, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-   { 23837, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
-   { 23857, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-   { 23882, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
-   { 23902, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-   { 23927, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
-   { 23945, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
-   { 23966, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
-   { 23995, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
-   { 24028, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
-   { 24053, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
-   { 24076, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
-   { 24107, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
-   { 24142, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
-   { 24169, 0x00001B00 }, /* GL_POINT */
-   { 24178, 0x00000000 }, /* GL_POINTS */
-   { 24188, 0x00000002 }, /* GL_POINT_BIT */
-   { 24201, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
-   { 24231, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
-   { 24265, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
-   { 24299, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
-   { 24334, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
-   { 24363, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
-   { 24396, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
-   { 24429, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
-   { 24463, 0x00000B11 }, /* GL_POINT_SIZE */
-   { 24477, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
-   { 24503, 0x00008127 }, /* GL_POINT_SIZE_MAX */
-   { 24521, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
-   { 24543, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
-   { 24565, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
-   { 24588, 0x00008126 }, /* GL_POINT_SIZE_MIN */
-   { 24606, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
-   { 24628, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
-   { 24650, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
-   { 24673, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
-   { 24693, 0x00000B10 }, /* GL_POINT_SMOOTH */
-   { 24709, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
-   { 24730, 0x00008861 }, /* GL_POINT_SPRITE */
-   { 24746, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
-   { 24766, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
-   { 24795, 0x00008861 }, /* GL_POINT_SPRITE_NV */
-   { 24814, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
-   { 24840, 0x00000701 }, /* GL_POINT_TOKEN */
-   { 24855, 0x00000009 }, /* GL_POLYGON */
-   { 24866, 0x00000008 }, /* GL_POLYGON_BIT */
-   { 24881, 0x00000B40 }, /* GL_POLYGON_MODE */
-   { 24897, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
-   { 24920, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
-   { 24945, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
-   { 24968, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
-   { 24991, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
-   { 25015, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
-   { 25039, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
-   { 25057, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
-   { 25080, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
-   { 25099, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
-   { 25122, 0x00000703 }, /* GL_POLYGON_TOKEN */
-   { 25139, 0x00001203 }, /* GL_POSITION */
-   { 25151, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-   { 25183, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
-   { 25219, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-   { 25252, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
-   { 25289, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-   { 25320, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
-   { 25355, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-   { 25387, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
-   { 25423, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 25456, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-   { 25488, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
-   { 25524, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-   { 25557, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
-   { 25594, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-   { 25624, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
-   { 25658, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-   { 25689, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
-   { 25724, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-   { 25755, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
-   { 25790, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-   { 25822, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
-   { 25858, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-   { 25888, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
-   { 25922, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-   { 25953, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
-   { 25988, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-   { 26020, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-   { 26051, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
-   { 26086, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-   { 26118, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
-   { 26154, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
-   { 26183, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
-   { 26216, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
-   { 26246, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
-   { 26280, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-   { 26319, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-   { 26352, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-   { 26392, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-   { 26426, 0x00008578 }, /* GL_PREVIOUS */
-   { 26438, 0x00008578 }, /* GL_PREVIOUS_ARB */
-   { 26454, 0x00008578 }, /* GL_PREVIOUS_EXT */
-   { 26470, 0x00008577 }, /* GL_PRIMARY_COLOR */
-   { 26487, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
-   { 26508, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
-   { 26529, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 26562, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 26594, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
-   { 26617, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
-   { 26640, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
-   { 26670, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
-   { 26699, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
-   { 26727, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
-   { 26749, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-   { 26777, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-   { 26805, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
-   { 26827, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
-   { 26848, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 26888, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 26927, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 26957, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 26992, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 27025, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 27059, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 27098, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 27137, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
-   { 27159, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
-   { 27185, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
-   { 27209, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
-   { 27232, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
-   { 27254, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
-   { 27275, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
-   { 27296, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
-   { 27323, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 27355, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 27387, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-   { 27422, 0x00001701 }, /* GL_PROJECTION */
-   { 27436, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
-   { 27457, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
-   { 27483, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
-   { 27507, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
-   { 27528, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
-   { 27547, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
-   { 27570, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 27609, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-   { 27647, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
-   { 27667, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
-   { 27697, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
-   { 27721, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
-   { 27741, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
-   { 27771, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
-   { 27795, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
-   { 27815, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-   { 27848, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
-   { 27874, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
-   { 27904, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
-   { 27935, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
-   { 27965, 0x00002003 }, /* GL_Q */
-   { 27970, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
-   { 27995, 0x00000007 }, /* GL_QUADS */
-   { 28004, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
-   { 28052, 0x00008614 }, /* GL_QUAD_MESH_SUN */
-   { 28069, 0x00000008 }, /* GL_QUAD_STRIP */
-   { 28083, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
-   { 28105, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
-   { 28131, 0x00008866 }, /* GL_QUERY_RESULT */
-   { 28147, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
-   { 28167, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
-   { 28193, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
-   { 28223, 0x00002002 }, /* GL_R */
-   { 28228, 0x00002A10 }, /* GL_R3_G3_B2 */
-   { 28240, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-   { 28273, 0x00000C02 }, /* GL_READ_BUFFER */
-   { 28288, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
-   { 28308, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
-   { 28340, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
-   { 28364, 0x000088B8 }, /* GL_READ_ONLY */
-   { 28377, 0x000088B8 }, /* GL_READ_ONLY_ARB */
-   { 28394, 0x000088BA }, /* GL_READ_WRITE */
-   { 28408, 0x000088BA }, /* GL_READ_WRITE_ARB */
-   { 28426, 0x00001903 }, /* GL_RED */
-   { 28433, 0x00008016 }, /* GL_REDUCE */
-   { 28443, 0x00008016 }, /* GL_REDUCE_EXT */
-   { 28457, 0x00000D15 }, /* GL_RED_BIAS */
-   { 28469, 0x00000D52 }, /* GL_RED_BITS */
-   { 28481, 0x00000D14 }, /* GL_RED_SCALE */
-   { 28494, 0x00008512 }, /* GL_REFLECTION_MAP */
-   { 28512, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
-   { 28534, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
-   { 28555, 0x00001C00 }, /* GL_RENDER */
-   { 28565, 0x00008D41 }, /* GL_RENDERBUFFER */
-   { 28581, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
-   { 28608, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
-   { 28636, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
-   { 28662, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
-   { 28689, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
-   { 28709, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
-   { 28736, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
-   { 28759, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
-   { 28786, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-   { 28818, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
-   { 28854, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
-   { 28879, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
-   { 28903, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
-   { 28932, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
-   { 28954, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
-   { 28980, 0x00001F01 }, /* GL_RENDERER */
-   { 28992, 0x00000C40 }, /* GL_RENDER_MODE */
-   { 29007, 0x00002901 }, /* GL_REPEAT */
-   { 29017, 0x00001E01 }, /* GL_REPLACE */
-   { 29028, 0x00008062 }, /* GL_REPLACE_EXT */
-   { 29043, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
-   { 29066, 0x0000803A }, /* GL_RESCALE_NORMAL */
-   { 29084, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
-   { 29106, 0x00000102 }, /* GL_RETURN */
-   { 29116, 0x00001907 }, /* GL_RGB */
-   { 29123, 0x00008052 }, /* GL_RGB10 */
-   { 29132, 0x00008059 }, /* GL_RGB10_A2 */
-   { 29144, 0x00008059 }, /* GL_RGB10_A2_EXT */
-   { 29160, 0x00008052 }, /* GL_RGB10_EXT */
-   { 29173, 0x00008053 }, /* GL_RGB12 */
-   { 29182, 0x00008053 }, /* GL_RGB12_EXT */
-   { 29195, 0x00008054 }, /* GL_RGB16 */
-   { 29204, 0x00008054 }, /* GL_RGB16_EXT */
-   { 29217, 0x0000804E }, /* GL_RGB2_EXT */
-   { 29229, 0x0000804F }, /* GL_RGB4 */
-   { 29237, 0x0000804F }, /* GL_RGB4_EXT */
-   { 29249, 0x000083A1 }, /* GL_RGB4_S3TC */
-   { 29262, 0x00008050 }, /* GL_RGB5 */
-   { 29270, 0x00008057 }, /* GL_RGB5_A1 */
-   { 29281, 0x00008057 }, /* GL_RGB5_A1_EXT */
-   { 29296, 0x00008050 }, /* GL_RGB5_EXT */
-   { 29308, 0x00008051 }, /* GL_RGB8 */
-   { 29316, 0x00008051 }, /* GL_RGB8_EXT */
-   { 29328, 0x00001908 }, /* GL_RGBA */
-   { 29336, 0x0000805A }, /* GL_RGBA12 */
-   { 29346, 0x0000805A }, /* GL_RGBA12_EXT */
-   { 29360, 0x0000805B }, /* GL_RGBA16 */
-   { 29370, 0x0000805B }, /* GL_RGBA16_EXT */
-   { 29384, 0x00008055 }, /* GL_RGBA2 */
-   { 29393, 0x00008055 }, /* GL_RGBA2_EXT */
-   { 29406, 0x00008056 }, /* GL_RGBA4 */
-   { 29415, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
-   { 29434, 0x00008056 }, /* GL_RGBA4_EXT */
-   { 29447, 0x000083A3 }, /* GL_RGBA4_S3TC */
-   { 29461, 0x00008058 }, /* GL_RGBA8 */
-   { 29470, 0x00008058 }, /* GL_RGBA8_EXT */
-   { 29483, 0x00008F97 }, /* GL_RGBA8_SNORM */
-   { 29498, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
-   { 29516, 0x00000C31 }, /* GL_RGBA_MODE */
-   { 29529, 0x000083A2 }, /* GL_RGBA_S3TC */
-   { 29542, 0x00008F93 }, /* GL_RGBA_SNORM */
-   { 29556, 0x000083A0 }, /* GL_RGB_S3TC */
-   { 29568, 0x00008573 }, /* GL_RGB_SCALE */
-   { 29581, 0x00008573 }, /* GL_RGB_SCALE_ARB */
-   { 29598, 0x00008573 }, /* GL_RGB_SCALE_EXT */
-   { 29615, 0x00000407 }, /* GL_RIGHT */
-   { 29624, 0x00002000 }, /* GL_S */
-   { 29629, 0x00008B5D }, /* GL_SAMPLER_1D */
-   { 29643, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
-   { 29664, 0x00008B5E }, /* GL_SAMPLER_2D */
-   { 29678, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
-   { 29699, 0x00008B5F }, /* GL_SAMPLER_3D */
-   { 29713, 0x00008B60 }, /* GL_SAMPLER_CUBE */
-   { 29729, 0x000080A9 }, /* GL_SAMPLES */
-   { 29740, 0x000086B4 }, /* GL_SAMPLES_3DFX */
-   { 29756, 0x000080A9 }, /* GL_SAMPLES_ARB */
-   { 29771, 0x00008914 }, /* GL_SAMPLES_PASSED */
-   { 29789, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
-   { 29811, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-   { 29839, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
-   { 29871, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
-   { 29894, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
-   { 29921, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
-   { 29939, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
-   { 29962, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
-   { 29984, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
-   { 30003, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
-   { 30026, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
-   { 30052, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
-   { 30082, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
-   { 30107, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
-   { 30136, 0x00080000 }, /* GL_SCISSOR_BIT */
-   { 30151, 0x00000C10 }, /* GL_SCISSOR_BOX */
-   { 30166, 0x00000C11 }, /* GL_SCISSOR_TEST */
-   { 30182, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
-   { 30207, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-   { 30247, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
-   { 30291, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-   { 30324, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-   { 30354, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-   { 30386, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-   { 30416, 0x00001C02 }, /* GL_SELECT */
-   { 30426, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
-   { 30454, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
-   { 30479, 0x00008012 }, /* GL_SEPARABLE_2D */
-   { 30495, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
-   { 30522, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
-   { 30553, 0x0000150F }, /* GL_SET */
-   { 30560, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
-   { 30581, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
-   { 30605, 0x00008B4F }, /* GL_SHADER_TYPE */
-   { 30620, 0x00000B54 }, /* GL_SHADE_MODEL */
-   { 30635, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
-   { 30663, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
-   { 30686, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-   { 30716, 0x00001601 }, /* GL_SHININESS */
-   { 30729, 0x00001402 }, /* GL_SHORT */
-   { 30738, 0x00009119 }, /* GL_SIGNALED */
-   { 30750, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
-   { 30771, 0x000081F9 }, /* GL_SINGLE_COLOR */
-   { 30787, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
-   { 30807, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
-   { 30826, 0x00008C46 }, /* GL_SLUMINANCE */
-   { 30840, 0x00008C47 }, /* GL_SLUMINANCE8 */
-   { 30855, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
-   { 30877, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
-   { 30897, 0x00001D01 }, /* GL_SMOOTH */
-   { 30907, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
-   { 30940, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
-   { 30967, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
-   { 31000, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
-   { 31027, 0x00008588 }, /* GL_SOURCE0_ALPHA */
-   { 31044, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
-   { 31065, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
-   { 31086, 0x00008580 }, /* GL_SOURCE0_RGB */
-   { 31101, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
-   { 31120, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
-   { 31139, 0x00008589 }, /* GL_SOURCE1_ALPHA */
-   { 31156, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
-   { 31177, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
-   { 31198, 0x00008581 }, /* GL_SOURCE1_RGB */
-   { 31213, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
-   { 31232, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
-   { 31251, 0x0000858A }, /* GL_SOURCE2_ALPHA */
-   { 31268, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
-   { 31289, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
-   { 31310, 0x00008582 }, /* GL_SOURCE2_RGB */
-   { 31325, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
-   { 31344, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
-   { 31363, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
-   { 31383, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
-   { 31401, 0x00001202 }, /* GL_SPECULAR */
-   { 31413, 0x00002402 }, /* GL_SPHERE_MAP */
-   { 31427, 0x00001206 }, /* GL_SPOT_CUTOFF */
-   { 31442, 0x00001204 }, /* GL_SPOT_DIRECTION */
-   { 31460, 0x00001205 }, /* GL_SPOT_EXPONENT */
-   { 31477, 0x00008588 }, /* GL_SRC0_ALPHA */
-   { 31491, 0x00008580 }, /* GL_SRC0_RGB */
-   { 31503, 0x00008589 }, /* GL_SRC1_ALPHA */
-   { 31517, 0x00008581 }, /* GL_SRC1_RGB */
-   { 31529, 0x0000858A }, /* GL_SRC2_ALPHA */
-   { 31543, 0x00008582 }, /* GL_SRC2_RGB */
-   { 31555, 0x00000302 }, /* GL_SRC_ALPHA */
-   { 31568, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
-   { 31590, 0x00000300 }, /* GL_SRC_COLOR */
-   { 31603, 0x00008C40 }, /* GL_SRGB */
-   { 31611, 0x00008C41 }, /* GL_SRGB8 */
-   { 31620, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
-   { 31636, 0x00008C42 }, /* GL_SRGB_ALPHA */
-   { 31650, 0x00000503 }, /* GL_STACK_OVERFLOW */
-   { 31668, 0x00000504 }, /* GL_STACK_UNDERFLOW */
-   { 31687, 0x000088E6 }, /* GL_STATIC_COPY */
-   { 31702, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
-   { 31721, 0x000088E4 }, /* GL_STATIC_DRAW */
-   { 31736, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
-   { 31755, 0x000088E5 }, /* GL_STATIC_READ */
-   { 31770, 0x000088E5 }, /* GL_STATIC_READ_ARB */
-   { 31789, 0x00001802 }, /* GL_STENCIL */
-   { 31800, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
-   { 31822, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
-   { 31848, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
-   { 31869, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
-   { 31894, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
-   { 31915, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
-   { 31940, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-   { 31972, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
-   { 32008, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-   { 32040, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
-   { 32076, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
-   { 32096, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
-   { 32123, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
-   { 32149, 0x00000D57 }, /* GL_STENCIL_BITS */
-   { 32165, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
-   { 32187, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
-   { 32210, 0x00000B94 }, /* GL_STENCIL_FAIL */
-   { 32226, 0x00000B92 }, /* GL_STENCIL_FUNC */
-   { 32242, 0x00001901 }, /* GL_STENCIL_INDEX */
-   { 32259, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
-   { 32282, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
-   { 32304, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
-   { 32326, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
-   { 32348, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
-   { 32369, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
-   { 32396, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
-   { 32423, 0x00000B97 }, /* GL_STENCIL_REF */
-   { 32438, 0x00000B90 }, /* GL_STENCIL_TEST */
-   { 32454, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
-   { 32483, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
-   { 32505, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
-   { 32526, 0x00000C33 }, /* GL_STEREO */
-   { 32536, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
-   { 32560, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
-   { 32585, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
-   { 32609, 0x000088E2 }, /* GL_STREAM_COPY */
-   { 32624, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
-   { 32643, 0x000088E0 }, /* GL_STREAM_DRAW */
-   { 32658, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
-   { 32677, 0x000088E1 }, /* GL_STREAM_READ */
-   { 32692, 0x000088E1 }, /* GL_STREAM_READ_ARB */
-   { 32711, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
-   { 32728, 0x000084E7 }, /* GL_SUBTRACT */
-   { 32740, 0x000084E7 }, /* GL_SUBTRACT_ARB */
-   { 32756, 0x00009113 }, /* GL_SYNC_CONDITION */
-   { 32774, 0x00009116 }, /* GL_SYNC_FENCE */
-   { 32788, 0x00009115 }, /* GL_SYNC_FLAGS */
-   { 32802, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
-   { 32829, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
-   { 32859, 0x00009114 }, /* GL_SYNC_STATUS */
-   { 32874, 0x00002001 }, /* GL_T */
-   { 32879, 0x00002A2A }, /* GL_T2F_C3F_V3F */
-   { 32894, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
-   { 32913, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
-   { 32929, 0x00002A2B }, /* GL_T2F_N3F_V3F */
-   { 32944, 0x00002A27 }, /* GL_T2F_V3F */
-   { 32955, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
-   { 32974, 0x00002A28 }, /* GL_T4F_V4F */
-   { 32985, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
-   { 33008, 0x00001702 }, /* GL_TEXTURE */
-   { 33019, 0x000084C0 }, /* GL_TEXTURE0 */
-   { 33031, 0x000084C0 }, /* GL_TEXTURE0_ARB */
-   { 33047, 0x000084C1 }, /* GL_TEXTURE1 */
-   { 33059, 0x000084CA }, /* GL_TEXTURE10 */
-   { 33072, 0x000084CA }, /* GL_TEXTURE10_ARB */
-   { 33089, 0x000084CB }, /* GL_TEXTURE11 */
-   { 33102, 0x000084CB }, /* GL_TEXTURE11_ARB */
-   { 33119, 0x000084CC }, /* GL_TEXTURE12 */
-   { 33132, 0x000084CC }, /* GL_TEXTURE12_ARB */
-   { 33149, 0x000084CD }, /* GL_TEXTURE13 */
-   { 33162, 0x000084CD }, /* GL_TEXTURE13_ARB */
-   { 33179, 0x000084CE }, /* GL_TEXTURE14 */
-   { 33192, 0x000084CE }, /* GL_TEXTURE14_ARB */
-   { 33209, 0x000084CF }, /* GL_TEXTURE15 */
-   { 33222, 0x000084CF }, /* GL_TEXTURE15_ARB */
-   { 33239, 0x000084D0 }, /* GL_TEXTURE16 */
-   { 33252, 0x000084D0 }, /* GL_TEXTURE16_ARB */
-   { 33269, 0x000084D1 }, /* GL_TEXTURE17 */
-   { 33282, 0x000084D1 }, /* GL_TEXTURE17_ARB */
-   { 33299, 0x000084D2 }, /* GL_TEXTURE18 */
-   { 33312, 0x000084D2 }, /* GL_TEXTURE18_ARB */
-   { 33329, 0x000084D3 }, /* GL_TEXTURE19 */
-   { 33342, 0x000084D3 }, /* GL_TEXTURE19_ARB */
-   { 33359, 0x000084C1 }, /* GL_TEXTURE1_ARB */
-   { 33375, 0x000084C2 }, /* GL_TEXTURE2 */
-   { 33387, 0x000084D4 }, /* GL_TEXTURE20 */
-   { 33400, 0x000084D4 }, /* GL_TEXTURE20_ARB */
-   { 33417, 0x000084D5 }, /* GL_TEXTURE21 */
-   { 33430, 0x000084D5 }, /* GL_TEXTURE21_ARB */
-   { 33447, 0x000084D6 }, /* GL_TEXTURE22 */
-   { 33460, 0x000084D6 }, /* GL_TEXTURE22_ARB */
-   { 33477, 0x000084D7 }, /* GL_TEXTURE23 */
-   { 33490, 0x000084D7 }, /* GL_TEXTURE23_ARB */
-   { 33507, 0x000084D8 }, /* GL_TEXTURE24 */
-   { 33520, 0x000084D8 }, /* GL_TEXTURE24_ARB */
-   { 33537, 0x000084D9 }, /* GL_TEXTURE25 */
-   { 33550, 0x000084D9 }, /* GL_TEXTURE25_ARB */
-   { 33567, 0x000084DA }, /* GL_TEXTURE26 */
-   { 33580, 0x000084DA }, /* GL_TEXTURE26_ARB */
-   { 33597, 0x000084DB }, /* GL_TEXTURE27 */
-   { 33610, 0x000084DB }, /* GL_TEXTURE27_ARB */
-   { 33627, 0x000084DC }, /* GL_TEXTURE28 */
-   { 33640, 0x000084DC }, /* GL_TEXTURE28_ARB */
-   { 33657, 0x000084DD }, /* GL_TEXTURE29 */
-   { 33670, 0x000084DD }, /* GL_TEXTURE29_ARB */
-   { 33687, 0x000084C2 }, /* GL_TEXTURE2_ARB */
-   { 33703, 0x000084C3 }, /* GL_TEXTURE3 */
-   { 33715, 0x000084DE }, /* GL_TEXTURE30 */
-   { 33728, 0x000084DE }, /* GL_TEXTURE30_ARB */
-   { 33745, 0x000084DF }, /* GL_TEXTURE31 */
-   { 33758, 0x000084DF }, /* GL_TEXTURE31_ARB */
-   { 33775, 0x000084C3 }, /* GL_TEXTURE3_ARB */
-   { 33791, 0x000084C4 }, /* GL_TEXTURE4 */
-   { 33803, 0x000084C4 }, /* GL_TEXTURE4_ARB */
-   { 33819, 0x000084C5 }, /* GL_TEXTURE5 */
-   { 33831, 0x000084C5 }, /* GL_TEXTURE5_ARB */
-   { 33847, 0x000084C6 }, /* GL_TEXTURE6 */
-   { 33859, 0x000084C6 }, /* GL_TEXTURE6_ARB */
-   { 33875, 0x000084C7 }, /* GL_TEXTURE7 */
-   { 33887, 0x000084C7 }, /* GL_TEXTURE7_ARB */
-   { 33903, 0x000084C8 }, /* GL_TEXTURE8 */
-   { 33915, 0x000084C8 }, /* GL_TEXTURE8_ARB */
-   { 33931, 0x000084C9 }, /* GL_TEXTURE9 */
-   { 33943, 0x000084C9 }, /* GL_TEXTURE9_ARB */
-   { 33959, 0x00000DE0 }, /* GL_TEXTURE_1D */
-   { 33973, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
-   { 33997, 0x00000DE1 }, /* GL_TEXTURE_2D */
-   { 34011, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
-   { 34035, 0x0000806F }, /* GL_TEXTURE_3D */
-   { 34049, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
-   { 34071, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
-   { 34097, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
-   { 34119, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
-   { 34141, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
-   { 34173, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
-   { 34195, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
-   { 34227, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
-   { 34249, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
-   { 34277, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
-   { 34309, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
-   { 34342, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
-   { 34374, 0x00040000 }, /* GL_TEXTURE_BIT */
-   { 34389, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
-   { 34410, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
-   { 34435, 0x00001005 }, /* GL_TEXTURE_BORDER */
-   { 34453, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
-   { 34477, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-   { 34508, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-   { 34538, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-   { 34568, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-   { 34603, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-   { 34634, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 34672, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
-   { 34699, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-   { 34731, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
-   { 34765, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
-   { 34789, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
-   { 34817, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
-   { 34841, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
-   { 34869, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-   { 34902, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
-   { 34926, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
-   { 34948, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
-   { 34970, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
-   { 34996, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
-   { 35030, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-   { 35063, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
-   { 35100, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
-   { 35128, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
-   { 35160, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
-   { 35183, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-   { 35221, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
-   { 35263, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-   { 35294, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-   { 35322, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-   { 35352, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-   { 35380, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
-   { 35400, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
-   { 35424, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-   { 35455, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
-   { 35490, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-   { 35521, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
-   { 35556, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-   { 35587, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
-   { 35622, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-   { 35653, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
-   { 35688, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-   { 35719, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
-   { 35754, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-   { 35785, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
-   { 35820, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
-   { 35849, 0x00008071 }, /* GL_TEXTURE_DEPTH */
-   { 35866, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
-   { 35888, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
-   { 35914, 0x00002300 }, /* GL_TEXTURE_ENV */
-   { 35929, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
-   { 35950, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
-   { 35970, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
-   { 35996, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
-   { 36016, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
-   { 36033, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
-   { 36050, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
-   { 36067, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
-   { 36084, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
-   { 36109, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
-   { 36131, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
-   { 36157, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
-   { 36175, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
-   { 36201, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
-   { 36227, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
-   { 36257, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
-   { 36284, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
-   { 36309, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
-   { 36329, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
-   { 36353, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-   { 36380, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-   { 36407, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-   { 36434, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
-   { 36460, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
-   { 36490, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
-   { 36512, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
-   { 36530, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 36560, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-   { 36588, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-   { 36616, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-   { 36644, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
-   { 36665, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
-   { 36684, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
-   { 36706, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
-   { 36725, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
-   { 36745, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
-   { 36775, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
-   { 36806, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
-   { 36831, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
-   { 36855, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
-   { 36875, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
-   { 36899, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
-   { 36919, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
-   { 36942, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
-   { 36966, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
-   { 36996, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
-   { 37021, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-   { 37055, 0x00001000 }, /* GL_TEXTURE_WIDTH */
-   { 37072, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
-   { 37090, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
-   { 37108, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
-   { 37126, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
-   { 37145, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */
-   { 37164, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
-   { 37184, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
-   { 37203, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-   { 37232, 0x00001000 }, /* GL_TRANSFORM_BIT */
-   { 37249, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
-   { 37275, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
-   { 37305, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-   { 37337, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-   { 37367, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
-   { 37401, 0x0000862C }, /* GL_TRANSPOSE_NV */
-   { 37417, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-   { 37448, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
-   { 37483, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-   { 37511, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
-   { 37543, 0x00000004 }, /* GL_TRIANGLES */
-   { 37556, 0x00000006 }, /* GL_TRIANGLE_FAN */
-   { 37572, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
-   { 37593, 0x00000005 }, /* GL_TRIANGLE_STRIP */
-   { 37611, 0x00000001 }, /* GL_TRUE */
-   { 37619, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
-   { 37639, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
-   { 37662, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
-   { 37682, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
-   { 37703, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
-   { 37725, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
-   { 37747, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
-   { 37767, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
-   { 37788, 0x00009118 }, /* GL_UNSIGNALED */
-   { 37802, 0x00001401 }, /* GL_UNSIGNED_BYTE */
-   { 37819, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-   { 37846, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
-   { 37869, 0x00001405 }, /* GL_UNSIGNED_INT */
-   { 37885, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
-   { 37912, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
-   { 37933, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
-   { 37957, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-   { 37988, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
-   { 38012, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-   { 38040, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
-   { 38063, 0x00001403 }, /* GL_UNSIGNED_SHORT */
-   { 38081, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-   { 38111, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-   { 38137, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-   { 38167, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-   { 38193, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
-   { 38217, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-   { 38245, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-   { 38273, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
-   { 38300, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-   { 38332, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
-   { 38363, 0x00008CA2 }, /* GL_UPPER_LEFT */
-   { 38377, 0x00002A20 }, /* GL_V2F */
-   { 38384, 0x00002A21 }, /* GL_V3F */
-   { 38391, 0x00008B83 }, /* GL_VALIDATE_STATUS */
-   { 38410, 0x00001F00 }, /* GL_VENDOR */
-   { 38420, 0x00001F02 }, /* GL_VERSION */
-   { 38431, 0x00008074 }, /* GL_VERTEX_ARRAY */
-   { 38447, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
-   { 38471, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
-   { 38501, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-   { 38532, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
-   { 38567, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
-   { 38591, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
-   { 38612, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
-   { 38635, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
-   { 38656, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-   { 38683, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-   { 38711, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-   { 38739, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-   { 38767, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-   { 38795, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-   { 38823, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-   { 38851, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-   { 38878, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-   { 38905, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-   { 38932, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-   { 38959, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-   { 38986, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-   { 39013, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-   { 39040, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-   { 39067, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-   { 39094, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-   { 39132, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
-   { 39174, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-   { 39205, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
-   { 39240, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-   { 39274, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
-   { 39312, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-   { 39343, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
-   { 39378, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-   { 39406, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
-   { 39438, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-   { 39468, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
-   { 39502, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
-   { 39530, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
-   { 39562, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
-   { 39582, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
-   { 39604, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
-   { 39633, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
-   { 39654, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
-   { 39683, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
-   { 39716, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
-   { 39748, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-   { 39775, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
-   { 39806, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
-   { 39836, 0x00008B31 }, /* GL_VERTEX_SHADER */
-   { 39853, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
-   { 39874, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
-   { 39901, 0x00000BA2 }, /* GL_VIEWPORT */
-   { 39913, 0x00000800 }, /* GL_VIEWPORT_BIT */
-   { 39929, 0x0000911D }, /* GL_WAIT_FAILED */
-   { 39944, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
-   { 39964, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-   { 39995, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
-   { 40030, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-   { 40058, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-   { 40083, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-   { 40110, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-   { 40135, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
-   { 40159, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
-   { 40178, 0x000088B9 }, /* GL_WRITE_ONLY */
-   { 40192, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
-   { 40210, 0x00001506 }, /* GL_XOR */
-   { 40217, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
-   { 40236, 0x00008757 }, /* GL_YCBCR_MESA */
-   { 40250, 0x00000000 }, /* GL_ZERO */
-   { 40258, 0x00000D16 }, /* GL_ZOOM_X */
-   { 40268, 0x00000D17 }, /* GL_ZOOM_Y */
+   {  7190, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */
+   {  7214, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
+   {  7234, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
+   {  7258, 0x00000D1F }, /* GL_DEPTH_BIAS */
+   {  7272, 0x00000D56 }, /* GL_DEPTH_BITS */
+   {  7286, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
+   {  7306, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
+   {  7331, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
+   {  7351, 0x0000864F }, /* GL_DEPTH_CLAMP */
+   {  7366, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
+   {  7384, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
+   {  7405, 0x00001902 }, /* GL_DEPTH_COMPONENT */
+   {  7424, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
+   {  7445, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
+   {  7470, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
+   {  7496, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
+   {  7517, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
+   {  7542, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
+   {  7568, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
+   {  7589, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
+   {  7614, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
+   {  7640, 0x00000B74 }, /* GL_DEPTH_FUNC */
+   {  7654, 0x00000B70 }, /* GL_DEPTH_RANGE */
+   {  7669, 0x00000D1E }, /* GL_DEPTH_SCALE */
+   {  7684, 0x000084F9 }, /* GL_DEPTH_STENCIL */
+   {  7701, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
+   {  7729, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */
+   {  7750, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
+   {  7770, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+   {  7798, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+   {  7826, 0x00000B71 }, /* GL_DEPTH_TEST */
+   {  7840, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
+   {  7862, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
+   {  7888, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
+   {  7907, 0x00001201 }, /* GL_DIFFUSE */
+   {  7918, 0x00000BD0 }, /* GL_DITHER */
+   {  7928, 0x00000A02 }, /* GL_DOMAIN */
+   {  7938, 0x00001100 }, /* GL_DONT_CARE */
+   {  7951, 0x000086AE }, /* GL_DOT3_RGB */
+   {  7963, 0x000086AF }, /* GL_DOT3_RGBA */
+   {  7976, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
+   {  7993, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
+   {  8010, 0x000086AE }, /* GL_DOT3_RGB_ARB */
+   {  8026, 0x00008740 }, /* GL_DOT3_RGB_EXT */
+   {  8042, 0x0000140A }, /* GL_DOUBLE */
+   {  8052, 0x00000C32 }, /* GL_DOUBLEBUFFER */
+   {  8068, 0x00000C01 }, /* GL_DRAW_BUFFER */
+   {  8083, 0x00008825 }, /* GL_DRAW_BUFFER0 */
+   {  8099, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
+   {  8119, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
+   {  8139, 0x00008826 }, /* GL_DRAW_BUFFER1 */
+   {  8155, 0x0000882F }, /* GL_DRAW_BUFFER10 */
+   {  8172, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
+   {  8193, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
+   {  8214, 0x00008830 }, /* GL_DRAW_BUFFER11 */
+   {  8231, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
+   {  8252, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
+   {  8273, 0x00008831 }, /* GL_DRAW_BUFFER12 */
+   {  8290, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
+   {  8311, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
+   {  8332, 0x00008832 }, /* GL_DRAW_BUFFER13 */
+   {  8349, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
+   {  8370, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
+   {  8391, 0x00008833 }, /* GL_DRAW_BUFFER14 */
+   {  8408, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
+   {  8429, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
+   {  8450, 0x00008834 }, /* GL_DRAW_BUFFER15 */
+   {  8467, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
+   {  8488, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
+   {  8509, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
+   {  8529, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
+   {  8549, 0x00008827 }, /* GL_DRAW_BUFFER2 */
+   {  8565, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
+   {  8585, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
+   {  8605, 0x00008828 }, /* GL_DRAW_BUFFER3 */
+   {  8621, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
+   {  8641, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
+   {  8661, 0x00008829 }, /* GL_DRAW_BUFFER4 */
+   {  8677, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
+   {  8697, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
+   {  8717, 0x0000882A }, /* GL_DRAW_BUFFER5 */
+   {  8733, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
+   {  8753, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
+   {  8773, 0x0000882B }, /* GL_DRAW_BUFFER6 */
+   {  8789, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
+   {  8809, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
+   {  8829, 0x0000882C }, /* GL_DRAW_BUFFER7 */
+   {  8845, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
+   {  8865, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
+   {  8885, 0x0000882D }, /* GL_DRAW_BUFFER8 */
+   {  8901, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
+   {  8921, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
+   {  8941, 0x0000882E }, /* GL_DRAW_BUFFER9 */
+   {  8957, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
+   {  8977, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
+   {  8997, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
+   {  9017, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */
+   {  9045, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
+   {  9077, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
+   {  9101, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
+   {  9121, 0x00000304 }, /* GL_DST_ALPHA */
+   {  9134, 0x00000306 }, /* GL_DST_COLOR */
+   {  9147, 0x0000877A }, /* GL_DU8DV8_ATI */
+   {  9161, 0x00008779 }, /* GL_DUDV_ATI */
+   {  9173, 0x000088EA }, /* GL_DYNAMIC_COPY */
+   {  9189, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
+   {  9209, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
+   {  9225, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
+   {  9245, 0x000088E9 }, /* GL_DYNAMIC_READ */
+   {  9261, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
+   {  9281, 0x00000B43 }, /* GL_EDGE_FLAG */
+   {  9294, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
+   {  9313, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+   {  9347, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
+   {  9385, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
+   {  9412, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+   {  9438, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
+   {  9462, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+   {  9494, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
+   {  9530, 0x00001600 }, /* GL_EMISSION */
+   {  9542, 0x00002000 }, /* GL_ENABLE_BIT */
+   {  9556, 0x00000202 }, /* GL_EQUAL */
+   {  9565, 0x00001509 }, /* GL_EQUIV */
+   {  9574, 0x00010000 }, /* GL_EVAL_BIT */
+   {  9586, 0x00000800 }, /* GL_EXP */
+   {  9593, 0x00000801 }, /* GL_EXP2 */
+   {  9601, 0x00001F03 }, /* GL_EXTENSIONS */
+   {  9615, 0x00002400 }, /* GL_EYE_LINEAR */
+   {  9629, 0x00002502 }, /* GL_EYE_PLANE */
+   {  9642, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
+   {  9667, 0x0000855B }, /* GL_EYE_RADIAL_NV */
+   {  9684, 0x00000000 }, /* GL_FALSE */
+   {  9693, 0x00001101 }, /* GL_FASTEST */
+   {  9704, 0x00001C01 }, /* GL_FEEDBACK */
+   {  9716, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
+   {  9743, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
+   {  9767, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
+   {  9791, 0x00001B02 }, /* GL_FILL */
+   {  9799, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */
+   {  9826, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */
+   {  9857, 0x00001D00 }, /* GL_FLAT */
+   {  9865, 0x00001406 }, /* GL_FLOAT */
+   {  9874, 0x00008B5A }, /* GL_FLOAT_MAT2 */
+   {  9888, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
+   {  9906, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
+   {  9922, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
+   {  9938, 0x00008B5B }, /* GL_FLOAT_MAT3 */
+   {  9952, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
+   {  9970, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
+   {  9986, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
+   { 10002, 0x00008B5C }, /* GL_FLOAT_MAT4 */
+   { 10016, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
+   { 10034, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
+   { 10050, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
+   { 10066, 0x00008B50 }, /* GL_FLOAT_VEC2 */
+   { 10080, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
+   { 10098, 0x00008B51 }, /* GL_FLOAT_VEC3 */
+   { 10112, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
+   { 10130, 0x00008B52 }, /* GL_FLOAT_VEC4 */
+   { 10144, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
+   { 10162, 0x00000B60 }, /* GL_FOG */
+   { 10169, 0x00000080 }, /* GL_FOG_BIT */
+   { 10180, 0x00000B66 }, /* GL_FOG_COLOR */
+   { 10193, 0x00008451 }, /* GL_FOG_COORD */
+   { 10206, 0x00008451 }, /* GL_FOG_COORDINATE */
+   { 10224, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
+   { 10248, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+   { 10287, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
+   { 10330, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+   { 10362, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+   { 10393, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+   { 10422, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
+   { 10447, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
+   { 10466, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
+   { 10500, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
+   { 10527, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
+   { 10553, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
+   { 10577, 0x00008450 }, /* GL_FOG_COORD_SRC */
+   { 10594, 0x00000B62 }, /* GL_FOG_DENSITY */
+   { 10609, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
+   { 10633, 0x00000B64 }, /* GL_FOG_END */
+   { 10644, 0x00000C54 }, /* GL_FOG_HINT */
+   { 10656, 0x00000B61 }, /* GL_FOG_INDEX */
+   { 10669, 0x00000B65 }, /* GL_FOG_MODE */
+   { 10681, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
+   { 10700, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
+   { 10725, 0x00000B63 }, /* GL_FOG_START */
+   { 10738, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
+   { 10756, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
+   { 10780, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
+   { 10799, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
+   { 10822, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+   { 10857, 0x00008D40 }, /* GL_FRAMEBUFFER */
+   { 10872, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+   { 10909, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+   { 10945, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+   { 10986, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+   { 11027, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+   { 11064, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+   { 11101, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+   { 11139, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
+   { 11181, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+   { 11219, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
+   { 11261, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+   { 11296, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+   { 11335, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
+   { 11384, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+   { 11432, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
+   { 11484, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+   { 11524, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+   { 11568, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+   { 11608, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
+   { 11652, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */
+   { 11675, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
+   { 11702, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
+   { 11726, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
+   { 11754, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
+   { 11777, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
+   { 11796, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+   { 11833, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
+   { 11874, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+   { 11915, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+   { 11953, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
+   { 11995, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+   { 12046, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+   { 12084, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+   { 12129, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
+   { 12178, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+   { 12216, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */
+   { 12258, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+   { 12296, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
+   { 12338, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+   { 12370, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
+   { 12395, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
+   { 12422, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
+   { 12453, 0x00000404 }, /* GL_FRONT */
+   { 12462, 0x00000408 }, /* GL_FRONT_AND_BACK */
+   { 12480, 0x00000B46 }, /* GL_FRONT_FACE */
+   { 12494, 0x00000400 }, /* GL_FRONT_LEFT */
+   { 12508, 0x00000401 }, /* GL_FRONT_RIGHT */
+   { 12523, 0x00008006 }, /* GL_FUNC_ADD */
+   { 12535, 0x00008006 }, /* GL_FUNC_ADD_EXT */
+   { 12551, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
+   { 12576, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
+   { 12605, 0x0000800A }, /* GL_FUNC_SUBTRACT */
+   { 12622, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
+   { 12643, 0x00008191 }, /* GL_GENERATE_MIPMAP */
+   { 12662, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
+   { 12686, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
+   { 12715, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
+   { 12739, 0x00000206 }, /* GL_GEQUAL */
+   { 12749, 0x00000204 }, /* GL_GREATER */
+   { 12760, 0x00001904 }, /* GL_GREEN */
+   { 12769, 0x00000D19 }, /* GL_GREEN_BIAS */
+   { 12783, 0x00000D53 }, /* GL_GREEN_BITS */
+   { 12797, 0x00000D18 }, /* GL_GREEN_SCALE */
+   { 12812, 0x00008000 }, /* GL_HINT_BIT */
+   { 12824, 0x00008024 }, /* GL_HISTOGRAM */
+   { 12837, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
+   { 12861, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
+   { 12889, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
+   { 12912, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
+   { 12939, 0x00008024 }, /* GL_HISTOGRAM_EXT */
+   { 12956, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
+   { 12976, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
+   { 13000, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
+   { 13024, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
+   { 13052, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+   { 13080, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
+   { 13112, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
+   { 13134, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
+   { 13160, 0x0000802D }, /* GL_HISTOGRAM_SINK */
+   { 13178, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
+   { 13200, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
+   { 13219, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
+   { 13242, 0x0000862A }, /* GL_IDENTITY_NV */
+   { 13257, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
+   { 13277, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+   { 13317, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+   { 13355, 0x00001E02 }, /* GL_INCR */
+   { 13363, 0x00008507 }, /* GL_INCR_WRAP */
+   { 13376, 0x00008507 }, /* GL_INCR_WRAP_EXT */
+   { 13393, 0x00008222 }, /* GL_INDEX */
+   { 13402, 0x00008077 }, /* GL_INDEX_ARRAY */
+   { 13417, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+   { 13447, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
+   { 13481, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
+   { 13504, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
+   { 13526, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
+   { 13546, 0x00000D51 }, /* GL_INDEX_BITS */
+   { 13560, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
+   { 13581, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
+   { 13599, 0x00000C30 }, /* GL_INDEX_MODE */
+   { 13613, 0x00000D13 }, /* GL_INDEX_OFFSET */
+   { 13629, 0x00000D12 }, /* GL_INDEX_SHIFT */
+   { 13644, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
+   { 13663, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
+   { 13682, 0x00001404 }, /* GL_INT */
+   { 13689, 0x00008049 }, /* GL_INTENSITY */
+   { 13702, 0x0000804C }, /* GL_INTENSITY12 */
+   { 13717, 0x0000804C }, /* GL_INTENSITY12_EXT */
+   { 13736, 0x0000804D }, /* GL_INTENSITY16 */
+   { 13751, 0x0000804D }, /* GL_INTENSITY16_EXT */
+   { 13770, 0x0000804A }, /* GL_INTENSITY4 */
+   { 13784, 0x0000804A }, /* GL_INTENSITY4_EXT */
+   { 13802, 0x0000804B }, /* GL_INTENSITY8 */
+   { 13816, 0x0000804B }, /* GL_INTENSITY8_EXT */
+   { 13834, 0x00008049 }, /* GL_INTENSITY_EXT */
+   { 13851, 0x00008575 }, /* GL_INTERPOLATE */
+   { 13866, 0x00008575 }, /* GL_INTERPOLATE_ARB */
+   { 13885, 0x00008575 }, /* GL_INTERPOLATE_EXT */
+   { 13904, 0x00008B53 }, /* GL_INT_VEC2 */
+   { 13916, 0x00008B53 }, /* GL_INT_VEC2_ARB */
+   { 13932, 0x00008B54 }, /* GL_INT_VEC3 */
+   { 13944, 0x00008B54 }, /* GL_INT_VEC3_ARB */
+   { 13960, 0x00008B55 }, /* GL_INT_VEC4 */
+   { 13972, 0x00008B55 }, /* GL_INT_VEC4_ARB */
+   { 13988, 0x00000500 }, /* GL_INVALID_ENUM */
+   { 14004, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+   { 14037, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
+   { 14074, 0x00000502 }, /* GL_INVALID_OPERATION */
+   { 14095, 0x00000501 }, /* GL_INVALID_VALUE */
+   { 14112, 0x0000862B }, /* GL_INVERSE_NV */
+   { 14126, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
+   { 14150, 0x0000150A }, /* GL_INVERT */
+   { 14160, 0x00001E00 }, /* GL_KEEP */
+   { 14168, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
+   { 14194, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
+   { 14224, 0x00000406 }, /* GL_LEFT */
+   { 14232, 0x00000203 }, /* GL_LEQUAL */
+   { 14242, 0x00000201 }, /* GL_LESS */
+   { 14250, 0x00004000 }, /* GL_LIGHT0 */
+   { 14260, 0x00004001 }, /* GL_LIGHT1 */
+   { 14270, 0x00004002 }, /* GL_LIGHT2 */
+   { 14280, 0x00004003 }, /* GL_LIGHT3 */
+   { 14290, 0x00004004 }, /* GL_LIGHT4 */
+   { 14300, 0x00004005 }, /* GL_LIGHT5 */
+   { 14310, 0x00004006 }, /* GL_LIGHT6 */
+   { 14320, 0x00004007 }, /* GL_LIGHT7 */
+   { 14330, 0x00000B50 }, /* GL_LIGHTING */
+   { 14342, 0x00000040 }, /* GL_LIGHTING_BIT */
+   { 14358, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
+   { 14381, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+   { 14410, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
+   { 14443, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+   { 14471, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
+   { 14495, 0x00001B01 }, /* GL_LINE */
+   { 14503, 0x00002601 }, /* GL_LINEAR */
+   { 14513, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
+   { 14535, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+   { 14565, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+   { 14596, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
+   { 14620, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
+   { 14645, 0x00000001 }, /* GL_LINES */
+   { 14654, 0x00000004 }, /* GL_LINE_BIT */
+   { 14666, 0x00000002 }, /* GL_LINE_LOOP */
+   { 14679, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
+   { 14699, 0x00000B20 }, /* GL_LINE_SMOOTH */
+   { 14714, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
+   { 14734, 0x00000B24 }, /* GL_LINE_STIPPLE */
+   { 14750, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
+   { 14774, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
+   { 14797, 0x00000003 }, /* GL_LINE_STRIP */
+   { 14811, 0x00000702 }, /* GL_LINE_TOKEN */
+   { 14825, 0x00000B21 }, /* GL_LINE_WIDTH */
+   { 14839, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
+   { 14865, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
+   { 14885, 0x00008B82 }, /* GL_LINK_STATUS */
+   { 14900, 0x00000B32 }, /* GL_LIST_BASE */
+   { 14913, 0x00020000 }, /* GL_LIST_BIT */
+   { 14925, 0x00000B33 }, /* GL_LIST_INDEX */
+   { 14939, 0x00000B30 }, /* GL_LIST_MODE */
+   { 14952, 0x00000101 }, /* GL_LOAD */
+   { 14960, 0x00000BF1 }, /* GL_LOGIC_OP */
+   { 14972, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
+   { 14989, 0x00008CA1 }, /* GL_LOWER_LEFT */
+   { 15003, 0x00001909 }, /* GL_LUMINANCE */
+   { 15016, 0x00008041 }, /* GL_LUMINANCE12 */
+   { 15031, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
+   { 15054, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
+   { 15081, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
+   { 15103, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
+   { 15129, 0x00008041 }, /* GL_LUMINANCE12_EXT */
+   { 15148, 0x00008042 }, /* GL_LUMINANCE16 */
+   { 15163, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
+   { 15186, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
+   { 15213, 0x00008042 }, /* GL_LUMINANCE16_EXT */
+   { 15232, 0x0000803F }, /* GL_LUMINANCE4 */
+   { 15246, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
+   { 15267, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
+   { 15292, 0x0000803F }, /* GL_LUMINANCE4_EXT */
+   { 15310, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
+   { 15331, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
+   { 15356, 0x00008040 }, /* GL_LUMINANCE8 */
+   { 15370, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
+   { 15391, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
+   { 15416, 0x00008040 }, /* GL_LUMINANCE8_EXT */
+   { 15434, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
+   { 15453, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
+   { 15469, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
+   { 15489, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
+   { 15511, 0x00000D91 }, /* GL_MAP1_INDEX */
+   { 15525, 0x00000D92 }, /* GL_MAP1_NORMAL */
+   { 15540, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
+   { 15564, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
+   { 15588, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
+   { 15612, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
+   { 15636, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
+   { 15653, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
+   { 15670, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+   { 15698, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+   { 15727, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+   { 15756, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+   { 15785, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+   { 15814, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+   { 15843, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+   { 15872, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+   { 15900, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+   { 15928, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+   { 15956, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+   { 15984, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+   { 16012, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+   { 16040, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+   { 16068, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+   { 16096, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+   { 16124, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
+   { 16140, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
+   { 16160, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
+   { 16182, 0x00000DB1 }, /* GL_MAP2_INDEX */
+   { 16196, 0x00000DB2 }, /* GL_MAP2_NORMAL */
+   { 16211, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
+   { 16235, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
+   { 16259, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
+   { 16283, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
+   { 16307, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
+   { 16324, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
+   { 16341, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+   { 16369, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+   { 16398, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+   { 16427, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+   { 16456, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+   { 16485, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+   { 16514, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+   { 16543, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+   { 16571, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+   { 16599, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+   { 16627, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+   { 16655, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+   { 16683, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+   { 16711, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
+   { 16739, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+   { 16767, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+   { 16795, 0x00000D10 }, /* GL_MAP_COLOR */
+   { 16808, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
+   { 16834, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
+   { 16863, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
+   { 16891, 0x00000001 }, /* GL_MAP_READ_BIT */
+   { 16907, 0x00000D11 }, /* GL_MAP_STENCIL */
+   { 16922, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
+   { 16948, 0x00000002 }, /* GL_MAP_WRITE_BIT */
+   { 16965, 0x000088C0 }, /* GL_MATRIX0_ARB */
+   { 16980, 0x00008630 }, /* GL_MATRIX0_NV */
+   { 16994, 0x000088CA }, /* GL_MATRIX10_ARB */
+   { 17010, 0x000088CB }, /* GL_MATRIX11_ARB */
+   { 17026, 0x000088CC }, /* GL_MATRIX12_ARB */
+   { 17042, 0x000088CD }, /* GL_MATRIX13_ARB */
+   { 17058, 0x000088CE }, /* GL_MATRIX14_ARB */
+   { 17074, 0x000088CF }, /* GL_MATRIX15_ARB */
+   { 17090, 0x000088D0 }, /* GL_MATRIX16_ARB */
+   { 17106, 0x000088D1 }, /* GL_MATRIX17_ARB */
+   { 17122, 0x000088D2 }, /* GL_MATRIX18_ARB */
+   { 17138, 0x000088D3 }, /* GL_MATRIX19_ARB */
+   { 17154, 0x000088C1 }, /* GL_MATRIX1_ARB */
+   { 17169, 0x00008631 }, /* GL_MATRIX1_NV */
+   { 17183, 0x000088D4 }, /* GL_MATRIX20_ARB */
+   { 17199, 0x000088D5 }, /* GL_MATRIX21_ARB */
+   { 17215, 0x000088D6 }, /* GL_MATRIX22_ARB */
+   { 17231, 0x000088D7 }, /* GL_MATRIX23_ARB */
+   { 17247, 0x000088D8 }, /* GL_MATRIX24_ARB */
+   { 17263, 0x000088D9 }, /* GL_MATRIX25_ARB */
+   { 17279, 0x000088DA }, /* GL_MATRIX26_ARB */
+   { 17295, 0x000088DB }, /* GL_MATRIX27_ARB */
+   { 17311, 0x000088DC }, /* GL_MATRIX28_ARB */
+   { 17327, 0x000088DD }, /* GL_MATRIX29_ARB */
+   { 17343, 0x000088C2 }, /* GL_MATRIX2_ARB */
+   { 17358, 0x00008632 }, /* GL_MATRIX2_NV */
+   { 17372, 0x000088DE }, /* GL_MATRIX30_ARB */
+   { 17388, 0x000088DF }, /* GL_MATRIX31_ARB */
+   { 17404, 0x000088C3 }, /* GL_MATRIX3_ARB */
+   { 17419, 0x00008633 }, /* GL_MATRIX3_NV */
+   { 17433, 0x000088C4 }, /* GL_MATRIX4_ARB */
+   { 17448, 0x00008634 }, /* GL_MATRIX4_NV */
+   { 17462, 0x000088C5 }, /* GL_MATRIX5_ARB */
+   { 17477, 0x00008635 }, /* GL_MATRIX5_NV */
+   { 17491, 0x000088C6 }, /* GL_MATRIX6_ARB */
+   { 17506, 0x00008636 }, /* GL_MATRIX6_NV */
+   { 17520, 0x000088C7 }, /* GL_MATRIX7_ARB */
+   { 17535, 0x00008637 }, /* GL_MATRIX7_NV */
+   { 17549, 0x000088C8 }, /* GL_MATRIX8_ARB */
+   { 17564, 0x000088C9 }, /* GL_MATRIX9_ARB */
+   { 17579, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
+   { 17605, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+   { 17639, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+   { 17670, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+   { 17703, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+   { 17734, 0x00000BA0 }, /* GL_MATRIX_MODE */
+   { 17749, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
+   { 17771, 0x00008008 }, /* GL_MAX */
+   { 17778, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
+   { 17801, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+   { 17833, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
+   { 17859, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+   { 17892, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+   { 17918, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 17952, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
+   { 17971, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
+   { 17996, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+   { 18025, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+   { 18057, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
+   { 18093, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+   { 18129, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
+   { 18169, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
+   { 18195, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
+   { 18225, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
+   { 18250, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
+   { 18279, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+   { 18308, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
+   { 18341, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
+   { 18361, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
+   { 18385, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
+   { 18409, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
+   { 18433, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
+   { 18458, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
+   { 18476, 0x00008008 }, /* GL_MAX_EXT */
+   { 18487, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+   { 18522, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
+   { 18561, 0x00000D31 }, /* GL_MAX_LIGHTS */
+   { 18575, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
+   { 18595, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+   { 18633, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+   { 18662, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
+   { 18686, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
+   { 18714, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
+   { 18737, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 18774, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 18810, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+   { 18837, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+   { 18866, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+   { 18900, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+   { 18936, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+   { 18963, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+   { 18995, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+   { 19031, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+   { 19060, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+   { 19089, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
+   { 19117, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+   { 19155, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 19199, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 19242, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 19276, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 19315, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 19352, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 19390, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 19433, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 19476, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+   { 19506, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+   { 19537, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 19573, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 19609, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
+   { 19639, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+   { 19673, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
+   { 19706, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
+   { 19731, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+   { 19760, 0x00008D57 }, /* GL_MAX_SAMPLES */
+   { 19775, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
+   { 19794, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+   { 19821, 0x00008504 }, /* GL_MAX_SHININESS_NV */
+   { 19841, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
+   { 19865, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
+   { 19887, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
+   { 19913, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+   { 19940, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
+   { 19971, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
+   { 19995, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 20029, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
+   { 20049, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
+   { 20076, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
+   { 20097, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
+   { 20122, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
+   { 20147, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
+   { 20182, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
+   { 20204, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
+   { 20230, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
+   { 20252, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
+   { 20278, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+   { 20312, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+   { 20350, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+   { 20383, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
+   { 20420, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
+   { 20444, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
+   { 20465, 0x00008007 }, /* GL_MIN */
+   { 20472, 0x0000802E }, /* GL_MINMAX */
+   { 20482, 0x0000802E }, /* GL_MINMAX_EXT */
+   { 20496, 0x0000802F }, /* GL_MINMAX_FORMAT */
+   { 20513, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
+   { 20534, 0x00008030 }, /* GL_MINMAX_SINK */
+   { 20549, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
+   { 20568, 0x00008007 }, /* GL_MIN_EXT */
+   { 20579, 0x00008370 }, /* GL_MIRRORED_REPEAT */
+   { 20598, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
+   { 20621, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
+   { 20644, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
+   { 20664, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
+   { 20684, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+   { 20714, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
+   { 20742, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+   { 20770, 0x00001700 }, /* GL_MODELVIEW */
+   { 20783, 0x00001700 }, /* GL_MODELVIEW0_ARB */
+   { 20801, 0x0000872A }, /* GL_MODELVIEW10_ARB */
+   { 20820, 0x0000872B }, /* GL_MODELVIEW11_ARB */
+   { 20839, 0x0000872C }, /* GL_MODELVIEW12_ARB */
+   { 20858, 0x0000872D }, /* GL_MODELVIEW13_ARB */
+   { 20877, 0x0000872E }, /* GL_MODELVIEW14_ARB */
+   { 20896, 0x0000872F }, /* GL_MODELVIEW15_ARB */
+   { 20915, 0x00008730 }, /* GL_MODELVIEW16_ARB */
+   { 20934, 0x00008731 }, /* GL_MODELVIEW17_ARB */
+   { 20953, 0x00008732 }, /* GL_MODELVIEW18_ARB */
+   { 20972, 0x00008733 }, /* GL_MODELVIEW19_ARB */
+   { 20991, 0x0000850A }, /* GL_MODELVIEW1_ARB */
+   { 21009, 0x00008734 }, /* GL_MODELVIEW20_ARB */
+   { 21028, 0x00008735 }, /* GL_MODELVIEW21_ARB */
+   { 21047, 0x00008736 }, /* GL_MODELVIEW22_ARB */
+   { 21066, 0x00008737 }, /* GL_MODELVIEW23_ARB */
+   { 21085, 0x00008738 }, /* GL_MODELVIEW24_ARB */
+   { 21104, 0x00008739 }, /* GL_MODELVIEW25_ARB */
+   { 21123, 0x0000873A }, /* GL_MODELVIEW26_ARB */
+   { 21142, 0x0000873B }, /* GL_MODELVIEW27_ARB */
+   { 21161, 0x0000873C }, /* GL_MODELVIEW28_ARB */
+   { 21180, 0x0000873D }, /* GL_MODELVIEW29_ARB */
+   { 21199, 0x00008722 }, /* GL_MODELVIEW2_ARB */
+   { 21217, 0x0000873E }, /* GL_MODELVIEW30_ARB */
+   { 21236, 0x0000873F }, /* GL_MODELVIEW31_ARB */
+   { 21255, 0x00008723 }, /* GL_MODELVIEW3_ARB */
+   { 21273, 0x00008724 }, /* GL_MODELVIEW4_ARB */
+   { 21291, 0x00008725 }, /* GL_MODELVIEW5_ARB */
+   { 21309, 0x00008726 }, /* GL_MODELVIEW6_ARB */
+   { 21327, 0x00008727 }, /* GL_MODELVIEW7_ARB */
+   { 21345, 0x00008728 }, /* GL_MODELVIEW8_ARB */
+   { 21363, 0x00008729 }, /* GL_MODELVIEW9_ARB */
+   { 21381, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
+   { 21401, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
+   { 21428, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
+   { 21453, 0x00002100 }, /* GL_MODULATE */
+   { 21465, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
+   { 21485, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
+   { 21512, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
+   { 21537, 0x00000103 }, /* GL_MULT */
+   { 21545, 0x0000809D }, /* GL_MULTISAMPLE */
+   { 21560, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
+   { 21580, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
+   { 21599, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
+   { 21618, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
+   { 21642, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
+   { 21665, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+   { 21695, 0x00002A25 }, /* GL_N3F_V3F */
+   { 21706, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
+   { 21726, 0x0000150E }, /* GL_NAND */
+   { 21734, 0x00002600 }, /* GL_NEAREST */
+   { 21745, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+   { 21776, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+   { 21808, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
+   { 21833, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
+   { 21859, 0x00000200 }, /* GL_NEVER */
+   { 21868, 0x00001102 }, /* GL_NICEST */
+   { 21878, 0x00000000 }, /* GL_NONE */
+   { 21886, 0x00001505 }, /* GL_NOOP */
+   { 21894, 0x00001508 }, /* GL_NOR */
+   { 21901, 0x00000BA1 }, /* GL_NORMALIZE */
+   { 21914, 0x00008075 }, /* GL_NORMAL_ARRAY */
+   { 21930, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+   { 21961, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
+   { 21996, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
+   { 22020, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
+   { 22043, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
+   { 22064, 0x00008511 }, /* GL_NORMAL_MAP */
+   { 22078, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
+   { 22096, 0x00008511 }, /* GL_NORMAL_MAP_NV */
+   { 22113, 0x00000205 }, /* GL_NOTEQUAL */
+   { 22125, 0x00000000 }, /* GL_NO_ERROR */
+   { 22137, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+   { 22171, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
+   { 22209, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
+   { 22241, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
+   { 22283, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
+   { 22313, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
+   { 22353, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
+   { 22384, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
+   { 22413, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
+   { 22441, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
+   { 22471, 0x00002401 }, /* GL_OBJECT_LINEAR */
+   { 22488, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
+   { 22514, 0x00002501 }, /* GL_OBJECT_PLANE */
+   { 22530, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
+   { 22565, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
+   { 22587, 0x00009112 }, /* GL_OBJECT_TYPE */
+   { 22602, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
+   { 22621, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
+   { 22651, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
+   { 22672, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
+   { 22700, 0x00000001 }, /* GL_ONE */
+   { 22707, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+   { 22735, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
+   { 22767, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
+   { 22795, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
+   { 22827, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
+   { 22850, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
+   { 22873, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
+   { 22896, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
+   { 22919, 0x00008598 }, /* GL_OPERAND0_ALPHA */
+   { 22937, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
+   { 22959, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
+   { 22981, 0x00008590 }, /* GL_OPERAND0_RGB */
+   { 22997, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
+   { 23017, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
+   { 23037, 0x00008599 }, /* GL_OPERAND1_ALPHA */
+   { 23055, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
+   { 23077, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
+   { 23099, 0x00008591 }, /* GL_OPERAND1_RGB */
+   { 23115, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
+   { 23135, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
+   { 23155, 0x0000859A }, /* GL_OPERAND2_ALPHA */
+   { 23173, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
+   { 23195, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
+   { 23217, 0x00008592 }, /* GL_OPERAND2_RGB */
+   { 23233, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
+   { 23253, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
+   { 23273, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
+   { 23294, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
+   { 23313, 0x00001507 }, /* GL_OR */
+   { 23319, 0x00000A01 }, /* GL_ORDER */
+   { 23328, 0x0000150D }, /* GL_OR_INVERTED */
+   { 23343, 0x0000150B }, /* GL_OR_REVERSE */
+   { 23357, 0x00000505 }, /* GL_OUT_OF_MEMORY */
+   { 23374, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
+   { 23392, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
+   { 23413, 0x00008758 }, /* GL_PACK_INVERT_MESA */
+   { 23433, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
+   { 23451, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
+   { 23470, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
+   { 23490, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
+   { 23510, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
+   { 23528, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
+   { 23547, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
+   { 23572, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
+   { 23596, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
+   { 23617, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
+   { 23639, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
+   { 23661, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
+   { 23686, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
+   { 23710, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
+   { 23731, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
+   { 23753, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
+   { 23775, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
+   { 23797, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
+   { 23828, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
+   { 23848, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+   { 23873, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
+   { 23893, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+   { 23918, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
+   { 23938, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+   { 23963, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
+   { 23983, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+   { 24008, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
+   { 24028, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+   { 24053, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
+   { 24073, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+   { 24098, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
+   { 24118, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+   { 24143, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
+   { 24163, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+   { 24188, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
+   { 24208, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+   { 24233, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
+   { 24253, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+   { 24278, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
+   { 24296, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
+   { 24317, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
+   { 24346, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
+   { 24379, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
+   { 24404, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
+   { 24427, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+   { 24458, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
+   { 24493, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
+   { 24520, 0x00001B00 }, /* GL_POINT */
+   { 24529, 0x00000000 }, /* GL_POINTS */
+   { 24539, 0x00000002 }, /* GL_POINT_BIT */
+   { 24552, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
+   { 24582, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
+   { 24616, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
+   { 24650, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
+   { 24685, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
+   { 24714, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
+   { 24747, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
+   { 24780, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
+   { 24814, 0x00000B11 }, /* GL_POINT_SIZE */
+   { 24828, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
+   { 24854, 0x00008127 }, /* GL_POINT_SIZE_MAX */
+   { 24872, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
+   { 24894, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
+   { 24916, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
+   { 24939, 0x00008126 }, /* GL_POINT_SIZE_MIN */
+   { 24957, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
+   { 24979, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
+   { 25001, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
+   { 25024, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
+   { 25044, 0x00000B10 }, /* GL_POINT_SMOOTH */
+   { 25060, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
+   { 25081, 0x00008861 }, /* GL_POINT_SPRITE */
+   { 25097, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
+   { 25117, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
+   { 25146, 0x00008861 }, /* GL_POINT_SPRITE_NV */
+   { 25165, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
+   { 25191, 0x00000701 }, /* GL_POINT_TOKEN */
+   { 25206, 0x00000009 }, /* GL_POLYGON */
+   { 25217, 0x00000008 }, /* GL_POLYGON_BIT */
+   { 25232, 0x00000B40 }, /* GL_POLYGON_MODE */
+   { 25248, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
+   { 25271, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
+   { 25296, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
+   { 25319, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
+   { 25342, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
+   { 25366, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
+   { 25390, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
+   { 25408, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
+   { 25431, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
+   { 25450, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
+   { 25473, 0x00000703 }, /* GL_POLYGON_TOKEN */
+   { 25490, 0x00001203 }, /* GL_POSITION */
+   { 25502, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+   { 25534, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
+   { 25570, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+   { 25603, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
+   { 25640, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+   { 25671, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
+   { 25706, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+   { 25738, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
+   { 25774, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 25807, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+   { 25839, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
+   { 25875, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+   { 25908, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
+   { 25945, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+   { 25975, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
+   { 26009, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+   { 26040, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
+   { 26075, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+   { 26106, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
+   { 26141, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+   { 26173, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
+   { 26209, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+   { 26239, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
+   { 26273, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+   { 26304, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
+   { 26339, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+   { 26371, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+   { 26402, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
+   { 26437, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+   { 26469, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
+   { 26505, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
+   { 26534, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
+   { 26567, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
+   { 26597, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
+   { 26631, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+   { 26670, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+   { 26703, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+   { 26743, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+   { 26777, 0x00008578 }, /* GL_PREVIOUS */
+   { 26789, 0x00008578 }, /* GL_PREVIOUS_ARB */
+   { 26805, 0x00008578 }, /* GL_PREVIOUS_EXT */
+   { 26821, 0x00008577 }, /* GL_PRIMARY_COLOR */
+   { 26838, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
+   { 26859, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
+   { 26880, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 26913, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 26945, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
+   { 26968, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
+   { 26991, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
+   { 27021, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
+   { 27050, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
+   { 27078, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
+   { 27100, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+   { 27128, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+   { 27156, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
+   { 27178, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
+   { 27199, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 27239, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 27278, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 27308, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 27343, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 27376, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 27410, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 27449, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 27488, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
+   { 27510, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
+   { 27536, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
+   { 27560, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
+   { 27583, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
+   { 27605, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
+   { 27626, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
+   { 27647, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
+   { 27674, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 27706, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 27738, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+   { 27773, 0x00001701 }, /* GL_PROJECTION */
+   { 27787, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
+   { 27808, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
+   { 27834, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
+   { 27854, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
+   { 27878, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
+   { 27899, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
+   { 27918, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
+   { 27941, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 27980, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+   { 28018, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
+   { 28038, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+   { 28068, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
+   { 28092, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
+   { 28112, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+   { 28142, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
+   { 28166, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
+   { 28186, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+   { 28219, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
+   { 28245, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
+   { 28275, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+   { 28306, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
+   { 28336, 0x00002003 }, /* GL_Q */
+   { 28341, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
+   { 28366, 0x00000007 }, /* GL_QUADS */
+   { 28375, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+   { 28419, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
+   { 28467, 0x00008614 }, /* GL_QUAD_MESH_SUN */
+   { 28484, 0x00000008 }, /* GL_QUAD_STRIP */
+   { 28498, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
+   { 28520, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
+   { 28546, 0x00008866 }, /* GL_QUERY_RESULT */
+   { 28562, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
+   { 28582, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
+   { 28608, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
+   { 28638, 0x00002002 }, /* GL_R */
+   { 28643, 0x00002A10 }, /* GL_R3_G3_B2 */
+   { 28655, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+   { 28688, 0x00000C02 }, /* GL_READ_BUFFER */
+   { 28703, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
+   { 28723, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
+   { 28751, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+   { 28783, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
+   { 28807, 0x000088B8 }, /* GL_READ_ONLY */
+   { 28820, 0x000088B8 }, /* GL_READ_ONLY_ARB */
+   { 28837, 0x000088BA }, /* GL_READ_WRITE */
+   { 28851, 0x000088BA }, /* GL_READ_WRITE_ARB */
+   { 28869, 0x00001903 }, /* GL_RED */
+   { 28876, 0x00008016 }, /* GL_REDUCE */
+   { 28886, 0x00008016 }, /* GL_REDUCE_EXT */
+   { 28900, 0x00000D15 }, /* GL_RED_BIAS */
+   { 28912, 0x00000D52 }, /* GL_RED_BITS */
+   { 28924, 0x00000D14 }, /* GL_RED_SCALE */
+   { 28937, 0x00008512 }, /* GL_REFLECTION_MAP */
+   { 28955, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
+   { 28977, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
+   { 28998, 0x00001C00 }, /* GL_RENDER */
+   { 29008, 0x00008D41 }, /* GL_RENDERBUFFER */
+   { 29024, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
+   { 29051, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
+   { 29075, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
+   { 29103, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
+   { 29129, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
+   { 29156, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
+   { 29176, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
+   { 29203, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
+   { 29226, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
+   { 29253, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+   { 29285, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
+   { 29321, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
+   { 29346, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
+   { 29370, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
+   { 29398, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
+   { 29427, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
+   { 29449, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
+   { 29475, 0x00001F01 }, /* GL_RENDERER */
+   { 29487, 0x00000C40 }, /* GL_RENDER_MODE */
+   { 29502, 0x00002901 }, /* GL_REPEAT */
+   { 29512, 0x00001E01 }, /* GL_REPLACE */
+   { 29523, 0x00008062 }, /* GL_REPLACE_EXT */
+   { 29538, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
+   { 29561, 0x0000803A }, /* GL_RESCALE_NORMAL */
+   { 29579, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
+   { 29601, 0x00000102 }, /* GL_RETURN */
+   { 29611, 0x00001907 }, /* GL_RGB */
+   { 29618, 0x00008052 }, /* GL_RGB10 */
+   { 29627, 0x00008059 }, /* GL_RGB10_A2 */
+   { 29639, 0x00008059 }, /* GL_RGB10_A2_EXT */
+   { 29655, 0x00008052 }, /* GL_RGB10_EXT */
+   { 29668, 0x00008053 }, /* GL_RGB12 */
+   { 29677, 0x00008053 }, /* GL_RGB12_EXT */
+   { 29690, 0x00008054 }, /* GL_RGB16 */
+   { 29699, 0x00008054 }, /* GL_RGB16_EXT */
+   { 29712, 0x0000804E }, /* GL_RGB2_EXT */
+   { 29724, 0x0000804F }, /* GL_RGB4 */
+   { 29732, 0x0000804F }, /* GL_RGB4_EXT */
+   { 29744, 0x000083A1 }, /* GL_RGB4_S3TC */
+   { 29757, 0x00008050 }, /* GL_RGB5 */
+   { 29765, 0x00008057 }, /* GL_RGB5_A1 */
+   { 29776, 0x00008057 }, /* GL_RGB5_A1_EXT */
+   { 29791, 0x00008050 }, /* GL_RGB5_EXT */
+   { 29803, 0x00008051 }, /* GL_RGB8 */
+   { 29811, 0x00008051 }, /* GL_RGB8_EXT */
+   { 29823, 0x00001908 }, /* GL_RGBA */
+   { 29831, 0x0000805A }, /* GL_RGBA12 */
+   { 29841, 0x0000805A }, /* GL_RGBA12_EXT */
+   { 29855, 0x0000805B }, /* GL_RGBA16 */
+   { 29865, 0x0000805B }, /* GL_RGBA16_EXT */
+   { 29879, 0x00008055 }, /* GL_RGBA2 */
+   { 29888, 0x00008055 }, /* GL_RGBA2_EXT */
+   { 29901, 0x00008056 }, /* GL_RGBA4 */
+   { 29910, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
+   { 29929, 0x00008056 }, /* GL_RGBA4_EXT */
+   { 29942, 0x000083A3 }, /* GL_RGBA4_S3TC */
+   { 29956, 0x00008058 }, /* GL_RGBA8 */
+   { 29965, 0x00008058 }, /* GL_RGBA8_EXT */
+   { 29978, 0x00008F97 }, /* GL_RGBA8_SNORM */
+   { 29993, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
+   { 30011, 0x00000C31 }, /* GL_RGBA_MODE */
+   { 30024, 0x000083A2 }, /* GL_RGBA_S3TC */
+   { 30037, 0x00008F93 }, /* GL_RGBA_SNORM */
+   { 30051, 0x000083A0 }, /* GL_RGB_S3TC */
+   { 30063, 0x00008573 }, /* GL_RGB_SCALE */
+   { 30076, 0x00008573 }, /* GL_RGB_SCALE_ARB */
+   { 30093, 0x00008573 }, /* GL_RGB_SCALE_EXT */
+   { 30110, 0x00000407 }, /* GL_RIGHT */
+   { 30119, 0x00002000 }, /* GL_S */
+   { 30124, 0x00008B5D }, /* GL_SAMPLER_1D */
+   { 30138, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
+   { 30159, 0x00008B5E }, /* GL_SAMPLER_2D */
+   { 30173, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
+   { 30194, 0x00008B5F }, /* GL_SAMPLER_3D */
+   { 30208, 0x00008B60 }, /* GL_SAMPLER_CUBE */
+   { 30224, 0x000080A9 }, /* GL_SAMPLES */
+   { 30235, 0x000086B4 }, /* GL_SAMPLES_3DFX */
+   { 30251, 0x000080A9 }, /* GL_SAMPLES_ARB */
+   { 30266, 0x00008914 }, /* GL_SAMPLES_PASSED */
+   { 30284, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
+   { 30306, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+   { 30334, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
+   { 30366, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
+   { 30389, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
+   { 30416, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
+   { 30434, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
+   { 30457, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
+   { 30479, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
+   { 30498, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
+   { 30521, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
+   { 30547, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
+   { 30577, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
+   { 30602, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
+   { 30631, 0x00080000 }, /* GL_SCISSOR_BIT */
+   { 30646, 0x00000C10 }, /* GL_SCISSOR_BOX */
+   { 30661, 0x00000C11 }, /* GL_SCISSOR_TEST */
+   { 30677, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
+   { 30702, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+   { 30742, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
+   { 30786, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+   { 30819, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+   { 30849, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+   { 30881, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+   { 30911, 0x00001C02 }, /* GL_SELECT */
+   { 30921, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
+   { 30949, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
+   { 30974, 0x00008012 }, /* GL_SEPARABLE_2D */
+   { 30990, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
+   { 31017, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
+   { 31048, 0x0000150F }, /* GL_SET */
+   { 31055, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
+   { 31076, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
+   { 31100, 0x00008B4F }, /* GL_SHADER_TYPE */
+   { 31115, 0x00000B54 }, /* GL_SHADE_MODEL */
+   { 31130, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
+   { 31158, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
+   { 31181, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+   { 31211, 0x00001601 }, /* GL_SHININESS */
+   { 31224, 0x00001402 }, /* GL_SHORT */
+   { 31233, 0x00009119 }, /* GL_SIGNALED */
+   { 31245, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
+   { 31266, 0x000081F9 }, /* GL_SINGLE_COLOR */
+   { 31282, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
+   { 31302, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
+   { 31321, 0x00008C46 }, /* GL_SLUMINANCE */
+   { 31335, 0x00008C47 }, /* GL_SLUMINANCE8 */
+   { 31350, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
+   { 31372, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
+   { 31392, 0x00001D01 }, /* GL_SMOOTH */
+   { 31402, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
+   { 31435, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
+   { 31462, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
+   { 31495, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
+   { 31522, 0x00008588 }, /* GL_SOURCE0_ALPHA */
+   { 31539, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
+   { 31560, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
+   { 31581, 0x00008580 }, /* GL_SOURCE0_RGB */
+   { 31596, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
+   { 31615, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
+   { 31634, 0x00008589 }, /* GL_SOURCE1_ALPHA */
+   { 31651, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
+   { 31672, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
+   { 31693, 0x00008581 }, /* GL_SOURCE1_RGB */
+   { 31708, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
+   { 31727, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
+   { 31746, 0x0000858A }, /* GL_SOURCE2_ALPHA */
+   { 31763, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
+   { 31784, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
+   { 31805, 0x00008582 }, /* GL_SOURCE2_RGB */
+   { 31820, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
+   { 31839, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
+   { 31858, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
+   { 31878, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
+   { 31896, 0x00001202 }, /* GL_SPECULAR */
+   { 31908, 0x00002402 }, /* GL_SPHERE_MAP */
+   { 31922, 0x00001206 }, /* GL_SPOT_CUTOFF */
+   { 31937, 0x00001204 }, /* GL_SPOT_DIRECTION */
+   { 31955, 0x00001205 }, /* GL_SPOT_EXPONENT */
+   { 31972, 0x00008588 }, /* GL_SRC0_ALPHA */
+   { 31986, 0x00008580 }, /* GL_SRC0_RGB */
+   { 31998, 0x00008589 }, /* GL_SRC1_ALPHA */
+   { 32012, 0x00008581 }, /* GL_SRC1_RGB */
+   { 32024, 0x0000858A }, /* GL_SRC2_ALPHA */
+   { 32038, 0x00008582 }, /* GL_SRC2_RGB */
+   { 32050, 0x00000302 }, /* GL_SRC_ALPHA */
+   { 32063, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
+   { 32085, 0x00000300 }, /* GL_SRC_COLOR */
+   { 32098, 0x00008C40 }, /* GL_SRGB */
+   { 32106, 0x00008C41 }, /* GL_SRGB8 */
+   { 32115, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
+   { 32131, 0x00008C42 }, /* GL_SRGB_ALPHA */
+   { 32145, 0x00000503 }, /* GL_STACK_OVERFLOW */
+   { 32163, 0x00000504 }, /* GL_STACK_UNDERFLOW */
+   { 32182, 0x000088E6 }, /* GL_STATIC_COPY */
+   { 32197, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
+   { 32216, 0x000088E4 }, /* GL_STATIC_DRAW */
+   { 32231, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
+   { 32250, 0x000088E5 }, /* GL_STATIC_READ */
+   { 32265, 0x000088E5 }, /* GL_STATIC_READ_ARB */
+   { 32284, 0x00001802 }, /* GL_STENCIL */
+   { 32295, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
+   { 32317, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
+   { 32343, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
+   { 32364, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
+   { 32389, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
+   { 32410, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
+   { 32435, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+   { 32467, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
+   { 32503, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+   { 32535, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
+   { 32571, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
+   { 32591, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
+   { 32618, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
+   { 32644, 0x00000D57 }, /* GL_STENCIL_BITS */
+   { 32660, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
+   { 32682, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
+   { 32705, 0x00000B94 }, /* GL_STENCIL_FAIL */
+   { 32721, 0x00000B92 }, /* GL_STENCIL_FUNC */
+   { 32737, 0x00001901 }, /* GL_STENCIL_INDEX */
+   { 32754, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
+   { 32772, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
+   { 32791, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
+   { 32814, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
+   { 32836, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
+   { 32854, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
+   { 32876, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
+   { 32894, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
+   { 32916, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
+   { 32937, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
+   { 32964, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
+   { 32991, 0x00000B97 }, /* GL_STENCIL_REF */
+   { 33006, 0x00000B90 }, /* GL_STENCIL_TEST */
+   { 33022, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+   { 33051, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
+   { 33073, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
+   { 33094, 0x00000C33 }, /* GL_STEREO */
+   { 33104, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
+   { 33128, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
+   { 33153, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
+   { 33177, 0x000088E2 }, /* GL_STREAM_COPY */
+   { 33192, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
+   { 33211, 0x000088E0 }, /* GL_STREAM_DRAW */
+   { 33226, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
+   { 33245, 0x000088E1 }, /* GL_STREAM_READ */
+   { 33260, 0x000088E1 }, /* GL_STREAM_READ_ARB */
+   { 33279, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
+   { 33296, 0x000084E7 }, /* GL_SUBTRACT */
+   { 33308, 0x000084E7 }, /* GL_SUBTRACT_ARB */
+   { 33324, 0x00009113 }, /* GL_SYNC_CONDITION */
+   { 33342, 0x00009116 }, /* GL_SYNC_FENCE */
+   { 33356, 0x00009115 }, /* GL_SYNC_FLAGS */
+   { 33370, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
+   { 33397, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+   { 33427, 0x00009114 }, /* GL_SYNC_STATUS */
+   { 33442, 0x00002001 }, /* GL_T */
+   { 33447, 0x00002A2A }, /* GL_T2F_C3F_V3F */
+   { 33462, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
+   { 33481, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
+   { 33497, 0x00002A2B }, /* GL_T2F_N3F_V3F */
+   { 33512, 0x00002A27 }, /* GL_T2F_V3F */
+   { 33523, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
+   { 33542, 0x00002A28 }, /* GL_T4F_V4F */
+   { 33553, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
+   { 33576, 0x00001702 }, /* GL_TEXTURE */
+   { 33587, 0x000084C0 }, /* GL_TEXTURE0 */
+   { 33599, 0x000084C0 }, /* GL_TEXTURE0_ARB */
+   { 33615, 0x000084C1 }, /* GL_TEXTURE1 */
+   { 33627, 0x000084CA }, /* GL_TEXTURE10 */
+   { 33640, 0x000084CA }, /* GL_TEXTURE10_ARB */
+   { 33657, 0x000084CB }, /* GL_TEXTURE11 */
+   { 33670, 0x000084CB }, /* GL_TEXTURE11_ARB */
+   { 33687, 0x000084CC }, /* GL_TEXTURE12 */
+   { 33700, 0x000084CC }, /* GL_TEXTURE12_ARB */
+   { 33717, 0x000084CD }, /* GL_TEXTURE13 */
+   { 33730, 0x000084CD }, /* GL_TEXTURE13_ARB */
+   { 33747, 0x000084CE }, /* GL_TEXTURE14 */
+   { 33760, 0x000084CE }, /* GL_TEXTURE14_ARB */
+   { 33777, 0x000084CF }, /* GL_TEXTURE15 */
+   { 33790, 0x000084CF }, /* GL_TEXTURE15_ARB */
+   { 33807, 0x000084D0 }, /* GL_TEXTURE16 */
+   { 33820, 0x000084D0 }, /* GL_TEXTURE16_ARB */
+   { 33837, 0x000084D1 }, /* GL_TEXTURE17 */
+   { 33850, 0x000084D1 }, /* GL_TEXTURE17_ARB */
+   { 33867, 0x000084D2 }, /* GL_TEXTURE18 */
+   { 33880, 0x000084D2 }, /* GL_TEXTURE18_ARB */
+   { 33897, 0x000084D3 }, /* GL_TEXTURE19 */
+   { 33910, 0x000084D3 }, /* GL_TEXTURE19_ARB */
+   { 33927, 0x000084C1 }, /* GL_TEXTURE1_ARB */
+   { 33943, 0x000084C2 }, /* GL_TEXTURE2 */
+   { 33955, 0x000084D4 }, /* GL_TEXTURE20 */
+   { 33968, 0x000084D4 }, /* GL_TEXTURE20_ARB */
+   { 33985, 0x000084D5 }, /* GL_TEXTURE21 */
+   { 33998, 0x000084D5 }, /* GL_TEXTURE21_ARB */
+   { 34015, 0x000084D6 }, /* GL_TEXTURE22 */
+   { 34028, 0x000084D6 }, /* GL_TEXTURE22_ARB */
+   { 34045, 0x000084D7 }, /* GL_TEXTURE23 */
+   { 34058, 0x000084D7 }, /* GL_TEXTURE23_ARB */
+   { 34075, 0x000084D8 }, /* GL_TEXTURE24 */
+   { 34088, 0x000084D8 }, /* GL_TEXTURE24_ARB */
+   { 34105, 0x000084D9 }, /* GL_TEXTURE25 */
+   { 34118, 0x000084D9 }, /* GL_TEXTURE25_ARB */
+   { 34135, 0x000084DA }, /* GL_TEXTURE26 */
+   { 34148, 0x000084DA }, /* GL_TEXTURE26_ARB */
+   { 34165, 0x000084DB }, /* GL_TEXTURE27 */
+   { 34178, 0x000084DB }, /* GL_TEXTURE27_ARB */
+   { 34195, 0x000084DC }, /* GL_TEXTURE28 */
+   { 34208, 0x000084DC }, /* GL_TEXTURE28_ARB */
+   { 34225, 0x000084DD }, /* GL_TEXTURE29 */
+   { 34238, 0x000084DD }, /* GL_TEXTURE29_ARB */
+   { 34255, 0x000084C2 }, /* GL_TEXTURE2_ARB */
+   { 34271, 0x000084C3 }, /* GL_TEXTURE3 */
+   { 34283, 0x000084DE }, /* GL_TEXTURE30 */
+   { 34296, 0x000084DE }, /* GL_TEXTURE30_ARB */
+   { 34313, 0x000084DF }, /* GL_TEXTURE31 */
+   { 34326, 0x000084DF }, /* GL_TEXTURE31_ARB */
+   { 34343, 0x000084C3 }, /* GL_TEXTURE3_ARB */
+   { 34359, 0x000084C4 }, /* GL_TEXTURE4 */
+   { 34371, 0x000084C4 }, /* GL_TEXTURE4_ARB */
+   { 34387, 0x000084C5 }, /* GL_TEXTURE5 */
+   { 34399, 0x000084C5 }, /* GL_TEXTURE5_ARB */
+   { 34415, 0x000084C6 }, /* GL_TEXTURE6 */
+   { 34427, 0x000084C6 }, /* GL_TEXTURE6_ARB */
+   { 34443, 0x000084C7 }, /* GL_TEXTURE7 */
+   { 34455, 0x000084C7 }, /* GL_TEXTURE7_ARB */
+   { 34471, 0x000084C8 }, /* GL_TEXTURE8 */
+   { 34483, 0x000084C8 }, /* GL_TEXTURE8_ARB */
+   { 34499, 0x000084C9 }, /* GL_TEXTURE9 */
+   { 34511, 0x000084C9 }, /* GL_TEXTURE9_ARB */
+   { 34527, 0x00000DE0 }, /* GL_TEXTURE_1D */
+   { 34541, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
+   { 34565, 0x00000DE1 }, /* GL_TEXTURE_2D */
+   { 34579, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
+   { 34603, 0x0000806F }, /* GL_TEXTURE_3D */
+   { 34617, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
+   { 34639, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
+   { 34665, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
+   { 34687, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
+   { 34709, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+   { 34741, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
+   { 34763, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+   { 34795, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
+   { 34817, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
+   { 34845, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
+   { 34877, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+   { 34910, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
+   { 34942, 0x00040000 }, /* GL_TEXTURE_BIT */
+   { 34957, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
+   { 34978, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
+   { 35003, 0x00001005 }, /* GL_TEXTURE_BORDER */
+   { 35021, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
+   { 35045, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+   { 35076, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+   { 35106, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+   { 35136, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+   { 35171, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+   { 35202, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 35240, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
+   { 35267, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+   { 35299, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+   { 35333, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
+   { 35357, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
+   { 35385, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
+   { 35409, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
+   { 35437, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+   { 35470, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
+   { 35494, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
+   { 35516, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
+   { 35538, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
+   { 35564, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
+   { 35598, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+   { 35631, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
+   { 35668, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
+   { 35696, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
+   { 35728, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
+   { 35751, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+   { 35789, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
+   { 35831, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+   { 35862, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+   { 35890, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+   { 35920, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+   { 35948, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
+   { 35968, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
+   { 35992, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+   { 36023, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
+   { 36058, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+   { 36089, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
+   { 36124, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+   { 36155, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
+   { 36190, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+   { 36221, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
+   { 36256, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+   { 36287, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
+   { 36322, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+   { 36353, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
+   { 36388, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+   { 36417, 0x00008071 }, /* GL_TEXTURE_DEPTH */
+   { 36434, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
+   { 36456, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
+   { 36482, 0x00002300 }, /* GL_TEXTURE_ENV */
+   { 36497, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
+   { 36518, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
+   { 36538, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
+   { 36564, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
+   { 36584, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
+   { 36601, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
+   { 36618, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
+   { 36635, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
+   { 36652, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
+   { 36677, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
+   { 36699, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
+   { 36725, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
+   { 36743, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
+   { 36769, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
+   { 36795, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
+   { 36825, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
+   { 36852, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
+   { 36877, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
+   { 36897, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
+   { 36921, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+   { 36948, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+   { 36975, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+   { 37002, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
+   { 37028, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
+   { 37058, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
+   { 37080, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
+   { 37098, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 37128, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+   { 37156, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+   { 37184, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+   { 37212, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
+   { 37233, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
+   { 37252, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
+   { 37274, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
+   { 37293, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
+   { 37313, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+   { 37343, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+   { 37374, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
+   { 37399, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
+   { 37423, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
+   { 37443, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
+   { 37467, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
+   { 37487, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
+   { 37510, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
+   { 37534, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
+   { 37562, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+   { 37592, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
+   { 37617, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+   { 37651, 0x00001000 }, /* GL_TEXTURE_WIDTH */
+   { 37668, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
+   { 37686, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
+   { 37704, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
+   { 37722, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
+   { 37741, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */
+   { 37760, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
+   { 37780, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
+   { 37799, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+   { 37828, 0x00001000 }, /* GL_TRANSFORM_BIT */
+   { 37845, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
+   { 37871, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
+   { 37901, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+   { 37933, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+   { 37963, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
+   { 37997, 0x0000862C }, /* GL_TRANSPOSE_NV */
+   { 38013, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+   { 38044, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
+   { 38079, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+   { 38107, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
+   { 38139, 0x00000004 }, /* GL_TRIANGLES */
+   { 38152, 0x00000006 }, /* GL_TRIANGLE_FAN */
+   { 38168, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
+   { 38189, 0x00000005 }, /* GL_TRIANGLE_STRIP */
+   { 38207, 0x00000001 }, /* GL_TRUE */
+   { 38215, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
+   { 38235, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
+   { 38258, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
+   { 38278, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
+   { 38299, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
+   { 38321, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
+   { 38343, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
+   { 38363, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
+   { 38384, 0x00009118 }, /* GL_UNSIGNALED */
+   { 38398, 0x00001401 }, /* GL_UNSIGNED_BYTE */
+   { 38415, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+   { 38442, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
+   { 38465, 0x00001405 }, /* GL_UNSIGNED_INT */
+   { 38481, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
+   { 38508, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
+   { 38529, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
+   { 38554, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
+   { 38578, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+   { 38609, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
+   { 38633, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+   { 38661, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
+   { 38684, 0x00001403 }, /* GL_UNSIGNED_SHORT */
+   { 38702, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+   { 38732, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+   { 38758, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+   { 38788, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+   { 38814, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
+   { 38838, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+   { 38866, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+   { 38894, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
+   { 38921, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+   { 38953, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
+   { 38984, 0x00008CA2 }, /* GL_UPPER_LEFT */
+   { 38998, 0x00002A20 }, /* GL_V2F */
+   { 39005, 0x00002A21 }, /* GL_V3F */
+   { 39012, 0x00008B83 }, /* GL_VALIDATE_STATUS */
+   { 39031, 0x00001F00 }, /* GL_VENDOR */
+   { 39041, 0x00001F02 }, /* GL_VERSION */
+   { 39052, 0x00008074 }, /* GL_VERTEX_ARRAY */
+   { 39068, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
+   { 39092, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+   { 39122, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+   { 39153, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
+   { 39188, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
+   { 39212, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
+   { 39233, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
+   { 39256, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
+   { 39277, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+   { 39304, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+   { 39332, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+   { 39360, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+   { 39388, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+   { 39416, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+   { 39444, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+   { 39472, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+   { 39499, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+   { 39526, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+   { 39553, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+   { 39580, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+   { 39607, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+   { 39634, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+   { 39661, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+   { 39688, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+   { 39715, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+   { 39753, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
+   { 39795, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+   { 39826, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
+   { 39861, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+   { 39895, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
+   { 39933, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+   { 39964, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
+   { 39999, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+   { 40027, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
+   { 40059, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+   { 40089, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
+   { 40123, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+   { 40151, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
+   { 40183, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
+   { 40203, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
+   { 40225, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
+   { 40254, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
+   { 40275, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+   { 40304, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
+   { 40337, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+   { 40369, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+   { 40396, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
+   { 40427, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+   { 40457, 0x00008B31 }, /* GL_VERTEX_SHADER */
+   { 40474, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
+   { 40495, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
+   { 40522, 0x00000BA2 }, /* GL_VIEWPORT */
+   { 40534, 0x00000800 }, /* GL_VIEWPORT_BIT */
+   { 40550, 0x0000911D }, /* GL_WAIT_FAILED */
+   { 40565, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
+   { 40585, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+   { 40616, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
+   { 40651, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+   { 40679, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+   { 40704, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+   { 40731, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+   { 40756, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
+   { 40780, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
+   { 40799, 0x000088B9 }, /* GL_WRITE_ONLY */
+   { 40813, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
+   { 40831, 0x00001506 }, /* GL_XOR */
+   { 40838, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
+   { 40857, 0x00008757 }, /* GL_YCBCR_MESA */
+   { 40871, 0x00000000 }, /* GL_ZERO */
+   { 40879, 0x00000D16 }, /* GL_ZOOM_X */
+   { 40889, 0x00000D17 }, /* GL_ZOOM_Y */
 };
 
 static const unsigned reduced_enums[1347] =
 {
-       475, /* GL_FALSE */
-       691, /* GL_LINES */
-       693, /* GL_LINE_LOOP */
-       700, /* GL_LINE_STRIP */
-      1743, /* GL_TRIANGLES */
-      1746, /* GL_TRIANGLE_STRIP */
-      1744, /* GL_TRIANGLE_FAN */
-      1271, /* GL_QUADS */
-      1274, /* GL_QUAD_STRIP */
-      1158, /* GL_POLYGON */
-      1170, /* GL_POLYGON_STIPPLE_BIT */
-      1119, /* GL_PIXEL_MODE_BIT */
-       678, /* GL_LIGHTING_BIT */
-       504, /* GL_FOG_BIT */
+       479, /* GL_FALSE */
+       701, /* GL_LINES */
+       703, /* GL_LINE_LOOP */
+       710, /* GL_LINE_STRIP */
+      1766, /* GL_TRIANGLES */
+      1769, /* GL_TRIANGLE_STRIP */
+      1767, /* GL_TRIANGLE_FAN */
+      1285, /* GL_QUADS */
+      1289, /* GL_QUAD_STRIP */
+      1171, /* GL_POLYGON */
+      1183, /* GL_POLYGON_STIPPLE_BIT */
+      1132, /* GL_PIXEL_MODE_BIT */
+       688, /* GL_LIGHTING_BIT */
+       509, /* GL_FOG_BIT */
          8, /* GL_ACCUM */
-       710, /* GL_LOAD */
-      1326, /* GL_RETURN */
-       991, /* GL_MULT */
+       720, /* GL_LOAD */
+      1344, /* GL_RETURN */
+      1004, /* GL_MULT */
         23, /* GL_ADD */
-      1007, /* GL_NEVER */
-       668, /* GL_LESS */
-       465, /* GL_EQUAL */
-       667, /* GL_LEQUAL */
-       590, /* GL_GREATER */
-      1022, /* GL_NOTEQUAL */
-       589, /* GL_GEQUAL */
+      1020, /* GL_NEVER */
+       678, /* GL_LESS */
+       469, /* GL_EQUAL */
+       677, /* GL_LEQUAL */
+       599, /* GL_GREATER */
+      1035, /* GL_NOTEQUAL */
+       598, /* GL_GEQUAL */
         47, /* GL_ALWAYS */
-      1467, /* GL_SRC_COLOR */
-      1052, /* GL_ONE_MINUS_SRC_COLOR */
-      1465, /* GL_SRC_ALPHA */
-      1051, /* GL_ONE_MINUS_SRC_ALPHA */
-       444, /* GL_DST_ALPHA */
-      1049, /* GL_ONE_MINUS_DST_ALPHA */
-       445, /* GL_DST_COLOR */
-      1050, /* GL_ONE_MINUS_DST_COLOR */
-      1466, /* GL_SRC_ALPHA_SATURATE */
-       577, /* GL_FRONT_LEFT */
-       578, /* GL_FRONT_RIGHT */
+      1485, /* GL_SRC_COLOR */
+      1065, /* GL_ONE_MINUS_SRC_COLOR */
+      1483, /* GL_SRC_ALPHA */
+      1064, /* GL_ONE_MINUS_SRC_ALPHA */
+       448, /* GL_DST_ALPHA */
+      1062, /* GL_ONE_MINUS_DST_ALPHA */
+       449, /* GL_DST_COLOR */
+      1063, /* GL_ONE_MINUS_DST_COLOR */
+      1484, /* GL_SRC_ALPHA_SATURATE */
+       586, /* GL_FRONT_LEFT */
+       587, /* GL_FRONT_RIGHT */
         69, /* GL_BACK_LEFT */
         70, /* GL_BACK_RIGHT */
-       574, /* GL_FRONT */
+       583, /* GL_FRONT */
         68, /* GL_BACK */
-       666, /* GL_LEFT */
-      1368, /* GL_RIGHT */
-       575, /* GL_FRONT_AND_BACK */
+       676, /* GL_LEFT */
+      1386, /* GL_RIGHT */
+       584, /* GL_FRONT_AND_BACK */
         63, /* GL_AUX0 */
         64, /* GL_AUX1 */
         65, /* GL_AUX2 */
         66, /* GL_AUX3 */
-       656, /* GL_INVALID_ENUM */
-       660, /* GL_INVALID_VALUE */
-       659, /* GL_INVALID_OPERATION */
-      1472, /* GL_STACK_OVERFLOW */
-      1473, /* GL_STACK_UNDERFLOW */
-      1077, /* GL_OUT_OF_MEMORY */
-       657, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+       665, /* GL_INVALID_ENUM */
+       669, /* GL_INVALID_VALUE */
+       668, /* GL_INVALID_OPERATION */
+      1490, /* GL_STACK_OVERFLOW */
+      1491, /* GL_STACK_UNDERFLOW */
+      1090, /* GL_OUT_OF_MEMORY */
+       666, /* GL_INVALID_FRAMEBUFFER_OPERATION */
          0, /* GL_2D */
          2, /* GL_3D */
          3, /* GL_3D_COLOR */
          4, /* GL_3D_COLOR_TEXTURE */
          6, /* GL_4D_COLOR_TEXTURE */
-      1097, /* GL_PASS_THROUGH_TOKEN */
-      1157, /* GL_POINT_TOKEN */
-       701, /* GL_LINE_TOKEN */
-      1171, /* GL_POLYGON_TOKEN */
+      1110, /* GL_PASS_THROUGH_TOKEN */
+      1170, /* GL_POINT_TOKEN */
+       711, /* GL_LINE_TOKEN */
+      1184, /* GL_POLYGON_TOKEN */
         74, /* GL_BITMAP_TOKEN */
-       443, /* GL_DRAW_PIXEL_TOKEN */
+       447, /* GL_DRAW_PIXEL_TOKEN */
        301, /* GL_COPY_PIXEL_TOKEN */
-       694, /* GL_LINE_RESET_TOKEN */
-       468, /* GL_EXP */
-       469, /* GL_EXP2 */
+       704, /* GL_LINE_RESET_TOKEN */
+       472, /* GL_EXP */
+       473, /* GL_EXP2 */
        337, /* GL_CW */
        125, /* GL_CCW */
        146, /* GL_COEFF */
-      1074, /* GL_ORDER */
-       381, /* GL_DOMAIN */
+      1087, /* GL_ORDER */
+       384, /* GL_DOMAIN */
        311, /* GL_CURRENT_COLOR */
        314, /* GL_CURRENT_INDEX */
        320, /* GL_CURRENT_NORMAL */
@@ -3844,519 +3892,519 @@ static const unsigned reduced_enums[1347] =
        328, /* GL_CURRENT_RASTER_POSITION */
        329, /* GL_CURRENT_RASTER_POSITION_VALID */
        326, /* GL_CURRENT_RASTER_DISTANCE */
-      1150, /* GL_POINT_SMOOTH */
-      1139, /* GL_POINT_SIZE */
-      1149, /* GL_POINT_SIZE_RANGE */
-      1140, /* GL_POINT_SIZE_GRANULARITY */
-       695, /* GL_LINE_SMOOTH */
-       702, /* GL_LINE_WIDTH */
-       704, /* GL_LINE_WIDTH_RANGE */
-       703, /* GL_LINE_WIDTH_GRANULARITY */
-       697, /* GL_LINE_STIPPLE */
-       698, /* GL_LINE_STIPPLE_PATTERN */
-       699, /* GL_LINE_STIPPLE_REPEAT */
-       709, /* GL_LIST_MODE */
-       874, /* GL_MAX_LIST_NESTING */
-       706, /* GL_LIST_BASE */
-       708, /* GL_LIST_INDEX */
-      1160, /* GL_POLYGON_MODE */
-      1167, /* GL_POLYGON_SMOOTH */
-      1169, /* GL_POLYGON_STIPPLE */
-       454, /* GL_EDGE_FLAG */
+      1163, /* GL_POINT_SMOOTH */
+      1152, /* GL_POINT_SIZE */
+      1162, /* GL_POINT_SIZE_RANGE */
+      1153, /* GL_POINT_SIZE_GRANULARITY */
+       705, /* GL_LINE_SMOOTH */
+       712, /* GL_LINE_WIDTH */
+       714, /* GL_LINE_WIDTH_RANGE */
+       713, /* GL_LINE_WIDTH_GRANULARITY */
+       707, /* GL_LINE_STIPPLE */
+       708, /* GL_LINE_STIPPLE_PATTERN */
+       709, /* GL_LINE_STIPPLE_REPEAT */
+       719, /* GL_LIST_MODE */
+       885, /* GL_MAX_LIST_NESTING */
+       716, /* GL_LIST_BASE */
+       718, /* GL_LIST_INDEX */
+      1173, /* GL_POLYGON_MODE */
+      1180, /* GL_POLYGON_SMOOTH */
+      1182, /* GL_POLYGON_STIPPLE */
+       458, /* GL_EDGE_FLAG */
        304, /* GL_CULL_FACE */
        305, /* GL_CULL_FACE_MODE */
-       576, /* GL_FRONT_FACE */
-       677, /* GL_LIGHTING */
-       682, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-       683, /* GL_LIGHT_MODEL_TWO_SIDE */
-       679, /* GL_LIGHT_MODEL_AMBIENT */
-      1414, /* GL_SHADE_MODEL */
+       585, /* GL_FRONT_FACE */
+       687, /* GL_LIGHTING */
+       692, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+       693, /* GL_LIGHT_MODEL_TWO_SIDE */
+       689, /* GL_LIGHT_MODEL_AMBIENT */
+      1432, /* GL_SHADE_MODEL */
        193, /* GL_COLOR_MATERIAL_FACE */
        194, /* GL_COLOR_MATERIAL_PARAMETER */
        192, /* GL_COLOR_MATERIAL */
-       503, /* GL_FOG */
-       525, /* GL_FOG_INDEX */
-       521, /* GL_FOG_DENSITY */
-       529, /* GL_FOG_START */
-       523, /* GL_FOG_END */
-       526, /* GL_FOG_MODE */
-       505, /* GL_FOG_COLOR */
-       368, /* GL_DEPTH_RANGE */
-       375, /* GL_DEPTH_TEST */
-       378, /* GL_DEPTH_WRITEMASK */
-       356, /* GL_DEPTH_CLEAR_VALUE */
-       367, /* GL_DEPTH_FUNC */
+       508, /* GL_FOG */
+       530, /* GL_FOG_INDEX */
+       526, /* GL_FOG_DENSITY */
+       534, /* GL_FOG_START */
+       528, /* GL_FOG_END */
+       531, /* GL_FOG_MODE */
+       510, /* GL_FOG_COLOR */
+       370, /* GL_DEPTH_RANGE */
+       378, /* GL_DEPTH_TEST */
+       381, /* GL_DEPTH_WRITEMASK */
+       358, /* GL_DEPTH_CLEAR_VALUE */
+       369, /* GL_DEPTH_FUNC */
         12, /* GL_ACCUM_CLEAR_VALUE */
-      1508, /* GL_STENCIL_TEST */
-      1496, /* GL_STENCIL_CLEAR_VALUE */
-      1498, /* GL_STENCIL_FUNC */
-      1510, /* GL_STENCIL_VALUE_MASK */
-      1497, /* GL_STENCIL_FAIL */
-      1505, /* GL_STENCIL_PASS_DEPTH_FAIL */
-      1506, /* GL_STENCIL_PASS_DEPTH_PASS */
-      1507, /* GL_STENCIL_REF */
-      1511, /* GL_STENCIL_WRITEMASK */
-       843, /* GL_MATRIX_MODE */
-      1012, /* GL_NORMALIZE */
-      1837, /* GL_VIEWPORT */
-       986, /* GL_MODELVIEW_STACK_DEPTH */
-      1250, /* GL_PROJECTION_STACK_DEPTH */
-      1718, /* GL_TEXTURE_STACK_DEPTH */
-       984, /* GL_MODELVIEW_MATRIX */
-      1249, /* GL_PROJECTION_MATRIX */
-      1701, /* GL_TEXTURE_MATRIX */
+      1530, /* GL_STENCIL_TEST */
+      1514, /* GL_STENCIL_CLEAR_VALUE */
+      1516, /* GL_STENCIL_FUNC */
+      1532, /* GL_STENCIL_VALUE_MASK */
+      1515, /* GL_STENCIL_FAIL */
+      1527, /* GL_STENCIL_PASS_DEPTH_FAIL */
+      1528, /* GL_STENCIL_PASS_DEPTH_PASS */
+      1529, /* GL_STENCIL_REF */
+      1533, /* GL_STENCIL_WRITEMASK */
+       853, /* GL_MATRIX_MODE */
+      1025, /* GL_NORMALIZE */
+      1861, /* GL_VIEWPORT */
+       999, /* GL_MODELVIEW_STACK_DEPTH */
+      1263, /* GL_PROJECTION_STACK_DEPTH */
+      1740, /* GL_TEXTURE_STACK_DEPTH */
+       997, /* GL_MODELVIEW_MATRIX */
+      1262, /* GL_PROJECTION_MATRIX */
+      1723, /* GL_TEXTURE_MATRIX */
         61, /* GL_ATTRIB_STACK_DEPTH */
        136, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
         43, /* GL_ALPHA_TEST */
         44, /* GL_ALPHA_TEST_FUNC */
         45, /* GL_ALPHA_TEST_REF */
-       380, /* GL_DITHER */
+       383, /* GL_DITHER */
         78, /* GL_BLEND_DST */
         87, /* GL_BLEND_SRC */
         75, /* GL_BLEND */
-       712, /* GL_LOGIC_OP_MODE */
-       630, /* GL_INDEX_LOGIC_OP */
+       722, /* GL_LOGIC_OP_MODE */
+       639, /* GL_INDEX_LOGIC_OP */
        191, /* GL_COLOR_LOGIC_OP */
         67, /* GL_AUX_BUFFERS */
-       391, /* GL_DRAW_BUFFER */
-      1284, /* GL_READ_BUFFER */
-      1395, /* GL_SCISSOR_BOX */
-      1396, /* GL_SCISSOR_TEST */
-       629, /* GL_INDEX_CLEAR_VALUE */
-       634, /* GL_INDEX_WRITEMASK */
+       394, /* GL_DRAW_BUFFER */
+      1299, /* GL_READ_BUFFER */
+      1413, /* GL_SCISSOR_BOX */
+      1414, /* GL_SCISSOR_TEST */
+       638, /* GL_INDEX_CLEAR_VALUE */
+       643, /* GL_INDEX_WRITEMASK */
        188, /* GL_COLOR_CLEAR_VALUE */
        230, /* GL_COLOR_WRITEMASK */
-       631, /* GL_INDEX_MODE */
-      1361, /* GL_RGBA_MODE */
-       390, /* GL_DOUBLEBUFFER */
-      1512, /* GL_STEREO */
-      1319, /* GL_RENDER_MODE */
-      1098, /* GL_PERSPECTIVE_CORRECTION_HINT */
-      1151, /* GL_POINT_SMOOTH_HINT */
-       696, /* GL_LINE_SMOOTH_HINT */
-      1168, /* GL_POLYGON_SMOOTH_HINT */
-       524, /* GL_FOG_HINT */
-      1682, /* GL_TEXTURE_GEN_S */
-      1683, /* GL_TEXTURE_GEN_T */
-      1681, /* GL_TEXTURE_GEN_R */
-      1680, /* GL_TEXTURE_GEN_Q */
-      1111, /* GL_PIXEL_MAP_I_TO_I */
-      1117, /* GL_PIXEL_MAP_S_TO_S */
-      1113, /* GL_PIXEL_MAP_I_TO_R */
-      1109, /* GL_PIXEL_MAP_I_TO_G */
-      1107, /* GL_PIXEL_MAP_I_TO_B */
-      1105, /* GL_PIXEL_MAP_I_TO_A */
-      1115, /* GL_PIXEL_MAP_R_TO_R */
-      1103, /* GL_PIXEL_MAP_G_TO_G */
-      1101, /* GL_PIXEL_MAP_B_TO_B */
-      1099, /* GL_PIXEL_MAP_A_TO_A */
-      1112, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-      1118, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-      1114, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-      1110, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-      1108, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-      1106, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-      1116, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-      1104, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-      1102, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-      1100, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-      1755, /* GL_UNPACK_SWAP_BYTES */
-      1750, /* GL_UNPACK_LSB_FIRST */
-      1751, /* GL_UNPACK_ROW_LENGTH */
-      1754, /* GL_UNPACK_SKIP_ROWS */
-      1753, /* GL_UNPACK_SKIP_PIXELS */
-      1748, /* GL_UNPACK_ALIGNMENT */
-      1086, /* GL_PACK_SWAP_BYTES */
-      1081, /* GL_PACK_LSB_FIRST */
-      1082, /* GL_PACK_ROW_LENGTH */
-      1085, /* GL_PACK_SKIP_ROWS */
-      1084, /* GL_PACK_SKIP_PIXELS */
-      1078, /* GL_PACK_ALIGNMENT */
-       790, /* GL_MAP_COLOR */
-       795, /* GL_MAP_STENCIL */
-       633, /* GL_INDEX_SHIFT */
-       632, /* GL_INDEX_OFFSET */
-      1297, /* GL_RED_SCALE */
-      1295, /* GL_RED_BIAS */
-      1855, /* GL_ZOOM_X */
-      1856, /* GL_ZOOM_Y */
-       594, /* GL_GREEN_SCALE */
-       592, /* GL_GREEN_BIAS */
+       640, /* GL_INDEX_MODE */
+      1379, /* GL_RGBA_MODE */
+       393, /* GL_DOUBLEBUFFER */
+      1534, /* GL_STEREO */
+      1337, /* GL_RENDER_MODE */
+      1111, /* GL_PERSPECTIVE_CORRECTION_HINT */
+      1164, /* GL_POINT_SMOOTH_HINT */
+       706, /* GL_LINE_SMOOTH_HINT */
+      1181, /* GL_POLYGON_SMOOTH_HINT */
+       529, /* GL_FOG_HINT */
+      1704, /* GL_TEXTURE_GEN_S */
+      1705, /* GL_TEXTURE_GEN_T */
+      1703, /* GL_TEXTURE_GEN_R */
+      1702, /* GL_TEXTURE_GEN_Q */
+      1124, /* GL_PIXEL_MAP_I_TO_I */
+      1130, /* GL_PIXEL_MAP_S_TO_S */
+      1126, /* GL_PIXEL_MAP_I_TO_R */
+      1122, /* GL_PIXEL_MAP_I_TO_G */
+      1120, /* GL_PIXEL_MAP_I_TO_B */
+      1118, /* GL_PIXEL_MAP_I_TO_A */
+      1128, /* GL_PIXEL_MAP_R_TO_R */
+      1116, /* GL_PIXEL_MAP_G_TO_G */
+      1114, /* GL_PIXEL_MAP_B_TO_B */
+      1112, /* GL_PIXEL_MAP_A_TO_A */
+      1125, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+      1131, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+      1127, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+      1123, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+      1121, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+      1119, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+      1129, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+      1117, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+      1115, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+      1113, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+      1778, /* GL_UNPACK_SWAP_BYTES */
+      1773, /* GL_UNPACK_LSB_FIRST */
+      1774, /* GL_UNPACK_ROW_LENGTH */
+      1777, /* GL_UNPACK_SKIP_ROWS */
+      1776, /* GL_UNPACK_SKIP_PIXELS */
+      1771, /* GL_UNPACK_ALIGNMENT */
+      1099, /* GL_PACK_SWAP_BYTES */
+      1094, /* GL_PACK_LSB_FIRST */
+      1095, /* GL_PACK_ROW_LENGTH */
+      1098, /* GL_PACK_SKIP_ROWS */
+      1097, /* GL_PACK_SKIP_PIXELS */
+      1091, /* GL_PACK_ALIGNMENT */
+       800, /* GL_MAP_COLOR */
+       805, /* GL_MAP_STENCIL */
+       642, /* GL_INDEX_SHIFT */
+       641, /* GL_INDEX_OFFSET */
+      1313, /* GL_RED_SCALE */
+      1311, /* GL_RED_BIAS */
+      1879, /* GL_ZOOM_X */
+      1880, /* GL_ZOOM_Y */
+       603, /* GL_GREEN_SCALE */
+       601, /* GL_GREEN_BIAS */
         93, /* GL_BLUE_SCALE */
         91, /* GL_BLUE_BIAS */
         42, /* GL_ALPHA_SCALE */
         40, /* GL_ALPHA_BIAS */
-       369, /* GL_DEPTH_SCALE */
-       350, /* GL_DEPTH_BIAS */
-       869, /* GL_MAX_EVAL_ORDER */
-       873, /* GL_MAX_LIGHTS */
-       852, /* GL_MAX_CLIP_PLANES */
-       919, /* GL_MAX_TEXTURE_SIZE */
-       879, /* GL_MAX_PIXEL_MAP_TABLE */
-       848, /* GL_MAX_ATTRIB_STACK_DEPTH */
-       876, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-       877, /* GL_MAX_NAME_STACK_DEPTH */
-       905, /* GL_MAX_PROJECTION_STACK_DEPTH */
-       920, /* GL_MAX_TEXTURE_STACK_DEPTH */
-       934, /* GL_MAX_VIEWPORT_DIMS */
-       849, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-      1522, /* GL_SUBPIXEL_BITS */
-       628, /* GL_INDEX_BITS */
-      1296, /* GL_RED_BITS */
-       593, /* GL_GREEN_BITS */
+       371, /* GL_DEPTH_SCALE */
+       351, /* GL_DEPTH_BIAS */
+       880, /* GL_MAX_EVAL_ORDER */
+       884, /* GL_MAX_LIGHTS */
+       862, /* GL_MAX_CLIP_PLANES */
+       932, /* GL_MAX_TEXTURE_SIZE */
+       890, /* GL_MAX_PIXEL_MAP_TABLE */
+       858, /* GL_MAX_ATTRIB_STACK_DEPTH */
+       887, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+       888, /* GL_MAX_NAME_STACK_DEPTH */
+       916, /* GL_MAX_PROJECTION_STACK_DEPTH */
+       933, /* GL_MAX_TEXTURE_STACK_DEPTH */
+       947, /* GL_MAX_VIEWPORT_DIMS */
+       859, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+      1544, /* GL_SUBPIXEL_BITS */
+       637, /* GL_INDEX_BITS */
+      1312, /* GL_RED_BITS */
+       602, /* GL_GREEN_BITS */
         92, /* GL_BLUE_BITS */
         41, /* GL_ALPHA_BITS */
-       351, /* GL_DEPTH_BITS */
-      1494, /* GL_STENCIL_BITS */
+       352, /* GL_DEPTH_BITS */
+      1512, /* GL_STENCIL_BITS */
         14, /* GL_ACCUM_RED_BITS */
         13, /* GL_ACCUM_GREEN_BITS */
         10, /* GL_ACCUM_BLUE_BITS */
          9, /* GL_ACCUM_ALPHA_BITS */
-      1000, /* GL_NAME_STACK_DEPTH */
+      1013, /* GL_NAME_STACK_DEPTH */
         62, /* GL_AUTO_NORMAL */
-       736, /* GL_MAP1_COLOR_4 */
-       739, /* GL_MAP1_INDEX */
-       740, /* GL_MAP1_NORMAL */
-       741, /* GL_MAP1_TEXTURE_COORD_1 */
-       742, /* GL_MAP1_TEXTURE_COORD_2 */
-       743, /* GL_MAP1_TEXTURE_COORD_3 */
-       744, /* GL_MAP1_TEXTURE_COORD_4 */
-       745, /* GL_MAP1_VERTEX_3 */
-       746, /* GL_MAP1_VERTEX_4 */
-       763, /* GL_MAP2_COLOR_4 */
-       766, /* GL_MAP2_INDEX */
-       767, /* GL_MAP2_NORMAL */
-       768, /* GL_MAP2_TEXTURE_COORD_1 */
-       769, /* GL_MAP2_TEXTURE_COORD_2 */
-       770, /* GL_MAP2_TEXTURE_COORD_3 */
-       771, /* GL_MAP2_TEXTURE_COORD_4 */
-       772, /* GL_MAP2_VERTEX_3 */
-       773, /* GL_MAP2_VERTEX_4 */
-       737, /* GL_MAP1_GRID_DOMAIN */
-       738, /* GL_MAP1_GRID_SEGMENTS */
-       764, /* GL_MAP2_GRID_DOMAIN */
-       765, /* GL_MAP2_GRID_SEGMENTS */
-      1605, /* GL_TEXTURE_1D */
-      1607, /* GL_TEXTURE_2D */
-       478, /* GL_FEEDBACK_BUFFER_POINTER */
-       479, /* GL_FEEDBACK_BUFFER_SIZE */
-       480, /* GL_FEEDBACK_BUFFER_TYPE */
-      1405, /* GL_SELECTION_BUFFER_POINTER */
-      1406, /* GL_SELECTION_BUFFER_SIZE */
-      1723, /* GL_TEXTURE_WIDTH */
-      1687, /* GL_TEXTURE_HEIGHT */
-      1642, /* GL_TEXTURE_COMPONENTS */
-      1626, /* GL_TEXTURE_BORDER_COLOR */
-      1625, /* GL_TEXTURE_BORDER */
-       382, /* GL_DONT_CARE */
-       476, /* GL_FASTEST */
-      1008, /* GL_NICEST */
+       746, /* GL_MAP1_COLOR_4 */
+       749, /* GL_MAP1_INDEX */
+       750, /* GL_MAP1_NORMAL */
+       751, /* GL_MAP1_TEXTURE_COORD_1 */
+       752, /* GL_MAP1_TEXTURE_COORD_2 */
+       753, /* GL_MAP1_TEXTURE_COORD_3 */
+       754, /* GL_MAP1_TEXTURE_COORD_4 */
+       755, /* GL_MAP1_VERTEX_3 */
+       756, /* GL_MAP1_VERTEX_4 */
+       773, /* GL_MAP2_COLOR_4 */
+       776, /* GL_MAP2_INDEX */
+       777, /* GL_MAP2_NORMAL */
+       778, /* GL_MAP2_TEXTURE_COORD_1 */
+       779, /* GL_MAP2_TEXTURE_COORD_2 */
+       780, /* GL_MAP2_TEXTURE_COORD_3 */
+       781, /* GL_MAP2_TEXTURE_COORD_4 */
+       782, /* GL_MAP2_VERTEX_3 */
+       783, /* GL_MAP2_VERTEX_4 */
+       747, /* GL_MAP1_GRID_DOMAIN */
+       748, /* GL_MAP1_GRID_SEGMENTS */
+       774, /* GL_MAP2_GRID_DOMAIN */
+       775, /* GL_MAP2_GRID_SEGMENTS */
+      1627, /* GL_TEXTURE_1D */
+      1629, /* GL_TEXTURE_2D */
+       482, /* GL_FEEDBACK_BUFFER_POINTER */
+       483, /* GL_FEEDBACK_BUFFER_SIZE */
+       484, /* GL_FEEDBACK_BUFFER_TYPE */
+      1423, /* GL_SELECTION_BUFFER_POINTER */
+      1424, /* GL_SELECTION_BUFFER_SIZE */
+      1746, /* GL_TEXTURE_WIDTH */
+      1709, /* GL_TEXTURE_HEIGHT */
+      1664, /* GL_TEXTURE_COMPONENTS */
+      1648, /* GL_TEXTURE_BORDER_COLOR */
+      1647, /* GL_TEXTURE_BORDER */
+       385, /* GL_DONT_CARE */
+       480, /* GL_FASTEST */
+      1021, /* GL_NICEST */
         48, /* GL_AMBIENT */
-       379, /* GL_DIFFUSE */
-      1454, /* GL_SPECULAR */
-      1172, /* GL_POSITION */
-      1457, /* GL_SPOT_DIRECTION */
-      1458, /* GL_SPOT_EXPONENT */
-      1456, /* GL_SPOT_CUTOFF */
+       382, /* GL_DIFFUSE */
+      1472, /* GL_SPECULAR */
+      1185, /* GL_POSITION */
+      1475, /* GL_SPOT_DIRECTION */
+      1476, /* GL_SPOT_EXPONENT */
+      1474, /* GL_SPOT_CUTOFF */
        275, /* GL_CONSTANT_ATTENUATION */
-       686, /* GL_LINEAR_ATTENUATION */
-      1270, /* GL_QUADRATIC_ATTENUATION */
+       696, /* GL_LINEAR_ATTENUATION */
+      1284, /* GL_QUADRATIC_ATTENUATION */
        244, /* GL_COMPILE */
        245, /* GL_COMPILE_AND_EXECUTE */
        120, /* GL_BYTE */
-      1757, /* GL_UNSIGNED_BYTE */
-      1419, /* GL_SHORT */
-      1768, /* GL_UNSIGNED_SHORT */
-       636, /* GL_INT */
-      1760, /* GL_UNSIGNED_INT */
-       484, /* GL_FLOAT */
+      1780, /* GL_UNSIGNED_BYTE */
+      1437, /* GL_SHORT */
+      1792, /* GL_UNSIGNED_SHORT */
+       645, /* GL_INT */
+      1783, /* GL_UNSIGNED_INT */
+       489, /* GL_FLOAT */
          1, /* GL_2_BYTES */
          5, /* GL_3_BYTES */
          7, /* GL_4_BYTES */
-       389, /* GL_DOUBLE */
+       392, /* GL_DOUBLE */
        132, /* GL_CLEAR */
         50, /* GL_AND */
         52, /* GL_AND_REVERSE */
        299, /* GL_COPY */
         51, /* GL_AND_INVERTED */
-      1010, /* GL_NOOP */
-      1851, /* GL_XOR */
-      1073, /* GL_OR */
-      1011, /* GL_NOR */
-       466, /* GL_EQUIV */
-       663, /* GL_INVERT */
-      1076, /* GL_OR_REVERSE */
+      1023, /* GL_NOOP */
+      1875, /* GL_XOR */
+      1086, /* GL_OR */
+      1024, /* GL_NOR */
+       470, /* GL_EQUIV */
+       672, /* GL_INVERT */
+      1089, /* GL_OR_REVERSE */
        300, /* GL_COPY_INVERTED */
-      1075, /* GL_OR_INVERTED */
-      1001, /* GL_NAND */
-      1410, /* GL_SET */
-       463, /* GL_EMISSION */
-      1418, /* GL_SHININESS */
+      1088, /* GL_OR_INVERTED */
+      1014, /* GL_NAND */
+      1428, /* GL_SET */
+       467, /* GL_EMISSION */
+      1436, /* GL_SHININESS */
         49, /* GL_AMBIENT_AND_DIFFUSE */
        190, /* GL_COLOR_INDEXES */
-       951, /* GL_MODELVIEW */
-      1248, /* GL_PROJECTION */
-      1540, /* GL_TEXTURE */
+       964, /* GL_MODELVIEW */
+      1261, /* GL_PROJECTION */
+      1562, /* GL_TEXTURE */
        147, /* GL_COLOR */
        346, /* GL_DEPTH */
-      1480, /* GL_STENCIL */
+      1498, /* GL_STENCIL */
        189, /* GL_COLOR_INDEX */
-      1499, /* GL_STENCIL_INDEX */
-       357, /* GL_DEPTH_COMPONENT */
-      1292, /* GL_RED */
-       591, /* GL_GREEN */
+      1517, /* GL_STENCIL_INDEX */
+       359, /* GL_DEPTH_COMPONENT */
+      1308, /* GL_RED */
+       600, /* GL_GREEN */
         90, /* GL_BLUE */
         31, /* GL_ALPHA */
-      1327, /* GL_RGB */
-      1346, /* GL_RGBA */
-       714, /* GL_LUMINANCE */
-       735, /* GL_LUMINANCE_ALPHA */
+      1345, /* GL_RGB */
+      1364, /* GL_RGBA */
+       724, /* GL_LUMINANCE */
+       745, /* GL_LUMINANCE_ALPHA */
         73, /* GL_BITMAP */
-      1128, /* GL_POINT */
-       684, /* GL_LINE */
-       481, /* GL_FILL */
-      1301, /* GL_RENDER */
-       477, /* GL_FEEDBACK */
-      1404, /* GL_SELECT */
-       483, /* GL_FLAT */
-      1429, /* GL_SMOOTH */
-       664, /* GL_KEEP */
-      1321, /* GL_REPLACE */
-       618, /* GL_INCR */
+      1141, /* GL_POINT */
+       694, /* GL_LINE */
+       485, /* GL_FILL */
+      1317, /* GL_RENDER */
+       481, /* GL_FEEDBACK */
+      1422, /* GL_SELECT */
+       488, /* GL_FLAT */
+      1447, /* GL_SMOOTH */
+       673, /* GL_KEEP */
+      1339, /* GL_REPLACE */
+       627, /* GL_INCR */
        342, /* GL_DECR */
-      1783, /* GL_VENDOR */
-      1318, /* GL_RENDERER */
-      1784, /* GL_VERSION */
-       470, /* GL_EXTENSIONS */
-      1369, /* GL_S */
-      1531, /* GL_T */
-      1281, /* GL_R */
-      1269, /* GL_Q */
-       987, /* GL_MODULATE */
+      1807, /* GL_VENDOR */
+      1336, /* GL_RENDERER */
+      1808, /* GL_VERSION */
+       474, /* GL_EXTENSIONS */
+      1387, /* GL_S */
+      1553, /* GL_T */
+      1296, /* GL_R */
+      1283, /* GL_Q */
+      1000, /* GL_MODULATE */
        341, /* GL_DECAL */
-      1677, /* GL_TEXTURE_ENV_MODE */
-      1676, /* GL_TEXTURE_ENV_COLOR */
-      1675, /* GL_TEXTURE_ENV */
-       471, /* GL_EYE_LINEAR */
-      1034, /* GL_OBJECT_LINEAR */
-      1455, /* GL_SPHERE_MAP */
-      1679, /* GL_TEXTURE_GEN_MODE */
-      1036, /* GL_OBJECT_PLANE */
-       472, /* GL_EYE_PLANE */
-      1002, /* GL_NEAREST */
-       685, /* GL_LINEAR */
-      1006, /* GL_NEAREST_MIPMAP_NEAREST */
-       690, /* GL_LINEAR_MIPMAP_NEAREST */
-      1005, /* GL_NEAREST_MIPMAP_LINEAR */
-       689, /* GL_LINEAR_MIPMAP_LINEAR */
-      1700, /* GL_TEXTURE_MAG_FILTER */
-      1708, /* GL_TEXTURE_MIN_FILTER */
-      1725, /* GL_TEXTURE_WRAP_S */
-      1726, /* GL_TEXTURE_WRAP_T */
+      1699, /* GL_TEXTURE_ENV_MODE */
+      1698, /* GL_TEXTURE_ENV_COLOR */
+      1697, /* GL_TEXTURE_ENV */
+       475, /* GL_EYE_LINEAR */
+      1047, /* GL_OBJECT_LINEAR */
+      1473, /* GL_SPHERE_MAP */
+      1701, /* GL_TEXTURE_GEN_MODE */
+      1049, /* GL_OBJECT_PLANE */
+       476, /* GL_EYE_PLANE */
+      1015, /* GL_NEAREST */
+       695, /* GL_LINEAR */
+      1019, /* GL_NEAREST_MIPMAP_NEAREST */
+       700, /* GL_LINEAR_MIPMAP_NEAREST */
+      1018, /* GL_NEAREST_MIPMAP_LINEAR */
+       699, /* GL_LINEAR_MIPMAP_LINEAR */
+      1722, /* GL_TEXTURE_MAG_FILTER */
+      1730, /* GL_TEXTURE_MIN_FILTER */
+      1748, /* GL_TEXTURE_WRAP_S */
+      1749, /* GL_TEXTURE_WRAP_T */
        126, /* GL_CLAMP */
-      1320, /* GL_REPEAT */
-      1166, /* GL_POLYGON_OFFSET_UNITS */
-      1165, /* GL_POLYGON_OFFSET_POINT */
-      1164, /* GL_POLYGON_OFFSET_LINE */
-      1282, /* GL_R3_G3_B2 */
-      1780, /* GL_V2F */
-      1781, /* GL_V3F */
+      1338, /* GL_REPEAT */
+      1179, /* GL_POLYGON_OFFSET_UNITS */
+      1178, /* GL_POLYGON_OFFSET_POINT */
+      1177, /* GL_POLYGON_OFFSET_LINE */
+      1297, /* GL_R3_G3_B2 */
+      1804, /* GL_V2F */
+      1805, /* GL_V3F */
        123, /* GL_C4UB_V2F */
        124, /* GL_C4UB_V3F */
        121, /* GL_C3F_V3F */
-       999, /* GL_N3F_V3F */
+      1012, /* GL_N3F_V3F */
        122, /* GL_C4F_N3F_V3F */
-      1536, /* GL_T2F_V3F */
-      1538, /* GL_T4F_V4F */
-      1534, /* GL_T2F_C4UB_V3F */
-      1532, /* GL_T2F_C3F_V3F */
-      1535, /* GL_T2F_N3F_V3F */
-      1533, /* GL_T2F_C4F_N3F_V3F */
-      1537, /* GL_T4F_C4F_N3F_V4F */
+      1558, /* GL_T2F_V3F */
+      1560, /* GL_T4F_V4F */
+      1556, /* GL_T2F_C4UB_V3F */
+      1554, /* GL_T2F_C3F_V3F */
+      1557, /* GL_T2F_N3F_V3F */
+      1555, /* GL_T2F_C4F_N3F_V3F */
+      1559, /* GL_T4F_C4F_N3F_V4F */
        139, /* GL_CLIP_PLANE0 */
        140, /* GL_CLIP_PLANE1 */
        141, /* GL_CLIP_PLANE2 */
        142, /* GL_CLIP_PLANE3 */
        143, /* GL_CLIP_PLANE4 */
        144, /* GL_CLIP_PLANE5 */
-       669, /* GL_LIGHT0 */
-       670, /* GL_LIGHT1 */
-       671, /* GL_LIGHT2 */
-       672, /* GL_LIGHT3 */
-       673, /* GL_LIGHT4 */
-       674, /* GL_LIGHT5 */
-       675, /* GL_LIGHT6 */
-       676, /* GL_LIGHT7 */
-       595, /* GL_HINT_BIT */
+       679, /* GL_LIGHT0 */
+       680, /* GL_LIGHT1 */
+       681, /* GL_LIGHT2 */
+       682, /* GL_LIGHT3 */
+       683, /* GL_LIGHT4 */
+       684, /* GL_LIGHT5 */
+       685, /* GL_LIGHT6 */
+       686, /* GL_LIGHT7 */
+       604, /* GL_HINT_BIT */
        277, /* GL_CONSTANT_COLOR */
-      1047, /* GL_ONE_MINUS_CONSTANT_COLOR */
+      1060, /* GL_ONE_MINUS_CONSTANT_COLOR */
        272, /* GL_CONSTANT_ALPHA */
-      1045, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+      1058, /* GL_ONE_MINUS_CONSTANT_ALPHA */
         76, /* GL_BLEND_COLOR */
-       579, /* GL_FUNC_ADD */
-       935, /* GL_MIN */
-       845, /* GL_MAX */
+       588, /* GL_FUNC_ADD */
+       948, /* GL_MIN */
+       855, /* GL_MAX */
         81, /* GL_BLEND_EQUATION */
-       583, /* GL_FUNC_SUBTRACT */
-       581, /* GL_FUNC_REVERSE_SUBTRACT */
+       592, /* GL_FUNC_SUBTRACT */
+       590, /* GL_FUNC_REVERSE_SUBTRACT */
        280, /* GL_CONVOLUTION_1D */
        281, /* GL_CONVOLUTION_2D */
-      1407, /* GL_SEPARABLE_2D */
+      1425, /* GL_SEPARABLE_2D */
        284, /* GL_CONVOLUTION_BORDER_MODE */
        288, /* GL_CONVOLUTION_FILTER_SCALE */
        286, /* GL_CONVOLUTION_FILTER_BIAS */
-      1293, /* GL_REDUCE */
+      1309, /* GL_REDUCE */
        290, /* GL_CONVOLUTION_FORMAT */
        294, /* GL_CONVOLUTION_WIDTH */
        292, /* GL_CONVOLUTION_HEIGHT */
-       860, /* GL_MAX_CONVOLUTION_WIDTH */
-       858, /* GL_MAX_CONVOLUTION_HEIGHT */
-      1205, /* GL_POST_CONVOLUTION_RED_SCALE */
-      1201, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-      1196, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-      1192, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-      1203, /* GL_POST_CONVOLUTION_RED_BIAS */
-      1199, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-      1194, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-      1190, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-       596, /* GL_HISTOGRAM */
-      1253, /* GL_PROXY_HISTOGRAM */
-       612, /* GL_HISTOGRAM_WIDTH */
-       602, /* GL_HISTOGRAM_FORMAT */
-       608, /* GL_HISTOGRAM_RED_SIZE */
-       604, /* GL_HISTOGRAM_GREEN_SIZE */
-       599, /* GL_HISTOGRAM_BLUE_SIZE */
-       597, /* GL_HISTOGRAM_ALPHA_SIZE */
-       606, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-       610, /* GL_HISTOGRAM_SINK */
-       936, /* GL_MINMAX */
-       938, /* GL_MINMAX_FORMAT */
-       940, /* GL_MINMAX_SINK */
-      1539, /* GL_TABLE_TOO_LARGE_EXT */
-      1759, /* GL_UNSIGNED_BYTE_3_3_2 */
-      1770, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-      1772, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-      1765, /* GL_UNSIGNED_INT_8_8_8_8 */
-      1761, /* GL_UNSIGNED_INT_10_10_10_2 */
-      1163, /* GL_POLYGON_OFFSET_FILL */
-      1162, /* GL_POLYGON_OFFSET_FACTOR */
-      1161, /* GL_POLYGON_OFFSET_BIAS */
-      1324, /* GL_RESCALE_NORMAL */
+       871, /* GL_MAX_CONVOLUTION_WIDTH */
+       869, /* GL_MAX_CONVOLUTION_HEIGHT */
+      1218, /* GL_POST_CONVOLUTION_RED_SCALE */
+      1214, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+      1209, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+      1205, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+      1216, /* GL_POST_CONVOLUTION_RED_BIAS */
+      1212, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+      1207, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+      1203, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+       605, /* GL_HISTOGRAM */
+      1267, /* GL_PROXY_HISTOGRAM */
+       621, /* GL_HISTOGRAM_WIDTH */
+       611, /* GL_HISTOGRAM_FORMAT */
+       617, /* GL_HISTOGRAM_RED_SIZE */
+       613, /* GL_HISTOGRAM_GREEN_SIZE */
+       608, /* GL_HISTOGRAM_BLUE_SIZE */
+       606, /* GL_HISTOGRAM_ALPHA_SIZE */
+       615, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+       619, /* GL_HISTOGRAM_SINK */
+       949, /* GL_MINMAX */
+       951, /* GL_MINMAX_FORMAT */
+       953, /* GL_MINMAX_SINK */
+      1561, /* GL_TABLE_TOO_LARGE_EXT */
+      1782, /* GL_UNSIGNED_BYTE_3_3_2 */
+      1794, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+      1796, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+      1789, /* GL_UNSIGNED_INT_8_8_8_8 */
+      1784, /* GL_UNSIGNED_INT_10_10_10_2 */
+      1176, /* GL_POLYGON_OFFSET_FILL */
+      1175, /* GL_POLYGON_OFFSET_FACTOR */
+      1174, /* GL_POLYGON_OFFSET_BIAS */
+      1342, /* GL_RESCALE_NORMAL */
         36, /* GL_ALPHA4 */
         38, /* GL_ALPHA8 */
         32, /* GL_ALPHA12 */
         34, /* GL_ALPHA16 */
-       725, /* GL_LUMINANCE4 */
-       731, /* GL_LUMINANCE8 */
-       715, /* GL_LUMINANCE12 */
-       721, /* GL_LUMINANCE16 */
-       726, /* GL_LUMINANCE4_ALPHA4 */
-       729, /* GL_LUMINANCE6_ALPHA2 */
-       732, /* GL_LUMINANCE8_ALPHA8 */
-       718, /* GL_LUMINANCE12_ALPHA4 */
-       716, /* GL_LUMINANCE12_ALPHA12 */
-       722, /* GL_LUMINANCE16_ALPHA16 */
-       637, /* GL_INTENSITY */
-       642, /* GL_INTENSITY4 */
-       644, /* GL_INTENSITY8 */
-       638, /* GL_INTENSITY12 */
-       640, /* GL_INTENSITY16 */
-      1336, /* GL_RGB2_EXT */
-      1337, /* GL_RGB4 */
-      1340, /* GL_RGB5 */
-      1344, /* GL_RGB8 */
-      1328, /* GL_RGB10 */
-      1332, /* GL_RGB12 */
-      1334, /* GL_RGB16 */
-      1351, /* GL_RGBA2 */
-      1353, /* GL_RGBA4 */
-      1341, /* GL_RGB5_A1 */
-      1357, /* GL_RGBA8 */
-      1329, /* GL_RGB10_A2 */
-      1347, /* GL_RGBA12 */
-      1349, /* GL_RGBA16 */
-      1715, /* GL_TEXTURE_RED_SIZE */
-      1685, /* GL_TEXTURE_GREEN_SIZE */
-      1623, /* GL_TEXTURE_BLUE_SIZE */
-      1610, /* GL_TEXTURE_ALPHA_SIZE */
-      1698, /* GL_TEXTURE_LUMINANCE_SIZE */
-      1689, /* GL_TEXTURE_INTENSITY_SIZE */
-      1322, /* GL_REPLACE_EXT */
-      1257, /* GL_PROXY_TEXTURE_1D */
-      1260, /* GL_PROXY_TEXTURE_2D */
-      1721, /* GL_TEXTURE_TOO_LARGE_EXT */
-      1710, /* GL_TEXTURE_PRIORITY */
-      1717, /* GL_TEXTURE_RESIDENT */
-      1613, /* GL_TEXTURE_BINDING_1D */
-      1615, /* GL_TEXTURE_BINDING_2D */
-      1617, /* GL_TEXTURE_BINDING_3D */
-      1083, /* GL_PACK_SKIP_IMAGES */
-      1079, /* GL_PACK_IMAGE_HEIGHT */
-      1752, /* GL_UNPACK_SKIP_IMAGES */
-      1749, /* GL_UNPACK_IMAGE_HEIGHT */
-      1609, /* GL_TEXTURE_3D */
-      1263, /* GL_PROXY_TEXTURE_3D */
-      1672, /* GL_TEXTURE_DEPTH */
-      1724, /* GL_TEXTURE_WRAP_R */
-       846, /* GL_MAX_3D_TEXTURE_SIZE */
-      1785, /* GL_VERTEX_ARRAY */
-      1013, /* GL_NORMAL_ARRAY */
+       735, /* GL_LUMINANCE4 */
+       741, /* GL_LUMINANCE8 */
+       725, /* GL_LUMINANCE12 */
+       731, /* GL_LUMINANCE16 */
+       736, /* GL_LUMINANCE4_ALPHA4 */
+       739, /* GL_LUMINANCE6_ALPHA2 */
+       742, /* GL_LUMINANCE8_ALPHA8 */
+       728, /* GL_LUMINANCE12_ALPHA4 */
+       726, /* GL_LUMINANCE12_ALPHA12 */
+       732, /* GL_LUMINANCE16_ALPHA16 */
+       646, /* GL_INTENSITY */
+       651, /* GL_INTENSITY4 */
+       653, /* GL_INTENSITY8 */
+       647, /* GL_INTENSITY12 */
+       649, /* GL_INTENSITY16 */
+      1354, /* GL_RGB2_EXT */
+      1355, /* GL_RGB4 */
+      1358, /* GL_RGB5 */
+      1362, /* GL_RGB8 */
+      1346, /* GL_RGB10 */
+      1350, /* GL_RGB12 */
+      1352, /* GL_RGB16 */
+      1369, /* GL_RGBA2 */
+      1371, /* GL_RGBA4 */
+      1359, /* GL_RGB5_A1 */
+      1375, /* GL_RGBA8 */
+      1347, /* GL_RGB10_A2 */
+      1365, /* GL_RGBA12 */
+      1367, /* GL_RGBA16 */
+      1737, /* GL_TEXTURE_RED_SIZE */
+      1707, /* GL_TEXTURE_GREEN_SIZE */
+      1645, /* GL_TEXTURE_BLUE_SIZE */
+      1632, /* GL_TEXTURE_ALPHA_SIZE */
+      1720, /* GL_TEXTURE_LUMINANCE_SIZE */
+      1711, /* GL_TEXTURE_INTENSITY_SIZE */
+      1340, /* GL_REPLACE_EXT */
+      1271, /* GL_PROXY_TEXTURE_1D */
+      1274, /* GL_PROXY_TEXTURE_2D */
+      1744, /* GL_TEXTURE_TOO_LARGE_EXT */
+      1732, /* GL_TEXTURE_PRIORITY */
+      1739, /* GL_TEXTURE_RESIDENT */
+      1635, /* GL_TEXTURE_BINDING_1D */
+      1637, /* GL_TEXTURE_BINDING_2D */
+      1639, /* GL_TEXTURE_BINDING_3D */
+      1096, /* GL_PACK_SKIP_IMAGES */
+      1092, /* GL_PACK_IMAGE_HEIGHT */
+      1775, /* GL_UNPACK_SKIP_IMAGES */
+      1772, /* GL_UNPACK_IMAGE_HEIGHT */
+      1631, /* GL_TEXTURE_3D */
+      1277, /* GL_PROXY_TEXTURE_3D */
+      1694, /* GL_TEXTURE_DEPTH */
+      1747, /* GL_TEXTURE_WRAP_R */
+       856, /* GL_MAX_3D_TEXTURE_SIZE */
+      1809, /* GL_VERTEX_ARRAY */
+      1026, /* GL_NORMAL_ARRAY */
        148, /* GL_COLOR_ARRAY */
-       622, /* GL_INDEX_ARRAY */
-      1650, /* GL_TEXTURE_COORD_ARRAY */
-       455, /* GL_EDGE_FLAG_ARRAY */
-      1791, /* GL_VERTEX_ARRAY_SIZE */
-      1793, /* GL_VERTEX_ARRAY_TYPE */
-      1792, /* GL_VERTEX_ARRAY_STRIDE */
-      1018, /* GL_NORMAL_ARRAY_TYPE */
-      1017, /* GL_NORMAL_ARRAY_STRIDE */
+       631, /* GL_INDEX_ARRAY */
+      1672, /* GL_TEXTURE_COORD_ARRAY */
+       459, /* GL_EDGE_FLAG_ARRAY */
+      1815, /* GL_VERTEX_ARRAY_SIZE */
+      1817, /* GL_VERTEX_ARRAY_TYPE */
+      1816, /* GL_VERTEX_ARRAY_STRIDE */
+      1031, /* GL_NORMAL_ARRAY_TYPE */
+      1030, /* GL_NORMAL_ARRAY_STRIDE */
        152, /* GL_COLOR_ARRAY_SIZE */
        154, /* GL_COLOR_ARRAY_TYPE */
        153, /* GL_COLOR_ARRAY_STRIDE */
-       627, /* GL_INDEX_ARRAY_TYPE */
-       626, /* GL_INDEX_ARRAY_STRIDE */
-      1654, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-      1656, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-      1655, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-       459, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-      1790, /* GL_VERTEX_ARRAY_POINTER */
-      1016, /* GL_NORMAL_ARRAY_POINTER */
+       636, /* GL_INDEX_ARRAY_TYPE */
+       635, /* GL_INDEX_ARRAY_STRIDE */
+      1676, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+      1678, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+      1677, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+       463, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+      1814, /* GL_VERTEX_ARRAY_POINTER */
+      1029, /* GL_NORMAL_ARRAY_POINTER */
        151, /* GL_COLOR_ARRAY_POINTER */
-       625, /* GL_INDEX_ARRAY_POINTER */
-      1653, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-       458, /* GL_EDGE_FLAG_ARRAY_POINTER */
-       992, /* GL_MULTISAMPLE */
-      1381, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-      1383, /* GL_SAMPLE_ALPHA_TO_ONE */
-      1388, /* GL_SAMPLE_COVERAGE */
-      1385, /* GL_SAMPLE_BUFFERS */
-      1376, /* GL_SAMPLES */
-      1392, /* GL_SAMPLE_COVERAGE_VALUE */
-      1390, /* GL_SAMPLE_COVERAGE_INVERT */
+       634, /* GL_INDEX_ARRAY_POINTER */
+      1675, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+       462, /* GL_EDGE_FLAG_ARRAY_POINTER */
+      1005, /* GL_MULTISAMPLE */
+      1399, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+      1401, /* GL_SAMPLE_ALPHA_TO_ONE */
+      1406, /* GL_SAMPLE_COVERAGE */
+      1403, /* GL_SAMPLE_BUFFERS */
+      1394, /* GL_SAMPLES */
+      1410, /* GL_SAMPLE_COVERAGE_VALUE */
+      1408, /* GL_SAMPLE_COVERAGE_INVERT */
        195, /* GL_COLOR_MATRIX */
        197, /* GL_COLOR_MATRIX_STACK_DEPTH */
-       854, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-      1188, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-      1184, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-      1179, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-      1175, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-      1186, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-      1182, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-      1177, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-      1173, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-      1633, /* GL_TEXTURE_COLOR_TABLE_SGI */
-      1264, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-      1635, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+       865, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+      1201, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+      1197, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+      1192, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+      1188, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+      1199, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+      1195, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+      1190, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+      1186, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+      1655, /* GL_TEXTURE_COLOR_TABLE_SGI */
+      1278, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+      1657, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
         80, /* GL_BLEND_DST_RGB */
         89, /* GL_BLEND_SRC_RGB */
         79, /* GL_BLEND_DST_ALPHA */
         88, /* GL_BLEND_SRC_ALPHA */
        201, /* GL_COLOR_TABLE */
-      1198, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-      1181, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-      1252, /* GL_PROXY_COLOR_TABLE */
-      1256, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-      1255, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+      1211, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+      1194, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+      1266, /* GL_PROXY_COLOR_TABLE */
+      1270, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+      1269, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
        225, /* GL_COLOR_TABLE_SCALE */
        205, /* GL_COLOR_TABLE_BIAS */
        210, /* GL_COLOR_TABLE_FORMAT */
@@ -4369,380 +4417,380 @@ static const unsigned reduced_enums[1347] =
        216, /* GL_COLOR_TABLE_INTENSITY_SIZE */
         71, /* GL_BGR */
         72, /* GL_BGRA */
-       868, /* GL_MAX_ELEMENTS_VERTICES */
-       867, /* GL_MAX_ELEMENTS_INDICES */
-      1688, /* GL_TEXTURE_INDEX_SIZE_EXT */
+       879, /* GL_MAX_ELEMENTS_VERTICES */
+       878, /* GL_MAX_ELEMENTS_INDICES */
+      1710, /* GL_TEXTURE_INDEX_SIZE_EXT */
        145, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
-      1145, /* GL_POINT_SIZE_MIN */
-      1141, /* GL_POINT_SIZE_MAX */
-      1135, /* GL_POINT_FADE_THRESHOLD_SIZE */
-      1131, /* GL_POINT_DISTANCE_ATTENUATION */
+      1158, /* GL_POINT_SIZE_MIN */
+      1154, /* GL_POINT_SIZE_MAX */
+      1148, /* GL_POINT_FADE_THRESHOLD_SIZE */
+      1144, /* GL_POINT_DISTANCE_ATTENUATION */
        127, /* GL_CLAMP_TO_BORDER */
        130, /* GL_CLAMP_TO_EDGE */
-      1709, /* GL_TEXTURE_MIN_LOD */
-      1707, /* GL_TEXTURE_MAX_LOD */
-      1612, /* GL_TEXTURE_BASE_LEVEL */
-      1706, /* GL_TEXTURE_MAX_LEVEL */
-       615, /* GL_IGNORE_BORDER_HP */
+      1731, /* GL_TEXTURE_MIN_LOD */
+      1729, /* GL_TEXTURE_MAX_LOD */
+      1634, /* GL_TEXTURE_BASE_LEVEL */
+      1728, /* GL_TEXTURE_MAX_LEVEL */
+       624, /* GL_IGNORE_BORDER_HP */
        276, /* GL_CONSTANT_BORDER_HP */
-      1323, /* GL_REPLICATE_BORDER_HP */
+      1341, /* GL_REPLICATE_BORDER_HP */
        282, /* GL_CONVOLUTION_BORDER_COLOR */
-      1042, /* GL_OCCLUSION_TEST_HP */
-      1043, /* GL_OCCLUSION_TEST_RESULT_HP */
-       687, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-      1627, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-      1629, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-      1631, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-      1632, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1630, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-      1628, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-       850, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-       851, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1208, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-      1210, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-      1207, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-      1209, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-      1696, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-      1697, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-      1695, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-       585, /* GL_GENERATE_MIPMAP */
-       586, /* GL_GENERATE_MIPMAP_HINT */
-       527, /* GL_FOG_OFFSET_SGIX */
-       528, /* GL_FOG_OFFSET_VALUE_SGIX */
-      1641, /* GL_TEXTURE_COMPARE_SGIX */
-      1640, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-      1692, /* GL_TEXTURE_LEQUAL_R_SGIX */
-      1684, /* GL_TEXTURE_GEQUAL_R_SGIX */
-       358, /* GL_DEPTH_COMPONENT16 */
-       361, /* GL_DEPTH_COMPONENT24 */
-       364, /* GL_DEPTH_COMPONENT32 */
+      1055, /* GL_OCCLUSION_TEST_HP */
+      1056, /* GL_OCCLUSION_TEST_RESULT_HP */
+       697, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+      1649, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+      1651, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+      1653, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+      1654, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      1652, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+      1650, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+       860, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+       861, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      1221, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+      1223, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+      1220, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+      1222, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+      1718, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+      1719, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+      1717, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+       594, /* GL_GENERATE_MIPMAP */
+       595, /* GL_GENERATE_MIPMAP_HINT */
+       532, /* GL_FOG_OFFSET_SGIX */
+       533, /* GL_FOG_OFFSET_VALUE_SGIX */
+      1663, /* GL_TEXTURE_COMPARE_SGIX */
+      1662, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+      1714, /* GL_TEXTURE_LEQUAL_R_SGIX */
+      1706, /* GL_TEXTURE_GEQUAL_R_SGIX */
+       360, /* GL_DEPTH_COMPONENT16 */
+       363, /* GL_DEPTH_COMPONENT24 */
+       366, /* GL_DEPTH_COMPONENT32 */
        306, /* GL_CULL_VERTEX_EXT */
        308, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
        307, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
-      1848, /* GL_WRAP_BORDER_SUN */
-      1634, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-       680, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-      1422, /* GL_SINGLE_COLOR */
-      1408, /* GL_SEPARATE_SPECULAR_COLOR */
-      1417, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-       538, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-       539, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-       546, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-       541, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-       537, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-       536, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-       540, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-       547, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-       558, /* GL_FRAMEBUFFER_DEFAULT */
-       571, /* GL_FRAMEBUFFER_UNDEFINED */
-       371, /* GL_DEPTH_STENCIL_ATTACHMENT */
-       621, /* GL_INDEX */
-      1758, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-      1773, /* GL_UNSIGNED_SHORT_5_6_5 */
-      1774, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-      1771, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-      1769, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-      1766, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-      1764, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-      1704, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-      1705, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-      1703, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-       943, /* GL_MIRRORED_REPEAT */
-      1364, /* GL_RGB_S3TC */
-      1339, /* GL_RGB4_S3TC */
-      1362, /* GL_RGBA_S3TC */
-      1356, /* GL_RGBA4_S3TC */
-      1360, /* GL_RGBA_DXT5_S3TC */
-      1354, /* GL_RGBA4_DXT5_S3TC */
+      1872, /* GL_WRAP_BORDER_SUN */
+      1656, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+       690, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+      1440, /* GL_SINGLE_COLOR */
+      1426, /* GL_SEPARATE_SPECULAR_COLOR */
+      1435, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+       543, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+       544, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+       551, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+       546, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+       542, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+       541, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+       545, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+       552, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+       564, /* GL_FRAMEBUFFER_DEFAULT */
+       580, /* GL_FRAMEBUFFER_UNDEFINED */
+       373, /* GL_DEPTH_STENCIL_ATTACHMENT */
+       630, /* GL_INDEX */
+      1781, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+      1797, /* GL_UNSIGNED_SHORT_5_6_5 */
+      1798, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+      1795, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+      1793, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+      1790, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+      1788, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+      1726, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+      1727, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+      1725, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+       956, /* GL_MIRRORED_REPEAT */
+      1382, /* GL_RGB_S3TC */
+      1357, /* GL_RGB4_S3TC */
+      1380, /* GL_RGBA_S3TC */
+      1374, /* GL_RGBA4_S3TC */
+      1378, /* GL_RGBA_DXT5_S3TC */
+      1372, /* GL_RGBA4_DXT5_S3TC */
        264, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
        259, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
        260, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
        261, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
-      1004, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-      1003, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-       688, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-       514, /* GL_FOG_COORDINATE_SOURCE */
-       506, /* GL_FOG_COORD */
-       530, /* GL_FRAGMENT_DEPTH */
+      1017, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+      1016, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+       698, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+       519, /* GL_FOG_COORDINATE_SOURCE */
+       511, /* GL_FOG_COORD */
+       535, /* GL_FRAGMENT_DEPTH */
        312, /* GL_CURRENT_FOG_COORD */
-       513, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-       512, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-       511, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-       508, /* GL_FOG_COORDINATE_ARRAY */
+       518, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+       517, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+       516, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+       513, /* GL_FOG_COORDINATE_ARRAY */
        199, /* GL_COLOR_SUM */
        332, /* GL_CURRENT_SECONDARY_COLOR */
-      1401, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-      1403, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-      1402, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-      1400, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-      1397, /* GL_SECONDARY_COLOR_ARRAY */
+      1419, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+      1421, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+      1420, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+      1418, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+      1415, /* GL_SECONDARY_COLOR_ARRAY */
        330, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
         28, /* GL_ALIASED_POINT_SIZE_RANGE */
         27, /* GL_ALIASED_LINE_WIDTH_RANGE */
-      1541, /* GL_TEXTURE0 */
-      1543, /* GL_TEXTURE1 */
-      1565, /* GL_TEXTURE2 */
-      1587, /* GL_TEXTURE3 */
-      1593, /* GL_TEXTURE4 */
-      1595, /* GL_TEXTURE5 */
-      1597, /* GL_TEXTURE6 */
-      1599, /* GL_TEXTURE7 */
-      1601, /* GL_TEXTURE8 */
-      1603, /* GL_TEXTURE9 */
-      1544, /* GL_TEXTURE10 */
-      1546, /* GL_TEXTURE11 */
-      1548, /* GL_TEXTURE12 */
-      1550, /* GL_TEXTURE13 */
-      1552, /* GL_TEXTURE14 */
-      1554, /* GL_TEXTURE15 */
-      1556, /* GL_TEXTURE16 */
-      1558, /* GL_TEXTURE17 */
-      1560, /* GL_TEXTURE18 */
-      1562, /* GL_TEXTURE19 */
-      1566, /* GL_TEXTURE20 */
-      1568, /* GL_TEXTURE21 */
-      1570, /* GL_TEXTURE22 */
-      1572, /* GL_TEXTURE23 */
-      1574, /* GL_TEXTURE24 */
-      1576, /* GL_TEXTURE25 */
-      1578, /* GL_TEXTURE26 */
-      1580, /* GL_TEXTURE27 */
-      1582, /* GL_TEXTURE28 */
-      1584, /* GL_TEXTURE29 */
-      1588, /* GL_TEXTURE30 */
-      1590, /* GL_TEXTURE31 */
+      1563, /* GL_TEXTURE0 */
+      1565, /* GL_TEXTURE1 */
+      1587, /* GL_TEXTURE2 */
+      1609, /* GL_TEXTURE3 */
+      1615, /* GL_TEXTURE4 */
+      1617, /* GL_TEXTURE5 */
+      1619, /* GL_TEXTURE6 */
+      1621, /* GL_TEXTURE7 */
+      1623, /* GL_TEXTURE8 */
+      1625, /* GL_TEXTURE9 */
+      1566, /* GL_TEXTURE10 */
+      1568, /* GL_TEXTURE11 */
+      1570, /* GL_TEXTURE12 */
+      1572, /* GL_TEXTURE13 */
+      1574, /* GL_TEXTURE14 */
+      1576, /* GL_TEXTURE15 */
+      1578, /* GL_TEXTURE16 */
+      1580, /* GL_TEXTURE17 */
+      1582, /* GL_TEXTURE18 */
+      1584, /* GL_TEXTURE19 */
+      1588, /* GL_TEXTURE20 */
+      1590, /* GL_TEXTURE21 */
+      1592, /* GL_TEXTURE22 */
+      1594, /* GL_TEXTURE23 */
+      1596, /* GL_TEXTURE24 */
+      1598, /* GL_TEXTURE25 */
+      1600, /* GL_TEXTURE26 */
+      1602, /* GL_TEXTURE27 */
+      1604, /* GL_TEXTURE28 */
+      1606, /* GL_TEXTURE29 */
+      1610, /* GL_TEXTURE30 */
+      1612, /* GL_TEXTURE31 */
         18, /* GL_ACTIVE_TEXTURE */
        133, /* GL_CLIENT_ACTIVE_TEXTURE */
-       921, /* GL_MAX_TEXTURE_UNITS */
-      1736, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-      1739, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-      1741, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-      1733, /* GL_TRANSPOSE_COLOR_MATRIX */
-      1523, /* GL_SUBTRACT */
-       908, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+       934, /* GL_MAX_TEXTURE_UNITS */
+      1759, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+      1762, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+      1764, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+      1756, /* GL_TRANSPOSE_COLOR_MATRIX */
+      1545, /* GL_SUBTRACT */
+       919, /* GL_MAX_RENDERBUFFER_SIZE */
        247, /* GL_COMPRESSED_ALPHA */
        251, /* GL_COMPRESSED_LUMINANCE */
        252, /* GL_COMPRESSED_LUMINANCE_ALPHA */
        249, /* GL_COMPRESSED_INTENSITY */
        255, /* GL_COMPRESSED_RGB */
        256, /* GL_COMPRESSED_RGBA */
-      1648, /* GL_TEXTURE_COMPRESSION_HINT */
-      1713, /* GL_TEXTURE_RECTANGLE_ARB */
-      1620, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
-      1267, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
-       906, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
-       370, /* GL_DEPTH_STENCIL */
-      1762, /* GL_UNSIGNED_INT_24_8 */
-       917, /* GL_MAX_TEXTURE_LOD_BIAS */
-      1702, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-       918, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-      1678, /* GL_TEXTURE_FILTER_CONTROL */
-      1693, /* GL_TEXTURE_LOD_BIAS */
+      1670, /* GL_TEXTURE_COMPRESSION_HINT */
+      1735, /* GL_TEXTURE_RECTANGLE_ARB */
+      1642, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+      1281, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+       917, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+       372, /* GL_DEPTH_STENCIL */
+      1785, /* GL_UNSIGNED_INT_24_8 */
+       930, /* GL_MAX_TEXTURE_LOD_BIAS */
+      1724, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+       931, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+      1700, /* GL_TEXTURE_FILTER_CONTROL */
+      1715, /* GL_TEXTURE_LOD_BIAS */
        232, /* GL_COMBINE4 */
-       911, /* GL_MAX_SHININESS_NV */
-       912, /* GL_MAX_SPOT_EXPONENT_NV */
-       619, /* GL_INCR_WRAP */
+       924, /* GL_MAX_SHININESS_NV */
+       925, /* GL_MAX_SPOT_EXPONENT_NV */
+       628, /* GL_INCR_WRAP */
        343, /* GL_DECR_WRAP */
-       963, /* GL_MODELVIEW1_ARB */
-      1019, /* GL_NORMAL_MAP */
-      1298, /* GL_REFLECTION_MAP */
-      1657, /* GL_TEXTURE_CUBE_MAP */
-      1618, /* GL_TEXTURE_BINDING_CUBE_MAP */
-      1665, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-      1659, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-      1667, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-      1661, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-      1669, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-      1663, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-      1265, /* GL_PROXY_TEXTURE_CUBE_MAP */
-       862, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-       998, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-       522, /* GL_FOG_DISTANCE_MODE_NV */
-       474, /* GL_EYE_RADIAL_NV */
-       473, /* GL_EYE_PLANE_ABSOLUTE_NV */
+       976, /* GL_MODELVIEW1_ARB */
+      1032, /* GL_NORMAL_MAP */
+      1314, /* GL_REFLECTION_MAP */
+      1679, /* GL_TEXTURE_CUBE_MAP */
+      1640, /* GL_TEXTURE_BINDING_CUBE_MAP */
+      1687, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+      1681, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+      1689, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+      1683, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+      1691, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+      1685, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+      1279, /* GL_PROXY_TEXTURE_CUBE_MAP */
+       873, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+      1011, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+       527, /* GL_FOG_DISTANCE_MODE_NV */
+       478, /* GL_EYE_RADIAL_NV */
+       477, /* GL_EYE_PLANE_ABSOLUTE_NV */
        231, /* GL_COMBINE */
        238, /* GL_COMBINE_RGB */
        233, /* GL_COMBINE_ALPHA */
-      1365, /* GL_RGB_SCALE */
+      1383, /* GL_RGB_SCALE */
         24, /* GL_ADD_SIGNED */
-       647, /* GL_INTERPOLATE */
+       656, /* GL_INTERPOLATE */
        271, /* GL_CONSTANT */
-      1214, /* GL_PRIMARY_COLOR */
-      1211, /* GL_PREVIOUS */
-      1437, /* GL_SOURCE0_RGB */
-      1443, /* GL_SOURCE1_RGB */
-      1449, /* GL_SOURCE2_RGB */
-      1453, /* GL_SOURCE3_RGB_NV */
-      1434, /* GL_SOURCE0_ALPHA */
-      1440, /* GL_SOURCE1_ALPHA */
-      1446, /* GL_SOURCE2_ALPHA */
-      1452, /* GL_SOURCE3_ALPHA_NV */
-      1056, /* GL_OPERAND0_RGB */
-      1062, /* GL_OPERAND1_RGB */
-      1068, /* GL_OPERAND2_RGB */
-      1072, /* GL_OPERAND3_RGB_NV */
-      1053, /* GL_OPERAND0_ALPHA */
-      1059, /* GL_OPERAND1_ALPHA */
-      1065, /* GL_OPERAND2_ALPHA */
-      1071, /* GL_OPERAND3_ALPHA_NV */
-      1786, /* GL_VERTEX_ARRAY_BINDING */
-      1711, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
-      1712, /* GL_TEXTURE_RANGE_POINTER_APPLE */
-      1852, /* GL_YCBCR_422_APPLE */
-      1775, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-      1777, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-      1720, /* GL_TEXTURE_STORAGE_HINT_APPLE */
-      1514, /* GL_STORAGE_PRIVATE_APPLE */
-      1513, /* GL_STORAGE_CACHED_APPLE */
-      1515, /* GL_STORAGE_SHARED_APPLE */
-      1424, /* GL_SLICE_ACCUM_SUN */
-      1273, /* GL_QUAD_MESH_SUN */
-      1745, /* GL_TRIANGLE_MESH_SUN */
-      1825, /* GL_VERTEX_PROGRAM_ARB */
-      1836, /* GL_VERTEX_STATE_PROGRAM_NV */
-      1812, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-      1818, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-      1820, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-      1822, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+      1227, /* GL_PRIMARY_COLOR */
+      1224, /* GL_PREVIOUS */
+      1455, /* GL_SOURCE0_RGB */
+      1461, /* GL_SOURCE1_RGB */
+      1467, /* GL_SOURCE2_RGB */
+      1471, /* GL_SOURCE3_RGB_NV */
+      1452, /* GL_SOURCE0_ALPHA */
+      1458, /* GL_SOURCE1_ALPHA */
+      1464, /* GL_SOURCE2_ALPHA */
+      1470, /* GL_SOURCE3_ALPHA_NV */
+      1069, /* GL_OPERAND0_RGB */
+      1075, /* GL_OPERAND1_RGB */
+      1081, /* GL_OPERAND2_RGB */
+      1085, /* GL_OPERAND3_RGB_NV */
+      1066, /* GL_OPERAND0_ALPHA */
+      1072, /* GL_OPERAND1_ALPHA */
+      1078, /* GL_OPERAND2_ALPHA */
+      1084, /* GL_OPERAND3_ALPHA_NV */
+      1810, /* GL_VERTEX_ARRAY_BINDING */
+      1733, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+      1734, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+      1876, /* GL_YCBCR_422_APPLE */
+      1799, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+      1801, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+      1743, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+      1536, /* GL_STORAGE_PRIVATE_APPLE */
+      1535, /* GL_STORAGE_CACHED_APPLE */
+      1537, /* GL_STORAGE_SHARED_APPLE */
+      1442, /* GL_SLICE_ACCUM_SUN */
+      1288, /* GL_QUAD_MESH_SUN */
+      1768, /* GL_TRIANGLE_MESH_SUN */
+      1849, /* GL_VERTEX_PROGRAM_ARB */
+      1860, /* GL_VERTEX_STATE_PROGRAM_NV */
+      1836, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+      1842, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+      1844, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+      1846, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
        334, /* GL_CURRENT_VERTEX_ATTRIB */
-      1227, /* GL_PROGRAM_LENGTH_ARB */
-      1241, /* GL_PROGRAM_STRING_ARB */
-       985, /* GL_MODELVIEW_PROJECTION_NV */
-       614, /* GL_IDENTITY_NV */
-       661, /* GL_INVERSE_NV */
-      1738, /* GL_TRANSPOSE_NV */
-       662, /* GL_INVERSE_TRANSPOSE_NV */
-       892, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-       891, /* GL_MAX_PROGRAM_MATRICES_ARB */
-       799, /* GL_MATRIX0_NV */
-       811, /* GL_MATRIX1_NV */
-       823, /* GL_MATRIX2_NV */
-       827, /* GL_MATRIX3_NV */
-       829, /* GL_MATRIX4_NV */
-       831, /* GL_MATRIX5_NV */
-       833, /* GL_MATRIX6_NV */
-       835, /* GL_MATRIX7_NV */
+      1240, /* GL_PROGRAM_LENGTH_ARB */
+      1254, /* GL_PROGRAM_STRING_ARB */
+       998, /* GL_MODELVIEW_PROJECTION_NV */
+       623, /* GL_IDENTITY_NV */
+       670, /* GL_INVERSE_NV */
+      1761, /* GL_TRANSPOSE_NV */
+       671, /* GL_INVERSE_TRANSPOSE_NV */
+       903, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+       902, /* GL_MAX_PROGRAM_MATRICES_ARB */
+       809, /* GL_MATRIX0_NV */
+       821, /* GL_MATRIX1_NV */
+       833, /* GL_MATRIX2_NV */
+       837, /* GL_MATRIX3_NV */
+       839, /* GL_MATRIX4_NV */
+       841, /* GL_MATRIX5_NV */
+       843, /* GL_MATRIX6_NV */
+       845, /* GL_MATRIX7_NV */
        318, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
        315, /* GL_CURRENT_MATRIX_ARB */
-      1828, /* GL_VERTEX_PROGRAM_POINT_SIZE */
-      1831, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-      1239, /* GL_PROGRAM_PARAMETER_NV */
-      1816, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-      1243, /* GL_PROGRAM_TARGET_NV */
-      1240, /* GL_PROGRAM_RESIDENT_NV */
-      1730, /* GL_TRACK_MATRIX_NV */
-      1731, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-      1826, /* GL_VERTEX_PROGRAM_BINDING_NV */
-      1221, /* GL_PROGRAM_ERROR_POSITION_ARB */
-       355, /* GL_DEPTH_CLAMP_NV */
-      1794, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-      1801, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-      1802, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-      1803, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-      1804, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-      1805, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-      1806, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-      1807, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-      1808, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-      1809, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-      1795, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-      1796, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-      1797, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-      1798, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-      1799, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-      1800, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-       747, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-       754, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-       755, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-       756, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-       757, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-       758, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-       759, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-       760, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-       761, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-       762, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-       748, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-       749, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-       750, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-       751, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-       752, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-       753, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-       774, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-       781, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-       782, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-       783, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-       784, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-       785, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-       786, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-      1220, /* GL_PROGRAM_BINDING_ARB */
-       788, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-       789, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-       775, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-       776, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-       777, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-       778, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-       779, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-       780, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-      1646, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-      1643, /* GL_TEXTURE_COMPRESSED */
-      1024, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+      1852, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+      1855, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+      1252, /* GL_PROGRAM_PARAMETER_NV */
+      1840, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+      1256, /* GL_PROGRAM_TARGET_NV */
+      1253, /* GL_PROGRAM_RESIDENT_NV */
+      1753, /* GL_TRACK_MATRIX_NV */
+      1754, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+      1850, /* GL_VERTEX_PROGRAM_BINDING_NV */
+      1234, /* GL_PROGRAM_ERROR_POSITION_ARB */
+       356, /* GL_DEPTH_CLAMP */
+      1818, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+      1825, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+      1826, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+      1827, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+      1828, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+      1829, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+      1830, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+      1831, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+      1832, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+      1833, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+      1819, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+      1820, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+      1821, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+      1822, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+      1823, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+      1824, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+       757, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+       764, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+       765, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+       766, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+       767, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+       768, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+       769, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+       770, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+       771, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+       772, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+       758, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+       759, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+       760, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+       761, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+       762, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+       763, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+       784, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+       791, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+       792, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+       793, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+       794, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+       795, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+       796, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+      1233, /* GL_PROGRAM_BINDING_ARB */
+       798, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+       799, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+       785, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+       786, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+       787, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+       788, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+       789, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+       790, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+      1668, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+      1665, /* GL_TEXTURE_COMPRESSED */
+      1037, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
        269, /* GL_COMPRESSED_TEXTURE_FORMATS */
-       933, /* GL_MAX_VERTEX_UNITS_ARB */
+       946, /* GL_MAX_VERTEX_UNITS_ARB */
         22, /* GL_ACTIVE_VERTEX_UNITS_ARB */
-      1847, /* GL_WEIGHT_SUM_UNITY_ARB */
-      1824, /* GL_VERTEX_BLEND_ARB */
+      1871, /* GL_WEIGHT_SUM_UNITY_ARB */
+      1848, /* GL_VERTEX_BLEND_ARB */
        336, /* GL_CURRENT_WEIGHT_ARB */
-      1846, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-      1845, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-      1844, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-      1843, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-      1840, /* GL_WEIGHT_ARRAY_ARB */
-       383, /* GL_DOT3_RGB */
-       384, /* GL_DOT3_RGBA */
+      1870, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+      1869, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+      1868, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+      1867, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+      1864, /* GL_WEIGHT_ARRAY_ARB */
+       386, /* GL_DOT3_RGB */
+       387, /* GL_DOT3_RGBA */
        263, /* GL_COMPRESSED_RGB_FXT1_3DFX */
        258, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
-       993, /* GL_MULTISAMPLE_3DFX */
-      1386, /* GL_SAMPLE_BUFFERS_3DFX */
-      1377, /* GL_SAMPLES_3DFX */
-       974, /* GL_MODELVIEW2_ARB */
-       977, /* GL_MODELVIEW3_ARB */
-       978, /* GL_MODELVIEW4_ARB */
-       979, /* GL_MODELVIEW5_ARB */
-       980, /* GL_MODELVIEW6_ARB */
-       981, /* GL_MODELVIEW7_ARB */
-       982, /* GL_MODELVIEW8_ARB */
-       983, /* GL_MODELVIEW9_ARB */
-       953, /* GL_MODELVIEW10_ARB */
-       954, /* GL_MODELVIEW11_ARB */
-       955, /* GL_MODELVIEW12_ARB */
-       956, /* GL_MODELVIEW13_ARB */
-       957, /* GL_MODELVIEW14_ARB */
-       958, /* GL_MODELVIEW15_ARB */
-       959, /* GL_MODELVIEW16_ARB */
-       960, /* GL_MODELVIEW17_ARB */
-       961, /* GL_MODELVIEW18_ARB */
-       962, /* GL_MODELVIEW19_ARB */
-       964, /* GL_MODELVIEW20_ARB */
-       965, /* GL_MODELVIEW21_ARB */
-       966, /* GL_MODELVIEW22_ARB */
-       967, /* GL_MODELVIEW23_ARB */
-       968, /* GL_MODELVIEW24_ARB */
-       969, /* GL_MODELVIEW25_ARB */
-       970, /* GL_MODELVIEW26_ARB */
-       971, /* GL_MODELVIEW27_ARB */
-       972, /* GL_MODELVIEW28_ARB */
-       973, /* GL_MODELVIEW29_ARB */
-       975, /* GL_MODELVIEW30_ARB */
-       976, /* GL_MODELVIEW31_ARB */
-       388, /* GL_DOT3_RGB_EXT */
-       386, /* GL_DOT3_RGBA_EXT */
-       947, /* GL_MIRROR_CLAMP_EXT */
-       950, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-       988, /* GL_MODULATE_ADD_ATI */
-       989, /* GL_MODULATE_SIGNED_ADD_ATI */
-       990, /* GL_MODULATE_SUBTRACT_ATI */
-      1853, /* GL_YCBCR_MESA */
-      1080, /* GL_PACK_INVERT_MESA */
+      1006, /* GL_MULTISAMPLE_3DFX */
+      1404, /* GL_SAMPLE_BUFFERS_3DFX */
+      1395, /* GL_SAMPLES_3DFX */
+       987, /* GL_MODELVIEW2_ARB */
+       990, /* GL_MODELVIEW3_ARB */
+       991, /* GL_MODELVIEW4_ARB */
+       992, /* GL_MODELVIEW5_ARB */
+       993, /* GL_MODELVIEW6_ARB */
+       994, /* GL_MODELVIEW7_ARB */
+       995, /* GL_MODELVIEW8_ARB */
+       996, /* GL_MODELVIEW9_ARB */
+       966, /* GL_MODELVIEW10_ARB */
+       967, /* GL_MODELVIEW11_ARB */
+       968, /* GL_MODELVIEW12_ARB */
+       969, /* GL_MODELVIEW13_ARB */
+       970, /* GL_MODELVIEW14_ARB */
+       971, /* GL_MODELVIEW15_ARB */
+       972, /* GL_MODELVIEW16_ARB */
+       973, /* GL_MODELVIEW17_ARB */
+       974, /* GL_MODELVIEW18_ARB */
+       975, /* GL_MODELVIEW19_ARB */
+       977, /* GL_MODELVIEW20_ARB */
+       978, /* GL_MODELVIEW21_ARB */
+       979, /* GL_MODELVIEW22_ARB */
+       980, /* GL_MODELVIEW23_ARB */
+       981, /* GL_MODELVIEW24_ARB */
+       982, /* GL_MODELVIEW25_ARB */
+       983, /* GL_MODELVIEW26_ARB */
+       984, /* GL_MODELVIEW27_ARB */
+       985, /* GL_MODELVIEW28_ARB */
+       986, /* GL_MODELVIEW29_ARB */
+       988, /* GL_MODELVIEW30_ARB */
+       989, /* GL_MODELVIEW31_ARB */
+       391, /* GL_DOT3_RGB_EXT */
+       389, /* GL_DOT3_RGBA_EXT */
+       960, /* GL_MIRROR_CLAMP_EXT */
+       963, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+      1001, /* GL_MODULATE_ADD_ATI */
+      1002, /* GL_MODULATE_SIGNED_ADD_ATI */
+      1003, /* GL_MODULATE_SUBTRACT_ATI */
+      1877, /* GL_YCBCR_MESA */
+      1093, /* GL_PACK_INVERT_MESA */
        339, /* GL_DEBUG_OBJECT_MESA */
        340, /* GL_DEBUG_PRINT_MESA */
        338, /* GL_DEBUG_ASSERT_MESA */
@@ -4752,292 +4800,292 @@ static const unsigned reduced_enums[1347] =
        117, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
        115, /* GL_BUMP_NUM_TEX_UNITS_ATI */
        119, /* GL_BUMP_TEX_UNITS_ATI */
-       447, /* GL_DUDV_ATI */
-       446, /* GL_DU8DV8_ATI */
+       451, /* GL_DUDV_ATI */
+       450, /* GL_DU8DV8_ATI */
        114, /* GL_BUMP_ENVMAP_ATI */
        118, /* GL_BUMP_TARGET_ATI */
-      1485, /* GL_STENCIL_BACK_FUNC */
-      1483, /* GL_STENCIL_BACK_FAIL */
-      1487, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-      1489, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-       531, /* GL_FRAGMENT_PROGRAM_ARB */
-      1218, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-      1246, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-      1245, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-      1230, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-      1236, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-      1235, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-       881, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-       904, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-       903, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-       894, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-       900, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-       899, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-       864, /* GL_MAX_DRAW_BUFFERS */
-       392, /* GL_DRAW_BUFFER0 */
-       395, /* GL_DRAW_BUFFER1 */
-       416, /* GL_DRAW_BUFFER2 */
-       419, /* GL_DRAW_BUFFER3 */
-       422, /* GL_DRAW_BUFFER4 */
-       425, /* GL_DRAW_BUFFER5 */
-       428, /* GL_DRAW_BUFFER6 */
-       431, /* GL_DRAW_BUFFER7 */
-       434, /* GL_DRAW_BUFFER8 */
-       437, /* GL_DRAW_BUFFER9 */
-       396, /* GL_DRAW_BUFFER10 */
-       399, /* GL_DRAW_BUFFER11 */
-       402, /* GL_DRAW_BUFFER12 */
-       405, /* GL_DRAW_BUFFER13 */
-       408, /* GL_DRAW_BUFFER14 */
-       411, /* GL_DRAW_BUFFER15 */
+      1503, /* GL_STENCIL_BACK_FUNC */
+      1501, /* GL_STENCIL_BACK_FAIL */
+      1505, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+      1507, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+       536, /* GL_FRAGMENT_PROGRAM_ARB */
+      1231, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+      1259, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+      1258, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+      1243, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+      1249, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+      1248, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+       892, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+       915, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+       914, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+       905, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+       911, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+       910, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+       875, /* GL_MAX_DRAW_BUFFERS */
+       395, /* GL_DRAW_BUFFER0 */
+       398, /* GL_DRAW_BUFFER1 */
+       419, /* GL_DRAW_BUFFER2 */
+       422, /* GL_DRAW_BUFFER3 */
+       425, /* GL_DRAW_BUFFER4 */
+       428, /* GL_DRAW_BUFFER5 */
+       431, /* GL_DRAW_BUFFER6 */
+       434, /* GL_DRAW_BUFFER7 */
+       437, /* GL_DRAW_BUFFER8 */
+       440, /* GL_DRAW_BUFFER9 */
+       399, /* GL_DRAW_BUFFER10 */
+       402, /* GL_DRAW_BUFFER11 */
+       405, /* GL_DRAW_BUFFER12 */
+       408, /* GL_DRAW_BUFFER13 */
+       411, /* GL_DRAW_BUFFER14 */
+       414, /* GL_DRAW_BUFFER15 */
         82, /* GL_BLEND_EQUATION_ALPHA */
-       844, /* GL_MATRIX_PALETTE_ARB */
-       875, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-       878, /* GL_MAX_PALETTE_MATRICES_ARB */
+       854, /* GL_MATRIX_PALETTE_ARB */
+       886, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+       889, /* GL_MAX_PALETTE_MATRICES_ARB */
        321, /* GL_CURRENT_PALETTE_MATRIX_ARB */
-       838, /* GL_MATRIX_INDEX_ARRAY_ARB */
+       848, /* GL_MATRIX_INDEX_ARRAY_ARB */
        316, /* GL_CURRENT_MATRIX_INDEX_ARB */
-       840, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-       842, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-       841, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-       839, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-      1673, /* GL_TEXTURE_DEPTH_SIZE */
-       376, /* GL_DEPTH_TEXTURE_MODE */
-      1638, /* GL_TEXTURE_COMPARE_MODE */
-      1636, /* GL_TEXTURE_COMPARE_FUNC */
+       850, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+       852, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+       851, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+       849, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+      1695, /* GL_TEXTURE_DEPTH_SIZE */
+       379, /* GL_DEPTH_TEXTURE_MODE */
+      1660, /* GL_TEXTURE_COMPARE_MODE */
+      1658, /* GL_TEXTURE_COMPARE_FUNC */
        242, /* GL_COMPARE_R_TO_TEXTURE */
-      1152, /* GL_POINT_SPRITE */
+      1165, /* GL_POINT_SPRITE */
        296, /* GL_COORD_REPLACE */
-      1156, /* GL_POINT_SPRITE_R_MODE_NV */
-      1275, /* GL_QUERY_COUNTER_BITS */
+      1169, /* GL_POINT_SPRITE_R_MODE_NV */
+      1290, /* GL_QUERY_COUNTER_BITS */
        323, /* GL_CURRENT_QUERY */
-      1277, /* GL_QUERY_RESULT */
-      1279, /* GL_QUERY_RESULT_AVAILABLE */
-       927, /* GL_MAX_VERTEX_ATTRIBS */
-      1814, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-       374, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-       373, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-       913, /* GL_MAX_TEXTURE_COORDS */
-       915, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-      1223, /* GL_PROGRAM_ERROR_STRING_ARB */
-      1225, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-      1224, /* GL_PROGRAM_FORMAT_ARB */
-      1722, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-       353, /* GL_DEPTH_BOUNDS_TEST_EXT */
-       352, /* GL_DEPTH_BOUNDS_EXT */
+      1292, /* GL_QUERY_RESULT */
+      1294, /* GL_QUERY_RESULT_AVAILABLE */
+       940, /* GL_MAX_VERTEX_ATTRIBS */
+      1838, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+       377, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+       376, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+       926, /* GL_MAX_TEXTURE_COORDS */
+       928, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+      1236, /* GL_PROGRAM_ERROR_STRING_ARB */
+      1238, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+      1237, /* GL_PROGRAM_FORMAT_ARB */
+      1745, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+       354, /* GL_DEPTH_BOUNDS_TEST_EXT */
+       353, /* GL_DEPTH_BOUNDS_EXT */
         53, /* GL_ARRAY_BUFFER */
-       460, /* GL_ELEMENT_ARRAY_BUFFER */
+       464, /* GL_ELEMENT_ARRAY_BUFFER */
         54, /* GL_ARRAY_BUFFER_BINDING */
-       461, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-      1788, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-      1014, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+       465, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+      1812, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+      1027, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
        149, /* GL_COLOR_ARRAY_BUFFER_BINDING */
-       623, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-      1651, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-       456, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-      1398, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-       509, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-      1841, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-      1810, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-      1226, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-       887, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-      1232, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-       896, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-      1244, /* GL_PROGRAM_TEMPORARIES_ARB */
-       902, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-      1234, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-       898, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-      1238, /* GL_PROGRAM_PARAMETERS_ARB */
-       901, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-      1233, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-       897, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-      1219, /* GL_PROGRAM_ATTRIBS_ARB */
-       882, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-      1231, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-       895, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-      1217, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-       880, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-      1229, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-       893, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-       888, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-       884, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-      1247, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-      1735, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-      1288, /* GL_READ_ONLY */
-      1849, /* GL_WRITE_ONLY */
-      1290, /* GL_READ_WRITE */
+       632, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+      1673, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+       460, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+      1416, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+       514, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+      1865, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+      1834, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+      1239, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+       898, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+      1245, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+       907, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+      1257, /* GL_PROGRAM_TEMPORARIES_ARB */
+       913, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+      1247, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+       909, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+      1251, /* GL_PROGRAM_PARAMETERS_ARB */
+       912, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+      1246, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+       908, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+      1232, /* GL_PROGRAM_ATTRIBS_ARB */
+       893, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+      1244, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+       906, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+      1230, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+       891, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+      1242, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+       904, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+       899, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+       895, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+      1260, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+      1758, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+      1304, /* GL_READ_ONLY */
+      1873, /* GL_WRITE_ONLY */
+      1306, /* GL_READ_WRITE */
        102, /* GL_BUFFER_ACCESS */
        105, /* GL_BUFFER_MAPPED */
        107, /* GL_BUFFER_MAP_POINTER */
-      1729, /* GL_TIME_ELAPSED_EXT */
-       798, /* GL_MATRIX0_ARB */
-       810, /* GL_MATRIX1_ARB */
-       822, /* GL_MATRIX2_ARB */
-       826, /* GL_MATRIX3_ARB */
-       828, /* GL_MATRIX4_ARB */
-       830, /* GL_MATRIX5_ARB */
-       832, /* GL_MATRIX6_ARB */
-       834, /* GL_MATRIX7_ARB */
-       836, /* GL_MATRIX8_ARB */
-       837, /* GL_MATRIX9_ARB */
-       800, /* GL_MATRIX10_ARB */
-       801, /* GL_MATRIX11_ARB */
-       802, /* GL_MATRIX12_ARB */
-       803, /* GL_MATRIX13_ARB */
-       804, /* GL_MATRIX14_ARB */
-       805, /* GL_MATRIX15_ARB */
-       806, /* GL_MATRIX16_ARB */
-       807, /* GL_MATRIX17_ARB */
-       808, /* GL_MATRIX18_ARB */
-       809, /* GL_MATRIX19_ARB */
-       812, /* GL_MATRIX20_ARB */
-       813, /* GL_MATRIX21_ARB */
-       814, /* GL_MATRIX22_ARB */
-       815, /* GL_MATRIX23_ARB */
-       816, /* GL_MATRIX24_ARB */
-       817, /* GL_MATRIX25_ARB */
-       818, /* GL_MATRIX26_ARB */
-       819, /* GL_MATRIX27_ARB */
-       820, /* GL_MATRIX28_ARB */
-       821, /* GL_MATRIX29_ARB */
-       824, /* GL_MATRIX30_ARB */
-       825, /* GL_MATRIX31_ARB */
-      1518, /* GL_STREAM_DRAW */
-      1520, /* GL_STREAM_READ */
-      1516, /* GL_STREAM_COPY */
-      1476, /* GL_STATIC_DRAW */
-      1478, /* GL_STATIC_READ */
-      1474, /* GL_STATIC_COPY */
-       450, /* GL_DYNAMIC_DRAW */
-       452, /* GL_DYNAMIC_READ */
-       448, /* GL_DYNAMIC_COPY */
-      1120, /* GL_PIXEL_PACK_BUFFER */
-      1124, /* GL_PIXEL_UNPACK_BUFFER */
-      1121, /* GL_PIXEL_PACK_BUFFER_BINDING */
-      1125, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+      1752, /* GL_TIME_ELAPSED_EXT */
+       808, /* GL_MATRIX0_ARB */
+       820, /* GL_MATRIX1_ARB */
+       832, /* GL_MATRIX2_ARB */
+       836, /* GL_MATRIX3_ARB */
+       838, /* GL_MATRIX4_ARB */
+       840, /* GL_MATRIX5_ARB */
+       842, /* GL_MATRIX6_ARB */
+       844, /* GL_MATRIX7_ARB */
+       846, /* GL_MATRIX8_ARB */
+       847, /* GL_MATRIX9_ARB */
+       810, /* GL_MATRIX10_ARB */
+       811, /* GL_MATRIX11_ARB */
+       812, /* GL_MATRIX12_ARB */
+       813, /* GL_MATRIX13_ARB */
+       814, /* GL_MATRIX14_ARB */
+       815, /* GL_MATRIX15_ARB */
+       816, /* GL_MATRIX16_ARB */
+       817, /* GL_MATRIX17_ARB */
+       818, /* GL_MATRIX18_ARB */
+       819, /* GL_MATRIX19_ARB */
+       822, /* GL_MATRIX20_ARB */
+       823, /* GL_MATRIX21_ARB */
+       824, /* GL_MATRIX22_ARB */
+       825, /* GL_MATRIX23_ARB */
+       826, /* GL_MATRIX24_ARB */
+       827, /* GL_MATRIX25_ARB */
+       828, /* GL_MATRIX26_ARB */
+       829, /* GL_MATRIX27_ARB */
+       830, /* GL_MATRIX28_ARB */
+       831, /* GL_MATRIX29_ARB */
+       834, /* GL_MATRIX30_ARB */
+       835, /* GL_MATRIX31_ARB */
+      1540, /* GL_STREAM_DRAW */
+      1542, /* GL_STREAM_READ */
+      1538, /* GL_STREAM_COPY */
+      1494, /* GL_STATIC_DRAW */
+      1496, /* GL_STATIC_READ */
+      1492, /* GL_STATIC_COPY */
+       454, /* GL_DYNAMIC_DRAW */
+       456, /* GL_DYNAMIC_READ */
+       452, /* GL_DYNAMIC_COPY */
+      1133, /* GL_PIXEL_PACK_BUFFER */
+      1137, /* GL_PIXEL_UNPACK_BUFFER */
+      1134, /* GL_PIXEL_PACK_BUFFER_BINDING */
+      1138, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
        347, /* GL_DEPTH24_STENCIL8 */
-      1719, /* GL_TEXTURE_STENCIL_SIZE */
-      1671, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
-       883, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-       886, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-       890, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-       889, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-       847, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
-      1509, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+      1741, /* GL_TEXTURE_STENCIL_SIZE */
+      1693, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+       894, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+       897, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+       901, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+       900, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+       857, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+      1531, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
         17, /* GL_ACTIVE_STENCIL_FACE_EXT */
-       948, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-      1379, /* GL_SAMPLES_PASSED */
+       961, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+      1397, /* GL_SAMPLES_PASSED */
        109, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */
        104, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */
-       532, /* GL_FRAGMENT_SHADER */
-      1834, /* GL_VERTEX_SHADER */
-      1237, /* GL_PROGRAM_OBJECT_ARB */
-      1411, /* GL_SHADER_OBJECT_ARB */
-       871, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-       931, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-       925, /* GL_MAX_VARYING_FLOATS */
-       929, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-       856, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-      1040, /* GL_OBJECT_TYPE_ARB */
-      1413, /* GL_SHADER_TYPE */
-       497, /* GL_FLOAT_VEC2 */
-       499, /* GL_FLOAT_VEC3 */
-       501, /* GL_FLOAT_VEC4 */
-       650, /* GL_INT_VEC2 */
-       652, /* GL_INT_VEC3 */
-       654, /* GL_INT_VEC4 */
+       537, /* GL_FRAGMENT_SHADER */
+      1858, /* GL_VERTEX_SHADER */
+      1250, /* GL_PROGRAM_OBJECT_ARB */
+      1429, /* GL_SHADER_OBJECT_ARB */
+       882, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+       944, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+       938, /* GL_MAX_VARYING_FLOATS */
+       942, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+       867, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+      1053, /* GL_OBJECT_TYPE_ARB */
+      1431, /* GL_SHADER_TYPE */
+       502, /* GL_FLOAT_VEC2 */
+       504, /* GL_FLOAT_VEC3 */
+       506, /* GL_FLOAT_VEC4 */
+       659, /* GL_INT_VEC2 */
+       661, /* GL_INT_VEC3 */
+       663, /* GL_INT_VEC4 */
         94, /* GL_BOOL */
         96, /* GL_BOOL_VEC2 */
         98, /* GL_BOOL_VEC3 */
        100, /* GL_BOOL_VEC4 */
-       485, /* GL_FLOAT_MAT2 */
-       489, /* GL_FLOAT_MAT3 */
-       493, /* GL_FLOAT_MAT4 */
-      1370, /* GL_SAMPLER_1D */
-      1372, /* GL_SAMPLER_2D */
-      1374, /* GL_SAMPLER_3D */
-      1375, /* GL_SAMPLER_CUBE */
-      1371, /* GL_SAMPLER_1D_SHADOW */
-      1373, /* GL_SAMPLER_2D_SHADOW */
-       487, /* GL_FLOAT_MAT2x3 */
-       488, /* GL_FLOAT_MAT2x4 */
-       491, /* GL_FLOAT_MAT3x2 */
-       492, /* GL_FLOAT_MAT3x4 */
-       495, /* GL_FLOAT_MAT4x2 */
-       496, /* GL_FLOAT_MAT4x3 */
+       490, /* GL_FLOAT_MAT2 */
+       494, /* GL_FLOAT_MAT3 */
+       498, /* GL_FLOAT_MAT4 */
+      1388, /* GL_SAMPLER_1D */
+      1390, /* GL_SAMPLER_2D */
+      1392, /* GL_SAMPLER_3D */
+      1393, /* GL_SAMPLER_CUBE */
+      1389, /* GL_SAMPLER_1D_SHADOW */
+      1391, /* GL_SAMPLER_2D_SHADOW */
+       492, /* GL_FLOAT_MAT2x3 */
+       493, /* GL_FLOAT_MAT2x4 */
+       496, /* GL_FLOAT_MAT3x2 */
+       497, /* GL_FLOAT_MAT3x4 */
+       500, /* GL_FLOAT_MAT4x2 */
+       501, /* GL_FLOAT_MAT4x3 */
        345, /* GL_DELETE_STATUS */
        246, /* GL_COMPILE_STATUS */
-       705, /* GL_LINK_STATUS */
-      1782, /* GL_VALIDATE_STATUS */
-       635, /* GL_INFO_LOG_LENGTH */
+       715, /* GL_LINK_STATUS */
+      1806, /* GL_VALIDATE_STATUS */
+       644, /* GL_INFO_LOG_LENGTH */
         56, /* GL_ATTACHED_SHADERS */
         20, /* GL_ACTIVE_UNIFORMS */
         21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
-      1412, /* GL_SHADER_SOURCE_LENGTH */
+      1430, /* GL_SHADER_SOURCE_LENGTH */
         15, /* GL_ACTIVE_ATTRIBUTES */
         16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
-       534, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-      1415, /* GL_SHADING_LANGUAGE_VERSION */
+       539, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+      1433, /* GL_SHADING_LANGUAGE_VERSION */
        322, /* GL_CURRENT_PROGRAM */
-      1089, /* GL_PALETTE4_RGB8_OES */
-      1091, /* GL_PALETTE4_RGBA8_OES */
-      1087, /* GL_PALETTE4_R5_G6_B5_OES */
-      1090, /* GL_PALETTE4_RGBA4_OES */
-      1088, /* GL_PALETTE4_RGB5_A1_OES */
-      1094, /* GL_PALETTE8_RGB8_OES */
-      1096, /* GL_PALETTE8_RGBA8_OES */
-      1092, /* GL_PALETTE8_R5_G6_B5_OES */
-      1095, /* GL_PALETTE8_RGBA4_OES */
-      1093, /* GL_PALETTE8_RGB5_A1_OES */
-       617, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-       616, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
-      1767, /* GL_UNSIGNED_NORMALIZED */
-      1606, /* GL_TEXTURE_1D_ARRAY_EXT */
-      1258, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
-      1608, /* GL_TEXTURE_2D_ARRAY_EXT */
-      1261, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
-      1614, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
-      1616, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
-      1468, /* GL_SRGB */
-      1469, /* GL_SRGB8 */
-      1471, /* GL_SRGB_ALPHA */
-      1470, /* GL_SRGB8_ALPHA8 */
-      1428, /* GL_SLUMINANCE_ALPHA */
-      1427, /* GL_SLUMINANCE8_ALPHA8 */
-      1425, /* GL_SLUMINANCE */
-      1426, /* GL_SLUMINANCE8 */
+      1102, /* GL_PALETTE4_RGB8_OES */
+      1104, /* GL_PALETTE4_RGBA8_OES */
+      1100, /* GL_PALETTE4_R5_G6_B5_OES */
+      1103, /* GL_PALETTE4_RGBA4_OES */
+      1101, /* GL_PALETTE4_RGB5_A1_OES */
+      1107, /* GL_PALETTE8_RGB8_OES */
+      1109, /* GL_PALETTE8_RGBA8_OES */
+      1105, /* GL_PALETTE8_R5_G6_B5_OES */
+      1108, /* GL_PALETTE8_RGBA4_OES */
+      1106, /* GL_PALETTE8_RGB5_A1_OES */
+       626, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+       625, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+      1791, /* GL_UNSIGNED_NORMALIZED */
+      1628, /* GL_TEXTURE_1D_ARRAY_EXT */
+      1272, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+      1630, /* GL_TEXTURE_2D_ARRAY_EXT */
+      1275, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+      1636, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+      1638, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+      1486, /* GL_SRGB */
+      1487, /* GL_SRGB8 */
+      1489, /* GL_SRGB_ALPHA */
+      1488, /* GL_SRGB8_ALPHA8 */
+      1446, /* GL_SLUMINANCE_ALPHA */
+      1445, /* GL_SLUMINANCE8_ALPHA8 */
+      1443, /* GL_SLUMINANCE */
+      1444, /* GL_SLUMINANCE8 */
        267, /* GL_COMPRESSED_SRGB */
        268, /* GL_COMPRESSED_SRGB_ALPHA */
        265, /* GL_COMPRESSED_SLUMINANCE */
        266, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
-      1154, /* GL_POINT_SPRITE_COORD_ORIGIN */
-       713, /* GL_LOWER_LEFT */
-      1779, /* GL_UPPER_LEFT */
-      1491, /* GL_STENCIL_BACK_REF */
-      1492, /* GL_STENCIL_BACK_VALUE_MASK */
-      1493, /* GL_STENCIL_BACK_WRITEMASK */
-       441, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
-      1304, /* GL_RENDERBUFFER_BINDING_EXT */
-      1285, /* GL_READ_FRAMEBUFFER */
-       440, /* GL_DRAW_FRAMEBUFFER */
-      1286, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
-      1314, /* GL_RENDERBUFFER_SAMPLES */
-       544, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-       542, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-       553, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-       549, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-       551, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-       556, /* GL_FRAMEBUFFER_COMPLETE */
-       560, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-       566, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-       564, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-       562, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-       565, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-       563, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
-       569, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
-       572, /* GL_FRAMEBUFFER_UNSUPPORTED */
-       570, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-       853, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+      1167, /* GL_POINT_SPRITE_COORD_ORIGIN */
+       723, /* GL_LOWER_LEFT */
+      1803, /* GL_UPPER_LEFT */
+      1509, /* GL_STENCIL_BACK_REF */
+      1510, /* GL_STENCIL_BACK_VALUE_MASK */
+      1511, /* GL_STENCIL_BACK_WRITEMASK */
+       444, /* GL_DRAW_FRAMEBUFFER_BINDING */
+      1320, /* GL_RENDERBUFFER_BINDING */
+      1300, /* GL_READ_FRAMEBUFFER */
+       443, /* GL_DRAW_FRAMEBUFFER */
+      1301, /* GL_READ_FRAMEBUFFER_BINDING */
+      1331, /* GL_RENDERBUFFER_SAMPLES */
+       549, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+       547, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+       558, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+       554, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+       556, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+       562, /* GL_FRAMEBUFFER_COMPLETE */
+       566, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+       573, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+       571, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+       568, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+       572, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+       569, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+       577, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+       581, /* GL_FRAMEBUFFER_UNSUPPORTED */
+       579, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+       863, /* GL_MAX_COLOR_ATTACHMENTS */
        155, /* GL_COLOR_ATTACHMENT0 */
        157, /* GL_COLOR_ATTACHMENT1 */
        171, /* GL_COLOR_ATTACHMENT2 */
@@ -5054,57 +5102,57 @@ static const unsigned reduced_enums[1347] =
        164, /* GL_COLOR_ATTACHMENT13 */
        166, /* GL_COLOR_ATTACHMENT14 */
        168, /* GL_COLOR_ATTACHMENT15 */
-       348, /* GL_DEPTH_ATTACHMENT */
-      1481, /* GL_STENCIL_ATTACHMENT */
-       535, /* GL_FRAMEBUFFER */
-      1302, /* GL_RENDERBUFFER */
-      1316, /* GL_RENDERBUFFER_WIDTH */
-      1309, /* GL_RENDERBUFFER_HEIGHT */
-      1311, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-      1504, /* GL_STENCIL_INDEX_EXT */
-      1501, /* GL_STENCIL_INDEX1_EXT */
-      1502, /* GL_STENCIL_INDEX4_EXT */
-      1503, /* GL_STENCIL_INDEX8_EXT */
-      1500, /* GL_STENCIL_INDEX16_EXT */
-      1313, /* GL_RENDERBUFFER_RED_SIZE */
-      1308, /* GL_RENDERBUFFER_GREEN_SIZE */
-      1305, /* GL_RENDERBUFFER_BLUE_SIZE */
-      1303, /* GL_RENDERBUFFER_ALPHA_SIZE */
-      1306, /* GL_RENDERBUFFER_DEPTH_SIZE */
-      1315, /* GL_RENDERBUFFER_STENCIL_SIZE */
-       568, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-       909, /* GL_MAX_SAMPLES */
-      1272, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
-       482, /* GL_FIRST_VERTEX_CONVENTION_EXT */
-       665, /* GL_LAST_VERTEX_CONVENTION_EXT */
-      1251, /* GL_PROVOKING_VERTEX_EXT */
+       349, /* GL_DEPTH_ATTACHMENT */
+      1499, /* GL_STENCIL_ATTACHMENT */
+       540, /* GL_FRAMEBUFFER */
+      1318, /* GL_RENDERBUFFER */
+      1334, /* GL_RENDERBUFFER_WIDTH */
+      1326, /* GL_RENDERBUFFER_HEIGHT */
+      1328, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+      1526, /* GL_STENCIL_INDEX_EXT */
+      1518, /* GL_STENCIL_INDEX1 */
+      1522, /* GL_STENCIL_INDEX4 */
+      1524, /* GL_STENCIL_INDEX8 */
+      1519, /* GL_STENCIL_INDEX16 */
+      1330, /* GL_RENDERBUFFER_RED_SIZE */
+      1325, /* GL_RENDERBUFFER_GREEN_SIZE */
+      1322, /* GL_RENDERBUFFER_BLUE_SIZE */
+      1319, /* GL_RENDERBUFFER_ALPHA_SIZE */
+      1323, /* GL_RENDERBUFFER_DEPTH_SIZE */
+      1333, /* GL_RENDERBUFFER_STENCIL_SIZE */
+       575, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+       921, /* GL_MAX_SAMPLES */
+      1286, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+       486, /* GL_FIRST_VERTEX_CONVENTION */
+       674, /* GL_LAST_VERTEX_CONVENTION */
+      1264, /* GL_PROVOKING_VERTEX */
        302, /* GL_COPY_READ_BUFFER */
        303, /* GL_COPY_WRITE_BUFFER */
-      1363, /* GL_RGBA_SNORM */
-      1359, /* GL_RGBA8_SNORM */
-      1421, /* GL_SIGNED_NORMALIZED */
-       910, /* GL_MAX_SERVER_WAIT_TIMEOUT */
-      1039, /* GL_OBJECT_TYPE */
-      1525, /* GL_SYNC_CONDITION */
-      1530, /* GL_SYNC_STATUS */
-      1527, /* GL_SYNC_FLAGS */
-      1526, /* GL_SYNC_FENCE */
-      1529, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
-      1756, /* GL_UNSIGNALED */
-      1420, /* GL_SIGNALED */
+      1381, /* GL_RGBA_SNORM */
+      1377, /* GL_RGBA8_SNORM */
+      1439, /* GL_SIGNED_NORMALIZED */
+       923, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+      1052, /* GL_OBJECT_TYPE */
+      1547, /* GL_SYNC_CONDITION */
+      1552, /* GL_SYNC_STATUS */
+      1549, /* GL_SYNC_FLAGS */
+      1548, /* GL_SYNC_FENCE */
+      1551, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+      1779, /* GL_UNSIGNALED */
+      1438, /* GL_SIGNALED */
         46, /* GL_ALREADY_SIGNALED */
-      1727, /* GL_TIMEOUT_EXPIRED */
+      1750, /* GL_TIMEOUT_EXPIRED */
        270, /* GL_CONDITION_SATISFIED */
-      1839, /* GL_WAIT_FAILED */
-       467, /* GL_EVAL_BIT */
-      1283, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-       707, /* GL_LIST_BIT */
-      1622, /* GL_TEXTURE_BIT */
-      1394, /* GL_SCISSOR_BIT */
+      1863, /* GL_WAIT_FAILED */
+       471, /* GL_EVAL_BIT */
+      1298, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+       717, /* GL_LIST_BIT */
+      1644, /* GL_TEXTURE_BIT */
+      1412, /* GL_SCISSOR_BIT */
         29, /* GL_ALL_ATTRIB_BITS */
-       995, /* GL_MULTISAMPLE_BIT */
+      1008, /* GL_MULTISAMPLE_BIT */
         30, /* GL_ALL_CLIENT_ATTRIB_BITS */
-      1728, /* GL_TIMEOUT_IGNORED */
+      1751, /* GL_TIMEOUT_IGNORED */
 };
 
 typedef int (*cfunc)(const void *, const void *);
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index 3f89f9c1e..95d6e2318 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -44,6 +44,10 @@
 #include "eval.h"
 #include "macros.h"
 #include "mtypes.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_evaluators
 
 
 /*
@@ -417,7 +421,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
              GLint order, const GLfloat *points )
 {
@@ -425,7 +429,7 @@ _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
              GLint order, const GLdouble *points )
 {
@@ -516,7 +520,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map2f( GLenum target,
              GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
              GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
@@ -527,7 +531,7 @@ _mesa_Map2f( GLenum target,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Map2d( GLenum target,
              GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
              GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
@@ -539,7 +543,7 @@ _mesa_Map2d( GLenum target,
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -604,7 +608,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -669,7 +673,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -735,7 +739,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -753,14 +757,14 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
 {
    _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 );
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
                  GLint vn, GLfloat v1, GLfloat v2 )
 {
@@ -788,7 +792,7 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
                  GLint vn, GLdouble v1, GLdouble v2 )
 {
@@ -797,6 +801,41 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
 }
 
 
+void
+_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
+                          const GLvertexformat *vfmt)
+{
+   SET_EvalCoord1f(disp, vfmt->EvalCoord1f);
+   SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv);
+   SET_EvalCoord2f(disp, vfmt->EvalCoord2f);
+   SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv);
+   SET_EvalPoint1(disp, vfmt->EvalPoint1);
+   SET_EvalPoint2(disp, vfmt->EvalPoint2);
+
+   SET_EvalMesh1(disp, vfmt->EvalMesh1);
+   SET_EvalMesh2(disp, vfmt->EvalMesh2);
+}
+
+
+void
+_mesa_init_eval_dispatch(struct _glapi_table *disp)
+{
+   SET_GetMapdv(disp, _mesa_GetMapdv);
+   SET_GetMapfv(disp, _mesa_GetMapfv);
+   SET_GetMapiv(disp, _mesa_GetMapiv);
+   SET_Map1d(disp, _mesa_Map1d);
+   SET_Map1f(disp, _mesa_Map1f);
+   SET_Map2d(disp, _mesa_Map2d);
+   SET_Map2f(disp, _mesa_Map2f);
+   SET_MapGrid1d(disp, _mesa_MapGrid1d);
+   SET_MapGrid1f(disp, _mesa_MapGrid1f);
+   SET_MapGrid2d(disp, _mesa_MapGrid2d);
+   SET_MapGrid2f(disp, _mesa_MapGrid2f);
+}
+
+
+#endif /* FEATURE_evaluators */
+
 
 /**********************************************************************/
 /*****                      Initialization                        *****/
diff --git a/mesalib/src/mesa/main/eval.h b/mesalib/src/mesa/main/eval.h
index b3ff0a96f..ffd1bab76 100644
--- a/mesalib/src/mesa/main/eval.h
+++ b/mesalib/src/mesa/main/eval.h
@@ -37,13 +37,22 @@
 #define EVAL_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
-#if _HAVE_FULL_GL
 
-extern void _mesa_init_eval( GLcontext *ctx );
-extern void _mesa_free_eval_data( GLcontext *ctx );
+#if FEATURE_evaluators
 
+#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl)         \
+   do {                                            \
+      (vfmt)->EvalCoord1f  = impl ## EvalCoord1f;  \
+      (vfmt)->EvalCoord1fv = impl ## EvalCoord1fv; \
+      (vfmt)->EvalCoord2f  = impl ## EvalCoord2f;  \
+      (vfmt)->EvalCoord2fv = impl ## EvalCoord2fv; \
+      (vfmt)->EvalPoint1   = impl ## EvalPoint1;   \
+      (vfmt)->EvalPoint2   = impl ## EvalPoint2;   \
+      (vfmt)->EvalMesh1    = impl ## EvalMesh1;    \
+      (vfmt)->EvalMesh2    = impl ## EvalMesh2;    \
+   } while (0)
 
 extern GLuint _mesa_evaluator_components( GLenum target );
 
@@ -70,59 +79,32 @@ extern GLfloat *_mesa_copy_map_points2d(GLenum target,
                                      GLint vstride, GLint vorder,
                                      const GLdouble *points );
 
+extern void
+_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
+                          const GLvertexformat *vfmt);
 
+extern void
+_mesa_init_eval_dispatch(struct _glapi_table *disp);
 
-extern void GLAPIENTRY
-_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
-             GLint order, const GLfloat *points );
-
-extern void GLAPIENTRY
-_mesa_Map2f( GLenum target,
-             GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
-             GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
-             const GLfloat *points );
-
-extern void GLAPIENTRY
-_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
-             GLint order, const GLdouble *points );
-
-extern void GLAPIENTRY
-_mesa_Map2d( GLenum target,
-             GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
-             GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
-             const GLdouble *points );
-
-extern void GLAPIENTRY
-_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
+#else /* FEATURE_evaluators */
 
-extern void GLAPIENTRY
-_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
+#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) do { } while (0)
 
-extern void GLAPIENTRY
-_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
-                 GLint vn, GLfloat v1, GLfloat v2 );
+static INLINE void
+_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
+                          const GLvertexformat *vfmt)
+{
+}
 
-extern void GLAPIENTRY
-_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
-                 GLint vn, GLdouble v1, GLdouble v2 );
+static INLINE void
+_mesa_init_eval_dispatch(struct _glapi_table *disp)
+{
+}
 
-extern void GLAPIENTRY
-_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v );
+#endif /* FEATURE_evaluators */
 
-extern void GLAPIENTRY
-_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v );
-
-extern void GLAPIENTRY
-_mesa_GetMapiv( GLenum target, GLenum query, GLint *v );
-
-#else
-
-/** No-op */
-#define _mesa_init_eval( c ) ((void)0)
-
-/** No-op */
-#define _mesa_free_eval_data( c ) ((void)0)
+extern void _mesa_init_eval( GLcontext *ctx );
+extern void _mesa_free_eval_data( GLcontext *ctx );
 
-#endif
 
-#endif
+#endif /* EVAL_H */
diff --git a/mesalib/src/mesa/main/execmem.c b/mesalib/src/mesa/main/execmem.c
index 57c1e117c..4c6139985 100644
--- a/mesalib/src/mesa/main/execmem.c
+++ b/mesalib/src/mesa/main/execmem.c
@@ -80,11 +80,10 @@ init_heap(void)
       exec_heap = mmInit( 0, EXEC_HEAP_SIZE );
    
    if (!exec_mem)
-      exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE, 
-					PROT_EXEC | PROT_READ | PROT_WRITE, 
-					MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+      exec_mem = mmap(NULL, EXEC_HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE,
+		      MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 
-   return (exec_mem != NULL);
+   return (exec_mem != MAP_FAILED);
 }
 
 
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index e3070b154..2138bfe40 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -47,7 +47,9 @@ static const struct {
 } default_extensions[] = {
    { OFF, "GL_ARB_copy_buffer",                F(ARB_copy_buffer) },
    { OFF, "GL_ARB_depth_texture",              F(ARB_depth_texture) },
+   { OFF, "GL_ARB_depth_clamp",                F(ARB_depth_clamp) },
    { ON,  "GL_ARB_draw_buffers",               F(ARB_draw_buffers) },
+   { OFF, "GL_ARB_draw_elements_base_vertex",  F(ARB_draw_elements_base_vertex) },
    { OFF, "GL_ARB_fragment_program",           F(ARB_fragment_program) },
    { OFF, "GL_ARB_fragment_program_shadow",    F(ARB_fragment_program_shadow) },
    { OFF, "GL_ARB_fragment_shader",            F(ARB_fragment_shader) },
@@ -61,6 +63,7 @@ static const struct {
    { OFF, "GL_ARB_pixel_buffer_object",        F(EXT_pixel_buffer_object) },
    { OFF, "GL_ARB_point_parameters",           F(EXT_point_parameters) },
    { OFF, "GL_ARB_point_sprite",               F(ARB_point_sprite) },
+   { OFF, "GL_ARB_provoking_vertex",           F(EXT_provoking_vertex) },
    { OFF, "GL_ARB_seamless_cube_map",          F(ARB_seamless_cube_map) },
    { OFF, "GL_ARB_shader_objects",             F(ARB_shader_objects) },
    { OFF, "GL_ARB_shading_language_100",       F(ARB_shading_language_100) },
@@ -101,8 +104,9 @@ static const struct {
    { ON,  "GL_EXT_copy_texture",               F(EXT_copy_texture) },
    { OFF, "GL_EXT_depth_bounds_test",          F(EXT_depth_bounds_test) },
    { ON,  "GL_EXT_draw_range_elements",        F(EXT_draw_range_elements) },
-   { OFF, "GL_EXT_framebuffer_object",         F(EXT_framebuffer_object) },
    { OFF, "GL_EXT_framebuffer_blit",           F(EXT_framebuffer_blit) },
+   { OFF, "GL_EXT_framebuffer_multisample",    F(EXT_framebuffer_multisample) },
+   { OFF, "GL_EXT_framebuffer_object",         F(EXT_framebuffer_object) },
    { OFF, "GL_EXT_fog_coord",                  F(EXT_fog_coord) },
    { OFF, "GL_EXT_gpu_program_parameters",     F(EXT_gpu_program_parameters) },
    { OFF, "GL_EXT_histogram",                  F(EXT_histogram) },
@@ -162,8 +166,11 @@ static const struct {
    { OFF, "GL_MESA_ycbcr_texture",             F(MESA_ycbcr_texture) },
    { ON,  "GL_MESA_window_pos",                F(ARB_window_pos) },
    { OFF, "GL_NV_blend_square",                F(NV_blend_square) },
+   { OFF, "GL_NV_depth_clamp",                 F(ARB_depth_clamp) },
    { OFF, "GL_NV_fragment_program",            F(NV_fragment_program) },
+   { OFF, "GL_NV_fragment_program_option",     F(NV_fragment_program_option) },
    { ON,  "GL_NV_light_max_exponent",          F(NV_light_max_exponent) },
+   { OFF, "GL_NV_packed_depth_stencil",        F(EXT_packed_depth_stencil) },
    { OFF, "GL_NV_point_sprite",                F(NV_point_sprite) },
    { OFF, "GL_NV_texture_env_combine4",        F(NV_texture_env_combine4) },
    { OFF, "GL_NV_texture_rectangle",           F(NV_texture_rectangle) },
@@ -192,8 +199,10 @@ void
 _mesa_enable_sw_extensions(GLcontext *ctx)
 {
    ctx->Extensions.ARB_copy_buffer = GL_TRUE;
+   ctx->Extensions.ARB_depth_clamp = GL_TRUE;
    ctx->Extensions.ARB_depth_texture = GL_TRUE;
    /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
+   ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
 #if FEATURE_ARB_fragment_program
    ctx->Extensions.ARB_fragment_program = GL_TRUE;
    ctx->Extensions.ARB_fragment_program_shadow = GL_TRUE;
@@ -208,7 +217,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
    ctx->Extensions.ARB_imaging = GL_TRUE;
    ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
    ctx->Extensions.ARB_multitexture = GL_TRUE;
-#if FEATURE_ARB_occlusion_query
+#if FEATURE_queryobj
    ctx->Extensions.ARB_occlusion_query = GL_TRUE;
 #endif
    ctx->Extensions.ARB_point_sprite = GL_TRUE;
@@ -266,6 +275,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
 #endif
 #if FEATURE_EXT_framebuffer_blit
    ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
+#endif
+#if FEATURE_ARB_framebuffer_object
+   ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
 #endif
    ctx->Extensions.EXT_histogram = GL_TRUE;
    /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
@@ -308,6 +320,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
 #endif
 #if FEATURE_NV_fragment_program
    ctx->Extensions.NV_fragment_program = GL_TRUE;
+#endif
+#if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program
+   ctx->Extensions.NV_fragment_program_option = GL_TRUE;
 #endif
    ctx->Extensions.SGI_color_matrix = GL_TRUE;
    ctx->Extensions.SGI_color_table = GL_TRUE;
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index ed1db0fec..7b3599f93 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -34,7 +34,9 @@
 
 #include "buffers.h"
 #include "context.h"
+#include "enums.h"
 #include "fbobject.h"
+#include "formats.h"
 #include "framebuffer.h"
 #include "hash.h"
 #include "macros.h"
@@ -44,6 +46,14 @@
 #include "teximage.h"
 #include "texobj.h"
 #include "texstore.h"
+#include "texstate.h"
+
+
+/** Set this to 1 to help debug FBO incompleteness problems */
+#define DEBUG_FBO 0
+
+/** Set this to 1 to debug/log glBlitFramebuffer() calls */
+#define DEBUG_BLIT 0
 
 
 /**
@@ -223,9 +233,13 @@ _mesa_set_texture_attachment(GLcontext *ctx,
    if (att->Texture == texObj) {
       /* re-attaching same texture */
       ASSERT(att->Type == GL_TEXTURE);
+      if (ctx->Driver.FinishRenderTexture)
+	 ctx->Driver.FinishRenderTexture(ctx, att);
    }
    else {
       /* new attachment */
+      if (ctx->Driver.FinishRenderTexture && att->Texture)
+	 ctx->Driver.FinishRenderTexture(ctx, att);
       _mesa_remove_attachment(ctx, att);
       att->Type = GL_TEXTURE;
       assert(!att->Texture);
@@ -234,12 +248,7 @@ _mesa_set_texture_attachment(GLcontext *ctx,
 
    /* always update these fields */
    att->TextureLevel = level;
-   if (IS_CUBE_FACE(texTarget)) {
-      att->CubeMapFace = texTarget - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-   }
-   else {
-      att->CubeMapFace = 0;
-   }
+   att->CubeMapFace = _mesa_tex_target_to_face(texTarget);
    att->Zoffset = zoffset;
    att->Complete = GL_FALSE;
 
@@ -308,14 +317,31 @@ _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
 static void
 att_incomplete(const char *msg)
 {
-#if 0
-   _mesa_printf("attachment incomplete: %s\n", msg);
+#if DEBUG_FBO
+   _mesa_debug(NULL, "attachment incomplete: %s\n", msg);
 #else
    (void) msg;
 #endif
 }
 
 
+/**
+ * For debug only.
+ */
+static void
+fbo_incomplete(const char *msg, int index)
+{
+#if DEBUG_FBO
+   _mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
+#else
+   (void) msg;
+   (void) index;
+#endif
+}
+
+
+
+
 /**
  * Test if an attachment point is complete and update its Complete field.
  * \param format if GL_COLOR, this is a color attachment point,
@@ -335,6 +361,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
    if (att->Type == GL_TEXTURE) {
       const struct gl_texture_object *texObj = att->Texture;
       struct gl_texture_image *texImage;
+      GLenum baseFormat;
 
       if (!texObj) {
          att_incomplete("no texobj");
@@ -361,26 +388,28 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
          return;
       }
 
+      baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
+
       if (format == GL_COLOR) {
-         if (texImage->TexFormat->BaseFormat != GL_RGB &&
-             texImage->TexFormat->BaseFormat != GL_RGBA) {
+         if (baseFormat != GL_RGB &&
+             baseFormat != GL_RGBA) {
             att_incomplete("bad format");
             att->Complete = GL_FALSE;
             return;
          }
-         if (texImage->TexFormat->TexelBytes == 0) {
+         if (_mesa_is_format_compressed(texImage->TexFormat)) {
             att_incomplete("compressed internalformat");
             att->Complete = GL_FALSE;
             return;
          }
       }
       else if (format == GL_DEPTH) {
-         if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) {
+         if (baseFormat == GL_DEPTH_COMPONENT) {
             /* OK */
          }
          else if (ctx->Extensions.EXT_packed_depth_stencil &&
                   ctx->Extensions.ARB_depth_texture &&
-                  texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
+                  baseFormat == GL_DEPTH_STENCIL_EXT) {
             /* OK */
          }
          else {
@@ -391,10 +420,9 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       }
       else {
          ASSERT(format == GL_STENCIL);
-         ASSERT(att->Renderbuffer->StencilBits);
          if (ctx->Extensions.EXT_packed_depth_stencil &&
              ctx->Extensions.ARB_depth_texture &&
-             att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+             baseFormat == GL_DEPTH_STENCIL_EXT) {
             /* OK */
          }
          else {
@@ -406,6 +434,9 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       }
    }
    else if (att->Type == GL_RENDERBUFFER_EXT) {
+      const GLenum baseFormat =
+         _mesa_get_format_base_format(att->Renderbuffer->Format);
+
       ASSERT(att->Renderbuffer);
       if (!att->Renderbuffer->InternalFormat ||
           att->Renderbuffer->Width < 1 ||
@@ -415,24 +446,19 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
          return;
       }
       if (format == GL_COLOR) {
-         if (att->Renderbuffer->_BaseFormat != GL_RGB &&
-             att->Renderbuffer->_BaseFormat != GL_RGBA) {
+         if (baseFormat != GL_RGB &&
+             baseFormat != GL_RGBA) {
             att_incomplete("bad renderbuffer color format");
             att->Complete = GL_FALSE;
             return;
          }
-         ASSERT(att->Renderbuffer->RedBits);
-         ASSERT(att->Renderbuffer->GreenBits);
-         ASSERT(att->Renderbuffer->BlueBits);
       }
       else if (format == GL_DEPTH) {
-         if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) {
-            ASSERT(att->Renderbuffer->DepthBits);
+         if (baseFormat == GL_DEPTH_COMPONENT) {
             /* OK */
          }
          else if (ctx->Extensions.EXT_packed_depth_stencil &&
-                  att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
-            ASSERT(att->Renderbuffer->DepthBits);
+                  baseFormat == GL_DEPTH_STENCIL_EXT) {
             /* OK */
          }
          else {
@@ -443,13 +469,11 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
       }
       else {
          assert(format == GL_STENCIL);
-         if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) {
-            ASSERT(att->Renderbuffer->StencilBits);
+         if (baseFormat == GL_STENCIL_INDEX) {
             /* OK */
          }
          else if (ctx->Extensions.EXT_packed_depth_stencil &&
-                  att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
-            ASSERT(att->Renderbuffer->StencilBits);
+                  baseFormat == GL_DEPTH_STENCIL_EXT) {
             /* OK */
          }
          else {
@@ -467,20 +491,6 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
 }
 
 
-/**
- * Helpful for debugging
- */
-static void
-fbo_incomplete(const char *msg, int index)
-{
-   (void) msg;
-   (void) index;
-   /*
-   _mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
-   */
-}
-
-
 /**
  * Test if the given framebuffer object is complete and update its
  * Status field with the results.
@@ -644,6 +654,8 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
          return;
       }
    }
+#else
+   (void) j;
 #endif
 
    if (numImages == 0) {
@@ -704,18 +716,13 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (target != GL_RENDERBUFFER_EXT) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                  "glBindRenderbufferEXT(target)");
+      _mesa_error(ctx, GL_INVALID_ENUM, "glBindRenderbufferEXT(target)");
       return;
    }
 
-   FLUSH_CURRENT(ctx, _NEW_BUFFERS);
-   /* The above doesn't fully flush the drivers in the way that a
-    * glFlush does, but that is required here:
+   /* No need to flush here since the render buffer binding has no
+    * effect on rendering state.
     */
-   if (ctx->Driver.Flush)
-      ctx->Driver.Flush(ctx);
-
 
    if (renderbuffer) {
       newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
@@ -969,42 +976,27 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
    }
 
    /* These MUST get set by the AllocStorage func */
-   rb->_ActualFormat = 0;
-   rb->RedBits =
-   rb->GreenBits =
-   rb->BlueBits =
-   rb->AlphaBits =
-   rb->IndexBits =
-   rb->DepthBits =
-   rb->StencilBits = 0;
+   rb->Format = MESA_FORMAT_NONE;
    rb->NumSamples = samples;
 
    /* Now allocate the storage */
    ASSERT(rb->AllocStorage);
    if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
       /* No error - check/set fields now */
-      assert(rb->_ActualFormat);
+      assert(rb->Format != MESA_FORMAT_NONE);
       assert(rb->Width == (GLuint) width);
       assert(rb->Height == (GLuint) height);
-      assert(rb->RedBits || rb->GreenBits || rb->BlueBits || rb->AlphaBits ||
-             rb->DepthBits || rb->StencilBits || rb->IndexBits);
       rb->InternalFormat = internalFormat;
-      rb->_BaseFormat = baseFormat;
+      rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
+      assert(rb->_BaseFormat != 0);
    }
    else {
       /* Probably ran out of memory - clear the fields */
       rb->Width = 0;
       rb->Height = 0;
+      rb->Format = MESA_FORMAT_NONE;
       rb->InternalFormat = GL_NONE;
-      rb->_ActualFormat = GL_NONE;
       rb->_BaseFormat = GL_NONE;
-      rb->RedBits =
-      rb->GreenBits =
-      rb->BlueBits =
-      rb->AlphaBits =
-      rb->IndexBits =
-      rb->DepthBits =
-      rb->StencilBits =
       rb->NumSamples = 0;
    }
 
@@ -1017,6 +1009,53 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
 }
 
 
+/**
+ * Helper function for _mesa_GetRenderbufferParameterivEXT() and
+ * _mesa_GetFramebufferAttachmentParameterivEXT()
+ * We have to be careful to respect the base format.  For example, if a
+ * renderbuffer/texture was created with internalFormat=GL_RGB but the
+ * driver actually chose a GL_RGBA format, when the user queries ALPHA_SIZE
+ * we need to return zero.
+ */
+static GLint
+get_component_bits(GLenum pname, GLenum baseFormat, gl_format format)
+{
+   switch (pname) {
+   case GL_RENDERBUFFER_RED_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+   case GL_RENDERBUFFER_GREEN_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+   case GL_RENDERBUFFER_BLUE_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+      if (baseFormat == GL_RGB || baseFormat == GL_RGBA)
+         return _mesa_get_format_bits(format, pname);
+      else
+         return 0;
+   case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+      if (baseFormat == GL_RGBA || baseFormat == GL_ALPHA)
+         return _mesa_get_format_bits(format, pname);
+      else
+         return 0;
+   case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+      if (baseFormat == GL_DEPTH_COMPONENT || baseFormat == GL_DEPTH_STENCIL)
+         return _mesa_get_format_bits(format, pname);
+      else
+         return 0;
+   case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+      if (baseFormat == GL_STENCIL_INDEX || baseFormat == GL_DEPTH_STENCIL)
+         return _mesa_get_format_bits(format, pname);
+      else
+         return 0;
+   default:
+      return 0;
+   }
+}
+
+
+
 void GLAPIENTRY
 _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
                              GLsizei width, GLsizei height)
@@ -1060,7 +1099,9 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params)
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+   /* No need to flush here since we're just quering state which is
+    * not effected by rendering.
+    */
 
    switch (pname) {
    case GL_RENDERBUFFER_WIDTH_EXT:
@@ -1073,22 +1114,12 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params)
       *params = rb->InternalFormat;
       return;
    case GL_RENDERBUFFER_RED_SIZE_EXT:
-      *params = rb->RedBits;
-      break;
    case GL_RENDERBUFFER_GREEN_SIZE_EXT:
-      *params = rb->GreenBits;
-      break;
    case GL_RENDERBUFFER_BLUE_SIZE_EXT:
-      *params = rb->BlueBits;
-      break;
    case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
-      *params = rb->AlphaBits;
-      break;
    case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
-      *params = rb->DepthBits;
-      break;
    case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
-      *params = rb->StencilBits;
+      *params = get_component_bits(pname, rb->_BaseFormat, rb->Format);
       break;
    case GL_RENDERBUFFER_SAMPLES:
       if (ctx->Extensions.ARB_framebuffer_object) {
@@ -1118,16 +1149,25 @@ _mesa_IsFramebufferEXT(GLuint framebuffer)
 }
 
 
+/**
+ * Check if any of the attachments of the given framebuffer are textures
+ * (render to texture).  Call ctx->Driver.RenderTexture() for such
+ * attachments.
+ */
 static void
 check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
 {
    GLuint i;
    ASSERT(ctx->Driver.RenderTexture);
+
+   if (fb->Name == 0)
+      return; /* can't render to texture with winsys framebuffers */
+
    for (i = 0; i < BUFFER_COUNT; i++) {
       struct gl_renderbuffer_attachment *att = fb->Attachment + i;
       struct gl_texture_object *texObj = att->Texture;
       if (texObj
-          && att->Texture->Image[att->CubeMapFace][att->TextureLevel]) {
+          && texObj->Image[att->CubeMapFace][att->TextureLevel]) {
          ctx->Driver.RenderTexture(ctx, fb, att);
       }
    }
@@ -1142,6 +1182,9 @@ check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
 static void
 check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
 {
+   if (fb->Name == 0)
+      return; /* can't render to texture with winsys framebuffers */
+
    if (ctx->Driver.FinishRenderTexture) {
       GLuint i;
       for (i = 0; i < BUFFER_COUNT; i++) {
@@ -1157,7 +1200,8 @@ check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
 void GLAPIENTRY
 _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
 {
-   struct gl_framebuffer *newFb, *newFbread;
+   struct gl_framebuffer *newDrawFb, *newReadFb;
+   struct gl_framebuffer *oldDrawFb, *oldReadFb;
    GLboolean bindReadBuf, bindDrawBuf;
    GET_CURRENT_CONTEXT(ctx);
 
@@ -1204,76 +1248,90 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
       return;
    }
 
-   FLUSH_CURRENT(ctx, _NEW_BUFFERS);
-   if (ctx->Driver.Flush) {  
-      ctx->Driver.Flush(ctx);
-   }
-
    if (framebuffer) {
       /* Binding a user-created framebuffer object */
-      newFb = _mesa_lookup_framebuffer(ctx, framebuffer);
-      if (newFb == &DummyFramebuffer) {
+      newDrawFb = _mesa_lookup_framebuffer(ctx, framebuffer);
+      if (newDrawFb == &DummyFramebuffer) {
          /* ID was reserved, but no real framebuffer object made yet */
-         newFb = NULL;
+         newDrawFb = NULL;
       }
-      else if (!newFb && ctx->Extensions.ARB_framebuffer_object) {
+      else if (!newDrawFb && ctx->Extensions.ARB_framebuffer_object) {
          /* All FBO IDs must be Gen'd */
          _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebuffer(buffer)");
          return;
       }
 
-      if (!newFb) {
+      if (!newDrawFb) {
 	 /* create new framebuffer object */
-	 newFb = ctx->Driver.NewFramebuffer(ctx, framebuffer);
-	 if (!newFb) {
+	 newDrawFb = ctx->Driver.NewFramebuffer(ctx, framebuffer);
+	 if (!newDrawFb) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFramebufferEXT");
 	    return;
 	 }
-         _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb);
+         _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newDrawFb);
       }
-      newFbread = newFb;
+      newReadFb = newDrawFb;
    }
    else {
       /* Binding the window system framebuffer (which was originally set
        * with MakeCurrent).
        */
-      newFb = ctx->WinSysDrawBuffer;
-      newFbread = ctx->WinSysReadBuffer;
+      newDrawFb = ctx->WinSysDrawBuffer;
+      newReadFb = ctx->WinSysReadBuffer;
    }
 
-   ASSERT(newFb);
-   ASSERT(newFb != &DummyFramebuffer);
+   ASSERT(newDrawFb);
+   ASSERT(newDrawFb != &DummyFramebuffer);
+
+   /* save pointers to current/old framebuffers */
+   oldDrawFb = ctx->DrawBuffer;
+   oldReadFb = ctx->ReadBuffer;
+
+   /* check if really changing bindings */
+   if (oldDrawFb == newDrawFb)
+      bindDrawBuf = GL_FALSE;
+   if (oldReadFb == newReadFb)
+      bindReadBuf = GL_FALSE;
 
    /*
     * OK, now bind the new Draw/Read framebuffers, if they're changing.
+    *
+    * We also check if we're beginning and/or ending render-to-texture.
+    * When a framebuffer with texture attachments is unbound, call
+    * ctx->Driver.FinishRenderTexture().
+    * When a framebuffer with texture attachments is bound, call
+    * ctx->Driver.RenderTexture().
+    *
+    * Note that if the ReadBuffer has texture attachments we don't consider
+    * that a render-to-texture case.
     */
-
    if (bindReadBuf) {
-      if (ctx->ReadBuffer == newFbread)
-         bindReadBuf = GL_FALSE; /* no change */
-      else
-         _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread);
+      FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
+      /* check if old readbuffer was render-to-texture */
+      check_end_texture_render(ctx, oldReadFb);
+
+      _mesa_reference_framebuffer(&ctx->ReadBuffer, newReadFb);
    }
 
    if (bindDrawBuf) {
-      /* check if old FB had any texture attachments */
-      if (ctx->DrawBuffer->Name != 0) {
-         check_end_texture_render(ctx, ctx->DrawBuffer);
-      }
+      FLUSH_VERTICES(ctx, _NEW_BUFFERS);
 
-      if (ctx->DrawBuffer == newFb)
-         bindDrawBuf = GL_FALSE; /* no change */
-      else
-         _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb);
+      /* check if old read/draw buffers were render-to-texture */
+      if (!bindReadBuf)
+         check_end_texture_render(ctx, oldReadFb);
 
-      if (newFb->Name != 0) {
-         /* check if newly bound framebuffer has any texture attachments */
-         check_begin_texture_render(ctx, newFb);
-      }
+      if (oldDrawFb != oldReadFb)
+         check_end_texture_render(ctx, oldDrawFb);
+
+      /* check if newly bound framebuffer has any texture attachments */
+      check_begin_texture_render(ctx, newDrawFb);
+
+      _mesa_reference_framebuffer(&ctx->DrawBuffer, newDrawFb);
    }
 
    if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) {
-      ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread);
+      ctx->Driver.BindFramebuffer(ctx, target, newDrawFb, newReadFb);
    }
 }
 
@@ -1285,12 +1343,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
    GET_CURRENT_CONTEXT(ctx);
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
-   FLUSH_CURRENT(ctx, _NEW_BUFFERS);
-   /* The above doesn't fully flush the drivers in the way that a
-    * glFlush does, but that is required here:
-    */
-   if (ctx->Driver.Flush)
-      ctx->Driver.Flush(ctx);
+   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
 
    for (i = 0; i < n; i++) {
       if (framebuffers[i] > 0) {
@@ -1395,7 +1448,7 @@ _mesa_CheckFramebufferStatusEXT(GLenum target)
       return GL_FRAMEBUFFER_COMPLETE_EXT;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+   /* No need to flush here */
 
    if (buffer->_Status != GL_FRAMEBUFFER_COMPLETE) {
       _mesa_test_framebuffer_completeness(ctx, buffer);
@@ -1511,12 +1564,7 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
       return;
    }
 
-   FLUSH_CURRENT(ctx, _NEW_BUFFERS);
-   /* The above doesn't fully flush the drivers in the way that a
-    * glFlush does, but that is required here:
-    */
-   if (ctx->Driver.Flush)
-      ctx->Driver.Flush(ctx);
+   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
 
    _glthread_LOCK_MUTEX(fb->Mutex);
    if (texObj) {
@@ -1664,7 +1712,8 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
    att = _mesa_get_attachment(ctx, fb, attachment);
    if (att == NULL) {
       _mesa_error(ctx, GL_INVALID_ENUM,
-                 "glFramebufferRenderbufferEXT(attachment)");
+                  "glFramebufferRenderbufferEXT(invalid attachment %s)",
+                  _mesa_lookup_enum_by_nr(attachment));
       return;
    }
 
@@ -1672,7 +1721,8 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
       rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
       if (!rb) {
 	 _mesa_error(ctx, GL_INVALID_OPERATION,
-		     "glFramebufferRenderbufferEXT(renderbuffer)");
+		     "glFramebufferRenderbufferEXT(non-existant"
+                     " renderbuffer %u)", renderbuffer);
 	 return;
       }
    }
@@ -1683,7 +1733,9 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
 
    if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
       /* make sure the renderbuffer is a depth/stencil format */
-      if (rb->_BaseFormat != GL_DEPTH_STENCIL) {
+      const GLenum baseFormat =
+         _mesa_get_format_base_format(att->Renderbuffer->Format);
+      if (baseFormat != GL_DEPTH_STENCIL) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glFramebufferRenderbufferEXT(renderbuffer"
                      " is not DEPTH_STENCIL format)");
@@ -1692,12 +1744,7 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
    }
 
 
-   FLUSH_CURRENT(ctx, _NEW_BUFFERS);
-   /* The above doesn't fully flush the drivers in the way that a
-    * glFlush does, but that is required here:
-    */
-   if (ctx->Driver.Flush)
-      ctx->Driver.Flush(ctx);
+   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
 
    assert(ctx->Driver.FramebufferRenderbuffer);
    ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb);
@@ -1773,12 +1820,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
       }
    }
 
-   FLUSH_CURRENT(ctx, _NEW_BUFFERS);
-   /* The above doesn't fully flush the drivers in the way that a
-    * glFlush does, but that is required here:
-    */
-   if (ctx->Driver.Flush)
-      ctx->Driver.Flush(ctx);
+   /* No need to flush here */
 
    switch (pname) {
    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
@@ -1839,7 +1881,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
       else {
-         *params = att->Renderbuffer->ColorEncoding;
+         *params = _mesa_get_format_color_encoding(att->Renderbuffer->Format);
       }
       return;
    case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
@@ -1849,61 +1891,44 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
          return;
       }
       else {
-         *params = att->Renderbuffer->ComponentType;
+         gl_format format = att->Renderbuffer->Format;
+         if (format == MESA_FORMAT_CI8 || format == MESA_FORMAT_S8) {
+            /* special cases */
+            *params = GL_INDEX;
+         }
+         else {
+            *params = _mesa_get_format_datatype(format);
+         }
       }
       return;
    case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
-      if (!ctx->Extensions.ARB_framebuffer_object) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glGetFramebufferAttachmentParameterivEXT(pname)");
-      }
-      else {
-         *params = att->Renderbuffer->RedBits;
-      }
-      return;
    case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
-      if (!ctx->Extensions.ARB_framebuffer_object) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glGetFramebufferAttachmentParameterivEXT(pname)");
-      }
-      else {
-         *params = att->Renderbuffer->GreenBits;
-      }
-      return;
    case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
-      if (!ctx->Extensions.ARB_framebuffer_object) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glGetFramebufferAttachmentParameterivEXT(pname)");
-      }
-      else {
-         *params = att->Renderbuffer->BlueBits;
-      }
-      return;
    case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
-      if (!ctx->Extensions.ARB_framebuffer_object) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glGetFramebufferAttachmentParameterivEXT(pname)");
-      }
-      else {
-         *params = att->Renderbuffer->AlphaBits;
-      }
-      return;
    case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+   case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
       if (!ctx->Extensions.ARB_framebuffer_object) {
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "glGetFramebufferAttachmentParameterivEXT(pname)");
       }
-      else {
-         *params = att->Renderbuffer->DepthBits;
+      else if (att->Texture) {
+         const struct gl_texture_image *texImage =
+            _mesa_select_tex_image(ctx, att->Texture, att->Texture->Target,
+                                   att->TextureLevel);
+         if (texImage) {
+            *params = get_component_bits(pname, texImage->_BaseFormat,
+                                         texImage->TexFormat);
+         }
+         else {
+            *params = 0;
+         }
       }
-      return;
-   case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
-      if (!ctx->Extensions.ARB_framebuffer_object) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glGetFramebufferAttachmentParameterivEXT(pname)");
+      else if (att->Renderbuffer) {
+         *params = get_component_bits(pname, att->Renderbuffer->_BaseFormat,
+                                      att->Renderbuffer->Format);
       }
       else {
-         *params = att->Renderbuffer->StencilBits;
+         *params = 0;
       }
       return;
    default:
@@ -1917,7 +1942,6 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
 void GLAPIENTRY
 _mesa_GenerateMipmapEXT(GLenum target)
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    GET_CURRENT_CONTEXT(ctx);
 
@@ -1936,18 +1960,22 @@ _mesa_GenerateMipmapEXT(GLenum target)
       return;
    }
 
-   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
+   if (texObj->BaseLevel >= texObj->MaxLevel) {
+      /* nothing to do */
+      return;
+   }
 
    _mesa_lock_texture(ctx, texObj);
    if (target == GL_TEXTURE_CUBE_MAP) {
-      int face;
-
+      GLuint face;
       for (face = 0; face < 6; face++)
 	 ctx->Driver.GenerateMipmap(ctx,
 				    GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face,
 				    texObj);
-   } else {
+   }
+   else {
       ctx->Driver.GenerateMipmap(ctx, target, texObj);
    }
    _mesa_unlock_texture(ctx, texObj);
@@ -1955,6 +1983,20 @@ _mesa_GenerateMipmapEXT(GLenum target)
 
 
 #if FEATURE_EXT_framebuffer_blit
+
+static const struct gl_renderbuffer_attachment *
+find_attachment(const struct gl_framebuffer *fb, const struct gl_renderbuffer *rb)
+{
+   GLuint i;
+   for (i = 0; i < Elements(fb->Attachment); i++) {
+      if (fb->Attachment[i].Renderbuffer == rb)
+         return &fb->Attachment[i];
+   }
+   return NULL;
+}
+
+
+
 /**
  * Blit rectangular region, optionally from one framebuffer to another.
  *
@@ -2030,7 +2072,8 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
       struct gl_renderbuffer *drawRb = drawFb->_StencilBuffer;
       if (!readRb ||
           !drawRb ||
-          readRb->StencilBits != drawRb->StencilBits) {
+          _mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) != 
+          _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glBlitFramebufferEXT(stencil buffer size mismatch");
          return;
@@ -2042,7 +2085,8 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
       struct gl_renderbuffer *drawRb = drawFb->_DepthBuffer;
       if (!readRb ||
           !drawRb ||
-          readRb->DepthBits != drawRb->DepthBits) {
+          _mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) != 
+          _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glBlitFramebufferEXT(depth buffer size mismatch");
          return;
@@ -2070,7 +2114,7 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
       /* color formats must match */
       if (colorReadRb &&
           colorDrawRb &&
-          colorReadRb->_ActualFormat != colorDrawRb->_ActualFormat) {
+          colorReadRb->Format != colorDrawRb->Format) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                 "glBlitFramebufferEXT(bad src/dst multisample pixel formats");
          return;
@@ -2082,6 +2126,44 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
       return;
    }
 
+   /* Debug code */
+   if (DEBUG_BLIT) {
+      _mesa_printf("glBlitFramebuffer(%d, %d, %d, %d,  %d, %d, %d, %d,"
+                   " 0x%x, 0x%x)\n",
+                   srcX0, srcY0, srcX1, srcY1,
+                   dstX0, dstY0, dstX1, dstY1,
+                   mask, filter);
+      if (colorReadRb) {
+         const struct gl_renderbuffer_attachment *att;
+
+         att = find_attachment(readFb, colorReadRb);
+         _mesa_printf("  Src FBO %u  RB %u (%dx%d)  ",
+                      readFb->Name, colorReadRb->Name,
+                      colorReadRb->Width, colorReadRb->Height);
+         if (att && att->Texture) {
+            _mesa_printf("Tex %u  tgt 0x%x  level %u  face %u",
+                         att->Texture->Name,
+                         att->Texture->Target,
+                         att->TextureLevel,
+                         att->CubeMapFace);
+         }
+         _mesa_printf("\n");
+
+         att = find_attachment(drawFb, colorDrawRb);
+         _mesa_printf("  Dst FBO %u  RB %u (%dx%d)  ",
+                      drawFb->Name, colorDrawRb->Name,
+                      colorDrawRb->Width, colorDrawRb->Height);
+         if (att && att->Texture) {
+            _mesa_printf("Tex %u  tgt 0x%x  level %u  face %u",
+                         att->Texture->Name,
+                         att->Texture->Target,
+                         att->TextureLevel,
+                         att->CubeMapFace);
+         }
+         _mesa_printf("\n");
+      }
+   }
+
    ASSERT(ctx->Driver.BlitFramebuffer);
    ctx->Driver.BlitFramebuffer(ctx,
                                srcX0, srcY0, srcX1, srcY1,
diff --git a/mesalib/src/mesa/main/feedback.c b/mesalib/src/mesa/main/feedback.c
index 818a80454..fcdbb75fc 100644
--- a/mesalib/src/mesa/main/feedback.c
+++ b/mesalib/src/mesa/main/feedback.c
@@ -36,9 +36,10 @@
 #include "feedback.h"
 #include "macros.h"
 #include "mtypes.h"
+#include "glapi/dispatch.h"
 
 
-#if _HAVE_FULL_GL
+#if FEATURE_feedback
 
 
 #define FB_3D		0x01
@@ -49,7 +50,7 @@
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -103,7 +104,7 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PassThrough( GLfloat token )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -153,9 +154,6 @@ _mesa_feedback_vertex(GLcontext *ctx,
 }
 
 
-#endif /* _HAVE_FULL_GL */
-
-
 /**********************************************************************/
 /** \name Selection */
 /*@{*/
@@ -173,7 +171,7 @@ _mesa_feedback_vertex(GLcontext *ctx,
  * Verifies we're not in selection mode, flushes the vertices and initialize
  * the fields in __GLcontextRec::Select with the given buffer.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -280,7 +278,7 @@ write_hit_record(GLcontext *ctx)
  * the hit record data in gl_selection. Marks new render mode in
  * __GLcontextRec::NewState.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_InitNames( void )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -311,7 +309,7 @@ _mesa_InitNames( void )
  *
  * sa __GLcontextRec::Select.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_LoadName( GLuint name )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -350,7 +348,7 @@ _mesa_LoadName( GLuint name )
  *
  * sa __GLcontextRec::Select.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PushName( GLuint name )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -381,7 +379,7 @@ _mesa_PushName( GLuint name )
  *
  * sa __GLcontextRec::Select.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PopName( void )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -424,7 +422,7 @@ _mesa_PopName( void )
  * __GLcontextRec::RenderMode and notifies the driver via the
  * dd_function_table::RenderMode callback.
  */
-GLint GLAPIENTRY
+static GLint GLAPIENTRY
 _mesa_RenderMode( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -507,6 +505,23 @@ _mesa_RenderMode( GLenum mode )
 /*@}*/
 
 
+void
+_mesa_init_feedback_dispatch(struct _glapi_table *disp)
+{
+   SET_InitNames(disp, _mesa_InitNames);
+   SET_FeedbackBuffer(disp, _mesa_FeedbackBuffer);
+   SET_LoadName(disp, _mesa_LoadName);
+   SET_PassThrough(disp, _mesa_PassThrough);
+   SET_PopName(disp, _mesa_PopName);
+   SET_PushName(disp, _mesa_PushName);
+   SET_SelectBuffer(disp, _mesa_SelectBuffer);
+   SET_RenderMode(disp, _mesa_RenderMode);
+}
+
+
+#endif /* FEATURE_feedback */
+
+
 /**********************************************************************/
 /** \name Initialization */
 /*@{*/
diff --git a/mesalib/src/mesa/main/feedback.h b/mesalib/src/mesa/main/feedback.h
index 72c2acd5e..7a648f444 100644
--- a/mesalib/src/mesa/main/feedback.h
+++ b/mesalib/src/mesa/main/feedback.h
@@ -27,11 +27,15 @@
 #define FEEDBACK_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
 
-extern void
-_mesa_init_feedback( GLcontext *ctx );
+#if FEATURE_feedback
+
+#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) \
+   do {                                             \
+      (driver)->RenderMode = impl ## RenderMode;    \
+   } while (0)
 
 extern void
 _mesa_feedback_vertex( GLcontext *ctx,
@@ -55,29 +59,47 @@ extern void
 _mesa_update_hitflag( GLcontext *ctx, GLfloat z );
 
 
-extern void GLAPIENTRY
-_mesa_PassThrough( GLfloat token );
+extern void
+_mesa_init_feedback_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_feedback */
 
-extern void GLAPIENTRY
-_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
+#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) do { } while (0)
 
-extern void GLAPIENTRY
-_mesa_SelectBuffer( GLsizei size, GLuint *buffer );
+static INLINE void
+_mesa_feedback_vertex( GLcontext *ctx,
+                       const GLfloat win[4],
+                       const GLfloat color[4],
+                       GLfloat index,
+                       const GLfloat texcoord[4] )
+{
+   /* render mode is always GL_RENDER */
+   ASSERT_NO_FEATURE();
+}
 
-extern void GLAPIENTRY
-_mesa_InitNames( void );
 
-extern void GLAPIENTRY
-_mesa_LoadName( GLuint name );
+static INLINE void
+_mesa_feedback_token( GLcontext *ctx, GLfloat token )
+{
+   /* render mode is always GL_RENDER */
+   ASSERT_NO_FEATURE();
+}
 
-extern void GLAPIENTRY
-_mesa_PushName( GLuint name );
+static INLINE void
+_mesa_update_hitflag( GLcontext *ctx, GLfloat z )
+{
+   /* render mode is always GL_RENDER */
+   ASSERT_NO_FEATURE();
+}
 
-extern void GLAPIENTRY
-_mesa_PopName( void );
+static INLINE void
+_mesa_init_feedback_dispatch(struct _glapi_table *disp)
+{
+}
 
-extern GLint GLAPIENTRY
-_mesa_RenderMode( GLenum mode );
+#endif /* FEATURE_feedback */
 
+extern void
+_mesa_init_feedback( GLcontext *ctx );
 
-#endif
+#endif /* FEEDBACK_H */
diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c
index 356476e35..fe2416d89 100644
--- a/mesalib/src/mesa/main/ffvertex_prog.c
+++ b/mesalib/src/mesa/main/ffvertex_prog.c
@@ -438,7 +438,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
  */
 static struct ureg register_output( struct tnl_program *p, GLuint output )
 {
-   p->program->Base.OutputsWritten |= (1<<output);
+   p->program->Base.OutputsWritten |= BITFIELD64_BIT(output);
    return make_ureg(PROGRAM_OUTPUT, output);
 }
 
diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c
index 4323d3db8..269ff3f8b 100644
--- a/mesalib/src/mesa/main/fog.c
+++ b/mesalib/src/mesa/main/fog.c
@@ -34,15 +34,20 @@
 void GLAPIENTRY
 _mesa_Fogf(GLenum pname, GLfloat param)
 {
-   _mesa_Fogfv(pname, &param);
+   GLfloat fparam[4];
+   fparam[0] = param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_Fogfv(pname, fparam);
 }
 
 
 void GLAPIENTRY
 _mesa_Fogi(GLenum pname, GLint param )
 {
-   GLfloat fparam = (GLfloat) param;
-   _mesa_Fogfv(pname, &fparam);
+   GLfloat fparam[4];
+   fparam[0] = (GLfloat) param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_Fogfv(pname, fparam);
 }
 
 
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
new file mode 100644
index 000000000..329b79507
--- /dev/null
+++ b/mesalib/src/mesa/main/formats.c
@@ -0,0 +1,1158 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008-2009  VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "imports.h"
+#include "formats.h"
+#include "config.h"
+#include "texstore.h"
+
+
+/**
+ * Information about texture formats.
+ */
+struct gl_format_info
+{
+   gl_format Name;
+
+   /** text name for debugging */
+   const char *StrName;
+
+   /**
+    * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE,
+    * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX,
+    * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
+    */
+   GLenum BaseFormat;
+
+   /**
+    * Logical data type: one of  GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED,
+    * GL_UNSIGNED_INT, GL_SIGNED_INT, GL_FLOAT.
+    */
+   GLenum DataType;
+
+   GLubyte RedBits;
+   GLubyte GreenBits;
+   GLubyte BlueBits;
+   GLubyte AlphaBits;
+   GLubyte LuminanceBits;
+   GLubyte IntensityBits;
+   GLubyte IndexBits;
+   GLubyte DepthBits;
+   GLubyte StencilBits;
+
+   /**
+    * To describe compressed formats.  If not compressed, Width=Height=1.
+    */
+   GLubyte BlockWidth, BlockHeight;
+   GLubyte BytesPerBlock;
+};
+
+
+/**
+ * Info about each format.
+ * These must be in the same order as the MESA_FORMAT_* enums so that
+ * we can do lookups without searching.
+ */
+static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
+{
+   {
+      MESA_FORMAT_NONE,            /* Name */
+      "MESA_FORMAT_NONE",          /* StrName */
+      GL_NONE,                     /* BaseFormat */
+      GL_NONE,                     /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      0, 0, 0                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_RGBA8888,        /* Name */
+      "MESA_FORMAT_RGBA8888",      /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 8,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_RGBA8888_REV,    /* Name */
+      "MESA_FORMAT_RGBA8888_REV",  /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 8,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_ARGB8888,        /* Name */
+      "MESA_FORMAT_ARGB8888",      /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 8,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_ARGB8888_REV,    /* Name */
+      "MESA_FORMAT_ARGB8888_REV",  /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 8,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_XRGB8888,        /* Name */
+      "MESA_FORMAT_XRGB8888",      /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_XRGB8888_REV,    /* Name */
+      "MESA_FORMAT_XRGB8888_REV",  /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_RGB888,          /* Name */
+      "MESA_FORMAT_RGB888",        /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 3                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_BGR888,          /* Name */
+      "MESA_FORMAT_BGR888",        /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      8, 8, 8, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 3                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_RGB565,          /* Name */
+      "MESA_FORMAT_RGB565",        /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      5, 6, 5, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_RGB565_REV,      /* Name */
+      "MESA_FORMAT_RGB565_REV",    /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      5, 6, 5, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_ARGB4444,        /* Name */
+      "MESA_FORMAT_ARGB4444",      /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      4, 4, 4, 4,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_ARGB4444_REV,    /* Name */
+      "MESA_FORMAT_ARGB4444_REV",  /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      4, 4, 4, 4,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_RGBA5551,        /* Name */
+      "MESA_FORMAT_RGBA5551",      /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      5, 5, 5, 1,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_ARGB1555,        /* Name */
+      "MESA_FORMAT_ARGB1555",      /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      5, 5, 5, 1,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_ARGB1555_REV,    /* Name */
+      "MESA_FORMAT_ARGB1555_REV",  /* StrName */
+      GL_RGBA,                     /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      5, 5, 5, 1,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_AL88,            /* Name */
+      "MESA_FORMAT_AL88",          /* StrName */
+      GL_LUMINANCE_ALPHA,          /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 8,                  /* Red/Green/Blue/AlphaBits */
+      8, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_AL88_REV,        /* Name */
+      "MESA_FORMAT_AL88_REV",      /* StrName */
+      GL_LUMINANCE_ALPHA,          /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 8,                  /* Red/Green/Blue/AlphaBits */
+      8, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_AL1616,          /* Name */
+      "MESA_FORMAT_AL1616",        /* StrName */
+      GL_LUMINANCE_ALPHA,          /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 16,                 /* Red/Green/Blue/AlphaBits */
+      16, 0, 0, 0, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_AL1616_REV,      /* Name */
+      "MESA_FORMAT_AL1616_REV",    /* StrName */
+      GL_LUMINANCE_ALPHA,          /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 16,                 /* Red/Green/Blue/AlphaBits */
+      16, 0, 0, 0, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_RGB332,          /* Name */
+      "MESA_FORMAT_RGB332",        /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      3, 3, 2, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 1                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_A8,              /* Name */
+      "MESA_FORMAT_A8",            /* StrName */
+      GL_ALPHA,                    /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 8,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 1                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_L8,              /* Name */
+      "MESA_FORMAT_L8",            /* StrName */
+      GL_LUMINANCE,                /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      8, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 1                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_I8,              /* Name */
+      "MESA_FORMAT_I8",            /* StrName */
+      GL_INTENSITY,                /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 8, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 1                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_CI8,             /* Name */
+      "MESA_FORMAT_CI8",           /* StrName */
+      GL_COLOR_INDEX,              /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 8, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 1                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_YCBCR,           /* Name */
+      "MESA_FORMAT_YCBCR",         /* StrName */
+      GL_YCBCR_MESA,               /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_YCBCR_REV,       /* Name */
+      "MESA_FORMAT_YCBCR_REV",     /* StrName */
+      GL_YCBCR_MESA,               /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_Z24_S8,          /* Name */
+      "MESA_FORMAT_Z24_S8",        /* StrName */
+      GL_DEPTH_STENCIL,            /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 24, 8,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_S8_Z24,          /* Name */
+      "MESA_FORMAT_S8_Z24",        /* StrName */
+      GL_DEPTH_STENCIL,            /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 24, 8,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_Z16,             /* Name */
+      "MESA_FORMAT_Z16",           /* StrName */
+      GL_DEPTH_COMPONENT,          /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 16, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_X8_Z24,          /* Name */
+      "MESA_FORMAT_X8_Z24",        /* StrName */
+      GL_DEPTH_COMPONENT,          /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 24, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_Z24_X8,          /* Name */
+      "MESA_FORMAT_Z24_X8",        /* StrName */
+      GL_DEPTH_COMPONENT,          /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 24, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_Z32,             /* Name */
+      "MESA_FORMAT_Z32",           /* StrName */
+      GL_DEPTH_COMPONENT,          /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 32, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 4                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_S8,              /* Name */
+      "MESA_FORMAT_S8",            /* StrName */
+      GL_STENCIL_INDEX,            /* BaseFormat */
+      GL_UNSIGNED_INT,             /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 8,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 1                      /* BlockWidth/Height,Bytes */
+   },
+   {
+      MESA_FORMAT_SRGB8,
+      "MESA_FORMAT_SRGB8",
+      GL_RGB,
+      GL_UNSIGNED_NORMALIZED,
+      8, 8, 8, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 3
+   },
+   {
+      MESA_FORMAT_SRGBA8,
+      "MESA_FORMAT_SRGBA8",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,    
+      8, 8, 8, 8,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_SARGB8,
+      "MESA_FORMAT_SARGB8",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,    
+      8, 8, 8, 8,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_SL8,
+      "MESA_FORMAT_SL8",
+      GL_LUMINANCE,
+      GL_UNSIGNED_NORMALIZED,    
+      0, 0, 0, 0,
+      8, 0, 0, 0, 0,
+      1, 1, 1
+   },
+   {
+      MESA_FORMAT_SLA8,
+      "MESA_FORMAT_SLA8",
+      GL_LUMINANCE_ALPHA,
+      GL_UNSIGNED_NORMALIZED,    
+      0, 0, 0, 8,
+      8, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_SRGB_DXT1,       /* Name */
+      "MESA_FORMAT_SRGB_DXT1",     /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      4, 4, 4, 0,                  /* approx Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      4, 4, 8                      /* 8 bytes per 4x4 block */
+   },
+   {
+      MESA_FORMAT_SRGBA_DXT1,
+      "MESA_FORMAT_SRGBA_DXT1",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,
+      4, 4, 4, 4,
+      0, 0, 0, 0, 0,
+      4, 4, 8                      /* 8 bytes per 4x4 block */
+   },
+   {
+      MESA_FORMAT_SRGBA_DXT3,
+      "MESA_FORMAT_SRGBA_DXT3",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,
+      4, 4, 4, 4,
+      0, 0, 0, 0, 0,
+      4, 4, 16                     /* 16 bytes per 4x4 block */
+   },
+   {
+      MESA_FORMAT_SRGBA_DXT5,
+      "MESA_FORMAT_SRGBA_DXT5",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,
+      4, 4, 4, 4,
+      0, 0, 0, 0, 0,
+      4, 4, 16                     /* 16 bytes per 4x4 block */
+   },
+
+   {
+      MESA_FORMAT_RGB_FXT1,
+      "MESA_FORMAT_RGB_FXT1",
+      GL_RGB,
+      GL_UNSIGNED_NORMALIZED,
+      4, 4, 4, 0,                  /* approx Red/Green/BlueBits */
+      0, 0, 0, 0, 0,
+      8, 4, 16                     /* 16 bytes per 8x4 block */
+   },
+   {
+      MESA_FORMAT_RGBA_FXT1,
+      "MESA_FORMAT_RGBA_FXT1",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,
+      4, 4, 4, 1,                  /* approx Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,
+      8, 4, 16                     /* 16 bytes per 8x4 block */
+   },
+
+   {
+      MESA_FORMAT_RGB_DXT1,        /* Name */
+      "MESA_FORMAT_RGB_DXT1",      /* StrName */
+      GL_RGB,                      /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      4, 4, 4, 0,                  /* approx Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      4, 4, 8                      /* 8 bytes per 4x4 block */
+   },
+   {
+      MESA_FORMAT_RGBA_DXT1,
+      "MESA_FORMAT_RGBA_DXT1",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,    
+      4, 4, 4, 4,
+      0, 0, 0, 0, 0,
+      4, 4, 8                      /* 8 bytes per 4x4 block */
+   },
+   {
+      MESA_FORMAT_RGBA_DXT3,
+      "MESA_FORMAT_RGBA_DXT3",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,    
+      4, 4, 4, 4,
+      0, 0, 0, 0, 0,
+      4, 4, 16                     /* 16 bytes per 4x4 block */
+   },
+   {
+      MESA_FORMAT_RGBA_DXT5,
+      "MESA_FORMAT_RGBA_DXT5",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,    
+      4, 4, 4, 4,
+      0, 0, 0, 0, 0,
+      4, 4, 16                     /* 16 bytes per 4x4 block */
+   },
+   {
+      MESA_FORMAT_RGBA_FLOAT32,
+      "MESA_FORMAT_RGBA_FLOAT32",
+      GL_RGBA,
+      GL_FLOAT,
+      32, 32, 32, 32,
+      0, 0, 0, 0, 0,
+      1, 1, 16
+   },
+   {
+      MESA_FORMAT_RGBA_FLOAT16,
+      "MESA_FORMAT_RGBA_FLOAT16",
+      GL_RGBA,
+      GL_FLOAT,
+      16, 16, 16, 16,
+      0, 0, 0, 0, 0,
+      1, 1, 8
+   },
+   {
+      MESA_FORMAT_RGB_FLOAT32,
+      "MESA_FORMAT_RGB_FLOAT32",
+      GL_RGB,
+      GL_FLOAT,
+      32, 32, 32, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 12
+   },
+   {
+      MESA_FORMAT_RGB_FLOAT16,
+      "MESA_FORMAT_RGB_FLOAT16",
+      GL_RGB,
+      GL_FLOAT,
+      16, 16, 16, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 6
+   },
+   {
+      MESA_FORMAT_ALPHA_FLOAT32,
+      "MESA_FORMAT_ALPHA_FLOAT32",
+      GL_ALPHA,
+      GL_FLOAT,
+      0, 0, 0, 32,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_ALPHA_FLOAT16,
+      "MESA_FORMAT_ALPHA_FLOAT16",
+      GL_ALPHA,
+      GL_FLOAT,
+      0, 0, 0, 16,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_LUMINANCE_FLOAT32,
+      "MESA_FORMAT_LUMINANCE_FLOAT32",
+      GL_ALPHA,
+      GL_FLOAT,
+      0, 0, 0, 0,
+      32, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_LUMINANCE_FLOAT16,
+      "MESA_FORMAT_LUMINANCE_FLOAT16",
+      GL_ALPHA,
+      GL_FLOAT,
+      0, 0, 0, 0,
+      16, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
+      "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32",
+      GL_LUMINANCE_ALPHA,
+      GL_FLOAT,
+      0, 0, 0, 32,
+      32, 0, 0, 0, 0,
+      1, 1, 8
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
+      "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16",
+      GL_LUMINANCE_ALPHA,
+      GL_FLOAT,
+      0, 0, 0, 16,
+      16, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_INTENSITY_FLOAT32,
+      "MESA_FORMAT_INTENSITY_FLOAT32",
+      GL_INTENSITY,
+      GL_FLOAT,
+      0, 0, 0, 0,
+      0, 32, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_INTENSITY_FLOAT16,
+      "MESA_FORMAT_INTENSITY_FLOAT16",
+      GL_INTENSITY,
+      GL_FLOAT,
+      0, 0, 0, 0,
+      0, 16, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_DUDV8,
+      "MESA_FORMAT_DUDV8",
+      GL_DUDV_ATI,
+      GL_SIGNED_NORMALIZED,
+      0, 0, 0, 0,
+      0, 0, 0, 0, 0,
+      1, 1, 2
+   },
+   {
+      MESA_FORMAT_SIGNED_RGBA8888,
+      "MESA_FORMAT_SIGNED_RGBA8888",
+      GL_RGBA,
+      GL_SIGNED_NORMALIZED,
+      8, 8, 8, 8,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_SIGNED_RGBA8888_REV,
+      "MESA_FORMAT_SIGNED_RGBA8888_REV",
+      GL_RGBA,
+      GL_SIGNED_NORMALIZED,
+      8, 8, 8, 8,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
+   {
+      MESA_FORMAT_SIGNED_RGBA_16,
+      "MESA_FORMAT_SIGNED_RGBA_16",
+      GL_RGBA,
+      GL_SIGNED_NORMALIZED,
+      16, 16, 16, 16,
+      0, 0, 0, 0, 0,
+      1, 1, 8
+   }
+};
+
+
+
+static const struct gl_format_info *
+_mesa_get_format_info(gl_format format)
+{
+   const struct gl_format_info *info = &format_info[format];
+   assert(info->Name == format);
+   return info;
+}
+
+
+/** Return string name of format (for debugging) */
+const char *
+_mesa_get_format_name(gl_format format)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   ASSERT(info->BytesPerBlock);
+   return info->StrName;
+}
+
+
+
+/**
+ * Return bytes needed to store a block of pixels in the given format.
+ * Normally, a block is 1x1 (a single pixel).  But for compressed formats
+ * a block may be 4x4 or 8x4, etc.
+ */
+GLuint
+_mesa_get_format_bytes(gl_format format)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   ASSERT(info->BytesPerBlock);
+   return info->BytesPerBlock;
+}
+
+
+/**
+ * Return bits per component for the given format.
+ * \param format  one of MESA_FORMAT_x
+ * \param pname  the component, such as GL_RED_BITS, GL_TEXTURE_BLUE_BITS, etc.
+ */
+GLint
+_mesa_get_format_bits(gl_format format, GLenum pname)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+
+   switch (pname) {
+   case GL_RED_BITS:
+   case GL_TEXTURE_RED_SIZE:
+   case GL_RENDERBUFFER_RED_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+      return info->RedBits;
+   case GL_GREEN_BITS:
+   case GL_TEXTURE_GREEN_SIZE:
+   case GL_RENDERBUFFER_GREEN_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+      return info->GreenBits;
+   case GL_BLUE_BITS:
+   case GL_TEXTURE_BLUE_SIZE:
+   case GL_RENDERBUFFER_BLUE_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+      return info->BlueBits;
+   case GL_ALPHA_BITS:
+   case GL_TEXTURE_ALPHA_SIZE:
+   case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+      return info->AlphaBits;
+   case GL_TEXTURE_INTENSITY_SIZE:
+      return info->IntensityBits;
+   case GL_TEXTURE_LUMINANCE_SIZE:
+      return info->LuminanceBits;
+   case GL_INDEX_BITS:
+   case GL_TEXTURE_INDEX_SIZE_EXT:
+      return info->IndexBits;
+   case GL_DEPTH_BITS:
+   case GL_TEXTURE_DEPTH_SIZE_ARB:
+   case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+      return info->DepthBits;
+   case GL_STENCIL_BITS:
+   case GL_TEXTURE_STENCIL_SIZE_EXT:
+   case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
+   case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+      return info->StencilBits;
+   default:
+      _mesa_problem(NULL, "bad pname in _mesa_get_format_bits()");
+      return 0;
+   }
+}
+
+
+/**
+ * Return the data type (or more specifically, the data representation)
+ * for the given format.
+ * The return value will be one of:
+ *    GL_UNSIGNED_NORMALIZED = unsigned int representing [0,1]
+ *    GL_SIGNED_NORMALIZED = signed int representing [-1, 1]
+ *    GL_UNSIGNED_INT = an ordinary unsigned integer
+ *    GL_FLOAT = an ordinary float
+ */
+GLenum
+_mesa_get_format_datatype(gl_format format)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   return info->DataType;
+}
+
+
+/**
+ * Return the basic format for the given type.  The result will be
+ * one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
+ * GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX, GL_DEPTH_COMPONENT,
+ * GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
+ */
+GLenum
+_mesa_get_format_base_format(gl_format format)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   return info->BaseFormat;
+}
+
+
+/**
+ * Return the block size (in pixels) for the given format.  Normally
+ * the block size is 1x1.  But compressed formats will have block sizes
+ * of 4x4 or 8x4 pixels, etc.
+ * \param bw  returns block width in pixels
+ * \param bh  returns block height in pixels
+ */
+void
+_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   *bw = info->BlockWidth;
+   *bh = info->BlockHeight;
+}
+
+
+/** Is the given format a compressed format? */
+GLboolean
+_mesa_is_format_compressed(gl_format format)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   return info->BlockWidth > 1 || info->BlockHeight > 1;
+}
+
+
+/**
+ * Return color encoding for given format.
+ * \return GL_LINEAR or GL_SRGB
+ */
+GLenum
+_mesa_get_format_color_encoding(gl_format format)
+{
+   /* XXX this info should be encoded in gl_format_info */
+   switch (format) {
+   case MESA_FORMAT_SRGB8:
+   case MESA_FORMAT_SRGBA8:
+   case MESA_FORMAT_SARGB8:
+   case MESA_FORMAT_SL8:
+   case MESA_FORMAT_SLA8:
+   case MESA_FORMAT_SRGB_DXT1:
+   case MESA_FORMAT_SRGBA_DXT1:
+   case MESA_FORMAT_SRGBA_DXT3:
+   case MESA_FORMAT_SRGBA_DXT5:
+      return GL_SRGB;
+   default:
+      return GL_LINEAR;
+   }
+}
+
+
+/**
+ * Return number of bytes needed to store an image of the given size
+ * in the given format.
+ */
+GLuint
+_mesa_format_image_size(gl_format format, GLsizei width,
+                        GLsizei height, GLsizei depth)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   /* Strictly speaking, a conditional isn't needed here */
+   if (info->BlockWidth > 1 || info->BlockHeight > 1) {
+      /* compressed format */
+      const GLuint bw = info->BlockWidth, bh = info->BlockHeight;
+      const GLuint wblocks = (width + bw - 1) / bw;
+      const GLuint hblocks = (height + bh - 1) / bh;
+      const GLuint sz = wblocks * hblocks * info->BytesPerBlock;
+      return sz;
+   }
+   else {
+      /* non-compressed */
+      const GLuint sz = width * height * depth * info->BytesPerBlock;
+      return sz;
+   }
+}
+
+
+
+GLint
+_mesa_format_row_stride(gl_format format, GLsizei width)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   /* Strictly speaking, a conditional isn't needed here */
+   if (info->BlockWidth > 1 || info->BlockHeight > 1) {
+      /* compressed format */
+      const GLuint bw = info->BlockWidth;
+      const GLuint wblocks = (width + bw - 1) / bw;
+      const GLint stride = wblocks * info->BytesPerBlock;
+      return stride;
+   }
+   else {
+      const GLint stride = width * info->BytesPerBlock;
+      return stride;
+   }
+}
+
+
+
+/**
+ * Do sanity checking of the format info table.
+ */
+void
+_mesa_test_formats(void)
+{
+   GLuint i;
+
+   assert(Elements(format_info) == MESA_FORMAT_COUNT);
+
+   for (i = 0; i < MESA_FORMAT_COUNT; i++) {
+      const struct gl_format_info *info = _mesa_get_format_info(i);
+      assert(info);
+
+      assert(info->Name == i);
+
+      if (info->Name == MESA_FORMAT_NONE)
+         continue;
+
+      if (info->BlockWidth == 1 && info->BlockHeight == 1) {
+         if (info->RedBits > 0) {
+            GLuint t = info->RedBits + info->GreenBits
+               + info->BlueBits + info->AlphaBits;
+            assert(t / 8 == info->BytesPerBlock);
+         }
+      }
+
+      assert(info->DataType == GL_UNSIGNED_NORMALIZED ||
+             info->DataType == GL_SIGNED_NORMALIZED ||
+             info->DataType == GL_UNSIGNED_INT ||
+             info->DataType == GL_FLOAT);
+
+      if (info->BaseFormat == GL_RGB) {
+         assert(info->RedBits > 0);
+         assert(info->GreenBits > 0);
+         assert(info->BlueBits > 0);
+         assert(info->AlphaBits == 0);
+         assert(info->LuminanceBits == 0);
+         assert(info->IntensityBits == 0);
+      }
+      else if (info->BaseFormat == GL_RGBA) {
+         assert(info->RedBits > 0);
+         assert(info->GreenBits > 0);
+         assert(info->BlueBits > 0);
+         assert(info->AlphaBits > 0);
+         assert(info->LuminanceBits == 0);
+         assert(info->IntensityBits == 0);
+      }
+      else if (info->BaseFormat == GL_LUMINANCE) {
+         assert(info->RedBits == 0);
+         assert(info->GreenBits == 0);
+         assert(info->BlueBits == 0);
+         assert(info->AlphaBits == 0);
+         assert(info->LuminanceBits > 0);
+         assert(info->IntensityBits == 0);
+      }
+      else if (info->BaseFormat == GL_INTENSITY) {
+         assert(info->RedBits == 0);
+         assert(info->GreenBits == 0);
+         assert(info->BlueBits == 0);
+         assert(info->AlphaBits == 0);
+         assert(info->LuminanceBits == 0);
+         assert(info->IntensityBits > 0);
+      }
+
+   }
+}
+
+
+
+/**
+ * Return datatype and number of components per texel for the given gl_format.
+ * Only used for mipmap generation code.
+ */
+void
+_mesa_format_to_type_and_comps(gl_format format,
+                               GLenum *datatype, GLuint *comps)
+{
+   switch (format) {
+   case MESA_FORMAT_RGBA8888:
+   case MESA_FORMAT_RGBA8888_REV:
+   case MESA_FORMAT_ARGB8888:
+   case MESA_FORMAT_ARGB8888_REV:
+   case MESA_FORMAT_XRGB8888:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 4;
+      return;
+   case MESA_FORMAT_RGB888:
+   case MESA_FORMAT_BGR888:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 3;
+      return;
+   case MESA_FORMAT_RGB565:
+   case MESA_FORMAT_RGB565_REV:
+      *datatype = GL_UNSIGNED_SHORT_5_6_5;
+      *comps = 3;
+      return;
+
+   case MESA_FORMAT_ARGB4444:
+   case MESA_FORMAT_ARGB4444_REV:
+      *datatype = GL_UNSIGNED_SHORT_4_4_4_4;
+      *comps = 4;
+      return;
+
+   case MESA_FORMAT_ARGB1555:
+   case MESA_FORMAT_ARGB1555_REV:
+      *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
+      *comps = 4;
+      return;
+
+   case MESA_FORMAT_AL88:
+   case MESA_FORMAT_AL88_REV:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 2;
+      return;
+
+   case MESA_FORMAT_AL1616:
+   case MESA_FORMAT_AL1616_REV:
+      *datatype = GL_UNSIGNED_SHORT;
+      *comps = 2;
+      return;
+
+   case MESA_FORMAT_RGB332:
+      *datatype = GL_UNSIGNED_BYTE_3_3_2;
+      *comps = 3;
+      return;
+
+   case MESA_FORMAT_A8:
+   case MESA_FORMAT_L8:
+   case MESA_FORMAT_I8:
+   case MESA_FORMAT_CI8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 1;
+      return;
+
+   case MESA_FORMAT_YCBCR:
+   case MESA_FORMAT_YCBCR_REV:
+      *datatype = GL_UNSIGNED_SHORT;
+      *comps = 2;
+      return;
+
+   case MESA_FORMAT_Z24_S8:
+      *datatype = GL_UNSIGNED_INT;
+      *comps = 1; /* XXX OK? */
+      return;
+
+   case MESA_FORMAT_S8_Z24:
+      *datatype = GL_UNSIGNED_INT;
+      *comps = 1; /* XXX OK? */
+      return;
+
+   case MESA_FORMAT_Z16:
+      *datatype = GL_UNSIGNED_SHORT;
+      *comps = 1;
+      return;
+
+   case MESA_FORMAT_X8_Z24:
+      *datatype = GL_UNSIGNED_INT;
+      *comps = 1;
+      return;
+
+   case MESA_FORMAT_Z24_X8:
+      *datatype = GL_UNSIGNED_INT;
+      *comps = 1;
+      return;
+
+   case MESA_FORMAT_Z32:
+      *datatype = GL_UNSIGNED_INT;
+      *comps = 1;
+      return;
+
+   case MESA_FORMAT_DUDV8:
+      *datatype = GL_BYTE;
+      *comps = 2;
+      return;
+
+   case MESA_FORMAT_SIGNED_RGBA8888:
+   case MESA_FORMAT_SIGNED_RGBA8888_REV:
+      *datatype = GL_BYTE;
+      *comps = 4;
+      return;
+   case MESA_FORMAT_SIGNED_RGBA_16:
+      *datatype = GL_SHORT;
+      *comps = 4;
+      return;
+
+#if FEATURE_EXT_texture_sRGB
+   case MESA_FORMAT_SRGB8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 3;
+      return;
+   case MESA_FORMAT_SRGBA8:
+   case MESA_FORMAT_SARGB8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 4;
+      return;
+   case MESA_FORMAT_SL8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 1;
+      return;
+   case MESA_FORMAT_SLA8:
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 2;
+      return;
+#endif
+
+#if FEATURE_texture_fxt1
+   case MESA_FORMAT_RGB_FXT1:
+   case MESA_FORMAT_RGBA_FXT1:
+#endif
+#if FEATURE_texture_s3tc
+   case MESA_FORMAT_RGB_DXT1:
+   case MESA_FORMAT_RGBA_DXT1:
+   case MESA_FORMAT_RGBA_DXT3:
+   case MESA_FORMAT_RGBA_DXT5:
+#if FEATURE_EXT_texture_sRGB
+   case MESA_FORMAT_SRGB_DXT1:
+   case MESA_FORMAT_SRGBA_DXT1:
+   case MESA_FORMAT_SRGBA_DXT3:
+   case MESA_FORMAT_SRGBA_DXT5:
+#endif
+      /* XXX generate error instead? */
+      *datatype = GL_UNSIGNED_BYTE;
+      *comps = 0;
+      return;
+#endif
+
+   case MESA_FORMAT_RGBA_FLOAT32:
+      *datatype = GL_FLOAT;
+      *comps = 4;
+      return;
+   case MESA_FORMAT_RGBA_FLOAT16:
+      *datatype = GL_HALF_FLOAT_ARB;
+      *comps = 4;
+      return;
+   case MESA_FORMAT_RGB_FLOAT32:
+      *datatype = GL_FLOAT;
+      *comps = 3;
+      return;
+   case MESA_FORMAT_RGB_FLOAT16:
+      *datatype = GL_HALF_FLOAT_ARB;
+      *comps = 3;
+      return;
+   case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
+      *datatype = GL_FLOAT;
+      *comps = 2;
+      return;
+   case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
+      *datatype = GL_HALF_FLOAT_ARB;
+      *comps = 2;
+      return;
+   case MESA_FORMAT_ALPHA_FLOAT32:
+   case MESA_FORMAT_LUMINANCE_FLOAT32:
+   case MESA_FORMAT_INTENSITY_FLOAT32:
+      *datatype = GL_FLOAT;
+      *comps = 1;
+      return;
+   case MESA_FORMAT_ALPHA_FLOAT16:
+   case MESA_FORMAT_LUMINANCE_FLOAT16:
+   case MESA_FORMAT_INTENSITY_FLOAT16:
+      *datatype = GL_HALF_FLOAT_ARB;
+      *comps = 1;
+      return;
+
+   default:
+      _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps");
+      *datatype = 0;
+      *comps = 1;
+   }
+}
diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h
new file mode 100644
index 000000000..0eeeb8b2b
--- /dev/null
+++ b/mesalib/src/mesa/main/formats.h
@@ -0,0 +1,185 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008-2009  VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Authors:
+ *   Brian Paul
+ */
+
+
+#ifndef FORMATS_H
+#define FORMATS_H
+
+
+#include "main/mtypes.h"
+
+
+
+/**
+ * Mesa texture/renderbuffer image formats.
+ */
+typedef enum
+{
+   MESA_FORMAT_NONE = 0,
+
+   /** 
+    * \name Basic hardware formats
+    */
+   /*@{*/
+				/* msb <------ TEXEL BITS -----------> lsb */
+				/* ---- ---- ---- ---- ---- ---- ---- ---- */
+   MESA_FORMAT_RGBA8888,	/* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
+   MESA_FORMAT_RGBA8888_REV,	/* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_ARGB8888,	/* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_ARGB8888_REV,	/* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
+   MESA_FORMAT_XRGB8888,	/* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_XRGB8888_REV,	/* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
+   MESA_FORMAT_RGB888,		/*           RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_BGR888,		/*           BBBB BBBB GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_RGB565,		/*                     RRRR RGGG GGGB BBBB */
+   MESA_FORMAT_RGB565_REV,	/*                     GGGB BBBB RRRR RGGG */
+   MESA_FORMAT_ARGB4444,	/*                     AAAA RRRR GGGG BBBB */
+   MESA_FORMAT_ARGB4444_REV,	/*                     GGGG BBBB AAAA RRRR */
+   MESA_FORMAT_RGBA5551,        /*                     RRRR RGGG GGBB BBBA */
+   MESA_FORMAT_ARGB1555,	/*                     ARRR RRGG GGGB BBBB */
+   MESA_FORMAT_ARGB1555_REV,	/*                     GGGB BBBB ARRR RRGG */
+   MESA_FORMAT_AL88,		/*                     AAAA AAAA LLLL LLLL */
+   MESA_FORMAT_AL88_REV,	/*                     LLLL LLLL AAAA AAAA */
+   MESA_FORMAT_AL1616,          /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
+   MESA_FORMAT_AL1616_REV,      /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
+   MESA_FORMAT_RGB332,		/*                               RRRG GGBB */
+   MESA_FORMAT_A8,		/*                               AAAA AAAA */
+   MESA_FORMAT_L8,		/*                               LLLL LLLL */
+   MESA_FORMAT_I8,		/*                               IIII IIII */
+   MESA_FORMAT_CI8,		/*                               CCCC CCCC */
+   MESA_FORMAT_YCBCR,		/*                     YYYY YYYY UorV UorV */
+   MESA_FORMAT_YCBCR_REV,	/*                     UorV UorV YYYY YYYY */
+   MESA_FORMAT_Z24_S8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
+   MESA_FORMAT_S8_Z24,          /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
+   MESA_FORMAT_Z16,             /*                     ZZZZ ZZZZ ZZZZ ZZZZ */
+   MESA_FORMAT_X8_Z24,          /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
+   MESA_FORMAT_Z24_X8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
+   MESA_FORMAT_Z32,             /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
+   MESA_FORMAT_S8,              /*                               SSSS SSSS */
+   /*@}*/
+
+   /**
+    * \name 8-bit/channel sRGB formats
+    */
+   /*@{*/
+   MESA_FORMAT_SRGB8,
+   MESA_FORMAT_SRGBA8,
+   MESA_FORMAT_SARGB8,
+   MESA_FORMAT_SL8,
+   MESA_FORMAT_SLA8,
+   MESA_FORMAT_SRGB_DXT1,
+   MESA_FORMAT_SRGBA_DXT1,
+   MESA_FORMAT_SRGBA_DXT3,
+   MESA_FORMAT_SRGBA_DXT5,
+   /*@}*/
+
+   /**
+    * \name Compressed texture formats.
+    */
+   /*@{*/
+   MESA_FORMAT_RGB_FXT1,
+   MESA_FORMAT_RGBA_FXT1,
+   MESA_FORMAT_RGB_DXT1,
+   MESA_FORMAT_RGBA_DXT1,
+   MESA_FORMAT_RGBA_DXT3,
+   MESA_FORMAT_RGBA_DXT5,
+   /*@}*/
+
+   /**
+    * \name Floating point texture formats.
+    */
+   /*@{*/
+   MESA_FORMAT_RGBA_FLOAT32,
+   MESA_FORMAT_RGBA_FLOAT16,
+   MESA_FORMAT_RGB_FLOAT32,
+   MESA_FORMAT_RGB_FLOAT16,
+   MESA_FORMAT_ALPHA_FLOAT32,
+   MESA_FORMAT_ALPHA_FLOAT16,
+   MESA_FORMAT_LUMINANCE_FLOAT32,
+   MESA_FORMAT_LUMINANCE_FLOAT16,
+   MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
+   MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
+   MESA_FORMAT_INTENSITY_FLOAT32,
+   MESA_FORMAT_INTENSITY_FLOAT16,
+   /*@}*/
+
+   /**
+    * \name Signed fixed point texture formats.
+    */
+   /*@{*/
+   MESA_FORMAT_DUDV8,
+   MESA_FORMAT_SIGNED_RGBA8888,
+   MESA_FORMAT_SIGNED_RGBA8888_REV,
+   MESA_FORMAT_SIGNED_RGBA_16,
+   /*@}*/
+
+   MESA_FORMAT_COUNT
+} gl_format;
+
+
+extern const char *
+_mesa_get_format_name(gl_format format);
+
+extern GLuint
+_mesa_get_format_bytes(gl_format format);
+
+extern GLint
+_mesa_get_format_bits(gl_format format, GLenum pname);
+
+extern GLenum
+_mesa_get_format_datatype(gl_format format);
+
+extern GLenum
+_mesa_get_format_base_format(gl_format format);
+
+extern void
+_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh);
+
+extern GLboolean
+_mesa_is_format_compressed(gl_format format);
+
+extern GLenum
+_mesa_get_format_color_encoding(gl_format format);
+
+extern GLuint
+_mesa_format_image_size(gl_format format, GLsizei width,
+                        GLsizei height, GLsizei depth);
+
+extern GLint
+_mesa_format_row_stride(gl_format format, GLsizei width);
+
+extern void
+_mesa_format_to_type_and_comps(gl_format format,
+                               GLenum *datatype, GLuint *comps);
+
+extern void
+_mesa_test_formats(void);
+
+#endif /* FORMATS_H */
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index dc79b8ca6..d958dbf7d 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -35,6 +35,7 @@
 #include "buffers.h"
 #include "context.h"
 #include "depthstencil.h"
+#include "formats.h"
 #include "macros.h"
 #include "mtypes.h"
 #include "fbobject.h"
@@ -281,7 +282,6 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
          struct gl_renderbuffer *rb = att->Renderbuffer;
          /* only resize if size is changing */
          if (rb->Width != width || rb->Height != height) {
-            /* could just as well pass rb->_ActualFormat here */
             if (rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) {
                ASSERT(rb->Width == width);
                ASSERT(rb->Height == height);
@@ -523,19 +523,22 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
    for (i = 0; i < BUFFER_COUNT; i++) {
       if (fb->Attachment[i].Renderbuffer) {
          const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
-         if (rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB) {
-            fb->Visual.redBits = rb->RedBits;
-            fb->Visual.greenBits = rb->GreenBits;
-            fb->Visual.blueBits = rb->BlueBits;
-            fb->Visual.alphaBits = rb->AlphaBits;
+         const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
+         const gl_format fmt = rb->Format;
+         
+         if (baseFormat == GL_RGBA || baseFormat == GL_RGB) {
+            fb->Visual.redBits = _mesa_get_format_bits(fmt, GL_RED_BITS);
+            fb->Visual.greenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS);
+            fb->Visual.blueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS);
+            fb->Visual.alphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS);
             fb->Visual.rgbBits = fb->Visual.redBits
                + fb->Visual.greenBits + fb->Visual.blueBits;
             fb->Visual.floatMode = GL_FALSE;
             fb->Visual.samples = rb->NumSamples;
             break;
          }
-         else if (rb->_BaseFormat == GL_COLOR_INDEX) {
-            fb->Visual.indexBits = rb->IndexBits;
+         else if (baseFormat == GL_COLOR_INDEX) {
+            fb->Visual.indexBits = _mesa_get_format_bits(fmt, GL_INDEX_BITS);
             fb->Visual.rgbMode = GL_FALSE;
             break;
          }
@@ -543,27 +546,30 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
    }
 
    if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) {
+      const struct gl_renderbuffer *rb =
+         fb->Attachment[BUFFER_DEPTH].Renderbuffer;
+      const gl_format fmt = rb->Format;
       fb->Visual.haveDepthBuffer = GL_TRUE;
-      fb->Visual.depthBits
-         = fb->Attachment[BUFFER_DEPTH].Renderbuffer->DepthBits;
+      fb->Visual.depthBits = _mesa_get_format_bits(fmt, GL_DEPTH_BITS);
    }
 
    if (fb->Attachment[BUFFER_STENCIL].Renderbuffer) {
+      const struct gl_renderbuffer *rb =
+         fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+      const gl_format fmt = rb->Format;
       fb->Visual.haveStencilBuffer = GL_TRUE;
-      fb->Visual.stencilBits
-         = fb->Attachment[BUFFER_STENCIL].Renderbuffer->StencilBits;
+      fb->Visual.stencilBits = _mesa_get_format_bits(fmt, GL_STENCIL_BITS);
    }
 
    if (fb->Attachment[BUFFER_ACCUM].Renderbuffer) {
+      const struct gl_renderbuffer *rb =
+         fb->Attachment[BUFFER_ACCUM].Renderbuffer;
+      const gl_format fmt = rb->Format;
       fb->Visual.haveAccumBuffer = GL_TRUE;
-      fb->Visual.accumRedBits
-         = fb->Attachment[BUFFER_ACCUM].Renderbuffer->RedBits;
-      fb->Visual.accumGreenBits
-         = fb->Attachment[BUFFER_ACCUM].Renderbuffer->GreenBits;
-      fb->Visual.accumBlueBits
-         = fb->Attachment[BUFFER_ACCUM].Renderbuffer->BlueBits;
-      fb->Visual.accumAlphaBits
-         = fb->Attachment[BUFFER_ACCUM].Renderbuffer->AlphaBits;
+      fb->Visual.accumRedBits = _mesa_get_format_bits(fmt, GL_RED_BITS);
+      fb->Visual.accumGreenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS);
+      fb->Visual.accumBlueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS);
+      fb->Visual.accumAlphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS);
    }
 
    compute_depth_max(fb);
@@ -592,11 +598,11 @@ _mesa_update_depth_buffer(GLcontext *ctx,
 
    depthRb = fb->Attachment[attIndex].Renderbuffer;
 
-   if (depthRb && depthRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
+   if (depthRb && depthRb->_BaseFormat == GL_DEPTH_STENCIL) {
       /* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */
       if (!fb->_DepthBuffer
           || fb->_DepthBuffer->Wrapped != depthRb
-          || fb->_DepthBuffer->_BaseFormat != GL_DEPTH_COMPONENT) {
+          || _mesa_get_format_base_format(fb->_DepthBuffer->Format) != GL_DEPTH_COMPONENT) {
          /* need to update wrapper */
          struct gl_renderbuffer *wrapper
             = _mesa_new_z24_renderbuffer_wrapper(ctx, depthRb);
@@ -633,11 +639,11 @@ _mesa_update_stencil_buffer(GLcontext *ctx,
 
    stencilRb = fb->Attachment[attIndex].Renderbuffer;
 
-   if (stencilRb && stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
+   if (stencilRb && stencilRb->_BaseFormat == GL_DEPTH_STENCIL) {
       /* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */
       if (!fb->_StencilBuffer
           || fb->_StencilBuffer->Wrapped != stencilRb
-          || fb->_StencilBuffer->_BaseFormat != GL_STENCIL_INDEX) {
+          || _mesa_get_format_base_format(fb->_StencilBuffer->Format) != GL_STENCIL_INDEX) {
          /* need to update wrapper */
          struct gl_renderbuffer *wrapper
             = _mesa_new_s8_renderbuffer_wrapper(ctx, stencilRb);
@@ -854,30 +860,32 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format)
       if (ctx->ReadBuffer->_ColorReadBuffer == NULL) {
          return GL_FALSE;
       }
-      ASSERT(ctx->ReadBuffer->_ColorReadBuffer->RedBits > 0 ||
-             ctx->ReadBuffer->_ColorReadBuffer->IndexBits > 0);
+      ASSERT(_mesa_get_format_bits(ctx->ReadBuffer->_ColorReadBuffer->Format, GL_RED_BITS) > 0 ||
+             _mesa_get_format_bits(ctx->ReadBuffer->_ColorReadBuffer->Format, GL_INDEX_BITS) > 0);
       break;
    case GL_DEPTH:
    case GL_DEPTH_COMPONENT:
       if (!att[BUFFER_DEPTH].Renderbuffer) {
          return GL_FALSE;
       }
-      ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);
+      /*ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);*/
       break;
    case GL_STENCIL:
    case GL_STENCIL_INDEX:
       if (!att[BUFFER_STENCIL].Renderbuffer) {
          return GL_FALSE;
       }
-      ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);
+      /*ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);*/
       break;
    case GL_DEPTH_STENCIL_EXT:
       if (!att[BUFFER_DEPTH].Renderbuffer ||
           !att[BUFFER_STENCIL].Renderbuffer) {
          return GL_FALSE;
       }
+      /*
       ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);
       ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);
+      */
       break;
    default:
       _mesa_problem(ctx,
@@ -932,22 +940,24 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
       if (!att[BUFFER_DEPTH].Renderbuffer) {
          return GL_FALSE;
       }
-      ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);
+      /*ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);*/
       break;
    case GL_STENCIL:
    case GL_STENCIL_INDEX:
       if (!att[BUFFER_STENCIL].Renderbuffer) {
          return GL_FALSE;
       }
-      ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);
+      /*ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);*/
       break;
    case GL_DEPTH_STENCIL_EXT:
       if (!att[BUFFER_DEPTH].Renderbuffer ||
           !att[BUFFER_STENCIL].Renderbuffer) {
          return GL_FALSE;
       }
+      /*
       ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);
       ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);
+      */
       break;
    default:
       _mesa_problem(ctx,
@@ -959,3 +969,29 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
    /* OK */
    return GL_TRUE;
 }
+
+GLenum
+_mesa_get_color_read_format(GLcontext *ctx)
+{
+   switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
+   case MESA_FORMAT_ARGB8888:
+      return GL_BGRA;
+   case MESA_FORMAT_RGB565:
+      return GL_BGR;
+   default:
+      return GL_RGBA;
+   }
+}
+
+GLenum
+_mesa_get_color_read_type(GLcontext *ctx)
+{
+   switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
+   case MESA_FORMAT_ARGB8888:
+      return GL_UNSIGNED_BYTE;
+   case MESA_FORMAT_RGB565:
+      return GL_UNSIGNED_SHORT_5_6_5_REV;
+   default:
+      return GL_UNSIGNED_BYTE;
+   }
+}
diff --git a/mesalib/src/mesa/main/framebuffer.h b/mesalib/src/mesa/main/framebuffer.h
index 45a4703ba..ef21dd98e 100644
--- a/mesalib/src/mesa/main/framebuffer.h
+++ b/mesalib/src/mesa/main/framebuffer.h
@@ -81,5 +81,10 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format);
 extern GLboolean
 _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format);
 
+extern GLenum
+_mesa_get_color_read_type(GLcontext *ctx);
+
+extern GLenum
+_mesa_get_color_read_format(GLcontext *ctx);
 
 #endif /* FRAMEBUFFER_H */
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 604b10621..3f6b03c88 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -13,6 +13,7 @@
 #include "mtypes.h"
 #include "state.h"
 #include "texcompress.h"
+#include "framebuffer.h"
 
 
 #define FLOAT_TO_BOOLEAN(X)   ( (X) ? GL_TRUE : GL_FALSE )
@@ -1722,6 +1723,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin);
          params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax);
          break;
+      case GL_DEPTH_CLAMP:
+         CHECK_EXT1(ARB_depth_clamp, "GetBooleanv");
+         params[0] = ctx->Transform.DepthClamp;
+         break;
       case GL_MAX_DRAW_BUFFERS_ARB:
          params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers);
          break;
@@ -1763,11 +1768,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
          break;
       case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
          CHECK_EXT1(OES_read_format, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType);
+         params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx));
          break;
       case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
          CHECK_EXT1(OES_read_format, "GetBooleanv");
-         params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat);
+         params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx));
          break;
       case GL_NUM_FRAGMENT_REGISTERS_ATI:
          CHECK_EXT1(ATI_fragment_shader, "GetBooleanv");
@@ -3553,6 +3558,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          params[0] = ctx->Depth.BoundsMin;
          params[1] = ctx->Depth.BoundsMax;
          break;
+      case GL_DEPTH_CLAMP:
+         CHECK_EXT1(ARB_depth_clamp, "GetFloatv");
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.DepthClamp);
+         break;
       case GL_MAX_DRAW_BUFFERS_ARB:
          params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers);
          break;
@@ -3594,11 +3603,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
          break;
       case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
          CHECK_EXT1(OES_read_format, "GetFloatv");
-         params[0] = (GLfloat)(ctx->Const.ColorReadType);
+         params[0] = (GLfloat)(_mesa_get_color_read_type(ctx));
          break;
       case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
          CHECK_EXT1(OES_read_format, "GetFloatv");
-         params[0] = (GLfloat)(ctx->Const.ColorReadFormat);
+         params[0] = (GLfloat)(_mesa_get_color_read_format(ctx));
          break;
       case GL_NUM_FRAGMENT_REGISTERS_ATI:
          CHECK_EXT1(ATI_fragment_shader, "GetFloatv");
@@ -5384,6 +5393,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          params[0] = IROUND(ctx->Depth.BoundsMin);
          params[1] = IROUND(ctx->Depth.BoundsMax);
          break;
+      case GL_DEPTH_CLAMP:
+         CHECK_EXT1(ARB_depth_clamp, "GetIntegerv");
+         params[0] = BOOLEAN_TO_INT(ctx->Transform.DepthClamp);
+         break;
       case GL_MAX_DRAW_BUFFERS_ARB:
          params[0] = ctx->Const.MaxDrawBuffers;
          break;
@@ -5425,11 +5438,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
          break;
       case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
          CHECK_EXT1(OES_read_format, "GetIntegerv");
-         params[0] = ctx->Const.ColorReadType;
+         params[0] = _mesa_get_color_read_type(ctx);
          break;
       case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
          CHECK_EXT1(OES_read_format, "GetIntegerv");
-         params[0] = ctx->Const.ColorReadFormat;
+         params[0] = _mesa_get_color_read_format(ctx);
          break;
       case GL_NUM_FRAGMENT_REGISTERS_ATI:
          CHECK_EXT1(ATI_fragment_shader, "GetIntegerv");
@@ -7216,6 +7229,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          params[0] = IROUND64(ctx->Depth.BoundsMin);
          params[1] = IROUND64(ctx->Depth.BoundsMax);
          break;
+      case GL_DEPTH_CLAMP:
+         CHECK_EXT1(ARB_depth_clamp, "GetInteger64v");
+         params[0] = BOOLEAN_TO_INT64(ctx->Transform.DepthClamp);
+         break;
       case GL_MAX_DRAW_BUFFERS_ARB:
          params[0] = (GLint64)(ctx->Const.MaxDrawBuffers);
          break;
@@ -7257,11 +7274,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
          break;
       case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
          CHECK_EXT1(OES_read_format, "GetInteger64v");
-         params[0] = (GLint64)(ctx->Const.ColorReadType);
+         params[0] = (GLint64)(_mesa_get_color_read_type(ctx));
          break;
       case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
          CHECK_EXT1(OES_read_format, "GetInteger64v");
-         params[0] = (GLint64)(ctx->Const.ColorReadFormat);
+         params[0] = (GLint64)(_mesa_get_color_read_format(ctx));
          break;
       case GL_NUM_FRAGMENT_REGISTERS_ATI:
          CHECK_EXT1(ATI_fragment_shader, "GetInteger64v");
diff --git a/mesalib/src/mesa/main/get_gen.py b/mesalib/src/mesa/main/get_gen.py
deleted file mode 100644
index c7babd1c8..000000000
--- a/mesalib/src/mesa/main/get_gen.py
+++ /dev/null
@@ -1,1252 +0,0 @@
-#!/usr/bin/env python
-
-# Mesa 3-D graphics library
-#
-# Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-# This script is used to generate the get.c file:
-# python get_gen.py > get.c
-
-
-import string
-
-
-GLint = 1
-GLenum = 2
-GLfloat = 3
-GLdouble = 4
-GLboolean = 5
-GLfloatN = 6    # A normalized value, such as a color or depth range
-GLint64 = 7
-
-
-TypeStrings = {
-	GLint : "GLint",
-	GLenum : "GLenum",
-	GLfloat : "GLfloat",
-	GLdouble : "GLdouble",
-	GLboolean : "GLboolean",
-	GLint64 : "GLint64"
-}
-
-
-# Each entry is a tuple of:
-#  - the GL state name, such as GL_CURRENT_COLOR
-#  - the state datatype, one of GLint, GLfloat, GLboolean or GLenum
-#  - list of code fragments to get the state, such as ["ctx->Foo.Bar"]
-#  - optional extra code or empty string.  If present, "CONVERSION" will be
-#    replaced by ENUM_TO_FLOAT, INT_TO_FLOAT, etc.
-#  - optional extensions to check, or None
-#
-StateVars = [
-	( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"],
-	  "", None ),
-	( "GL_ACCUM_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.accumGreenBits"],
-	  "", None ),
-	( "GL_ACCUM_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.accumBlueBits"],
-	  "", None ),
-	( "GL_ACCUM_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.accumAlphaBits"],
-	  "", None ),
-	( "GL_ACCUM_CLEAR_VALUE", GLfloatN,
-	  [ "ctx->Accum.ClearColor[0]",
-		"ctx->Accum.ClearColor[1]",
-		"ctx->Accum.ClearColor[2]",
-		"ctx->Accum.ClearColor[3]" ],
-	  "", None ),
-	( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", None ),
-	( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"],
-	  "", None ),
-	( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", None ),
-	( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ),
-	( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ),
-	( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ),
-	( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", None ),
-	( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", None ),
-	( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"],
-	  "", None ),
-	( "GL_BLEND", GLboolean, ["ctx->Color.BlendEnabled"], "", None ),
-	( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
-	( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
-	( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
-	( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
-	( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None ),
-	( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None ),
-	( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None),
-	( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "],
-	  "", None ),
-	( "GL_BLEND_COLOR_EXT", GLfloatN,
-	  [ "ctx->Color.BlendColor[0]",
-		"ctx->Color.BlendColor[1]",
-		"ctx->Color.BlendColor[2]",
-		"ctx->Color.BlendColor[3]"], "", None ),
-	( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", None ),
-	( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ),
-	( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", None ),
-	( "GL_CLIENT_ATTRIB_STACK_DEPTH", GLint,
-	  ["ctx->ClientAttribStackDepth"], "", None ),
-	( "GL_CLIP_PLANE0", GLboolean,
-	  [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ),
-	( "GL_CLIP_PLANE1", GLboolean,
-	  [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ),
-	( "GL_CLIP_PLANE2", GLboolean,
-	  [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ),
-	( "GL_CLIP_PLANE3", GLboolean,
-	  [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ),
-	( "GL_CLIP_PLANE4", GLboolean,
-	  [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ),
-	( "GL_CLIP_PLANE5", GLboolean,
-	  [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ),
-	( "GL_COLOR_CLEAR_VALUE", GLfloatN,
-	  [ "ctx->Color.ClearColor[0]",
-		"ctx->Color.ClearColor[1]",
-		"ctx->Color.ClearColor[2]",
-		"ctx->Color.ClearColor[3]" ], "", None ),
-	( "GL_COLOR_MATERIAL", GLboolean,
-	  ["ctx->Light.ColorMaterialEnabled"], "", None ),
-	( "GL_COLOR_MATERIAL_FACE", GLenum,
-	  ["ctx->Light.ColorMaterialFace"], "", None ),
-	( "GL_COLOR_MATERIAL_PARAMETER", GLenum,
-	  ["ctx->Light.ColorMaterialMode"], "", None ),
-	( "GL_COLOR_WRITEMASK", GLint,
-	  [ "ctx->Color.ColorMask[RCOMP] ? 1 : 0",
-		"ctx->Color.ColorMask[GCOMP] ? 1 : 0",
-		"ctx->Color.ColorMask[BCOMP] ? 1 : 0",
-		"ctx->Color.ColorMask[ACOMP] ? 1 : 0" ], "", None ),
-	( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ),
-	( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ),
-	( "GL_CURRENT_COLOR", GLfloatN,
-	  [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]",
-		"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]",
-		"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]",
-		"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ],
-	  "FLUSH_CURRENT(ctx, 0);", None ),
-	( "GL_CURRENT_INDEX", GLfloat,
-	  [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ],
-	  "FLUSH_CURRENT(ctx, 0);", None ),
-	( "GL_CURRENT_NORMAL", GLfloatN,
-	  [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]",
-		"ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]",
-		"ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"],
-	  "FLUSH_CURRENT(ctx, 0);", None ),
-	( "GL_CURRENT_RASTER_COLOR", GLfloatN,
-	  ["ctx->Current.RasterColor[0]",
-	   "ctx->Current.RasterColor[1]",
-	   "ctx->Current.RasterColor[2]",
-	   "ctx->Current.RasterColor[3]"], "", None ),
-	( "GL_CURRENT_RASTER_DISTANCE", GLfloat,
-	  ["ctx->Current.RasterDistance"], "", None ),
-	( "GL_CURRENT_RASTER_INDEX", GLfloat,
-	  ["ctx->Current.RasterIndex"], "", None ),
-	( "GL_CURRENT_RASTER_POSITION", GLfloat,
-	  ["ctx->Current.RasterPos[0]",
-	   "ctx->Current.RasterPos[1]",
-	   "ctx->Current.RasterPos[2]",
-	   "ctx->Current.RasterPos[3]"], "", None ),
-	( "GL_CURRENT_RASTER_SECONDARY_COLOR", GLfloatN,
-	  ["ctx->Current.RasterSecondaryColor[0]",
-	   "ctx->Current.RasterSecondaryColor[1]",
-	   "ctx->Current.RasterSecondaryColor[2]",
-	   "ctx->Current.RasterSecondaryColor[3]"], "", None ),
-	( "GL_CURRENT_RASTER_TEXTURE_COORDS", GLfloat,
-	  ["ctx->Current.RasterTexCoords[texUnit][0]",
-	   "ctx->Current.RasterTexCoords[texUnit][1]",
-	   "ctx->Current.RasterTexCoords[texUnit][2]",
-	   "ctx->Current.RasterTexCoords[texUnit][3]"],
-	  "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ),
-	( "GL_CURRENT_RASTER_POSITION_VALID", GLboolean,
-	  ["ctx->Current.RasterPosValid"], "", None ),
-	( "GL_CURRENT_TEXTURE_COORDS", GLfloat,
-	  ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]",
-	   "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]",
-	   "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]",
-	   "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]"],
-	  """const GLuint texUnit = ctx->Texture.CurrentUnit;
-         FLUSH_CURRENT(ctx, 0);""", None ),
-	( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ),
-	( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
-	  "", None ),
-	( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["((GLfloat) ctx->Depth.Clear)"], "", None ),
-	( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ),
-	( "GL_DEPTH_RANGE", GLfloatN,
-	  [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ),
-	( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", None ),
-	( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ),
-	( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ),
-	( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ),
-	( "GL_DOUBLEBUFFER", GLboolean,
-	  ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ),
-	( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
-	( "GL_EDGE_FLAG", GLboolean, ["(ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)"],
-	  "FLUSH_CURRENT(ctx, 0);", None ),
-	( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ),
-	( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ),
-	( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ),
-	( "GL_FOG_COLOR", GLfloatN,
-	  [ "ctx->Fog.Color[0]",
-		"ctx->Fog.Color[1]",
-		"ctx->Fog.Color[2]",
-		"ctx->Fog.Color[3]" ], "", None ),
-	( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ),
-	( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ),
-	( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ),
-	( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", None ),
-	( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ),
-	( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ),
-	( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ),
-	( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", None ),
-	( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"],
-	  "", None ),
-	( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", None ),
-	( "GL_INDEX_BITS", GLint, ["ctx->DrawBuffer->Visual.indexBits"],
-	  "", None ),
-	( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", None ),
-	( "GL_INDEX_MODE", GLboolean, ["!ctx->DrawBuffer->Visual.rgbMode"],
-	  "", None ),
-	( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", None ),
-	( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", None ),
-	( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", None ),
-	( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ),
-	( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ),
-	( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ),
-	( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ),
-	( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ),
-	( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ),
-	( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ),
-	( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ),
-	( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ),
-	( "GL_LIGHT_MODEL_AMBIENT", GLfloatN,
-	  ["ctx->Light.Model.Ambient[0]",
-	   "ctx->Light.Model.Ambient[1]",
-	   "ctx->Light.Model.Ambient[2]",
-	   "ctx->Light.Model.Ambient[3]"], "", None ),
-	( "GL_LIGHT_MODEL_COLOR_CONTROL", GLenum,
-	  ["ctx->Light.Model.ColorControl"], "", None ),
-	( "GL_LIGHT_MODEL_LOCAL_VIEWER", GLboolean,
-	  ["ctx->Light.Model.LocalViewer"], "", None ),
-	( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ),
-	( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ),
-	( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ),
-	( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", None ),
-	( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", None ),
-	( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", None ),
-	( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ),
-	( "GL_LINE_WIDTH_GRANULARITY", GLfloat,
-	  ["ctx->Const.LineWidthGranularity"], "", None ),
-	( "GL_LINE_WIDTH_RANGE", GLfloat,
-	  ["ctx->Const.MinLineWidthAA",
-	   "ctx->Const.MaxLineWidthAA"], "", None ),
-	( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat,
-	  ["ctx->Const.MinLineWidth",
-	   "ctx->Const.MaxLineWidth"], "", None ),
-	( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", None ),
-	( "GL_LIST_INDEX", GLint, ["(ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)"], "", None ),
-	( "GL_LIST_MODE", GLenum, ["mode"],
-	  """GLenum mode;
-         if (!ctx->CompileFlag)
-            mode = 0;
-         else if (ctx->ExecuteFlag)
-            mode = GL_COMPILE_AND_EXECUTE;
-         else
-            mode = GL_COMPILE;""", None ),
-	( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", None ),
-	( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ),
-	( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ),
-	( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", None ),
-	( "GL_MAP1_GRID_DOMAIN", GLfloat,
-	  ["ctx->Eval.MapGrid1u1",
-	   "ctx->Eval.MapGrid1u2"], "", None ),
-	( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", None ),
-	( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", None ),
-	( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", None ),
-	( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", None ),
-	( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", None ),
-	( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", None ),
-	( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", None ),
-	( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", None ),
-	( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", None ),
-	( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", None ),
-	( "GL_MAP2_GRID_DOMAIN", GLfloat,
-	  ["ctx->Eval.MapGrid2u1",
-	   "ctx->Eval.MapGrid2u2",
-	   "ctx->Eval.MapGrid2v1",
-	   "ctx->Eval.MapGrid2v2"], "", None ),
-	( "GL_MAP2_GRID_SEGMENTS", GLint,
-	  ["ctx->Eval.MapGrid2un",
-	   "ctx->Eval.MapGrid2vn"], "", None ),
-	( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", None ),
-	( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", None ),
-	( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", None ),
-	( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", None ),
-	( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", None ),
-	( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", None ),
-	( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", None ),
-	( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", None ),
-	( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", None ),
-	( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", None ),
-	( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ),
-
-	( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", None ),
-	( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", None ),
-	( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ),
-	( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
-	( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
-	( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", None ),
-	( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ),
-	( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", None ),
-	( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ),
-	( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", None ),
-	( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", None ),
-	( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ),
-	( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ),
-	( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None ),
-	( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ),
-	( "GL_MAX_VIEWPORT_DIMS", GLint,
-	  ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"],
-	  "", None ),
-	( "GL_MODELVIEW_MATRIX", GLfloat,
-	  [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
-		"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
-		"matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
-		"matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-	  "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
-	( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ),
-	( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", None ),
-	( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ),
-	( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ),
-	( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", None ),
-	( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", None ),
-	( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", None ),
-	( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", None ),
-	( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", None ),
-	( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ),
-	( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", None ),
-	( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ),
-	( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
-	  ["ctx->Hint.PerspectiveCorrection"], "", None ),
-	( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", None ),
-	( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", None ),
-	( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", None ),
-	( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", None ),
-	( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", None ),
-	( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", None ),
-	( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", None ),
-	( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", None ),
-	( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", None ),
-	( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", None ),
-	( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
-	( "GL_POINT_SIZE_GRANULARITY", GLfloat,
-	  ["ctx->Const.PointSizeGranularity"], "", None ),
-	( "GL_POINT_SIZE_RANGE", GLfloat,
-	  ["ctx->Const.MinPointSizeAA",
-	   "ctx->Const.MaxPointSizeAA"], "", None ),
-	( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat,
-	  ["ctx->Const.MinPointSize",
-	   "ctx->Const.MaxPointSize"], "", None ),
-	( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ),
-	( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ),
-	( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ),
-	( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ),
-	( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat,
-	  ["ctx->Point.Threshold"], "", None ),
-	( "GL_DISTANCE_ATTENUATION_EXT", GLfloat,
-	  ["ctx->Point.Params[0]",
-	   "ctx->Point.Params[1]",
-	   "ctx->Point.Params[2]"], "", None ),
-	( "GL_POLYGON_MODE", GLenum,
-	  ["ctx->Polygon.FrontMode",
-	   "ctx->Polygon.BackMode"], "", None ),
-	( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ),
-	( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ),
-	( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ),
-	( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", None ),
-	( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", None ),
-	( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", None ),
-	( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ),
-	( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ),
-	( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ),
-	( "GL_PROJECTION_MATRIX", GLfloat,
-	  [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
-		"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
-		"matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
-		"matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-	  "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
-	( "GL_PROJECTION_STACK_DEPTH", GLint,
-	  ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ),
-	( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", None ),
-	( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", None ),
-	( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", None ),
-	( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", None ),
-	( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", None ),
-	( "GL_RESCALE_NORMAL", GLboolean,
-	  ["ctx->Transform.RescaleNormals"], "", None ),
-	( "GL_RGBA_MODE", GLboolean, ["ctx->DrawBuffer->Visual.rgbMode"],
-	  "", None ),
-	( "GL_SCISSOR_BOX", GLint,
-	  ["ctx->Scissor.X",
-	   "ctx->Scissor.Y",
-	   "ctx->Scissor.Width",
-	   "ctx->Scissor.Height"], "", None ),
-	( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ),
-	( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", None ),
-	( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ),
-	( "GL_SHARED_TEXTURE_PALETTE_EXT", GLboolean,
-	  ["ctx->Texture.SharedPalette"], "", None ),
-	( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ),
-	( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ),
-	( "GL_STENCIL_FAIL", GLenum,
-	  ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ),
-	( "GL_STENCIL_FUNC", GLenum,
-	  ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ),
-	( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum,
-	  ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ),
-	( "GL_STENCIL_PASS_DEPTH_PASS", GLenum,
-	  ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ),
-	( "GL_STENCIL_REF", GLint,
-	  ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ),
-	( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ),
-	( "GL_STENCIL_VALUE_MASK", GLint,
-	  ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ),
-	( "GL_STENCIL_WRITEMASK", GLint,
-	  ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ),
-	( "GL_STEREO", GLboolean, ["ctx->DrawBuffer->Visual.stereoMode"],
-	  "", None ),
-	( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ),
-	( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", None ),
-	( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ),
-	( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", None ),
-	( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
-	( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
-	( "GL_TEXTURE_BINDING_1D", GLint,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", None ),
-	( "GL_TEXTURE_BINDING_2D", GLint,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", None ),
-	( "GL_TEXTURE_BINDING_3D", GLint,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", None ),
-	( "GL_TEXTURE_BINDING_1D_ARRAY_EXT", GLint,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
-	( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
-	( "GL_TEXTURE_GEN_S", GLboolean,
-	  ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ),
-	( "GL_TEXTURE_GEN_T", GLboolean,
-	  ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", None ),
-	( "GL_TEXTURE_GEN_R", GLboolean,
-	  ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", None ),
-	( "GL_TEXTURE_GEN_Q", GLboolean,
-	  ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", None ),
-	( "GL_TEXTURE_MATRIX", GLfloat,
-	  ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
-	   "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
-	   "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
-	   "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-	  "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
-	( "GL_TEXTURE_STACK_DEPTH", GLint,
-	  ["ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1"], "", None ),
-	( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ),
-	( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", None ),
-	( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", None ),
-	( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", None ),
-	( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", None ),
-	( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", None ),
-	( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", None ),
-	( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", None ),
-	( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", None ),
-	( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y",
-	  "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ),
-	( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", None ),
-	( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", None ),
-
-	# Vertex arrays
-	( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", None ),
-	( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", None ),
-	( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", None ),
-	( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", None ),
-	( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-	( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", None ),
-	( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", None ),
-	( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", None ),
-	( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-	( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", None ),
-	( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", None ),
-	( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", None ),
-	( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", None ),
-	( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-	( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Index.Enabled"], "", None ),
-	( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Index.Type"], "", None ),
-	( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Index.Stride"], "", None ),
-	( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-	( "GL_TEXTURE_COORD_ARRAY", GLboolean,
-	  ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ),
-	( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint,
-	  ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", None ),
-	( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum,
-	  ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", None ),
-	( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint,
-	  ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ),
-	( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-	( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.ArrayObj->EdgeFlag.Enabled"], "", None ),
-	( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->EdgeFlag.Stride"], "", None ),
-	( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-
-	# GL_ARB_multitexture
-	( "GL_MAX_TEXTURE_UNITS_ARB", GLint,
-	  ["ctx->Const.MaxTextureUnits"], "", ["ARB_multitexture"] ),
-	( "GL_ACTIVE_TEXTURE_ARB", GLint,
-	  [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", ["ARB_multitexture"] ),
-	( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint,
-	  ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", ["ARB_multitexture"] ),
-
-	# GL_ARB_texture_cube_map
-	( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean,
-	  ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", ["ARB_texture_cube_map"] ),
-	( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"],
-	  "", ["ARB_texture_cube_map"] ),
-	( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint,
-	  ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"],
-	  "", ["ARB_texture_cube_map"]),
-
-	# GL_ARB_texture_compression */
-	( "GL_TEXTURE_COMPRESSION_HINT_ARB", GLint,
-	  ["ctx->Hint.TextureCompression"], "", None ),
-	( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
-	  ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"],
-	  "", None ),
-	( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum,
-	  [],
-	  """GLint formats[100];
-         GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
-         ASSERT(n <= 100);
-         for (i = 0; i < n; i++)
-            params[i] = CONVERSION(formats[i]);""",
-	  None ),
-
-	# GL_EXT_compiled_vertex_array
-	( "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", GLint, ["ctx->Array.LockFirst"],
-	  "", ["EXT_compiled_vertex_array"] ),
-	( "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", GLint, ["ctx->Array.LockCount"],
-	  "", ["EXT_compiled_vertex_array"] ),
-
-	# GL_ARB_transpose_matrix
-	( "GL_TRANSPOSE_COLOR_MATRIX_ARB", GLfloat,
-	  ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
-	   "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
-	   "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
-	   "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-	  "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
-	( "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", GLfloat,
-	  ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
-	   "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
-	   "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
-	   "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-	  "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
-	( "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", GLfloat,
-	  ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
-	   "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
-	   "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
-	   "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-	  "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
-	( "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", GLfloat,
-	  ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
-	   "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
-	   "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
-	   "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-	  "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
-
-	# GL_SGI_color_matrix (also in 1.2 imaging)
-	( "GL_COLOR_MATRIX_SGI", GLfloat,
-	  ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
-	   "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
-	   "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
-	   "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-	  "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
-	( "GL_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
-	  ["ctx->ColorMatrixStack.Depth + 1"], "", None ),
-	( "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
-	  ["MAX_COLOR_STACK_DEPTH"], "", None ),
-	( "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixScale[0]"], "", None ),
-	( "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixScale[1]"], "", None ),
-	( "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixScale[2]"], "", None ),
-	( "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixScale[3]"], "", None ),
-	( "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixBias[0]"], "", None ),
-	( "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixBias[1]"], "", None ),
-	( "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixBias[2]"], "", None ),
-	( "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", GLfloat,
-	  ["ctx->Pixel.PostColorMatrixBias[3]"], "", None ),
-
-	# GL_EXT_convolution (also in 1.2 imaging)
-	( "GL_CONVOLUTION_1D_EXT", GLboolean,
-	  ["ctx->Pixel.Convolution1DEnabled"], "", ["EXT_convolution"] ),
-	( "GL_CONVOLUTION_2D_EXT", GLboolean,
-	  ["ctx->Pixel.Convolution2DEnabled"], "", ["EXT_convolution"] ),
-	( "GL_SEPARABLE_2D_EXT", GLboolean,
-	  ["ctx->Pixel.Separable2DEnabled"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_RED_SCALE_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionScale[0]"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionScale[1]"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionScale[2]"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionScale[3]"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_RED_BIAS_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionBias[0]"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionBias[1]"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionBias[2]"], "", ["EXT_convolution"] ),
-	( "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", GLfloat,
-	  ["ctx->Pixel.PostConvolutionBias[3]"], "", ["EXT_convolution"] ),
-
-	# GL_EXT_histogram / GL_ARB_imaging
-	( "GL_HISTOGRAM", GLboolean,
-	  [ "ctx->Pixel.HistogramEnabled" ], "", ["EXT_histogram"] ),
-	( "GL_MINMAX", GLboolean,
-	  [ "ctx->Pixel.MinMaxEnabled" ], "", ["EXT_histogram"] ),
-
-	# GL_SGI_color_table / GL_ARB_imaging
-	( "GL_COLOR_TABLE_SGI", GLboolean,
-	  ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "", ["SGI_color_table"] ),
-	( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
-	  ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "", ["SGI_color_table"] ),
-	( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
-	  ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "", ["SGI_color_table"] ),
-
-	# GL_SGI_texture_color_table
-	( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled"],
-	  "", ["SGI_texture_color_table"] ),
-
-	# GL_EXT_secondary_color
-	( "GL_COLOR_SUM_EXT", GLboolean,
-	  ["ctx->Fog.ColorSumEnabled"], "",
-	  ["EXT_secondary_color", "ARB_vertex_program"] ),
-	( "GL_CURRENT_SECONDARY_COLOR_EXT", GLfloatN,
-	  ["ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]",
-	   "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]",
-	   "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]",
-	   "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]"],
-	  "FLUSH_CURRENT(ctx, 0);", ["EXT_secondary_color"] ),
-	( "GL_SECONDARY_COLOR_ARRAY_EXT", GLboolean,
-	  ["ctx->Array.ArrayObj->SecondaryColor.Enabled"], "", ["EXT_secondary_color"] ),
-	( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum,
-	  ["ctx->Array.ArrayObj->SecondaryColor.Type"], "",  ["EXT_secondary_color"] ),
-	( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint,
-	  ["ctx->Array.ArrayObj->SecondaryColor.Stride"], "", ["EXT_secondary_color"] ),
-	( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint,
-	  ["ctx->Array.ArrayObj->SecondaryColor.Size"], "", ["EXT_secondary_color"] ),
-
-	# GL_EXT_fog_coord
-	( "GL_CURRENT_FOG_COORDINATE_EXT", GLfloat,
-	  ["ctx->Current.Attrib[VERT_ATTRIB_FOG][0]"],
-	  "FLUSH_CURRENT(ctx, 0);", ["EXT_fog_coord"] ),
-	( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean, ["ctx->Array.ArrayObj->FogCoord.Enabled"],
-	  "",  ["EXT_fog_coord"] ),
-	( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, ["ctx->Array.ArrayObj->FogCoord.Type"],
-	  "", ["EXT_fog_coord"] ),
-	( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, ["ctx->Array.ArrayObj->FogCoord.Stride"],
-	  "", ["EXT_fog_coord"] ),
-	( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum, ["ctx->Fog.FogCoordinateSource"],
-	  "", ["EXT_fog_coord"] ),
-
-	# GL_EXT_texture_lod_bias
-	( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat,
-	  ["ctx->Const.MaxTextureLodBias"], "", ["EXT_texture_lod_bias"]),
-
-	# GL_EXT_texture_filter_anisotropic
-	( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat,
-	  ["ctx->Const.MaxTextureMaxAnisotropy"], "", ["EXT_texture_filter_anisotropic"]),
-
-	# GL_ARB_multisample
-	( "GL_MULTISAMPLE_ARB", GLboolean,
-	  ["ctx->Multisample.Enabled"], "", None ),
-	( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean,
-	  ["ctx->Multisample.SampleAlphaToCoverage"], "", None ),
-	( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean,
-	  ["ctx->Multisample.SampleAlphaToOne"], "", None ),
-	( "GL_SAMPLE_COVERAGE_ARB", GLboolean,
-	  ["ctx->Multisample.SampleCoverage"], "", None ),
-	( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat,
-	  ["ctx->Multisample.SampleCoverageValue"], "", None ),
-	( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean,
-	  ["ctx->Multisample.SampleCoverageInvert"], "", None ),
-	( "GL_SAMPLE_BUFFERS_ARB", GLint,
-	  ["ctx->DrawBuffer->Visual.sampleBuffers"], "", None ),
-	( "GL_SAMPLES_ARB", GLint,
-	  ["ctx->DrawBuffer->Visual.samples"], "", None ),
-
-	# GL_IBM_rasterpos_clip
-	( "GL_RASTER_POSITION_UNCLIPPED_IBM", GLboolean,
-	  ["ctx->Transform.RasterPositionUnclipped"], "", ["IBM_rasterpos_clip"] ),
-
-	# GL_NV_point_sprite
-	( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB
-	  "", ["NV_point_sprite", "ARB_point_sprite"] ),
-	( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"],
-	  "", ["NV_point_sprite"] ),
-	( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"],
-	  "", ["NV_point_sprite", "ARB_point_sprite"] ),
-
-	# GL_SGIS_generate_mipmap
-	( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"],
-	  "", ["SGIS_generate_mipmap"] ),
-
-	# GL_NV_vertex_program
-	( "GL_VERTEX_PROGRAM_BINDING_NV", GLint,
-	  ["(ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)"],
-	  "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY0_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[0].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[1].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[2].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[3].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[4].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[5].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[6].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[7].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[8].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[9].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[10].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[11].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[12].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[13].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[14].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean,
-	  ["ctx->Array.ArrayObj->VertexAttrib[15].Enabled"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB0_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[0]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB1_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[1]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB2_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[2]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB3_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[3]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB4_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[4]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB5_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[5]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB6_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[6]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB7_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[7]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB8_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[8]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB9_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[9]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB10_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[10]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB11_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[11]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB12_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[12]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB13_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[13]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB14_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[14]"], "", ["NV_vertex_program"] ),
-	( "GL_MAP1_VERTEX_ATTRIB15_4_NV", GLboolean,
-	  ["ctx->Eval.Map1Attrib[15]"], "", ["NV_vertex_program"] ),
-
-	# GL_NV_fragment_program
-	( "GL_FRAGMENT_PROGRAM_NV", GLboolean,
-	  ["ctx->FragmentProgram.Enabled"], "", ["NV_fragment_program"] ),
-	( "GL_FRAGMENT_PROGRAM_BINDING_NV", GLint,
-	  ["ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0"],
-	  "", ["NV_fragment_program"] ),
-	( "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", GLint,
-	  ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", ["NV_fragment_program"] ),
-
-	# GL_NV_texture_rectangle
-	( "GL_TEXTURE_RECTANGLE_NV", GLboolean,
-	  ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", ["NV_texture_rectangle"] ),
-	( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint,
-	  ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name"],
-	  "", ["NV_texture_rectangle"] ),
-	( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint,
-	  ["ctx->Const.MaxTextureRectSize"], "", ["NV_texture_rectangle"] ),
-
-	# GL_EXT_stencil_two_side
-	( "GL_STENCIL_TEST_TWO_SIDE_EXT", GLboolean,
-	  ["ctx->Stencil.TestTwoSide"], "", ["EXT_stencil_two_side"] ),
-	( "GL_ACTIVE_STENCIL_FACE_EXT", GLenum,
-	  ["ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT"],
-	  "", ["EXT_stencil_two_side"] ),
-
-	# GL_NV_light_max_exponent
-	( "GL_MAX_SHININESS_NV", GLfloat,
-	  ["ctx->Const.MaxShininess"], "", ["NV_light_max_exponent"] ),
-	( "GL_MAX_SPOT_EXPONENT_NV", GLfloat,
-	  ["ctx->Const.MaxSpotExponent"], "", ["NV_light_max_exponent"] ),
-
-	# GL_ARB_vertex_buffer_object
-	( "GL_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayBufferObj->Name"], "", None ),
-	( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", None ),
-	( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", None ),
-	( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", None ),
-	( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->Index.BufferObj->Name"], "", None ),
-	( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"],
-	  "", None ),
-	( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name"], "", None ),
-	( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name"],
-	  "", None ),
-	( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ArrayObj->FogCoord.BufferObj->Name"],
-	  "", None ),
-	# GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported
-	( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint,
-	  ["ctx->Array.ElementArrayBufferObj->Name"],
-	  "", None ),
-
-	# GL_EXT_pixel_buffer_object
-	( "GL_PIXEL_PACK_BUFFER_BINDING_EXT", GLint,
-	  ["ctx->Pack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
-	( "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", GLint,
-	  ["ctx->Unpack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
-
-	# GL_ARB_vertex_program
-	( "GL_VERTEX_PROGRAM_ARB", GLboolean, # == GL_VERTEX_PROGRAM_NV
-	  ["ctx->VertexProgram.Enabled"], "",
-	  ["ARB_vertex_program", "NV_vertex_program"] ),
-	( "GL_VERTEX_PROGRAM_POINT_SIZE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_POINT_SIZE_NV
-	  ["ctx->VertexProgram.PointSizeEnabled"], "",
-	  ["ARB_vertex_program", "NV_vertex_program"] ),
-	( "GL_VERTEX_PROGRAM_TWO_SIDE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_TWO_SIDE_NV
-	  ["ctx->VertexProgram.TwoSideEnabled"], "",
-	  ["ARB_vertex_program", "NV_vertex_program"] ),
-	( "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", GLint, # == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV
-	  ["ctx->Const.MaxProgramMatrixStackDepth"], "",
-	  ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
-	( "GL_MAX_PROGRAM_MATRICES_ARB", GLint, # == GL_MAX_TRACK_MATRICES_NV
-	  ["ctx->Const.MaxProgramMatrices"], "",
-	  ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
-	( "GL_CURRENT_MATRIX_STACK_DEPTH_ARB", GLboolean, # == GL_CURRENT_MATRIX_STACK_DEPTH_NV
-	  ["ctx->CurrentStack->Depth + 1"], "",
-	  ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
-	( "GL_CURRENT_MATRIX_ARB", GLfloat, # == GL_CURRENT_MATRIX_NV
-	  ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
-	   "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
-	   "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
-	   "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
-	  "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
-	  ["ARB_vertex_program", "ARB_fragment_program", "NV_fragment_program"] ),
-	( "GL_TRANSPOSE_CURRENT_MATRIX_ARB", GLfloat,
-	  ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
-	   "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
-	   "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
-	   "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
-	  "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
-	  ["ARB_vertex_program", "ARB_fragment_program"] ),
-	( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint,
-	  ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ),
-	( "GL_PROGRAM_ERROR_POSITION_ARB", GLint, # == GL_PROGRAM_ERROR_POSITION_NV
-	  ["ctx->Program.ErrorPos"], "", ["NV_vertex_program",
-	   "ARB_vertex_program", "NV_fragment_program", "ARB_fragment_program"] ),
-
-	# GL_ARB_fragment_program
-	( "GL_FRAGMENT_PROGRAM_ARB", GLboolean,
-	  ["ctx->FragmentProgram.Enabled"], "", ["ARB_fragment_program"] ),
-	( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV
-	  ["ctx->Const.MaxTextureCoordUnits"], "",
-	  ["ARB_fragment_program", "NV_fragment_program"] ),
-	( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNITS_NV
-	  ["ctx->Const.MaxTextureImageUnits"], "",
-	  ["ARB_fragment_program", "NV_fragment_program"] ),
-
-	# GL_EXT_depth_bounds_test
-	( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean,
-	  ["ctx->Depth.BoundsTest"], "", ["EXT_depth_bounds_test"] ),
-	( "GL_DEPTH_BOUNDS_EXT", GLfloat,
-	  ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"],
-	  "", ["EXT_depth_bounds_test"] ),
-
-	# GL_ARB_draw_buffers
-	( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
-	  ["ctx->Const.MaxDrawBuffers"], "", None ),
-	( "GL_DRAW_BUFFER0_ARB", GLenum,
-	  ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
-	( "GL_DRAW_BUFFER1_ARB", GLenum,
-	  ["buffer"],
-	  """GLenum buffer;
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
-            return;
-         }
-         buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", None ),
-	( "GL_DRAW_BUFFER2_ARB", GLenum,
-	  ["buffer"],
-	  """GLenum buffer;
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
-            return;
-         }
-         buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", None ),
-	( "GL_DRAW_BUFFER3_ARB", GLenum,
-	  ["buffer"],
-	  """GLenum buffer;
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
-            return;
-         }
-         buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", None ),
-	# XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future
-
-	# GL_OES_read_format
-	( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
-	  ["ctx->Const.ColorReadType"], "", ["OES_read_format"] ),
-	( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
-	  ["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ),
-
-	# GL_ATI_fragment_shader
-	( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
-	( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
-	( "GL_NUM_PASSES_ATI", GLint, ["2"], "", ["ATI_fragment_shader"] ),
-	( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
-	( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"], "", ["ATI_fragment_shader"] ),
-	( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"], "", ["ATI_fragment_shader"] ),
-	( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
-	( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
-
-	# OpenGL 2.0
-	( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ),
-	( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ),
-	( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"], "", None ),
-	( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ),
-	( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ),
-	( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ),
-	( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ),
-
-	# GL_EXT_framebuffer_object
-	( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "",
-	  ["EXT_framebuffer_object"] ),
-	( "GL_RENDERBUFFER_BINDING_EXT", GLint,
-	  ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "",
-	  ["EXT_framebuffer_object"] ),
-	( "GL_MAX_COLOR_ATTACHMENTS_EXT", GLint,
-	  ["ctx->Const.MaxColorAttachments"], "",
-	  ["EXT_framebuffer_object"] ),
-	( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint,
-	  ["ctx->Const.MaxRenderbufferSize"], "",
-	  ["EXT_framebuffer_object"] ),
-
-	# GL_EXT_framebuffer_blit
-	# NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT
-	( "GL_READ_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->ReadBuffer->Name"], "",
-	  ["EXT_framebuffer_blit"] ),
-
-	# GL_EXT_provoking_vertex
-	( "GL_PROVOKING_VERTEX_EXT", GLboolean,
-	  ["ctx->Light.ProvokingVertex"], "", ["EXT_provoking_vertex"] ),
-	( "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", GLboolean,
-	  ["ctx->Const.QuadsFollowProvokingVertexConvention"], "",
-	  ["EXT_provoking_vertex"] ),
-
-	# GL_ARB_fragment_shader
-	( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
-	  ["ctx->Const.FragmentProgram.MaxUniformComponents"], "",
-	  ["ARB_fragment_shader"] ),
-	( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum,
-	  ["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ),
-
-	# GL_ARB_vertex_shader
-	( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint,
-	  ["ctx->Const.VertexProgram.MaxUniformComponents"], "",
-	  ["ARB_vertex_shader"] ),
-	( "GL_MAX_VARYING_FLOATS_ARB", GLint,
-	  ["ctx->Const.MaxVarying * 4"], "", ["ARB_vertex_shader"] ),
-	( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
-	  ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ),
-	( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
-	  ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ),
-
-	# GL_ARB_shader_objects
-	# Actually, this token isn't part of GL_ARB_shader_objects, but is
-	# close enough for now.
-	( "GL_CURRENT_PROGRAM", GLint,
-	  ["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"],
-	  "", ["ARB_shader_objects"] ),
-
-	# GL_ARB_framebuffer_object
-	( "GL_MAX_SAMPLES", GLint, ["ctx->Const.MaxSamples"], "",
-	  ["ARB_framebuffer_object"] ),
-
-	# GL_APPLE_vertex_array_object
-	( "GL_VERTEX_ARRAY_BINDING_APPLE", GLint, ["ctx->Array.ArrayObj->Name"], "",
-	  ["APPLE_vertex_array_object"] ),
-
-	# GL_ARB_seamless_cube_map
-	( "GL_TEXTURE_CUBE_MAP_SEAMLESS", GLboolean, ["ctx->Texture.CubeMapSeamless"], "",
-	  ["ARB_seamless_cube_map"] ),
-
-	# GL_ARB_sync
-	( "GL_MAX_SERVER_WAIT_TIMEOUT", GLint64, ["ctx->Const.MaxServerWaitTimeout"], "",
-	  ["ARB_sync"] ),
-]
-
-
-def ConversionFunc(fromType, toType):
-	"""Return the name of the macro to convert between two data types."""
-	if fromType == toType:
-		return ""
-	elif fromType == GLfloat and toType == GLint:
-		return "IROUND"
-	elif fromType == GLfloat and toType == GLint64:
-		return "IROUND64"
-	elif fromType == GLfloatN and toType == GLfloat:
-		return ""
-	elif fromType == GLint and toType == GLfloat: # but not GLfloatN!
-		return "(GLfloat)"
-	elif fromType == GLint and toType == GLint64:
-		return "(GLint64)"
-	elif fromType == GLint64 and toType == GLfloat: # but not GLfloatN!
-		return "(GLfloat)"
-	else:
-		if fromType == GLfloatN:
-			fromType = GLfloat
-		fromStr = TypeStrings[fromType]
-		fromStr = string.upper(fromStr[2:])
-		toStr = TypeStrings[toType]
-		toStr = string.upper(toStr[2:])
-		return fromStr + "_TO_" + toStr
-
-
-def EmitGetFunction(stateVars, returnType):
-	"""Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv."""
-	assert (returnType == GLboolean or
-			returnType == GLint or
-			returnType == GLint64 or
-			returnType == GLfloat)
-
-	strType = TypeStrings[returnType]
-	# Capitalize first letter of return type
-	if returnType == GLint:
-		function = "GetIntegerv"
-	elif returnType == GLboolean:
-		function = "GetBooleanv"
-	elif returnType == GLfloat:
-		function = "GetFloatv"
-	elif returnType == GLint64:
-		function = "GetInteger64v"
-	else:
-		abort()
-
-	if returnType == GLint64:
-		print "#if FEATURE_ARB_sync"
-
-	print "void GLAPIENTRY"
-	print "_mesa_%s( GLenum pname, %s *params )" % (function, strType)
-	print "{"
-	print "   GET_CURRENT_CONTEXT(ctx);"
-	print "   ASSERT_OUTSIDE_BEGIN_END(ctx);"
-	print ""
-	print "   if (!params)"
-	print "      return;"
-	print ""
-	print "   if (ctx->NewState)"
-	print "      _mesa_update_state(ctx);"
-	print ""
-	print "   if (ctx->Driver.%s &&" % function
-	print "       ctx->Driver.%s(ctx, pname, params))" % function
-	print "      return;"
-	print ""
-	print "   switch (pname) {"
-
-	for (name, varType, state, optionalCode, extensions) in stateVars:
-		print "      case " + name + ":"
-		if extensions:
-			if len(extensions) == 1:
-				print ('         CHECK_EXT1(%s, "%s");' %
-					   (extensions[0], function))
-			elif len(extensions) == 2:
-				print ('         CHECK_EXT2(%s, %s, "%s");' %
-					   (extensions[0], extensions[1], function))
-			elif len(extensions) == 3:
-				print ('         CHECK_EXT3(%s, %s, %s, "%s");' %
-					   (extensions[0], extensions[1], extensions[2], function))
-			else:
-				assert len(extensions) == 4
-				print ('         CHECK_EXT4(%s, %s, %s, %s, "%s");' %
-					   (extensions[0], extensions[1], extensions[2], extensions[3], function))
-		conversion = ConversionFunc(varType, returnType)
-		if optionalCode:
-			optionalCode = string.replace(optionalCode, "CONVERSION", conversion);	
-			print "         {"
-			print "         " + optionalCode
-		n = len(state)
-		for i in range(n):
-			if conversion:
-				print "         params[%d] = %s(%s);" % (i, conversion, state[i])
-			else:
-				print "         params[%d] = %s;" % (i, state[i])
-		if optionalCode:
-			print "         }"
-		print "         break;"
-
-	print "      default:"
-	print '         _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function
-	print "   }"
-	print "}"
-	if returnType == GLint64:
-		print "#endif /* FEATURE_ARB_sync */"
-	print ""
-	return
-
-
-
-def EmitHeader():
-	"""Print the get.c file header."""
-	print """
-/***
- ***  NOTE!!!  DO NOT EDIT THIS FILE!!!  IT IS GENERATED BY get_gen.py
- ***/
-
-#include "glheader.h"
-#include "context.h"
-#include "enable.h"
-#include "extensions.h"
-#include "fbobject.h"
-#include "get.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "state.h"
-#include "texcompress.h"
-
-
-#define FLOAT_TO_BOOLEAN(X)   ( (X) ? GL_TRUE : GL_FALSE )
-
-#define INT_TO_BOOLEAN(I)     ( (I) ? GL_TRUE : GL_FALSE )
-
-#define INT64_TO_BOOLEAN(I)   ( (I) ? GL_TRUE : GL_FALSE )
-#define INT64_TO_INT(I)       ( (GLint)((I > INT_MAX) ? INT_MAX : ((I < INT_MIN) ? INT_MIN : (I))) )
-
-#define BOOLEAN_TO_INT(B)     ( (GLint) (B) )
-#define BOOLEAN_TO_INT64(B)   ( (GLint64) (B) )
-#define BOOLEAN_TO_FLOAT(B)   ( (B) ? 1.0F : 0.0F )
-
-#define ENUM_TO_INT64(E)      ( (GLint64) (E) )
-
-
-/*
- * Check if named extension is enabled, if not generate error and return.
- */
-#define CHECK_EXT1(EXT1, FUNC)                                         \\
-   if (!ctx->Extensions.EXT1) {                                        \\
-      _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname);  \\
-      return;                                                          \\
-   }
-
-/*
- * Check if either of two extensions is enabled.
- */
-#define CHECK_EXT2(EXT1, EXT2, FUNC)                                   \\
-   if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) {               \\
-      _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname);  \\
-      return;                                                          \\
-   }
-
-/*
- * Check if either of three extensions is enabled.
- */
-#define CHECK_EXT3(EXT1, EXT2, EXT3, FUNC)                             \\
-   if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 &&               \\
-       !ctx->Extensions.EXT3) {                                        \\
-      _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname);  \\
-      return;                                                          \\
-   }
-
-/*
- * Check if either of four extensions is enabled.
- */
-#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4, FUNC)                       \\
-   if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 &&               \\
-       !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) {               \\
-      _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname);  \\
-      return;                                                          \\
-   }
-
-"""
-	return
-
-
-
-def EmitGetDoublev():
-	print """
-void GLAPIENTRY
-_mesa_GetDoublev( GLenum pname, GLdouble *params )
-{
-   const GLfloat magic = -1234.5F;
-   GLfloat values[16];
-   GLuint i;
-
-   if (!params)
-      return;
-
-   /* Init temp array to magic numbers so we can figure out how many values
-    * are returned by the GetFloatv() call.
-    */
-   for (i = 0; i < 16; i++)
-      values[i] = magic;
-
-   _mesa_GetFloatv(pname, values);
-   
-   for (i = 0; i < 16 && values[i] != magic; i++)
-      params[i] = (GLdouble) values[i];
-}
-"""
-	
-
-
-
-EmitHeader()
-# XXX Maybe sort the StateVars list
-EmitGetFunction(StateVars, GLboolean)
-EmitGetFunction(StateVars, GLfloat)
-EmitGetFunction(StateVars, GLint)
-EmitGetFunction(StateVars, GLint64)
-EmitGetDoublev()
-
diff --git a/mesalib/src/mesa/main/histogram.c b/mesalib/src/mesa/main/histogram.c
index 2b3e62c7d..c7304e8dd 100644
--- a/mesalib/src/mesa/main/histogram.c
+++ b/mesalib/src/mesa/main/histogram.c
@@ -29,8 +29,11 @@
 #include "context.h"
 #include "image.h"
 #include "histogram.h"
+#include "glapi/dispatch.h"
 
 
+#if FEATURE_histogram
+
 
 /*
  * XXX the packed pixel formats haven't been tested.
@@ -615,7 +618,11 @@ base_histogram_format( GLenum format )
  */
 
 
-void GLAPIENTRY
+/* this is defined below */
+static void GLAPIENTRY _mesa_ResetMinmax(GLenum target);
+
+
+static void GLAPIENTRY
 _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -678,7 +685,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -738,7 +745,7 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -785,7 +792,7 @@ _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -832,7 +839,7 @@ _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -858,7 +865,7 @@ _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -884,7 +891,7 @@ _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
 {
    GLuint i;
@@ -967,7 +974,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -995,7 +1002,7 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ResetHistogram(GLenum target)
 {
    GLuint i;
@@ -1021,7 +1028,7 @@ _mesa_ResetHistogram(GLenum target)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_ResetMinmax(GLenum target)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1044,6 +1051,24 @@ _mesa_ResetMinmax(GLenum target)
 }
 
 
+void
+_mesa_init_histogram_dispatch(struct _glapi_table *disp)
+{
+   SET_GetHistogram(disp, _mesa_GetHistogram);
+   SET_GetHistogramParameterfv(disp, _mesa_GetHistogramParameterfv);
+   SET_GetHistogramParameteriv(disp, _mesa_GetHistogramParameteriv);
+   SET_GetMinmax(disp, _mesa_GetMinmax);
+   SET_GetMinmaxParameterfv(disp, _mesa_GetMinmaxParameterfv);
+   SET_GetMinmaxParameteriv(disp, _mesa_GetMinmaxParameteriv);
+   SET_Histogram(disp, _mesa_Histogram);
+   SET_Minmax(disp, _mesa_Minmax);
+   SET_ResetHistogram(disp, _mesa_ResetHistogram);
+   SET_ResetMinmax(disp, _mesa_ResetMinmax);
+}
+
+
+#endif /* FEATURE_histogram */
+
 
 /**********************************************************************/
 /*****                      Initialization                        *****/
diff --git a/mesalib/src/mesa/main/histogram.h b/mesalib/src/mesa/main/histogram.h
index 367e9b11b..dbae1bbd0 100644
--- a/mesalib/src/mesa/main/histogram.h
+++ b/mesalib/src/mesa/main/histogram.h
@@ -36,48 +36,22 @@
 #ifndef HISTOGRAM_H
 #define HISTOGRAM_H
 
-#include "glheader.h"
-#include "mtypes.h"
+#include "main/mtypes.h"
 
-#if _HAVE_FULL_GL
+#if FEATURE_histogram
 
-extern void GLAPIENTRY 
-_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values);
+extern void
+_mesa_init_histogram_dispatch(struct _glapi_table *disp);
 
-extern void GLAPIENTRY 
-_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+#else /* FEATURE_histogram */
 
-extern void GLAPIENTRY 
-_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params);
+static INLINE void
+_mesa_init_histogram_dispatch(struct _glapi_table *disp)
+{
+}
 
-extern void GLAPIENTRY 
-_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY 
-_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
-
-extern void GLAPIENTRY 
-_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY 
-_mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-
-extern void GLAPIENTRY 
-_mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink);
-
-extern void GLAPIENTRY 
-_mesa_ResetHistogram(GLenum target);
-
-extern void GLAPIENTRY 
-_mesa_ResetMinmax(GLenum target);
+#endif /* FEATURE_histogram */
 
 extern void _mesa_init_histogram( GLcontext * ctx );
 
-#else
-
-/** No-op */
-#define _mesa_init_histogram( c ) ((void) 0)
-
-#endif
-
-#endif
+#endif /* HISTOGRAM_H */
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index 10c89f436..654faa5c7 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -206,7 +206,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
 void GLAPIENTRY
 _mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
 {
-   _mesa_Lightfv( light, pname, &param );
+   GLfloat fparam[4];
+   fparam[0] = param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_Lightfv( light, pname, fparam );
 }
 
 
@@ -285,7 +288,10 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
 void GLAPIENTRY
 _mesa_Lighti( GLenum light, GLenum pname, GLint param )
 {
-   _mesa_Lightiv( light, pname, &param );
+   GLint iparam[4];
+   iparam[0] = param;
+   iparam[1] = iparam[2] = iparam[3] = 0;
+   _mesa_Lightiv( light, pname, iparam );
 }
 
 
@@ -537,14 +543,20 @@ _mesa_LightModeliv( GLenum pname, const GLint *params )
 void GLAPIENTRY
 _mesa_LightModeli( GLenum pname, GLint param )
 {
-   _mesa_LightModeliv( pname, &param );
+   GLint iparam[4];
+   iparam[0] = param;
+   iparam[1] = iparam[2] = iparam[3] = 0;
+   _mesa_LightModeliv( pname, iparam );
 }
 
 
 void GLAPIENTRY
 _mesa_LightModelf( GLenum pname, GLfloat param )
 {
-   _mesa_LightModelfv( pname, &param );
+   GLfloat fparam[4];
+   fparam[0] = param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
+   _mesa_LightModelfv( pname, fparam );
 }
 
 
@@ -636,7 +648,7 @@ _mesa_update_material( GLcontext *ctx, GLuint bitmask )
    struct gl_light *light, *list = &ctx->Light.EnabledList;
    GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
 
-   if (MESA_VERBOSE&VERBOSE_IMMEDIATE) 
+   if (MESA_VERBOSE & VERBOSE_MATERIAL) 
       _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask);
 
    if (!bitmask)
diff --git a/mesalib/src/mesa/main/mfeatures.h b/mesalib/src/mesa/main/mfeatures.h
index e23cdb1f4..4e68bc15d 100644
--- a/mesalib/src/mesa/main/mfeatures.h
+++ b/mesalib/src/mesa/main/mfeatures.h
@@ -36,12 +36,53 @@
 #define _HAVE_FULL_GL 1
 #endif
 
+/* assert that a feature is disabled and should never be used */
+#define ASSERT_NO_FEATURE() ASSERT(0)
+
+/**
+ * A feature can be anything.  But most of them share certain characteristics.
+ *
+ * When a feature defines driver entries, they can be initialized by
+ *   _MESA_INIT_<FEATURE>_FUNCTIONS
+ *
+ * When a feature defines vtxfmt entries, they can be initialized and
+ * installed by
+ *   _MESA_INIT_<FEATURE>_VTXFMT
+ *   _mesa_install_<feature>_vtxfmt
+ *
+ * When a feature defines dispatch entries, they are initialized by
+ *   _mesa_init_<feature>_dispatch
+ *
+ * When a feature has states, they are initialized and freed by
+ *   _mesa_init_<feature>
+ *   _mesa_free_<feature>_data
+ *
+ * Except for states, the others compile to no-op when a feature is disabled.
+ *
+ * The GLAPIENTRYs and helper functions defined by a feature should also
+ * compile to no-op when it is disabled.  But to save typings and to catch
+ * bugs, some of them may be unavailable, or compile to ASSERT_NO_FEATURE()
+ * when the feature is disabled.
+ *
+ * A feature following the conventions may be used without knowing if it is
+ * enabled or not.
+ */
+
+#ifdef IN_DRI_DRIVER
+#define FEATURE_remap_table 1
+#else
+#define FEATURE_remap_table 0
+#endif
+
 #define FEATURE_accum  _HAVE_FULL_GL
+#define FEATURE_arrayelt  _HAVE_FULL_GL
 #define FEATURE_attrib_stack  _HAVE_FULL_GL
+/* this disables vtxfmt, api_loopback, and api_noop completely */
+#define FEATURE_beginend  _HAVE_FULL_GL
 #define FEATURE_colortable  _HAVE_FULL_GL
 #define FEATURE_convolve  _HAVE_FULL_GL
 #define FEATURE_dispatch  _HAVE_FULL_GL
-#define FEATURE_dlist  _HAVE_FULL_GL
+#define FEATURE_dlist  (_HAVE_FULL_GL && FEATURE_arrayelt && FEATURE_beginend)
 #define FEATURE_draw_read_buffer  _HAVE_FULL_GL
 #define FEATURE_drawpix  _HAVE_FULL_GL
 #define FEATURE_evaluators  _HAVE_FULL_GL
@@ -50,15 +91,15 @@
 #define FEATURE_histogram  _HAVE_FULL_GL
 #define FEATURE_pixel_transfer  _HAVE_FULL_GL
 #define FEATURE_point_size_array 0
+#define FEATURE_queryobj  _HAVE_FULL_GL
+#define FEATURE_rastpos  _HAVE_FULL_GL
 #define FEATURE_texgen  _HAVE_FULL_GL
 #define FEATURE_texture_fxt1  _HAVE_FULL_GL
 #define FEATURE_texture_s3tc  _HAVE_FULL_GL
 #define FEATURE_userclip  _HAVE_FULL_GL
 #define FEATURE_vertex_array_byte 0
-#define FEATURE_windowpos  _HAVE_FULL_GL
 #define FEATURE_es2_glsl 0
 
-#define FEATURE_ARB_occlusion_query  _HAVE_FULL_GL
 #define FEATURE_ARB_fragment_program  _HAVE_FULL_GL
 #define FEATURE_ARB_framebuffer_object  _HAVE_FULL_GL
 #define FEATURE_ARB_map_buffer_range  _HAVE_FULL_GL
@@ -76,7 +117,6 @@
 #define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
 #define FEATURE_EXT_pixel_buffer_object  _HAVE_FULL_GL
 #define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL
-#define FEATURE_EXT_timer_query  _HAVE_FULL_GL
 #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL
 #define FEATURE_NV_fence  _HAVE_FULL_GL
 #define FEATURE_NV_fragment_program  _HAVE_FULL_GL
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index c3928fa51..7350c7a3d 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -28,10 +28,11 @@
  */
 
 #include "imports.h"
+#include "formats.h"
 #include "mipmap.h"
 #include "texcompress.h"
-#include "texformat.h"
 #include "teximage.h"
+#include "texstore.h"
 #include "image.h"
 
 
@@ -1493,7 +1494,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
                       struct gl_texture_object *texObj)
 {
    const struct gl_texture_image *srcImage;
-   const struct gl_texture_format *convertFormat;
+   gl_format convertFormat;
    const GLubyte *srcData = NULL;
    GLubyte *dstData = NULL;
    GLint level, maxLevels;
@@ -1508,7 +1509,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
    ASSERT(maxLevels > 0);  /* bad target */
 
    /* Find convertFormat - the format that do_row() will process */
-   if (srcImage->IsCompressed) {
+
+   if (_mesa_is_format_compressed(srcImage->TexFormat)) {
       /* setup for compressed textures - need to allocate temporary
        * image buffers to hold uncompressed images.
        */
@@ -1520,11 +1522,11 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
              texObj->Target == GL_TEXTURE_CUBE_MAP_ARB);
 
       if (srcImage->_BaseFormat == GL_RGB) {
-         convertFormat = &_mesa_texformat_rgb;
+         convertFormat = MESA_FORMAT_RGB888;
          components = 3;
       }
       else if (srcImage->_BaseFormat == GL_RGBA) {
-         convertFormat = &_mesa_texformat_rgba;
+         convertFormat = MESA_FORMAT_RGBA8888;
          components = 4;
       }
       else {
@@ -1588,7 +1590,11 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
                                          &dstWidth, &dstHeight, &dstDepth);
       if (!nextLevel) {
          /* all done */
-         break;
+         if (_mesa_is_format_compressed(srcImage->TexFormat)) {
+            _mesa_free((void *) srcData);
+            _mesa_free(dstData);
+         }
+         return;
       }
 
       /* get dest gl_texture_image */
@@ -1609,25 +1615,17 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
       dstImage->TexFormat = srcImage->TexFormat;
       dstImage->FetchTexelc = srcImage->FetchTexelc;
       dstImage->FetchTexelf = srcImage->FetchTexelf;
-      dstImage->IsCompressed = srcImage->IsCompressed;
-      if (dstImage->IsCompressed) {
-         dstImage->CompressedSize
-            = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width,
-                                              dstImage->Height,
-                                              dstImage->Depth,
-                                              dstImage->TexFormat->MesaFormat);
-         ASSERT(dstImage->CompressedSize > 0);
-      }
-
-      ASSERT(dstImage->TexFormat);
-      ASSERT(dstImage->FetchTexelc);
-      ASSERT(dstImage->FetchTexelf);
 
       /* Alloc new teximage data buffer.
        * Setup src and dest data pointers.
        */
-      if (dstImage->IsCompressed) {
-         dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize);
+      if (_mesa_is_format_compressed(dstImage->TexFormat)) {
+         GLuint dstCompressedSize = 
+            _mesa_format_image_size(dstImage->TexFormat, dstImage->Width,
+                                    dstImage->Height, dstImage->Depth);
+         ASSERT(dstCompressedSize > 0);
+
+         dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize);
          if (!dstImage->Data) {
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
             return;
@@ -1637,7 +1635,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
          ASSERT(dstData);
       }
       else {
-         bytesPerTexel = dstImage->TexFormat->TexelBytes;
+         bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat);
          ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
          dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight
                                                 * dstDepth * bytesPerTexel);
@@ -1649,6 +1647,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
          dstData = (GLubyte *) dstImage->Data;
       }
 
+      ASSERT(dstImage->TexFormat);
+      ASSERT(dstImage->FetchTexelc);
+      ASSERT(dstImage->FetchTexelf);
+
       _mesa_generate_mipmap_level(target, datatype, comps, border,
                                   srcWidth, srcHeight, srcDepth, 
                                   srcData, srcImage->RowStride,
@@ -1656,22 +1658,24 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
                                   dstData, dstImage->RowStride);
 
 
-      if (dstImage->IsCompressed) {
+      if (_mesa_is_format_compressed(dstImage->TexFormat)) {
          GLubyte *temp;
          /* compress image from dstData into dstImage->Data */
-         const GLenum srcFormat = convertFormat->BaseFormat;
+         const GLenum srcFormat = _mesa_get_format_base_format(convertFormat);
          GLint dstRowStride
-            = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth);
+            = _mesa_format_row_stride(dstImage->TexFormat, dstWidth);
          ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
-         dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat,
-                                         dstImage->TexFormat,
-                                         dstImage->Data,
-                                         0, 0, 0, /* dstX/Y/Zoffset */
-                                         dstRowStride, 0, /* strides */
-                                         dstWidth, dstHeight, 1, /* size */
-                                         srcFormat, CHAN_TYPE,
-                                         dstData, /* src data, actually */
-                                         &ctx->DefaultPacking);
+
+         _mesa_texstore(ctx, 2, dstImage->_BaseFormat,
+                        dstImage->TexFormat,
+                        dstImage->Data,
+                        0, 0, 0, /* dstX/Y/Zoffset */
+                        dstRowStride, 0, /* strides */
+                        dstWidth, dstHeight, 1, /* size */
+                        srcFormat, CHAN_TYPE,
+                        dstData, /* src data, actually */
+                        &ctx->DefaultPacking);
+
          /* swap src and dest pointers */
          temp = (GLubyte *) srcData;
          srcData = dstData;
@@ -1679,12 +1683,6 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
       }
 
    } /* loop over mipmap levels */
-
-   if (srcImage->IsCompressed) {
-      /* free uncompressed image buffers */
-      _mesa_free((void *) srcData);
-      _mesa_free(dstData);
-   }
 }
 
 
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index f8e4e4158..cde2f5fe0 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.5
+ * Version:  7.7
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
@@ -78,12 +78,38 @@
 #endif
 
 
+/**
+ * \name 64-bit extension of GLbitfield.
+ */
+/*@{*/
+typedef GLuint64 GLbitfield64;
+
+#define BITFIELD64_ONE         1ULL
+#define BITFIELD64_ALLONES     ~0ULL
+
+/** Set a single bit */
+#define BITFIELD64_BIT(b)      (BITFIELD64_ONE << (b))
+
+/** Set a mask of the least significant \c b bits */
+#define BITFIELD64_MASK(b)     (((b) >= 64) ? BITFIELD64_ALLONES : \
+				(BITFIELD64_BIT(b) - 1))
+
+/**
+ * Set all bits from l (low bit) to h (high bit), inclusive.
+ *
+ * \note \C BITFIELD_64_RANGE(0, 63) return 64 set bits.
+ */
+#define BITFIELD64_RANGE(l, h) (BITFIELD64_MASK((h) + 1) & ~BITFIELD64_MASK(l))
+/*@}*/
+
+
 /**
  * \name Some forward type declarations
  */
 /*@{*/
 struct _mesa_HashTable;
 struct gl_attrib_node;
+struct gl_list_extensions;
 struct gl_meta_state;
 struct gl_pixelstore_attrib;
 struct gl_program_cache;
@@ -207,7 +233,7 @@ typedef enum
    VERT_RESULT_BFC0 = 13,
    VERT_RESULT_BFC1 = 14,
    VERT_RESULT_EDGE = 15,
-   VERT_RESULT_VAR0 = 16  /**< shader varying */,
+   VERT_RESULT_VAR0 = 16,  /**< shader varying */
    VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
 } gl_vert_result;
 
@@ -819,29 +845,6 @@ struct gl_list_attrib
 };
 
 
-/**
- * Used by device drivers to hook new commands into display lists.
- */
-struct gl_list_instruction
-{
-   GLuint Size;
-   void (*Execute)( GLcontext *ctx, void *data );
-   void (*Destroy)( GLcontext *ctx, void *data );
-   void (*Print)( GLcontext *ctx, void *data );
-};
-
-#define MAX_DLIST_EXT_OPCODES 16
-
-/**
- * Used by device drivers to hook new commands into display lists.
- */
-struct gl_list_extensions
-{
-   struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
-   GLuint NumOpcodes;
-};
-
-
 /**
  * Multisample attribute group (GL_MULTISAMPLE_BIT).
  */
@@ -1136,104 +1139,21 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
                                const void *texel);
 
 
-/**
- * This macro defines the (many) parameters to the texstore functions.
- * \param dims  either 1 or 2 or 3
- * \param baseInternalFormat  user-specified base internal format
- * \param dstFormat  destination Mesa texture format
- * \param dstAddr  destination image address
- * \param dstX/Y/Zoffset  destination x/y/z offset (ala TexSubImage), in texels
- * \param dstRowStride  destination image row stride, in bytes
- * \param dstImageOffsets  offset of each 2D slice within 3D texture, in texels
- * \param srcWidth/Height/Depth  source image size, in pixels
- * \param srcFormat  incoming image format
- * \param srcType  incoming image data type
- * \param srcAddr  source image address
- * \param srcPacking  source image packing parameters
- */
-#define TEXSTORE_PARAMS \
-	GLcontext *ctx, GLuint dims, \
-	GLenum baseInternalFormat, \
-	const struct gl_texture_format *dstFormat, \
-	GLvoid *dstAddr, \
-	GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
-	GLint dstRowStride, const GLuint *dstImageOffsets, \
-	GLint srcWidth, GLint srcHeight, GLint srcDepth, \
-	GLenum srcFormat, GLenum srcType, \
-	const GLvoid *srcAddr, \
-	const struct gl_pixelstore_attrib *srcPacking
-
-
-
-/**
- * Texture image storage function.
- */
-typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
-
-
-/**
- * Texture format record 
- */
-struct gl_texture_format
-{
-   GLint MesaFormat;		/**< One of the MESA_FORMAT_* values */
-
-   GLenum BaseFormat;		/**< Either GL_RGB, GL_RGBA, GL_ALPHA,
-				 *   GL_LUMINANCE, GL_LUMINANCE_ALPHA,
-				 *   GL_INTENSITY, GL_COLOR_INDEX or
-				 *   GL_DEPTH_COMPONENT.
-				 */
-   GLenum DataType;		/**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */
-
-   /**
-    * Bits per texel component.  These are just rough approximations
-    * for compressed texture formats.
-    */
-   /*@{*/
-   GLubyte RedBits;
-   GLubyte GreenBits;
-   GLubyte BlueBits;
-   GLubyte AlphaBits;
-   GLubyte LuminanceBits;
-   GLubyte IntensityBits;
-   GLubyte IndexBits;
-   GLubyte DepthBits;
-   GLubyte StencilBits; 	/**< GL_EXT_packed_depth_stencil */
-   /*@}*/
-
-   GLuint TexelBytes;		/**< Bytes per texel, 0 if compressed format */
-
-   StoreTexImageFunc StoreImage;
-
-   /**
-    * \name Texel fetch function pointers
-    */
-   /*@{*/
-   FetchTexelFuncC FetchTexel1D;
-   FetchTexelFuncC FetchTexel2D;
-   FetchTexelFuncC FetchTexel3D;
-   FetchTexelFuncF FetchTexel1Df;
-   FetchTexelFuncF FetchTexel2Df;
-   FetchTexelFuncF FetchTexel3Df;
-   /*@}*/
-
-   StoreTexelFunc StoreTexel;
-};
-
-
 /**
  * Texture image state.  Describes the dimensions of a texture image,
  * the texel format and pointers to Texel Fetch functions.
  */
 struct gl_texture_image
 {
+   GLint InternalFormat;	/**< Internal format as given by the user */
    GLenum _BaseFormat;		/**< Either GL_RGB, GL_RGBA, GL_ALPHA,
 				 *   GL_LUMINANCE, GL_LUMINANCE_ALPHA,
 				 *   GL_INTENSITY, GL_COLOR_INDEX,
 				 *   GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT
                                  *   only. Used for choosing TexEnv arithmetic.
 				 */
-   GLint InternalFormat;	/**< Internal format as given by the user */
+   GLuint TexFormat;            /**< The actual format: MESA_FORMAT_x */
+
    GLuint Border;		/**< 0 or 1 */
    GLuint Width;		/**< = 2^WidthLog2 + 2*Border */
    GLuint Height;		/**< = 2^HeightLog2 + 2*Border */
@@ -1251,16 +1171,11 @@ struct gl_texture_image
    GLboolean IsClientData;	/**< Data owned by client? */
    GLboolean _IsPowerOfTwo;	/**< Are all dimensions powers of two? */
 
-   const struct gl_texture_format *TexFormat;
-
    struct gl_texture_object *TexObject;  /**< Pointer back to parent object */
 
    FetchTexelFuncC FetchTexelc;	/**< GLchan texel fetch function pointer */
    FetchTexelFuncF FetchTexelf;	/**< Float texel fetch function pointer */
 
-   GLboolean IsCompressed;	/**< GL_ARB_texture_compression */
-   GLuint CompressedSize;	/**< GL_ARB_texture_compression */
-
    GLuint RowStride;		/**< Padded width in units of texels */
    GLuint *ImageOffsets;        /**< if 3D texture: array [Depth] of offsets to
                                      each 2D slice in 'Data', in texels */
@@ -1482,6 +1397,7 @@ struct gl_transform_attrib
    GLboolean Normalize;				/**< Normalize all normals? */
    GLboolean RescaleNormals;			/**< GL_EXT_rescale_normal */
    GLboolean RasterPositionUnclipped;           /**< GL_IBM_rasterpos_clip */
+   GLboolean DepthClamp;			/**< GL_ARB_depth_clamp */
 
    GLboolean CullVertexFlag;	/**< True if GL_CULL_VERTEX_EXT is enabled */
    GLfloat CullEyePos[4];
@@ -1779,7 +1695,7 @@ struct gl_program
    struct prog_instruction *Instructions;
 
    GLbitfield InputsRead;     /**< Bitmask of which input regs are read */
-   GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */
+   GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */
    GLbitfield InputFlags[MAX_PROGRAM_INPUTS];   /**< PROG_PARAM_BIT_x flags */
    GLbitfield OutputFlags[MAX_PROGRAM_OUTPUTS]; /**< PROG_PARAM_BIT_x flags */
    GLbitfield TexturesUsed[MAX_TEXTURE_UNITS];  /**< TEXTURE_x_BIT bitmask */
@@ -1833,7 +1749,6 @@ struct gl_vertex_program
    struct gl_program Base;   /**< base class */
    GLboolean IsNVProgram;    /**< is this a GL_NV_vertex_program program? */
    GLboolean IsPositionInvariant;
-   void *TnlData;		/**< should probably use Base.DriverData */
 };
 
 
@@ -1939,10 +1854,10 @@ struct ati_fragment_shader
    struct atifs_instruction *Instructions[2];
    struct atifs_setupinst *SetupInst[2];
    GLfloat Constants[8][4];
-   GLbitfield LocalConstDef;  /** Indicates which constants have been set */
+   GLbitfield LocalConstDef;  /**< Indicates which constants have been set */
    GLubyte numArithInstr[2];
    GLubyte regsAssigned[2];
-   GLubyte NumPasses;         /** 1 or 2 */
+   GLubyte NumPasses;         /**< 1 or 2 */
    GLubyte cur_pass;
    GLubyte last_optype;
    GLboolean interpinp1;
@@ -1956,7 +1871,7 @@ struct ati_fragment_shader
 struct gl_ati_fragment_shader_state
 {
    GLboolean Enabled;
-   GLboolean _Enabled;                      /** enabled and valid shader? */
+   GLboolean _Enabled;                  /**< enabled and valid shader? */
    GLboolean Compiling;
    GLfloat GlobalConstants[8][4];
    struct ati_fragment_shader *Current;
@@ -2066,6 +1981,9 @@ struct gl_shader_program
 #define GLSL_OPT       0x4  /**< Force optimizations (override pragmas) */
 #define GLSL_NO_OPT    0x8  /**< Force no optimizations (override pragmas) */
 #define GLSL_UNIFORMS 0x10  /**< Print glUniform calls */
+#define GLSL_NOP_VERT 0x20  /**< Force no-op vertex shaders */
+#define GLSL_NOP_FRAG 0x40  /**< Force no-op fragment shaders */
+#define GLSL_USE_PROG 0x80  /**< Log glUseProgram calls */
 
 
 /**
@@ -2176,20 +2094,12 @@ struct gl_renderbuffer
    GLuint Name;
    GLint RefCount;
    GLuint Width, Height;
+
    GLenum InternalFormat; /**< The user-specified format */
-   GLenum _ActualFormat;  /**< The driver-chosen format */
    GLenum _BaseFormat;    /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or
                                GL_STENCIL_INDEX. */
-   GLenum ColorEncoding; /**< GL_LINEAR or GL_SRGB */
-   GLenum ComponentType; /**< GL_FLOAT, GL_INT, GL_UNSIGNED_INT,
-                              GL_UNSIGNED_NORMALIZED or GL_INDEX */
-   GLubyte RedBits;      /**< Bits of red per pixel */
-   GLubyte GreenBits;
-   GLubyte BlueBits;
-   GLubyte AlphaBits;
-   GLubyte IndexBits;
-   GLubyte DepthBits;
-   GLubyte StencilBits;
+   GLuint Format;         /**< The actual format: MESA_FORMAT_x */
+
    GLubyte NumSamples;
 
    GLenum DataType;      /**< Type of values passed to the Get/Put functions */
@@ -2445,9 +2355,6 @@ struct gl_constants
 
    GLuint MaxDrawBuffers;    /**< GL_ARB_draw_buffers */
 
-   GLenum ColorReadFormat;   /**< GL_OES_read_format */
-   GLenum ColorReadType;     /**< GL_OES_read_format */
-
    GLuint MaxColorAttachments;   /**< GL_EXT_framebuffer_object */
    GLuint MaxRenderbufferSize;   /**< GL_EXT_framebuffer_object */
    GLuint MaxSamples;            /**< GL_ARB_framebuffer_object */
@@ -2476,7 +2383,9 @@ struct gl_extensions
    GLboolean dummy;  /* don't remove this! */
    GLboolean ARB_copy_buffer;
    GLboolean ARB_depth_texture;
+   GLboolean ARB_depth_clamp;
    GLboolean ARB_draw_buffers;
+   GLboolean ARB_draw_elements_base_vertex;
    GLboolean ARB_fragment_program;
    GLboolean ARB_fragment_program_shadow;
    GLboolean ARB_fragment_shader;
@@ -2525,9 +2434,10 @@ struct gl_extensions
    GLboolean EXT_copy_texture;
    GLboolean EXT_depth_bounds_test;
    GLboolean EXT_draw_range_elements;
-   GLboolean EXT_framebuffer_object;
    GLboolean EXT_fog_coord;
    GLboolean EXT_framebuffer_blit;
+   GLboolean EXT_framebuffer_multisample;
+   GLboolean EXT_framebuffer_object;
    GLboolean EXT_gpu_program_parameters;
    GLboolean EXT_histogram;
    GLboolean EXT_multi_draw_arrays;
@@ -2581,6 +2491,7 @@ struct gl_extensions
    GLboolean MESA_texture_signed_rgba;
    GLboolean NV_blend_square;
    GLboolean NV_fragment_program;
+   GLboolean NV_fragment_program_option;
    GLboolean NV_light_max_exponent;
    GLboolean NV_point_sprite;
    GLboolean NV_texgen_reflection;
@@ -3056,7 +2967,7 @@ struct __GLcontextRec
    struct gl_shine_tab *_ShineTabList;  /**< MRU list of inactive shine tables */
    /**@}*/
 
-   struct gl_list_extensions ListExt; /**< driver dlist extensions */
+   struct gl_list_extensions *ListExt; /**< driver dlist extensions */
 
    /** \name For debugging/development only */
    /*@{*/
@@ -3112,11 +3023,12 @@ extern int MESA_DEBUG_FLAGS;
 #endif
 
 
+/** The MESA_VERBOSE var is a bitmask of these flags */
 enum _verbose
 {
    VERBOSE_VARRAY		= 0x0001,
    VERBOSE_TEXTURE		= 0x0002,
-   VERBOSE_IMMEDIATE		= 0x0004,
+   VERBOSE_MATERIAL		= 0x0004,
    VERBOSE_PIPELINE		= 0x0008,
    VERBOSE_DRIVER		= 0x0010,
    VERBOSE_STATE		= 0x0020,
@@ -3126,9 +3038,12 @@ enum _verbose
    VERBOSE_PRIMS		= 0x0400,
    VERBOSE_VERTS		= 0x0800,
    VERBOSE_DISASSEM		= 0x1000,
+   VERBOSE_DRAW                 = 0x2000,
+   VERBOSE_SWAPBUFFERS          = 0x4000
 };
 
 
+/** The MESA_DEBUG_FLAGS var is a bitmask of these flags */
 enum _debug
 {
    DEBUG_ALWAYS_FLUSH		= 0x1
diff --git a/mesalib/src/mesa/main/pixel.c b/mesalib/src/mesa/main/pixel.c
index fcef6dfd4..3820ebd88 100644
--- a/mesalib/src/mesa/main/pixel.c
+++ b/mesalib/src/mesa/main/pixel.c
@@ -36,13 +36,17 @@
 #include "macros.h"
 #include "pixel.h"
 #include "mtypes.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_pixel_transfer
 
 
 /**********************************************************************/
 /*****                    glPixelZoom                             *****/
 /**********************************************************************/
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -163,7 +167,7 @@ validate_pbo_access(GLcontext *ctx, struct gl_pixelstore_attrib *pack,
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -205,7 +209,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
 {
    GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
@@ -261,7 +265,7 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
 {
    GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
@@ -317,7 +321,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -362,7 +366,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -406,7 +410,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetPixelMapusv( GLenum map, GLushort *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -468,7 +472,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
  * Implements glPixelTransfer[fi] whether called immediately or from a
  * display list.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PixelTransferf( GLenum pname, GLfloat param )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -662,7 +666,7 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PixelTransferi( GLenum pname, GLint param )
 {
    _mesa_PixelTransferf( pname, (GLfloat) param );
@@ -756,6 +760,24 @@ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
 }
 
 
+void
+_mesa_init_pixel_dispatch(struct _glapi_table *disp)
+{
+   SET_GetPixelMapfv(disp, _mesa_GetPixelMapfv);
+   SET_GetPixelMapuiv(disp, _mesa_GetPixelMapuiv);
+   SET_GetPixelMapusv(disp, _mesa_GetPixelMapusv);
+   SET_PixelMapfv(disp, _mesa_PixelMapfv);
+   SET_PixelMapuiv(disp, _mesa_PixelMapuiv);
+   SET_PixelMapusv(disp, _mesa_PixelMapusv);
+   SET_PixelTransferf(disp, _mesa_PixelTransferf);
+   SET_PixelTransferi(disp, _mesa_PixelTransferi);
+   SET_PixelZoom(disp, _mesa_PixelZoom);
+}
+
+
+#endif /* FEATURE_pixel_transfer */
+
+
 /**********************************************************************/
 /*****                      Initialization                        *****/
 /**********************************************************************/
diff --git a/mesalib/src/mesa/main/pixel.h b/mesalib/src/mesa/main/pixel.h
index cb6c5262a..f4d3f1efd 100644
--- a/mesalib/src/mesa/main/pixel.h
+++ b/mesalib/src/mesa/main/pixel.h
@@ -33,48 +33,35 @@
 #define PIXEL_H
 
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
 
-/** \name API functions */
-/*@{*/
+#if FEATURE_pixel_transfer
 
-extern void GLAPIENTRY
-_mesa_GetPixelMapfv( GLenum map, GLfloat *values );
-
-extern void GLAPIENTRY
-_mesa_GetPixelMapuiv( GLenum map, GLuint *values );
-
-extern void GLAPIENTRY
-_mesa_GetPixelMapusv( GLenum map, GLushort *values );
-
-extern void GLAPIENTRY
-_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values );
-
-extern void GLAPIENTRY
-_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values );
-
-extern void GLAPIENTRY
-_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values );
+extern void 
+_mesa_update_pixel( GLcontext *ctx, GLuint newstate );
 
-extern void GLAPIENTRY
-_mesa_PixelTransferf( GLenum pname, GLfloat param );
+extern void
+_mesa_init_pixel_dispatch( struct _glapi_table * disp );
 
-extern void GLAPIENTRY
-_mesa_PixelTransferi( GLenum pname, GLint param );
+#else /* FEATURE_pixel_transfer */
 
-extern void GLAPIENTRY
-_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor );
+static INLINE void
+_mesa_update_pixel(GLcontext *ctx, GLuint newstate)
+{
+}
 
-/*@}*/
+static INLINE void
+_mesa_init_pixel_dispatch(struct _glapi_table *disp)
+{
+}
 
+#endif /* FEATURE_pixel_transfer */
 
-extern void 
-_mesa_update_pixel( GLcontext *ctx, GLuint newstate );
 
 extern void 
 _mesa_init_pixel( GLcontext * ctx );
 
 /*@}*/
 
-#endif
+#endif /* PIXEL_H */
diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c
index 4c8fc1f72..dcaeccd90 100644
--- a/mesalib/src/mesa/main/points.c
+++ b/mesalib/src/mesa/main/points.c
@@ -69,8 +69,10 @@ _mesa_PointSize( GLfloat size )
 void GLAPIENTRY
 _mesa_PointParameteri( GLenum pname, GLint param )
 {
-   const GLfloat value = (GLfloat) param;
-   _mesa_PointParameterfv(pname, &value);
+   GLfloat p[3];
+   p[0] = (GLfloat) param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
@@ -90,7 +92,10 @@ _mesa_PointParameteriv( GLenum pname, const GLint *params )
 void GLAPIENTRY
 _mesa_PointParameterf( GLenum pname, GLfloat param)
 {
-   _mesa_PointParameterfv(pname, &param);
+   GLfloat p[3];
+   p[0] = param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
@@ -200,7 +205,12 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
          }
          break;
       case GL_POINT_SPRITE_COORD_ORIGIN:
-         if (ctx->Extensions.ARB_point_sprite || ctx->Extensions.NV_point_sprite) {
+	 /* This is not completely correct.  GL_POINT_SPRITE_COORD_ORIGIN was
+	  * added to point sprites when the extension was merged into OpenGL
+	  * 2.0.  It is expected that an implementation supporting OpenGL 1.4
+	  * and GL_ARB_point_sprite will generate an error here.
+	  */
+         if (ctx->Extensions.ARB_point_sprite) {
             GLenum value = (GLenum) params[0];
             if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
                _mesa_error(ctx, GL_INVALID_VALUE,
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index a73c6e050..f6eb4ee7e 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -29,6 +29,10 @@
 #include "imports.h"
 #include "queryobj.h"
 #include "mtypes.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_queryobj
 
 
 /**
@@ -216,7 +220,7 @@ _mesa_IsQueryARB(GLuint id)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_BeginQueryARB(GLenum target, GLuint id)
 {
    struct gl_query_object *q;
@@ -236,7 +240,6 @@ _mesa_BeginQueryARB(GLenum target, GLuint id)
             return;
          }
          break;
-#if FEATURE_EXT_timer_query
       case GL_TIME_ELAPSED_EXT:
          if (!ctx->Extensions.EXT_timer_query) {
             _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
@@ -247,7 +250,6 @@ _mesa_BeginQueryARB(GLenum target, GLuint id)
             return;
          }
          break;
-#endif
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
          return;
@@ -285,17 +287,15 @@ _mesa_BeginQueryARB(GLenum target, GLuint id)
    if (target == GL_SAMPLES_PASSED_ARB) {
       ctx->Query.CurrentOcclusionObject = q;
    }
-#if FEATURE_EXT_timer_query
    else if (target == GL_TIME_ELAPSED_EXT) {
       ctx->Query.CurrentTimerObject = q;
    }
-#endif
 
    ctx->Driver.BeginQuery(ctx, q);
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_EndQueryARB(GLenum target)
 {
    struct gl_query_object *q;
@@ -313,7 +313,6 @@ _mesa_EndQueryARB(GLenum target)
          q = ctx->Query.CurrentOcclusionObject;
          ctx->Query.CurrentOcclusionObject = NULL;
          break;
-#if FEATURE_EXT_timer_query
       case GL_TIME_ELAPSED_EXT:
          if (!ctx->Extensions.EXT_timer_query) {
             _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
@@ -322,7 +321,6 @@ _mesa_EndQueryARB(GLenum target)
          q = ctx->Query.CurrentTimerObject;
          ctx->Query.CurrentTimerObject = NULL;
          break;
-#endif
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
          return;
@@ -354,7 +352,6 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
          }
          q = ctx->Query.CurrentOcclusionObject;
          break;
-#if FEATURE_EXT_timer_query
       case GL_TIME_ELAPSED_EXT:
          if (!ctx->Extensions.EXT_timer_query) {
             _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
@@ -362,7 +359,6 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
          }
          q = ctx->Query.CurrentTimerObject;
          break;
-#endif
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(target)");
          return;
@@ -462,12 +458,10 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
 }
 
 
-#if FEATURE_EXT_timer_query
-
 /**
  * New with GL_EXT_timer_query
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params)
 {
    struct gl_query_object *q = NULL;
@@ -504,7 +498,7 @@ _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params)
 /**
  * New with GL_EXT_timer_query
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params)
 {
    struct gl_query_object *q = NULL;
@@ -537,19 +531,35 @@ _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params)
    }
 }
 
-#endif /* FEATURE_EXT_timer_query */
+
+void
+_mesa_init_queryobj_dispatch(struct _glapi_table *disp)
+{
+   SET_GenQueriesARB(disp, _mesa_GenQueriesARB);
+   SET_DeleteQueriesARB(disp, _mesa_DeleteQueriesARB);
+   SET_IsQueryARB(disp, _mesa_IsQueryARB);
+   SET_BeginQueryARB(disp, _mesa_BeginQueryARB);
+   SET_EndQueryARB(disp, _mesa_EndQueryARB);
+   SET_GetQueryivARB(disp, _mesa_GetQueryivARB);
+   SET_GetQueryObjectivARB(disp, _mesa_GetQueryObjectivARB);
+   SET_GetQueryObjectuivARB(disp, _mesa_GetQueryObjectuivARB);
+
+   SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT);
+   SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT);
+}
+
+
+#endif /* FEATURE_queryobj */
 
 
 /**
  * Allocate/init the context state related to query objects.
  */
 void
-_mesa_init_query(GLcontext *ctx)
+_mesa_init_queryobj(GLcontext *ctx)
 {
-#if FEATURE_ARB_occlusion_query
    ctx->Query.QueryObjects = _mesa_NewHashTable();
    ctx->Query.CurrentOcclusionObject = NULL;
-#endif
 }
 
 
@@ -569,7 +579,7 @@ delete_queryobj_cb(GLuint id, void *data, void *userData)
  * Free the context state related to query objects.
  */
 void
-_mesa_free_query_data(GLcontext *ctx)
+_mesa_free_queryobj_data(GLcontext *ctx)
 {
    _mesa_HashDeleteAll(ctx->Query.QueryObjects, delete_queryobj_cb, ctx);
    _mesa_DeleteHashTable(ctx->Query.QueryObjects);
diff --git a/mesalib/src/mesa/main/queryobj.h b/mesalib/src/mesa/main/queryobj.h
index ee775ef95..6cf3c76d7 100644
--- a/mesalib/src/mesa/main/queryobj.h
+++ b/mesalib/src/mesa/main/queryobj.h
@@ -23,19 +23,24 @@
  */
 
 
-#ifndef OCCLUDE_H
-#define OCCLUDE_H
+#ifndef QUERYOBJ_H
+#define QUERYOBJ_H
 
 
-extern void
-_mesa_init_query(GLcontext *ctx);
+#include "main/mtypes.h"
 
-extern void
-_mesa_free_query_data(GLcontext *ctx);
 
-extern void
-_mesa_init_query_object_functions(struct dd_function_table *driver);
+#if FEATURE_queryobj
 
+#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl)      \
+   do {                                                  \
+      (driver)->NewQueryObject = impl ## NewQueryObject; \
+      (driver)->DeleteQuery    = impl ## DeleteQuery;    \
+      (driver)->BeginQuery     = impl ## BeginQuery;     \
+      (driver)->EndQuery       = impl ## EndQuery;       \
+      (driver)->WaitQuery      = impl ## WaitQuery;      \
+      (driver)->CheckQuery     = impl ## CheckQuery;     \
+   } while (0)
 
 extern void GLAPIENTRY
 _mesa_GenQueriesARB(GLsizei n, GLuint *ids);
@@ -46,12 +51,6 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids);
 extern GLboolean GLAPIENTRY
 _mesa_IsQueryARB(GLuint id);
 
-extern void GLAPIENTRY
-_mesa_BeginQueryARB(GLenum target, GLuint id);
-
-extern void GLAPIENTRY
-_mesa_EndQueryARB(GLenum target);
-
 extern void GLAPIENTRY
 _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params);
 
@@ -61,11 +60,33 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params);
 extern void GLAPIENTRY
 _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params);
 
-extern void GLAPIENTRY
-_mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params);
+extern void
+_mesa_init_query_object_functions(struct dd_function_table *driver);
 
-extern void GLAPIENTRY
-_mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params);
+extern void
+_mesa_init_queryobj_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_queryobj */
+
+#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl) do { } while (0)
+
+static INLINE void
+_mesa_init_query_object_functions(struct dd_function_table *driver)
+{
+}
+
+static INLINE void
+_mesa_init_queryobj_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_queryobj */
+
+extern void
+_mesa_init_queryobj(GLcontext *ctx);
+
+extern void
+_mesa_free_queryobj_data(GLcontext *ctx);
 
 
-#endif /* OCCLUDE_H */
+#endif /* QUERYOBJ_H */
diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c
index 9f309d6ab..703b47ec7 100644
--- a/mesalib/src/mesa/main/rastpos.c
+++ b/mesalib/src/mesa/main/rastpos.c
@@ -34,6 +34,10 @@
 #include "macros.h"
 #include "rastpos.h"
 #include "state.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_rastpos
 
 
 /**
@@ -60,147 +64,147 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2d(GLdouble x, GLdouble y)
 {
    rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2f(GLfloat x, GLfloat y)
 {
    rasterpos(x, y, 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2i(GLint x, GLint y)
 {
    rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2s(GLshort x, GLshort y)
 {
    rasterpos(x, y, 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
 {
    rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
 {
    rasterpos(x, y, z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3i(GLint x, GLint y, GLint z)
 {
    rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3s(GLshort x, GLshort y, GLshort z)
 {
    rasterpos(x, y, z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
    rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
    rasterpos(x, y, z, w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
 {
    rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
 {
    rasterpos(x, y, z, w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2dv(const GLdouble *v)
 {
    rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2fv(const GLfloat *v)
 {
    rasterpos(v[0], v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2iv(const GLint *v)
 {
    rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos2sv(const GLshort *v)
 {
    rasterpos(v[0], v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3dv(const GLdouble *v)
 {
    rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3fv(const GLfloat *v)
 {
    rasterpos(v[0], v[1], v[2], 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3iv(const GLint *v)
 {
    rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos3sv(const GLshort *v)
 {
    rasterpos(v[0], v[1], v[2], 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4dv(const GLdouble *v)
 {
    rasterpos((GLfloat) v[0], (GLfloat) v[1], 
 		     (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4fv(const GLfloat *v)
 {
    rasterpos(v[0], v[1], v[2], v[3]);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4iv(const GLint *v)
 {
    rasterpos((GLfloat) v[0], (GLfloat) v[1], 
 		     (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_RasterPos4sv(const GLshort *v)
 {
    rasterpos(v[0], v[1], v[2], v[3]);
@@ -211,7 +215,7 @@ _mesa_RasterPos4sv(const GLshort *v)
 /***           GL_ARB_window_pos / GL_MESA_window_pos               ***/
 /**********************************************************************/
 
-#if FEATURE_drawpix
+
 /**
  * All glWindowPosMESA and glWindowPosARB commands call this function to
  * update the current raster position.
@@ -290,153 +294,152 @@ window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2dMESA(GLdouble x, GLdouble y)
 {
    window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2fMESA(GLfloat x, GLfloat y)
 {
    window_pos4f(x, y, 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2iMESA(GLint x, GLint y)
 {
    window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2sMESA(GLshort x, GLshort y)
 {
    window_pos4f(x, y, 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
 {
    window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
 {
    window_pos4f(x, y, z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3iMESA(GLint x, GLint y, GLint z)
 {
    window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
 {
    window_pos4f(x, y, z, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
    window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
    window_pos4f(x, y, z, w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
 {
    window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
 {
    window_pos4f(x, y, z, w);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2dvMESA(const GLdouble *v)
 {
    window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2fvMESA(const GLfloat *v)
 {
    window_pos4f(v[0], v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2ivMESA(const GLint *v)
 {
    window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos2svMESA(const GLshort *v)
 {
    window_pos4f(v[0], v[1], 0.0F, 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3dvMESA(const GLdouble *v)
 {
    window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3fvMESA(const GLfloat *v)
 {
    window_pos4f(v[0], v[1], v[2], 1.0);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3ivMESA(const GLint *v)
 {
    window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos3svMESA(const GLshort *v)
 {
    window_pos4f(v[0], v[1], v[2], 1.0F);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4dvMESA(const GLdouble *v)
 {
    window_pos4f((GLfloat) v[0], (GLfloat) v[1], 
 			 (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4fvMESA(const GLfloat *v)
 {
    window_pos4f(v[0], v[1], v[2], v[3]);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4ivMESA(const GLint *v)
 {
    window_pos4f((GLfloat) v[0], (GLfloat) v[1], 
 			 (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_WindowPos4svMESA(const GLshort *v)
 {
    window_pos4f(v[0], v[1], v[2], v[3]);
 }
 
-#endif
 
 #if 0
 
@@ -477,6 +480,65 @@ void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
 #endif
 
 
+void
+_mesa_init_rastpos_dispatch(struct _glapi_table *disp)
+{
+   SET_RasterPos2f(disp, _mesa_RasterPos2f);
+   SET_RasterPos2fv(disp, _mesa_RasterPos2fv);
+   SET_RasterPos2i(disp, _mesa_RasterPos2i);
+   SET_RasterPos2iv(disp, _mesa_RasterPos2iv);
+   SET_RasterPos2d(disp, _mesa_RasterPos2d);
+   SET_RasterPos2dv(disp, _mesa_RasterPos2dv);
+   SET_RasterPos2s(disp, _mesa_RasterPos2s);
+   SET_RasterPos2sv(disp, _mesa_RasterPos2sv);
+   SET_RasterPos3d(disp, _mesa_RasterPos3d);
+   SET_RasterPos3dv(disp, _mesa_RasterPos3dv);
+   SET_RasterPos3f(disp, _mesa_RasterPos3f);
+   SET_RasterPos3fv(disp, _mesa_RasterPos3fv);
+   SET_RasterPos3i(disp, _mesa_RasterPos3i);
+   SET_RasterPos3iv(disp, _mesa_RasterPos3iv);
+   SET_RasterPos3s(disp, _mesa_RasterPos3s);
+   SET_RasterPos3sv(disp, _mesa_RasterPos3sv);
+   SET_RasterPos4d(disp, _mesa_RasterPos4d);
+   SET_RasterPos4dv(disp, _mesa_RasterPos4dv);
+   SET_RasterPos4f(disp, _mesa_RasterPos4f);
+   SET_RasterPos4fv(disp, _mesa_RasterPos4fv);
+   SET_RasterPos4i(disp, _mesa_RasterPos4i);
+   SET_RasterPos4iv(disp, _mesa_RasterPos4iv);
+   SET_RasterPos4s(disp, _mesa_RasterPos4s);
+   SET_RasterPos4sv(disp, _mesa_RasterPos4sv);
+
+   /* 197. GL_MESA_window_pos */
+   SET_WindowPos2dMESA(disp, _mesa_WindowPos2dMESA);
+   SET_WindowPos2dvMESA(disp, _mesa_WindowPos2dvMESA);
+   SET_WindowPos2fMESA(disp, _mesa_WindowPos2fMESA);
+   SET_WindowPos2fvMESA(disp, _mesa_WindowPos2fvMESA);
+   SET_WindowPos2iMESA(disp, _mesa_WindowPos2iMESA);
+   SET_WindowPos2ivMESA(disp, _mesa_WindowPos2ivMESA);
+   SET_WindowPos2sMESA(disp, _mesa_WindowPos2sMESA);
+   SET_WindowPos2svMESA(disp, _mesa_WindowPos2svMESA);
+   SET_WindowPos3dMESA(disp, _mesa_WindowPos3dMESA);
+   SET_WindowPos3dvMESA(disp, _mesa_WindowPos3dvMESA);
+   SET_WindowPos3fMESA(disp, _mesa_WindowPos3fMESA);
+   SET_WindowPos3fvMESA(disp, _mesa_WindowPos3fvMESA);
+   SET_WindowPos3iMESA(disp, _mesa_WindowPos3iMESA);
+   SET_WindowPos3ivMESA(disp, _mesa_WindowPos3ivMESA);
+   SET_WindowPos3sMESA(disp, _mesa_WindowPos3sMESA);
+   SET_WindowPos3svMESA(disp, _mesa_WindowPos3svMESA);
+   SET_WindowPos4dMESA(disp, _mesa_WindowPos4dMESA);
+   SET_WindowPos4dvMESA(disp, _mesa_WindowPos4dvMESA);
+   SET_WindowPos4fMESA(disp, _mesa_WindowPos4fMESA);
+   SET_WindowPos4fvMESA(disp, _mesa_WindowPos4fvMESA);
+   SET_WindowPos4iMESA(disp, _mesa_WindowPos4iMESA);
+   SET_WindowPos4ivMESA(disp, _mesa_WindowPos4ivMESA);
+   SET_WindowPos4sMESA(disp, _mesa_WindowPos4sMESA);
+   SET_WindowPos4svMESA(disp, _mesa_WindowPos4svMESA);
+}
+
+
+#endif /* FEATURE_rastpos */
+
+
 /**********************************************************************/
 /** \name Initialization                                              */
 /**********************************************************************/
diff --git a/mesalib/src/mesa/main/rastpos.h b/mesalib/src/mesa/main/rastpos.h
index 363f86ad8..b2127225b 100644
--- a/mesalib/src/mesa/main/rastpos.h
+++ b/mesalib/src/mesa/main/rastpos.h
@@ -32,162 +32,33 @@
 #define RASTPOS_H
 
 
-#include "glheader.h"
+#include "main/mtypes.h"
 
 
-extern void GLAPIENTRY
-_mesa_RasterPos2d(GLdouble x, GLdouble y);
+#if FEATURE_rastpos
 
-extern void GLAPIENTRY
-_mesa_RasterPos2f(GLfloat x, GLfloat y);
+#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) \
+   do {                                            \
+      (driver)->RasterPos = impl ## RasterPos;     \
+   } while (0)
 
-extern void GLAPIENTRY
-_mesa_RasterPos2i(GLint x, GLint y);
+extern void
+_mesa_init_rastpos_dispatch(struct _glapi_table *disp);
 
-extern void GLAPIENTRY
-_mesa_RasterPos2s(GLshort x, GLshort y);
+#else /* FEATURE_rastpos */
 
-extern void GLAPIENTRY
-_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z);
+#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) do { } while (0)
 
-extern void GLAPIENTRY
-_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z);
+static INLINE void
+_mesa_init_rastpos_dispatch(struct _glapi_table *disp)
+{
+}
 
-extern void GLAPIENTRY
-_mesa_RasterPos3i(GLint x, GLint y, GLint z);
-
-extern void GLAPIENTRY
-_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
-
-extern void GLAPIENTRY
-_mesa_RasterPos2dv(const GLdouble *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos2fv(const GLfloat *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos2iv(const GLint *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos2sv(const GLshort *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos3dv(const GLdouble *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos3fv(const GLfloat *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos3iv(const GLint *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos3sv(const GLshort *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4dv(const GLdouble *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4fv(const GLfloat *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4iv(const GLint *v);
-
-extern void GLAPIENTRY
-_mesa_RasterPos4sv(const GLshort *v);
-
-
-/**********************************************************************/
-/** \name GL_MESA_window_pos                                          */
-/**********************************************************************/
-/*@{*/
-
-extern void GLAPIENTRY
-_mesa_WindowPos2dMESA(GLdouble x, GLdouble y);
-
-extern void GLAPIENTRY
-_mesa_WindowPos2fMESA(GLfloat x, GLfloat y);
-
-extern void GLAPIENTRY
-_mesa_WindowPos2iMESA(GLint x, GLint y);
-
-extern void GLAPIENTRY
-_mesa_WindowPos2sMESA(GLshort x, GLshort y);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w);
-
-extern void GLAPIENTRY
-_mesa_WindowPos2dvMESA(const GLdouble *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos2fvMESA(const GLfloat *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos2ivMESA(const GLint *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos2svMESA(const GLshort *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3dvMESA(const GLdouble *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3fvMESA(const GLfloat *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3ivMESA(const GLint *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos3svMESA(const GLshort *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4dvMESA(const GLdouble *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4fvMESA(const GLfloat *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4ivMESA(const GLint *v);
-
-extern void GLAPIENTRY
-_mesa_WindowPos4svMESA(const GLshort *v);
+#endif /* FEATURE_rastpos */
 
 extern void 
-_mesa_init_rastpos( GLcontext * ctx );
+_mesa_init_rastpos(GLcontext *ctx);
 
 /*@}*/
 
-#endif
+#endif /* RASTPOS_H */
diff --git a/mesalib/src/mesa/main/rbadaptors.c b/mesalib/src/mesa/main/rbadaptors.c
index c1ac0606c..1060c5796 100644
--- a/mesalib/src/mesa/main/rbadaptors.c
+++ b/mesalib/src/mesa/main/rbadaptors.c
@@ -218,14 +218,10 @@ _mesa_new_renderbuffer_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8)
       _glthread_UNLOCK_MUTEX(rb8->Mutex);
 
       rb16->InternalFormat = rb8->InternalFormat;
-      rb16->_ActualFormat = rb8->_ActualFormat;
+      rb16->Format = rb8->Format; /* XXX is this right? */
       rb16->_BaseFormat = rb8->_BaseFormat;
       rb16->DataType = GL_UNSIGNED_SHORT;
       /* Note: passing through underlying bits/channel */
-      rb16->RedBits = rb8->RedBits;
-      rb16->GreenBits = rb8->GreenBits;
-      rb16->BlueBits = rb8->BlueBits;
-      rb16->AlphaBits = rb8->AlphaBits;
       rb16->Wrapped = rb8;
 
       rb16->AllocStorage = AllocStorage_wrapper;
@@ -385,14 +381,10 @@ _mesa_new_renderbuffer_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8)
       _glthread_UNLOCK_MUTEX(rb8->Mutex);
 
       rb32->InternalFormat = rb8->InternalFormat;
-      rb32->_ActualFormat = rb8->_ActualFormat;
+      rb32->Format = rb8->Format;  /* XXX is this right? */
       rb32->_BaseFormat = rb8->_BaseFormat;
       rb32->DataType = GL_FLOAT;
       /* Note: passing through underlying bits/channel */
-      rb32->RedBits = rb8->RedBits;
-      rb32->GreenBits = rb8->GreenBits;
-      rb32->BlueBits = rb8->BlueBits;
-      rb32->AlphaBits = rb8->AlphaBits;
       rb32->Wrapped = rb8;
 
       rb32->AllocStorage = AllocStorage_wrapper;
@@ -552,14 +544,10 @@ _mesa_new_renderbuffer_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb16)
       _glthread_UNLOCK_MUTEX(rb16->Mutex);
 
       rb32->InternalFormat = rb16->InternalFormat;
-      rb32->_ActualFormat = rb16->_ActualFormat;
+      rb32->Format = rb16->Format;  /* XXX is this right? */
       rb32->_BaseFormat = rb16->_BaseFormat;
       rb32->DataType = GL_FLOAT;
       /* Note: passing through underlying bits/channel */
-      rb32->RedBits = rb16->RedBits;
-      rb32->GreenBits = rb16->GreenBits;
-      rb32->BlueBits = rb16->BlueBits;
-      rb32->AlphaBits = rb16->AlphaBits;
       rb32->Wrapped = rb16;
 
       rb32->AllocStorage = AllocStorage_wrapper;
diff --git a/mesalib/src/mesa/main/remap.c b/mesalib/src/mesa/main/remap.c
new file mode 100644
index 000000000..0385ae8d7
--- /dev/null
+++ b/mesalib/src/mesa/main/remap.c
@@ -0,0 +1,216 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file remap.c
+ * Remap table management.
+ *
+ * Entries in the dispatch table are either static or dynamic.  The
+ * dispatch table is shared by mesa core and glapi.  When they are
+ * built separately, it is possible that a static entry in mesa core
+ * is dynamic, or assigned a different static offset, in glapi.  The
+ * remap table is in charge of mapping a static entry in mesa core to
+ * a dynamic entry, or the corresponding static entry, in glapi.
+ */
+
+#include "remap.h"
+#include "imports.h"
+
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_remap_table
+
+
+#define need_MESA_remap_table
+#include "remap_helper.h"
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+#define MAX_ENTRY_POINTS 16
+
+
+/* this is global for quick access */
+int driDispatchRemapTable[driDispatchRemapTable_size];
+
+
+/**
+ * Return the spec string associated with the given function index.
+ * The index is available from including remap_helper.h.
+ *
+ * \param func_index an opaque function index.
+ *
+ * \return the spec string associated with the function index, or NULL.
+ */
+const char *
+_mesa_get_function_spec(GLint func_index)
+{
+   if (func_index < ARRAY_SIZE(_mesa_function_pool))
+      return _mesa_function_pool + func_index;
+   else
+      return NULL;
+}
+
+
+/**
+ * Map a function by its spec.  The function will be added to glapi,
+ * and the dispatch offset will be returned.
+ *
+ * \param spec a '\0'-separated string array specifying a function.
+ *        It begins with the parameter signature of the function,
+ *        followed by the names of the entry points.  An empty entry
+ *        point name terminates the array.
+ *
+ * \return the offset of the (re-)mapped function in the dispatch
+ *         table, or -1.
+ */
+GLint
+_mesa_map_function_spec(const char *spec)
+{
+   const char *signature;
+   const char *names[MAX_ENTRY_POINTS + 1];
+   GLint num_names = 0;
+
+   if (!spec)
+      return -1;
+
+   signature = spec;
+   spec += strlen(spec) + 1;
+
+   /* spec is terminated by an empty string */
+   while (*spec) {
+      names[num_names] = spec;
+      num_names++;
+      if (num_names >= MAX_ENTRY_POINTS)
+         break;
+      spec += strlen(spec) + 1;
+   }
+   if (!num_names)
+      return -1;
+
+   names[num_names] = NULL;
+
+   /* add the entry points to the dispatch table */
+   return _glapi_add_dispatch(names, signature);
+}
+
+
+/**
+ * Map an array of functions.  This is a convenient function for
+ * use with arrays available from including remap_helper.h.
+ *
+ * Note that the dispatch offsets of the functions are not returned.
+ * If they are needed, _mesa_map_function_spec() should be used.
+ *
+ * \param func_array an array of function remaps.
+ */
+void
+_mesa_map_function_array(const struct gl_function_remap *func_array)
+{
+   GLint i;
+
+   if (!func_array)
+      return;
+
+   for (i = 0; func_array[i].func_index != -1; i++) {
+      const char *spec;
+      GLint offset;
+
+      spec = _mesa_get_function_spec(func_array[i].func_index);
+      if (!spec) {
+         _mesa_problem(NULL, "invalid function index %d",
+                       func_array[i].func_index);
+         continue;
+      }
+
+      offset = _mesa_map_function_spec(spec);
+      /* error checks */
+      if (offset < 0) {
+         const char *name = spec + strlen(spec) + 1;
+         _mesa_warning(NULL, "failed to remap %s", name);
+      }
+      else if (func_array[i].dispatch_offset >= 0 &&
+               offset != func_array[i].dispatch_offset) {
+         const char *name = spec + strlen(spec) + 1;
+         _mesa_problem(NULL, "%s should be mapped to %d, not %d",
+                       name, func_array[i].dispatch_offset, offset);
+      }
+   }
+}
+
+
+/**
+ * Map the functions which are already static.
+ *
+ * When a extension function are incorporated into the ABI, the
+ * extension suffix is usually stripped.  Mapping such functions
+ * makes sure the alternative names are available.
+ *
+ * Note that functions mapped by _mesa_init_remap_table() are
+ * excluded.
+ */
+void
+_mesa_map_static_functions(void)
+{
+   /* Remap static functions which have alternative names and are in the ABI.
+    * This is to be on the safe side.  glapi should have defined those names.
+    */
+   _mesa_map_function_array(MESA_alt_functions);
+}
+
+
+/**
+ * Initialize the remap table.  This is called in one_time_init().
+ * The remap table needs to be initialized before calling the
+ * CALL/GET/SET macros defined in glapi/dispatch.h.
+ */
+void
+_mesa_init_remap_table(void)
+{
+   static GLboolean initialized = GL_FALSE;
+   GLint i;
+
+   if (initialized)
+      return;
+   initialized = GL_TRUE;
+
+   /* initialize the remap table */
+   for (i = 0; i < ARRAY_SIZE(driDispatchRemapTable); i++) {
+      GLint offset;
+      const char *spec;
+
+      /* sanity check */
+      ASSERT(i == MESA_remap_table_functions[i].remap_index);
+      spec = _mesa_function_pool + MESA_remap_table_functions[i].pool_index;
+
+      offset = _mesa_map_function_spec(spec);
+      /* store the dispatch offset in the remap table */
+      driDispatchRemapTable[i] = offset;
+      if (offset < 0)
+         _mesa_warning(NULL, "failed to remap index %d", i);
+   }
+}
+
+
+#endif /* FEATURE_remap_table */
diff --git a/mesalib/src/mesa/main/remap.h b/mesalib/src/mesa/main/remap.h
new file mode 100644
index 000000000..7fb56e360
--- /dev/null
+++ b/mesalib/src/mesa/main/remap.h
@@ -0,0 +1,87 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef REMAP_H
+#define REMAP_H
+
+
+#include "main/mtypes.h"
+
+struct gl_function_remap;
+
+
+#if FEATURE_remap_table
+
+extern int
+driDispatchRemapTable[];
+
+extern const char *
+_mesa_get_function_spec(GLint func_index);
+
+extern GLint
+_mesa_map_function_spec(const char *spec);
+
+extern void
+_mesa_map_function_array(const struct gl_function_remap *func_array);
+
+extern void
+_mesa_map_static_functions(void);
+
+extern void
+_mesa_init_remap_table(void);
+
+#else /* FEATURE_remap_table */
+
+static INLINE const char *
+_mesa_get_function_spec(GLint func_index)
+{
+   return NULL;
+}
+
+static INLINE GLint
+_mesa_map_function_spec(const char *spec)
+{
+   return -1;
+}
+
+static INLINE void
+_mesa_map_function_array(const struct gl_function_remap *func_array)
+{
+}
+
+static INLINE void
+_mesa_map_static_functions(void)
+{
+}
+
+static INLINE void
+_mesa_init_remap_table(void)
+{
+}
+
+#endif /* FEATURE_remap_table */
+
+
+#endif /* REMAP_H */
diff --git a/mesalib/src/mesa/main/remap_helper.h b/mesalib/src/mesa/main/remap_helper.h
new file mode 100644
index 000000000..c80a524b4
--- /dev/null
+++ b/mesalib/src/mesa/main/remap_helper.h
@@ -0,0 +1,5891 @@
+/* DO NOT EDIT - This file generated automatically by remap_helper.py (from Mesa) script */
+
+/*
+ * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
+ * 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
+ * Chia-I Wu,
+ * 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 "glapi/dispatch.h"
+
+struct gl_function_remap {
+   GLint func_index;
+   GLint dispatch_offset; /* for sanity check */
+};
+
+/* this is internal to remap.c */
+#ifdef need_MESA_remap_table
+
+static const char _mesa_function_pool[] =
+   /* _mesa_function_pool[0]: MapGrid1d (offset 224) */
+   "idd\0"
+   "glMapGrid1d\0"
+   "\0"
+   /* _mesa_function_pool[17]: UniformMatrix3fvARB (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix3fv\0"
+   "glUniformMatrix3fvARB\0"
+   "\0"
+   /* _mesa_function_pool[64]: MapGrid1f (offset 225) */
+   "iff\0"
+   "glMapGrid1f\0"
+   "\0"
+   /* _mesa_function_pool[81]: RasterPos4i (offset 82) */
+   "iiii\0"
+   "glRasterPos4i\0"
+   "\0"
+   /* _mesa_function_pool[101]: RasterPos4d (offset 78) */
+   "dddd\0"
+   "glRasterPos4d\0"
+   "\0"
+   /* _mesa_function_pool[121]: NewList (dynamic) */
+   "ii\0"
+   "glNewList\0"
+   "\0"
+   /* _mesa_function_pool[135]: RasterPos4f (offset 80) */
+   "ffff\0"
+   "glRasterPos4f\0"
+   "\0"
+   /* _mesa_function_pool[155]: LoadIdentity (offset 290) */
+   "\0"
+   "glLoadIdentity\0"
+   "\0"
+   /* _mesa_function_pool[172]: SampleCoverageARB (will be remapped) */
+   "fi\0"
+   "glSampleCoverage\0"
+   "glSampleCoverageARB\0"
+   "\0"
+   /* _mesa_function_pool[213]: ConvolutionFilter1D (offset 348) */
+   "iiiiip\0"
+   "glConvolutionFilter1D\0"
+   "glConvolutionFilter1DEXT\0"
+   "\0"
+   /* _mesa_function_pool[268]: BeginQueryARB (will be remapped) */
+   "ii\0"
+   "glBeginQuery\0"
+   "glBeginQueryARB\0"
+   "\0"
+   /* _mesa_function_pool[301]: RasterPos3dv (offset 71) */
+   "p\0"
+   "glRasterPos3dv\0"
+   "\0"
+   /* _mesa_function_pool[319]: PointParameteriNV (will be remapped) */
+   "ii\0"
+   "glPointParameteri\0"
+   "glPointParameteriNV\0"
+   "\0"
+   /* _mesa_function_pool[361]: GetProgramiv (will be remapped) */
+   "iip\0"
+   "glGetProgramiv\0"
+   "\0"
+   /* _mesa_function_pool[381]: MultiTexCoord3sARB (offset 398) */
+   "iiii\0"
+   "glMultiTexCoord3s\0"
+   "glMultiTexCoord3sARB\0"
+   "\0"
+   /* _mesa_function_pool[426]: SecondaryColor3iEXT (will be remapped) */
+   "iii\0"
+   "glSecondaryColor3i\0"
+   "glSecondaryColor3iEXT\0"
+   "\0"
+   /* _mesa_function_pool[472]: WindowPos3fMESA (will be remapped) */
+   "fff\0"
+   "glWindowPos3f\0"
+   "glWindowPos3fARB\0"
+   "glWindowPos3fMESA\0"
+   "\0"
+   /* _mesa_function_pool[526]: TexCoord1iv (offset 99) */
+   "p\0"
+   "glTexCoord1iv\0"
+   "\0"
+   /* _mesa_function_pool[543]: TexCoord4sv (offset 125) */
+   "p\0"
+   "glTexCoord4sv\0"
+   "\0"
+   /* _mesa_function_pool[560]: RasterPos4s (offset 84) */
+   "iiii\0"
+   "glRasterPos4s\0"
+   "\0"
+   /* _mesa_function_pool[580]: PixelTexGenParameterfvSGIS (will be remapped) */
+   "ip\0"
+   "glPixelTexGenParameterfvSGIS\0"
+   "\0"
+   /* _mesa_function_pool[613]: ActiveTextureARB (offset 374) */
+   "i\0"
+   "glActiveTexture\0"
+   "glActiveTextureARB\0"
+   "\0"
+   /* _mesa_function_pool[651]: BlitFramebufferEXT (will be remapped) */
+   "iiiiiiiiii\0"
+   "glBlitFramebuffer\0"
+   "glBlitFramebufferEXT\0"
+   "\0"
+   /* _mesa_function_pool[702]: TexCoord1f (offset 96) */
+   "f\0"
+   "glTexCoord1f\0"
+   "\0"
+   /* _mesa_function_pool[718]: TexCoord1d (offset 94) */
+   "d\0"
+   "glTexCoord1d\0"
+   "\0"
+   /* _mesa_function_pool[734]: VertexAttrib4ubvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4ubvNV\0"
+   "\0"
+   /* _mesa_function_pool[759]: TexCoord1i (offset 98) */
+   "i\0"
+   "glTexCoord1i\0"
+   "\0"
+   /* _mesa_function_pool[775]: GetProgramNamedParameterdvNV (will be remapped) */
+   "iipp\0"
+   "glGetProgramNamedParameterdvNV\0"
+   "\0"
+   /* _mesa_function_pool[812]: Histogram (offset 367) */
+   "iiii\0"
+   "glHistogram\0"
+   "glHistogramEXT\0"
+   "\0"
+   /* _mesa_function_pool[845]: TexCoord1s (offset 100) */
+   "i\0"
+   "glTexCoord1s\0"
+   "\0"
+   /* _mesa_function_pool[861]: GetMapfv (offset 267) */
+   "iip\0"
+   "glGetMapfv\0"
+   "\0"
+   /* _mesa_function_pool[877]: EvalCoord1f (offset 230) */
+   "f\0"
+   "glEvalCoord1f\0"
+   "\0"
+   /* _mesa_function_pool[894]: TexImage4DSGIS (dynamic) */
+   "iiiiiiiiiip\0"
+   "glTexImage4DSGIS\0"
+   "\0"
+   /* _mesa_function_pool[924]: PolygonStipple (offset 175) */
+   "p\0"
+   "glPolygonStipple\0"
+   "\0"
+   /* _mesa_function_pool[944]: WindowPos2dvMESA (will be remapped) */
+   "p\0"
+   "glWindowPos2dv\0"
+   "glWindowPos2dvARB\0"
+   "glWindowPos2dvMESA\0"
+   "\0"
+   /* _mesa_function_pool[999]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glReplacementCodeuiColor3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[1043]: BlendEquationSeparateEXT (will be remapped) */
+   "ii\0"
+   "glBlendEquationSeparate\0"
+   "glBlendEquationSeparateEXT\0"
+   "glBlendEquationSeparateATI\0"
+   "\0"
+   /* _mesa_function_pool[1125]: ListParameterfSGIX (dynamic) */
+   "iif\0"
+   "glListParameterfSGIX\0"
+   "\0"
+   /* _mesa_function_pool[1151]: SecondaryColor3bEXT (will be remapped) */
+   "iii\0"
+   "glSecondaryColor3b\0"
+   "glSecondaryColor3bEXT\0"
+   "\0"
+   /* _mesa_function_pool[1197]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */
+   "pppp\0"
+   "glTexCoord4fColor4fNormal3fVertex4fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[1243]: GetPixelMapfv (offset 271) */
+   "ip\0"
+   "glGetPixelMapfv\0"
+   "\0"
+   /* _mesa_function_pool[1263]: Color3uiv (offset 22) */
+   "p\0"
+   "glColor3uiv\0"
+   "\0"
+   /* _mesa_function_pool[1278]: IsEnabled (offset 286) */
+   "i\0"
+   "glIsEnabled\0"
+   "\0"
+   /* _mesa_function_pool[1293]: VertexAttrib4svNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4svNV\0"
+   "\0"
+   /* _mesa_function_pool[1317]: EvalCoord2fv (offset 235) */
+   "p\0"
+   "glEvalCoord2fv\0"
+   "\0"
+   /* _mesa_function_pool[1335]: GetBufferSubDataARB (will be remapped) */
+   "iiip\0"
+   "glGetBufferSubData\0"
+   "glGetBufferSubDataARB\0"
+   "\0"
+   /* _mesa_function_pool[1382]: BufferSubDataARB (will be remapped) */
+   "iiip\0"
+   "glBufferSubData\0"
+   "glBufferSubDataARB\0"
+   "\0"
+   /* _mesa_function_pool[1423]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glTexCoord2fColor4ubVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[1461]: AttachShader (will be remapped) */
+   "ii\0"
+   "glAttachShader\0"
+   "\0"
+   /* _mesa_function_pool[1480]: VertexAttrib2fARB (will be remapped) */
+   "iff\0"
+   "glVertexAttrib2f\0"
+   "glVertexAttrib2fARB\0"
+   "\0"
+   /* _mesa_function_pool[1522]: GetDebugLogLengthMESA (dynamic) */
+   "iii\0"
+   "glGetDebugLogLengthMESA\0"
+   "\0"
+   /* _mesa_function_pool[1551]: GetMapiv (offset 268) */
+   "iip\0"
+   "glGetMapiv\0"
+   "\0"
+   /* _mesa_function_pool[1567]: VertexAttrib3fARB (will be remapped) */
+   "ifff\0"
+   "glVertexAttrib3f\0"
+   "glVertexAttrib3fARB\0"
+   "\0"
+   /* _mesa_function_pool[1610]: Indexubv (offset 316) */
+   "p\0"
+   "glIndexubv\0"
+   "\0"
+   /* _mesa_function_pool[1624]: GetQueryivARB (will be remapped) */
+   "iip\0"
+   "glGetQueryiv\0"
+   "glGetQueryivARB\0"
+   "\0"
+   /* _mesa_function_pool[1658]: TexImage3D (offset 371) */
+   "iiiiiiiiip\0"
+   "glTexImage3D\0"
+   "glTexImage3DEXT\0"
+   "\0"
+   /* _mesa_function_pool[1699]: ReplacementCodeuiVertex3fvSUN (dynamic) */
+   "pp\0"
+   "glReplacementCodeuiVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[1735]: EdgeFlagPointer (offset 312) */
+   "ip\0"
+   "glEdgeFlagPointer\0"
+   "\0"
+   /* _mesa_function_pool[1757]: Color3ubv (offset 20) */
+   "p\0"
+   "glColor3ubv\0"
+   "\0"
+   /* _mesa_function_pool[1772]: GetQueryObjectivARB (will be remapped) */
+   "iip\0"
+   "glGetQueryObjectiv\0"
+   "glGetQueryObjectivARB\0"
+   "\0"
+   /* _mesa_function_pool[1818]: Vertex3dv (offset 135) */
+   "p\0"
+   "glVertex3dv\0"
+   "\0"
+   /* _mesa_function_pool[1833]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glReplacementCodeuiTexCoord2fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[1880]: CompressedTexSubImage2DARB (will be remapped) */
+   "iiiiiiiip\0"
+   "glCompressedTexSubImage2D\0"
+   "glCompressedTexSubImage2DARB\0"
+   "\0"
+   /* _mesa_function_pool[1946]: CombinerOutputNV (will be remapped) */
+   "iiiiiiiiii\0"
+   "glCombinerOutputNV\0"
+   "\0"
+   /* _mesa_function_pool[1977]: VertexAttribs3fvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs3fvNV\0"
+   "\0"
+   /* _mesa_function_pool[2003]: Uniform2fARB (will be remapped) */
+   "iff\0"
+   "glUniform2f\0"
+   "glUniform2fARB\0"
+   "\0"
+   /* _mesa_function_pool[2035]: LightModeliv (offset 166) */
+   "ip\0"
+   "glLightModeliv\0"
+   "\0"
+   /* _mesa_function_pool[2054]: VertexAttrib1svARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib1sv\0"
+   "glVertexAttrib1svARB\0"
+   "\0"
+   /* _mesa_function_pool[2097]: VertexAttribs1dvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs1dvNV\0"
+   "\0"
+   /* _mesa_function_pool[2123]: Uniform2ivARB (will be remapped) */
+   "iip\0"
+   "glUniform2iv\0"
+   "glUniform2ivARB\0"
+   "\0"
+   /* _mesa_function_pool[2157]: GetImageTransformParameterfvHP (dynamic) */
+   "iip\0"
+   "glGetImageTransformParameterfvHP\0"
+   "\0"
+   /* _mesa_function_pool[2195]: Normal3bv (offset 53) */
+   "p\0"
+   "glNormal3bv\0"
+   "\0"
+   /* _mesa_function_pool[2210]: TexGeniv (offset 193) */
+   "iip\0"
+   "glTexGeniv\0"
+   "\0"
+   /* _mesa_function_pool[2226]: WeightubvARB (dynamic) */
+   "ip\0"
+   "glWeightubvARB\0"
+   "\0"
+   /* _mesa_function_pool[2245]: VertexAttrib1fvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib1fvNV\0"
+   "\0"
+   /* _mesa_function_pool[2269]: Vertex3iv (offset 139) */
+   "p\0"
+   "glVertex3iv\0"
+   "\0"
+   /* _mesa_function_pool[2284]: CopyConvolutionFilter1D (offset 354) */
+   "iiiii\0"
+   "glCopyConvolutionFilter1D\0"
+   "glCopyConvolutionFilter1DEXT\0"
+   "\0"
+   /* _mesa_function_pool[2346]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */
+   "iffffff\0"
+   "glReplacementCodeuiNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[2394]: DeleteSync (will be remapped) */
+   "i\0"
+   "glDeleteSync\0"
+   "\0"
+   /* _mesa_function_pool[2410]: FragmentMaterialfvSGIX (dynamic) */
+   "iip\0"
+   "glFragmentMaterialfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[2440]: BlendColor (offset 336) */
+   "ffff\0"
+   "glBlendColor\0"
+   "glBlendColorEXT\0"
+   "\0"
+   /* _mesa_function_pool[2475]: UniformMatrix4fvARB (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix4fv\0"
+   "glUniformMatrix4fvARB\0"
+   "\0"
+   /* _mesa_function_pool[2522]: DeleteVertexArraysAPPLE (will be remapped) */
+   "ip\0"
+   "glDeleteVertexArrays\0"
+   "glDeleteVertexArraysAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[2573]: ReadInstrumentsSGIX (dynamic) */
+   "i\0"
+   "glReadInstrumentsSGIX\0"
+   "\0"
+   /* _mesa_function_pool[2598]: CallLists (offset 3) */
+   "iip\0"
+   "glCallLists\0"
+   "\0"
+   /* _mesa_function_pool[2615]: UniformMatrix2x4fv (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix2x4fv\0"
+   "\0"
+   /* _mesa_function_pool[2642]: Color4ubVertex3fvSUN (dynamic) */
+   "pp\0"
+   "glColor4ubVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[2669]: Normal3iv (offset 59) */
+   "p\0"
+   "glNormal3iv\0"
+   "\0"
+   /* _mesa_function_pool[2684]: PassThrough (offset 199) */
+   "f\0"
+   "glPassThrough\0"
+   "\0"
+   /* _mesa_function_pool[2701]: FramebufferTextureLayerEXT (will be remapped) */
+   "iiiii\0"
+   "glFramebufferTextureLayer\0"
+   "glFramebufferTextureLayerEXT\0"
+   "\0"
+   /* _mesa_function_pool[2763]: GetListParameterfvSGIX (dynamic) */
+   "iip\0"
+   "glGetListParameterfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[2793]: Viewport (offset 305) */
+   "iiii\0"
+   "glViewport\0"
+   "\0"
+   /* _mesa_function_pool[2810]: VertexAttrib4NusvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4Nusv\0"
+   "glVertexAttrib4NusvARB\0"
+   "\0"
+   /* _mesa_function_pool[2857]: WindowPos4svMESA (will be remapped) */
+   "p\0"
+   "glWindowPos4svMESA\0"
+   "\0"
+   /* _mesa_function_pool[2879]: CreateProgramObjectARB (will be remapped) */
+   "\0"
+   "glCreateProgramObjectARB\0"
+   "\0"
+   /* _mesa_function_pool[2906]: FragmentLightModelivSGIX (dynamic) */
+   "ip\0"
+   "glFragmentLightModelivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[2937]: UniformMatrix4x3fv (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix4x3fv\0"
+   "\0"
+   /* _mesa_function_pool[2964]: PrioritizeTextures (offset 331) */
+   "ipp\0"
+   "glPrioritizeTextures\0"
+   "glPrioritizeTexturesEXT\0"
+   "\0"
+   /* _mesa_function_pool[3014]: AsyncMarkerSGIX (dynamic) */
+   "i\0"
+   "glAsyncMarkerSGIX\0"
+   "\0"
+   /* _mesa_function_pool[3035]: GlobalAlphaFactorubSUN (dynamic) */
+   "i\0"
+   "glGlobalAlphaFactorubSUN\0"
+   "\0"
+   /* _mesa_function_pool[3063]: ClearDebugLogMESA (dynamic) */
+   "iii\0"
+   "glClearDebugLogMESA\0"
+   "\0"
+   /* _mesa_function_pool[3088]: ResetHistogram (offset 369) */
+   "i\0"
+   "glResetHistogram\0"
+   "glResetHistogramEXT\0"
+   "\0"
+   /* _mesa_function_pool[3128]: GetProgramNamedParameterfvNV (will be remapped) */
+   "iipp\0"
+   "glGetProgramNamedParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[3165]: PointParameterfEXT (will be remapped) */
+   "if\0"
+   "glPointParameterf\0"
+   "glPointParameterfARB\0"
+   "glPointParameterfEXT\0"
+   "glPointParameterfSGIS\0"
+   "\0"
+   /* _mesa_function_pool[3251]: LoadIdentityDeformationMapSGIX (dynamic) */
+   "i\0"
+   "glLoadIdentityDeformationMapSGIX\0"
+   "\0"
+   /* _mesa_function_pool[3287]: GenFencesNV (will be remapped) */
+   "ip\0"
+   "glGenFencesNV\0"
+   "\0"
+   /* _mesa_function_pool[3305]: ImageTransformParameterfHP (dynamic) */
+   "iif\0"
+   "glImageTransformParameterfHP\0"
+   "\0"
+   /* _mesa_function_pool[3339]: MatrixIndexusvARB (dynamic) */
+   "ip\0"
+   "glMatrixIndexusvARB\0"
+   "\0"
+   /* _mesa_function_pool[3363]: DrawElementsBaseVertex (will be remapped) */
+   "iiipi\0"
+   "glDrawElementsBaseVertex\0"
+   "\0"
+   /* _mesa_function_pool[3395]: DisableVertexAttribArrayARB (will be remapped) */
+   "i\0"
+   "glDisableVertexAttribArray\0"
+   "glDisableVertexAttribArrayARB\0"
+   "\0"
+   /* _mesa_function_pool[3455]: TexCoord2sv (offset 109) */
+   "p\0"
+   "glTexCoord2sv\0"
+   "\0"
+   /* _mesa_function_pool[3472]: Vertex4dv (offset 143) */
+   "p\0"
+   "glVertex4dv\0"
+   "\0"
+   /* _mesa_function_pool[3487]: StencilMaskSeparate (will be remapped) */
+   "ii\0"
+   "glStencilMaskSeparate\0"
+   "\0"
+   /* _mesa_function_pool[3513]: ProgramLocalParameter4dARB (will be remapped) */
+   "iidddd\0"
+   "glProgramLocalParameter4dARB\0"
+   "\0"
+   /* _mesa_function_pool[3550]: CompressedTexImage3DARB (will be remapped) */
+   "iiiiiiiip\0"
+   "glCompressedTexImage3D\0"
+   "glCompressedTexImage3DARB\0"
+   "\0"
+   /* _mesa_function_pool[3610]: Color3sv (offset 18) */
+   "p\0"
+   "glColor3sv\0"
+   "\0"
+   /* _mesa_function_pool[3624]: GetConvolutionParameteriv (offset 358) */
+   "iip\0"
+   "glGetConvolutionParameteriv\0"
+   "glGetConvolutionParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[3688]: VertexAttrib1fARB (will be remapped) */
+   "if\0"
+   "glVertexAttrib1f\0"
+   "glVertexAttrib1fARB\0"
+   "\0"
+   /* _mesa_function_pool[3729]: Vertex2dv (offset 127) */
+   "p\0"
+   "glVertex2dv\0"
+   "\0"
+   /* _mesa_function_pool[3744]: TestFenceNV (will be remapped) */
+   "i\0"
+   "glTestFenceNV\0"
+   "\0"
+   /* _mesa_function_pool[3761]: MultiTexCoord1fvARB (offset 379) */
+   "ip\0"
+   "glMultiTexCoord1fv\0"
+   "glMultiTexCoord1fvARB\0"
+   "\0"
+   /* _mesa_function_pool[3806]: TexCoord3iv (offset 115) */
+   "p\0"
+   "glTexCoord3iv\0"
+   "\0"
+   /* _mesa_function_pool[3823]: ColorFragmentOp2ATI (will be remapped) */
+   "iiiiiiiiii\0"
+   "glColorFragmentOp2ATI\0"
+   "\0"
+   /* _mesa_function_pool[3857]: SecondaryColorPointerListIBM (dynamic) */
+   "iiipi\0"
+   "glSecondaryColorPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[3895]: GetPixelTexGenParameterivSGIS (will be remapped) */
+   "ip\0"
+   "glGetPixelTexGenParameterivSGIS\0"
+   "\0"
+   /* _mesa_function_pool[3931]: Color3fv (offset 14) */
+   "p\0"
+   "glColor3fv\0"
+   "\0"
+   /* _mesa_function_pool[3945]: VertexAttrib4fNV (will be remapped) */
+   "iffff\0"
+   "glVertexAttrib4fNV\0"
+   "\0"
+   /* _mesa_function_pool[3971]: ReplacementCodeubSUN (dynamic) */
+   "i\0"
+   "glReplacementCodeubSUN\0"
+   "\0"
+   /* _mesa_function_pool[3997]: FinishAsyncSGIX (dynamic) */
+   "p\0"
+   "glFinishAsyncSGIX\0"
+   "\0"
+   /* _mesa_function_pool[4018]: GetDebugLogMESA (dynamic) */
+   "iiiipp\0"
+   "glGetDebugLogMESA\0"
+   "\0"
+   /* _mesa_function_pool[4044]: FogCoorddEXT (will be remapped) */
+   "d\0"
+   "glFogCoordd\0"
+   "glFogCoorddEXT\0"
+   "\0"
+   /* _mesa_function_pool[4074]: Color4ubVertex3fSUN (dynamic) */
+   "iiiifff\0"
+   "glColor4ubVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[4105]: FogCoordfEXT (will be remapped) */
+   "f\0"
+   "glFogCoordf\0"
+   "glFogCoordfEXT\0"
+   "\0"
+   /* _mesa_function_pool[4135]: PointSize (offset 173) */
+   "f\0"
+   "glPointSize\0"
+   "\0"
+   /* _mesa_function_pool[4150]: TexCoord2fVertex3fSUN (dynamic) */
+   "fffff\0"
+   "glTexCoord2fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[4181]: PopName (offset 200) */
+   "\0"
+   "glPopName\0"
+   "\0"
+   /* _mesa_function_pool[4193]: GlobalAlphaFactoriSUN (dynamic) */
+   "i\0"
+   "glGlobalAlphaFactoriSUN\0"
+   "\0"
+   /* _mesa_function_pool[4220]: VertexAttrib2dNV (will be remapped) */
+   "idd\0"
+   "glVertexAttrib2dNV\0"
+   "\0"
+   /* _mesa_function_pool[4244]: GetProgramInfoLog (will be remapped) */
+   "iipp\0"
+   "glGetProgramInfoLog\0"
+   "\0"
+   /* _mesa_function_pool[4270]: VertexAttrib4NbvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4Nbv\0"
+   "glVertexAttrib4NbvARB\0"
+   "\0"
+   /* _mesa_function_pool[4315]: GetActiveAttribARB (will be remapped) */
+   "iiipppp\0"
+   "glGetActiveAttrib\0"
+   "glGetActiveAttribARB\0"
+   "\0"
+   /* _mesa_function_pool[4363]: Vertex4sv (offset 149) */
+   "p\0"
+   "glVertex4sv\0"
+   "\0"
+   /* _mesa_function_pool[4378]: VertexAttrib4ubNV (will be remapped) */
+   "iiiii\0"
+   "glVertexAttrib4ubNV\0"
+   "\0"
+   /* _mesa_function_pool[4405]: TextureRangeAPPLE (will be remapped) */
+   "iip\0"
+   "glTextureRangeAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[4430]: GetTexEnvfv (offset 276) */
+   "iip\0"
+   "glGetTexEnvfv\0"
+   "\0"
+   /* _mesa_function_pool[4449]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+   "ffffffffffff\0"
+   "glTexCoord2fColor4fNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[4502]: Indexub (offset 315) */
+   "i\0"
+   "glIndexub\0"
+   "\0"
+   /* _mesa_function_pool[4515]: TexEnvi (offset 186) */
+   "iii\0"
+   "glTexEnvi\0"
+   "\0"
+   /* _mesa_function_pool[4530]: GetClipPlane (offset 259) */
+   "ip\0"
+   "glGetClipPlane\0"
+   "\0"
+   /* _mesa_function_pool[4549]: CombinerParameterfvNV (will be remapped) */
+   "ip\0"
+   "glCombinerParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[4577]: VertexAttribs3dvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs3dvNV\0"
+   "\0"
+   /* _mesa_function_pool[4603]: VertexAttribs4fvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs4fvNV\0"
+   "\0"
+   /* _mesa_function_pool[4629]: VertexArrayRangeNV (will be remapped) */
+   "ip\0"
+   "glVertexArrayRangeNV\0"
+   "\0"
+   /* _mesa_function_pool[4654]: FragmentLightiSGIX (dynamic) */
+   "iii\0"
+   "glFragmentLightiSGIX\0"
+   "\0"
+   /* _mesa_function_pool[4680]: PolygonOffsetEXT (will be remapped) */
+   "ff\0"
+   "glPolygonOffsetEXT\0"
+   "\0"
+   /* _mesa_function_pool[4703]: PollAsyncSGIX (dynamic) */
+   "p\0"
+   "glPollAsyncSGIX\0"
+   "\0"
+   /* _mesa_function_pool[4722]: DeleteFragmentShaderATI (will be remapped) */
+   "i\0"
+   "glDeleteFragmentShaderATI\0"
+   "\0"
+   /* _mesa_function_pool[4751]: Scaled (offset 301) */
+   "ddd\0"
+   "glScaled\0"
+   "\0"
+   /* _mesa_function_pool[4765]: Scalef (offset 302) */
+   "fff\0"
+   "glScalef\0"
+   "\0"
+   /* _mesa_function_pool[4779]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glTexCoord2fNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[4817]: MultTransposeMatrixdARB (will be remapped) */
+   "p\0"
+   "glMultTransposeMatrixd\0"
+   "glMultTransposeMatrixdARB\0"
+   "\0"
+   /* _mesa_function_pool[4869]: AlphaFunc (offset 240) */
+   "if\0"
+   "glAlphaFunc\0"
+   "\0"
+   /* _mesa_function_pool[4885]: WindowPos2svMESA (will be remapped) */
+   "p\0"
+   "glWindowPos2sv\0"
+   "glWindowPos2svARB\0"
+   "glWindowPos2svMESA\0"
+   "\0"
+   /* _mesa_function_pool[4940]: EdgeFlag (offset 41) */
+   "i\0"
+   "glEdgeFlag\0"
+   "\0"
+   /* _mesa_function_pool[4954]: TexCoord2iv (offset 107) */
+   "p\0"
+   "glTexCoord2iv\0"
+   "\0"
+   /* _mesa_function_pool[4971]: CompressedTexImage1DARB (will be remapped) */
+   "iiiiiip\0"
+   "glCompressedTexImage1D\0"
+   "glCompressedTexImage1DARB\0"
+   "\0"
+   /* _mesa_function_pool[5029]: Rotated (offset 299) */
+   "dddd\0"
+   "glRotated\0"
+   "\0"
+   /* _mesa_function_pool[5045]: VertexAttrib2sNV (will be remapped) */
+   "iii\0"
+   "glVertexAttrib2sNV\0"
+   "\0"
+   /* _mesa_function_pool[5069]: ReadPixels (offset 256) */
+   "iiiiiip\0"
+   "glReadPixels\0"
+   "\0"
+   /* _mesa_function_pool[5091]: EdgeFlagv (offset 42) */
+   "p\0"
+   "glEdgeFlagv\0"
+   "\0"
+   /* _mesa_function_pool[5106]: NormalPointerListIBM (dynamic) */
+   "iipi\0"
+   "glNormalPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[5135]: IndexPointerEXT (will be remapped) */
+   "iiip\0"
+   "glIndexPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[5159]: Color4iv (offset 32) */
+   "p\0"
+   "glColor4iv\0"
+   "\0"
+   /* _mesa_function_pool[5173]: TexParameterf (offset 178) */
+   "iif\0"
+   "glTexParameterf\0"
+   "\0"
+   /* _mesa_function_pool[5194]: TexParameteri (offset 180) */
+   "iii\0"
+   "glTexParameteri\0"
+   "\0"
+   /* _mesa_function_pool[5215]: NormalPointerEXT (will be remapped) */
+   "iiip\0"
+   "glNormalPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[5240]: MultiTexCoord3dARB (offset 392) */
+   "iddd\0"
+   "glMultiTexCoord3d\0"
+   "glMultiTexCoord3dARB\0"
+   "\0"
+   /* _mesa_function_pool[5285]: MultiTexCoord2iARB (offset 388) */
+   "iii\0"
+   "glMultiTexCoord2i\0"
+   "glMultiTexCoord2iARB\0"
+   "\0"
+   /* _mesa_function_pool[5329]: DrawPixels (offset 257) */
+   "iiiip\0"
+   "glDrawPixels\0"
+   "\0"
+   /* _mesa_function_pool[5349]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */
+   "iffffffff\0"
+   "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[5409]: MultiTexCoord2svARB (offset 391) */
+   "ip\0"
+   "glMultiTexCoord2sv\0"
+   "glMultiTexCoord2svARB\0"
+   "\0"
+   /* _mesa_function_pool[5454]: ReplacementCodeubvSUN (dynamic) */
+   "p\0"
+   "glReplacementCodeubvSUN\0"
+   "\0"
+   /* _mesa_function_pool[5481]: Uniform3iARB (will be remapped) */
+   "iiii\0"
+   "glUniform3i\0"
+   "glUniform3iARB\0"
+   "\0"
+   /* _mesa_function_pool[5514]: GetFragmentMaterialfvSGIX (dynamic) */
+   "iip\0"
+   "glGetFragmentMaterialfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[5547]: GetShaderInfoLog (will be remapped) */
+   "iipp\0"
+   "glGetShaderInfoLog\0"
+   "\0"
+   /* _mesa_function_pool[5572]: WeightivARB (dynamic) */
+   "ip\0"
+   "glWeightivARB\0"
+   "\0"
+   /* _mesa_function_pool[5590]: PollInstrumentsSGIX (dynamic) */
+   "p\0"
+   "glPollInstrumentsSGIX\0"
+   "\0"
+   /* _mesa_function_pool[5615]: GlobalAlphaFactordSUN (dynamic) */
+   "d\0"
+   "glGlobalAlphaFactordSUN\0"
+   "\0"
+   /* _mesa_function_pool[5642]: GetFinalCombinerInputParameterfvNV (will be remapped) */
+   "iip\0"
+   "glGetFinalCombinerInputParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[5684]: GenerateMipmapEXT (will be remapped) */
+   "i\0"
+   "glGenerateMipmap\0"
+   "glGenerateMipmapEXT\0"
+   "\0"
+   /* _mesa_function_pool[5724]: GenLists (offset 5) */
+   "i\0"
+   "glGenLists\0"
+   "\0"
+   /* _mesa_function_pool[5738]: SetFragmentShaderConstantATI (will be remapped) */
+   "ip\0"
+   "glSetFragmentShaderConstantATI\0"
+   "\0"
+   /* _mesa_function_pool[5773]: GetMapAttribParameterivNV (dynamic) */
+   "iiip\0"
+   "glGetMapAttribParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[5807]: CreateShaderObjectARB (will be remapped) */
+   "i\0"
+   "glCreateShaderObjectARB\0"
+   "\0"
+   /* _mesa_function_pool[5834]: GetSharpenTexFuncSGIS (dynamic) */
+   "ip\0"
+   "glGetSharpenTexFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[5862]: BufferDataARB (will be remapped) */
+   "iipi\0"
+   "glBufferData\0"
+   "glBufferDataARB\0"
+   "\0"
+   /* _mesa_function_pool[5897]: FlushVertexArrayRangeNV (will be remapped) */
+   "\0"
+   "glFlushVertexArrayRangeNV\0"
+   "\0"
+   /* _mesa_function_pool[5925]: MapGrid2d (offset 226) */
+   "iddidd\0"
+   "glMapGrid2d\0"
+   "\0"
+   /* _mesa_function_pool[5945]: MapGrid2f (offset 227) */
+   "iffiff\0"
+   "glMapGrid2f\0"
+   "\0"
+   /* _mesa_function_pool[5965]: SampleMapATI (will be remapped) */
+   "iii\0"
+   "glSampleMapATI\0"
+   "\0"
+   /* _mesa_function_pool[5985]: VertexPointerEXT (will be remapped) */
+   "iiiip\0"
+   "glVertexPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[6011]: GetTexFilterFuncSGIS (dynamic) */
+   "iip\0"
+   "glGetTexFilterFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[6039]: Scissor (offset 176) */
+   "iiii\0"
+   "glScissor\0"
+   "\0"
+   /* _mesa_function_pool[6055]: Fogf (offset 153) */
+   "if\0"
+   "glFogf\0"
+   "\0"
+   /* _mesa_function_pool[6066]: GetCombinerOutputParameterfvNV (will be remapped) */
+   "iiip\0"
+   "glGetCombinerOutputParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[6105]: TexSubImage1D (offset 332) */
+   "iiiiiip\0"
+   "glTexSubImage1D\0"
+   "glTexSubImage1DEXT\0"
+   "\0"
+   /* _mesa_function_pool[6149]: VertexAttrib1sARB (will be remapped) */
+   "ii\0"
+   "glVertexAttrib1s\0"
+   "glVertexAttrib1sARB\0"
+   "\0"
+   /* _mesa_function_pool[6190]: FenceSync (will be remapped) */
+   "ii\0"
+   "glFenceSync\0"
+   "\0"
+   /* _mesa_function_pool[6206]: Color4usv (offset 40) */
+   "p\0"
+   "glColor4usv\0"
+   "\0"
+   /* _mesa_function_pool[6221]: Fogi (offset 155) */
+   "ii\0"
+   "glFogi\0"
+   "\0"
+   /* _mesa_function_pool[6232]: DepthRange (offset 288) */
+   "dd\0"
+   "glDepthRange\0"
+   "\0"
+   /* _mesa_function_pool[6249]: RasterPos3iv (offset 75) */
+   "p\0"
+   "glRasterPos3iv\0"
+   "\0"
+   /* _mesa_function_pool[6267]: FinalCombinerInputNV (will be remapped) */
+   "iiii\0"
+   "glFinalCombinerInputNV\0"
+   "\0"
+   /* _mesa_function_pool[6296]: TexCoord2i (offset 106) */
+   "ii\0"
+   "glTexCoord2i\0"
+   "\0"
+   /* _mesa_function_pool[6313]: PixelMapfv (offset 251) */
+   "iip\0"
+   "glPixelMapfv\0"
+   "\0"
+   /* _mesa_function_pool[6331]: Color4ui (offset 37) */
+   "iiii\0"
+   "glColor4ui\0"
+   "\0"
+   /* _mesa_function_pool[6348]: RasterPos3s (offset 76) */
+   "iii\0"
+   "glRasterPos3s\0"
+   "\0"
+   /* _mesa_function_pool[6367]: Color3usv (offset 24) */
+   "p\0"
+   "glColor3usv\0"
+   "\0"
+   /* _mesa_function_pool[6382]: FlushRasterSGIX (dynamic) */
+   "\0"
+   "glFlushRasterSGIX\0"
+   "\0"
+   /* _mesa_function_pool[6402]: TexCoord2f (offset 104) */
+   "ff\0"
+   "glTexCoord2f\0"
+   "\0"
+   /* _mesa_function_pool[6419]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */
+   "ifffff\0"
+   "glReplacementCodeuiTexCoord2fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[6468]: TexCoord2d (offset 102) */
+   "dd\0"
+   "glTexCoord2d\0"
+   "\0"
+   /* _mesa_function_pool[6485]: RasterPos3d (offset 70) */
+   "ddd\0"
+   "glRasterPos3d\0"
+   "\0"
+   /* _mesa_function_pool[6504]: RasterPos3f (offset 72) */
+   "fff\0"
+   "glRasterPos3f\0"
+   "\0"
+   /* _mesa_function_pool[6523]: Uniform1fARB (will be remapped) */
+   "if\0"
+   "glUniform1f\0"
+   "glUniform1fARB\0"
+   "\0"
+   /* _mesa_function_pool[6554]: AreTexturesResident (offset 322) */
+   "ipp\0"
+   "glAreTexturesResident\0"
+   "glAreTexturesResidentEXT\0"
+   "\0"
+   /* _mesa_function_pool[6606]: TexCoord2s (offset 108) */
+   "ii\0"
+   "glTexCoord2s\0"
+   "\0"
+   /* _mesa_function_pool[6623]: StencilOpSeparate (will be remapped) */
+   "iiii\0"
+   "glStencilOpSeparate\0"
+   "glStencilOpSeparateATI\0"
+   "\0"
+   /* _mesa_function_pool[6672]: ColorTableParameteriv (offset 341) */
+   "iip\0"
+   "glColorTableParameteriv\0"
+   "glColorTableParameterivSGI\0"
+   "\0"
+   /* _mesa_function_pool[6728]: FogCoordPointerListIBM (dynamic) */
+   "iipi\0"
+   "glFogCoordPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[6759]: WindowPos3dMESA (will be remapped) */
+   "ddd\0"
+   "glWindowPos3d\0"
+   "glWindowPos3dARB\0"
+   "glWindowPos3dMESA\0"
+   "\0"
+   /* _mesa_function_pool[6813]: Color4us (offset 39) */
+   "iiii\0"
+   "glColor4us\0"
+   "\0"
+   /* _mesa_function_pool[6830]: PointParameterfvEXT (will be remapped) */
+   "ip\0"
+   "glPointParameterfv\0"
+   "glPointParameterfvARB\0"
+   "glPointParameterfvEXT\0"
+   "glPointParameterfvSGIS\0"
+   "\0"
+   /* _mesa_function_pool[6920]: Color3bv (offset 10) */
+   "p\0"
+   "glColor3bv\0"
+   "\0"
+   /* _mesa_function_pool[6934]: WindowPos2fvMESA (will be remapped) */
+   "p\0"
+   "glWindowPos2fv\0"
+   "glWindowPos2fvARB\0"
+   "glWindowPos2fvMESA\0"
+   "\0"
+   /* _mesa_function_pool[6989]: SecondaryColor3bvEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3bv\0"
+   "glSecondaryColor3bvEXT\0"
+   "\0"
+   /* _mesa_function_pool[7035]: VertexPointerListIBM (dynamic) */
+   "iiipi\0"
+   "glVertexPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[7065]: GetProgramLocalParameterfvARB (will be remapped) */
+   "iip\0"
+   "glGetProgramLocalParameterfvARB\0"
+   "\0"
+   /* _mesa_function_pool[7102]: FragmentMaterialfSGIX (dynamic) */
+   "iif\0"
+   "glFragmentMaterialfSGIX\0"
+   "\0"
+   /* _mesa_function_pool[7131]: TexCoord2fNormal3fVertex3fSUN (dynamic) */
+   "ffffffff\0"
+   "glTexCoord2fNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[7173]: RenderbufferStorageEXT (will be remapped) */
+   "iiii\0"
+   "glRenderbufferStorage\0"
+   "glRenderbufferStorageEXT\0"
+   "\0"
+   /* _mesa_function_pool[7226]: IsFenceNV (will be remapped) */
+   "i\0"
+   "glIsFenceNV\0"
+   "\0"
+   /* _mesa_function_pool[7241]: AttachObjectARB (will be remapped) */
+   "ii\0"
+   "glAttachObjectARB\0"
+   "\0"
+   /* _mesa_function_pool[7263]: GetFragmentLightivSGIX (dynamic) */
+   "iip\0"
+   "glGetFragmentLightivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[7293]: UniformMatrix2fvARB (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix2fv\0"
+   "glUniformMatrix2fvARB\0"
+   "\0"
+   /* _mesa_function_pool[7340]: MultiTexCoord2fARB (offset 386) */
+   "iff\0"
+   "glMultiTexCoord2f\0"
+   "glMultiTexCoord2fARB\0"
+   "\0"
+   /* _mesa_function_pool[7384]: ColorTable (offset 339) */
+   "iiiiip\0"
+   "glColorTable\0"
+   "glColorTableSGI\0"
+   "glColorTableEXT\0"
+   "\0"
+   /* _mesa_function_pool[7437]: IndexPointer (offset 314) */
+   "iip\0"
+   "glIndexPointer\0"
+   "\0"
+   /* _mesa_function_pool[7457]: Accum (offset 213) */
+   "if\0"
+   "glAccum\0"
+   "\0"
+   /* _mesa_function_pool[7469]: GetTexImage (offset 281) */
+   "iiiip\0"
+   "glGetTexImage\0"
+   "\0"
+   /* _mesa_function_pool[7490]: MapControlPointsNV (dynamic) */
+   "iiiiiiiip\0"
+   "glMapControlPointsNV\0"
+   "\0"
+   /* _mesa_function_pool[7522]: ConvolutionFilter2D (offset 349) */
+   "iiiiiip\0"
+   "glConvolutionFilter2D\0"
+   "glConvolutionFilter2DEXT\0"
+   "\0"
+   /* _mesa_function_pool[7578]: Finish (offset 216) */
+   "\0"
+   "glFinish\0"
+   "\0"
+   /* _mesa_function_pool[7589]: MapParameterfvNV (dynamic) */
+   "iip\0"
+   "glMapParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[7613]: ClearStencil (offset 207) */
+   "i\0"
+   "glClearStencil\0"
+   "\0"
+   /* _mesa_function_pool[7631]: VertexAttrib3dvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib3dv\0"
+   "glVertexAttrib3dvARB\0"
+   "\0"
+   /* _mesa_function_pool[7674]: HintPGI (dynamic) */
+   "ii\0"
+   "glHintPGI\0"
+   "\0"
+   /* _mesa_function_pool[7688]: ConvolutionParameteriv (offset 353) */
+   "iip\0"
+   "glConvolutionParameteriv\0"
+   "glConvolutionParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[7746]: Color4s (offset 33) */
+   "iiii\0"
+   "glColor4s\0"
+   "\0"
+   /* _mesa_function_pool[7762]: InterleavedArrays (offset 317) */
+   "iip\0"
+   "glInterleavedArrays\0"
+   "\0"
+   /* _mesa_function_pool[7787]: RasterPos2fv (offset 65) */
+   "p\0"
+   "glRasterPos2fv\0"
+   "\0"
+   /* _mesa_function_pool[7805]: TexCoord1fv (offset 97) */
+   "p\0"
+   "glTexCoord1fv\0"
+   "\0"
+   /* _mesa_function_pool[7822]: Vertex2d (offset 126) */
+   "dd\0"
+   "glVertex2d\0"
+   "\0"
+   /* _mesa_function_pool[7837]: CullParameterdvEXT (will be remapped) */
+   "ip\0"
+   "glCullParameterdvEXT\0"
+   "\0"
+   /* _mesa_function_pool[7862]: ProgramNamedParameter4fNV (will be remapped) */
+   "iipffff\0"
+   "glProgramNamedParameter4fNV\0"
+   "\0"
+   /* _mesa_function_pool[7899]: Color3fVertex3fSUN (dynamic) */
+   "ffffff\0"
+   "glColor3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[7928]: ProgramEnvParameter4fvARB (will be remapped) */
+   "iip\0"
+   "glProgramEnvParameter4fvARB\0"
+   "glProgramParameter4fvNV\0"
+   "\0"
+   /* _mesa_function_pool[7985]: Color4i (offset 31) */
+   "iiii\0"
+   "glColor4i\0"
+   "\0"
+   /* _mesa_function_pool[8001]: Color4f (offset 29) */
+   "ffff\0"
+   "glColor4f\0"
+   "\0"
+   /* _mesa_function_pool[8017]: RasterPos4fv (offset 81) */
+   "p\0"
+   "glRasterPos4fv\0"
+   "\0"
+   /* _mesa_function_pool[8035]: Color4d (offset 27) */
+   "dddd\0"
+   "glColor4d\0"
+   "\0"
+   /* _mesa_function_pool[8051]: ClearIndex (offset 205) */
+   "f\0"
+   "glClearIndex\0"
+   "\0"
+   /* _mesa_function_pool[8067]: Color4b (offset 25) */
+   "iiii\0"
+   "glColor4b\0"
+   "\0"
+   /* _mesa_function_pool[8083]: LoadMatrixd (offset 292) */
+   "p\0"
+   "glLoadMatrixd\0"
+   "\0"
+   /* _mesa_function_pool[8100]: FragmentLightModeliSGIX (dynamic) */
+   "ii\0"
+   "glFragmentLightModeliSGIX\0"
+   "\0"
+   /* _mesa_function_pool[8130]: RasterPos2dv (offset 63) */
+   "p\0"
+   "glRasterPos2dv\0"
+   "\0"
+   /* _mesa_function_pool[8148]: ConvolutionParameterfv (offset 351) */
+   "iip\0"
+   "glConvolutionParameterfv\0"
+   "glConvolutionParameterfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[8206]: TbufferMask3DFX (dynamic) */
+   "i\0"
+   "glTbufferMask3DFX\0"
+   "\0"
+   /* _mesa_function_pool[8227]: GetTexGendv (offset 278) */
+   "iip\0"
+   "glGetTexGendv\0"
+   "\0"
+   /* _mesa_function_pool[8246]: LoadProgramNV (will be remapped) */
+   "iiip\0"
+   "glLoadProgramNV\0"
+   "\0"
+   /* _mesa_function_pool[8268]: WaitSync (will be remapped) */
+   "iii\0"
+   "glWaitSync\0"
+   "\0"
+   /* _mesa_function_pool[8284]: EndList (offset 1) */
+   "\0"
+   "glEndList\0"
+   "\0"
+   /* _mesa_function_pool[8296]: VertexAttrib4fvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4fvNV\0"
+   "\0"
+   /* _mesa_function_pool[8320]: GetAttachedObjectsARB (will be remapped) */
+   "iipp\0"
+   "glGetAttachedObjectsARB\0"
+   "\0"
+   /* _mesa_function_pool[8350]: Uniform3fvARB (will be remapped) */
+   "iip\0"
+   "glUniform3fv\0"
+   "glUniform3fvARB\0"
+   "\0"
+   /* _mesa_function_pool[8384]: EvalCoord1fv (offset 231) */
+   "p\0"
+   "glEvalCoord1fv\0"
+   "\0"
+   /* _mesa_function_pool[8402]: DrawRangeElements (offset 338) */
+   "iiiiip\0"
+   "glDrawRangeElements\0"
+   "glDrawRangeElementsEXT\0"
+   "\0"
+   /* _mesa_function_pool[8453]: EvalMesh2 (offset 238) */
+   "iiiii\0"
+   "glEvalMesh2\0"
+   "\0"
+   /* _mesa_function_pool[8472]: Vertex4fv (offset 145) */
+   "p\0"
+   "glVertex4fv\0"
+   "\0"
+   /* _mesa_function_pool[8487]: SpriteParameterfvSGIX (dynamic) */
+   "ip\0"
+   "glSpriteParameterfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[8515]: CheckFramebufferStatusEXT (will be remapped) */
+   "i\0"
+   "glCheckFramebufferStatus\0"
+   "glCheckFramebufferStatusEXT\0"
+   "\0"
+   /* _mesa_function_pool[8571]: GlobalAlphaFactoruiSUN (dynamic) */
+   "i\0"
+   "glGlobalAlphaFactoruiSUN\0"
+   "\0"
+   /* _mesa_function_pool[8599]: GetHandleARB (will be remapped) */
+   "i\0"
+   "glGetHandleARB\0"
+   "\0"
+   /* _mesa_function_pool[8617]: GetVertexAttribivARB (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribiv\0"
+   "glGetVertexAttribivARB\0"
+   "\0"
+   /* _mesa_function_pool[8665]: GetCombinerInputParameterfvNV (will be remapped) */
+   "iiiip\0"
+   "glGetCombinerInputParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[8704]: CreateProgram (will be remapped) */
+   "\0"
+   "glCreateProgram\0"
+   "\0"
+   /* _mesa_function_pool[8722]: LoadTransposeMatrixdARB (will be remapped) */
+   "p\0"
+   "glLoadTransposeMatrixd\0"
+   "glLoadTransposeMatrixdARB\0"
+   "\0"
+   /* _mesa_function_pool[8774]: GetMinmax (offset 364) */
+   "iiiip\0"
+   "glGetMinmax\0"
+   "glGetMinmaxEXT\0"
+   "\0"
+   /* _mesa_function_pool[8808]: StencilFuncSeparate (will be remapped) */
+   "iiii\0"
+   "glStencilFuncSeparate\0"
+   "\0"
+   /* _mesa_function_pool[8836]: SecondaryColor3sEXT (will be remapped) */
+   "iii\0"
+   "glSecondaryColor3s\0"
+   "glSecondaryColor3sEXT\0"
+   "\0"
+   /* _mesa_function_pool[8882]: Color3fVertex3fvSUN (dynamic) */
+   "pp\0"
+   "glColor3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[8908]: Normal3fv (offset 57) */
+   "p\0"
+   "glNormal3fv\0"
+   "\0"
+   /* _mesa_function_pool[8923]: GlobalAlphaFactorbSUN (dynamic) */
+   "i\0"
+   "glGlobalAlphaFactorbSUN\0"
+   "\0"
+   /* _mesa_function_pool[8950]: Color3us (offset 23) */
+   "iii\0"
+   "glColor3us\0"
+   "\0"
+   /* _mesa_function_pool[8966]: ImageTransformParameterfvHP (dynamic) */
+   "iip\0"
+   "glImageTransformParameterfvHP\0"
+   "\0"
+   /* _mesa_function_pool[9001]: VertexAttrib4ivARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4iv\0"
+   "glVertexAttrib4ivARB\0"
+   "\0"
+   /* _mesa_function_pool[9044]: End (offset 43) */
+   "\0"
+   "glEnd\0"
+   "\0"
+   /* _mesa_function_pool[9052]: VertexAttrib3fNV (will be remapped) */
+   "ifff\0"
+   "glVertexAttrib3fNV\0"
+   "\0"
+   /* _mesa_function_pool[9077]: VertexAttribs2dvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs2dvNV\0"
+   "\0"
+   /* _mesa_function_pool[9103]: GetQueryObjectui64vEXT (will be remapped) */
+   "iip\0"
+   "glGetQueryObjectui64vEXT\0"
+   "\0"
+   /* _mesa_function_pool[9133]: MultiTexCoord3fvARB (offset 395) */
+   "ip\0"
+   "glMultiTexCoord3fv\0"
+   "glMultiTexCoord3fvARB\0"
+   "\0"
+   /* _mesa_function_pool[9178]: SecondaryColor3dEXT (will be remapped) */
+   "ddd\0"
+   "glSecondaryColor3d\0"
+   "glSecondaryColor3dEXT\0"
+   "\0"
+   /* _mesa_function_pool[9224]: Color3ub (offset 19) */
+   "iii\0"
+   "glColor3ub\0"
+   "\0"
+   /* _mesa_function_pool[9240]: GetProgramParameterfvNV (will be remapped) */
+   "iiip\0"
+   "glGetProgramParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[9272]: TangentPointerEXT (dynamic) */
+   "iip\0"
+   "glTangentPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[9297]: Color4fNormal3fVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glColor4fNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[9332]: GetInstrumentsSGIX (dynamic) */
+   "\0"
+   "glGetInstrumentsSGIX\0"
+   "\0"
+   /* _mesa_function_pool[9355]: Color3ui (offset 21) */
+   "iii\0"
+   "glColor3ui\0"
+   "\0"
+   /* _mesa_function_pool[9371]: EvalMapsNV (dynamic) */
+   "ii\0"
+   "glEvalMapsNV\0"
+   "\0"
+   /* _mesa_function_pool[9388]: TexSubImage2D (offset 333) */
+   "iiiiiiiip\0"
+   "glTexSubImage2D\0"
+   "glTexSubImage2DEXT\0"
+   "\0"
+   /* _mesa_function_pool[9434]: FragmentLightivSGIX (dynamic) */
+   "iip\0"
+   "glFragmentLightivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[9461]: GetTexParameterPointervAPPLE (will be remapped) */
+   "iip\0"
+   "glGetTexParameterPointervAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[9497]: TexGenfv (offset 191) */
+   "iip\0"
+   "glTexGenfv\0"
+   "\0"
+   /* _mesa_function_pool[9513]: PixelTransformParameterfvEXT (dynamic) */
+   "iip\0"
+   "glPixelTransformParameterfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[9549]: VertexAttrib4bvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4bv\0"
+   "glVertexAttrib4bvARB\0"
+   "\0"
+   /* _mesa_function_pool[9592]: AlphaFragmentOp2ATI (will be remapped) */
+   "iiiiiiiii\0"
+   "glAlphaFragmentOp2ATI\0"
+   "\0"
+   /* _mesa_function_pool[9625]: MultiTexCoord4sARB (offset 406) */
+   "iiiii\0"
+   "glMultiTexCoord4s\0"
+   "glMultiTexCoord4sARB\0"
+   "\0"
+   /* _mesa_function_pool[9671]: GetFragmentMaterialivSGIX (dynamic) */
+   "iip\0"
+   "glGetFragmentMaterialivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[9704]: WindowPos4dMESA (will be remapped) */
+   "dddd\0"
+   "glWindowPos4dMESA\0"
+   "\0"
+   /* _mesa_function_pool[9728]: WeightPointerARB (dynamic) */
+   "iiip\0"
+   "glWeightPointerARB\0"
+   "\0"
+   /* _mesa_function_pool[9753]: WindowPos2dMESA (will be remapped) */
+   "dd\0"
+   "glWindowPos2d\0"
+   "glWindowPos2dARB\0"
+   "glWindowPos2dMESA\0"
+   "\0"
+   /* _mesa_function_pool[9806]: FramebufferTexture3DEXT (will be remapped) */
+   "iiiiii\0"
+   "glFramebufferTexture3D\0"
+   "glFramebufferTexture3DEXT\0"
+   "\0"
+   /* _mesa_function_pool[9863]: BlendEquation (offset 337) */
+   "i\0"
+   "glBlendEquation\0"
+   "glBlendEquationEXT\0"
+   "\0"
+   /* _mesa_function_pool[9901]: VertexAttrib3dNV (will be remapped) */
+   "iddd\0"
+   "glVertexAttrib3dNV\0"
+   "\0"
+   /* _mesa_function_pool[9926]: VertexAttrib3dARB (will be remapped) */
+   "iddd\0"
+   "glVertexAttrib3d\0"
+   "glVertexAttrib3dARB\0"
+   "\0"
+   /* _mesa_function_pool[9969]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+   "ppppp\0"
+   "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[10033]: VertexAttrib4fARB (will be remapped) */
+   "iffff\0"
+   "glVertexAttrib4f\0"
+   "glVertexAttrib4fARB\0"
+   "\0"
+   /* _mesa_function_pool[10077]: GetError (offset 261) */
+   "\0"
+   "glGetError\0"
+   "\0"
+   /* _mesa_function_pool[10090]: IndexFuncEXT (dynamic) */
+   "if\0"
+   "glIndexFuncEXT\0"
+   "\0"
+   /* _mesa_function_pool[10109]: TexCoord3dv (offset 111) */
+   "p\0"
+   "glTexCoord3dv\0"
+   "\0"
+   /* _mesa_function_pool[10126]: Indexdv (offset 45) */
+   "p\0"
+   "glIndexdv\0"
+   "\0"
+   /* _mesa_function_pool[10139]: FramebufferTexture2DEXT (will be remapped) */
+   "iiiii\0"
+   "glFramebufferTexture2D\0"
+   "glFramebufferTexture2DEXT\0"
+   "\0"
+   /* _mesa_function_pool[10195]: Normal3s (offset 60) */
+   "iii\0"
+   "glNormal3s\0"
+   "\0"
+   /* _mesa_function_pool[10211]: PushName (offset 201) */
+   "i\0"
+   "glPushName\0"
+   "\0"
+   /* _mesa_function_pool[10225]: MultiTexCoord2dvARB (offset 385) */
+   "ip\0"
+   "glMultiTexCoord2dv\0"
+   "glMultiTexCoord2dvARB\0"
+   "\0"
+   /* _mesa_function_pool[10270]: CullParameterfvEXT (will be remapped) */
+   "ip\0"
+   "glCullParameterfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[10295]: Normal3i (offset 58) */
+   "iii\0"
+   "glNormal3i\0"
+   "\0"
+   /* _mesa_function_pool[10311]: ProgramNamedParameter4fvNV (will be remapped) */
+   "iipp\0"
+   "glProgramNamedParameter4fvNV\0"
+   "\0"
+   /* _mesa_function_pool[10346]: SecondaryColorPointerEXT (will be remapped) */
+   "iiip\0"
+   "glSecondaryColorPointer\0"
+   "glSecondaryColorPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[10403]: VertexAttrib4fvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4fv\0"
+   "glVertexAttrib4fvARB\0"
+   "\0"
+   /* _mesa_function_pool[10446]: ColorPointerListIBM (dynamic) */
+   "iiipi\0"
+   "glColorPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[10475]: GetActiveUniformARB (will be remapped) */
+   "iiipppp\0"
+   "glGetActiveUniform\0"
+   "glGetActiveUniformARB\0"
+   "\0"
+   /* _mesa_function_pool[10525]: ImageTransformParameteriHP (dynamic) */
+   "iii\0"
+   "glImageTransformParameteriHP\0"
+   "\0"
+   /* _mesa_function_pool[10559]: Normal3b (offset 52) */
+   "iii\0"
+   "glNormal3b\0"
+   "\0"
+   /* _mesa_function_pool[10575]: Normal3d (offset 54) */
+   "ddd\0"
+   "glNormal3d\0"
+   "\0"
+   /* _mesa_function_pool[10591]: Normal3f (offset 56) */
+   "fff\0"
+   "glNormal3f\0"
+   "\0"
+   /* _mesa_function_pool[10607]: MultiTexCoord1svARB (offset 383) */
+   "ip\0"
+   "glMultiTexCoord1sv\0"
+   "glMultiTexCoord1svARB\0"
+   "\0"
+   /* _mesa_function_pool[10652]: Indexi (offset 48) */
+   "i\0"
+   "glIndexi\0"
+   "\0"
+   /* _mesa_function_pool[10664]: EndQueryARB (will be remapped) */
+   "i\0"
+   "glEndQuery\0"
+   "glEndQueryARB\0"
+   "\0"
+   /* _mesa_function_pool[10692]: DeleteFencesNV (will be remapped) */
+   "ip\0"
+   "glDeleteFencesNV\0"
+   "\0"
+   /* _mesa_function_pool[10713]: DeformationMap3dSGIX (dynamic) */
+   "iddiiddiiddiip\0"
+   "glDeformationMap3dSGIX\0"
+   "\0"
+   /* _mesa_function_pool[10752]: DepthMask (offset 211) */
+   "i\0"
+   "glDepthMask\0"
+   "\0"
+   /* _mesa_function_pool[10767]: IsShader (will be remapped) */
+   "i\0"
+   "glIsShader\0"
+   "\0"
+   /* _mesa_function_pool[10781]: Indexf (offset 46) */
+   "f\0"
+   "glIndexf\0"
+   "\0"
+   /* _mesa_function_pool[10793]: GetImageTransformParameterivHP (dynamic) */
+   "iip\0"
+   "glGetImageTransformParameterivHP\0"
+   "\0"
+   /* _mesa_function_pool[10831]: Indexd (offset 44) */
+   "d\0"
+   "glIndexd\0"
+   "\0"
+   /* _mesa_function_pool[10843]: GetMaterialiv (offset 270) */
+   "iip\0"
+   "glGetMaterialiv\0"
+   "\0"
+   /* _mesa_function_pool[10864]: StencilOp (offset 244) */
+   "iii\0"
+   "glStencilOp\0"
+   "\0"
+   /* _mesa_function_pool[10881]: WindowPos4ivMESA (will be remapped) */
+   "p\0"
+   "glWindowPos4ivMESA\0"
+   "\0"
+   /* _mesa_function_pool[10903]: MultiTexCoord3svARB (offset 399) */
+   "ip\0"
+   "glMultiTexCoord3sv\0"
+   "glMultiTexCoord3svARB\0"
+   "\0"
+   /* _mesa_function_pool[10948]: TexEnvfv (offset 185) */
+   "iip\0"
+   "glTexEnvfv\0"
+   "\0"
+   /* _mesa_function_pool[10964]: MultiTexCoord4iARB (offset 404) */
+   "iiiii\0"
+   "glMultiTexCoord4i\0"
+   "glMultiTexCoord4iARB\0"
+   "\0"
+   /* _mesa_function_pool[11010]: Indexs (offset 50) */
+   "i\0"
+   "glIndexs\0"
+   "\0"
+   /* _mesa_function_pool[11022]: Binormal3ivEXT (dynamic) */
+   "p\0"
+   "glBinormal3ivEXT\0"
+   "\0"
+   /* _mesa_function_pool[11042]: ResizeBuffersMESA (will be remapped) */
+   "\0"
+   "glResizeBuffersMESA\0"
+   "\0"
+   /* _mesa_function_pool[11064]: GetUniformivARB (will be remapped) */
+   "iip\0"
+   "glGetUniformiv\0"
+   "glGetUniformivARB\0"
+   "\0"
+   /* _mesa_function_pool[11102]: PixelTexGenParameteriSGIS (will be remapped) */
+   "ii\0"
+   "glPixelTexGenParameteriSGIS\0"
+   "\0"
+   /* _mesa_function_pool[11134]: VertexPointervINTEL (dynamic) */
+   "iip\0"
+   "glVertexPointervINTEL\0"
+   "\0"
+   /* _mesa_function_pool[11161]: Vertex2i (offset 130) */
+   "ii\0"
+   "glVertex2i\0"
+   "\0"
+   /* _mesa_function_pool[11176]: LoadMatrixf (offset 291) */
+   "p\0"
+   "glLoadMatrixf\0"
+   "\0"
+   /* _mesa_function_pool[11193]: Vertex2f (offset 128) */
+   "ff\0"
+   "glVertex2f\0"
+   "\0"
+   /* _mesa_function_pool[11208]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
+   "pppp\0"
+   "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[11261]: Color4bv (offset 26) */
+   "p\0"
+   "glColor4bv\0"
+   "\0"
+   /* _mesa_function_pool[11275]: VertexPointer (offset 321) */
+   "iiip\0"
+   "glVertexPointer\0"
+   "\0"
+   /* _mesa_function_pool[11297]: SecondaryColor3uiEXT (will be remapped) */
+   "iii\0"
+   "glSecondaryColor3ui\0"
+   "glSecondaryColor3uiEXT\0"
+   "\0"
+   /* _mesa_function_pool[11345]: StartInstrumentsSGIX (dynamic) */
+   "\0"
+   "glStartInstrumentsSGIX\0"
+   "\0"
+   /* _mesa_function_pool[11370]: SecondaryColor3usvEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3usv\0"
+   "glSecondaryColor3usvEXT\0"
+   "\0"
+   /* _mesa_function_pool[11418]: VertexAttrib2fvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib2fvNV\0"
+   "\0"
+   /* _mesa_function_pool[11442]: ProgramLocalParameter4dvARB (will be remapped) */
+   "iip\0"
+   "glProgramLocalParameter4dvARB\0"
+   "\0"
+   /* _mesa_function_pool[11477]: DeleteLists (offset 4) */
+   "ii\0"
+   "glDeleteLists\0"
+   "\0"
+   /* _mesa_function_pool[11495]: LogicOp (offset 242) */
+   "i\0"
+   "glLogicOp\0"
+   "\0"
+   /* _mesa_function_pool[11508]: MatrixIndexuivARB (dynamic) */
+   "ip\0"
+   "glMatrixIndexuivARB\0"
+   "\0"
+   /* _mesa_function_pool[11532]: Vertex2s (offset 132) */
+   "ii\0"
+   "glVertex2s\0"
+   "\0"
+   /* _mesa_function_pool[11547]: RenderbufferStorageMultisample (will be remapped) */
+   "iiiii\0"
+   "glRenderbufferStorageMultisample\0"
+   "glRenderbufferStorageMultisampleEXT\0"
+   "\0"
+   /* _mesa_function_pool[11623]: TexCoord4fv (offset 121) */
+   "p\0"
+   "glTexCoord4fv\0"
+   "\0"
+   /* _mesa_function_pool[11640]: Tangent3sEXT (dynamic) */
+   "iii\0"
+   "glTangent3sEXT\0"
+   "\0"
+   /* _mesa_function_pool[11660]: GlobalAlphaFactorfSUN (dynamic) */
+   "f\0"
+   "glGlobalAlphaFactorfSUN\0"
+   "\0"
+   /* _mesa_function_pool[11687]: MultiTexCoord3iARB (offset 396) */
+   "iiii\0"
+   "glMultiTexCoord3i\0"
+   "glMultiTexCoord3iARB\0"
+   "\0"
+   /* _mesa_function_pool[11732]: IsProgram (will be remapped) */
+   "i\0"
+   "glIsProgram\0"
+   "\0"
+   /* _mesa_function_pool[11747]: TexCoordPointerListIBM (dynamic) */
+   "iiipi\0"
+   "glTexCoordPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[11779]: GlobalAlphaFactorusSUN (dynamic) */
+   "i\0"
+   "glGlobalAlphaFactorusSUN\0"
+   "\0"
+   /* _mesa_function_pool[11807]: VertexAttrib2dvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib2dvNV\0"
+   "\0"
+   /* _mesa_function_pool[11831]: FramebufferRenderbufferEXT (will be remapped) */
+   "iiii\0"
+   "glFramebufferRenderbuffer\0"
+   "glFramebufferRenderbufferEXT\0"
+   "\0"
+   /* _mesa_function_pool[11892]: VertexAttrib1dvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib1dvNV\0"
+   "\0"
+   /* _mesa_function_pool[11916]: GenTextures (offset 328) */
+   "ip\0"
+   "glGenTextures\0"
+   "glGenTexturesEXT\0"
+   "\0"
+   /* _mesa_function_pool[11951]: SetFenceNV (will be remapped) */
+   "ii\0"
+   "glSetFenceNV\0"
+   "\0"
+   /* _mesa_function_pool[11968]: FramebufferTexture1DEXT (will be remapped) */
+   "iiiii\0"
+   "glFramebufferTexture1D\0"
+   "glFramebufferTexture1DEXT\0"
+   "\0"
+   /* _mesa_function_pool[12024]: GetCombinerOutputParameterivNV (will be remapped) */
+   "iiip\0"
+   "glGetCombinerOutputParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[12063]: PixelTexGenParameterivSGIS (will be remapped) */
+   "ip\0"
+   "glPixelTexGenParameterivSGIS\0"
+   "\0"
+   /* _mesa_function_pool[12096]: TextureNormalEXT (dynamic) */
+   "i\0"
+   "glTextureNormalEXT\0"
+   "\0"
+   /* _mesa_function_pool[12118]: IndexPointerListIBM (dynamic) */
+   "iipi\0"
+   "glIndexPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[12146]: WeightfvARB (dynamic) */
+   "ip\0"
+   "glWeightfvARB\0"
+   "\0"
+   /* _mesa_function_pool[12164]: RasterPos2sv (offset 69) */
+   "p\0"
+   "glRasterPos2sv\0"
+   "\0"
+   /* _mesa_function_pool[12182]: Color4ubv (offset 36) */
+   "p\0"
+   "glColor4ubv\0"
+   "\0"
+   /* _mesa_function_pool[12197]: DrawBuffer (offset 202) */
+   "i\0"
+   "glDrawBuffer\0"
+   "\0"
+   /* _mesa_function_pool[12213]: TexCoord2fv (offset 105) */
+   "p\0"
+   "glTexCoord2fv\0"
+   "\0"
+   /* _mesa_function_pool[12230]: WindowPos4fMESA (will be remapped) */
+   "ffff\0"
+   "glWindowPos4fMESA\0"
+   "\0"
+   /* _mesa_function_pool[12254]: TexCoord1sv (offset 101) */
+   "p\0"
+   "glTexCoord1sv\0"
+   "\0"
+   /* _mesa_function_pool[12271]: WindowPos3dvMESA (will be remapped) */
+   "p\0"
+   "glWindowPos3dv\0"
+   "glWindowPos3dvARB\0"
+   "glWindowPos3dvMESA\0"
+   "\0"
+   /* _mesa_function_pool[12326]: DepthFunc (offset 245) */
+   "i\0"
+   "glDepthFunc\0"
+   "\0"
+   /* _mesa_function_pool[12341]: PixelMapusv (offset 253) */
+   "iip\0"
+   "glPixelMapusv\0"
+   "\0"
+   /* _mesa_function_pool[12360]: GetQueryObjecti64vEXT (will be remapped) */
+   "iip\0"
+   "glGetQueryObjecti64vEXT\0"
+   "\0"
+   /* _mesa_function_pool[12389]: MultiTexCoord1dARB (offset 376) */
+   "id\0"
+   "glMultiTexCoord1d\0"
+   "glMultiTexCoord1dARB\0"
+   "\0"
+   /* _mesa_function_pool[12432]: PointParameterivNV (will be remapped) */
+   "ip\0"
+   "glPointParameteriv\0"
+   "glPointParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[12476]: BlendFunc (offset 241) */
+   "ii\0"
+   "glBlendFunc\0"
+   "\0"
+   /* _mesa_function_pool[12492]: Uniform2fvARB (will be remapped) */
+   "iip\0"
+   "glUniform2fv\0"
+   "glUniform2fvARB\0"
+   "\0"
+   /* _mesa_function_pool[12526]: BufferParameteriAPPLE (will be remapped) */
+   "iii\0"
+   "glBufferParameteriAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[12555]: MultiTexCoord3dvARB (offset 393) */
+   "ip\0"
+   "glMultiTexCoord3dv\0"
+   "glMultiTexCoord3dvARB\0"
+   "\0"
+   /* _mesa_function_pool[12600]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
+   "pppp\0"
+   "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[12656]: DeleteObjectARB (will be remapped) */
+   "i\0"
+   "glDeleteObjectARB\0"
+   "\0"
+   /* _mesa_function_pool[12677]: MatrixIndexPointerARB (dynamic) */
+   "iiip\0"
+   "glMatrixIndexPointerARB\0"
+   "\0"
+   /* _mesa_function_pool[12707]: ProgramNamedParameter4dvNV (will be remapped) */
+   "iipp\0"
+   "glProgramNamedParameter4dvNV\0"
+   "\0"
+   /* _mesa_function_pool[12742]: Tangent3fvEXT (dynamic) */
+   "p\0"
+   "glTangent3fvEXT\0"
+   "\0"
+   /* _mesa_function_pool[12761]: Flush (offset 217) */
+   "\0"
+   "glFlush\0"
+   "\0"
+   /* _mesa_function_pool[12771]: Color4uiv (offset 38) */
+   "p\0"
+   "glColor4uiv\0"
+   "\0"
+   /* _mesa_function_pool[12786]: GenVertexArrays (will be remapped) */
+   "ip\0"
+   "glGenVertexArrays\0"
+   "\0"
+   /* _mesa_function_pool[12808]: RasterPos3sv (offset 77) */
+   "p\0"
+   "glRasterPos3sv\0"
+   "\0"
+   /* _mesa_function_pool[12826]: BindFramebufferEXT (will be remapped) */
+   "ii\0"
+   "glBindFramebuffer\0"
+   "glBindFramebufferEXT\0"
+   "\0"
+   /* _mesa_function_pool[12869]: ReferencePlaneSGIX (dynamic) */
+   "p\0"
+   "glReferencePlaneSGIX\0"
+   "\0"
+   /* _mesa_function_pool[12893]: PushAttrib (offset 219) */
+   "i\0"
+   "glPushAttrib\0"
+   "\0"
+   /* _mesa_function_pool[12909]: RasterPos2i (offset 66) */
+   "ii\0"
+   "glRasterPos2i\0"
+   "\0"
+   /* _mesa_function_pool[12927]: ValidateProgramARB (will be remapped) */
+   "i\0"
+   "glValidateProgram\0"
+   "glValidateProgramARB\0"
+   "\0"
+   /* _mesa_function_pool[12969]: TexParameteriv (offset 181) */
+   "iip\0"
+   "glTexParameteriv\0"
+   "\0"
+   /* _mesa_function_pool[12991]: UnlockArraysEXT (will be remapped) */
+   "\0"
+   "glUnlockArraysEXT\0"
+   "\0"
+   /* _mesa_function_pool[13011]: TexCoord2fColor3fVertex3fSUN (dynamic) */
+   "ffffffff\0"
+   "glTexCoord2fColor3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[13052]: WindowPos3fvMESA (will be remapped) */
+   "p\0"
+   "glWindowPos3fv\0"
+   "glWindowPos3fvARB\0"
+   "glWindowPos3fvMESA\0"
+   "\0"
+   /* _mesa_function_pool[13107]: RasterPos2f (offset 64) */
+   "ff\0"
+   "glRasterPos2f\0"
+   "\0"
+   /* _mesa_function_pool[13125]: VertexAttrib1svNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib1svNV\0"
+   "\0"
+   /* _mesa_function_pool[13149]: RasterPos2d (offset 62) */
+   "dd\0"
+   "glRasterPos2d\0"
+   "\0"
+   /* _mesa_function_pool[13167]: RasterPos3fv (offset 73) */
+   "p\0"
+   "glRasterPos3fv\0"
+   "\0"
+   /* _mesa_function_pool[13185]: CopyTexSubImage3D (offset 373) */
+   "iiiiiiiii\0"
+   "glCopyTexSubImage3D\0"
+   "glCopyTexSubImage3DEXT\0"
+   "\0"
+   /* _mesa_function_pool[13239]: VertexAttrib2dARB (will be remapped) */
+   "idd\0"
+   "glVertexAttrib2d\0"
+   "glVertexAttrib2dARB\0"
+   "\0"
+   /* _mesa_function_pool[13281]: Color4ub (offset 35) */
+   "iiii\0"
+   "glColor4ub\0"
+   "\0"
+   /* _mesa_function_pool[13298]: GetInteger64v (will be remapped) */
+   "ip\0"
+   "glGetInteger64v\0"
+   "\0"
+   /* _mesa_function_pool[13318]: TextureColorMaskSGIS (dynamic) */
+   "iiii\0"
+   "glTextureColorMaskSGIS\0"
+   "\0"
+   /* _mesa_function_pool[13347]: RasterPos2s (offset 68) */
+   "ii\0"
+   "glRasterPos2s\0"
+   "\0"
+   /* _mesa_function_pool[13365]: GetColorTable (offset 343) */
+   "iiip\0"
+   "glGetColorTable\0"
+   "glGetColorTableSGI\0"
+   "glGetColorTableEXT\0"
+   "\0"
+   /* _mesa_function_pool[13425]: SelectBuffer (offset 195) */
+   "ip\0"
+   "glSelectBuffer\0"
+   "\0"
+   /* _mesa_function_pool[13444]: Indexiv (offset 49) */
+   "p\0"
+   "glIndexiv\0"
+   "\0"
+   /* _mesa_function_pool[13457]: TexCoord3i (offset 114) */
+   "iii\0"
+   "glTexCoord3i\0"
+   "\0"
+   /* _mesa_function_pool[13475]: CopyColorTable (offset 342) */
+   "iiiii\0"
+   "glCopyColorTable\0"
+   "glCopyColorTableSGI\0"
+   "\0"
+   /* _mesa_function_pool[13519]: GetHistogramParameterfv (offset 362) */
+   "iip\0"
+   "glGetHistogramParameterfv\0"
+   "glGetHistogramParameterfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[13579]: Frustum (offset 289) */
+   "dddddd\0"
+   "glFrustum\0"
+   "\0"
+   /* _mesa_function_pool[13597]: GetString (offset 275) */
+   "i\0"
+   "glGetString\0"
+   "\0"
+   /* _mesa_function_pool[13612]: ColorPointervINTEL (dynamic) */
+   "iip\0"
+   "glColorPointervINTEL\0"
+   "\0"
+   /* _mesa_function_pool[13638]: TexEnvf (offset 184) */
+   "iif\0"
+   "glTexEnvf\0"
+   "\0"
+   /* _mesa_function_pool[13653]: TexCoord3d (offset 110) */
+   "ddd\0"
+   "glTexCoord3d\0"
+   "\0"
+   /* _mesa_function_pool[13671]: AlphaFragmentOp1ATI (will be remapped) */
+   "iiiiii\0"
+   "glAlphaFragmentOp1ATI\0"
+   "\0"
+   /* _mesa_function_pool[13701]: TexCoord3f (offset 112) */
+   "fff\0"
+   "glTexCoord3f\0"
+   "\0"
+   /* _mesa_function_pool[13719]: MultiTexCoord3ivARB (offset 397) */
+   "ip\0"
+   "glMultiTexCoord3iv\0"
+   "glMultiTexCoord3ivARB\0"
+   "\0"
+   /* _mesa_function_pool[13764]: MultiTexCoord2sARB (offset 390) */
+   "iii\0"
+   "glMultiTexCoord2s\0"
+   "glMultiTexCoord2sARB\0"
+   "\0"
+   /* _mesa_function_pool[13808]: VertexAttrib1dvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib1dv\0"
+   "glVertexAttrib1dvARB\0"
+   "\0"
+   /* _mesa_function_pool[13851]: DeleteTextures (offset 327) */
+   "ip\0"
+   "glDeleteTextures\0"
+   "glDeleteTexturesEXT\0"
+   "\0"
+   /* _mesa_function_pool[13892]: TexCoordPointerEXT (will be remapped) */
+   "iiiip\0"
+   "glTexCoordPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[13920]: TexSubImage4DSGIS (dynamic) */
+   "iiiiiiiiiiiip\0"
+   "glTexSubImage4DSGIS\0"
+   "\0"
+   /* _mesa_function_pool[13955]: TexCoord3s (offset 116) */
+   "iii\0"
+   "glTexCoord3s\0"
+   "\0"
+   /* _mesa_function_pool[13973]: GetTexLevelParameteriv (offset 285) */
+   "iiip\0"
+   "glGetTexLevelParameteriv\0"
+   "\0"
+   /* _mesa_function_pool[14004]: CombinerStageParameterfvNV (dynamic) */
+   "iip\0"
+   "glCombinerStageParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[14038]: StopInstrumentsSGIX (dynamic) */
+   "i\0"
+   "glStopInstrumentsSGIX\0"
+   "\0"
+   /* _mesa_function_pool[14063]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
+   "fffffffffffffff\0"
+   "glTexCoord4fColor4fNormal3fVertex4fSUN\0"
+   "\0"
+   /* _mesa_function_pool[14119]: ClearAccum (offset 204) */
+   "ffff\0"
+   "glClearAccum\0"
+   "\0"
+   /* _mesa_function_pool[14138]: DeformSGIX (dynamic) */
+   "i\0"
+   "glDeformSGIX\0"
+   "\0"
+   /* _mesa_function_pool[14154]: GetVertexAttribfvARB (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribfv\0"
+   "glGetVertexAttribfvARB\0"
+   "\0"
+   /* _mesa_function_pool[14202]: SecondaryColor3ivEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3iv\0"
+   "glSecondaryColor3ivEXT\0"
+   "\0"
+   /* _mesa_function_pool[14248]: TexCoord4iv (offset 123) */
+   "p\0"
+   "glTexCoord4iv\0"
+   "\0"
+   /* _mesa_function_pool[14265]: UniformMatrix4x2fv (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix4x2fv\0"
+   "\0"
+   /* _mesa_function_pool[14292]: GetDetailTexFuncSGIS (dynamic) */
+   "ip\0"
+   "glGetDetailTexFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[14319]: GetCombinerStageParameterfvNV (dynamic) */
+   "iip\0"
+   "glGetCombinerStageParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[14356]: PolygonOffset (offset 319) */
+   "ff\0"
+   "glPolygonOffset\0"
+   "\0"
+   /* _mesa_function_pool[14376]: BindVertexArray (will be remapped) */
+   "i\0"
+   "glBindVertexArray\0"
+   "\0"
+   /* _mesa_function_pool[14397]: Color4ubVertex2fvSUN (dynamic) */
+   "pp\0"
+   "glColor4ubVertex2fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[14424]: Rectd (offset 86) */
+   "dddd\0"
+   "glRectd\0"
+   "\0"
+   /* _mesa_function_pool[14438]: TexFilterFuncSGIS (dynamic) */
+   "iiip\0"
+   "glTexFilterFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[14464]: SampleMaskSGIS (will be remapped) */
+   "fi\0"
+   "glSampleMaskSGIS\0"
+   "glSampleMaskEXT\0"
+   "\0"
+   /* _mesa_function_pool[14501]: GetAttribLocationARB (will be remapped) */
+   "ip\0"
+   "glGetAttribLocation\0"
+   "glGetAttribLocationARB\0"
+   "\0"
+   /* _mesa_function_pool[14548]: RasterPos3i (offset 74) */
+   "iii\0"
+   "glRasterPos3i\0"
+   "\0"
+   /* _mesa_function_pool[14567]: VertexAttrib4ubvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4ubv\0"
+   "glVertexAttrib4ubvARB\0"
+   "\0"
+   /* _mesa_function_pool[14612]: DetailTexFuncSGIS (dynamic) */
+   "iip\0"
+   "glDetailTexFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[14637]: Normal3fVertex3fSUN (dynamic) */
+   "ffffff\0"
+   "glNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[14667]: CopyTexImage2D (offset 324) */
+   "iiiiiiii\0"
+   "glCopyTexImage2D\0"
+   "glCopyTexImage2DEXT\0"
+   "\0"
+   /* _mesa_function_pool[14714]: GetBufferPointervARB (will be remapped) */
+   "iip\0"
+   "glGetBufferPointerv\0"
+   "glGetBufferPointervARB\0"
+   "\0"
+   /* _mesa_function_pool[14762]: ProgramEnvParameter4fARB (will be remapped) */
+   "iiffff\0"
+   "glProgramEnvParameter4fARB\0"
+   "glProgramParameter4fNV\0"
+   "\0"
+   /* _mesa_function_pool[14820]: Uniform3ivARB (will be remapped) */
+   "iip\0"
+   "glUniform3iv\0"
+   "glUniform3ivARB\0"
+   "\0"
+   /* _mesa_function_pool[14854]: Lightfv (offset 160) */
+   "iip\0"
+   "glLightfv\0"
+   "\0"
+   /* _mesa_function_pool[14869]: ClearDepth (offset 208) */
+   "d\0"
+   "glClearDepth\0"
+   "\0"
+   /* _mesa_function_pool[14885]: GetFenceivNV (will be remapped) */
+   "iip\0"
+   "glGetFenceivNV\0"
+   "\0"
+   /* _mesa_function_pool[14905]: WindowPos4dvMESA (will be remapped) */
+   "p\0"
+   "glWindowPos4dvMESA\0"
+   "\0"
+   /* _mesa_function_pool[14927]: ColorSubTable (offset 346) */
+   "iiiiip\0"
+   "glColorSubTable\0"
+   "glColorSubTableEXT\0"
+   "\0"
+   /* _mesa_function_pool[14970]: Color4fv (offset 30) */
+   "p\0"
+   "glColor4fv\0"
+   "\0"
+   /* _mesa_function_pool[14984]: MultiTexCoord4ivARB (offset 405) */
+   "ip\0"
+   "glMultiTexCoord4iv\0"
+   "glMultiTexCoord4ivARB\0"
+   "\0"
+   /* _mesa_function_pool[15029]: ProgramLocalParameters4fvEXT (will be remapped) */
+   "iiip\0"
+   "glProgramLocalParameters4fvEXT\0"
+   "\0"
+   /* _mesa_function_pool[15066]: ColorPointer (offset 308) */
+   "iiip\0"
+   "glColorPointer\0"
+   "\0"
+   /* _mesa_function_pool[15087]: Rects (offset 92) */
+   "iiii\0"
+   "glRects\0"
+   "\0"
+   /* _mesa_function_pool[15101]: GetMapAttribParameterfvNV (dynamic) */
+   "iiip\0"
+   "glGetMapAttribParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[15135]: Lightiv (offset 162) */
+   "iip\0"
+   "glLightiv\0"
+   "\0"
+   /* _mesa_function_pool[15150]: VertexAttrib4sARB (will be remapped) */
+   "iiiii\0"
+   "glVertexAttrib4s\0"
+   "glVertexAttrib4sARB\0"
+   "\0"
+   /* _mesa_function_pool[15194]: GetQueryObjectuivARB (will be remapped) */
+   "iip\0"
+   "glGetQueryObjectuiv\0"
+   "glGetQueryObjectuivARB\0"
+   "\0"
+   /* _mesa_function_pool[15242]: GetTexParameteriv (offset 283) */
+   "iip\0"
+   "glGetTexParameteriv\0"
+   "\0"
+   /* _mesa_function_pool[15267]: MapParameterivNV (dynamic) */
+   "iip\0"
+   "glMapParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[15291]: GenRenderbuffersEXT (will be remapped) */
+   "ip\0"
+   "glGenRenderbuffers\0"
+   "glGenRenderbuffersEXT\0"
+   "\0"
+   /* _mesa_function_pool[15336]: VertexAttrib2dvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib2dv\0"
+   "glVertexAttrib2dvARB\0"
+   "\0"
+   /* _mesa_function_pool[15379]: EdgeFlagPointerEXT (will be remapped) */
+   "iip\0"
+   "glEdgeFlagPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[15405]: VertexAttribs2svNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs2svNV\0"
+   "\0"
+   /* _mesa_function_pool[15431]: WeightbvARB (dynamic) */
+   "ip\0"
+   "glWeightbvARB\0"
+   "\0"
+   /* _mesa_function_pool[15449]: VertexAttrib2fvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib2fv\0"
+   "glVertexAttrib2fvARB\0"
+   "\0"
+   /* _mesa_function_pool[15492]: GetBufferParameterivARB (will be remapped) */
+   "iip\0"
+   "glGetBufferParameteriv\0"
+   "glGetBufferParameterivARB\0"
+   "\0"
+   /* _mesa_function_pool[15546]: Rectdv (offset 87) */
+   "pp\0"
+   "glRectdv\0"
+   "\0"
+   /* _mesa_function_pool[15559]: ListParameteriSGIX (dynamic) */
+   "iii\0"
+   "glListParameteriSGIX\0"
+   "\0"
+   /* _mesa_function_pool[15585]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
+   "iffffffffff\0"
+   "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[15644]: InstrumentsBufferSGIX (dynamic) */
+   "ip\0"
+   "glInstrumentsBufferSGIX\0"
+   "\0"
+   /* _mesa_function_pool[15672]: VertexAttrib4NivARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4Niv\0"
+   "glVertexAttrib4NivARB\0"
+   "\0"
+   /* _mesa_function_pool[15717]: GetAttachedShaders (will be remapped) */
+   "iipp\0"
+   "glGetAttachedShaders\0"
+   "\0"
+   /* _mesa_function_pool[15744]: GenVertexArraysAPPLE (will be remapped) */
+   "ip\0"
+   "glGenVertexArraysAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[15771]: Materialiv (offset 172) */
+   "iip\0"
+   "glMaterialiv\0"
+   "\0"
+   /* _mesa_function_pool[15789]: PushClientAttrib (offset 335) */
+   "i\0"
+   "glPushClientAttrib\0"
+   "\0"
+   /* _mesa_function_pool[15811]: ProgramEnvParameters4fvEXT (will be remapped) */
+   "iiip\0"
+   "glProgramEnvParameters4fvEXT\0"
+   "\0"
+   /* _mesa_function_pool[15846]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+   "pppp\0"
+   "glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[15892]: WindowPos2iMESA (will be remapped) */
+   "ii\0"
+   "glWindowPos2i\0"
+   "glWindowPos2iARB\0"
+   "glWindowPos2iMESA\0"
+   "\0"
+   /* _mesa_function_pool[15945]: SecondaryColor3fvEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3fv\0"
+   "glSecondaryColor3fvEXT\0"
+   "\0"
+   /* _mesa_function_pool[15991]: PolygonMode (offset 174) */
+   "ii\0"
+   "glPolygonMode\0"
+   "\0"
+   /* _mesa_function_pool[16009]: CompressedTexSubImage1DARB (will be remapped) */
+   "iiiiiip\0"
+   "glCompressedTexSubImage1D\0"
+   "glCompressedTexSubImage1DARB\0"
+   "\0"
+   /* _mesa_function_pool[16073]: GetVertexAttribivNV (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribivNV\0"
+   "\0"
+   /* _mesa_function_pool[16100]: GetProgramStringARB (will be remapped) */
+   "iip\0"
+   "glGetProgramStringARB\0"
+   "\0"
+   /* _mesa_function_pool[16127]: TexBumpParameterfvATI (will be remapped) */
+   "ip\0"
+   "glTexBumpParameterfvATI\0"
+   "\0"
+   /* _mesa_function_pool[16155]: CompileShaderARB (will be remapped) */
+   "i\0"
+   "glCompileShader\0"
+   "glCompileShaderARB\0"
+   "\0"
+   /* _mesa_function_pool[16193]: DeleteShader (will be remapped) */
+   "i\0"
+   "glDeleteShader\0"
+   "\0"
+   /* _mesa_function_pool[16211]: DisableClientState (offset 309) */
+   "i\0"
+   "glDisableClientState\0"
+   "\0"
+   /* _mesa_function_pool[16235]: TexGeni (offset 192) */
+   "iii\0"
+   "glTexGeni\0"
+   "\0"
+   /* _mesa_function_pool[16250]: TexGenf (offset 190) */
+   "iif\0"
+   "glTexGenf\0"
+   "\0"
+   /* _mesa_function_pool[16265]: Uniform3fARB (will be remapped) */
+   "ifff\0"
+   "glUniform3f\0"
+   "glUniform3fARB\0"
+   "\0"
+   /* _mesa_function_pool[16298]: TexGend (offset 188) */
+   "iid\0"
+   "glTexGend\0"
+   "\0"
+   /* _mesa_function_pool[16313]: ListParameterfvSGIX (dynamic) */
+   "iip\0"
+   "glListParameterfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[16340]: GetPolygonStipple (offset 274) */
+   "p\0"
+   "glGetPolygonStipple\0"
+   "\0"
+   /* _mesa_function_pool[16363]: Tangent3dvEXT (dynamic) */
+   "p\0"
+   "glTangent3dvEXT\0"
+   "\0"
+   /* _mesa_function_pool[16382]: GetVertexAttribfvNV (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribfvNV\0"
+   "\0"
+   /* _mesa_function_pool[16409]: WindowPos3sMESA (will be remapped) */
+   "iii\0"
+   "glWindowPos3s\0"
+   "glWindowPos3sARB\0"
+   "glWindowPos3sMESA\0"
+   "\0"
+   /* _mesa_function_pool[16463]: VertexAttrib2svNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib2svNV\0"
+   "\0"
+   /* _mesa_function_pool[16487]: VertexAttribs1fvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs1fvNV\0"
+   "\0"
+   /* _mesa_function_pool[16513]: TexCoord2fVertex3fvSUN (dynamic) */
+   "pp\0"
+   "glTexCoord2fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[16542]: WindowPos4sMESA (will be remapped) */
+   "iiii\0"
+   "glWindowPos4sMESA\0"
+   "\0"
+   /* _mesa_function_pool[16566]: VertexAttrib4NuivARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4Nuiv\0"
+   "glVertexAttrib4NuivARB\0"
+   "\0"
+   /* _mesa_function_pool[16613]: ClientActiveTextureARB (offset 375) */
+   "i\0"
+   "glClientActiveTexture\0"
+   "glClientActiveTextureARB\0"
+   "\0"
+   /* _mesa_function_pool[16663]: PixelTexGenSGIX (will be remapped) */
+   "i\0"
+   "glPixelTexGenSGIX\0"
+   "\0"
+   /* _mesa_function_pool[16684]: ReplacementCodeusvSUN (dynamic) */
+   "p\0"
+   "glReplacementCodeusvSUN\0"
+   "\0"
+   /* _mesa_function_pool[16711]: Uniform4fARB (will be remapped) */
+   "iffff\0"
+   "glUniform4f\0"
+   "glUniform4fARB\0"
+   "\0"
+   /* _mesa_function_pool[16745]: Color4sv (offset 34) */
+   "p\0"
+   "glColor4sv\0"
+   "\0"
+   /* _mesa_function_pool[16759]: FlushMappedBufferRange (will be remapped) */
+   "iii\0"
+   "glFlushMappedBufferRange\0"
+   "\0"
+   /* _mesa_function_pool[16789]: IsProgramNV (will be remapped) */
+   "i\0"
+   "glIsProgramARB\0"
+   "glIsProgramNV\0"
+   "\0"
+   /* _mesa_function_pool[16821]: FlushMappedBufferRangeAPPLE (will be remapped) */
+   "iii\0"
+   "glFlushMappedBufferRangeAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[16856]: PixelZoom (offset 246) */
+   "ff\0"
+   "glPixelZoom\0"
+   "\0"
+   /* _mesa_function_pool[16872]: ReplacementCodePointerSUN (dynamic) */
+   "iip\0"
+   "glReplacementCodePointerSUN\0"
+   "\0"
+   /* _mesa_function_pool[16905]: ProgramEnvParameter4dARB (will be remapped) */
+   "iidddd\0"
+   "glProgramEnvParameter4dARB\0"
+   "glProgramParameter4dNV\0"
+   "\0"
+   /* _mesa_function_pool[16963]: ColorTableParameterfv (offset 340) */
+   "iip\0"
+   "glColorTableParameterfv\0"
+   "glColorTableParameterfvSGI\0"
+   "\0"
+   /* _mesa_function_pool[17019]: FragmentLightModelfSGIX (dynamic) */
+   "if\0"
+   "glFragmentLightModelfSGIX\0"
+   "\0"
+   /* _mesa_function_pool[17049]: Binormal3bvEXT (dynamic) */
+   "p\0"
+   "glBinormal3bvEXT\0"
+   "\0"
+   /* _mesa_function_pool[17069]: PixelMapuiv (offset 252) */
+   "iip\0"
+   "glPixelMapuiv\0"
+   "\0"
+   /* _mesa_function_pool[17088]: Color3dv (offset 12) */
+   "p\0"
+   "glColor3dv\0"
+   "\0"
+   /* _mesa_function_pool[17102]: IsTexture (offset 330) */
+   "i\0"
+   "glIsTexture\0"
+   "glIsTextureEXT\0"
+   "\0"
+   /* _mesa_function_pool[17132]: VertexWeightfvEXT (dynamic) */
+   "p\0"
+   "glVertexWeightfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[17155]: VertexAttrib1dARB (will be remapped) */
+   "id\0"
+   "glVertexAttrib1d\0"
+   "glVertexAttrib1dARB\0"
+   "\0"
+   /* _mesa_function_pool[17196]: ImageTransformParameterivHP (dynamic) */
+   "iip\0"
+   "glImageTransformParameterivHP\0"
+   "\0"
+   /* _mesa_function_pool[17231]: TexCoord4i (offset 122) */
+   "iiii\0"
+   "glTexCoord4i\0"
+   "\0"
+   /* _mesa_function_pool[17250]: DeleteQueriesARB (will be remapped) */
+   "ip\0"
+   "glDeleteQueries\0"
+   "glDeleteQueriesARB\0"
+   "\0"
+   /* _mesa_function_pool[17289]: Color4ubVertex2fSUN (dynamic) */
+   "iiiiff\0"
+   "glColor4ubVertex2fSUN\0"
+   "\0"
+   /* _mesa_function_pool[17319]: FragmentColorMaterialSGIX (dynamic) */
+   "ii\0"
+   "glFragmentColorMaterialSGIX\0"
+   "\0"
+   /* _mesa_function_pool[17351]: CurrentPaletteMatrixARB (dynamic) */
+   "i\0"
+   "glCurrentPaletteMatrixARB\0"
+   "\0"
+   /* _mesa_function_pool[17380]: GetMapdv (offset 266) */
+   "iip\0"
+   "glGetMapdv\0"
+   "\0"
+   /* _mesa_function_pool[17396]: SamplePatternSGIS (will be remapped) */
+   "i\0"
+   "glSamplePatternSGIS\0"
+   "glSamplePatternEXT\0"
+   "\0"
+   /* _mesa_function_pool[17438]: PixelStoref (offset 249) */
+   "if\0"
+   "glPixelStoref\0"
+   "\0"
+   /* _mesa_function_pool[17456]: IsQueryARB (will be remapped) */
+   "i\0"
+   "glIsQuery\0"
+   "glIsQueryARB\0"
+   "\0"
+   /* _mesa_function_pool[17482]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
+   "iiiiifff\0"
+   "glReplacementCodeuiColor4ubVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[17531]: PixelStorei (offset 250) */
+   "ii\0"
+   "glPixelStorei\0"
+   "\0"
+   /* _mesa_function_pool[17549]: VertexAttrib4usvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4usv\0"
+   "glVertexAttrib4usvARB\0"
+   "\0"
+   /* _mesa_function_pool[17594]: LinkProgramARB (will be remapped) */
+   "i\0"
+   "glLinkProgram\0"
+   "glLinkProgramARB\0"
+   "\0"
+   /* _mesa_function_pool[17628]: VertexAttrib2fNV (will be remapped) */
+   "iff\0"
+   "glVertexAttrib2fNV\0"
+   "\0"
+   /* _mesa_function_pool[17652]: ShaderSourceARB (will be remapped) */
+   "iipp\0"
+   "glShaderSource\0"
+   "glShaderSourceARB\0"
+   "\0"
+   /* _mesa_function_pool[17691]: FragmentMaterialiSGIX (dynamic) */
+   "iii\0"
+   "glFragmentMaterialiSGIX\0"
+   "\0"
+   /* _mesa_function_pool[17720]: EvalCoord2dv (offset 233) */
+   "p\0"
+   "glEvalCoord2dv\0"
+   "\0"
+   /* _mesa_function_pool[17738]: VertexAttrib3svARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib3sv\0"
+   "glVertexAttrib3svARB\0"
+   "\0"
+   /* _mesa_function_pool[17781]: ColorMaterial (offset 151) */
+   "ii\0"
+   "glColorMaterial\0"
+   "\0"
+   /* _mesa_function_pool[17801]: CompressedTexSubImage3DARB (will be remapped) */
+   "iiiiiiiiiip\0"
+   "glCompressedTexSubImage3D\0"
+   "glCompressedTexSubImage3DARB\0"
+   "\0"
+   /* _mesa_function_pool[17869]: WindowPos2ivMESA (will be remapped) */
+   "p\0"
+   "glWindowPos2iv\0"
+   "glWindowPos2ivARB\0"
+   "glWindowPos2ivMESA\0"
+   "\0"
+   /* _mesa_function_pool[17924]: IsFramebufferEXT (will be remapped) */
+   "i\0"
+   "glIsFramebuffer\0"
+   "glIsFramebufferEXT\0"
+   "\0"
+   /* _mesa_function_pool[17962]: Uniform4ivARB (will be remapped) */
+   "iip\0"
+   "glUniform4iv\0"
+   "glUniform4ivARB\0"
+   "\0"
+   /* _mesa_function_pool[17996]: GetVertexAttribdvARB (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribdv\0"
+   "glGetVertexAttribdvARB\0"
+   "\0"
+   /* _mesa_function_pool[18044]: TexBumpParameterivATI (will be remapped) */
+   "ip\0"
+   "glTexBumpParameterivATI\0"
+   "\0"
+   /* _mesa_function_pool[18072]: GetSeparableFilter (offset 359) */
+   "iiippp\0"
+   "glGetSeparableFilter\0"
+   "glGetSeparableFilterEXT\0"
+   "\0"
+   /* _mesa_function_pool[18125]: Binormal3dEXT (dynamic) */
+   "ddd\0"
+   "glBinormal3dEXT\0"
+   "\0"
+   /* _mesa_function_pool[18146]: SpriteParameteriSGIX (dynamic) */
+   "ii\0"
+   "glSpriteParameteriSGIX\0"
+   "\0"
+   /* _mesa_function_pool[18173]: RequestResidentProgramsNV (will be remapped) */
+   "ip\0"
+   "glRequestResidentProgramsNV\0"
+   "\0"
+   /* _mesa_function_pool[18205]: TagSampleBufferSGIX (dynamic) */
+   "\0"
+   "glTagSampleBufferSGIX\0"
+   "\0"
+   /* _mesa_function_pool[18229]: ReplacementCodeusSUN (dynamic) */
+   "i\0"
+   "glReplacementCodeusSUN\0"
+   "\0"
+   /* _mesa_function_pool[18255]: FeedbackBuffer (offset 194) */
+   "iip\0"
+   "glFeedbackBuffer\0"
+   "\0"
+   /* _mesa_function_pool[18277]: RasterPos2iv (offset 67) */
+   "p\0"
+   "glRasterPos2iv\0"
+   "\0"
+   /* _mesa_function_pool[18295]: TexImage1D (offset 182) */
+   "iiiiiiip\0"
+   "glTexImage1D\0"
+   "\0"
+   /* _mesa_function_pool[18318]: ListParameterivSGIX (dynamic) */
+   "iip\0"
+   "glListParameterivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[18345]: MultiDrawElementsEXT (will be remapped) */
+   "ipipi\0"
+   "glMultiDrawElements\0"
+   "glMultiDrawElementsEXT\0"
+   "\0"
+   /* _mesa_function_pool[18395]: Color3s (offset 17) */
+   "iii\0"
+   "glColor3s\0"
+   "\0"
+   /* _mesa_function_pool[18410]: Uniform1ivARB (will be remapped) */
+   "iip\0"
+   "glUniform1iv\0"
+   "glUniform1ivARB\0"
+   "\0"
+   /* _mesa_function_pool[18444]: WindowPos2sMESA (will be remapped) */
+   "ii\0"
+   "glWindowPos2s\0"
+   "glWindowPos2sARB\0"
+   "glWindowPos2sMESA\0"
+   "\0"
+   /* _mesa_function_pool[18497]: WeightusvARB (dynamic) */
+   "ip\0"
+   "glWeightusvARB\0"
+   "\0"
+   /* _mesa_function_pool[18516]: TexCoordPointer (offset 320) */
+   "iiip\0"
+   "glTexCoordPointer\0"
+   "\0"
+   /* _mesa_function_pool[18540]: FogCoordPointerEXT (will be remapped) */
+   "iip\0"
+   "glFogCoordPointer\0"
+   "glFogCoordPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[18584]: IndexMaterialEXT (dynamic) */
+   "ii\0"
+   "glIndexMaterialEXT\0"
+   "\0"
+   /* _mesa_function_pool[18607]: Color3i (offset 15) */
+   "iii\0"
+   "glColor3i\0"
+   "\0"
+   /* _mesa_function_pool[18622]: FrontFace (offset 157) */
+   "i\0"
+   "glFrontFace\0"
+   "\0"
+   /* _mesa_function_pool[18637]: EvalCoord2d (offset 232) */
+   "dd\0"
+   "glEvalCoord2d\0"
+   "\0"
+   /* _mesa_function_pool[18655]: SecondaryColor3ubvEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3ubv\0"
+   "glSecondaryColor3ubvEXT\0"
+   "\0"
+   /* _mesa_function_pool[18703]: EvalCoord2f (offset 234) */
+   "ff\0"
+   "glEvalCoord2f\0"
+   "\0"
+   /* _mesa_function_pool[18721]: VertexAttrib4dvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4dv\0"
+   "glVertexAttrib4dvARB\0"
+   "\0"
+   /* _mesa_function_pool[18764]: BindAttribLocationARB (will be remapped) */
+   "iip\0"
+   "glBindAttribLocation\0"
+   "glBindAttribLocationARB\0"
+   "\0"
+   /* _mesa_function_pool[18814]: Color3b (offset 9) */
+   "iii\0"
+   "glColor3b\0"
+   "\0"
+   /* _mesa_function_pool[18829]: MultiTexCoord2dARB (offset 384) */
+   "idd\0"
+   "glMultiTexCoord2d\0"
+   "glMultiTexCoord2dARB\0"
+   "\0"
+   /* _mesa_function_pool[18873]: ExecuteProgramNV (will be remapped) */
+   "iip\0"
+   "glExecuteProgramNV\0"
+   "\0"
+   /* _mesa_function_pool[18897]: Color3f (offset 13) */
+   "fff\0"
+   "glColor3f\0"
+   "\0"
+   /* _mesa_function_pool[18912]: LightEnviSGIX (dynamic) */
+   "ii\0"
+   "glLightEnviSGIX\0"
+   "\0"
+   /* _mesa_function_pool[18932]: Color3d (offset 11) */
+   "ddd\0"
+   "glColor3d\0"
+   "\0"
+   /* _mesa_function_pool[18947]: Normal3dv (offset 55) */
+   "p\0"
+   "glNormal3dv\0"
+   "\0"
+   /* _mesa_function_pool[18962]: Lightf (offset 159) */
+   "iif\0"
+   "glLightf\0"
+   "\0"
+   /* _mesa_function_pool[18976]: ReplacementCodeuiSUN (dynamic) */
+   "i\0"
+   "glReplacementCodeuiSUN\0"
+   "\0"
+   /* _mesa_function_pool[19002]: MatrixMode (offset 293) */
+   "i\0"
+   "glMatrixMode\0"
+   "\0"
+   /* _mesa_function_pool[19018]: GetPixelMapusv (offset 273) */
+   "ip\0"
+   "glGetPixelMapusv\0"
+   "\0"
+   /* _mesa_function_pool[19039]: Lighti (offset 161) */
+   "iii\0"
+   "glLighti\0"
+   "\0"
+   /* _mesa_function_pool[19053]: VertexAttribPointerNV (will be remapped) */
+   "iiiip\0"
+   "glVertexAttribPointerNV\0"
+   "\0"
+   /* _mesa_function_pool[19084]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
+   "iiip\0"
+   "glGetFramebufferAttachmentParameteriv\0"
+   "glGetFramebufferAttachmentParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[19169]: PixelTransformParameterfEXT (dynamic) */
+   "iif\0"
+   "glPixelTransformParameterfEXT\0"
+   "\0"
+   /* _mesa_function_pool[19204]: MultiTexCoord4dvARB (offset 401) */
+   "ip\0"
+   "glMultiTexCoord4dv\0"
+   "glMultiTexCoord4dvARB\0"
+   "\0"
+   /* _mesa_function_pool[19249]: PixelTransformParameteriEXT (dynamic) */
+   "iii\0"
+   "glPixelTransformParameteriEXT\0"
+   "\0"
+   /* _mesa_function_pool[19284]: GetDoublev (offset 260) */
+   "ip\0"
+   "glGetDoublev\0"
+   "\0"
+   /* _mesa_function_pool[19301]: MultMatrixd (offset 295) */
+   "p\0"
+   "glMultMatrixd\0"
+   "\0"
+   /* _mesa_function_pool[19318]: MultMatrixf (offset 294) */
+   "p\0"
+   "glMultMatrixf\0"
+   "\0"
+   /* _mesa_function_pool[19335]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
+   "ffiiiifff\0"
+   "glTexCoord2fColor4ubVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[19378]: Uniform1iARB (will be remapped) */
+   "ii\0"
+   "glUniform1i\0"
+   "glUniform1iARB\0"
+   "\0"
+   /* _mesa_function_pool[19409]: VertexAttribPointerARB (will be remapped) */
+   "iiiiip\0"
+   "glVertexAttribPointer\0"
+   "glVertexAttribPointerARB\0"
+   "\0"
+   /* _mesa_function_pool[19464]: SharpenTexFuncSGIS (dynamic) */
+   "iip\0"
+   "glSharpenTexFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[19490]: MultiTexCoord4fvARB (offset 403) */
+   "ip\0"
+   "glMultiTexCoord4fv\0"
+   "glMultiTexCoord4fvARB\0"
+   "\0"
+   /* _mesa_function_pool[19535]: UniformMatrix2x3fv (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix2x3fv\0"
+   "\0"
+   /* _mesa_function_pool[19562]: TrackMatrixNV (will be remapped) */
+   "iiii\0"
+   "glTrackMatrixNV\0"
+   "\0"
+   /* _mesa_function_pool[19584]: CombinerParameteriNV (will be remapped) */
+   "ii\0"
+   "glCombinerParameteriNV\0"
+   "\0"
+   /* _mesa_function_pool[19611]: DeleteAsyncMarkersSGIX (dynamic) */
+   "ii\0"
+   "glDeleteAsyncMarkersSGIX\0"
+   "\0"
+   /* _mesa_function_pool[19640]: IsAsyncMarkerSGIX (dynamic) */
+   "i\0"
+   "glIsAsyncMarkerSGIX\0"
+   "\0"
+   /* _mesa_function_pool[19663]: FrameZoomSGIX (dynamic) */
+   "i\0"
+   "glFrameZoomSGIX\0"
+   "\0"
+   /* _mesa_function_pool[19682]: Normal3fVertex3fvSUN (dynamic) */
+   "pp\0"
+   "glNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[19709]: RasterPos4sv (offset 85) */
+   "p\0"
+   "glRasterPos4sv\0"
+   "\0"
+   /* _mesa_function_pool[19727]: VertexAttrib4NsvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4Nsv\0"
+   "glVertexAttrib4NsvARB\0"
+   "\0"
+   /* _mesa_function_pool[19772]: VertexAttrib3fvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib3fv\0"
+   "glVertexAttrib3fvARB\0"
+   "\0"
+   /* _mesa_function_pool[19815]: ClearColor (offset 206) */
+   "ffff\0"
+   "glClearColor\0"
+   "\0"
+   /* _mesa_function_pool[19834]: GetSynciv (will be remapped) */
+   "iiipp\0"
+   "glGetSynciv\0"
+   "\0"
+   /* _mesa_function_pool[19853]: DeleteFramebuffersEXT (will be remapped) */
+   "ip\0"
+   "glDeleteFramebuffers\0"
+   "glDeleteFramebuffersEXT\0"
+   "\0"
+   /* _mesa_function_pool[19902]: GlobalAlphaFactorsSUN (dynamic) */
+   "i\0"
+   "glGlobalAlphaFactorsSUN\0"
+   "\0"
+   /* _mesa_function_pool[19929]: TexEnviv (offset 187) */
+   "iip\0"
+   "glTexEnviv\0"
+   "\0"
+   /* _mesa_function_pool[19945]: TexSubImage3D (offset 372) */
+   "iiiiiiiiiip\0"
+   "glTexSubImage3D\0"
+   "glTexSubImage3DEXT\0"
+   "\0"
+   /* _mesa_function_pool[19993]: Tangent3fEXT (dynamic) */
+   "fff\0"
+   "glTangent3fEXT\0"
+   "\0"
+   /* _mesa_function_pool[20013]: SecondaryColor3uivEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3uiv\0"
+   "glSecondaryColor3uivEXT\0"
+   "\0"
+   /* _mesa_function_pool[20061]: MatrixIndexubvARB (dynamic) */
+   "ip\0"
+   "glMatrixIndexubvARB\0"
+   "\0"
+   /* _mesa_function_pool[20085]: Color4fNormal3fVertex3fSUN (dynamic) */
+   "ffffffffff\0"
+   "glColor4fNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[20126]: PixelTexGenParameterfSGIS (will be remapped) */
+   "if\0"
+   "glPixelTexGenParameterfSGIS\0"
+   "\0"
+   /* _mesa_function_pool[20158]: CreateShader (will be remapped) */
+   "i\0"
+   "glCreateShader\0"
+   "\0"
+   /* _mesa_function_pool[20176]: GetColorTableParameterfv (offset 344) */
+   "iip\0"
+   "glGetColorTableParameterfv\0"
+   "glGetColorTableParameterfvSGI\0"
+   "glGetColorTableParameterfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[20268]: FragmentLightModelfvSGIX (dynamic) */
+   "ip\0"
+   "glFragmentLightModelfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[20299]: Bitmap (offset 8) */
+   "iiffffp\0"
+   "glBitmap\0"
+   "\0"
+   /* _mesa_function_pool[20317]: MultiTexCoord3fARB (offset 394) */
+   "ifff\0"
+   "glMultiTexCoord3f\0"
+   "glMultiTexCoord3fARB\0"
+   "\0"
+   /* _mesa_function_pool[20362]: GetTexLevelParameterfv (offset 284) */
+   "iiip\0"
+   "glGetTexLevelParameterfv\0"
+   "\0"
+   /* _mesa_function_pool[20393]: GetPixelTexGenParameterfvSGIS (will be remapped) */
+   "ip\0"
+   "glGetPixelTexGenParameterfvSGIS\0"
+   "\0"
+   /* _mesa_function_pool[20429]: GenFramebuffersEXT (will be remapped) */
+   "ip\0"
+   "glGenFramebuffers\0"
+   "glGenFramebuffersEXT\0"
+   "\0"
+   /* _mesa_function_pool[20472]: GetProgramParameterdvNV (will be remapped) */
+   "iiip\0"
+   "glGetProgramParameterdvNV\0"
+   "\0"
+   /* _mesa_function_pool[20504]: Vertex2sv (offset 133) */
+   "p\0"
+   "glVertex2sv\0"
+   "\0"
+   /* _mesa_function_pool[20519]: GetIntegerv (offset 263) */
+   "ip\0"
+   "glGetIntegerv\0"
+   "\0"
+   /* _mesa_function_pool[20537]: IsVertexArrayAPPLE (will be remapped) */
+   "i\0"
+   "glIsVertexArray\0"
+   "glIsVertexArrayAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[20577]: FragmentLightfvSGIX (dynamic) */
+   "iip\0"
+   "glFragmentLightfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[20604]: DetachShader (will be remapped) */
+   "ii\0"
+   "glDetachShader\0"
+   "\0"
+   /* _mesa_function_pool[20623]: VertexAttrib4NubARB (will be remapped) */
+   "iiiii\0"
+   "glVertexAttrib4Nub\0"
+   "glVertexAttrib4NubARB\0"
+   "\0"
+   /* _mesa_function_pool[20671]: GetProgramEnvParameterfvARB (will be remapped) */
+   "iip\0"
+   "glGetProgramEnvParameterfvARB\0"
+   "\0"
+   /* _mesa_function_pool[20706]: GetTrackMatrixivNV (will be remapped) */
+   "iiip\0"
+   "glGetTrackMatrixivNV\0"
+   "\0"
+   /* _mesa_function_pool[20733]: VertexAttrib3svNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib3svNV\0"
+   "\0"
+   /* _mesa_function_pool[20757]: Uniform4fvARB (will be remapped) */
+   "iip\0"
+   "glUniform4fv\0"
+   "glUniform4fvARB\0"
+   "\0"
+   /* _mesa_function_pool[20791]: MultTransposeMatrixfARB (will be remapped) */
+   "p\0"
+   "glMultTransposeMatrixf\0"
+   "glMultTransposeMatrixfARB\0"
+   "\0"
+   /* _mesa_function_pool[20843]: GetTexEnviv (offset 277) */
+   "iip\0"
+   "glGetTexEnviv\0"
+   "\0"
+   /* _mesa_function_pool[20862]: ColorFragmentOp1ATI (will be remapped) */
+   "iiiiiii\0"
+   "glColorFragmentOp1ATI\0"
+   "\0"
+   /* _mesa_function_pool[20893]: GetUniformfvARB (will be remapped) */
+   "iip\0"
+   "glGetUniformfv\0"
+   "glGetUniformfvARB\0"
+   "\0"
+   /* _mesa_function_pool[20931]: PopClientAttrib (offset 334) */
+   "\0"
+   "glPopClientAttrib\0"
+   "\0"
+   /* _mesa_function_pool[20951]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+   "iffffffffffff\0"
+   "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[21022]: DetachObjectARB (will be remapped) */
+   "ii\0"
+   "glDetachObjectARB\0"
+   "\0"
+   /* _mesa_function_pool[21044]: VertexBlendARB (dynamic) */
+   "i\0"
+   "glVertexBlendARB\0"
+   "\0"
+   /* _mesa_function_pool[21064]: WindowPos3iMESA (will be remapped) */
+   "iii\0"
+   "glWindowPos3i\0"
+   "glWindowPos3iARB\0"
+   "glWindowPos3iMESA\0"
+   "\0"
+   /* _mesa_function_pool[21118]: SeparableFilter2D (offset 360) */
+   "iiiiiipp\0"
+   "glSeparableFilter2D\0"
+   "glSeparableFilter2DEXT\0"
+   "\0"
+   /* _mesa_function_pool[21171]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glReplacementCodeuiColor4ubVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[21216]: Map1d (offset 220) */
+   "iddiip\0"
+   "glMap1d\0"
+   "\0"
+   /* _mesa_function_pool[21232]: Map1f (offset 221) */
+   "iffiip\0"
+   "glMap1f\0"
+   "\0"
+   /* _mesa_function_pool[21248]: CompressedTexImage2DARB (will be remapped) */
+   "iiiiiiip\0"
+   "glCompressedTexImage2D\0"
+   "glCompressedTexImage2DARB\0"
+   "\0"
+   /* _mesa_function_pool[21307]: ArrayElement (offset 306) */
+   "i\0"
+   "glArrayElement\0"
+   "glArrayElementEXT\0"
+   "\0"
+   /* _mesa_function_pool[21343]: TexImage2D (offset 183) */
+   "iiiiiiiip\0"
+   "glTexImage2D\0"
+   "\0"
+   /* _mesa_function_pool[21367]: DepthBoundsEXT (will be remapped) */
+   "dd\0"
+   "glDepthBoundsEXT\0"
+   "\0"
+   /* _mesa_function_pool[21388]: ProgramParameters4fvNV (will be remapped) */
+   "iiip\0"
+   "glProgramParameters4fvNV\0"
+   "\0"
+   /* _mesa_function_pool[21419]: DeformationMap3fSGIX (dynamic) */
+   "iffiiffiiffiip\0"
+   "glDeformationMap3fSGIX\0"
+   "\0"
+   /* _mesa_function_pool[21458]: GetProgramivNV (will be remapped) */
+   "iip\0"
+   "glGetProgramivNV\0"
+   "\0"
+   /* _mesa_function_pool[21480]: GetMinmaxParameteriv (offset 366) */
+   "iip\0"
+   "glGetMinmaxParameteriv\0"
+   "glGetMinmaxParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[21534]: PixelTransferf (offset 247) */
+   "if\0"
+   "glPixelTransferf\0"
+   "\0"
+   /* _mesa_function_pool[21555]: CopyTexImage1D (offset 323) */
+   "iiiiiii\0"
+   "glCopyTexImage1D\0"
+   "glCopyTexImage1DEXT\0"
+   "\0"
+   /* _mesa_function_pool[21601]: PushMatrix (offset 298) */
+   "\0"
+   "glPushMatrix\0"
+   "\0"
+   /* _mesa_function_pool[21616]: Fogiv (offset 156) */
+   "ip\0"
+   "glFogiv\0"
+   "\0"
+   /* _mesa_function_pool[21628]: TexCoord1dv (offset 95) */
+   "p\0"
+   "glTexCoord1dv\0"
+   "\0"
+   /* _mesa_function_pool[21645]: AlphaFragmentOp3ATI (will be remapped) */
+   "iiiiiiiiiiii\0"
+   "glAlphaFragmentOp3ATI\0"
+   "\0"
+   /* _mesa_function_pool[21681]: PixelTransferi (offset 248) */
+   "ii\0"
+   "glPixelTransferi\0"
+   "\0"
+   /* _mesa_function_pool[21702]: GetVertexAttribdvNV (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribdvNV\0"
+   "\0"
+   /* _mesa_function_pool[21729]: VertexAttrib3fvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib3fvNV\0"
+   "\0"
+   /* _mesa_function_pool[21753]: Rotatef (offset 300) */
+   "ffff\0"
+   "glRotatef\0"
+   "\0"
+   /* _mesa_function_pool[21769]: GetFinalCombinerInputParameterivNV (will be remapped) */
+   "iip\0"
+   "glGetFinalCombinerInputParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[21811]: Vertex3i (offset 138) */
+   "iii\0"
+   "glVertex3i\0"
+   "\0"
+   /* _mesa_function_pool[21827]: Vertex3f (offset 136) */
+   "fff\0"
+   "glVertex3f\0"
+   "\0"
+   /* _mesa_function_pool[21843]: Clear (offset 203) */
+   "i\0"
+   "glClear\0"
+   "\0"
+   /* _mesa_function_pool[21854]: Vertex3d (offset 134) */
+   "ddd\0"
+   "glVertex3d\0"
+   "\0"
+   /* _mesa_function_pool[21870]: GetMapParameterivNV (dynamic) */
+   "iip\0"
+   "glGetMapParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[21897]: Uniform4iARB (will be remapped) */
+   "iiiii\0"
+   "glUniform4i\0"
+   "glUniform4iARB\0"
+   "\0"
+   /* _mesa_function_pool[21931]: ReadBuffer (offset 254) */
+   "i\0"
+   "glReadBuffer\0"
+   "\0"
+   /* _mesa_function_pool[21947]: ConvolutionParameteri (offset 352) */
+   "iii\0"
+   "glConvolutionParameteri\0"
+   "glConvolutionParameteriEXT\0"
+   "\0"
+   /* _mesa_function_pool[22003]: Ortho (offset 296) */
+   "dddddd\0"
+   "glOrtho\0"
+   "\0"
+   /* _mesa_function_pool[22019]: Binormal3sEXT (dynamic) */
+   "iii\0"
+   "glBinormal3sEXT\0"
+   "\0"
+   /* _mesa_function_pool[22040]: ListBase (offset 6) */
+   "i\0"
+   "glListBase\0"
+   "\0"
+   /* _mesa_function_pool[22054]: Vertex3s (offset 140) */
+   "iii\0"
+   "glVertex3s\0"
+   "\0"
+   /* _mesa_function_pool[22070]: ConvolutionParameterf (offset 350) */
+   "iif\0"
+   "glConvolutionParameterf\0"
+   "glConvolutionParameterfEXT\0"
+   "\0"
+   /* _mesa_function_pool[22126]: GetColorTableParameteriv (offset 345) */
+   "iip\0"
+   "glGetColorTableParameteriv\0"
+   "glGetColorTableParameterivSGI\0"
+   "glGetColorTableParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[22218]: ProgramEnvParameter4dvARB (will be remapped) */
+   "iip\0"
+   "glProgramEnvParameter4dvARB\0"
+   "glProgramParameter4dvNV\0"
+   "\0"
+   /* _mesa_function_pool[22275]: ShadeModel (offset 177) */
+   "i\0"
+   "glShadeModel\0"
+   "\0"
+   /* _mesa_function_pool[22291]: VertexAttribs2fvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs2fvNV\0"
+   "\0"
+   /* _mesa_function_pool[22317]: Rectiv (offset 91) */
+   "pp\0"
+   "glRectiv\0"
+   "\0"
+   /* _mesa_function_pool[22330]: UseProgramObjectARB (will be remapped) */
+   "i\0"
+   "glUseProgram\0"
+   "glUseProgramObjectARB\0"
+   "\0"
+   /* _mesa_function_pool[22368]: GetMapParameterfvNV (dynamic) */
+   "iip\0"
+   "glGetMapParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[22395]: PassTexCoordATI (will be remapped) */
+   "iii\0"
+   "glPassTexCoordATI\0"
+   "\0"
+   /* _mesa_function_pool[22418]: DeleteProgram (will be remapped) */
+   "i\0"
+   "glDeleteProgram\0"
+   "\0"
+   /* _mesa_function_pool[22437]: Tangent3ivEXT (dynamic) */
+   "p\0"
+   "glTangent3ivEXT\0"
+   "\0"
+   /* _mesa_function_pool[22456]: Tangent3dEXT (dynamic) */
+   "ddd\0"
+   "glTangent3dEXT\0"
+   "\0"
+   /* _mesa_function_pool[22476]: SecondaryColor3dvEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3dv\0"
+   "glSecondaryColor3dvEXT\0"
+   "\0"
+   /* _mesa_function_pool[22522]: Vertex2fv (offset 129) */
+   "p\0"
+   "glVertex2fv\0"
+   "\0"
+   /* _mesa_function_pool[22537]: MultiDrawArraysEXT (will be remapped) */
+   "ippi\0"
+   "glMultiDrawArrays\0"
+   "glMultiDrawArraysEXT\0"
+   "\0"
+   /* _mesa_function_pool[22582]: BindRenderbufferEXT (will be remapped) */
+   "ii\0"
+   "glBindRenderbuffer\0"
+   "glBindRenderbufferEXT\0"
+   "\0"
+   /* _mesa_function_pool[22627]: MultiTexCoord4dARB (offset 400) */
+   "idddd\0"
+   "glMultiTexCoord4d\0"
+   "glMultiTexCoord4dARB\0"
+   "\0"
+   /* _mesa_function_pool[22673]: Vertex3sv (offset 141) */
+   "p\0"
+   "glVertex3sv\0"
+   "\0"
+   /* _mesa_function_pool[22688]: SecondaryColor3usEXT (will be remapped) */
+   "iii\0"
+   "glSecondaryColor3us\0"
+   "glSecondaryColor3usEXT\0"
+   "\0"
+   /* _mesa_function_pool[22736]: ProgramLocalParameter4fvARB (will be remapped) */
+   "iip\0"
+   "glProgramLocalParameter4fvARB\0"
+   "\0"
+   /* _mesa_function_pool[22771]: DeleteProgramsNV (will be remapped) */
+   "ip\0"
+   "glDeleteProgramsARB\0"
+   "glDeleteProgramsNV\0"
+   "\0"
+   /* _mesa_function_pool[22814]: EvalMesh1 (offset 236) */
+   "iii\0"
+   "glEvalMesh1\0"
+   "\0"
+   /* _mesa_function_pool[22831]: MultiTexCoord1sARB (offset 382) */
+   "ii\0"
+   "glMultiTexCoord1s\0"
+   "glMultiTexCoord1sARB\0"
+   "\0"
+   /* _mesa_function_pool[22874]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
+   "iffffff\0"
+   "glReplacementCodeuiColor3fVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[22921]: GetVertexAttribPointervNV (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribPointerv\0"
+   "glGetVertexAttribPointervARB\0"
+   "glGetVertexAttribPointervNV\0"
+   "\0"
+   /* _mesa_function_pool[23009]: MultiTexCoord1dvARB (offset 377) */
+   "ip\0"
+   "glMultiTexCoord1dv\0"
+   "glMultiTexCoord1dvARB\0"
+   "\0"
+   /* _mesa_function_pool[23054]: Uniform2iARB (will be remapped) */
+   "iii\0"
+   "glUniform2i\0"
+   "glUniform2iARB\0"
+   "\0"
+   /* _mesa_function_pool[23086]: Vertex2iv (offset 131) */
+   "p\0"
+   "glVertex2iv\0"
+   "\0"
+   /* _mesa_function_pool[23101]: GetProgramStringNV (will be remapped) */
+   "iip\0"
+   "glGetProgramStringNV\0"
+   "\0"
+   /* _mesa_function_pool[23127]: ColorPointerEXT (will be remapped) */
+   "iiiip\0"
+   "glColorPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[23152]: LineWidth (offset 168) */
+   "f\0"
+   "glLineWidth\0"
+   "\0"
+   /* _mesa_function_pool[23167]: MapBufferARB (will be remapped) */
+   "ii\0"
+   "glMapBuffer\0"
+   "glMapBufferARB\0"
+   "\0"
+   /* _mesa_function_pool[23198]: MultiDrawElementsBaseVertex (will be remapped) */
+   "ipipip\0"
+   "glMultiDrawElementsBaseVertex\0"
+   "\0"
+   /* _mesa_function_pool[23236]: Binormal3svEXT (dynamic) */
+   "p\0"
+   "glBinormal3svEXT\0"
+   "\0"
+   /* _mesa_function_pool[23256]: ApplyTextureEXT (dynamic) */
+   "i\0"
+   "glApplyTextureEXT\0"
+   "\0"
+   /* _mesa_function_pool[23277]: TexGendv (offset 189) */
+   "iip\0"
+   "glTexGendv\0"
+   "\0"
+   /* _mesa_function_pool[23293]: TextureMaterialEXT (dynamic) */
+   "ii\0"
+   "glTextureMaterialEXT\0"
+   "\0"
+   /* _mesa_function_pool[23318]: TextureLightEXT (dynamic) */
+   "i\0"
+   "glTextureLightEXT\0"
+   "\0"
+   /* _mesa_function_pool[23339]: ResetMinmax (offset 370) */
+   "i\0"
+   "glResetMinmax\0"
+   "glResetMinmaxEXT\0"
+   "\0"
+   /* _mesa_function_pool[23373]: SpriteParameterfSGIX (dynamic) */
+   "if\0"
+   "glSpriteParameterfSGIX\0"
+   "\0"
+   /* _mesa_function_pool[23400]: EnableClientState (offset 313) */
+   "i\0"
+   "glEnableClientState\0"
+   "\0"
+   /* _mesa_function_pool[23423]: VertexAttrib4sNV (will be remapped) */
+   "iiiii\0"
+   "glVertexAttrib4sNV\0"
+   "\0"
+   /* _mesa_function_pool[23449]: GetConvolutionParameterfv (offset 357) */
+   "iip\0"
+   "glGetConvolutionParameterfv\0"
+   "glGetConvolutionParameterfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[23513]: VertexAttribs4dvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs4dvNV\0"
+   "\0"
+   /* _mesa_function_pool[23539]: MultiModeDrawArraysIBM (will be remapped) */
+   "pppii\0"
+   "glMultiModeDrawArraysIBM\0"
+   "\0"
+   /* _mesa_function_pool[23571]: VertexAttrib4dARB (will be remapped) */
+   "idddd\0"
+   "glVertexAttrib4d\0"
+   "glVertexAttrib4dARB\0"
+   "\0"
+   /* _mesa_function_pool[23615]: GetTexBumpParameterfvATI (will be remapped) */
+   "ip\0"
+   "glGetTexBumpParameterfvATI\0"
+   "\0"
+   /* _mesa_function_pool[23646]: ProgramNamedParameter4dNV (will be remapped) */
+   "iipdddd\0"
+   "glProgramNamedParameter4dNV\0"
+   "\0"
+   /* _mesa_function_pool[23683]: GetMaterialfv (offset 269) */
+   "iip\0"
+   "glGetMaterialfv\0"
+   "\0"
+   /* _mesa_function_pool[23704]: VertexWeightfEXT (dynamic) */
+   "f\0"
+   "glVertexWeightfEXT\0"
+   "\0"
+   /* _mesa_function_pool[23726]: Binormal3fEXT (dynamic) */
+   "fff\0"
+   "glBinormal3fEXT\0"
+   "\0"
+   /* _mesa_function_pool[23747]: CallList (offset 2) */
+   "i\0"
+   "glCallList\0"
+   "\0"
+   /* _mesa_function_pool[23761]: Materialfv (offset 170) */
+   "iip\0"
+   "glMaterialfv\0"
+   "\0"
+   /* _mesa_function_pool[23779]: TexCoord3fv (offset 113) */
+   "p\0"
+   "glTexCoord3fv\0"
+   "\0"
+   /* _mesa_function_pool[23796]: FogCoordfvEXT (will be remapped) */
+   "p\0"
+   "glFogCoordfv\0"
+   "glFogCoordfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[23828]: MultiTexCoord1ivARB (offset 381) */
+   "ip\0"
+   "glMultiTexCoord1iv\0"
+   "glMultiTexCoord1ivARB\0"
+   "\0"
+   /* _mesa_function_pool[23873]: SecondaryColor3ubEXT (will be remapped) */
+   "iii\0"
+   "glSecondaryColor3ub\0"
+   "glSecondaryColor3ubEXT\0"
+   "\0"
+   /* _mesa_function_pool[23921]: MultiTexCoord2ivARB (offset 389) */
+   "ip\0"
+   "glMultiTexCoord2iv\0"
+   "glMultiTexCoord2ivARB\0"
+   "\0"
+   /* _mesa_function_pool[23966]: FogFuncSGIS (dynamic) */
+   "ip\0"
+   "glFogFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[23984]: CopyTexSubImage2D (offset 326) */
+   "iiiiiiii\0"
+   "glCopyTexSubImage2D\0"
+   "glCopyTexSubImage2DEXT\0"
+   "\0"
+   /* _mesa_function_pool[24037]: GetObjectParameterivARB (will be remapped) */
+   "iip\0"
+   "glGetObjectParameterivARB\0"
+   "\0"
+   /* _mesa_function_pool[24068]: Color3iv (offset 16) */
+   "p\0"
+   "glColor3iv\0"
+   "\0"
+   /* _mesa_function_pool[24082]: TexCoord4fVertex4fSUN (dynamic) */
+   "ffffffff\0"
+   "glTexCoord4fVertex4fSUN\0"
+   "\0"
+   /* _mesa_function_pool[24116]: DrawElements (offset 311) */
+   "iiip\0"
+   "glDrawElements\0"
+   "\0"
+   /* _mesa_function_pool[24137]: BindVertexArrayAPPLE (will be remapped) */
+   "i\0"
+   "glBindVertexArrayAPPLE\0"
+   "\0"
+   /* _mesa_function_pool[24163]: GetProgramLocalParameterdvARB (will be remapped) */
+   "iip\0"
+   "glGetProgramLocalParameterdvARB\0"
+   "\0"
+   /* _mesa_function_pool[24200]: GetHistogramParameteriv (offset 363) */
+   "iip\0"
+   "glGetHistogramParameteriv\0"
+   "glGetHistogramParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[24260]: MultiTexCoord1iARB (offset 380) */
+   "ii\0"
+   "glMultiTexCoord1i\0"
+   "glMultiTexCoord1iARB\0"
+   "\0"
+   /* _mesa_function_pool[24303]: GetConvolutionFilter (offset 356) */
+   "iiip\0"
+   "glGetConvolutionFilter\0"
+   "glGetConvolutionFilterEXT\0"
+   "\0"
+   /* _mesa_function_pool[24358]: GetProgramivARB (will be remapped) */
+   "iip\0"
+   "glGetProgramivARB\0"
+   "\0"
+   /* _mesa_function_pool[24381]: BlendFuncSeparateEXT (will be remapped) */
+   "iiii\0"
+   "glBlendFuncSeparate\0"
+   "glBlendFuncSeparateEXT\0"
+   "glBlendFuncSeparateINGR\0"
+   "\0"
+   /* _mesa_function_pool[24454]: MapBufferRange (will be remapped) */
+   "iiii\0"
+   "glMapBufferRange\0"
+   "\0"
+   /* _mesa_function_pool[24477]: ProgramParameters4dvNV (will be remapped) */
+   "iiip\0"
+   "glProgramParameters4dvNV\0"
+   "\0"
+   /* _mesa_function_pool[24508]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glTexCoord2fColor3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[24545]: EvalPoint2 (offset 239) */
+   "ii\0"
+   "glEvalPoint2\0"
+   "\0"
+   /* _mesa_function_pool[24562]: EvalPoint1 (offset 237) */
+   "i\0"
+   "glEvalPoint1\0"
+   "\0"
+   /* _mesa_function_pool[24578]: Binormal3dvEXT (dynamic) */
+   "p\0"
+   "glBinormal3dvEXT\0"
+   "\0"
+   /* _mesa_function_pool[24598]: PopMatrix (offset 297) */
+   "\0"
+   "glPopMatrix\0"
+   "\0"
+   /* _mesa_function_pool[24612]: FinishFenceNV (will be remapped) */
+   "i\0"
+   "glFinishFenceNV\0"
+   "\0"
+   /* _mesa_function_pool[24631]: GetFogFuncSGIS (dynamic) */
+   "p\0"
+   "glGetFogFuncSGIS\0"
+   "\0"
+   /* _mesa_function_pool[24651]: GetUniformLocationARB (will be remapped) */
+   "ip\0"
+   "glGetUniformLocation\0"
+   "glGetUniformLocationARB\0"
+   "\0"
+   /* _mesa_function_pool[24700]: SecondaryColor3fEXT (will be remapped) */
+   "fff\0"
+   "glSecondaryColor3f\0"
+   "glSecondaryColor3fEXT\0"
+   "\0"
+   /* _mesa_function_pool[24746]: GetTexGeniv (offset 280) */
+   "iip\0"
+   "glGetTexGeniv\0"
+   "\0"
+   /* _mesa_function_pool[24765]: CombinerInputNV (will be remapped) */
+   "iiiiii\0"
+   "glCombinerInputNV\0"
+   "\0"
+   /* _mesa_function_pool[24791]: VertexAttrib3sARB (will be remapped) */
+   "iiii\0"
+   "glVertexAttrib3s\0"
+   "glVertexAttrib3sARB\0"
+   "\0"
+   /* _mesa_function_pool[24834]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
+   "ppp\0"
+   "glReplacementCodeuiNormal3fVertex3fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[24879]: Map2d (offset 222) */
+   "iddiiddiip\0"
+   "glMap2d\0"
+   "\0"
+   /* _mesa_function_pool[24899]: Map2f (offset 223) */
+   "iffiiffiip\0"
+   "glMap2f\0"
+   "\0"
+   /* _mesa_function_pool[24919]: ProgramStringARB (will be remapped) */
+   "iiip\0"
+   "glProgramStringARB\0"
+   "\0"
+   /* _mesa_function_pool[24944]: Vertex4s (offset 148) */
+   "iiii\0"
+   "glVertex4s\0"
+   "\0"
+   /* _mesa_function_pool[24961]: TexCoord4fVertex4fvSUN (dynamic) */
+   "pp\0"
+   "glTexCoord4fVertex4fvSUN\0"
+   "\0"
+   /* _mesa_function_pool[24990]: VertexAttrib3sNV (will be remapped) */
+   "iiii\0"
+   "glVertexAttrib3sNV\0"
+   "\0"
+   /* _mesa_function_pool[25015]: VertexAttrib1fNV (will be remapped) */
+   "if\0"
+   "glVertexAttrib1fNV\0"
+   "\0"
+   /* _mesa_function_pool[25038]: Vertex4f (offset 144) */
+   "ffff\0"
+   "glVertex4f\0"
+   "\0"
+   /* _mesa_function_pool[25055]: EvalCoord1d (offset 228) */
+   "d\0"
+   "glEvalCoord1d\0"
+   "\0"
+   /* _mesa_function_pool[25072]: Vertex4d (offset 142) */
+   "dddd\0"
+   "glVertex4d\0"
+   "\0"
+   /* _mesa_function_pool[25089]: RasterPos4dv (offset 79) */
+   "p\0"
+   "glRasterPos4dv\0"
+   "\0"
+   /* _mesa_function_pool[25107]: FragmentLightfSGIX (dynamic) */
+   "iif\0"
+   "glFragmentLightfSGIX\0"
+   "\0"
+   /* _mesa_function_pool[25133]: GetCompressedTexImageARB (will be remapped) */
+   "iip\0"
+   "glGetCompressedTexImage\0"
+   "glGetCompressedTexImageARB\0"
+   "\0"
+   /* _mesa_function_pool[25189]: GetTexGenfv (offset 279) */
+   "iip\0"
+   "glGetTexGenfv\0"
+   "\0"
+   /* _mesa_function_pool[25208]: Vertex4i (offset 146) */
+   "iiii\0"
+   "glVertex4i\0"
+   "\0"
+   /* _mesa_function_pool[25225]: VertexWeightPointerEXT (dynamic) */
+   "iiip\0"
+   "glVertexWeightPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[25256]: GetHistogram (offset 361) */
+   "iiiip\0"
+   "glGetHistogram\0"
+   "glGetHistogramEXT\0"
+   "\0"
+   /* _mesa_function_pool[25296]: ActiveStencilFaceEXT (will be remapped) */
+   "i\0"
+   "glActiveStencilFaceEXT\0"
+   "\0"
+   /* _mesa_function_pool[25322]: StencilFuncSeparateATI (will be remapped) */
+   "iiii\0"
+   "glStencilFuncSeparateATI\0"
+   "\0"
+   /* _mesa_function_pool[25353]: Materialf (offset 169) */
+   "iif\0"
+   "glMaterialf\0"
+   "\0"
+   /* _mesa_function_pool[25370]: GetShaderSourceARB (will be remapped) */
+   "iipp\0"
+   "glGetShaderSource\0"
+   "glGetShaderSourceARB\0"
+   "\0"
+   /* _mesa_function_pool[25415]: IglooInterfaceSGIX (dynamic) */
+   "ip\0"
+   "glIglooInterfaceSGIX\0"
+   "\0"
+   /* _mesa_function_pool[25440]: Materiali (offset 171) */
+   "iii\0"
+   "glMateriali\0"
+   "\0"
+   /* _mesa_function_pool[25457]: VertexAttrib4dNV (will be remapped) */
+   "idddd\0"
+   "glVertexAttrib4dNV\0"
+   "\0"
+   /* _mesa_function_pool[25483]: MultiModeDrawElementsIBM (will be remapped) */
+   "ppipii\0"
+   "glMultiModeDrawElementsIBM\0"
+   "\0"
+   /* _mesa_function_pool[25518]: Indexsv (offset 51) */
+   "p\0"
+   "glIndexsv\0"
+   "\0"
+   /* _mesa_function_pool[25531]: MultiTexCoord4svARB (offset 407) */
+   "ip\0"
+   "glMultiTexCoord4sv\0"
+   "glMultiTexCoord4svARB\0"
+   "\0"
+   /* _mesa_function_pool[25576]: LightModelfv (offset 164) */
+   "ip\0"
+   "glLightModelfv\0"
+   "\0"
+   /* _mesa_function_pool[25595]: TexCoord2dv (offset 103) */
+   "p\0"
+   "glTexCoord2dv\0"
+   "\0"
+   /* _mesa_function_pool[25612]: GenQueriesARB (will be remapped) */
+   "ip\0"
+   "glGenQueries\0"
+   "glGenQueriesARB\0"
+   "\0"
+   /* _mesa_function_pool[25645]: EvalCoord1dv (offset 229) */
+   "p\0"
+   "glEvalCoord1dv\0"
+   "\0"
+   /* _mesa_function_pool[25663]: ReplacementCodeuiVertex3fSUN (dynamic) */
+   "ifff\0"
+   "glReplacementCodeuiVertex3fSUN\0"
+   "\0"
+   /* _mesa_function_pool[25700]: Translated (offset 303) */
+   "ddd\0"
+   "glTranslated\0"
+   "\0"
+   /* _mesa_function_pool[25718]: Translatef (offset 304) */
+   "fff\0"
+   "glTranslatef\0"
+   "\0"
+   /* _mesa_function_pool[25736]: StencilMask (offset 209) */
+   "i\0"
+   "glStencilMask\0"
+   "\0"
+   /* _mesa_function_pool[25753]: Tangent3iEXT (dynamic) */
+   "iii\0"
+   "glTangent3iEXT\0"
+   "\0"
+   /* _mesa_function_pool[25773]: GetLightiv (offset 265) */
+   "iip\0"
+   "glGetLightiv\0"
+   "\0"
+   /* _mesa_function_pool[25791]: DrawMeshArraysSUN (dynamic) */
+   "iiii\0"
+   "glDrawMeshArraysSUN\0"
+   "\0"
+   /* _mesa_function_pool[25817]: IsList (offset 287) */
+   "i\0"
+   "glIsList\0"
+   "\0"
+   /* _mesa_function_pool[25829]: IsSync (will be remapped) */
+   "i\0"
+   "glIsSync\0"
+   "\0"
+   /* _mesa_function_pool[25841]: RenderMode (offset 196) */
+   "i\0"
+   "glRenderMode\0"
+   "\0"
+   /* _mesa_function_pool[25857]: GetMapControlPointsNV (dynamic) */
+   "iiiiiip\0"
+   "glGetMapControlPointsNV\0"
+   "\0"
+   /* _mesa_function_pool[25890]: DrawBuffersARB (will be remapped) */
+   "ip\0"
+   "glDrawBuffers\0"
+   "glDrawBuffersARB\0"
+   "glDrawBuffersATI\0"
+   "\0"
+   /* _mesa_function_pool[25942]: ProgramLocalParameter4fARB (will be remapped) */
+   "iiffff\0"
+   "glProgramLocalParameter4fARB\0"
+   "\0"
+   /* _mesa_function_pool[25979]: SpriteParameterivSGIX (dynamic) */
+   "ip\0"
+   "glSpriteParameterivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[26007]: ProvokingVertexEXT (will be remapped) */
+   "i\0"
+   "glProvokingVertexEXT\0"
+   "glProvokingVertex\0"
+   "\0"
+   /* _mesa_function_pool[26049]: MultiTexCoord1fARB (offset 378) */
+   "if\0"
+   "glMultiTexCoord1f\0"
+   "glMultiTexCoord1fARB\0"
+   "\0"
+   /* _mesa_function_pool[26092]: LoadName (offset 198) */
+   "i\0"
+   "glLoadName\0"
+   "\0"
+   /* _mesa_function_pool[26106]: VertexAttribs4ubvNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs4ubvNV\0"
+   "\0"
+   /* _mesa_function_pool[26133]: WeightsvARB (dynamic) */
+   "ip\0"
+   "glWeightsvARB\0"
+   "\0"
+   /* _mesa_function_pool[26151]: Uniform1fvARB (will be remapped) */
+   "iip\0"
+   "glUniform1fv\0"
+   "glUniform1fvARB\0"
+   "\0"
+   /* _mesa_function_pool[26185]: CopyTexSubImage1D (offset 325) */
+   "iiiiii\0"
+   "glCopyTexSubImage1D\0"
+   "glCopyTexSubImage1DEXT\0"
+   "\0"
+   /* _mesa_function_pool[26236]: CullFace (offset 152) */
+   "i\0"
+   "glCullFace\0"
+   "\0"
+   /* _mesa_function_pool[26250]: BindTexture (offset 307) */
+   "ii\0"
+   "glBindTexture\0"
+   "glBindTextureEXT\0"
+   "\0"
+   /* _mesa_function_pool[26285]: BeginFragmentShaderATI (will be remapped) */
+   "\0"
+   "glBeginFragmentShaderATI\0"
+   "\0"
+   /* _mesa_function_pool[26312]: MultiTexCoord4fARB (offset 402) */
+   "iffff\0"
+   "glMultiTexCoord4f\0"
+   "glMultiTexCoord4fARB\0"
+   "\0"
+   /* _mesa_function_pool[26358]: VertexAttribs3svNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs3svNV\0"
+   "\0"
+   /* _mesa_function_pool[26384]: StencilFunc (offset 243) */
+   "iii\0"
+   "glStencilFunc\0"
+   "\0"
+   /* _mesa_function_pool[26403]: CopyPixels (offset 255) */
+   "iiiii\0"
+   "glCopyPixels\0"
+   "\0"
+   /* _mesa_function_pool[26423]: Rectsv (offset 93) */
+   "pp\0"
+   "glRectsv\0"
+   "\0"
+   /* _mesa_function_pool[26436]: ReplacementCodeuivSUN (dynamic) */
+   "p\0"
+   "glReplacementCodeuivSUN\0"
+   "\0"
+   /* _mesa_function_pool[26463]: EnableVertexAttribArrayARB (will be remapped) */
+   "i\0"
+   "glEnableVertexAttribArray\0"
+   "glEnableVertexAttribArrayARB\0"
+   "\0"
+   /* _mesa_function_pool[26521]: NormalPointervINTEL (dynamic) */
+   "ip\0"
+   "glNormalPointervINTEL\0"
+   "\0"
+   /* _mesa_function_pool[26547]: CopyConvolutionFilter2D (offset 355) */
+   "iiiiii\0"
+   "glCopyConvolutionFilter2D\0"
+   "glCopyConvolutionFilter2DEXT\0"
+   "\0"
+   /* _mesa_function_pool[26610]: WindowPos3ivMESA (will be remapped) */
+   "p\0"
+   "glWindowPos3iv\0"
+   "glWindowPos3ivARB\0"
+   "glWindowPos3ivMESA\0"
+   "\0"
+   /* _mesa_function_pool[26665]: CopyBufferSubData (will be remapped) */
+   "iiiii\0"
+   "glCopyBufferSubData\0"
+   "\0"
+   /* _mesa_function_pool[26692]: NormalPointer (offset 318) */
+   "iip\0"
+   "glNormalPointer\0"
+   "\0"
+   /* _mesa_function_pool[26713]: TexParameterfv (offset 179) */
+   "iip\0"
+   "glTexParameterfv\0"
+   "\0"
+   /* _mesa_function_pool[26735]: IsBufferARB (will be remapped) */
+   "i\0"
+   "glIsBuffer\0"
+   "glIsBufferARB\0"
+   "\0"
+   /* _mesa_function_pool[26763]: WindowPos4iMESA (will be remapped) */
+   "iiii\0"
+   "glWindowPos4iMESA\0"
+   "\0"
+   /* _mesa_function_pool[26787]: VertexAttrib4uivARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4uiv\0"
+   "glVertexAttrib4uivARB\0"
+   "\0"
+   /* _mesa_function_pool[26832]: Tangent3bvEXT (dynamic) */
+   "p\0"
+   "glTangent3bvEXT\0"
+   "\0"
+   /* _mesa_function_pool[26851]: UniformMatrix3x4fv (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix3x4fv\0"
+   "\0"
+   /* _mesa_function_pool[26878]: ClipPlane (offset 150) */
+   "ip\0"
+   "glClipPlane\0"
+   "\0"
+   /* _mesa_function_pool[26894]: Recti (offset 90) */
+   "iiii\0"
+   "glRecti\0"
+   "\0"
+   /* _mesa_function_pool[26908]: DrawRangeElementsBaseVertex (will be remapped) */
+   "iiiiipi\0"
+   "glDrawRangeElementsBaseVertex\0"
+   "\0"
+   /* _mesa_function_pool[26947]: TexCoordPointervINTEL (dynamic) */
+   "iip\0"
+   "glTexCoordPointervINTEL\0"
+   "\0"
+   /* _mesa_function_pool[26976]: DeleteBuffersARB (will be remapped) */
+   "ip\0"
+   "glDeleteBuffers\0"
+   "glDeleteBuffersARB\0"
+   "\0"
+   /* _mesa_function_pool[27015]: WindowPos4fvMESA (will be remapped) */
+   "p\0"
+   "glWindowPos4fvMESA\0"
+   "\0"
+   /* _mesa_function_pool[27037]: GetPixelMapuiv (offset 272) */
+   "ip\0"
+   "glGetPixelMapuiv\0"
+   "\0"
+   /* _mesa_function_pool[27058]: Rectf (offset 88) */
+   "ffff\0"
+   "glRectf\0"
+   "\0"
+   /* _mesa_function_pool[27072]: VertexAttrib1sNV (will be remapped) */
+   "ii\0"
+   "glVertexAttrib1sNV\0"
+   "\0"
+   /* _mesa_function_pool[27095]: Indexfv (offset 47) */
+   "p\0"
+   "glIndexfv\0"
+   "\0"
+   /* _mesa_function_pool[27108]: SecondaryColor3svEXT (will be remapped) */
+   "p\0"
+   "glSecondaryColor3sv\0"
+   "glSecondaryColor3svEXT\0"
+   "\0"
+   /* _mesa_function_pool[27154]: LoadTransposeMatrixfARB (will be remapped) */
+   "p\0"
+   "glLoadTransposeMatrixf\0"
+   "glLoadTransposeMatrixfARB\0"
+   "\0"
+   /* _mesa_function_pool[27206]: GetPointerv (offset 329) */
+   "ip\0"
+   "glGetPointerv\0"
+   "glGetPointervEXT\0"
+   "\0"
+   /* _mesa_function_pool[27241]: Tangent3bEXT (dynamic) */
+   "iii\0"
+   "glTangent3bEXT\0"
+   "\0"
+   /* _mesa_function_pool[27261]: CombinerParameterfNV (will be remapped) */
+   "if\0"
+   "glCombinerParameterfNV\0"
+   "\0"
+   /* _mesa_function_pool[27288]: IndexMask (offset 212) */
+   "i\0"
+   "glIndexMask\0"
+   "\0"
+   /* _mesa_function_pool[27303]: BindProgramNV (will be remapped) */
+   "ii\0"
+   "glBindProgramARB\0"
+   "glBindProgramNV\0"
+   "\0"
+   /* _mesa_function_pool[27340]: VertexAttrib4svARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4sv\0"
+   "glVertexAttrib4svARB\0"
+   "\0"
+   /* _mesa_function_pool[27383]: GetFloatv (offset 262) */
+   "ip\0"
+   "glGetFloatv\0"
+   "\0"
+   /* _mesa_function_pool[27399]: CreateDebugObjectMESA (dynamic) */
+   "\0"
+   "glCreateDebugObjectMESA\0"
+   "\0"
+   /* _mesa_function_pool[27425]: GetShaderiv (will be remapped) */
+   "iip\0"
+   "glGetShaderiv\0"
+   "\0"
+   /* _mesa_function_pool[27444]: ClientWaitSync (will be remapped) */
+   "iii\0"
+   "glClientWaitSync\0"
+   "\0"
+   /* _mesa_function_pool[27466]: TexCoord4s (offset 124) */
+   "iiii\0"
+   "glTexCoord4s\0"
+   "\0"
+   /* _mesa_function_pool[27485]: TexCoord3sv (offset 117) */
+   "p\0"
+   "glTexCoord3sv\0"
+   "\0"
+   /* _mesa_function_pool[27502]: BindFragmentShaderATI (will be remapped) */
+   "i\0"
+   "glBindFragmentShaderATI\0"
+   "\0"
+   /* _mesa_function_pool[27529]: PopAttrib (offset 218) */
+   "\0"
+   "glPopAttrib\0"
+   "\0"
+   /* _mesa_function_pool[27543]: Fogfv (offset 154) */
+   "ip\0"
+   "glFogfv\0"
+   "\0"
+   /* _mesa_function_pool[27555]: UnmapBufferARB (will be remapped) */
+   "i\0"
+   "glUnmapBuffer\0"
+   "glUnmapBufferARB\0"
+   "\0"
+   /* _mesa_function_pool[27589]: InitNames (offset 197) */
+   "\0"
+   "glInitNames\0"
+   "\0"
+   /* _mesa_function_pool[27603]: Normal3sv (offset 61) */
+   "p\0"
+   "glNormal3sv\0"
+   "\0"
+   /* _mesa_function_pool[27618]: Minmax (offset 368) */
+   "iii\0"
+   "glMinmax\0"
+   "glMinmaxEXT\0"
+   "\0"
+   /* _mesa_function_pool[27644]: TexCoord4d (offset 118) */
+   "dddd\0"
+   "glTexCoord4d\0"
+   "\0"
+   /* _mesa_function_pool[27663]: TexCoord4f (offset 120) */
+   "ffff\0"
+   "glTexCoord4f\0"
+   "\0"
+   /* _mesa_function_pool[27682]: FogCoorddvEXT (will be remapped) */
+   "p\0"
+   "glFogCoorddv\0"
+   "glFogCoorddvEXT\0"
+   "\0"
+   /* _mesa_function_pool[27714]: FinishTextureSUNX (dynamic) */
+   "\0"
+   "glFinishTextureSUNX\0"
+   "\0"
+   /* _mesa_function_pool[27736]: GetFragmentLightfvSGIX (dynamic) */
+   "iip\0"
+   "glGetFragmentLightfvSGIX\0"
+   "\0"
+   /* _mesa_function_pool[27766]: Binormal3fvEXT (dynamic) */
+   "p\0"
+   "glBinormal3fvEXT\0"
+   "\0"
+   /* _mesa_function_pool[27786]: GetBooleanv (offset 258) */
+   "ip\0"
+   "glGetBooleanv\0"
+   "\0"
+   /* _mesa_function_pool[27804]: ColorFragmentOp3ATI (will be remapped) */
+   "iiiiiiiiiiiii\0"
+   "glColorFragmentOp3ATI\0"
+   "\0"
+   /* _mesa_function_pool[27841]: Hint (offset 158) */
+   "ii\0"
+   "glHint\0"
+   "\0"
+   /* _mesa_function_pool[27852]: Color4dv (offset 28) */
+   "p\0"
+   "glColor4dv\0"
+   "\0"
+   /* _mesa_function_pool[27866]: VertexAttrib2svARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib2sv\0"
+   "glVertexAttrib2svARB\0"
+   "\0"
+   /* _mesa_function_pool[27909]: AreProgramsResidentNV (will be remapped) */
+   "ipp\0"
+   "glAreProgramsResidentNV\0"
+   "\0"
+   /* _mesa_function_pool[27938]: WindowPos3svMESA (will be remapped) */
+   "p\0"
+   "glWindowPos3sv\0"
+   "glWindowPos3svARB\0"
+   "glWindowPos3svMESA\0"
+   "\0"
+   /* _mesa_function_pool[27993]: CopyColorSubTable (offset 347) */
+   "iiiii\0"
+   "glCopyColorSubTable\0"
+   "glCopyColorSubTableEXT\0"
+   "\0"
+   /* _mesa_function_pool[28043]: WeightdvARB (dynamic) */
+   "ip\0"
+   "glWeightdvARB\0"
+   "\0"
+   /* _mesa_function_pool[28061]: DeleteRenderbuffersEXT (will be remapped) */
+   "ip\0"
+   "glDeleteRenderbuffers\0"
+   "glDeleteRenderbuffersEXT\0"
+   "\0"
+   /* _mesa_function_pool[28112]: VertexAttrib4NubvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4Nubv\0"
+   "glVertexAttrib4NubvARB\0"
+   "\0"
+   /* _mesa_function_pool[28159]: VertexAttrib3dvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib3dvNV\0"
+   "\0"
+   /* _mesa_function_pool[28183]: GetObjectParameterfvARB (will be remapped) */
+   "iip\0"
+   "glGetObjectParameterfvARB\0"
+   "\0"
+   /* _mesa_function_pool[28214]: Vertex4iv (offset 147) */
+   "p\0"
+   "glVertex4iv\0"
+   "\0"
+   /* _mesa_function_pool[28229]: GetProgramEnvParameterdvARB (will be remapped) */
+   "iip\0"
+   "glGetProgramEnvParameterdvARB\0"
+   "\0"
+   /* _mesa_function_pool[28264]: TexCoord4dv (offset 119) */
+   "p\0"
+   "glTexCoord4dv\0"
+   "\0"
+   /* _mesa_function_pool[28281]: LockArraysEXT (will be remapped) */
+   "ii\0"
+   "glLockArraysEXT\0"
+   "\0"
+   /* _mesa_function_pool[28301]: Begin (offset 7) */
+   "i\0"
+   "glBegin\0"
+   "\0"
+   /* _mesa_function_pool[28312]: LightModeli (offset 165) */
+   "ii\0"
+   "glLightModeli\0"
+   "\0"
+   /* _mesa_function_pool[28330]: Rectfv (offset 89) */
+   "pp\0"
+   "glRectfv\0"
+   "\0"
+   /* _mesa_function_pool[28343]: LightModelf (offset 163) */
+   "if\0"
+   "glLightModelf\0"
+   "\0"
+   /* _mesa_function_pool[28361]: GetTexParameterfv (offset 282) */
+   "iip\0"
+   "glGetTexParameterfv\0"
+   "\0"
+   /* _mesa_function_pool[28386]: GetLightfv (offset 264) */
+   "iip\0"
+   "glGetLightfv\0"
+   "\0"
+   /* _mesa_function_pool[28404]: PixelTransformParameterivEXT (dynamic) */
+   "iip\0"
+   "glPixelTransformParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[28440]: BinormalPointerEXT (dynamic) */
+   "iip\0"
+   "glBinormalPointerEXT\0"
+   "\0"
+   /* _mesa_function_pool[28466]: VertexAttrib1dNV (will be remapped) */
+   "id\0"
+   "glVertexAttrib1dNV\0"
+   "\0"
+   /* _mesa_function_pool[28489]: GetCombinerInputParameterivNV (will be remapped) */
+   "iiiip\0"
+   "glGetCombinerInputParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[28528]: Disable (offset 214) */
+   "i\0"
+   "glDisable\0"
+   "\0"
+   /* _mesa_function_pool[28541]: MultiTexCoord2fvARB (offset 387) */
+   "ip\0"
+   "glMultiTexCoord2fv\0"
+   "glMultiTexCoord2fvARB\0"
+   "\0"
+   /* _mesa_function_pool[28586]: GetRenderbufferParameterivEXT (will be remapped) */
+   "iip\0"
+   "glGetRenderbufferParameteriv\0"
+   "glGetRenderbufferParameterivEXT\0"
+   "\0"
+   /* _mesa_function_pool[28652]: CombinerParameterivNV (will be remapped) */
+   "ip\0"
+   "glCombinerParameterivNV\0"
+   "\0"
+   /* _mesa_function_pool[28680]: GenFragmentShadersATI (will be remapped) */
+   "i\0"
+   "glGenFragmentShadersATI\0"
+   "\0"
+   /* _mesa_function_pool[28707]: DrawArrays (offset 310) */
+   "iii\0"
+   "glDrawArrays\0"
+   "glDrawArraysEXT\0"
+   "\0"
+   /* _mesa_function_pool[28741]: WeightuivARB (dynamic) */
+   "ip\0"
+   "glWeightuivARB\0"
+   "\0"
+   /* _mesa_function_pool[28760]: VertexAttrib2sARB (will be remapped) */
+   "iii\0"
+   "glVertexAttrib2s\0"
+   "glVertexAttrib2sARB\0"
+   "\0"
+   /* _mesa_function_pool[28802]: ColorMask (offset 210) */
+   "iiii\0"
+   "glColorMask\0"
+   "\0"
+   /* _mesa_function_pool[28820]: GenAsyncMarkersSGIX (dynamic) */
+   "i\0"
+   "glGenAsyncMarkersSGIX\0"
+   "\0"
+   /* _mesa_function_pool[28845]: Tangent3svEXT (dynamic) */
+   "p\0"
+   "glTangent3svEXT\0"
+   "\0"
+   /* _mesa_function_pool[28864]: GetListParameterivSGIX (dynamic) */
+   "iip\0"
+   "glGetListParameterivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[28894]: BindBufferARB (will be remapped) */
+   "ii\0"
+   "glBindBuffer\0"
+   "glBindBufferARB\0"
+   "\0"
+   /* _mesa_function_pool[28927]: GetInfoLogARB (will be remapped) */
+   "iipp\0"
+   "glGetInfoLogARB\0"
+   "\0"
+   /* _mesa_function_pool[28949]: RasterPos4iv (offset 83) */
+   "p\0"
+   "glRasterPos4iv\0"
+   "\0"
+   /* _mesa_function_pool[28967]: Enable (offset 215) */
+   "i\0"
+   "glEnable\0"
+   "\0"
+   /* _mesa_function_pool[28979]: LineStipple (offset 167) */
+   "ii\0"
+   "glLineStipple\0"
+   "\0"
+   /* _mesa_function_pool[28997]: VertexAttribs4svNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs4svNV\0"
+   "\0"
+   /* _mesa_function_pool[29023]: EdgeFlagPointerListIBM (dynamic) */
+   "ipi\0"
+   "glEdgeFlagPointerListIBM\0"
+   "\0"
+   /* _mesa_function_pool[29053]: UniformMatrix3x2fv (will be remapped) */
+   "iiip\0"
+   "glUniformMatrix3x2fv\0"
+   "\0"
+   /* _mesa_function_pool[29080]: GetMinmaxParameterfv (offset 365) */
+   "iip\0"
+   "glGetMinmaxParameterfv\0"
+   "glGetMinmaxParameterfvEXT\0"
+   "\0"
+   /* _mesa_function_pool[29134]: VertexAttrib1fvARB (will be remapped) */
+   "ip\0"
+   "glVertexAttrib1fv\0"
+   "glVertexAttrib1fvARB\0"
+   "\0"
+   /* _mesa_function_pool[29177]: GenBuffersARB (will be remapped) */
+   "ip\0"
+   "glGenBuffers\0"
+   "glGenBuffersARB\0"
+   "\0"
+   /* _mesa_function_pool[29210]: VertexAttribs1svNV (will be remapped) */
+   "iip\0"
+   "glVertexAttribs1svNV\0"
+   "\0"
+   /* _mesa_function_pool[29236]: Vertex3fv (offset 137) */
+   "p\0"
+   "glVertex3fv\0"
+   "\0"
+   /* _mesa_function_pool[29251]: GetTexBumpParameterivATI (will be remapped) */
+   "ip\0"
+   "glGetTexBumpParameterivATI\0"
+   "\0"
+   /* _mesa_function_pool[29282]: Binormal3bEXT (dynamic) */
+   "iii\0"
+   "glBinormal3bEXT\0"
+   "\0"
+   /* _mesa_function_pool[29303]: FragmentMaterialivSGIX (dynamic) */
+   "iip\0"
+   "glFragmentMaterialivSGIX\0"
+   "\0"
+   /* _mesa_function_pool[29333]: IsRenderbufferEXT (will be remapped) */
+   "i\0"
+   "glIsRenderbuffer\0"
+   "glIsRenderbufferEXT\0"
+   "\0"
+   /* _mesa_function_pool[29373]: GenProgramsNV (will be remapped) */
+   "ip\0"
+   "glGenProgramsARB\0"
+   "glGenProgramsNV\0"
+   "\0"
+   /* _mesa_function_pool[29410]: VertexAttrib4dvNV (will be remapped) */
+   "ip\0"
+   "glVertexAttrib4dvNV\0"
+   "\0"
+   /* _mesa_function_pool[29434]: EndFragmentShaderATI (will be remapped) */
+   "\0"
+   "glEndFragmentShaderATI\0"
+   "\0"
+   /* _mesa_function_pool[29459]: Binormal3iEXT (dynamic) */
+   "iii\0"
+   "glBinormal3iEXT\0"
+   "\0"
+   /* _mesa_function_pool[29480]: WindowPos2fMESA (will be remapped) */
+   "ff\0"
+   "glWindowPos2f\0"
+   "glWindowPos2fARB\0"
+   "glWindowPos2fMESA\0"
+   "\0"
+   ;
+
+/* these functions need to be remapped */
+static const struct {
+   GLint pool_index;
+   GLint remap_index;
+} MESA_remap_table_functions[] = {
+   {  1461, AttachShader_remap_index },
+   {  8704, CreateProgram_remap_index },
+   { 20158, CreateShader_remap_index },
+   { 22418, DeleteProgram_remap_index },
+   { 16193, DeleteShader_remap_index },
+   { 20604, DetachShader_remap_index },
+   { 15717, GetAttachedShaders_remap_index },
+   {  4244, GetProgramInfoLog_remap_index },
+   {   361, GetProgramiv_remap_index },
+   {  5547, GetShaderInfoLog_remap_index },
+   { 27425, GetShaderiv_remap_index },
+   { 11732, IsProgram_remap_index },
+   { 10767, IsShader_remap_index },
+   {  8808, StencilFuncSeparate_remap_index },
+   {  3487, StencilMaskSeparate_remap_index },
+   {  6623, StencilOpSeparate_remap_index },
+   { 19535, UniformMatrix2x3fv_remap_index },
+   {  2615, UniformMatrix2x4fv_remap_index },
+   { 29053, UniformMatrix3x2fv_remap_index },
+   { 26851, UniformMatrix3x4fv_remap_index },
+   { 14265, UniformMatrix4x2fv_remap_index },
+   {  2937, UniformMatrix4x3fv_remap_index },
+   {  8722, LoadTransposeMatrixdARB_remap_index },
+   { 27154, LoadTransposeMatrixfARB_remap_index },
+   {  4817, MultTransposeMatrixdARB_remap_index },
+   { 20791, MultTransposeMatrixfARB_remap_index },
+   {   172, SampleCoverageARB_remap_index },
+   {  4971, CompressedTexImage1DARB_remap_index },
+   { 21248, CompressedTexImage2DARB_remap_index },
+   {  3550, CompressedTexImage3DARB_remap_index },
+   { 16009, CompressedTexSubImage1DARB_remap_index },
+   {  1880, CompressedTexSubImage2DARB_remap_index },
+   { 17801, CompressedTexSubImage3DARB_remap_index },
+   { 25133, GetCompressedTexImageARB_remap_index },
+   {  3395, DisableVertexAttribArrayARB_remap_index },
+   { 26463, EnableVertexAttribArrayARB_remap_index },
+   { 28229, GetProgramEnvParameterdvARB_remap_index },
+   { 20671, GetProgramEnvParameterfvARB_remap_index },
+   { 24163, GetProgramLocalParameterdvARB_remap_index },
+   {  7065, GetProgramLocalParameterfvARB_remap_index },
+   { 16100, GetProgramStringARB_remap_index },
+   { 24358, GetProgramivARB_remap_index },
+   { 17996, GetVertexAttribdvARB_remap_index },
+   { 14154, GetVertexAttribfvARB_remap_index },
+   {  8617, GetVertexAttribivARB_remap_index },
+   { 16905, ProgramEnvParameter4dARB_remap_index },
+   { 22218, ProgramEnvParameter4dvARB_remap_index },
+   { 14762, ProgramEnvParameter4fARB_remap_index },
+   {  7928, ProgramEnvParameter4fvARB_remap_index },
+   {  3513, ProgramLocalParameter4dARB_remap_index },
+   { 11442, ProgramLocalParameter4dvARB_remap_index },
+   { 25942, ProgramLocalParameter4fARB_remap_index },
+   { 22736, ProgramLocalParameter4fvARB_remap_index },
+   { 24919, ProgramStringARB_remap_index },
+   { 17155, VertexAttrib1dARB_remap_index },
+   { 13808, VertexAttrib1dvARB_remap_index },
+   {  3688, VertexAttrib1fARB_remap_index },
+   { 29134, VertexAttrib1fvARB_remap_index },
+   {  6149, VertexAttrib1sARB_remap_index },
+   {  2054, VertexAttrib1svARB_remap_index },
+   { 13239, VertexAttrib2dARB_remap_index },
+   { 15336, VertexAttrib2dvARB_remap_index },
+   {  1480, VertexAttrib2fARB_remap_index },
+   { 15449, VertexAttrib2fvARB_remap_index },
+   { 28760, VertexAttrib2sARB_remap_index },
+   { 27866, VertexAttrib2svARB_remap_index },
+   {  9926, VertexAttrib3dARB_remap_index },
+   {  7631, VertexAttrib3dvARB_remap_index },
+   {  1567, VertexAttrib3fARB_remap_index },
+   { 19772, VertexAttrib3fvARB_remap_index },
+   { 24791, VertexAttrib3sARB_remap_index },
+   { 17738, VertexAttrib3svARB_remap_index },
+   {  4270, VertexAttrib4NbvARB_remap_index },
+   { 15672, VertexAttrib4NivARB_remap_index },
+   { 19727, VertexAttrib4NsvARB_remap_index },
+   { 20623, VertexAttrib4NubARB_remap_index },
+   { 28112, VertexAttrib4NubvARB_remap_index },
+   { 16566, VertexAttrib4NuivARB_remap_index },
+   {  2810, VertexAttrib4NusvARB_remap_index },
+   {  9549, VertexAttrib4bvARB_remap_index },
+   { 23571, VertexAttrib4dARB_remap_index },
+   { 18721, VertexAttrib4dvARB_remap_index },
+   { 10033, VertexAttrib4fARB_remap_index },
+   { 10403, VertexAttrib4fvARB_remap_index },
+   {  9001, VertexAttrib4ivARB_remap_index },
+   { 15150, VertexAttrib4sARB_remap_index },
+   { 27340, VertexAttrib4svARB_remap_index },
+   { 14567, VertexAttrib4ubvARB_remap_index },
+   { 26787, VertexAttrib4uivARB_remap_index },
+   { 17549, VertexAttrib4usvARB_remap_index },
+   { 19409, VertexAttribPointerARB_remap_index },
+   { 28894, BindBufferARB_remap_index },
+   {  5862, BufferDataARB_remap_index },
+   {  1382, BufferSubDataARB_remap_index },
+   { 26976, DeleteBuffersARB_remap_index },
+   { 29177, GenBuffersARB_remap_index },
+   { 15492, GetBufferParameterivARB_remap_index },
+   { 14714, GetBufferPointervARB_remap_index },
+   {  1335, GetBufferSubDataARB_remap_index },
+   { 26735, IsBufferARB_remap_index },
+   { 23167, MapBufferARB_remap_index },
+   { 27555, UnmapBufferARB_remap_index },
+   {   268, BeginQueryARB_remap_index },
+   { 17250, DeleteQueriesARB_remap_index },
+   { 10664, EndQueryARB_remap_index },
+   { 25612, GenQueriesARB_remap_index },
+   {  1772, GetQueryObjectivARB_remap_index },
+   { 15194, GetQueryObjectuivARB_remap_index },
+   {  1624, GetQueryivARB_remap_index },
+   { 17456, IsQueryARB_remap_index },
+   {  7241, AttachObjectARB_remap_index },
+   { 16155, CompileShaderARB_remap_index },
+   {  2879, CreateProgramObjectARB_remap_index },
+   {  5807, CreateShaderObjectARB_remap_index },
+   { 12656, DeleteObjectARB_remap_index },
+   { 21022, DetachObjectARB_remap_index },
+   { 10475, GetActiveUniformARB_remap_index },
+   {  8320, GetAttachedObjectsARB_remap_index },
+   {  8599, GetHandleARB_remap_index },
+   { 28927, GetInfoLogARB_remap_index },
+   { 28183, GetObjectParameterfvARB_remap_index },
+   { 24037, GetObjectParameterivARB_remap_index },
+   { 25370, GetShaderSourceARB_remap_index },
+   { 24651, GetUniformLocationARB_remap_index },
+   { 20893, GetUniformfvARB_remap_index },
+   { 11064, GetUniformivARB_remap_index },
+   { 17594, LinkProgramARB_remap_index },
+   { 17652, ShaderSourceARB_remap_index },
+   {  6523, Uniform1fARB_remap_index },
+   { 26151, Uniform1fvARB_remap_index },
+   { 19378, Uniform1iARB_remap_index },
+   { 18410, Uniform1ivARB_remap_index },
+   {  2003, Uniform2fARB_remap_index },
+   { 12492, Uniform2fvARB_remap_index },
+   { 23054, Uniform2iARB_remap_index },
+   {  2123, Uniform2ivARB_remap_index },
+   { 16265, Uniform3fARB_remap_index },
+   {  8350, Uniform3fvARB_remap_index },
+   {  5481, Uniform3iARB_remap_index },
+   { 14820, Uniform3ivARB_remap_index },
+   { 16711, Uniform4fARB_remap_index },
+   { 20757, Uniform4fvARB_remap_index },
+   { 21897, Uniform4iARB_remap_index },
+   { 17962, Uniform4ivARB_remap_index },
+   {  7293, UniformMatrix2fvARB_remap_index },
+   {    17, UniformMatrix3fvARB_remap_index },
+   {  2475, UniformMatrix4fvARB_remap_index },
+   { 22330, UseProgramObjectARB_remap_index },
+   { 12927, ValidateProgramARB_remap_index },
+   { 18764, BindAttribLocationARB_remap_index },
+   {  4315, GetActiveAttribARB_remap_index },
+   { 14501, GetAttribLocationARB_remap_index },
+   { 25890, DrawBuffersARB_remap_index },
+   { 11547, RenderbufferStorageMultisample_remap_index },
+   { 16759, FlushMappedBufferRange_remap_index },
+   { 24454, MapBufferRange_remap_index },
+   { 14376, BindVertexArray_remap_index },
+   { 12786, GenVertexArrays_remap_index },
+   { 26665, CopyBufferSubData_remap_index },
+   { 27444, ClientWaitSync_remap_index },
+   {  2394, DeleteSync_remap_index },
+   {  6190, FenceSync_remap_index },
+   { 13298, GetInteger64v_remap_index },
+   { 19834, GetSynciv_remap_index },
+   { 25829, IsSync_remap_index },
+   {  8268, WaitSync_remap_index },
+   {  3363, DrawElementsBaseVertex_remap_index },
+   { 26908, DrawRangeElementsBaseVertex_remap_index },
+   { 23198, MultiDrawElementsBaseVertex_remap_index },
+   {  4680, PolygonOffsetEXT_remap_index },
+   { 20393, GetPixelTexGenParameterfvSGIS_remap_index },
+   {  3895, GetPixelTexGenParameterivSGIS_remap_index },
+   { 20126, PixelTexGenParameterfSGIS_remap_index },
+   {   580, PixelTexGenParameterfvSGIS_remap_index },
+   { 11102, PixelTexGenParameteriSGIS_remap_index },
+   { 12063, PixelTexGenParameterivSGIS_remap_index },
+   { 14464, SampleMaskSGIS_remap_index },
+   { 17396, SamplePatternSGIS_remap_index },
+   { 23127, ColorPointerEXT_remap_index },
+   { 15379, EdgeFlagPointerEXT_remap_index },
+   {  5135, IndexPointerEXT_remap_index },
+   {  5215, NormalPointerEXT_remap_index },
+   { 13892, TexCoordPointerEXT_remap_index },
+   {  5985, VertexPointerEXT_remap_index },
+   {  3165, PointParameterfEXT_remap_index },
+   {  6830, PointParameterfvEXT_remap_index },
+   { 28281, LockArraysEXT_remap_index },
+   { 12991, UnlockArraysEXT_remap_index },
+   {  7837, CullParameterdvEXT_remap_index },
+   { 10270, CullParameterfvEXT_remap_index },
+   {  1151, SecondaryColor3bEXT_remap_index },
+   {  6989, SecondaryColor3bvEXT_remap_index },
+   {  9178, SecondaryColor3dEXT_remap_index },
+   { 22476, SecondaryColor3dvEXT_remap_index },
+   { 24700, SecondaryColor3fEXT_remap_index },
+   { 15945, SecondaryColor3fvEXT_remap_index },
+   {   426, SecondaryColor3iEXT_remap_index },
+   { 14202, SecondaryColor3ivEXT_remap_index },
+   {  8836, SecondaryColor3sEXT_remap_index },
+   { 27108, SecondaryColor3svEXT_remap_index },
+   { 23873, SecondaryColor3ubEXT_remap_index },
+   { 18655, SecondaryColor3ubvEXT_remap_index },
+   { 11297, SecondaryColor3uiEXT_remap_index },
+   { 20013, SecondaryColor3uivEXT_remap_index },
+   { 22688, SecondaryColor3usEXT_remap_index },
+   { 11370, SecondaryColor3usvEXT_remap_index },
+   { 10346, SecondaryColorPointerEXT_remap_index },
+   { 22537, MultiDrawArraysEXT_remap_index },
+   { 18345, MultiDrawElementsEXT_remap_index },
+   { 18540, FogCoordPointerEXT_remap_index },
+   {  4044, FogCoorddEXT_remap_index },
+   { 27682, FogCoorddvEXT_remap_index },
+   {  4105, FogCoordfEXT_remap_index },
+   { 23796, FogCoordfvEXT_remap_index },
+   { 16663, PixelTexGenSGIX_remap_index },
+   { 24381, BlendFuncSeparateEXT_remap_index },
+   {  5897, FlushVertexArrayRangeNV_remap_index },
+   {  4629, VertexArrayRangeNV_remap_index },
+   { 24765, CombinerInputNV_remap_index },
+   {  1946, CombinerOutputNV_remap_index },
+   { 27261, CombinerParameterfNV_remap_index },
+   {  4549, CombinerParameterfvNV_remap_index },
+   { 19584, CombinerParameteriNV_remap_index },
+   { 28652, CombinerParameterivNV_remap_index },
+   {  6267, FinalCombinerInputNV_remap_index },
+   {  8665, GetCombinerInputParameterfvNV_remap_index },
+   { 28489, GetCombinerInputParameterivNV_remap_index },
+   {  6066, GetCombinerOutputParameterfvNV_remap_index },
+   { 12024, GetCombinerOutputParameterivNV_remap_index },
+   {  5642, GetFinalCombinerInputParameterfvNV_remap_index },
+   { 21769, GetFinalCombinerInputParameterivNV_remap_index },
+   { 11042, ResizeBuffersMESA_remap_index },
+   {  9753, WindowPos2dMESA_remap_index },
+   {   944, WindowPos2dvMESA_remap_index },
+   { 29480, WindowPos2fMESA_remap_index },
+   {  6934, WindowPos2fvMESA_remap_index },
+   { 15892, WindowPos2iMESA_remap_index },
+   { 17869, WindowPos2ivMESA_remap_index },
+   { 18444, WindowPos2sMESA_remap_index },
+   {  4885, WindowPos2svMESA_remap_index },
+   {  6759, WindowPos3dMESA_remap_index },
+   { 12271, WindowPos3dvMESA_remap_index },
+   {   472, WindowPos3fMESA_remap_index },
+   { 13052, WindowPos3fvMESA_remap_index },
+   { 21064, WindowPos3iMESA_remap_index },
+   { 26610, WindowPos3ivMESA_remap_index },
+   { 16409, WindowPos3sMESA_remap_index },
+   { 27938, WindowPos3svMESA_remap_index },
+   {  9704, WindowPos4dMESA_remap_index },
+   { 14905, WindowPos4dvMESA_remap_index },
+   { 12230, WindowPos4fMESA_remap_index },
+   { 27015, WindowPos4fvMESA_remap_index },
+   { 26763, WindowPos4iMESA_remap_index },
+   { 10881, WindowPos4ivMESA_remap_index },
+   { 16542, WindowPos4sMESA_remap_index },
+   {  2857, WindowPos4svMESA_remap_index },
+   { 23539, MultiModeDrawArraysIBM_remap_index },
+   { 25483, MultiModeDrawElementsIBM_remap_index },
+   { 10692, DeleteFencesNV_remap_index },
+   { 24612, FinishFenceNV_remap_index },
+   {  3287, GenFencesNV_remap_index },
+   { 14885, GetFenceivNV_remap_index },
+   {  7226, IsFenceNV_remap_index },
+   { 11951, SetFenceNV_remap_index },
+   {  3744, TestFenceNV_remap_index },
+   { 27909, AreProgramsResidentNV_remap_index },
+   { 27303, BindProgramNV_remap_index },
+   { 22771, DeleteProgramsNV_remap_index },
+   { 18873, ExecuteProgramNV_remap_index },
+   { 29373, GenProgramsNV_remap_index },
+   { 20472, GetProgramParameterdvNV_remap_index },
+   {  9240, GetProgramParameterfvNV_remap_index },
+   { 23101, GetProgramStringNV_remap_index },
+   { 21458, GetProgramivNV_remap_index },
+   { 20706, GetTrackMatrixivNV_remap_index },
+   { 22921, GetVertexAttribPointervNV_remap_index },
+   { 21702, GetVertexAttribdvNV_remap_index },
+   { 16382, GetVertexAttribfvNV_remap_index },
+   { 16073, GetVertexAttribivNV_remap_index },
+   { 16789, IsProgramNV_remap_index },
+   {  8246, LoadProgramNV_remap_index },
+   { 24477, ProgramParameters4dvNV_remap_index },
+   { 21388, ProgramParameters4fvNV_remap_index },
+   { 18173, RequestResidentProgramsNV_remap_index },
+   { 19562, TrackMatrixNV_remap_index },
+   { 28466, VertexAttrib1dNV_remap_index },
+   { 11892, VertexAttrib1dvNV_remap_index },
+   { 25015, VertexAttrib1fNV_remap_index },
+   {  2245, VertexAttrib1fvNV_remap_index },
+   { 27072, VertexAttrib1sNV_remap_index },
+   { 13125, VertexAttrib1svNV_remap_index },
+   {  4220, VertexAttrib2dNV_remap_index },
+   { 11807, VertexAttrib2dvNV_remap_index },
+   { 17628, VertexAttrib2fNV_remap_index },
+   { 11418, VertexAttrib2fvNV_remap_index },
+   {  5045, VertexAttrib2sNV_remap_index },
+   { 16463, VertexAttrib2svNV_remap_index },
+   {  9901, VertexAttrib3dNV_remap_index },
+   { 28159, VertexAttrib3dvNV_remap_index },
+   {  9052, VertexAttrib3fNV_remap_index },
+   { 21729, VertexAttrib3fvNV_remap_index },
+   { 24990, VertexAttrib3sNV_remap_index },
+   { 20733, VertexAttrib3svNV_remap_index },
+   { 25457, VertexAttrib4dNV_remap_index },
+   { 29410, VertexAttrib4dvNV_remap_index },
+   {  3945, VertexAttrib4fNV_remap_index },
+   {  8296, VertexAttrib4fvNV_remap_index },
+   { 23423, VertexAttrib4sNV_remap_index },
+   {  1293, VertexAttrib4svNV_remap_index },
+   {  4378, VertexAttrib4ubNV_remap_index },
+   {   734, VertexAttrib4ubvNV_remap_index },
+   { 19053, VertexAttribPointerNV_remap_index },
+   {  2097, VertexAttribs1dvNV_remap_index },
+   { 16487, VertexAttribs1fvNV_remap_index },
+   { 29210, VertexAttribs1svNV_remap_index },
+   {  9077, VertexAttribs2dvNV_remap_index },
+   { 22291, VertexAttribs2fvNV_remap_index },
+   { 15405, VertexAttribs2svNV_remap_index },
+   {  4577, VertexAttribs3dvNV_remap_index },
+   {  1977, VertexAttribs3fvNV_remap_index },
+   { 26358, VertexAttribs3svNV_remap_index },
+   { 23513, VertexAttribs4dvNV_remap_index },
+   {  4603, VertexAttribs4fvNV_remap_index },
+   { 28997, VertexAttribs4svNV_remap_index },
+   { 26106, VertexAttribs4ubvNV_remap_index },
+   { 23615, GetTexBumpParameterfvATI_remap_index },
+   { 29251, GetTexBumpParameterivATI_remap_index },
+   { 16127, TexBumpParameterfvATI_remap_index },
+   { 18044, TexBumpParameterivATI_remap_index },
+   { 13671, AlphaFragmentOp1ATI_remap_index },
+   {  9592, AlphaFragmentOp2ATI_remap_index },
+   { 21645, AlphaFragmentOp3ATI_remap_index },
+   { 26285, BeginFragmentShaderATI_remap_index },
+   { 27502, BindFragmentShaderATI_remap_index },
+   { 20862, ColorFragmentOp1ATI_remap_index },
+   {  3823, ColorFragmentOp2ATI_remap_index },
+   { 27804, ColorFragmentOp3ATI_remap_index },
+   {  4722, DeleteFragmentShaderATI_remap_index },
+   { 29434, EndFragmentShaderATI_remap_index },
+   { 28680, GenFragmentShadersATI_remap_index },
+   { 22395, PassTexCoordATI_remap_index },
+   {  5965, SampleMapATI_remap_index },
+   {  5738, SetFragmentShaderConstantATI_remap_index },
+   {   319, PointParameteriNV_remap_index },
+   { 12432, PointParameterivNV_remap_index },
+   { 25296, ActiveStencilFaceEXT_remap_index },
+   { 24137, BindVertexArrayAPPLE_remap_index },
+   {  2522, DeleteVertexArraysAPPLE_remap_index },
+   { 15744, GenVertexArraysAPPLE_remap_index },
+   { 20537, IsVertexArrayAPPLE_remap_index },
+   {   775, GetProgramNamedParameterdvNV_remap_index },
+   {  3128, GetProgramNamedParameterfvNV_remap_index },
+   { 23646, ProgramNamedParameter4dNV_remap_index },
+   { 12707, ProgramNamedParameter4dvNV_remap_index },
+   {  7862, ProgramNamedParameter4fNV_remap_index },
+   { 10311, ProgramNamedParameter4fvNV_remap_index },
+   { 21367, DepthBoundsEXT_remap_index },
+   {  1043, BlendEquationSeparateEXT_remap_index },
+   { 12826, BindFramebufferEXT_remap_index },
+   { 22582, BindRenderbufferEXT_remap_index },
+   {  8515, CheckFramebufferStatusEXT_remap_index },
+   { 19853, DeleteFramebuffersEXT_remap_index },
+   { 28061, DeleteRenderbuffersEXT_remap_index },
+   { 11831, FramebufferRenderbufferEXT_remap_index },
+   { 11968, FramebufferTexture1DEXT_remap_index },
+   { 10139, FramebufferTexture2DEXT_remap_index },
+   {  9806, FramebufferTexture3DEXT_remap_index },
+   { 20429, GenFramebuffersEXT_remap_index },
+   { 15291, GenRenderbuffersEXT_remap_index },
+   {  5684, GenerateMipmapEXT_remap_index },
+   { 19084, GetFramebufferAttachmentParameterivEXT_remap_index },
+   { 28586, GetRenderbufferParameterivEXT_remap_index },
+   { 17924, IsFramebufferEXT_remap_index },
+   { 29333, IsRenderbufferEXT_remap_index },
+   {  7173, RenderbufferStorageEXT_remap_index },
+   {   651, BlitFramebufferEXT_remap_index },
+   { 12526, BufferParameteriAPPLE_remap_index },
+   { 16821, FlushMappedBufferRangeAPPLE_remap_index },
+   {  2701, FramebufferTextureLayerEXT_remap_index },
+   { 26007, ProvokingVertexEXT_remap_index },
+   {  9461, GetTexParameterPointervAPPLE_remap_index },
+   {  4405, TextureRangeAPPLE_remap_index },
+   { 25322, StencilFuncSeparateATI_remap_index },
+   { 15811, ProgramEnvParameters4fvEXT_remap_index },
+   { 15029, ProgramLocalParameters4fvEXT_remap_index },
+   { 12360, GetQueryObjecti64vEXT_remap_index },
+   {  9103, GetQueryObjectui64vEXT_remap_index },
+   {    -1, -1 }
+};
+
+/* these functions are in the ABI, but have alternative names */
+static const struct gl_function_remap MESA_alt_functions[] = {
+   /* from GL_EXT_blend_color */
+   {  2440, _gloffset_BlendColor },
+   /* from GL_EXT_blend_minmax */
+   {  9863, _gloffset_BlendEquation },
+   /* from GL_EXT_color_subtable */
+   { 14927, _gloffset_ColorSubTable },
+   { 27993, _gloffset_CopyColorSubTable },
+   /* from GL_EXT_convolution */
+   {   213, _gloffset_ConvolutionFilter1D },
+   {  2284, _gloffset_CopyConvolutionFilter1D },
+   {  3624, _gloffset_GetConvolutionParameteriv },
+   {  7522, _gloffset_ConvolutionFilter2D },
+   {  7688, _gloffset_ConvolutionParameteriv },
+   {  8148, _gloffset_ConvolutionParameterfv },
+   { 18072, _gloffset_GetSeparableFilter },
+   { 21118, _gloffset_SeparableFilter2D },
+   { 21947, _gloffset_ConvolutionParameteri },
+   { 22070, _gloffset_ConvolutionParameterf },
+   { 23449, _gloffset_GetConvolutionParameterfv },
+   { 24303, _gloffset_GetConvolutionFilter },
+   { 26547, _gloffset_CopyConvolutionFilter2D },
+   /* from GL_EXT_copy_texture */
+   { 13185, _gloffset_CopyTexSubImage3D },
+   { 14667, _gloffset_CopyTexImage2D },
+   { 21555, _gloffset_CopyTexImage1D },
+   { 23984, _gloffset_CopyTexSubImage2D },
+   { 26185, _gloffset_CopyTexSubImage1D },
+   /* from GL_EXT_draw_range_elements */
+   {  8402, _gloffset_DrawRangeElements },
+   /* from GL_EXT_histogram */
+   {   812, _gloffset_Histogram },
+   {  3088, _gloffset_ResetHistogram },
+   {  8774, _gloffset_GetMinmax },
+   { 13519, _gloffset_GetHistogramParameterfv },
+   { 21480, _gloffset_GetMinmaxParameteriv },
+   { 23339, _gloffset_ResetMinmax },
+   { 24200, _gloffset_GetHistogramParameteriv },
+   { 25256, _gloffset_GetHistogram },
+   { 27618, _gloffset_Minmax },
+   { 29080, _gloffset_GetMinmaxParameterfv },
+   /* from GL_EXT_paletted_texture */
+   {  7384, _gloffset_ColorTable },
+   { 13365, _gloffset_GetColorTable },
+   { 20176, _gloffset_GetColorTableParameterfv },
+   { 22126, _gloffset_GetColorTableParameteriv },
+   /* from GL_EXT_subtexture */
+   {  6105, _gloffset_TexSubImage1D },
+   {  9388, _gloffset_TexSubImage2D },
+   /* from GL_EXT_texture3D */
+   {  1658, _gloffset_TexImage3D },
+   { 19945, _gloffset_TexSubImage3D },
+   /* from GL_EXT_texture_object */
+   {  2964, _gloffset_PrioritizeTextures },
+   {  6554, _gloffset_AreTexturesResident },
+   { 11916, _gloffset_GenTextures },
+   { 13851, _gloffset_DeleteTextures },
+   { 17102, _gloffset_IsTexture },
+   { 26250, _gloffset_BindTexture },
+   /* from GL_EXT_vertex_array */
+   { 21307, _gloffset_ArrayElement },
+   { 27206, _gloffset_GetPointerv },
+   { 28707, _gloffset_DrawArrays },
+   /* from GL_SGI_color_table */
+   {  6672, _gloffset_ColorTableParameteriv },
+   {  7384, _gloffset_ColorTable },
+   { 13365, _gloffset_GetColorTable },
+   { 13475, _gloffset_CopyColorTable },
+   { 16963, _gloffset_ColorTableParameterfv },
+   { 20176, _gloffset_GetColorTableParameterfv },
+   { 22126, _gloffset_GetColorTableParameteriv },
+   /* from GL_VERSION_1_3 */
+   {   381, _gloffset_MultiTexCoord3sARB },
+   {   613, _gloffset_ActiveTextureARB },
+   {  3761, _gloffset_MultiTexCoord1fvARB },
+   {  5240, _gloffset_MultiTexCoord3dARB },
+   {  5285, _gloffset_MultiTexCoord2iARB },
+   {  5409, _gloffset_MultiTexCoord2svARB },
+   {  7340, _gloffset_MultiTexCoord2fARB },
+   {  9133, _gloffset_MultiTexCoord3fvARB },
+   {  9625, _gloffset_MultiTexCoord4sARB },
+   { 10225, _gloffset_MultiTexCoord2dvARB },
+   { 10607, _gloffset_MultiTexCoord1svARB },
+   { 10903, _gloffset_MultiTexCoord3svARB },
+   { 10964, _gloffset_MultiTexCoord4iARB },
+   { 11687, _gloffset_MultiTexCoord3iARB },
+   { 12389, _gloffset_MultiTexCoord1dARB },
+   { 12555, _gloffset_MultiTexCoord3dvARB },
+   { 13719, _gloffset_MultiTexCoord3ivARB },
+   { 13764, _gloffset_MultiTexCoord2sARB },
+   { 14984, _gloffset_MultiTexCoord4ivARB },
+   { 16613, _gloffset_ClientActiveTextureARB },
+   { 18829, _gloffset_MultiTexCoord2dARB },
+   { 19204, _gloffset_MultiTexCoord4dvARB },
+   { 19490, _gloffset_MultiTexCoord4fvARB },
+   { 20317, _gloffset_MultiTexCoord3fARB },
+   { 22627, _gloffset_MultiTexCoord4dARB },
+   { 22831, _gloffset_MultiTexCoord1sARB },
+   { 23009, _gloffset_MultiTexCoord1dvARB },
+   { 23828, _gloffset_MultiTexCoord1ivARB },
+   { 23921, _gloffset_MultiTexCoord2ivARB },
+   { 24260, _gloffset_MultiTexCoord1iARB },
+   { 25531, _gloffset_MultiTexCoord4svARB },
+   { 26049, _gloffset_MultiTexCoord1fARB },
+   { 26312, _gloffset_MultiTexCoord4fARB },
+   { 28541, _gloffset_MultiTexCoord2fvARB },
+   {    -1, -1 }
+};
+
+#endif /* need_MESA_remap_table */
+
+#if defined(need_GL_3DFX_tbuffer)
+static const struct gl_function_remap GL_3DFX_tbuffer_functions[] = {
+   {  8206, -1 }, /* TbufferMask3DFX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_APPLE_flush_buffer_range)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_APPLE_flush_buffer_range_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_APPLE_texture_range)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_APPLE_texture_range_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_APPLE_vertex_array_object)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_APPLE_vertex_array_object_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_copy_buffer)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_copy_buffer_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_draw_buffers)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_draw_buffers_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_draw_elements_base_vertex)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_draw_elements_base_vertex_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_framebuffer_object)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_framebuffer_object_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_map_buffer_range)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_matrix_palette)
+static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = {
+   {  3339, -1 }, /* MatrixIndexusvARB */
+   { 11508, -1 }, /* MatrixIndexuivARB */
+   { 12677, -1 }, /* MatrixIndexPointerARB */
+   { 17351, -1 }, /* CurrentPaletteMatrixARB */
+   { 20061, -1 }, /* MatrixIndexubvARB */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_multisample)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_multisample_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_occlusion_query)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_occlusion_query_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_point_parameters)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_point_parameters_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_provoking_vertex)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_provoking_vertex_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_shader_objects)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_shader_objects_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_sync)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_sync_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_texture_compression)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_texture_compression_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_transpose_matrix)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_transpose_matrix_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_vertex_array_object)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_vertex_blend)
+static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = {
+   {  2226, -1 }, /* WeightubvARB */
+   {  5572, -1 }, /* WeightivARB */
+   {  9728, -1 }, /* WeightPointerARB */
+   { 12146, -1 }, /* WeightfvARB */
+   { 15431, -1 }, /* WeightbvARB */
+   { 18497, -1 }, /* WeightusvARB */
+   { 21044, -1 }, /* VertexBlendARB */
+   { 26133, -1 }, /* WeightsvARB */
+   { 28043, -1 }, /* WeightdvARB */
+   { 28741, -1 }, /* WeightuivARB */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_vertex_buffer_object)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_vertex_buffer_object_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_vertex_program)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_vertex_program_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_vertex_shader)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_vertex_shader_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ARB_window_pos)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_window_pos_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ATI_blend_equation_separate)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ATI_blend_equation_separate_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ATI_draw_buffers)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ATI_draw_buffers_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ATI_envmap_bumpmap)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ATI_envmap_bumpmap_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ATI_fragment_shader)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ATI_fragment_shader_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_ATI_separate_stencil)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ATI_separate_stencil_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_blend_color)
+static const struct gl_function_remap GL_EXT_blend_color_functions[] = {
+   {  2440, _gloffset_BlendColor },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_blend_equation_separate)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_blend_equation_separate_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_blend_func_separate)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_blend_minmax)
+static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = {
+   {  9863, _gloffset_BlendEquation },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_color_subtable)
+static const struct gl_function_remap GL_EXT_color_subtable_functions[] = {
+   { 14927, _gloffset_ColorSubTable },
+   { 27993, _gloffset_CopyColorSubTable },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_compiled_vertex_array)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_compiled_vertex_array_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_convolution)
+static const struct gl_function_remap GL_EXT_convolution_functions[] = {
+   {   213, _gloffset_ConvolutionFilter1D },
+   {  2284, _gloffset_CopyConvolutionFilter1D },
+   {  3624, _gloffset_GetConvolutionParameteriv },
+   {  7522, _gloffset_ConvolutionFilter2D },
+   {  7688, _gloffset_ConvolutionParameteriv },
+   {  8148, _gloffset_ConvolutionParameterfv },
+   { 18072, _gloffset_GetSeparableFilter },
+   { 21118, _gloffset_SeparableFilter2D },
+   { 21947, _gloffset_ConvolutionParameteri },
+   { 22070, _gloffset_ConvolutionParameterf },
+   { 23449, _gloffset_GetConvolutionParameterfv },
+   { 24303, _gloffset_GetConvolutionFilter },
+   { 26547, _gloffset_CopyConvolutionFilter2D },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_coordinate_frame)
+static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = {
+   {  9272, -1 }, /* TangentPointerEXT */
+   { 11022, -1 }, /* Binormal3ivEXT */
+   { 11640, -1 }, /* Tangent3sEXT */
+   { 12742, -1 }, /* Tangent3fvEXT */
+   { 16363, -1 }, /* Tangent3dvEXT */
+   { 17049, -1 }, /* Binormal3bvEXT */
+   { 18125, -1 }, /* Binormal3dEXT */
+   { 19993, -1 }, /* Tangent3fEXT */
+   { 22019, -1 }, /* Binormal3sEXT */
+   { 22437, -1 }, /* Tangent3ivEXT */
+   { 22456, -1 }, /* Tangent3dEXT */
+   { 23236, -1 }, /* Binormal3svEXT */
+   { 23726, -1 }, /* Binormal3fEXT */
+   { 24578, -1 }, /* Binormal3dvEXT */
+   { 25753, -1 }, /* Tangent3iEXT */
+   { 26832, -1 }, /* Tangent3bvEXT */
+   { 27241, -1 }, /* Tangent3bEXT */
+   { 27766, -1 }, /* Binormal3fvEXT */
+   { 28440, -1 }, /* BinormalPointerEXT */
+   { 28845, -1 }, /* Tangent3svEXT */
+   { 29282, -1 }, /* Binormal3bEXT */
+   { 29459, -1 }, /* Binormal3iEXT */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_copy_texture)
+static const struct gl_function_remap GL_EXT_copy_texture_functions[] = {
+   { 13185, _gloffset_CopyTexSubImage3D },
+   { 14667, _gloffset_CopyTexImage2D },
+   { 21555, _gloffset_CopyTexImage1D },
+   { 23984, _gloffset_CopyTexSubImage2D },
+   { 26185, _gloffset_CopyTexSubImage1D },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_cull_vertex)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_cull_vertex_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_depth_bounds_test)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_depth_bounds_test_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_draw_range_elements)
+static const struct gl_function_remap GL_EXT_draw_range_elements_functions[] = {
+   {  8402, _gloffset_DrawRangeElements },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_fog_coord)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_fog_coord_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_framebuffer_blit)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_framebuffer_blit_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_framebuffer_multisample)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_framebuffer_multisample_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_framebuffer_object)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_framebuffer_object_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_gpu_program_parameters)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_gpu_program_parameters_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_histogram)
+static const struct gl_function_remap GL_EXT_histogram_functions[] = {
+   {   812, _gloffset_Histogram },
+   {  3088, _gloffset_ResetHistogram },
+   {  8774, _gloffset_GetMinmax },
+   { 13519, _gloffset_GetHistogramParameterfv },
+   { 21480, _gloffset_GetMinmaxParameteriv },
+   { 23339, _gloffset_ResetMinmax },
+   { 24200, _gloffset_GetHistogramParameteriv },
+   { 25256, _gloffset_GetHistogram },
+   { 27618, _gloffset_Minmax },
+   { 29080, _gloffset_GetMinmaxParameterfv },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_index_func)
+static const struct gl_function_remap GL_EXT_index_func_functions[] = {
+   { 10090, -1 }, /* IndexFuncEXT */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_index_material)
+static const struct gl_function_remap GL_EXT_index_material_functions[] = {
+   { 18584, -1 }, /* IndexMaterialEXT */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_light_texture)
+static const struct gl_function_remap GL_EXT_light_texture_functions[] = {
+   { 23256, -1 }, /* ApplyTextureEXT */
+   { 23293, -1 }, /* TextureMaterialEXT */
+   { 23318, -1 }, /* TextureLightEXT */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_multi_draw_arrays)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_multi_draw_arrays_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_multisample)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_multisample_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_paletted_texture)
+static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = {
+   {  7384, _gloffset_ColorTable },
+   { 13365, _gloffset_GetColorTable },
+   { 20176, _gloffset_GetColorTableParameterfv },
+   { 22126, _gloffset_GetColorTableParameteriv },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_pixel_transform)
+static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = {
+   {  9513, -1 }, /* PixelTransformParameterfvEXT */
+   { 19169, -1 }, /* PixelTransformParameterfEXT */
+   { 19249, -1 }, /* PixelTransformParameteriEXT */
+   { 28404, -1 }, /* PixelTransformParameterivEXT */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_point_parameters)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_point_parameters_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_polygon_offset)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_polygon_offset_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_provoking_vertex)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_provoking_vertex_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_secondary_color)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_secondary_color_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_stencil_two_side)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_subtexture)
+static const struct gl_function_remap GL_EXT_subtexture_functions[] = {
+   {  6105, _gloffset_TexSubImage1D },
+   {  9388, _gloffset_TexSubImage2D },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_texture3D)
+static const struct gl_function_remap GL_EXT_texture3D_functions[] = {
+   {  1658, _gloffset_TexImage3D },
+   { 19945, _gloffset_TexSubImage3D },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_texture_array)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_texture_array_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_texture_object)
+static const struct gl_function_remap GL_EXT_texture_object_functions[] = {
+   {  2964, _gloffset_PrioritizeTextures },
+   {  6554, _gloffset_AreTexturesResident },
+   { 11916, _gloffset_GenTextures },
+   { 13851, _gloffset_DeleteTextures },
+   { 17102, _gloffset_IsTexture },
+   { 26250, _gloffset_BindTexture },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_texture_perturb_normal)
+static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = {
+   { 12096, -1 }, /* TextureNormalEXT */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_timer_query)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_timer_query_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_vertex_array)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_vertex_array_functions[] = {
+   { 21307, _gloffset_ArrayElement },
+   { 27206, _gloffset_GetPointerv },
+   { 28707, _gloffset_DrawArrays },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_EXT_vertex_weighting)
+static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = {
+   { 17132, -1 }, /* VertexWeightfvEXT */
+   { 23704, -1 }, /* VertexWeightfEXT */
+   { 25225, -1 }, /* VertexWeightPointerEXT */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_HP_image_transform)
+static const struct gl_function_remap GL_HP_image_transform_functions[] = {
+   {  2157, -1 }, /* GetImageTransformParameterfvHP */
+   {  3305, -1 }, /* ImageTransformParameterfHP */
+   {  8966, -1 }, /* ImageTransformParameterfvHP */
+   { 10525, -1 }, /* ImageTransformParameteriHP */
+   { 10793, -1 }, /* GetImageTransformParameterivHP */
+   { 17196, -1 }, /* ImageTransformParameterivHP */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_IBM_multimode_draw_arrays)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_IBM_multimode_draw_arrays_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_IBM_vertex_array_lists)
+static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = {
+   {  3857, -1 }, /* SecondaryColorPointerListIBM */
+   {  5106, -1 }, /* NormalPointerListIBM */
+   {  6728, -1 }, /* FogCoordPointerListIBM */
+   {  7035, -1 }, /* VertexPointerListIBM */
+   { 10446, -1 }, /* ColorPointerListIBM */
+   { 11747, -1 }, /* TexCoordPointerListIBM */
+   { 12118, -1 }, /* IndexPointerListIBM */
+   { 29023, -1 }, /* EdgeFlagPointerListIBM */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_INGR_blend_func_separate)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_INTEL_parallel_arrays)
+static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = {
+   { 11134, -1 }, /* VertexPointervINTEL */
+   { 13612, -1 }, /* ColorPointervINTEL */
+   { 26521, -1 }, /* NormalPointervINTEL */
+   { 26947, -1 }, /* TexCoordPointervINTEL */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_MESA_resize_buffers)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_MESA_resize_buffers_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_MESA_shader_debug)
+static const struct gl_function_remap GL_MESA_shader_debug_functions[] = {
+   {  1522, -1 }, /* GetDebugLogLengthMESA */
+   {  3063, -1 }, /* ClearDebugLogMESA */
+   {  4018, -1 }, /* GetDebugLogMESA */
+   { 27399, -1 }, /* CreateDebugObjectMESA */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_MESA_window_pos)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_MESA_window_pos_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_evaluators)
+static const struct gl_function_remap GL_NV_evaluators_functions[] = {
+   {  5773, -1 }, /* GetMapAttribParameterivNV */
+   {  7490, -1 }, /* MapControlPointsNV */
+   {  7589, -1 }, /* MapParameterfvNV */
+   {  9371, -1 }, /* EvalMapsNV */
+   { 15101, -1 }, /* GetMapAttribParameterfvNV */
+   { 15267, -1 }, /* MapParameterivNV */
+   { 21870, -1 }, /* GetMapParameterivNV */
+   { 22368, -1 }, /* GetMapParameterfvNV */
+   { 25857, -1 }, /* GetMapControlPointsNV */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_fence)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_NV_fence_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_fragment_program)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_NV_fragment_program_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_point_sprite)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_NV_point_sprite_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_register_combiners)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_NV_register_combiners_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_register_combiners2)
+static const struct gl_function_remap GL_NV_register_combiners2_functions[] = {
+   { 14004, -1 }, /* CombinerStageParameterfvNV */
+   { 14319, -1 }, /* GetCombinerStageParameterfvNV */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_vertex_array_range)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_NV_vertex_array_range_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_NV_vertex_program)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_NV_vertex_program_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_PGI_misc_hints)
+static const struct gl_function_remap GL_PGI_misc_hints_functions[] = {
+   {  7674, -1 }, /* HintPGI */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_detail_texture)
+static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = {
+   { 14292, -1 }, /* GetDetailTexFuncSGIS */
+   { 14612, -1 }, /* DetailTexFuncSGIS */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_fog_function)
+static const struct gl_function_remap GL_SGIS_fog_function_functions[] = {
+   { 23966, -1 }, /* FogFuncSGIS */
+   { 24631, -1 }, /* GetFogFuncSGIS */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_multisample)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_SGIS_multisample_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_pixel_texture)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_SGIS_pixel_texture_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_point_parameters)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_sharpen_texture)
+static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
+   {  5834, -1 }, /* GetSharpenTexFuncSGIS */
+   { 19464, -1 }, /* SharpenTexFuncSGIS */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_texture4D)
+static const struct gl_function_remap GL_SGIS_texture4D_functions[] = {
+   {   894, -1 }, /* TexImage4DSGIS */
+   { 13920, -1 }, /* TexSubImage4DSGIS */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_texture_color_mask)
+static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = {
+   { 13318, -1 }, /* TextureColorMaskSGIS */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIS_texture_filter4)
+static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = {
+   {  6011, -1 }, /* GetTexFilterFuncSGIS */
+   { 14438, -1 }, /* TexFilterFuncSGIS */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_async)
+static const struct gl_function_remap GL_SGIX_async_functions[] = {
+   {  3014, -1 }, /* AsyncMarkerSGIX */
+   {  3997, -1 }, /* FinishAsyncSGIX */
+   {  4703, -1 }, /* PollAsyncSGIX */
+   { 19611, -1 }, /* DeleteAsyncMarkersSGIX */
+   { 19640, -1 }, /* IsAsyncMarkerSGIX */
+   { 28820, -1 }, /* GenAsyncMarkersSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_flush_raster)
+static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = {
+   {  6382, -1 }, /* FlushRasterSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_fragment_lighting)
+static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = {
+   {  2410, -1 }, /* FragmentMaterialfvSGIX */
+   {  2906, -1 }, /* FragmentLightModelivSGIX */
+   {  4654, -1 }, /* FragmentLightiSGIX */
+   {  5514, -1 }, /* GetFragmentMaterialfvSGIX */
+   {  7102, -1 }, /* FragmentMaterialfSGIX */
+   {  7263, -1 }, /* GetFragmentLightivSGIX */
+   {  8100, -1 }, /* FragmentLightModeliSGIX */
+   {  9434, -1 }, /* FragmentLightivSGIX */
+   {  9671, -1 }, /* GetFragmentMaterialivSGIX */
+   { 17019, -1 }, /* FragmentLightModelfSGIX */
+   { 17319, -1 }, /* FragmentColorMaterialSGIX */
+   { 17691, -1 }, /* FragmentMaterialiSGIX */
+   { 18912, -1 }, /* LightEnviSGIX */
+   { 20268, -1 }, /* FragmentLightModelfvSGIX */
+   { 20577, -1 }, /* FragmentLightfvSGIX */
+   { 25107, -1 }, /* FragmentLightfSGIX */
+   { 27736, -1 }, /* GetFragmentLightfvSGIX */
+   { 29303, -1 }, /* FragmentMaterialivSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_framezoom)
+static const struct gl_function_remap GL_SGIX_framezoom_functions[] = {
+   { 19663, -1 }, /* FrameZoomSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_igloo_interface)
+static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = {
+   { 25415, -1 }, /* IglooInterfaceSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_instruments)
+static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
+   {  2573, -1 }, /* ReadInstrumentsSGIX */
+   {  5590, -1 }, /* PollInstrumentsSGIX */
+   {  9332, -1 }, /* GetInstrumentsSGIX */
+   { 11345, -1 }, /* StartInstrumentsSGIX */
+   { 14038, -1 }, /* StopInstrumentsSGIX */
+   { 15644, -1 }, /* InstrumentsBufferSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_list_priority)
+static const struct gl_function_remap GL_SGIX_list_priority_functions[] = {
+   {  1125, -1 }, /* ListParameterfSGIX */
+   {  2763, -1 }, /* GetListParameterfvSGIX */
+   { 15559, -1 }, /* ListParameteriSGIX */
+   { 16313, -1 }, /* ListParameterfvSGIX */
+   { 18318, -1 }, /* ListParameterivSGIX */
+   { 28864, -1 }, /* GetListParameterivSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_pixel_texture)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_polynomial_ffd)
+static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = {
+   {  3251, -1 }, /* LoadIdentityDeformationMapSGIX */
+   { 10713, -1 }, /* DeformationMap3dSGIX */
+   { 14138, -1 }, /* DeformSGIX */
+   { 21419, -1 }, /* DeformationMap3fSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_reference_plane)
+static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = {
+   { 12869, -1 }, /* ReferencePlaneSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_sprite)
+static const struct gl_function_remap GL_SGIX_sprite_functions[] = {
+   {  8487, -1 }, /* SpriteParameterfvSGIX */
+   { 18146, -1 }, /* SpriteParameteriSGIX */
+   { 23373, -1 }, /* SpriteParameterfSGIX */
+   { 25979, -1 }, /* SpriteParameterivSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGIX_tag_sample_buffer)
+static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = {
+   { 18205, -1 }, /* TagSampleBufferSGIX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SGI_color_table)
+static const struct gl_function_remap GL_SGI_color_table_functions[] = {
+   {  6672, _gloffset_ColorTableParameteriv },
+   {  7384, _gloffset_ColorTable },
+   { 13365, _gloffset_GetColorTable },
+   { 13475, _gloffset_CopyColorTable },
+   { 16963, _gloffset_ColorTableParameterfv },
+   { 20176, _gloffset_GetColorTableParameterfv },
+   { 22126, _gloffset_GetColorTableParameteriv },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SUNX_constant_data)
+static const struct gl_function_remap GL_SUNX_constant_data_functions[] = {
+   { 27714, -1 }, /* FinishTextureSUNX */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SUN_global_alpha)
+static const struct gl_function_remap GL_SUN_global_alpha_functions[] = {
+   {  3035, -1 }, /* GlobalAlphaFactorubSUN */
+   {  4193, -1 }, /* GlobalAlphaFactoriSUN */
+   {  5615, -1 }, /* GlobalAlphaFactordSUN */
+   {  8571, -1 }, /* GlobalAlphaFactoruiSUN */
+   {  8923, -1 }, /* GlobalAlphaFactorbSUN */
+   { 11660, -1 }, /* GlobalAlphaFactorfSUN */
+   { 11779, -1 }, /* GlobalAlphaFactorusSUN */
+   { 19902, -1 }, /* GlobalAlphaFactorsSUN */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SUN_mesh_array)
+static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
+   { 25791, -1 }, /* DrawMeshArraysSUN */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SUN_triangle_list)
+static const struct gl_function_remap GL_SUN_triangle_list_functions[] = {
+   {  3971, -1 }, /* ReplacementCodeubSUN */
+   {  5454, -1 }, /* ReplacementCodeubvSUN */
+   { 16684, -1 }, /* ReplacementCodeusvSUN */
+   { 16872, -1 }, /* ReplacementCodePointerSUN */
+   { 18229, -1 }, /* ReplacementCodeusSUN */
+   { 18976, -1 }, /* ReplacementCodeuiSUN */
+   { 26436, -1 }, /* ReplacementCodeuivSUN */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_SUN_vertex)
+static const struct gl_function_remap GL_SUN_vertex_functions[] = {
+   {   999, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */
+   {  1197, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */
+   {  1423, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */
+   {  1699, -1 }, /* ReplacementCodeuiVertex3fvSUN */
+   {  1833, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */
+   {  2346, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */
+   {  2642, -1 }, /* Color4ubVertex3fvSUN */
+   {  4074, -1 }, /* Color4ubVertex3fSUN */
+   {  4150, -1 }, /* TexCoord2fVertex3fSUN */
+   {  4449, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */
+   {  4779, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */
+   {  5349, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */
+   {  6419, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */
+   {  7131, -1 }, /* TexCoord2fNormal3fVertex3fSUN */
+   {  7899, -1 }, /* Color3fVertex3fSUN */
+   {  8882, -1 }, /* Color3fVertex3fvSUN */
+   {  9297, -1 }, /* Color4fNormal3fVertex3fvSUN */
+   {  9969, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
+   { 11208, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
+   { 12600, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
+   { 13011, -1 }, /* TexCoord2fColor3fVertex3fSUN */
+   { 14063, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
+   { 14397, -1 }, /* Color4ubVertex2fvSUN */
+   { 14637, -1 }, /* Normal3fVertex3fSUN */
+   { 15585, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
+   { 15846, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
+   { 16513, -1 }, /* TexCoord2fVertex3fvSUN */
+   { 17289, -1 }, /* Color4ubVertex2fSUN */
+   { 17482, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
+   { 19335, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
+   { 19682, -1 }, /* Normal3fVertex3fvSUN */
+   { 20085, -1 }, /* Color4fNormal3fVertex3fSUN */
+   { 20951, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
+   { 21171, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
+   { 22874, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
+   { 24082, -1 }, /* TexCoord4fVertex4fSUN */
+   { 24508, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
+   { 24834, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
+   { 24961, -1 }, /* TexCoord4fVertex4fvSUN */
+   { 25663, -1 }, /* ReplacementCodeuiVertex3fSUN */
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_VERSION_1_3)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_VERSION_1_3_functions[] = {
+   {   381, _gloffset_MultiTexCoord3sARB },
+   {   613, _gloffset_ActiveTextureARB },
+   {  3761, _gloffset_MultiTexCoord1fvARB },
+   {  5240, _gloffset_MultiTexCoord3dARB },
+   {  5285, _gloffset_MultiTexCoord2iARB },
+   {  5409, _gloffset_MultiTexCoord2svARB },
+   {  7340, _gloffset_MultiTexCoord2fARB },
+   {  9133, _gloffset_MultiTexCoord3fvARB },
+   {  9625, _gloffset_MultiTexCoord4sARB },
+   { 10225, _gloffset_MultiTexCoord2dvARB },
+   { 10607, _gloffset_MultiTexCoord1svARB },
+   { 10903, _gloffset_MultiTexCoord3svARB },
+   { 10964, _gloffset_MultiTexCoord4iARB },
+   { 11687, _gloffset_MultiTexCoord3iARB },
+   { 12389, _gloffset_MultiTexCoord1dARB },
+   { 12555, _gloffset_MultiTexCoord3dvARB },
+   { 13719, _gloffset_MultiTexCoord3ivARB },
+   { 13764, _gloffset_MultiTexCoord2sARB },
+   { 14984, _gloffset_MultiTexCoord4ivARB },
+   { 16613, _gloffset_ClientActiveTextureARB },
+   { 18829, _gloffset_MultiTexCoord2dARB },
+   { 19204, _gloffset_MultiTexCoord4dvARB },
+   { 19490, _gloffset_MultiTexCoord4fvARB },
+   { 20317, _gloffset_MultiTexCoord3fARB },
+   { 22627, _gloffset_MultiTexCoord4dARB },
+   { 22831, _gloffset_MultiTexCoord1sARB },
+   { 23009, _gloffset_MultiTexCoord1dvARB },
+   { 23828, _gloffset_MultiTexCoord1ivARB },
+   { 23921, _gloffset_MultiTexCoord2ivARB },
+   { 24260, _gloffset_MultiTexCoord1iARB },
+   { 25531, _gloffset_MultiTexCoord4svARB },
+   { 26049, _gloffset_MultiTexCoord1fARB },
+   { 26312, _gloffset_MultiTexCoord4fARB },
+   { 28541, _gloffset_MultiTexCoord2fvARB },
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_VERSION_1_4)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_VERSION_1_4_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_VERSION_1_5)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_VERSION_1_5_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_VERSION_2_0)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_VERSION_2_0_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
+#if defined(need_GL_VERSION_2_1)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_VERSION_2_1_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index 5bef7c84f..3bb062bae 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -43,6 +43,8 @@
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
+#include "fbobject.h"
+#include "formats.h"
 #include "mtypes.h"
 #include "fbobject.h"
 #include "renderbuffer.h"
@@ -72,7 +74,7 @@ get_pointer_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb,
    if (!rb->Data)
       return NULL;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   /* Can't assert _ActualFormat since these funcs may be used for serveral
+   /* Can't assert rb->Format since these funcs may be used for serveral
     * different formats (GL_ALPHA8, GL_STENCIL_INDEX8, etc).
     */
    return (GLubyte *) rb->Data + y * rb->Width + x;
@@ -448,7 +450,7 @@ static void *
 get_pointer_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb,
                    GLint x, GLint y)
 {
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    /* No direct access since this buffer is RGB but caller will be
     * treating it as if it were RGBA.
     */
@@ -463,7 +465,7 @@ get_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    const GLubyte *src = (const GLubyte *) rb->Data + 3 * (y * rb->Width + x);
    GLubyte *dst = (GLubyte *) values;
    GLuint i;
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       dst[i * 4 + 0] = src[i * 3 + 0];
@@ -480,7 +482,7 @@ get_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
 {
    GLubyte *dst = (GLubyte *) values;
    GLuint i;
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       const GLubyte *src
@@ -501,7 +503,7 @@ put_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    const GLubyte *src = (const GLubyte *) values;
    GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
    GLuint i;
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
@@ -521,7 +523,7 @@ put_row_rgb_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    const GLubyte *src = (const GLubyte *) values;
    GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
    GLuint i;
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
@@ -542,7 +544,7 @@ put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    const GLubyte val1 = ((const GLubyte *) value)[1];
    const GLubyte val2 = ((const GLubyte *) value)[2];
    GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x);
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    if (!mask && val0 == val1 && val1 == val2) {
       /* optimized case */
@@ -569,7 +571,7 @@ put_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    /* note: incoming values are RGB+A! */
    const GLubyte *src = (const GLubyte *) values;
    GLuint i;
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
@@ -592,7 +594,7 @@ put_mono_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb,
    const GLubyte val1 = ((const GLubyte *) value)[1];
    const GLubyte val2 = ((const GLubyte *) value)[2];
    GLuint i;
-   ASSERT(rb->_ActualFormat == GL_RGB8);
+   ASSERT(rb->Format == MESA_FORMAT_RGB888);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
@@ -617,7 +619,7 @@ get_pointer_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb,
    if (!rb->Data)
       return NULL;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    return (GLubyte *) rb->Data + 4 * (y * rb->Width + x);
 }
 
@@ -628,7 +630,7 @@ get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
 {
    const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    _mesa_memcpy(values, src, 4 * count * sizeof(GLubyte));
 }
 
@@ -641,7 +643,7 @@ get_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    GLuint *dst = (GLuint *) values;
    GLuint i;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    for (i = 0; i < count; i++) {
       const GLuint *src = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
       dst[i] = *src;
@@ -657,7 +659,7 @@ put_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    const GLuint *src = (const GLuint *) values;
    GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    if (mask) {
       GLuint i;
       for (i = 0; i < count; i++) {
@@ -681,7 +683,7 @@ put_row_rgb_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    GLubyte *dst = (GLubyte *) rb->Data + 4 * (y * rb->Width + x);
    GLuint i;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
          dst[i * 4 + 0] = src[i * 3 + 0];
@@ -701,7 +703,7 @@ put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    const GLuint val = *((const GLuint *) value);
    GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x);
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    if (!mask && val == 0) {
       /* common case */
       _mesa_bzero(dst, count * 4 * sizeof(GLubyte));
@@ -735,7 +737,7 @@ put_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    const GLuint *src = (const GLuint *) values;
    GLuint i;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
          GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
@@ -754,7 +756,7 @@ put_mono_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb,
    const GLuint val = *((const GLuint *) value);
    GLuint i;
    ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
-   ASSERT(rb->_ActualFormat == GL_RGBA8);
+   ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
    for (i = 0; i < count; i++) {
       if (!mask || mask[i]) {
          GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]);
@@ -947,15 +949,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
 {
    GLuint pixelSize;
 
-   /* first clear these fields */
-   rb->RedBits =
-   rb->GreenBits =
-   rb->BlueBits =
-   rb->AlphaBits =
-   rb->IndexBits =
-   rb->DepthBits =
-   rb->StencilBits = 0;
-
    switch (internalFormat) {
    case GL_RGB:
    case GL_R3_G3_B2:
@@ -965,8 +958,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
    case GL_RGB10:
    case GL_RGB12:
    case GL_RGB16:
-      rb->_ActualFormat = GL_RGB8;
-      rb->_BaseFormat = GL_RGB;
+      rb->Format = MESA_FORMAT_RGB888;
       rb->DataType = GL_UNSIGNED_BYTE;
       rb->GetPointer = get_pointer_ubyte3;
       rb->GetRow = get_row_ubyte3;
@@ -976,10 +968,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_ubyte3;
       rb->PutValues = put_values_ubyte3;
       rb->PutMonoValues = put_mono_values_ubyte3;
-      rb->RedBits   = 8 * sizeof(GLubyte);
-      rb->GreenBits = 8 * sizeof(GLubyte);
-      rb->BlueBits  = 8 * sizeof(GLubyte);
-      rb->AlphaBits = 0;
       pixelSize = 3 * sizeof(GLubyte);
       break;
    case GL_RGBA:
@@ -987,8 +975,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
    case GL_RGBA4:
    case GL_RGB5_A1:
    case GL_RGBA8:
-      rb->_ActualFormat = GL_RGBA8;
-      rb->_BaseFormat = GL_RGBA;
+#if 1
+   case GL_RGB10_A2:
+   case GL_RGBA12:
+#endif
+      rb->Format = MESA_FORMAT_RGBA8888;
       rb->DataType = GL_UNSIGNED_BYTE;
       rb->GetPointer = get_pointer_ubyte4;
       rb->GetRow = get_row_ubyte4;
@@ -998,18 +989,12 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_ubyte4;
       rb->PutValues = put_values_ubyte4;
       rb->PutMonoValues = put_mono_values_ubyte4;
-      rb->RedBits   = 8 * sizeof(GLubyte);
-      rb->GreenBits = 8 * sizeof(GLubyte);
-      rb->BlueBits  = 8 * sizeof(GLubyte);
-      rb->AlphaBits = 8 * sizeof(GLubyte);
       pixelSize = 4 * sizeof(GLubyte);
       break;
-   case GL_RGB10_A2:
-   case GL_RGBA12:
    case GL_RGBA16:
-      rb->_ActualFormat = GL_RGBA16;
-      rb->_BaseFormat = GL_RGBA;
-      rb->DataType = GL_UNSIGNED_SHORT;
+      /* for accum buffer */
+      rb->Format = MESA_FORMAT_SIGNED_RGBA_16;
+      rb->DataType = GL_SHORT;
       rb->GetPointer = get_pointer_ushort4;
       rb->GetRow = get_row_ushort4;
       rb->GetValues = get_values_ushort4;
@@ -1018,16 +1003,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_ushort4;
       rb->PutValues = put_values_ushort4;
       rb->PutMonoValues = put_mono_values_ushort4;
-      rb->RedBits   = 8 * sizeof(GLushort);
-      rb->GreenBits = 8 * sizeof(GLushort);
-      rb->BlueBits  = 8 * sizeof(GLushort);
-      rb->AlphaBits = 8 * sizeof(GLushort);
       pixelSize = 4 * sizeof(GLushort);
       break;
-#if 00
+#if 0
    case GL_ALPHA8:
-      rb->_ActualFormat = GL_ALPHA8;
-      rb->_BaseFormat = GL_RGBA; /* Yes, not GL_ALPHA! */
+      rb->Format = MESA_FORMAT_A8;
       rb->DataType = GL_UNSIGNED_BYTE;
       rb->GetPointer = get_pointer_alpha8;
       rb->GetRow = get_row_alpha8;
@@ -1037,10 +1017,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_alpha8;
       rb->PutValues = put_values_alpha8;
       rb->PutMonoValues = put_mono_values_alpha8;
-      rb->RedBits   = 0; /*red*/
-      rb->GreenBits = 0; /*green*/
-      rb->BlueBits  = 0; /*blue*/
-      rb->AlphaBits = 8 * sizeof(GLubyte);
       pixelSize = sizeof(GLubyte);
       break;
 #endif
@@ -1048,8 +1024,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
    case GL_STENCIL_INDEX1_EXT:
    case GL_STENCIL_INDEX4_EXT:
    case GL_STENCIL_INDEX8_EXT:
-      rb->_ActualFormat = GL_STENCIL_INDEX8_EXT;
-      rb->_BaseFormat = GL_STENCIL_INDEX;
+   case GL_STENCIL_INDEX16_EXT:
+      rb->Format = MESA_FORMAT_S8;
       rb->DataType = GL_UNSIGNED_BYTE;
       rb->GetPointer = get_pointer_ubyte;
       rb->GetRow = get_row_ubyte;
@@ -1059,28 +1035,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_ubyte;
       rb->PutValues = put_values_ubyte;
       rb->PutMonoValues = put_mono_values_ubyte;
-      rb->StencilBits = 8 * sizeof(GLubyte);
       pixelSize = sizeof(GLubyte);
       break;
-   case GL_STENCIL_INDEX16_EXT:
-      rb->_ActualFormat = GL_STENCIL_INDEX16_EXT;
-      rb->_BaseFormat = GL_STENCIL_INDEX;
-      rb->DataType = GL_UNSIGNED_SHORT;
-      rb->GetPointer = get_pointer_ushort;
-      rb->GetRow = get_row_ushort;
-      rb->GetValues = get_values_ushort;
-      rb->PutRow = put_row_ushort;
-      rb->PutRowRGB = NULL;
-      rb->PutMonoRow = put_mono_row_ushort;
-      rb->PutValues = put_values_ushort;
-      rb->PutMonoValues = put_mono_values_ushort;
-      rb->StencilBits = 8 * sizeof(GLushort);
-      pixelSize = sizeof(GLushort);
-      break;
    case GL_DEPTH_COMPONENT:
    case GL_DEPTH_COMPONENT16:
-      rb->_ActualFormat = GL_DEPTH_COMPONENT16;
-      rb->_BaseFormat = GL_DEPTH_COMPONENT;
+      rb->Format = MESA_FORMAT_Z16;
       rb->DataType = GL_UNSIGNED_SHORT;
       rb->GetPointer = get_pointer_ushort;
       rb->GetRow = get_row_ushort;
@@ -1090,12 +1049,22 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_ushort;
       rb->PutValues = put_values_ushort;
       rb->PutMonoValues = put_mono_values_ushort;
-      rb->DepthBits = 8 * sizeof(GLushort);
       pixelSize = sizeof(GLushort);
       break;
    case GL_DEPTH_COMPONENT24:
+      rb->DataType = GL_UNSIGNED_INT;
+      rb->GetPointer = get_pointer_uint;
+      rb->GetRow = get_row_uint;
+      rb->GetValues = get_values_uint;
+      rb->PutRow = put_row_uint;
+      rb->PutRowRGB = NULL;
+      rb->PutMonoRow = put_mono_row_uint;
+      rb->PutValues = put_values_uint;
+      rb->PutMonoValues = put_mono_values_uint;
+      rb->Format = MESA_FORMAT_X8_Z24;
+      pixelSize = sizeof(GLuint);
+      break;
    case GL_DEPTH_COMPONENT32:
-      rb->_BaseFormat = GL_DEPTH_COMPONENT;
       rb->DataType = GL_UNSIGNED_INT;
       rb->GetPointer = get_pointer_uint;
       rb->GetRow = get_row_uint;
@@ -1105,20 +1074,12 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_uint;
       rb->PutValues = put_values_uint;
       rb->PutMonoValues = put_mono_values_uint;
-      if (internalFormat == GL_DEPTH_COMPONENT24) {
-         rb->_ActualFormat = GL_DEPTH_COMPONENT24;
-         rb->DepthBits = 24;
-      }
-      else {
-         rb->_ActualFormat = GL_DEPTH_COMPONENT32;
-         rb->DepthBits = 32;
-      }
+      rb->Format = MESA_FORMAT_Z32;
       pixelSize = sizeof(GLuint);
       break;
    case GL_DEPTH_STENCIL_EXT:
    case GL_DEPTH24_STENCIL8_EXT:
-      rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
-      rb->_BaseFormat = GL_DEPTH_STENCIL_EXT;
+      rb->Format = MESA_FORMAT_Z24_S8;
       rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
       rb->GetPointer = get_pointer_uint;
       rb->GetRow = get_row_uint;
@@ -1128,13 +1089,12 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_uint;
       rb->PutValues = put_values_uint;
       rb->PutMonoValues = put_mono_values_uint;
-      rb->DepthBits = 24;
-      rb->StencilBits = 8;
       pixelSize = sizeof(GLuint);
       break;
    case GL_COLOR_INDEX8_EXT:
-      rb->_ActualFormat = GL_COLOR_INDEX8_EXT;
-      rb->_BaseFormat = GL_COLOR_INDEX;
+   case GL_COLOR_INDEX16_EXT:
+   case COLOR_INDEX32:
+      rb->Format = MESA_FORMAT_CI8;
       rb->DataType = GL_UNSIGNED_BYTE;
       rb->GetPointer = get_pointer_ubyte;
       rb->GetRow = get_row_ubyte;
@@ -1144,39 +1104,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoRow = put_mono_row_ubyte;
       rb->PutValues = put_values_ubyte;
       rb->PutMonoValues = put_mono_values_ubyte;
-      rb->IndexBits = 8 * sizeof(GLubyte);
       pixelSize = sizeof(GLubyte);
       break;
-   case GL_COLOR_INDEX16_EXT:
-      rb->_ActualFormat = GL_COLOR_INDEX16_EXT;
-      rb->_BaseFormat = GL_COLOR_INDEX;
-      rb->DataType = GL_UNSIGNED_SHORT;
-      rb->GetPointer = get_pointer_ushort;
-      rb->GetRow = get_row_ushort;
-      rb->GetValues = get_values_ushort;
-      rb->PutRow = put_row_ushort;
-      rb->PutRowRGB = NULL;
-      rb->PutMonoRow = put_mono_row_ushort;
-      rb->PutValues = put_values_ushort;
-      rb->PutMonoValues = put_mono_values_ushort;
-      rb->IndexBits = 8 * sizeof(GLushort);
-      pixelSize = sizeof(GLushort);
-      break;
-   case COLOR_INDEX32:
-      rb->_ActualFormat = COLOR_INDEX32;
-      rb->_BaseFormat = GL_COLOR_INDEX;
-      rb->DataType = GL_UNSIGNED_INT;
-      rb->GetPointer = get_pointer_uint;
-      rb->GetRow = get_row_uint;
-      rb->GetValues = get_values_uint;
-      rb->PutRow = put_row_uint;
-      rb->PutRowRGB = NULL;
-      rb->PutMonoRow = put_mono_row_uint;
-      rb->PutValues = put_values_uint;
-      rb->PutMonoValues = put_mono_values_uint;
-      rb->IndexBits = 8 * sizeof(GLuint);
-      pixelSize = sizeof(GLuint);
-      break;
    default:
       _mesa_problem(ctx, "Bad internalFormat in _mesa_soft_renderbuffer_storage");
       return GL_FALSE;
@@ -1213,6 +1142,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
 
    rb->Width = width;
    rb->Height = height;
+   rb->_BaseFormat = _mesa_base_fbo_format(ctx, rb->InternalFormat);
 
    return GL_TRUE;
 }
@@ -1239,7 +1169,7 @@ alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb,
                      GLenum internalFormat, GLuint width, GLuint height)
 {
    ASSERT(arb != arb->Wrapped);
-   ASSERT(arb->_ActualFormat == GL_ALPHA8);
+   ASSERT(arb->Format == MESA_FORMAT_A8);
 
    /* first, pass the call to the wrapped RGB buffer */
    if (!arb->Wrapped->AllocStorage(ctx, arb->Wrapped, internalFormat,
@@ -1439,8 +1369,8 @@ put_mono_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb,
 static void
 copy_buffer_alpha8(struct gl_renderbuffer* dst, struct gl_renderbuffer* src)
 {
-   ASSERT(dst->_ActualFormat == GL_ALPHA8);
-   ASSERT(src->_ActualFormat == GL_ALPHA8);
+   ASSERT(dst->Format == MESA_FORMAT_A8);
+   ASSERT(src->Format == MESA_FORMAT_A8);
    ASSERT(dst->Width == src->Width);
    ASSERT(dst->Height == src->Height);
 
@@ -1486,16 +1416,7 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
    rb->Width = 0;
    rb->Height = 0;
    rb->InternalFormat = GL_NONE;
-   rb->_ActualFormat = GL_NONE;
-   rb->_BaseFormat = GL_NONE;
-
-   rb->ComponentType = GL_UNSIGNED_NORMALIZED; /* ARB_fbo */
-   rb->ColorEncoding = GL_LINEAR; /* ARB_fbo */
-
-   rb->RedBits = rb->GreenBits = rb->BlueBits = rb->AlphaBits = 0;
-   rb->IndexBits = 0;
-   rb->DepthBits = 0;
-   rb->StencilBits = 0;
+   rb->Format = MESA_FORMAT_NONE;
 
    rb->DataType = GL_NONE;
    rb->Data = NULL;
@@ -1612,18 +1533,15 @@ _mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
 
       if (rgbBits <= 8) {
          if (alphaBits)
-            rb->_ActualFormat = GL_RGBA8;
+            rb->Format = MESA_FORMAT_RGBA8888;
          else
-            rb->_ActualFormat = GL_RGB8;
+            rb->Format = MESA_FORMAT_RGB888;
       }
       else {
          assert(rgbBits <= 16);
-         if (alphaBits)
-            rb->_ActualFormat = GL_RGBA16;
-         else
-            rb->_ActualFormat = GL_RGBA16; /* don't really have RGB16 yet */
+         rb->Format = MESA_FORMAT_NONE; /*XXX RGBA16;*/
       }
-      rb->InternalFormat = rb->_ActualFormat;
+      rb->InternalFormat = GL_RGBA;
 
       rb->AllocStorage = _mesa_soft_renderbuffer_storage;
       _mesa_add_renderbuffer(fb, b, rb);
@@ -1677,15 +1595,9 @@ _mesa_add_color_index_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
          return GL_FALSE;
       }
 
-      if (indexBits <= 8) {
-         /* only support GLuint for now */
-         /*rb->InternalFormat = GL_COLOR_INDEX8_EXT;*/
-         rb->_ActualFormat = COLOR_INDEX32;
-      }
-      else {
-         rb->_ActualFormat = COLOR_INDEX32;
-      }
-      rb->InternalFormat = rb->_ActualFormat;
+      assert(indexBits <= 8);
+      rb->Format = MESA_FORMAT_CI8;
+      rb->InternalFormat = GL_COLOR_INDEX;
 
       rb->AllocStorage = _mesa_soft_renderbuffer_storage;
       _mesa_add_renderbuffer(fb, b, rb);
@@ -1758,8 +1670,7 @@ _mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
        * values.
        */
       arb->InternalFormat = arb->Wrapped->InternalFormat;
-      arb->_ActualFormat  = GL_ALPHA8;
-      arb->_BaseFormat    = arb->Wrapped->_BaseFormat;
+      arb->Format         = MESA_FORMAT_A8;
       arb->DataType       = arb->Wrapped->DataType;
       arb->AllocStorage   = alloc_storage_alpha8;
       arb->Delete         = delete_renderbuffer_alpha8;
@@ -1833,15 +1744,17 @@ _mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
    }
 
    if (depthBits <= 16) {
-      rb->_ActualFormat = GL_DEPTH_COMPONENT16;
+      rb->Format = MESA_FORMAT_Z16;
+      rb->InternalFormat = GL_DEPTH_COMPONENT16;
    }
    else if (depthBits <= 24) {
-      rb->_ActualFormat = GL_DEPTH_COMPONENT24;
+      rb->Format = MESA_FORMAT_X8_Z24;
+      rb->InternalFormat = GL_DEPTH_COMPONENT24;
    }
    else {
-      rb->_ActualFormat = GL_DEPTH_COMPONENT32;
+      rb->Format = MESA_FORMAT_Z32;
+      rb->InternalFormat = GL_DEPTH_COMPONENT32;
    }
-   rb->InternalFormat = rb->_ActualFormat;
 
    rb->AllocStorage = _mesa_soft_renderbuffer_storage;
    _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
@@ -1878,14 +1791,9 @@ _mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
       return GL_FALSE;
    }
 
-   if (stencilBits <= 8) {
-      rb->_ActualFormat = GL_STENCIL_INDEX8_EXT;
-   }
-   else {
-      /* not really supported (see s_stencil.c code) */
-      rb->_ActualFormat = GL_STENCIL_INDEX16_EXT;
-   }
-   rb->InternalFormat = rb->_ActualFormat;
+   assert(stencilBits <= 8);
+   rb->Format = MESA_FORMAT_S8;
+   rb->InternalFormat = GL_STENCIL_INDEX8;
 
    rb->AllocStorage = _mesa_soft_renderbuffer_storage;
    _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
@@ -1923,7 +1831,7 @@ _mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
       return GL_FALSE;
    }
 
-   rb->_ActualFormat = GL_RGBA16;
+   rb->Format = MESA_FORMAT_SIGNED_RGBA_16;
    rb->InternalFormat = GL_RGBA16;
    rb->AllocStorage = _mesa_soft_renderbuffer_storage;
    _mesa_add_renderbuffer(fb, BUFFER_ACCUM, rb);
@@ -1967,13 +1875,9 @@ _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
          return GL_FALSE;
       }
 
-      if (colorBits <= 8) {
-         rb->_ActualFormat = GL_RGBA8;
-      }
-      else {
-         rb->_ActualFormat = GL_RGBA16;
-      }
-      rb->InternalFormat = rb->_ActualFormat;
+      assert (colorBits <= 8);
+      rb->Format = MESA_FORMAT_RGBA8888;
+      rb->InternalFormat = GL_RGBA;
 
       rb->AllocStorage = _mesa_soft_renderbuffer_storage;
       _mesa_add_renderbuffer(fb, BUFFER_AUX0 + i, rb);
@@ -2071,6 +1975,8 @@ void
 _mesa_add_renderbuffer(struct gl_framebuffer *fb,
                        GLuint bufferName, struct gl_renderbuffer *rb)
 {
+   GLenum baseFormat;
+
    assert(fb);
    assert(rb);
    assert(bufferName < BUFFER_COUNT);
@@ -2095,7 +2001,8 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb,
     * and the device driver is expecting 8-bit values (GLubyte), we can
     * use a "renderbuffer adaptor/wrapper" to do the necessary conversions.
     */
-   if (rb->_BaseFormat == GL_RGBA) {
+   baseFormat = _mesa_get_format_base_format(rb->Format);
+   if (baseFormat == GL_RGBA) {
       if (CHAN_BITS == 16 && rb->DataType == GL_UNSIGNED_BYTE) {
          GET_CURRENT_CONTEXT(ctx);
          rb = _mesa_new_renderbuffer_16wrap8(ctx, rb);
@@ -2202,7 +2109,7 @@ _mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name)
 
    /* init fields not covered by _mesa_new_renderbuffer() */
    dsrb->InternalFormat = GL_DEPTH24_STENCIL8_EXT;
-   dsrb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
+   dsrb->Format = MESA_FORMAT_Z24_S8;
    dsrb->AllocStorage = _mesa_soft_renderbuffer_storage;
 
    return dsrb;
diff --git a/mesalib/src/mesa/main/shaders.c b/mesalib/src/mesa/main/shaders.c
index bc76b9129..d0dc7e551 100644
--- a/mesalib/src/mesa/main/shaders.c
+++ b/mesalib/src/mesa/main/shaders.c
@@ -26,6 +26,12 @@
 #include "glheader.h"
 #include "context.h"
 #include "shaders.h"
+#include "shader/shader_api.h"
+
+
+/** Define this to enable shader substitution (see below) */
+#define SHADER_SUBST 0
+
 
 
 /**
@@ -388,7 +394,6 @@ _mesa_read_shader(const char *fname)
    int len;
 
    if (!f) {
-      _mesa_fprintf(stderr, "Unable to open shader file %s\n", fname);
       return NULL;
    }
 
@@ -401,16 +406,10 @@ _mesa_read_shader(const char *fname)
    shader = _mesa_strdup(buffer);
    free(buffer);
 
-   if (0) {
-      _mesa_fprintf(stderr, "Read shader %s:\n", fname);
-      _mesa_fprintf(stderr, "%s\n", shader);
-   }
-
    return shader;
 }
 
 
-
 /**
  * Called via glShaderSource() and glShaderSourceARB() API functions.
  * Basically, concatenate the source code strings into one long string
@@ -424,6 +423,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
    GLint *offsets;
    GLsizei i, totalLength;
    GLcharARB *source;
+   GLuint checksum;
 
    if (!shaderObj || string == NULL) {
       _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
@@ -475,22 +475,35 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
    source[totalLength - 1] = '\0';
    source[totalLength - 2] = '\0';
 
-#if 0
-   if (0) {
+   if (SHADER_SUBST) {
+      /* Compute the shader's source code checksum then try to open a file
+       * named newshader_<CHECKSUM>.  If it exists, use it in place of the
+       * original shader source code.  For debugging.
+       */
+      char filename[100];
       GLcharARB *newSource;
 
-      newSource = _mesa_read_shader("newshader.frag");
+      checksum = _mesa_str_checksum(source);
+
+      sprintf(filename, "newshader_%d", checksum);
+
+      newSource = _mesa_read_shader(filename);
       if (newSource) {
+         _mesa_fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
+                       shaderObj, checksum, filename);
          _mesa_free(source);
          source = newSource;
       }
-   }
-#else
-   (void) _mesa_read_shader;
-#endif
+   }      
 
    ctx->Driver.ShaderSource(ctx, shaderObj, source);
 
+   if (SHADER_SUBST) {
+      struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj);
+      if (sh)
+         sh->SourceChecksum = checksum; /* save original checksum */
+   }
+
    _mesa_free(offsets);
 }
 
diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c
index 643ad3354..4d01e8abc 100644
--- a/mesalib/src/mesa/main/shared.c
+++ b/mesalib/src/mesa/main/shared.c
@@ -37,9 +37,7 @@
 #include "shared.h"
 #include "shader/program.h"
 #include "shader/shader_api.h"
-#if FEATURE_dlist
 #include "dlist.h"
-#endif
 #if FEATURE_ATI_fragment_shader
 #include "shader/atifragshader.h"
 #endif
@@ -143,11 +141,9 @@ _mesa_alloc_shared_state(GLcontext *ctx)
 static void
 delete_displaylist_cb(GLuint id, void *data, void *userData)
 {
-#if FEATURE_dlist
    struct gl_display_list *list = (struct gl_display_list *) data;
    GLcontext *ctx = (GLcontext *) userData;
    _mesa_delete_list(ctx, list);
-#endif
 }
 
 
diff --git a/mesalib/src/mesa/main/sources b/mesalib/src/mesa/main/sources
deleted file mode 100644
index 5d9d99040..000000000
--- a/mesalib/src/mesa/main/sources
+++ /dev/null
@@ -1,158 +0,0 @@
-# List of source files in this directory used for X.org xserver build
-MESA_MAIN_SOURCES = \
-accum.c \
-api_arrayelt.c \
-api_exec.c \
-api_loopback.c \
-api_noop.c \
-api_validate.c \
-arrayobj.c \
-attrib.c \
-blend.c \
-bufferobj.c \
-buffers.c \
-clear.c \
-clip.c \
-colortab.c \
-context.c \
-convolve.c \
-debug.c \
-depth.c \
-depthstencil.c \
-dlist.c \
-dlopen.c \
-drawpix.c \
-enable.c \
-enums.c \
-eval.c \
-execmem.c \
-extensions.c \
-fbobject.c \
-feedback.c \
-fog.c \
-framebuffer.c \
-get.c \
-getstring.c \
-hash.c \
-hint.c \
-histogram.c \
-image.c \
-imports.c \
-light.c \
-lines.c \
-matrix.c \
-mipmap.c \
-mm.c \
-multisample.c \
-occlude.c \
-pixel.c \
-pixelstore.c \
-points.c \
-polygon.c \
-readpix.c \
-rastpos.c \
-rbadaptors.c \
-renderbuffer.c \
-scissor.c \
-state.c \
-stencil.c \
-texcompress.c \
-texcompress_fxt1.c \
-texcompress_s3tc.c \
-texenv.c \
-texenvprogram.c \
-texformat.c \
-texgen.c \
-texgetimage.c \
-teximage.c \
-texobj.c \
-texparam.c \
-texrender.c \
-texstate.c \
-texstore.c \
-varray.c \
-$(VSNPRINTF_SOURCES) \
-vtxfmt.c
-
-MESA_VSNPRINTF_SOURCES = \
-vsnprintf.c
-
-MESA_MAIN_HEADERS = \
-accum.h \
-api_arrayelt.h \
-api_exec.h \
-api_loopback.h \
-api_noop.h \
-api_validate.h \
-arrayobj.h \
-attrib.h \
-bitset.h \
-blend.h \
-bufferobj.h \
-buffers.h \
-clear.h \
-clip.h \
-colormac.h \
-colortab.h \
-config.h \
-context.h \
-convolve.h \
-dd.h \
-debug.h \
-depth.h \
-depthstencil.h \
-dlist.h \
-dlopen.h \
-drawpix.h \
-enable.h \
-enums.h \
-eval.h \
-extensions.h \
-fbobject.h \
-feedback.h \
-fog.h \
-framebuffer.h \
-get.h \
-glheader.h \
-hash.h \
-hint.h \
-histogram.h \
-image.h \
-imports.h \
-light.h \
-lines.h \
-macros.h \
-matrix.h \
-mipmap.h \
-mm.h \
-mtypes.h \
-multisample.h \
-occlude.h \
-pixel.h \
-pixelstore.h \
-points.h \
-polygon.h \
-rastpos.h \
-rbadaptors.h \
-readpix.h \
-renderbuffer.h \
-simple_list.h \
-scissor.h \
-state.h \
-stencil.h \
-texcompress.h \
-texenv.h \
-texenvprogram.h \
-texformat.h \
-texformat_tmp.h \
-texgen.h \
-teximage.h \
-texobj.h \
-texparam.h \
-texrender.h \
-texstate.h \
-texstore.h \
-varray.h \
-version.h \
-vtxfmt.h \
-vtxfmt_tmp.h
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index 140a998df..f10e6b04b 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -40,9 +40,7 @@
 #include "framebuffer.h"
 #include "light.h"
 #include "matrix.h"
-#if FEATURE_pixel_transfer
 #include "pixel.h"
-#endif
 #include "shader/program.h"
 #include "shader/prog_parameter.h"
 #include "state.h"
@@ -585,10 +583,8 @@ _mesa_update_state_locked( GLcontext *ctx )
    if (new_state & (_NEW_STENCIL | _NEW_BUFFERS))
       _mesa_update_stencil( ctx );
 
-#if FEATURE_pixel_transfer
    if (new_state & _MESA_NEW_TRANSFER_STATE)
       _mesa_update_pixel( ctx, new_state );
-#endif
 
    if (new_state & _DD_NEW_SEPARATE_SPECULAR)
       update_separate_specular( ctx );
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index 2cda4dd85..a4f1926ab 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -34,10 +34,10 @@
 #include "imports.h"
 #include "colormac.h"
 #include "context.h"
+#include "formats.h"
 #include "image.h"
 #include "mipmap.h"
 #include "texcompress.h"
-#include "texformat.h"
 #include "texstore.h"
 
 
@@ -113,252 +113,43 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all)
 }
 
 
-
 /**
- * Return number of bytes needed to store a texture of the given size
- * using the specified compressed format.
- * This is called via the ctx->Driver.CompressedTextureSize function,
- * unless a device driver overrides it.
- *
- * \param width texture width in texels.
- * \param height texture height in texels.
- * \param depth texture depth in texels.
- * \param mesaFormat  one of the MESA_FORMAT_* compressed formats
- *
- * \return size in bytes, or zero if bad format
+ * Convert a compressed MESA_FORMAT_x to a GLenum.
  */
-GLuint
-_mesa_compressed_texture_size( GLcontext *ctx,
-                               GLsizei width, GLsizei height, GLsizei depth,
-                               GLuint mesaFormat )
+gl_format
+_mesa_glenum_to_compressed_format(GLenum format)
 {
-   GLuint size;
-
-   ASSERT(depth == 1);
-   (void) depth;
-   (void) size;
-
-   switch (mesaFormat) {
-#if FEATURE_texture_fxt1
-   case MESA_FORMAT_RGB_FXT1:
-   case MESA_FORMAT_RGBA_FXT1:
-      /* round up width to next multiple of 8, height to next multiple of 4 */
-      width = (width + 7) & ~7;
-      height = (height + 3) & ~3;
-      /* 16 bytes per 8x4 tile of RGB[A] texels */
-      size = width * height / 2;
-      /* Textures smaller than 8x4 will effectively be made into 8x4 and
-       * take 16 bytes.
-       */
-      return size;
-#endif
-#if FEATURE_texture_s3tc
-   case MESA_FORMAT_RGB_DXT1:
-   case MESA_FORMAT_RGBA_DXT1:
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGB_DXT1:
-   case MESA_FORMAT_SRGBA_DXT1:
-#endif
-      /* round up width, height to next multiple of 4 */
-      width = (width + 3) & ~3;
-      height = (height + 3) & ~3;
-      /* 8 bytes per 4x4 tile of RGB[A] texels */
-      size = width * height / 2;
-      /* Textures smaller than 4x4 will effectively be made into 4x4 and
-       * take 8 bytes.
-       */
-      return size;
-   case MESA_FORMAT_RGBA_DXT3:
-   case MESA_FORMAT_RGBA_DXT5:
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGBA_DXT3:
-   case MESA_FORMAT_SRGBA_DXT5:
-#endif
-      /* round up width, height to next multiple of 4 */
-      width = (width + 3) & ~3;
-      height = (height + 3) & ~3;
-      /* 16 bytes per 4x4 tile of RGBA texels */
-      size = width * height; /* simple! */
-      /* Textures smaller than 4x4 will effectively be made into 4x4 and
-       * take 16 bytes.
-       */
-      return size;
-#endif
-   default:
-      _mesa_problem(ctx, "bad mesaFormat in _mesa_compressed_texture_size");
-      return 0;
-   }
-}
-
-
-/**
- * As above, but format is specified by a GLenum (GL_COMPRESSED_*) token.
- *
- * Note: This function CAN NOT return a padded hardware texture size.
- * That's why we don't call the ctx->Driver.CompressedTextureSize() function.
- *
- * We use this function to validate the <imageSize> parameter
- * of glCompressedTex[Sub]Image1/2/3D(), which must be an exact match.
- */
-GLuint
-_mesa_compressed_texture_size_glenum(GLcontext *ctx,
-                                     GLsizei width, GLsizei height,
-                                     GLsizei depth, GLenum glformat)
-{
-   GLuint mesaFormat;
-
-   switch (glformat) {
-#if FEATURE_texture_fxt1
+   switch (format) {
    case GL_COMPRESSED_RGB_FXT1_3DFX:
-      mesaFormat = MESA_FORMAT_RGB_FXT1;
-      break;
+      return MESA_FORMAT_RGB_FXT1;
    case GL_COMPRESSED_RGBA_FXT1_3DFX:
-      mesaFormat = MESA_FORMAT_RGBA_FXT1;
-      break;
-#endif
-#if FEATURE_texture_s3tc
+      return MESA_FORMAT_RGBA_FXT1;
+
    case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
    case GL_RGB_S3TC:
-      mesaFormat = MESA_FORMAT_RGB_DXT1;
-      break;
+      return MESA_FORMAT_RGB_DXT1;
    case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
    case GL_RGB4_S3TC:
-      mesaFormat = MESA_FORMAT_RGBA_DXT1;
-      break;
+      return MESA_FORMAT_RGBA_DXT1;
    case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
    case GL_RGBA_S3TC:
-      mesaFormat = MESA_FORMAT_RGBA_DXT3;
-      break;
+      return MESA_FORMAT_RGBA_DXT3;
    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
    case GL_RGBA4_S3TC:
-      mesaFormat = MESA_FORMAT_RGBA_DXT5;
-      break;
-#if FEATURE_EXT_texture_sRGB
+      return MESA_FORMAT_RGBA_DXT5;
+
    case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
-      mesaFormat = MESA_FORMAT_SRGB_DXT1;
-      break;
+      return MESA_FORMAT_SRGB_DXT1;
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-      mesaFormat = MESA_FORMAT_SRGBA_DXT1;
-      break;
+      return MESA_FORMAT_SRGBA_DXT1;
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-      mesaFormat = MESA_FORMAT_SRGBA_DXT3;
-      break;
+      return MESA_FORMAT_SRGBA_DXT3;
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-      mesaFormat = MESA_FORMAT_SRGBA_DXT5;
-      break;
-#endif
-#endif
-   default:
-      return 0;
-   }
-
-   return _mesa_compressed_texture_size(ctx, width, height, depth, mesaFormat);
-}
-
-
-/*
- * Compute the bytes per row in a compressed texture image.
- * We use this for computing the destination address for sub-texture updates.
- * \param mesaFormat  one of the MESA_FORMAT_* compressed formats
- * \param width  image width in pixels
- * \return stride, in bytes, between rows for compressed image
- */
-GLint
-_mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width)
-{
-   GLint stride;
-
-   switch (mesaFormat) {
-#if FEATURE_texture_fxt1
-   case MESA_FORMAT_RGB_FXT1:
-   case MESA_FORMAT_RGBA_FXT1:
-      stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */
-      break;
-#endif
-#if FEATURE_texture_s3tc
-   case MESA_FORMAT_RGB_DXT1:
-   case MESA_FORMAT_RGBA_DXT1:
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGB_DXT1:
-   case MESA_FORMAT_SRGBA_DXT1:
-#endif
-      stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */
-      break;
-   case MESA_FORMAT_RGBA_DXT3:
-   case MESA_FORMAT_RGBA_DXT5:
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGBA_DXT3:
-   case MESA_FORMAT_SRGBA_DXT5:
-#endif
-      stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */
-      break;
-#endif
-   default:
-      _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_row_stride");
-      return 0;
-   }
-
-   return stride;
-}
-
+      return MESA_FORMAT_SRGBA_DXT5;
 
-/*
- * Return the address of the pixel at (col, row, img) in a
- * compressed texture image.
- * \param col, row, img - image position (3D)
- * \param format - compressed image format
- * \param width - image width
- * \param image - the image address
- * \return address of pixel at (row, col)
- */
-GLubyte *
-_mesa_compressed_image_address(GLint col, GLint row, GLint img,
-                               GLuint mesaFormat,
-                               GLsizei width, const GLubyte *image)
-{
-   GLubyte *addr;
-
-   (void) img;
-
-   /* We try to spot a "complete" subtexture "above" ROW, COL;
-    * this texture is given by appropriate rounding of WIDTH x ROW.
-    * Then we just add the amount left (usually on the left).
-    *
-    * Example for X*Y microtiles (Z bytes each)
-    * offset = Z * (((width + X - 1) / X) * (row / Y) + col / X);
-    */
-
-   switch (mesaFormat) {
-#if FEATURE_texture_fxt1
-   case MESA_FORMAT_RGB_FXT1:
-   case MESA_FORMAT_RGBA_FXT1:
-      addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8);
-      break;
-#endif
-#if FEATURE_texture_s3tc
-   case MESA_FORMAT_RGB_DXT1:
-   case MESA_FORMAT_RGBA_DXT1:
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGB_DXT1:
-   case MESA_FORMAT_SRGBA_DXT1:
-#endif
-      addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4);
-      break;
-   case MESA_FORMAT_RGBA_DXT3:
-   case MESA_FORMAT_RGBA_DXT5:
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGBA_DXT3:
-   case MESA_FORMAT_SRGBA_DXT5:
-#endif
-      addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4);
-      break;
-#endif
    default:
-      _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_image_address");
-      addr = NULL;
+      return MESA_FORMAT_NONE;
    }
-
-   return addr;
 }
 
 
@@ -410,3 +201,33 @@ _mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat)
 }
 
 
+/*
+ * Return the address of the pixel at (col, row, img) in a
+ * compressed texture image.
+ * \param col, row, img - image position (3D), should be a multiple of the
+ *                        format's block size.
+ * \param format - compressed image format
+ * \param width - image width (stride) in pixels
+ * \param image - the image address
+ * \return address of pixel at (row, col, img)
+ */
+GLubyte *
+_mesa_compressed_image_address(GLint col, GLint row, GLint img,
+                               gl_format mesaFormat,
+                               GLsizei width, const GLubyte *image)
+{
+   /* XXX only 2D images implemented, not 3D */
+   const GLuint blockSize = _mesa_get_format_bytes(mesaFormat);
+   GLuint bw, bh;
+   GLint offset;
+
+   _mesa_get_format_block_size(mesaFormat, &bw, &bh);
+
+   ASSERT(col % bw == 0);
+   ASSERT(row % bh == 0);
+
+   offset = ((width + bw - 1) / bw) * (row / bh) + col / bw;
+   offset *= blockSize;
+
+   return (GLubyte *) image + offset;
+}
diff --git a/mesalib/src/mesa/main/texcompress.h b/mesalib/src/mesa/main/texcompress.h
index 0f1a38f88..5e73a3149 100644
--- a/mesalib/src/mesa/main/texcompress.h
+++ b/mesalib/src/mesa/main/texcompress.h
@@ -26,50 +26,28 @@
 #define TEXCOMPRESS_H
 
 #include "mtypes.h"
+#include "formats.h"
 
 #if _HAVE_FULL_GL
 
 extern GLuint
 _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all);
 
-extern GLuint
-_mesa_compressed_texture_size( GLcontext *ctx,
-                               GLsizei width, GLsizei height, GLsizei depth,
-                               GLuint mesaFormat );
-
-extern GLuint
-_mesa_compressed_texture_size_glenum(GLcontext *ctx,
-                                     GLsizei width, GLsizei height,
-                                     GLsizei depth, GLenum glformat);
-
-extern GLint
-_mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width);
+extern gl_format
+_mesa_glenum_to_compressed_format(GLenum format);
 
+extern GLenum
+_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat);
 
 extern GLubyte *
 _mesa_compressed_image_address(GLint col, GLint row, GLint img,
-                               GLuint mesaFormat,
+                               gl_format mesaFormat,
                                GLsizei width, const GLubyte *image);
 
-
-extern GLenum
-_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat);
-
-
-extern void
-_mesa_init_texture_s3tc( GLcontext *ctx );
-
-extern void
-_mesa_init_texture_fxt1( GLcontext *ctx );
-
-
 #else /* _HAVE_FULL_GL */
 
 /* no-op macros */
 #define _mesa_get_compressed_formats( c, f ) 0
-#define _mesa_compressed_texture_size( c, w, h, d, f ) 0
-#define _mesa_compressed_texture_size_glenum( c, w, h, d, f ) 0
-#define _mesa_compressed_row_stride( f, w) 0
 #define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0
 #define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0)
 
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c
index fc151605c..85becb80d 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.c
+++ b/mesalib/src/mesa/main/texcompress_fxt1.c
@@ -37,10 +37,13 @@
 #include "image.h"
 #include "mipmap.h"
 #include "texcompress.h"
-#include "texformat.h"
+#include "texcompress_fxt1.h"
 #include "texstore.h"
 
 
+#if FEATURE_texture_fxt1
+
+
 static void
 fxt1_encode (GLuint width, GLuint height, GLint comps,
              const void *source, GLint srcRowStride,
@@ -52,20 +55,10 @@ fxt1_decode_1 (const void *texture, GLint stride,
 
 
 /**
- * Called during context initialization.
- */
-void
-_mesa_init_texture_fxt1( GLcontext *ctx )
-{
-   (void) ctx;
-}
-
-
-/**
- * Called via TexFormat->StoreImage to store an RGB_FXT1 texture.
+ * Store user's image in rgb_fxt1 format.
  */
-static GLboolean
-texstore_rgb_fxt1(TEXSTORE_PARAMS)
+GLboolean
+_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -73,7 +66,7 @@ texstore_rgb_fxt1(TEXSTORE_PARAMS)
    const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
    const GLchan *tempImage = NULL;
 
-   ASSERT(dstFormat == &_mesa_texformat_rgb_fxt1);
+   ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
    ASSERT(dstXoffset % 8 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset     == 0);
@@ -87,7 +80,7 @@ texstore_rgb_fxt1(TEXSTORE_PARAMS)
       /* convert image to RGB/GLchan */
       tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                              baseInternalFormat,
-                                             dstFormat->BaseFormat,
+                                             _mesa_get_format_base_format(dstFormat),
                                              srcWidth, srcHeight, srcDepth,
                                              srcFormat, srcType, srcAddr,
                                              srcPacking);
@@ -105,7 +98,7 @@ texstore_rgb_fxt1(TEXSTORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        dstFormat->MesaFormat,
+                                        dstFormat,
                                         texWidth, (GLubyte *) dstAddr);
 
    fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
@@ -119,10 +112,10 @@ texstore_rgb_fxt1(TEXSTORE_PARAMS)
 
 
 /**
- * Called via TexFormat->StoreImage to store an RGBA_FXT1 texture.
+ * Store user's image in rgba_fxt1 format.
  */
-static GLboolean
-texstore_rgba_fxt1(TEXSTORE_PARAMS)
+GLboolean
+_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -130,7 +123,7 @@ texstore_rgba_fxt1(TEXSTORE_PARAMS)
    GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
    const GLchan *tempImage = NULL;
 
-   ASSERT(dstFormat == &_mesa_texformat_rgba_fxt1);
+   ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
    ASSERT(dstXoffset % 8 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset     == 0);
@@ -144,7 +137,7 @@ texstore_rgba_fxt1(TEXSTORE_PARAMS)
       /* convert image to RGBA/GLchan */
       tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                              baseInternalFormat,
-                                             dstFormat->BaseFormat,
+                                             _mesa_get_format_base_format(dstFormat),
                                              srcWidth, srcHeight, srcDepth,
                                              srcFormat, srcType, srcAddr,
                                              srcPacking);
@@ -162,7 +155,7 @@ texstore_rgba_fxt1(TEXSTORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        dstFormat->MesaFormat,
+                                        dstFormat,
                                         texWidth, (GLubyte *) dstAddr);
 
    fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
@@ -175,18 +168,9 @@ texstore_rgba_fxt1(TEXSTORE_PARAMS)
 }
 
 
-static void
-fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLchan *texel )
-{
-   (void) k;
-   fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel);
-}
-
-
-static void
-fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -199,19 +183,9 @@ fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
 }
 
 
-static void
-fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLchan *texel )
-{
-   (void) k;
-   fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel);
-   texel[ACOMP] = 255;
-}
-
-
-static void
-fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -225,55 +199,6 @@ fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
 
 
 
-const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
-   MESA_FORMAT_RGB_FXT1,		/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgb_fxt1,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   fetch_texel_2d_rgb_fxt1, 		/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb_fxt1, 		/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
-   MESA_FORMAT_RGBA_FXT1,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   1, /*approx*/			/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgba_fxt1,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   fetch_texel_2d_rgba_fxt1, 		/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_fxt1, 		/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-
 /***************************************************************************\
  * FXT1 encoder
  *
@@ -1722,3 +1647,6 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
 
    decode_1[mode](code, t, rgba);
 }
+
+
+#endif /* FEATURE_texture_fxt1 */
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.h b/mesalib/src/mesa/main/texcompress_fxt1.h
new file mode 100644
index 000000000..d63ca71e2
--- /dev/null
+++ b/mesalib/src/mesa/main/texcompress_fxt1.h
@@ -0,0 +1,59 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef TEXCOMPRESS_FXT1_H
+#define TEXCOMPRESS_FXT1_H
+
+#include "main/mtypes.h"
+#include "texstore.h"
+
+#if FEATURE_texture_fxt1
+
+extern GLboolean
+_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, GLfloat *texel);
+
+#else /* FEATURE_texture_fxt1 */
+
+/* these are used only in texstore_funcs[] */
+#define _mesa_texstore_rgb_fxt1 NULL
+#define _mesa_texstore_rgba_fxt1 NULL
+
+/* these are used only in texfetch_funcs[] */
+#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL
+
+#endif /* FEATURE_texture_fxt1 */
+
+#endif /* TEXCOMPRESS_FXT1_H */
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index a1c0f18f3..b271a539a 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -41,9 +41,13 @@
 #include "dlopen.h"
 #include "image.h"
 #include "texcompress.h"
-#include "texformat.h"
+#include "texcompress_s3tc.h"
 #include "texstore.h"
 
+
+#if FEATURE_texture_s3tc
+
+
 #ifdef __MINGW32__
 #define DXTN_LIBNAME "dxtn.dll"
 #define RTLD_LAZY 0
@@ -153,10 +157,10 @@ _mesa_init_texture_s3tc( GLcontext *ctx )
 }
 
 /**
- * Called via TexFormat->StoreImage to store an RGB_DXT1 texture.
+ * Store user's image in rgb_dxt1 format.
  */
-static GLboolean
-texstore_rgb_dxt1(TEXSTORE_PARAMS)
+GLboolean
+_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -164,7 +168,7 @@ texstore_rgb_dxt1(TEXSTORE_PARAMS)
    const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
    const GLchan *tempImage = NULL;
 
-   ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1);
+   ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1);
    ASSERT(dstXoffset % 4 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset % 4 == 0);
@@ -178,7 +182,7 @@ texstore_rgb_dxt1(TEXSTORE_PARAMS)
       /* convert image to RGB/GLchan */
       tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                              baseInternalFormat,
-                                             dstFormat->BaseFormat,
+                                             _mesa_get_format_base_format(dstFormat),
                                              srcWidth, srcHeight, srcDepth,
                                              srcFormat, srcType, srcAddr,
                                              srcPacking);
@@ -196,7 +200,7 @@ texstore_rgb_dxt1(TEXSTORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        dstFormat->MesaFormat,
+                                        dstFormat,
                                         texWidth, (GLubyte *) dstAddr);
 
    if (ext_tx_compress_dxtn) {
@@ -216,10 +220,10 @@ texstore_rgb_dxt1(TEXSTORE_PARAMS)
 
 
 /**
- * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture.
+ * Store user's image in rgba_dxt1 format.
  */
-static GLboolean
-texstore_rgba_dxt1(TEXSTORE_PARAMS)
+GLboolean
+_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -227,7 +231,7 @@ texstore_rgba_dxt1(TEXSTORE_PARAMS)
    const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
    const GLchan *tempImage = NULL;
 
-   ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1);
+   ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1);
    ASSERT(dstXoffset % 4 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset % 4 == 0);
@@ -241,7 +245,7 @@ texstore_rgba_dxt1(TEXSTORE_PARAMS)
       /* convert image to RGBA/GLchan */
       tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                              baseInternalFormat,
-                                             dstFormat->BaseFormat,
+                                             _mesa_get_format_base_format(dstFormat),
                                              srcWidth, srcHeight, srcDepth,
                                              srcFormat, srcType, srcAddr,
                                              srcPacking);
@@ -259,7 +263,7 @@ texstore_rgba_dxt1(TEXSTORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        dstFormat->MesaFormat,
+                                        dstFormat,
                                         texWidth, (GLubyte *) dstAddr);
    if (ext_tx_compress_dxtn) {
       (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
@@ -278,10 +282,10 @@ texstore_rgba_dxt1(TEXSTORE_PARAMS)
 
 
 /**
- * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture.
+ * Store user's image in rgba_dxt3 format.
  */
-static GLboolean
-texstore_rgba_dxt3(TEXSTORE_PARAMS)
+GLboolean
+_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -289,7 +293,7 @@ texstore_rgba_dxt3(TEXSTORE_PARAMS)
    const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
    const GLchan *tempImage = NULL;
 
-   ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3);
+   ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3);
    ASSERT(dstXoffset % 4 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset % 4 == 0);
@@ -303,7 +307,7 @@ texstore_rgba_dxt3(TEXSTORE_PARAMS)
       /* convert image to RGBA/GLchan */
       tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                              baseInternalFormat,
-                                             dstFormat->BaseFormat,
+                                             _mesa_get_format_base_format(dstFormat),
                                              srcWidth, srcHeight, srcDepth,
                                              srcFormat, srcType, srcAddr,
                                              srcPacking);
@@ -320,7 +324,7 @@ texstore_rgba_dxt3(TEXSTORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        dstFormat->MesaFormat,
+                                        dstFormat,
                                         texWidth, (GLubyte *) dstAddr);
    if (ext_tx_compress_dxtn) {
       (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
@@ -339,10 +343,10 @@ texstore_rgba_dxt3(TEXSTORE_PARAMS)
 
 
 /**
- * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture.
+ * Store user's image in rgba_dxt5 format.
  */
-static GLboolean
-texstore_rgba_dxt5(TEXSTORE_PARAMS)
+GLboolean
+_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -350,7 +354,7 @@ texstore_rgba_dxt5(TEXSTORE_PARAMS)
    const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
    const GLchan *tempImage = NULL;
 
-   ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5);
+   ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5);
    ASSERT(dstXoffset % 4 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset % 4 == 0);
@@ -364,7 +368,7 @@ texstore_rgba_dxt5(TEXSTORE_PARAMS)
       /* convert image to RGBA/GLchan */
       tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                              baseInternalFormat,
-                                             dstFormat->BaseFormat,
+                                   	     _mesa_get_format_base_format(dstFormat),
                                              srcWidth, srcHeight, srcDepth,
                                              srcFormat, srcType, srcAddr,
                                              srcPacking);
@@ -381,7 +385,7 @@ texstore_rgba_dxt5(TEXSTORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        dstFormat->MesaFormat,
+                                        dstFormat,
                                         texWidth, (GLubyte *) dstAddr);
    if (ext_tx_compress_dxtn) {
       (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
@@ -414,9 +418,9 @@ fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
 }
 
 
-static void
-fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -442,9 +446,9 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
 }
 
 
-static void
-fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -471,9 +475,9 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
 }
 
 
-static void
-fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -499,9 +503,9 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
 }
 
 
-static void
-fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -513,9 +517,9 @@ fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
 }
 
 #if FEATURE_EXT_texture_sRGB
-static void
-fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -526,9 +530,9 @@ fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
    texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
 }
 
-static void
-fetch_texel_2d_f_srgba_dxt1( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -539,9 +543,9 @@ fetch_texel_2d_f_srgba_dxt1( const struct gl_texture_image *texImage,
    texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
 }
 
-static void
-fetch_texel_2d_f_srgba_dxt3( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -552,9 +556,9 @@ fetch_texel_2d_f_srgba_dxt3( const struct gl_texture_image *texImage,
    texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
 }
 
-static void
-fetch_texel_2d_f_srgba_dxt5( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
@@ -564,198 +568,7 @@ fetch_texel_2d_f_srgba_dxt5( const struct gl_texture_image *texImage,
    texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
    texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
 }
-#endif
+#endif /* FEATURE_EXT_texture_sRGB */
 
-const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
-   MESA_FORMAT_RGB_DXT1,		/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgb_dxt1,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   fetch_texel_2d_rgb_dxt1, 		/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb_dxt1, 		/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
-   MESA_FORMAT_RGBA_DXT1,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   1, /*approx*/			/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgba_dxt1,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   fetch_texel_2d_rgba_dxt1, 		/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_dxt1, 		/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
-   MESA_FORMAT_RGBA_DXT3,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   4, /*approx*/			/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgba_dxt3,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   fetch_texel_2d_rgba_dxt3, 		/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_dxt3, 		/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
-   MESA_FORMAT_RGBA_DXT5,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4,/*approx*/				/* RedBits */
-   4,/*approx*/				/* GreenBits */
-   4,/*approx*/				/* BlueBits */
-   4,/*approx*/				/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgba_dxt5,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   fetch_texel_2d_rgba_dxt5, 		/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_dxt5, 		/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
 
-#if FEATURE_EXT_texture_sRGB
-const struct gl_texture_format _mesa_texformat_srgb_dxt1 = {
-   MESA_FORMAT_SRGB_DXT1,		/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgb_dxt1,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   NULL, 				/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_srgb_dxt1, 		/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_srgba_dxt1 = {
-   MESA_FORMAT_SRGBA_DXT1,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   1, /*approx*/			/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgba_dxt1,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   NULL, 				/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_srgba_dxt1, 	/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_srgba_dxt3 = {
-   MESA_FORMAT_SRGBA_DXT3,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4, /*approx*/			/* RedBits */
-   4, /*approx*/			/* GreenBits */
-   4, /*approx*/			/* BlueBits */
-   4, /*approx*/			/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgba_dxt3,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   NULL, 				/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_srgba_dxt3, 	/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_srgba_dxt5 = {
-   MESA_FORMAT_SRGBA_DXT5,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4,/*approx*/				/* RedBits */
-   4,/*approx*/				/* GreenBits */
-   4,/*approx*/				/* BlueBits */
-   4,/*approx*/				/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   texstore_rgba_dxt5,			/* StoreTexImageFunc */
-   NULL, /*impossible*/ 		/* FetchTexel1D */
-   NULL, 				/* FetchTexel2D */
-   NULL, /*impossible*/ 		/* FetchTexel3D */
-   NULL, /*impossible*/ 		/* FetchTexel1Df */
-   fetch_texel_2d_f_srgba_dxt5, 	/* FetchTexel2Df */
-   NULL, /*impossible*/ 		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-#endif
+#endif /* FEATURE_texture_s3tc */
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.h b/mesalib/src/mesa/main/texcompress_s3tc.h
new file mode 100644
index 000000000..2e7688d36
--- /dev/null
+++ b/mesalib/src/mesa/main/texcompress_s3tc.h
@@ -0,0 +1,106 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.1
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef TEXCOMPRESS_S3TC_H
+#define TEXCOMPRESS_S3TC_H
+
+#include "main/mtypes.h"
+#include "texstore.h"
+
+
+#if FEATURE_texture_s3tc
+
+extern GLboolean
+_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
+
+extern void
+_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgb_dxt1(const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_init_texture_s3tc(GLcontext *ctx);
+
+#else /* FEATURE_texture_s3tc */
+
+/* these are used only in texstore_funcs[] */
+#define _mesa_texstore_rgb_dxt1 NULL
+#define _mesa_texstore_rgba_dxt1 NULL
+#define _mesa_texstore_rgba_dxt3 NULL
+#define _mesa_texstore_rgba_dxt5 NULL
+
+/* these are used only in texfetch_funcs[] */
+#define _mesa_fetch_texel_2d_f_rgb_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt3 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt5 NULL
+#define _mesa_fetch_texel_2d_f_srgb_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt3 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL
+
+static INLINE void
+_mesa_init_texture_s3tc(GLcontext *ctx)
+{
+}
+
+#endif /* FEATURE_texture_s3tc */
+
+#endif /* TEXCOMPRESS_S3TC_H */
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index 6d86a4275..4442fb8cf 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -598,7 +598,10 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
 void GLAPIENTRY
 _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
 {
-   _mesa_TexEnvfv( target, pname, &param );
+   GLfloat p[4];
+   p[0] = param;
+   p[1] = p[2] = p[3] = 0.0;
+   _mesa_TexEnvfv( target, pname, p );
 }
 
 
diff --git a/mesalib/src/mesa/main/texenvprogram.c b/mesalib/src/mesa/main/texenvprogram.c
index d7e77e759..f439d4add 100644
--- a/mesalib/src/mesa/main/texenvprogram.c
+++ b/mesalib/src/mesa/main/texenvprogram.c
@@ -367,7 +367,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx )
    else {
       /* calculate from vp->outputs */
       struct gl_vertex_program *vprog;
-      GLbitfield vp_outputs;
+      GLbitfield64 vp_outputs;
 
       /* Choose GLSL vertex shader over ARB vertex program.  Need this
        * since vertex shader state validation comes after fragment state
diff --git a/mesalib/src/mesa/main/texfetch.c b/mesalib/src/mesa/main/texfetch.c
new file mode 100644
index 000000000..b37039429
--- /dev/null
+++ b/mesalib/src/mesa/main/texfetch.c
@@ -0,0 +1,693 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2009  VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texfetch.c
+ *
+ * Texel fetch/store functions
+ *
+ * \author Gareth Hughes
+ */
+
+
+#include "colormac.h"
+#include "context.h"
+#include "texcompress.h"
+#include "texcompress_fxt1.h"
+#include "texcompress_s3tc.h"
+#include "texfetch.h"
+
+
+/**
+ * Convert an 8-bit sRGB value from non-linear space to a
+ * linear RGB value in [0, 1].
+ * Implemented with a 256-entry lookup table.
+ */
+static INLINE GLfloat
+nonlinear_to_linear(GLubyte cs8)
+{
+   static GLfloat table[256];
+   static GLboolean tableReady = GL_FALSE;
+   if (!tableReady) {
+      /* compute lookup table now */
+      GLuint i;
+      for (i = 0; i < 256; i++) {
+         const GLfloat cs = UBYTE_TO_FLOAT(i);
+         if (cs <= 0.04045) {
+            table[i] = cs / 12.92f;
+         }
+         else {
+            table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4);
+         }
+      }
+      tableReady = GL_TRUE;
+   }
+   return table[cs8];
+}
+
+
+
+/* Texel fetch routines for all supported formats
+ */
+#define DIM 1
+#include "texfetch_tmp.h"
+
+#define DIM 2
+#include "texfetch_tmp.h"
+
+#define DIM 3
+#include "texfetch_tmp.h"
+
+/**
+ * Null texel fetch function.
+ *
+ * Have to have this so the FetchTexel function pointer is never NULL.
+ */
+static void fetch_null_texelf( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   (void) texImage; (void) i; (void) j; (void) k;
+   texel[RCOMP] = 0.0;
+   texel[GCOMP] = 0.0;
+   texel[BCOMP] = 0.0;
+   texel[ACOMP] = 0.0;
+   _mesa_warning(NULL, "fetch_null_texelf() called!");
+}
+
+static void store_null_texel(struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, const void *texel)
+{
+   (void) texImage;
+   (void) i;
+   (void) j;
+   (void) k;
+   (void) texel;
+   /* no-op */
+}
+
+
+
+/**
+ * Table to map MESA_FORMAT_ to texel fetch/store funcs.
+ * XXX this is somewhat temporary.
+ */
+static struct {
+   GLuint Name;
+   FetchTexelFuncF Fetch1D;
+   FetchTexelFuncF Fetch2D;
+   FetchTexelFuncF Fetch3D;
+   StoreTexelFunc StoreTexel;
+}
+texfetch_funcs[MESA_FORMAT_COUNT] =
+{
+   {
+      MESA_FORMAT_SRGB8,
+      fetch_texel_1d_srgb8,
+      fetch_texel_2d_srgb8,
+      fetch_texel_3d_srgb8,
+      store_texel_srgb8
+   },
+   {
+      MESA_FORMAT_SRGBA8,
+      fetch_texel_1d_srgba8,
+      fetch_texel_2d_srgba8,
+      fetch_texel_3d_srgba8,
+      store_texel_srgba8
+   },
+   {
+      MESA_FORMAT_SARGB8,
+      fetch_texel_1d_sargb8,
+      fetch_texel_2d_sargb8,
+      fetch_texel_3d_sargb8,
+      store_texel_sargb8
+   },
+   {
+      MESA_FORMAT_SL8,
+      fetch_texel_1d_sl8,
+      fetch_texel_2d_sl8,
+      fetch_texel_3d_sl8,
+      store_texel_sl8
+   },
+   {
+      MESA_FORMAT_SLA8,
+      fetch_texel_1d_sla8,
+      fetch_texel_2d_sla8,
+      fetch_texel_3d_sla8,
+      store_texel_sla8
+   },
+   {
+      MESA_FORMAT_RGB_FXT1,
+      NULL,
+      _mesa_fetch_texel_2d_f_rgb_fxt1,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_RGBA_FXT1,
+      NULL,
+      _mesa_fetch_texel_2d_f_rgba_fxt1,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_RGB_DXT1,
+      NULL,
+      _mesa_fetch_texel_2d_f_rgb_dxt1,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_RGBA_DXT1,
+      NULL,
+      _mesa_fetch_texel_2d_f_rgba_dxt1,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_RGBA_DXT3,
+      NULL,
+      _mesa_fetch_texel_2d_f_rgba_dxt3,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_RGBA_DXT5,
+      NULL,
+      _mesa_fetch_texel_2d_f_rgba_dxt5,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_SRGB_DXT1,
+      NULL,
+      _mesa_fetch_texel_2d_f_srgb_dxt1,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_SRGBA_DXT1,
+      NULL,
+      _mesa_fetch_texel_2d_f_srgba_dxt1,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_SRGBA_DXT3,
+      NULL,
+      _mesa_fetch_texel_2d_f_srgba_dxt3,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_SRGBA_DXT5,
+      NULL,
+      _mesa_fetch_texel_2d_f_srgba_dxt5,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_RGBA_FLOAT32,
+      fetch_texel_1d_f_rgba_f32,
+      fetch_texel_2d_f_rgba_f32,
+      fetch_texel_3d_f_rgba_f32,
+      store_texel_rgba_f32
+   },
+   {
+      MESA_FORMAT_RGBA_FLOAT16,
+      fetch_texel_1d_f_rgba_f16,
+      fetch_texel_2d_f_rgba_f16,
+      fetch_texel_3d_f_rgba_f16,
+      store_texel_rgba_f16
+   },
+   {
+      MESA_FORMAT_RGB_FLOAT32,
+      fetch_texel_1d_f_rgb_f32,
+      fetch_texel_2d_f_rgb_f32,
+      fetch_texel_3d_f_rgb_f32,
+      store_texel_rgb_f32
+   },
+   {
+      MESA_FORMAT_RGB_FLOAT16,
+      fetch_texel_1d_f_rgb_f16,
+      fetch_texel_2d_f_rgb_f16,
+      fetch_texel_3d_f_rgb_f16,
+      store_texel_rgb_f16
+   },
+   {
+      MESA_FORMAT_ALPHA_FLOAT32,
+      fetch_texel_1d_f_alpha_f32,
+      fetch_texel_2d_f_alpha_f32,
+      fetch_texel_3d_f_alpha_f32,
+      store_texel_alpha_f32
+   },
+   {
+      MESA_FORMAT_ALPHA_FLOAT16,
+      fetch_texel_1d_f_alpha_f16,
+      fetch_texel_2d_f_alpha_f16,
+      fetch_texel_3d_f_alpha_f16,
+      store_texel_alpha_f16
+   },
+   {
+      MESA_FORMAT_LUMINANCE_FLOAT32,
+      fetch_texel_1d_f_luminance_f32,
+      fetch_texel_2d_f_luminance_f32,
+      fetch_texel_3d_f_luminance_f32,
+      store_texel_luminance_f32
+   },
+   {
+      MESA_FORMAT_LUMINANCE_FLOAT16,
+      fetch_texel_1d_f_luminance_f16,
+      fetch_texel_2d_f_luminance_f16,
+      fetch_texel_3d_f_luminance_f16,
+      store_texel_luminance_f16
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
+      fetch_texel_1d_f_luminance_alpha_f32,
+      fetch_texel_2d_f_luminance_alpha_f32,
+      fetch_texel_3d_f_luminance_alpha_f32,
+      store_texel_luminance_alpha_f32
+   },
+   {
+      MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
+      fetch_texel_1d_f_luminance_alpha_f16,
+      fetch_texel_2d_f_luminance_alpha_f16,
+      fetch_texel_3d_f_luminance_alpha_f16,
+      store_texel_luminance_alpha_f16
+   },
+   {
+      MESA_FORMAT_INTENSITY_FLOAT32,
+      fetch_texel_1d_f_intensity_f32,
+      fetch_texel_2d_f_intensity_f32,
+      fetch_texel_3d_f_intensity_f32,
+      store_texel_intensity_f32
+   },
+   {
+      MESA_FORMAT_INTENSITY_FLOAT16,
+      fetch_texel_1d_f_intensity_f16,
+      fetch_texel_2d_f_intensity_f16,
+      fetch_texel_3d_f_intensity_f16,
+      store_texel_intensity_f16
+   },
+   {
+      MESA_FORMAT_DUDV8,
+      fetch_texel_1d_dudv8,
+      fetch_texel_2d_dudv8,
+      fetch_texel_3d_dudv8,
+      NULL
+   },
+   {
+      MESA_FORMAT_SIGNED_RGBA8888,
+      fetch_texel_1d_signed_rgba8888,
+      fetch_texel_2d_signed_rgba8888,
+      fetch_texel_3d_signed_rgba8888,
+      store_texel_signed_rgba8888
+   },
+   {
+      MESA_FORMAT_SIGNED_RGBA8888_REV,
+      fetch_texel_1d_signed_rgba8888_rev,
+      fetch_texel_2d_signed_rgba8888_rev,
+      fetch_texel_3d_signed_rgba8888_rev,
+      store_texel_signed_rgba8888_rev
+   },
+   {
+      MESA_FORMAT_SIGNED_RGBA_16,
+      NULL, /* XXX to do */
+      NULL,
+      NULL,
+      NULL
+   },
+   {
+      MESA_FORMAT_RGBA8888,
+      fetch_texel_1d_f_rgba8888,
+      fetch_texel_2d_f_rgba8888,
+      fetch_texel_3d_f_rgba8888,
+      store_texel_rgba8888
+   },
+   {
+      MESA_FORMAT_RGBA8888_REV,
+      fetch_texel_1d_f_rgba8888_rev,
+      fetch_texel_2d_f_rgba8888_rev,
+      fetch_texel_3d_f_rgba8888_rev,
+      store_texel_rgba8888_rev
+   },
+   {
+      MESA_FORMAT_ARGB8888,
+      fetch_texel_1d_f_argb8888,
+      fetch_texel_2d_f_argb8888,
+      fetch_texel_3d_f_argb8888,
+      store_texel_argb8888
+   },
+   {
+      MESA_FORMAT_ARGB8888_REV,
+      fetch_texel_1d_f_argb8888_rev,
+      fetch_texel_2d_f_argb8888_rev,
+      fetch_texel_3d_f_argb8888_rev,
+      store_texel_argb8888_rev
+   },
+   {
+      MESA_FORMAT_XRGB8888,
+      fetch_texel_1d_f_xrgb8888,
+      fetch_texel_2d_f_xrgb8888,
+      fetch_texel_3d_f_xrgb8888,
+      store_texel_xrgb8888
+   },
+   {
+      MESA_FORMAT_XRGB8888_REV,
+      fetch_texel_1d_f_xrgb8888_rev,
+      fetch_texel_2d_f_xrgb8888_rev,
+      fetch_texel_3d_f_xrgb8888_rev,
+      store_texel_xrgb8888_rev,
+   },
+   {
+      MESA_FORMAT_RGB888,
+      fetch_texel_1d_f_rgb888,
+      fetch_texel_2d_f_rgb888,
+      fetch_texel_3d_f_rgb888,
+      store_texel_rgb888
+   },
+   {
+      MESA_FORMAT_BGR888,
+      fetch_texel_1d_f_bgr888,
+      fetch_texel_2d_f_bgr888,
+      fetch_texel_3d_f_bgr888,
+      store_texel_bgr888
+   },
+   {
+      MESA_FORMAT_RGB565,
+      fetch_texel_1d_f_rgb565,
+      fetch_texel_2d_f_rgb565,
+      fetch_texel_3d_f_rgb565,
+      store_texel_rgb565
+   },
+   {
+      MESA_FORMAT_RGB565_REV,
+      fetch_texel_1d_f_rgb565_rev,
+      fetch_texel_2d_f_rgb565_rev,
+      fetch_texel_3d_f_rgb565_rev,
+      store_texel_rgb565_rev
+   },
+   {
+      MESA_FORMAT_ARGB4444,
+      fetch_texel_1d_f_argb4444,
+      fetch_texel_2d_f_argb4444,
+      fetch_texel_3d_f_argb4444,
+      store_texel_argb4444
+   },
+   {
+      MESA_FORMAT_ARGB4444_REV,
+      fetch_texel_1d_f_argb4444_rev,
+      fetch_texel_2d_f_argb4444_rev,
+      fetch_texel_3d_f_argb4444_rev,
+      store_texel_argb4444_rev
+   },
+   {
+      MESA_FORMAT_RGBA5551,
+      fetch_texel_1d_f_rgba5551,
+      fetch_texel_2d_f_rgba5551,
+      fetch_texel_3d_f_rgba5551,
+      store_texel_rgba5551
+   },
+   {
+      MESA_FORMAT_ARGB1555,
+      fetch_texel_1d_f_argb1555,
+      fetch_texel_2d_f_argb1555,
+      fetch_texel_3d_f_argb1555,
+      store_texel_argb1555
+   },
+   {
+      MESA_FORMAT_ARGB1555_REV,
+      fetch_texel_1d_f_argb1555_rev,
+      fetch_texel_2d_f_argb1555_rev,
+      fetch_texel_3d_f_argb1555_rev,
+      store_texel_argb1555_rev
+   },
+   {
+      MESA_FORMAT_AL88,
+      fetch_texel_1d_f_al88,
+      fetch_texel_2d_f_al88,
+      fetch_texel_3d_f_al88,
+      store_texel_al88
+   },
+   {
+      MESA_FORMAT_AL88_REV,
+      fetch_texel_1d_f_al88_rev,
+      fetch_texel_2d_f_al88_rev,
+      fetch_texel_3d_f_al88_rev,
+      store_texel_al88_rev
+   },
+   {
+      MESA_FORMAT_AL1616,
+      fetch_texel_1d_f_al1616,
+      fetch_texel_2d_f_al1616,
+      fetch_texel_3d_f_al1616,
+      store_texel_al1616
+   },
+   {
+      MESA_FORMAT_AL1616_REV,
+      fetch_texel_1d_f_al1616_rev,
+      fetch_texel_2d_f_al1616_rev,
+      fetch_texel_3d_f_al1616_rev,
+      store_texel_al1616_rev
+   },
+   {
+      MESA_FORMAT_RGB332,
+      fetch_texel_1d_f_rgb332,
+      fetch_texel_2d_f_rgb332,
+      fetch_texel_3d_f_rgb332,
+      store_texel_rgb332
+   },
+   {
+      MESA_FORMAT_A8,
+      fetch_texel_1d_f_a8,
+      fetch_texel_2d_f_a8,
+      fetch_texel_3d_f_a8,
+      store_texel_a8
+   },
+   {
+      MESA_FORMAT_L8,
+      fetch_texel_1d_f_l8,
+      fetch_texel_2d_f_l8,
+      fetch_texel_3d_f_l8,
+      store_texel_l8
+   },
+   {
+      MESA_FORMAT_I8,
+      fetch_texel_1d_f_i8,
+      fetch_texel_2d_f_i8,
+      fetch_texel_3d_f_i8,
+      store_texel_i8
+   },
+   {
+      MESA_FORMAT_CI8,
+      fetch_texel_1d_f_ci8,
+      fetch_texel_2d_f_ci8,
+      fetch_texel_3d_f_ci8,
+      store_texel_ci8
+   },
+   {
+      MESA_FORMAT_YCBCR,
+      fetch_texel_1d_f_ycbcr,
+      fetch_texel_2d_f_ycbcr,
+      fetch_texel_3d_f_ycbcr,
+      store_texel_ycbcr
+   },
+   {
+      MESA_FORMAT_YCBCR_REV,
+      fetch_texel_1d_f_ycbcr_rev,
+      fetch_texel_2d_f_ycbcr_rev,
+      fetch_texel_3d_f_ycbcr_rev,
+      store_texel_ycbcr_rev
+   },
+   {
+      MESA_FORMAT_Z24_S8,
+      fetch_texel_1d_f_z24_s8,
+      fetch_texel_2d_f_z24_s8,
+      fetch_texel_3d_f_z24_s8,
+      store_texel_z24_s8
+   },
+   {
+      MESA_FORMAT_S8_Z24,
+      fetch_texel_1d_f_s8_z24,
+      fetch_texel_2d_f_s8_z24,
+      fetch_texel_3d_f_s8_z24,
+      store_texel_s8_z24
+   },
+   {
+      MESA_FORMAT_Z16,
+      fetch_texel_1d_f_z16,
+      fetch_texel_2d_f_z16,
+      fetch_texel_3d_f_z16,
+      store_texel_z16
+   },
+   {
+      MESA_FORMAT_X8_Z24,
+      fetch_texel_1d_f_s8_z24,
+      fetch_texel_2d_f_s8_z24,
+      fetch_texel_3d_f_s8_z24,
+      store_texel_s8_z24
+   },
+   {
+      MESA_FORMAT_Z24_X8,
+      fetch_texel_1d_f_z24_s8,
+      fetch_texel_2d_f_z24_s8,
+      fetch_texel_3d_f_z24_s8,
+      store_texel_z24_s8
+   },
+   {
+      MESA_FORMAT_Z32,
+      fetch_texel_1d_f_z32,
+      fetch_texel_2d_f_z32,
+      fetch_texel_3d_f_z32,
+      store_texel_z32
+   }
+};
+
+
+static FetchTexelFuncF
+_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
+{
+   FetchTexelFuncF f = NULL;
+   GLuint i;
+   /* XXX replace loop with direct table lookup */
+   for (i = 0; i < MESA_FORMAT_COUNT; i++) {
+      if (texfetch_funcs[i].Name == format) {
+         switch (dims) {
+         case 1:
+            f = texfetch_funcs[i].Fetch1D;
+            break;
+         case 2:
+            f = texfetch_funcs[i].Fetch2D;
+            break;
+         case 3:
+            f = texfetch_funcs[i].Fetch3D;
+            break;
+         }
+         if (!f)
+            f = fetch_null_texelf;
+         return f;
+      }
+   }
+   return NULL;
+}
+
+
+StoreTexelFunc
+_mesa_get_texel_store_func(gl_format format)
+{
+   GLuint i;
+   /* XXX replace loop with direct table lookup */
+   for (i = 0; i < MESA_FORMAT_COUNT; i++) {
+      if (texfetch_funcs[i].Name == format) {
+         if (texfetch_funcs[i].StoreTexel)
+            return texfetch_funcs[i].StoreTexel;
+         else
+            return store_null_texel;
+      }
+   }
+   return NULL;
+}
+
+
+
+/**
+ * Adaptor for fetching a GLchan texel from a float-valued texture.
+ */
+static void
+fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLchan *texelOut)
+{
+   GLfloat temp[4];
+   GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
+
+   ASSERT(texImage->FetchTexelf);
+   texImage->FetchTexelf(texImage, i, j, k, temp);
+   if (baseFormat == GL_DEPTH_COMPONENT ||
+       baseFormat == GL_DEPTH_STENCIL_EXT) {
+      /* just one channel */
+      UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
+   }
+   else {
+      /* four channels */
+      UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
+      UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]);
+      UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]);
+      UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]);
+   }
+}
+
+
+#if 0
+/**
+ * Adaptor for fetching a float texel from a GLchan-valued texture.
+ */
+static void
+fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texelOut)
+{
+   GLchan temp[4];
+   GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
+
+   ASSERT(texImage->FetchTexelc);
+   texImage->FetchTexelc(texImage, i, j, k, temp);
+   if (baseFormat == GL_DEPTH_COMPONENT ||
+       baseFormat == GL_DEPTH_STENCIL_EXT) {
+      /* just one channel */
+      texelOut[0] = CHAN_TO_FLOAT(temp[0]);
+   }
+   else {
+      /* four channels */
+      texelOut[0] = CHAN_TO_FLOAT(temp[0]);
+      texelOut[1] = CHAN_TO_FLOAT(temp[1]);
+      texelOut[2] = CHAN_TO_FLOAT(temp[2]);
+      texelOut[3] = CHAN_TO_FLOAT(temp[3]);
+   }
+}
+#endif
+
+
+/**
+ * Initialize the texture image's FetchTexelc and FetchTexelf methods.
+ */
+void
+_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
+{
+   ASSERT(dims == 1 || dims == 2 || dims == 3);
+   ASSERT(texImage->TexFormat);
+
+   if (!texImage->FetchTexelf) {
+      texImage->FetchTexelf =
+         _mesa_get_texel_fetch_func(texImage->TexFormat, dims);
+   }
+
+   /* now check if we need to use a float/chan adaptor */
+   if (!texImage->FetchTexelc) {
+      texImage->FetchTexelc = fetch_texel_float_to_chan;
+   }
+
+   ASSERT(texImage->FetchTexelc);
+   ASSERT(texImage->FetchTexelf);
+}
diff --git a/mesalib/src/mesa/main/texfetch.h b/mesalib/src/mesa/main/texfetch.h
new file mode 100644
index 000000000..ef13bf27f
--- /dev/null
+++ b/mesalib/src/mesa/main/texfetch.h
@@ -0,0 +1,40 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2009 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXFETCH_H
+#define TEXFETCH_H
+
+#include "mtypes.h"
+#include "formats.h"
+
+
+extern StoreTexelFunc
+_mesa_get_texel_store_func(gl_format format);
+
+extern void
+_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
+
+#endif
diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/main/texfetch_tmp.h
new file mode 100644
index 000000000..e6772c89f
--- /dev/null
+++ b/mesalib/src/mesa/main/texfetch_tmp.h
@@ -0,0 +1,1394 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.7
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008-2009  VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texfetch_tmp.h
+ * Texel fetch functions template.
+ * 
+ * This template file is used by texfetch.c to generate texel fetch functions
+ * for 1-D, 2-D and 3-D texture images. 
+ *
+ * It should be expanded by defining \p DIM as the number texture dimensions
+ * (1, 2 or 3).  According to the value of \p DIM a series of macros is defined
+ * for the texel lookup in the gl_texture_image::Data.
+ * 
+ * \author Gareth Hughes
+ * \author Brian Paul
+ */
+
+
+#if DIM == 1
+
+#define TEXEL_ADDR( type, image, i, j, k, size ) \
+	((void) (j), (void) (k), ((type *)(image)->Data + (i) * (size)))
+
+#define FETCH(x) fetch_texel_1d_##x
+
+#elif DIM == 2
+
+#define TEXEL_ADDR( type, image, i, j, k, size )			\
+	((void) (k),							\
+	 ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size)))
+
+#define FETCH(x) fetch_texel_2d_##x
+
+#elif DIM == 3
+
+#define TEXEL_ADDR( type, image, i, j, k, size )			\
+	((type *)(image)->Data + ((image)->ImageOffsets[k]		\
+             + (image)->RowStride * (j) + (i)) * (size))
+
+#define FETCH(x) fetch_texel_3d_##x
+
+#else
+#error	illegal number of texture dimensions
+#endif
+
+
+/* MESA_FORMAT_Z32 ***********************************************************/
+
+/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture,
+ * returning 1 GLfloat.
+ * Note: no GLchan version of this function.
+ */
+static void FETCH(f_z32)( const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[0] = src[0] * (1.0F / 0xffffffff);
+}
+
+#if DIM == 3
+static void store_texel_z32(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLuint *depth = (const GLuint *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   dst[0] = *depth;
+}
+#endif
+
+
+/* MESA_FORMAT_Z16 ***********************************************************/
+
+/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture,
+ * returning 1 GLfloat.
+ * Note: no GLchan version of this function.
+ */
+static void FETCH(f_z16)(const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   texel[0] = src[0] * (1.0F / 65535.0F);
+}
+
+#if DIM == 3
+static void store_texel_z16(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLushort *depth = (const GLushort *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   dst[0] = *depth;
+}
+#endif
+
+
+/* MESA_FORMAT_RGBA_F32 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
+ */
+static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
+   texel[RCOMP] = src[0];
+   texel[GCOMP] = src[1];
+   texel[BCOMP] = src[2];
+   texel[ACOMP] = src[3];
+}
+
+#if DIM == 3
+static void store_texel_rgba_f32(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *depth = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   dst[0] = depth[RCOMP];
+   dst[1] = depth[GCOMP];
+   dst[2] = depth[BCOMP];
+   dst[3] = depth[ACOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_RGBA_F16 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
+   texel[RCOMP] = _mesa_half_to_float(src[0]);
+   texel[GCOMP] = _mesa_half_to_float(src[1]);
+   texel[BCOMP] = _mesa_half_to_float(src[2]);
+   texel[ACOMP] = _mesa_half_to_float(src[3]);
+}
+
+#if DIM == 3
+static void store_texel_rgba_f16(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *depth = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   dst[0] = _mesa_float_to_half(*depth);
+}
+#endif
+
+/* MESA_FORMAT_RGB_F32 *******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
+                              GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
+   texel[RCOMP] = src[0];
+   texel[GCOMP] = src[1];
+   texel[BCOMP] = src[2];
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgb_f32(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *depth = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   dst[0] = *depth;
+}
+#endif
+
+
+/* MESA_FORMAT_RGB_F16 *******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
+                              GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
+   texel[RCOMP] = _mesa_half_to_float(src[0]);
+   texel[GCOMP] = _mesa_half_to_float(src[1]);
+   texel[BCOMP] = _mesa_half_to_float(src[2]);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgb_f16(struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *depth = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   dst[0] = _mesa_float_to_half(*depth);
+}
+#endif
+
+
+/* MESA_FORMAT_ALPHA_F32 *****************************************************/
+
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
+                              GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = 0.0F;
+   texel[ACOMP] = src[0];
+}
+
+#if DIM == 3
+static void store_texel_alpha_f32(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   dst[0] = rgba[ACOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_ALPHA_F32 *****************************************************/
+
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
+                              GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = 0.0F;
+   texel[ACOMP] = _mesa_half_to_float(src[0]);
+}
+
+#if DIM == 3
+static void store_texel_alpha_f16(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   dst[0] = _mesa_float_to_half(rgba[ACOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_LUMINANCE_F32 *************************************************/
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
+                                    GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = src[0];
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_luminance_f32(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   dst[0] = rgba[RCOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_LUMINANCE_F16 *************************************************/
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
+                                    GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = _mesa_half_to_float(src[0]);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_luminance_f16(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
+                                    GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = src[0];
+   texel[ACOMP] = src[1];
+}
+
+#if DIM == 3
+static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
+   dst[0] = rgba[RCOMP];
+   dst[1] = rgba[ACOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/
+
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
+                                    GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = _mesa_half_to_float(src[0]);
+   texel[ACOMP] = _mesa_half_to_float(src[1]);
+}
+
+#if DIM == 3
+static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
+   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
+   dst[1] = _mesa_float_to_half(rgba[ACOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_INTENSITY_F32 *************************************************/
+
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
+                                    GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] =
+   texel[ACOMP] = src[0];
+}
+
+#if DIM == 3
+static void store_texel_intensity_f32(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   dst[0] = rgba[RCOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_INTENSITY_F16 *************************************************/
+
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
+ * returning 4 GLfloats.
+ */
+static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
+                                    GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] =
+   texel[ACOMP] = _mesa_half_to_float(src[0]);
+}
+
+#if DIM == 3
+static void store_texel_intensity_f16(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *rgba = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
+   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
+}
+#endif
+
+
+
+
+/*
+ * Begin Hardware formats
+ */
+
+/* MESA_FORMAT_RGBA8888 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
+static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+}
+
+
+
+#if DIM == 3
+static void store_texel_rgba8888(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_RGBA888_REV ***************************************************/
+
+/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
+static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+}
+
+#if DIM == 3
+static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_ARGB8888 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
+static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+}
+
+#if DIM == 3
+static void store_texel_argb8888(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_ARGB8888_REV **************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
+static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+}
+
+#if DIM == 3
+static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], rgba[ACOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_XRGB8888 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */
+static void FETCH(f_xrgb8888)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+   texel[ACOMP] = 1.0f;
+}
+
+#if DIM == 3
+static void store_texel_xrgb8888(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(0xff, rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_XRGB8888_REV **************************************************/
+
+/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
+static void FETCH(f_xrgb8888_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+   texel[ACOMP] = 1.0f;
+}
+
+#if DIM == 3
+static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
+                                     GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], 0xff);
+}
+#endif
+
+
+/* MESA_FORMAT_RGB888 ********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
+static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
+   texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
+   texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
+   texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgb888(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
+   dst[0] = rgba[BCOMP];
+   dst[1] = rgba[GCOMP];
+   dst[2] = rgba[RCOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_BGR888 ********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
+static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
+   texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
+   texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
+   texel[BCOMP] = UBYTE_TO_FLOAT( src[2] );
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_bgr888(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
+   dst[0] = rgba[RCOMP];
+   dst[1] = rgba[GCOMP];
+   dst[2] = rgba[BCOMP];
+}
+#endif
+
+
+/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding)
+   instead of slow (g << 2) * 255 / 252 (always rounds down) */
+
+/* MESA_FORMAT_RGB565 ********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
+static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   const GLushort s = *src;
+   texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
+   texel[GCOMP] = ((s >> 5 ) & 0x3f) * (1.0F / 63.0F);
+   texel[BCOMP] = ((s      ) & 0x1f) * (1.0F / 31.0F);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgb565(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_565(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_RGB565_REV ****************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
+static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
+   texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
+   texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 3) & 0xfc) | ((s >>  9) & 0x3) );
+   texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >>  2) & 0x7) );
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_565(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_ARGB4444 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
+static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   const GLushort s = *src;
+   texel[RCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
+   texel[GCOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
+   texel[BCOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
+   texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+}
+
+#if DIM == 3
+static void store_texel_argb4444(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_ARGB4444_REV **************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
+static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   texel[RCOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
+   texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+   texel[BCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
+   texel[ACOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
+}
+
+#if DIM == 3
+static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
+}
+#endif
+
+/* MESA_FORMAT_RGBA5551 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
+static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   const GLushort s = *src;
+   texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
+   texel[GCOMP] = ((s >>  6) & 0x1f) * (1.0F / 31.0F);
+   texel[BCOMP] = ((s >>  1) & 0x1f) * (1.0F / 31.0F);
+   texel[ACOMP] = ((s      ) & 0x01) * 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgba5551(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_5551(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+/* MESA_FORMAT_ARGB1555 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
+static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
+			     GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   const GLushort s = *src;
+   texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
+   texel[GCOMP] = ((s >>  5) & 0x1f) * (1.0F / 31.0F);
+   texel[BCOMP] = ((s >>  0) & 0x1f) * (1.0F / 31.0F);
+   texel[ACOMP] = ((s >> 15) & 0x01) * 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_argb1555(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_1555(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_ARGB1555_REV **************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
+static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
+   texel[RCOMP] = UBYTE_TO_FLOAT( ((s >>  7) & 0xf8) | ((s >> 12) & 0x7) );
+   texel[GCOMP] = UBYTE_TO_FLOAT( ((s >>  2) & 0xf8) | ((s >>  7) & 0x7) );
+   texel[BCOMP] = UBYTE_TO_FLOAT( ((s <<  3) & 0xf8) | ((s >>  2) & 0x7) );
+   texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
+}
+
+#if DIM == 3
+static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_AL88 **********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
+static void FETCH(f_al88)( const struct gl_texture_image *texImage,
+                           GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   texel[RCOMP] = 
+   texel[GCOMP] = 
+   texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
+}
+
+#if DIM == 3
+static void store_texel_al88(struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_AL88_REV ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
+static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   texel[RCOMP] = 
+   texel[GCOMP] = 
+   texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+   texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
+}
+
+#if DIM == 3
+static void store_texel_al88_rev(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_AL1616 ********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
+static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
+			     GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = USHORT_TO_FLOAT( s & 0xffff );
+   texel[ACOMP] = USHORT_TO_FLOAT( s >> 16 );
+}
+
+#if DIM == 3
+static void store_texel_al1616(struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLushort *rgba = (const GLushort *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_1616(rgba[ACOMP], rgba[RCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_AL1616_REV ****************************************************/
+
+/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */
+static void FETCH(f_al1616_rev)( const struct gl_texture_image *texImage,
+				 GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = USHORT_TO_FLOAT( s >> 16 );
+   texel[ACOMP] = USHORT_TO_FLOAT( s & 0xffff );
+}
+
+#if DIM == 3
+static void store_texel_al1616_rev(struct gl_texture_image *texImage,
+				   GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLushort *rgba = (const GLushort *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[ACOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_RGB332 ********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
+static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   const GLubyte s = *src;
+   texel[RCOMP] = ((s >> 5) & 0x7) * (1.0F / 7.0F);
+   texel[GCOMP] = ((s >> 2) & 0x7) * (1.0F / 7.0F);
+   texel[BCOMP] = ((s     ) & 0x3) * (1.0F / 3.0F);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_rgb332(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_332(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_A8 ************************************************************/
+
+/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
+static void FETCH(f_a8)( const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = 0.0F;
+   texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+}
+
+#if DIM == 3
+static void store_texel_a8(struct gl_texture_image *texImage,
+                           GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   *dst = rgba[ACOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_L8 ************************************************************/
+
+/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
+static void FETCH(f_l8)( const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_l8(struct gl_texture_image *texImage,
+                           GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   *dst = rgba[RCOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_I8 ************************************************************/
+
+/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
+static void FETCH(f_i8)( const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] =
+   texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+}
+
+#if DIM == 3
+static void store_texel_i8(struct gl_texture_image *texImage,
+                           GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   *dst = rgba[RCOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_CI8 ***********************************************************/
+
+/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
+ * color table, and return 4 GLchans.
+ */
+static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   const struct gl_color_table *palette;
+   GLuint index;
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (ctx->Texture.SharedPalette) {
+      palette = &ctx->Texture.Palette;
+   }
+   else {
+      palette = &texImage->TexObject->Palette;
+   }
+   if (palette->Size == 0)
+      return; /* undefined results */
+
+   /* Mask the index against size of palette to avoid going out of bounds */
+   index = (*src) & (palette->Size - 1);
+
+   {
+      const GLfloat *table = palette->TableF;
+      switch (palette->_BaseFormat) {
+      case GL_ALPHA:
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] = 0.0F;
+         texel[ACOMP] = table[index];
+         break;
+      case GL_LUMINANCE:
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] = table[index];
+         texel[ACOMP] = 1.0F;
+         break;
+      case GL_INTENSITY:
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] =
+         texel[ACOMP] = table[index];
+         break;
+      case GL_LUMINANCE_ALPHA:
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] = table[index * 2 + 0];
+         texel[ACOMP] = table[index * 2 + 1];
+         break;
+      case GL_RGB:
+         texel[RCOMP] = table[index * 3 + 0];
+         texel[GCOMP] = table[index * 3 + 1];
+         texel[BCOMP] = table[index * 3 + 2];
+         texel[ACOMP] = 1.0F;
+         break;
+      case GL_RGBA:
+         texel[RCOMP] = table[index * 4 + 0];
+         texel[GCOMP] = table[index * 4 + 1];
+         texel[BCOMP] = table[index * 4 + 2];
+         texel[ACOMP] = table[index * 4 + 3];
+         break;
+      default:
+         _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8");
+         return;
+      }
+   }
+}
+
+#if DIM == 3
+static void store_texel_ci8(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *index = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   *dst = *index;
+}
+#endif
+
+
+/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
+/* Note: component order is same as for MESA_FORMAT_RGB888 */
+static void FETCH(srgb8)(const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
+   texel[RCOMP] = nonlinear_to_linear(src[2]);
+   texel[GCOMP] = nonlinear_to_linear(src[1]);
+   texel[BCOMP] = nonlinear_to_linear(src[0]);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_srgb8(struct gl_texture_image *texImage,
+                              GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
+   dst[0] = rgba[BCOMP]; /* no conversion */
+   dst[1] = rgba[GCOMP];
+   dst[2] = rgba[RCOMP];
+}
+#endif
+
+/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */
+static void FETCH(srgba8)(const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = nonlinear_to_linear( (s >> 24) );
+   texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
+   texel[BCOMP] = nonlinear_to_linear( (s >>  8) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff ); /* linear! */
+}
+
+#if DIM == 3
+static void store_texel_srgba8(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
+static void FETCH(sargb8)(const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
+   texel[GCOMP] = nonlinear_to_linear( (s >>  8) & 0xff );
+   texel[BCOMP] = nonlinear_to_linear( (s      ) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */
+}
+
+#if DIM == 3
+static void store_texel_sargb8(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */
+static void FETCH(sl8)(const struct gl_texture_image *texImage,
+                       GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   texel[RCOMP] = 
+   texel[GCOMP] = 
+   texel[BCOMP] = nonlinear_to_linear(src[0]);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_sl8(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   dst[0] = rgba[RCOMP];
+}
+#endif
+
+/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */
+static void FETCH(sla8)(const struct gl_texture_image *texImage,
+                       GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = nonlinear_to_linear(src[0]);
+   texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */
+}
+
+#if DIM == 3
+static void store_texel_sla8(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
+   dst[0] = rgba[RCOMP];
+   dst[1] = rgba[ACOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_DUDV8 ********************************************************/
+
+/* this format by definition produces 0,0,0,1 as rgba values,
+   however we'll return the dudv values as rg and fix up elsewhere */
+static void FETCH(dudv8)(const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
+   texel[RCOMP] = BYTE_TO_FLOAT(src[0]);
+   texel[GCOMP] = BYTE_TO_FLOAT(src[1]);
+   texel[BCOMP] = 0;
+   texel[ACOMP] = 0;
+}
+
+/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/
+
+static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
+			            GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s >> 24)        );
+   texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
+   texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >>  8) & 0xff );
+   texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s      ) & 0xff );
+}
+
+#if DIM == 3
+static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
+                                        GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLbyte *rgba = (const GLbyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
+                                        GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s      ) & 0xff );
+   texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >>  8) & 0xff );
+   texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
+   texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24)        );
+}
+
+#if DIM == 3
+static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
+                                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+
+
+/* MESA_FORMAT_YCBCR *********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats.
+ * We convert YCbCr to RGB here.
+ */
+static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
+   const GLushort *src1 = src0 + 1;                               /* odd */
+   const GLubyte y0 = (*src0 >> 8) & 0xff;  /* luminance */
+   const GLubyte cb = *src0 & 0xff;         /* chroma U */
+   const GLubyte y1 = (*src1 >> 8) & 0xff;  /* luminance */
+   const GLubyte cr = *src1 & 0xff;         /* chroma V */
+   const GLubyte y = (i & 1) ? y1 : y0;     /* choose even/odd luminance */
+   GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
+   GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
+   GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
+   r *= (1.0F / 255.0F);
+   g *= (1.0F / 255.0F);
+   b *= (1.0F / 255.0F);
+   texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
+   texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
+   texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_ycbcr(struct gl_texture_image *texImage,
+                              GLint i, GLint j, GLint k, const void *texel)
+{
+   (void) texImage;
+   (void) i;
+   (void) j;
+   (void) k;
+   (void) texel;
+   /* XXX to do */
+}
+#endif
+
+
+/* MESA_FORMAT_YCBCR_REV *****************************************************/
+
+/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats.
+ * We convert YCbCr to RGB here.
+ */
+static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
+   const GLushort *src1 = src0 + 1;                               /* odd */
+   const GLubyte y0 = *src0 & 0xff;         /* luminance */
+   const GLubyte cr = (*src0 >> 8) & 0xff;  /* chroma V */
+   const GLubyte y1 = *src1 & 0xff;         /* luminance */
+   const GLubyte cb = (*src1 >> 8) & 0xff;  /* chroma U */
+   const GLubyte y = (i & 1) ? y1 : y0;     /* choose even/odd luminance */
+   GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
+   GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
+   GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
+   r *= (1.0F / 255.0F);
+   g *= (1.0F / 255.0F);
+   b *= (1.0F / 255.0F);
+   texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
+   texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
+   texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, const void *texel)
+{
+   (void) texImage;
+   (void) i;
+   (void) j;
+   (void) k;
+   (void) texel;
+   /* XXX to do */
+}
+#endif
+
+
+/* MESA_TEXFORMAT_Z24_S8 ***************************************************/
+
+static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   /* only return Z, not stencil data */
+   const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
+   texel[0] = ((*src) >> 8) * scale;
+   ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8);
+   ASSERT(texel[0] >= 0.0F);
+   ASSERT(texel[0] <= 1.0F);
+}
+
+#if DIM == 3
+static void store_texel_z24_s8(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   /* only store Z, not stencil */
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   GLfloat depth = *((GLfloat *) texel);
+   GLuint zi = ((GLuint) (depth * 0xffffff)) << 8;
+   *dst = zi | (*dst & 0xff);
+}
+#endif
+
+
+/* MESA_TEXFORMAT_S8_Z24 ***************************************************/
+
+static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   /* only return Z, not stencil data */
+   const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
+   texel[0] = ((*src) & 0x00ffffff) * scale;
+   ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24);
+   ASSERT(texel[0] >= 0.0F);
+   ASSERT(texel[0] <= 1.0F);
+}
+
+#if DIM == 3
+static void store_texel_s8_z24(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   /* only store Z, not stencil */
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   GLfloat depth = *((GLfloat *) texel);
+   GLuint zi = (GLuint) (depth * 0xffffff);
+   *dst = zi | (*dst & 0xff000000);
+}
+#endif
+
+
+#undef TEXEL_ADDR
+#undef DIM
+#undef FETCH
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 9d5534e39..1a374e7be 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -1,9 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  7.7
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008-2009 VMware, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -29,1435 +29,15 @@
  * Texture formats.
  *
  * \author Gareth Hughes
+ * \author Brian Paul
  */
 
 
-#include "colormac.h"
 #include "context.h"
+#include "texcompress.h"
+#include "texcompress_fxt1.h"
+#include "texcompress_s3tc.h"
 #include "texformat.h"
-#include "texstore.h"
-
-
-#if FEATURE_EXT_texture_sRGB
-
-/**
- * Convert an 8-bit sRGB value from non-linear space to a
- * linear RGB value in [0, 1].
- * Implemented with a 256-entry lookup table.
- */
-static INLINE GLfloat
-nonlinear_to_linear(GLubyte cs8)
-{
-   static GLfloat table[256];
-   static GLboolean tableReady = GL_FALSE;
-   if (!tableReady) {
-      /* compute lookup table now */
-      GLuint i;
-      for (i = 0; i < 256; i++) {
-         const GLfloat cs = UBYTE_TO_FLOAT(i);
-         if (cs <= 0.04045) {
-            table[i] = cs / 12.92f;
-         }
-         else {
-            table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4);
-         }
-      }
-      tableReady = GL_TRUE;
-   }
-   return table[cs8];
-}
-
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
-/* Texel fetch routines for all supported formats
- */
-#define DIM 1
-#include "texformat_tmp.h"
-
-#define DIM 2
-#include "texformat_tmp.h"
-
-#define DIM 3
-#include "texformat_tmp.h"
-
-/**
- * Null texel fetch function.
- *
- * Have to have this so the FetchTexel function pointer is never NULL.
- */
-static void fetch_null_texel( const struct gl_texture_image *texImage,
-			      GLint i, GLint j, GLint k, GLchan *texel )
-{
-   (void) texImage; (void) i; (void) j; (void) k;
-   texel[RCOMP] = 0;
-   texel[GCOMP] = 0;
-   texel[BCOMP] = 0;
-   texel[ACOMP] = 0;
-   _mesa_warning(NULL, "fetch_null_texel() called!");
-}
-
-static void fetch_null_texelf( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   (void) texImage; (void) i; (void) j; (void) k;
-   texel[RCOMP] = 0.0;
-   texel[GCOMP] = 0.0;
-   texel[BCOMP] = 0.0;
-   texel[ACOMP] = 0.0;
-   _mesa_warning(NULL, "fetch_null_texelf() called!");
-}
-
-static void store_null_texel(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   (void) texImage;
-   (void) i;
-   (void) j;
-   (void) k;
-   (void) texel;
-   /* no-op */
-}
-
-
-/**
- * Notes about the predefined gl_texture_formats:
- *
- * 1. There are 1D, 2D and 3D functions for fetching texels from texture
- *    images, returning both GLchan values and GLfloat values.  (six
- *    functions in total)
- *    You don't have to provide both the GLchan and GLfloat functions;
- *    just one or the other is OK.  Mesa will use an "adaptor" to convert
- *    between GLchan/GLfloat when needed.
- *    Since the adaptors have small performance penalty, we provide both
- *    GLchan and GLfloat functions for some common formats like RGB, RGBA.
- */
-
-
-/***************************************************************/
-/** \name Default GLchan-based formats */
-/*@{*/
-
-const struct gl_texture_format _mesa_texformat_rgba = {
-   MESA_FORMAT_RGBA,			/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   CHAN_BITS,				/* RedBits */
-   CHAN_BITS,				/* GreenBits */
-   CHAN_BITS,				/* BlueBits */
-   CHAN_BITS,				/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4 * sizeof(GLchan),			/* TexelBytes */
-   _mesa_texstore_rgba,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgba,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgba,		/* FetchTexel3Df */
-   store_texel_rgba			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb = {
-   MESA_FORMAT_RGB,			/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   CHAN_BITS,				/* RedBits */
-   CHAN_BITS,				/* GreenBits */
-   CHAN_BITS,				/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   3 * sizeof(GLchan),			/* TexelBytes */
-   _mesa_texstore_rgba,/*yes*/		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgb,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgb,		/* FetchTexel3Df */
-   store_texel_rgb			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_alpha = {
-   MESA_FORMAT_ALPHA,			/* MesaFormat */
-   GL_ALPHA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   CHAN_BITS,				/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   sizeof(GLchan),			/* TexelBytes */
-   _mesa_texstore_rgba,/*yes*/		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_alpha,		/* FetchTexel1Df */
-   fetch_texel_2d_f_alpha,		/* FetchTexel2Df */
-   fetch_texel_3d_f_alpha,		/* FetchTexel3Df */
-   store_texel_alpha			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_luminance = {
-   MESA_FORMAT_LUMINANCE,		/* MesaFormat */
-   GL_LUMINANCE,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   CHAN_BITS,				/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   sizeof(GLchan),			/* TexelBytes */
-   _mesa_texstore_rgba,/*yes*/		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_luminance,		/* FetchTexel1Df */
-   fetch_texel_2d_f_luminance,		/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance,		/* FetchTexel3Df */
-   store_texel_luminance		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_luminance_alpha = {
-   MESA_FORMAT_LUMINANCE_ALPHA,		/* MesaFormat */
-   GL_LUMINANCE_ALPHA,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   CHAN_BITS,				/* AlphaBits */
-   CHAN_BITS,				/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2 * sizeof(GLchan),			/* TexelBytes */
-   _mesa_texstore_rgba,/*yes*/		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_luminance_alpha,	/* FetchTexel1Df */
-   fetch_texel_2d_f_luminance_alpha,	/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_alpha,	/* FetchTexel3Df */
-   store_texel_luminance_alpha		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_intensity = {
-   MESA_FORMAT_INTENSITY,		/* MesaFormat */
-   GL_INTENSITY,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   CHAN_BITS,				/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   sizeof(GLchan),			/* TexelBytes */
-   _mesa_texstore_rgba,/*yes*/		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_intensity,		/* FetchTexel1Df */
-   fetch_texel_2d_f_intensity,		/* FetchTexel2Df */
-   fetch_texel_3d_f_intensity,		/* FetchTexel3Df */
-   store_texel_intensity		/* StoreTexel */
-};
-
-
-#if FEATURE_EXT_texture_sRGB
-
-const struct gl_texture_format _mesa_texformat_srgb8 = {
-   MESA_FORMAT_SRGB8,			/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   3,					/* TexelBytes */
-   _mesa_texstore_srgb8,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_srgb8,		/* FetchTexel1Df */
-   fetch_texel_2d_srgb8,		/* FetchTexel2Df */
-   fetch_texel_3d_srgb8,		/* FetchTexel3Df */
-   store_texel_srgb8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_srgba8 = {
-   MESA_FORMAT_SRGBA8,			/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_srgba8,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_srgba8,		/* FetchTexel1Df */
-   fetch_texel_2d_srgba8,		/* FetchTexel2Df */
-   fetch_texel_3d_srgba8,		/* FetchTexel3Df */
-   store_texel_srgba8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_sargb8 = {
-   MESA_FORMAT_SARGB8,			/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_sargb8,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_sargb8,		/* FetchTexel1Df */
-   fetch_texel_2d_sargb8,		/* FetchTexel2Df */
-   fetch_texel_3d_sargb8,		/* FetchTexel3Df */
-   store_texel_sargb8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_sl8 = {
-   MESA_FORMAT_SL8,			/* MesaFormat */
-   GL_LUMINANCE,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   8,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1,					/* TexelBytes */
-   _mesa_texstore_sl8,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_sl8,			/* FetchTexel1Df */
-   fetch_texel_2d_sl8,			/* FetchTexel2Df */
-   fetch_texel_3d_sl8,			/* FetchTexel3Df */
-   store_texel_sl8			/* StoreTexel */
-};
-
-/* Note: this format name looks like a misnomer, make it sal8? */
-const struct gl_texture_format _mesa_texformat_sla8 = {
-   MESA_FORMAT_SLA8,			/* MesaFormat */
-   GL_LUMINANCE_ALPHA,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8,					/* AlphaBits */
-   8,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_sla8,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_sla8,			/* FetchTexel1Df */
-   fetch_texel_2d_sla8,			/* FetchTexel2Df */
-   fetch_texel_3d_sla8,			/* FetchTexel3Df */
-   store_texel_sla8			/* StoreTexel */
-};
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-const struct gl_texture_format _mesa_texformat_rgba_float32 = {
-   MESA_FORMAT_RGBA_FLOAT32,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   8 * sizeof(GLfloat),			/* RedBits */
-   8 * sizeof(GLfloat),			/* GreenBits */
-   8 * sizeof(GLfloat),			/* BlueBits */
-   8 * sizeof(GLfloat),			/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4 * sizeof(GLfloat),			/* TexelBytes */
-   _mesa_texstore_rgba_float32,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_rgba_f32,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_f32,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgba_f32,		/* FetchTexel3Df */
-   store_texel_rgba_f32			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_float16 = {
-   MESA_FORMAT_RGBA_FLOAT16,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   8 * sizeof(GLhalfARB),		/* RedBits */
-   8 * sizeof(GLhalfARB),		/* GreenBits */
-   8 * sizeof(GLhalfARB),		/* BlueBits */
-   8 * sizeof(GLhalfARB),		/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4 * sizeof(GLhalfARB),		/* TexelBytes */
-   _mesa_texstore_rgba_float16,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_rgba_f16,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_f16,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgba_f16,		/* FetchTexel3Df */
-   store_texel_rgba_f16			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb_float32 = {
-   MESA_FORMAT_RGB_FLOAT32,		/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   8 * sizeof(GLfloat),			/* RedBits */
-   8 * sizeof(GLfloat),			/* GreenBits */
-   8 * sizeof(GLfloat),			/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   3 * sizeof(GLfloat),			/* TexelBytes */
-   _mesa_texstore_rgba_float32,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_rgb_f32,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb_f32,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgb_f32,		/* FetchTexel3Df */
-   store_texel_rgb_f32			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb_float16 = {
-   MESA_FORMAT_RGB_FLOAT16,		/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   8 * sizeof(GLhalfARB),		/* RedBits */
-   8 * sizeof(GLhalfARB),		/* GreenBits */
-   8 * sizeof(GLhalfARB),		/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   3 * sizeof(GLhalfARB),		/* TexelBytes */
-   _mesa_texstore_rgba_float16,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_rgb_f16,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb_f16,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgb_f16,		/* FetchTexel3Df */
-   store_texel_rgb_f16			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_alpha_float32 = {
-   MESA_FORMAT_ALPHA_FLOAT32,		/* MesaFormat */
-   GL_ALPHA,				/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8 * sizeof(GLfloat),			/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1 * sizeof(GLfloat),			/* TexelBytes */
-   _mesa_texstore_rgba_float32,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_alpha_f32,		/* FetchTexel1Df */
-   fetch_texel_2d_f_alpha_f32,		/* FetchTexel2Df */
-   fetch_texel_3d_f_alpha_f32,		/* FetchTexel3Df */
-   store_texel_alpha_f32		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_alpha_float16 = {
-   MESA_FORMAT_ALPHA_FLOAT16,		/* MesaFormat */
-   GL_ALPHA,				/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8 * sizeof(GLhalfARB),		/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1 * sizeof(GLhalfARB),		/* TexelBytes */
-   _mesa_texstore_rgba_float16,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_alpha_f16,		/* FetchTexel1Df */
-   fetch_texel_2d_f_alpha_f16,		/* FetchTexel2Df */
-   fetch_texel_3d_f_alpha_f16,		/* FetchTexel3Df */
-   store_texel_alpha_f16		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_luminance_float32 = {
-   MESA_FORMAT_LUMINANCE_FLOAT32,	/* MesaFormat */
-   GL_LUMINANCE,			/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   8 * sizeof(GLfloat),			/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1 * sizeof(GLfloat),			/* TexelBytes */
-   _mesa_texstore_rgba_float32,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_luminance_f32,	/* FetchTexel1Df */
-   fetch_texel_2d_f_luminance_f32,	/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_f32,	/* FetchTexel3Df */
-   store_texel_luminance_f32		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_luminance_float16 = {
-   MESA_FORMAT_LUMINANCE_FLOAT16,	/* MesaFormat */
-   GL_LUMINANCE,			/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   8 * sizeof(GLhalfARB),		/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1 * sizeof(GLhalfARB),		/* TexelBytes */
-   _mesa_texstore_rgba_float16,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_luminance_f16,	/* FetchTexel1Df */
-   fetch_texel_2d_f_luminance_f16,	/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_f16,	/* FetchTexel3Df */
-   store_texel_luminance_f16		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = {
-   MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,	/* MesaFormat */
-   GL_LUMINANCE_ALPHA,			/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8 * sizeof(GLfloat),			/* AlphaBits */
-   8 * sizeof(GLfloat),			/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2 * sizeof(GLfloat),			/* TexelBytes */
-   _mesa_texstore_rgba_float32,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */
-   fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */
-   store_texel_luminance_alpha_f32	/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = {
-   MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,	/* MesaFormat */
-   GL_LUMINANCE_ALPHA,			/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8 * sizeof(GLhalfARB),		/* AlphaBits */
-   8 * sizeof(GLhalfARB),		/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2 * sizeof(GLhalfARB),		/* TexelBytes */
-   _mesa_texstore_rgba_float16,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */
-   fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */
-   store_texel_luminance_alpha_f16	/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_intensity_float32 = {
-   MESA_FORMAT_INTENSITY_FLOAT32,	/* MesaFormat */
-   GL_INTENSITY,			/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   8 * sizeof(GLfloat),			/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1 * sizeof(GLfloat),			/* TexelBytes */
-   _mesa_texstore_rgba_float32,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_intensity_f32,	/* FetchTexel1Df */
-   fetch_texel_2d_f_intensity_f32,	/* FetchTexel2Df */
-   fetch_texel_3d_f_intensity_f32,	/* FetchTexel3Df */
-   store_texel_intensity_f32		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_intensity_float16 = {
-   MESA_FORMAT_INTENSITY_FLOAT16,	/* MesaFormat */
-   GL_INTENSITY,			/* BaseFormat */
-   GL_FLOAT,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   8 * sizeof(GLhalfARB),		/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1 * sizeof(GLhalfARB),		/* TexelBytes */
-   _mesa_texstore_rgba_float16,/*yes*/	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_intensity_f16,	/* FetchTexel1Df */
-   fetch_texel_2d_f_intensity_f16,	/* FetchTexel2Df */
-   fetch_texel_3d_f_intensity_f16,	/* FetchTexel3Df */
-   store_texel_intensity_f16		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_dudv8 = {
-   MESA_FORMAT_DUDV8,			/* MesaFormat */
-   GL_DUDV_ATI,				/* BaseFormat */
-   GL_SIGNED_NORMALIZED,		/* DataType */
-   /* maybe should add dudvBits field, but spec seems to be
-      lacking the ability to query with GetTexLevelParameter anyway */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_dudv8,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_dudv8,		/* FetchTexel1Df */
-   fetch_texel_2d_dudv8,		/* FetchTexel2Df */
-   fetch_texel_3d_dudv8,		/* FetchTexel3Df */
-   NULL					/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_signed_rgba8888 = {
-   MESA_FORMAT_SIGNED_RGBA8888,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_SIGNED_NORMALIZED,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_signed_rgba8888,	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_signed_rgba8888,	/* FetchTexel1Df */
-   fetch_texel_2d_signed_rgba8888,	/* FetchTexel2Df */
-   fetch_texel_3d_signed_rgba8888,	/* FetchTexel3Df */
-   store_texel_signed_rgba8888		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = {
-   MESA_FORMAT_SIGNED_RGBA8888_REV,	/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_SIGNED_NORMALIZED,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_signed_rgba8888,	/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_signed_rgba8888_rev,	/* FetchTexel1Df */
-   fetch_texel_2d_signed_rgba8888_rev,	/* FetchTexel2Df */
-   fetch_texel_3d_signed_rgba8888_rev,	/* FetchTexel3Df */
-   store_texel_signed_rgba8888_rev		/* StoreTexel */
-};
-
-/*@}*/
-
-
-/***************************************************************/
-/** \name Hardware formats */
-/*@{*/
-
-const struct gl_texture_format _mesa_texformat_rgba8888 = {
-   MESA_FORMAT_RGBA8888,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_rgba8888,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgba8888,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba8888,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgba8888,		/* FetchTexel3Df */
-   store_texel_rgba8888			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba8888_rev = {
-   MESA_FORMAT_RGBA8888_REV,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_rgba8888,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgba8888_rev,	/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba8888_rev,	/* FetchTexel2Df */
-   fetch_texel_3d_f_rgba8888_rev,	/* FetchTexel3Df */
-   store_texel_rgba8888_rev		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_argb8888 = {
-   MESA_FORMAT_ARGB8888,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_argb8888,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_argb8888,		/* FetchTexel1Df */
-   fetch_texel_2d_f_argb8888,		/* FetchTexel2Df */
-   fetch_texel_3d_f_argb8888,		/* FetchTexel3Df */
-   store_texel_argb8888			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_argb8888_rev = {
-   MESA_FORMAT_ARGB8888_REV,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_argb8888,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_argb8888_rev,	/* FetchTexel1Df */
-   fetch_texel_2d_f_argb8888_rev,	/* FetchTexel2Df */
-   fetch_texel_3d_f_argb8888_rev,	/* FetchTexel3Df */
-   store_texel_argb8888_rev		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb888 = {
-   MESA_FORMAT_RGB888,			/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   3,					/* TexelBytes */
-   _mesa_texstore_rgb888,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgb888,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb888,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgb888,		/* FetchTexel3Df */
-   store_texel_rgb888			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_bgr888 = {
-   MESA_FORMAT_BGR888,			/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   8,					/* RedBits */
-   8,					/* GreenBits */
-   8,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   3,					/* TexelBytes */
-   _mesa_texstore_bgr888,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_bgr888,		/* FetchTexel1Df */
-   fetch_texel_2d_f_bgr888,		/* FetchTexel2Df */
-   fetch_texel_3d_f_bgr888,		/* FetchTexel3Df */
-   store_texel_bgr888			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb565 = {
-   MESA_FORMAT_RGB565,			/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   5,					/* RedBits */
-   6,					/* GreenBits */
-   5,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_rgb565,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgb565,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb565,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgb565,		/* FetchTexel3Df */
-   store_texel_rgb565			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb565_rev = {
-   MESA_FORMAT_RGB565_REV,		/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   5,					/* RedBits */
-   6,					/* GreenBits */
-   5,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_rgb565,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgb565_rev,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb565_rev,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgb565_rev,		/* FetchTexel3Df */
-   store_texel_rgb565_rev		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba4444 = {
-   MESA_FORMAT_RGBA4444,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4,					/* RedBits */
-   4,					/* GreenBits */
-   4,					/* BlueBits */
-   4,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_rgba4444,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgba4444,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba4444,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgba4444,		/* FetchTexel3Df */
-   store_texel_rgba4444			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_argb4444 = {
-   MESA_FORMAT_ARGB4444,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4,					/* RedBits */
-   4,					/* GreenBits */
-   4,					/* BlueBits */
-   4,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_argb4444,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_argb4444,		/* FetchTexel1Df */
-   fetch_texel_2d_f_argb4444,		/* FetchTexel2Df */
-   fetch_texel_3d_f_argb4444,		/* FetchTexel3Df */
-   store_texel_argb4444			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_argb4444_rev = {
-   MESA_FORMAT_ARGB4444_REV,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   4,					/* RedBits */
-   4,					/* GreenBits */
-   4,					/* BlueBits */
-   4,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_argb4444,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_argb4444_rev,	/* FetchTexel1Df */
-   fetch_texel_2d_f_argb4444_rev,	/* FetchTexel2Df */
-   fetch_texel_3d_f_argb4444_rev,	/* FetchTexel3Df */
-   store_texel_argb4444_rev		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba5551 = {
-   MESA_FORMAT_RGBA5551,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   5,					/* RedBits */
-   5,					/* GreenBits */
-   5,					/* BlueBits */
-   1,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_rgba5551,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgba5551,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgba5551,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgba5551,		/* FetchTexel3Df */
-   store_texel_rgba5551			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_argb1555 = {
-   MESA_FORMAT_ARGB1555,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   5,					/* RedBits */
-   5,					/* GreenBits */
-   5,					/* BlueBits */
-   1,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_argb1555,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_argb1555,		/* FetchTexel1Df */
-   fetch_texel_2d_f_argb1555,		/* FetchTexel2Df */
-   fetch_texel_3d_f_argb1555,		/* FetchTexel3Df */
-   store_texel_argb1555			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_argb1555_rev = {
-   MESA_FORMAT_ARGB1555_REV,		/* MesaFormat */
-   GL_RGBA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   5,					/* RedBits */
-   5,					/* GreenBits */
-   5,					/* BlueBits */
-   1,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_argb1555,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_argb1555_rev,	/* FetchTexel1Df */
-   fetch_texel_2d_f_argb1555_rev,	/* FetchTexel2Df */
-   fetch_texel_3d_f_argb1555_rev,	/* FetchTexel3Df */
-   store_texel_argb1555_rev		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_al88 = {
-   MESA_FORMAT_AL88,			/* MesaFormat */
-   GL_LUMINANCE_ALPHA,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8,					/* AlphaBits */
-   8,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_al88,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_al88,		/* FetchTexel1Df */
-   fetch_texel_2d_f_al88,		/* FetchTexel2Df */
-   fetch_texel_3d_f_al88,		/* FetchTexel3Df */
-   store_texel_al88			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_al88_rev = {
-   MESA_FORMAT_AL88_REV,		/* MesaFormat */
-   GL_LUMINANCE_ALPHA,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8,					/* AlphaBits */
-   8,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_al88,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_al88_rev,		/* FetchTexel1Df */
-   fetch_texel_2d_f_al88_rev,		/* FetchTexel2Df */
-   fetch_texel_3d_f_al88_rev,		/* FetchTexel3Df */
-   store_texel_al88_rev			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb332 = {
-   MESA_FORMAT_RGB332,			/* MesaFormat */
-   GL_RGB,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   3,					/* RedBits */
-   3,					/* GreenBits */
-   2,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1,					/* TexelBytes */
-   _mesa_texstore_rgb332,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_rgb332,		/* FetchTexel1Df */
-   fetch_texel_2d_f_rgb332,		/* FetchTexel2Df */
-   fetch_texel_3d_f_rgb332,		/* FetchTexel3Df */
-   store_texel_rgb332			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_a8 = {
-   MESA_FORMAT_A8,			/* MesaFormat */
-   GL_ALPHA,				/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   8,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1,					/* TexelBytes */
-   _mesa_texstore_a8,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_a8,			/* FetchTexel1Df */
-   fetch_texel_2d_f_a8,			/* FetchTexel2Df */
-   fetch_texel_3d_f_a8,			/* FetchTexel3Df */
-   store_texel_a8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_l8 = {
-   MESA_FORMAT_L8,			/* MesaFormat */
-   GL_LUMINANCE,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   8,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1,					/* TexelBytes */
-   _mesa_texstore_a8,/*yes*/		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_l8,			/* FetchTexel1Df */
-   fetch_texel_2d_f_l8,			/* FetchTexel2Df */
-   fetch_texel_3d_f_l8,			/* FetchTexel3Df */
-   store_texel_l8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_i8 = {
-   MESA_FORMAT_I8,			/* MesaFormat */
-   GL_INTENSITY,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   8,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1,					/* TexelBytes */
-   _mesa_texstore_a8,/*yes*/		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_i8,			/* FetchTexel1Df */
-   fetch_texel_2d_f_i8,			/* FetchTexel2Df */
-   fetch_texel_3d_f_i8,			/* FetchTexel3Df */
-   store_texel_i8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_ci8 = {
-   MESA_FORMAT_CI8,			/* MesaFormat */
-   GL_COLOR_INDEX,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   8,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   1,					/* TexelBytes */
-   _mesa_texstore_ci8,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_ci8,		/* FetchTexel1Df */
-   fetch_texel_2d_f_ci8,		/* FetchTexel2Df */
-   fetch_texel_3d_f_ci8,		/* FetchTexel3Df */
-   store_texel_ci8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_ycbcr = {
-   MESA_FORMAT_YCBCR,			/* MesaFormat */
-   GL_YCBCR_MESA,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_ycbcr,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_ycbcr,		/* FetchTexel1Df */
-   fetch_texel_2d_f_ycbcr,		/* FetchTexel2Df */
-   fetch_texel_3d_f_ycbcr,		/* FetchTexel3Df */
-   store_texel_ycbcr			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
-   MESA_FORMAT_YCBCR_REV,		/* MesaFormat */
-   GL_YCBCR_MESA,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   2,					/* TexelBytes */
-   _mesa_texstore_ycbcr,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_ycbcr_rev,		/* FetchTexel1Df */
-   fetch_texel_2d_f_ycbcr_rev,		/* FetchTexel2Df */
-   fetch_texel_3d_f_ycbcr_rev,		/* FetchTexel3Df */
-   store_texel_ycbcr_rev		/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_z24_s8 = {
-   MESA_FORMAT_Z24_S8,			/* MesaFormat */
-   GL_DEPTH_STENCIL_EXT,		/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   24,					/* DepthBits */
-   8,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_z24_s8,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_z24_s8,		/* FetchTexel1Df */
-   fetch_texel_2d_f_z24_s8,		/* FetchTexel2Df */
-   fetch_texel_3d_f_z24_s8,		/* FetchTexel3Df */
-   store_texel_z24_s8			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_s8_z24 = {
-   MESA_FORMAT_S8_Z24,			/* MesaFormat */
-   GL_DEPTH_STENCIL_EXT,		/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   24,					/* DepthBits */
-   8,					/* StencilBits */
-   4,					/* TexelBytes */
-   _mesa_texstore_s8_z24,		/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel2D */
-   NULL,				/* FetchTexel3D */
-   fetch_texel_1d_f_s8_z24,		/* FetchTexel1Df */
-   fetch_texel_2d_f_s8_z24,		/* FetchTexel2Df */
-   fetch_texel_3d_f_s8_z24,		/* FetchTexel3Df */
-   store_texel_s8_z24			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_z16 = {
-   MESA_FORMAT_Z16,			/* MesaFormat */
-   GL_DEPTH_COMPONENT,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   sizeof(GLushort) * 8,		/* DepthBits */
-   0,					/* StencilBits */
-   sizeof(GLushort),			/* TexelBytes */
-   _mesa_texstore_z16,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_z16,		/* FetchTexel1Df */
-   fetch_texel_2d_f_z16,		/* FetchTexel2Df */
-   fetch_texel_3d_f_z16,		/* FetchTexel3Df */
-   store_texel_z16			/* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_z32 = {
-   MESA_FORMAT_Z32,			/* MesaFormat */
-   GL_DEPTH_COMPONENT,			/* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   sizeof(GLuint) * 8,			/* DepthBits */
-   0,					/* StencilBits */
-   sizeof(GLuint),			/* TexelBytes */
-   _mesa_texstore_z32,			/* StoreTexImageFunc */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   NULL,				/* FetchTexel1D */
-   fetch_texel_1d_f_z32,		/* FetchTexel1Df */
-   fetch_texel_2d_f_z32,		/* FetchTexel2Df */
-   fetch_texel_3d_f_z32,		/* FetchTexel3Df */
-   store_texel_z32			/* StoreTexel */
-};
-
-/*@}*/
-
-
-/***************************************************************/
-/** \name Null format (useful for proxy textures) */
-/*@{*/
-
-const struct gl_texture_format _mesa_null_texformat = {
-   -1,					/* MesaFormat */
-   0,					/* BaseFormat */
-   GL_NONE,				/* DataType */
-   0,					/* RedBits */
-   0,					/* GreenBits */
-   0,					/* BlueBits */
-   0,					/* AlphaBits */
-   0,					/* LuminanceBits */
-   0,					/* IntensityBits */
-   0,					/* IndexBits */
-   0,					/* DepthBits */
-   0,					/* StencilBits */
-   0,					/* TexelBytes */
-   NULL,				/* StoreTexImageFunc */
-   fetch_null_texel,			/* FetchTexel1D */
-   fetch_null_texel,			/* FetchTexel2D */
-   fetch_null_texel,			/* FetchTexel3D */
-   fetch_null_texelf,			/* FetchTexel1Df */
-   fetch_null_texelf,			/* FetchTexel2Df */
-   fetch_null_texelf,			/* FetchTexel3Df */
-   store_null_texel			/* StoreTexel */
-};
-
-/*@}*/
 
 
 /**
@@ -1475,7 +55,7 @@ const struct gl_texture_format _mesa_null_texformat = {
  * This is called via dd_function_table::ChooseTextureFormat.  Hardware drivers
  * will typically override this function with a specialized version.
  */
-const struct gl_texture_format *
+gl_format
 _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
                          GLenum format, GLenum type )
 {
@@ -1489,15 +69,14 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       case GL_RGB10_A2:
       case GL_RGBA12:
       case GL_RGBA16:
-         return &_mesa_texformat_rgba;
       case GL_RGBA8:
-         return &_mesa_texformat_rgba8888;
+         return MESA_FORMAT_RGBA8888;
       case GL_RGB5_A1:
-         return &_mesa_texformat_argb1555;
+         return MESA_FORMAT_ARGB1555;
       case GL_RGBA2:
-         return &_mesa_texformat_argb4444_rev; /* just to test another format*/
+         return MESA_FORMAT_ARGB4444_REV; /* just to test another format*/
       case GL_RGBA4:
-         return &_mesa_texformat_argb4444;
+         return MESA_FORMAT_ARGB4444;
 
       /* RGB formats */
       case 3:
@@ -1505,24 +84,22 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       case GL_RGB10:
       case GL_RGB12:
       case GL_RGB16:
-         return &_mesa_texformat_rgb;
       case GL_RGB8:
-         return &_mesa_texformat_rgb888;
+         return MESA_FORMAT_RGB888;
       case GL_R3_G3_B2:
-         return &_mesa_texformat_rgb332;
+         return MESA_FORMAT_RGB332;
       case GL_RGB4:
-         return &_mesa_texformat_rgb565_rev; /* just to test another format */
+         return MESA_FORMAT_RGB565_REV; /* just to test another format */
       case GL_RGB5:
-         return &_mesa_texformat_rgb565;
+         return MESA_FORMAT_RGB565;
 
       /* Alpha formats */
       case GL_ALPHA:
       case GL_ALPHA4:
       case GL_ALPHA12:
       case GL_ALPHA16:
-         return &_mesa_texformat_alpha;
       case GL_ALPHA8:
-         return &_mesa_texformat_a8;
+         return MESA_FORMAT_A8;
 
       /* Luminance formats */
       case 1:
@@ -1530,29 +107,28 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       case GL_LUMINANCE4:
       case GL_LUMINANCE12:
       case GL_LUMINANCE16:
-         return &_mesa_texformat_luminance;
       case GL_LUMINANCE8:
-         return &_mesa_texformat_l8;
+         return MESA_FORMAT_L8;
 
       /* Luminance/Alpha formats */
       case 2:
       case GL_LUMINANCE_ALPHA:
       case GL_LUMINANCE4_ALPHA4:
       case GL_LUMINANCE6_ALPHA2:
+      case GL_LUMINANCE8_ALPHA8:
+         return MESA_FORMAT_AL88;
+
       case GL_LUMINANCE12_ALPHA4:
       case GL_LUMINANCE12_ALPHA12:
       case GL_LUMINANCE16_ALPHA16:
-         return &_mesa_texformat_luminance_alpha;
-      case GL_LUMINANCE8_ALPHA8:
-         return &_mesa_texformat_al88;
+         return MESA_FORMAT_AL1616;
 
       case GL_INTENSITY:
       case GL_INTENSITY4:
       case GL_INTENSITY12:
       case GL_INTENSITY16:
-         return &_mesa_texformat_intensity;
       case GL_INTENSITY8:
-         return &_mesa_texformat_i8;
+         return MESA_FORMAT_I8;
 
       case GL_COLOR_INDEX:
       case GL_COLOR_INDEX1_EXT:
@@ -1561,7 +137,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       case GL_COLOR_INDEX12_EXT:
       case GL_COLOR_INDEX16_EXT:
       case GL_COLOR_INDEX8_EXT:
-         return &_mesa_texformat_ci8;
+         return MESA_FORMAT_CI8;
 
       default:
          ; /* fallthrough */
@@ -1572,9 +148,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
          case GL_DEPTH_COMPONENT:
          case GL_DEPTH_COMPONENT24:
          case GL_DEPTH_COMPONENT32:
-            return &_mesa_texformat_z32;
+            return MESA_FORMAT_Z32;
          case GL_DEPTH_COMPONENT16:
-            return &_mesa_texformat_z16;
+            return MESA_FORMAT_Z16;
          default:
             ; /* fallthrough */
       }
@@ -1582,35 +158,27 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
 
    switch (internalFormat) {
       case GL_COMPRESSED_ALPHA_ARB:
-         return &_mesa_texformat_alpha;
+         return MESA_FORMAT_A8;
       case GL_COMPRESSED_LUMINANCE_ARB:
-         return &_mesa_texformat_luminance;
+         return MESA_FORMAT_L8;
       case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
-         return &_mesa_texformat_luminance_alpha;
+         return MESA_FORMAT_AL88;
       case GL_COMPRESSED_INTENSITY_ARB:
-         return &_mesa_texformat_intensity;
+         return MESA_FORMAT_I8;
       case GL_COMPRESSED_RGB_ARB:
-#if FEATURE_texture_s3tc
          if (ctx->Extensions.EXT_texture_compression_s3tc ||
              ctx->Extensions.S3_s3tc)
-            return &_mesa_texformat_rgb_dxt1;
-#endif
-#if FEATURE_texture_fxt1
+            return MESA_FORMAT_RGB_DXT1;
          if (ctx->Extensions.TDFX_texture_compression_FXT1)
-            return &_mesa_texformat_rgb_fxt1;
-#endif
-         return &_mesa_texformat_rgb;
+            return MESA_FORMAT_RGB_FXT1;
+         return MESA_FORMAT_RGB888;
       case GL_COMPRESSED_RGBA_ARB:
-#if FEATURE_texture_s3tc
          if (ctx->Extensions.EXT_texture_compression_s3tc ||
              ctx->Extensions.S3_s3tc)
-            return &_mesa_texformat_rgba_dxt5; /* Not rgba_dxt1, see spec */
-#endif
-#if FEATURE_texture_fxt1
+            return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */
          if (ctx->Extensions.TDFX_texture_compression_FXT1)
-            return &_mesa_texformat_rgba_fxt1;
-#endif
-         return &_mesa_texformat_rgba;
+            return MESA_FORMAT_RGBA_FXT1;
+         return MESA_FORMAT_RGBA8888;
       default:
          ; /* fallthrough */
    }
@@ -1618,9 +186,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
    if (ctx->Extensions.MESA_ycbcr_texture) {
       if (internalFormat == GL_YCBCR_MESA) {
          if (type == GL_UNSIGNED_SHORT_8_8_MESA)
-            return &_mesa_texformat_ycbcr;
+            return MESA_FORMAT_YCBCR;
          else
-            return &_mesa_texformat_ycbcr_rev;
+            return MESA_FORMAT_YCBCR_REV;
       }
    }
 
@@ -1628,9 +196,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
    if (ctx->Extensions.TDFX_texture_compression_FXT1) {
       switch (internalFormat) {
          case GL_COMPRESSED_RGB_FXT1_3DFX:
-            return &_mesa_texformat_rgb_fxt1;
+            return MESA_FORMAT_RGB_FXT1;
          case GL_COMPRESSED_RGBA_FXT1_3DFX:
-            return &_mesa_texformat_rgba_fxt1;
+            return MESA_FORMAT_RGBA_FXT1;
          default:
             ; /* fallthrough */
       }
@@ -1641,13 +209,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
    if (ctx->Extensions.EXT_texture_compression_s3tc) {
       switch (internalFormat) {
          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-            return &_mesa_texformat_rgb_dxt1;
+            return MESA_FORMAT_RGB_DXT1;
          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-            return &_mesa_texformat_rgba_dxt1;
+            return MESA_FORMAT_RGBA_DXT1;
          case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-            return &_mesa_texformat_rgba_dxt3;
+            return MESA_FORMAT_RGBA_DXT3;
          case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-            return &_mesa_texformat_rgba_dxt5;
+            return MESA_FORMAT_RGBA_DXT5;
          default:
             ; /* fallthrough */
       }
@@ -1657,10 +225,10 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_RGB_S3TC:
          case GL_RGB4_S3TC:
-            return &_mesa_texformat_rgb_dxt1;
+            return MESA_FORMAT_RGB_DXT1;
          case GL_RGBA_S3TC:
          case GL_RGBA4_S3TC:
-            return &_mesa_texformat_rgba_dxt3;
+            return MESA_FORMAT_RGBA_DXT3;
          default:
             ; /* fallthrough */
       }
@@ -1670,29 +238,29 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
    if (ctx->Extensions.ARB_texture_float) {
       switch (internalFormat) {
          case GL_ALPHA16F_ARB:
-            return &_mesa_texformat_alpha_float16;
+            return MESA_FORMAT_ALPHA_FLOAT16;
          case GL_ALPHA32F_ARB:
-            return &_mesa_texformat_alpha_float32;
+            return MESA_FORMAT_ALPHA_FLOAT32;
          case GL_LUMINANCE16F_ARB:
-            return &_mesa_texformat_luminance_float16;
+            return MESA_FORMAT_LUMINANCE_FLOAT16;
          case GL_LUMINANCE32F_ARB:
-            return &_mesa_texformat_luminance_float32;
+            return MESA_FORMAT_LUMINANCE_FLOAT32;
          case GL_LUMINANCE_ALPHA16F_ARB:
-            return &_mesa_texformat_luminance_alpha_float16;
+            return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16;
          case GL_LUMINANCE_ALPHA32F_ARB:
-            return &_mesa_texformat_luminance_alpha_float32;
+            return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32;
          case GL_INTENSITY16F_ARB:
-            return &_mesa_texformat_intensity_float16;
+            return MESA_FORMAT_INTENSITY_FLOAT16;
          case GL_INTENSITY32F_ARB:
-            return &_mesa_texformat_intensity_float32;
+            return MESA_FORMAT_INTENSITY_FLOAT32;
          case GL_RGB16F_ARB:
-            return &_mesa_texformat_rgb_float16;
+            return MESA_FORMAT_RGB_FLOAT16;
          case GL_RGB32F_ARB:
-            return &_mesa_texformat_rgb_float32;
+            return MESA_FORMAT_RGB_FLOAT32;
          case GL_RGBA16F_ARB:
-            return &_mesa_texformat_rgba_float16;
+            return MESA_FORMAT_RGBA_FLOAT16;
          case GL_RGBA32F_ARB:
-            return &_mesa_texformat_rgba_float32;
+            return MESA_FORMAT_RGBA_FLOAT32;
          default:
             ; /* fallthrough */
       }
@@ -1702,7 +270,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_DEPTH_STENCIL_EXT:
          case GL_DEPTH24_STENCIL8_EXT:
-            return &_mesa_texformat_z24_s8;
+            return MESA_FORMAT_Z24_S8;
          default:
             ; /* fallthrough */
       }
@@ -1712,7 +280,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_DUDV_ATI:
          case GL_DU8DV8_ATI:
-            return &_mesa_texformat_dudv8;
+            return MESA_FORMAT_DUDV8;
          default:
             ; /* fallthrough */
       }
@@ -1722,7 +290,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_RGBA_SNORM:
          case GL_RGBA8_SNORM:
-            return &_mesa_texformat_signed_rgba8888;
+            return MESA_FORMAT_SIGNED_RGBA8888;
          default:
             ; /* fallthrough */
       }
@@ -1734,48 +302,48 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_SRGB_EXT:
          case GL_SRGB8_EXT:
-            return &_mesa_texformat_srgb8;
+            return MESA_FORMAT_SRGB8;
          case GL_SRGB_ALPHA_EXT:
          case GL_SRGB8_ALPHA8_EXT:
-            return &_mesa_texformat_srgba8;
+            return MESA_FORMAT_SRGBA8;
          case GL_SLUMINANCE_EXT:
          case GL_SLUMINANCE8_EXT:
-            return &_mesa_texformat_sl8;
+            return MESA_FORMAT_SL8;
          case GL_SLUMINANCE_ALPHA_EXT:
          case GL_SLUMINANCE8_ALPHA8_EXT:
-            return &_mesa_texformat_sla8;
+            return MESA_FORMAT_SLA8;
          case GL_COMPRESSED_SLUMINANCE_EXT:
-            return &_mesa_texformat_sl8;
+            return MESA_FORMAT_SL8;
          case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
-            return &_mesa_texformat_sla8;
+            return MESA_FORMAT_SLA8;
          case GL_COMPRESSED_SRGB_EXT:
 #if FEATURE_texture_s3tc
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return &_mesa_texformat_srgb_dxt1;
+               return MESA_FORMAT_SRGB_DXT1;
 #endif
-            return &_mesa_texformat_srgb8;
+            return MESA_FORMAT_SRGB8;
          case GL_COMPRESSED_SRGB_ALPHA_EXT:
 #if FEATURE_texture_s3tc
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return &_mesa_texformat_srgba_dxt3; /* Not srgba_dxt1, see spec */
+               return MESA_FORMAT_SRGBA_DXT3; /* Not srgba_dxt1, see spec */
 #endif
-            return &_mesa_texformat_srgba8;
+            return MESA_FORMAT_SRGBA8;
 #if FEATURE_texture_s3tc
          case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return &_mesa_texformat_srgb_dxt1;
+               return MESA_FORMAT_SRGB_DXT1;
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return &_mesa_texformat_srgba_dxt1;
+               return MESA_FORMAT_SRGBA_DXT1;
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return &_mesa_texformat_srgba_dxt3;
+               return MESA_FORMAT_SRGBA_DXT3;
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return &_mesa_texformat_srgba_dxt5;
+               return MESA_FORMAT_SRGBA_DXT5;
             break;
 #endif
          default:
@@ -1785,205 +353,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
 #endif /* FEATURE_EXT_texture_sRGB */
 
    _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
-   return NULL;
+   return MESA_FORMAT_NONE;
 }
 
-
-
-/**
- * Return datatype and number of components per texel for the
- * given gl_texture_format.
- */
-void
-_mesa_format_to_type_and_comps(const struct gl_texture_format *format,
-                               GLenum *datatype, GLuint *comps)
-{
-   switch (format->MesaFormat) {
-   case MESA_FORMAT_RGBA8888:
-   case MESA_FORMAT_RGBA8888_REV:
-   case MESA_FORMAT_ARGB8888:
-   case MESA_FORMAT_ARGB8888_REV:
-      *datatype = CHAN_TYPE;
-      *comps = 4;
-      return;
-   case MESA_FORMAT_RGB888:
-   case MESA_FORMAT_BGR888:
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 3;
-      return;
-   case MESA_FORMAT_RGB565:
-   case MESA_FORMAT_RGB565_REV:
-      *datatype = GL_UNSIGNED_SHORT_5_6_5;
-      *comps = 3;
-      return;
-
-   case MESA_FORMAT_ARGB4444:
-   case MESA_FORMAT_ARGB4444_REV:
-      *datatype = GL_UNSIGNED_SHORT_4_4_4_4;
-      *comps = 4;
-      return;
-
-   case MESA_FORMAT_ARGB1555:
-   case MESA_FORMAT_ARGB1555_REV:
-      *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
-      *comps = 4;
-      return;
-
-   case MESA_FORMAT_AL88:
-   case MESA_FORMAT_AL88_REV:
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 2;
-      return;
-   case MESA_FORMAT_RGB332:
-      *datatype = GL_UNSIGNED_BYTE_3_3_2;
-      *comps = 3;
-      return;
-
-   case MESA_FORMAT_A8:
-   case MESA_FORMAT_L8:
-   case MESA_FORMAT_I8:
-   case MESA_FORMAT_CI8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 1;
-      return;
-
-   case MESA_FORMAT_YCBCR:
-   case MESA_FORMAT_YCBCR_REV:
-      *datatype = GL_UNSIGNED_SHORT;
-      *comps = 2;
-      return;
-
-   case MESA_FORMAT_Z24_S8:
-      *datatype = GL_UNSIGNED_INT;
-      *comps = 1; /* XXX OK? */
-      return;
-
-   case MESA_FORMAT_S8_Z24:
-      *datatype = GL_UNSIGNED_INT;
-      *comps = 1; /* XXX OK? */
-      return;
-
-   case MESA_FORMAT_Z16:
-      *datatype = GL_UNSIGNED_SHORT;
-      *comps = 1;
-      return;
-
-   case MESA_FORMAT_Z32:
-      *datatype = GL_UNSIGNED_INT;
-      *comps = 1;
-      return;
-
-   case MESA_FORMAT_DUDV8:
-      *datatype = GL_BYTE;
-      *comps = 2;
-      return;
-
-   case MESA_FORMAT_SIGNED_RGBA8888:
-   case MESA_FORMAT_SIGNED_RGBA8888_REV:
-      *datatype = GL_BYTE;
-      *comps = 4;
-      return;
-
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGB8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 3;
-      return;
-   case MESA_FORMAT_SRGBA8:
-   case MESA_FORMAT_SARGB8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 4;
-      return;
-   case MESA_FORMAT_SL8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 1;
-      return;
-   case MESA_FORMAT_SLA8:
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 2;
-      return;
-#endif
-
-#if FEATURE_texture_fxt1
-   case MESA_FORMAT_RGB_FXT1:
-   case MESA_FORMAT_RGBA_FXT1:
-#endif
-#if FEATURE_texture_s3tc
-   case MESA_FORMAT_RGB_DXT1:
-   case MESA_FORMAT_RGBA_DXT1:
-   case MESA_FORMAT_RGBA_DXT3:
-   case MESA_FORMAT_RGBA_DXT5:
-#if FEATURE_EXT_texture_sRGB
-   case MESA_FORMAT_SRGB_DXT1:
-   case MESA_FORMAT_SRGBA_DXT1:
-   case MESA_FORMAT_SRGBA_DXT3:
-   case MESA_FORMAT_SRGBA_DXT5:
-#endif
-      /* XXX generate error instead? */
-      *datatype = GL_UNSIGNED_BYTE;
-      *comps = 0;
-      return;
-#endif
-
-   case MESA_FORMAT_RGBA:
-      *datatype = CHAN_TYPE;
-      *comps = 4;
-      return;
-   case MESA_FORMAT_RGB:
-      *datatype = CHAN_TYPE;
-      *comps = 3;
-      return;
-   case MESA_FORMAT_LUMINANCE_ALPHA:
-      *datatype = CHAN_TYPE;
-      *comps = 2;
-      return;
-   case MESA_FORMAT_ALPHA:
-   case MESA_FORMAT_LUMINANCE:
-   case MESA_FORMAT_INTENSITY:
-      *datatype = CHAN_TYPE;
-      *comps = 1;
-      return;
-
-   case MESA_FORMAT_RGBA_FLOAT32:
-      *datatype = GL_FLOAT;
-      *comps = 4;
-      return;
-   case MESA_FORMAT_RGBA_FLOAT16:
-      *datatype = GL_HALF_FLOAT_ARB;
-      *comps = 4;
-      return;
-   case MESA_FORMAT_RGB_FLOAT32:
-      *datatype = GL_FLOAT;
-      *comps = 3;
-      return;
-   case MESA_FORMAT_RGB_FLOAT16:
-      *datatype = GL_HALF_FLOAT_ARB;
-      *comps = 3;
-      return;
-   case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
-      *datatype = GL_FLOAT;
-      *comps = 2;
-      return;
-   case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
-      *datatype = GL_HALF_FLOAT_ARB;
-      *comps = 2;
-      return;
-   case MESA_FORMAT_ALPHA_FLOAT32:
-   case MESA_FORMAT_LUMINANCE_FLOAT32:
-   case MESA_FORMAT_INTENSITY_FLOAT32:
-      *datatype = GL_FLOAT;
-      *comps = 1;
-      return;
-   case MESA_FORMAT_ALPHA_FLOAT16:
-   case MESA_FORMAT_LUMINANCE_FLOAT16:
-   case MESA_FORMAT_INTENSITY_FLOAT16:
-      *datatype = GL_HALF_FLOAT_ARB;
-      *comps = 1;
-      return;
-
-   default:
-      _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps");
-      *datatype = 0;
-      *comps = 1;
-   }
-}
diff --git a/mesalib/src/mesa/main/texformat.h b/mesalib/src/mesa/main/texformat.h
index 5aa1d756c..bda5fd6d8 100644
--- a/mesalib/src/mesa/main/texformat.h
+++ b/mesalib/src/mesa/main/texformat.h
@@ -1,9 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  7.75
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008-2009 VMware, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -23,271 +23,17 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-
-/**
- * \file texformat.h
- * Texture formats definitions.
- *
- * \author Gareth Hughes
- */
-
-
 #ifndef TEXFORMAT_H
 #define TEXFORMAT_H
 
 
 #include "mtypes.h"
+#include "formats.h"
 
 
-/**
- * Mesa internal texture image formats.
- * All texture images are stored in one of these formats.
- *
- * NOTE: when you add a new format, be sure to update the do_row()
- * function in texstore.c used for auto mipmap generation.
- */
-enum _format {
-   /** 
-    * \name Hardware-friendly formats.  
-    *
-    * Drivers can override the default formats and convert texture images to
-    * one of these as required.  The driver's
-    * dd_function_table::ChooseTextureFormat function will choose one of these
-    * formats.
-    *
-    * \note In the default case, some of these formats will be duplicates of
-    * the generic formats listed below.  However, these formats guarantee their
-    * internal component sizes, while GLchan may vary between GLubyte, GLushort
-    * and GLfloat.
-    */
-   /*@{*/
-				/* msb <------ TEXEL BITS -----------> lsb */
-				/* ---- ---- ---- ---- ---- ---- ---- ---- */
-   MESA_FORMAT_RGBA8888,	/* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
-   MESA_FORMAT_RGBA8888_REV,	/* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
-   MESA_FORMAT_ARGB8888,	/* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
-   MESA_FORMAT_ARGB8888_REV,	/* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
-   MESA_FORMAT_RGB888,		/*           RRRR RRRR GGGG GGGG BBBB BBBB */
-   MESA_FORMAT_BGR888,		/*           BBBB BBBB GGGG GGGG RRRR RRRR */
-   MESA_FORMAT_RGB565,		/*                     RRRR RGGG GGGB BBBB */
-   MESA_FORMAT_RGB565_REV,	/*                     GGGB BBBB RRRR RGGG */
-   MESA_FORMAT_RGBA4444,        /*                     RRRR GGGG BBBB AAAA */
-   MESA_FORMAT_ARGB4444,	/*                     AAAA RRRR GGGG BBBB */
-   MESA_FORMAT_ARGB4444_REV,	/*                     GGGG BBBB AAAA RRRR */
-   MESA_FORMAT_RGBA5551,        /*                     RRRR RGGG GGBB BBBA */
-   MESA_FORMAT_ARGB1555,	/*                     ARRR RRGG GGGB BBBB */
-   MESA_FORMAT_ARGB1555_REV,	/*                     GGGB BBBB ARRR RRGG */
-   MESA_FORMAT_AL88,		/*                     AAAA AAAA LLLL LLLL */
-   MESA_FORMAT_AL88_REV,	/*                     LLLL LLLL AAAA AAAA */
-   MESA_FORMAT_RGB332,		/*                               RRRG GGBB */
-   MESA_FORMAT_A8,		/*                               AAAA AAAA */
-   MESA_FORMAT_L8,		/*                               LLLL LLLL */
-   MESA_FORMAT_I8,		/*                               IIII IIII */
-   MESA_FORMAT_CI8,		/*                               CCCC CCCC */
-   MESA_FORMAT_YCBCR,		/*                     YYYY YYYY UorV UorV */
-   MESA_FORMAT_YCBCR_REV,	/*                     UorV UorV YYYY YYYY */
-   MESA_FORMAT_Z24_S8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
-   MESA_FORMAT_S8_Z24,          /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
-   MESA_FORMAT_Z16,             /*                     ZZZZ ZZZZ ZZZZ ZZZZ */
-   MESA_FORMAT_Z32,             /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
-   /*@}*/
-
-#if FEATURE_EXT_texture_sRGB
-   /**
-    * \name 8-bit/channel sRGB formats
-    */
-   /*@{*/
-   MESA_FORMAT_SRGB8,
-   MESA_FORMAT_SRGBA8,
-   MESA_FORMAT_SARGB8,
-   MESA_FORMAT_SL8,
-   MESA_FORMAT_SLA8,
-#if FEATURE_texture_s3tc
-   MESA_FORMAT_SRGB_DXT1,
-   MESA_FORMAT_SRGBA_DXT1,
-   MESA_FORMAT_SRGBA_DXT3,
-   MESA_FORMAT_SRGBA_DXT5,
-#endif
-   /*@}*/
-#endif
-
-   /**
-    * \name Compressed texture formats.
-    */
-   /*@{*/
-#if FEATURE_texture_fxt1
-   MESA_FORMAT_RGB_FXT1,
-   MESA_FORMAT_RGBA_FXT1,
-#endif
-#if FEATURE_texture_s3tc
-   MESA_FORMAT_RGB_DXT1,
-   MESA_FORMAT_RGBA_DXT1,
-   MESA_FORMAT_RGBA_DXT3,
-   MESA_FORMAT_RGBA_DXT5,
-#endif
-   /*@}*/
-
-   /**
-    * \name Generic GLchan-based formats.
-    *
-    * Software-oriented texture formats.  Texels are arrays of GLchan
-    * values so there are no byte order issues.
-    *
-    * \note Because these are based on the GLchan data type, one cannot assume
-    * 8 bits per channel with these formats.  If you require GLubyte channels,
-    * use one of the hardware formats above.
-    */
-   /*@{*/
-   MESA_FORMAT_RGBA,
-   MESA_FORMAT_RGB,
-   MESA_FORMAT_ALPHA,
-   MESA_FORMAT_LUMINANCE,
-   MESA_FORMAT_LUMINANCE_ALPHA,
-   MESA_FORMAT_INTENSITY,
-   /*@}*/
-
-   /**
-    * \name Floating point texture formats.
-    */
-   /*@{*/
-   MESA_FORMAT_RGBA_FLOAT32,
-   MESA_FORMAT_RGBA_FLOAT16,
-   MESA_FORMAT_RGB_FLOAT32,
-   MESA_FORMAT_RGB_FLOAT16,
-   MESA_FORMAT_ALPHA_FLOAT32,
-   MESA_FORMAT_ALPHA_FLOAT16,
-   MESA_FORMAT_LUMINANCE_FLOAT32,
-   MESA_FORMAT_LUMINANCE_FLOAT16,
-   MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
-   MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
-   MESA_FORMAT_INTENSITY_FLOAT32,
-   MESA_FORMAT_INTENSITY_FLOAT16,
-   /*@}*/
-
-   /**
-    * \name Signed fixed point texture formats.
-    */
-   /*@{*/
-   MESA_FORMAT_DUDV8,
-   MESA_FORMAT_SIGNED_RGBA8888,
-   MESA_FORMAT_SIGNED_RGBA8888_REV
-   /*@}*/
-};
-
-
-/** GLchan-valued formats */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_rgba;
-extern const struct gl_texture_format _mesa_texformat_rgb;
-extern const struct gl_texture_format _mesa_texformat_alpha;
-extern const struct gl_texture_format _mesa_texformat_luminance;
-extern const struct gl_texture_format _mesa_texformat_luminance_alpha;
-extern const struct gl_texture_format _mesa_texformat_intensity;
-/*@}*/
-
-#if FEATURE_EXT_texture_sRGB
-/** sRGB (nonlinear) formats */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_srgb8;
-extern const struct gl_texture_format _mesa_texformat_srgba8;
-extern const struct gl_texture_format _mesa_texformat_sargb8;
-extern const struct gl_texture_format _mesa_texformat_sl8;
-extern const struct gl_texture_format _mesa_texformat_sla8;
-#if FEATURE_texture_s3tc
-extern const struct gl_texture_format _mesa_texformat_srgb_dxt1;
-extern const struct gl_texture_format _mesa_texformat_srgba_dxt1;
-extern const struct gl_texture_format _mesa_texformat_srgba_dxt3;
-extern const struct gl_texture_format _mesa_texformat_srgba_dxt5;
-#endif
-/*@}*/
-#endif
-
-/** Floating point texture formats */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_rgba_float32;
-extern const struct gl_texture_format _mesa_texformat_rgba_float16;
-extern const struct gl_texture_format _mesa_texformat_rgb_float32;
-extern const struct gl_texture_format _mesa_texformat_rgb_float16;
-extern const struct gl_texture_format _mesa_texformat_alpha_float32;
-extern const struct gl_texture_format _mesa_texformat_alpha_float16;
-extern const struct gl_texture_format _mesa_texformat_luminance_float32;
-extern const struct gl_texture_format _mesa_texformat_luminance_float16;
-extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32;
-extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16;
-extern const struct gl_texture_format _mesa_texformat_intensity_float32;
-extern const struct gl_texture_format _mesa_texformat_intensity_float16;
-/*@}*/
-
-/** Signed fixed point texture formats */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_dudv8;
-extern const struct gl_texture_format _mesa_texformat_signed_rgba8888;
-extern const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev;
-/*@}*/
-
-/** \name Assorted hardware-friendly formats */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_rgba8888;
-extern const struct gl_texture_format _mesa_texformat_rgba8888_rev;
-extern const struct gl_texture_format _mesa_texformat_argb8888;
-extern const struct gl_texture_format _mesa_texformat_argb8888_rev;
-extern const struct gl_texture_format _mesa_texformat_rgb888;
-extern const struct gl_texture_format _mesa_texformat_bgr888;
-extern const struct gl_texture_format _mesa_texformat_rgb565;
-extern const struct gl_texture_format _mesa_texformat_rgb565_rev;
-extern const struct gl_texture_format _mesa_texformat_rgba4444;
-extern const struct gl_texture_format _mesa_texformat_argb4444;
-extern const struct gl_texture_format _mesa_texformat_argb4444_rev;
-extern const struct gl_texture_format _mesa_texformat_argb1555;
-extern const struct gl_texture_format _mesa_texformat_argb1555_rev;
-extern const struct gl_texture_format _mesa_texformat_rgba5551;
-extern const struct gl_texture_format _mesa_texformat_al88;
-extern const struct gl_texture_format _mesa_texformat_al88_rev;
-extern const struct gl_texture_format _mesa_texformat_rgb332;
-extern const struct gl_texture_format _mesa_texformat_a8;
-extern const struct gl_texture_format _mesa_texformat_l8;
-extern const struct gl_texture_format _mesa_texformat_i8;
-extern const struct gl_texture_format _mesa_texformat_ci8;
-extern const struct gl_texture_format _mesa_texformat_z24_s8;
-extern const struct gl_texture_format _mesa_texformat_s8_z24;
-extern const struct gl_texture_format _mesa_texformat_z16;
-extern const struct gl_texture_format _mesa_texformat_z32;
-/*@}*/
-
-/** \name YCbCr formats */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_ycbcr;
-extern const struct gl_texture_format _mesa_texformat_ycbcr_rev;
-/*@}*/
-
-/** \name Compressed formats */
-/*@{*/
-#if FEATURE_texture_fxt1
-extern const struct gl_texture_format _mesa_texformat_rgb_fxt1;
-extern const struct gl_texture_format _mesa_texformat_rgba_fxt1;
-#endif
-#if FEATURE_texture_s3tc
-extern const struct gl_texture_format _mesa_texformat_rgb_dxt1;
-extern const struct gl_texture_format _mesa_texformat_rgba_dxt1;
-extern const struct gl_texture_format _mesa_texformat_rgba_dxt3;
-extern const struct gl_texture_format _mesa_texformat_rgba_dxt5;
-#endif
-/*@}*/
-
-/** \name The null format */
-/*@{*/
-extern const struct gl_texture_format _mesa_null_texformat;
-/*@}*/
-
-
-extern const struct gl_texture_format *
+extern gl_format
 _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
                          GLenum format, GLenum type );
 
 
-extern void
-_mesa_format_to_type_and_comps(const struct gl_texture_format *format,
-                               GLenum *datatype, GLuint *comps);
-
-
 #endif
diff --git a/mesalib/src/mesa/main/texformat_tmp.h b/mesalib/src/mesa/main/texformat_tmp.h
deleted file mode 100644
index eb160deff..000000000
--- a/mesalib/src/mesa/main/texformat_tmp.h
+++ /dev/null
@@ -1,1474 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.1
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file texformat_tmp.h
- * Texel fetch functions template.
- * 
- * This template file is used by texformat.c to generate texel fetch functions
- * for 1-D, 2-D and 3-D texture images. 
- *
- * It should be expanded by defining \p DIM as the number texture dimensions
- * (1, 2 or 3).  According to the value of \p DIM a series of macros is defined
- * for the texel lookup in the gl_texture_image::Data.
- * 
- * \sa texformat.c and FetchTexel.
- * 
- * \author Gareth Hughes
- * \author Brian Paul
- */
-
-
-#if DIM == 1
-
-#define TEXEL_ADDR( type, image, i, j, k, size ) \
-	((void) (j), (void) (k), ((type *)(image)->Data + (i) * (size)))
-
-#define FETCH(x) fetch_texel_1d_##x
-
-#elif DIM == 2
-
-#define TEXEL_ADDR( type, image, i, j, k, size )			\
-	((void) (k),							\
-	 ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size)))
-
-#define FETCH(x) fetch_texel_2d_##x
-
-#elif DIM == 3
-
-#define TEXEL_ADDR( type, image, i, j, k, size )			\
-	((type *)(image)->Data + ((image)->ImageOffsets[k]		\
-             + (image)->RowStride * (j) + (i)) * (size))
-
-#define FETCH(x) fetch_texel_3d_##x
-
-#else
-#error	illegal number of texture dimensions
-#endif
-
-
-/* MESA_FORMAT_RGBA **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */
-static void FETCH(f_rgba)( const struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 4);
-   texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
-   texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
-   texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
-   texel[ACOMP] = CHAN_TO_FLOAT(src[3]);
-}
-
-#if DIM == 3
-/* Store a GLchan RGBA texel */
-static void store_texel_rgba(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 4);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-   dst[3] = rgba[ACOMP];
-}
-#endif
-
-/* MESA_FORMAT_RGB ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */
-static void FETCH(f_rgb)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 3);
-   texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
-   texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
-   texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 3);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-}
-#endif
-
-/* MESA_FORMAT_ALPHA *********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */
-static void FETCH(f_alpha)( const struct gl_texture_image *texImage,
-			  GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = 0.0F;
-   texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_alpha(struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
-   dst[0] = rgba[ACOMP];
-}
-#endif
-
-/* MESA_FORMAT_LUMINANCE *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
-static void FETCH(f_luminance)( const struct gl_texture_image *texImage,
-                                GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_luminance(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
-
-/* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/
-
-/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */
-static void FETCH(f_luminance_alpha)(const struct gl_texture_image *texImage,
-                                     GLint i, GLint j, GLint k, GLfloat *texel)
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 2);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
-   texel[ACOMP] = CHAN_TO_FLOAT(src[1]);
-}
-
-#if DIM == 3
-static void store_texel_luminance_alpha(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 2);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[ACOMP];
-}
-#endif
-
-/* MESA_FORMAT_INTENSITY *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */
-static void FETCH(f_intensity)( const struct gl_texture_image *texImage,
-                                GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] =
-   texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_intensity(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_Z32 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z32)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[0] = src[0] * (1.0F / 0xffffffff);
-}
-
-#if DIM == 3
-static void store_texel_z32(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLuint *depth = (const GLuint *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   dst[0] = *depth;
-}
-#endif
-
-
-/* MESA_FORMAT_Z16 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z16)(const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   texel[0] = src[0] * (1.0F / 65535.0F);
-}
-
-#if DIM == 3
-static void store_texel_z16(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLushort *depth = (const GLushort *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   dst[0] = *depth;
-}
-#endif
-
-
-/* MESA_FORMAT_RGBA_F32 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
-   texel[RCOMP] = src[0];
-   texel[GCOMP] = src[1];
-   texel[BCOMP] = src[2];
-   texel[ACOMP] = src[3];
-}
-
-#if DIM == 3
-static void store_texel_rgba_f32(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = depth[RCOMP];
-   dst[1] = depth[GCOMP];
-   dst[2] = depth[BCOMP];
-   dst[3] = depth[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_RGBA_F16 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
-   texel[RCOMP] = _mesa_half_to_float(src[0]);
-   texel[GCOMP] = _mesa_half_to_float(src[1]);
-   texel[BCOMP] = _mesa_half_to_float(src[2]);
-   texel[ACOMP] = _mesa_half_to_float(src[3]);
-}
-
-#if DIM == 3
-static void store_texel_rgba_f16(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(*depth);
-}
-#endif
-
-/* MESA_FORMAT_RGB_F32 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
-   texel[RCOMP] = src[0];
-   texel[GCOMP] = src[1];
-   texel[BCOMP] = src[2];
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb_f32(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = *depth;
-}
-#endif
-
-
-/* MESA_FORMAT_RGB_F16 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
-   texel[RCOMP] = _mesa_half_to_float(src[0]);
-   texel[GCOMP] = _mesa_half_to_float(src[1]);
-   texel[BCOMP] = _mesa_half_to_float(src[2]);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb_f16(struct gl_texture_image *texImage,
-                                GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(*depth);
-}
-#endif
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = 0.0F;
-   texel[ACOMP] = src[0];
-}
-
-#if DIM == 3
-static void store_texel_alpha_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = rgba[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = 0.0F;
-   texel[ACOMP] = _mesa_half_to_float(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_alpha_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = src[0];
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_luminance_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = _mesa_half_to_float(src[0]);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_luminance_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = src[0];
-   texel[ACOMP] = src[1];
-}
-
-#if DIM == 3
-static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = _mesa_half_to_float(src[0]);
-   texel[ACOMP] = _mesa_half_to_float(src[1]);
-}
-
-#if DIM == 3
-static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-   dst[1] = _mesa_float_to_half(rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_INTENSITY_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] =
-   texel[ACOMP] = src[0];
-}
-
-#if DIM == 3
-static void store_texel_intensity_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_INTENSITY_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] =
-   texel[ACOMP] = _mesa_half_to_float(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_intensity_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-}
-#endif
-
-
-
-
-/*
- * Begin Hardware formats
- */
-
-/* MESA_FORMAT_RGBA8888 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
-static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
-   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
-   texel[BCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
-   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
-}
-
-
-
-#if DIM == 3
-static void store_texel_rgba8888(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RGBA888_REV ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
-                                   GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
-   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
-   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
-   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
-}
-
-#if DIM == 3
-static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB8888 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
-static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
-   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
-   texel[BCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
-   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
-}
-
-#if DIM == 3
-static void store_texel_argb8888(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB8888_REV **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
-                                   GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
-   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
-   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
-   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
-}
-
-#if DIM == 3
-static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RGB888 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
-static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
-   texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
-   texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb888(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   dst[0] = rgba[BCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_BGR888 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
-static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
-   texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
-   texel[BCOMP] = UBYTE_TO_FLOAT( src[2] );
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_bgr888(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-}
-#endif
-
-
-/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding)
-   instead of slow (g << 2) * 255 / 252 (always rounds down) */
-
-/* MESA_FORMAT_RGB565 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
-static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   const GLushort s = *src;
-   texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
-   texel[GCOMP] = ((s >> 5 ) & 0x3f) * (1.0F / 63.0F);
-   texel[BCOMP] = ((s      ) & 0x1f) * (1.0F / 31.0F);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb565(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_565(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RGB565_REV ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
-static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
-   texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
-   texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 3) & 0xfc) | ((s >>  9) & 0x3) );
-   texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >>  2) & 0x7) );
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_565(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
-
-/* MESA_FORMAT_RGBA4444 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(f_rgba4444)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   const GLushort s = *src;
-   texel[RCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
-   texel[GCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
-   texel[BCOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
-   texel[ACOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
-}
-
-#if DIM == 3
-static void store_texel_rgba4444(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_4444(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB4444 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   const GLushort s = *src;
-   texel[RCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
-   texel[GCOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
-   texel[BCOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
-   texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
-}
-
-#if DIM == 3
-static void store_texel_argb4444(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB4444_REV **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
-static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
-                                   GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   texel[RCOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
-   texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
-   texel[BCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
-   texel[ACOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
-}
-
-#if DIM == 3
-static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
-
-/* MESA_FORMAT_RGBA5551 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   const GLushort s = *src;
-   texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
-   texel[GCOMP] = ((s >>  6) & 0x1f) * (1.0F / 31.0F);
-   texel[BCOMP] = ((s >>  1) & 0x1f) * (1.0F / 31.0F);
-   texel[ACOMP] = ((s      ) & 0x01) * 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgba5551(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_5551(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-/* MESA_FORMAT_ARGB1555 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
-			     GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   const GLushort s = *src;
-   texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
-   texel[GCOMP] = ((s >>  5) & 0x1f) * (1.0F / 31.0F);
-   texel[BCOMP] = ((s >>  0) & 0x1f) * (1.0F / 31.0F);
-   texel[ACOMP] = ((s >> 15) & 0x01) * 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_argb1555(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_1555(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_ARGB1555_REV **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
-static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
-                                   GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
-   texel[RCOMP] = UBYTE_TO_FLOAT( ((s >>  7) & 0xf8) | ((s >> 12) & 0x7) );
-   texel[GCOMP] = UBYTE_TO_FLOAT( ((s >>  2) & 0xf8) | ((s >>  7) & 0x7) );
-   texel[BCOMP] = UBYTE_TO_FLOAT( ((s <<  3) & 0xf8) | ((s >>  2) & 0x7) );
-   texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
-}
-
-#if DIM == 3
-static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_AL88 **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
-static void FETCH(f_al88)( const struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   texel[RCOMP] = 
-   texel[GCOMP] = 
-   texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
-   texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
-}
-
-#if DIM == 3
-static void store_texel_al88(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_AL88_REV ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
-static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   texel[RCOMP] = 
-   texel[GCOMP] = 
-   texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
-   texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
-}
-
-#if DIM == 3
-static void store_texel_al88_rev(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_RGB332 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
-static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   const GLubyte s = *src;
-   texel[RCOMP] = ((s >> 5) & 0x7) * (1.0F / 7.0F);
-   texel[GCOMP] = ((s >> 2) & 0x7) * (1.0F / 7.0F);
-   texel[BCOMP] = ((s     ) & 0x3) * (1.0F / 3.0F);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb332(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_332(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-
-/* MESA_FORMAT_A8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a8)( const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = 0.0F;
-   texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
-}
-
-#if DIM == 3
-static void store_texel_a8(struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   *dst = rgba[ACOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_L8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
-static void FETCH(f_l8)( const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_l8(struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_I8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
-static void FETCH(f_i8)( const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] =
-   texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
-}
-
-#if DIM == 3
-static void store_texel_i8(struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
-
-
-/* MESA_FORMAT_CI8 ***********************************************************/
-
-/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
- * color table, and return 4 GLchans.
- */
-static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   const struct gl_color_table *palette;
-   GLuint index;
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (ctx->Texture.SharedPalette) {
-      palette = &ctx->Texture.Palette;
-   }
-   else {
-      palette = &texImage->TexObject->Palette;
-   }
-   if (palette->Size == 0)
-      return; /* undefined results */
-
-   /* Mask the index against size of palette to avoid going out of bounds */
-   index = (*src) & (palette->Size - 1);
-
-   {
-      const GLfloat *table = palette->TableF;
-      switch (palette->_BaseFormat) {
-      case GL_ALPHA:
-         texel[RCOMP] =
-         texel[GCOMP] =
-         texel[BCOMP] = 0.0F;
-         texel[ACOMP] = table[index];
-         break;
-      case GL_LUMINANCE:
-         texel[RCOMP] =
-         texel[GCOMP] =
-         texel[BCOMP] = table[index];
-         texel[ACOMP] = 1.0F;
-         break;
-      case GL_INTENSITY:
-         texel[RCOMP] =
-         texel[GCOMP] =
-         texel[BCOMP] =
-         texel[ACOMP] = table[index];
-         break;
-      case GL_LUMINANCE_ALPHA:
-         texel[RCOMP] =
-         texel[GCOMP] =
-         texel[BCOMP] = table[index * 2 + 0];
-         texel[ACOMP] = table[index * 2 + 1];
-         break;
-      case GL_RGB:
-         texel[RCOMP] = table[index * 3 + 0];
-         texel[GCOMP] = table[index * 3 + 1];
-         texel[BCOMP] = table[index * 3 + 2];
-         texel[ACOMP] = 1.0F;
-         break;
-      case GL_RGBA:
-         texel[RCOMP] = table[index * 4 + 0];
-         texel[GCOMP] = table[index * 4 + 1];
-         texel[BCOMP] = table[index * 4 + 2];
-         texel[ACOMP] = table[index * 4 + 3];
-         break;
-      default:
-         _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8");
-         return;
-      }
-   }
-}
-
-#if DIM == 3
-static void store_texel_ci8(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *index = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   *dst = *index;
-}
-#endif
-
-
-#if FEATURE_EXT_texture_sRGB
-
-/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
-/* Note: component order is same as for MESA_FORMAT_RGB888 */
-static void FETCH(srgb8)(const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   texel[RCOMP] = nonlinear_to_linear(src[2]);
-   texel[GCOMP] = nonlinear_to_linear(src[1]);
-   texel[BCOMP] = nonlinear_to_linear(src[0]);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_srgb8(struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   dst[0] = rgba[BCOMP]; /* no conversion */
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[RCOMP];
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */
-static void FETCH(srgba8)(const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = nonlinear_to_linear( (s >> 24) );
-   texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
-   texel[BCOMP] = nonlinear_to_linear( (s >>  8) & 0xff );
-   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff ); /* linear! */
-}
-
-#if DIM == 3
-static void store_texel_srgba8(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
-static void FETCH(sargb8)(const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
-   texel[GCOMP] = nonlinear_to_linear( (s >>  8) & 0xff );
-   texel[BCOMP] = nonlinear_to_linear( (s      ) & 0xff );
-   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */
-}
-
-#if DIM == 3
-static void store_texel_sargb8(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */
-static void FETCH(sl8)(const struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   texel[RCOMP] = 
-   texel[GCOMP] = 
-   texel[BCOMP] = nonlinear_to_linear(src[0]);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_sl8(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
-
-/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */
-static void FETCH(sla8)(const struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
-   texel[RCOMP] =
-   texel[GCOMP] =
-   texel[BCOMP] = nonlinear_to_linear(src[0]);
-   texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */
-}
-
-#if DIM == 3
-static void store_texel_sla8(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[ACOMP];
-}
-#endif
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
-/* MESA_FORMAT_DUDV8 ********************************************************/
-
-/* this format by definition produces 0,0,0,1 as rgba values,
-   however we'll return the dudv values as rg and fix up elsewhere */
-static void FETCH(dudv8)(const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
-   texel[RCOMP] = BYTE_TO_FLOAT(src[0]);
-   texel[GCOMP] = BYTE_TO_FLOAT(src[1]);
-   texel[BCOMP] = 0;
-   texel[ACOMP] = 0;
-}
-
-/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/
-
-static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
-			            GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s >> 24)        );
-   texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
-   texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >>  8) & 0xff );
-   texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s      ) & 0xff );
-}
-
-#if DIM == 3
-static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
-                                        GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
-                                        GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s      ) & 0xff );
-   texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >>  8) & 0xff );
-   texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
-   texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24)        );
-}
-
-#if DIM == 3
-static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
-                                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
-
-
-
-/* MESA_FORMAT_YCBCR *********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats.
- * We convert YCbCr to RGB here.
- */
-static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
-   const GLushort *src1 = src0 + 1;                               /* odd */
-   const GLubyte y0 = (*src0 >> 8) & 0xff;  /* luminance */
-   const GLubyte cb = *src0 & 0xff;         /* chroma U */
-   const GLubyte y1 = (*src1 >> 8) & 0xff;  /* luminance */
-   const GLubyte cr = *src1 & 0xff;         /* chroma V */
-   const GLubyte y = (i & 1) ? y1 : y0;     /* choose even/odd luminance */
-   GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
-   GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
-   GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
-   r *= (1.0F / 255.0F);
-   g *= (1.0F / 255.0F);
-   b *= (1.0F / 255.0F);
-   texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
-   texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
-   texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_ycbcr(struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, const void *texel)
-{
-   (void) texImage;
-   (void) i;
-   (void) j;
-   (void) k;
-   (void) texel;
-   /* XXX to do */
-}
-#endif
-
-
-/* MESA_FORMAT_YCBCR_REV *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats.
- * We convert YCbCr to RGB here.
- */
-static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
-                                GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
-   const GLushort *src1 = src0 + 1;                               /* odd */
-   const GLubyte y0 = *src0 & 0xff;         /* luminance */
-   const GLubyte cr = (*src0 >> 8) & 0xff;  /* chroma V */
-   const GLubyte y1 = *src1 & 0xff;         /* luminance */
-   const GLubyte cb = (*src1 >> 8) & 0xff;  /* chroma U */
-   const GLubyte y = (i & 1) ? y1 : y0;     /* choose even/odd luminance */
-   GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
-   GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
-   GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
-   r *= (1.0F / 255.0F);
-   g *= (1.0F / 255.0F);
-   b *= (1.0F / 255.0F);
-   texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
-   texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
-   texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
-   texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   (void) texImage;
-   (void) i;
-   (void) j;
-   (void) k;
-   (void) texel;
-   /* XXX to do */
-}
-#endif
-
-
-/* MESA_TEXFORMAT_Z24_S8 ***************************************************/
-
-static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   /* only return Z, not stencil data */
-   const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
-   texel[0] = ((*src) >> 8) * scale;
-   ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8);
-   ASSERT(texel[0] >= 0.0F);
-   ASSERT(texel[0] <= 1.0F);
-}
-
-#if DIM == 3
-static void store_texel_z24_s8(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   /* only store Z, not stencil */
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   GLfloat depth = *((GLfloat *) texel);
-   GLuint zi = ((GLuint) (depth * 0xffffff)) << 8;
-   *dst = zi | (*dst & 0xff);
-}
-#endif
-
-
-/* MESA_TEXFORMAT_S8_Z24 ***************************************************/
-
-static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLfloat *texel )
-{
-   /* only return Z, not stencil data */
-   const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
-   texel[0] = ((*src) & 0x00ffffff) * scale;
-   ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24);
-   ASSERT(texel[0] >= 0.0F);
-   ASSERT(texel[0] <= 1.0F);
-}
-
-#if DIM == 3
-static void store_texel_s8_z24(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   /* only store Z, not stencil */
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   GLfloat depth = *((GLfloat *) texel);
-   GLuint zi = (GLuint) (depth * 0xffffff);
-   *dst = zi | (*dst & 0xff000000);
-}
-#endif
-
-
-#undef TEXEL_ADDR
-#undef DIM
-#undef FETCH
diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c
index e3feb024c..be4e03bc5 100644
--- a/mesalib/src/mesa/main/texgen.c
+++ b/mesalib/src/mesa/main/texgen.c
@@ -35,7 +35,12 @@
 #include "main/enums.h"
 #include "main/macros.h"
 #include "main/texgen.h"
+#include "main/texstate.h"
 #include "math/m_matrix.h"
+#include "glapi/dispatch.h"
+
+
+#if FEATURE_texgen
 
 
 /**
@@ -79,7 +84,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
       return;
    }
 
-   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   texUnit = _mesa_get_current_tex_unit(ctx);
 
    texgen = get_texgen(texUnit, coord);
    if (!texgen) {
@@ -161,7 +166,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
 {
    GLfloat p[4];
@@ -178,15 +183,17 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
 {
-   GLfloat p = (GLfloat) param;
-   _mesa_TexGenfv( coord, pname, &p );
+   GLfloat p[4];
+   p[0] = (GLfloat) param;
+   p[1] = p[2] = p[3] = 0.0F;
+   _mesa_TexGenfv( coord, pname, p );
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
 {
    GLfloat p[4];
@@ -203,22 +210,28 @@ _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
 {
-   _mesa_TexGenfv(coord, pname, &param);
+   GLfloat p[4];
+   p[0] = param;
+   p[1] = p[2] = p[3] = 0.0F;
+   _mesa_TexGenfv(coord, pname, p);
 }
 
 
 void GLAPIENTRY
 _mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
 {
-   _mesa_TexGeniv( coord, pname, &param );
+   GLint p[4];
+   p[0] = param;
+   p[1] = p[2] = p[3] = 0;
+   _mesa_TexGeniv( coord, pname, p );
 }
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
 {
    struct gl_texture_unit *texUnit;
@@ -231,7 +244,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
       return;
    }
 
-   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   texUnit = _mesa_get_current_tex_unit(ctx);
 
    texgen = get_texgen(texUnit, coord);
    if (!texgen) {
@@ -256,7 +269,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
 {
    struct gl_texture_unit *texUnit;
@@ -269,7 +282,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
       return;
    }
 
-   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   texUnit = _mesa_get_current_tex_unit(ctx);
 
    texgen = get_texgen(texUnit, coord);
    if (!texgen) {
@@ -294,7 +307,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
 {
    struct gl_texture_unit *texUnit;
@@ -307,7 +320,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
       return;
    }
 
-   texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+   texUnit = _mesa_get_current_tex_unit(ctx);
 
    texgen = get_texgen(texUnit, coord);
    if (!texgen) {
@@ -337,3 +350,19 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
 }
 
 
+void
+_mesa_init_texgen_dispatch(struct _glapi_table *disp)
+{
+   SET_GetTexGendv(disp, _mesa_GetTexGendv);
+   SET_GetTexGenfv(disp, _mesa_GetTexGenfv);
+   SET_GetTexGeniv(disp, _mesa_GetTexGeniv);
+   SET_TexGend(disp, _mesa_TexGend);
+   SET_TexGendv(disp, _mesa_TexGendv);
+   SET_TexGenf(disp, _mesa_TexGenf);
+   SET_TexGenfv(disp, _mesa_TexGenfv);
+   SET_TexGeni(disp, _mesa_TexGeni);
+   SET_TexGeniv(disp, _mesa_TexGeniv);
+}
+
+
+#endif /* FEATURE_texgen */
diff --git a/mesalib/src/mesa/main/texgen.h b/mesalib/src/mesa/main/texgen.h
index 073588efc..f6924ef72 100644
--- a/mesalib/src/mesa/main/texgen.h
+++ b/mesalib/src/mesa/main/texgen.h
@@ -27,36 +27,45 @@
 #define TEXGEN_H
 
 
-#include "main/glheader.h"
+#include "main/mtypes.h"
 
 
-extern void GLAPIENTRY
-_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
+#if FEATURE_texgen
 
-extern void GLAPIENTRY
-_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) \
+   do {                                           \
+      (driver)->TexGen = impl ## TexGen;          \
+   } while (0)
 
 extern void GLAPIENTRY
-_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
 
 extern void GLAPIENTRY
-_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param );
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
 
-extern void GLAPIENTRY
-_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params );
+extern void
+_mesa_init_texgen_dispatch(struct _glapi_table *disp);
 
-extern void GLAPIENTRY
-_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
+#else /* FEATURE_texgen */
 
-extern void GLAPIENTRY
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
+#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) do { } while (0)
 
-extern void GLAPIENTRY
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
+static void
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+{
+}
 
-extern void GLAPIENTRY
-_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params );
+static void INLINE
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+}
+
+static INLINE void
+_mesa_init_texgen_dispatch(struct _glapi_table *disp)
+{
+}
 
+#endif /* FEATURE_texgen */
 
 
 #endif /* TEXGEN_H */
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 14d6fc765..23765d275 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.5
+ * Version:  7.7
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  * Copyright (c) 2009 VMware, Inc.
@@ -31,10 +31,11 @@
 
 #include "glheader.h"
 #include "bufferobj.h"
+#include "enums.h"
 #include "context.h"
+#include "formats.h"
 #include "image.h"
 #include "texcompress.h"
-#include "texformat.h"
 #include "texgetimage.h"
 #include "teximage.h"
 #include "texstate.h"
@@ -43,29 +44,6 @@
 
 #if FEATURE_EXT_texture_sRGB
 
-/**
- * Test if given texture image is an sRGB format.
- */
-static GLboolean
-is_srgb_teximage(const struct gl_texture_image *texImage)
-{
-   switch (texImage->TexFormat->MesaFormat) {
-   case MESA_FORMAT_SRGB8:
-   case MESA_FORMAT_SRGBA8:
-   case MESA_FORMAT_SARGB8:
-   case MESA_FORMAT_SL8:
-   case MESA_FORMAT_SLA8:
-   case MESA_FORMAT_SRGB_DXT1:
-   case MESA_FORMAT_SRGBA_DXT1:
-   case MESA_FORMAT_SRGBA_DXT3:
-   case MESA_FORMAT_SRGBA_DXT5:
-      return GL_TRUE;
-   default:
-      return GL_FALSE;
-   }
-}
-
-
 /**
  * Convert a float value from linear space to a
  * non-linear sRGB value in [0, 255].
@@ -107,9 +85,358 @@ type_with_negative_values(GLenum type)
 }
 
 
+/**
+ * glGetTexImage for color index pixels.
+ */
+static void
+get_tex_color_index(GLcontext *ctx, GLuint dimensions,
+                    GLenum format, GLenum type, GLvoid *pixels,
+                    const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLuint indexBits =
+      _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT);
+   const GLbitfield transferOps = 0x0;
+   GLint img, row, col;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         GLuint indexRow[MAX_WIDTH];
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         assert(dest);
+
+         if (indexBits == 8) {
+            const GLubyte *src = (const GLubyte *) texImage->Data;
+            src += width * (img * texImage->Height + row);
+            for (col = 0; col < width; col++) {
+               indexRow[col] = src[col];
+            }
+         }
+         else if (indexBits == 16) {
+            const GLushort *src = (const GLushort *) texImage->Data;
+            src += width * (img * texImage->Height + row);
+            for (col = 0; col < width; col++) {
+               indexRow[col] = src[col];
+            }
+         }
+         else {
+            _mesa_problem(ctx, "Color index problem in _mesa_GetTexImage");
+         }
+         _mesa_pack_index_span(ctx, width, type, dest,
+                               indexRow, &ctx->Pack, transferOps);
+      }
+   }
+}
+
+
+/**
+ * glGetTexImage for depth/Z pixels.
+ */
+static void
+get_tex_depth(GLcontext *ctx, GLuint dimensions,
+              GLenum format, GLenum type, GLvoid *pixels,
+              const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   GLint img, row, col;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         GLfloat depthRow[MAX_WIDTH];
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         assert(dest);
+
+         for (col = 0; col < width; col++) {
+            texImage->FetchTexelf(texImage, col, row, img, depthRow + col);
+         }
+         _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack);
+      }
+   }
+}
+
+
+/**
+ * glGetTexImage for depth/stencil pixels.
+ */
+static void
+get_tex_depth_stencil(GLcontext *ctx, GLuint dimensions,
+                      GLenum format, GLenum type, GLvoid *pixels,
+                      const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLuint *src = (const GLuint *) texImage->Data;
+   GLint img, row;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         _mesa_memcpy(dest, src, width * sizeof(GLuint));
+         if (ctx->Pack.SwapBytes) {
+            _mesa_swap4((GLuint *) dest, width);
+         }
+
+         src += width * row + width * height * img;
+      }
+   }
+}
+
+
+/**
+ * glGetTexImage for YCbCr pixels.
+ */
+static void
+get_tex_ycbcr(GLcontext *ctx, GLuint dimensions,
+              GLenum format, GLenum type, GLvoid *pixels,
+              const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLint rowstride = texImage->RowStride;
+   const GLushort *src = (const GLushort *) texImage->Data;
+   GLint img, row;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         _mesa_memcpy(dest, src, width * sizeof(GLushort));
+
+         /* check for byte swapping */
+         if ((texImage->TexFormat == MESA_FORMAT_YCBCR
+              && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
+             (texImage->TexFormat == MESA_FORMAT_YCBCR_REV
+              && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
+            if (!ctx->Pack.SwapBytes)
+               _mesa_swap2((GLushort *) dest, width);
+         }
+         else if (ctx->Pack.SwapBytes) {
+            _mesa_swap2((GLushort *) dest, width);
+         }
+
+         src += rowstride;
+      }
+   }
+}
+
+
+/**
+ * glGetTexImagefor sRGB pixels;
+ */
+static void
+get_tex_srgb(GLcontext *ctx, GLuint dimensions,
+             GLenum format, GLenum type, GLvoid *pixels,
+             const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   const GLbitfield transferOps = 0x0;
+   GLint img, row;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+
+         GLfloat rgba[MAX_WIDTH][4];
+         GLint col;
+
+         /* convert row to RGBA format */
+         for (col = 0; col < width; col++) {
+            texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
+            if (texImage->_BaseFormat == GL_LUMINANCE) {
+               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+               rgba[col][GCOMP] = 0.0;
+               rgba[col][BCOMP] = 0.0;
+            }
+            else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+               rgba[col][GCOMP] = 0.0;
+               rgba[col][BCOMP] = 0.0;
+            }
+            else if (texImage->_BaseFormat == GL_RGB ||
+                     texImage->_BaseFormat == GL_RGBA) {
+               rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+               rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
+               rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
+            }
+         }
+         _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
+                                    format, type, dest,
+                                    &ctx->Pack, transferOps);
+      }
+   }
+}
+
+
+/**
+ * glGetTexImagefor RGBA, Luminance, etc. pixels.
+ * This is the slow way since we use texture sampling.
+ */
+static void
+get_tex_rgba(GLcontext *ctx, GLuint dimensions,
+             GLenum format, GLenum type, GLvoid *pixels,
+             const struct gl_texture_image *texImage)
+{
+   const GLint width = texImage->Width;
+   const GLint height = texImage->Height;
+   const GLint depth = texImage->Depth;
+   /* Normally, no pixel transfer ops are performed during glGetTexImage.
+    * The only possible exception is component clamping to [0,1].
+    */
+   GLbitfield transferOps = 0x0;
+   GLint img, row;
+
+   for (img = 0; img < depth; img++) {
+      for (row = 0; row < height; row++) {
+         void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+                                          width, height, format, type,
+                                          img, row, 0);
+         GLfloat rgba[MAX_WIDTH][4];
+         GLint col;
+         GLenum dataType = _mesa_get_format_datatype(texImage->TexFormat);
+
+         /* clamp does not apply to GetTexImage (final conversion)?
+          * Looks like we need clamp though when going from format
+          * containing negative values to unsigned format.
+          */
+         if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) {
+            transferOps |= IMAGE_CLAMP_BIT;
+         }
+         else if (!type_with_negative_values(type) &&
+                  (dataType == GL_FLOAT ||
+                   dataType == GL_SIGNED_NORMALIZED)) {
+            transferOps |= IMAGE_CLAMP_BIT;
+         }
+
+         for (col = 0; col < width; col++) {
+            texImage->FetchTexelf(texImage, col, row, img, rgba[col]);
+            if (texImage->_BaseFormat == GL_ALPHA) {
+               rgba[col][RCOMP] = 0.0F;
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+            }
+            else if (texImage->_BaseFormat == GL_LUMINANCE) {
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+               rgba[col][ACOMP] = 1.0F;
+            }
+            else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+            }
+            else if (texImage->_BaseFormat == GL_INTENSITY) {
+               rgba[col][GCOMP] = 0.0F;
+               rgba[col][BCOMP] = 0.0F;
+               rgba[col][ACOMP] = 1.0F;
+            }
+         }
+         _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
+                                    format, type, dest,
+                                    &ctx->Pack, transferOps);
+      }
+   }
+}
+
+
+/**
+ * Try to do glGetTexImage() with simple memcpy().
+ * \return GL_TRUE if done, GL_FALSE otherwise
+ */
+static GLboolean
+get_tex_memcpy(GLcontext *ctx, GLenum format, GLenum type, GLvoid *pixels,
+               const struct gl_texture_object *texObj,
+               const struct gl_texture_image *texImage)
+{
+   GLboolean memCopy = GL_FALSE;
+
+   /* Texture image should have been mapped already */
+   assert(texImage->Data);
+
+   /*
+    * Check if the src/dst formats are compatible.
+    * Also note that GL's pixel transfer ops don't apply to glGetTexImage()
+    * so we don't have to worry about those.
+    * XXX more format combinations could be supported here.
+    */
+   if ((texObj->Target == GL_TEXTURE_1D ||
+        texObj->Target == GL_TEXTURE_2D ||
+        texObj->Target == GL_TEXTURE_RECTANGLE ||
+        (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+         texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
+      if (texImage->TexFormat == MESA_FORMAT_ARGB8888 &&
+          format == GL_BGRA &&
+          type == GL_UNSIGNED_BYTE &&
+          !ctx->Pack.SwapBytes &&
+          _mesa_little_endian()) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_AL88 &&
+               format == GL_LUMINANCE_ALPHA &&
+               type == GL_UNSIGNED_BYTE &&
+               !ctx->Pack.SwapBytes &&
+               _mesa_little_endian()) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_L8 &&
+               format == GL_LUMINANCE &&
+               type == GL_UNSIGNED_BYTE) {
+         memCopy = GL_TRUE;
+      }
+      else if (texImage->TexFormat == MESA_FORMAT_A8 &&
+               format == GL_ALPHA &&
+               type == GL_UNSIGNED_BYTE) {
+         memCopy = GL_TRUE;
+      }
+   }
+
+   if (memCopy) {
+      const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat);
+      const GLuint bytesPerRow = texImage->Width * bpp;
+      GLubyte *dst =
+         _mesa_image_address2d(&ctx->Pack, pixels, texImage->Width,
+                               texImage->Height, format, type, 0, 0);
+      const GLint dstRowStride =
+         _mesa_image_row_stride(&ctx->Pack, texImage->Width, format, type);
+      const GLubyte *src = texImage->Data;
+      const GLint srcRowStride = texImage->RowStride * bpp;
+      GLuint row;
+
+      if (bytesPerRow == dstRowStride && bytesPerRow == srcRowStride) {
+         memcpy(dst, src, bytesPerRow * texImage->Height);
+      }
+      else {
+         for (row = 0; row < texImage->Height; row++) {
+            memcpy(dst, src, bytesPerRow);
+            dst += dstRowStride;
+            src += srcRowStride;
+         }
+      }
+   }
+
+   return memCopy;
+}
+
+
 /**
  * This is the software fallback for Driver.GetTexImage().
  * All error checking will have been done before this routine is called.
+ * The texture image must be mapped.
  */
 void
 _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
@@ -117,7 +444,21 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
                    struct gl_texture_object *texObj,
                    struct gl_texture_image *texImage)
 {
-   const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;
+   GLuint dimensions;
+
+   /* If we get here, the texture image should be mapped */
+   assert(texImage->Data);
+
+   switch (target) {
+   case GL_TEXTURE_1D:
+      dimensions = 1;
+      break;
+   case GL_TEXTURE_3D:
+      dimensions = 3;
+      break;
+   default:
+      dimensions = 2;
+   }
 
    if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
       /* Packing texture image into a PBO.
@@ -130,8 +471,8 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
          ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
                                GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
       if (!buf) {
-         /* buffer is already mapped - that's an error */
-         _mesa_error(ctx, GL_INVALID_OPERATION,"glGetTexImage(PBO is mapped)");
+         /* out of memory or other unexpected error */
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)");
          return;
       }
       /* <pixels> was an offset into the PBO.
@@ -139,164 +480,27 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
        */
       pixels = ADD_POINTERS(buf, pixels);
    }
-   else if (!pixels) {
-      /* not an error */
-      return;
-   }
 
-   {
-      const GLint width = texImage->Width;
-      const GLint height = texImage->Height;
-      const GLint depth = texImage->Depth;
-      GLint img, row;
-      for (img = 0; img < depth; img++) {
-         for (row = 0; row < height; row++) {
-            /* compute destination address in client memory */
-            GLvoid *dest = _mesa_image_address( dimensions, &ctx->Pack, pixels,
-                                                width, height, format, type,
-                                                img, row, 0);
-            assert(dest);
-
-            if (format == GL_COLOR_INDEX) {
-               GLuint indexRow[MAX_WIDTH];
-               GLint col;
-               /* Can't use FetchTexel here because that returns RGBA */
-               if (texImage->TexFormat->IndexBits == 8) {
-                  const GLubyte *src = (const GLubyte *) texImage->Data;
-                  src += width * (img * texImage->Height + row);
-                  for (col = 0; col < width; col++) {
-                     indexRow[col] = src[col];
-                  }
-               }
-               else if (texImage->TexFormat->IndexBits == 16) {
-                  const GLushort *src = (const GLushort *) texImage->Data;
-                  src += width * (img * texImage->Height + row);
-                  for (col = 0; col < width; col++) {
-                     indexRow[col] = src[col];
-                  }
-               }
-               else {
-                  _mesa_problem(ctx,
-                                "Color index problem in _mesa_GetTexImage");
-               }
-               _mesa_pack_index_span(ctx, width, type, dest,
-                                     indexRow, &ctx->Pack,
-                                     0 /* no image transfer */);
-            }
-            else if (format == GL_DEPTH_COMPONENT) {
-               GLfloat depthRow[MAX_WIDTH];
-               GLint col;
-               for (col = 0; col < width; col++) {
-                  (*texImage->FetchTexelf)(texImage, col, row, img,
-                                           depthRow + col);
-               }
-               _mesa_pack_depth_span(ctx, width, dest, type,
-                                     depthRow, &ctx->Pack);
-            }
-            else if (format == GL_DEPTH_STENCIL_EXT) {
-               /* XXX Note: we're bypassing texImage->FetchTexel()! */
-               const GLuint *src = (const GLuint *) texImage->Data;
-               src += width * row + width * height * img;
-               _mesa_memcpy(dest, src, width * sizeof(GLuint));
-               if (ctx->Pack.SwapBytes) {
-                  _mesa_swap4((GLuint *) dest, width);
-               }
-            }
-            else if (format == GL_YCBCR_MESA) {
-               /* No pixel transfer */
-               const GLint rowstride = texImage->RowStride;
-               MEMCPY(dest,
-                      (const GLushort *) texImage->Data + row * rowstride,
-                      width * sizeof(GLushort));
-               /* check for byte swapping */
-               if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR
-                    && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
-                   (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV
-                    && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
-                  if (!ctx->Pack.SwapBytes)
-                     _mesa_swap2((GLushort *) dest, width);
-               }
-               else if (ctx->Pack.SwapBytes) {
-                  _mesa_swap2((GLushort *) dest, width);
-               }
-            }
-#if FEATURE_EXT_texture_sRGB
-            else if (is_srgb_teximage(texImage)) {
-               /* special case this since need to backconvert values */
-               /* convert row to RGBA format */
-               GLfloat rgba[MAX_WIDTH][4];
-               GLint col;
-               GLbitfield transferOps = 0x0;
-
-               for (col = 0; col < width; col++) {
-                  (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
-                  if (texImage->_BaseFormat == GL_LUMINANCE) {
-                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
-                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->_BaseFormat == GL_RGB ||
-                     texImage->_BaseFormat == GL_RGBA) {
-                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-                     rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
-                     rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
-                  }
-               }
-               _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
-                                          format, type, dest,
-                                          &ctx->Pack, transferOps);
-            }
-#endif /* FEATURE_EXT_texture_sRGB */
-            else {
-               /* general case:  convert row to RGBA format */
-               GLfloat rgba[MAX_WIDTH][4];
-               GLint col;
-               GLbitfield transferOps = 0x0;
-
-               /* clamp does not apply to GetTexImage (final conversion)?
-                * Looks like we need clamp though when going from format
-                * containing negative values to unsigned format.
-                */
-               if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA)
-                  transferOps |= IMAGE_CLAMP_BIT;
-               else if (!type_with_negative_values(type) &&
-                        (texImage->TexFormat->DataType == GL_FLOAT ||
-                         texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED))
-                  transferOps |= IMAGE_CLAMP_BIT;
-
-               for (col = 0; col < width; col++) {
-                  (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
-                  if (texImage->_BaseFormat == GL_ALPHA) {
-                     rgba[col][RCOMP] = 0.0;
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->_BaseFormat == GL_LUMINANCE) {
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                     rgba[col][ACOMP] = 1.0;
-                  }
-                  else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->_BaseFormat == GL_INTENSITY) {
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                     rgba[col][ACOMP] = 1.0;
-                  }
-               }
-               _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
-                                          format, type, dest,
-                                          &ctx->Pack, transferOps);
-            } /* format */
-         } /* row */
-      } /* img */
+   if (get_tex_memcpy(ctx, format, type, pixels, texObj, texImage)) {
+      /* all done */
+   }
+   else if (format == GL_COLOR_INDEX) {
+      get_tex_color_index(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (format == GL_DEPTH_COMPONENT) {
+      get_tex_depth(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (format == GL_DEPTH_STENCIL_EXT) {
+      get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (format == GL_YCBCR_MESA) {
+      get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else if (_mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB) {
+      get_tex_srgb(ctx, dimensions, format, type, pixels, texImage);
+   }
+   else {
+      get_tex_rgba(ctx, dimensions, format, type, pixels, texImage);
    }
 
    if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
@@ -317,40 +521,43 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
                               struct gl_texture_object *texObj,
                               struct gl_texture_image *texImage)
 {
-   GLuint size;
+   const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat,
+                                                     texImage->Width);
+   const GLuint row_stride_stored = _mesa_format_row_stride(texImage->TexFormat,
+                                                            texImage->RowStride);
+   GLuint i;
 
    if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
       /* pack texture image into a PBO */
-      GLubyte *buf;
-      if ((const GLubyte *) img + texImage->CompressedSize >
-          (const GLubyte *) ctx->Pack.BufferObj->Size) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetCompressedTexImage(invalid PBO access)");
-         return;
-      }
-      buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                                              GL_WRITE_ONLY_ARB,
-                                              ctx->Pack.BufferObj);
+      GLubyte *buf = (GLubyte *)
+         ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                               GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
       if (!buf) {
-         /* buffer is already mapped - that's an error */
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetCompressedTexImage(PBO is mapped)");
+         /* out of memory or other unexpected error */
+         _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                     "glGetCompresssedTexImage(map PBO failed)");
          return;
       }
       img = ADD_POINTERS(buf, img);
    }
-   else if (!img) {
-      /* not an error */
-      return;
-   }
 
-   /* don't use texImage->CompressedSize since that may be padded out */
-   size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height,
-                                        texImage->Depth,
-                                        texImage->TexFormat->MesaFormat);
+   /* no pixelstore or pixel transfer, but respect stride */
 
-   /* just memcpy, no pixelstore or pixel transfer */
-   _mesa_memcpy(img, texImage->Data, size);
+   if (row_stride == row_stride_stored) {
+      const GLuint size = _mesa_format_image_size(texImage->TexFormat,
+                                                  texImage->Width,
+                                                  texImage->Height,
+                                                  texImage->Depth);
+      _mesa_memcpy(img, texImage->Data, size);
+   }
+   else {
+      GLuint bw, bh;
+      _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
+      for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) {
+         memcpy((GLubyte *)img + i * row_stride,
+                (GLubyte *)texImage->Data + i * row_stride_stored, row_stride);
+      }
+   }
 
    if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
       ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
@@ -368,10 +575,10 @@ static GLboolean
 getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
                         GLenum format, GLenum type, GLvoid *pixels )
 {
-   const struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+   GLenum baseFormat;
 
    if (maxLevels == 0) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target);
@@ -421,8 +628,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
       return GL_TRUE;
    }
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
 
    if (!texObj || _mesa_is_proxy_texture(target)) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");
@@ -434,40 +640,42 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
       /* out of memory */
       return GL_TRUE;
    }
+
+   baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
       
    /* Make sure the requested image format is compatible with the
     * texture's format.  Note that a color index texture can be converted
     * to RGBA so that combo is allowed.
     */
    if (_mesa_is_color_format(format)
-       && !_mesa_is_color_format(texImage->TexFormat->BaseFormat)
-       && !_mesa_is_index_format(texImage->TexFormat->BaseFormat)) {
+       && !_mesa_is_color_format(baseFormat)
+       && !_mesa_is_index_format(baseFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
       return GL_TRUE;
    }
    else if (_mesa_is_index_format(format)
-            && !_mesa_is_index_format(texImage->TexFormat->BaseFormat)) {
+            && !_mesa_is_index_format(baseFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
       return GL_TRUE;
    }
    else if (_mesa_is_depth_format(format)
-            && !_mesa_is_depth_format(texImage->TexFormat->BaseFormat)
-            && !_mesa_is_depthstencil_format(texImage->TexFormat->BaseFormat)) {
+            && !_mesa_is_depth_format(baseFormat)
+            && !_mesa_is_depthstencil_format(baseFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
       return GL_TRUE;
    }
    else if (_mesa_is_ycbcr_format(format)
-            && !_mesa_is_ycbcr_format(texImage->TexFormat->BaseFormat)) {
+            && !_mesa_is_ycbcr_format(baseFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
       return GL_TRUE;
    }
    else if (_mesa_is_depthstencil_format(format)
-            && !_mesa_is_depthstencil_format(texImage->TexFormat->BaseFormat)) {
+            && !_mesa_is_depthstencil_format(baseFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
       return GL_TRUE;
    }
    else if (_mesa_is_dudv_format(format)
-            && !_mesa_is_dudv_format(texImage->TexFormat->BaseFormat)) {
+            && !_mesa_is_dudv_format(baseFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
       return GL_TRUE;
    }
@@ -479,7 +687,14 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
                                      texImage->Height, texImage->Depth,
                                      format, type, pixels)) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetTexImage(invalid PBO access)");
+                     "glGetTexImage(out of bounds PBO write)");
+         return GL_TRUE;
+      }
+
+      /* PBO should not be mapped */
+      if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetTexImage(PBO is mapped)");
          return GL_TRUE;
       }
    }
@@ -502,8 +717,8 @@ void GLAPIENTRY
 _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
                    GLenum type, GLvoid *pixels )
 {
-   const struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
@@ -511,15 +726,25 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
       return;
    }
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) {
+      /* not an error, do nothing */
+      return;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
+      _mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d,"
+                  " dstFmt=0x%x, dstType=0x%x\n",
+                  texObj->Name,
+                  _mesa_get_format_name(texImage->TexFormat),
+                  texImage->Width, texImage->Height,
+                  format, type);
+   }
 
    _mesa_lock_texture(ctx, texObj);
    {
-      struct gl_texture_image *texImage =
-         _mesa_select_tex_image(ctx, texObj, target, level);
-
-      /* typically, this will call _mesa_get_teximage() */
       ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels,
                               texObj, texImage);
    }
@@ -527,55 +752,119 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
 }
 
 
+
+/**
+ * Do error checking for a glGetCompressedTexImage() call.
+ * \return GL_TRUE if any error, GL_FALSE if no errors.
+ */
+static GLboolean
+getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
+                                  GLvoid *img)
+{
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+
+   if (maxLevels == 0) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",
+                  target);
+      return GL_TRUE;
+   }
+
+   if (level < 0 || level >= maxLevels) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glGetCompressedTexImageARB(bad level = %d)", level);
+      return GL_TRUE;
+   }
+
+   if (_mesa_is_proxy_texture(target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM,
+                  "glGetCompressedTexImageARB(bad target = %s)",
+                  _mesa_lookup_enum_by_nr(target));
+      return GL_TRUE;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   if (!texObj) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)");
+      return GL_TRUE;
+   }
+
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+   if (!texImage) {
+      /* probably invalid mipmap level */
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glGetCompressedTexImageARB(level)");
+      return GL_TRUE;
+   }
+
+   if (!_mesa_is_format_compressed(texImage->TexFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glGetCompressedTexImageARB(texture is not compressed)");
+      return GL_TRUE;
+   }
+
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+      GLuint compressedSize;
+
+      /* make sure PBO is not mapped */
+      if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetCompressedTexImage(PBO is mapped)");
+         return GL_TRUE;
+      }
+
+      compressedSize = _mesa_format_image_size(texImage->TexFormat,
+                                               texImage->Width,
+                                               texImage->Height,
+                                               texImage->Depth);
+
+      /* do bounds checking on PBO write */
+      if ((const GLubyte *) img + compressedSize >
+          (const GLubyte *) ctx->Pack.BufferObj->Size) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetCompressedTexImage(out of bounds PBO write)");
+         return GL_TRUE;
+      }
+   }
+
+   return GL_FALSE;
+}
+
+
 void GLAPIENTRY
 _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
 {
-   const struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
-   GLint maxLevels;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
-   if (!texObj) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB");
+   if (getcompressedteximage_error_check(ctx, target, level, img)) {
       return;
    }
 
-   maxLevels = _mesa_max_texture_levels(ctx, target);
-   ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */
-
-   if (level < 0 || level >= maxLevels) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)");
+   if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && !img) {
+      /* not an error, do nothing */
       return;
    }
 
-   if (_mesa_is_proxy_texture(target)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)");
-      return;
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
+      _mesa_debug(ctx,
+                  "glGetCompressedTexImage(tex %u) format = %s, w=%d, h=%d\n",
+                  texObj->Name,
+                  _mesa_get_format_name(texImage->TexFormat),
+                  texImage->Width, texImage->Height);
    }
 
    _mesa_lock_texture(ctx, texObj);
    {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-      if (texImage) {
-         if (texImage->IsCompressed) {
-            /* this typically calls _mesa_get_compressed_teximage() */
-            ctx->Driver.GetCompressedTexImage(ctx, target, level, img,
-                                              texObj, texImage);
-         }
-         else {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glGetCompressedTexImageARB");
-         }
-      }
-      else {
-         /* probably invalid mipmap level */
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glGetCompressedTexImageARB(level)");
-      }
+      ctx->Driver.GetCompressedTexImage(ctx, target, level, img,
+                                        texObj, texImage);
    }
    _mesa_unlock_texture(ctx, texObj);
 }
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index a8160c273..b946f3c69 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -33,9 +33,7 @@
 #include "glheader.h"
 #include "bufferobj.h"
 #include "context.h"
-#if FEATURE_convolve
 #include "convolve.h"
-#endif
 #include "enums.h"
 #include "fbobject.h"
 #include "framebuffer.h"
@@ -45,7 +43,7 @@
 #include "macros.h"
 #include "state.h"
 #include "texcompress.h"
-#include "texformat.h"
+#include "texfetch.h"
 #include "teximage.h"
 #include "texstate.h"
 #include "texstore.h"
@@ -84,63 +82,6 @@ _mesa_free_texmemory(void *m)
 }
 
 
-
-
-#if 0
-static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img)
-{
-#if CHAN_TYPE != GL_UNSIGNED_BYTE
-   _mesa_problem(NULL, "PrintTexture not supported");
-#else
-   GLuint i, j, c;
-   const GLubyte *data = (const GLubyte *) img->Data;
-
-   if (!data) {
-      _mesa_printf("No texture data\n");
-      return;
-   }
-
-   switch (img->Format) {
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-      case GL_COLOR_INDEX:
-         c = 1;
-         break;
-      case GL_LUMINANCE_ALPHA:
-         c = 2;
-         break;
-      case GL_RGB:
-         c = 3;
-         break;
-      case GL_RGBA:
-         c = 4;
-         break;
-      default:
-         _mesa_problem(NULL, "error in PrintTexture\n");
-         return;
-   }
-
-   for (i = 0; i < img->Height; i++) {
-      for (j = 0; j < img->Width; j++) {
-         if (c==1)
-            _mesa_printf("%02x  ", data[0]);
-         else if (c==2)
-            _mesa_printf("%02x%02x  ", data[0], data[1]);
-         else if (c==3)
-            _mesa_printf("%02x%02x%02x  ", data[0], data[1], data[2]);
-         else if (c==4)
-            _mesa_printf("%02x%02x%02x%02x  ", data[0], data[1], data[2], data[3]);
-         data += (img->RowStride - img->Width) * c;
-      }
-      /* XXX use img->ImageStride here */
-      _mesa_printf("\n");
-   }
-#endif
-}
-#endif
-
-
 /*
  * Compute floor(log_base_2(n)).
  * If n < 0 return -1.
@@ -641,6 +582,17 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
 }
 
 
+/**
+ * Return pointer to texture object for given target on current texture unit.
+ */
+struct gl_texture_object *
+_mesa_get_current_tex_object(GLcontext *ctx, GLenum target)
+{
+   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+   return _mesa_select_tex_object(ctx, texUnit, target);
+}
+
+
 /**
  * Get a texture image pointer from a texture object, given a texture
  * target and mipmap level.  The target and level parameters should
@@ -902,11 +854,9 @@ clear_teximage_fields(struct gl_texture_image *img)
    img->HeightLog2 = 0;
    img->DepthLog2 = 0;
    img->Data = NULL;
-   img->TexFormat = &_mesa_null_texformat;
+   img->TexFormat = MESA_FORMAT_NONE;
    img->FetchTexelc = NULL;
    img->FetchTexelf = NULL;
-   img->IsCompressed = 0;
-   img->CompressedSize = 0;
 }
 
 
@@ -969,9 +919,6 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
 
    img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
 
-   img->IsCompressed = GL_FALSE;
-   img->CompressedSize = 0;
-
    if ((width == 1 || _mesa_is_pow_two(img->Width2)) &&
        (height == 1 || _mesa_is_pow_two(img->Height2)) &&
        (depth == 1 || _mesa_is_pow_two(img->Depth2)))
@@ -1004,6 +951,9 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
       img->HeightScale = (GLfloat) img->Height;
       img->DepthScale = (GLfloat) img->Depth;
    }
+
+   img->FetchTexelc = NULL;
+   img->FetchTexelf = NULL;
 }
 
 
@@ -1317,8 +1267,8 @@ texture_error_check( GLcontext *ctx, GLenum target,
    if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
       if (!isProxy) {
          _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glTexImage%dD(internalFormat=0x%x)",
-                     dimensions, internalFormat);
+                     "glTexImage%dD(internalFormat=%s)",
+                     dimensions, _mesa_lookup_enum_by_nr(internalFormat));
       }
       return GL_TRUE;
    }
@@ -1530,6 +1480,11 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
    return GL_FALSE;
 }
 
+
+/**
+ * Do second part of glTexSubImage which depends on the destination texture.
+ * \return GL_TRUE if error recorded, GL_FALSE otherwise
+ */
 static GLboolean
 subtexture_error_check2( GLcontext *ctx, GLuint dimensions,
 			 GLenum target, GLint level,
@@ -1577,41 +1532,35 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions,
       }
    }
 
-#if FEATURE_EXT_texture_sRGB
-   if (destTex->InternalFormat == GL_COMPRESSED_SRGB_S3TC_DXT1_EXT ||
-       destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT ||
-       destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT ||
-       destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT) {
-      if ((width & 0x3) || (height & 0x3) ||
-          (xoffset & 0x3) || (yoffset & 0x3))
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexSubImage%dD(size or offset not multiple of 4)",
-                     dimensions);
-      return GL_TRUE;
-   }
-#endif
+   if (_mesa_is_format_compressed(destTex->TexFormat)) {
+      GLuint bw, bh;
 
-   if (destTex->IsCompressed) {
       if (!target_can_be_compressed(ctx, target)) {
          _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glTexSubImage%D(target)", dimensions);
+                     "glTexSubImage%D(target=%s)", dimensions,
+                     _mesa_lookup_enum_by_nr(target));
          return GL_TRUE;
       }
-      /* offset must be multiple of 4 */
-      if ((xoffset & 3) || (yoffset & 3)) {
+
+      /* do tests which depend on compression block size */
+      _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh);
+
+      /* offset must be multiple of block size */
+      if ((xoffset % bw != 0) || (yoffset % bh != 0)) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexSubImage%D(xoffset or yoffset)", dimensions);
+                     "glTexSubImage%D(xoffset = %d, yoffset = %d)",
+                     dimensions, xoffset, yoffset);
          return GL_TRUE;
       }
-      /* size must be multiple of 4 or equal to whole texture size */
-      if ((width & 3) && (GLuint) width != destTex->Width) {
+      /* size must be multiple of bw by bh or equal to whole texture size */
+      if ((width % bw != 0) && (GLuint) width != destTex->Width) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexSubImage%D(width)", dimensions);
+                     "glTexSubImage%D(width = %d)", dimensions, width);
          return GL_TRUE;
       }         
-      if ((height & 3) && (GLuint) height != destTex->Height) {
+      if ((height % bh != 0) && (GLuint) height != destTex->Height) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexSubImage%D(width)", dimensions);
+                     "glTexSubImage%D(height = %d)", dimensions, height);
          return GL_TRUE;
       }         
    }
@@ -1953,7 +1902,7 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions,
       }
    }
 
-   if (teximage->IsCompressed) {
+   if (_mesa_is_format_compressed(teximage->TexFormat)) {
       if (!target_can_be_compressed(ctx, target)) {
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "glCopyTexSubImage%d(target)", dimensions);
@@ -2076,6 +2025,25 @@ update_fbo_texture(GLcontext *ctx, struct gl_texture_object *texObj,
 }
 
 
+/**
+ * If the texture object's GenerateMipmap flag is set and we've
+ * changed the texture base level image, regenerate the rest of the
+ * mipmap levels now.
+ */
+static INLINE void
+check_gen_mipmap(GLcontext *ctx, GLenum target,
+                 struct gl_texture_object *texObj, GLint level)
+{
+   ASSERT(target != GL_TEXTURE_CUBE_MAP);
+   if (texObj->GenerateMipmap &&
+       level == texObj->BaseLevel &&
+       level < texObj->MaxLevel) {
+      ASSERT(ctx->Driver.GenerateMipmap);
+      ctx->Driver.GenerateMipmap(ctx, target, texObj);
+   }
+}
+
+
 /** Debug helper: override the user-requested internal format */
 static GLenum
 override_internal_format(GLenum internalFormat, GLint width, GLint height)
@@ -2149,7 +2117,6 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
 
    if (target == GL_TEXTURE_1D) {
       /* non-proxy target */
-      struct gl_texture_unit *texUnit;
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
       const GLuint face = _mesa_tex_target_to_face(target);
@@ -2162,43 +2129,50 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
       if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
 	 _mesa_update_state(ctx);
 
-      texUnit = _mesa_get_current_tex_unit(ctx);
-      texObj = _mesa_select_tex_object(ctx, texUnit, target);
+      texObj = _mesa_get_current_tex_object(ctx, target);
       _mesa_lock_texture(ctx, texObj);
       {
 	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
 	 if (!texImage) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
-	    goto out;
-	 }
-      
-	 if (texImage->Data) {
-	    ctx->Driver.FreeTexImageData( ctx, texImage );
 	 }
+         else {
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+
+            ASSERT(texImage->Data == NULL);
+
+            clear_teximage_fields(texImage); /* not really needed, but helpful */
+            _mesa_init_teximage_fields(ctx, target, texImage,
+                                       postConvWidth, 1, 1,
+                                       border, internalFormat);
+
+            /* Choose actual texture format */
+            texImage->TexFormat =
+               ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                               format, type);
+            ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
+            /* Give the texture to the driver.  <pixels> may be null. */
+            ASSERT(ctx->Driver.TexImage1D);
+            ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+                                   width, border, format, type, pixels,
+                                   &ctx->Unpack, texObj, texImage);
+
+            ASSERT(texImage->TexFormat);
+
+            _mesa_set_fetch_functions(texImage, 1);
+
+            check_gen_mipmap(ctx, target, texObj, level);
+
+            update_fbo_texture(ctx, texObj, face, level);
 
-	 ASSERT(texImage->Data == NULL);
-
-	 clear_teximage_fields(texImage); /* not really needed, but helpful */
-	 _mesa_init_teximage_fields(ctx, target, texImage,
-				    postConvWidth, 1, 1,
-				    border, internalFormat);
-	 
-	 ASSERT(ctx->Driver.TexImage1D);
-
-	 /* Give the texture to the driver!  <pixels> may be null! */
-	 (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat,
-				   width, border, format, type, pixels,
-				   &ctx->Unpack, texObj, texImage);
-	 
-	 ASSERT(texImage->TexFormat);
-
-	 update_fbo_texture(ctx, texObj, face, level);
-	 
-	 /* state update */
-	 texObj->_Complete = GL_FALSE;
-	 ctx->NewState |= _NEW_TEXTURE;
-      }
-   out:
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
       _mesa_unlock_texture(ctx, texObj);
    }
    else if (target == GL_PROXY_TEXTURE_1D) {
@@ -2217,8 +2191,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
          _mesa_init_teximage_fields(ctx, target, texImage,
                                     postConvWidth, 1, 1,
                                     border, internalFormat);
-         texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
-                                          internalFormat, format, type);
+         texImage->TexFormat =
+            ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
       }
    }
    else {
@@ -2263,7 +2237,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
        (ctx->Extensions.MESA_texture_array &&
         target == GL_TEXTURE_1D_ARRAY_EXT)) {
       /* non-proxy target */
-      struct gl_texture_unit *texUnit;
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
       const GLuint face = _mesa_tex_target_to_face(target);
@@ -2277,42 +2250,49 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
       if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
 	 _mesa_update_state(ctx);
 
-      texUnit = _mesa_get_current_tex_unit(ctx);
-      texObj = _mesa_select_tex_object(ctx, texUnit, target);
+      texObj = _mesa_get_current_tex_object(ctx, target);
       _mesa_lock_texture(ctx, texObj);
       {
 	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
 	 if (!texImage) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
-	    goto out;
-	 }
-	 
-	 if (texImage->Data) {
-	    ctx->Driver.FreeTexImageData( ctx, texImage );
 	 }
-	 
-	 ASSERT(texImage->Data == NULL);
-	 clear_teximage_fields(texImage); /* not really needed, but helpful */
-	 _mesa_init_teximage_fields(ctx, target, texImage,
-				    postConvWidth, postConvHeight, 1,
-				    border, internalFormat);
-	 
-	 ASSERT(ctx->Driver.TexImage2D);
-
-	 /* Give the texture to the driver!  <pixels> may be null! */
-	 (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat,
-				   width, height, border, format, type, pixels,
-				   &ctx->Unpack, texObj, texImage);
-	 
-	 ASSERT(texImage->TexFormat);
-
-	 update_fbo_texture(ctx, texObj, face, level);
-
-	 /* state update */
-	 texObj->_Complete = GL_FALSE;
-	 ctx->NewState |= _NEW_TEXTURE;
-      }
-   out:
+         else {
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+
+            ASSERT(texImage->Data == NULL);
+            clear_teximage_fields(texImage); /* not really needed, but helpful */
+            _mesa_init_teximage_fields(ctx, target, texImage,
+                                       postConvWidth, postConvHeight, 1,
+                                       border, internalFormat);
+
+            /* Choose actual texture format */
+            texImage->TexFormat =
+               ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                               format, type);
+            ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
+            /* Give the texture to the driver.  <pixels> may be null. */
+            ASSERT(ctx->Driver.TexImage2D);
+            ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+                                   width, height, border, format, type,
+                                   pixels, &ctx->Unpack, texObj, texImage);
+
+            ASSERT(texImage->TexFormat);
+
+            _mesa_set_fetch_functions(texImage, 2);
+
+            check_gen_mipmap(ctx, target, texObj, level);
+
+            update_fbo_texture(ctx, texObj, face, level);
+
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
       _mesa_unlock_texture(ctx, texObj);
    }
    else if (target == GL_PROXY_TEXTURE_2D ||
@@ -2337,8 +2317,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
          _mesa_init_teximage_fields(ctx, target, texImage,
                                     postConvWidth, postConvHeight, 1,
                                     border, internalFormat);
-         texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
-                                          internalFormat, format, type);
+         texImage->TexFormat =
+            ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
       }
    }
    else {
@@ -2374,7 +2354,6 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
        (ctx->Extensions.MESA_texture_array &&
         target == GL_TEXTURE_2D_ARRAY_EXT)) {
       /* non-proxy target */
-      struct gl_texture_unit *texUnit;
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
       const GLuint face = _mesa_tex_target_to_face(target);
@@ -2387,42 +2366,49 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
       if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
 	 _mesa_update_state(ctx);
 
-      texUnit = _mesa_get_current_tex_unit(ctx);
-      texObj = _mesa_select_tex_object(ctx, texUnit, target);
+      texObj = _mesa_get_current_tex_object(ctx, target);
       _mesa_lock_texture(ctx, texObj);
       {
 	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
 	 if (!texImage) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
-	    goto out;
 	 }
-	 
-	 if (texImage->Data) {
-	    ctx->Driver.FreeTexImageData( ctx, texImage );
-	 }
-	 
-	 ASSERT(texImage->Data == NULL);
-	 clear_teximage_fields(texImage); /* not really needed, but helpful */
-	 _mesa_init_teximage_fields(ctx, target, texImage,
-				    width, height, depth,
-				    border, internalFormat);
+         else {
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+
+            ASSERT(texImage->Data == NULL);
+            clear_teximage_fields(texImage); /* not really needed, but helpful */
+            _mesa_init_teximage_fields(ctx, target, texImage,
+                                       width, height, depth,
+                                       border, internalFormat);
+
+            /* Choose actual texture format */
+            texImage->TexFormat =
+               ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                               format, type);
+            ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
 
-	 ASSERT(ctx->Driver.TexImage3D);
+            /* Give the texture to the driver.  <pixels> may be null. */
+            ASSERT(ctx->Driver.TexImage3D);
+            ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
+                                   width, height, depth, border, format, type,
+                                   pixels, &ctx->Unpack, texObj, texImage);
 
-	 /* Give the texture to the driver!  <pixels> may be null! */
-	 (*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat,
-				   width, height, depth, border, format, type,
-				   pixels, &ctx->Unpack, texObj, texImage);
+            ASSERT(texImage->TexFormat);
 
-	 ASSERT(texImage->TexFormat);
+            _mesa_set_fetch_functions(texImage, 3);
 
-	 update_fbo_texture(ctx, texObj, face, level);
+            check_gen_mipmap(ctx, target, texObj, level);
 
-	 /* state update */
-	 texObj->_Complete = GL_FALSE;
-	 ctx->NewState |= _NEW_TEXTURE;
+            update_fbo_texture(ctx, texObj, face, level);
+
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
       }
-   out:
       _mesa_unlock_texture(ctx, texObj);
    }
    else if (target == GL_PROXY_TEXTURE_3D ||
@@ -2441,8 +2427,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
          /* no error, set the tex image parameters */
          _mesa_init_teximage_fields(ctx, target, texImage, width, height,
                                     depth, border, internalFormat);
-         texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
-                                          internalFormat, format, type);
+         texImage->TexFormat =
+            ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
       }
    }
    else {
@@ -2471,9 +2457,8 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
                      const GLvoid *pixels )
 {
    GLsizei postConvWidth = width;
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage = NULL;
+   struct gl_texture_image *texImage;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
@@ -2499,8 +2484,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
    }
 
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
    assert(texObj);
 
    _mesa_lock_texture(ctx, texObj);
@@ -2508,23 +2492,24 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
       if (subtexture_error_check2(ctx, 1, target, level, xoffset, 0, 0,
-				  postConvWidth, 1, 1, format, type, texImage)) {
-	 goto out;   /* error was detected */
+				  postConvWidth, 1, 1,
+                                  format, type, texImage)) {
+         /* error was recorded */
       }
+      else if (width > 0) {
+         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
+         xoffset += texImage->Border;
 
-      if (width == 0)
-	 goto out;  /* no-op, not an error */
+         ASSERT(ctx->Driver.TexSubImage1D);
+         ctx->Driver.TexSubImage1D(ctx, target, level, xoffset, width,
+                                   format, type, pixels, &ctx->Unpack,
+                                   texObj, texImage);
 
-      /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-      xoffset += texImage->Border;
+         check_gen_mipmap(ctx, target, texObj, level);
 
-      ASSERT(ctx->Driver.TexSubImage1D);
-      (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
-				   format, type, pixels, &ctx->Unpack,
-				   texObj, texImage);
-      ctx->NewState |= _NEW_TEXTURE;
+         ctx->NewState |= _NEW_TEXTURE;
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2537,7 +2522,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
                      const GLvoid *pixels )
 {
    GLsizei postConvWidth = width, postConvHeight = height;
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GET_CURRENT_CONTEXT(ctx);
@@ -2566,32 +2550,32 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
       return;   /* error was detected */
    }
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
    _mesa_lock_texture(ctx, texObj);
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
       if (subtexture_error_check2(ctx, 2, target, level, xoffset, yoffset, 0,
-				  postConvWidth, postConvHeight, 1, format, type, 
-				  texImage)) {
-	 goto out;   /* error was detected */
+				  postConvWidth, postConvHeight, 1,
+                                  format, type, texImage)) {
+	 /* error was recorded */
       }
+      else if (width > 0 && height >= 0) {
+         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
+         xoffset += texImage->Border;
+         yoffset += texImage->Border;
 
-      if (width == 0 || height == 0)
-	 goto out;  /* no-op, not an error */
+         ASSERT(ctx->Driver.TexSubImage2D);
+         ctx->Driver.TexSubImage2D(ctx, target, level, xoffset, yoffset,
+                                   width, height, format, type, pixels,
+                                   &ctx->Unpack, texObj, texImage);
 
-      /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-      xoffset += texImage->Border;
-      yoffset += texImage->Border;
-      
-      ASSERT(ctx->Driver.TexSubImage2D);
-      (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset,
-				   width, height, format, type, pixels,
-				   &ctx->Unpack, texObj, texImage);
-      ctx->NewState |= _NEW_TEXTURE;
+         check_gen_mipmap(ctx, target, texObj, level);
+
+         ctx->NewState |= _NEW_TEXTURE;
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2604,7 +2588,6 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
                      GLenum format, GLenum type,
                      const GLvoid *pixels )
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GET_CURRENT_CONTEXT(ctx);
@@ -2625,35 +2608,36 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
       return;   /* error was detected */
    }
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
 
    _mesa_lock_texture(ctx, texObj);
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
-      if (subtexture_error_check2(ctx, 3, target, level, xoffset, yoffset, zoffset,
-				  width, height, depth, format, type, texImage)) {
-	 goto out;   /* error was detected */
+      if (subtexture_error_check2(ctx, 3, target, level,
+                                  xoffset, yoffset, zoffset,
+				  width, height, depth,
+                                  format, type, texImage)) {
+         /* error was recorded */
       }
+      else if (width > 0 && height > 0 && height > 0) {
+         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
+         xoffset += texImage->Border;
+         yoffset += texImage->Border;
+         zoffset += texImage->Border;
 
-      if (width == 0 || height == 0 || height == 0)
-	 goto out;  /* no-op, not an error */
+         ASSERT(ctx->Driver.TexSubImage3D);
+         ctx->Driver.TexSubImage3D(ctx, target, level,
+                                   xoffset, yoffset, zoffset,
+                                   width, height, depth,
+                                   format, type, pixels,
+                                   &ctx->Unpack, texObj, texImage );
 
-      /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-      xoffset += texImage->Border;
-      yoffset += texImage->Border;
-      zoffset += texImage->Border;
+         check_gen_mipmap(ctx, target, texObj, level);
 
-      ASSERT(ctx->Driver.TexSubImage3D);
-      (*ctx->Driver.TexSubImage3D)(ctx, target, level,
-				   xoffset, yoffset, zoffset,
-				   width, height, depth,
-				   format, type, pixels,
-				   &ctx->Unpack, texObj, texImage );
-      ctx->NewState |= _NEW_TEXTURE;
+         ctx->NewState |= _NEW_TEXTURE;
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2665,7 +2649,6 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
                       GLint x, GLint y,
                       GLsizei width, GLint border )
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GLsizei postConvWidth = width;
@@ -2692,40 +2675,48 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
                                postConvWidth, 1, border))
       return;
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
    _mesa_lock_texture(ctx, texObj);
    {
       texImage = _mesa_get_tex_image(ctx, texObj, target, level);
       if (!texImage) {
 	 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D");
-	 goto out;
       }
+      else {
+         if (texImage->Data) {
+            ctx->Driver.FreeTexImageData( ctx, texImage );
+         }
 
-      if (texImage->Data) {
-	 ctx->Driver.FreeTexImageData( ctx, texImage );
-      }
-      
-      ASSERT(texImage->Data == NULL);
+         ASSERT(texImage->Data == NULL);
+
+         clear_teximage_fields(texImage); /* not really needed, but helpful */
+         _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
+                                    border, internalFormat);
+
+         /* Choose actual texture format */
+         texImage->TexFormat =
+            ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                            GL_NONE, GL_NONE);
+         ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
 
-      clear_teximage_fields(texImage); /* not really needed, but helpful */
-      _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
-				 border, internalFormat);
+         ASSERT(ctx->Driver.CopyTexImage1D);
+         ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
+                                    x, y, width, border);
 
+         ASSERT(texImage->TexFormat);
 
-      ASSERT(ctx->Driver.CopyTexImage1D);
-      (*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat,
-				    x, y, width, border);
+         _mesa_set_fetch_functions(texImage, 1);
 
-      ASSERT(texImage->TexFormat);
+         check_gen_mipmap(ctx, target, texObj, level);
 
-      update_fbo_texture(ctx, texObj, face, level);
+         update_fbo_texture(ctx, texObj, face, level);
 
-      /* state update */
-      texObj->_Complete = GL_FALSE;
-      ctx->NewState |= _NEW_TEXTURE;
+         /* state update */
+         texObj->_Complete = GL_FALSE;
+         ctx->NewState |= _NEW_TEXTURE;
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2736,7 +2727,6 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
                       GLint x, GLint y, GLsizei width, GLsizei height,
                       GLint border )
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GLsizei postConvWidth = width, postConvHeight = height;
@@ -2764,8 +2754,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
                                postConvWidth, postConvHeight, border))
       return;
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
 
    _mesa_lock_texture(ctx, texObj);
    {
@@ -2773,33 +2762,42 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
 
       if (!texImage) {
 	 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D");
-	 goto out;
-      }
-      
-      if (texImage->Data) {
-	 ctx->Driver.FreeTexImageData( ctx, texImage );
       }
-      
-      ASSERT(texImage->Data == NULL);
+      else {
+         if (texImage->Data) {
+            ctx->Driver.FreeTexImageData( ctx, texImage );
+         }
+
+         ASSERT(texImage->Data == NULL);
+
+         clear_teximage_fields(texImage); /* not really needed, but helpful */
+         _mesa_init_teximage_fields(ctx, target, texImage,
+                                    postConvWidth, postConvHeight, 1,
+                                    border, internalFormat);
+
+         /* Choose actual texture format */
+         texImage->TexFormat =
+            ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                            GL_NONE, GL_NONE);
+         ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
+         ASSERT(ctx->Driver.CopyTexImage2D);
+         ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
+                                    x, y, width, height, border);
 
-      clear_teximage_fields(texImage); /* not really needed, but helpful */
-      _mesa_init_teximage_fields(ctx, target, texImage,
-				 postConvWidth, postConvHeight, 1,
-				 border, internalFormat);
-      
-      ASSERT(ctx->Driver.CopyTexImage2D);
-      (*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat,
-				    x, y, width, height, border);
-      
-      ASSERT(texImage->TexFormat);
+         ASSERT(texImage->TexFormat);
 
-      update_fbo_texture(ctx, texObj, face, level);
+         _mesa_set_fetch_functions(texImage, 2);
 
-      /* state update */
-      texObj->_Complete = GL_FALSE;
-      ctx->NewState |= _NEW_TEXTURE;
+         check_gen_mipmap(ctx, target, texObj, level);
+
+         update_fbo_texture(ctx, texObj, face, level);
+
+         /* state update */
+         texObj->_Complete = GL_FALSE;
+         ctx->NewState |= _NEW_TEXTURE;
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2808,7 +2806,6 @@ void GLAPIENTRY
 _mesa_CopyTexSubImage1D( GLenum target, GLint level,
                          GLint xoffset, GLint x, GLint y, GLsizei width )
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GLsizei postConvWidth = width;
@@ -2829,8 +2826,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
    if (copytexsubimage_error_check1(ctx, 1, target, level))
       return;
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
 
    _mesa_lock_texture(ctx, texObj);
    {
@@ -2844,23 +2840,25 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
 
       if (copytexsubimage_error_check2(ctx, 1, target, level,
 				       xoffset, 0, 0, postConvWidth, 1,
-				       texImage))
-	 goto out;
-      
+				       texImage)) {
+         /* error was recorded */
+      }
+      else {
+         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
+         xoffset += texImage->Border;
 
-      /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-      xoffset += texImage->Border;
+         if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
+                                        &width, &height)) {
+            ASSERT(ctx->Driver.CopyTexSubImage1D);
+            ctx->Driver.CopyTexSubImage1D(ctx, target, level,
+                                          xoffset, x, y, width);
 
-      if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
-                                     &width, &height)) {
-         ASSERT(ctx->Driver.CopyTexSubImage1D);
-         ctx->Driver.CopyTexSubImage1D(ctx, target, level,
-                                       xoffset, x, y, width);
-      }
+            check_gen_mipmap(ctx, target, texObj, level);
 
-      ctx->NewState |= _NEW_TEXTURE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2871,7 +2869,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
                          GLint xoffset, GLint yoffset,
                          GLint x, GLint y, GLsizei width, GLsizei height )
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GLsizei postConvWidth = width, postConvHeight = height;
@@ -2889,8 +2886,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
    if (copytexsubimage_error_check1(ctx, 2, target, level))
       return;
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
 
    _mesa_lock_texture(ctx, texObj);
    {
@@ -2903,24 +2899,29 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
       }
 #endif
 
-      if (copytexsubimage_error_check2(ctx, 2, target, level, xoffset, yoffset, 0,
-				       postConvWidth, postConvHeight, texImage))
-	 goto out;
+      if (copytexsubimage_error_check2(ctx, 2, target, level,
+                                       xoffset, yoffset, 0,
+				       postConvWidth, postConvHeight,
+                                       texImage)) {
+         /* error was recorded */
+      }
+      else {
+         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
+         xoffset += texImage->Border;
+         yoffset += texImage->Border;
 
-      /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-      xoffset += texImage->Border;
-      yoffset += texImage->Border;
+         if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
+                                        &width, &height)) {
+            ASSERT(ctx->Driver.CopyTexSubImage2D);
+            ctx->Driver.CopyTexSubImage2D(ctx, target, level, xoffset, yoffset,
+                                          x, y, width, height);
 
-      if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
-                                     &width, &height)) {
-         ASSERT(ctx->Driver.CopyTexSubImage2D);
-         ctx->Driver.CopyTexSubImage2D(ctx, target, level,
-				       xoffset, yoffset, x, y, width, height);
-      }
+            check_gen_mipmap(ctx, target, texObj, level);
 
-      ctx->NewState |= _NEW_TEXTURE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2931,7 +2932,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
                          GLint xoffset, GLint yoffset, GLint zoffset,
                          GLint x, GLint y, GLsizei width, GLsizei height )
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GLsizei postConvWidth = width, postConvHeight = height;
@@ -2949,8 +2949,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
    if (copytexsubimage_error_check1(ctx, 3, target, level))
       return;
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
 
    _mesa_lock_texture(ctx, texObj);
    {
@@ -2965,25 +2964,28 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
 
       if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset,
 				       zoffset, postConvWidth, postConvHeight,
-				       texImage))
-	 goto out;
-
-      /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-      xoffset += texImage->Border;
-      yoffset += texImage->Border;
-      zoffset += texImage->Border;
-      
-      if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
-                                     &width, &height)) {
-         ASSERT(ctx->Driver.CopyTexSubImage3D);
-         ctx->Driver.CopyTexSubImage3D(ctx, target, level,
-				       xoffset, yoffset, zoffset,
-				       x, y, width, height);
+				       texImage)) {
+         /* error was recored */
       }
+      else {
+         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
+         xoffset += texImage->Border;
+         yoffset += texImage->Border;
+         zoffset += texImage->Border;
+
+         if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
+                                        &width, &height)) {
+            ASSERT(ctx->Driver.CopyTexSubImage3D);
+            ctx->Driver.CopyTexSubImage3D(ctx, target, level,
+                                          xoffset, yoffset, zoffset,
+                                          x, y, width, height);
+
+            check_gen_mipmap(ctx, target, texObj, level);
 
-      ctx->NewState |= _NEW_TEXTURE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
@@ -2995,6 +2997,29 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
 /**********************************************************************/
 
 
+/**
+ * Return expected size of a compressed texture.
+ */
+static GLuint
+compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth,
+                    GLenum glformat)
+{
+   gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
+   return _mesa_format_image_size(mesaFormat, width, height, depth);
+}
+
+
+/*
+ * Return compressed texture block size, in pixels.
+ */
+static void
+get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
+{
+   gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
+   _mesa_get_format_block_size(mesaFormat, bw, bh);
+}
+
+
 /**
  * Error checking for glCompressedTexImage[123]D().
  * \return error code or GL_NO_ERROR.
@@ -3077,8 +3102,7 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
    if (level < 0 || level >= maxLevels)
       return GL_INVALID_VALUE;
 
-   expectedSize = _mesa_compressed_texture_size_glenum(ctx, width, height,
-                                                       depth, internalFormat);
+   expectedSize = compressed_tex_size(width, height, depth, internalFormat);
    if (expectedSize != imageSize)
       return GL_INVALID_VALUE;
 
@@ -3111,6 +3135,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
                                   GLenum format, GLsizei imageSize)
 {
    GLint expectedSize, maxLevels = 0, maxTextureSize;
+   GLuint bw, bh;
    (void) zoffset;
 
    if (dimensions == 1) {
@@ -3160,20 +3185,21 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
    if (level < 0 || level >= maxLevels)
       return GL_INVALID_VALUE;
 
-   /* XXX these tests are specific to the compressed format.
-    * this code should be generalized in some way.
+   /*
+    * do checks which depend on compression block size
     */
-   if ((xoffset & 3) != 0 || (yoffset & 3) != 0)
+   get_compressed_block_size(format, &bw, &bh);
+
+   if ((xoffset % bw != 0) || (yoffset % bh != 0))
       return GL_INVALID_VALUE;
 
-   if ((width & 3) != 0 && width != 2 && width != 1)
+   if ((width % bw != 0) && width != 2 && width != 1)
       return GL_INVALID_VALUE;
 
-   if ((height & 3) != 0 && height != 2 && height != 1)
+   if ((height % bh != 0) && height != 2 && height != 1)
       return GL_INVALID_VALUE;
 
-   expectedSize = _mesa_compressed_texture_size_glenum(ctx, width, height,
-                                                       depth, format);
+   expectedSize = compressed_tex_size(width, height, depth, format);
    if (expectedSize != imageSize)
       return GL_INVALID_VALUE;
 
@@ -3181,6 +3207,55 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
 }
 
 
+/**
+ * Do second part of glCompressedTexSubImage error checking.
+ * \return GL_TRUE if error found, GL_FALSE otherwise.
+ */
+static GLboolean
+compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims,
+                                   GLsizei width, GLsizei height,
+                                   GLsizei depth, GLenum format,
+                                   struct gl_texture_image *texImage)
+{
+
+   if ((GLint) format != texImage->InternalFormat) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCompressedTexSubImage%uD(format=0x%x)", dims, format);
+      return GL_TRUE;
+   }
+
+   if (((width == 1 || width == 2) &&
+        (GLuint) width != texImage->Width) ||
+       (width > texImage->Width)) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCompressedTexSubImage%uD(width=%d)", dims, width);
+      return GL_TRUE;
+   }
+
+   if (dims >= 2) {
+      if (((height == 1 || height == 2) &&
+           (GLuint) height != texImage->Height) ||
+          (height > texImage->Height)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCompressedTexSubImage%uD(height=%d)", dims, height);
+         return GL_TRUE;
+      }
+   }
+
+   if (dims >= 3) {
+      if (((depth == 1 || depth == 2) &&
+           (GLuint) depth != texImage->Depth) ||
+          (depth > texImage->Depth)) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glCompressedTexSubImage%uD(depth=%d)", dims, depth);
+         return GL_TRUE;
+      }
+   }
+
+   return GL_FALSE;
+}
+
+
 
 void GLAPIENTRY
 _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
@@ -3199,7 +3274,6 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
 
    if (target == GL_TEXTURE_1D) {
       /* non-proxy target */
-      struct gl_texture_unit *texUnit;
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
       GLenum error = compressed_texture_error_check(ctx, 1, target, level,
@@ -3209,36 +3283,44 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
          return;
       }
 
-      texUnit = _mesa_get_current_tex_unit(ctx);
-      texObj = _mesa_select_tex_object(ctx, texUnit, target);
+      texObj = _mesa_get_current_tex_object(ctx, target);
 
       _mesa_lock_texture(ctx, texObj);
       {
 	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
 	 if (!texImage) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D");
-	    goto out;
-	 }
-	 
-	 if (texImage->Data) {
-	    ctx->Driver.FreeTexImageData( ctx, texImage );
 	 }
-	 ASSERT(texImage->Data == NULL);
+         else {
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+            ASSERT(texImage->Data == NULL);
+
+            _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
+                                       border, internalFormat);
+
+            /* Choose actual texture format */
+            texImage->TexFormat =
+               ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                               GL_NONE, GL_NONE);
+            ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
 
-	 _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
-				    border, internalFormat);
+            ASSERT(ctx->Driver.CompressedTexImage1D);
+            ctx->Driver.CompressedTexImage1D(ctx, target, level,
+                                             internalFormat, width, border,
+                                             imageSize, data,
+                                             texObj, texImage);
 
-	 ASSERT(ctx->Driver.CompressedTexImage1D);
-	 (*ctx->Driver.CompressedTexImage1D)(ctx, target, level,
-					     internalFormat, width, border,
-					     imageSize, data,
-					     texObj, texImage);
+            _mesa_set_fetch_functions(texImage, 1);
 
-	 /* state update */
-	 texObj->_Complete = GL_FALSE;
-	 ctx->NewState |= _NEW_TEXTURE;
+            check_gen_mipmap(ctx, target, texObj, level);
+
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
       }
-   out:
       _mesa_unlock_texture(ctx, texObj);
    }
    else if (target == GL_PROXY_TEXTURE_1D) {
@@ -3260,11 +3342,10 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
       }
       else {
          /* store the teximage parameters */
-         struct gl_texture_unit *texUnit;
          struct gl_texture_object *texObj;
          struct gl_texture_image *texImage;
-         texUnit = _mesa_get_current_tex_unit(ctx);
-	 texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
+         texObj = _mesa_get_current_tex_object(ctx, target);
 
 	 _mesa_lock_texture(ctx, texObj);
 	 {
@@ -3302,9 +3383,9 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
         target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
         target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
       /* non-proxy target */
-      struct gl_texture_unit *texUnit;
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
+
       GLenum error = compressed_texture_error_check(ctx, 2, target, level,
                           internalFormat, width, height, 1, border, imageSize);
       if (error) {
@@ -3312,36 +3393,44 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
          return;
       }
 
-      texUnit = _mesa_get_current_tex_unit(ctx);
-      texObj = _mesa_select_tex_object(ctx, texUnit, target);
+      texObj = _mesa_get_current_tex_object(ctx, target);
 
       _mesa_lock_texture(ctx, texObj);
       {
 	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
 	 if (!texImage) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
-	    goto out;
 	 }
-	 
-	 if (texImage->Data) {
-	    ctx->Driver.FreeTexImageData( ctx, texImage );
-	 }
-	 ASSERT(texImage->Data == NULL);
-
-	 _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
-				    border, internalFormat);
-
-	 ASSERT(ctx->Driver.CompressedTexImage2D);
-	 (*ctx->Driver.CompressedTexImage2D)(ctx, target, level,
-					     internalFormat, width, height,
-					     border, imageSize, data,
-					     texObj, texImage);
-	 
-	 /* state update */
-	 texObj->_Complete = GL_FALSE;
-	 ctx->NewState |= _NEW_TEXTURE;
-      }
-   out:
+         else {
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+            ASSERT(texImage->Data == NULL);
+
+            _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
+                                       border, internalFormat);
+
+            /* Choose actual texture format */
+            texImage->TexFormat =
+               ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                               GL_NONE, GL_NONE);
+            ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
+            ASSERT(ctx->Driver.CompressedTexImage2D);
+            ctx->Driver.CompressedTexImage2D(ctx, target, level,
+                                             internalFormat, width, height,
+                                             border, imageSize, data,
+                                             texObj, texImage);
+
+            _mesa_set_fetch_functions(texImage, 2);
+
+            check_gen_mipmap(ctx, target, texObj, level);
+
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
       _mesa_unlock_texture(ctx, texObj);
    }
    else if (target == GL_PROXY_TEXTURE_2D ||
@@ -3365,11 +3454,10 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
       }
       else {
          /* store the teximage parameters */
-         struct gl_texture_unit *texUnit;
          struct gl_texture_object *texObj;
          struct gl_texture_image *texImage;
-         texUnit = _mesa_get_current_tex_unit(ctx);
-	 texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
+         texObj = _mesa_get_current_tex_object(ctx, target);
 
 	 _mesa_lock_texture(ctx, texObj);
 	 {
@@ -3404,7 +3492,6 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
 
    if (target == GL_TEXTURE_3D) {
       /* non-proxy target */
-      struct gl_texture_unit *texUnit;
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
       GLenum error = compressed_texture_error_check(ctx, 3, target, level,
@@ -3414,36 +3501,46 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
          return;
       }
 
-      texUnit = _mesa_get_current_tex_unit(ctx);
-      texObj = _mesa_select_tex_object(ctx, texUnit, target);
+      texObj = _mesa_get_current_tex_object(ctx, target);
+
       _mesa_lock_texture(ctx, texObj);
       {
 	 texImage = _mesa_get_tex_image(ctx, texObj, target, level);
 	 if (!texImage) {
 	    _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D");
-	    goto out;
-	 }
-	 
-	 if (texImage->Data) {
-	    ctx->Driver.FreeTexImageData( ctx, texImage );
 	 }
-	 ASSERT(texImage->Data == NULL);
-
-	 _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth,
-				    border, internalFormat);
-
-	 ASSERT(ctx->Driver.CompressedTexImage3D);
-	 (*ctx->Driver.CompressedTexImage3D)(ctx, target, level,
-					     internalFormat,
-					     width, height, depth,
-					     border, imageSize, data,
-					     texObj, texImage);
-	 
-	 /* state update */
-	 texObj->_Complete = GL_FALSE;
-	 ctx->NewState |= _NEW_TEXTURE;
-      }
-   out:
+         else {
+            if (texImage->Data) {
+               ctx->Driver.FreeTexImageData( ctx, texImage );
+            }
+            ASSERT(texImage->Data == NULL);
+
+            _mesa_init_teximage_fields(ctx, target, texImage,
+                                       width, height, depth,
+                                       border, internalFormat);
+
+            /* Choose actual texture format */
+            texImage->TexFormat =
+               ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                               GL_NONE, GL_NONE);
+            ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
+            ASSERT(ctx->Driver.CompressedTexImage3D);
+            ctx->Driver.CompressedTexImage3D(ctx, target, level,
+                                             internalFormat,
+                                             width, height, depth,
+                                             border, imageSize, data,
+                                             texObj, texImage);
+
+            _mesa_set_fetch_functions(texImage, 3);
+
+            check_gen_mipmap(ctx, target, texObj, level);
+
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+      }
       _mesa_unlock_texture(ctx, texObj);
    }
    else if (target == GL_PROXY_TEXTURE_3D) {
@@ -3465,11 +3562,11 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
       }
       else {
          /* store the teximage parameters */
-         struct gl_texture_unit *texUnit;
          struct gl_texture_object *texObj;
          struct gl_texture_image *texImage;
-         texUnit = _mesa_get_current_tex_unit(ctx);
-	 texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
+         texObj = _mesa_get_current_tex_object(ctx, target);
+
 	 _mesa_lock_texture(ctx, texObj);
 	 {
 	    texImage = _mesa_select_tex_image(ctx, texObj, target, level);
@@ -3486,116 +3583,100 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
 }
 
 
-void GLAPIENTRY
-_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
-                                 GLsizei width, GLenum format,
-                                 GLsizei imageSize, const GLvoid *data)
+/**
+ * Common helper for glCompressedTexSubImage1/2/3D().
+ */
+static void
+compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
+                         GLint xoffset, GLint yoffset, GLint zoffset,
+                         GLsizei width, GLsizei height, GLsizei depth,
+                         GLenum format, GLsizei imageSize, const GLvoid *data)
 {
-   struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    GLenum error;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   error = compressed_subtexture_error_check(ctx, 1, target, level,
+   error = compressed_subtexture_error_check(ctx, dims, target, level,
                                              xoffset, 0, 0, /* pos */
-                                             width, 1, 1,   /* size */
+                                             width, height, depth,   /* size */
                                              format, imageSize);
    if (error) {
-      _mesa_error(ctx, error, "glCompressedTexSubImage1D");
+      _mesa_error(ctx, error, "glCompressedTexSubImage%uD", dims);
       return;
    }
 
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
+   texObj = _mesa_get_current_tex_object(ctx, target);
+
    _mesa_lock_texture(ctx, texObj);
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
       assert(texImage);
 
-      if ((GLint) format != texImage->InternalFormat) {
-	 _mesa_error(ctx, GL_INVALID_OPERATION,
-		     "glCompressedTexSubImage1D(format)");
-	 goto out;
-      }
+      if (compressed_subtexture_error_check2(ctx, dims, width, height, depth,
+                                             format, texImage)) {
+         /* error was recorded */
+      }
+      else if (width > 0 && height > 0 && depth > 0) {
+         switch (dims) {
+         case 1:
+            if (ctx->Driver.CompressedTexSubImage1D) {
+               ctx->Driver.CompressedTexSubImage1D(ctx, target, level,
+                                                   xoffset, width,
+                                                   format, imageSize, data,
+                                                   texObj, texImage);
+            }
+            break;
+         case 2:
+            if (ctx->Driver.CompressedTexSubImage2D) {
+               ctx->Driver.CompressedTexSubImage2D(ctx, target, level,
+                                                   xoffset, yoffset,
+                                                   width, height,
+                                                   format, imageSize, data,
+                                                   texObj, texImage);
+            }
+            break;
+         case 3:
+            if (ctx->Driver.CompressedTexSubImage3D) {
+               ctx->Driver.CompressedTexSubImage3D(ctx, target, level,
+                                                   xoffset, yoffset, zoffset,
+                                                   width, height, depth,
+                                                   format, imageSize, data,
+                                                   texObj, texImage);
+            }
+            break;
+         default:
+            ;
+         }
 
-      if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) {
-	 _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)");
-	 goto out;
-      }
-      
-      if (width == 0)
-	 goto out;  /* no-op, not an error */
+         check_gen_mipmap(ctx, target, texObj, level);
 
-      if (ctx->Driver.CompressedTexSubImage1D) {
-	 (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level,
-						xoffset, width,
-						format, imageSize, data,
-						texObj, texImage);
+         ctx->NewState |= _NEW_TEXTURE;
       }
-      ctx->NewState |= _NEW_TEXTURE;
    }
- out:
    _mesa_unlock_texture(ctx, texObj);
 }
 
 
+void GLAPIENTRY
+_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
+                                 GLsizei width, GLenum format,
+                                 GLsizei imageSize, const GLvoid *data)
+{
+   compressed_tex_sub_image(1, target, level, xoffset, 0, 0, width, 1, 1,
+                            format, imageSize, data);
+}
+
+
 void GLAPIENTRY
 _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
                                  GLint yoffset, GLsizei width, GLsizei height,
                                  GLenum format, GLsizei imageSize,
                                  const GLvoid *data)
 {
-   struct gl_texture_unit *texUnit;
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GLenum error;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   error = compressed_subtexture_error_check(ctx, 2, target, level,
-                                             xoffset, yoffset, 0, /* pos */
-                                             width, height, 1,    /* size */
-                                             format, imageSize);
-   if (error) {
-      /* XXX proxy target? */
-      _mesa_error(ctx, error, "glCompressedTexSubImage2D");
-      return;
-   }
-
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-      assert(texImage);
-
-      if ((GLint) format != texImage->InternalFormat) {
-	 _mesa_error(ctx, GL_INVALID_OPERATION,
-		     "glCompressedTexSubImage2D(format)");
-	 goto out;
-      }
-
-      if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) ||
-	  ((height == 1 || height == 2) && (GLuint) height != texImage->Height)) {
-	 _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)");
-	 goto out;
-      }
-      
-      if (width == 0 || height == 0)
-	 goto out;  /* no-op, not an error */
-
-      if (ctx->Driver.CompressedTexSubImage2D) {
-	 (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level,
-						xoffset, yoffset, width, height,
-						format, imageSize, data,
-						texObj, texImage);
-      }
-      ctx->NewState |= _NEW_TEXTURE;
-   }
- out:
-   _mesa_unlock_texture(ctx, texObj);
+   compressed_tex_sub_image(2, target, level, xoffset, yoffset, 0,
+                            width, height, 1, format, imageSize, data);
 }
 
 
@@ -3605,56 +3686,8 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
                                  GLsizei height, GLsizei depth, GLenum format,
                                  GLsizei imageSize, const GLvoid *data)
 {
-   struct gl_texture_unit *texUnit;
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GLenum error;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   error = compressed_subtexture_error_check(ctx, 3, target, level,
-                                             xoffset, yoffset, zoffset,/*pos*/
-                                             width, height, depth, /*size*/
-                                             format, imageSize);
-   if (error) {
-      _mesa_error(ctx, error, "glCompressedTexSubImage3D");
-      return;
-   }
-
-   texUnit = _mesa_get_current_tex_unit(ctx);
-   texObj = _mesa_select_tex_object(ctx, texUnit, target);
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-      assert(texImage);
-
-      if ((GLint) format != texImage->InternalFormat) {
-	 _mesa_error(ctx, GL_INVALID_OPERATION,
-		     "glCompressedTexSubImage3D(format)");
-	 goto out;
-      }
-
-      if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) ||
-	  ((height == 1 || height == 2) && (GLuint) height != texImage->Height) ||
-	  ((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) {
-	 _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)");
-	 goto out;
-      }
-      
-      if (width == 0 || height == 0 || depth == 0)
-	 goto out;  /* no-op, not an error */
-
-      if (ctx->Driver.CompressedTexSubImage3D) {
-	 (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level,
-						xoffset, yoffset, zoffset,
-						width, height, depth,
-						format, imageSize, data,
-						texObj, texImage);
-      }
-      ctx->NewState |= _NEW_TEXTURE;
-   }
- out:
-   _mesa_unlock_texture(ctx, texObj);
+   compressed_tex_sub_image(3, target, level, xoffset, yoffset, zoffset,
+                            width, height, depth, format, imageSize, data);
 }
 
 
diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h
index 094177da7..97c901831 100644
--- a/mesalib/src/mesa/main/teximage.h
+++ b/mesalib/src/mesa/main/teximage.h
@@ -86,6 +86,9 @@ extern struct gl_texture_object *
 _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
                         GLenum target);
 
+extern struct gl_texture_object *
+_mesa_get_current_tex_object(GLcontext *ctx, GLenum target);
+
 
 extern struct gl_texture_image *
 _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj,
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index da55ac869..237b6eb00 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -29,12 +29,11 @@
 
 
 #include "mfeatures.h"
-#if FEATURE_colortable
 #include "colortab.h"
-#endif
 #include "context.h"
 #include "enums.h"
 #include "fbobject.h"
+#include "formats.h"
 #include "hash.h"
 #include "imports.h"
 #include "macros.h"
@@ -194,9 +193,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
     */
    texObj->Target = 0x99;
 
-#if FEATURE_colortable
    _mesa_free_colortable_data(&texObj->Palette);
-#endif
 
    /* free the texture images */
    for (face = 0; face < 6; face++) {
@@ -418,7 +415,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
    /* Detect cases where the application set the base level to an invalid
     * value.
     */
-   if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) {
+   if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) {
       char s[100];
       _mesa_sprintf(s, "base level = %d is invalid", baseLevel);
       incomplete(t, s);
@@ -495,7 +492,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
 	     t->Image[face][baseLevel]->Width2 != w ||
 	     t->Image[face][baseLevel]->Height2 != h) {
 	    t->_Complete = GL_FALSE;
-	    incomplete(t, "Non-quare cubemap image");
+	    incomplete(t, "Cube face missing or mismatched size");
 	    return;
 	 }
       }
@@ -744,6 +741,10 @@ _mesa_get_fallback_texture(GLcontext *ctx)
       _mesa_init_teximage_fields(ctx, GL_TEXTURE_2D, texImage,
                                     8, 8, 1, 0, GL_RGBA); 
 
+      texImage->TexFormat =
+         ctx->Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
+      ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
+
       /* set image data */
       ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA,
                              8, 8, 0,
@@ -1102,8 +1103,6 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
          struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]);
          if (t) {
             t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
-	    if (ctx->Driver.PrioritizeTexture)
-	       ctx->Driver.PrioritizeTexture( ctx, t, t->Priority );
          }
       }
    }
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 9d1fdd056..db4c7a5ed 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -31,9 +31,10 @@
 
 
 #include "main/glheader.h"
+#include "main/colormac.h"
 #include "main/context.h"
 #include "main/enums.h"
-#include "main/colormac.h"
+#include "main/formats.h"
 #include "main/macros.h"
 #include "main/texcompress.h"
 #include "main/texparam.h"
@@ -78,6 +79,8 @@ validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap)
 /**
  * Get current texture object for given target.
  * Return NULL if any error.
+ * Note that this is different from _mesa_select_tex_object() in that proxy
+ * targets are not accepted.
  */
 static struct gl_texture_object *
 get_texobj(GLcontext *ctx, GLenum target)
@@ -544,13 +547,20 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
    case GL_DEPTH_TEXTURE_MODE_ARB:
       {
          /* convert float param to int */
-         GLint p = (GLint) param;
-         need_update = set_tex_parameteri(ctx, texObj, pname, &p);
+         GLint p[4];
+         p[0] = (GLint) param;
+         p[1] = p[2] = p[3] = 0;
+         need_update = set_tex_parameteri(ctx, texObj, pname, p);
       }
       break;
    default:
-      /* this will generate an error if pname is illegal */
-      need_update = set_tex_parameterf(ctx, texObj, pname, &param);
+      {
+         /* this will generate an error if pname is illegal */
+         GLfloat p[4];
+         p[0] = param;
+         p[1] = p[2] = p[3] = 0.0F;
+         need_update = set_tex_parameterf(ctx, texObj, pname, p);
+      }
    }
 
    if (ctx->Driver.TexParameter && need_update) {
@@ -585,8 +595,10 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
    case GL_DEPTH_TEXTURE_MODE_ARB:
       {
          /* convert float param to int */
-         GLint p = (GLint) params[0];
-         need_update = set_tex_parameteri(ctx, texObj, pname, &p);
+         GLint p[4];
+         p[0] = (GLint) params[0];
+         p[1] = p[2] = p[3] = 0;
+         need_update = set_tex_parameteri(ctx, texObj, pname, p);
       }
       break;
 
@@ -599,7 +611,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
          iparams[1] = (GLint) params[1];
          iparams[2] = (GLint) params[2];
          iparams[3] = (GLint) params[3];
-         need_update = set_tex_parameteri(ctx, target, iparams);
+         need_update = set_tex_parameteri(ctx, texObj, pname, iparams);
       }
       break;
 #endif
@@ -635,14 +647,21 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
    case GL_TEXTURE_LOD_BIAS:
    case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
       {
-         GLfloat fparam = (GLfloat) param;
+         GLfloat fparam[4];
+         fparam[0] = (GLfloat) param;
+         fparam[1] = fparam[2] = fparam[3] = 0.0F;
          /* convert int param to float */
-         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
+         need_update = set_tex_parameterf(ctx, texObj, pname, fparam);
       }
       break;
    default:
       /* this will generate an error if pname is illegal */
-      need_update = set_tex_parameteri(ctx, texObj, pname, &param);
+      {
+         GLint iparam[4];
+         iparam[0] = param;
+         iparam[1] = iparam[2] = iparam[3] = 0;
+         need_update = set_tex_parameteri(ctx, texObj, pname, iparam);
+      }
    }
 
    if (ctx->Driver.TexParameter && need_update) {
@@ -684,8 +703,10 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
    case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
       {
          /* convert int param to float */
-         GLfloat fparam = (GLfloat) params[0];
-         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
+         GLfloat fparams[4];
+         fparams[0] = (GLfloat) params[0];
+         fparams[1] = fparams[2] = fparams[3] = 0.0F;
+         need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
       }
       break;
    default:
@@ -726,6 +747,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
    const struct gl_texture_image *img = NULL;
    GLboolean isProxy;
    GLint maxLevels;
+   gl_format texFormat;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -763,6 +785,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
       goto out;
    }
 
+   texFormat = img->TexFormat;
+
    isProxy = _mesa_is_proxy_texture(target);
 
    switch (pname) {
@@ -776,10 +800,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          *params = img->Depth;
          break;
       case GL_TEXTURE_INTERNAL_FORMAT:
-         if (img->IsCompressed) {
+         if (_mesa_is_format_compressed(img->TexFormat)) {
             /* need to return the actual compressed format */
-            *params = _mesa_compressed_format_to_glenum(ctx,
-                                          img->TexFormat->MesaFormat);
+            *params = _mesa_compressed_format_to_glenum(ctx, img->TexFormat);
          }
          else {
             /* return the user's requested internal format */
@@ -790,20 +813,10 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          *params = img->Border;
          break;
       case GL_TEXTURE_RED_SIZE:
-         if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
-            *params = img->TexFormat->RedBits;
-         else
-            *params = 0;
-         break;
       case GL_TEXTURE_GREEN_SIZE:
-         if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
-            *params = img->TexFormat->GreenBits;
-         else
-            *params = 0;
-         break;
       case GL_TEXTURE_BLUE_SIZE:
          if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
-            *params = img->TexFormat->BlueBits;
+            *params = _mesa_get_format_bits(texFormat, pname);
          else
             *params = 0;
          break;
@@ -811,36 +824,44 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          if (img->_BaseFormat == GL_ALPHA ||
              img->_BaseFormat == GL_LUMINANCE_ALPHA ||
              img->_BaseFormat == GL_RGBA)
-            *params = img->TexFormat->AlphaBits;
+            *params = _mesa_get_format_bits(texFormat, pname);
          else
             *params = 0;
          break;
       case GL_TEXTURE_INTENSITY_SIZE:
          if (img->_BaseFormat != GL_INTENSITY)
             *params = 0;
-         else if (img->TexFormat->IntensityBits > 0)
-            *params = img->TexFormat->IntensityBits;
-         else /* intensity probably stored as rgb texture */
-            *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
+         else {
+            *params = _mesa_get_format_bits(texFormat, pname);
+            if (*params == 0) {
+               /* intensity probably stored as rgb texture */
+               *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE),
+                              _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE));
+            }
+         }
          break;
       case GL_TEXTURE_LUMINANCE_SIZE:
          if (img->_BaseFormat != GL_LUMINANCE &&
              img->_BaseFormat != GL_LUMINANCE_ALPHA)
             *params = 0;
-         else if (img->TexFormat->LuminanceBits > 0)
-            *params = img->TexFormat->LuminanceBits;
-         else /* luminance probably stored as rgb texture */
-            *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
+         else {
+            *params = _mesa_get_format_bits(texFormat, pname);
+            if (*params == 0) {
+               /* luminance probably stored as rgb texture */
+               *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE),
+                              _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE));
+            }
+         }
          break;
       case GL_TEXTURE_INDEX_SIZE_EXT:
          if (img->_BaseFormat == GL_COLOR_INDEX)
-            *params = img->TexFormat->IndexBits;
+            *params = _mesa_get_format_bits(texFormat, pname);
          else
             *params = 0;
          break;
       case GL_TEXTURE_DEPTH_SIZE_ARB:
          if (ctx->Extensions.ARB_depth_texture)
-            *params = img->TexFormat->DepthBits;
+            *params = _mesa_get_format_bits(texFormat, pname);
          else
             _mesa_error(ctx, GL_INVALID_ENUM,
                         "glGetTexLevelParameter[if]v(pname)");
@@ -848,7 +869,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
       case GL_TEXTURE_STENCIL_SIZE_EXT:
          if (ctx->Extensions.EXT_packed_depth_stencil ||
              ctx->Extensions.ARB_framebuffer_object) {
-            *params = img->TexFormat->StencilBits;
+            *params = _mesa_get_format_bits(texFormat, pname);
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -858,13 +879,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
 
       /* GL_ARB_texture_compression */
       case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
-	 if (img->IsCompressed && !isProxy) {
-	    /* Don't use ctx->Driver.CompressedTextureSize() since that
-	     * may returned a padded hardware size.
-	     */
-	    *params = _mesa_compressed_texture_size(ctx, img->Width,
-						    img->Height, img->Depth,
-						    img->TexFormat->MesaFormat);
+	 if (_mesa_is_format_compressed(img->TexFormat) && !isProxy) {
+            *params = _mesa_format_image_size(texFormat, img->Width,
+                                              img->Height, img->Depth);
 	 }
 	 else {
 	    _mesa_error(ctx, GL_INVALID_OPERATION,
@@ -872,13 +889,14 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
 	 }
          break;
       case GL_TEXTURE_COMPRESSED:
-         *params = (GLint) img->IsCompressed;
+         *params = (GLint) _mesa_is_format_compressed(img->TexFormat);
          break;
 
       /* GL_ARB_texture_float */
       case GL_TEXTURE_RED_TYPE_ARB:
          if (ctx->Extensions.ARB_texture_float) {
-            *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE;
+            *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE) ?
+               _mesa_get_format_datatype(texFormat) : GL_NONE;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -887,7 +905,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          break;
       case GL_TEXTURE_GREEN_TYPE_ARB:
          if (ctx->Extensions.ARB_texture_float) {
-            *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE;
+            *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE) ?
+               _mesa_get_format_datatype(texFormat) : GL_NONE;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -896,7 +915,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          break;
       case GL_TEXTURE_BLUE_TYPE_ARB:
          if (ctx->Extensions.ARB_texture_float) {
-            *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE;
+            *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE) ?
+               _mesa_get_format_datatype(texFormat) : GL_NONE;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -905,7 +925,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          break;
       case GL_TEXTURE_ALPHA_TYPE_ARB:
          if (ctx->Extensions.ARB_texture_float) {
-            *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE;
+            *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE) ?
+               _mesa_get_format_datatype(texFormat) : GL_NONE;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -914,7 +935,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          break;
       case GL_TEXTURE_LUMINANCE_TYPE_ARB:
          if (ctx->Extensions.ARB_texture_float) {
-            *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE;
+            *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_LUMINANCE_SIZE) ?
+               _mesa_get_format_datatype(texFormat) : GL_NONE;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -923,7 +945,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          break;
       case GL_TEXTURE_INTENSITY_TYPE_ARB:
          if (ctx->Extensions.ARB_texture_float) {
-            *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE;
+            *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_INTENSITY_SIZE) ?
+               _mesa_get_format_datatype(texFormat) : GL_NONE;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -932,7 +955,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          break;
       case GL_TEXTURE_DEPTH_TYPE_ARB:
          if (ctx->Extensions.ARB_texture_float) {
-            *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE;
+            *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE) ?
+               _mesa_get_format_datatype(texFormat) : GL_NONE;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
diff --git a/mesalib/src/mesa/main/texrender.c b/mesalib/src/mesa/main/texrender.c
index 53be83b05..e2432be6c 100644
--- a/mesalib/src/mesa/main/texrender.c
+++ b/mesalib/src/mesa/main/texrender.c
@@ -1,7 +1,8 @@
 
 #include "context.h"
+#include "colormac.h"
 #include "fbobject.h"
-#include "texformat.h"
+#include "texfetch.h"
 #include "texrender.h"
 #include "renderbuffer.h"
 
@@ -46,7 +47,9 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    if (rb->DataType == CHAN_TYPE) {
       GLchan *rgbaOut = (GLchan *) values;
       for (i = 0; i < count; i++) {
-         trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i);
+         GLfloat rgba[4];
+         trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, rgba);
+         UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
       }
    }
    else if (rb->DataType == GL_UNSIGNED_SHORT) {
@@ -100,8 +103,10 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
    if (rb->DataType == CHAN_TYPE) {
       GLchan *rgbaOut = (GLchan *) values;
       for (i = 0; i < count; i++) {
-         trb->TexImage->FetchTexelc(trb->TexImage, x[i], y[i] + trb->Yoffset,
-				    z, rgbaOut + 4 * i);
+         GLfloat rgba[4];
+         trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+				    z, rgba);
+         UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
       }
    }
    else if (rb->DataType == GL_UNSIGNED_SHORT) {
@@ -462,6 +467,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
 {
    struct texture_renderbuffer *trb
       = (struct texture_renderbuffer *) att->Renderbuffer;
+   gl_format texFormat;
 
    (void) ctx;
    ASSERT(trb);
@@ -469,7 +475,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
    trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
    ASSERT(trb->TexImage);
 
-   trb->Store = trb->TexImage->TexFormat->StoreTexel;
+   trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat);
    if (!trb->Store) {
       /* we'll never draw into some textures (compressed formats) */
       trb->Store = store_nop;
@@ -484,41 +490,30 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
       trb->Zoffset = att->Zoffset;
    }
 
+   texFormat = trb->TexImage->TexFormat;
+
    trb->Base.Width = trb->TexImage->Width;
    trb->Base.Height = trb->TexImage->Height;
    trb->Base.InternalFormat = trb->TexImage->InternalFormat;
    /* XXX may need more special cases here */
-   if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8) {
-      trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
+   if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) {
+      trb->Base.Format = MESA_FORMAT_Z24_S8;
       trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
    }
-   else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z16) {
-      trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
+   else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) {
+      trb->Base.Format = MESA_FORMAT_Z16;
       trb->Base.DataType = GL_UNSIGNED_SHORT;
    }
-   else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z32) {
-      trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
+   else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) {
+      trb->Base.Format = MESA_FORMAT_Z32;
       trb->Base.DataType = GL_UNSIGNED_INT;
    }
    else {
-      trb->Base._ActualFormat = trb->TexImage->InternalFormat;
+      trb->Base.Format = trb->TexImage->TexFormat;
       trb->Base.DataType = CHAN_TYPE;
    }
-   trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat;
-#if 0
-   /* fix/avoid this assertion someday */
-   ASSERT(trb->Base._BaseFormat == GL_RGB ||
-          trb->Base._BaseFormat == GL_RGBA ||
-          trb->Base._BaseFormat == GL_DEPTH_COMPONENT);
-#endif
    trb->Base.Data = trb->TexImage->Data;
-
-   trb->Base.RedBits = trb->TexImage->TexFormat->RedBits;
-   trb->Base.GreenBits = trb->TexImage->TexFormat->GreenBits;
-   trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits;
-   trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits;
-   trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits;
-   trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits;
+   trb->Base._BaseFormat = _mesa_base_fbo_format(ctx, trb->Base.InternalFormat);
 }
 
 
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 8292d43eb..c735e18af 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -31,9 +31,7 @@
 #include "glheader.h"
 #include "mfeatures.h"
 #include "colormac.h"
-#if FEATURE_colortable
 #include "colortab.h"
-#endif
 #include "context.h"
 #include "enums.h"
 #include "macros.h"
@@ -309,10 +307,6 @@ _mesa_ActiveTextureARB(GLenum texture)
       /* update current stack pointer */
       ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
    }
-
-   if (ctx->Driver.ActiveTexture) {
-      (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
-   }
 }
 
 
@@ -324,11 +318,18 @@ _mesa_ClientActiveTextureARB(GLenum texture)
    GLuint texUnit = texture - GL_TEXTURE0;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
+   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE))
+      _mesa_debug(ctx, "glClientActiveTexture %s\n",
+                  _mesa_lookup_enum_by_nr(texture));
+
    if (texUnit >= ctx->Const.MaxTextureCoordUnits) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)");
       return;
    }
 
+   if (ctx->Array.ActiveTexture == texUnit)
+      return;
+
    FLUSH_VERTICES(ctx, _NEW_ARRAY);
    ctx->Array.ActiveTexture = texUnit;
 }
@@ -362,9 +363,6 @@ update_texture_matrices( GLcontext *ctx )
 	 if (ctx->Texture.Unit[u]._ReallyEnabled &&
 	     ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY)
 	    ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u);
-
-	 if (ctx->Driver.TextureMatrix)
-	    ctx->Driver.TextureMatrix( ctx, u, ctx->TextureMatrixStack[u].Top);
       }
    }
 }
@@ -759,9 +757,7 @@ _mesa_init_texture(GLcontext *ctx)
    ctx->Texture.CurrentUnit = 0;      /* multitexture */
    ctx->Texture._EnabledUnits = 0x0;
    ctx->Texture.SharedPalette = GL_FALSE;
-#if FEATURE_colortable
    _mesa_init_colortable(&ctx->Texture.Palette);
-#endif
 
    for (u = 0; u < MAX_TEXTURE_UNITS; u++)
       init_texture_unit(ctx, u);
@@ -802,10 +798,8 @@ _mesa_free_texture_data(GLcontext *ctx)
    for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++)
       ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
 
-#if FEATURE_colortable
    for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++)
       _mesa_free_colortable_data(&ctx->Texture.Unit[u].ColorTable);
-#endif
 }
 
 
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index d3237959e..792c83141 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -56,15 +56,14 @@
 #include "bufferobj.h"
 #include "colormac.h"
 #include "context.h"
-#if FEATURE_convolve
 #include "convolve.h"
-#endif
 #include "image.h"
 #include "macros.h"
 #include "mipmap.h"
 #include "imports.h"
 #include "texcompress.h"
-#include "texformat.h"
+#include "texcompress_fxt1.h"
+#include "texcompress_s3tc.h"
 #include "teximage.h"
 #include "texstore.h"
 #include "enums.h"
@@ -76,6 +75,12 @@ enum {
 };
 
 
+/**
+ * Texture image storage function.
+ */
+typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
+
+
 /**
  * Return GL_TRUE if the given image format is one that be converted
  * to another format by swizzling.
@@ -272,16 +277,6 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat,
 }
 
 
-#if !FEATURE_convolve
-static void
-_mesa_adjust_image_for_convolution(GLcontext *ctx, GLuint dims,
-                                   GLsizei *srcWidth, GLsizei *srcHeight)
-{
-   /* no-op */
-}
-#endif
-
-
 /**
  * Make a temporary (color) texture image with GLfloat components.
  * Apply all needed pixel unpacking and pixel transfer operations.
@@ -348,7 +343,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
       const GLuint postConvTransferOps
          = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT;
       GLint img, row;
-      GLint convWidth, convHeight;
+      GLint convWidth = srcWidth, convHeight = srcHeight;
       GLfloat *convImage;
 
       /* pre-convolution image buffer (3D) */
@@ -433,8 +428,8 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
    else {
       /* no convolution */
       const GLint components = _mesa_components_in_format(logicalBaseFormat);
-      const GLint srcStride = _mesa_image_row_stride(srcPacking,
-                                                 srcWidth, srcFormat, srcType);
+      const GLint srcStride =
+         _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
       GLfloat *dst;
       GLint img, row;
 
@@ -598,14 +593,13 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
 
    dst = tempImage;
    for (img = 0; img < srcDepth; img++) {
-      const GLint srcStride = _mesa_image_row_stride(srcPacking,
-                                                     srcWidth, srcFormat,
-                                                     srcType);
-      const GLubyte *src
-         = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
-                                                 srcWidth, srcHeight,
-                                                 srcFormat, srcType,
-                                                 img, 0, 0);
+      const GLint srcStride =
+         _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
+      const GLubyte *src =
+         (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
+                                               srcWidth, srcHeight,
+                                               srcFormat, srcType,
+                                               img, 0, 0);
       for (row = 0; row < srcHeight; row++) {
          _mesa_unpack_color_span_chan(ctx, srcWidth, logicalBaseFormat, dst,
                                       srcFormat, srcType, src, srcPacking,
@@ -930,7 +924,7 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
 static void
 memcpy_texture(GLcontext *ctx,
 	       GLuint dimensions,
-               const struct gl_texture_format *dstFormat,
+               gl_format dstFormat,
                GLvoid *dstAddr,
                GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
                GLint dstRowStride,
@@ -946,7 +940,8 @@ memcpy_texture(GLcontext *ctx,
                                       srcWidth, srcHeight, srcFormat, srcType);
    const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions,
         srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0);
-   const GLint bytesPerRow = srcWidth * dstFormat->TexelBytes;
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLint bytesPerRow = srcWidth * texelBytes;
 
 #if 0
    /* XXX update/re-enable for dstImageOffsets array */
@@ -955,7 +950,7 @@ memcpy_texture(GLcontext *ctx,
    GLubyte *dstImage = (GLubyte *) dstAddr
                      + dstZoffset * dstImageStride
                      + dstYoffset * dstRowStride
-                     + dstXoffset * dstFormat->TexelBytes;
+                     + dstXoffset * texelBytes;
 
    if (dstRowStride == srcRowStride &&
        dstRowStride == bytesPerRow &&
@@ -986,9 +981,9 @@ memcpy_texture(GLcontext *ctx,
    for (img = 0; img < srcDepth; img++) {
       const GLubyte *srcRow = srcImage;
       GLubyte *dstRow = (GLubyte *) dstAddr
-         + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+         + dstImageOffsets[dstZoffset + img] * texelBytes
          + dstYoffset * dstRowStride
-         + dstXoffset * dstFormat->TexelBytes;
+         + dstXoffset * texelBytes;
       for (row = 0; row < srcHeight; row++) {
          ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow);
          dstRow += dstRowStride;
@@ -1001,38 +996,23 @@ memcpy_texture(GLcontext *ctx,
 
 
 /**
- * Store an image in any of the formats:
- *   _mesa_texformat_rgba
- *   _mesa_texformat_rgb
- *   _mesa_texformat_alpha
- *   _mesa_texformat_luminance
- *   _mesa_texformat_luminance_alpha
- *   _mesa_texformat_intensity
- * 
+ * Store a 32-bit integer depth component texture image.
  */
-GLboolean
-_mesa_texstore_rgba(TEXSTORE_PARAMS)
+static GLboolean
+_mesa_texstore_z32(TEXSTORE_PARAMS)
 {
-   const GLint components = _mesa_components_in_format(baseInternalFormat);
-
-   ASSERT(dstFormat == &_mesa_texformat_rgba ||
-          dstFormat == &_mesa_texformat_rgb ||
-          dstFormat == &_mesa_texformat_alpha ||
-          dstFormat == &_mesa_texformat_luminance ||
-          dstFormat == &_mesa_texformat_luminance_alpha ||
-          dstFormat == &_mesa_texformat_intensity);
-   ASSERT(baseInternalFormat == GL_RGBA ||
-          baseInternalFormat == GL_RGB ||
-          baseInternalFormat == GL_ALPHA ||
-          baseInternalFormat == GL_LUMINANCE ||
-          baseInternalFormat == GL_LUMINANCE_ALPHA ||
-          baseInternalFormat == GL_INTENSITY);
-   ASSERT(dstFormat->TexelBytes == components * sizeof(GLchan));
+   const GLuint depthScale = 0xffffffff;
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   (void) dims;
+   ASSERT(dstFormat == MESA_FORMAT_Z32);
+   ASSERT(texelBytes == sizeof(GLuint));
 
-   if (!ctx->_ImageTransferState &&
+   if (ctx->Pixel.DepthScale == 1.0f &&
+       ctx->Pixel.DepthBias == 0.0f &&
        !srcPacking->SwapBytes &&
-       baseInternalFormat == srcFormat &&
-       srcType == CHAN_TYPE) {
+       baseInternalFormat == GL_DEPTH_COMPONENT &&
+       srcFormat == GL_DEPTH_COMPONENT &&
+       srcType == GL_UNSIGNED_INT) {
       /* simple memcpy path */
       memcpy_texture(ctx, dims,
                      dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
@@ -1041,160 +1021,92 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS)
                      srcWidth, srcHeight, srcDepth, srcFormat, srcType,
                      srcAddr, srcPacking);
    }
-   else if (!ctx->_ImageTransferState &&
-            !srcPacking->SwapBytes &&
-            dstFormat == &_mesa_texformat_rgb &&
-            srcFormat == GL_RGBA &&
-            srcType == CHAN_TYPE) {
-      /* extract RGB from RGBA */
-      GLint img, row, col;
+   else {
+      /* general path */
+      GLint img, row;
       for (img = 0; img < srcDepth; img++) {
-         GLchan *dstImage = (GLchan *)
-            ((GLubyte *) dstAddr
-             + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
-             + dstYoffset * dstRowStride
-             + dstXoffset * dstFormat->TexelBytes);
-
-         const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
-                                                 srcWidth, srcFormat, srcType);
-         GLchan *srcRow = (GLchan *) _mesa_image_address(dims, srcPacking,
-                  srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
-         GLchan *dstRow = dstImage;
+         GLubyte *dstRow = (GLubyte *) dstAddr
+            + dstImageOffsets[dstZoffset + img] * texelBytes
+            + dstYoffset * dstRowStride
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
-            for (col = 0; col < srcWidth; col++) {
-               dstRow[col * 3 + RCOMP] = srcRow[col * 4 + RCOMP];
-               dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP];
-               dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP];
-            }
-            dstRow += dstRowStride / sizeof(GLchan);
-            srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride);
+            const GLvoid *src = _mesa_image_address(dims, srcPacking,
+                srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
+            _mesa_unpack_depth_span(ctx, srcWidth,
+                                    GL_UNSIGNED_INT, (GLuint *) dstRow,
+                                    depthScale, srcType, src, srcPacking);
+            dstRow += dstRowStride;
          }
       }
    }
-   else if (!ctx->_ImageTransferState &&
-	    CHAN_TYPE == GL_UNSIGNED_BYTE &&
-	    (srcType == GL_UNSIGNED_BYTE ||
-	     srcType == GL_UNSIGNED_INT_8_8_8_8 ||
-	     srcType == GL_UNSIGNED_INT_8_8_8_8_REV) &&
-	    can_swizzle(baseInternalFormat) &&
-	    can_swizzle(srcFormat)) {
+   return GL_TRUE;
+}
 
-      const GLubyte *dstmap;
-      GLuint components;
 
-      /* dstmap - how to swizzle from RGBA to dst format:
-       */
-      if (dstFormat == &_mesa_texformat_rgba) {
-	 dstmap = mappings[IDX_RGBA].from_rgba;
-	 components = 4;
-      }
-      else if (dstFormat == &_mesa_texformat_rgb) {
-	 dstmap = mappings[IDX_RGB].from_rgba;
-	 components = 3;
-      }
-      else if (dstFormat == &_mesa_texformat_alpha) {
-	 dstmap = mappings[IDX_ALPHA].from_rgba;
-	 components = 1;
-      }
-      else if (dstFormat == &_mesa_texformat_luminance) {
-	 dstmap = mappings[IDX_LUMINANCE].from_rgba;
-	 components = 1;
-      }
-      else if (dstFormat == &_mesa_texformat_luminance_alpha) {
-	 dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba;
-	 components = 2;
-      }
-      else if (dstFormat == &_mesa_texformat_intensity) {
-	 dstmap = mappings[IDX_INTENSITY].from_rgba;
-	 components = 1;
-      }
-      else {
-         _mesa_problem(ctx, "Unexpected dstFormat in _mesa_texstore_rgba");
-         return GL_FALSE;
-      }
+/**
+ * Store a 24-bit integer depth component texture image.
+ */
+static GLboolean
+_mesa_texstore_x8_z24(TEXSTORE_PARAMS)
+{
+   const GLuint depthScale = 0xffffff;
+   const GLuint texelBytes = 4;
 
-      _mesa_swizzle_ubyte_image(ctx, dims,
-				srcFormat,
-				srcType,
-				baseInternalFormat,
-				dstmap, components,
-				dstAddr, dstXoffset, dstYoffset, dstZoffset,
-				dstRowStride, dstImageOffsets,
-				srcWidth, srcHeight, srcDepth, srcAddr,
-				srcPacking);      
-   }
-   else {
+   (void) dims;
+   ASSERT(dstFormat == MESA_FORMAT_X8_Z24);
+
+   {
       /* general path */
-      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
-                                                 baseInternalFormat,
-                                                 dstFormat->BaseFormat,
-                                                 srcWidth, srcHeight, srcDepth,
-                                                 srcFormat, srcType, srcAddr,
-                                                 srcPacking);
-      const GLchan *src = tempImage;
-      GLint bytesPerRow;
       GLint img, row;
-      if (!tempImage)
-         return GL_FALSE;
-      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
-      bytesPerRow = srcWidth * components * sizeof(GLchan);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
-            _mesa_memcpy(dstRow, src, bytesPerRow);
+            const GLvoid *src = _mesa_image_address(dims, srcPacking,
+                srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
+            _mesa_unpack_depth_span(ctx, srcWidth,
+                                    GL_UNSIGNED_INT, (GLuint *) dstRow,
+                                    depthScale, srcType, src, srcPacking);
             dstRow += dstRowStride;
-            src += srcWidth * components;
          }
       }
-
-      _mesa_free((void *) tempImage);
    }
    return GL_TRUE;
 }
 
 
 /**
- * Store a 32-bit integer depth component texture image.
+ * Store a 24-bit integer depth component texture image.
  */
-GLboolean
-_mesa_texstore_z32(TEXSTORE_PARAMS)
+static GLboolean
+_mesa_texstore_z24_x8(TEXSTORE_PARAMS)
 {
-   const GLuint depthScale = 0xffffffff;
+   const GLuint depthScale = 0xffffff;
+   const GLuint texelBytes = 4;
+
    (void) dims;
-   ASSERT(dstFormat == &_mesa_texformat_z32);
-   ASSERT(dstFormat->TexelBytes == sizeof(GLuint));
+   ASSERT(dstFormat == MESA_FORMAT_Z24_X8);
 
-   if (ctx->Pixel.DepthScale == 1.0f &&
-       ctx->Pixel.DepthBias == 0.0f &&
-       !srcPacking->SwapBytes &&
-       baseInternalFormat == GL_DEPTH_COMPONENT &&
-       srcFormat == GL_DEPTH_COMPONENT &&
-       srcType == GL_UNSIGNED_INT) {
-      /* simple memcpy path */
-      memcpy_texture(ctx, dims,
-                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
-                     dstRowStride,
-                     dstImageOffsets,
-                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
-                     srcAddr, srcPacking);
-   }
-   else {
+   {
       /* general path */
       GLint img, row;
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             const GLvoid *src = _mesa_image_address(dims, srcPacking,
                 srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
+            GLuint *dst = (GLuint *) dstRow;
+            GLint i;
             _mesa_unpack_depth_span(ctx, srcWidth,
-                                    GL_UNSIGNED_INT, (GLuint *) dstRow,
+                                    GL_UNSIGNED_INT, dst,
                                     depthScale, srcType, src, srcPacking);
+            for (i = 0; i < srcWidth; i++)
+               dst[i] <<= 8;
             dstRow += dstRowStride;
          }
       }
@@ -1202,18 +1114,18 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
-#define STRIDE_3D 0
 
 /**
  * Store a 16-bit integer depth component texture image.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_z16(TEXSTORE_PARAMS)
 {
    const GLuint depthScale = 0xffff;
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
    (void) dims;
-   ASSERT(dstFormat == &_mesa_texformat_z16);
-   ASSERT(dstFormat->TexelBytes == sizeof(GLushort));
+   ASSERT(dstFormat == MESA_FORMAT_Z16);
+   ASSERT(texelBytes == sizeof(GLushort));
 
    if (ctx->Pixel.DepthScale == 1.0f &&
        ctx->Pixel.DepthBias == 0.0f &&
@@ -1234,9 +1146,9 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
       GLint img, row;
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             const GLvoid *src = _mesa_image_address(dims, srcPacking,
                 srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
@@ -1255,16 +1167,19 @@ _mesa_texstore_z16(TEXSTORE_PARAMS)
 /**
  * Store an rgb565 or rgb565_rev texture image.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_rgb565(TEXSTORE_PARAMS)
 {
-   ASSERT(dstFormat == &_mesa_texformat_rgb565 ||
-          dstFormat == &_mesa_texformat_rgb565_rev);
-   ASSERT(dstFormat->TexelBytes == 2);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
+          dstFormat == MESA_FORMAT_RGB565_REV);
+   ASSERT(texelBytes == 2);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_rgb565 &&
+       dstFormat == MESA_FORMAT_RGB565 &&
        baseInternalFormat == GL_RGB &&
        srcFormat == GL_RGB &&
        srcType == GL_UNSIGNED_SHORT_5_6_5) {
@@ -1283,20 +1198,20 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
             srcType == GL_UNSIGNED_BYTE &&
             dims == 2) {
       /* do optimized tex store */
-      const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth,
-                                                        srcFormat, srcType);
+      const GLint srcRowStride =
+         _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
       const GLubyte *src = (const GLubyte *)
          _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight,
                              srcFormat, srcType, 0, 0, 0);
       GLubyte *dst = (GLubyte *) dstAddr
                    + dstYoffset * dstRowStride
-                   + dstXoffset * dstFormat->TexelBytes;
+                   + dstXoffset * texelBytes;
       GLint row, col;
       for (row = 0; row < srcHeight; row++) {
          const GLubyte *srcUB = (const GLubyte *) src;
          GLushort *dstUS = (GLushort *) dst;
          /* check for byteswapped format */
-         if (dstFormat == &_mesa_texformat_rgb565) {
+         if (dstFormat == MESA_FORMAT_RGB565) {
             for (col = 0; col < srcWidth; col++) {
                dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] );
                srcUB += 3;
@@ -1316,7 +1231,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -1327,13 +1242,13 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLushort *dstUS = (GLushort *) dstRow;
             /* check for byteswapped format */
-            if (dstFormat == &_mesa_texformat_rgb565) {
+            if (dstFormat == MESA_FORMAT_RGB565) {
                for (col = 0; col < srcWidth; col++) {
                   dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]),
                                                CHAN_TO_UBYTE(src[GCOMP]),
@@ -1361,18 +1276,20 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
 /**
  * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == &_mesa_texformat_rgba8888 ||
-          dstFormat == &_mesa_texformat_rgba8888_rev);
-   ASSERT(dstFormat->TexelBytes == 4);
+   ASSERT(dstFormat == MESA_FORMAT_RGBA8888 ||
+          dstFormat == MESA_FORMAT_RGBA8888_REV);
+   ASSERT(texelBytes == 4);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_rgba8888 &&
+       dstFormat == MESA_FORMAT_RGBA8888 &&
        baseInternalFormat == GL_RGBA &&
       ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
        (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
@@ -1388,7 +1305,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
    }
    else if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_rgba8888_rev &&
+       dstFormat == MESA_FORMAT_RGBA8888_REV &&
        baseInternalFormat == GL_RGBA &&
       ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
        (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) ||
@@ -1413,8 +1330,8 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
 
       /* dstmap - how to swizzle from RGBA to dst format:
        */
-      if ((littleEndian && dstFormat == &_mesa_texformat_rgba8888) ||
-	  (!littleEndian && dstFormat == &_mesa_texformat_rgba8888_rev)) {
+      if ((littleEndian && dstFormat == MESA_FORMAT_RGBA8888) ||
+	  (!littleEndian && dstFormat == MESA_FORMAT_RGBA8888_REV)) {
 	 dstmap[3] = 0;
 	 dstmap[2] = 1;
 	 dstmap[1] = 2;
@@ -1441,7 +1358,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -1452,12 +1369,12 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLuint *dstUI = (GLuint *) dstRow;
-            if (dstFormat == &_mesa_texformat_rgba8888) {
+            if (dstFormat == MESA_FORMAT_RGBA8888) {
                for (col = 0; col < srcWidth; col++) {
                   dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]),
                                                 CHAN_TO_UBYTE(src[GCOMP]),
@@ -1484,18 +1401,23 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_argb8888(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = GL_RGBA;
 
-   ASSERT(dstFormat == &_mesa_texformat_argb8888 ||
-          dstFormat == &_mesa_texformat_argb8888_rev);
-   ASSERT(dstFormat->TexelBytes == 4);
+   ASSERT(dstFormat == MESA_FORMAT_ARGB8888 ||
+          dstFormat == MESA_FORMAT_ARGB8888_REV ||
+          dstFormat == MESA_FORMAT_XRGB8888 ||
+          dstFormat == MESA_FORMAT_XRGB8888_REV );
+   ASSERT(texelBytes == 4);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_argb8888 &&
+       (dstFormat == MESA_FORMAT_ARGB8888 ||
+        dstFormat == MESA_FORMAT_XRGB8888) &&
        baseInternalFormat == GL_RGBA &&
        srcFormat == GL_BGRA &&
        ((srcType == GL_UNSIGNED_BYTE && littleEndian) ||
@@ -1510,7 +1432,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
    }
    else if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_argb8888_rev &&
+       (dstFormat == MESA_FORMAT_ARGB8888_REV ||
+        dstFormat == MESA_FORMAT_XRGB8888_REV) &&
        baseInternalFormat == GL_RGBA &&
        srcFormat == GL_BGRA &&
        ((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
@@ -1525,21 +1448,22 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
    }
    else if (!ctx->_ImageTransferState &&
             !srcPacking->SwapBytes &&
-	    dstFormat == &_mesa_texformat_argb8888 &&
+	    (dstFormat == MESA_FORMAT_ARGB8888 ||
+             dstFormat == MESA_FORMAT_XRGB8888) &&
             srcFormat == GL_RGB &&
 	    (baseInternalFormat == GL_RGBA ||
 	     baseInternalFormat == GL_RGB) &&
             srcType == GL_UNSIGNED_BYTE) {
       int img, row, col;
       for (img = 0; img < srcDepth; img++) {
-         const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
-                                                 srcWidth, srcFormat, srcType);
+         const GLint srcRowStride =
+            _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
          GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
                   srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLuint *d4 = (GLuint *) dstRow;
             for (col = 0; col < srcWidth; col++) {
@@ -1555,7 +1479,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
    }
    else if (!ctx->_ImageTransferState &&
             !srcPacking->SwapBytes &&
-	    dstFormat == &_mesa_texformat_argb8888 &&
+	    dstFormat == MESA_FORMAT_ARGB8888 &&
             srcFormat == GL_RGBA &&
 	    baseInternalFormat == GL_RGBA &&
             srcType == GL_UNSIGNED_BYTE) {
@@ -1568,14 +1492,14 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
        * Strangely the same isn't required for the RGB path, above.
        */
       for (img = 0; img < srcDepth; img++) {
-         const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
-                                                 srcWidth, srcFormat, srcType);
+         const GLint srcRowStride =
+            _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
          GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
                   srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLuint *d4 = (GLuint *) dstRow;
             for (col = 0; col < srcWidth; col++) {
@@ -1600,16 +1524,20 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
 
       /* dstmap - how to swizzle from RGBA to dst format:
        */
-      if ((littleEndian && dstFormat == &_mesa_texformat_argb8888) ||
-	  (!littleEndian && dstFormat == &_mesa_texformat_argb8888_rev)) {
+      if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) ||
+          (littleEndian && dstFormat == MESA_FORMAT_XRGB8888) ||
+	  (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) ||
+	  (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV)) {
 	 dstmap[3] = 3;		/* alpha */
 	 dstmap[2] = 0;		/* red */
 	 dstmap[1] = 1;		/* green */
 	 dstmap[0] = 2;		/* blue */
       }
       else {
-	 assert((littleEndian && dstFormat == &_mesa_texformat_argb8888_rev) ||
-		(!littleEndian && dstFormat == &_mesa_texformat_argb8888));
+	 assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) ||
+		(!littleEndian && dstFormat == MESA_FORMAT_ARGB8888) ||
+		(littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV) ||
+		(!littleEndian && dstFormat == MESA_FORMAT_XRGB8888));
 	 dstmap[3] = 2;
 	 dstmap[2] = 1;
 	 dstmap[1] = 0;
@@ -1632,7 +1560,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -1643,12 +1571,12 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLuint *dstUI = (GLuint *) dstRow;
-            if (dstFormat == &_mesa_texformat_argb8888) {
+            if (dstFormat == MESA_FORMAT_ARGB8888) {
                for (col = 0; col < srcWidth; col++) {
                   dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]),
                                                 CHAN_TO_UBYTE(src[RCOMP]),
@@ -1657,6 +1585,15 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
                   src += 4;
                }
             }
+            else if (dstFormat == MESA_FORMAT_XRGB8888) {
+               for (col = 0; col < srcWidth; col++) {
+                  dstUI[col] = PACK_COLOR_8888( 0xff,
+                                                CHAN_TO_UBYTE(src[RCOMP]),
+                                                CHAN_TO_UBYTE(src[GCOMP]),
+                                                CHAN_TO_UBYTE(src[BCOMP]) );
+                  src += 4;
+               }
+            }
             else {
                for (col = 0; col < srcWidth; col++) {
                   dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[ACOMP]),
@@ -1675,13 +1612,15 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_rgb888(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == &_mesa_texformat_rgb888);
-   ASSERT(dstFormat->TexelBytes == 3);
+   ASSERT(dstFormat == MESA_FORMAT_RGB888);
+   ASSERT(texelBytes == 3);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
@@ -1704,14 +1643,14 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
       /* extract RGB from RGBA */
       GLint img, row, col;
       for (img = 0; img < srcDepth; img++) {
-         const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
-                                                 srcWidth, srcFormat, srcType);
+         const GLint srcRowStride =
+            _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
          GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
                   srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             for (col = 0; col < srcWidth; col++) {
                dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP];
@@ -1751,7 +1690,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -1762,9 +1701,9 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
 #if 0
             if (littleEndian) {
@@ -1800,13 +1739,15 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_bgr888(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == &_mesa_texformat_bgr888);
-   ASSERT(dstFormat->TexelBytes == 3);
+   ASSERT(dstFormat == MESA_FORMAT_BGR888);
+   ASSERT(texelBytes == 3);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
@@ -1829,14 +1770,14 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
       /* extract BGR from RGBA */
       int img, row, col;
       for (img = 0; img < srcDepth; img++) {
-         const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
-                                                 srcWidth, srcFormat, srcType);
+         const GLint srcRowStride =
+            _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
          GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
                   srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             for (col = 0; col < srcWidth; col++) {
                dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP];
@@ -1876,7 +1817,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -1887,9 +1828,9 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             for (col = 0; col < srcWidth; col++) {
                dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);
@@ -1905,71 +1846,20 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
-GLboolean
-_mesa_texstore_rgba4444(TEXSTORE_PARAMS)
-{
-   ASSERT(dstFormat == &_mesa_texformat_rgba4444);
-   ASSERT(dstFormat->TexelBytes == 2);
-
-   if (!ctx->_ImageTransferState &&
-       !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_rgba4444 &&
-       baseInternalFormat == GL_RGBA &&
-       srcFormat == GL_RGBA &&
-       srcType == GL_UNSIGNED_SHORT_4_4_4_4){
-      /* simple memcpy path */
-      memcpy_texture(ctx, dims,
-                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
-                     dstRowStride,
-                     dstImageOffsets,
-                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
-                     srcAddr, srcPacking);
-   }
-   else {
-      /* general path */
-      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
-                                                 baseInternalFormat,
-                                                 dstFormat->BaseFormat,
-                                                 srcWidth, srcHeight, srcDepth,
-                                                 srcFormat, srcType, srcAddr,
-                                                 srcPacking);
-      const GLchan *src = tempImage;
-      GLint img, row, col;
-      if (!tempImage)
-         return GL_FALSE;
-      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
-      for (img = 0; img < srcDepth; img++) {
-         GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
-            + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
-         for (row = 0; row < srcHeight; row++) {
-            GLushort *dstUS = (GLushort *) dstRow;
-	    for (col = 0; col < srcWidth; col++) {
-	      dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[RCOMP]),
-					    CHAN_TO_UBYTE(src[GCOMP]),
-					    CHAN_TO_UBYTE(src[BCOMP]),
-					    CHAN_TO_UBYTE(src[ACOMP]) );
-	      src += 4;
-            }
-            dstRow += dstRowStride;
-         }
-      }
-      _mesa_free((void *) tempImage);
-   }
-   return GL_TRUE;
-}
 
-GLboolean
+static GLboolean
 _mesa_texstore_argb4444(TEXSTORE_PARAMS)
 {
-   ASSERT(dstFormat == &_mesa_texformat_argb4444 ||
-          dstFormat == &_mesa_texformat_argb4444_rev);
-   ASSERT(dstFormat->TexelBytes == 2);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_ARGB4444 ||
+          dstFormat == MESA_FORMAT_ARGB4444_REV);
+   ASSERT(texelBytes == 2);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_argb4444 &&
+       dstFormat == MESA_FORMAT_ARGB4444 &&
        baseInternalFormat == GL_RGBA &&
        srcFormat == GL_BGRA &&
        srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
@@ -1985,7 +1875,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -1996,12 +1886,12 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLushort *dstUS = (GLushort *) dstRow;
-            if (dstFormat == &_mesa_texformat_argb4444) {
+            if (dstFormat == MESA_FORMAT_ARGB4444) {
                for (col = 0; col < srcWidth; col++) {
                   dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]),
                                                 CHAN_TO_UBYTE(src[RCOMP]),
@@ -2027,15 +1917,18 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
-GLboolean
+static GLboolean
 _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
 {
-   ASSERT(dstFormat == &_mesa_texformat_rgba5551);
-   ASSERT(dstFormat->TexelBytes == 2);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
+   ASSERT(texelBytes == 2);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_rgba5551 &&
+       dstFormat == MESA_FORMAT_RGBA5551 &&
        baseInternalFormat == GL_RGBA &&
        srcFormat == GL_RGBA &&
        srcType == GL_UNSIGNED_SHORT_5_5_5_1) {
@@ -2051,7 +1944,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2062,9 +1955,9 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLushort *dstUS = (GLushort *) dstRow;
 	    for (col = 0; col < srcWidth; col++) {
@@ -2082,16 +1975,19 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
-GLboolean
+static GLboolean
 _mesa_texstore_argb1555(TEXSTORE_PARAMS)
 {
-   ASSERT(dstFormat == &_mesa_texformat_argb1555 ||
-          dstFormat == &_mesa_texformat_argb1555_rev);
-   ASSERT(dstFormat->TexelBytes == 2);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_ARGB1555 ||
+          dstFormat == MESA_FORMAT_ARGB1555_REV);
+   ASSERT(texelBytes == 2);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_argb1555 &&
+       dstFormat == MESA_FORMAT_ARGB1555 &&
        baseInternalFormat == GL_RGBA &&
        srcFormat == GL_BGRA &&
        srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
@@ -2107,7 +2003,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2118,12 +2014,12 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLushort *dstUS = (GLushort *) dstRow;
-            if (dstFormat == &_mesa_texformat_argb1555) {
+            if (dstFormat == MESA_FORMAT_ARGB1555) {
                for (col = 0; col < srcWidth; col++) {
                   dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]),
                                                 CHAN_TO_UBYTE(src[RCOMP]),
@@ -2150,18 +2046,20 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_al88(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == &_mesa_texformat_al88 ||
-          dstFormat == &_mesa_texformat_al88_rev);
-   ASSERT(dstFormat->TexelBytes == 2);
+   ASSERT(dstFormat == MESA_FORMAT_AL88 ||
+          dstFormat == MESA_FORMAT_AL88_REV);
+   ASSERT(texelBytes == 2);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_al88 &&
+       dstFormat == MESA_FORMAT_AL88 &&
        baseInternalFormat == GL_LUMINANCE_ALPHA &&
        srcFormat == GL_LUMINANCE_ALPHA &&
        srcType == GL_UNSIGNED_BYTE &&
@@ -2184,8 +2082,8 @@ _mesa_texstore_al88(TEXSTORE_PARAMS)
 
       /* dstmap - how to swizzle from RGBA to dst format:
        */
-      if ((littleEndian && dstFormat == &_mesa_texformat_al88) ||
-	  (!littleEndian && dstFormat == &_mesa_texformat_al88_rev)) {
+      if ((littleEndian && dstFormat == MESA_FORMAT_AL88) ||
+	  (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) {
 	 dstmap[0] = 0;
 	 dstmap[1] = 3;
       }
@@ -2210,7 +2108,7 @@ _mesa_texstore_al88(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2221,12 +2119,12 @@ _mesa_texstore_al88(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLushort *dstUS = (GLushort *) dstRow;
-            if (dstFormat == &_mesa_texformat_al88) {
+            if (dstFormat == MESA_FORMAT_AL88) {
                for (col = 0; col < srcWidth; col++) {
                   /* src[0] is luminance, src[1] is alpha */
                  dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]),
@@ -2251,11 +2149,89 @@ _mesa_texstore_al88(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
+_mesa_texstore_al1616(TEXSTORE_PARAMS)
+{
+   const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_AL1616 ||
+          dstFormat == MESA_FORMAT_AL1616_REV);
+   ASSERT(texelBytes == 4);
+
+   if (!ctx->_ImageTransferState &&
+       !srcPacking->SwapBytes &&
+       dstFormat == MESA_FORMAT_AL1616 &&
+       baseInternalFormat == GL_LUMINANCE_ALPHA &&
+       srcFormat == GL_LUMINANCE_ALPHA &&
+       srcType == GL_UNSIGNED_SHORT &&
+       littleEndian) {
+      /* simple memcpy path */
+      memcpy_texture(ctx, dims,
+                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                     dstRowStride,
+                     dstImageOffsets,
+                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+                     srcAddr, srcPacking);
+   }
+   else {
+      /* general path */
+      const GLfloat *tempImage = make_temp_float_image(ctx, dims,
+                                                 baseInternalFormat,
+                                                 baseFormat,
+                                                 srcWidth, srcHeight, srcDepth,
+                                                 srcFormat, srcType, srcAddr,
+                                                 srcPacking);
+      const GLfloat *src = tempImage;
+      GLint img, row, col;
+      if (!tempImage)
+         return GL_FALSE;
+      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+      for (img = 0; img < srcDepth; img++) {
+         GLubyte *dstRow = (GLubyte *) dstAddr
+            + dstImageOffsets[dstZoffset + img] * texelBytes
+            + dstYoffset * dstRowStride
+            + dstXoffset * texelBytes;
+         for (row = 0; row < srcHeight; row++) {
+            GLuint *dstUI = (GLuint *) dstRow;
+            if (dstFormat == MESA_FORMAT_AL1616) {
+               for (col = 0; col < srcWidth; col++) {
+		  GLushort l, a;
+
+		  UNCLAMPED_FLOAT_TO_USHORT(l, src[0]);
+		  UNCLAMPED_FLOAT_TO_USHORT(a, src[1]);
+		  dstUI[col] = PACK_COLOR_1616(a, l);
+		  src += 2;
+               }
+            }
+            else {
+               for (col = 0; col < srcWidth; col++) {
+		  GLushort l, a;
+
+		  UNCLAMPED_FLOAT_TO_USHORT(l, src[0]);
+		  UNCLAMPED_FLOAT_TO_USHORT(a, src[1]);
+		  dstUI[col] = PACK_COLOR_1616_REV(a, l);
+		  src += 2;
+               }
+            }
+            dstRow += dstRowStride;
+         }
+      }
+      _mesa_free((void *) tempImage);
+   }
+   return GL_TRUE;
+}
+
+
+static GLboolean
 _mesa_texstore_rgb332(TEXSTORE_PARAMS)
 {
-   ASSERT(dstFormat == &_mesa_texformat_rgb332);
-   ASSERT(dstFormat->TexelBytes == 1);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_RGB332);
+   ASSERT(texelBytes == 1);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
@@ -2273,7 +2249,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2284,9 +2260,9 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             for (col = 0; col < srcWidth; col++) {
                dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]),
@@ -2306,13 +2282,16 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
 /**
  * Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_a8(TEXSTORE_PARAMS)
 {
-   ASSERT(dstFormat == &_mesa_texformat_a8 ||
-          dstFormat == &_mesa_texformat_l8 ||
-          dstFormat == &_mesa_texformat_i8);
-   ASSERT(dstFormat->TexelBytes == 1);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_A8 ||
+          dstFormat == MESA_FORMAT_L8 ||
+          dstFormat == MESA_FORMAT_I8);
+   ASSERT(texelBytes == 1);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
@@ -2335,7 +2314,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS)
 
       /* dstmap - how to swizzle from RGBA to dst format:
        */
-      if (dstFormat == &_mesa_texformat_a8) {
+      if (dstFormat == MESA_FORMAT_A8) {
 	 dstmap[0] = 3;
       }
       else {
@@ -2359,7 +2338,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS)
       /* general path */
       const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2370,9 +2349,9 @@ _mesa_texstore_a8(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             for (col = 0; col < srcWidth; col++) {
                dstRow[col] = CHAN_TO_UBYTE(src[col]);
@@ -2388,12 +2367,14 @@ _mesa_texstore_a8(TEXSTORE_PARAMS)
 
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_ci8(TEXSTORE_PARAMS)
 {
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+
    (void) dims; (void) baseInternalFormat;
-   ASSERT(dstFormat == &_mesa_texformat_ci8);
-   ASSERT(dstFormat->TexelBytes == 1);
+   ASSERT(dstFormat == MESA_FORMAT_CI8);
+   ASSERT(texelBytes == 1);
    ASSERT(baseInternalFormat == GL_COLOR_INDEX);
 
    if (!ctx->_ImageTransferState &&
@@ -2413,9 +2394,9 @@ _mesa_texstore_ci8(TEXSTORE_PARAMS)
       GLint img, row;
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             const GLvoid *src = _mesa_image_address(dims, srcPacking,
                 srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
@@ -2431,17 +2412,19 @@ _mesa_texstore_ci8(TEXSTORE_PARAMS)
 
 
 /**
- * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev.
+ * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_REV.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+
    (void) ctx; (void) dims; (void) baseInternalFormat;
 
-   ASSERT((dstFormat == &_mesa_texformat_ycbcr) ||
-          (dstFormat == &_mesa_texformat_ycbcr_rev));
-   ASSERT(dstFormat->TexelBytes == 2);
+   ASSERT((dstFormat == MESA_FORMAT_YCBCR) ||
+          (dstFormat == MESA_FORMAT_YCBCR_REV));
+   ASSERT(texelBytes == 2);
    ASSERT(ctx->Extensions.MESA_ycbcr_texture);
    ASSERT(srcFormat == GL_YCBCR_MESA);
    ASSERT((srcType == GL_UNSIGNED_SHORT_8_8_MESA) ||
@@ -2460,14 +2443,14 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
    /* XXX the logic here _might_ be wrong */
    if (srcPacking->SwapBytes ^
        (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^
-       (dstFormat == &_mesa_texformat_ycbcr_rev) ^
+       (dstFormat == MESA_FORMAT_YCBCR_REV) ^
        !littleEndian) {
       GLint img, row;
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             _mesa_swap2((GLushort *) dstRow, srcWidth);
             dstRow += dstRowStride;
@@ -2477,13 +2460,14 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
-GLboolean
+static GLboolean
 _mesa_texstore_dudv8(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
 
-   ASSERT(dstFormat == &_mesa_texformat_dudv8);
-   ASSERT(dstFormat->TexelBytes == 2);
+   ASSERT(dstFormat == MESA_FORMAT_DUDV8);
+   ASSERT(texelBytes == 2);
    ASSERT(ctx->Extensions.ATI_envmap_bumpmap);
    ASSERT((srcFormat == GL_DU8DV8_ATI) ||
 	  (srcFormat == GL_DUDV_ATI));
@@ -2529,8 +2513,8 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS)
    else {
       /* general path - note this is defined for 2d textures only */
       const GLint components = _mesa_components_in_format(baseInternalFormat);
-      const GLint srcStride = _mesa_image_row_stride(srcPacking,
-                                                 srcWidth, srcFormat, srcType);
+      const GLint srcStride = _mesa_image_row_stride(srcPacking, srcWidth,
+                                                     srcFormat, srcType);
       GLbyte *tempImage, *dst, *src;
       GLint row;
 
@@ -2556,11 +2540,11 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS)
       src = tempImage;
       dst = (GLbyte *) dstAddr
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
       for (row = 0; row < srcHeight; row++) {
-         memcpy(dst, src, srcWidth * dstFormat->TexelBytes);
+         memcpy(dst, src, srcWidth * texelBytes);
          dst += dstRowStride;
-         src += srcWidth * dstFormat->TexelBytes;
+         src += srcWidth * texelBytes;
       }
       _mesa_free((void *) tempImage);
    }
@@ -2570,18 +2554,20 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS)
 /**
  * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV
  */
-GLboolean
+static GLboolean
 _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 ||
-          dstFormat == &_mesa_texformat_signed_rgba8888_rev);
-   ASSERT(dstFormat->TexelBytes == 4);
+   ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 ||
+          dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV);
+   ASSERT(texelBytes == 4);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_signed_rgba8888 &&
+       dstFormat == MESA_FORMAT_SIGNED_RGBA8888 &&
        baseInternalFormat == GL_RGBA &&
       ((srcFormat == GL_RGBA && srcType == GL_BYTE && !littleEndian) ||
        (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) {
@@ -2595,7 +2581,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
    }
    else if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == &_mesa_texformat_signed_rgba8888_rev &&
+       dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV &&
        baseInternalFormat == GL_RGBA &&
       ((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) ||
        (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) {
@@ -2616,8 +2602,8 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
 
       /* dstmap - how to swizzle from RGBA to dst format:
        */
-      if ((littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) ||
-	  (!littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888_rev)) {
+      if ((littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888) ||
+	  (!littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV)) {
 	 dstmap[3] = 0;
 	 dstmap[2] = 1;
 	 dstmap[1] = 2;
@@ -2644,7 +2630,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
       /* general path */
       const GLfloat *tempImage = make_temp_float_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2655,12 +2641,12 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLuint *dstUI = (GLuint *) dstRow;
-            if (dstFormat == &_mesa_texformat_signed_rgba8888) {
+            if (dstFormat == MESA_FORMAT_SIGNED_RGBA8888) {
                for (col = 0; col < srcWidth; col++) {
                   dstUI[col] = PACK_COLOR_8888( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]),
                                                 FLOAT_TO_BYTE_TEX(srcRow[GCOMP]),
@@ -2689,7 +2675,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
 /**
  * Store a combined depth/stencil texture image.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
 {
    const GLfloat depthScale = (GLfloat) 0xffffff;
@@ -2698,7 +2684,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
       / sizeof(GLuint);
    GLint img, row;
 
-   ASSERT(dstFormat == &_mesa_texformat_z24_s8);
+   ASSERT(dstFormat == MESA_FORMAT_Z24_S8);
    ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
    ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
 
@@ -2790,7 +2776,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
 /**
  * Store a combined depth/stencil texture image.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
 {
    const GLuint depthScale = 0xffffff;
@@ -2799,7 +2785,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
       / sizeof(GLuint);
    GLint img, row;
 
-   ASSERT(dstFormat == &_mesa_texformat_s8_z24);
+   ASSERT(dstFormat == MESA_FORMAT_S8_Z24);
    ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
    ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
 
@@ -2879,24 +2865,26 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
  *   _mesa_texformat_luminance_alpha_float32
  *   _mesa_texformat_intensity_float32
  */
-GLboolean
+static GLboolean
 _mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
 {
-   const GLint components = _mesa_components_in_format(dstFormat->BaseFormat);
-
-   ASSERT(dstFormat == &_mesa_texformat_rgba_float32 ||
-          dstFormat == &_mesa_texformat_rgb_float32 ||
-          dstFormat == &_mesa_texformat_alpha_float32 ||
-          dstFormat == &_mesa_texformat_luminance_float32 ||
-          dstFormat == &_mesa_texformat_luminance_alpha_float32 ||
-          dstFormat == &_mesa_texformat_intensity_float32);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+   const GLint components = _mesa_components_in_format(baseFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT32 ||
+          dstFormat == MESA_FORMAT_RGB_FLOAT32 ||
+          dstFormat == MESA_FORMAT_ALPHA_FLOAT32 ||
+          dstFormat == MESA_FORMAT_LUMINANCE_FLOAT32 ||
+          dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 ||
+          dstFormat == MESA_FORMAT_INTENSITY_FLOAT32);
    ASSERT(baseInternalFormat == GL_RGBA ||
           baseInternalFormat == GL_RGB ||
           baseInternalFormat == GL_ALPHA ||
           baseInternalFormat == GL_LUMINANCE ||
           baseInternalFormat == GL_LUMINANCE_ALPHA ||
           baseInternalFormat == GL_INTENSITY);
-   ASSERT(dstFormat->TexelBytes == components * sizeof(GLfloat));
+   ASSERT(texelBytes == components * sizeof(GLfloat));
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
@@ -2914,7 +2902,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
       /* general path */
       const GLfloat *tempImage = make_temp_float_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2927,9 +2915,9 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
       bytesPerRow = srcWidth * components * sizeof(GLfloat);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             _mesa_memcpy(dstRow, srcRow, bytesPerRow);
             dstRow += dstRowStride;
@@ -2946,24 +2934,26 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
 /**
  * As above, but store 16-bit floats.
  */
-GLboolean
+static GLboolean
 _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
 {
-   const GLint components = _mesa_components_in_format(dstFormat->BaseFormat);
-
-   ASSERT(dstFormat == &_mesa_texformat_rgba_float16 ||
-          dstFormat == &_mesa_texformat_rgb_float16 ||
-          dstFormat == &_mesa_texformat_alpha_float16 ||
-          dstFormat == &_mesa_texformat_luminance_float16 ||
-          dstFormat == &_mesa_texformat_luminance_alpha_float16 ||
-          dstFormat == &_mesa_texformat_intensity_float16);
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+   const GLint components = _mesa_components_in_format(baseFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT16 ||
+          dstFormat == MESA_FORMAT_RGB_FLOAT16 ||
+          dstFormat == MESA_FORMAT_ALPHA_FLOAT16 ||
+          dstFormat == MESA_FORMAT_LUMINANCE_FLOAT16 ||
+          dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 ||
+          dstFormat == MESA_FORMAT_INTENSITY_FLOAT16);
    ASSERT(baseInternalFormat == GL_RGBA ||
           baseInternalFormat == GL_RGB ||
           baseInternalFormat == GL_ALPHA ||
           baseInternalFormat == GL_LUMINANCE ||
           baseInternalFormat == GL_LUMINANCE_ALPHA ||
           baseInternalFormat == GL_INTENSITY);
-   ASSERT(dstFormat->TexelBytes == components * sizeof(GLhalfARB));
+   ASSERT(texelBytes == components * sizeof(GLhalfARB));
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
@@ -2981,7 +2971,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
       /* general path */
       const GLfloat *tempImage = make_temp_float_image(ctx, dims,
                                                  baseInternalFormat,
-                                                 dstFormat->BaseFormat,
+                                                 baseFormat,
                                                  srcWidth, srcHeight, srcDepth,
                                                  srcFormat, srcType, srcAddr,
                                                  srcPacking);
@@ -2992,9 +2982,9 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
       _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
       for (img = 0; img < srcDepth; img++) {
          GLubyte *dstRow = (GLubyte *) dstAddr
-            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstImageOffsets[dstZoffset + img] * texelBytes
             + dstYoffset * dstRowStride
-            + dstXoffset * dstFormat->TexelBytes;
+            + dstXoffset * texelBytes;
          for (row = 0; row < srcHeight; row++) {
             GLhalfARB *dstTexel = (GLhalfARB *) dstRow;
             GLint i;
@@ -3013,20 +3003,18 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
 
 
 #if FEATURE_EXT_texture_sRGB
-GLboolean
+static GLboolean
 _mesa_texstore_srgb8(TEXSTORE_PARAMS)
 {
-   const struct gl_texture_format *newDstFormat;
-   StoreTexImageFunc store;
+   gl_format newDstFormat;
    GLboolean k;
 
-   ASSERT(dstFormat == &_mesa_texformat_srgb8);
+   ASSERT(dstFormat == MESA_FORMAT_SRGB8);
 
    /* reuse normal rgb texstore code */
-   newDstFormat = &_mesa_texformat_rgb888;
-   store = _mesa_texstore_rgb888;
+   newDstFormat = MESA_FORMAT_RGB888;
 
-   k = store(ctx, dims, baseInternalFormat,
+   k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat,
              newDstFormat, dstAddr,
              dstXoffset, dstYoffset, dstZoffset,
              dstRowStride, dstImageOffsets,
@@ -3037,17 +3025,16 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_srgba8(TEXSTORE_PARAMS)
 {
-   const struct gl_texture_format *newDstFormat;
+   gl_format newDstFormat;
    GLboolean k;
 
-   ASSERT(dstFormat == &_mesa_texformat_srgba8);
+   ASSERT(dstFormat == MESA_FORMAT_SRGBA8);
 
    /* reuse normal rgba texstore code */
-   newDstFormat = &_mesa_texformat_rgba8888;
-
+   newDstFormat = MESA_FORMAT_RGBA8888;
    k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat,
                                newDstFormat, dstAddr,
                                dstXoffset, dstYoffset, dstZoffset,
@@ -3059,16 +3046,16 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_sargb8(TEXSTORE_PARAMS)
 {
-   const struct gl_texture_format *newDstFormat;
+   gl_format newDstFormat;
    GLboolean k;
 
-   ASSERT(dstFormat == &_mesa_texformat_sargb8);
+   ASSERT(dstFormat == MESA_FORMAT_SARGB8);
 
    /* reuse normal rgba texstore code */
-   newDstFormat = &_mesa_texformat_argb8888;
+   newDstFormat = MESA_FORMAT_ARGB8888;
 
    k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
                                newDstFormat, dstAddr,
@@ -3081,15 +3068,15 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_sl8(TEXSTORE_PARAMS)
 {
-   const struct gl_texture_format *newDstFormat;
+   gl_format newDstFormat;
    GLboolean k;
 
-   ASSERT(dstFormat == &_mesa_texformat_sl8);
+   ASSERT(dstFormat == MESA_FORMAT_SL8);
 
-   newDstFormat = &_mesa_texformat_l8;
+   newDstFormat = MESA_FORMAT_L8;
 
    /* _mesa_textore_a8 handles luminance8 too */
    k = _mesa_texstore_a8(ctx, dims, baseInternalFormat,
@@ -3103,16 +3090,16 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS)
 }
 
 
-GLboolean
+static GLboolean
 _mesa_texstore_sla8(TEXSTORE_PARAMS)
 {
-   const struct gl_texture_format *newDstFormat;
+   gl_format newDstFormat;
    GLboolean k;
 
-   ASSERT(dstFormat == &_mesa_texformat_sla8);
+   ASSERT(dstFormat == MESA_FORMAT_SLA8);
 
    /* reuse normal luminance/alpha texstore code */
-   newDstFormat = &_mesa_texformat_al88;
+   newDstFormat = MESA_FORMAT_AL88;
 
    k = _mesa_texstore_al88(ctx, dims, baseInternalFormat,
                            newDstFormat, dstAddr,
@@ -3124,9 +3111,160 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS)
    return k;
 }
 
+#else
+
+/* these are used only in texstore_funcs[] below */
+#define _mesa_texstore_srgb8 NULL
+#define _mesa_texstore_srgba8 NULL
+#define _mesa_texstore_sargb8 NULL
+#define _mesa_texstore_sl8 NULL
+#define _mesa_texstore_sla8 NULL
+
 #endif /* FEATURE_EXT_texture_sRGB */
 
 
+
+
+/**
+ * Table mapping MESA_FORMAT_8 to _mesa_texstore_*()
+ * XXX this is somewhat temporary.
+ */
+static const struct {
+   gl_format Name;
+   StoreTexImageFunc Store;
+}
+texstore_funcs[MESA_FORMAT_COUNT] =
+{
+   { MESA_FORMAT_NONE, NULL },
+   { MESA_FORMAT_RGBA8888, _mesa_texstore_rgba8888 },
+   { MESA_FORMAT_RGBA8888_REV, _mesa_texstore_rgba8888 },
+   { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 },
+   { MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 },
+   { MESA_FORMAT_XRGB8888, _mesa_texstore_argb8888 },
+   { MESA_FORMAT_XRGB8888_REV, _mesa_texstore_argb8888 },
+   { MESA_FORMAT_RGB888, _mesa_texstore_rgb888 },
+   { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 },
+   { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 },
+   { MESA_FORMAT_RGB565_REV, _mesa_texstore_rgb565 },
+   { MESA_FORMAT_ARGB4444, _mesa_texstore_argb4444 },
+   { MESA_FORMAT_ARGB4444_REV, _mesa_texstore_argb4444 },
+   { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 },
+   { MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 },
+   { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 },
+   { MESA_FORMAT_AL88, _mesa_texstore_al88 },
+   { MESA_FORMAT_AL88_REV, _mesa_texstore_al88 },
+   { MESA_FORMAT_AL1616, _mesa_texstore_al1616 },
+   { MESA_FORMAT_AL1616_REV, _mesa_texstore_al1616 },
+   { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 },
+   { MESA_FORMAT_A8, _mesa_texstore_a8 },
+   { MESA_FORMAT_L8, _mesa_texstore_a8 },
+   { MESA_FORMAT_I8, _mesa_texstore_a8 },
+   { MESA_FORMAT_CI8, _mesa_texstore_ci8 },
+   { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr },
+   { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr },
+   { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 },
+   { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 },
+   { MESA_FORMAT_Z16, _mesa_texstore_z16 },
+   { MESA_FORMAT_X8_Z24, _mesa_texstore_x8_z24 },
+   { MESA_FORMAT_Z24_X8, _mesa_texstore_z24_x8 },
+   { MESA_FORMAT_Z32, _mesa_texstore_z32 },
+   { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ },
+   { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 },
+   { MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 },
+   { MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 },
+   { MESA_FORMAT_SL8, _mesa_texstore_sl8 },
+   { MESA_FORMAT_SLA8, _mesa_texstore_sla8 },
+   { MESA_FORMAT_SRGB_DXT1, _mesa_texstore_rgb_dxt1 },
+   { MESA_FORMAT_SRGBA_DXT1, _mesa_texstore_rgba_dxt1 },
+   { MESA_FORMAT_SRGBA_DXT3, _mesa_texstore_rgba_dxt3 },
+   { MESA_FORMAT_SRGBA_DXT5, _mesa_texstore_rgba_dxt5 },
+   { MESA_FORMAT_RGB_FXT1, _mesa_texstore_rgb_fxt1 },
+   { MESA_FORMAT_RGBA_FXT1, _mesa_texstore_rgba_fxt1 },
+   { MESA_FORMAT_RGB_DXT1, _mesa_texstore_rgb_dxt1 },
+   { MESA_FORMAT_RGBA_DXT1, _mesa_texstore_rgba_dxt1 },
+   { MESA_FORMAT_RGBA_DXT3, _mesa_texstore_rgba_dxt3 },
+   { MESA_FORMAT_RGBA_DXT5, _mesa_texstore_rgba_dxt5 },
+   { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 },
+   { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 },
+   { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 },
+   { MESA_FORMAT_RGB_FLOAT16, _mesa_texstore_rgba_float16 },
+   { MESA_FORMAT_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 },
+   { MESA_FORMAT_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 },
+   { MESA_FORMAT_LUMINANCE_FLOAT32, _mesa_texstore_rgba_float32 },
+   { MESA_FORMAT_LUMINANCE_FLOAT16, _mesa_texstore_rgba_float16 },
+   { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 },
+   { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 },
+   { MESA_FORMAT_INTENSITY_FLOAT32, _mesa_texstore_rgba_float32 },
+   { MESA_FORMAT_INTENSITY_FLOAT16, _mesa_texstore_rgba_float16 },
+   { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 },
+   { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 },
+   { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 },
+   { MESA_FORMAT_SIGNED_RGBA_16, NULL },
+};
+
+
+static GLboolean
+_mesa_texstore_null(TEXSTORE_PARAMS)
+{
+   (void) ctx; (void) dims;
+   (void) baseInternalFormat;
+   (void) dstFormat;
+   (void) dstAddr;
+   (void) dstXoffset; (void) dstYoffset; (void) dstZoffset;
+   (void) dstRowStride; (void) dstImageOffsets;
+   (void) srcWidth; (void) srcHeight; (void) srcDepth;
+   (void) srcFormat; (void) srcType;
+   (void) srcAddr;
+   (void) srcPacking;
+
+   /* should never happen */
+   _mesa_problem(NULL, "_mesa_texstore_null() is called");
+   return GL_FALSE;
+}
+
+
+/**
+ * Return the StoreTexImageFunc pointer to store an image in the given format.
+ */
+static StoreTexImageFunc
+_mesa_get_texstore_func(gl_format format)
+{
+#ifdef DEBUG
+   GLuint i;
+   for (i = 0; i < MESA_FORMAT_COUNT; i++) {
+      ASSERT(texstore_funcs[i].Name == i);
+   }
+#endif
+   ASSERT(texstore_funcs[format].Name == format);
+
+   if (texstore_funcs[format].Store)
+      return texstore_funcs[format].Store;
+   else
+      return _mesa_texstore_null;
+}
+
+
+/**
+ * Store user data into texture memory.
+ * Called via glTex[Sub]Image1/2/3D()
+ */
+GLboolean
+_mesa_texstore(TEXSTORE_PARAMS)
+{
+   StoreTexImageFunc storeImage;
+   GLboolean success;
+
+   storeImage = _mesa_get_texstore_func(dstFormat);
+
+   success = storeImage(ctx, dims, baseInternalFormat,
+                        dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                        dstRowStride, dstImageOffsets,
+                        srcWidth, srcHeight, srcDepth,
+                        srcFormat, srcType, srcAddr, srcPacking);
+   return success;
+}
+
+
 /**
  * Check if an unpack PBO is active prior to fetching a texture image.
  * If so, do bounds checking and map the buffer into main memory.
@@ -3215,136 +3353,23 @@ _mesa_unmap_teximage_pbo(GLcontext *ctx,
 }
 
 
-
-/**
- * Adaptor for fetching a GLchan texel from a float-valued texture.
- */
-static void
-fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLchan *texelOut)
+/** Return texture size in bytes */
+static GLuint
+texture_size(const struct gl_texture_image *texImage)
 {
-   GLfloat temp[4];
-   ASSERT(texImage->FetchTexelf);
-   texImage->FetchTexelf(texImage, i, j, k, temp);
-   if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT ||
-       texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
-      /* just one channel */
-      UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
-   }
-   else {
-      /* four channels */
-      UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
-      UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]);
-      UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]);
-      UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]);
-   }
+   GLuint sz = _mesa_format_image_size(texImage->TexFormat, texImage->Width,
+                                       texImage->Height, texImage->Depth);
+   return sz;
 }
 
 
-/**
- * Adaptor for fetching a float texel from a GLchan-valued texture.
- */
-static void
-fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLfloat *texelOut)
+/** Return row stride in bytes */
+static GLuint
+texture_row_stride(const struct gl_texture_image *texImage)
 {
-   GLchan temp[4];
-   ASSERT(texImage->FetchTexelc);
-   texImage->FetchTexelc(texImage, i, j, k, temp);
-   if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT ||
-       texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
-      /* just one channel */
-      texelOut[0] = CHAN_TO_FLOAT(temp[0]);
-   }
-   else {
-      /* four channels */
-      texelOut[0] = CHAN_TO_FLOAT(temp[0]);
-      texelOut[1] = CHAN_TO_FLOAT(temp[1]);
-      texelOut[2] = CHAN_TO_FLOAT(temp[2]);
-      texelOut[3] = CHAN_TO_FLOAT(temp[3]);
-   }
-}
-
-
-/**
- * Initialize the texture image's FetchTexelc and FetchTexelf methods.
- */
-void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
-{
-   ASSERT(dims == 1 || dims == 2 || dims == 3);
-   ASSERT(texImage->TexFormat);
-
-   switch (dims) {
-   case 1:
-      texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
-      texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
-      break;
-   case 2:
-      texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
-      texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
-      break;
-   case 3:
-      texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D;
-      texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df;
-      break;
-   default:
-      ;
-   }
-
-   /* now check if we need to use a float/chan adaptor */
-   if (!texImage->FetchTexelc) {
-      texImage->FetchTexelc = fetch_texel_float_to_chan;
-   }
-   else if (!texImage->FetchTexelf) {
-      texImage->FetchTexelf = fetch_texel_chan_to_float;
-   }
-
-
-   ASSERT(texImage->FetchTexelc);
-   ASSERT(texImage->FetchTexelf);
-}
-
-
-/**
- * Choose the actual storage format for a new texture image.
- * Mainly, this is a wrapper for the driver's ChooseTextureFormat() function.
- * Also set some other texImage fields related to texture compression, etc.
- * \param ctx  rendering context
- * \param texImage  the gl_texture_image
- * \param dims  texture dimensions (1, 2 or 3)
- * \param format  the user-specified format parameter
- * \param type  the user-specified type parameter
- * \param internalFormat  the user-specified internal format hint
- */
-static void
-choose_texture_format(GLcontext *ctx, struct gl_texture_image *texImage,
-                      GLuint dims,
-                      GLenum format, GLenum type, GLint internalFormat)
-{
-   ASSERT(dims == 1 || dims == 2 || dims == 3);
-   ASSERT(ctx->Driver.ChooseTextureFormat);
-
-   texImage->TexFormat
-      = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
-
-   ASSERT(texImage->TexFormat);
-
-   _mesa_set_fetch_functions(texImage, dims);
-
-   if (texImage->TexFormat->TexelBytes == 0) {
-      /* must be a compressed format */
-      texImage->IsCompressed = GL_TRUE;
-      texImage->CompressedSize =
-         ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
-                                           texImage->Height, texImage->Depth,
-                                           texImage->TexFormat->MesaFormat);
-   }
-   else {
-      /* non-compressed format */
-      texImage->IsCompressed = GL_FALSE;
-      texImage->CompressedSize = 0;
-   }
+   GLuint stride = _mesa_format_row_stride(texImage->TexFormat,
+                                           texImage->Width);
+   return stride;
 }
 
 
@@ -3366,16 +3391,11 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
                        struct gl_texture_object *texObj,
                        struct gl_texture_image *texImage)
 {
-   GLint sizeInBytes;
+   GLuint sizeInBytes;
    (void) border;
 
-   choose_texture_format(ctx, texImage, 1, format, type, internalFormat);
-
    /* allocate memory */
-   if (texImage->IsCompressed)
-      sizeInBytes = texImage->CompressedSize;
-   else
-      sizeInBytes = texImage->Width * texImage->TexFormat->TexelBytes;
+   sizeInBytes = texture_size(texImage);
    texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
    if (!texImage->Data) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
@@ -3392,26 +3412,19 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
    }
    else {
       const GLint dstRowStride = 0;
-      GLboolean success;
-      ASSERT(texImage->TexFormat->StoreImage);
-      success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
-                                                texImage->TexFormat,
-                                                texImage->Data,
-                                                0, 0, 0,  /* dstX/Y/Zoffset */
-                                                dstRowStride,
-                                                texImage->ImageOffsets,
-                                                width, 1, 1,
-                                                format, type, pixels, packing);
+      GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
+                                         texImage->TexFormat,
+                                         texImage->Data,
+                                         0, 0, 0,  /* dstX/Y/Zoffset */
+                                         dstRowStride,
+                                         texImage->ImageOffsets,
+                                         width, 1, 1,
+                                         format, type, pixels, packing);
       if (!success) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
       }
    }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, packing);
 }
 
@@ -3435,18 +3448,11 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
                        struct gl_texture_object *texObj,
                        struct gl_texture_image *texImage)
 {
-   GLint texelBytes, sizeInBytes;
+   GLuint sizeInBytes;
    (void) border;
 
-   choose_texture_format(ctx, texImage, 2, format, type, internalFormat);
-
-   texelBytes = texImage->TexFormat->TexelBytes;
-
    /* allocate memory */
-   if (texImage->IsCompressed)
-      sizeInBytes = texImage->CompressedSize;
-   else
-      sizeInBytes = texImage->Width * texImage->Height * texelBytes;
+   sizeInBytes = texture_size(texImage);
    texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
    if (!texImage->Data) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
@@ -3462,34 +3468,20 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
       return;
    }
    else {
-      GLint dstRowStride;
-      GLboolean success;
-      if (texImage->IsCompressed) {
-         dstRowStride
-            = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
-      }
-      else {
-         dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
-      }
-      ASSERT(texImage->TexFormat->StoreImage);
-      success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
-                                                texImage->TexFormat,
-                                                texImage->Data,
-                                                0, 0, 0,  /* dstX/Y/Zoffset */
-                                                dstRowStride,
-                                                texImage->ImageOffsets,
-                                                width, height, 1,
-                                                format, type, pixels, packing);
+      GLint dstRowStride = texture_row_stride(texImage);
+      GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
+                                         texImage->TexFormat,
+                                         texImage->Data,
+                                         0, 0, 0,  /* dstX/Y/Zoffset */
+                                         dstRowStride,
+                                         texImage->ImageOffsets,
+                                         width, height, 1,
+                                         format, type, pixels, packing);
       if (!success) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
       }
    }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, packing);
 }
 
@@ -3509,18 +3501,11 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
                        struct gl_texture_object *texObj,
                        struct gl_texture_image *texImage)
 {
-   GLint texelBytes, sizeInBytes;
+   GLuint sizeInBytes;
    (void) border;
 
-   choose_texture_format(ctx, texImage, 3, format, type, internalFormat);
-
-   texelBytes = texImage->TexFormat->TexelBytes;
-
    /* allocate memory */
-   if (texImage->IsCompressed)
-      sizeInBytes = texImage->CompressedSize;
-   else
-      sizeInBytes = width * height * depth * texelBytes;
+   sizeInBytes = texture_size(texImage);
    texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
    if (!texImage->Data) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
@@ -3536,34 +3521,20 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
       return;
    }
    else {
-      GLint dstRowStride;
-      GLboolean success;
-      if (texImage->IsCompressed) {
-         dstRowStride
-            = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
-      }
-      else {
-         dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
-      }
-      ASSERT(texImage->TexFormat->StoreImage);
-      success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
-                                                texImage->TexFormat,
-                                                texImage->Data,
-                                                0, 0, 0,  /* dstX/Y/Zoffset */
-                                                dstRowStride,
-                                                texImage->ImageOffsets,
-                                                width, height, depth,
-                                                format, type, pixels, packing);
+      GLint dstRowStride = texture_row_stride(texImage);
+      GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
+                                         texImage->TexFormat,
+                                         texImage->Data,
+                                         0, 0, 0,  /* dstX/Y/Zoffset */
+                                         dstRowStride,
+                                         texImage->ImageOffsets,
+                                         width, height, depth,
+                                         format, type, pixels, packing);
       if (!success) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
       }
    }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, packing);
 }
 
@@ -3590,26 +3561,19 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
 
    {
       const GLint dstRowStride = 0;
-      GLboolean success;
-      ASSERT(texImage->TexFormat->StoreImage);
-      success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
-                                                texImage->TexFormat,
-                                                texImage->Data,
-                                                xoffset, 0, 0,  /* offsets */
-                                                dstRowStride,
-                                                texImage->ImageOffsets,
-                                                width, 1, 1,
-                                                format, type, pixels, packing);
+      GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
+                                         texImage->TexFormat,
+                                         texImage->Data,
+                                         xoffset, 0, 0,  /* offsets */
+                                         dstRowStride,
+                                         texImage->ImageOffsets,
+                                         width, 1, 1,
+                                         format, type, pixels, packing);
       if (!success) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
       }
    }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, packing);
 }
 
@@ -3635,34 +3599,20 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
       return;
 
    {
-      GLint dstRowStride = 0;
-      GLboolean success;
-      if (texImage->IsCompressed) {
-         dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
-                                                    texImage->Width);
-      }
-      else {
-         dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
-      }
-      ASSERT(texImage->TexFormat->StoreImage);
-      success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
-                                                texImage->TexFormat,
-                                                texImage->Data,
-                                                xoffset, yoffset, 0,
-                                                dstRowStride,
-                                                texImage->ImageOffsets,
-                                                width, height, 1,
-                                                format, type, pixels, packing);
+      GLint dstRowStride = texture_row_stride(texImage);
+      GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
+                                         texImage->TexFormat,
+                                         texImage->Data,
+                                         xoffset, yoffset, 0,
+                                         dstRowStride,
+                                         texImage->ImageOffsets,
+                                         width, height, 1,
+                                         format, type, pixels, packing);
       if (!success) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
       }
    }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, packing);
 }
 
@@ -3688,34 +3638,20 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
       return;
 
    {
-      GLint dstRowStride;
-      GLboolean success;
-      if (texImage->IsCompressed) {
-         dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
-                                                    texImage->Width);
-      }
-      else {
-         dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes;
-      }
-      ASSERT(texImage->TexFormat->StoreImage);
-      success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
-                                                texImage->TexFormat,
-                                                texImage->Data,
-                                                xoffset, yoffset, zoffset,
-                                                dstRowStride,
-                                                texImage->ImageOffsets,
-                                                width, height, depth,
-                                                format, type, pixels, packing);
+      GLint dstRowStride = texture_row_stride(texImage);
+      GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
+                                         texImage->TexFormat,
+                                         texImage->Data,
+                                         xoffset, yoffset, zoffset,
+                                         dstRowStride,
+                                         texImage->ImageOffsets,
+                                         width, height, depth,
+                                         format, type, pixels, packing);
       if (!success) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
       }
    }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, packing);
 }
 
@@ -3766,8 +3702,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
    ASSERT(texImage->Depth == 1);
    ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
 
-   choose_texture_format(ctx, texImage, 2, 0, 0, internalFormat);
-
    /* allocate storage */
    texImage->Data = _mesa_alloc_texmemory(imageSize);
    if (!texImage->Data) {
@@ -3782,14 +3716,8 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
       return;
 
    /* copy the data */
-   ASSERT(texImage->CompressedSize == (GLuint) imageSize);
    MEMCPY(texImage->Data, data, imageSize);
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
 }
 
@@ -3860,15 +3788,20 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
    GLint i, rows;
    GLubyte *dest;
    const GLubyte *src;
-   const GLuint mesaFormat = texImage->TexFormat->MesaFormat;
+   const gl_format texFormat = texImage->TexFormat;
+   const GLint destWidth = texImage->Width;
+   GLuint bw, bh;
 
+   _mesa_get_format_block_size(texFormat, &bw, &bh);
+
+   (void) level;
    (void) format;
 
    /* these should have been caught sooner */
-   ASSERT((width & 3) == 0 || width == 2 || width == 1);
-   ASSERT((height & 3) == 0 || height == 2 || height == 1);
-   ASSERT((xoffset & 3) == 0);
-   ASSERT((yoffset & 3) == 0);
+   ASSERT((width % bw) == 0 || width == 2 || width == 1);
+   ASSERT((height % bh) == 0 || height == 2 || height == 1);
+   ASSERT((xoffset % bw) == 0);
+   ASSERT((yoffset % bh) == 0);
 
    /* get pointer to src pixels (may be in a pbo which we'll map here) */
    data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
@@ -3877,29 +3810,24 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
    if (!data)
       return;
 
-   srcRowStride = _mesa_compressed_row_stride(mesaFormat, width);
+   srcRowStride = _mesa_format_row_stride(texFormat, width);
    src = (const GLubyte *) data;
 
-   destRowStride = _mesa_compressed_row_stride(mesaFormat, texImage->Width);
+   destRowStride = _mesa_format_row_stride(texFormat, destWidth);
    dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
-                                         texImage->TexFormat->MesaFormat,
-                                         texImage->Width,
+                                         texFormat, destWidth,
                                          (GLubyte *) texImage->Data);
 
-   bytesPerRow = srcRowStride;
-   rows = height / 4;
+   bytesPerRow = srcRowStride;  /* bytes per row of blocks */
+   rows = height / bh;  /* rows in blocks */
 
+   /* copy rows of blocks */
    for (i = 0; i < rows; i++) {
       MEMCPY(dest, src, bytesPerRow);
       dest += destRowStride;
       src += srcRowStride;
    }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
 }
 
diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h
index 313f2d6a5..3211086dd 100644
--- a/mesalib/src/mesa/main/texstore.h
+++ b/mesalib/src/mesa/main/texstore.h
@@ -37,49 +37,40 @@
 
 
 #include "mtypes.h"
+#include "formats.h"
 
 
-extern GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_color_index(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb565_rev(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba4444(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_argb4444_rev(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_argb1555_rev(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_al88(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_al88_rev(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_s8_z24(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
-#if FEATURE_EXT_texture_sRGB
-extern GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS);
-#endif
-extern GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS);
-extern GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS);
+/**
+ * This macro defines the (many) parameters to the texstore functions.
+ * \param dims  either 1 or 2 or 3
+ * \param baseInternalFormat  user-specified base internal format
+ * \param dstFormat  destination Mesa texture format
+ * \param dstAddr  destination image address
+ * \param dstX/Y/Zoffset  destination x/y/z offset (ala TexSubImage), in texels
+ * \param dstRowStride  destination image row stride, in bytes
+ * \param dstImageOffsets  offset of each 2D slice within 3D texture, in texels
+ * \param srcWidth/Height/Depth  source image size, in pixels
+ * \param srcFormat  incoming image format
+ * \param srcType  incoming image data type
+ * \param srcAddr  source image address
+ * \param srcPacking  source image packing parameters
+ */
+#define TEXSTORE_PARAMS \
+	GLcontext *ctx, GLuint dims, \
+	GLenum baseInternalFormat, \
+	gl_format dstFormat, \
+	GLvoid *dstAddr, \
+	GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
+	GLint dstRowStride, const GLuint *dstImageOffsets, \
+	GLint srcWidth, GLint srcHeight, GLint srcDepth, \
+	GLenum srcFormat, GLenum srcType, \
+	const GLvoid *srcAddr, \
+	const struct gl_pixelstore_attrib *srcPacking
+
+
+extern GLboolean
+_mesa_texstore(TEXSTORE_PARAMS);
+
 
 extern GLchan *
 _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
@@ -91,10 +82,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
                            const struct gl_pixelstore_attrib *srcPacking);
 
 
-extern void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
-
-
 extern void
 _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
                        GLint internalFormat,
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 6cd2a2f4f..c2193074c 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -51,9 +51,8 @@
  * \param stride  stride between elements, in elements
  * \param normalized  are integer types converted to floats in [-1, 1]?
  * \param ptr  the address (or offset inside VBO) of the array data
- * \return GL_TRUE if no error, GL_FALSE if error
  */
-static GLboolean
+static void
 update_array(GLcontext *ctx, struct gl_client_array *array,
              GLbitfield dirtyBit, GLsizei elementSize,
              GLint size, GLenum type, GLenum format,
@@ -68,7 +67,7 @@ update_array(GLcontext *ctx, struct gl_client_array *array,
        */
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glVertex/Normal/EtcPointer(non-VBO array)");
-      return GL_FALSE;
+      return;
    }
 
    array->Size = size;
@@ -85,8 +84,6 @@ update_array(GLcontext *ctx, struct gl_client_array *array,
 
    ctx->NewState |= _NEW_ARRAY;
    ctx->Array.NewState |= dirtyBit;
-
-   return GL_TRUE;
 }
 
 
@@ -140,12 +137,8 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX,
-                     elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr))
-      return;
-
-   if (ctx->Driver.VertexPointer)
-      ctx->Driver.VertexPointer( ctx, size, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX,
+                elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr);
 }
 
 
@@ -192,12 +185,8 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL,
-                     elementSize, 3, type, GL_RGBA, stride, GL_TRUE, ptr))
-      return;
-
-   if (ctx->Driver.NormalPointer)
-      ctx->Driver.NormalPointer( ctx, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL,
+                elementSize, 3, type, GL_RGBA, stride, GL_TRUE, ptr);
 }
 
 
@@ -272,12 +261,8 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0,
-                     elementSize, size, type, format, stride, GL_TRUE, ptr))
-      return;
-
-   if (ctx->Driver.ColorPointer)
-      ctx->Driver.ColorPointer( ctx, size, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0,
+                elementSize, size, type, format, stride, GL_TRUE, ptr);
 }
 
 
@@ -305,12 +290,8 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD,
-                     elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr))
-      return;
-
-   if (ctx->Driver.FogCoordPointer)
-      ctx->Driver.FogCoordPointer( ctx, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD,
+                elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr);
 }
 
 
@@ -347,12 +328,8 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX,
-                     elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr))
-      return;
-
-   if (ctx->Driver.IndexPointer)
-      ctx->Driver.IndexPointer( ctx, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX,
+                elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr);
 }
 
 
@@ -423,13 +400,8 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->SecondaryColor,
-                     _NEW_ARRAY_COLOR1, elementSize, size, type,
-                     format, stride, GL_TRUE, ptr))
-      return;
-
-   if (ctx->Driver.SecondaryColorPointer)
-      ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1,
+                elementSize, size, type, format, stride, GL_TRUE, ptr);
 }
 
 
@@ -485,13 +457,9 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->TexCoord[unit],
-                     _NEW_ARRAY_TEXCOORD(unit),
-                     elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr))
-      return;
-
-   if (ctx->Driver.TexCoordPointer)
-      ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->TexCoord[unit],
+                _NEW_ARRAY_TEXCOORD(unit),
+                elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr);
 }
 
 
@@ -506,13 +474,9 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
       return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG,
-                     sizeof(GLboolean), 1, GL_UNSIGNED_BYTE, GL_RGBA,
-                     stride, GL_FALSE, ptr))
-      return;
-
-   if (ctx->Driver.EdgeFlagPointer)
-      ctx->Driver.EdgeFlagPointer( ctx, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG,
+                sizeof(GLboolean), 1, GL_UNSIGNED_BYTE, GL_RGBA,
+                stride, GL_FALSE, ptr);
 }
 
 
@@ -620,13 +584,9 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index],
-                     _NEW_ARRAY_ATTRIB(index),
-                     elementSize, size, type, format, stride, normalized, ptr))
-      return;
-
-   if (ctx->Driver.VertexAttribPointer)
-      ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
+   update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index],
+                _NEW_ARRAY_ATTRIB(index),
+                elementSize, size, type, format, stride, normalized, ptr);
 }
 #endif
 
@@ -720,13 +680,9 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
          return;
    }
 
-   if (!update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index],
-                     _NEW_ARRAY_ATTRIB(index),
-                     elementSize, size, type, format, stride, normalized, ptr))
-      return;
-
-   if (ctx->Driver.VertexAttribPointer)
-      ctx->Driver.VertexAttribPointer(ctx, index, size, type, stride, ptr);
+   update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index],
+                _NEW_ARRAY_ATTRIB(index),
+                elementSize, size, type, format, stride, normalized, ptr);
 }
 #endif
 
@@ -989,9 +945,6 @@ _mesa_LockArraysEXT(GLint first, GLsizei count)
 
    ctx->NewState |= _NEW_ARRAY;
    ctx->Array.NewState |= _NEW_ARRAY_ALL;
-
-   if (ctx->Driver.LockArraysEXT)
-      ctx->Driver.LockArraysEXT( ctx, first, count );
 }
 
 
@@ -1013,9 +966,6 @@ _mesa_UnlockArraysEXT( void )
    ctx->Array.LockCount = 0;
    ctx->NewState |= _NEW_ARRAY;
    ctx->Array.NewState |= _NEW_ARRAY_ALL;
-
-   if (ctx->Driver.UnlockArraysEXT)
-      ctx->Driver.UnlockArraysEXT( ctx );
 }
 
 
diff --git a/mesalib/src/mesa/main/varray.h b/mesalib/src/mesa/main/varray.h
index becc67c29..ef790c504 100644
--- a/mesalib/src/mesa/main/varray.h
+++ b/mesalib/src/mesa/main/varray.h
@@ -129,6 +129,11 @@ extern void GLAPIENTRY
 _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
                             const GLvoid **indices, GLsizei primcount );
 
+extern void GLAPIENTRY
+_mesa_MultiDrawElementsBaseVertex( GLenum mode,
+				   const GLsizei *count, GLenum type,
+				   const GLvoid **indices, GLsizei primcount,
+				   const GLint *basevertex);
 
 extern void GLAPIENTRY
 _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
@@ -159,6 +164,16 @@ extern void GLAPIENTRY
 _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
                         GLenum type, const GLvoid *indices);
 
+extern void GLAPIENTRY
+_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
+			     const GLvoid *indices, GLint basevertex);
+
+extern void GLAPIENTRY
+_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
+				  GLsizei count, GLenum type,
+				  const GLvoid *indices,
+				  GLint basevertex);
+
 
 extern void
 _mesa_copy_client_array(GLcontext *ctx,
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index 3e9143979..9c758ce3b 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.6.1
+ * Version:  7.7
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
@@ -30,9 +30,9 @@
 
 /* Mesa version */
 #define MESA_MAJOR 7
-#define MESA_MINOR 6
-#define MESA_PATCH 1
-#define MESA_VERSION_STRING "7.6.1-rc1"
+#define MESA_MINOR 7
+#define MESA_PATCH 0
+#define MESA_VERSION_STRING "7.7"
 
 /* To make version comparison easy */
 #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 8d6f560a8..c9eea8ab8 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -27,12 +27,18 @@
  */
 
 #include "glheader.h"
+#include "api_arrayelt.h"
 #include "api_loopback.h"
 #include "context.h"
 #include "imports.h"
 #include "mtypes.h"
 #include "state.h"
 #include "vtxfmt.h"
+#include "eval.h"
+#include "dlist.h"
+
+
+#if FEATURE_beginend
 
 
 /* The neutral vertex format.  This wraps all tnl module functions,
@@ -82,18 +88,16 @@
 static void
 install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
 {
-   SET_ArrayElement(tab, vfmt->ArrayElement);
+   _mesa_install_arrayelt_vtxfmt(tab, vfmt);
+
    SET_Color3f(tab, vfmt->Color3f);
    SET_Color3fv(tab, vfmt->Color3fv);
    SET_Color4f(tab, vfmt->Color4f);
    SET_Color4fv(tab, vfmt->Color4fv);
    SET_EdgeFlag(tab, vfmt->EdgeFlag);
-   SET_EvalCoord1f(tab, vfmt->EvalCoord1f);
-   SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv);
-   SET_EvalCoord2f(tab, vfmt->EvalCoord2f);
-   SET_EvalCoord2fv(tab, vfmt->EvalCoord2fv);
-   SET_EvalPoint1(tab, vfmt->EvalPoint1);
-   SET_EvalPoint2(tab, vfmt->EvalPoint2);
+
+   _mesa_install_eval_vtxfmt(tab, vfmt);
+
    SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
    SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
    SET_Indexf(tab, vfmt->Indexf);
@@ -125,8 +129,9 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
    SET_Vertex3fv(tab, vfmt->Vertex3fv);
    SET_Vertex4f(tab, vfmt->Vertex4f);
    SET_Vertex4fv(tab, vfmt->Vertex4fv);
-   SET_CallList(tab, vfmt->CallList);
-   SET_CallLists(tab, vfmt->CallLists);
+
+   _mesa_install_dlist_vtxfmt(tab, vfmt);
+
    SET_Begin(tab, vfmt->Begin);
    SET_End(tab, vfmt->End);
    SET_Rectf(tab, vfmt->Rectf);
@@ -134,9 +139,9 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
    SET_DrawElements(tab, vfmt->DrawElements);
    SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
    SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT);
-   SET_EvalMesh1(tab, vfmt->EvalMesh1);
-   SET_EvalMesh2(tab, vfmt->EvalMesh2);
-   ASSERT(tab->EvalMesh2);
+   SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex);
+   SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex);
+   SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex);
 
    /* GL_NV_vertex_program */
    SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
@@ -193,3 +198,6 @@ void _mesa_restore_exec_vtxfmt( GLcontext *ctx )
 
    tnl->SwapCount = 0;
 }
+
+
+#endif /* FEATURE_beginend */
diff --git a/mesalib/src/mesa/main/vtxfmt.h b/mesalib/src/mesa/main/vtxfmt.h
index 76f108e02..fb6c23abe 100644
--- a/mesalib/src/mesa/main/vtxfmt.h
+++ b/mesalib/src/mesa/main/vtxfmt.h
@@ -33,6 +33,8 @@
 #ifndef _VTXFMT_H_
 #define _VTXFMT_H_
 
+#if FEATURE_beginend
+
 extern void _mesa_init_exec_vtxfmt( GLcontext *ctx );
 
 extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt );
@@ -40,4 +42,28 @@ extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfm
 
 extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx );
 
-#endif
+#else /* FEATURE_beginend */
+
+static INLINE void
+_mesa_init_exec_vtxfmt( GLcontext *ctx )
+{
+}
+
+static INLINE void
+_mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+{
+}
+
+static INLINE void
+_mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+{
+}
+
+static INLINE void
+_mesa_restore_exec_vtxfmt( GLcontext *ctx )
+{
+}
+
+#endif /* FEATURE_beginend */
+
+#endif /* _VTXFMT_H_ */
diff --git a/mesalib/src/mesa/main/vtxfmt_tmp.h b/mesalib/src/mesa/main/vtxfmt_tmp.h
index 1308d0aa4..ae636fb24 100644
--- a/mesalib/src/mesa/main/vtxfmt_tmp.h
+++ b/mesalib/src/mesa/main/vtxfmt_tmp.h
@@ -30,7 +30,6 @@
 #endif
 
 #include "glapi/dispatch.h"
-#include "glapi/glapioffsets.h"
 
 static void GLAPIENTRY TAG(ArrayElement)( GLint i )
 {
@@ -354,6 +353,44 @@ static void GLAPIENTRY TAG(DrawRangeElements)( GLenum mode, GLuint start,
    CALL_DrawRangeElements(GET_DISPATCH(), ( mode, start, end, count, type, indices ));
 }
 
+static void GLAPIENTRY TAG(DrawElementsBaseVertex)( GLenum mode,
+						    GLsizei count,
+						    GLenum type,
+						    const GLvoid *indices,
+						    GLint basevertex)
+{
+   PRE_LOOPBACK( DrawElementsBaseVertex );
+   CALL_DrawElementsBaseVertex(GET_DISPATCH(), ( mode, count, type,
+						 indices, basevertex ));
+}
+
+static void GLAPIENTRY TAG(DrawRangeElementsBaseVertex)( GLenum mode,
+							 GLuint start,
+							 GLuint end,
+							 GLsizei count,
+							 GLenum type,
+							 const GLvoid *indices,
+							 GLint basevertex)
+{
+   PRE_LOOPBACK( DrawRangeElementsBaseVertex );
+   CALL_DrawRangeElementsBaseVertex(GET_DISPATCH(), ( mode, start, end,
+						      count, type, indices,
+						      basevertex ));
+}
+
+static void GLAPIENTRY TAG(MultiDrawElementsBaseVertex)( GLenum mode,
+							 const GLsizei *count,
+							 GLenum type,
+							 const GLvoid **indices,
+							 GLsizei primcount,
+							 const GLint *basevertex)
+{
+   PRE_LOOPBACK( MultiDrawElementsBaseVertex );
+   CALL_MultiDrawElementsBaseVertex(GET_DISPATCH(), ( mode, count, type,
+						      indices,
+						      primcount, basevertex ));
+}
+
 static void GLAPIENTRY TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 )
 {
    PRE_LOOPBACK( EvalMesh1 );
@@ -534,6 +571,9 @@ static GLvertexformat TAG(vtxfmt) = {
    TAG(DrawElements),
    TAG(DrawRangeElements),
    TAG(MultiDrawElementsEXT),
+   TAG(DrawElementsBaseVertex),
+   TAG(DrawRangeElementsBaseVertex),
+   TAG(MultiDrawElementsBaseVertex),
    TAG(EvalMesh1),
    TAG(EvalMesh2)
 };
-- 
cgit v1.2.3