aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_pack_color.h2
-rw-r--r--mesalib/src/glu/sgi/Makefile293
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c2
-rw-r--r--mesalib/src/mesa/main/api_exec.c4
-rw-r--r--mesalib/src/mesa/main/arrayobj.c4
-rw-r--r--mesalib/src/mesa/main/context.c2
-rw-r--r--mesalib/src/mesa/main/dlist.c4
-rw-r--r--mesalib/src/mesa/main/light.c16
-rw-r--r--mesalib/src/mesa/main/light.h298
-rw-r--r--mesalib/src/mesa/main/mfeatures.h1
-rw-r--r--mesalib/src/mesa/main/mtypes.h8
-rw-r--r--mesalib/src/mesa/main/querymatrix.c2
-rw-r--r--mesalib/src/mesa/main/shared.c6
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp4
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c9
-rw-r--r--mesalib/src/mesa/swrast_setup/ss_context.c608
-rw-r--r--mesalib/src/mesa/swrast_setup/ss_context.h2
-rw-r--r--mesalib/src/mesa/tnl/t_context.c20
-rw-r--r--mesalib/src/mesa/tnl/t_context.h20
-rw-r--r--mesalib/src/mesa/tnl/t_rasterpos.c967
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c11
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.h42
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c61
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c3
25 files changed, 1175 insertions, 1216 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_pack_color.h b/mesalib/src/gallium/auxiliary/util/u_pack_color.h
index 0bbf769a4..50ec226d8 100644
--- a/mesalib/src/gallium/auxiliary/util/u_pack_color.h
+++ b/mesalib/src/gallium/auxiliary/util/u_pack_color.h
@@ -122,7 +122,7 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
case PIPE_FORMAT_L8_UNORM:
case PIPE_FORMAT_I8_UNORM:
{
- uc->ub = a;
+ uc->ub = r;
}
return;
case PIPE_FORMAT_R32G32B32A32_FLOAT:
diff --git a/mesalib/src/glu/sgi/Makefile b/mesalib/src/glu/sgi/Makefile
index 4621bf8e0..50eede3ad 100644
--- a/mesalib/src/glu/sgi/Makefile
+++ b/mesalib/src/glu/sgi/Makefile
@@ -1,149 +1,144 @@
-# src/glu/sgi/Makefile
-
-.SUFFIXES : .cc
-
-TOP = ../../..
-
-include $(TOP)/configs/current
-
-GLU_MAJOR = 1
-GLU_MINOR = 3
-GLU_TINY = 0$(MESA_MAJOR)$(MESA_MINOR)0$(MESA_TINY)
-
-INCDIRS = -I$(TOP)/include -Iinclude -Iinternals -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
-
-C_SOURCES = \
- libutil/error.c \
- libutil/glue.c \
- libutil/mipmap.c \
- libutil/project.c \
- libutil/quad.c \
- libutil/registry.c \
- libtess/dict.c \
- libtess/geom.c \
- libtess/memalloc.c \
- libtess/mesh.c \
- libtess/normal.c \
- libtess/priorityq.c \
- libtess/render.c \
- libtess/sweep.c \
- libtess/tess.c \
- libtess/tessmono.c
-
-CC_SOURCES = \
- libnurbs/interface/bezierEval.cc \
- libnurbs/interface/bezierPatch.cc \
- libnurbs/interface/bezierPatchMesh.cc \
- libnurbs/interface/glcurveval.cc \
- libnurbs/interface/glinterface.cc \
- libnurbs/interface/glrenderer.cc \
- libnurbs/interface/glsurfeval.cc \
- libnurbs/interface/incurveeval.cc \
- libnurbs/interface/insurfeval.cc \
- libnurbs/internals/arc.cc \
- libnurbs/internals/arcsorter.cc \
- libnurbs/internals/arctess.cc \
- libnurbs/internals/backend.cc \
- libnurbs/internals/basiccrveval.cc \
- libnurbs/internals/basicsurfeval.cc \
- libnurbs/internals/bin.cc \
- libnurbs/internals/bufpool.cc \
- libnurbs/internals/cachingeval.cc \
- libnurbs/internals/ccw.cc \
- libnurbs/internals/coveandtiler.cc \
- libnurbs/internals/curve.cc \
- libnurbs/internals/curvelist.cc \
- libnurbs/internals/curvesub.cc \
- libnurbs/internals/dataTransform.cc \
- libnurbs/internals/displaylist.cc \
- libnurbs/internals/flist.cc \
- libnurbs/internals/flistsorter.cc \
- libnurbs/internals/hull.cc \
- libnurbs/internals/intersect.cc \
- libnurbs/internals/knotvector.cc \
- libnurbs/internals/mapdesc.cc \
- libnurbs/internals/mapdescv.cc \
- libnurbs/internals/maplist.cc \
- libnurbs/internals/mesher.cc \
- libnurbs/internals/monoTriangulationBackend.cc \
- libnurbs/internals/monotonizer.cc \
- libnurbs/internals/mycode.cc \
- libnurbs/internals/nurbsinterfac.cc \
- libnurbs/internals/nurbstess.cc \
- libnurbs/internals/patch.cc \
- libnurbs/internals/patchlist.cc \
- libnurbs/internals/quilt.cc \
- libnurbs/internals/reader.cc \
- libnurbs/internals/renderhints.cc \
- libnurbs/internals/slicer.cc \
- libnurbs/internals/sorter.cc \
- libnurbs/internals/splitarcs.cc \
- libnurbs/internals/subdivider.cc \
- libnurbs/internals/tobezier.cc \
- libnurbs/internals/trimline.cc \
- libnurbs/internals/trimregion.cc \
- libnurbs/internals/trimvertpool.cc \
- libnurbs/internals/uarray.cc \
- libnurbs/internals/varray.cc \
- libnurbs/nurbtess/directedLine.cc \
- libnurbs/nurbtess/gridWrap.cc \
- libnurbs/nurbtess/monoChain.cc \
- libnurbs/nurbtess/monoPolyPart.cc \
- libnurbs/nurbtess/monoTriangulation.cc \
- libnurbs/nurbtess/partitionX.cc \
- libnurbs/nurbtess/partitionY.cc \
- libnurbs/nurbtess/polyDBG.cc \
- libnurbs/nurbtess/polyUtil.cc \
- libnurbs/nurbtess/primitiveStream.cc \
- libnurbs/nurbtess/quicksort.cc \
- libnurbs/nurbtess/rectBlock.cc \
- libnurbs/nurbtess/sampleComp.cc \
- libnurbs/nurbtess/sampleCompBot.cc \
- libnurbs/nurbtess/sampleCompRight.cc \
- libnurbs/nurbtess/sampleCompTop.cc \
- libnurbs/nurbtess/sampleMonoPoly.cc \
- libnurbs/nurbtess/sampledLine.cc \
- libnurbs/nurbtess/searchTree.cc
-
-SOURCES = $(C_SOURCES) $(CC_SOURCES)
-
-C_OBJECTS = $(C_SOURCES:.c=.o)
-CC_OBJECTS = $(CC_SOURCES:.cc=.o)
-OBJECTS = $(C_OBJECTS) $(CC_OBJECTS)
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCDIRS) $(CFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
-
-.cc.o:
- $(CXX) -c $(INCDIRS) $(CXXFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
-
-
-##### TARGETS #####
-
-default:
- @if [ "${CONFIG_NAME}" = "beos" ] ; then \
- echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \
- exit 0 ; \
- else \
- $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \
- fi
-
-$(TOP)/$(LIB_DIR):
- -mkdir $(TOP)/$(LIB_DIR)
-
-# Make the library:
-$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
- $(MKLIB) -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
- -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
- -cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
- -exports glu.exports -id $(INSTALL_LIB_DIR)/lib$(GLU_LIB).$(GLU_MAJOR).dylib \
- $(GLU_LIB_DEPS) $(OBJECTS)
-
-
-clean:
- -rm -f *.o */*.o */*/*.o
- -rm -f *.lo */*.lo */*/*.lo
- -rm -f *.la */*.la */*/*.la
+# src/glu/sgi/Makefile
+
+.SUFFIXES : .cc
+
+TOP = ../../..
+
+include $(TOP)/configs/current
+
+GLU_MAJOR = 1
+GLU_MINOR = 3
+GLU_TINY = 0$(MESA_MAJOR)$(MESA_MINOR)0$(MESA_TINY)
+
+INCDIRS = -I$(TOP)/include -Iinclude -Iinternals -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
+
+C_SOURCES = \
+ libutil/error.c \
+ libutil/glue.c \
+ libutil/mipmap.c \
+ libutil/project.c \
+ libutil/quad.c \
+ libutil/registry.c \
+ libtess/dict.c \
+ libtess/geom.c \
+ libtess/memalloc.c \
+ libtess/mesh.c \
+ libtess/normal.c \
+ libtess/priorityq.c \
+ libtess/render.c \
+ libtess/sweep.c \
+ libtess/tess.c \
+ libtess/tessmono.c
+
+CC_SOURCES = \
+ libnurbs/interface/bezierEval.cc \
+ libnurbs/interface/bezierPatch.cc \
+ libnurbs/interface/bezierPatchMesh.cc \
+ libnurbs/interface/glcurveval.cc \
+ libnurbs/interface/glinterface.cc \
+ libnurbs/interface/glrenderer.cc \
+ libnurbs/interface/glsurfeval.cc \
+ libnurbs/interface/incurveeval.cc \
+ libnurbs/interface/insurfeval.cc \
+ libnurbs/internals/arc.cc \
+ libnurbs/internals/arcsorter.cc \
+ libnurbs/internals/arctess.cc \
+ libnurbs/internals/backend.cc \
+ libnurbs/internals/basiccrveval.cc \
+ libnurbs/internals/basicsurfeval.cc \
+ libnurbs/internals/bin.cc \
+ libnurbs/internals/bufpool.cc \
+ libnurbs/internals/cachingeval.cc \
+ libnurbs/internals/ccw.cc \
+ libnurbs/internals/coveandtiler.cc \
+ libnurbs/internals/curve.cc \
+ libnurbs/internals/curvelist.cc \
+ libnurbs/internals/curvesub.cc \
+ libnurbs/internals/dataTransform.cc \
+ libnurbs/internals/displaylist.cc \
+ libnurbs/internals/flist.cc \
+ libnurbs/internals/flistsorter.cc \
+ libnurbs/internals/hull.cc \
+ libnurbs/internals/intersect.cc \
+ libnurbs/internals/knotvector.cc \
+ libnurbs/internals/mapdesc.cc \
+ libnurbs/internals/mapdescv.cc \
+ libnurbs/internals/maplist.cc \
+ libnurbs/internals/mesher.cc \
+ libnurbs/internals/monoTriangulationBackend.cc \
+ libnurbs/internals/monotonizer.cc \
+ libnurbs/internals/mycode.cc \
+ libnurbs/internals/nurbsinterfac.cc \
+ libnurbs/internals/nurbstess.cc \
+ libnurbs/internals/patch.cc \
+ libnurbs/internals/patchlist.cc \
+ libnurbs/internals/quilt.cc \
+ libnurbs/internals/reader.cc \
+ libnurbs/internals/renderhints.cc \
+ libnurbs/internals/slicer.cc \
+ libnurbs/internals/sorter.cc \
+ libnurbs/internals/splitarcs.cc \
+ libnurbs/internals/subdivider.cc \
+ libnurbs/internals/tobezier.cc \
+ libnurbs/internals/trimline.cc \
+ libnurbs/internals/trimregion.cc \
+ libnurbs/internals/trimvertpool.cc \
+ libnurbs/internals/uarray.cc \
+ libnurbs/internals/varray.cc \
+ libnurbs/nurbtess/directedLine.cc \
+ libnurbs/nurbtess/gridWrap.cc \
+ libnurbs/nurbtess/monoChain.cc \
+ libnurbs/nurbtess/monoPolyPart.cc \
+ libnurbs/nurbtess/monoTriangulation.cc \
+ libnurbs/nurbtess/partitionX.cc \
+ libnurbs/nurbtess/partitionY.cc \
+ libnurbs/nurbtess/polyDBG.cc \
+ libnurbs/nurbtess/polyUtil.cc \
+ libnurbs/nurbtess/primitiveStream.cc \
+ libnurbs/nurbtess/quicksort.cc \
+ libnurbs/nurbtess/rectBlock.cc \
+ libnurbs/nurbtess/sampleComp.cc \
+ libnurbs/nurbtess/sampleCompBot.cc \
+ libnurbs/nurbtess/sampleCompRight.cc \
+ libnurbs/nurbtess/sampleCompTop.cc \
+ libnurbs/nurbtess/sampleMonoPoly.cc \
+ libnurbs/nurbtess/sampledLine.cc \
+ libnurbs/nurbtess/searchTree.cc
+
+SOURCES = $(C_SOURCES) $(CC_SOURCES)
+
+C_OBJECTS = $(C_SOURCES:.c=.o)
+CC_OBJECTS = $(CC_SOURCES:.cc=.o)
+OBJECTS = $(C_OBJECTS) $(CC_OBJECTS)
+
+
+##### RULES #####
+
+.c.o:
+ $(CC) -c $(INCDIRS) $(CFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
+
+.cc.o:
+ $(CXX) -c $(INCDIRS) $(CXXFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
+
+
+##### TARGETS #####
+
+default:
+ $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME)
+
+$(TOP)/$(LIB_DIR):
+ -mkdir $(TOP)/$(LIB_DIR)
+
+# Make the library:
+$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
+ $(MKLIB) -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
+ -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
+ -cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
+ -exports glu.exports -id $(INSTALL_LIB_DIR)/lib$(GLU_LIB).$(GLU_MAJOR).dylib \
+ $(GLU_LIB_DEPS) $(OBJECTS)
+
+
+clean:
+ -rm -f *.o */*.o */*/*.o
+ -rm -f *.lo */*.lo */*/*.lo
+ -rm -f *.la */*.la */*/*.la
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index e62267394..5098680b6 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -588,6 +588,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
if (ctx->Extensions.NV_texture_rectangle)
_mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
+ if (ctx->Extensions.OES_EGL_image_external)
+ _mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index 26fd37e63..605af381d 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -39,9 +39,7 @@
#include "atifragshader.h"
#include "attrib.h"
#include "blend.h"
-#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
-#endif
#include "arrayobj.h"
#if FEATURE_draw_read_buffer
#include "buffers.h"
@@ -580,7 +578,6 @@ _mesa_create_exec_table(void)
#endif
/* ARB 28. GL_ARB_vertex_buffer_object */
-#if FEATURE_ARB_vertex_buffer_object
SET_BindBufferARB(exec, _mesa_BindBufferARB);
SET_BufferDataARB(exec, _mesa_BufferDataARB);
SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
@@ -592,7 +589,6 @@ _mesa_create_exec_table(void)
SET_IsBufferARB(exec, _mesa_IsBufferARB);
SET_MapBufferARB(exec, _mesa_MapBufferARB);
SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
-#endif
/* ARB 29. GL_ARB_occlusion_query */
_mesa_init_queryobj_dispatch(exec);
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 0439063b1..4b3e07b85 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -45,9 +45,7 @@
#include "imports.h"
#include "context.h"
#include "mfeatures.h"
-#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
-#endif
#include "arrayobj.h"
#include "macros.h"
#include "mtypes.h"
@@ -195,11 +193,9 @@ init_array(struct gl_context *ctx,
array->Normalized = GL_FALSE;
array->Integer = GL_FALSE;
array->_ElementSize = size * _mesa_sizeof_type(type);
-#if FEATURE_ARB_vertex_buffer_object
/* Vertex array buffers */
_mesa_reference_buffer_object(ctx, &array->BufferObj,
ctx->Shared->NullBufferObj);
-#endif
}
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 009048170..f39cab5e4 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -1133,9 +1133,7 @@ _mesa_free_context_data( struct gl_context *ctx )
_mesa_reference_buffer_object(ctx, &ctx->DefaultPacking.BufferObj, NULL);
#endif
-#if FEATURE_ARB_vertex_buffer_object
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
-#endif
/* free dispatch tables */
free(ctx->Exec);
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index b3edae0e6..95b8211b2 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -40,9 +40,7 @@
#endif
#include "config.h"
#include "mfeatures.h"
-#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
-#endif
#include "arrayobj.h"
#include "context.h"
#include "dlist.h"
@@ -10184,7 +10182,6 @@ _mesa_create_save_table(void)
#endif
/* ARB 28. GL_ARB_vertex_buffer_object */
-#if FEATURE_ARB_vertex_buffer_object
/* None of the extension's functions get compiled */
SET_BindBufferARB(table, _mesa_BindBufferARB);
SET_BufferDataARB(table, _mesa_BufferDataARB);
@@ -10197,7 +10194,6 @@ _mesa_create_save_table(void)
SET_IsBufferARB(table, _mesa_IsBufferARB);
SET_MapBufferARB(table, _mesa_MapBufferARB);
SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
-#endif
#if FEATURE_queryobj
_mesa_init_queryobj_dispatch(table); /* glGetQuery, etc */
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index 60daa89a3..bf4bee3d6 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -624,22 +624,6 @@ _mesa_material_bitmask( struct gl_context *ctx, GLenum face, GLenum pname,
-/* Perform a straight copy between materials.
- */
-void
-_mesa_copy_materials( struct gl_material *dst,
- const struct gl_material *src,
- GLuint bitmask )
-{
- int i;
-
- for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
- if (bitmask & (1<<i))
- COPY_4FV( dst->Attrib[i], src->Attrib[i] );
-}
-
-
-
/* Update derived values following a change in ctx->Light.Material
*/
void
diff --git a/mesalib/src/mesa/main/light.h b/mesalib/src/mesa/main/light.h
index cd8aeaeb6..9b66c7ed8 100644
--- a/mesalib/src/mesa/main/light.h
+++ b/mesalib/src/mesa/main/light.h
@@ -1,151 +1,147 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef LIGHT_H
-#define LIGHT_H
-
-
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct gl_context;
-struct gl_light;
-struct gl_material;
-
-extern void GLAPIENTRY
-_mesa_ShadeModel( GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_ProvokingVertexEXT(GLenum mode);
-
-
-#if _HAVE_FULL_GL
-extern void GLAPIENTRY
-_mesa_ColorMaterial( GLenum face, GLenum mode );
-
-extern void GLAPIENTRY
-_mesa_Lightf( GLenum light, GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params );
-
-extern void GLAPIENTRY
-_mesa_Lighti( GLenum light, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_LightModelf( GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_LightModelfv( GLenum pname, const GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_LightModeli( GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_LightModeliv( GLenum pname, const GLint *params );
-
-extern void GLAPIENTRY
-_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params );
-
-extern void GLAPIENTRY
-_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params );
-
-
-extern void
-_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params);
-
-
-/* Lerp between adjacent values in the f(x) lookup table, giving a
- * continuous function, with adequeate overall accuracy. (Though
- * still pretty good compared to a straight lookup).
- * Result should be a GLfloat.
- */
-#define GET_SHINE_TAB_ENTRY( table, dp, result ) \
-do { \
- struct gl_shine_tab *_tab = table; \
- float f = (dp * (SHINE_TABLE_SIZE-1)); \
- int k = (int) f; \
- if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \
- || k > SHINE_TABLE_SIZE-2) \
- result = (GLfloat) pow( dp, _tab->shininess ); \
- else \
- result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \
-} while (0)
-
-
-extern GLuint _mesa_material_bitmask( struct gl_context *ctx,
- GLenum face, GLenum pname,
- GLuint legal,
- const char * );
-
-extern void _mesa_invalidate_spot_exp_table( struct gl_light *l );
-
-extern void _mesa_invalidate_shine_table( struct gl_context *ctx, GLuint i );
-
-extern void _mesa_validate_all_lighting_tables( struct gl_context *ctx );
-
-extern void _mesa_update_lighting( struct gl_context *ctx );
-
-extern void _mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state );
-
-extern void _mesa_update_material( struct gl_context *ctx,
- GLuint bitmask );
-
-extern void _mesa_copy_materials( struct gl_material *dst,
- const struct gl_material *src,
- GLuint bitmask );
-
-extern void _mesa_update_color_material( struct gl_context *ctx,
- const GLfloat rgba[4] );
-
-extern void _mesa_init_lighting( struct gl_context *ctx );
-
-extern void _mesa_free_lighting_data( struct gl_context *ctx );
-
-extern void _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag );
-
-#else
-#define _mesa_update_color_material( c, r ) ((void)0)
-#define _mesa_validate_all_lighting_tables( c ) ((void)0)
-#define _mesa_invalidate_spot_exp_table( l ) ((void)0)
-#define _mesa_material_bitmask( c, f, p, l, s ) 0
-#define _mesa_init_lighting( c ) ((void)0)
-#define _mesa_free_lighting_data( c ) ((void)0)
-#define _mesa_update_lighting( c ) ((void)0)
-#define _mesa_update_tnl_spaces( c, n ) ((void)0)
-#define GET_SHINE_TAB_ENTRY( table, dp, result ) ((result)=0)
-#endif
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.5
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef LIGHT_H
+#define LIGHT_H
+
+
+#include "glheader.h"
+#include "mfeatures.h"
+
+struct gl_context;
+struct gl_light;
+struct gl_material;
+
+extern void GLAPIENTRY
+_mesa_ShadeModel( GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_ProvokingVertexEXT(GLenum mode);
+
+
+#if _HAVE_FULL_GL
+extern void GLAPIENTRY
+_mesa_ColorMaterial( GLenum face, GLenum mode );
+
+extern void GLAPIENTRY
+_mesa_Lightf( GLenum light, GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params );
+
+extern void GLAPIENTRY
+_mesa_Lighti( GLenum light, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_LightModelf( GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_LightModelfv( GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_LightModeli( GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_LightModeliv( GLenum pname, const GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params );
+
+
+extern void
+_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params);
+
+
+/* Lerp between adjacent values in the f(x) lookup table, giving a
+ * continuous function, with adequeate overall accuracy. (Though
+ * still pretty good compared to a straight lookup).
+ * Result should be a GLfloat.
+ */
+#define GET_SHINE_TAB_ENTRY( table, dp, result ) \
+do { \
+ struct gl_shine_tab *_tab = table; \
+ float f = (dp * (SHINE_TABLE_SIZE-1)); \
+ int k = (int) f; \
+ if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \
+ || k > SHINE_TABLE_SIZE-2) \
+ result = (GLfloat) pow( dp, _tab->shininess ); \
+ else \
+ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \
+} while (0)
+
+
+extern GLuint _mesa_material_bitmask( struct gl_context *ctx,
+ GLenum face, GLenum pname,
+ GLuint legal,
+ const char * );
+
+extern void _mesa_invalidate_spot_exp_table( struct gl_light *l );
+
+extern void _mesa_invalidate_shine_table( struct gl_context *ctx, GLuint i );
+
+extern void _mesa_validate_all_lighting_tables( struct gl_context *ctx );
+
+extern void _mesa_update_lighting( struct gl_context *ctx );
+
+extern void _mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state );
+
+extern void _mesa_update_material( struct gl_context *ctx,
+ GLuint bitmask );
+
+extern void _mesa_update_color_material( struct gl_context *ctx,
+ const GLfloat rgba[4] );
+
+extern void _mesa_init_lighting( struct gl_context *ctx );
+
+extern void _mesa_free_lighting_data( struct gl_context *ctx );
+
+extern void _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag );
+
+#else
+#define _mesa_update_color_material( c, r ) ((void)0)
+#define _mesa_validate_all_lighting_tables( c ) ((void)0)
+#define _mesa_invalidate_spot_exp_table( l ) ((void)0)
+#define _mesa_material_bitmask( c, f, p, l, s ) 0
+#define _mesa_init_lighting( c ) ((void)0)
+#define _mesa_free_lighting_data( c ) ((void)0)
+#define _mesa_update_lighting( c ) ((void)0)
+#define _mesa_update_tnl_spaces( c, n ) ((void)0)
+#define GET_SHINE_TAB_ENTRY( table, dp, result ) ((result)=0)
+#endif
+
+#endif
diff --git a/mesalib/src/mesa/main/mfeatures.h b/mesalib/src/mesa/main/mfeatures.h
index 33db50814..b67f046ca 100644
--- a/mesalib/src/mesa/main/mfeatures.h
+++ b/mesalib/src/mesa/main/mfeatures.h
@@ -124,7 +124,6 @@
#define FEATURE_ARB_pixel_buffer_object (FEATURE_GL && FEATURE_EXT_pixel_buffer_object)
#define FEATURE_ARB_sampler_objects FEATURE_GL
#define FEATURE_ARB_sync FEATURE_GL
-#define FEATURE_ARB_vertex_buffer_object 1
#define FEATURE_EXT_framebuffer_blit FEATURE_GL
#define FEATURE_EXT_framebuffer_object 1
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 02452aa68..107371e52 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -56,6 +56,12 @@ typedef GLuint64 GLbitfield64;
/** Set a single bit */
#define BITFIELD64_BIT(b) ((GLbitfield64)1 << (b))
+/** Set all bits up to excluding bit b */
+#define BITFIELD64_MASK(b) \
+ ((b) == 64 ? (~(GLbitfield64)0) : BITFIELD64_BIT(b) - 1)
+/** Set count bits starting from bit b */
+#define BITFIELD64_RANGE(b, count) \
+ (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b))
/**
@@ -683,8 +689,6 @@ struct gl_light
GLfloat _MatAmbient[2][3]; /**< material ambient * light ambient */
GLfloat _MatDiffuse[2][3]; /**< material diffuse * light diffuse */
GLfloat _MatSpecular[2][3]; /**< material spec * light specular */
- GLfloat _dli; /**< CI diffuse light intensity */
- GLfloat _sli; /**< CI specular light intensity */
/*@}*/
};
diff --git a/mesalib/src/mesa/main/querymatrix.c b/mesalib/src/mesa/main/querymatrix.c
index eaedf7cd2..2843d5589 100644
--- a/mesalib/src/mesa/main/querymatrix.c
+++ b/mesalib/src/mesa/main/querymatrix.c
@@ -73,7 +73,7 @@ fpclassify(double x)
#elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
(defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \
- (defined(__sun) && defined(__GNUC__)) || defined(ANDROID)
+ (defined(__sun) && defined(__GNUC__)) || defined(ANDROID) || defined(__HAIKU__)
/* fpclassify is available. */
diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c
index caa6132d4..276fac149 100644
--- a/mesalib/src/mesa/main/shared.c
+++ b/mesalib/src/mesa/main/shared.c
@@ -89,9 +89,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
shared->ShaderObjects = _mesa_NewHashTable();
#endif
-#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
shared->BufferObjects = _mesa_NewHashTable();
-#endif
#if FEATURE_ARB_sampler_objects
/* GL_ARB_sampler_objects */
@@ -342,10 +340,8 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
_mesa_delete_ati_fragment_shader(ctx, shared->DefaultFragmentShader);
#endif
-#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
_mesa_HashDeleteAll(shared->BufferObjects, delete_bufferobj_cb, ctx);
_mesa_DeleteHashTable(shared->BufferObjects);
-#endif
#if FEATURE_EXT_framebuffer_object
_mesa_HashDeleteAll(shared->FrameBuffers, delete_framebuffer_cb, ctx);
@@ -354,9 +350,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
_mesa_DeleteHashTable(shared->RenderBuffers);
#endif
-#if FEATURE_ARB_vertex_buffer_object
_mesa_reference_buffer_object(ctx, &shared->NullBufferObj, NULL);
-#endif
{
struct simple_node *node;
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 33ba53c2e..f3d6a16ee 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -648,7 +648,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
if (offset >= uni->array_elements)
return;
- count = MIN2(count, (uni->array_elements - offset));
+ count = MIN2(count, (int) (uni->array_elements - offset));
}
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -797,7 +797,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
if (offset >= uni->array_elements)
return;
- count = MIN2(count, (uni->array_elements - offset));
+ count = MIN2(count, (int) (uni->array_elements - offset));
}
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 76a31eeae..ffd78a2b8 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -189,8 +189,15 @@ _swrast_map_teximage(struct gl_context *ctx,
stride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
_mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
- assert(swImage->Buffer);
+ assert(x % bw == 0);
+ assert(y % bh == 0);
+ if (!swImage->Buffer) {
+ /* probably ran out of memory when allocating tex mem */
+ *mapOut = NULL;
+ return;
+ }
+
map = swImage->Buffer;
if (texImage->TexObject->Target == GL_TEXTURE_3D ||
diff --git a/mesalib/src/mesa/swrast_setup/ss_context.c b/mesalib/src/mesa/swrast_setup/ss_context.c
index 384cf425a..9c013a454 100644
--- a/mesalib/src/mesa/swrast_setup/ss_context.c
+++ b/mesalib/src/mesa/swrast_setup/ss_context.c
@@ -1,306 +1,302 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/colormac.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-#include "swrast_setup.h"
-#include "ss_context.h"
-#include "ss_triangle.h"
-
-
-/* Need to check lighting state and vertex program state to know
- * if two-sided lighting is in effect.
- */
-#define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT|_NEW_PROGRAM)
-
-
-#define VARYING_EMIT_STYLE EMIT_4F
-
-
-GLboolean
-_swsetup_CreateContext( struct gl_context *ctx )
-{
- SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext));
-
- if (!swsetup)
- return GL_FALSE;
-
- ctx->swsetup_context = swsetup;
-
- swsetup->NewState = ~0;
- _swsetup_trifuncs_init( ctx );
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- sizeof(SWvertex) );
-
-
- return GL_TRUE;
-}
-
-void
-_swsetup_DestroyContext( struct gl_context *ctx )
-{
- SScontext *swsetup = SWSETUP_CONTEXT(ctx);
-
- if (swsetup) {
- FREE(swsetup);
- ctx->swsetup_context = 0;
- }
-
- _tnl_free_vertices( ctx );
-}
-
-static void
-_swsetup_RenderPrimitive( struct gl_context *ctx, GLenum mode )
-{
- SWSETUP_CONTEXT(ctx)->render_prim = mode;
- _swrast_render_primitive( ctx, mode );
-}
-
-
-/**
- * Helper macros for setup_vertex_format()
- */
-#define SWZ ((SWvertex *)0)
-#define SWOffset(MEMBER) (((char *)&(SWZ->MEMBER)) - ((char *)SWZ))
-
-#define EMIT_ATTR( ATTR, STYLE, MEMBER ) \
-do { \
- map[e].attrib = (ATTR); \
- map[e].format = (STYLE); \
- map[e].offset = SWOffset(MEMBER); \
- e++; \
-} while (0)
-
-
-/**
- * Tell the tnl module how to build SWvertex objects for swrast.
- * We'll build the map[] array with that info and pass it to
- * _tnl_install_attrs().
- */
-static void
-setup_vertex_format(struct gl_context *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- SScontext *swsetup = SWSETUP_CONTEXT(ctx);
- GLboolean intColors = !ctx->FragmentProgram._Current
- && !ctx->ATIFragmentShader._Enabled
- && ctx->RenderMode == GL_RENDER
- && CHAN_TYPE != GL_FLOAT;
-
- if (intColors != swsetup->intColors ||
- !RENDERINPUTS_EQUAL(tnl->render_inputs_bitset,
- swsetup->last_index_bitset)) {
- DECLARE_RENDERINPUTS(index_bitset);
- struct tnl_attr_map map[_TNL_ATTRIB_MAX];
- unsigned int i, e = 0;
-
- swsetup->intColors = intColors;
-
- RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
-
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] );
-
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR0 )) {
- if (swsetup->intColors)
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
- else
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[FRAG_ATTRIB_COL0]);
- }
-
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[FRAG_ATTRIB_COL1]);
- }
-
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
- const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : EMIT_1F;
- EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]);
- }
-
- if (RENDERINPUTS_TEST_RANGE(index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX))
- {
- for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
- EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F,
- attrib[FRAG_ATTRIB_TEX0 + i] );
- }
- }
- }
-
- /* shader varying vars */
- if (RENDERINPUTS_TEST_RANGE( index_bitset,
- _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC )) {
- for (i = 0; i < ctx->Const.MaxVarying; i++) {
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_GENERIC(i) )) {
- EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE,
- attrib[FRAG_ATTRIB_VAR0 + i] );
- }
- }
- }
-
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE ))
- EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize );
-
- _tnl_install_attrs( ctx, map, e,
- ctx->Viewport._WindowMap.m,
- sizeof(SWvertex) );
-
- RENDERINPUTS_COPY( swsetup->last_index_bitset, index_bitset );
- }
-}
-
-
-/**
- * Prepare to render a vertex buffer.
- * Called via tnl->Driver.Render.Start.
- */
-static void
-_swsetup_RenderStart( struct gl_context *ctx )
-{
- SScontext *swsetup = SWSETUP_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
-
- if (swsetup->NewState & _SWSETUP_NEW_RENDERINDEX) {
- _swsetup_choose_trifuncs(ctx);
- }
-
- if (swsetup->NewState & _NEW_PROGRAM) {
- RENDERINPUTS_ZERO( swsetup->last_index_bitset );
- }
-
- swsetup->NewState = 0;
-
- /* This will change if drawing unfilled tris */
- _swrast_SetFacing(ctx, 0);
-
- _swrast_render_start(ctx);
-
- /* Important */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
-
- setup_vertex_format(ctx);
-}
-
-
-/*
- * We patch this function into tnl->Driver.Render.Finish.
- * It's called when we finish rendering a vertex buffer.
- */
-static void
-_swsetup_RenderFinish( struct gl_context *ctx )
-{
- _swrast_render_finish( ctx );
-}
-
-void
-_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state )
-{
- SScontext *swsetup = SWSETUP_CONTEXT(ctx);
- swsetup->NewState |= new_state;
- _tnl_invalidate_vertex_state( ctx, new_state );
-}
-
-
-void
-_swsetup_Wakeup( struct gl_context *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- SScontext *swsetup = SWSETUP_CONTEXT(ctx);
-
- tnl->Driver.Render.Start = _swsetup_RenderStart;
- tnl->Driver.Render.Finish = _swsetup_RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = _swsetup_RenderPrimitive;
- tnl->Driver.Render.Interp = _tnl_interp;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; /* new */
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; /* new */
- /* points */
- /* line */
- /* triangle */
- /* quad */
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.Multipass = 0;
-
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_need_projected_coords( ctx, GL_TRUE );
- _swsetup_InvalidateState( ctx, ~0 );
-
- swsetup->verts = (SWvertex *)tnl->clipspace.vertex_buf;
- RENDERINPUTS_ZERO( swsetup->last_index_bitset );
-}
-
-
-/**
- * Populate a swrast SWvertex from an attrib-style vertex.
- */
-void
-_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest )
-{
- const GLfloat *m = ctx->Viewport._WindowMap.m;
- GLfloat tmp[4];
- GLuint i;
-
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, tmp );
-
- dest->attrib[FRAG_ATTRIB_WPOS][0] = m[0] * tmp[0] + m[12];
- dest->attrib[FRAG_ATTRIB_WPOS][1] = m[5] * tmp[1] + m[13];
- dest->attrib[FRAG_ATTRIB_WPOS][2] = m[10] * tmp[2] + m[14];
- dest->attrib[FRAG_ATTRIB_WPOS][3] = tmp[3];
-
- /** XXX try to limit these loops someday */
- for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0 + i,
- dest->attrib[FRAG_ATTRIB_TEX0 + i] );
-
- for (i = 0 ; i < ctx->Const.MaxVarying ; i++)
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0 + i,
- dest->attrib[FRAG_ATTRIB_VAR0 + i] );
-
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0,
- dest->attrib[FRAG_ATTRIB_COL0] );
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp );
-
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1,
- dest->attrib[FRAG_ATTRIB_COL1]);
-
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp );
- dest->attrib[FRAG_ATTRIB_FOGC][0] = tmp[0];
-
- /* XXX See _tnl_get_attr about pointsize ... */
- _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp );
- dest->pointSize = tmp[0];
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/colormac.h"
+#include "tnl/tnl.h"
+#include "tnl/t_context.h"
+#include "tnl/t_pipeline.h"
+#include "tnl/t_vertex.h"
+#include "swrast_setup.h"
+#include "ss_context.h"
+#include "ss_triangle.h"
+
+
+/* Need to check lighting state and vertex program state to know
+ * if two-sided lighting is in effect.
+ */
+#define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT|_NEW_PROGRAM)
+
+
+#define VARYING_EMIT_STYLE EMIT_4F
+
+
+GLboolean
+_swsetup_CreateContext( struct gl_context *ctx )
+{
+ SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext));
+
+ if (!swsetup)
+ return GL_FALSE;
+
+ ctx->swsetup_context = swsetup;
+
+ swsetup->NewState = ~0;
+ _swsetup_trifuncs_init( ctx );
+
+ _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
+ sizeof(SWvertex) );
+
+
+ return GL_TRUE;
+}
+
+void
+_swsetup_DestroyContext( struct gl_context *ctx )
+{
+ SScontext *swsetup = SWSETUP_CONTEXT(ctx);
+
+ if (swsetup) {
+ FREE(swsetup);
+ ctx->swsetup_context = 0;
+ }
+
+ _tnl_free_vertices( ctx );
+}
+
+static void
+_swsetup_RenderPrimitive( struct gl_context *ctx, GLenum mode )
+{
+ SWSETUP_CONTEXT(ctx)->render_prim = mode;
+ _swrast_render_primitive( ctx, mode );
+}
+
+
+/**
+ * Helper macros for setup_vertex_format()
+ */
+#define SWZ ((SWvertex *)0)
+#define SWOffset(MEMBER) (((char *)&(SWZ->MEMBER)) - ((char *)SWZ))
+
+#define EMIT_ATTR( ATTR, STYLE, MEMBER ) \
+do { \
+ map[e].attrib = (ATTR); \
+ map[e].format = (STYLE); \
+ map[e].offset = SWOffset(MEMBER); \
+ e++; \
+} while (0)
+
+
+/**
+ * Tell the tnl module how to build SWvertex objects for swrast.
+ * We'll build the map[] array with that info and pass it to
+ * _tnl_install_attrs().
+ */
+static void
+setup_vertex_format(struct gl_context *ctx)
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ SScontext *swsetup = SWSETUP_CONTEXT(ctx);
+ GLboolean intColors = !ctx->FragmentProgram._Current
+ && !ctx->ATIFragmentShader._Enabled
+ && ctx->RenderMode == GL_RENDER
+ && CHAN_TYPE != GL_FLOAT;
+
+ if (intColors != swsetup->intColors ||
+ tnl->render_inputs_bitset != swsetup->last_index_bitset) {
+ GLbitfield64 index_bitset = tnl->render_inputs_bitset;
+ struct tnl_attr_map map[_TNL_ATTRIB_MAX];
+ unsigned int i, e = 0;
+
+ swsetup->intColors = intColors;
+
+ EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] );
+
+ if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR0)) {
+ if (swsetup->intColors)
+ EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
+ else
+ EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[FRAG_ATTRIB_COL0]);
+ }
+
+ if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) {
+ EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[FRAG_ATTRIB_COL1]);
+ }
+
+ if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) {
+ const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : EMIT_1F;
+ EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]);
+ }
+
+ if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX))
+ {
+ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+ if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_TEX(i))) {
+ EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F,
+ attrib[FRAG_ATTRIB_TEX0 + i] );
+ }
+ }
+ }
+
+ /* shader varying vars */
+ if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_GENERIC0, _TNL_NUM_GENERIC)) {
+ for (i = 0; i < ctx->Const.MaxVarying; i++) {
+ if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i))) {
+ EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE,
+ attrib[FRAG_ATTRIB_VAR0 + i] );
+ }
+ }
+ }
+
+ if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_POINTSIZE))
+ EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize );
+
+ _tnl_install_attrs( ctx, map, e,
+ ctx->Viewport._WindowMap.m,
+ sizeof(SWvertex) );
+
+ swsetup->last_index_bitset = index_bitset;
+ }
+}
+
+
+/**
+ * Prepare to render a vertex buffer.
+ * Called via tnl->Driver.Render.Start.
+ */
+static void
+_swsetup_RenderStart( struct gl_context *ctx )
+{
+ SScontext *swsetup = SWSETUP_CONTEXT(ctx);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+
+ if (swsetup->NewState & _SWSETUP_NEW_RENDERINDEX) {
+ _swsetup_choose_trifuncs(ctx);
+ }
+
+ if (swsetup->NewState & _NEW_PROGRAM) {
+ swsetup->last_index_bitset = 0;
+ }
+
+ swsetup->NewState = 0;
+
+ /* This will change if drawing unfilled tris */
+ _swrast_SetFacing(ctx, 0);
+
+ _swrast_render_start(ctx);
+
+ /* Important */
+ VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
+
+ setup_vertex_format(ctx);
+}
+
+
+/*
+ * We patch this function into tnl->Driver.Render.Finish.
+ * It's called when we finish rendering a vertex buffer.
+ */
+static void
+_swsetup_RenderFinish( struct gl_context *ctx )
+{
+ _swrast_render_finish( ctx );
+}
+
+void
+_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state )
+{
+ SScontext *swsetup = SWSETUP_CONTEXT(ctx);
+ swsetup->NewState |= new_state;
+ _tnl_invalidate_vertex_state( ctx, new_state );
+}
+
+
+void
+_swsetup_Wakeup( struct gl_context *ctx )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ SScontext *swsetup = SWSETUP_CONTEXT(ctx);
+
+ tnl->Driver.Render.Start = _swsetup_RenderStart;
+ tnl->Driver.Render.Finish = _swsetup_RenderFinish;
+ tnl->Driver.Render.PrimitiveNotify = _swsetup_RenderPrimitive;
+ tnl->Driver.Render.Interp = _tnl_interp;
+ tnl->Driver.Render.CopyPV = _tnl_copy_pv;
+ tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; /* new */
+ tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; /* new */
+ /* points */
+ /* line */
+ /* triangle */
+ /* quad */
+ tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
+ tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
+ tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
+ tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
+ tnl->Driver.Render.Multipass = 0;
+
+ _tnl_invalidate_vertices( ctx, ~0 );
+ _tnl_need_projected_coords( ctx, GL_TRUE );
+ _swsetup_InvalidateState( ctx, ~0 );
+
+ swsetup->verts = (SWvertex *)tnl->clipspace.vertex_buf;
+ swsetup->last_index_bitset = 0;
+}
+
+
+/**
+ * Populate a swrast SWvertex from an attrib-style vertex.
+ */
+void
+_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest )
+{
+ const GLfloat *m = ctx->Viewport._WindowMap.m;
+ GLfloat tmp[4];
+ GLuint i;
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, tmp );
+
+ dest->attrib[FRAG_ATTRIB_WPOS][0] = m[0] * tmp[0] + m[12];
+ dest->attrib[FRAG_ATTRIB_WPOS][1] = m[5] * tmp[1] + m[13];
+ dest->attrib[FRAG_ATTRIB_WPOS][2] = m[10] * tmp[2] + m[14];
+ dest->attrib[FRAG_ATTRIB_WPOS][3] = tmp[3];
+
+ /** XXX try to limit these loops someday */
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0 + i,
+ dest->attrib[FRAG_ATTRIB_TEX0 + i] );
+
+ for (i = 0 ; i < ctx->Const.MaxVarying ; i++)
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0 + i,
+ dest->attrib[FRAG_ATTRIB_VAR0 + i] );
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0,
+ dest->attrib[FRAG_ATTRIB_COL0] );
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp );
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1,
+ dest->attrib[FRAG_ATTRIB_COL1]);
+
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp );
+ dest->attrib[FRAG_ATTRIB_FOGC][0] = tmp[0];
+
+ /* XXX See _tnl_get_attr about pointsize ... */
+ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp );
+ dest->pointSize = tmp[0];
+}
+
diff --git a/mesalib/src/mesa/swrast_setup/ss_context.h b/mesalib/src/mesa/swrast_setup/ss_context.h
index 56551ab27..ecc1f5fd6 100644
--- a/mesalib/src/mesa/swrast_setup/ss_context.h
+++ b/mesalib/src/mesa/swrast_setup/ss_context.h
@@ -35,7 +35,7 @@
typedef struct {
GLuint NewState;
GLenum render_prim;
- DECLARE_RENDERINPUTS(last_index_bitset);
+ GLbitfield64 last_index_bitset;
SWvertex *verts;
GLboolean intColors;
} SScontext;
diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c
index a6da8cafe..1ded44ccf 100644
--- a/mesalib/src/mesa/tnl/t_context.c
+++ b/mesalib/src/mesa/tnl/t_context.c
@@ -121,20 +121,19 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
/* Calculate tnl->render_inputs. This bitmask indicates which vertex
* attributes need to be emitted to the rasterizer.
*/
- RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+ tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS);
if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) {
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0);
}
if (_mesa_need_secondary_color(ctx))
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR1);
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
(fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) {
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i));
}
}
@@ -142,27 +141,26 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
|| (fp != NULL && (fp->Base.InputsRead & FRAG_BIT_FOGC) != 0)) {
/* Either fixed-function fog or a fragment program needs fog coord.
*/
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG);
}
if (ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL)
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_EDGEFLAG );
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_EDGEFLAG);
if (ctx->RenderMode == GL_FEEDBACK)
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 );
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX0);
if (ctx->Point._Attenuated ||
(ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE );
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_POINTSIZE);
/* check for varying vars which are written by the vertex program */
if (vp) {
GLuint i;
for (i = 0; i < MAX_VARYING; i++) {
if (vp->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) {
- RENDERINPUTS_SET(tnl->render_inputs_bitset,
- _TNL_ATTRIB_GENERIC(i));
+ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i));
}
}
}
diff --git a/mesalib/src/mesa/tnl/t_context.h b/mesalib/src/mesa/tnl/t_context.h
index 36b104354..c5a902082 100644
--- a/mesalib/src/mesa/tnl/t_context.h
+++ b/mesalib/src/mesa/tnl/t_context.h
@@ -50,7 +50,7 @@
#define _T_CONTEXT_H
#include "main/glheader.h"
-#include "main/bitset.h"
+#include "main/imports.h"
#include "main/mtypes.h"
#include "math/m_vector.h"
@@ -162,6 +162,9 @@ enum {
#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC0 */
#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES /* GENERIC11 */
+/* Number of available texture attributes */
+#define _TNL_NUM_TEX 8
+
/* Number of available generic attributes */
#define _TNL_NUM_GENERIC 16
@@ -480,19 +483,6 @@ struct tnl_device_driver
};
-#define DECLARE_RENDERINPUTS(name) BITSET64_DECLARE(name, _TNL_ATTRIB_MAX)
-#define RENDERINPUTS_COPY BITSET64_COPY
-#define RENDERINPUTS_EQUAL BITSET64_EQUAL
-#define RENDERINPUTS_ZERO BITSET64_ZERO
-#define RENDERINPUTS_ONES BITSET64_ONES
-#define RENDERINPUTS_TEST BITSET64_TEST
-#define RENDERINPUTS_SET BITSET64_SET
-#define RENDERINPUTS_CLEAR BITSET64_CLEAR
-#define RENDERINPUTS_TEST_RANGE BITSET64_TEST_RANGE
-#define RENDERINPUTS_SET_RANGE BITSET64_SET_RANGE
-#define RENDERINPUTS_CLEAR_RANGE BITSET64_CLEAR_RANGE
-
-
/**
* Context state for T&L context.
*/
@@ -518,7 +508,7 @@ typedef struct
GLboolean AllowPixelFog;
GLboolean _DoVertexFog; /* eval fog function at each vertex? */
- DECLARE_RENDERINPUTS(render_inputs_bitset);
+ GLbitfield64 render_inputs_bitset;
GLvector4f tmp_inputs[VERT_ATTRIB_MAX];
diff --git a/mesalib/src/mesa/tnl/t_rasterpos.c b/mesalib/src/mesa/tnl/t_rasterpos.c
index 78aa8880f..a7e4397b6 100644
--- a/mesalib/src/mesa/tnl/t_rasterpos.c
+++ b/mesalib/src/mesa/tnl/t_rasterpos.c
@@ -1,486 +1,481 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "main/glheader.h"
-#include "main/colormac.h"
-#include "main/feedback.h"
-#include "main/light.h"
-#include "main/macros.h"
-#include "main/simple_list.h"
-#include "main/mtypes.h"
-
-#include "math/m_matrix.h"
-#include "tnl/tnl.h"
-
-
-
-/**
- * Clip a point against the view volume.
- *
- * \param v vertex vector describing the point to clip.
- *
- * \return zero if outside view volume, or one if inside.
- */
-static GLuint
-viewclip_point_xy( const GLfloat v[] )
-{
- if ( v[0] > v[3] || v[0] < -v[3]
- || v[1] > v[3] || v[1] < -v[3] ) {
- return 0;
- }
- else {
- return 1;
- }
-}
-
-
-/**
- * Clip a point against the far/near Z clipping planes.
- *
- * \param v vertex vector describing the point to clip.
- *
- * \return zero if outside view volume, or one if inside.
- */
-static GLuint
-viewclip_point_z( const GLfloat v[] )
-{
- if (v[2] > v[3] || v[2] < -v[3] ) {
- return 0;
- }
- else {
- return 1;
- }
-}
-
-
-/**
- * Clip a point against the user clipping planes.
- *
- * \param ctx GL context.
- * \param v vertex vector describing the point to clip.
- *
- * \return zero if the point was clipped, or one otherwise.
- */
-static GLuint
-userclip_point( struct gl_context *ctx, const GLfloat v[] )
-{
- GLuint p;
-
- for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
- + v[1] * ctx->Transform._ClipUserPlane[p][1]
- + v[2] * ctx->Transform._ClipUserPlane[p][2]
- + v[3] * ctx->Transform._ClipUserPlane[p][3];
- if (dot < 0.0F) {
- return 0;
- }
- }
- }
-
- return 1;
-}
-
-
-/**
- * Compute lighting for the raster position. Both RGB and CI modes computed.
- * \param ctx the context
- * \param vertex vertex location
- * \param normal normal vector
- * \param Rcolor returned color
- * \param Rspec returned specular color (if separate specular enabled)
- * \param Rindex returned color index
- */
-static void
-shade_rastpos(struct gl_context *ctx,
- const GLfloat vertex[4],
- const GLfloat normal[3],
- GLfloat Rcolor[4],
- GLfloat Rspec[4])
-{
- /*const*/ GLfloat (*base)[3] = ctx->Light._BaseColor;
- const struct gl_light *light;
- GLfloat diffuseColor[4], specularColor[4]; /* for RGB mode only */
- GLfloat diffuseCI = 0.0, specularCI = 0.0; /* for CI mode only */
-
- _mesa_validate_all_lighting_tables( ctx );
-
- COPY_3V(diffuseColor, base[0]);
- diffuseColor[3] = CLAMP(
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F );
- ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 1.0);
-
- foreach (light, &ctx->Light.EnabledList) {
- GLfloat attenuation = 1.0;
- GLfloat VP[3]; /* vector from vertex to light pos */
- GLfloat n_dot_VP;
- GLfloat diffuseContrib[3], specularContrib[3];
-
- if (!(light->_Flags & LIGHT_POSITIONAL)) {
- /* light at infinity */
- COPY_3V(VP, light->_VP_inf_norm);
- attenuation = light->_VP_inf_spot_attenuation;
- }
- else {
- /* local/positional light */
- GLfloat d;
-
- /* VP = vector from vertex pos to light[i].pos */
- SUB_3V(VP, light->_Position, vertex);
- /* d = length(VP) */
- d = (GLfloat) LEN_3FV( VP );
- if (d > 1.0e-6) {
- /* normalize VP */
- GLfloat invd = 1.0F / d;
- SELF_SCALE_SCALAR_3V(VP, invd);
- }
-
- /* atti */
- attenuation = 1.0F / (light->ConstantAttenuation + d *
- (light->LinearAttenuation + d *
- light->QuadraticAttenuation));
-
- if (light->_Flags & LIGHT_SPOT) {
- GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
-
- if (PV_dot_dir<light->_CosCutoff) {
- continue;
- }
- else {
- double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- int k = (int) x;
- GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
- + (x-k)*light->_SpotExpTable[k][1]);
- attenuation *= spot;
- }
- }
- }
-
- if (attenuation < 1e-3)
- continue;
-
- n_dot_VP = DOT3( normal, VP );
-
- if (n_dot_VP < 0.0F) {
- ACC_SCALE_SCALAR_3V(diffuseColor, attenuation, light->_MatAmbient[0]);
- continue;
- }
-
- /* Ambient + diffuse */
- COPY_3V(diffuseContrib, light->_MatAmbient[0]);
- ACC_SCALE_SCALAR_3V(diffuseContrib, n_dot_VP, light->_MatDiffuse[0]);
- diffuseCI += n_dot_VP * light->_dli * attenuation;
-
- /* Specular */
- {
- const GLfloat *h;
- GLfloat n_dot_h;
-
- ASSIGN_3V(specularContrib, 0.0, 0.0, 0.0);
-
- if (ctx->Light.Model.LocalViewer) {
- GLfloat v[3];
- COPY_3V(v, vertex);
- NORMALIZE_3FV(v);
- SUB_3V(VP, VP, v);
- NORMALIZE_3FV(VP);
- h = VP;
- }
- else if (light->_Flags & LIGHT_POSITIONAL) {
- ACC_3V(VP, ctx->_EyeZDir);
- NORMALIZE_3FV(VP);
- h = VP;
- }
- else {
- h = light->_h_inf_norm;
- }
-
- n_dot_h = DOT3(normal, h);
-
- if (n_dot_h > 0.0F) {
- GLfloat spec_coef;
- GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef );
-
- if (spec_coef > 1.0e-10) {
- if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
- ACC_SCALE_SCALAR_3V( specularContrib, spec_coef,
- light->_MatSpecular[0]);
- }
- else {
- ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef,
- light->_MatSpecular[0]);
- }
- /*assert(light->_sli > 0.0);*/
- specularCI += spec_coef * light->_sli * attenuation;
- }
- }
- }
-
- ACC_SCALE_SCALAR_3V( diffuseColor, attenuation, diffuseContrib );
- ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib );
- }
-
- Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F);
- Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F);
- Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F);
- Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F);
- Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F);
- Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F);
- Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F);
- Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F);
-}
-
-
-/**
- * Do texgen needed for glRasterPos.
- * \param ctx rendering context
- * \param vObj object-space vertex coordinate
- * \param vEye eye-space vertex coordinate
- * \param normal vertex normal
- * \param unit texture unit number
- * \param texcoord incoming texcoord and resulting texcoord
- */
-static void
-compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
- const GLfloat normal[3], GLuint unit, GLfloat texcoord[4])
-{
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- /* always compute sphere map terms, just in case */
- GLfloat u[3], two_nu, rx, ry, rz, m, mInv;
- COPY_3V(u, vEye);
- NORMALIZE_3FV(u);
- two_nu = 2.0F * DOT3(normal, u);
- rx = u[0] - normal[0] * two_nu;
- ry = u[1] - normal[1] * two_nu;
- rz = u[2] - normal[2] * two_nu;
- m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F);
- if (m > 0.0F)
- mInv = 0.5F * _mesa_inv_sqrtf(m);
- else
- mInv = 0.0F;
-
- if (texUnit->TexGenEnabled & S_BIT) {
- switch (texUnit->GenS.Mode) {
- case GL_OBJECT_LINEAR:
- texcoord[0] = DOT4(vObj, texUnit->GenS.ObjectPlane);
- break;
- case GL_EYE_LINEAR:
- texcoord[0] = DOT4(vEye, texUnit->GenS.EyePlane);
- break;
- case GL_SPHERE_MAP:
- texcoord[0] = rx * mInv + 0.5F;
- break;
- case GL_REFLECTION_MAP:
- texcoord[0] = rx;
- break;
- case GL_NORMAL_MAP:
- texcoord[0] = normal[0];
- break;
- default:
- _mesa_problem(ctx, "Bad S texgen in compute_texgen()");
- return;
- }
- }
-
- if (texUnit->TexGenEnabled & T_BIT) {
- switch (texUnit->GenT.Mode) {
- case GL_OBJECT_LINEAR:
- texcoord[1] = DOT4(vObj, texUnit->GenT.ObjectPlane);
- break;
- case GL_EYE_LINEAR:
- texcoord[1] = DOT4(vEye, texUnit->GenT.EyePlane);
- break;
- case GL_SPHERE_MAP:
- texcoord[1] = ry * mInv + 0.5F;
- break;
- case GL_REFLECTION_MAP:
- texcoord[1] = ry;
- break;
- case GL_NORMAL_MAP:
- texcoord[1] = normal[1];
- break;
- default:
- _mesa_problem(ctx, "Bad T texgen in compute_texgen()");
- return;
- }
- }
-
- if (texUnit->TexGenEnabled & R_BIT) {
- switch (texUnit->GenR.Mode) {
- case GL_OBJECT_LINEAR:
- texcoord[2] = DOT4(vObj, texUnit->GenR.ObjectPlane);
- break;
- case GL_EYE_LINEAR:
- texcoord[2] = DOT4(vEye, texUnit->GenR.EyePlane);
- break;
- case GL_REFLECTION_MAP:
- texcoord[2] = rz;
- break;
- case GL_NORMAL_MAP:
- texcoord[2] = normal[2];
- break;
- default:
- _mesa_problem(ctx, "Bad R texgen in compute_texgen()");
- return;
- }
- }
-
- if (texUnit->TexGenEnabled & Q_BIT) {
- switch (texUnit->GenQ.Mode) {
- case GL_OBJECT_LINEAR:
- texcoord[3] = DOT4(vObj, texUnit->GenQ.ObjectPlane);
- break;
- case GL_EYE_LINEAR:
- texcoord[3] = DOT4(vEye, texUnit->GenQ.EyePlane);
- break;
- default:
- _mesa_problem(ctx, "Bad Q texgen in compute_texgen()");
- return;
- }
- }
-}
-
-
-/**
- * glRasterPos transformation. Typically called via ctx->Driver.RasterPos().
- * XXX some of this code (such as viewport xform, clip testing and setting
- * of ctx->Current.Raster* fields) could get lifted up into the
- * main/rasterpos.c code.
- *
- * \param vObj vertex position in object space
- */
-void
-_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
-{
- if (ctx->VertexProgram._Enabled) {
- /* XXX implement this */
- _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
- return;
- }
- else {
- GLfloat eye[4], clip[4], ndc[3], d;
- GLfloat *norm, eyenorm[3];
- GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
-
- /* apply modelview matrix: eye = MV * obj */
- TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, vObj );
- /* apply projection matrix: clip = Proj * eye */
- TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye );
-
- /* clip to view volume. */
- if (!ctx->Transform.DepthClamp) {
- if (viewclip_point_z(clip) == 0) {
- ctx->Current.RasterPosValid = GL_FALSE;
- return;
- }
- }
- if (!ctx->Transform.RasterPositionUnclipped) {
- if (viewclip_point_xy(clip) == 0) {
- ctx->Current.RasterPosValid = GL_FALSE;
- return;
- }
- }
-
- /* clip to user clipping planes */
- if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) {
- ctx->Current.RasterPosValid = GL_FALSE;
- return;
- }
-
- /* ndc = clip / W */
- d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3];
- ndc[0] = clip[0] * d;
- ndc[1] = clip[1] * d;
- ndc[2] = clip[2] * d;
- /* wincoord = viewport_mapping(ndc) */
- ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX]
- + ctx->Viewport._WindowMap.m[MAT_TX]);
- ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY]
- + ctx->Viewport._WindowMap.m[MAT_TY]);
- ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ]
- + ctx->Viewport._WindowMap.m[MAT_TZ])
- / ctx->DrawBuffer->_DepthMaxF;
- ctx->Current.RasterPos[3] = clip[3];
-
- if (ctx->Transform.DepthClamp) {
- ctx->Current.RasterPos[3] = CLAMP(ctx->Current.RasterPos[3],
- ctx->Viewport.Near,
- ctx->Viewport.Far);
- }
-
- /* compute raster distance */
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
- ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
- else
- ctx->Current.RasterDistance =
- SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
-
- /* compute transformed normal vector (for lighting or texgen) */
- if (ctx->_NeedEyeCoords) {
- const GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv;
- TRANSFORM_NORMAL( eyenorm, objnorm, inv );
- norm = eyenorm;
- }
- else {
- norm = objnorm;
- }
-
- /* update raster color */
- if (ctx->Light.Enabled) {
- /* lighting */
- shade_rastpos( ctx, vObj, norm,
- ctx->Current.RasterColor,
- ctx->Current.RasterSecondaryColor );
- }
- else {
- /* use current color */
- COPY_4FV(ctx->Current.RasterColor,
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
- COPY_4FV(ctx->Current.RasterSecondaryColor,
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
- }
-
- /* texture coords */
- {
- GLuint u;
- for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
- GLfloat tc[4];
- COPY_4V(tc, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]);
- if (ctx->Texture.Unit[u].TexGenEnabled) {
- compute_texgen(ctx, vObj, eye, norm, u, tc);
- }
- TRANSFORM_POINT(ctx->Current.RasterTexCoords[u],
- ctx->TextureMatrixStack[u].Top->m, tc);
- }
- }
-
- ctx->Current.RasterPosValid = GL_TRUE;
- }
-
- if (ctx->RenderMode == GL_SELECT) {
- _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
- }
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/feedback.h"
+#include "main/light.h"
+#include "main/macros.h"
+#include "main/simple_list.h"
+#include "main/mtypes.h"
+
+#include "math/m_matrix.h"
+#include "tnl/tnl.h"
+
+
+
+/**
+ * Clip a point against the view volume.
+ *
+ * \param v vertex vector describing the point to clip.
+ *
+ * \return zero if outside view volume, or one if inside.
+ */
+static GLuint
+viewclip_point_xy( const GLfloat v[] )
+{
+ if ( v[0] > v[3] || v[0] < -v[3]
+ || v[1] > v[3] || v[1] < -v[3] ) {
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
+
+/**
+ * Clip a point against the far/near Z clipping planes.
+ *
+ * \param v vertex vector describing the point to clip.
+ *
+ * \return zero if outside view volume, or one if inside.
+ */
+static GLuint
+viewclip_point_z( const GLfloat v[] )
+{
+ if (v[2] > v[3] || v[2] < -v[3] ) {
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
+
+/**
+ * Clip a point against the user clipping planes.
+ *
+ * \param ctx GL context.
+ * \param v vertex vector describing the point to clip.
+ *
+ * \return zero if the point was clipped, or one otherwise.
+ */
+static GLuint
+userclip_point( struct gl_context *ctx, const GLfloat v[] )
+{
+ GLuint p;
+
+ for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
+ + v[1] * ctx->Transform._ClipUserPlane[p][1]
+ + v[2] * ctx->Transform._ClipUserPlane[p][2]
+ + v[3] * ctx->Transform._ClipUserPlane[p][3];
+ if (dot < 0.0F) {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+
+/**
+ * Compute lighting for the raster position. RGB modes computed.
+ * \param ctx the context
+ * \param vertex vertex location
+ * \param normal normal vector
+ * \param Rcolor returned color
+ * \param Rspec returned specular color (if separate specular enabled)
+ */
+static void
+shade_rastpos(struct gl_context *ctx,
+ const GLfloat vertex[4],
+ const GLfloat normal[3],
+ GLfloat Rcolor[4],
+ GLfloat Rspec[4])
+{
+ /*const*/ GLfloat (*base)[3] = ctx->Light._BaseColor;
+ const struct gl_light *light;
+ GLfloat diffuseColor[4], specularColor[4]; /* for RGB mode only */
+
+ _mesa_validate_all_lighting_tables( ctx );
+
+ COPY_3V(diffuseColor, base[0]);
+ diffuseColor[3] = CLAMP(
+ ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F );
+ ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 1.0);
+
+ foreach (light, &ctx->Light.EnabledList) {
+ GLfloat attenuation = 1.0;
+ GLfloat VP[3]; /* vector from vertex to light pos */
+ GLfloat n_dot_VP;
+ GLfloat diffuseContrib[3], specularContrib[3];
+
+ if (!(light->_Flags & LIGHT_POSITIONAL)) {
+ /* light at infinity */
+ COPY_3V(VP, light->_VP_inf_norm);
+ attenuation = light->_VP_inf_spot_attenuation;
+ }
+ else {
+ /* local/positional light */
+ GLfloat d;
+
+ /* VP = vector from vertex pos to light[i].pos */
+ SUB_3V(VP, light->_Position, vertex);
+ /* d = length(VP) */
+ d = (GLfloat) LEN_3FV( VP );
+ if (d > 1.0e-6) {
+ /* normalize VP */
+ GLfloat invd = 1.0F / d;
+ SELF_SCALE_SCALAR_3V(VP, invd);
+ }
+
+ /* atti */
+ attenuation = 1.0F / (light->ConstantAttenuation + d *
+ (light->LinearAttenuation + d *
+ light->QuadraticAttenuation));
+
+ if (light->_Flags & LIGHT_SPOT) {
+ GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
+
+ if (PV_dot_dir<light->_CosCutoff) {
+ continue;
+ }
+ else {
+ double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
+ int k = (int) x;
+ GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
+ + (x-k)*light->_SpotExpTable[k][1]);
+ attenuation *= spot;
+ }
+ }
+ }
+
+ if (attenuation < 1e-3)
+ continue;
+
+ n_dot_VP = DOT3( normal, VP );
+
+ if (n_dot_VP < 0.0F) {
+ ACC_SCALE_SCALAR_3V(diffuseColor, attenuation, light->_MatAmbient[0]);
+ continue;
+ }
+
+ /* Ambient + diffuse */
+ COPY_3V(diffuseContrib, light->_MatAmbient[0]);
+ ACC_SCALE_SCALAR_3V(diffuseContrib, n_dot_VP, light->_MatDiffuse[0]);
+
+ /* Specular */
+ {
+ const GLfloat *h;
+ GLfloat n_dot_h;
+
+ ASSIGN_3V(specularContrib, 0.0, 0.0, 0.0);
+
+ if (ctx->Light.Model.LocalViewer) {
+ GLfloat v[3];
+ COPY_3V(v, vertex);
+ NORMALIZE_3FV(v);
+ SUB_3V(VP, VP, v);
+ NORMALIZE_3FV(VP);
+ h = VP;
+ }
+ else if (light->_Flags & LIGHT_POSITIONAL) {
+ ACC_3V(VP, ctx->_EyeZDir);
+ NORMALIZE_3FV(VP);
+ h = VP;
+ }
+ else {
+ h = light->_h_inf_norm;
+ }
+
+ n_dot_h = DOT3(normal, h);
+
+ if (n_dot_h > 0.0F) {
+ GLfloat spec_coef;
+ GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef );
+
+ if (spec_coef > 1.0e-10) {
+ if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
+ ACC_SCALE_SCALAR_3V( specularContrib, spec_coef,
+ light->_MatSpecular[0]);
+ }
+ else {
+ ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef,
+ light->_MatSpecular[0]);
+ }
+ }
+ }
+ }
+
+ ACC_SCALE_SCALAR_3V( diffuseColor, attenuation, diffuseContrib );
+ ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib );
+ }
+
+ Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F);
+ Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F);
+ Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F);
+ Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F);
+ Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F);
+ Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F);
+ Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F);
+ Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F);
+}
+
+
+/**
+ * Do texgen needed for glRasterPos.
+ * \param ctx rendering context
+ * \param vObj object-space vertex coordinate
+ * \param vEye eye-space vertex coordinate
+ * \param normal vertex normal
+ * \param unit texture unit number
+ * \param texcoord incoming texcoord and resulting texcoord
+ */
+static void
+compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
+ const GLfloat normal[3], GLuint unit, GLfloat texcoord[4])
+{
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+
+ /* always compute sphere map terms, just in case */
+ GLfloat u[3], two_nu, rx, ry, rz, m, mInv;
+ COPY_3V(u, vEye);
+ NORMALIZE_3FV(u);
+ two_nu = 2.0F * DOT3(normal, u);
+ rx = u[0] - normal[0] * two_nu;
+ ry = u[1] - normal[1] * two_nu;
+ rz = u[2] - normal[2] * two_nu;
+ m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F);
+ if (m > 0.0F)
+ mInv = 0.5F * _mesa_inv_sqrtf(m);
+ else
+ mInv = 0.0F;
+
+ if (texUnit->TexGenEnabled & S_BIT) {
+ switch (texUnit->GenS.Mode) {
+ case GL_OBJECT_LINEAR:
+ texcoord[0] = DOT4(vObj, texUnit->GenS.ObjectPlane);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[0] = DOT4(vEye, texUnit->GenS.EyePlane);
+ break;
+ case GL_SPHERE_MAP:
+ texcoord[0] = rx * mInv + 0.5F;
+ break;
+ case GL_REFLECTION_MAP:
+ texcoord[0] = rx;
+ break;
+ case GL_NORMAL_MAP:
+ texcoord[0] = normal[0];
+ break;
+ default:
+ _mesa_problem(ctx, "Bad S texgen in compute_texgen()");
+ return;
+ }
+ }
+
+ if (texUnit->TexGenEnabled & T_BIT) {
+ switch (texUnit->GenT.Mode) {
+ case GL_OBJECT_LINEAR:
+ texcoord[1] = DOT4(vObj, texUnit->GenT.ObjectPlane);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[1] = DOT4(vEye, texUnit->GenT.EyePlane);
+ break;
+ case GL_SPHERE_MAP:
+ texcoord[1] = ry * mInv + 0.5F;
+ break;
+ case GL_REFLECTION_MAP:
+ texcoord[1] = ry;
+ break;
+ case GL_NORMAL_MAP:
+ texcoord[1] = normal[1];
+ break;
+ default:
+ _mesa_problem(ctx, "Bad T texgen in compute_texgen()");
+ return;
+ }
+ }
+
+ if (texUnit->TexGenEnabled & R_BIT) {
+ switch (texUnit->GenR.Mode) {
+ case GL_OBJECT_LINEAR:
+ texcoord[2] = DOT4(vObj, texUnit->GenR.ObjectPlane);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[2] = DOT4(vEye, texUnit->GenR.EyePlane);
+ break;
+ case GL_REFLECTION_MAP:
+ texcoord[2] = rz;
+ break;
+ case GL_NORMAL_MAP:
+ texcoord[2] = normal[2];
+ break;
+ default:
+ _mesa_problem(ctx, "Bad R texgen in compute_texgen()");
+ return;
+ }
+ }
+
+ if (texUnit->TexGenEnabled & Q_BIT) {
+ switch (texUnit->GenQ.Mode) {
+ case GL_OBJECT_LINEAR:
+ texcoord[3] = DOT4(vObj, texUnit->GenQ.ObjectPlane);
+ break;
+ case GL_EYE_LINEAR:
+ texcoord[3] = DOT4(vEye, texUnit->GenQ.EyePlane);
+ break;
+ default:
+ _mesa_problem(ctx, "Bad Q texgen in compute_texgen()");
+ return;
+ }
+ }
+}
+
+
+/**
+ * glRasterPos transformation. Typically called via ctx->Driver.RasterPos().
+ * XXX some of this code (such as viewport xform, clip testing and setting
+ * of ctx->Current.Raster* fields) could get lifted up into the
+ * main/rasterpos.c code.
+ *
+ * \param vObj vertex position in object space
+ */
+void
+_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
+{
+ if (ctx->VertexProgram._Enabled) {
+ /* XXX implement this */
+ _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
+ return;
+ }
+ else {
+ GLfloat eye[4], clip[4], ndc[3], d;
+ GLfloat *norm, eyenorm[3];
+ GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
+
+ /* apply modelview matrix: eye = MV * obj */
+ TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, vObj );
+ /* apply projection matrix: clip = Proj * eye */
+ TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye );
+
+ /* clip to view volume. */
+ if (!ctx->Transform.DepthClamp) {
+ if (viewclip_point_z(clip) == 0) {
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
+ }
+ }
+ if (!ctx->Transform.RasterPositionUnclipped) {
+ if (viewclip_point_xy(clip) == 0) {
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
+ }
+ }
+
+ /* clip to user clipping planes */
+ if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) {
+ ctx->Current.RasterPosValid = GL_FALSE;
+ return;
+ }
+
+ /* ndc = clip / W */
+ d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3];
+ ndc[0] = clip[0] * d;
+ ndc[1] = clip[1] * d;
+ ndc[2] = clip[2] * d;
+ /* wincoord = viewport_mapping(ndc) */
+ ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX]
+ + ctx->Viewport._WindowMap.m[MAT_TX]);
+ ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY]
+ + ctx->Viewport._WindowMap.m[MAT_TY]);
+ ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ]
+ + ctx->Viewport._WindowMap.m[MAT_TZ])
+ / ctx->DrawBuffer->_DepthMaxF;
+ ctx->Current.RasterPos[3] = clip[3];
+
+ if (ctx->Transform.DepthClamp) {
+ ctx->Current.RasterPos[3] = CLAMP(ctx->Current.RasterPos[3],
+ ctx->Viewport.Near,
+ ctx->Viewport.Far);
+ }
+
+ /* compute raster distance */
+ if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
+ ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+ else
+ ctx->Current.RasterDistance =
+ SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
+
+ /* compute transformed normal vector (for lighting or texgen) */
+ if (ctx->_NeedEyeCoords) {
+ const GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv;
+ TRANSFORM_NORMAL( eyenorm, objnorm, inv );
+ norm = eyenorm;
+ }
+ else {
+ norm = objnorm;
+ }
+
+ /* update raster color */
+ if (ctx->Light.Enabled) {
+ /* lighting */
+ shade_rastpos( ctx, vObj, norm,
+ ctx->Current.RasterColor,
+ ctx->Current.RasterSecondaryColor );
+ }
+ else {
+ /* use current color */
+ COPY_4FV(ctx->Current.RasterColor,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ COPY_4FV(ctx->Current.RasterSecondaryColor,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
+ }
+
+ /* texture coords */
+ {
+ GLuint u;
+ for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
+ GLfloat tc[4];
+ COPY_4V(tc, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]);
+ if (ctx->Texture.Unit[u].TexGenEnabled) {
+ compute_texgen(ctx, vObj, eye, norm, u, tc);
+ }
+ TRANSFORM_POINT(ctx->Current.RasterTexCoords[u],
+ ctx->TextureMatrixStack[u].Top->m, tc);
+ }
+ }
+
+ ctx->Current.RasterPosValid = GL_TRUE;
+ }
+
+ if (ctx->RenderMode == GL_SELECT) {
+ _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] );
+ }
+}
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index b2e6bbc12..d83f2fd23 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -176,17 +176,14 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
{
GLuint i;
- /* When no vertex program, pull in the material attributes in
- * the generic range.
- */
- for (i = 0; i < VERT_ATTRIB_FF_MAX; i++)
+ /* identity mapping */
+ for (i = 0; i < Elements(vbo->map_vp_none); i++)
vbo->map_vp_none[i] = i;
+ /* map material attribs to generic slots */
for (i = 0; i < NR_MAT_ATTRIBS; i++)
vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)]
= VBO_ATTRIB_MAT_FRONT_AMBIENT + i;
- for (i = NR_MAT_ATTRIBS; i < VERT_ATTRIB_GENERIC_MAX; i++)
- vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)] = i;
-
+
for (i = 0; i < Elements(vbo->map_vp_arb); i++)
vbo->map_vp_arb[i] = i;
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h
index cfed8e86d..f6ede99cd 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.h
+++ b/mesalib/src/mesa/vbo/vbo_exec.h
@@ -78,12 +78,26 @@ struct vbo_exec_copied_vtx {
};
+/** Used to signal when transitioning from one kind of drawing method
+ * to another.
+ */
+enum draw_method
+{
+ DRAW_NONE, /**< Initial value only */
+ DRAW_BEGIN_END,
+ DRAW_DISPLAY_LIST,
+ DRAW_ARRAYS
+};
+
+
struct vbo_exec_context
{
struct gl_context *ctx;
GLvertexformat vtxfmt;
GLvertexformat vtxfmt_noop;
+ enum draw_method last_draw_method;
+
struct {
struct gl_buffer_object *bufferobj;
@@ -122,12 +136,6 @@ struct vbo_exec_context
} eval;
struct {
- /* These just mirror the current arrayobj (todo: make arrayobj
- * look like this and remove the mirror):
- */
- const struct gl_client_array *legacy_array[VERT_ATTRIB_FF_MAX];
- const struct gl_client_array *generic_array[VERT_ATTRIB_GENERIC_MAX];
-
/* Arrays and current values manipulated according to program
* mode, etc. These are the attributes as seen by vertex
* programs:
@@ -164,6 +172,28 @@ void vbo_exec_array_destroy( struct vbo_exec_context *exec );
void vbo_exec_vtx_init( struct vbo_exec_context *exec );
void vbo_exec_vtx_destroy( struct vbo_exec_context *exec );
+
+/**
+ * This is called by glBegin, glDrawArrays and glDrawElements (and
+ * variations of those calls). When we transition from immediate mode
+ * drawing to array drawing we need to invalidate the array state.
+ *
+ * glBegin/End builds vertex arrays. Those arrays may look identical
+ * to glDrawArrays arrays except that the position of the elements may
+ * be different. For example, arrays of (position3v, normal3f) vs. arrays
+ * of (normal3f, position3f). So we need to make sure we notify drivers
+ * that arrays may be changing.
+ */
+static inline void
+vbo_draw_method(struct vbo_exec_context *exec, enum draw_method method)
+{
+ if (exec->last_draw_method != method) {
+ exec->ctx->NewState |= _NEW_ARRAY;
+ exec->last_draw_method = method;
+ }
+}
+
+
#if FEATURE_beginend
void vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap );
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 4be016925..cb5f9ae52 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -701,6 +701,8 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
return;
}
+ vbo_draw_method(exec, DRAW_BEGIN_END);
+
if (ctx->Driver.PrepareExecBegin)
ctx->Driver.PrepareExecBegin(ctx);
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index a6e41e9c5..2db85e2e5 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -332,6 +332,7 @@ print_draw_arrays(struct gl_context *ctx,
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
+ struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
int i;
printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
@@ -347,7 +348,7 @@ print_draw_arrays(struct gl_context *ctx,
exec->array.inputs[i]->Size,
stride,
/*exec->array.inputs[i]->Enabled,*/
- exec->array.legacy_array[i]->Enabled,
+ arrayObj->VertexAttrib[VERT_ATTRIB_FF(i)].Enabled,
exec->array.inputs[i]->Ptr,
bufName);
@@ -372,30 +373,6 @@ print_draw_arrays(struct gl_context *ctx,
/**
- * Bind the VBO executor to the current vertex array object prior
- * to drawing.
- *
- * Just translate the arrayobj into a sane layout.
- */
-static void
-bind_array_obj(struct gl_context *ctx)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct vbo_exec_context *exec = &vbo->exec;
- struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
- GLuint i;
-
- for (i = 0; i < VERT_ATTRIB_FF_MAX; i++)
- exec->array.legacy_array[i] = &arrayObj->VertexAttrib[VERT_ATTRIB_FF(i)];
-
- for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
- assert(i < Elements(exec->array.generic_array));
- exec->array.generic_array[i] = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
- }
-}
-
-
-/**
* Set the vbo->exec->inputs[] pointers to point to the enabled
* vertex arrays. This depends on the current vertex program/shader
* being executed because of whether or not generic vertex arrays
@@ -408,6 +385,7 @@ recalculate_input_bindings(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
+ struct gl_client_array *vertexAttrib = ctx->Array.ArrayObj->VertexAttrib;
const struct gl_client_array **inputs = &exec->array.inputs[0];
GLbitfield64 const_inputs = 0x0;
GLuint i;
@@ -420,8 +398,8 @@ recalculate_input_bindings(struct gl_context *ctx)
* are available as per-vertex attributes.
*/
for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
- if (exec->array.legacy_array[i]->Enabled)
- inputs[i] = exec->array.legacy_array[i];
+ if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
+ inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
else {
inputs[i] = &vbo->legacy_currval[i];
const_inputs |= VERT_BIT(i);
@@ -457,10 +435,10 @@ recalculate_input_bindings(struct gl_context *ctx)
*/
for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
if (i < VERT_ATTRIB_GENERIC_MAX
- && exec->array.generic_array[i]->Enabled)
- inputs[i] = exec->array.generic_array[i];
- else if (exec->array.legacy_array[i]->Enabled)
- inputs[i] = exec->array.legacy_array[i];
+ && vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
+ inputs[i] = &vertexAttrib[VERT_ATTRIB_GENERIC(i)];
+ else if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
+ inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
else {
inputs[i] = &vbo->legacy_currval[i];
const_inputs |= VERT_BIT_FF(i);
@@ -486,18 +464,18 @@ recalculate_input_bindings(struct gl_context *ctx)
* generic attributes in the generic slots and materials are not
* available as per-vertex attributes.
*/
- if (exec->array.generic_array[0]->Enabled)
- inputs[0] = exec->array.generic_array[0];
- else if (exec->array.legacy_array[0]->Enabled)
- inputs[0] = exec->array.legacy_array[0];
+ if (vertexAttrib[VERT_ATTRIB_GENERIC0].Enabled)
+ inputs[0] = &vertexAttrib[VERT_ATTRIB_GENERIC0];
+ else if (vertexAttrib[VERT_ATTRIB_POS].Enabled)
+ inputs[0] = &vertexAttrib[VERT_ATTRIB_POS];
else {
inputs[0] = &vbo->legacy_currval[0];
const_inputs |= VERT_BIT_POS;
}
for (i = 1; i < VERT_ATTRIB_FF_MAX; i++) {
- if (exec->array.legacy_array[i]->Enabled)
- inputs[i] = exec->array.legacy_array[i];
+ if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
+ inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
else {
inputs[i] = &vbo->legacy_currval[i];
const_inputs |= VERT_BIT_FF(i);
@@ -505,8 +483,8 @@ recalculate_input_bindings(struct gl_context *ctx)
}
for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) {
- if (exec->array.generic_array[i]->Enabled)
- inputs[VERT_ATTRIB_GENERIC(i)] = exec->array.generic_array[i];
+ if (vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vertexAttrib[VERT_ATTRIB_GENERIC(i)];
else {
inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i];
const_inputs |= VERT_BIT_GENERIC(i);
@@ -536,7 +514,6 @@ vbo_bind_arrays(struct gl_context *ctx)
return;
}
- bind_array_obj(ctx);
recalculate_input_bindings(ctx);
ctx->Array.RebindArrays = GL_FALSE;
}
@@ -558,6 +535,8 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
vbo_bind_arrays(ctx);
+ vbo_draw_method(exec, DRAW_ARRAYS);
+
/* Again... because we may have changed the bitmask of per-vertex varying
* attributes. If we regenerate the fixed-function vertex program now
* we may be able to prune down the number of vertex attributes which we
@@ -773,6 +752,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
vbo_bind_arrays( ctx );
+ vbo_draw_method(exec, DRAW_ARRAYS);
+
/* check for dirty state again */
if (ctx->NewState)
_mesa_update_state( ctx );
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index fa93ca48f..9f0290561 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -248,6 +248,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
const struct vbo_save_vertex_list *node =
(const struct vbo_save_vertex_list *) data;
struct vbo_save_context *save = &vbo_context(ctx)->save;
+ struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
FLUSH_CURRENT(ctx, 0);
@@ -286,6 +287,8 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
vbo_bind_vertex_list( ctx, node );
+ vbo_draw_method(exec, DRAW_DISPLAY_LIST);
+
/* Again...
*/
if (ctx->NewState)