summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/Imakefile129
-rw-r--r--src/mesa/main/KNOWN_BUGS21
-rw-r--r--src/mesa/main/Makefile.ugl364
-rw-r--r--src/mesa/main/Makefile.win208
-rw-r--r--src/mesa/main/api_arrayelt.c475
-rw-r--r--src/mesa/main/api_loopback.c11
-rw-r--r--src/mesa/main/api_noop.c302
-rw-r--r--src/mesa/main/api_noop.h125
-rw-r--r--src/mesa/main/attrib.c36
-rw-r--r--src/mesa/main/bitset.h122
-rw-r--r--src/mesa/main/buffers.c7
-rw-r--r--src/mesa/main/buffers.h2
-rw-r--r--src/mesa/main/colortab.c64
-rw-r--r--src/mesa/main/config.h11
-rw-r--r--src/mesa/main/context.c47
-rw-r--r--src/mesa/main/dd.h4
-rw-r--r--src/mesa/main/depthstencil.c6
-rw-r--r--src/mesa/main/descrip.mms2
-rw-r--r--src/mesa/main/dlist.c59
-rw-r--r--src/mesa/main/execmem.c6
-rw-r--r--src/mesa/main/fbobject.c76
-rw-r--r--src/mesa/main/framebuffer.c68
-rw-r--r--src/mesa/main/framebuffer.h5
-rw-r--r--src/mesa/main/get.c24
-rw-r--r--src/mesa/main/get_gen.py1194
-rw-r--r--src/mesa/main/getstring.c8
-rw-r--r--src/mesa/main/glheader.h9
-rw-r--r--src/mesa/main/image.c92
-rw-r--r--src/mesa/main/imports.c41
-rw-r--r--src/mesa/main/imports.h4
-rw-r--r--src/mesa/main/light.c8
-rw-r--r--src/mesa/main/matrix.c8
-rw-r--r--src/mesa/main/mm.c184
-rw-r--r--src/mesa/main/mm.h12
-rw-r--r--src/mesa/main/mtypes.h217
-rw-r--r--src/mesa/main/occlude.c1
-rw-r--r--src/mesa/main/rastpos.c6
-rw-r--r--src/mesa/main/rbadaptors.c577
-rw-r--r--src/mesa/main/rbadaptors.h40
-rw-r--r--src/mesa/main/renderbuffer.c89
-rw-r--r--src/mesa/main/renderbuffer.h5
-rw-r--r--src/mesa/main/state.c28
-rw-r--r--src/mesa/main/texcompress.c148
-rw-r--r--src/mesa/main/texcompress.h25
-rw-r--r--src/mesa/main/texcompress_fxt1.c12
-rw-r--r--src/mesa/main/texcompress_s3tc.c94
-rw-r--r--src/mesa/main/texenvprogram.c162
-rw-r--r--src/mesa/main/texenvprogram.h1
-rw-r--r--src/mesa/main/texformat.c108
-rw-r--r--src/mesa/main/texformat.h22
-rw-r--r--src/mesa/main/texformat_tmp.h48
-rw-r--r--src/mesa/main/teximage.c86
-rw-r--r--src/mesa/main/texrender.c77
-rw-r--r--src/mesa/main/texstate.c161
-rw-r--r--src/mesa/main/texstore.c656
-rw-r--r--src/mesa/main/texstore.h77
-rw-r--r--src/mesa/main/varray.c33
-rw-r--r--src/mesa/main/version.h8
-rw-r--r--src/mesa/main/vtxfmt.c24
-rw-r--r--src/mesa/main/vtxfmt_tmp.h7
60 files changed, 5106 insertions, 1340 deletions
diff --git a/src/mesa/main/Imakefile b/src/mesa/main/Imakefile
new file mode 100644
index 00000000000..fe0658c6c76
--- /dev/null
+++ b/src/mesa/main/Imakefile
@@ -0,0 +1,129 @@
+#define DoNormalLib NO
+#define DoSharedLib YES
+#define DoDebugLib NO
+#define DoProfileLib NO
+#define LibName MESAGL
+#define SoRev SOX11REV
+#define LibHeaders NO
+
+#include <Threads.tmpl>
+
+REQUIREDLIBS = $(X11ROOT)\\XFree86\\lib\\ Xext X11
+BUILDLIBDIR = $(TOP)\\lib
+
+INCLUDES = -I$(TOP)\\include
+
+SRCS = \
+accum.c \
+alpha.c \
+alphabuf.c \
+api1.c \
+api2.c \
+attrib.c \
+bitmap.c \
+blend.c \
+bresenhm.c \
+clip.c \
+context.c \
+copypix.c \
+dd.c \
+depth.c \
+draw.c \
+drawpix.c \
+enable.c \
+eval2.c \
+feedback.c \
+fog.c \
+fortran.c \
+get.c \
+hash.c \
+glx.c \
+interp.c \
+light.c \
+lines.c \
+list.c \
+logic.c \
+masking.c \
+misc.c \
+osmesa.c \
+pb.c \
+pixel.c \
+points.c \
+polygons.c \
+readpix.c \
+scissor.c \
+span.c \
+stencil.c \
+svgamesa.c \
+texture.c \
+varray.c \
+vb.c \
+vertex.c \
+xfonts.c \
+xform.c \
+xm_api.c \
+xm_dd.c \
+xm_line.c \
+xm_span.c \
+xm_tri.c
+
+OBJS = \
+accum.o \
+alpha.o \
+alphabuf.o \
+api1.o \
+api2.o \
+attrib.o \
+bitmap.o \
+blend.o \
+bresenhm.o \
+clip.o \
+context.o \
+copypix.o \
+dd.o \
+depth.o \
+draw.o \
+drawpix.o \
+enable.o \
+eval2.o \
+feedback.o \
+fog.o \
+fortran.o \
+get.o \
+hash.o \
+glx.o \
+interp.o \
+light.o \
+lines.o \
+list.o \
+logic.o \
+masking.o \
+misc.o \
+osmesa.o \
+pb.o \
+pixel.o \
+points.o \
+polygons.o \
+readpix.o \
+scissor.o \
+span.o \
+stencil.o \
+svgamesa.o \
+texture.o \
+varray.o \
+vb.o \
+vertex.o \
+xfonts.o \
+xform.o \
+xm_api.o \
+xm_dd.o \
+xm_line.o \
+xm_span.o \
+xm_tri.o
+
+LINTLIBS =
+
+#include <Library.tmpl>
+
+DependTarget()
+
diff --git a/src/mesa/main/KNOWN_BUGS b/src/mesa/main/KNOWN_BUGS
new file mode 100644
index 00000000000..efbb0ca40fc
--- /dev/null
+++ b/src/mesa/main/KNOWN_BUGS
@@ -0,0 +1,21 @@
+
+
+Performance issues with EXT_point_parameters & quake2
+
+
+
+Using glPolygonMode() where the front and back modes aren't the
+same causes poor performance on 3Dfx.
+
+
+
+Broken drivers: some of the Mesa device drivers (such as BeOS, D3D,
+etc) haven't been updated for Mesa 3.3's device driver changes.
+
+
+
+glDrawRangeElements() should use vertex array locking to improve performance
+but trying to do so causes a rendering error. Reported by Scott McMillan.
+Fixed by disabling locking in glDrawRangeElements (varray.c) but that's
+really just hiding a bug in array locking.
+
diff --git a/src/mesa/main/Makefile.ugl b/src/mesa/main/Makefile.ugl
new file mode 100644
index 00000000000..b440e136436
--- /dev/null
+++ b/src/mesa/main/Makefile.ugl
@@ -0,0 +1,364 @@
+# 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/src/mesa/main/Makefile.win b/src/mesa/main/Makefile.win
new file mode 100644
index 00000000000..a27f44c112e
--- /dev/null
+++ b/src/mesa/main/Makefile.win
@@ -0,0 +1,208 @@
+# 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/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index e905f164025..9c65ae5b9a1 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -147,7 +147,10 @@ static const int NormalFuncs[8] = {
static int SecondaryColorFuncs[8];
static int FogCoordFuncs[8];
-/**********************************************************************/
+
+/**
+ ** GL_NV_vertex_program
+ **/
/* GL_BYTE attributes */
@@ -580,6 +583,442 @@ static attrib_func AttribFuncsNV[2][4][8] = {
}
};
+
+/**
+ ** GL_ARB_vertex_program
+ **/
+
+/* GL_BYTE attributes */
+
+static void GLAPIENTRY VertexAttrib1NbvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0])));
+}
+
+static void GLAPIENTRY VertexAttrib1bvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])));
+}
+
+static void GLAPIENTRY VertexAttrib2bvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
+ BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2])));
+}
+
+static void GLAPIENTRY VertexAttrib3bvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
+ BYTE_TO_FLOAT(v[1]),
+ BYTE_TO_FLOAT(v[2]),
+ BYTE_TO_FLOAT(v[3])));
+}
+
+static void GLAPIENTRY VertexAttrib4bvARB(GLuint index, const GLbyte *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+}
+
+/* GL_UNSIGNED_BYTE attributes */
+
+static void GLAPIENTRY VertexAttrib1NubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0])));
+}
+
+static void GLAPIENTRY VertexAttrib1ubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1])));
+}
+
+static void GLAPIENTRY VertexAttrib2ubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2])));
+}
+static void GLAPIENTRY VertexAttrib3ubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]),
+ UBYTE_TO_FLOAT(v[3])));
+}
+
+static void GLAPIENTRY VertexAttrib4ubvARB(GLuint index, const GLubyte *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+}
+
+/* GL_SHORT attributes */
+
+static void GLAPIENTRY VertexAttrib1NsvARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0])));
+}
+
+static void GLAPIENTRY VertexAttrib1svARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
+ SHORT_TO_FLOAT(v[1])));
+}
+
+static void GLAPIENTRY VertexAttrib2svARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
+ SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2])));
+}
+
+static void GLAPIENTRY VertexAttrib3svARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
+ SHORT_TO_FLOAT(v[1]),
+ SHORT_TO_FLOAT(v[2]),
+ SHORT_TO_FLOAT(v[3])));
+}
+
+static void GLAPIENTRY VertexAttrib4svARB(GLuint index, const GLshort *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+}
+
+/* GL_UNSIGNED_SHORT attributes */
+
+static void GLAPIENTRY VertexAttrib1NusvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0])));
+}
+
+static void GLAPIENTRY VertexAttrib1usvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
+ USHORT_TO_FLOAT(v[1])));
+}
+
+static void GLAPIENTRY VertexAttrib2usvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
+ USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2])));
+}
+
+static void GLAPIENTRY VertexAttrib3usvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
+ USHORT_TO_FLOAT(v[1]),
+ USHORT_TO_FLOAT(v[2]),
+ USHORT_TO_FLOAT(v[3])));
+}
+
+static void GLAPIENTRY VertexAttrib4usvARB(GLuint index, const GLushort *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+}
+
+/* GL_INT attributes */
+
+static void GLAPIENTRY VertexAttrib1NivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0])));
+}
+
+static void GLAPIENTRY VertexAttrib1ivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
+ INT_TO_FLOAT(v[1])));
+}
+
+static void GLAPIENTRY VertexAttrib2ivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
+ INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2])));
+}
+
+static void GLAPIENTRY VertexAttrib3ivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
+ INT_TO_FLOAT(v[1]),
+ INT_TO_FLOAT(v[2]),
+ INT_TO_FLOAT(v[3])));
+}
+
+static void GLAPIENTRY VertexAttrib4ivARB(GLuint index, const GLint *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+}
+
+/* GL_UNSIGNED_INT attributes */
+
+static void GLAPIENTRY VertexAttrib1NuivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0])));
+}
+
+static void GLAPIENTRY VertexAttrib1uivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+}
+
+static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
+ UINT_TO_FLOAT(v[1])));
+}
+
+static void GLAPIENTRY VertexAttrib2uivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+}
+
+static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
+ UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2])));
+}
+
+static void GLAPIENTRY VertexAttrib3uivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+}
+
+static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
+ UINT_TO_FLOAT(v[1]),
+ UINT_TO_FLOAT(v[2]),
+ UINT_TO_FLOAT(v[3])));
+}
+
+static void GLAPIENTRY VertexAttrib4uivARB(GLuint index, const GLuint *v)
+{
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+}
+
+/* GL_FLOAT attributes */
+
+static void GLAPIENTRY VertexAttrib1fvARB(GLuint index, const GLfloat *v)
+{
+ CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY VertexAttrib2fvARB(GLuint index, const GLfloat *v)
+{
+ CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY VertexAttrib3fvARB(GLuint index, const GLfloat *v)
+{
+ CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY VertexAttrib4fvARB(GLuint index, const GLfloat *v)
+{
+ CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index, v));
+}
+
+/* GL_DOUBLE attributes */
+
+static void GLAPIENTRY VertexAttrib1dvARB(GLuint index, const GLdouble *v)
+{
+ CALL_VertexAttrib1dvARB(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY VertexAttrib2dvARB(GLuint index, const GLdouble *v)
+{
+ CALL_VertexAttrib2dvARB(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY VertexAttrib3dvARB(GLuint index, const GLdouble *v)
+{
+ CALL_VertexAttrib3dvARB(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY VertexAttrib4dvARB(GLuint index, const GLdouble *v)
+{
+ CALL_VertexAttrib4dvARB(GET_DISPATCH(), (index, v));
+}
+
+
+/*
+ * Array [size][type] of VertexAttrib functions
+ */
+static attrib_func AttribFuncsARB[2][4][8] = {
+ {
+ /* non-normalized */
+ {
+ /* size 1 */
+ (attrib_func) VertexAttrib1bvARB,
+ (attrib_func) VertexAttrib1ubvARB,
+ (attrib_func) VertexAttrib1svARB,
+ (attrib_func) VertexAttrib1usvARB,
+ (attrib_func) VertexAttrib1ivARB,
+ (attrib_func) VertexAttrib1uivARB,
+ (attrib_func) VertexAttrib1fvARB,
+ (attrib_func) VertexAttrib1dvARB
+ },
+ {
+ /* size 2 */
+ (attrib_func) VertexAttrib2bvARB,
+ (attrib_func) VertexAttrib2ubvARB,
+ (attrib_func) VertexAttrib2svARB,
+ (attrib_func) VertexAttrib2usvARB,
+ (attrib_func) VertexAttrib2ivARB,
+ (attrib_func) VertexAttrib2uivARB,
+ (attrib_func) VertexAttrib2fvARB,
+ (attrib_func) VertexAttrib2dvARB
+ },
+ {
+ /* size 3 */
+ (attrib_func) VertexAttrib3bvARB,
+ (attrib_func) VertexAttrib3ubvARB,
+ (attrib_func) VertexAttrib3svARB,
+ (attrib_func) VertexAttrib3usvARB,
+ (attrib_func) VertexAttrib3ivARB,
+ (attrib_func) VertexAttrib3uivARB,
+ (attrib_func) VertexAttrib3fvARB,
+ (attrib_func) VertexAttrib3dvARB
+ },
+ {
+ /* size 4 */
+ (attrib_func) VertexAttrib4bvARB,
+ (attrib_func) VertexAttrib4ubvARB,
+ (attrib_func) VertexAttrib4svARB,
+ (attrib_func) VertexAttrib4usvARB,
+ (attrib_func) VertexAttrib4ivARB,
+ (attrib_func) VertexAttrib4uivARB,
+ (attrib_func) VertexAttrib4fvARB,
+ (attrib_func) VertexAttrib4dvARB
+ }
+ },
+ {
+ /* normalized (except for float/double) */
+ {
+ /* size 1 */
+ (attrib_func) VertexAttrib1NbvARB,
+ (attrib_func) VertexAttrib1NubvARB,
+ (attrib_func) VertexAttrib1NsvARB,
+ (attrib_func) VertexAttrib1NusvARB,
+ (attrib_func) VertexAttrib1NivARB,
+ (attrib_func) VertexAttrib1NuivARB,
+ (attrib_func) VertexAttrib1fvARB,
+ (attrib_func) VertexAttrib1dvARB
+ },
+ {
+ /* size 2 */
+ (attrib_func) VertexAttrib2NbvARB,
+ (attrib_func) VertexAttrib2NubvARB,
+ (attrib_func) VertexAttrib2NsvARB,
+ (attrib_func) VertexAttrib2NusvARB,
+ (attrib_func) VertexAttrib2NivARB,
+ (attrib_func) VertexAttrib2NuivARB,
+ (attrib_func) VertexAttrib2fvARB,
+ (attrib_func) VertexAttrib2dvARB
+ },
+ {
+ /* size 3 */
+ (attrib_func) VertexAttrib3NbvARB,
+ (attrib_func) VertexAttrib3NubvARB,
+ (attrib_func) VertexAttrib3NsvARB,
+ (attrib_func) VertexAttrib3NusvARB,
+ (attrib_func) VertexAttrib3NivARB,
+ (attrib_func) VertexAttrib3NuivARB,
+ (attrib_func) VertexAttrib3fvARB,
+ (attrib_func) VertexAttrib3dvARB
+ },
+ {
+ /* size 4 */
+ (attrib_func) VertexAttrib4NbvARB,
+ (attrib_func) VertexAttrib4NubvARB,
+ (attrib_func) VertexAttrib4NsvARB,
+ (attrib_func) VertexAttrib4NusvARB,
+ (attrib_func) VertexAttrib4NivARB,
+ (attrib_func) VertexAttrib4NuivARB,
+ (attrib_func) VertexAttrib4fvARB,
+ (attrib_func) VertexAttrib4dvARB
+ }
+ }
+};
+
/**********************************************************************/
@@ -670,14 +1109,16 @@ static void _ae_update_state( GLcontext *ctx )
aa++;
}
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- if (ctx->Array.TexCoord[i].Enabled) {
- /* NOTE: we use generic glVertexAttrib functions here.
- * If we ever de-alias conventional/generic vertex attribs this
- * will have to change.
+ struct gl_client_array *attribArray = &ctx->Array.TexCoord[i];
+ if (attribArray->Enabled) {
+ /* NOTE: we use generic glVertexAttribNV functions here.
+ * If we ever remove GL_NV_vertex_program this will have to change.
*/
- struct gl_client_array *attribArray = &ctx->Array.TexCoord[i];
at->array = attribArray;
- at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)];
+ ASSERT(!at->array->Normalized);
+ at->func = AttribFuncsNV[at->array->Normalized]
+ [at->array->Size-1]
+ [TYPE_IDX(at->array->Type)];
at->index = VERT_ATTRIB_TEX0 + i;
at++;
}
@@ -685,15 +1126,25 @@ static void _ae_update_state( GLcontext *ctx )
/* generic vertex attribute arrays */
for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */
- if (ctx->Array.VertexAttrib[i].Enabled) {
- struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i];
+ struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i];
+ if (attribArray->Enabled) {
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
* the next. Doing so caused UT to break.
*/
- at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)];
+ if (ctx->VertexProgram._Enabled
+ && ctx->VertexProgram.Current->IsNVProgram) {
+ at->func = AttribFuncsNV[at->array->Normalized]
+ [at->array->Size-1]
+ [TYPE_IDX(at->array->Type)];
+ }
+ else {
+ at->func = AttribFuncsARB[at->array->Normalized]
+ [at->array->Size-1]
+ [TYPE_IDX(at->array->Type)];
+ }
at->index = i;
at++;
}
@@ -702,7 +1153,7 @@ static void _ae_update_state( GLcontext *ctx )
/* finally, vertex position */
if (ctx->Array.VertexAttrib[0].Enabled) {
/* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
- * issued as the last (proviking) attribute).
+ * issued as the last (provoking) attribute).
*/
aa->array = &ctx->Array.VertexAttrib[0];
assert(aa->array->Size >= 2); /* XXX fix someday? */
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index db30059e61d..51d5af6f5f0 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -281,6 +281,7 @@ loopback_Color4ubv_f( const GLubyte *v)
UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) );
}
+
static void GLAPIENTRY
loopback_FogCoorddEXT( GLdouble d )
{
@@ -342,6 +343,14 @@ loopback_Indexubv( const GLubyte *c )
INDEX( (GLfloat) *c );
}
+
+static void GLAPIENTRY
+loopback_EdgeFlagv(const GLboolean *flag)
+{
+ CALL_EdgeFlag(GET_DISPATCH(), (*flag));
+}
+
+
static void GLAPIENTRY
loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz )
{
@@ -1483,6 +1492,8 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f);
SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f);
+ SET_EdgeFlagv(dest, loopback_EdgeFlagv);
+
SET_Indexd(dest, loopback_Indexd);
SET_Indexi(dest, loopback_Indexi);
SET_Indexs(dest, loopback_Indexs);
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index af7e1f9ac70..33d44e43296 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * 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"),
@@ -28,48 +28,39 @@
#include "api_validate.h"
#include "api_arrayelt.h"
#include "context.h"
-#include "colormac.h"
#include "light.h"
#include "macros.h"
-#include "mtypes.h"
#include "dlist.h"
#include "dispatch.h"
-/* In states where certain vertex components are required for t&l or
- * rasterization, we still need to keep track of the current values.
- * These functions provide this service by keeping uptodate the
- * 'ctx->Current' struct for all data elements not included in the
- * currently enabled hardware vertex.
- * I.e. these functions would typically be used when outside of glBegin/End.
+/**
+ * \file
+ * Just update the ctx->Current vertex attributes.
+ * These functions are used when outside glBegin/glEnd or outside display
+ * lists.
*/
-void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
+static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
{
GET_CURRENT_CONTEXT(ctx);
ctx->Current.EdgeFlag = b;
}
-void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b )
+static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.EdgeFlag = *b;
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = f;
}
-void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
+static void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Index = f;
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = *v;
}
-void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Current.Index = *v;
-}
-
-void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
+static void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
@@ -79,7 +70,7 @@ void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
dest[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
@@ -89,7 +80,7 @@ void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v )
dest[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
+static void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
@@ -99,7 +90,7 @@ void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
dest[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
@@ -109,7 +100,7 @@ void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v )
dest[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+static void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
@@ -119,7 +110,7 @@ void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
color[3] = d;
}
-void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
@@ -129,7 +120,7 @@ void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v )
color[3] = v[3];
}
-void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
+static void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
@@ -139,7 +130,7 @@ void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
color[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
@@ -149,7 +140,7 @@ void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v )
color[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
+static void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -166,7 +157,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
}
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -183,7 +174,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v
}
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
+static void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -200,7 +191,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat
}
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -217,7 +208,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v
}
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c)
+static void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c)
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -234,7 +225,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat
}
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -251,7 +242,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v
}
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
+static void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
GLfloat c, GLfloat d )
{
GET_CURRENT_CONTEXT(ctx);
@@ -269,7 +260,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat
}
}
-void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLuint unit = target - GL_TEXTURE0_ARB;
@@ -286,7 +277,7 @@ void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v
}
}
-void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
+static void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
@@ -296,7 +287,7 @@ void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c
color[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
@@ -306,7 +297,7 @@ void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
color[3] = 1.0;
}
-void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a )
+static void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -316,7 +307,7 @@ void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a )
dest[3] = 1;
}
-void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -326,7 +317,7 @@ void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v )
dest[3] = 1;
}
-void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
+static void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -336,7 +327,7 @@ void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
dest[3] = 1;
}
-void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -346,7 +337,7 @@ void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v )
dest[3] = 1;
}
-void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
+static void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -356,7 +347,7 @@ void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
dest[3] = 1;
}
-void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -366,7 +357,7 @@ void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v )
dest[3] = 1;
}
-void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+static void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -376,7 +367,7 @@ void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat
dest[3] = d;
}
-void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -387,181 +378,189 @@ void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v )
}
+/**
+ * GL_NV_vertex_program attributes.
+ * Note that these attributes alias the conventional vertex attributes.
+ */
-void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
+static void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fNV(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fvNV(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
+static void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fNV(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fvNV(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
+static void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fNV(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fvNV(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
+static void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
GLfloat y, GLfloat z, GLfloat w )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fNV(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvNV" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fvNV(index)" );
}
-/*
- * XXX Un-alias attribs here
+
+/**
+ * GL_ARB_vertex_program attributes.
+ * Note that these attributes DO NOT alias the conventional vertex attributes.
*/
-void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x )
+static void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, 0, 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fARB(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], 0, 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fvARB(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
+static void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fARB(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], 0, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fvARB(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x,
+static void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x,
GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fARB(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], 1);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fvARB(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x,
+static void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x,
GLfloat y, GLfloat z, GLfloat w )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, w);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fARB(index)" );
}
-void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], v[3]);
}
else
- _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvARB" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fvARB(index)" );
}
-/* Material
+/**
+ * Called by glMaterial*()
*/
-void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
+void GLAPIENTRY
+_mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLint i, nr;
@@ -588,66 +587,68 @@ void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat
_mesa_update_material( ctx, bitmask );
}
-/* These really are noops outside begin/end:
+
+/**
+ * These really are noops outside begin/end:
*/
-void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v )
{
(void) v;
}
-void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v )
{
(void) v;
}
-void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v )
{
(void) v;
}
-void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b )
+static void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b )
{
(void) a; (void) b;
}
-void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c )
+static void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c )
{
(void) a; (void) b; (void) c;
}
-void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
{
(void) a; (void) b; (void) c; (void) d;
}
/* Similarly, these have no effect outside begin/end:
*/
-void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a )
+static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a )
{
(void) a;
}
-void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v )
{
(void) v;
}
-void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b )
+static void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b )
{
(void) a; (void) b;
}
-void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v )
+static void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v )
{
(void) v;
}
-void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a )
+static void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a )
{
(void) a;
}
-void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
+static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
{
(void) a; (void) b;
}
@@ -656,7 +657,7 @@ void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
/* Begin -- call into driver, should result in the vtxfmt being
* swapped out:
*/
-void GLAPIENTRY _mesa_noop_Begin( GLenum mode )
+static void GLAPIENTRY _mesa_noop_Begin( GLenum mode )
{
(void) mode;
}
@@ -664,14 +665,15 @@ void GLAPIENTRY _mesa_noop_Begin( GLenum mode )
/* End -- just raise an error
*/
-void GLAPIENTRY _mesa_noop_End( void )
+static void GLAPIENTRY _mesa_noop_End( void )
{
GET_CURRENT_CONTEXT(ctx);
- _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd(no glBegin)" );
}
-/* Execute a glRectf() function. This is not suitable for GL_COMPILE
+/**
+ * Execute a glRectf() function. This is not suitable for GL_COMPILE
* modes (as the test for outside begin/end is not compiled),
* but may be useful for drivers in circumstances which exclude
* display list interactions.
@@ -679,7 +681,8 @@ void GLAPIENTRY _mesa_noop_End( void )
* (None of the functions in this file are suitable for GL_COMPILE
* modes).
*/
-void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
+void GLAPIENTRY
+_mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
{
{
GET_CURRENT_CONTEXT(ctx);
@@ -695,11 +698,13 @@ void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2
}
-/* Some very basic support for arrays. Drivers without explicit array
+/**
+ * Some very basic support for arrays. Drivers without explicit array
* support can hook these in, but still need to supply an array-elt
* implementation.
*/
-void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
+static void GLAPIENTRY
+_mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
@@ -714,8 +719,9 @@ void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
}
-void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices)
+static void GLAPIENTRY
+_mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
@@ -746,10 +752,12 @@ void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
CALL_End(GET_DISPATCH(), ());
}
-void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
- GLuint start, GLuint end,
- GLsizei count, GLenum type,
- const GLvoid *indices)
+
+static void GLAPIENTRY
+_mesa_noop_DrawRangeElements(GLenum mode,
+ GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
@@ -763,16 +771,18 @@ void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
* Eval Mesh
*/
-/* KW: If are compiling, we don't know whether eval will produce a
- * vertex when it is run in the future. If this is pure immediate
- * mode, eval is a noop if neither vertex map is enabled.
+/**
+ * KW:
+ * If are compiling, we don't know whether eval will produce a
+ * vertex when it is run in the future. If this is pure immediate
+ * mode, eval is a noop if neither vertex map is enabled.
*
- * Thus we need to have a check in the display list code or
- * elsewhere for eval(1,2) vertices in the case where
- * map(1,2)_vertex is disabled, and to purge those vertices from
- * the vb.
+ * Thus we need to have a check in the display list code or elsewhere
+ * for eval(1,2) vertices in the case where map(1,2)_vertex is
+ * disabled, and to purge those vertices from the vb.
*/
-void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
+void GLAPIENTRY
+_mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
@@ -810,7 +820,8 @@ void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
-void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
+void GLAPIENTRY
+_mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
{
GET_CURRENT_CONTEXT(ctx);
GLfloat u, du, v, dv, v1, u1;
@@ -882,12 +893,14 @@ void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1,
-/* Build a vertexformat full of things to use outside begin/end pairs.
+/**
+ * Build a vertexformat of functions to use outside begin/end pairs.
*
* TODO -- build a whole dispatch table for this purpose, and likewise
* for inside begin/end.
*/
-void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
+void
+_mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
{
vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
vfmt->Begin = _mesa_noop_Begin;
@@ -898,7 +911,6 @@ void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
vfmt->Color4f = _mesa_noop_Color4f;
vfmt->Color4fv = _mesa_noop_Color4fv;
vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
vfmt->End = _mesa_noop_End;
vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h
index 56d930e3b04..8bf46608001 100644
--- a/src/mesa/main/api_noop.h
+++ b/src/mesa/main/api_noop.h
@@ -1,9 +1,8 @@
-
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * 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"),
@@ -26,122 +25,22 @@
#ifndef _API_NOOP_H
#define _API_NOOP_H
-
-#include "glheader.h"
#include "mtypes.h"
#include "context.h"
-/* In states where certain vertex components are required for t&l or
- * rasterization, we still need to keep track of the current values.
- * These functions provide this service by keeping uptodate the
- * 'ctx->Current' struct for all data elements not included in the
- * currently enabled hardware vertex.
- *
- */
-extern void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b );
-extern void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b );
-
-extern void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a );
-extern void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_Indexf( GLfloat i );
-extern void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c );
-extern void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *param );
-
-extern void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d );
-extern void _mesa_noop_Color4ubv( const GLubyte *v );
-extern void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
-extern void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v );
-extern void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c );
-extern void _mesa_noop_Color3ubv( const GLubyte *v );
-extern void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c );
-extern void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a );
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b );
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c);
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c, GLfloat d );
-extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c );
-extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v );
-extern void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c );
-extern void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a );
-extern void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b );
-extern void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c );
-extern void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
-extern void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b );
-extern void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c );
-extern void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
-extern void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v );
-
-extern void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-
-extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v );
-
-
-extern void GLAPIENTRY _mesa_noop_End( void );
-extern void GLAPIENTRY _mesa_noop_Begin( GLenum mode );
-extern void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b );
-extern void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a );
-extern void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b );
-extern void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v );
-extern void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a );
-
-extern void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt );
-
-extern void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2,
- GLint j1, GLint j2 );
-
-extern void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 );
-
-
-/* Not strictly a noop -- translate Rectf down to Begin/End and
- * vertices. Closer to the loopback operations, but doesn't meet the
- * criteria for inclusion there (cannot be used in the Save table).
- */
-extern void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
+extern void GLAPIENTRY
+_mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+extern void GLAPIENTRY
+_mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2);
-extern void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count);
-extern void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices);
-extern void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
- GLuint start, GLuint end,
- GLsizei count, GLenum type,
- const GLvoid *indices);
+extern void GLAPIENTRY
+_mesa_noop_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
+extern void GLAPIENTRY
+_mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat *param);
+extern void
+_mesa_noop_vtxfmt_init(GLvertexformat *vfmt);
#endif
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 2eef7294691..eaf20a5b73e 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * 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"),
@@ -848,8 +848,36 @@ _mesa_PopAttrib(void)
(GLboolean) (color->ColorMask[1] != 0),
(GLboolean) (color->ColorMask[2] != 0),
(GLboolean) (color->ColorMask[3] != 0));
- _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers,
- color->DrawBuffer, NULL);
+ {
+ /* Need to determine if more than one color output is
+ * specified. If so, call glDrawBuffersARB, else call
+ * glDrawBuffer(). This is a subtle, but essential point
+ * since GL_FRONT (for example) is illegal for the former
+ * function, but legal for the later.
+ */
+ GLboolean multipleBuffers = GL_FALSE;
+ if (ctx->Extensions.ARB_draw_buffers) {
+ GLuint i;
+ for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
+ if (color->DrawBuffer[i] != GL_NONE) {
+ multipleBuffers = GL_TRUE;
+ break;
+ }
+ }
+ }
+ /* Call the API_level functions, not _mesa_drawbuffers()
+ * since we need to do error checking on the pop'd
+ * GL_DRAW_BUFFER.
+ * Ex: if GL_FRONT were pushed, but we're popping with a
+ * user FBO bound, GL_FRONT will be illegal and we'll need
+ * to record that error. Per OpenGL ARB decision.
+ */
+ if (multipleBuffers)
+ _mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers,
+ color->DrawBuffer);
+ else
+ _mesa_DrawBuffer(color->DrawBuffer[0]);
+ }
_mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled);
_mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef);
_mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled);
diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
new file mode 100644
index 00000000000..8bd4526cb6f
--- /dev/null
+++ b/src/mesa/main/bitset.h
@@ -0,0 +1,122 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 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.
+ */
+
+/**
+ * \file bitset.h
+ * \brief Bitset of arbitrary size definitions.
+ * \author Michal Krol
+ */
+
+/****************************************************************************
+ * generic bitset implementation
+ */
+
+#define BITSET_WORD GLuint
+#define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)
+
+/* bitset declarations
+ */
+#define BITSET_DECLARE(name, size) \
+ BITSET_WORD name[((size) + BITSET_WORDBITS - 1) / BITSET_WORDBITS]
+
+/* bitset operations
+ */
+#define BITSET_COPY(x, y) _mesa_memcpy( (x), (y), sizeof (x) )
+#define BITSET_EQUAL(x, y) (_mesa_memcmp( (x), (y), sizeof (x) ) == 0)
+#define BITSET_ZERO(x) _mesa_memset( (x), 0, sizeof (x) )
+#define BITSET_ONES(x) _mesa_memset( (x), 0xff, sizeof (x) )
+
+#define BITSET_BITWORD(b) ((b) / BITSET_WORDBITS)
+#define BITSET_BIT(b) (1 << ((b) % BITSET_WORDBITS))
+
+/* single bit operations
+ */
+#define BITSET_TEST(x, b) ((x)[BITSET_BITWORD(b)] & BITSET_BIT(b))
+#define BITSET_SET(x, b) ((x)[BITSET_BITWORD(b)] |= BITSET_BIT(b))
+#define BITSET_CLEAR(x, b) ((x)[BITSET_BITWORD(b)] &= ~BITSET_BIT(b))
+
+#define BITSET_MASK(b) ((b) == BITSET_WORDBITS ? ~0 : BITSET_BIT(b) - 1)
+#define BITSET_RANGE(b, e) (BITSET_MASK((e) + 1) & ~BITSET_MASK(b))
+
+/* bit range operations
+ */
+#define BITSET_TEST_RANGE(x, b, e) \
+ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
+ ((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) : \
+ (assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
+#define BITSET_SET_RANGE(x, b, e) \
+ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
+ ((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \
+ (assert (!"BITSET_SET_RANGE: bit range crosses word boundary"), 0))
+#define BITSET_CLEAR_RANGE(x, b, e) \
+ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
+ ((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \
+ (assert (!"BITSET_CLEAR_RANGE: bit range crosses word boundary"), 0))
+
+/****************************************************************************
+ * 64-bit bitset implementation
+ */
+
+#define BITSET64_WORD GLuint
+#define BITSET64_WORDBITS (sizeof (BITSET64_WORD) * 8)
+
+/* bitset declarations
+ */
+#define BITSET64_DECLARE(name, size) \
+ GLuint name[2]
+
+/* bitset operations
+ */
+#define BITSET64_COPY(x, y) do { (x)[0] = (y)[0]; (x)[1] = (y)[1]; } while (0)
+#define BITSET64_EQUAL(x, y) ( (x)[0] == (y)[0] && (x)[1] == (y)[1] )
+#define BITSET64_ZERO(x) do { (x)[0] = 0; (x)[1] = 0; } while (0)
+#define BITSET64_ONES(x) do { (x)[0] = 0xFF; (x)[1] = 0xFF; } while (0)
+
+#define BITSET64_BITWORD(b) ((b) / BITSET64_WORDBITS)
+#define BITSET64_BIT(b) (1 << ((b) % BITSET64_WORDBITS))
+
+/* single bit operations
+ */
+#define BITSET64_TEST(x, b) ((x)[BITSET64_BITWORD(b)] & BITSET64_BIT(b))
+#define BITSET64_SET(x, b) ((x)[BITSET64_BITWORD(b)] |= BITSET64_BIT(b))
+#define BITSET64_CLEAR(x, b) ((x)[BITSET64_BITWORD(b)] &= ~BITSET64_BIT(b))
+
+#define BITSET64_MASK(b) ((b) == BITSET64_WORDBITS ? ~0 : BITSET64_BIT(b) - 1)
+#define BITSET64_RANGE(b, e) (BITSET64_MASK((e) + 1) & ~BITSET64_MASK(b))
+
+/* bit range operations
+ */
+#define BITSET64_TEST_RANGE(x, b, e) \
+ (BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
+ ((x)[BITSET64_BITWORD(b)] & BITSET64_RANGE(b, e)) : \
+ (assert (!"BITSET64_TEST_RANGE: bit range crosses word boundary"), 0))
+#define BITSET64_SET_RANGE(x, b, e) \
+ (BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
+ ((x)[BITSET64_BITWORD(b)] |= BITSET64_RANGE(b, e)) : \
+ (assert (!"BITSET64_SET_RANGE: bit range crosses word boundary"), 0))
+#define BITSET64_CLEAR_RANGE(x, b, e) \
+ (BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
+ ((x)[BITSET64_BITWORD(b)] &= ~BITSET64_RANGE(b, e)) : \
+ (assert (!"BITSET64_CLEAR_RANGE: bit range crosses word boundary"), 0))
+
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 0d5d838ca0c..28fbc34ff78 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -193,10 +193,10 @@ static GLbitfield
supported_buffer_bitmask(const GLcontext *ctx, GLuint framebufferID)
{
GLbitfield mask = 0x0;
- GLint i;
if (framebufferID > 0) {
/* A user-created renderbuffer */
+ GLuint i;
ASSERT(ctx->Extensions.EXT_framebuffer_object);
for (i = 0; i < ctx->Const.MaxColorAttachments; i++) {
mask |= (BUFFER_BIT_COLOR0 << i);
@@ -204,6 +204,7 @@ supported_buffer_bitmask(const GLcontext *ctx, GLuint framebufferID)
}
else {
/* A window system renderbuffer */
+ GLint i;
mask = BUFFER_BIT_FRONT_LEFT; /* always have this */
if (ctx->Visual.stereoMode) {
mask |= BUFFER_BIT_FRONT_RIGHT;
@@ -485,11 +486,11 @@ set_color_output(GLcontext *ctx, GLuint output, GLenum buffer,
* BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
*/
void
-_mesa_drawbuffers(GLcontext *ctx, GLsizei n, const GLenum *buffers,
+_mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
const GLbitfield *destMask)
{
GLbitfield mask[MAX_DRAW_BUFFERS];
- GLint output;
+ GLuint output;
if (!destMask) {
/* compute destMask values now */
diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
index 77e9f81560e..b61bdad4330 100644
--- a/src/mesa/main/buffers.h
+++ b/src/mesa/main/buffers.h
@@ -53,7 +53,7 @@ extern void GLAPIENTRY
_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers);
extern void
-_mesa_drawbuffers(GLcontext *ctx, GLsizei n, const GLenum *buffers,
+_mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
const GLbitfield *destMask);
extern void GLAPIENTRY
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index e2f95cf7f9b..8b6fc127fe9 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -767,7 +767,11 @@ _mesa_GetColorTable( GLenum target, GLenum format,
rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
rgba[i][BCOMP] = 0;
+#if CHAN_BITS==32
+ rgba[i][ACOMP] = tableF[i];
+#else
rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#endif
}
}
else {
@@ -786,18 +790,25 @@ _mesa_GetColorTable( GLenum target, GLenum format,
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
- rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#if CHAN_BITS==32
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = tableF[i];
+ rgba[i][ACOMP] = CHAN_MAX;
+#else
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
rgba[i][ACOMP] = CHAN_MAX;
+#endif
}
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = tableUB[i];
- rgba[i][GCOMP] = tableUB[i];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = tableUB[i];
rgba[i][ACOMP] = CHAN_MAX;
}
@@ -808,18 +819,25 @@ _mesa_GetColorTable( GLenum target, GLenum format,
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
- rgba[i][GCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
+#if CHAN_BITS==32
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = tableF[i*2+0];
+ rgba[i][ACOMP] = tableF[i*2+1];
+#else
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
rgba[i][ACOMP] = IROUND_POS(tableF[i*2+1] * CHAN_MAXF);
+#endif
}
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = tableUB[i*2+0];
- rgba[i][GCOMP] = tableUB[i*2+0];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = tableUB[i*2+0];
rgba[i][ACOMP] = tableUB[i*2+1];
}
@@ -830,19 +848,26 @@ _mesa_GetColorTable( GLenum target, GLenum format,
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
- rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
- rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#if CHAN_BITS==32
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
+ rgba[i][ACOMP] = tableF[i];
+#else
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#endif
}
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = tableUB[i];
- rgba[i][GCOMP] = tableUB[i];
- rgba[i][BCOMP] = tableUB[i];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
rgba[i][ACOMP] = tableUB[i];
}
}
@@ -852,10 +877,17 @@ _mesa_GetColorTable( GLenum target, GLenum format,
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
+#if CHAN_BITS==32
+ rgba[i][RCOMP] = tableF[i*3+0];
+ rgba[i][GCOMP] = tableF[i*3+1];
+ rgba[i][BCOMP] = tableF[i*3+2];
+ rgba[i][ACOMP] = CHAN_MAX;
+#else
rgba[i][RCOMP] = IROUND_POS(tableF[i*3+0] * CHAN_MAXF);
rgba[i][GCOMP] = IROUND_POS(tableF[i*3+1] * CHAN_MAXF);
rgba[i][BCOMP] = IROUND_POS(tableF[i*3+2] * CHAN_MAXF);
rgba[i][ACOMP] = CHAN_MAX;
+#endif
}
}
else {
@@ -872,6 +904,9 @@ _mesa_GetColorTable( GLenum target, GLenum format,
case GL_RGBA:
if (table->Type == GL_FLOAT) {
const GLfloat *tableF = (const GLfloat *) table->Table;
+#if CHAN_BITS==32
+ _mesa_memcpy(rgba, tableF, 4 * table->Size * sizeof(GLfloat));
+#else
GLuint i;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = IROUND_POS(tableF[i*4+0] * CHAN_MAXF);
@@ -879,6 +914,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
rgba[i][BCOMP] = IROUND_POS(tableF[i*4+2] * CHAN_MAXF);
rgba[i][ACOMP] = IROUND_POS(tableF[i*4+3] * CHAN_MAXF);
}
+#endif
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index a10542de22e..95555cb7d47 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * 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"),
@@ -108,7 +108,11 @@
/** Maximum rectangular texture size - GL_NV_texture_rectangle */
#define MAX_TEXTURE_RECT_SIZE 2048
-/** Number of texture units - GL_ARB_multitexture */
+/** Number of texture units - GL_ARB_multitexture
+ * This needs to be the larger of MAX_TEXTURE_COORD_UNITS and
+ * MAX_TEXTURE_IMAGE_UNITS seen below, since MAX_TEXTURE_UNITS is used
+ * to dimension some arrays that store both coord and image data.
+*/
#define MAX_TEXTURE_UNITS 8
/*@}*/
@@ -203,6 +207,7 @@
/** For GL_ARB_vertex_shader */
/*@{*/
+#define MAX_VERTEX_ATTRIBS 16
#define MAX_VERTEX_UNIFORM_COMPONENTS 512
#define MAX_VARYING_FLOATS 32
#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 92dcdfd4ffc..2379c6d7668 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -913,18 +913,18 @@ _mesa_init_current( GLcontext *ctx )
{
GLuint i;
- /* Current group */
+ /* Init all to (0,0,0,1) */
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 );
}
- /* special cases: */
+
+ /* redo special cases: */
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 );
-
- ctx->Current.Index = 1;
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = 1.0;
ctx->Current.EdgeFlag = GL_TRUE;
}
@@ -959,14 +959,18 @@ _mesa_init_constants( GLcontext *ctx )
assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
+ assert(MAX_TEXTURE_UNITS >= MAX_TEXTURE_COORD_UNITS);
+ assert(MAX_TEXTURE_UNITS >= MAX_TEXTURE_IMAGE_UNITS);
+
/* Constants, may be overriden (usually only reduced) by device drivers */
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
- ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS;
ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS;
ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
+ ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits,
+ ctx->Const.MaxTextureImageUnits);
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS;
ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;
@@ -1041,13 +1045,43 @@ _mesa_init_constants( GLcontext *ctx )
#endif
/* sanity checks */
- ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
+ ASSERT(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits));
ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
}
/**
+ * Do some sanity checks on the limits/constants for the given context.
+ * Only called the first time a context is bound.
+ */
+static void
+check_context_limits(GLcontext *ctx)
+{
+ /* Many context limits/constants are limited by the size of
+ * internal arrays.
+ */
+ assert(ctx->Const.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS);
+ assert(ctx->Const.MaxTextureCoordUnits <= MAX_TEXTURE_COORD_UNITS);
+ assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_IMAGE_UNITS);
+ assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_COORD_UNITS);
+
+ assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
+ assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
+
+ /* make sure largest texture image is <= MAX_WIDTH in size */
+ assert((1 << (ctx->Const.MaxTextureLevels -1 )) <= MAX_WIDTH);
+ assert((1 << (ctx->Const.MaxCubeTextureLevels -1 )) <= MAX_WIDTH);
+ assert((1 << (ctx->Const.Max3DTextureLevels -1 )) <= MAX_WIDTH);
+
+ assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS);
+
+ /* XXX probably add more tests */
+}
+
+
+/**
* Initialize the attribute groups in a GL context.
*
* \param ctx GL context.
@@ -1642,6 +1676,7 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
drawBuffer->Width, drawBuffer->Height);
_mesa_set_scissor(newCtx, 0, 0,
drawBuffer->Width, drawBuffer->Height );
+ check_context_limits(newCtx);
}
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 4f1a962731d..4d9cea1e59e 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -975,7 +975,6 @@ typedef struct {
void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
void (GLAPIENTRYP Color4fv)( const GLfloat * );
void (GLAPIENTRYP EdgeFlag)( GLboolean );
- void (GLAPIENTRYP EdgeFlagv)( const GLboolean * );
void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */
void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */
void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
@@ -1017,6 +1016,7 @@ typedef struct {
void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */
void (GLAPIENTRYP Begin)( GLenum );
void (GLAPIENTRYP End)( void );
+ /* GL_NV_vertex_program */
void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
@@ -1025,6 +1025,7 @@ typedef struct {
void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
+#if FEATURE_ARB_vertex_program
void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x );
void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v );
void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
@@ -1033,6 +1034,7 @@ typedef struct {
void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v );
void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v );
+#endif
/*@}*/
/*
diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c
index 09524bba02e..d4990bb795f 100644
--- a/src/mesa/main/depthstencil.c
+++ b/src/mesa/main/depthstencil.c
@@ -48,6 +48,10 @@
static void *
nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
{
+ (void) ctx;
+ (void) rb;
+ (void) x;
+ (void) y;
return NULL;
}
@@ -82,6 +86,8 @@ alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
struct gl_renderbuffer *dsrb = rb->Wrapped;
GLboolean retVal;
+ (void) internalFormat;
+
ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height);
diff --git a/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms
index f4221cef903..d9ea61883d7 100644
--- a/src/mesa/main/descrip.mms
+++ b/src/mesa/main/descrip.mms
@@ -61,6 +61,7 @@ SOURCES =accum.c \
points.c \
polygon.c \
rastpos.c \
+ rbadaptors.c \
renderbuffer.c \
state.c \
stencil.c \
@@ -195,6 +196,7 @@ pixel.obj : pixel.c
points.obj : points.c
polygon.obj : polygon.c
rastpos.obj : rastpos.c
+rbadaptors.obj : rbadaptors.c
renderbuffer.obj : renderbuffer.c
state.obj : state.c
stencil.obj : stencil.c
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index dba2008ef73..cbf00f735ed 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -4777,7 +4777,7 @@ save_Attr1fNV(GLenum attr, GLfloat x)
n[2].f = x;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 1;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
@@ -4799,7 +4799,7 @@ save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
n[3].f = y;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 2;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
@@ -4822,7 +4822,7 @@ save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
n[4].f = z;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 3;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
@@ -4846,7 +4846,7 @@ save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
n[5].f = w;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 4;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
@@ -4868,7 +4868,7 @@ save_Attr1fARB(GLenum attr, GLfloat x)
n[2].f = x;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 1;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
@@ -4890,7 +4890,7 @@ save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
n[3].f = y;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 2;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
@@ -4913,7 +4913,7 @@ save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
n[4].f = z;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 3;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
@@ -4937,7 +4937,7 @@ save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
n[5].f = w;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 4;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
@@ -5037,7 +5037,7 @@ save_Indexf(GLfloat x)
ctx->ListState.CurrentIndex = x;
if (ctx->ExecuteFlag) {
- CALL_Indexi(ctx->Exec, ((GLint) x));
+ CALL_Indexf(ctx->Exec, (x));
}
}
@@ -5067,12 +5067,6 @@ save_EdgeFlag(GLboolean x)
}
static void GLAPIENTRY
-save_EdgeFlagv(const GLboolean * v)
-{
- save_EdgeFlag(v[0]);
-}
-
-static void GLAPIENTRY
save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
{
GET_CURRENT_CONTEXT(ctx);
@@ -5432,7 +5426,7 @@ index_error(void)
static void GLAPIENTRY
save_VertexAttrib1fNV(GLuint index, GLfloat x)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr1fNV(index, x);
else
index_error();
@@ -5441,7 +5435,7 @@ save_VertexAttrib1fNV(GLuint index, GLfloat x)
static void GLAPIENTRY
save_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr1fNV(index, v[0]);
else
index_error();
@@ -5450,7 +5444,7 @@ save_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
static void GLAPIENTRY
save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr2fNV(index, x, y);
else
index_error();
@@ -5459,7 +5453,7 @@ save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
static void GLAPIENTRY
save_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr2fNV(index, v[0], v[1]);
else
index_error();
@@ -5468,7 +5462,7 @@ save_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
static void GLAPIENTRY
save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr3fNV(index, x, y, z);
else
index_error();
@@ -5477,7 +5471,7 @@ save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
static void GLAPIENTRY
save_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr3fNV(index, v[0], v[1], v[2]);
else
index_error();
@@ -5487,7 +5481,7 @@ static void GLAPIENTRY
save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y,
GLfloat z, GLfloat w)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr4fNV(index, x, y, z, w);
else
index_error();
@@ -5496,7 +5490,7 @@ save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y,
static void GLAPIENTRY
save_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr4fNV(index, v[0], v[1], v[2], v[3]);
else
index_error();
@@ -5508,7 +5502,7 @@ save_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
static void GLAPIENTRY
save_VertexAttrib1fARB(GLuint index, GLfloat x)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr1fARB(index, x);
else
index_error();
@@ -5517,7 +5511,7 @@ save_VertexAttrib1fARB(GLuint index, GLfloat x)
static void GLAPIENTRY
save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr1fARB(index, v[0]);
else
index_error();
@@ -5526,7 +5520,7 @@ save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
static void GLAPIENTRY
save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr2fARB(index, x, y);
else
index_error();
@@ -5535,7 +5529,7 @@ save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
static void GLAPIENTRY
save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr2fARB(index, v[0], v[1]);
else
index_error();
@@ -5544,7 +5538,7 @@ save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
static void GLAPIENTRY
save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr3fARB(index, x, y, z);
else
index_error();
@@ -5553,7 +5547,7 @@ save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
static void GLAPIENTRY
save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr3fARB(index, v[0], v[1], v[2]);
else
index_error();
@@ -5563,7 +5557,7 @@ static void GLAPIENTRY
save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
GLfloat w)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr4fARB(index, x, y, z, w);
else
index_error();
@@ -5572,7 +5566,7 @@ save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
static void GLAPIENTRY
save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
else
index_error();
@@ -6527,7 +6521,7 @@ execute_list(GLcontext *ctx, GLuint list)
}
break;
case OPCODE_INDEX:
- CALL_Indexi(ctx->Exec, (n[1].i));
+ CALL_Indexf(ctx->Exec, (n[1].f));
break;
case OPCODE_EDGEFLAG:
CALL_EdgeFlag(ctx->Exec, (n[1].b));
@@ -8447,7 +8441,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
vfmt->Color4f = save_Color4f;
vfmt->Color4fv = save_Color4fv;
vfmt->EdgeFlag = save_EdgeFlag;
- vfmt->EdgeFlagv = save_EdgeFlagv;
vfmt->End = save_End;
vfmt->EvalCoord1f = save_EvalCoord1f;
vfmt->EvalCoord1fv = save_EvalCoord1fv;
diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c
index 7d498a82791..b7cbc818c66 100644
--- a/src/mesa/main/execmem.c
+++ b/src/mesa/main/execmem.c
@@ -47,7 +47,7 @@
#include <sys/mman.h>
#include "mm.h"
-#define EXEC_HEAP_SIZE (128*1024)
+#define EXEC_HEAP_SIZE (10*1024*1024)
_glthread_DECLARE_STATIC_MUTEX(exec_mutex);
@@ -85,7 +85,9 @@ _mesa_exec_malloc(GLuint size)
if (block)
addr = exec_mem + block->ofs;
-
+ else
+ _mesa_printf("_mesa_exec_malloc failed\n");
+
_glthread_UNLOCK_MUTEX(exec_mutex);
return addr;
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 191b81c39c6..b6a59336cb8 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -391,6 +391,8 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
static void
fbo_incomplete(const char *msg, int index)
{
+ (void) msg;
+ (void) index;
/*
_mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
*/
@@ -410,6 +412,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
GLenum intFormat = GL_NONE;
GLuint w = 0, h = 0;
GLint i;
+ GLuint j;
assert(fb->Name != 0);
@@ -498,14 +501,14 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
}
/* Check that all DrawBuffers are present */
- for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
- if (fb->ColorDrawBuffer[i] != GL_NONE) {
+ for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
+ if (fb->ColorDrawBuffer[j] != GL_NONE) {
const struct gl_renderbuffer_attachment *att
- = _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer[i]);
+ = _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer[j]);
assert(att);
if (att->Type == GL_NONE) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
- fbo_incomplete("missing drawbuffer", i);
+ fbo_incomplete("missing drawbuffer", j);
return;
}
}
@@ -523,26 +526,6 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
}
}
- /* Check if any renderbuffer is attached more than once.
- * Note that there's one exception: a GL_DEPTH_STENCIL renderbuffer can be
- * bound to both the stencil and depth attachment points at the same time.
- */
- for (i = 0; i < BUFFER_COUNT - 1; i++) {
- struct gl_renderbuffer *rb_i = fb->Attachment[i].Renderbuffer;
- if (rb_i) {
- GLint j;
- for (j = i + 1; j < BUFFER_COUNT; j++) {
- struct gl_renderbuffer *rb_j = fb->Attachment[j].Renderbuffer;
- if (rb_i == rb_j && rb_i->_BaseFormat != GL_DEPTH_STENCIL_EXT) {
- fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT;
- fbo_incomplete("multiply bound renderbuffer", -1);
- return;
- }
- }
- }
- }
-
-
if (numImages == 0) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
fbo_incomplete("no attachments", -1);
@@ -612,10 +595,7 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
oldRb = ctx->CurrentRenderbuffer;
if (oldRb) {
- oldRb->RefCount--;
- if (oldRb->RefCount == 0) {
- oldRb->Delete(oldRb);
- }
+ _mesa_dereference_renderbuffer(&oldRb);
}
ASSERT(newRb != &DummyRenderbuffer);
@@ -652,10 +632,7 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers)
/* But the object will not be freed until it's no longer
* bound in any context.
*/
- rb->RefCount--;
- if (rb->RefCount == 0) {
- rb->Delete(rb);
- }
+ _mesa_dereference_renderbuffer(&rb);
}
}
}
@@ -770,12 +747,12 @@ _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
return;
}
- if (width < 1 || width > ctx->Const.MaxRenderbufferSize) {
+ if (width < 1 || width > (GLsizei) ctx->Const.MaxRenderbufferSize) {
_mesa_error(ctx, GL_INVALID_VALUE, "glRenderbufferStorageEXT(width)");
return;
}
- if (height < 1 || height > ctx->Const.MaxRenderbufferSize) {
+ if (height < 1 || height > (GLsizei) ctx->Const.MaxRenderbufferSize) {
_mesa_error(ctx, GL_INVALID_VALUE, "glRenderbufferStorageEXT(height)");
return;
}
@@ -790,8 +767,8 @@ _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
if (rb->InternalFormat == internalFormat &&
- rb->Width == width &&
- rb->Height == height) {
+ rb->Width == (GLuint) width &&
+ rb->Height == (GLuint) height) {
/* no change in allocation needed */
return;
}
@@ -811,8 +788,8 @@ _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
/* No error - check/set fields now */
assert(rb->_ActualFormat);
- assert(rb->Width == width);
- assert(rb->Height == height);
+ 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;
@@ -1036,12 +1013,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
if (bindReadBuf) {
oldFb = ctx->ReadBuffer;
if (oldFb && oldFb->Name != 0) {
- _glthread_LOCK_MUTEX(oldFb->Mutex);
- oldFb->RefCount--;
- _glthread_UNLOCK_MUTEX(oldFb->Mutex);
- if (oldFb->RefCount == 0) {
- oldFb->Delete(oldFb);
- }
+ _mesa_dereference_framebuffer(&oldFb);
}
ctx->ReadBuffer = newFb;
}
@@ -1052,12 +1024,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
/* check if old FB had any texture attachments */
check_end_texture_render(ctx, oldFb);
/* check if time to delete this framebuffer */
- _glthread_LOCK_MUTEX(oldFb->Mutex);
- oldFb->RefCount--;
- if (oldFb->RefCount == 0) {
- oldFb->Delete(oldFb);
- }
- _glthread_UNLOCK_MUTEX(oldFb->Mutex);
+ _mesa_dereference_framebuffer(&oldFb);
}
ctx->DrawBuffer = newFb;
if (newFb->Name != 0) {
@@ -1102,12 +1069,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
/* But the object will not be freed until it's no longer
* bound in any context.
*/
- _glthread_LOCK_MUTEX(fb->Mutex);
- fb->RefCount--;
- _glthread_UNLOCK_MUTEX(fb->Mutex);
- if (fb->RefCount == 0) {
- fb->Delete(fb);
- }
+ _mesa_dereference_framebuffer(&fb);
}
}
}
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index a6607387fee..4d6871bb7d0 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -78,10 +78,7 @@ set_depth_renderbuffer(struct gl_framebuffer *fb,
struct gl_renderbuffer *rb)
{
if (fb->_DepthBuffer) {
- fb->_DepthBuffer->RefCount--;
- if (fb->_DepthBuffer->RefCount <= 0) {
- fb->_DepthBuffer->Delete(fb->_DepthBuffer);
- }
+ _mesa_dereference_renderbuffer(&fb->_DepthBuffer);
}
fb->_DepthBuffer = rb;
if (rb) {
@@ -99,10 +96,7 @@ set_stencil_renderbuffer(struct gl_framebuffer *fb,
struct gl_renderbuffer *rb)
{
if (fb->_StencilBuffer) {
- fb->_StencilBuffer->RefCount--;
- if (fb->_StencilBuffer->RefCount <= 0) {
- fb->_StencilBuffer->Delete(fb->_StencilBuffer);
- }
+ _mesa_dereference_renderbuffer(&fb->_StencilBuffer);
}
fb->_StencilBuffer = rb;
if (rb) {
@@ -141,6 +135,7 @@ struct gl_framebuffer *
_mesa_new_framebuffer(GLcontext *ctx, GLuint name)
{
struct gl_framebuffer *fb;
+ (void) ctx;
assert(name != 0);
fb = CALLOC_STRUCT(gl_framebuffer);
if (fb) {
@@ -225,11 +220,11 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
struct gl_renderbuffer_attachment *att = &fb->Attachment[i];
if (att->Renderbuffer) {
struct gl_renderbuffer *rb = att->Renderbuffer;
- _glthread_LOCK_MUTEX(rb->Mutex);
- rb->RefCount--;
- _glthread_UNLOCK_MUTEX(rb->Mutex);
- if (rb->RefCount == 0) {
- rb->Delete(rb);
+ /* remove framebuffer's reference to renderbuffer */
+ _mesa_dereference_renderbuffer(&rb);
+ if (rb && rb->Name == 0) {
+ /* delete window system renderbuffer */
+ _mesa_dereference_renderbuffer(&rb);
}
}
att->Type = GL_NONE;
@@ -243,6 +238,33 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
/**
+ * Decrement the reference count on a framebuffer and delete it when
+ * the refcount hits zero.
+ * Note: we pass the address of a pointer and set it to NULL if we delete it.
+ */
+void
+_mesa_dereference_framebuffer(struct gl_framebuffer **fb)
+{
+ GLboolean deleteFlag = GL_FALSE;
+
+ _glthread_LOCK_MUTEX((*fb)->Mutex);
+ {
+ ASSERT((*fb)->RefCount > 0);
+ (*fb)->RefCount--;
+ deleteFlag = ((*fb)->RefCount == 0);
+ }
+ _glthread_UNLOCK_MUTEX((*fb)->Mutex);
+
+ if (deleteFlag) {
+ (*fb)->Delete(*fb);
+ *fb = NULL;
+ }
+}
+
+
+
+
+/**
* Resize the given framebuffer's renderbuffers to the new width and height.
* This should only be used for window-system framebuffers, not
* user-created renderbuffers (i.e. made with GL_EXT_framebuffer_object).
@@ -413,11 +435,16 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
{
GLuint i;
- assert(fb->Name != 0);
-
_mesa_bzero(&fb->Visual, sizeof(fb->Visual));
fb->Visual.rgbMode = GL_TRUE; /* assume this */
+#if 0 /* this _might_ be needed */
+ if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ /* leave visual fields zero'd */
+ return;
+ }
+#endif
+
/* find first RGB or CI renderbuffer */
for (i = 0; i < BUFFER_COUNT; i++) {
if (fb->Attachment[i].Renderbuffer) {
@@ -480,7 +507,9 @@ _mesa_update_depth_buffer(GLcontext *ctx,
if (depthRb && depthRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
/* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */
- if (!fb->_DepthBuffer || fb->_DepthBuffer->Wrapped != depthRb) {
+ if (!fb->_DepthBuffer
+ || fb->_DepthBuffer->Wrapped != depthRb
+ || fb->_DepthBuffer->_BaseFormat != GL_DEPTH_COMPONENT) {
/* need to update wrapper */
struct gl_renderbuffer *wrapper
= _mesa_new_z24_renderbuffer_wrapper(ctx, depthRb);
@@ -519,7 +548,9 @@ _mesa_update_stencil_buffer(GLcontext *ctx,
if (stencilRb && stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
/* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */
- if (!fb->_StencilBuffer || fb->_StencilBuffer->Wrapped != stencilRb) {
+ if (!fb->_StencilBuffer
+ || fb->_StencilBuffer->Wrapped != stencilRb
+ || fb->_StencilBuffer->_BaseFormat != GL_STENCIL_INDEX) {
/* need to update wrapper */
struct gl_renderbuffer *wrapper
= _mesa_new_s8_renderbuffer_wrapper(ctx, stencilRb);
@@ -581,6 +612,7 @@ update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
static void
update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
+ (void) ctx;
if (fb->_ColorReadBufferIndex == -1) {
fb->_ColorReadBuffer = NULL; /* legal! */
}
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index 1ff04085f34..7f3254fe8ea 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -43,7 +43,10 @@ extern void
_mesa_free_framebuffer_data(struct gl_framebuffer *buffer);
extern void
-_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *b,
+_mesa_dereference_framebuffer(struct gl_framebuffer **fb);
+
+extern void
+_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height);
extern void
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 7147c9a5ccc..2e2da7d933d 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -230,7 +230,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_CURRENT_INDEX:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Index);
+ params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
}
break;
case GL_CURRENT_NORMAL:
@@ -1040,7 +1040,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXT1(ARB_multitexture, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXT1(ARB_multitexture, "GetBooleanv");
@@ -1068,13 +1068,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXT1(ARB_texture_compression, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL));
+ params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE));
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXT1(ARB_texture_compression, "GetBooleanv");
{
GLint formats[100];
- GLuint i, n = _mesa_get_compressed_formats(ctx, formats);
+ GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
ASSERT(n <= 100);
for (i = 0; i < n; i++)
params[i] = ENUM_TO_INT(formats[i]);
@@ -2048,7 +2048,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_CURRENT_INDEX:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = ctx->Current.Index;
+ params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
}
break;
case GL_CURRENT_NORMAL:
@@ -2858,7 +2858,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXT1(ARB_multitexture, "GetFloatv");
- params[0] = (GLfloat)(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
+ params[0] = (GLfloat)(ctx->Const.MaxTextureUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXT1(ARB_multitexture, "GetFloatv");
@@ -2886,13 +2886,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXT1(ARB_texture_compression, "GetFloatv");
- params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL));
+ params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE));
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXT1(ARB_texture_compression, "GetFloatv");
{
GLint formats[100];
- GLuint i, n = _mesa_get_compressed_formats(ctx, formats);
+ GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
ASSERT(n <= 100);
for (i = 0; i < n; i++)
params[i] = ENUM_TO_INT(formats[i]);
@@ -3866,7 +3866,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_CURRENT_INDEX:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = IROUND(ctx->Current.Index);
+ params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
}
break;
case GL_CURRENT_NORMAL:
@@ -4676,7 +4676,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXT1(ARB_multitexture, "GetIntegerv");
- params[0] = MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits);
+ params[0] = ctx->Const.MaxTextureUnits;
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXT1(ARB_multitexture, "GetIntegerv");
@@ -4704,13 +4704,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXT1(ARB_texture_compression, "GetIntegerv");
- params[0] = _mesa_get_compressed_formats(ctx, NULL);
+ params[0] = _mesa_get_compressed_formats(ctx, NULL, GL_FALSE);
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXT1(ARB_texture_compression, "GetIntegerv");
{
GLint formats[100];
- GLuint i, n = _mesa_get_compressed_formats(ctx, formats);
+ GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
ASSERT(n <= 100);
for (i = 0; i < n; i++)
params[i] = ENUM_TO_INT(formats[i]);
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
new file mode 100644
index 00000000000..78d50663550
--- /dev/null
+++ b/src/mesa/main/get_gen.py
@@ -0,0 +1,1194 @@
+#!/usr/bin/env python
+
+# Mesa 3-D graphics library
+#
+# Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# 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
+
+
+TypeStrings = {
+ GLint : "GLint",
+ GLenum : "GLenum",
+ GLfloat : "GLfloat",
+ GLdouble : "GLdouble",
+ GLboolean : "GLboolean"
+}
+
+
+# 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
+# - 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_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;", None ),
+ ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ),
+ ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
+ "", None ),
+ ( "GL_DEPTH_CLEAR_VALUE", 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.EdgeFlag"],
+ "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.CurrentListNum"], "", 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->Pixel.MapAtoAsize"], "", None ),
+ ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->Pixel.MapBtoBsize"], "", None ),
+ ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->Pixel.MapGtoGsize"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->Pixel.MapItoAsize"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->Pixel.MapItoBsize"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->Pixel.MapItoGsize"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->Pixel.MapItoIsize"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->Pixel.MapItoRsize"], "", None ),
+ ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->Pixel.MapRtoRsize"], "", None ),
+ ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->Pixel.MapStoSsize"], "", 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_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_BINDING_1D", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name"], "", None ),
+ ( "GL_TEXTURE_BINDING_2D", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name"], "", None ),
+ ( "GL_TEXTURE_BINDING_3D", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name"], "", None ),
+ ( "GL_TEXTURE_ENV_COLOR", GLfloatN,
+ ["color[0]", "color[1]", "color[2]", "color[3]"],
+ "const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;",
+ None ),
+ ( "GL_TEXTURE_ENV_MODE", GLenum,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode"], "", None ),
+ ( "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.Vertex.Enabled"], "", None ),
+ ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.Vertex.Size"], "", None ),
+ ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.Vertex.Type"], "", None ),
+ ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.Vertex.Stride"], "", None ),
+ ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.Normal.Enabled"], "", None ),
+ ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.Normal.Type"], "", None ),
+ ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.Normal.Stride"], "", None ),
+ ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.Color.Enabled"], "", None ),
+ ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.Color.Size"], "", None ),
+ ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.Color.Type"], "", None ),
+ ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.Color.Stride"], "", None ),
+ ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.Index.Enabled"], "", None ),
+ ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.Index.Type"], "", None ),
+ ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.Index.Stride"], "", None ),
+ ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY", GLboolean,
+ ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint,
+ ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum,
+ ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint,
+ ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.EdgeFlag.Enabled"], "", None ),
+ ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.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].CurrentCubeMap->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"], "", ["ARB_texture_compression"] ),
+ ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
+ ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"],
+ "", ["ARB_texture_compression"] ),
+ ( "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] = ENUM_TO_INT(formats[i]);""",
+ ["ARB_texture_compression"] ),
+
+ # 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"], "", ["SGI_color_table"] ),
+ ( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
+ ["ctx->Pixel.PostConvolutionColorTableEnabled"], "", ["SGI_color_table"] ),
+ ( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
+ ["ctx->Pixel.PostColorMatrixColorTableEnabled"], "", ["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.SecondaryColor.Enabled"], "", ["EXT_secondary_color"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum,
+ ["ctx->Array.SecondaryColor.Type"], "", ["EXT_secondary_color"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint,
+ ["ctx->Array.SecondaryColor.Stride"], "", ["EXT_secondary_color"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint,
+ ["ctx->Array.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.FogCoord.Enabled"],
+ "", ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, ["ctx->Array.FogCoord.Type"],
+ "", ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, ["ctx->Array.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"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean,
+ ["ctx->Multisample.SampleAlphaToCoverage"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean,
+ ["ctx->Multisample.SampleAlphaToOne"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_COVERAGE_ARB", GLboolean,
+ ["ctx->Multisample.SampleCoverage"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat,
+ ["ctx->Multisample.SampleCoverageValue"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean,
+ ["ctx->Multisample.SampleCoverageInvert"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_BUFFERS_ARB", GLint,
+ ["ctx->DrawBuffer->Visual.sampleBuffers"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLES_ARB", GLint,
+ ["ctx->DrawBuffer->Visual.samples"], "", ["ARB_multisample"] ),
+
+ # 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.VertexAttrib[0].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[1].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[2].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[3].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[4].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[5].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[6].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[7].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[8].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[9].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[10].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[11].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[12].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[13].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean,
+ ["ctx->Array.VertexAttrib[14].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean,
+ ["ctx->Array.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].CurrentRect->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"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.Vertex.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.Normal.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.Color.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.Index.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.EdgeFlag.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.SecondaryColor.BufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.FogCoord.BufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+ # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported
+ ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ElementArrayBufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+
+ # 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_MESA_program_debug
+ ( "GL_FRAGMENT_PROGRAM_CALLBACK_MESA", GLboolean,
+ ["ctx->FragmentProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
+ ( "GL_VERTEX_PROGRAM_CALLBACK_MESA", GLboolean,
+ ["ctx->VertexProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
+ ( "GL_FRAGMENT_PROGRAM_POSITION_MESA", GLint,
+ ["ctx->FragmentProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
+ ( "GL_VERTEX_PROGRAM_POSITION_MESA", GLint,
+ ["ctx->VertexProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
+
+ # GL_ARB_draw_buffers
+ ( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
+ ["ctx->Const.MaxDrawBuffers"], "", ["ARB_draw_buffers"] ),
+ ( "GL_DRAW_BUFFER0_ARB", GLenum,
+ ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", ["ARB_draw_buffers"] ),
+ ( "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];""", ["ARB_draw_buffers"] ),
+ ( "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];""", ["ARB_draw_buffers"] ),
+ ( "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];""", ["ARB_draw_buffers"] ),
+ # 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_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_ARB_fragment_shader
+ ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
+ ["MAX_FRAGMENT_UNIFORM_COMPONENTS"], "", ["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,
+ ["MAX_VERTEX_UNIFORM_COMPONENTS"], "", ["ARB_vertex_shader"] ),
+ ( "GL_MAX_VARYING_FLOATS_ARB", GLint,
+ ["MAX_VARYING_FLOATS"], "", ["ARB_vertex_shader"] ),
+ ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
+ ["MAX_VERTEX_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ),
+ ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
+ ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] )
+]
+
+
+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 == GLfloatN and toType == GLfloat:
+ return ""
+ elif fromType == GLint 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 == 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"
+ else:
+ abort()
+
+ 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))
+ if optionalCode:
+ print " {"
+ print " " + optionalCode
+ conversion = ConversionFunc(varType, returnType)
+ 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 "}"
+ 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 ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE )
+#define ENUM_TO_INT(E) ( (GLint) (E) )
+#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) )
+
+#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
+#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
+
+
+/*
+ * 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)
+EmitGetDoublev()
+
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 5188a79c951..b6eed5810cd 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -55,6 +55,7 @@ _mesa_GetString( GLenum name )
static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
static const char *version_2_0 = "1.5 Mesa " MESA_VERSION_STRING;/*XXX FIX*/
+ static const char *sl_version_110 = "1.10 Mesa " MESA_VERSION_STRING;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
@@ -126,6 +127,12 @@ _mesa_GetString( GLenum name )
if (!ctx->Extensions.String)
ctx->Extensions.String = _mesa_make_extension_string(ctx);
return (const GLubyte *) ctx->Extensions.String;
+#if FEATURE_ARB_shading_language_100
+ case GL_SHADING_LANGUAGE_VERSION_ARB:
+ if (ctx->Extensions.ARB_shading_language_100)
+ return (const GLubyte *) sl_version_110;
+ goto error;
+#endif
#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
case GL_PROGRAM_ERROR_STRING_NV:
@@ -137,6 +144,7 @@ _mesa_GetString( GLenum name )
}
/* FALL-THROUGH */
#endif
+ error:
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
return (const GLubyte *) 0;
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 0ebadaa9fa6..e37499e4be7 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -247,9 +247,12 @@
* Don't define it if using a newer Windows compiler.
*/
#if defined(__VMS)
-#define __FUNCTION__ "VMS$NL:"
-#elif !(defined(__GNUC__) && __GNUC__ >= 2) && !(defined(_MSC_VER) && _MSC_VER >= 1300)
-#define __FUNCTION__ "unknown"
+# define __FUNCTION__ "VMS$NL:"
+#elif __STDC_VERSION__ < 199901L
+# if ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \
+ (!defined(_MSC_VER) || _MSC_VER < 1300)
+# define __FUNCTION__ "<unknown>"
+# endif
#endif
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index a82b540ed60..a5074efe176 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -121,7 +121,8 @@ _mesa_swap4( GLuint *p, GLuint n )
* \return the size, in bytes, of the given data type, 0 if a GL_BITMAP, or -1
* if an invalid type enum.
*/
-GLint _mesa_sizeof_type( GLenum type )
+GLint
+_mesa_sizeof_type( GLenum type )
{
switch (type) {
case GL_BITMAP:
@@ -152,7 +153,8 @@ GLint _mesa_sizeof_type( GLenum type )
* Same as _mesa_sizeof_type() but also accepting the packed pixel
* format data types.
*/
-GLint _mesa_sizeof_packed_type( GLenum type )
+GLint
+_mesa_sizeof_packed_type( GLenum type )
{
switch (type) {
case GL_BITMAP:
@@ -215,7 +217,8 @@ GLint _mesa_sizeof_packed_type( GLenum type )
*
* \return the number of components in the given format, or -1 if a bad format.
*/
-GLint _mesa_components_in_format( GLenum format )
+GLint
+_mesa_components_in_format( GLenum format )
{
switch (format) {
case GL_COLOR_INDEX:
@@ -264,7 +267,8 @@ GLint _mesa_components_in_format( GLenum format )
*
* \return bytes per pixel, or -1 if a bad format or type was given.
*/
-GLint _mesa_bytes_per_pixel( GLenum format, GLenum type )
+GLint
+_mesa_bytes_per_pixel( GLenum format, GLenum type )
{
GLint comps = _mesa_components_in_format( format );
if (comps < 0)
@@ -636,10 +640,6 @@ _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
* \param type pixel data type.
*
* \return the stride in bytes for the given parameters.
- *
- * Computes the number of bytes per pixel and row and compensates for alignment.
- *
- * \sa gl_pixelstore_attrib.
*/
GLint
_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
@@ -731,7 +731,7 @@ void
_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
const struct gl_pixelstore_attrib *unpacking )
{
- GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap( 32, 32, pattern, unpacking );
+ GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap(32, 32, pattern, unpacking);
if (ptrn) {
/* Convert pattern from GLubytes to GLuints and handle big/little
* endian differences
@@ -745,7 +745,7 @@ _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
| (p[3] );
p += 4;
}
- FREE(ptrn);
+ _mesa_free(ptrn);
}
}
@@ -790,11 +790,10 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
/* Alloc dest storage */
bytes = ((width + 7) / 8 * height);
- buffer = (GLubyte *) MALLOC( bytes );
+ buffer = (GLubyte *) _mesa_malloc( bytes );
if (!buffer)
return NULL;
-
width_in_bytes = CEILING( width, 8 );
dst = buffer;
for (row = 0; row < height; row++) {
@@ -802,12 +801,12 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
_mesa_image_address2d(packing, pixels, width, height,
GL_COLOR_INDEX, GL_BITMAP, row, 0);
if (!src) {
- FREE(buffer);
+ _mesa_free(buffer);
return NULL;
}
if (packing->SkipPixels == 0) {
- MEMCPY( dst, src, width_in_bytes );
+ _mesa_memcpy( dst, src, width_in_bytes );
if (packing->LsbFirst) {
flip_bytes( dst, width_in_bytes );
}
@@ -899,7 +898,7 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
return;
if (packing->SkipPixels == 0) {
- MEMCPY( dst, src, width_in_bytes );
+ _mesa_memcpy( dst, src, width_in_bytes );
if (packing->LsbFirst) {
flip_bytes( dst, width_in_bytes );
}
@@ -2002,7 +2001,7 @@ _mesa_pack_rgba_span_chan( GLcontext *ctx,
/* Test for optimized case first */
if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) {
/* common simple case */
- MEMCPY(dstAddr, srcRgba, n * 4 * sizeof(GLchan));
+ _mesa_memcpy(dstAddr, srcRgba, n * 4 * sizeof(GLchan));
}
else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) {
/* common simple case */
@@ -2853,7 +2852,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
if (srcType == CHAN_TYPE) {
if (dstFormat == GL_RGBA) {
if (srcFormat == GL_RGBA) {
- MEMCPY( dest, source, n * 4 * sizeof(GLchan) );
+ _mesa_memcpy( dest, source, n * 4 * sizeof(GLchan) );
return;
}
else if (srcFormat == GL_RGB) {
@@ -2873,7 +2872,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
}
else if (dstFormat == GL_RGB) {
if (srcFormat == GL_RGB) {
- MEMCPY( dest, source, n * 3 * sizeof(GLchan) );
+ _mesa_memcpy( dest, source, n * 3 * sizeof(GLchan) );
return;
}
else if (srcFormat == GL_RGBA) {
@@ -2893,7 +2892,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
else if (dstFormat == srcFormat) {
GLint comps = _mesa_components_in_format(srcFormat);
assert(comps > 0);
- MEMCPY( dest, source, n * comps * sizeof(GLchan) );
+ _mesa_memcpy( dest, source, n * comps * sizeof(GLchan) );
return;
}
}
@@ -3392,11 +3391,11 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
*/
if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE
&& dstType == GL_UNSIGNED_BYTE) {
- MEMCPY(dest, source, n * sizeof(GLubyte));
+ _mesa_memcpy(dest, source, n * sizeof(GLubyte));
}
else if (transferOps == 0 && srcType == GL_UNSIGNED_INT
&& dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) {
- MEMCPY(dest, source, n * sizeof(GLuint));
+ _mesa_memcpy(dest, source, n * sizeof(GLuint));
}
else {
/*
@@ -3438,7 +3437,7 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
}
break;
case GL_UNSIGNED_INT:
- MEMCPY(dest, indexes, n * sizeof(GLuint));
+ _mesa_memcpy(dest, indexes, n * sizeof(GLuint));
break;
default:
_mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span");
@@ -3461,7 +3460,7 @@ _mesa_pack_index_span( const GLcontext *ctx, GLuint n,
if (transferOps & (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT)) {
/* make a copy of input */
- MEMCPY(indexes, source, n * sizeof(GLuint));
+ _mesa_memcpy(indexes, source, n * sizeof(GLuint));
if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
_mesa_shift_and_offset_ci( ctx, n, indexes);
}
@@ -3613,13 +3612,13 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
if (transferOps == 0 &&
srcType == GL_UNSIGNED_BYTE &&
dstType == GL_UNSIGNED_BYTE) {
- MEMCPY(dest, source, n * sizeof(GLubyte));
+ _mesa_memcpy(dest, source, n * sizeof(GLubyte));
}
else if (transferOps == 0 &&
srcType == GL_UNSIGNED_INT &&
dstType == GL_UNSIGNED_INT &&
!srcPacking->SwapBytes) {
- MEMCPY(dest, source, n * sizeof(GLuint));
+ _mesa_memcpy(dest, source, n * sizeof(GLuint));
}
else {
/*
@@ -3668,7 +3667,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
}
break;
case GL_UNSIGNED_INT:
- MEMCPY(dest, indexes, n * sizeof(GLuint));
+ _mesa_memcpy(dest, indexes, n * sizeof(GLuint));
break;
default:
_mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
@@ -3689,7 +3688,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset ||
ctx->Pixel.MapStencilFlag) {
/* make a copy of input */
- MEMCPY(stencil, source, n * sizeof(GLstencil));
+ _mesa_memcpy(stencil, source, n * sizeof(GLstencil));
if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) {
_mesa_shift_and_offset_stencil( ctx, n, stencil );
}
@@ -3702,7 +3701,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
switch (dstType) {
case GL_UNSIGNED_BYTE:
if (sizeof(GLstencil) == 8) {
- MEMCPY( dest, source, n );
+ _mesa_memcpy( dest, source, n );
}
else {
GLubyte *dst = (GLubyte *) dest;
@@ -3714,7 +3713,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
break;
case GL_BYTE:
if (sizeof(GLstencil) == 8) {
- MEMCPY( dest, source, n );
+ _mesa_memcpy( dest, source, n );
}
else {
GLbyte *dst = (GLbyte *) dest;
@@ -3908,8 +3907,10 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
}
break;
case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
- if (dstType == GL_UNSIGNED_INT && ctx->Pixel.DepthScale == 1.0 &&
- ctx->Pixel.DepthBias == 0.0 && depthScale == (GLfloat) 0xffffff) {
+ if (dstType == GL_UNSIGNED_INT &&
+ depthScale == (GLfloat) 0xffffff &&
+ ctx->Pixel.DepthScale == 1.0 &&
+ ctx->Pixel.DepthBias == 0.0) {
const GLuint *src = (const GLuint *) source;
GLuint *zValues = (GLuint *) dest;
GLuint i;
@@ -3928,7 +3929,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
}
break;
case GL_FLOAT:
- MEMCPY(depthValues, source, n * sizeof(GLfloat));
+ _mesa_memcpy(depthValues, source, n * sizeof(GLfloat));
break;
case GL_HALF_FLOAT_ARB:
{
@@ -3953,13 +3954,27 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
if (dstType == GL_UNSIGNED_INT) {
GLuint *zValues = (GLuint *) dest;
GLuint i;
- for (i = 0; i < n; i++) {
- zValues[i] = (GLuint) (depthValues[i] * depthScale);
+ if (depthScale <= (GLfloat) 0xffffff) {
+ /* no overflow worries */
+ for (i = 0; i < n; i++) {
+ zValues[i] = (GLuint) (depthValues[i] * depthScale);
+ }
+ }
+ else {
+ /* need to use double precision to prevent overflow problems */
+ for (i = 0; i < n; i++) {
+ GLdouble z = depthValues[i] * depthScale;
+ if (z >= (GLdouble) 0xffffffff)
+ zValues[i] = 0xffffffff;
+ else
+ zValues[i] = (GLuint) z;
+ }
}
}
else if (dstType == GL_UNSIGNED_SHORT) {
GLushort *zValues = (GLushort *) dest;
GLuint i;
+ ASSERT(depthScale <= 65535.0);
for (i = 0; i < n; i++) {
zValues[i] = (GLushort) (depthValues[i] * depthScale);
}
@@ -4176,7 +4191,8 @@ _mesa_unpack_image( GLuint dimensions,
}
{
- GLubyte *destBuffer = (GLubyte *) MALLOC(bytesPerRow * height * depth);
+ GLubyte *destBuffer
+ = (GLubyte *) _mesa_malloc(bytesPerRow * height * depth);
GLubyte *dst;
GLint img, row;
if (!destBuffer)
@@ -4187,7 +4203,7 @@ _mesa_unpack_image( GLuint dimensions,
for (row = 0; row < height; row++) {
const GLvoid *src = _mesa_image_address(dimensions, unpack, pixels,
width, height, format, type, img, row, 0);
- MEMCPY(dst, src, bytesPerRow);
+ _mesa_memcpy(dst, src, bytesPerRow);
/* byte flipping/swapping */
if (flipBytes) {
flip_bytes((GLubyte *) dst, bytesPerRow);
@@ -4205,7 +4221,7 @@ _mesa_unpack_image( GLuint dimensions,
}
}
-#endif
+#endif /* _HAVE_FULL_GL */
/**
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index afa5fc1c7f4..b506f856a69 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -201,6 +201,25 @@ _mesa_align_free(void *ptr)
#endif
}
+/**
+ * Reallocate memory, with alignment.
+ */
+void *
+_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
+ unsigned long alignment)
+{
+ const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
+ void *newBuf = _mesa_align_malloc(newSize, alignment);
+ if (newBuf && oldBuffer && copySize > 0) {
+ _mesa_memcpy(newBuf, oldBuffer, copySize);
+ }
+ if (oldBuffer)
+ _mesa_align_free(oldBuffer);
+ return newBuf;
+}
+
+
+
/** Reallocate memory */
void *
_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
@@ -295,17 +314,17 @@ _mesa_sin(double a)
#else
return sin(a);
#endif
-}
-
-/** Single precision wrapper around either sin() or xf86sin() */
-float
-_mesa_sinf(float a)
-{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return (float) xf86sin((double) a);
-#else
- return (float) sin((double) a);
-#endif
+}
+
+/** Single precision wrapper around either sin() or xf86sin() */
+float
+_mesa_sinf(float a)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return (float) xf86sin((double) a);
+#else
+ return (float) sin((double) a);
+#endif
}
/** Wrapper around either cos() or xf86cos() */
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 37abe89d330..3e41874343f 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -626,6 +626,10 @@ extern void
_mesa_align_free( void *ptr );
extern void *
+_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
+ unsigned long alignment);
+
+extern void *
_mesa_exec_malloc( GLuint size );
extern void
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 35ec1547e98..63f88b7229f 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -125,11 +125,11 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
if (light->SpotCutoff == params[0])
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
- light->SpotCutoff = params[0];
+ light->SpotCutoff = params[0];
light->_CosCutoffNeg = (GLfloat) (_mesa_cos(light->SpotCutoff * DEG2RAD));
if (light->_CosCutoffNeg < 0)
- light->_CosCutoff = 0;
- else
+ light->_CosCutoff = 0;
+ else
light->_CosCutoff = light->_CosCutoffNeg;
if (light->SpotCutoff != 180.0F)
light->_Flags |= LIGHT_SPOT;
@@ -1265,7 +1265,7 @@ init_light( struct gl_light *l, GLuint n )
ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 );
l->SpotExponent = 0.0;
_mesa_invalidate_spot_exp_table( l );
- l->SpotCutoff = 180.0;
+ l->SpotCutoff = 180.0;
l->_CosCutoffNeg = -1.0f;
l->_CosCutoff = 0.0; /* KW: -ve values not admitted */
l->ConstantAttenuation = 1.0;
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index ecd3732c933..7339b0ce409 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -160,6 +160,10 @@ _mesa_MatrixMode( GLenum mode )
ctx->CurrentStack = &ctx->ProjectionMatrixStack;
break;
case GL_TEXTURE:
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(texcoord unit)");
+ return;
+ }
ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
break;
case GL_COLOR:
@@ -576,8 +580,8 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
}
/* clamp width and height to the implementation dependent range */
- width = CLAMP(width, 1, ctx->Const.MaxViewportWidth);
- height = CLAMP(height, 1, ctx->Const.MaxViewportHeight);
+ width = CLAMP(width, 1, (GLsizei) ctx->Const.MaxViewportWidth);
+ height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
ctx->Viewport.X = x;
ctx->Viewport.Width = width;
diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c
index 0a71c4d8514..e5f445889f9 100644
--- a/src/mesa/main/mm.c
+++ b/src/mesa/main/mm.c
@@ -28,19 +28,26 @@
void
mmDumpMemInfo(const struct mem_block *heap)
{
- const struct mem_block *p;
-
fprintf(stderr, "Memory heap %p:\n", (void *)heap);
if (heap == 0) {
fprintf(stderr, " heap == 0\n");
} else {
- p = (struct mem_block *)heap;
- while (p) {
+ const struct mem_block *p;
+
+ for(p = heap->next; p != heap; p = p->next) {
+ fprintf(stderr, " Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
+ p->free ? 'F':'.',
+ p->reserved ? 'R':'.');
+ }
+
+ fprintf(stderr, "\nFree list:\n");
+
+ for(p = heap->next_free; p != heap; p = p->next_free) {
fprintf(stderr, " Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
- p->free ? '.':'U',
+ p->free ? 'F':'.',
p->reserved ? 'R':'.');
- p = p->next;
}
+
}
fprintf(stderr, "End of memory blocks\n");
}
@@ -48,21 +55,37 @@ mmDumpMemInfo(const struct mem_block *heap)
struct mem_block *
mmInit(int ofs, int size)
{
- struct mem_block *blocks;
+ struct mem_block *heap, *block;
- if (size <= 0) {
+ if (size <= 0)
return NULL;
- }
- blocks = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
- if (blocks) {
- blocks->ofs = ofs;
- blocks->size = size;
- blocks->free = 1;
- return (struct mem_block *)blocks;
- }
- else {
+
+ heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
+ if (!heap)
+ return NULL;
+
+ block = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
+ if (!block) {
+ _mesa_free(heap);
return NULL;
}
+
+ heap->next = block;
+ heap->prev = block;
+ heap->next_free = block;
+ heap->prev_free = block;
+
+ block->heap = heap;
+ block->next = heap;
+ block->prev = heap;
+ block->next_free = heap;
+ block->prev_free = heap;
+
+ block->ofs = ofs;
+ block->size = size;
+ block->free = 1;
+
+ return (struct mem_block *)heap;
}
@@ -73,7 +96,7 @@ SliceBlock(struct mem_block *p,
{
struct mem_block *newblock;
- /* break left */
+ /* break left [p, newblock, p->next], then p = newblock */
if (startofs > p->ofs) {
newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block));
if (!newblock)
@@ -81,13 +104,23 @@ SliceBlock(struct mem_block *p,
newblock->ofs = startofs;
newblock->size = p->size - (startofs - p->ofs);
newblock->free = 1;
+ newblock->heap = p->heap;
+
newblock->next = p->next;
- p->size -= newblock->size;
+ newblock->prev = p;
+ p->next->prev = newblock;
p->next = newblock;
+
+ newblock->next_free = p->next_free;
+ newblock->prev_free = p;
+ p->next_free->prev_free = newblock;
+ p->next_free = newblock;
+
+ p->size -= newblock->size;
p = newblock;
}
- /* break right */
+ /* break right, also [p, newblock, p->next], then p = newblock*/
if (size < p->size) {
newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block));
if (!newblock)
@@ -95,14 +128,29 @@ SliceBlock(struct mem_block *p,
newblock->ofs = startofs + size;
newblock->size = p->size - size;
newblock->free = 1;
+ newblock->heap = p->heap;
+
newblock->next = p->next;
- p->size = size;
+ newblock->prev = p;
+ p->next->prev = newblock;
p->next = newblock;
+
+ newblock->next_free = p->next_free;
+ newblock->prev_free = p;
+ p->next_free->prev_free = newblock;
+ p->next_free = newblock;
+
+ p->size = size;
}
/* p = middle block */
- p->align = alignment;
p->free = 0;
+
+ /* Remove p from the free list:
+ */
+ p->next_free->prev_free = p->prev_free;
+ p->prev_free->next_free = p->next_free;
+
p->reserved = reserved;
return p;
}
@@ -111,30 +159,31 @@ SliceBlock(struct mem_block *p,
struct mem_block *
mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
{
- struct mem_block *p = heap;
- int mask = (1 << align2)-1;
+ struct mem_block *p;
+ const int mask = (1 << align2)-1;
int startofs = 0;
int endofs;
if (!heap || align2 < 0 || size <= 0)
return NULL;
- while (p) {
- if ((p)->free) {
- startofs = (p->ofs + mask) & ~mask;
- if ( startofs < startSearch ) {
- startofs = startSearch;
- }
- endofs = startofs+size;
- if (endofs <= (p->ofs+p->size))
- break;
+ for (p = heap->next_free; p != heap; p = p->next_free) {
+ assert(p->free);
+
+ startofs = (p->ofs + mask) & ~mask;
+ if ( startofs < startSearch ) {
+ startofs = startSearch;
}
- p = p->next;
+ endofs = startofs+size;
+ if (endofs <= (p->ofs+p->size))
+ break;
}
- if (!p)
+
+ if (p == heap)
return NULL;
+
p = SliceBlock(p,startofs,size,0,mask+1);
- p->heap = heap;
+
return p;
}
@@ -142,27 +191,34 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
struct mem_block *
mmFindBlock(struct mem_block *heap, int start)
{
- struct mem_block *p = (struct mem_block *)heap;
+ struct mem_block *p;
- while (p) {
- if (p->ofs == start && p->free)
+ for (p = heap->next_free; p != heap; p = p->next_free) {
+ if (p->ofs == start)
return p;
-
- p = p->next;
}
return NULL;
}
-static int
+static INLINE int
Join2Blocks(struct mem_block *p)
{
/* XXX there should be some assertions here */
- if (p->free && p->next && p->next->free) {
+
+ /* NOTE: heap->free == 0 */
+
+ if (p->free && p->next->free) {
struct mem_block *q = p->next;
p->size += q->size;
+
p->next = q->next;
+ q->next->prev = p;
+
+ q->next_free->prev_free = q->prev_free;
+ q->prev_free->next_free = q->next_free;
+
_mesa_free(q);
return 1;
}
@@ -172,33 +228,28 @@ Join2Blocks(struct mem_block *p)
int
mmFreeMem(struct mem_block *b)
{
- struct mem_block *p,*prev;
-
if (!b)
return 0;
- if (!b->heap) {
- fprintf(stderr, "no heap\n");
+
+ if (b->free) {
+ fprintf(stderr, "block already free\n");
return -1;
}
- p = b->heap;
- prev = NULL;
- while (p && p != b) {
- prev = p;
- p = p->next;
- }
- if (!p || p->free || p->reserved) {
- if (!p)
- fprintf(stderr, "block not found in heap\n");
- else if (p->free)
- fprintf(stderr, "block already free\n");
- else
- fprintf(stderr, "block is reserved\n");
+ if (b->reserved) {
+ fprintf(stderr, "block is reserved\n");
return -1;
}
- p->free = 1;
- Join2Blocks(p);
- if (prev)
- Join2Blocks(prev);
+
+ b->free = 1;
+ b->next_free = b->heap->next_free;
+ b->prev_free = b->heap;
+ b->next_free->prev_free = b;
+ b->prev_free->next_free = b;
+
+ Join2Blocks(b);
+ if (b->prev)
+ Join2Blocks(b->prev);
+
return 0;
}
@@ -211,10 +262,11 @@ mmDestroy(struct mem_block *heap)
if (!heap)
return;
- p = (struct mem_block *) heap;
- while (p) {
+ for (p = heap->next; p != heap; ) {
struct mem_block *next = p->next;
_mesa_free(p);
p = next;
}
+
+ _mesa_free(heap);
}
diff --git a/src/mesa/main/mm.h b/src/mesa/main/mm.h
index 9213b2ad34e..26d59fff139 100644
--- a/src/mesa/main/mm.h
+++ b/src/mesa/main/mm.h
@@ -36,12 +36,12 @@
struct mem_block {
- struct mem_block *next;
- struct mem_block *heap;
- int ofs,size;
- int align;
- unsigned int free:1;
- unsigned int reserved:1;
+ struct mem_block *next, *prev;
+ struct mem_block *next_free, *prev_free;
+ struct mem_block *heap;
+ int ofs,size;
+ unsigned int free:1;
+ unsigned int reserved:1;
};
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7876cff2ed5..e9893dda619 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -41,6 +41,7 @@
#include "glapitable.h"
#include "glthread.h"
#include "math/m_matrix.h" /* GLmatrix */
+#include "bitset.h"
/**
@@ -141,7 +142,7 @@ enum
VERT_ATTRIB_COLOR0 = 3,
VERT_ATTRIB_COLOR1 = 4,
VERT_ATTRIB_FOG = 5,
- VERT_ATTRIB_SIX = 6,
+ VERT_ATTRIB_COLOR_INDEX = 6,
VERT_ATTRIB_SEVEN = 7,
VERT_ATTRIB_TEX0 = 8,
VERT_ATTRIB_TEX1 = 9,
@@ -155,7 +156,19 @@ enum
VERT_ATTRIB_GENERIC1 = 17,
VERT_ATTRIB_GENERIC2 = 18,
VERT_ATTRIB_GENERIC3 = 19,
- VERT_ATTRIB_MAX = 16 /* XXX not counting generic attribs yet */
+ VERT_ATTRIB_GENERIC4 = 20,
+ VERT_ATTRIB_GENERIC5 = 21,
+ VERT_ATTRIB_GENERIC6 = 22,
+ VERT_ATTRIB_GENERIC7 = 23,
+ VERT_ATTRIB_GENERIC8 = 24,
+ VERT_ATTRIB_GENERIC9 = 25,
+ VERT_ATTRIB_GENERIC10 = 26,
+ VERT_ATTRIB_GENERIC11 = 27,
+ VERT_ATTRIB_GENERIC12 = 28,
+ VERT_ATTRIB_GENERIC13 = 29,
+ VERT_ATTRIB_GENERIC14 = 30,
+ VERT_ATTRIB_GENERIC15 = 31,
+ VERT_ATTRIB_MAX = 32
};
/**
@@ -163,32 +176,61 @@ enum
* These are used in bitfields in many places.
*/
/*@{*/
-#define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
-#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
-#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
-#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
-#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
-#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
-#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX)
-#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
-#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
-#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
-#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
-#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
-#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
-#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
-#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
-#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
-#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
-#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
-#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
-#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
+#define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
+#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
+#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
+#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
+#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
+#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
+#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
+#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
+#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
+#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
+#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
+#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
+#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
+#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
+#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
+#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
+#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
+#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
+#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
+#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4)
+#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5)
+#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6)
+#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7)
+#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8)
+#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9)
+#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10)
+#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11)
+#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12)
+#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13)
+#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14)
+#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15)
#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
#define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g)))
/*@}*/
/**
+ * GLSL allows shader writers to allocate vertex result attributes (varyings) in
+ * single float component granularity. This is in contrast to vertex / fragment
+ * programs, where result attributes (actually texcoords) were allocated
+ * in 4-component vectors of floats granularity.
+ * For performance reasons, it would be optimal to stick with this scheme on a scalar
+ * processor. Varyings will likely be allocated as 3-component vectors, so statistically
+ * we win 2 floats.
+ * The constant VARYINGS_PER_VECTOR tells us how much of float components we pack into
+ * one result vector. For scalar processor it would be 1, for vector processor - 4.
+ *
+ * NOTE: Currently we pack varyings into vertex attributes.
+ */
+#define VARYINGS_PER_VECTOR 2
+#define VARYING_EMIT_STYLE EMIT_2F
+#define MAX_VARYING_VECTORS ((MAX_VARYING_FLOATS + VARYINGS_PER_VECTOR - 1) / VARYINGS_PER_VECTOR)
+
+/**
* Indexes for vertex program result attributes
*/
/*@{*/
@@ -207,7 +249,8 @@ enum
#define VERT_RESULT_PSIZ 12
#define VERT_RESULT_BFC0 13
#define VERT_RESULT_BFC1 14
-#define VERT_RESULT_MAX 15
+#define VERT_RESULT_EDGE 15
+#define VERT_RESULT_MAX 16
/*@}*/
@@ -571,29 +614,27 @@ struct gl_colorbuffer_attrib
struct gl_current_attrib
{
/**
- * \name Values valid only when FLUSH_VERTICES has been called.
+ * \name Current vertex attributes.
+ * \note Values are valid only after FLUSH_VERTICES has been called.
*/
/*@{*/
- GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Current vertex attributes
- * indexed by VERT_ATTRIB_* */
- GLfloat Index; /**< Current color index */
- GLboolean EdgeFlag; /**< Current edge flag */
+ GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */
+ GLfloat Index; /**< Current color index */
+ GLboolean EdgeFlag; /**< Current edge flag */
/*@}*/
/**
- * \name Values are always valid.
- *
- * \note BTW, note how similar this set of attributes is to the SWvertex
- * data type in the software rasterizer...
+ * \name Current raster position attributes (always valid).
+ * \note This set of attributes is very similar to the SWvertex struct.
*/
/*@{*/
- GLfloat RasterPos[4]; /**< Current raster position */
- GLfloat RasterDistance; /**< Current raster distance */
- GLfloat RasterColor[4]; /**< Current raster color */
- GLfloat RasterSecondaryColor[4]; /**< Current raster secondary color */
- GLfloat RasterIndex; /**< Current raster index */
- GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/**< Current raster texcoords */
- GLboolean RasterPosValid; /**< Raster pos valid flag */
+ GLfloat RasterPos[4];
+ GLfloat RasterDistance;
+ GLfloat RasterColor[4];
+ GLfloat RasterSecondaryColor[4];
+ GLfloat RasterIndex;
+ GLfloat RasterTexCoords[MAX_TEXTURE_COORD_UNITS][4];
+ GLboolean RasterPosValid;
/*@}*/
};
@@ -1006,8 +1047,8 @@ struct gl_point_attrib
GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */
GLfloat Threshold; /**< GL_EXT_point_parameters */
GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */
- GLboolean PointSprite; /**< GL_NV_point_sprite / GL_NV_point_sprite */
- GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /**< GL_NV/ARB_point_sprite */
+ GLboolean PointSprite; /**< GL_NV/ARB_point_sprite */
+ GLboolean CoordReplace[MAX_TEXTURE_COORD_UNITS]; /**< GL_ARB_point_sprite */
GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */
GLenum SpriteOrigin; /**< GL_ARB_point_sprite */
};
@@ -1175,25 +1216,43 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
GLint col, GLint row, GLint img,
const void *texel);
+
/**
- * TexImage store function. This is called by the glTex[Sub]Image
- * functions and is responsible for converting the user-specified texture
- * image into a specific (hardware) image format.
+ * 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
*/
-typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking);
+#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
@@ -1236,6 +1295,8 @@ struct gl_texture_format
};
+#define MAX_3D_TEXTURE_SIZE (1 << (MAX_3D_TEXTURE_LEVELS - 1))
+
/**
* Texture image state. Describes the dimensions of a texture image,
* the texel format and pointers to Texel Fetch functions.
@@ -1253,8 +1314,6 @@ struct gl_texture_image
GLuint Width; /**< = 2^WidthLog2 + 2*Border */
GLuint Height; /**< = 2^HeightLog2 + 2*Border */
GLuint Depth; /**< = 2^DepthLog2 + 2*Border */
- GLuint RowStride; /**< == Width unless IsClientData and padded */
- GLuint ImageStride; /**< Stride between images, in texels */
GLuint Width2; /**< = Width - 2*Border */
GLuint Height2; /**< = Height - 2*Border */
GLuint Depth2; /**< = Depth - 2*Border */
@@ -1265,7 +1324,6 @@ struct gl_texture_image
GLfloat WidthScale; /**< used for mipmap LOD computation */
GLfloat HeightScale; /**< used for mipmap LOD computation */
GLfloat DepthScale; /**< used for mipmap LOD computation */
- GLvoid *Data; /**< Image data, accessed via FetchTexel() */
GLboolean IsClientData; /**< Data owned by client? */
GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
@@ -1279,6 +1337,11 @@ struct gl_texture_image
GLboolean IsCompressed; /**< GL_ARB_texture_compression */
GLuint CompressedSize; /**< GL_ARB_texture_compression */
+ GLuint RowStride; /**< == Width unless IsClientData and padded */
+ GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
+ each 2D slice in 'Data', in texels */
+ GLvoid *Data; /**< Image data, accessed via FetchTexel() */
+
/**
* \name For device driver:
*/
@@ -1451,11 +1514,17 @@ struct gl_texture_unit
GLboolean ColorTableEnabled;
};
-struct texenvprog_cache {
+struct texenvprog_cache_item {
GLuint hash;
void *key;
- void *data;
- struct texenvprog_cache *next;
+ struct fragment_program *data;
+ struct texenvprog_cache_item *next;
+};
+
+struct texenvprog_cache {
+ struct texenvprog_cache_item **items;
+ GLuint size, n_items;
+ GLcontext *ctx;
};
/**
@@ -1488,7 +1557,7 @@ struct gl_texture_attrib
struct gl_color_table Palette;
/** Cached texenv fragment programs */
- struct texenvprog_cache *env_fp_cache;
+ struct texenvprog_cache env_fp_cache;
};
@@ -1599,7 +1668,9 @@ struct gl_client_array
*/
struct gl_array_attrib
{
- struct gl_client_array Vertex; /**< client data descriptors */
+ /** Conventional vertex arrays */
+ /*@{*/
+ struct gl_client_array Vertex;
struct gl_client_array Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
@@ -1607,15 +1678,17 @@ struct gl_array_attrib
struct gl_client_array Index;
struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
+ /*@}*/
- struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; /**< GL_NV_vertex_program */
+ /** Generic arrays for vertex programs/shaders; */
+ struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
GLint ActiveTexture; /**< Client Active Texture */
GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
- GLbitfield _Enabled; /**< _NEW_ARRAY_* - bit set if array enabled */
- GLbitfield NewState; /**< _NEW_ARRAY_* */
+ GLbitfield _Enabled; /**< mask of _NEW_ARRAY_* values */
+ GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */
#if FEATURE_ARB_vertex_buffer_object
struct gl_buffer_object *NullBufferObj;
@@ -1844,9 +1917,9 @@ struct gl_vertex_program_state
GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
struct vertex_program *Current; /**< ptr to currently bound program */
- struct vertex_program *_Current; /**< ptr to currently bound
- program, including internal
- (t_vp_build.c) programs */
+ const struct vertex_program *_Current; /**< ptr to currently bound
+ program, including internal
+ (t_vp_build.c) programs */
GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
@@ -1877,8 +1950,8 @@ struct gl_fragment_program_state
GLboolean _Enabled; /* Enabled and valid program? */
GLboolean _Active;
struct fragment_program *Current; /* ptr to currently bound program */
- struct fragment_program *_Current; /* ptr to currently active program
- (including internal programs) */
+ const struct fragment_program *_Current; /* ptr to currently active program
+ (including internal programs) */
struct fp_machine Machine; /* machine state */
GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */
@@ -2260,7 +2333,7 @@ struct gl_constants
GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */
GLuint MaxTextureCoordUnits;
GLuint MaxTextureImageUnits;
- GLuint MaxTextureUnits; /* = MAX(CoordUnits, ImageUnits) */
+ GLuint MaxTextureUnits; /* = MIN(CoordUnits, ImageUnits) */
GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */
GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */
GLuint MaxArrayLockSize;
@@ -2522,7 +2595,7 @@ struct matrix_stack
#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0
#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
-#define _NEW_ARRAY_INDEX VERT_BIT_SIX
+#define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX
#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c
index 483ca5d0c41..2f4be87901c 100644
--- a/src/mesa/main/occlude.c
+++ b/src/mesa/main/occlude.c
@@ -42,6 +42,7 @@ struct gl_query_object *
_mesa_new_query_object(GLcontext *ctx, GLuint id)
{
struct gl_query_object *q = MALLOC_STRUCT(gl_query_object);
+ (void) ctx;
if (q) {
q->Id = id;
q->Result = 0;
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 507eb9f9843..4f490db724f 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -503,7 +503,8 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
}
else {
- ctx->Current.RasterIndex = ctx->Current.Index;
+ ctx->Current.RasterIndex
+ = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
}
}
@@ -756,7 +757,8 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z)
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F);
}
else {
- ctx->Current.RasterIndex = ctx->Current.Index;
+ ctx->Current.RasterIndex
+ = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
}
/* raster texcoord = current texcoord */
diff --git a/src/mesa/main/rbadaptors.c b/src/mesa/main/rbadaptors.c
new file mode 100644
index 00000000000..313c8d43d62
--- /dev/null
+++ b/src/mesa/main/rbadaptors.c
@@ -0,0 +1,577 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.1
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * Renderbuffer adaptors.
+ * These fuctions are used to convert rendering from core Mesa's GLchan
+ * colors to 8 or 16-bit color channels in RGBA renderbuffers.
+ * This means Mesa can be compiled for 16 or 32-bit color processing
+ * and still render into 8 and 16-bit/channel renderbuffers.
+ */
+
+
+#include "glheader.h"
+#include "mtypes.h"
+#include "colormac.h"
+#include "renderbuffer.h"
+#include "rbadaptors.h"
+
+
+static void
+Delete_wrapper(struct gl_renderbuffer *rb)
+{
+ /* Decrement reference count on the buffer we're wrapping and delete
+ * it if refcount hits zero.
+ */
+ _mesa_dereference_renderbuffer(&rb->Wrapped);
+
+ /* delete myself */
+ _mesa_delete_renderbuffer(rb);
+}
+
+
+static GLboolean
+AllocStorage_wrapper(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLenum internalFormat, GLuint width, GLuint height)
+{
+ GLboolean b = rb->Wrapped->AllocStorage(ctx, rb->Wrapped, internalFormat,
+ width, height);
+ if (b) {
+ rb->Width = width;
+ rb->Height = height;
+ }
+ return b;
+}
+
+
+static void *
+GetPointer_wrapper(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLint x, GLint y)
+{
+ (void) ctx;
+ (void) rb;
+ (void) x;
+ (void) y;
+ return NULL;
+}
+
+
+static void
+GetRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, void *values)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLushort *values16 = (GLushort *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ ASSERT(count <= MAX_WIDTH);
+
+ /* get 8bpp values */
+ rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values8);
+
+ /* convert 8bpp to 16bpp */
+ for (i = 0; i < 4 * count; i++) {
+ values16[i] = (values8[i] << 8) | values8[i];
+ }
+}
+
+
+static void
+GetValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ const GLint x[], const GLint y[], void *values)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLushort *values16 = (GLushort *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+
+ rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values8);
+
+ for (i = 0; i < 4 * count; i++) {
+ values16[i] = (values8[i] << 8) | values8[i];
+ }
+}
+
+
+static void
+PutRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLushort *values16 = (GLushort *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ for (i = 0; i < 4 * count; i++) {
+ values8[i] = values16[i] >> 8;
+ }
+ rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values8, mask);
+}
+
+
+static void
+PutRowRGB_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+ GLubyte values8[MAX_WIDTH * 3];
+ GLushort *values16 = (GLushort *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ for (i = 0; i < 3 * count; i++) {
+ values8[i] = values16[i] >> 8;
+ }
+ rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values8, mask);
+}
+
+
+static void
+PutMonoRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *value, const GLubyte *mask)
+{
+ GLubyte value8[4];
+ GLushort *value16 = (GLushort *) value;
+ ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ value8[0] = value16[0] >> 8;
+ value8[1] = value16[1] >> 8;
+ value8[2] = value16[2] >> 8;
+ value8[3] = value16[3] >> 8;
+ rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value8, mask);
+}
+
+
+static void
+PutValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ const GLint x[], const GLint y[], const void *values,
+ const GLubyte *mask)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLushort *values16 = (GLushort *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ for (i = 0; i < 4 * count; i++) {
+ values8[i] = values16[i] >> 8;
+ }
+ rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values8, mask);
+}
+
+
+static void
+PutMonoValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLuint count, const GLint x[], const GLint y[],
+ const void *value, const GLubyte *mask)
+{
+ GLubyte value8[4];
+ GLushort *value16 = (GLushort *) value;
+ ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ value8[0] = value16[0] >> 8;
+ value8[1] = value16[1] >> 8;
+ value8[2] = value16[2] >> 8;
+ value8[3] = value16[3] >> 8;
+ rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value8, mask);
+}
+
+
+/**
+ * Wrap an 8-bit/channel renderbuffer with a 16-bit/channel
+ * renderbuffer adaptor.
+ */
+struct gl_renderbuffer *
+_mesa_new_renderbuffer_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8)
+{
+ struct gl_renderbuffer *rb16;
+
+ rb16 = _mesa_new_renderbuffer(ctx, rb8->Name);
+ if (rb16) {
+ ASSERT(rb8->DataType == GL_UNSIGNED_BYTE);
+ ASSERT(rb8->_BaseFormat == GL_RGBA);
+
+ _glthread_LOCK_MUTEX(rb8->Mutex);
+ rb8->RefCount++;
+ _glthread_UNLOCK_MUTEX(rb8->Mutex);
+
+ rb16->InternalFormat = rb8->InternalFormat;
+ rb16->_ActualFormat = rb8->_ActualFormat;
+ 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;
+ rb16->Delete = Delete_wrapper;
+ rb16->GetPointer = GetPointer_wrapper;
+ rb16->GetRow = GetRow_16wrap8;
+ rb16->GetValues = GetValues_16wrap8;
+ rb16->PutRow = PutRow_16wrap8;
+ rb16->PutRowRGB = PutRowRGB_16wrap8;
+ rb16->PutMonoRow = PutMonoRow_16wrap8;
+ rb16->PutValues = PutValues_16wrap8;
+ rb16->PutMonoValues = PutMonoValues_16wrap8;
+ }
+ return rb16;
+}
+
+
+
+
+static void
+GetRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, void *values)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ ASSERT(count <= MAX_WIDTH);
+
+ /* get 8bpp values */
+ rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values8);
+
+ /* convert 8bpp to 32bpp */
+ for (i = 0; i < 4 * count; i++) {
+ values32[i] = UBYTE_TO_FLOAT(values8[i]);
+ }
+}
+
+
+static void
+GetValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ const GLint x[], const GLint y[], void *values)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+
+ rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values8);
+
+ for (i = 0; i < 4 * count; i++) {
+ values32[i] = UBYTE_TO_FLOAT(values8[i]);
+ }
+}
+
+
+static void
+PutRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ for (i = 0; i < 4 * count; i++) {
+ UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]);
+ }
+ rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values8, mask);
+}
+
+
+static void
+PutRowRGB_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+ GLubyte values8[MAX_WIDTH * 3];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ for (i = 0; i < 3 * count; i++) {
+ UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]);
+ }
+ rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values8, mask);
+}
+
+
+static void
+PutMonoRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *value, const GLubyte *mask)
+{
+ GLubyte value8[4];
+ GLfloat *value32 = (GLfloat *) value;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[0], value32[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[1], value32[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[2], value32[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[3], value32[3]);
+ rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value8, mask);
+}
+
+
+static void
+PutValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ const GLint x[], const GLint y[], const void *values,
+ const GLubyte *mask)
+{
+ GLubyte values8[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ for (i = 0; i < 4 * count; i++) {
+ UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]);
+ }
+ rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values8, mask);
+}
+
+
+static void
+PutMonoValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLuint count, const GLint x[], const GLint y[],
+ const void *value, const GLubyte *mask)
+{
+ GLubyte value8[4];
+ GLfloat *value32 = (GLfloat *) value;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[0], value32[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[1], value32[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[2], value32[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(value8[3], value32[3]);
+ rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value8, mask);
+}
+
+
+/**
+ * Wrap an 8-bit/channel renderbuffer with a 32-bit/channel
+ * renderbuffer adaptor.
+ */
+struct gl_renderbuffer *
+_mesa_new_renderbuffer_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8)
+{
+ struct gl_renderbuffer *rb32;
+
+ rb32 = _mesa_new_renderbuffer(ctx, rb8->Name);
+ if (rb32) {
+ ASSERT(rb8->DataType == GL_UNSIGNED_BYTE);
+ ASSERT(rb8->_BaseFormat == GL_RGBA);
+
+ _glthread_LOCK_MUTEX(rb8->Mutex);
+ rb8->RefCount++;
+ _glthread_UNLOCK_MUTEX(rb8->Mutex);
+
+ rb32->InternalFormat = rb8->InternalFormat;
+ rb32->_ActualFormat = rb8->_ActualFormat;
+ 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;
+ rb32->Delete = Delete_wrapper;
+ rb32->GetPointer = GetPointer_wrapper;
+ rb32->GetRow = GetRow_32wrap8;
+ rb32->GetValues = GetValues_32wrap8;
+ rb32->PutRow = PutRow_32wrap8;
+ rb32->PutRowRGB = PutRowRGB_32wrap8;
+ rb32->PutMonoRow = PutMonoRow_32wrap8;
+ rb32->PutValues = PutValues_32wrap8;
+ rb32->PutMonoValues = PutMonoValues_32wrap8;
+ }
+ return rb32;
+}
+
+
+
+
+static void
+GetRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, void *values)
+{
+ GLushort values16[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(count <= MAX_WIDTH);
+
+ /* get 16bpp values */
+ rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values16);
+
+ /* convert 16bpp to 32bpp */
+ for (i = 0; i < 4 * count; i++) {
+ values32[i] = USHORT_TO_FLOAT(values16[i]);
+ }
+}
+
+
+static void
+GetValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ const GLint x[], const GLint y[], void *values)
+{
+ GLushort values16[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
+
+ rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values16);
+
+ for (i = 0; i < 4 * count; i++) {
+ values32[i] = USHORT_TO_FLOAT(values16[i]);
+ }
+}
+
+
+static void
+PutRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+ GLushort values16[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
+ for (i = 0; i < 4 * count; i++) {
+ UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]);
+ }
+ rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values16, mask);
+}
+
+
+static void
+PutRowRGB_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *values, const GLubyte *mask)
+{
+ GLushort values16[MAX_WIDTH * 3];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
+ for (i = 0; i < 3 * count; i++) {
+ UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]);
+ }
+ rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values16, mask);
+}
+
+
+static void
+PutMonoRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ GLint x, GLint y, const void *value, const GLubyte *mask)
+{
+ GLushort value16[4];
+ GLfloat *value32 = (GLfloat *) value;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[0], value32[0]);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[1], value32[1]);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[2], value32[2]);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[3], value32[3]);
+ rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value16, mask);
+}
+
+
+static void
+PutValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ const GLint x[], const GLint y[], const void *values,
+ const GLubyte *mask)
+{
+ GLushort values16[MAX_WIDTH * 4];
+ GLfloat *values32 = (GLfloat *) values;
+ GLuint i;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
+ for (i = 0; i < 4 * count; i++) {
+ UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]);
+ }
+ rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values16, mask);
+}
+
+
+static void
+PutMonoValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLuint count, const GLint x[], const GLint y[],
+ const void *value, const GLubyte *mask)
+{
+ GLushort value16[4];
+ GLfloat *value32 = (GLfloat *) value;
+ ASSERT(rb->DataType == GL_FLOAT);
+ ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[0], value32[0]);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[1], value32[1]);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[2], value32[2]);
+ UNCLAMPED_FLOAT_TO_USHORT(value16[3], value32[3]);
+ rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value16, mask);
+}
+
+
+/**
+ * Wrap an 16-bit/channel renderbuffer with a 32-bit/channel
+ * renderbuffer adaptor.
+ */
+struct gl_renderbuffer *
+_mesa_new_renderbuffer_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb16)
+{
+ struct gl_renderbuffer *rb32;
+
+ rb32 = _mesa_new_renderbuffer(ctx, rb16->Name);
+ if (rb32) {
+ ASSERT(rb16->DataType == GL_UNSIGNED_SHORT);
+ ASSERT(rb16->_BaseFormat == GL_RGBA);
+
+ _glthread_LOCK_MUTEX(rb16->Mutex);
+ rb16->RefCount++;
+ _glthread_UNLOCK_MUTEX(rb16->Mutex);
+
+ rb32->InternalFormat = rb16->InternalFormat;
+ rb32->_ActualFormat = rb16->_ActualFormat;
+ 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;
+ rb32->Delete = Delete_wrapper;
+ rb32->GetPointer = GetPointer_wrapper;
+ rb32->GetRow = GetRow_32wrap16;
+ rb32->GetValues = GetValues_32wrap16;
+ rb32->PutRow = PutRow_32wrap16;
+ rb32->PutRowRGB = PutRowRGB_32wrap16;
+ rb32->PutMonoRow = PutMonoRow_32wrap16;
+ rb32->PutValues = PutValues_32wrap16;
+ rb32->PutMonoValues = PutMonoValues_32wrap16;
+ }
+ return rb32;
+}
diff --git a/src/mesa/main/rbadaptors.h b/src/mesa/main/rbadaptors.h
new file mode 100644
index 00000000000..1d45b287ddf
--- /dev/null
+++ b/src/mesa/main/rbadaptors.h
@@ -0,0 +1,40 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.1
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef RBADAPTORS_H
+#define RBADAPTORS_H
+
+
+extern struct gl_renderbuffer *
+_mesa_new_renderbuffer_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8);
+
+extern struct gl_renderbuffer *
+_mesa_new_renderbuffer_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8);
+
+extern struct gl_renderbuffer *
+_mesa_new_renderbuffer_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb16);
+
+
+#endif /* RBADAPTORS_H */
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index aa14bf8634a..6b18d60baff 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -47,6 +47,8 @@
#include "fbobject.h"
#include "renderbuffer.h"
+#include "rbadaptors.h"
+
/* 32-bit color index format. Not a public format. */
#define COLOR_INDEX32 0x424243
@@ -624,10 +626,10 @@ static void
get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
- const GLbyte *src = (const GLbyte *) rb->Data + 4 * (y * rb->Width + x);
+ const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x);
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
ASSERT(rb->_ActualFormat == GL_RGBA8);
- _mesa_memcpy(values, src, 4 * count * sizeof(GLbyte));
+ _mesa_memcpy(values, src, 4 * count * sizeof(GLubyte));
}
@@ -1509,7 +1511,7 @@ _mesa_new_renderbuffer(GLcontext *ctx, GLuint name)
/**
* Delete a gl_framebuffer.
- * This is the default function for framebuffer->Delete().
+ * This is the default function for renderbuffer->Delete().
*/
void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
@@ -1517,7 +1519,6 @@ _mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
if (rb->Data) {
_mesa_free(rb->Data);
}
- _glthread_INIT_MUTEX(rb->Mutex);
_mesa_free(rb);
}
@@ -2029,12 +2030,16 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb,
{
assert(fb);
assert(rb);
-#if 00
- /* there should be no previous renderbuffer on this attachment point! */
- assert(fb->Attachment[bufferName].Renderbuffer == NULL);
-#endif
assert(bufferName < BUFFER_COUNT);
+ /* There should be no previous renderbuffer on this attachment point,
+ * with the exception of depth/stencil since the same renderbuffer may
+ * be used for both.
+ */
+ assert(bufferName == BUFFER_DEPTH ||
+ bufferName == BUFFER_STENCIL ||
+ fb->Attachment[bufferName].Renderbuffer == NULL);
+
/* winsys vs. user-created buffer cross check */
if (fb->Name) {
assert(rb->Name);
@@ -2043,13 +2048,81 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb,
assert(!rb->Name);
}
+ /* If Mesa's compiled with deep color channels (16 or 32 bits / channel)
+ * 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) {
+ if (CHAN_BITS == 16 && rb->DataType == GL_UNSIGNED_BYTE) {
+ GET_CURRENT_CONTEXT(ctx);
+ rb = _mesa_new_renderbuffer_16wrap8(ctx, rb);
+ }
+ else if (CHAN_BITS == 32 && rb->DataType == GL_UNSIGNED_BYTE) {
+ GET_CURRENT_CONTEXT(ctx);
+ rb = _mesa_new_renderbuffer_32wrap8(ctx, rb);
+ }
+ else if (CHAN_BITS == 32 && rb->DataType == GL_UNSIGNED_SHORT) {
+ GET_CURRENT_CONTEXT(ctx);
+ rb = _mesa_new_renderbuffer_32wrap16(ctx, rb);
+ }
+ }
+
fb->Attachment[bufferName].Type = GL_RENDERBUFFER_EXT;
fb->Attachment[bufferName].Complete = GL_TRUE;
fb->Attachment[bufferName].Renderbuffer = rb;
+
+ rb->RefCount++;
}
/**
+ * Remove the named renderbuffer from the given framebuffer.
+ */
+void
+_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName)
+{
+ struct gl_renderbuffer *rb;
+
+ assert(bufferName < BUFFER_COUNT);
+
+ rb = fb->Attachment[bufferName].Renderbuffer;
+ if (!rb)
+ return;
+
+ _mesa_dereference_renderbuffer(&rb);
+
+ fb->Attachment[bufferName].Renderbuffer = NULL;
+}
+
+
+/**
+ * Decrement the reference count on a renderbuffer and delete it when
+ * the refcount hits zero.
+ * Note: we pass the address of a pointer and set it to NULL if we delete it.
+ */
+void
+_mesa_dereference_renderbuffer(struct gl_renderbuffer **rb)
+{
+ GLboolean deleteFlag = GL_FALSE;
+
+ _glthread_LOCK_MUTEX((*rb)->Mutex);
+ {
+ ASSERT((*rb)->RefCount > 0);
+ (*rb)->RefCount--;
+ deleteFlag = ((*rb)->RefCount == 0);
+ }
+ _glthread_UNLOCK_MUTEX((*rb)->Mutex);
+
+ if (deleteFlag) {
+ (*rb)->Delete(*rb);
+ *rb = NULL;
+ }
+}
+
+
+
+
+/**
* Create a new combined depth/stencil renderbuffer for implementing
* the GL_EXT_packed_depth_stencil extension.
* \return new depth/stencil renderbuffer
diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h
index d8358e213cb..74ca43c57ab 100644
--- a/src/mesa/main/renderbuffer.h
+++ b/src/mesa/main/renderbuffer.h
@@ -95,6 +95,11 @@ extern void
_mesa_add_renderbuffer(struct gl_framebuffer *fb,
GLuint bufferName, struct gl_renderbuffer *rb);
+extern void
+_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName);
+
+extern void
+_mesa_dereference_renderbuffer(struct gl_renderbuffer **rb);
extern struct gl_renderbuffer *
_mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 7e452bdfd7f..dbf0834df45 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -820,7 +820,11 @@ update_arrays( GLcontext *ctx )
/* find min of _MaxElement values for all enabled arrays */
/* 0 */
- if (ctx->VertexProgram._Enabled
+ if (ctx->ShaderObjects._VertexShaderPresent
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
+ min = ctx->Array.VertexAttrib[VERT_ATTRIB_GENERIC0]._MaxElement;
+ }
+ else if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) {
min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement;
}
@@ -877,9 +881,13 @@ update_arrays( GLcontext *ctx )
/* 6 */
if (ctx->VertexProgram._Enabled
- && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) {
- min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement);
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement);
}
+ else if (ctx->Array.Index.Enabled) {
+ min = MIN2(min, ctx->Array.Index._MaxElement);
+ }
+
/* 7 */
if (ctx->VertexProgram._Enabled
@@ -888,7 +896,7 @@ update_arrays( GLcontext *ctx )
}
/* 8..15 */
- for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) {
+ for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) {
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[i].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement);
@@ -899,8 +907,13 @@ update_arrays( GLcontext *ctx )
}
}
- if (ctx->Array.Index.Enabled) {
- min = MIN2(min, ctx->Array.Index._MaxElement);
+ /* 16..31 */
+ if (ctx->ShaderObjects._VertexShaderPresent) {
+ for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
+ if (ctx->Array.VertexAttrib[i].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement);
+ }
+ }
}
if (ctx->Array.EdgeFlag.Enabled) {
@@ -933,11 +946,12 @@ update_program(GLcontext *ctx)
ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
if (ctx->_MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) {
+#if 0
if (!ctx->_TexEnvProgram)
ctx->_TexEnvProgram = (struct fragment_program *)
ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
-
ctx->FragmentProgram._Current = ctx->_TexEnvProgram;
+#endif
if (ctx->_UseTexEnvProgram)
ctx->FragmentProgram._Active = GL_TRUE;
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index d18b1d0b418..2516339e112 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * 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"),
@@ -38,16 +38,21 @@
#include "texformat.h"
#include "texstore.h"
+
/**
- * Get the list of supported internal compression formats.
+ * Return list of (and count of) all specific texture compression
+ * formats that are supported.
*
- * \param ctx GL context.
- * \param formats the resulting format list (may be NULL).
+ * \param ctx the GL context
+ * \param formats the resulting format list (may be NULL).
+ * \param all if true return all formats, even those with some kind
+ * of restrictions/limitations (See GL_ARB_texture_compression
+ * spec for more info).
*
* \return number of formats.
*/
GLuint
-_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats )
+_mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all)
{
GLuint n = 0;
if (ctx->Extensions.ARB_texture_compression) {
@@ -63,16 +68,20 @@ _mesa_get_compressed_formats( GLcontext *ctx, GLint *formats )
if (ctx->Extensions.EXT_texture_compression_s3tc) {
if (formats) {
formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- /* Skip this one because it has a restriction (all transparent
- * pixels become black). See the texture compressions spec for
- * a detailed explanation. This is what NVIDIA does.
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- */
+ /* This format has some restrictions/limitations and so should
+ * not be returned via the GL_COMPRESSED_TEXTURE_FORMATS query.
+ * Specifically, all transparent pixels become black. NVIDIA
+ * omits this format too.
+ */
+ if (all)
+ formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
}
else {
n += 3;
+ if (all)
+ n += 1;
}
}
if (ctx->Extensions.S3_s3tc) {
@@ -101,23 +110,23 @@ _mesa_get_compressed_formats( GLcontext *ctx, GLint *formats )
* \param width texture width in texels.
* \param height texture height in texels.
* \param depth texture depth in texels.
- * \param format - one of the specific compressed texture formats
+ * \param mesaFormat one of the MESA_FORMAT_* compressed formats
*
* \return size in bytes, or zero if bad format
*/
GLuint
_mesa_compressed_texture_size( GLcontext *ctx,
GLsizei width, GLsizei height, GLsizei depth,
- GLenum format )
+ GLuint mesaFormat )
{
GLuint size;
ASSERT(depth == 1);
(void) depth;
- switch (format) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ switch (mesaFormat) {
+ 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;
@@ -129,10 +138,8 @@ _mesa_compressed_texture_size( GLcontext *ctx,
if (size < 16)
size = 16;
return size;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
+ case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_RGBA_DXT1:
/* round up width, height to next multiple of 4 */
width = (width + 3) & ~3;
height = (height + 3) & ~3;
@@ -144,10 +151,8 @@ _mesa_compressed_texture_size( GLcontext *ctx,
if (size < 8)
size = 8;
return size;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
+ case MESA_FORMAT_RGBA_DXT3:
+ case MESA_FORMAT_RGBA_DXT5:
/* round up width, height to next multiple of 4 */
width = (width + 3) & ~3;
height = (height + 3) & ~3;
@@ -160,42 +165,86 @@ _mesa_compressed_texture_size( GLcontext *ctx,
size = 16;
return size;
default:
- _mesa_problem(ctx, "bad texformat in compressed_texture_size");
+ _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) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ mesaFormat = MESA_FORMAT_RGB_FXT1;
+ break;
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ mesaFormat = MESA_FORMAT_RGBA_FXT1;
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_RGB_S3TC:
+ mesaFormat = MESA_FORMAT_RGB_DXT1;
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_RGB4_S3TC:
+ mesaFormat = MESA_FORMAT_RGBA_DXT1;
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_RGBA_S3TC:
+ mesaFormat = MESA_FORMAT_RGBA_DXT3;
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_RGBA4_S3TC:
+ mesaFormat = MESA_FORMAT_RGBA_DXT5;
+ break;
+ 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 format one of the specific texture compression formats
+ * \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(GLenum format, GLsizei width)
+_mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width)
{
GLint stride;
- switch (format) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ switch (mesaFormat) {
+ case MESA_FORMAT_RGB_FXT1:
+ case MESA_FORMAT_RGBA_FXT1:
stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */
break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
+ case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_RGBA_DXT1:
stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */
break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
+ case MESA_FORMAT_RGBA_DXT3:
+ case MESA_FORMAT_RGBA_DXT5:
stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */
break;
default:
+ _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_row_stride");
return 0;
}
@@ -214,7 +263,7 @@ _mesa_compressed_row_stride(GLenum format, GLsizei width)
*/
GLubyte *
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
- GLenum format,
+ GLuint mesaFormat,
GLsizei width, const GLubyte *image)
{
GLubyte *addr;
@@ -229,25 +278,22 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
* offset = Z * (((width + X - 1) / X) * (row / Y) + col / X);
*/
- switch (format) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ switch (mesaFormat) {
+ case MESA_FORMAT_RGB_FXT1:
+ case MESA_FORMAT_RGBA_FXT1:
addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8);
break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
+ case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_RGBA_DXT1:
addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4);
break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
+ case MESA_FORMAT_RGBA_DXT3:
+ case MESA_FORMAT_RGBA_DXT5:
addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4);
break;
default:
- return NULL;
+ _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_image_address");
+ addr = NULL;
}
return addr;
diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h
index 50074145469..44f33382228 100644
--- a/src/mesa/main/texcompress.h
+++ b/src/mesa/main/texcompress.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * 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"),
@@ -28,21 +28,27 @@
#include "mtypes.h"
#if _HAVE_FULL_GL
+
extern GLuint
-_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats );
+_mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all);
extern GLuint
_mesa_compressed_texture_size( GLcontext *ctx,
GLsizei width, GLsizei height, GLsizei depth,
- GLenum format );
+ 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(GLenum format, GLsizei width);
+_mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width);
extern GLubyte *
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
- GLenum format,
+ GLuint mesaFormat,
GLsizei width, const GLubyte *image);
@@ -53,13 +59,16 @@ extern void
_mesa_init_texture_fxt1( GLcontext *ctx );
+#else /* _HAVE_FULL_GL */
-#else
+/* 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)
-#endif
+
+#endif /* _HAVE_FULL_GL */
#endif /* TEXCOMPRESS_H */
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index 44b450fd56e..18180e12eaf 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -64,7 +64,7 @@ _mesa_init_texture_fxt1( GLcontext *ctx )
* Called via TexFormat->StoreImage to store an RGB_FXT1 texture.
*/
static GLboolean
-texstore_rgb_fxt1(STORE_PARAMS)
+texstore_rgb_fxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@@ -76,7 +76,8 @@ texstore_rgb_fxt1(STORE_PARAMS)
ASSERT(dstXoffset % 8 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset == 0);
- (void) dstZoffset; (void) dstImageStride;
+ (void) dstZoffset;
+ (void) dstImageOffsets;
if (srcFormat != GL_RGB ||
srcType != CHAN_TYPE ||
@@ -120,7 +121,7 @@ texstore_rgb_fxt1(STORE_PARAMS)
* Called via TexFormat->StoreImage to store an RGBA_FXT1 texture.
*/
static GLboolean
-texstore_rgba_fxt1(STORE_PARAMS)
+texstore_rgba_fxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@@ -132,7 +133,8 @@ texstore_rgba_fxt1(STORE_PARAMS)
ASSERT(dstXoffset % 8 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset == 0);
- (void) dstZoffset; (void) dstImageStride;
+ (void) dstZoffset;
+ (void) dstImageOffsets;
if (srcFormat != GL_RGBA ||
srcType != CHAN_TYPE ||
@@ -243,6 +245,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
@@ -266,6 +269,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 881da83b0f5..656a3d329c1 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -88,7 +88,7 @@ _mesa_init_texture_s3tc( GLcontext *ctx )
dxtlibhandle = dlopen (DXTN_EXT, RTLD_LAZY | RTLD_GLOBAL);
if (!dxtlibhandle) {
_mesa_warning(ctx, "couldn't open " DXTN_EXT ", software DXTn "
- "compression/decompression unavailable\n");
+ "compression/decompression unavailable");
}
else {
/* the fetch functions are not per context! Might be problematic... */
@@ -109,7 +109,7 @@ _mesa_init_texture_s3tc( GLcontext *ctx )
if (ext_tx_compress_dxtn == NULL) {
_mesa_warning(ctx, "couldn't reference all symbols in "
DXTN_EXT ", software DXTn compression/decompression "
- "unavailable\n");
+ "unavailable");
fetch_ext_rgb_dxt1 = NULL;
fetch_ext_rgba_dxt1 = NULL;
fetch_ext_rgba_dxt3 = NULL;
@@ -122,7 +122,7 @@ _mesa_init_texture_s3tc( GLcontext *ctx )
}
if (dxtlibhandle) {
ctx->Mesa_DXTn = GL_TRUE;
- _mesa_warning(ctx, "software DXTn compression/decompression available\n");
+ _mesa_warning(ctx, "software DXTn compression/decompression available");
}
#else
(void) ctx;
@@ -133,7 +133,7 @@ _mesa_init_texture_s3tc( GLcontext *ctx )
* Called via TexFormat->StoreImage to store an RGB_DXT1 texture.
*/
static GLboolean
-texstore_rgb_dxt1(STORE_PARAMS)
+texstore_rgb_dxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@@ -145,7 +145,8 @@ texstore_rgb_dxt1(STORE_PARAMS)
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset; (void) dstImageStride;
+ (void) dstZoffset;
+ (void) dstImageOffsets;
if (srcFormat != GL_RGB ||
srcType != CHAN_TYPE ||
@@ -172,11 +173,13 @@ texstore_rgb_dxt1(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -193,7 +196,7 @@ texstore_rgb_dxt1(STORE_PARAMS)
* Called via TexFormat->StoreImage to store an RGBA_DXT1 texture.
*/
static GLboolean
-texstore_rgba_dxt1(STORE_PARAMS)
+texstore_rgba_dxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@@ -205,7 +208,8 @@ texstore_rgba_dxt1(STORE_PARAMS)
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset; (void) dstImageStride;
+ (void) dstZoffset;
+ (void) dstImageOffsets;
if (srcFormat != GL_RGBA ||
srcType != CHAN_TYPE ||
@@ -232,10 +236,12 @@ texstore_rgba_dxt1(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -252,7 +258,7 @@ texstore_rgba_dxt1(STORE_PARAMS)
* Called via TexFormat->StoreImage to store an RGBA_DXT3 texture.
*/
static GLboolean
-texstore_rgba_dxt3(STORE_PARAMS)
+texstore_rgba_dxt3(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@@ -264,7 +270,8 @@ texstore_rgba_dxt3(STORE_PARAMS)
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset; (void) dstImageStride;
+ (void) dstZoffset;
+ (void) dstImageOffsets;
if (srcFormat != GL_RGBA ||
srcType != CHAN_TYPE ||
@@ -290,10 +297,12 @@ texstore_rgba_dxt3(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -310,7 +319,7 @@ texstore_rgba_dxt3(STORE_PARAMS)
* Called via TexFormat->StoreImage to store an RGBA_DXT5 texture.
*/
static GLboolean
-texstore_rgba_dxt5(STORE_PARAMS)
+texstore_rgba_dxt5(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@@ -322,7 +331,8 @@ texstore_rgba_dxt5(STORE_PARAMS)
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
- (void) dstZoffset; (void) dstImageStride;
+ (void) dstZoffset;
+ (void) dstImageOffsets;
if (srcFormat != GL_RGBA ||
srcType != CHAN_TYPE ||
@@ -348,10 +358,12 @@ texstore_rgba_dxt5(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -368,12 +380,14 @@ static void
fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
- (void) k;
- if (fetch_ext_rgb_dxt1) {
- ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- (*fetch_ext_rgb_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ (void) k;
+ if (fetch_ext_rgb_dxt1) {
+ ASSERT (sizeof(GLchan) == sizeof(GLubyte));
+ fetch_ext_rgb_dxt1(texImage->RowStride,
+ (GLubyte *)(texImage)->Data, i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}
@@ -397,9 +411,11 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
{
(void) k;
if (fetch_ext_rgba_dxt1) {
- (*fetch_ext_rgba_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ fetch_ext_rgba_dxt1(texImage->RowStride,
+ (GLubyte *)(texImage)->Data, i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}
@@ -423,10 +439,12 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
{
(void) k;
if (fetch_ext_rgba_dxt3) {
- ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- (*fetch_ext_rgba_dxt3)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ ASSERT (sizeof(GLchan) == sizeof(GLubyte));
+ fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
+ i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}
@@ -450,9 +468,11 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
{
(void) k;
if (fetch_ext_rgba_dxt5) {
- (*fetch_ext_rgba_dxt5)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
+ i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}
@@ -491,6 +511,7 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
@@ -514,6 +535,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
@@ -537,6 +559,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
@@ -560,4 +583,5 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 02ff833dab4..5db2f6249c4 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -185,14 +185,14 @@ static GLuint translate_tex_src_bit( GLbitfield bit )
* Examine current texture environment state and generate a unique
* key to identify it.
*/
-static struct state_key *
-make_state_key(GLcontext *ctx)
+static void make_state_key( GLcontext *ctx, struct state_key *key )
{
- struct state_key *key = CALLOC_STRUCT(state_key);
GLuint i, j;
+ memset(key, 0, sizeof(*key));
+
for (i=0;i<MAX_TEXTURE_UNITS;i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
if (!texUnit->_ReallyEnabled)
continue;
@@ -212,7 +212,7 @@ make_state_key(GLcontext *ctx)
translate_mode(texUnit->_CurrentCombine->ModeA);
key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB;
- key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftRGB;
+ key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftA;
for (j=0;j<3;j++) {
key->unit[i].OptRGB[j].Operand =
@@ -233,8 +233,6 @@ make_state_key(GLcontext *ctx)
key->fog_enabled = 1;
key->fog_mode = translate_fog_mode(ctx->Fog.Mode);
}
-
- return key;
}
/* Use uregs to represent registers internally, translate to Mesa's
@@ -259,7 +257,7 @@ struct ureg {
GLuint pad:5;
};
-const static struct ureg undef = {
+static const struct ureg undef = {
~0,
~0,
0,
@@ -342,7 +340,7 @@ static GLboolean is_undef( struct ureg reg )
static struct ureg get_temp( struct texenv_fragment_program *p )
{
- int bit;
+ GLint bit;
/* First try and reuse temps which have been used already:
*/
@@ -358,7 +356,7 @@ static struct ureg get_temp( struct texenv_fragment_program *p )
_mesa_exit(1);
}
- if (bit > p->program->Base.NumTemporaries)
+ if ((GLuint) bit > p->program->Base.NumTemporaries)
p->program->Base.NumTemporaries = bit;
p->temp_in_use |= 1<<(bit-1);
@@ -386,7 +384,7 @@ static struct ureg get_tex_temp( struct texenv_fragment_program *p )
_mesa_exit(1);
}
- if (bit > p->program->Base.NumTemporaries)
+ if ((GLuint) bit > p->program->Base.NumTemporaries)
p->program->Base.NumTemporaries = bit;
p->temp_in_use |= 1<<(bit-1);
@@ -729,7 +727,7 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
GLuint unit,
GLuint nr,
GLuint mode,
- struct mode_opt *opt)
+ const struct mode_opt *opt)
{
struct ureg src[3];
struct ureg tmp, half;
@@ -1023,6 +1021,10 @@ create_new_program(struct state_key *key, GLcontext *ctx,
p.src_texture[unit] = undef;
p.src_previous = undef;
+ p.half = undef;
+ p.zero = undef;
+ p.one = undef;
+
p.last_tex_stage = 0;
release_temps(&p);
@@ -1101,60 +1103,119 @@ create_new_program(struct state_key *key, GLcontext *ctx,
}
-static void *search_cache( struct texenvprog_cache *cache,
- GLuint hash,
- const void *key,
- GLuint keysize)
+static struct fragment_program *
+search_cache(const struct texenvprog_cache *cache,
+ GLuint hash,
+ const const void *key,
+ GLuint keysize)
{
- struct texenvprog_cache *c;
+ struct texenvprog_cache_item *c;
- for (c = cache; c; c = c->next) {
- if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0)
- return c->data;
+ for (c = cache->items[hash % cache->size]; c; c = c->next) {
+ if (c->hash == hash && memcmp(c->key, key, keysize) == 0)
+ return (struct fragment_program *) c->data;
}
return NULL;
}
-static void cache_item( struct texenvprog_cache **cache,
+static void rehash( struct texenvprog_cache *cache )
+{
+ struct texenvprog_cache_item **items;
+ struct texenvprog_cache_item *c, *next;
+ GLuint size, i;
+
+ size = cache->size * 3;
+ items = (struct texenvprog_cache_item**) _mesa_malloc(size * sizeof(*items));
+ _mesa_memset(items, 0, size * sizeof(*items));
+
+ for (i = 0; i < cache->size; i++)
+ for (c = cache->items[i]; c; c = next) {
+ next = c->next;
+ c->next = items[c->hash % size];
+ items[c->hash % size] = c;
+ }
+
+ _mesa_free(cache->items);
+ cache->items = items;
+ cache->size = size;
+}
+
+static void clear_cache( struct texenvprog_cache *cache )
+{
+ struct texenvprog_cache_item *c, *next;
+ GLuint i;
+
+ for (i = 0; i < cache->size; i++) {
+ for (c = cache->items[i]; c; c = next) {
+ next = c->next;
+ _mesa_free(c->key);
+ cache->ctx->Driver.DeleteProgram(cache->ctx, (struct program *)c->data);
+ _mesa_free(c);
+ }
+ cache->items[i] = NULL;
+ }
+
+
+ cache->n_items = 0;
+}
+
+
+static void cache_item( struct texenvprog_cache *cache,
GLuint hash,
- void *key,
+ const struct state_key *key,
void *data )
{
- struct texenvprog_cache *c = CALLOC_STRUCT(texenvprog_cache);
+ struct texenvprog_cache_item *c = MALLOC(sizeof(*c));
c->hash = hash;
- c->key = key;
+
+ c->key = _mesa_malloc(sizeof(*key));
+ memcpy(c->key, key, sizeof(*key));
+
c->data = data;
- c->next = *cache;
- *cache = c;
+
+ if (cache->n_items > cache->size * 1.5) {
+ if (cache->size < 1000)
+ rehash(cache);
+ else
+ clear_cache(cache);
+ }
+
+ cache->n_items++;
+ c->next = cache->items[hash % cache->size];
+ cache->items[hash % cache->size] = c;
}
-static GLuint hash_key( struct state_key *key )
+static GLuint hash_key( const struct state_key *key )
{
GLuint *ikey = (GLuint *)key;
GLuint hash = 0, i;
- /* I'm sure this can be improved on, but speed is important:
+ /* Make a slightly better attempt at a hash function:
*/
- for (i = 0; i < sizeof(*key)/sizeof(GLuint); i++)
- hash ^= ikey[i];
+ for (i = 0; i < sizeof(*key)/sizeof(*ikey); i++)
+ {
+ hash += ikey[i];
+ hash += (hash << 10);
+ hash ^= (hash >> 6);
+ }
return hash;
}
void _mesa_UpdateTexEnvProgram( GLcontext *ctx )
{
- struct state_key *key;
+ struct state_key key;
GLuint hash;
- struct fragment_program *prev = ctx->FragmentProgram._Current;
+ const struct fragment_program *prev = ctx->FragmentProgram._Current;
if (!ctx->FragmentProgram._Enabled) {
- key = make_state_key(ctx);
- hash = hash_key(key);
+ make_state_key(ctx, &key);
+ hash = hash_key(&key);
- ctx->FragmentProgram._Current = ctx->_TexEnvProgram =
- (struct fragment_program *)
- search_cache(ctx->Texture.env_fp_cache, hash, key, sizeof(*key));
+ ctx->FragmentProgram._Current =
+ ctx->_TexEnvProgram =
+ search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key));
if (!ctx->_TexEnvProgram) {
if (0) _mesa_printf("Building new texenv proggy for key %x\n", hash);
@@ -1163,11 +1224,10 @@ void _mesa_UpdateTexEnvProgram( GLcontext *ctx )
(struct fragment_program *)
ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
- create_new_program(key, ctx, ctx->_TexEnvProgram);
+ create_new_program(&key, ctx, ctx->_TexEnvProgram);
- cache_item(&ctx->Texture.env_fp_cache, hash, key, ctx->_TexEnvProgram);
+ cache_item(&ctx->Texture.env_fp_cache, hash, &key, ctx->_TexEnvProgram);
} else {
- _mesa_free(key);
if (0) _mesa_printf("Found existing texenv program for key %x\n", hash);
}
}
@@ -1184,14 +1244,20 @@ void _mesa_UpdateTexEnvProgram( GLcontext *ctx )
}
}
-void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx )
+
+void _mesa_TexEnvProgramCacheInit( GLcontext *ctx )
{
- struct texenvprog_cache *a, *tmp;
+ ctx->Texture.env_fp_cache.ctx = ctx;
+ ctx->Texture.env_fp_cache.size = 17;
+ ctx->Texture.env_fp_cache.n_items = 0;
+ ctx->Texture.env_fp_cache.items = (struct texenvprog_cache_item **)
+ _mesa_calloc(ctx->Texture.env_fp_cache.size *
+ sizeof(struct texenvprog_cache_item));
+}
- for (a = ctx->Texture.env_fp_cache; a; a = tmp) {
- tmp = a->next;
- _mesa_free(a->key);
- ctx->Driver.DeleteProgram(ctx, (struct program *) a->data);
- _mesa_free(a);
- }
+
+void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx )
+{
+ clear_cache(&ctx->Texture.env_fp_cache);
+ _mesa_free(ctx->Texture.env_fp_cache.items);
}
diff --git a/src/mesa/main/texenvprogram.h b/src/mesa/main/texenvprogram.h
index 30c8cca3889..6f017767c82 100644
--- a/src/mesa/main/texenvprogram.h
+++ b/src/mesa/main/texenvprogram.h
@@ -35,6 +35,7 @@
#include "mtypes.h"
extern void _mesa_UpdateTexEnvProgram( GLcontext *ctx );
+extern void _mesa_TexEnvProgramCacheInit( GLcontext *ctx );
extern void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx );
#endif
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 5ef9e46df22..792bfbc1e45 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * 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"),
@@ -79,6 +79,11 @@ static void fetch_null_texelf( const struct gl_texture_image *texImage,
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 */
}
@@ -245,53 +250,6 @@ const struct gl_texture_format _mesa_texformat_intensity = {
store_texel_intensity /* StoreTexel */
};
-const struct gl_texture_format _mesa_texformat_depth_component_float32 = {
- MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, /* 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(GLfloat) * 8, /* DepthBits */
- sizeof(GLfloat) * 8, /* StencilBits */
- sizeof(GLfloat), /* TexelBytes */
- _mesa_texstore_depth_component_float32,/* StoreTexImageFunc */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */
- fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */
- fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */
- store_texel_depth_component_f32 /* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_depth_component16 = {
- MESA_FORMAT_DEPTH_COMPONENT16, /* 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 */
- sizeof(GLushort) * 8, /* StencilBits */
- sizeof(GLushort), /* TexelBytes */
- _mesa_texstore_depth_component16, /* StoreTexImageFunc */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */
- fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */
- fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */
- store_texel_depth_component16 /* StoreTexel */
-};
const struct gl_texture_format _mesa_texformat_rgba_float32 = {
MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */
@@ -1117,6 +1075,54 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = {
store_texel_z24_s8 /* 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 */
+};
+
/*@}*/
@@ -1264,9 +1270,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24_SGIX:
case GL_DEPTH_COMPONENT32_SGIX:
- return &_mesa_texformat_depth_component_float32;
+ return &_mesa_texformat_z32;
case GL_DEPTH_COMPONENT16_SGIX:
- return &_mesa_texformat_depth_component16;
+ return &_mesa_texformat_z16;
default:
; /* fallthrough */
}
diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h
index 63f524bbe13..b7e5fc27dcb 100644
--- a/src/mesa/main/texformat.h
+++ b/src/mesa/main/texformat.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * 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"),
@@ -84,6 +84,8 @@ enum _format {
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_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
+ MESA_FORMAT_Z32, /*ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
/*@}*/
/**
@@ -118,14 +120,6 @@ enum _format {
/*@}*/
/**
- * Depth textures
- */
- /*@{*/
- MESA_FORMAT_DEPTH_COMPONENT_FLOAT32,
- MESA_FORMAT_DEPTH_COMPONENT16,
- /*@}*/
-
- /**
* \name Floating point texture formats.
*/
/*@{*/
@@ -155,12 +149,6 @@ extern const struct gl_texture_format _mesa_texformat_luminance_alpha;
extern const struct gl_texture_format _mesa_texformat_intensity;
/*@}*/
-/** Depth textures */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_depth_component_float32;
-extern const struct gl_texture_format _mesa_texformat_depth_component16;
-/*@}*/
-
/** Floating point texture formats */
/*@{*/
extern const struct gl_texture_format _mesa_texformat_rgba_float32;
@@ -199,6 +187,8 @@ 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_z16;
+extern const struct gl_texture_format _mesa_texformat_z32;
/*@}*/
/** \name YCbCr formats */
diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h
index cc6ed1cc936..186fe23514c 100644
--- a/src/mesa/main/texformat_tmp.h
+++ b/src/mesa/main/texformat_tmp.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -59,8 +59,8 @@
#elif DIM == 3
#define TEXEL_ADDR( type, image, i, j, k, size ) \
- ((type *)(image)->Data + (((image)->Height * (k) + (j)) * \
- (image)->RowStride + (i)) * (size))
+ ((type *)(image)->Data + ((image)->ImageOffsets[k] \
+ + (image)->RowStride * (j) + (i)) * (size))
#define FETCH(x) fetch_texel_3d_##x
@@ -234,46 +234,46 @@ static void store_texel_intensity(struct gl_texture_image *texImage,
#endif
-/* MESA_FORMAT_DEPTH_COMPONENT_F32 *******************************************/
+/* MESA_FORMAT_Z32 ***********************************************************/
-/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
+/* 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_depth_component_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void FETCH(f_z32)( 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[0] = src[0];
+ 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_depth_component_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
+static void store_texel_z32(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);
+ const GLuint *depth = (const GLuint *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
dst[0] = *depth;
}
#endif
-/* MESA_FORMAT_DEPTH_COMPONENT16 *********************************************/
+/* MESA_FORMAT_Z16 ***********************************************************/
-/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
+/* 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_depth_component16)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+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_depth_component16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
+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);
@@ -1211,6 +1211,11 @@ static void FETCH(ycbcr)( const struct gl_texture_image *texImage,
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
@@ -1253,6 +1258,11 @@ static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
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
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ff1d51d7d09..02d2aa362cb 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -533,22 +533,17 @@ is_depthstencil_format(GLenum format)
static GLboolean
is_compressed_format(GLcontext *ctx, GLenum internalFormat)
{
- (void) ctx;
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
+ GLint supported[100]; /* 100 should be plenty */
+ GLuint i, n;
+
+ n = _mesa_get_compressed_formats(ctx, supported, GL_TRUE);
+ ASSERT(n < 100);
+ for (i = 0; i < n; i++) {
+ if ((GLint) internalFormat == supported[i]) {
return GL_TRUE;
- default:
- return GL_FALSE;
+ }
}
+ return GL_FALSE;
}
@@ -642,6 +637,8 @@ void
_mesa_free_texture_image_data(GLcontext *ctx,
struct gl_texture_image *texImage)
{
+ (void) ctx;
+
if (texImage->Data && !texImage->IsClientData) {
/* free the old texture data */
_mesa_free_texmemory(texImage->Data);
@@ -665,7 +662,9 @@ _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage )
ctx->Driver.FreeTexImageData( ctx, texImage );
}
ASSERT(texImage->Data == NULL);
- FREE( texImage );
+ if (texImage->ImageOffsets)
+ _mesa_free(texImage->ImageOffsets);
+ _mesa_free(texImage);
}
@@ -1053,7 +1052,10 @@ clear_teximage_fields(struct gl_texture_image *img)
img->Height = 0;
img->Depth = 0;
img->RowStride = 0;
- img->ImageStride = 0;
+ if (img->ImageOffsets) {
+ _mesa_free(img->ImageOffsets);
+ img->ImageOffsets = NULL;
+ }
img->Width2 = 0;
img->Height2 = 0;
img->Depth2 = 0;
@@ -1073,7 +1075,7 @@ clear_teximage_fields(struct gl_texture_image *img)
* Initialize basic fields of the gl_texture_image struct.
*
* \param ctx GL context.
- * \param target texture target.
+ * \param target texture target (GL_TEXTURE_1D, GL_TEXTURE_RECTANGLE, etc).
* \param img texture image structure to be initialized.
* \param width image width.
* \param height image height.
@@ -1090,7 +1092,13 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat)
{
+ GLint i;
+
ASSERT(img);
+ ASSERT(width > 0);
+ ASSERT(height > 0);
+ ASSERT(depth > 0);
+
img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
ASSERT(img->_BaseFormat > 0);
img->InternalFormat = internalFormat;
@@ -1098,8 +1106,6 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
img->Width = width;
img->Height = height;
img->Depth = depth;
- img->RowStride = width;
- img->ImageStride = width * height;
img->Width2 = width - 2 * border; /* == 1 << img->WidthLog2; */
img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */
@@ -1113,12 +1119,8 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
else
img->DepthLog2 = logbase2(img->Depth2);
img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
- img->IsCompressed = is_compressed_format(ctx, internalFormat);
- if (img->IsCompressed)
- img->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, width,
- height, depth, internalFormat);
- else
- img->CompressedSize = 0;
+ img->IsCompressed = GL_FALSE;
+ img->CompressedSize = 0;
if ((width == 1 || _mesa_bitcount(img->Width2) == 1) &&
(height == 1 || _mesa_bitcount(img->Height2) == 1) &&
@@ -1127,6 +1129,17 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
else
img->_IsPowerOfTwo = GL_FALSE;
+ /* RowStride and ImageOffsets[] describe how to address texels in 'Data' */
+ img->RowStride = width;
+ /* Allocate the ImageOffsets array and initialize to typical values.
+ * We allocate the array for 1D/2D textures too in order to avoid special-
+ * case code in the texstore routines.
+ */
+ img->ImageOffsets = (GLuint *) _mesa_malloc(depth * sizeof(GLuint));
+ for (i = 0; i < depth; i++) {
+ img->ImageOffsets[i] = i * width * height;
+ }
+
/* Compute Width/Height/DepthScale for mipmap lod computation */
if (target == GL_TEXTURE_RECTANGLE_NV) {
/* scale = 1.0 since texture coords directly map to texels */
@@ -2879,9 +2892,11 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
maxTextureSize = 1 << (maxLevels - 1);
+ /* This will detect any invalid internalFormat value */
if (!is_compressed_format(ctx, internalFormat))
return GL_INVALID_ENUM;
+ /* This should really never fail */
if (_mesa_base_tex_format(ctx, internalFormat) < 0)
return GL_INVALID_ENUM;
@@ -2913,8 +2928,8 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
if (level < 0 || level >= maxLevels)
return GL_INVALID_VALUE;
- expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth,
- internalFormat);
+ expectedSize = _mesa_compressed_texture_size_glenum(ctx, width, height,
+ depth, internalFormat);
if (expectedSize != imageSize)
return GL_INVALID_VALUE;
@@ -2972,6 +2987,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
maxTextureSize = 1 << (maxLevels - 1);
+ /* this will catch any invalid compressed format token */
if (!is_compressed_format(ctx, format))
return GL_INVALID_ENUM;
@@ -2997,8 +3013,8 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
if ((height & 3) != 0 && height != 2 && height != 1)
return GL_INVALID_VALUE;
- expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth,
- format);
+ expectedSize = _mesa_compressed_texture_size_glenum(ctx, width, height,
+ depth, format);
if (expectedSize != imageSize)
return GL_INVALID_VALUE;
@@ -3266,7 +3282,9 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
error = compressed_subtexture_error_check(ctx, 1, target, level,
- xoffset, 0, 0, width, 1, 1, format, imageSize);
+ xoffset, 0, 0, /* pos */
+ width, 1, 1, /* size */
+ format, imageSize);
if (error) {
_mesa_error(ctx, error, "glCompressedTexSubImage1D");
return;
@@ -3315,7 +3333,9 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
error = compressed_subtexture_error_check(ctx, 2, target, level,
- xoffset, yoffset, 0, width, height, 1, format, imageSize);
+ xoffset, yoffset, 0, /* pos */
+ width, height, 1, /* size */
+ format, imageSize);
if (error) {
/* XXX proxy target? */
_mesa_error(ctx, error, "glCompressedTexSubImage2D");
@@ -3366,7 +3386,9 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
error = compressed_subtexture_error_check(ctx, 3, target, level,
- xoffset, yoffset, zoffset, width, height, depth, format, imageSize);
+ xoffset, yoffset, zoffset,/*pos*/
+ width, height, depth, /*size*/
+ format, imageSize);
if (error) {
_mesa_error(ctx, error, "glCompressedTexSubImage2D");
return;
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index db720cef6e0..32e7b575f00 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -1,6 +1,7 @@
#include "context.h"
#include "fbobject.h"
+#include "texformat.h"
#include "texrender.h"
#include "renderbuffer.h"
@@ -43,6 +44,23 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i);
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ GLuint *zValues = (GLuint *) values;
+ /*
+ const GLdouble scale = (GLdouble) 0xffffffff;
+ */
+ for (i = 0; i < count; i++) {
+ GLfloat flt;
+ trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+#if 0
+ /* this should work, but doesn't (overflow due to low precision) */
+ zValues[i] = (GLuint) (flt * scale);
+#else
+ /* temporary hack */
+ zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
+#endif
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
@@ -73,6 +91,18 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgbaOut + 4 * i);
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ GLuint *zValues = (GLuint *) values;
+ for (i = 0; i < count; i++) {
+ GLfloat flt;
+ trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i], z, &flt);
+#if 0
+ zValues[i] = (GLuint) (flt * 0xffffffff);
+#else
+ zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
+#endif
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
@@ -108,6 +138,14 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgba += 4;
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint *zValues = (const GLuint *) values;
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x + i, y, z, zValues + i);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
@@ -140,6 +178,14 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint zValue = *((const GLuint *) value);
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x + i, y, z, &zValue);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint zValue = *((const GLuint *) value);
const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff);
@@ -174,6 +220,14 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgba += 4;
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint *zValues = (const GLuint *) values;
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x[i], y[i], z, zValues + i);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
@@ -207,6 +261,14 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
}
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint zValue = *((const GLuint *) value);
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x[i], y[i], z, &zValue);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint zValue = *((const GLuint *) value);
const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff);
@@ -279,6 +341,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
struct texture_renderbuffer *trb
= (struct texture_renderbuffer *) att->Renderbuffer;
+ (void) ctx;
ASSERT(trb);
trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
@@ -293,13 +356,17 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
trb->Base.Height = trb->TexImage->Height;
trb->Base.InternalFormat = trb->TexImage->InternalFormat;
/* XXX may need more special cases here */
- if (trb->TexImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
+ if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8) {
trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
}
- else if (trb->TexImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) {
+ else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z16) {
trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
- trb->Base.DataType = GL_FLOAT;
+ trb->Base.DataType = GL_UNSIGNED_SHORT;
+ }
+ else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z32) {
+ trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
+ trb->Base.DataType = GL_UNSIGNED_INT;
}
else {
trb->Base._ActualFormat = trb->TexImage->InternalFormat;
@@ -345,6 +412,8 @@ _mesa_render_texture(GLcontext *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
+ (void) fb;
+
if (!att->Renderbuffer) {
wrap_texture(ctx, att);
}
@@ -360,4 +429,6 @@ _mesa_finish_render_texture(GLcontext *ctx,
/* The renderbuffer texture wrapper will get deleted by the
* normal mechanism for deleting renderbuffers.
*/
+ (void) ctx;
+ (void) att;
}
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index daf579a7bfc..ea3873c3804 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -34,6 +34,7 @@
#include "context.h"
#include "enums.h"
#include "macros.h"
+#include "texcompress.h"
#include "texobj.h"
#include "teximage.h"
#include "texstate.h"
@@ -312,10 +313,20 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
void GLAPIENTRY
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
{
+ GLuint maxUnit;
GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ struct gl_texture_unit *texUnit;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
#define TE_ERROR(errCode, msg, value) \
_mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
@@ -795,10 +806,20 @@ _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
void GLAPIENTRY
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
{
+ GLuint maxUnit;
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
if (target == GL_TEXTURE_ENV) {
switch (pname) {
case GL_TEXTURE_ENV_MODE:
@@ -1006,10 +1027,20 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
void GLAPIENTRY
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
{
+ GLuint maxUnit;
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
if (target == GL_TEXTURE_ENV) {
switch (pname) {
case GL_TEXTURE_ENV_MODE:
@@ -1264,10 +1295,10 @@ _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
void GLAPIENTRY
_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- GLenum eparam = (GLenum) (GLint) params[0];
+ const GLenum eparam = (GLenum) (GLint) params[0];
+ struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
@@ -1277,6 +1308,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
*params,
_mesa_lookup_enum_by_nr(eparam));
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameterfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
switch (target) {
case GL_TEXTURE_1D:
@@ -1662,14 +1699,22 @@ void GLAPIENTRY
_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
GLenum pname, GLint *params )
{
- GET_CURRENT_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ const struct gl_texture_unit *texUnit;
const struct gl_texture_image *img = NULL;
GLuint dimensions;
GLboolean isProxy;
GLint maxLevels;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexLevelParameteriv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
/* this will catch bad target values */
dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */
if (dimensions == 0) {
@@ -1787,11 +1832,18 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
/* GL_ARB_texture_compression */
case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
if (ctx->Extensions.ARB_texture_compression) {
- if (img->IsCompressed && !isProxy)
- *params = img->CompressedSize;
- else
+ 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);
+ }
+ else {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetTexLevelParameter[if]v(pname)");
+ }
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -1884,11 +1936,19 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
void GLAPIENTRY
_mesa_GetTexParameterfv( 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;
struct gl_texture_object *obj;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexParameterfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)");
@@ -2008,11 +2068,19 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
void GLAPIENTRY
_mesa_GetTexParameteriv( 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;
struct gl_texture_object *obj;
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexParameteriv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)");
@@ -2146,8 +2214,7 @@ void GLAPIENTRY
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
+ struct gl_texture_unit *texUnit;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
@@ -2157,6 +2224,13 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
*params,
_mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2428,11 +2502,17 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
void GLAPIENTRY
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
{
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2505,11 +2585,17 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
void GLAPIENTRY
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
{
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2582,11 +2668,17 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
void GLAPIENTRY
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
{
+ const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- GLuint tUnit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
switch (coord) {
case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) {
@@ -2679,21 +2771,22 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
}
#endif
+
/* GL_ARB_multitexture */
void GLAPIENTRY
-_mesa_ActiveTextureARB( GLenum target )
+_mesa_ActiveTextureARB(GLenum texture)
{
GET_CURRENT_CONTEXT(ctx);
- const GLuint texUnit = target - GL_TEXTURE0;
+ const GLuint texUnit = texture - GL_TEXTURE0;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glActiveTexture %s\n",
- _mesa_lookup_enum_by_nr(target));
+ _mesa_lookup_enum_by_nr(texture));
- /* Cater for texture unit 0 is first, therefore use >= */
+ /* XXX error-check against max(coordunits, imageunits) */
if (texUnit >= ctx->Const.MaxTextureUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(target)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture)");
return;
}
@@ -2716,14 +2809,14 @@ _mesa_ActiveTextureARB( GLenum target )
/* GL_ARB_multitexture */
void GLAPIENTRY
-_mesa_ClientActiveTextureARB( GLenum target )
+_mesa_ClientActiveTextureARB(GLenum texture)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit = target - GL_TEXTURE0;
+ GLuint texUnit = texture - GL_TEXTURE0;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (texUnit >= ctx->Const.MaxTextureUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(target)");
+ if (texUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)");
return;
}
@@ -3105,6 +3198,8 @@ _mesa_init_texture(GLcontext *ctx)
ctx->Texture.SharedPalette = GL_FALSE;
_mesa_init_colortable(&ctx->Texture.Palette);
+ _mesa_TexEnvProgramCacheInit( ctx );
+
/* Allocate proxy textures */
if (!alloc_proxy_textures( ctx ))
return GL_FALSE;
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 717551d716c..28f6a191fdb 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -560,7 +560,7 @@ swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src,
GLuint srcComponents, const GLubyte *map, GLuint count)
{
GLubyte tmp[8];
- GLint i;
+ GLuint i;
tmp[ZERO] = 0x0;
tmp[ONE] = 0xff;
@@ -611,7 +611,8 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
GLvoid *dstAddr,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
+ GLint dstRowStride,
+ const GLuint *dstImageOffsets,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
const GLvoid *srcAddr,
@@ -632,10 +633,7 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
srcWidth, srcHeight, srcFormat,
GL_UNSIGNED_BYTE, 0, 0, 0);
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstComponents;
+ (void) ctx;
compute_component_mapping(srcFormat, GL_RGBA, srcmap);
@@ -643,23 +641,28 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
map[i] = srcmap[dstmap[i]];
if (srcRowStride == srcWidth * srcComponents &&
- (srcImageStride == srcWidth * srcHeight * srcComponents ||
- srcDepth == 1)) {
+ dimensions < 3) {
+ /* 1 and 2D images only */
+ GLubyte *dstImage = (GLubyte *) dstAddr
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstComponents;
swizzle_copy(dstImage, dstComponents, srcImage, srcComponents, map,
- srcWidth * srcHeight * srcDepth);
+ srcWidth * srcHeight);
}
else {
GLint img, row;
for (img = 0; img < srcDepth; img++) {
const GLubyte *srcRow = srcImage;
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstComponents
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstComponents;
for (row = 0; row < srcHeight; row++) {
swizzle_copy(dstRow, dstComponents, srcRow, srcComponents, map, srcWidth);
dstRow += dstRowStride;
srcRow += srcRowStride;
}
srcImage += srcImageStride;
- dstImage += dstImageStride;
}
}
}
@@ -676,7 +679,8 @@ memcpy_texture(GLcontext *ctx,
const struct gl_texture_format *dstFormat,
GLvoid *dstAddr,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
+ GLint dstRowStride,
+ const GLuint *dstImageOffsets,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLenum srcFormat, GLenum srcType,
const GLvoid *srcAddr,
@@ -689,6 +693,9 @@ memcpy_texture(GLcontext *ctx,
const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions,
srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0);
const GLint bytesPerRow = srcWidth * dstFormat->TexelBytes;
+
+#if 0
+ /* XXX update/re-enable for dstImageOffsets array */
const GLint bytesPerImage = srcHeight * bytesPerRow;
const GLint bytesPerTexture = srcDepth * bytesPerImage;
GLubyte *dstImage = (GLubyte *) dstAddr
@@ -704,7 +711,8 @@ memcpy_texture(GLcontext *ctx,
/* one big memcpy */
ctx->Driver.TextureMemCpy(dstImage, srcImage, bytesPerTexture);
}
- else {
+ else
+ {
GLint img, row;
for (img = 0; img < srcDepth; img++) {
const GLubyte *srcRow = srcImage;
@@ -718,6 +726,22 @@ memcpy_texture(GLcontext *ctx,
dstImage += dstImageStride;
}
}
+#endif
+
+ GLint img, row;
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *srcRow = srcImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+ for (row = 0; row < srcHeight; row++) {
+ ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow);
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ srcImage += srcImageStride;
+ }
}
@@ -731,30 +755,9 @@ memcpy_texture(GLcontext *ctx,
* _mesa_texformat_luminance_alpha
* _mesa_texformat_intensity
*
- * \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 dstImageStride destination image layer stride, in bytes
- * \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
*/
GLboolean
-_mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking)
+_mesa_texstore_rgba(TEXSTORE_PARAMS)
{
const GLint components = _mesa_components_in_format(baseInternalFormat);
@@ -779,7 +782,8 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -789,12 +793,14 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
srcFormat == GL_RGBA &&
srcType == CHAN_TYPE) {
/* extract RGB from RGBA */
- int img, row, col;
- GLchan *dstImage = (GLchan *) (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
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,
@@ -806,10 +812,9 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP];
dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP];
}
- dstRow += dstRowStride;
+ dstRow += dstRowStride / sizeof(GLchan);
srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride);
}
- dstImage += dstImageStride;
}
}
else {
@@ -822,23 +827,21 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
srcPacking);
const GLchan *src = tempImage;
GLint bytesPerRow;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
_mesa_memcpy(dstRow, src, bytesPerRow);
dstRow += dstRowStride;
src += srcWidth * components;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
@@ -848,59 +851,61 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
/**
- * Store a floating point depth component texture image.
+ * Store a 32-bit integer depth component texture image.
*/
GLboolean
-_mesa_texstore_depth_component_float32(STORE_PARAMS)
+_mesa_texstore_z32(TEXSTORE_PARAMS)
{
+ const GLfloat depthScale = (GLfloat) 0xffffffff;
(void) dims;
- ASSERT(dstFormat == &_mesa_texformat_depth_component_float32);
- ASSERT(dstFormat->TexelBytes == sizeof(GLfloat));
+ ASSERT(dstFormat == &_mesa_texformat_z32);
+ ASSERT(dstFormat->TexelBytes == sizeof(GLuint));
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
baseInternalFormat == GL_DEPTH_COMPONENT &&
srcFormat == GL_DEPTH_COMPONENT &&
- srcType == GL_FLOAT) {
+ srcType == GL_UNSIGNED_INT) {
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
else {
/* general path */
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
const GLvoid *src = _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
_mesa_unpack_depth_span(ctx, srcWidth,
- GL_FLOAT, (GLfloat *) dstRow, 1.0F,
- srcType, src, srcPacking);
+ GL_UNSIGNED_INT, (GLuint *) dstRow,
+ depthScale, srcType, src, srcPacking);
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
}
return GL_TRUE;
}
+#define STRIDE_3D 0
/**
* Store a 16-bit integer depth component texture image.
*/
GLboolean
-_mesa_texstore_depth_component16(STORE_PARAMS)
+_mesa_texstore_z16(TEXSTORE_PARAMS)
{
+ const GLfloat depthScale = 65535.0f;
(void) dims;
- ASSERT(dstFormat == &_mesa_texformat_depth_component16);
+ ASSERT(dstFormat == &_mesa_texformat_z16);
ASSERT(dstFormat->TexelBytes == sizeof(GLushort));
if (!ctx->_ImageTransferState &&
@@ -911,29 +916,28 @@ _mesa_texstore_depth_component16(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
else {
/* general path */
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
const GLvoid *src = _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
GLushort *dst16 = (GLushort *) dstRow;
_mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_SHORT, dst16, 65535.0F,
+ GL_UNSIGNED_SHORT, dst16, depthScale,
srcType, src, srcPacking);
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
}
return GL_TRUE;
@@ -944,7 +948,7 @@ _mesa_texstore_depth_component16(STORE_PARAMS)
* Store an rgb565 or rgb565_rev texture image.
*/
GLboolean
-_mesa_texstore_rgb565(STORE_PARAMS)
+_mesa_texstore_rgb565(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_rgb565 ||
dstFormat == &_mesa_texformat_rgb565_rev);
@@ -959,7 +963,8 @@ _mesa_texstore_rgb565(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -976,7 +981,6 @@ _mesa_texstore_rgb565(STORE_PARAMS)
_mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight,
srcFormat, srcType, 0, 0, 0);
GLubyte *dst = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
+ dstYoffset * dstRowStride
+ dstXoffset * dstFormat->TexelBytes;
GLint row, col;
@@ -1009,16 +1013,15 @@ _mesa_texstore_rgb565(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
/* check for byteswapped format */
@@ -1040,7 +1043,6 @@ _mesa_texstore_rgb565(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1049,7 +1051,7 @@ _mesa_texstore_rgb565(STORE_PARAMS)
GLboolean
-_mesa_texstore_rgba8888(STORE_PARAMS)
+_mesa_texstore_rgba8888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
@@ -1068,11 +1070,13 @@ _mesa_texstore_rgba8888(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
#if 0
+ /* broken? */
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
srcType == GL_UNSIGNED_BYTE &&
@@ -1114,16 +1118,15 @@ _mesa_texstore_rgba8888(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
if (dstFormat == &_mesa_texformat_rgba8888) {
@@ -1146,7 +1149,6 @@ _mesa_texstore_rgba8888(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1155,7 +1157,7 @@ _mesa_texstore_rgba8888(STORE_PARAMS)
GLboolean
-_mesa_texstore_argb8888(STORE_PARAMS)
+_mesa_texstore_argb8888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
@@ -1174,7 +1176,8 @@ _mesa_texstore_argb8888(STORE_PARAMS)
/* simple memcpy path (little endian) */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1188,7 +1191,8 @@ _mesa_texstore_argb8888(STORE_PARAMS)
/* simple memcpy path (big endian) */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1199,16 +1203,15 @@ _mesa_texstore_argb8888(STORE_PARAMS)
srcType == GL_UNSIGNED_BYTE) {
int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
for (img = 0; img < srcDepth; img++) {
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 4 + 0] = srcRow[col * 3 + BCOMP];
@@ -1219,7 +1222,6 @@ _mesa_texstore_argb8888(STORE_PARAMS)
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else if (!ctx->_ImageTransferState &&
@@ -1227,13 +1229,7 @@ _mesa_texstore_argb8888(STORE_PARAMS)
dstFormat == &_mesa_texformat_argb8888 &&
srcFormat == GL_RGBA &&
(srcType == GL_UNSIGNED_BYTE && littleEndian)) {
-
- int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
-
+ GLint img, row, col;
/* For some reason, streaming copies to write-combined regions
* are extremely sensitive to the characteristics of how the
* source data is retrieved. By reordering the source reads to
@@ -1245,7 +1241,11 @@ _mesa_texstore_argb8888(STORE_PARAMS)
srcWidth, srcFormat, srcType);
GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
+
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
*(GLuint *)(dstRow + col * 4) = (srcRow[col * 4 + RCOMP] << 16 |
@@ -1256,7 +1256,6 @@ _mesa_texstore_argb8888(STORE_PARAMS)
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else if (!ctx->_ImageTransferState &&
@@ -1265,17 +1264,16 @@ _mesa_texstore_argb8888(STORE_PARAMS)
srcFormat == GL_RGBA &&
srcType == GL_UNSIGNED_BYTE) {
- int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
for (img = 0; img < srcDepth; img++) {
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 4 + 0] = srcRow[col * 4 + BCOMP];
@@ -1286,7 +1284,6 @@ _mesa_texstore_argb8888(STORE_PARAMS)
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else if (!ctx->_ImageTransferState &&
@@ -1315,7 +1312,8 @@ _mesa_texstore_argb8888(STORE_PARAMS)
srcFormat,
dstmap, 4,
dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcAddr,
srcPacking);
}
@@ -1328,16 +1326,15 @@ _mesa_texstore_argb8888(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
if (dstFormat == &_mesa_texformat_argb8888) {
@@ -1360,7 +1357,6 @@ _mesa_texstore_argb8888(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1369,7 +1365,7 @@ _mesa_texstore_argb8888(STORE_PARAMS)
GLboolean
-_mesa_texstore_rgb888(STORE_PARAMS)
+_mesa_texstore_rgb888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
@@ -1386,7 +1382,8 @@ _mesa_texstore_rgb888(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1395,17 +1392,16 @@ _mesa_texstore_rgb888(STORE_PARAMS)
srcFormat == GL_RGBA &&
srcType == GL_UNSIGNED_BYTE) {
/* extract RGB from RGBA */
- int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
+ GLint img, row, col;
for (img = 0; img < srcDepth; img++) {
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP];
@@ -1415,7 +1411,6 @@ _mesa_texstore_rgb888(STORE_PARAMS)
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else {
@@ -1427,16 +1422,15 @@ _mesa_texstore_rgb888(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = (const GLchan *) tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
#if 0
if (littleEndian) {
@@ -1465,7 +1459,6 @@ _mesa_texstore_rgb888(STORE_PARAMS)
#endif
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1474,7 +1467,7 @@ _mesa_texstore_rgb888(STORE_PARAMS)
GLboolean
-_mesa_texstore_bgr888(STORE_PARAMS)
+_mesa_texstore_bgr888(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
@@ -1491,7 +1484,8 @@ _mesa_texstore_bgr888(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1501,16 +1495,15 @@ _mesa_texstore_bgr888(STORE_PARAMS)
srcType == GL_UNSIGNED_BYTE) {
/* extract BGR from RGBA */
int img, row, col;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
for (img = 0; img < srcDepth; img++) {
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP];
@@ -1520,7 +1513,6 @@ _mesa_texstore_bgr888(STORE_PARAMS)
dstRow += dstRowStride;
srcRow += srcRowStride;
}
- dstImage += dstImageStride;
}
}
else {
@@ -1532,16 +1524,15 @@ _mesa_texstore_bgr888(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = (const GLchan *) tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);
@@ -1551,7 +1542,6 @@ _mesa_texstore_bgr888(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1560,7 +1550,7 @@ _mesa_texstore_bgr888(STORE_PARAMS)
GLboolean
-_mesa_texstore_argb4444(STORE_PARAMS)
+_mesa_texstore_argb4444(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_argb4444 ||
dstFormat == &_mesa_texformat_argb4444_rev);
@@ -1575,7 +1565,8 @@ _mesa_texstore_argb4444(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1588,16 +1579,15 @@ _mesa_texstore_argb4444(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
if (dstFormat == &_mesa_texformat_argb4444) {
@@ -1620,7 +1610,6 @@ _mesa_texstore_argb4444(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1630,7 +1619,7 @@ _mesa_texstore_argb4444(STORE_PARAMS)
GLboolean
-_mesa_texstore_argb1555(STORE_PARAMS)
+_mesa_texstore_argb1555(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_argb1555 ||
dstFormat == &_mesa_texformat_argb1555_rev);
@@ -1645,7 +1634,8 @@ _mesa_texstore_argb1555(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1658,16 +1648,15 @@ _mesa_texstore_argb1555(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src =tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
if (dstFormat == &_mesa_texformat_argb1555) {
@@ -1690,7 +1679,6 @@ _mesa_texstore_argb1555(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1699,7 +1687,7 @@ _mesa_texstore_argb1555(STORE_PARAMS)
GLboolean
-_mesa_texstore_al88(STORE_PARAMS)
+_mesa_texstore_al88(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
@@ -1718,7 +1706,8 @@ _mesa_texstore_al88(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1731,16 +1720,15 @@ _mesa_texstore_al88(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
if (dstFormat == &_mesa_texformat_al88) {
@@ -1761,7 +1749,6 @@ _mesa_texstore_al88(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1770,7 +1757,7 @@ _mesa_texstore_al88(STORE_PARAMS)
GLboolean
-_mesa_texstore_rgb332(STORE_PARAMS)
+_mesa_texstore_rgb332(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_rgb332);
ASSERT(dstFormat->TexelBytes == 1);
@@ -1782,7 +1769,8 @@ _mesa_texstore_rgb332(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1795,16 +1783,15 @@ _mesa_texstore_rgb332(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]),
@@ -1814,7 +1801,6 @@ _mesa_texstore_rgb332(STORE_PARAMS)
}
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1826,7 +1812,7 @@ _mesa_texstore_rgb332(STORE_PARAMS)
* Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8.
*/
GLboolean
-_mesa_texstore_a8(STORE_PARAMS)
+_mesa_texstore_a8(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_a8 ||
dstFormat == &_mesa_texformat_l8 ||
@@ -1840,7 +1826,8 @@ _mesa_texstore_a8(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1853,16 +1840,15 @@ _mesa_texstore_a8(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
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 = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) {
dstRow[col] = CHAN_TO_UBYTE(src[col]);
@@ -1870,7 +1856,6 @@ _mesa_texstore_a8(STORE_PARAMS)
dstRow += dstRowStride;
src += srcWidth;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
}
@@ -1880,7 +1865,7 @@ _mesa_texstore_a8(STORE_PARAMS)
GLboolean
-_mesa_texstore_ci8(STORE_PARAMS)
+_mesa_texstore_ci8(TEXSTORE_PARAMS)
{
(void) dims; (void) baseInternalFormat;
ASSERT(dstFormat == &_mesa_texformat_ci8);
@@ -1894,19 +1879,19 @@ _mesa_texstore_ci8(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
else {
/* general path */
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
const GLvoid *src = _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
@@ -1915,7 +1900,6 @@ _mesa_texstore_ci8(STORE_PARAMS)
ctx->_ImageTransferState);
dstRow += dstRowStride;
}
- dstImage += dstImageStride;
}
}
return GL_TRUE;
@@ -1926,7 +1910,7 @@ _mesa_texstore_ci8(STORE_PARAMS)
* Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev.
*/
GLboolean
-_mesa_texstore_ycbcr(STORE_PARAMS)
+_mesa_texstore_ycbcr(TEXSTORE_PARAMS)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
@@ -1944,7 +1928,8 @@ _mesa_texstore_ycbcr(STORE_PARAMS)
/* always just memcpy since no pixel transfer ops apply */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
@@ -1954,18 +1939,16 @@ _mesa_texstore_ycbcr(STORE_PARAMS)
(srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^
(dstFormat == &_mesa_texformat_ycbcr_rev) ^
!littleEndian) {
- GLubyte *pImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLubyte *pRow = pImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
- _mesa_swap2((GLushort *) pRow, srcWidth);
- pRow += dstRowStride;
+ _mesa_swap2((GLushort *) dstRow, srcWidth);
+ dstRow += dstRowStride;
}
- pImage += dstImageStride;
}
}
return GL_TRUE;
@@ -1977,7 +1960,7 @@ _mesa_texstore_ycbcr(STORE_PARAMS)
* Store a combined depth/stencil texture image.
*/
GLboolean
-_mesa_texstore_z24_s8(STORE_PARAMS)
+_mesa_texstore_z24_s8(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == &_mesa_texformat_z24_s8);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT);
@@ -1988,7 +1971,8 @@ _mesa_texstore_z24_s8(STORE_PARAMS)
/* simple path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -1997,11 +1981,13 @@ _mesa_texstore_z24_s8(STORE_PARAMS)
const GLint srcRowStride
= _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
/ sizeof(GLuint);
- GLuint *dstImage = (GLuint *) dstAddr;
GLint img, row;
for (img = 0; img < srcDepth; img++) {
- GLuint *dst = dstImage;
+ GLuint *dstRow = (GLuint *) dstAddr
+ + dstImageOffsets[dstZoffset + img]
+ + dstYoffset * dstRowStride / sizeof(GLuint)
+ + dstXoffset;
const GLuint *src
= (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
srcWidth, srcHeight,
@@ -2013,7 +1999,7 @@ _mesa_texstore_z24_s8(STORE_PARAMS)
/* the 24 depth bits will be in the high position: */
_mesa_unpack_depth_span(ctx, srcWidth,
GL_UNSIGNED_INT, /* dst type */
- dst, /* dst addr */
+ dstRow, /* dst addr */
(GLfloat) 0xffffff, /* depthScale */
srcType, src, srcPacking);
/* get the 8-bit stencil values */
@@ -2024,16 +2010,13 @@ _mesa_texstore_z24_s8(STORE_PARAMS)
ctx->_ImageTransferState);
/* merge stencil values into depth values */
for (i = 0; i < srcWidth; i++)
- dst[i] |= stencil[i];
+ dstRow[i] |= stencil[i];
src += srcRowStride;
- dst += dstRowStride / sizeof(GLuint);
+ dstRow += dstRowStride / sizeof(GLuint);
}
- dstImage += dstImageStride / sizeof(GLuint);
}
}
-
-
return GL_TRUE;
}
@@ -2049,7 +2032,7 @@ _mesa_texstore_z24_s8(STORE_PARAMS)
* _mesa_texformat_intensity_float32
*/
GLboolean
-_mesa_texstore_rgba_float32(STORE_PARAMS)
+_mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
{
const GLint components = _mesa_components_in_format(dstFormat->BaseFormat);
@@ -2074,7 +2057,8 @@ _mesa_texstore_rgba_float32(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -2086,25 +2070,23 @@ _mesa_texstore_rgba_float32(STORE_PARAMS)
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
- const GLfloat *src = tempImage;
+ const GLfloat *srcRow = tempImage;
GLint bytesPerRow;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
bytesPerRow = srcWidth * components * sizeof(GLfloat);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dst = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
- _mesa_memcpy(dst, src, bytesPerRow);
- dst += dstRowStride;
- src += srcWidth * components;
+ _mesa_memcpy(dstRow, srcRow, bytesPerRow);
+ dstRow += dstRowStride;
+ srcRow += srcWidth * components;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
@@ -2117,7 +2099,7 @@ _mesa_texstore_rgba_float32(STORE_PARAMS)
* As above, but store 16-bit floats.
*/
GLboolean
-_mesa_texstore_rgba_float16(STORE_PARAMS)
+_mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
{
const GLint components = _mesa_components_in_format(dstFormat->BaseFormat);
@@ -2142,7 +2124,8 @@ _mesa_texstore_rgba_float16(STORE_PARAMS)
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
+ dstRowStride,
+ dstImageOffsets,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
@@ -2155,16 +2138,15 @@ _mesa_texstore_rgba_float16(STORE_PARAMS)
srcFormat, srcType, srcAddr,
srcPacking);
const GLfloat *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
GLint img, row;
if (!tempImage)
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
GLhalfARB *dstTexel = (GLhalfARB *) dstRow;
GLint i;
@@ -2174,7 +2156,6 @@ _mesa_texstore_rgba_float16(STORE_PARAMS)
dstRow += dstRowStride;
src += srcWidth * components;
}
- dstImage += dstImageStride;
}
_mesa_free((void *) tempImage);
@@ -2363,6 +2344,49 @@ set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
}
+/**
+ * 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);
+
+ 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;
+ }
+}
+
+
+
/*
* This is the software fallback for Driver.TexImage1D()
* and Driver.CopyTexImage1D().
@@ -2385,12 +2409,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
}
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
- format, type);
- assert(texImage->TexFormat);
- set_fetch_functions(texImage, 1);
+ choose_texture_format(ctx, texImage, 1, format, type, internalFormat);
/* allocate memory */
if (texImage->IsCompressed)
@@ -2412,14 +2431,15 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
return;
}
else {
- const GLint dstRowStride = 0, dstImageStride = 0;
+ 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, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, 1, 1,
format, type, pixels, packing);
if (!success) {
@@ -2441,16 +2461,12 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
/**
* This is the software fallback for Driver.TexImage2D()
* and Driver.CopyTexImage2D().
- * We store the image in heap memory. We know nothing about on-board
- * VRAM here. But since most DRI drivers rely on keeping a copy of all
- * textures in main memory, this routine will typically be used by
- * hardware drivers too.
*
- * Reasons why a driver might override this function:
- * - Special memory allocation needs (VRAM, AGP, etc)
- * - Unusual row/image strides or padding
- * - Special housekeeping
- * - Using VRAM-based Pixel Buffer Objects
+ * This function is oriented toward storing images in main memory, rather
+ * than VRAM. Device driver's can easily plug in their own replacement.
+ *
+ * Note: width and height may be pre-convolved dimensions, but
+ * texImage->Width and texImage->Height will be post-convolved dimensions.
*/
void
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
@@ -2470,12 +2486,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
&postConvHeight);
}
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
- assert(texImage->TexFormat);
- set_fetch_functions(texImage, 2);
+ choose_texture_format(ctx, texImage, 2, format, type, internalFormat);
texelBytes = texImage->TexFormat->TexelBytes;
@@ -2499,21 +2510,22 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
return;
}
else {
- GLint dstRowStride, dstImageStride = 0;
+ GLint dstRowStride;
GLboolean success;
if (texImage->IsCompressed) {
dstRowStride
- = _mesa_compressed_row_stride(texImage->InternalFormat,width);
+ = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
}
else {
- dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes;
+ 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, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, 1,
format, type, pixels, packing);
if (!success) {
@@ -2550,12 +2562,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
GLint texelBytes, sizeInBytes;
(void) border;
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
- assert(texImage->TexFormat);
- set_fetch_functions(texImage, 3);
+ choose_texture_format(ctx, texImage, 3, format, type, internalFormat);
texelBytes = texImage->TexFormat->TexelBytes;
@@ -2579,23 +2586,22 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
return;
}
else {
- GLint dstRowStride, dstImageStride;
+ GLint dstRowStride;
GLboolean success;
if (texImage->IsCompressed) {
dstRowStride
- = _mesa_compressed_row_stride(texImage->InternalFormat,width);
- dstImageStride = 0;
+ = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
}
else {
- dstRowStride = width * texImage->TexFormat->TexelBytes;
- dstImageStride = dstRowStride * height;
+ 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, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, depth,
format, type, pixels, packing);
if (!success) {
@@ -2628,20 +2634,22 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
pixels = _mesa_validate_pbo_teximage(ctx, 1, width, 1, 1, format, type,
pixels, packing, "glTexSubImage1D");
if (!pixels)
return;
{
- const GLint dstRowStride = 0, dstImageStride = 0;
+ 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, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, 1, 1,
format, type, pixels, packing);
if (!success) {
@@ -2674,27 +2682,29 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1, format, type,
pixels, packing, "glTexSubImage2D");
if (!pixels)
return;
{
- GLint dstRowStride = 0, dstImageStride = 0;
+ GLint dstRowStride = 0;
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
texImage->Width);
}
else {
- dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
+ 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, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, 1,
format, type, pixels, packing);
if (!success) {
@@ -2726,6 +2736,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ /* get pointer to src pixels (may be in a pbo which we'll map here) */
pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format,
type, pixels, packing,
"glTexSubImage3D");
@@ -2733,23 +2744,22 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
return;
{
- GLint dstRowStride, dstImageStride;
+ GLint dstRowStride;
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
texImage->Width);
- dstImageStride = 0; /* XXX fix */
}
else {
- dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
- dstImageStride = dstRowStride * texImage->Height;
+ 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, dstImageStride,
+ dstRowStride,
+ texImage->ImageOffsets,
width, height, depth,
format, type, pixels, packing);
if (!success) {
@@ -2791,7 +2801,7 @@ _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
-/*
+/**
* Fallback for Driver.CompressedTexImage2D()
*/
void
@@ -2814,12 +2824,7 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
ASSERT(texImage->Depth == 1);
ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, 0, 0);
- assert(texImage->TexFormat);
- set_fetch_functions(texImage, 2);
+ choose_texture_format(ctx, texImage, 2, 0, 0, internalFormat);
/* allocate storage */
texImage->Data = _mesa_alloc_texmemory(imageSize);
@@ -2887,7 +2892,7 @@ _mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- /* this space intentionally left blank */
+ /* there are no compressed 1D texture formats yet */
(void) ctx;
(void) target; (void) level;
(void) xoffset; (void) width;
@@ -2915,6 +2920,8 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
GLint i, rows;
GLubyte *dest;
const GLubyte *src;
+ const GLuint mesaFormat = texImage->TexFormat->MesaFormat;
+
(void) format;
/* these should have been caught sooner */
@@ -2923,21 +2930,21 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
ASSERT((xoffset & 3) == 0);
ASSERT((yoffset & 3) == 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,
&ctx->Unpack,
"glCompressedTexSubImage2D");
if (!data)
return;
- srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, width);
+ srcRowStride = _mesa_compressed_row_stride(mesaFormat, width);
src = (const GLubyte *) data;
- destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,
- texImage->Width);
+ destRowStride = _mesa_compressed_row_stride(mesaFormat, texImage->Width);
dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texImage->InternalFormat,
+ texImage->TexFormat->MesaFormat,
texImage->Width,
- (GLubyte*) texImage->Data);
+ (GLubyte *) texImage->Data);
bytesPerRow = srcRowStride;
rows = height / 4;
@@ -2972,7 +2979,7 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- /* this space intentionally left blank */
+ /* there are no compressed 3D texture formats yet */
(void) ctx;
(void) target; (void) level;
(void) xoffset; (void) yoffset; (void) zoffset;
@@ -3068,19 +3075,19 @@ do_row(const struct gl_texture_format *format, GLint srcWidth,
}
}
return;
- case MESA_FORMAT_DEPTH_COMPONENT_FLOAT32:
+ case MESA_FORMAT_Z32:
{
GLuint i, j, k;
- const GLfloat *rowA = (const GLfloat *) srcRowA;
- const GLfloat *rowB = (const GLfloat *) srcRowB;
+ const GLuint *rowA = (const GLuint *) srcRowA;
+ const GLuint *rowB = (const GLuint *) srcRowB;
GLfloat *dst = (GLfloat *) dstRow;
for (i = j = 0, k = k0; i < (GLuint) dstWidth;
i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F;
+ dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4;
}
}
return;
- case MESA_FORMAT_DEPTH_COMPONENT16:
+ case MESA_FORMAT_Z16:
{
GLuint i, j, k;
const GLushort *rowA = (const GLushort *) srcRowA;
@@ -3467,6 +3474,9 @@ make_1d_mipmap(const struct gl_texture_format *format, GLint border,
}
+/**
+ * XXX need to use the tex image's row stride!
+ */
static void
make_2d_mipmap(const struct gl_texture_format *format, GLint border,
GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr,
@@ -3729,7 +3739,7 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border,
}
-/*
+/**
* For GL_SGIX_generate_mipmap:
* Generate a complete set of mipmaps from texObj's base-level image.
* Stop at texObj's MaxLevel or when we get to the 1x1 texture.
@@ -3872,6 +3882,16 @@ _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);
@@ -3880,7 +3900,6 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
* Setup src and dest data pointers.
*/
if (dstImage->IsCompressed) {
- ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/
dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize);
if (!dstImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
@@ -3891,7 +3910,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
ASSERT(dstData);
}
else {
- bytesPerTexel = srcImage->TexFormat->TexelBytes;
+ bytesPerTexel = dstImage->TexFormat->TexelBytes;
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight
* dstDepth * bytesPerTexel);
@@ -3941,7 +3960,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
/* compress image from dstData into dstImage->Data */
const GLenum srcFormat = convertFormat->BaseFormat;
GLint dstRowStride
- = _mesa_compressed_row_stride(srcImage->InternalFormat, dstWidth);
+ = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth);
ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat,
dstImage->TexFormat,
@@ -4218,6 +4237,8 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj,
const struct gl_texture_image *texImage)
{
+ GLuint size;
+
if (ctx->Pack.BufferObj->Name) {
/* pack texture image into a PBO */
GLubyte *buf;
@@ -4243,8 +4264,13 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
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);
+
/* just memcpy, no pixelstore or pixel transfer */
- MEMCPY(img, texImage->Data, texImage->CompressedSize);
+ _mesa_memcpy(img, texImage->Data, size);
if (ctx->Pack.BufferObj->Name) {
ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index b71bae24eb1..3f5b7b0145c 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * 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"),
@@ -37,49 +37,36 @@
#include "mtypes.h"
-/* Macro just to save some typing */
-#define STORE_PARAMS \
- GLcontext *ctx, GLuint dims, \
- GLenum baseInternalFormat, \
- const struct gl_texture_format *dstFormat, \
- GLvoid *dstAddr, \
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
- GLint dstRowStride, GLint dstImageStride, \
- GLint srcWidth, GLint srcHeight, GLint srcDepth, \
- GLenum srcFormat, GLenum srcType, \
- const GLvoid *srcAddr, \
- const struct gl_pixelstore_attrib *srcPacking
-
-
-extern GLboolean _mesa_texstore_rgba(STORE_PARAMS);
-extern GLboolean _mesa_texstore_color_index(STORE_PARAMS);
-extern GLboolean _mesa_texstore_depth_component16(STORE_PARAMS);
-extern GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba8888(STORE_PARAMS);
-extern GLboolean _mesa_texstore_argb8888(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb888(STORE_PARAMS);
-extern GLboolean _mesa_texstore_bgr888(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb565(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb565_rev(STORE_PARAMS);
-extern GLboolean _mesa_texstore_argb4444(STORE_PARAMS);
-extern GLboolean _mesa_texstore_argb4444_rev(STORE_PARAMS);
-extern GLboolean _mesa_texstore_argb1555(STORE_PARAMS);
-extern GLboolean _mesa_texstore_argb1555_rev(STORE_PARAMS);
-extern GLboolean _mesa_texstore_al88(STORE_PARAMS);
-extern GLboolean _mesa_texstore_al88_rev(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb332(STORE_PARAMS);
-extern GLboolean _mesa_texstore_a8(STORE_PARAMS);
-extern GLboolean _mesa_texstore_ci8(STORE_PARAMS);
-extern GLboolean _mesa_texstore_ycbcr(STORE_PARAMS);
-extern GLboolean _mesa_texstore_z24_s8(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb_fxt1(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_fxt1(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgb_dxt1(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_dxt1(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_dxt3(STORE_PARAMS);
-extern GLboolean _mesa_texstore_rgba_dxt5(STORE_PARAMS);
+
+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_argb4444(TEXSTORE_PARAMS);
+extern GLboolean _mesa_texstore_argb4444_rev(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_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);
extern GLchan *
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index cf64fb23df7..97b02142936 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * 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"),
@@ -29,8 +29,6 @@
#include "context.h"
#include "enable.h"
#include "enums.h"
-#include "dlist.h"
-#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
#include "dispatch.h"
@@ -47,7 +45,7 @@
*/
static void
update_array(GLcontext *ctx, struct gl_client_array *array,
- GLuint dirtyFlag, GLsizei elementSize,
+ GLbitfield dirtyFlag, GLsizei elementSize,
GLint size, GLenum type,
GLsizei stride, GLboolean normalized, const GLvoid *ptr)
{
@@ -167,7 +165,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
}
update_array(ctx, &ctx->Array.Normal, _NEW_ARRAY_NORMAL,
- elementSize, 3, type, stride, GL_FALSE, ptr);
+ elementSize, 3, type, stride, GL_TRUE, ptr);
if (ctx->Driver.NormalPointer)
ctx->Driver.NormalPointer( ctx, type, stride, ptr );
@@ -225,7 +223,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
}
update_array(ctx, &ctx->Array.Color, _NEW_ARRAY_COLOR0,
- elementSize, size, type, stride, GL_FALSE, ptr);
+ elementSize, size, type, stride, GL_TRUE, ptr);
if (ctx->Driver.ColorPointer)
ctx->Driver.ColorPointer( ctx, size, type, stride, ptr );
@@ -357,7 +355,7 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
}
update_array(ctx, &ctx->Array.SecondaryColor, _NEW_ARRAY_COLOR1,
- elementSize, size, type, stride, GL_FALSE, ptr);
+ elementSize, size, type, stride, GL_TRUE, ptr);
if (ctx->Driver.SecondaryColorPointer)
ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr );
@@ -437,11 +435,12 @@ void GLAPIENTRY
_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
GLsizei stride, const GLvoid *ptr)
{
+ const GLboolean normalized = GL_FALSE;
GLsizei elementSize;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (index >= VERT_ATTRIB_MAX) {
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)");
return;
}
@@ -481,7 +480,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
}
update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index),
- elementSize, size, type, stride, GL_FALSE, ptr);
+ elementSize, size, type, stride, normalized, ptr);
if (ctx->Driver.VertexAttribPointer)
ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
@@ -754,6 +753,7 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
_mesa_DisableClientState( GL_EDGE_FLAG_ARRAY );
_mesa_DisableClientState( GL_INDEX_ARRAY );
+ /* XXX also disable secondary color and generic arrays? */
/* Texcoords */
if (tflag) {
@@ -917,12 +917,11 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
}
-/**********************************************************************/
-/***** Initialization *****/
-/**********************************************************************/
-
+/**
+ * Initialize vertex array state for given context.
+ */
void
-_mesa_init_varray( GLcontext * ctx )
+_mesa_init_varray(GLcontext *ctx)
{
GLuint i;
@@ -981,7 +980,6 @@ _mesa_init_varray( GLcontext * ctx )
ctx->Array.EdgeFlag.Ptr = NULL;
ctx->Array.EdgeFlag.Enabled = GL_FALSE;
ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA;
- ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
ctx->Array.VertexAttrib[i].Size = 4;
ctx->Array.VertexAttrib[i].Type = GL_FLOAT;
@@ -989,6 +987,9 @@ _mesa_init_varray( GLcontext * ctx )
ctx->Array.VertexAttrib[i].StrideB = 0;
ctx->Array.VertexAttrib[i].Ptr = NULL;
ctx->Array.VertexAttrib[i].Enabled = GL_FALSE;
+ ctx->Array.VertexAttrib[i].Normalized = GL_FALSE;
ctx->Array.VertexAttrib[i].Flags = CA_CLIENT_DATA;
}
+
+ ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
}
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 578406401a5..1c01d900192 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * 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"),
@@ -30,8 +30,8 @@
/* Mesa version */
#define MESA_MAJOR 6
#define MESA_MINOR 5
-#define MESA_PATCH 0
-#define MESA_VERSION_STRING "6.5"
+#define MESA_PATCH 1
+#define MESA_VERSION_STRING "6.5.1"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index b3c63982911..0204979003e 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -72,7 +72,10 @@
#include "vtxfmt_tmp.h"
-
+/**
+ * Use the per-vertex functions found in <vfmt> to initialze the given
+ * API dispatch table.
+ */
static void
install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
{
@@ -82,7 +85,6 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_Color4f(tab, vfmt->Color4f);
SET_Color4fv(tab, vfmt->Color4fv);
SET_EdgeFlag(tab, vfmt->EdgeFlag);
- SET_EdgeFlagv(tab, vfmt->EdgeFlagv);
SET_EvalCoord1f(tab, vfmt->EvalCoord1f);
SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv);
SET_EvalCoord2f(tab, vfmt->EvalCoord2f);
@@ -124,6 +126,15 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_CallLists(tab, vfmt->CallLists);
SET_Begin(tab, vfmt->Begin);
SET_End(tab, vfmt->End);
+ SET_Rectf(tab, vfmt->Rectf);
+ SET_DrawArrays(tab, vfmt->DrawArrays);
+ SET_DrawElements(tab, vfmt->DrawElements);
+ SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
+ SET_EvalMesh1(tab, vfmt->EvalMesh1);
+ SET_EvalMesh2(tab, vfmt->EvalMesh2);
+ ASSERT(tab->EvalMesh2);
+
+ /* GL_NV_vertex_program */
SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
@@ -132,6 +143,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV);
SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV);
SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV);
+#if FEATURE_ARB_vertex_program
SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB);
SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB);
SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB);
@@ -140,13 +152,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB);
SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB);
SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB);
- SET_Rectf(tab, vfmt->Rectf);
- SET_DrawArrays(tab, vfmt->DrawArrays);
- SET_DrawElements(tab, vfmt->DrawElements);
- SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
- SET_EvalMesh1(tab, vfmt->EvalMesh1);
- SET_EvalMesh2(tab, vfmt->EvalMesh2);
- ASSERT(tab->EvalMesh2);
+#endif
}
diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h
index 2a0fdde4665..783b06558d5 100644
--- a/src/mesa/main/vtxfmt_tmp.h
+++ b/src/mesa/main/vtxfmt_tmp.h
@@ -68,12 +68,6 @@ static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e )
CALL_EdgeFlag(GET_DISPATCH(), ( e ));
}
-static void GLAPIENTRY TAG(EdgeFlagv)( const GLboolean *v )
-{
- PRE_LOOPBACK( EdgeFlagv );
- CALL_EdgeFlagv(GET_DISPATCH(), ( v ));
-}
-
static void GLAPIENTRY TAG(EvalCoord1f)( GLfloat s )
{
PRE_LOOPBACK( EvalCoord1f );
@@ -467,7 +461,6 @@ static GLvertexformat TAG(vtxfmt) = {
TAG(Color4f),
TAG(Color4fv),
TAG(EdgeFlag),
- TAG(EdgeFlagv),
TAG(EvalCoord1f),
TAG(EvalCoord1fv),
TAG(EvalCoord2f),